datasheetbank_Logo
Integrated circuits, Transistor, Semiconductors Search and Datasheet PDF Download Site

PIC16C925-I/CL View Datasheet(PDF) - Microchip Technology

Part Name
Description
MFG CO.
PIC16C925-I/CL
Microchip
Microchip Technology 
PIC16C925-I/CL Datasheet PDF : 182 Pages
First Prev 51 52 53 54 55 56 57 58 59 60 Next Last
PIC16C925/926
EQUATION 8-1: EXAMPLES OF PWM PERIOD AND DUTY CYCLE CALCULATION
1. Find the value of the PR2 register, given:
Desired PWM frequency = 31.25 kHz
FOSC = 8 MHz
TMR2 prescale = 1
From the equation for PWM period in Section 8.3.1,
1 / 31.25 kHz = [ (PR2) + 1 ] 4 1/8 MHz 1
or
32 µs
= [ (PR2) + 1 ] 4 125 ns 1 = [ (PR2) + 1 ] 0.5 µs
PR2
= (32 µs / 0.5 µs) - 1
PR2
= 63
2. Find the maximum resolution of the duty cycle that can be used with a 31.25 kHz frequency and
8 MHz oscillator.
From the equation from maximum PWM resolution in Section 8.3.2,
1 / 31.25 kHz = 2PWM RESOLUTION 1 / 8 MHz 1
or
32 µs
= 2PWM RESOLUTION 125 ns 1
256
= 2PWM RESOLUTION
log(256)
= (PWM Resolution) log(2)
8.0
= PWM Resolution
At most, an 8-bit resolution duty cycle can be obtained
from a 31.25 kHz frequency and a 8 MHz oscillator, i.e.,
0 CCPR1L:CCP1CON<5:4> 255. Any value greater
than 255 will result in a 100% duty cycle.
In order to achieve higher resolution, the PWM fre-
quency must be decreased. In order to achieve higher
PWM frequency, the resolution must be decreased.
Table 8-2 lists example PWM frequencies and resolu-
tions for FOSC = 8 MHz. TMR2 prescaler and PR2 val-
ues are also shown.
8.3.3 SET-UP FOR PWM OPERATION
The following steps should be taken when configuring
the CCP module for PWM operation:
1. Set the PWM period by writing to the PR2
register.
2. Set the PWM duty cycle by writing to the
CCPR1L register and CCP1CON<5:4> bits.
3. Make the CCP1 pin an output by clearing the
TRISC<2> bit.
4. Set the TMR2 prescale value and enable Timer2
by writing to T2CON.
5. Configure the CCP module for PWM operation.
TABLE 8-2: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS AT 8 MHz
PWM Frequency
Timer Prescaler (1, 4, 16)
PR2 Value
Maximum Resolution (bits)
488 Hz
16
0xFF
10
1.95 kHz
4
0xFF
10
7.81 kHz
1
0xFF
10
31.25 kHz
1
0x3F
8
62.5 kHz
1
0x1F
7
250 kHz
1
0x07
5
2001 Microchip Technology Inc.
Preliminary
DS39544A-page 57

Share Link: 

datasheetbank.com [ Privacy Policy ] [ Request Datasheet ] [ Contact Us ]