Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PLC as stepper controller

Not open for further replies.


Newbie level 4
Jun 25, 2011
Reaction score
Trophy points
Activity points
Hi to everyone

I'm trying to build bipolar stepper controller using siemens s200 plc. L298 would be my motor driver and plc would create signals for full step and half step mode of work. This is my school project, i don't have enough knowledge to build it so i need your help. I need to utilize high speed signals with microwin subroutines, inputs have to be speed (frequency), cw/ccw mode, and of course fs/hs mode and frequency needs to be modifiable on line. ANY help would be great, i'm totally at a loss. i have some ladder diagram exp, but have never worked with subroutines.

Thank you all in advance

I don't think that your question can be answered here, the majority of users are involved with microcontrollers or ASIC etc, they can also help with analog design but PLC is a different thing, maybe you should look for PLC specific forums.

I did a search using Google, one of the results was


Thing is, i registered on that forum, but i'm unable to post new threads (?), in an any case, thank you for reply

Why don't you try to generate the step motor phase sequence in your familiar ladder description, using a timer for the step delay? This will provide you at least with a functional design.

I'm sorry, can you post me example, or link one, i'm not sure what you are talking about. (oh, and when i sad ladder ex, i meant i know basic stuff, like locking circles, using logic so...i'm a noob)

Yes, I'm talking about using logic. If you consider the state signals A, B, C, D, and inputs DIR, MODE and CLK, you can describe the stepper motor controller in any PLC programming language of your choice, e.g. ladder. As previously suggested, the CLK input should be derived from a timer that sets the step frequency.

The first design step is to write down a truth table that contains the next state of A to D depending on the previous states, DIR and MODE when the CLK input is set.

Ok, i managed to drive my step motor using pwm and fast outputs, i even tried using timers, it worked, but pwm subroutine is more elegant in my opinion. Now i wonder, there are two inputs for that subroutine, cycle and pulse. I locked my pulse to 1 ms but i would like my motor to gradually ramp up speed, and after some time, gradually stop. Is there a way to program cycle input of my pwm so it changes values from, let say 200, in increment of 5 every 1 s to 2, stay like that for 10 s and thay goes backe, in increment of 5s form 2 to 200?

i managed to drive my step motor using pwm and fast outputs, i even tried using timers, it worked
Very good.
i would like my motor to gradually ramp up speed
According to the S7-200 system manual, PWM cycle time can be only changed asynchronously, shortly stopping PWM operation. You have to determine, if this conflicts with the "elegance" of the PWM solution. The manual suggests PTO tables for step motor ramps, but it can only provide 50 percent duty cycle signals.

I fear that you have to fall back to manual step motor sequence programming if you want to implement an optimal speed ramp. I assume, that S7-200 can do at least for moderate step speed requirements. What's your maximum step frequency, by the way? For maximum utilization of the S7 capabilities, you may want to refer to AWL coding, however.

It doesn't have to be optimal, it is not for industrial application, i just have to show sequence driving. I'm gonna study manual a bit more, perhaps i will use pto instead of pwm, and i don't have fixed step frequency, i can determine it, currently it's 1kHz

Not open for further replies.

Part and Inventory Search

Welcome to