DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

PIC16LC73A-10/SO View Datasheet(PDF) - Microchip Technology

Part Name
Description
Manufacturer
PIC16LC73A-10/SO
Microchip
Microchip Technology 
PIC16LC73A-10/SO Datasheet PDF : 288 Pages
First Prev 71 72 73 74 75 76 77 78 79 80 Next Last
PIC16C7X
EXAMPLE 10-2: PWM PERIOD AND DUTY
CYCLE CALCULATION
Desired PWM frequency is 78.125 kHz,
Fosc = 20 MHz
TMR2 prescale = 1
1/78.125 kHz= [(PR2) + 1] • 4 • 1/20 MHz • 1
12.8 µs = [(PR2) + 1] • 4 • 50 ns • 1
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 10-3 lists example PWM frequencies and resolu-
tions for Fosc = 20 MHz. The TMR2 prescaler and PR2
values are also shown.
10.3.3 SET-UP FOR PWM OPERATION
PR2 = 63
Find the maximum resolution of the duty cycle that can
be used with a 78.125 kHz frequency and 20 MHz
oscillator:
1/78.125 kHz= 2PWM RESOLUTION • 1/20 MHz • 1
12.8 µs = 2PWM RESOLUTION • 50 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 78.125 kHz frequency and a 20 MHz oscillator,
i.e., 0 CCPR1L:CCP1CON<5:4> 255. Any value
greater than 255 will result in a 100% duty cycle.
The following steps should be taken when configuring
the CCP module for PWM operation:
1. Set the PWM period by writing to the PR2 regis-
ter.
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 CCP1 module for PWM operation.
TABLE 10-3: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS AT 20 MHz
PWM Frequency
1.22 kHz 4.88 kHz 19.53 kHz 78.12 kHz 156.3 kHz 208.3 kHz
Timer Prescaler (1, 4, 16)
PR2 Value
Maximum Resolution (bits)
16
0xFF
10
4
0xFF
10
1
0xFF
10
1
0x3F
8
1
0x1F
7
1
0x17
5.5
TABLE 10-4: REGISTERS ASSOCIATED WITH CAPTURE, COMPARE, AND TIMER1
Address Name
Bit 7 Bit 6 Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR,
BOR
Value on
all other
resets
0Bh,8Bh, INTCON
10Bh,18Bh
0Ch
0Dh(2)
PIR1
PIR2
8Ch
8Dh(2)
PIE1
PIE2
GIE PEIE T0IE
PSPIF(1,2) ADIF RCIF(2)
PSPIE(1,2) ADIE RCIE(2)
INTE
TXIF(2)
TXIE(2)
RBIE
T0IF INTF RBIF 0000 000x 0000 000u
SSPIF
SSPIE
CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
— CCP2IF ---- ---0 ---- ---0
CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
— CCP2IE ---- ---0 ---- ---0
87h
TRISC PORTC Data Direction Register
1111 1111 1111 1111
0Eh
TMR1L Holding register for the Least Significant Byte of the 16-bit TMR1 register
xxxx xxxx uuuu uuuu
0Fh
TMR1H Holding register for the Most Significant Byte of the 16-bit TMR1register
xxxx xxxx uuuu uuuu
10h
T1CON
— T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
15h
CCPR1L Capture/Compare/PWM register1 (LSB)
xxxx xxxx uuuu uuuu
16h
CCPR1H Capture/Compare/PWM register1 (MSB)
xxxx xxxx uuuu uuuu
17h
1Bh(2)
1Ch(2)
1Dh(2)
CCP1CON —
— CCP1X CCP1Y CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
CCPR2L Capture/Compare/PWM register2 (LSB)
xxxx xxxx uuuu uuuu
CCPR2H Capture/Compare/PWM register2 (MSB)
xxxx xxxx uuuu uuuu
CCP2CON —
— CCP2X CCP2Y CCP2M3 CCP2M2 CCP2M1 CCP2M0 --00 0000 --00 0000
Legend: x = unknown, u = unchanged, - = unimplemented read as '0'. Shaded cells are not used by Capture and Timer1.
Note 1: Bits PSPIE and PSPIF are reserved on the PIC16C73/73A/76, always maintain these bits clear.
2: The PIC16C72 does not have a Parallel Slave Port, USART or CCP2 module, these bits are unimplemented, read as '0'.
© 1997 Microchip Technology Inc.
DS30390E-page 75

Share Link: 

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