原理介绍
F280049C的PWM模块功能强大,可以比较容易的实现移相控制。 本节主要向大家讲述用DSP如何编程实现移相控制,如下图所示为移相全桥变换器的移相控制示意图,其中EPWM1A和EPWM1B为占空比50%的互补信号,EPWM2A和EPWM2B也为占空比50%的互补信号。通过控制EPWM1A和EPWM2B的移相角来实现移相控制。
如上图标注所示,控制上以PWM1的计数时基为基准信号,在PWM1的计数器为零(宏:EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO)时PWM1发出同步脉冲SyncOut,同时配置PWM2的同步信号来源为Syncln(宏:EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN)。相关的宏定义如下所示:
typedef enum
{
//! sync pulse is generated by software
EPWM_SYNC_OUT_PULSE_ON_SOFTWARE = 0,
//! sync pulse is passed from EPWMxSYNCIN
EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN = 0,
//! sync pulse is generated when time base counter equals zero
EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO = 1,
//! sync pulse is generated when time base counter equals compare B value.
EPWM_SYNC_OUT_PULSE_ON_COUNTER_COMPARE_B = 2,
//! sync pulse is disabled
EPWM_SYNC_OUT_PULSE_DISABLED = 4,
//! sync pulse is generated when time base counter equals compare D value.
EPWM_SYNC_OUT_PULSE_ON_COUNTER_COMPARE_C = 5,
//! sync pulse is disabled.
EPWM_SYNC_OUT_PULSE_ON_COUNTER_COMPARE_D = 6
}EPWM_SyncOutPulseMod
当PWM1的时基计数到零数发出同步脉冲,此时,PWM2接收到同步脉冲后将相位寄存器TBPHS中的值加载到时基计数器TBCTR中。也就是说,当PWM1从零开始计数时,PWM2此时从TBPHS寄存器中的值开始计数。因此,PWM1和PWM2实现了移相,改变TBPHS寄存器中的值可以改变移相控制的移相角。