24 PWM - Pulse-Width Modulation

The PWM module generates a Pulse-Width Modulated signal determined by the duty cycle, period, and resolution that are configured by the following registers:

  • TxPR
  • TxCON
  • PWMxDC
  • PWMxCON
Important: The corresponding TRIS bit must be cleared to enable the PWM output on the PWMx pin.

Each PWM module can select the timer source that controls the module. Note that the PWM mode operation is described with respect to TMR2 in the following sections.

Figure 24-1 shows a simplified block diagram of PWM operation.

Figure 24-2 shows a typical waveform of the PWM signal.

Figure 24-1. Simplified PWM Block Diagram
Note:
  1. 8-bit timer is concatenated with two bits generated by Fosc or two bits of the internal prescaler to create 10-bit time base.
Figure 24-2. PWM Output

For a step-by-step procedure on how to set up this module for PWM operation, refer to 24.9 Setup for PWM Operation Using PWMx Output Pins.