I need help with simple ladder logic.

So your saying use a internal bit like B:3/3, latch it on after the timer is done T4:0/13, then use the internal bit B:3/3 to turn on (any statement) a comparison statement? Then do you come off the comparison with a add instruction?
That's what I was initially recommending but after looking more at your problem I think you'd probably be better off with my second suggestion, which wouldn't require an extra internal bit.

Think of it this way: Every time the timer rolls over to zero, the timer accumulated value should be immediately changed to 5 seconds. Since you're using the reset of the timer to trigger that change, it won't happen during the first cycle when the program first starts.

So... the DN bit of the timer indicates when it's ready to "roll over." You can use this condition to trigger a MOV instruction to transfer 5 seconds (i.e. 50) into the accumulated timer value. You can also remove that XIO contact on rung 001, since the new rung you're adding will keep the timer running.
 
Last edited:
kolyur said:
That's what I was initially recommending but after looking more at your problem I think you'd probably be better off with my second suggestion, which wouldn't require an extra internal bit.

Think of it this way: Every time the timer rolls over to zero, the timer accumulated value should be immediately changed to 5 seconds. Since you're using the reset of the timer to trigger that change, it won't happen during the first cycle when the program first starts.

So... the DN bit of the timer indicates when it's ready to "roll over." You can use this condition to trigger a MOV instruction to transfer 5 seconds (i.e. 50) into the accumulated timer value. You can also remove that XIO contact on rung 001, since the new rung you're adding will keep the timer running.
I tried adding a rung at the bottom with XIC T4:0/13 then a MOV command at the end with the Source T4:0/13 and Dest 50, but it just keeps running. Thanks Dennis
 
Keep in mind what the terms Source and Destination mean. Source is the value you're starting with, Destination is where you're putting it. So if we want to put 50 into the timer accumulator, think about which is the source and which is the destination.

Also, review your timer terminology and addressing. The timer bits (DN, TT, and EN) can only be used with bit-level instructions like contacts and coils. The preset (PRE) and accumulator (ACC) registers hold numerical values. You can't move a value (i.e. 50) into a bit (which must be a 0 or 1). Remember that timer values are addressed with a period (i.e. T4:0.ACC) and timer bits are addressed with a slash (i.e. T4:0/DN).
 
Dennis, It appears that you are making an effort to solve this so here are some tips:

1. Using comparison instructions, you only need 1 master timer. Any additional timers simply complicate the program, with no added benefits.
2. Do not use any Move or Jump commands, because they are not needed.
3. A cycle timing diagram is very useful to answer questions like: When East/West Red is on, what is North/South Green doing? If you do not have one made already, I recommend that you make one. It will help to clarify your thinking.
4. LIM is also a comparison instruction, and it works well for what you are doing.
5. To control the East/West Red light, use two LIM instructions on parallel branches, with different On/Off times for each LIM limit.
6. Use 1 LIM on a rung to control each of the other 5 lights.
 
Last edited:
Here is a timing diagram for a 26-second cycle light. Adjust the time numbers according to your instructions.

Traffic_Light_Timing_Diagram4.JPG
 
Last edited:
Thanks for the info. I am having trouble with coming up with the right times where my red lights will overlap for at least 4 seconds. I am going to have a 60 second timer + or - 5 seconds.
I've got the red N/S 0-340, yellow N/S 540 -640, green 340-540 and the E/W lights Red 0-40 then parallel 340-640, then the Yellow 240-340, then the green 40 - 240. I tried adding the extra 4 seconds in the middle to accomodate the double red light sequence.
Thanks Dennis - can you tell I suck at math!
 
Dennis,

Do you have any instructions on how long the green, red, and amber lights should be on?

Simply adjust the scale for a 60-second cycle, similar to this:

Traffic_Light_Timing_Diagram60sec.JPG
 
