用dsp28335产生三个都是1kHz的pwm波,占空比为1/3,它们之间的相位差是180度,如何改下面的程序?
voidInitEPwm1Example(){//SetupTBCLKEPwm1Regs.TBPRD=2000;//Settimerperiod801TBCLKsEPwm...
void InitEPwm1Example()
{
// Setup TBCLK
EPwm1Regs.TBPRD = 2000; // Set timer period 801 TBCLKs
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.TBCTR = 0x0000; // Clear counter
// Set Compare values
EPwm1Regs.CMPA.half.CMPA = EPWM1_MIN_CMPA; // Set compare A value
EPwm1Regs.CMPB = EPWM1_MAX_CMPB; // Set Compare B value
// Setup counter mode
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0x01; // Clock ratio to SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV =0x02; 展开
{
// Setup TBCLK
EPwm1Regs.TBPRD = 2000; // Set timer period 801 TBCLKs
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.TBCTR = 0x0000; // Clear counter
// Set Compare values
EPwm1Regs.CMPA.half.CMPA = EPWM1_MIN_CMPA; // Set compare A value
EPwm1Regs.CMPB = EPWM1_MAX_CMPB; // Set Compare B value
// Setup counter mode
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0x01; // Clock ratio to SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV =0x02; 展开
1个回答
展开全部
EPwm1Regs.TBPRD = 2000; // Set timer period 801 TBCLKs
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.CMPA.half.CMPA = EPWM1_MIN_CMPA; // Set compare A value
EPwm2Regs
EPwm3Regs
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.CMPA.half.CMPA = EPWM1_MIN_CMPA; // Set compare A value
EPwm2Regs
EPwm3Regs
追问
如果是相差120度呢,求教,PHS该设置为多少,谢谢啦!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询