Decrementing packed BCD

Thread Starter

RG23

Joined Dec 6, 2010
304
incf count304,1 ////count304 is h'00'
movf count304,0
addlw 0x06
btfss STATUS,DC
addlw -0x06
addlw 0x60
btfss STATUS,C
addlw -0x60
movwf count304

The above subroutine enables me to increment from 00 to 99 on LCD display

It didn't work while decrementing from 99 to 00

If anyone has an idea please let me know

Thanks
 
Last edited:

Markd77

Joined Sep 7, 2009
2,806
This will do it:
movlw 0x01
subwf count304, W
btfss STATUS, DC ;if digit borrow then subtract another 6 eg 0x8F
addlw -0x06 ;would become 0x89
movwf count304
 
Top