好像不是硬件上的问题,以前SPWM都好着呢,昨天改了改角度又脉宽少的严重了。
void SPWMacc(void)
{
unsigned long int temp,Theta_temp;
unsigned int sin_angle1,sin_angle2;
unsigned int t1,t2,t0;
unsigned int PDC11,PDC12,PDC13;
temp=(unsigned long int)(K*Fref);
Theta=Theta+(unsigned int)(temp>>17);
phase=Theta/10924;
//t1,t2,t0
Theta_temp=Theta;
sin_angle1=sin_angle(Theta);
temp=(unsigned long int)(M*sin_angle1);
temp=(unsigned long int)(temp>>6);
temp=(unsigned long int)(temp*DUTY);
t1=(unsigned int)(temp>>17);
Theta_temp=10922-Theta;
sin_angle2=sin_angle(Theta);
temp=(unsigned long int)(M*sin_angle2); //M,q15
temp=(unsigned long int)(temp>>6);
temp=(unsigned long int)(temp*DUTY);
t2=(unsigned int)(temp>>17);