Re: 比較判斷程式debug
|
||||
---|---|---|---|---|
版主
|
如果你有 Include Microchip 的 INC 擋的話,那請將 statua,z 改為大寫,打開 INC 擋你揪知道的,MPASM 大小寫有區分。
NDF EQU H'0000' TMR0 EQU H'0001' PCL EQU H'0002' STATUS EQU H'0003'
發表於: 2007/3/22 9:10
|
|||
|
Re: 比較判斷程式debug
|
||||
---|---|---|---|---|
版主
|
旗號用來做比較是不用刻意去設定的。如果是做減法的話就需考慮C旗號的設定(PIC用2's做減法)
發表於: 2007/3/21 18:00
|
|||
|
Re: 比較判斷程式debug
|
||||
---|---|---|---|---|
初級會員
|
感謝各位大大的指點,目前這個判斷程式我已經修改的差不多了,只是又遇到了一個問題是在程式中我所有的判斷依據都是根據STATUS Register裡C,Z的狀態作判斷,可是目前遇到一個小問題,那就是不論數值的大小STATUS的值都不改變,這是我那邊還需要再設定,或是我疏忽了呢?或是應該這樣問,要如何設定STATUS Register?
發表於: 2007/3/21 10:26
|
|||
|
Re: 比較判斷程式debug
|
||||
---|---|---|---|---|
版主
|
Microchip 在 Dtat Sheet 有關 BTFSS 指令的描述:
Syntax: [ label ] BTFSS f,b Operands: 0 ≤ f ≤ 127 , 0 ≤ b < 7 Operation: skip if (f<b>) = 1 ; 測試位元=1時,跳過下一個指令進而執行第二個指令。 Status Affected: None Description: If bit ‘b’ in register ‘f’ is ‘0’, the next instruction is executed. If bit ‘b’ is ‘1’, then the next instruction is discarded and a NOP is executed instead, making this a 2 TCY instruction.
發表於: 2007/3/16 16:42
|
|||
|
Re: 比較判斷程式debug
|
||||
---|---|---|---|---|
中級會員
|
btfss DATAI_H,7
goto heat movlw MSB 最高位元為1時 執行 movlw MSB 最高位元為0時,跳到go to heat
發表於: 2007/3/16 14:53
|
|||
|
比較判斷程式debug
|
||||
---|---|---|---|---|
初級會員
|
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Calcomp ;******* DATAI>Amb Set GPIO_5 High ;******* DATAI<=Amb Set GPIO_4 High ;******************************************** compare btfsc DATAI_H,7 ; [DATA_H(7)=H]=-xC goto heat movlw MSB subwf DATAI_H,W ; DATAI_H-Amb(5'C) btfsc status,z goto heat ; when DATAI = Amb btfss status,c goto heat ; when DATAI < Amb goto system ; when DATAI > Amb ;:::::::::::::::::::::::::::::::::::::::::::::::::::::: system nop bsf GPIO,0 ; Set GPIO_0 High goto start ; Read Temperature Sensor Data again heat nop bcf GPIO,0 ; Set GPIO_0 Low goto start ; Read Temperature Sensor Data again end
發表於: 2007/3/16 14:24
|
|||
|