MikroElektronika PIC Microcontrollers PIC16 Specifications Page 241

  • Download
  • Add to my manuals
  • Print
  • Page
    / 266
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 240
mikroElektronika | Free Online Book | PIC Microcontrollers | Appendix B: Examples
Example 10:
;********************** Header **********************************************
;************* DEFINING VARIABLES *******************************************
cblock 0x20 ; Block of variables starts at address 20h
w_temp ; Variable at address 20h
pclath_temp ; Variable at address 21h
status_temp ; Variable at address 22h
endc
#define DARK PORTB,0 ; Push-button "DARK" is connected
; to PORTB,0 pin
#define BRIGHT PORTB,1 ; Push-button "BRIGHT" is connected
; to PORTB,1 pin
;************************ PROGRAM START *************************************
org 0x0000 ; First program instruction address
goto main ; Jump to label "main"
;************************ INTERRUPT ROUTINE *********************************
org 0x0004 ; Interrupt vector
movwf w_temp ; Save register W
movf STATUS ; Save register STATUS
movwf status_temp
http://www.mikroe.com/en/books/picmcubook/appb/ (36 of 54)5/3/2009 11:36:02 AM
Page view 240
1 2 ... 236 237 238 239 240 241 242 243 244 245 246 ... 265 266

Comments to this Manuals

No comments