Enhanced PWM Auto-Shutdown/Auto-Restart

The Enhanced PWM mode supports Auto-Shutdown mode and Auto-Restart mode.


Figure 1: Waveform showing the Auto-Shutdown/Auto-Restart


Auto-Shutdown will disable the PWM outputs when an external shutdown event occurs and places the PWM output pins into a predetermined state. This mode is used to help prevent the PWM from damaging the application. The auto-shutdown sources are selected using the CCPxAS<2:0> bits of the CCPxAS register. A shutdown event may be generated by:

  • A logic ‘0’ on the INT pin
  • A logic ‘1’ on a Comparator (Cx) output

A shutdown condition is indicated by the CCPxASE (Auto-Shutdown Event Status) bit of the CCPxAS register.

  • If the bit is a ‘0’, the PWM pins are operating normally.
  • If the bit is a ‘1’, the PWM outputs are in the shutdown state.

When a shutdown event occurs, two things happen:

1) The CCPxASE bit is set to ‘1’. The CCPxASE will remain set until cleared in firmware or an auto-restart occurs.

2) The enabled PWM pins are asynchronously placed in their shutdown states. The PWM output pins are grouped into pairs [PxA/PxC] and [PxB/PxD]. The state of each pin pair is determined by the PSSxAC and PSSxBD bits of the CCPxAS register. Each pin pair may be placed into one of three states:

  • Drive logic ‘1’
  • Drive logic ‘0’
  • Tri-state (high-impedance)

In the Figure 1 waveform plot above, the Shut-Down occurs at the "Shutdown Event Occurs" label. This is caused by the Comparator Output going to a high state.


The Enhanced PWM can be configured to automatically restart the PWM signal once the auto-shutdown condition has been removed. Auto-restart is enabled by setting the PxRSEN bit in the PWMxCON register.

If auto-restart is enabled, the CCPxASE bit will remain set as long as the auto-shutdown condition is active.

When the auto-shutdown condition is removed, the CCPxASE bit will be cleared via hardware and normal operation will resume.

This can be seen in Figure 1 above where the "PWM Resumes" label is shown. The Auto-Restart actually occurs right after the CCPxASE is cleared but the PWM waveform cannot start until a full pulse can be released.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.