PIC16C65A Microchip Technology, PIC16C65A Datasheet - Page 81

no-image

PIC16C65A

Manufacturer Part Number
PIC16C65A
Description
8-Bit CMOS Microcontrollers
Manufacturer
Microchip Technology
Datasheets

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC16C65A-04/L
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C65A-04/L
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
PIC16C65A-04/P
Manufacturer:
Microchip Technology
Quantity:
135
Part Number:
PIC16C65A-04/PQ
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C65A-04/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C65A-04E/L
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C65A-04E/PQ
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C65A-10/L
Manufacturer:
Microchip Technology
Quantity:
135
Part Number:
PIC16C65A-10/P
Quantity:
6
Part Number:
PIC16C65A-10/P
Quantity:
17
EXAMPLE 10-2: PWM PERIOD AND DUTY
Desired PWM frequency is 78.125 kHz,
Fosc = 20 MHz
TMR2 prescale = 1
Find the maximum resolution of the duty cycle that can
be used with a 78.125 kHz frequency and 20 MHz
oscillator:
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
greater than 255 will result in a 100% duty cycle.
TABLE 10-3:
TABLE 10-4:
Add
0Bh,8Bh
10Bh,18Bh
0Ch
0Dh
8Ch
8Dh
87h
0Eh
0Fh
10h
15h
16h
17h
1Bh
1Ch
1Dh
Legend:
Note 1: These bits are associated with the USART module, which is implemented on the PIC16C63/R63/65/65A/R65/66/67 only.
Timer Prescaler (1, 4, 16)
PR2 Value
Maximum Resolution (bits)
1997 Microchip Technology Inc.
(4)
(4)
(4)
(4)
(4)
1/78.125 kHz = [(PR2) + 1] • 4 • 1/20 MHz • 1
12.8 s
PR2
1/78.125 kHz = 2
12.8 s
256
log(256)
8.0
2: Bits PSPIE and PSPIF are reserved on the PIC16C62/62A/R62/63/R63/66, always maintain these bits clear.
3: The PIR1<6> and PIE1<6> bits are reserved, always maintain these bits clear.
4: These registers are associated with the CCP2 module, which is only implemented on the PIC16C63/R63/65/65A/R65/66/67.
CCPR1L:CCP1CON<5:4>
x = unknown, u = unchanged, - = unimplemented locations read as '0’. Shaded cells are not used in these modes.
Name
INTCON
PIR1
PIR2
PIE1
PIE2
TRISC
TMR1L
TMR1H
T1CON
CCPR1L
CCPR1H
CCP1CON
CCPR2L
CCPR2H
CCP2CON
PWM Frequency
EXAMPLE PWM FREQUENCIES AND RESOLUTIONS AT 20 MHz
REGISTERS ASSOCIATED WITH TIMER1, CAPTURE AND COMPARE
= [(PR2) + 1] • 4 • 50 ns • 1
= 63
= 2
= 2
= (PWM Resolution) • log(2)
= PWM Resolution
CYCLE CALCULATION
PWM RESOLUTION
PWM RESOLUTION
PWM RESOLUTION
PSPIF
PSPIE
PORTC Data Direction register
Holding register for the Least Significant Byte of the 16-bit TMR1 register
Holding register for the Most Significant Byte of the 16-bit TMR1 register
Capture/Compare/PWM1 (LSB)
Capture/Compare/PWM1 (MSB)
Capture/Compare/PWM2 (LSB)
Capture/Compare/PWM2 (MSB)
Bit 7
GIE
(2)
(2)
PEIE
Bit 6
(3)
(3)
• 1/20 MHz • 1
• 50 ns • 1
255. Any value
T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON --00 0000 --uu uuuu
RCIF
RCIE
CCP1X
CCP2X
Bit 5
T0IE
(1)
(1)
1.22 kHz 4.88 kHz 19.53 kHz 78.12 kHz 156.3 kHz 208.3 kHz
0xFF
16
10
CCP1Y
CCP2Y
TXIE
TXIF
INTE
Bit 4
(1)
(1)
CCP1M3 CCP1M2 CCP1M1 CCP1M0 --00 0000 --00 0000
CCP2M3 CCP2M2 CCP2M1 CCP2M0 --00 0000 --00 0000
0xFF
SSPIF
SSPIE
10
RBIE
Bit 3
4
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
The following steps should be taken when configuring
the CCP module for PWM operation:
1.
2.
3.
4.
5.
Set the PWM period by writing to the PR2 regis-
ter.
Set the PWM duty cycle by writing to the
CCPR1L register and CCP1CON<5:4> bits.
Make the CCP1 pin an output by clearing the
TRISC<2> bit.
Set the TMR2 prescale value and enable Timer2
by writing to T2CON.
Configure the CCP1 module for PWM operation.
CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
CCP1IF TMR2IF TMR1IF 0000 0000 0000 0000
Bit 2
T0IF
0xFF
SET-UP FOR PWM OPERATION
10
1
Bit 1
INTF
0x3F
1
8
CCP2IF ---- ---0 ---- ---0
CCP2IE ---- ---0 ---- ---0
RBIF
Bit 0
PIC16C6X
0000 000x 0000 000u
1111 1111 1111 1111
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
xxxx xxxx uuuu uuuu
0x1F
Value on:
1
7
POR,
DS30234D-page 81
BOR
0x17
Value on
all other
5.5
Resets
1

Related parts for PIC16C65A