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

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-59:
© 2009 Microchip Technology Inc.
Timer2 also has a postscaler, but the postscaler does not affect the CPP module
operation PWM time base, so its settings are “don’t care.” The Timer2 module also has
a Period Register, known as PR2. This Special Function Register is the maximum to
which Timer2 can count before being reset to 0.
Normally, an 8-bit timer would count up to 255 before resetting to 0 and beginning to
count again. With the PR2 register, the timer counts up to the value in PR2. When it
reaches this value, the timer is reset to 0. For example if PR2 = 3, then Timer2 would
count 0-1-2-3-0-1-2-3-0-1-2-3- etc.
The count cycle from zero up until Timer2 reaches the PR2 in conjunction with the timer
prescaler (which determines how long each timer count takes) determines the PWM
frequency. The time between each reset to 0 in Timer2 is the PWM period. For
example, assume we want a PWM frequency of 62.5 Hz, which has a period of 16 ms.
Our clock is the internal oscillator block default, 1 MHz, which gives a 250 kHz
instruction rate. 250,000 Hz/62.5 Hz = 4000. Thus, we need to count 4000 times at 250
kHz before each Timer2 Reset. However, Timer2 is 8 bits and can count to a maximum
of 255. So we must use the prescaler to slow down the counting. Timer2 has 3
prescaler options: 1:1, 1:4, or 1:16 (Figure 3-59). 4000/256 = 15.6 so it requires a
prescaler of 1:16.
With the prescaler set to 1:16, the count frequency of Timer2 is 250,000 Hz/16 = 15625
Hz. To get our PWM frequency of 62.5 Hz, Timer 2 must count 15625/62.5 = 250 times.
Since Timer2 starts at 0, we set PR2 = 249, so it counts 0-249 (250 counts), resets to
zero, and counts back to 249. A simplified diagram of the PWM module is shown in
Figure 3-60.
T2CON: TIMER2 CONTROL REGISTER
PICkit™ 3 Debug Express Lessons
DS41370C-page 69

Related parts for PIC18F45K20-E/P