Ramping A Stepper Motor PLC Code


Thread Starter

Bob Roberts

Would like an example of ramping a stepper motor for a period of one hour from 0 to 25rpm. Method of control is velocity (0-10vdc) with no
feed back.

The actual code needed can either be AB or Siemens or just some ideas.
You have 3600 seconds in one hour. To go from 0 to 25RPM, you would need to increment by 1 RPM every 144 seconds. Most PLCs have a 1-second pulsing bit available, or some set of bits you can use in the same way. The only hard part might be scaling your RPM increment to the units for your stepper controller. In any case, I bet you can figure it out from here. AB has a great scale-with-parameters function [SCP]. Hope this helps.

Steve Myres, PE

Set T4:0 to run at the beginning of the hour, with a preset of 3600. Calculate the output as DIV T4:0.ACC T4:0.PRE F8:0. MUL F8:0 32767 (or analog range) and send to analog output. Timer preset will stop incrementing on the first scan after expiration. You could also use a CPT statement in AB and do it all in one step. Potential problem: if the timer has a short time base, like 10ms, the accumulated value will slightly overshoot the preset, and could result in overranging or overflowing the integer analog value (because the DIV result is > 1.0). For a timer with a timebase that's long in relation to the scan, this won't be a problem.

Hakan Ozevin

1. Create a pulse using a timed interrupt
2. Increment a word (or a double word) at each pulse created.
3. Normalize the result and send it to the output.