hi every one i am strucked while thinking of this i am working on LPC2148 RTOS , i have to run 3 stepper motors X axix,y axis and Z axis and control their directions using using computer hyperterminal (i am planning to use hyperterminal as a KEYBOAD for controlling the stepper motor directions, to START and to STOP )... please can anyone tell me how to implement this using RTOS
So you are not even going to let the stepper motors run, but only allow them to tick one step up or down depending on detection of key presses?
Then you really, really have no reason for having all these tasks, since you don't seem to intend to run multiple motors concurrently.
For "normal" stepper motor electronics, you normally have a set of goals that you try to fulfill concurrently.
So stepper motor 1 may have a goal to run counter-clockwise 1000 pulses within 15 seconds. Stepper motor 2 may have a goal to run clockwise 700 pulses within 15 seconds.
The above may move a plotter pen in a diagonal over a plotter table, while drawing a straight line by having the two motors select different speeds to get the required angle.
So unless the processor have hardware acceleration for the motors, it's common to have the control program run a single loop, stepping a time counter at a high speed. And for each iteration (time step), the code figures out if one or more of the connected motors should take a full, half or micro step forward or backward or stay still.
No reason for multiple threads. If it's important that multiple motors takes the steps at exactly the same time, the code can precompute all signals and then just have to emit the clock pulses for the motor(s) that should step.
But often, it doesn't matter if a 45 degree diagonal is performed as step x, step y, step x, step y, i.e. the two motors are ticked one at a time. With small enough steps, the end result will look the same. Especially since different motors may have different strength and/or have different amount of mass, making it impossible for two motors to step concurrently and get them to perform the one-step movement so precisely that both motors have done 50% of the step at the same time.