DM163045 Microchip Technology, DM163045 Datasheet - Page 58

no-image

DM163045

Manufacturer Part Number
DM163045
Description
PICDEM Lab Development Kit (with PICkit 3) General Purpose
Manufacturer
Microchip Technology
Series
PICDEM™r
Type
MCUr
Datasheet

Specifications of DM163045

Contents
Board, PIC kit 3
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
PIC Micro® MCU

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
DM163045
Manufacturer:
MICROCHIP
Quantity:
12 000
PICDEM
DS41369A-page 54
TM
The INTCON register is needed as well to implement the interrupt-on-change feature.
Again the GIE bit needs to be set to enable any interrupts used on the microcontroller.
To configure for an interrupt-on-change, the PORTA/PORTB Change Interrupt Enable
bit (RABIE) must be set along with the individual enable bits in the IOCA register. On
an interrupt-on-change for configured pins, the PORTA/PORTB Change Interrupt Flag
bit (RABIF) will be set. To detect a logic change on a port pin, the firmware needs to
know what has changed. Therefore, PORTA must be read before an
interrupt-on-change can occur. Reading PORTA retains, or latches, the current value
on the RA2 pin for later reference. In the event that the signal on the RA2 pin changes
and a mismatch with the reference value occurs, an interrupt will result.
The main() software flowchart for this lab remains the same as that in Figure 3-24 of
the previous lab. The Interrupt Service Routine changes since it now must determine
whether the interrupt occurred due to a high-to-low or low-to-high transition on pin RA2.
The ISR flowchart is shown in Figure 3-25.
FIGURE 3-25:
Lab Development Board User’s Guide
RABIE and RABIF
Read PORTA
pb_pressISR()
RETURN
bits set
?
PB_PRESSISR FLOWCHART FOR LAB 7
YES
NO
NO
direction = 1
Clear RABIF flag
Delay for 5mS
RA2 pin = 1
RA2 pin = 1
?
?
NO
direction = 1
Delay for 5mS
RA2 pin = 0
RA2 pin = 0
© 2009 Microchip Technology Inc.
?
?
YES
YES
NO

Related parts for DM163045