btfsc STATUS,C
goto Step1
bsf STATUS,C
MOVlw 1
subwf HigB,F ; decrement HigB
btfsc STATUS,C ; if underflow -> C=0
goto Step1
bsf Temp,C ; set C
Step1 decf HIndex,F
MOVf HIndex,W ; pointer to middle byte of const
call DecTable
bsf STATUS,C
subwf MidB,F ; MidB - W -> MidB
btfsc STATUS,C ; if underflow -> C=0
goto Step2
bsf STATUS,C
MOVlw 1
subwf HigB,1 ; decrement HigB
btfsc STATUS,C ; if underflow -> C=0
goto Step2
bsf Temp,C ; set C
Step2 decf HIndex,F
MOVf HIndex,W ; pointer to middle byte of constatnt
call DecTable
bsf STATUS,C
subwf HigB,F ; HigB - W -> HigB
btfsc STATUS,C ; if underflow -> C=0
goto ClearCF
bsf STATUS,C
goto SubEnd
ClearCF rrf Temp,C ; C -> STATUS
SubEnd retlw 0
;+-------------------------------------------------------------------------+
;| 3 byte addition of the constant from the table, it sets carry if |
;| result overflows |
;+-------------------------------------------------------------------------+
Addc24 clrf Temp ; register for temporary storage of CF
MOVf Index,W ; pointer to lower byte of const into W
MOVwf HIndex ; save it into HIndex
call DecTable ; W contains low byte of const
bcf STATUS,C ; clear C
addwf LowB,1 ; W + LowB -> LowB
btfss STATUS,C ; test overflow
goto Add2
bcf STATUS,C ; clear C
MOVlw 1
addwf MidB,F ; increment MidB
btfss STATUS,C
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] 下一页
本文关键字:暂无联系方式PIC单片机,单片机-工控设备 - PIC单片机