# Ladder logic Program-How to start and hold an LED?

#### DeathYu

Joined Jun 1, 2010
4
Rich (BB code):
|--Input Switch_1 ---Normally closed T3----Timer_T1(1second)--|
|--Normally open T1---Timer_T2(2second)--|
|--Normally open T2-- Timer_T3(3second)--|
|--Normally open T1--Normally closed T2---Output_1--|
|--Normally open T2--Normally close T3---Output_2--|
Circuit operation of my circuit
When Input switch_1 is turned on , after 1 second , Output_1 is turned on.Then Output_2 is turned on at 2second and Output_1 is off. Then at 3 seconds , output_2 is turned off. Lastly , the circuit operation repeats itself. 1-->2-->1-->2-->1-->2

What I need to do.
For example , when input Switch_2 is turned on at output_2 is turned on , it will hold at output_2(meaning pause at that point) and when the input switch_2 is turned off , the circuit operation continue itself again. meaning 1-->2-->1-->2-->1-->2

If you don't get what I mean , it is something like this 1-->2(Hold at this point)-->1-->2-->1-->2.
When the input switch_2 is turned off ,the it goes from 2-->1-->2-->1-->2

Last edited by a moderator:

#### BSomer

Joined Dec 28, 2011
434
Let me see if I have this right...
You have a switch(1) that enables a timer that counts in seconds.
At second #2, LED 1 turns on.
At second #3, LED 1 turns off and LED 2 turns on.
It then continues this cycle, 1 - 2 - 1 - 2...
Then you want to interrupt the cycle with a second switch that holds it at the second LED.

Is this correct? If so you may be able to use a sequencer in your logic program that gets clock cycles from the timer. Does there need to be some way to reset the system?

I can probably come up with something. Are you using any particular type of PLC or program to write this?

#### DeathYu

Joined Jun 1, 2010
4
Let me see if I have this right...
You have a switch(1) that enables a timer that counts in seconds.
At second #2, LED 1 turns on.
At second #3, LED 1 turns off and LED 2 turns on.
It then continues this cycle, 1 - 2 - 1 - 2...
Then you want to interrupt the cycle with a second switch that holds it at the second LED.

Is this correct? If so you may be able to use a sequencer in your logic program that gets clock cycles from the timer. Does there need to be some way to reset the system?

I can probably come up with something. Are you using any particular type of PLC or program to write this?
I am using rslogix 5000 for the above code. Actually it should be at second #1 , LED 1 turns on. At second #2 , LED 1 turns off and LED 2 turns on. At second #3 , it turn off the LED 2 and reset the timer so the whole thing becomes a loop 1-2-1-2

#### BSomer

Joined Dec 28, 2011
434
Sorry for the late response, been a little busy with other things. Like I was saying before though, using a sequencer could be one possible solution to your problem.

Rich (BB code):
|---||------|/|----------|TON   |--(EN)-------|
|   SW1   R6:0/EN        |T4:0  |--(DN)       |
|                                             |
|---||-------|/|---------|SQO         |       |
|  T4:0/DN    SW2        |Dest:   O3:0|       |
|                        |Control R6:0|--(EN)-|
|                                             |
|---||-------------------------(OTE)----------|
|  SW2                         LED2           |
This is just a start of something that you can use. You will need to change your N7 (interger) Data File to the data needed for your application. Something like N7:1 = 0, N7:2 = 01h, N7:3 = 02h. You can put these numbers in as hexidecimal, binary, or decimal.
The R6:0 is the control word which contains the status, length, and position. The length is the number of words in the sequencer file, this does not include position 0. So in your case it would be 2. The position is the starting point of the sequencer, i.e. 0. This is considered the "home" position, where it goes when nothing is running.

As to the second switch, it would be used twice in the program. First to disable the SQO. Second is to turn on the LED#2.

If you have a users manual or similar for your specific program read the section about the sequencer. If you are still having problems I might be able to help a little more. It has been a while since I have done any of this but I did find some of my notes from school.

Hope you find this somewhat helpful.

Brian

Last edited by a moderator:

#### panic mode

Joined Oct 10, 2011
1,882
there are many ways to do this but using sequencer is probably the most common. here is alternative using counter (but uses same principle).

#### Attachments

• 44.8 KB Views: 79

#### BSomer

Joined Dec 28, 2011
434
there are many ways to do this...

Very true. While I was in school we had our labwork to do and almost every student came up with a different way to do each lab. The thing to keep in mind is "if it works, it is right" which is to say that there isn't only one correct way to do things. There can be many different solutions to a problem. I suggest trying both of the methods here. Learn how they are supposed to work. Then try to come up with your own.