Hey guys,
I am stuck on this and I 'll appreciate your help on this silly, i think, question. I try to compare two numbers the MAX_TEMP_HIGH and the HIGH_BYTE.
if the HIGH_BYTE is zero so the PIC will try to compare the low Byte, but for some reason this wont happen. Any ideas?
I am stuck on this and I 'll appreciate your help on this silly, i think, question. I try to compare two numbers the MAX_TEMP_HIGH and the HIGH_BYTE.
Code:
...
movlw b'00000000'
movwf MAX_TEMP_HIGH
movlw b'00110010'
movwf MAX_TEMP_LOW
...
...
;make the comparison
movf HIGH_BYTE, 0 ;w <-- HIGH_BYTE
subwf MAX_TEMP_HIGH, 0 ;w = MAX_TEMP_HIGH - w
btfsc STATUS, Z ;if STATUS<Z> == 1 its equal
goto checkLowByte
btfsc STATUS, C ;if STATUS<C> == 1 MAX_TEMP_HIGH < HIGH_BYTE
goto continueHeat
goto stopHeat
checkLowByte
movf LOW_BYTE, 0 ;w <-- LOW_BYTE
subwf MAX_TEMP_LOW, 0 ;w = MAX_TEMP_LOW - w
btfsc STATUS, Z ;if STATUS<Z> == 1 its equal
goto stopHeat
btfsc STATUS, C ;if STATUS<C> == 1 MAX_TEMP_LOW < HIGH_LOW
goto continueHeat