本帖最后由 salon 于 2015-1-23 18:18 编辑
Mircrochip文档AN1017《使用dsPIC30F DSC实现PMSM电机的正弦驱动》的程序中,请教大家:
在SVM.c文件中:
//volts = 0x7F97; //5990.4 RPM
//angle = 57344; // PHASE_ZERO
void SVM(int volts, unsigned int angle)
{
......
tpwm = PTPER << 1 = 1000;
..............
else //第258行
{
angle2 = angle - VECTOR6; // Reference SVM angle to the current
//angle2 = 57344 - 0xd555 = 2731 ;
angle1 = SIXTY_DEG - angle2; // Calculate second angle referenced to
//angle1 = 0x2aaa - 2731 = 8191;
t1 = sinetable[(unsigned char)(angle1 >> 6)]; // Look up values from
//t1 = sinetable[127] = 22992;
t2 = sinetable[(unsigned char)(angle2 >> 6)];
//t2 = sinetable[42] = 8335;
t1 = ((long)t1*(long)volts) >> 15;
//t1 = (22992*0x7F97) >> 15=22918
t1 = ((long)t1*(long)tpwm) >> 15;
//t1 = (22918*1000)>>15 = 699;
t2 = ((long)t2*(long)volts) >> 15;
//t2 = (8335*0x7F97)>> = 8308;
t2 = ((long)t2*(long)tpwm) >> 15;
//t2 = (8308*1000)>>15=253;
half_t0 = (tpwm - t1 - t2) >> 1; // Calculate half_t0 null time from
// period and t1,t2
// Calculate duty cycles for Sector 6 ( 300 - 359 degrees )
PDC1 = t1 + t2 + half_t0;
PDC2 = half_t0;
PDC3 = t1 + half_t0;
}
} // end SVM()
不管怎么算都PDC1比PTPER(500)大???
PDC1比PTPER大,PWM怎么出来呢?
使用中心对齐模式的PWM输出的。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
下面这张图也许能解释
未命名.JPG (31.74 KB, 下载次数: 0)
下载附件
2015-1-23 22:11 上传
谢谢。我再看一下。
一周热门 更多>