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.

旋变解码例程pmsm3_3旋变解码部分程序量过大,超出中断执行周期



如题选编解码文件resolver.c中的程序量实测过长,执行时间为20us左右,而电机控制中断周期为20K,即50usresolver解码加上电机控制部分的程序之后,时间超出了50us,导致实际结果更新速度不够,比如我给定转速800转,但实际速度只有400转,如果我把以下旋变解码部分程序屏蔽之后,则转速恢复正常,此问题该如何解决呢?

    speed1.SinIn = _IQ15toIQ((int32)adc1.Ch3Out);

    speed1.CosIn = _IQ15toIQ((int32)adc1.Ch4Out); 

    speed1.calc(&speed1);