PIC18F45K20-E/P Microchip Technology, PIC18F45K20-E/P Datasheet - Page 55

32KB, Flash, 1536bytes-RAM, 36I/O, 8-bit Family,nanowatt XLP 40 PDIP .600in TUBE

PIC18F45K20-E/P

Manufacturer Part Number
PIC18F45K20-E/P
Description
32KB, Flash, 1536bytes-RAM, 36I/O, 8-bit Family,nanowatt XLP 40 PDIP .600in TUBE
Manufacturer
Microchip Technology
Series
PIC® XLP™ 18Fr

Specifications of PIC18F45K20-E/P

Core Processor
PIC
Core Size
8-Bit
Speed
48MHz
Connectivity
I²C, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, HLVD, POR, PWM, WDT
Number Of I /o
35
Program Memory Size
32KB (16K x 16)
Program Memory Type
FLASH
Eeprom Size
256 x 8
Ram Size
1.5K x 8
Voltage - Supply (vcc/vdd)
1.8 V ~ 3.6 V
Data Converters
A/D 14x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 125°C
Package / Case
40-DIP (0.600", 15.24mm)
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With
DM240313 - BOARD DEMO 8BIT XLPAC164112 - VOLTAGE LIMITER MPLAB ICD2 VPPDM164124 - KIT STARTER FOR PIC18F4XK20
Lead Free Status / RoHS Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18F45K20-E/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
FIGURE 3-41:
© 2009 Microchip Technology Inc.
/**
//----------------------------------------------------------------------------
//
#pragma code InterruptVectorHigh = 0x08
void InterruptVectorHigh (void)
{
}
//----------------------------------------------------------------------------
//
#pragma code InterruptVectorLow =
0x18 void InterruptVectorLow (void)
{
}
_asm
_endasm
_asm
High
goto InterruptServiceHigh //jump to interrupt routine
Low
goto InterruptServiceLow //jump to interrupt routine _endasm
I
N
priority
priority
T
E
R
DEFINE INTERRUPT VECTORS
interrupt
The Interrupt Service Routine functions themselves are then declared with the
#pragma interrupt directive for the high priority vector, and #pragma
interruptlow for the low priority. Note the names must match between the vector
GOTO argument, the #pragma attribute, and the function declaration name. The
interrupt functions may call other functions defined elsewhere in the source, though the
lesson source code does not do this.
FIGURE 3-42:
As all interrupts of the same priority vector to the same function, it is necessary in the
function to examine which of the enabled interrupt flags caused the interrupt. Once the
flag is found so that peripheral or event may be serviced, the software must clear the
interrupt flag bit to reset the interrupt. In the lesson source code, the high priority
interrupt routine looks for the INT0 pin interrupt INT0IF flag bit. Examples are shown in
the source code of how it might check for other enabled interrupts, such as Timer1
TMR1IF and the ADC ADIF although neither of these interrupts are enabled in the
lesson code. Similarly, the low priority vector checks for the Timer0 flag TMR0IF.
Setting Up Interrupts
Now that the source code has defined the interrupt vectors, and has functions to deal
with the interrupts, it must properly setup and configure the interrupting logic and
enable the individual interrupts it wants to use.
Timer0 and external pin interrupts are set up using the INTCONx Special Function
Registers. Other interrupts are setup through a number set of peripheral interrupt
SFRs: PIRx, PIEx and IPRx. The PIRx registers contain the interrupt flags. The
R
interrupt
//
#pragma
void
{
}
#pragma interruptlow InterruptServiceLow // "interruptlow" pragma for low priority
void InterruptServiceLow(void)
{
}
U
P
//function
//
//function
//
InterruptServiceHigh(void)
T
vector
interrupt
return
return
vector
S
***********************************************/
statements
from
statements
from
PICkit™ 3 Debug Express Lessons
INTERRUPT SERVICE FUNCTIONS
Iterrupt
InterruptServiceHigh//
high-priority
low-priority
Service
interrupt
interrupt
Routines
"interrupt"
pragma
for
high
DS41370C-page 51
priority

Related parts for PIC18F45K20-E/P