PIC18F45K20-E/ML Microchip Technology, PIC18F45K20-E/ML Datasheet - Page 61
![32KB, Flash, 1536bytes-RAM, 36I/O, 8-bit Family,nanowatt XLP 44 QFN 8x8x0.9mm TU](/photos/6/81/68122/150-44-qfn_sml.jpg)
PIC18F45K20-E/ML
Manufacturer Part Number
PIC18F45K20-E/ML
Description
32KB, Flash, 1536bytes-RAM, 36I/O, 8-bit Family,nanowatt XLP 44 QFN 8x8x0.9mm TU
Manufacturer
Microchip Technology
Series
PIC® XLP™ 18Fr
Datasheets
1.PIC18F25K20T-ISS.pdf
(42 pages)
2.PIC18F25K20T-ISS.pdf
(12 pages)
3.PIC18F25K20T-ISS.pdf
(14 pages)
4.PIC18F25K20T-ISS.pdf
(456 pages)
5.PIC18F45K20-IPT.pdf
(78 pages)
Specifications of PIC18F45K20-E/ML
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
44-QFN
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 PIC18F4XK20AC164322 - MODULE SOCKET MPLAB PM3 28/44QFN
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
FIGURE 3-48:
© 2009 Microchip Technology Inc.
while
{//
}
Delay1KTCYx(32);
LATD
delayand
(1)
=LED_Count++;
3.9.3
The Lesson 9 program code has a simple background loop in the main() function that
displays a binary count on the demo board LEDs, as shown in Figure 3-46. Each count
increment is delayed by 64,000 instruction cycles. As the clock frequency is changed,
the instruction rate changes and so the total time in seconds of the delay gets shorter
as the clock frequency increases. The effect is that the LED display will count faster as
the clock speed is increased.
At the start of the program, the internal oscillator is running at 250 kHz. Each press of
the demo board switch creates an interrupt that increases the clock frequency by a
factor of 2 up through 64 MHz, after which it returns to 250 kHz.
SOURCE CODE BACKGROUND LOOP
A few other things of interest in the Lesson 9 source code are:
• The interrupts are configured for only a single level of priority, where interrupt pri-
• Instead of using ADCON1 to configure the switch input RB0 as a digital input as
• The Lesson 9 interrupt service function void InterruptService(void) dem-
3.9.4
Build and program the Lesson 9 project, then Run the application in the debugger.
Pressing the demo board switch causes the program to change the oscillator frequency
during execution. As the oscillator frequency increases, the rate at which the LEDs
count increases.
counton
orities are disabled. This differs from the Lesson 8 source code where interrupt
priorities were enabled.
was done in previous lessons, the Lesson 9 source sets the Configuration bit
PBADEN = OFF. This causes all PORTB pins to default to digital, instead of ana-
log, inputs on a Reset.
onstrates calling another function void SetIntOSC(IntOSCFreq *ClockSet)
from within the interrupt service code.
LEDs
Exploring the Lesson 9 Source Code
Build and Run the Lesson 9 Code with PICkit 3 Debug Express
here.Interrupt
PICkit™ 3 Debug Express Lessons
//output
//delay
32,000cycles
handles
countto
switch
PORTD
or
LEDs
about
and
freqchanges
1
secat
125kHz
DS41370C-page 57