MC9S12ZVML128_LIN_BLDC_Sensorless code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MC9S12ZVML128_LIN_BLDC_Sensorless code

跳至解决方案
1,677 次查看
itsnewforme
Contributor IV

Hii, I'm using the code MC9S12ZVML128_LIN_BLDC_Sensorless for S12ZVML. I've flashed the code on the microcontroller and after running the code the motor rotates with 1500 rpm. How do I change the speed of the motor in the code ?

0 项奖励
回复
1 解答
1,658 次查看
lama
NXP TechSupport
NXP TechSupport

There is a FreeMaster variable requiredSpeeed which is connected to a variable with the same name in the project - requireSpeed. You can find any suitable place or event to modify the variable on  your demand but you have to add the variable in correct way because it is transformed ti signed fractional arithmetic. In other words the value has to be added in fractional form if it is modified in the code.

 

This is a screensho of inserting variable via FreeMaster and connection to real variable in the application SW in the MCU.

lama_0-1659517054338.png

... and function where to do it.

For example in the main loop int the function void main(void)

If you study the code then you see that the variable is checked and updated in the periodic intervals (INTERRUPT void TIMchan3_ISR(void)) and then entered into control loop with another name.

 

Best regards,

Ladislav

在原帖中查看解决方案

3 回复数
1,671 次查看
lama
NXP TechSupport
NXP TechSupport

Hi,

You have to have installed FreeMaster and then … it is described in the application control part in  https://www.nxp.com/docs/en/user-guide/MTRCKTSBNZVM128QSG.pdf

 

Best regards,

Ladislav

0 项奖励
回复
1,669 次查看
itsnewforme
Contributor IV

Is it possible to do it without using FreeMaster, by directly changing the values in code. If so, please let me know where ?

0 项奖励
回复
1,659 次查看
lama
NXP TechSupport
NXP TechSupport

There is a FreeMaster variable requiredSpeeed which is connected to a variable with the same name in the project - requireSpeed. You can find any suitable place or event to modify the variable on  your demand but you have to add the variable in correct way because it is transformed ti signed fractional arithmetic. In other words the value has to be added in fractional form if it is modified in the code.

 

This is a screensho of inserting variable via FreeMaster and connection to real variable in the application SW in the MCU.

lama_0-1659517054338.png

... and function where to do it.

For example in the main loop int the function void main(void)

If you study the code then you see that the variable is checked and updated in the periodic intervals (INTERRUPT void TIMchan3_ISR(void)) and then entered into control loop with another name.

 

Best regards,

Ladislav