English
Language : 

PIC24FJ256GB110-I Datasheet, PDF (164/328 Pages) Microchip Technology – 64/80/100-Pin, 16-Bit Flash Microcontrollers with USB On-The-Go (OTG)
PIC24FJ256GB110 FAMILY
13.3 Pulse-Width Modulation (PWM)
Mode
In PWM mode, the output compare module can be
configured for edge-aligned or center-aligned pulse
waveform generation. All PWM operations are
double-buffered (buffer registers are internal to the
module and are not mapped into SFR space).
To configure the output compare module for PWM
operation:
1. Configure the OCx output for one of the
available Peripheral Pin Select pins.
2. Calculate the desired duty cycles and load them
into the OCxR register.
3. Calculate the desired period and load it into the
OCxRS register.
4. Select the current OCx as the trigger/sync source
by writing 0x1F to SYNCSEL<4:0>
(OCxCON2<4:0>).
5. Select a clock source by writing the
OCTSEL2<2:0> (OCxCON<12:10>) bits.
6. Enable interrupts, if required, for the timer and
output compare modules. The output compare
interrupt is required for PWM Fault pin utilization.
7. Select the desired PWM mode in the OCM<2:0>
(OCxCON1<2:0>) bits.
8. If a timer is selected as a clock source, set the
TMRy prescale value and enable the time base by
setting the TON (TxCON<15>) bit.
Note:
This peripheral contains input and output
functions that may need to be configured
by the peripheral pin select. See
Section 9.4 “Peripheral Pin Select” for
more information.
FIGURE 13-2:
OUTPUT COMPARE BLOCK DIAGRAM (DOUBLE-BUFFERED, 16-BIT PWM MODE)
OCTSELx
SYNCSELx
TRIGSTAT
TRIGMODE
OCTRIG
OCxCON1
OCxCON2
OCxR
Rollover/Reset
OCxR buffer
OC Clock
Sources
Trigger and
Sync Sources
Clock
Select
Increment
Reset
Trigger and Match Event
Sync Logic
Comparator
OCxTMR
Match
Event
Rollover
Comparator
OCxRS buffer
Match
Event
OCMx
OCINV
OCTRIS
FLTOUT
FLTTRIEN
FLTMD
ENFLT0
OCFLT0
OC Output and
Fault Logic
OCx Pin
OCFA/OCFB
Rollover/Reset
Reset
OCxRS
OCx Interrupt
Note 1: The OCx outputs must be assigned to an available RPn pin before use. Please see Section 9.4 “Peripheral
Pin Select” for more information.
DS39897B-page 162
Preliminary
© 2008 Microchip Technology Inc.