please dont rip this site

PIC Microcontoller Time Method

Count Seconds, Minutes, and Hours by Andrew Warren

SECONDS EQU [any register, on any page] 

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.

file: /Techref/microchip/countsecminhrs-aw.htm, 1KB, , updated: 2010/3/26 15:52, local time: 2024/7/16 01:28,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> PIC Microcontoller Time Method: Count Seconds, Minutes, and Hours by Andrew Warren</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!