EasyManuals Logo

Microchip Technology PICkit 3 User Manual

Microchip Technology PICkit 3
102 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #78 background imageLoading...
Page #78 background image
PICkit™ 3 Starter Kit User’s Guide
DS41628B-page 78 2012 Microchip Technology Inc.
EXAMPLE 3-40:
The #ifdef is a preprocessor directive, which will look to see if the directive, in this
case PULL_UPS, is defined. If so, the code between the #ifdef and #endif will be
assembled. These two lines activate the weak pull-up resistor on pin RA2.
3.11.6.3 PIC18
The PIC18 does not differentiate between rising and falling edges. Therefore, the same
debounce routine and flowchart in Lesson 7 (Figure 3-6) will be used.
EXAMPLE 3-41:
When priority interrupts are disabled, all interrupts occur at address 0x0008.
EXAMPLE 3-42:
Same as the PIC16, except that the registers and bit names are changed slightly.
3.11.7 C Language
The enhanced core can have only one interrupt vector defined. This is done by creating
a function with the interrupt keyword:
void interrupt ISR(void)
This is a special name and is reserved only for the ISR. The PIC18 can have two, but
this lesson uses only one as shown above.
#ifdef PULL_UPS
banksel WPUA
bsf WPUA, 2 ;enable the weak pull-up for the switch
banksel OPTION_REG
bcf OPTION_REG, NOT_WPUEN ;enable the global weak pull-up bit
;this bit is active HIGH, meaning it must be cleared for it to be enabled
#endif
Org 0x0000 ;Reset Vector starts at 0x0000
bra Start ;main code execution
Org 0x0008 ;High Priority Interrupt Vector starts at address 0x0008
goto ISR
#ifdef PULL_UPS
bsf WPUA, 2 ;enable the weak pull-up for the switch
bcf INTCON2, NOT_RABPU ;enable the global weak pull-up bit
;this bit is active HIGH, meaning it must be cleared for it to be enabled
#endif

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Microchip Technology PICkit 3 and is the answer not in the manual?

Microchip Technology PICkit 3 Specifications

General IconGeneral
BrandMicrochip Technology
ModelPICkit 3
CategoryComputer Accessories
LanguageEnglish

Related product manuals