Hi I have a pair of 3 digit values. They are actual value & save value.
I need to subtract the save value from the actual value & need to decide is it greater than the save value.
I don’t need the exact result I need to know whether actual value > or < than the save value.
I wrote a small routine needs to check is it ok or not,
I need to subtract the save value from the actual value & need to decide is it greater than the save value.
I don’t need the exact result I need to know whether actual value > or < than the save value.
I wrote a small routine needs to check is it ok or not,
Code:
121 =actual value (D3,D2,D1)
103 =save value (SD3,SD2,SD1)
movf SD1,W
subwf D1,W ;substract digit1
btfsc STATUS,C
goto $+2
decf D2,F
movf SD2,W
subwf D2,W ;substract digit2
btfsc STATUS,C
goto $+2
decf D3,F
movf SD3,W
subwf D3,W ;substract digit3
btfss STATUS,C
goto $+3
bsf Result,1 ;result possitive
return
bcf Result,1 ;result negative
return