Microchip Technology Zena User's Guide Page 46

  • Download
  • Add to my manuals
  • Print
  • Page
    / 288
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 45
MPLAB
®
IDE User’s Guide
DS51519B-page 36 © 2006 Microchip Technology Inc.
FIGURE 2-13: TEMPLATE FILE – MAIN
When any source file is opened, you are automatically in the editor. Type in this code
beneath Main:
clrf WREG
movwf PORTC ; clear PORTC
movwf TRISC ; configure PORTC as all outputs
Init
clrf COUNT,A ; initialize counter
IncCount
incf COUNT,F,A
movf COUNT,W,A ; increase count and
movwf PORTC ; display on PORTC
call Delay ; go to Delay subroutine
goto IncCount ; infinite loop
Delay
movlw 0x40
movwf DVAR2,A ; set outer delay loop
DelayOuter
movlw 0xFF
movwf DVAR,A ; set inner delay loop
DelayInner
decfsz DVAR,F,A
goto DelayInner
decfsz DVAR2,F,A
goto DelayOuter
return
Page view 45
1 2 ... 41 42 43 44 45 46 47 48 49 50 51 ... 287 288

Comments to this Manuals

No comments