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.

Compiler/TMS320F28068M: How to move the motor in any moment

Part Number: TMS320F28068M

Tool/software: TI C/C++ Compiler

Hi, im using TI F28069M microcontroller with a Motor wich have an absolute encoder. I send the encoder data to a FPGA, that divides it andsend the frames through the SCI port to the microcontroller, so i can take the data in CCS from that port. The problema is that i dont know how to make the motor move whenever i want, for example after Reading the SCI port. I'm using lab 6.b of InstaSpin- MOtion like a reference, but it uses switch cases to control the motor. Can anyone explain me or send me an example of code written in the Main function to move the motor without using switch cases in mainISR? Thank you!!

  • It all depends what you want to do. If you're interested in using the SpinTAC Motion profile, you'll need to call the ST_runVelPlanXX() API in the mainISR for lab6b. Otherwise, you can call CTRL_run to use the integrated controller, or CTRL_runOnLine_User() for the stripped down version, or if you have the PWM period information you can directly plug it into HAL_writePwmData()

    The point of the mainISR is to grab the ADC data, perform the angle estimation, and update the PWM to drive the motor. When you say "move the motor," we don't have any information as to what data you've already extrapolated from your system. If you have the angle data, have you calculated the PWM duty cycle to update the output?

    With absolute encoder, I would suggest exploring Labs 12a and 12b. If you look through the API, you should be able to ID where the SPINTAC and FAST IP are called, and bring them into the main loop as necessary. The reason we use the interrupt though is to prioritize the PWM output updating to a known frequency instead of leaving it running in the background loop

  • Hi Jose, if there aren't any additional questions here, I will mark this thread closed for now