Last edited:
Yes the Red 30 seconds and the Yellow 10 seconds and the green for 30 seconds. All red lights must be on for a time period of four seconds.
Cycle limits may vary plus or minus 5 seconds. I've got the limit comparison's to work but I'm having trouble figuring out how to overlap the red lights to get a double red everytime though.
Thanks Dennis
 
Study the timing diagrams some more.

Green time + Yellow time = Red time (not counting "overlap")
30 + 10 = 40 seconds, DOES NOT EQUAL what you said it should (30).

Something is off here somewhere. Double check your instructions. You can do it if adds up to work like a traffic light, but if the instructions are off, then it is difficult to do the "impossible".

Why a 10 second yellow light? 3 seconds is normal, 4 seconds is maximum for yellow in the real world.

The period for both red lights to be on at same time (called a "delayed green") should be no more than 1 or 2 seconds.
 
Last edited:
I've got the red N/S 0-340, yellow N/S 540 -640, green 340-540 and the E/W lights Red 0-40 then parallel 340-640, then the Yellow 240-340, then the green 40 - 240.
If you are using the LIM instruction, then (because it switches when equal to Low Limit), you must not allow any overlap in your lights.

For example if E/W Red = 0 to 40, then E/W Amber must start at 41, not 40.
 
The thing that's not clear to me from your instructions is whether both N/S and E/W can be red simultaneously for a short time during every signal change (to prevent accidents from people running the light I suppose). That is how the signals in my town work but I have visited places where that is not the case (opposing signal turns green immediately as other turns red).

If the former case is permitted, then I think your logic will be simpler since you won't have to worry about the initial 4-second double-red state--just set up your timing diagram like Lancie suggested and you'll be good to go. But if that double-red condition only occurs during the first timing cycle, then you'll probably have to finagle your timer accumulator with a MOV instruction or something to get that functionality.
 
button.jpg

Here is where the program at now. I think its about the best its gonna get. The only thing that not exactly right is it should have a double red light for 4 seconds at the beginning and since the E/W Red light come on at 0-20 its 2 seconds short on the first time through. They do over lap for 4 seconds in the middle of the program though. If anyone has any other ideas or suggestions I would appreciate them. If anyone can't read the numbers they are
N/S Red 0-340, Yellow 540-640, Green 340-540,
and E/W Red 0-20, 320-640, Yellow 220-320, Green 20-220.
Thanks Dennis
 
kolyur said:
The thing that's not clear to me from your instructions is whether both N/S and E/W can be red simultaneously for a short time during every signal change (to prevent accidents from people running the light I suppose). That is how the signals in my town work but I have visited places where that is not the case (opposing signal turns green immediately as other turns red).

If the former case is permitted, then I think your logic will be simpler since you won't have to worry about the initial 4-second double-red state--just set up your timing diagram like Lancie suggested and you'll be good to go. But if that double-red condition only occurs during the first timing cycle, then you'll probably have to finagle your timer accumulator with a MOV instruction or something to get that functionality.
Yes I'm going off of what someone else pointed out that there should be a 4 second overlap everytime a green light is cycled that way to cut down on crashes. Thanks Dennis
 

Similar Topics

Question 1: I am still new to this - I also might be asking for too much. - but i need help using Ladder Logic to run (rod style actuator motor)...
Replies
6
Views
1,654
Hello all, I am new to programming PLCs and I am working on project involving a reject mechanism on a packaging machine. I am using a ML1000 PLC...
Replies
3
Views
2,580
I have three 5/04 PLCS sitting in front of me. I also have a few serial cables with gender changers and null adaptors. I'm trying to connect...
Replies
15
Views
8,172
This is an assignment for class. I'm about to pull my hair out on this one. All the others have been very easy using timers and counters, but I'm...
Replies
3
Views
2,298
I'm fairly new to Rockwell software, I've had some basic training in the past but nothing too advanced. My company and I use Reliable products for...
Replies
9
Views
147
Back
Top Bottom