Ladder Logic needed to for determinted pulse output times

Join Date
Oct 2005
Location
Ohio
Posts
19
Ok, I'm guessing this is pretty simple, as I'm in a beginner program for PLCs. In one question I'm asked to draw the ladder logic needed to make 0:2.0/0 a PWM output with a duty cycle of 40% and a period of 200ms...

The period of 200ms I assume you use a timer, but what about the 40% duty cycle? It looks like about 3 lines of code but not sure
 
40% duty cycle means output will stay on for 40% of the period

for 200ms it will be 80ms ON and 120ms OFF
200*40%=80ms ON
200-80=120ms OFF
 
Your instincts are correct. It is pretty simple.

If you can set up a self-resetting timer with a preset of 200 mS, you ought to be able to calculate 40% of that. Then turn on an output if the ACC is less than or equal to the duty cycle value and turn it off when the ACC is greater than the duty cycle value.
 
So maybe something like:


---------||(first pass)-------------Ton preset 200---


--------Less than ---Equal to ACC?--------------(output)
 
Last edited:
The first pass bit isn't going to do you much good here. As Steve said, you'l need a self-resetting timer, like this:

| TIMER
|----]/[------------------[TON Preset 0.200 sec.)


That is, when the timer is NOT expired, run the timer.

Now you have a value (the timer's accumulated value) that is continuously going from zero to 0.200 over and over. It's then just a matter of comparing this value to the 40% figure. ON for 40% of 0.200 seconds, and OFF for 60% of 0.200 seconds. 40% of 0.200 seconds is 0.080 seconds, so you want the output to be ON when the accumulated value is < 0.080

Keep in mind the timer setting value. If the timer base is 0.01 then a value of 100 = 1.00 second

🍻

-Eric
 
Ok SO I think I get what is going on, however on the LES function it shows source B as N7:0, memory address no? is it possible to just input the number instead of referencing it in memory?

So for a 40% duty cycle = 80ms, we would want source b = "80"?
 
stanggt200220000 said:
Ok SO I think I get what is going on, however on the LES function it shows source B as N7:0, memory address no? is it possible to just input the number instead of referencing it in memory?

So for a 40% duty cycle = 80ms, we would want source b = "80"?

you can use a constant.
 
Last edited:
Hmm ok 1 more question, appreciate all the help btw...

In one example given, there is a greater than, and less than function used, but in another example given by you...its just a less than....if they do the same thing why not use use the smaller one?
 
As you can see, there are many ways to write the logic. All of them giving you the same result. What matters is write it so that it's easy for YOU to understand.

Gary
 

Similar Topics

Hi, Good Morning. I am new to PLC programming. So some one can help me to create a ladder program to move the stepper motor in forward and in...
Replies
5
Views
2,090
I need to create a very specific PLC ladder logic program and have tried for days and can't get it to function the way I need it to. Is there...
Replies
30
Views
7,500
Hey Guys I can’t seem to come up with the logic that I need on one of our operator stations Any points in the right direction would be much...
Replies
4
Views
2,282
Hello there, I am currently taking my final year project and working out in my ladder logic programming. I am finding some difficulties on...
Replies
76
Views
32,278
Hi All, I was in the design stage of a new stand-alone machine and need some inputs/advice from all you experienced and knowledgeable industry...
Replies
5
Views
3,069
Back
Top Bottom