Datasheet
PIC16(L)F1782/3
DS41579D-page 214 Preliminary 2011-2012 Microchip Technology Inc.
24.3.3 PUSH-PULL PWM
The push-pull PWM is used to drive transistor bridge
circuits. It uses at least two outputs and generates
PWM signals that alternate between the two outputs in
even and odd cycles.
Variations of the push-pull waveform include four
outputs with two outputs being complementary or two
sets of two identical outputs. Refer to Sections 24.3.4
through 24.3.6 for the other Push-Pull modes.
24.3.3.1 Mode Features
• No dead-band control available
• No steering control available
• Output is on the following two pins only:
- PSMCxA
- PSMCxB
24.3.3.2 Waveform Generation
Odd numbered period rising edge event:
• PSMCxA is set active
Odd numbered period falling edge event:
• PSMCxA is set inactive
Even numbered period rising edge event:
• PSMCxB is set active
Even numbered period falling edge event:
• PSMCxB is set inactive
Code for setting up the PSMC generate the comple-
mentary single-phase waveform shown in Figure 24-6,
and given in Example 24-3.
EXAMPLE 24-3: PUSH-PULL SETUP
FIGURE 24-6: PUSH-PULL PWM WAVEFORM
Note: This is a subset of the 6-pin output of the
push-pull PWM output, which is why pin
functions are fixed in these positions, so
they are compatible with that mode. See
Section 24.3.6 “Push-Pull PWM with Four
Full-Bridge and Complementary Out-
puts”
; Push-Pull PWM PSMC setup
; Fully synchronous operation
; Period = 10 us
; Duty cycle = 50% (25% each phase)
BANKSEL PSMC1CON
MOVLW 0x02 ; set period
MOVWF PSMC1PRH
MOVLW 0x7F
MOVWF PSMC1PRL
MOVLW 0x01 ; set duty cycle
MOVWF PSMC1DCH
MOVLW 0x3F
MOVWF PSMC1DCL
CLRF PSMC1PHH ; no phase offset
CLRF PSMC1PHL
MOVLW 0x01 ; PSMC clock=64 MHz
MOVWF PSMC1CLK
; output on A and B, normal polarity
MOVLW B’00000011’
MOVWF PSMC1OEN
CLRF PSMC1POL
; set time base as source for all events
BSF PSMC1PRS, P1PRST
BSF PSMC1PHS, P1PHST
BSF PSMC1DCS, P1DCST
; enable PSMC in Push-Pull Mode
; this also loads steering and time buffers
MOVLW B’11000010’
MOVWF PSMC1CON
BANKSEL TRISC
BCF TRISC, 0 ; enable pin drivers
BCF TRISC, 1
1 2 3
B Output
A Output A Output
PWM Period Number
Period Event
Rising Edge Event
Falling Edge Event
PSMCxA
PSMCxB