English
Language : 

PIC18F6390 Datasheet, PDF (157/412 Pages) Microchip Technology – 64/80-Pin Flash Microcontrollers with LCD Driver and nanoWatt Technology
PIC18F6390/6490/8390/8490
14.4.3 SETUP 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
CCPR2L register and CCP2CON<5:4> bits.
3. Make the CCP2 pin an output by clearing the
appropriate TRIS bit.
4. Set the TMR2 prescale value, then enable
Timer2 by writing to T2CON.
5. Configure the CCP2 module for PWM operation.
TABLE 14-5: REGISTERS ASSOCIATED WITH PWM AND TIMER2
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page
INTCON GIE/GIEH PEIE/GIEL TMR0IE INT0IE
RBIE TMR0IF INT0IF RBIF
59
RCON
IPEN SBOREN
—
RI
TO
PD
POR
BOR
60
PIR1
—
ADIF
RC1IF
TX1IF
SSPIF CCP1IF TMR2IF TMR1IF 61
PIE1
—
ADIE
RC1IE
TX1IE
SSPIE CCP1IE TMR2IE TMR1IE 61
IPR1
—
ADIP
RC1IP
TX1IP
SSPIP CCP1IP TMR2IP TMR1IP 61
TRISC PORTC Data Direction Register
62
TRISE PORTE Data Direction Register
—
—
—
—
62
TMR2
Timer2 Module Register
60
PR2
Timer2 Module Period Register
60
T2CON
— T2OUTPS3 T2OUTPS2 T2OUTPS1 T2OUTPS0 TMR2ON T2CKPS1 T2CKPS0 60
CCPR1L Capture/Compare/PWM Register 1 (LSB)
61
CCPR1H Capture/Compare/PWM Register 1 (MSB)
61
CCP1CON —
—
DC1B1 DC1B0 CCP1M3 CCP1M2 CCP1M1 CCP1M0 61
CCPR2L Capture/Compare/PWM Register 2 (LSB)
61
CCPR2H Capture/Compare/PWM Register 2 (MSB)
61
CCP2CON —
—
DC2B1 DC2B0 CCP2M3 CCP2M2 CCP2M1 CCP2M0 61
Legend: — = unimplemented, read as ‘0’. Shaded cells are not used by PWM or Timer2.
 2004 Microchip Technology Inc.
Preliminary
DS39629B-page 155