Download Assembler/Linker/Librarian User's Guide
Transcript
Assembler Examples, Tips and Tricks goto TestCode ;Go back to top of program and ;run the delay again. ;Subroutine, called by the Macro Dly32 (20 Tcy per loop) DoDly32 movlw H'FF' ;Start with -1 in W addwf btfsc clrw Dly0,F STATUS,C ;LSB decrement ;was the carry flag set? ;If so, 0 is put in W addwf btfsc clrw Dly1,F STATUS,C ;Else, we continue. addwf btfsc clrw Dly2,F STATUS,C addwf btfsc clrw Dly3,F STATUS,C iorwf iorwf iorwf iorwf Dly0,W Dly1,W Dly2,W Dly3,W ;Inclusive-OR all variables ;together to see if we have reached ;0 on all of them. btfss goto retlw STATUS,Z DoDly32 0 ;Test if result of Inclusive-OR's is 0 ;It was NOT zero, so continue counting ;It WAS zero, so exit this subroutine. ;0 in W ;0 in W ;0 in W END © 2005 Microchip Technology Inc. DS33014J-page 135