我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
rookiecalf:
没看出哪里不对了,低有效互补,输出很好啊
我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
user4244115:
回复 rookiecalf:
我加了死区,但是波形不对啊,您可以看一下,黄色是上管,蓝色是下管,死区明显不对啊!
我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
rookiecalf:
回复 user4244115:
高电平重合很显眼啊,这就是低电平有效的死区。除非你想要的是高电平有效,那就是你配置电平方式有问题
我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
user4244115:
回复 rookiecalf:
加我的QQ吧,563287986,需要您的指导,谢谢
我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
user4244115:
回复 rookiecalf:
那我想要一个高电平有效的死区应该怎么设置呢,我真的不知道怎么设置才是正确的设置,希望您能指导一下,谢谢!
我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
rookiecalf:
回复 user4244115:
28335为例:
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC ; //Active high complementary
我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
user4244115:
回复 rookiecalf:
您可以看一下我的程序段,我是给了EPwm1Regs.CMPB = 1000;,CMPA为0,我想通过设置让CMPA随着CMPB变化,最终输出互补的PWM,主要的设置为:
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event EPwm1Regs.DBRED = 450; // Enable INT EPwm1Regs.DBFED = 450;
我想得到高电平有效的死区波形,请您看一下我的寄存器哪一位不对,谢谢您的帮助!
我将 EPwm1Regs.CMPB设置为1000,通过寄存器配置想输出一对互补对称且加死区的PWM,但是输出结果总是不对,请大家帮我分析一下哪里出了问题,谢谢!
EPwm1Regs.CMPA.half.CMPA = 0; // Set compare A value
EPwm1Regs.CMPB = 1000;
EPwm1Regs.AQCTLA.bit.CAU = 0x1; // Set PWM1A on event A, up count
EPwm1Regs.AQCTLA.bit.CAD = 0x2; // Clear PWM1A on event A, down count
EPwm1Regs.AQCTLB.bit.CBU = 0x1; // Set PWM1B on event B, up count
EPwm1Regs.AQCTLB.bit.CBD = 0x2;
EPwm1Regs.DBCTL.all = 0x37; // Select INT on Zero event
EPwm1Regs.DBRED = 450; // Enable INT
EPwm1Regs.DBFED = 450;
rookiecalf:
回复 user4244115:
struct DBCTL_BITS { // bits description Uint16 OUT_MODE:2; // 1:0 Dead Band Output Mode Control Uint16 POLSEL:2; // 3:2 Polarity Select Control Uint16 IN_MODE:2; // 5:4 Dead Band Input Select Mode Control Uint16 rsvd1:10; // 15:4 reserved};
POLSEL是电平有效方式的设定,对应你的配置为b'01,那么对应的方式为:
// POLSEL bits#define DB_ACTV_HI 0x0#define DB_ACTV_LOC 0x1#define DB_ACTV_HIC 0x2#define DB_ACTV_LO 0x3
中的DB_ACTV_LOC ,即低电平有效。
将相应为更改为DB_ACTV_HIC 即可。