Re: 關於 PICFORTH
|
||||
---|---|---|---|---|
新會員
|
切 bank 是 mcu 的硬體設計 誰也沒辦法改變
會比c小 用 asm 寫 常忘了切bank 我試過比較 會比asm 大一點 畢竟 asm 完全控制程序 但又有點累
發表於: 2007/10/23 1:41
|
|||
|
Re: 關於 PICFORTH
|
||||
---|---|---|---|---|
新會員
|
好玩麻
這是 201 lab6 的題目 我覺得 可以較省code 用 asm 寫 常常 bank 忘了切
: init
發表於: 2007/10/21 9:44
|
|||
|
Re: 關於 PICFORTH
|
||||
---|---|---|---|---|
新會員
|
使用 patch -p1
=== patch picforth.fs 1.2.5 ========= --- picforth.fs Wed Dec 29 20:31:50 2004 +++ \temp\picforth-1.2.5\picforth.fs Tue Oct 16 16:46:58 2007 @@ -171,7 +171,7 @@ bank0 host - +70 data-org \ tcompile is the equivalent of state for the cross-compiler : set true swap ! ; @@ -187,12 +187,22 @@ variable current-bank : bank ( a -- n ) 180 and ; +: chkfile ( a -- tf) + dup + 7b and 00 xor 0= \ 0 4 and fb =0 + over + 76 and 02 xor 0= \ a b 2 3 and f6 , xor 02 =0 + or swap + 70 and 70 xor 0= + or +; : check-bank ( a -- a ) tcompile? if exit then \ The compiler takes care of banks + dup chkfile 0<> if exit then dup bank current-bank @ <> if - s" wrong bank may be selected" warning - then ; + s" wrong bank may be selected" warning + then ; \ We are not being strict here. At this time, we assume that all the \ code fits in 8kwords (13 bits addressing) and that main data fits in one @@ -446,9 +456,10 @@ : nop 000 cs, ; : retfie 009 cs, ; : check-default-bank ( -- ) - current-bank @ if - s" call, goto or return with possible non-0 bank selected" warning - then ; +\ current-bank @ if +\ s" call, goto or return with possible non-0 bank selected" warning +\ then ; +; : return check-default-bank 008 cs, ; : sleep 063 cs, ; @@ -1046,7 +1057,7 @@ : t-name ( addr -- ) 3 cells + @ count ; : t-previous ( addr -- addr' ) 2 cells + @ ; : t-length ( addr -- n ) 1 cells + @ ; - +: t-bank ( bank -- bank' ) 4 cells + @ ; \ Code bank handling variable current-cbank @@ -1290,12 +1301,17 @@ target + + + \ Temporary variables udata variable tmp1 variable tmp2 idata +20 set-stack-size + host \ Words to manipulate temporary variables @@ -1375,41 +1391,80 @@ \ Adjust the current bank so that it can appropriately select the right \ address in memory - +: rp0bcf ( -- ) reg-rp0 bcf ; +: rp1bcf ( -- ) reg-rp1 bcf ; +: bank0chk ( bank -- ) + case + 80 of rp0bsf endof + 100 of rp1bsf endof + 180 of rp0bsf rp1bsf endof + endcase +; +: bank1chk ( bank -- ) + case + 00 of rp0bcf endof + 100 of rp0bcf rp1bsf endof + 180 of rp1bsf endof + endcase +; + +: bank2chk ( banf -- ) + case + 00 of rp1bcf endof + 80 of rp1bcf rp0bsf endof + 180 of rp0bsf endof + endcase +; + +: bank3chk ( bank -- ) + case + 00 of rp1bcf rp0bcf endof + 80 of rp1bcf endof + 100 of rp0bcf endof + endcase +; + : adjust-bank ( a -- a ) + dup chkfile 0<> if exit then \ a suspend-warnings >r - case dup bank dup current-bank ! - 80 of rp0bsf endof - 100 of rp1bsf endof - 180 of rp0bsf rp1bsf endof - endcase +\ 0= if + case dup bank dup current-bank @ \ a ba ba cba + 00 of bank0chk endof \ a ba ba + 80 of bank1chk endof + 100 of bank2chk endof + 180 of bank3chk endof +\ 00 of rp1bcf rp0bcf endof +\ 80 of rp1bcf rp0bsf endof +\ 100 of rp1bsf rp0bcf endof +\ 180 of rp1bsf rp0bsf endof + endcase \ a ba + current-bank ! \ a +\ else + +\ then r> restore-warnings ; \ Select the right bank and returned a trimmed address in the page : select-bank ( a -- a' ) adjust-bank 7f and ; - -: rp0bcf ( -- ) reg-rp0 bcf ; -: rp1bcf ( -- ) reg-rp1 bcf ; - : restore-bank ( -- ) - suspend-warnings >r - case current-bank @ - 80 of rp0bcf endof - 100 of rp1bcf endof - 180 of rp1bcf rp0bcf endof - endcase - 0 current-bank ! - r> restore-warnings +\ suspend-warnings >r +\ case current-bank @ +\ 80 of rp0bcf endof +\ 100 of rp1bcf endof +\ 180 of rp1bcf rp0bcf endof +\ endcase +\ 0 current-bank ! +\ r> restore-warnings ; : const-! ( addr -- ) const? if kill-const dup 0= if - drop select-bank clrf restore-bank + drop select-bank clrf restore-bank else - movlw select-bank movwf restore-bank + movlw select-bank movwf restore-bank then else meta> popw select-bank movwf restore-bank @@ -2234,7 +2289,7 @@ meta \ Address of main program -: main ( -- ) 0 set-vector init-picforth ; +: main ( -- ) 30 set-stack-size 30 data-org 0 set-vector init-picforth ; \ ---------------------------------------------------------------------- \ Tables @@ -2485,7 +2540,9 @@ c00 of .op" btfss" endof endcase dup .file ." ," 380 and 7 rshift .bconst -; + ; + + \ Control operations @@ -2600,4 +2657,4 @@ \ Reserve space for jump to main (4 bytes, because of the need to erase \ 4 bytes at a time on 16F8xxA devices) -4 org + ========================end =======================
發表於: 2007/10/16 21:53
|
|||
|
關於 PICFORTH
|
||||
---|---|---|---|---|
新會員
|
請問 有沒有人用 PICFORTH v 1.2.5
大家可以一起討論研究研究 我現在正在改 1 FILE BANK 切換的程序 因 bank 切換 不影嚮 fsr 取消 回0bank 指令 ,兩個指位器不一樣 00 02 03 04 0A 0B 70~7f 為共用區 可在不切bank時 讀寫資料 2 P16F690 的 FILE NAME 從 p16f88/87 改為 690 (下一步 p14 reg 改為 include 方式) 3 變數位址 (variable ) 改從 70~ 7f (共用區) 當全域變數用 (下一步 變數 分 全域 區域 ) 基本上 14BIT 指令都一樣 只要改 2項即可 1 跟 3 為了減少多切 bank的指令
發表於: 2007/10/16 13:39
|
|||
|
量產燒錄程序及工具
|
||||
---|---|---|---|---|
新會員
|
請問
有沒有大量燒錄的工具 因 eeprom 還要校正 ad 所以 先燒程式 還是要在上一次線 且每個 板子可能用不同的hex檔 想要的作業流程如下 pcb smd (多連片) 電路電流確認 燒錄程式( 由治具上切換 (1-8).hex ) 依標示選擇 HEX 燒錄程式 校正 完成 謝謝
發表於: 2007/10/16 13:25
|
|||
|
Re: 關於12F675..
|
||||
---|---|---|---|---|
新會員
|
^^ sorry
p12f510 3 ch 8bit AD
發表於: 2007/9/4 19:01
|
|||
|
Re: 關於12F675..
|
||||
---|---|---|---|---|
新會員
|
p42 7.1.6
7.1.6 CONVERSION OUTPUT The A/D conversion can be supplied in two formats: left or right shifted. The ADFM bit (ADCON0<7>) controls the output format. Figure 7-2 shows the output formats. or p12f509 8bit AD
發表於: 2007/9/3 23:49
|
|||
|
Re: 使用 hex 燒錄 無法動作
|
||||
---|---|---|---|---|
新會員
|
太感謝了tonys
我找到地方了 config 在 倒數第二行 直接拷背上去就能作動了 :02 400E 00BC3F B5 謝謝已解決
發表於: 2007/2/27 14:11
|
|||
|
Re: 使用 hex 燒錄 無法動作
|
||||
---|---|---|---|---|
新會員
|
各位先進
下面兩個 檔 的機械碼指令都一樣 但是只有ok.hex 能夠作動 開機後 gpio 2 45 會亮 有部份是 空碼 nop 及 3ff的不同 程式區是一樣的 0x0000 018A clrf 0x0A 0x0001 2810 goto 0x010 0x0010 3052 movlw 0x52 ; 0x0011 0084 movwf 0x04 ; 52 -> FSR 0x0012 307B movlw 0x7B ; 0x0013 1683 bsf 0x03,5 ; status rp0 0x0014 0081 movwf 0x01 ; 7B -> option-reg 0x0015 3071 movlw 0x71 0x0016 009F movwf 0x1F ; 71 -> ansel 0x0017 3003 movlw 0x03 0x0018 0085 movwf 0x05 ; 03 -> trisio 0x0019 1283 bcf 0x03,5 ; set bank 0 0x001A 138B bcf 0x0B,7 ; intcon 0x001B 1683 bsf 0x03,5 ; set bank 1 0x001C 0199 clrf 0x19 ; clr vfcon 0x001D 1283 bcf 0x03,5 ; set bank 0 0x001E 3080 movlw 0x80 0x001F 009F movwf 0x1F ; 80 -> adcon0 0x0020 3007 movlw 0x07 0x0021 0099 movwf 0x19 ; 07 -> cmcon 0x0022 1505 bsf 0x05,2 ; 2 4 5 set 0x0023 1605 bsf 0x05,4 0x0024 1685 bsf 0x05,5 0x0025 2825 goto 0x025 ; loop type err.hex :100000008A0110280000000000000000000000002D :1000100000000000000000000000000000000000E0 :10002000523084007B308316810071309F00033092 :10003000850083128B1383169901831280309F00F1 :1000400007309900051505168516252800000000C3 :04400E00FF3FFF3F32 :00000001FF type ok.hex :020000040000FA :040000008A01102839 :020008000900ED :10002000523084007B308316810071309F00033092 :10003000850083128B1383169901831280309F00F1 :0C004000073099000515051685162528C7 :02400E00BC3FB5 :00000001FF
發表於: 2007/2/27 12:35
|
|||
|