When to use:
When NOT to use:
| Parameter | Description | Values |
|---|---|---|
| OverrideChannels | Select which PWM channels are controlled by override | Vector of channel numbers [1 2 3 …] |
| OverrideMode | Override application mode | โข Individual (per channel control) |
| Parameter | Description | Values |
|---|---|---|
| DefaultState_H | Default state for high-side outputs when override active | 0 (Low), 1 (High) |
| DefaultState_L | Default state for low-side outputs when override active | 0 (Low), 1 (High) |
| SyncMode | Synchronization with PWM timebase | โข Immediate (override applied immediately) |
| Input | Type | Description |
|---|---|---|
| Override_En 1..N | boolean | Enable override for channel N (1=override active, 0=normal PWM) |
| Override_H 1..N | boolean | High-side output state when override enabled for channel N |
| Override_L 1..N | boolean | Low-side output state when override enabled for channel N |
| Input | Type | Description |
|---|---|---|
| Override_En | boolean | Enable override for all selected channels |
| Override_Value | uint16 | Bitfield: override state for all channels |
| Output | Type | Description |
|---|---|---|
| Override_Status | uint16 | Current override register value (IOCONx.OVRDAT bits) |
| Override_Active | boolean | Indicates if any override is currently active |
| Application | Safe State | Rationale |
|---|---|---|
| Motor Drive (Half-bridge) | All outputs LOW | Prevents shoot-through, allows motor to freewheel via body diodes |
| Buck Converter | High-side OFF, Low-side ON | Maintains inductor current path, prevents voltage spikes |
| Boost Converter | High-side OFF, Low-side ON | Prevents output overvoltage |
| Push-Pull Transformer | Both sides OFF | Prevents transformer saturation |
% Configuration:
% OverrideChannels = [1 2 3]; % All motor phases
% OverrideMode = 'Grouped';
% DefaultState_H = 0; % All high-sides OFF
% DefaultState_L = 0; % All low-sides OFF
% SyncMode = 'Immediate'; % Fastest response
% Model logic:
% Connect emergency stop button -> Override_En input
% When E-stop pressed: all outputs forced LOW immediately
% Simulink implementation:
% [E_Stop] โโโ [Override_En]
% [0] โโโ [Override_Value] % All bits 0 = all outputs LOW
% Configuration:
% OverrideChannels = [1 2 3];
% OverrideMode = 'Individual';
% Test sequence (executed by state machine):
% 1. Override PWM1: High-side ON, Low-side OFF
% 2. Measure current
% 3. Override PWM1: High-side OFF, Low-side ON
% 4. Measure current
% 5. Repeat for PWM2, PWM3
% Block inputs:
% Override_En_1 = test_active && (phase == 1);
% Override_H_1 = test_state == HIGH_SIDE_TEST;
% Override_L_1 = test_state == LOW_SIDE_TEST;
% For 6-step BLDC commutation with hall sensors:
% OverrideChannels = [1 2 3];
% OverrideMode = 'Grouped';
% Commutation table (hall sensor state -> override value):
% Hall = 001: PWM1H=1, PWM1L=0, PWM2H=0, PWM2L=1, PWM3H/L=0
% Hall = 010: ...
commutationTable = [
bin2dec('000000'), % Hall 000 (invalid)
bin2dec('100001'), % Hall 001
bin2dec('001100'), % Hall 010
bin2dec('101100'), % Hall 011
bin2dec('110010'), % Hall 100
bin2dec('110001'), % Hall 101
bin2dec('011010'), % Hall 110
bin2dec('000000') % Hall 111 (invalid)
];
% Model:
% [Hall_State] โโโ [Lookup Table] โโโ [Override_Value]
% (commutationTable)
% [BLDC_Mode] โโโ [Override_En] % Enable override in BLDC mode
% Prevent both high and low side ON simultaneously:
% OverrideChannels = [1 2 3];
% OverrideMode = 'Individual';
% SyncMode = 'Synchronized'; % Avoid glitches
% Protection logic (for each channel):
% if (PWM_H_command && PWM_L_command) % Illegal state
% Override_En = 1;
% Override_H = 0;
% Override_L = 0;
% else
% Override_En = 0; % Normal PWM operation
% end
Possible Causes:
Solutions:
Symptom: Momentary short circuit during override enable/disable Solutions:
The override block configures the following registers:
| Register | Bits | Purpose |
|---|---|---|
| IOCONx | OVRENH, OVRENL | Enable override for high and low outputs |
| IOCONx | OVRDAT[1:0] | Override data (output pin states when override enabled) |
| IOCONx | OSYNC | Override synchronization (0=immediate, 1=sync with PWM) |
When multiple control mechanisms are active, the priority order is:
MCHP_PWM_HighSpeed - Main PWM block (required for override block to function)
MCHP_PWM - Standard PWM (has built-in OVDCON register control)
MCHP_PWM_SAM7x_Override - Override block for SAM7x devices
MCHP_Comparator - Hardware fault generation
[Peripheral Block Overview](../
dsPIC33F/EP Family Reference Manual - PWM Override Control
dsPIC33C Family Reference Manual - Output Override and Polarity Control