MC9S12ZVML128_LIN_BLDC_Sensorless code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S12ZVML128_LIN_BLDC_Sensorless code

Jump to solution
879 Views
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 Kudos
1 Solution
860 Views
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

View solution in original post

3 Replies
873 Views
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 Kudos
871 Views
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 Kudos
861 Views
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