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 ?
Solved! Go to Solution.
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.
... 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
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
Is it possible to do it without using FreeMaster, by directly changing the values in code. If so, please let me know where ?
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.
... 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