我想在线计算Ton=1500(1+Msin(2*k*pi/N)),其中M,K,,N都是变量,我想利用IO格式来计算,这样可以提高处理速度,不知该怎样列式?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我想在线计算Ton=1500(1+Msin(2*k*pi/N)),其中M,K,,N都是变量,我想利用IO格式来计算,这样可以提高处理速度,不知该怎样列式?
今天找到解决的办法了,关键在于IQ格式的选择,因为要SIN值,故选为IQ24(要求高精度),后面要计算PWM,选为IQ15(范围要大)。
同时也调用了_IQtoIQ15和_IQ15toF函数
ton1=_IQ(0.5)+ _IQmpy(_IQ(M/2 ),_IQsin(_IQ(PI/N)+ _IQ(2*PI*k/N)));
pwm1[k]=_IQ15toF ((_IQtoIQ15(ton1))*pwm/2);