Namaste,我正在研究带有DSPIC30F4011i的PWM问题,因为当我增加PDC占空比的值降低时,请发现波形第一波形是PWM1H(PDC1=1999)和第二个PWM2H(PDC2=19999)。根据我的理解,应该是相反的,请解释为什么?…程序…使用主(空){TrISE=0x00;和/或确保PWM引脚被设置为输出端口=0x00;/ /清除输出PTCONBITS.PPES=1;/PWM PWM定时器规模比例PTCONPS.PTCKPS=0;//PWM定时器预刻度PTCONPTS.PTMOD=2;//PWM工作在上下模式连续PTMR=0;//P。WM计数器值,开始于0 PTP= 19999;//PWM时基周期PWMCON1比特。PMOD3=0;//PWM在互补模式PWMCON1BIT.PMOD2=0;//PWM在互补模式PWMCON1BIT.PMOD1=0;//PWM在互补模式PWMCON1BITS PN3H=1;//PWM高引脚启用PWMCON1BITS PN2H=1;//P;WM高PIN启用PWMCON1BITS PUN1H=1;//PWM高PIN启用PWMCON1BITS PEN3L=1;//启用PWM Low pin(方向控制?)PWMCON1比特?PN2L=1;/ / PWM Low pin启用(方向控制?)PWMCON1比特?PUN1L=1;/ / PWM Low pin启用(方向控制?)DTCON1BITS DTAPs=0;//死区预缩放器DTCON1BITS DTA=59;/死区时间值为4 U.PDC1=1999;//PWM×1占空比寄存器(11位)PDC2=19999;/PWM PWM 2占空比寄存器(11位)PDC3=30000;/PWM PWM占线占空比寄存器(11位)PTCONBITS.PTEN=1;/ /启用PWM定时库!(1){}
以上来自于百度翻译
以下为原文
Namaste,
I am working on pwm with DSPIC30f4011
My problem is that as i increase the value of PDC duty cycle reduces.
Please find the waveform first waveform is of PWM1H(PDC1=1999) and second of PWM2H(PDC2=19999).
As per my understanding it should be opposite, kindly explain why?
........
Program used
int main(void)
{
TRISE = 0x00; // make sure PWM pins are set to be outputs
PORTE = 0x00; // clear the outputs
PTCONbits.PTOPS = 1; // PWM
timer post-scale
PTCONbits.PTCKPS = 0; // PWM timer pre-scale
PTCONbits.PTMOD = 2; // PWM operates in Up-down Mode continuously
PTMR = 0; // PWM counter value, start at 0
PTPER = 19999; // PWM Timebase period
PWMCON1bits.PMOD3 = 0; // PWM in complimentary mode
PWMCON1bits.PMOD2 = 0; // PWM in complimentary mode
PWMCON1bits.PMOD1 = 0; // PWM in complimentary mode
PWMCON1bits.PEN3H = 1; // PWM High pin is enabled
PWMCON1bits.PEN2H = 1; // PWM High pin is enabled
PWMCON1bits.PEN1H = 1; // PWM High pin is enabled
PWMCON1bits.PEN3L = 1; // PWM Low pin enabled (direction control later?)
PWMCON1bits.PEN2L = 1; // PWM Low pin enabled (direction control later?)
PWMCON1bits.PEN1L = 1; // PWM Low pin enabled (direction control later?)
DTCON1bits.DTAPS = 0; //DeadTime pre-scaler
DTCON1bits.DTA = 59; //DeadTime value for 4 us.
PDC1 = 1999; // PWM#1 Duty Cycle register (11-bit)
PDC2 = 19999; // PWM#2 Duty Cycle register (11-bit)
PDC3 = 30000; // PWM#3 Duty Cycle register (11-bit)
PTCONbits.PTEN = 1; // Enable PWM Timerbase!
while(1)
{}
}
Attached Image(s)