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.

CCS/CCSTUDIO: Lab 6b StateTimer[ticks] convert to seconds

Part Number: CCSTUDIO


Tool/software: Code Composer Studio

Hello,

I am using the TMS320C2000 MCU and hvmtr_r1p1 kit to test a 3 phase ACIM. I am using code composer studio, specifically lab 6b to get the motor to simulate opening and closing a garage door. I would like the motor to be at rest at state A, then speed up to some speed and hold it for 30 seconds for State B, and then accelerate back down to zero for state C. Thus, I need to control the amount of time spent in each state.

In order to do this, I believe I need to adjust the parameter StateTimer[ticks] which I have highlighted below. Is there a conversion between number of ticks and seconds? I used a stopwatch to try and get this conversion (measure the time spent in each state and divide by the value entered for StateTimer[ticks] but the relationship was not linear. How can I ensure I get the motion profile that I want?

  • Please see section 4.7.1.4 of the InstaSPIN User's Guide here: www.ti.com/.../spruhj1g.pdf

    That section, as well as section 9.2, will help to clear up how the decimation happens from SYSCLKOUT down to the # of ticks used by InstaSPIN-MOTION

    Sean
  • Thank you for the very informative resources. I think I understand now, but I still would like to run my thought process by you.

    In lab 6b it is stated that the time spent in state is given in terms of ISR (Interrupt service routine) ticks:

    From what I read in the User's guide, this parameter is given in my user.h file, which I found to be:

    Which comes out to be 15,000Hz since USER_PWM_FREQ_kHz is defined to be 15.

    So does this mean the number of ISR ticks per second is 15K(cycles/second aka ticks/second) while the number of seconds per tick is 1/15k = 6.67*10^(-5) seconds? So the conversion between time and ticks is: time = ticks*(6.67*10^-5)? Are you able to confirm or deny this?

  • You've calculated the ISR rate. The SpinTAC component execution rate is calculated as:

    (USER_NUM_ISR_TICKS_PER_CTRL_TICK * USER_NUM_CTRL_TICKS_PER_SPEED_TICK) / (USER_PWM_FREQ_kHz * 1000.0 / USER_NUM_PWM_TICKS_PER_ISR_TICK)

    For example

    (user.h)
    USER_NUM_ISR_TICKS_PER_CTRL_TICK = 1
    USER_NUM_CTRL_TICKS_PER_SPEED_TICK = 15
    USER_PWM_FREQ_kHz = 15
    USER_NUM_PWM_TICKS_PER_ISR_TICK = 1

    (1 * 15)/(15 * 1000 / 1) = 1/1000

    Each SpinTAC component execution occurs at (1/1000) or 1 ms. This is the tick rate used by the SpinTAC state machine

    Sean