Pulse Width Modulation (PWM) blocks provide high-performance waveform generation for motor control, power conversion, and signal generation applications. The MPLAB Blockset offers PWM blocks optimized for different device families and application requirements, from edge-aligned PWM to high-resolution PWM with fine edge positioning.
Override blocks provide software control over PWM outputs:
Force PWM outputs to specific states independent of generator. Use with extreme caution - improper use can damage hardware.
๐ View Documentation
Override control for SAM7x PWM outputs. Essential for emergency shutdown and safety systems.
๐ View Documentation
| Device Family | Recommended PWM Block | Key Advantage |
|---|---|---|
| dsPIC33A (33AK) | PWM_HS_FEP | Highest resolution (250 ps), fine edge placement |
| dsPIC33C (CH/CK/CDV) | PWM_HighSpeed | Independent time bases, flexible modes |
| dsPIC33E (non-GS) | PWM | Standard complementary PWM |
| dsPIC33E GS | PWM_HighSpeed | Enhanced features with APLL |
| dsPIC33F / dsPIC30F | PWM | dsPIC30F/33F device support |
| PIC32MK | MCPWM | Digital comparator integration |
| SAM E70/S70/V70/V71 | PWM_SAM7x | Up to 8 channels, advanced features |
| SAM E5x/D5x/C2x | TCC_PWM | Pattern generation, compact |
| Application | Block Choice | Why? |
|---|---|---|
| Premium 3-Phase Motor | PWM_HS_FEP | Ultra-low THD, fine edge control |
| Standard 3-Phase Motor | PWM_HighSpeed | Independent channels, good performance |
| BLDC with Hall Sensors | TCC_PWM | Built-in pattern generator |
| High-Frequency SMPS | PWM_HS_FEP | Sub-nanosecond resolution |
| Interleaved Converters | PWM_HighSpeed | Independent time bases per channel |
| dsPIC30F/33F/33E Motor Drive | PWM | Wide device support |
| Fault-Tolerant System | MCPWM | Digital comparator, advanced fault handling |
Critical for motor control and power conversion - ADC sampling must be synchronized with PWM to minimize switching noise and ensure accurate measurements.
How It Works:
PWM modules can generate trigger signals that automatically start ADC conversions at precise moments within the PWM period. This synchronization ensures current and voltage measurements occur when switching transients have settled, providing clean data for control algorithms.
Trigger Timing Strategies:
| Trigger Point | PWM Mode | Benefit | Typical Application |
|---|---|---|---|
| Valley (center of low period) | Center-aligned | Minimum switching noise | 3-phase motor control |
| Peak (center of high period) | Center-aligned | High-side current sensing | Buck converters |
| Start of period | Edge-aligned | Simple timing | Basic power supplies |
| Mid-period | Edge-aligned | Balanced measurement | General purpose |
Multiple Trigger Support:
Advanced PWM modules (dsPIC33A, dsPIC33C) can generate multiple independent trigger outputs, enabling:
Configuration Principles:
Typical Applications:
| PWM Block | dsPIC30F | dsPIC33F | dsPIC33E | dsPIC33C | dsPIC33A | PIC32MK | SAM E7x | SAM E5x | SAM C2x |
|---|---|---|---|---|---|---|---|---|---|
| PWM | โ | โ | โ (non-GS) | โ | โ | โ | โ | โ | โ |
| PWM_HighSpeed | โ | โ ๏ธ (selected) | โ GS | โ | โ | โ | โ | โ | โ |
| PWM_HS_FEP | โ | โ | โ | โ | โ | โ | โ | โ | โ |
| MCPWM | โ | โ | โ | โ ๏ธ (selected) | โ | โ | โ | โ | โ |
| PWM_SAM7x | โ | โ | โ | โ | โ | โ | โ | โ | โ |
| TCC_PWM | โ | โ | โ | โ | โ | โ | โ | โ | โ |
Legend: โ Full Support | โ ๏ธ Selected Devices | โ Not Available
Related Block Categories:
Application Notes:
Example Projects:
๐ก Need Help Choosing?
Advanced PWM peripheral for SAM ARM Cortex-M microcontrollers. Provides complementary PWM with dead-time, fault protection, and pattern generation โฆ
Read more โMCPWM (Motor Control PWM) offers enhanced features beyond standard PWM blocks, including programmable fault sources with digital comparator inputs, โฆ
Read more โThe PWM block supports up to 4 complementary PWM channel pairs with independent duty cycle control, dead-time insertion, fault protection, and โฆ
Read more โThis block is designed for demanding motor control and power conversion applications requiring precise timing, independent channel control, and high โฆ
Read more โThe override block works in conjunction with the MCHP_PWM_HighSpeed block and can force PWM outputs to specific logic levels regardless of the PWM โฆ
Read more โThis advanced PWM peripheral is specifically designed for precision motor control, high-frequency power conversion, and applications demanding โฆ
Read more โDirect control of PWM output pins for SAM7x devices, allowing software override of PWM signals for safety shutdown, diagnostics, and custom patterns. โฆ
Read more โTimer/Counter for Control (TCC) PWM peripheral for SAM microcontrollers. Features advanced pattern generation, complementary outputs with dead-time, โฆ
Read more โ