DM163045 Microchip Technology, DM163045 Datasheet - Page 54

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 50
TM
Referring to the flowchart in Figure 3-24, the PB_PressISR() replaces the
Get_Inputs() used in Lab 4 with a few additions. At the beginning of the ISR, the
INTE and INTF bits are first checked to ensure that the RA2/INT external interrupt is
indeed enabled and that the flag is set indicating that an RA2/INT external interrupt has
occurred. Determining the source of an interrupt becomes especially important if
multiple peripherals are configured to cause an interrupt. The ISR then clears the
RA2/INT external interrupt flag so that subsequent interrupts will be registered. The
ISR then performs the RA2 check along with the debounce routine that was discussed
in the previous lab.
3.4.5.3
Using the firmware developed in the previous lab, make the following changes:
1. Copy/paste the Interrupt Service Routine in Figure 3-23 at the top of the firmware
EXAMPLE 3-23:
Lab Development Board User’s Guide
/*---------------------------------------------------------
-
---------------------------------------------------------*/
void interrupt PB_PressISR(void)
{
}
source file under the section labeled:
/**INTERRUPT CODE***************************************/
Subroutine: Interrupt Service Routine
Parameters: none
Returns:nothing
Synopsis:Execute this code on any interrupt
//Check to see if the interrupt was caused by
//the external interrupt on RA2
//If so, clear the external interrupt flag
//to allow subsequent interrupts to be detected
if(INTE && INTF) INTF = 0;
//Check to see if the RA2 pin is 0
//(i.e. push button pressed)
if(RA2 == 0)
{
}
//If RA2 is not 0, keep direction value
//the same as it was
else direction = direction;
PROCEDURE
//If RA2 is 0 delay for 5mS to filter
//any switch bounce
Delay_5mS();
//Check to see if RA2 is still 0
//If so, toggle the direction bit
if(RA2 == 0) direction ^= 1;
PB_PRESSISR() CODE FOR GPIO LAB 6
© 2009 Microchip Technology Inc.

Related parts for DM163045