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.
Override control for SAM7x PWM outputs. Essential for emergency shutdown and safety systems.
| 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?
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 →Advanced PWM peripheral for SAM ARM Cortex-M microcontrollers. Provides complementary PWM with dead-time, fault protection, and pattern generation …
Read more →All SAM7x families: SAME5x, SAME7x, SAMC2x, SAMD2x Supported Device Families SAM E70 SAM S70 SAM V70 SAM V71 Configuration Parameters Parameter …
Read more →Timer/Counter for Control (TCC) PWM peripheral for SAM microcontrollers. Features advanced pattern generation, complementary outputs with dead-time, …
Read more →