Scott, You have one too many "l's" in "will". Jim -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Scott Dattalo Sent: Saturday, March 27, 2010 8:16 PM To: Microcontroller discussion list - Public. Subject: Re: [PIC] Of course you don't understand this routine. > SECONDS EQU [any register, on any page] > MINUTES EQU SECONDS+1 > HOURS EQU MINUTES+1 > > TICK: MOVLW SECONDS ;First, initialize the FSR to point > MOVWF FSR ; at SECONDS. > CALL SUB1 ;Use the BCD-increment code to inc > CALL SUB0 ; SECONDS and then MINUTES. > CALL SUB0 ;Call it one last time to increment > ; HOURS. > GOTO SUB2 ;Keep HOURS in the range [0-23]. > > SUB0: INCF FSR ;You enter here to point to the next > SKPNC ; register before incrementing it. > SUB1: INCF INDF ;Or enter here to just increment the > ; register. > MOVLW 6 ;Use this MOVLW/ADDWF to see whether > ADDWF INDF ; reg is outside the range [0-9]. > > SKPDC ;Obscure DC flag usage was contributed > SUBWF INDF ; by Scott Dattalo. > MOVLW 0100H - 060H ;Load W with a value that'll make the > SUB2: ADDWF INDF,W ; ADDWF overflow if the reg > 60. > SKPNC ;If there's an overflow, clear the > CLRF INDF ; register. > RETLW 0100H - 024H ;Now return with W holding a value that > ; will make ADDWF overflow if reg>24. Andrew, I I c m c t e t r S t w o y a e t o e c h i m v l r h o g o i l m e c s i a t n l e r o l s r t k l n t u i d t i n k s -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist