Hello All,
I am programming an msp430f5659 and I need to program a timer to accelerate and then level off at a constant speed for a stepper motor drive.
The first requirement for this project required only to create pulses for a stepper motor at a constant speed with no acceleration, the motor torque was supposed to be adequate. Easy . I programmed
P3SEL = 1; // for TA1.0 output bit would have the step pulses coming out
TA1CCTL0 |= OUTMOD_4; // for toggle mode
now I could easily load
TA1CCR0 with pre-calculated count values representing the constant speed and life was good. I didn't even need to do an interrupt routine. I did this once upon initializing the processor, and everyone was happy.
But the party's over. Seems speed and torque requirements changed so we need acceleration as well which means the pulses coming out of P3.1 are going to change until I hit constant speed at which time the counter will be reloaded with the same count value forever or until someone shuts off the pumps.
My question is, is there no easy way to do this where I dont have to setup an interrupt routine? I'm thinking I need to set up an interrupt routine and the interrupt's whole job is to load the counter with the next value of counts. During accel part of the move at the beginning the counts values with change each time, I actually already calculated what those count values will be in matlab. When it reaches desired velocity, the count number remains the same.
but I'm worried the very process of calling an interrupt routine will screw up the timing of the pulses coming out to drive the pumps thereby throwing off the speed of the pumping. I have to do this with two timers for two motors that are supposed to be synchronized . I precalculated the count values and I'm going to store them in an array as a #define so it's preprocessed, so the only overhead is retrieve the next count value from memory and load it into the counter - no math calculations required.
Is there any other way to do this? I'd so prefer to reload the counter without having an interrupt routine as I do not now, though I'm thinking that's an oxymoronic thing to say.
Thanks for your help
Dubs