TI中文支持网
TI专业的中文技术问题搜集分享网站

F28M35x PWM输出方向设定

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Hank Zhao:

更改后的波形是什么样的?

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Sam Su:

回复 Hank Zhao:

你好,

是这样的,

正常设定CMPA值增加时,PWM输出的高电平宽度变小。

而将AQCTLA的设定反向时,CMPA增加,PWM输出的高电平宽度也是变小的。

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Hank Zhao:

回复 Sam Su:

你需要将ZRO和PRD也设置成反相。

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Terry Deng:

回复 Sam Su:

你的程序修改是没错的。有种可能是你开启了死区设置,并且以EPWMB为基准,这样PWMA输出只会按照B通道设置。你可以把整个EPWM的所有寄存器设置发上来检查

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Sam Su:

回复 Terry Deng:

原来的设定:

//EPMW Module 1 config // Setup TBCLK EPwm1Regs.TBPRD = EPWM1_TIMER_TBPRD; // 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

// Setup counter mode EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up/down EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // Clock ratio to SYSCLKOUT EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1; EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module

// Setup shadowing EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // Load on Zero EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

// Set actions EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

// // Active Low PWMs – Setup Deadband

EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; EPwm1Regs.DBRED = EPWM_DB; EPwm1Regs.DBFED = EPWM_DB;

反向的设定:

//EPMW Module 1 config // Setup TBCLK EPwm1Regs.TBPRD = EPWM1_TIMER_TBPRD; // 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

// Setup counter mode EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up/down EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // Clock ratio to SYSCLKOUT EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1; EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module

// Setup shadowing EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // Load on Zero EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

 EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Set PWM1A on event A, up count EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Clear PWM1A on event A, down count

// // Active Low PWMs – Setup Deadband EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC; EPwm1Regs.DBRED = EPWM_DB; EPwm1Regs.DBFED = EPWM_DB;

请帮忙检查!

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

bad:

回复 Sam Su:

EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;

设置成这样,直接取反

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Sam Su:

回复 bad:

不行呢。

设置成这样EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;

死区的前后顺序不正确。正常需要A延后B下降,但是这样设定变成A提前B下降了。

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Sam Su:

回复 Terry Deng:

 Dear  Terry :

请问这样的配置要怎么修改!

还请帮忙!

谢谢!

请问一下,将C28设定为PWM输出控制电机。按照例参考手册设定可以正常工作,但是现在希望将PWM输出反向,其它设定不变。 

原始设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event A, down count

更改后的设定

EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR ; // Clear PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET; // Set PWM1A on event A, down count

但是PWM实际输出不是想要的波形,不知要需要怎样设定,请指教!

Sam Su:

回复 Terry Deng:

Terry:

可以了!

感谢!

赞(0)
未经允许不得转载:TI中文支持网 » F28M35x PWM输出方向设定
分享到: 更多 (0)