User manual
MPLAB
®
PM3 User’s Guide
DS51464C-page 32 © 2006 Microchip Technology Inc.
When any source file is opened, you are automatically in the editor. Type in this code:
Main:
clr f WREG
movwf PORTC; clear PORTC
movwf TRISC; configure PORTC as all outputs
Init
clrf COUNT
IncCount
incf COUNT
movf COUNT,W
movwf PORTC; display COUNT on PORTC
callDelay
goto IncCount; infinite loop
Delay
movlw 0x40; set outer delay loop
movwf DVAR2
Delay0
movlw 0xFF
movwf DVAR; set inner delay loop
Delay1
decfsz DVAR
goto Delay1
decfsz DVAR2
goto Delay0
return
The template file should now look like Figure 3-13.
FIGURE 3-13: TEMPLATE FILE – ADD CODE