Overview

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.

Available PWM Blocks

PWM HS FEP - High-Resolution PWM with Fine Edge Positioning


PWM HighSpeed - High-Speed PWM for dsPIC33C/CH/CK


PWM - Standard PWM for dsPIC30F/33F/33E


MCPWM - Motor Control PWM for PIC32MK


PWM SAM7x - PWM for SAM ARM Microcontrollers


TCC PWM - Timer/Counter for Control (SAM)


PWM Override Blocks

Override blocks provide software control over PWM outputs:

PWM HighSpeed Override

Force PWM outputs to specific states independent of generator. Use with extreme caution - improper use can damage hardware.

📖 View Documentation

PWM SAM7x Override

Override control for SAM7x PWM outputs. Essential for emergency shutdown and safety systems.

📖 View Documentation


Block Selection Guide

By Device Family

Device FamilyRecommended PWM BlockKey Advantage
dsPIC33A (33AK)PWM_HS_FEPHighest resolution (250 ps), fine edge placement
dsPIC33C (CH/CK/CDV)PWM_HighSpeedIndependent time bases, flexible modes
dsPIC33E (non-GS)PWMStandard complementary PWM
dsPIC33E GSPWM_HighSpeedEnhanced features with APLL
dsPIC33F / dsPIC30FPWMdsPIC30F/33F device support
PIC32MKMCPWMDigital comparator integration
SAM E70/S70/V70/V71PWM_SAM7xUp to 8 channels, advanced features
SAM E5x/D5x/C2xTCC_PWMPattern generation, compact

By Application Requirements

ApplicationBlock ChoiceWhy?
Premium 3-Phase MotorPWM_HS_FEPUltra-low THD, fine edge control
Standard 3-Phase MotorPWM_HighSpeedIndependent channels, good performance
BLDC with Hall SensorsTCC_PWMBuilt-in pattern generator
High-Frequency SMPSPWM_HS_FEPSub-nanosecond resolution
Interleaved ConvertersPWM_HighSpeedIndependent time bases per channel
dsPIC30F/33F/33E Motor DrivePWMWide device support
Fault-Tolerant SystemMCPWMDigital comparator, advanced fault handling

PWM-ADC Synchronization

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 PointPWM ModeBenefitTypical Application
Valley (center of low period)Center-alignedMinimum switching noise3-phase motor control
Peak (center of high period)Center-alignedHigh-side current sensingBuck converters
Start of periodEdge-alignedSimple timingBasic power supplies
Mid-periodEdge-alignedBalanced measurementGeneral purpose

Multiple Trigger Support:

Advanced PWM modules (dsPIC33A, dsPIC33C) can generate multiple independent trigger outputs, enabling:

  • Simultaneous multi-phase sampling for 3-phase motor control
  • Staggered ADC conversions to distribute processing load
  • Auxiliary measurements (DC bus voltage, temperature) at different times

Configuration Principles:

  • Choose trigger point based on switching waveform characteristics
  • Verify trigger timing with oscilloscope before motor/power testing
  • Use hardware triggers instead of software polling for deterministic timing
  • Match ADC sample time to source impedance and noise settling requirements

Typical Applications:

  • Motor FOC: Sample phase currents at valley (minimum noise) for current loop
  • SMPS: Sample output voltage mid-period for voltage loop
  • Multi-motor: Use independent triggers for each motor’s ADC channels

Device Family Support Summary

PWM BlockdsPIC30FdsPIC33FdsPIC33EdsPIC33CdsPIC33APIC32MKSAM E7xSAM E5xSAM C2x
PWM✅ (non-GS)
PWM_HighSpeed⚠️ (selected)✅ GS
PWM_HS_FEP
MCPWM⚠️ (selected)
PWM_SAM7x
TCC_PWM

Legend: ✅ Full Support | ⚠️ Selected Devices | ❌ Not Available


See Also

Related Block Categories:

  • ADC Blocks - For PWM-synchronized current/voltage sampling
  • Timer Blocks - For precise timing and capture
  • Encoders - For motor position feedback (QEI, PDEC)

Application Notes:

  • AN1078 - Sensorless Field-Oriented Control of PMSM
  • AN1292 - Sensorless Field-Oriented Control of Three-Phase PMSMs
  • AN1160 - Sensorless Field-Oriented Control

Example Projects:


💡 Need Help Choosing?

  • For dsPIC33A → PWM_HS_FEP
  • For dsPIC33C designs → PWM_HighSpeed
  • For dsPIC33F/33E → PWM
  • For ARM-based designs → PWM_SAM7x or TCC_PWM

MCPWM

MCPWM (Motor Control PWM) offers enhanced features beyond standard PWM blocks, including programmable fault sources with digital comparator inputs, …

Read more →

PWM

The PWM block supports up to 4 complementary PWM channel pairs with independent duty cycle control, dead-time insertion, fault protection, and …

Read more →

PWM HighSpeed

This block is designed for demanding motor control and power conversion applications requiring precise timing, independent channel control, and high …

Read more →

PWM HighSpeed Override

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 →

PWM HS FEP

This advanced PWM peripheral is specifically designed for precision motor control, high-frequency power conversion, and applications demanding …

Read more →

PWM SAM7x

Advanced PWM peripheral for SAM ARM Cortex-M microcontrollers. Provides complementary PWM with dead-time, fault protection, and pattern generation …

Read more →

PWM SAM7x Override

All SAM7x families: SAME5x, SAME7x, SAMC2x, SAMD2x Supported Device Families SAM E70 SAM S70 SAM V70 SAM V71 Configuration Parameters Parameter …

Read more →

TCC PWM

Timer/Counter for Control (TCC) PWM peripheral for SAM microcontrollers. Features advanced pattern generation, complementary outputs with dead-time, …

Read more →