LxP_Traffic_Lt_W

LogixPro Traffic Light Using Sequencers
Sequencers are commands that will send a list of words, one word at a time, through a mask to a destination.
The source of the words is a list, usually stored in the B3 file or the N7 file, and the destination is usually an
output word.
In the example below the list contains the words indicated. When the Sequencer goes into position 1 the
word in position1 of the source file will be sent to the destination location. Below, the sequencer should be
in position 3 because the word “Brown” is in the destination location.
Position
1
2
3
4
5
Source
The
Quick
Brown
Fox
Jumped
Destination
Brown
A Sequencer could also be used to only change certain parts of the destination with the remainder of the
contents being left alone. In the case below the sequencer should only change the last 6 characters of the
phrase leaving the first 12 in place. Notice that the longest word I will send is 6 characters, and even if the
first word has only 3 characters I need to over-write all six of the characters. If this is not done, when the
sequencer goes from position 6 to position 1 the new destination would read “The Word is Theped”.
Position
1
2
3
4
5
Source
The
Quick
Brown
Fox
Jumped
Destination
The Word is Brown
A Mask is used to only allow a sequencer to change certain locations in the designation. The mask will
contain 1’s and 0’ in which the locations with the 1’s will be over-written and the locations with the 0’s will
not be changed. In this case the mask would be as shown in the second row.
T
h
e
W
o
r
d
i
s
B
r
o w n
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
To keep track of what the sequencer is doing, it uses a Control Element with
three 3 words. Each Control Element has a Length, a Position and a number
of Control Bits use to keep track of the process. The default file for these
control Words in RSLogix systems is the R6 file.
LogixPro Traffic Light Using Sequencers
Taking this instruction apart:
“File” is the marker to show where the Source List is stored
“Mask” shows which bits are passed and blocked
“Dest” is the Destination location
“Control” is the word used to control the process
“Length” shows how many words are in the list
“Position” stores the current position in the list. Usually this is used
when monitoring the program to see what the sequencer is doing, but the position can be changed using a
word command which would not case the destination to be changed.
Using a sequencer to control the LogixPro Traffic Light:
A traffic Light is a good example of a Sequencer because it has 2 sets of information which changes: the
condition of the lights and the amount of time that the lights stay in each position.
LogixPro Traffic Light with Sequencer
Left Street
Right Street
Traffic Light Control
There are 2 streets in the Simulation: Right Street has cars running right to left. Left Street has cars running
left to right. The normal light times should be as follows:
Position Description
Lights on
Timer Preset
1
Red/Red: 2 Seconds
O:2/00, /04
20
2
Right Green, Left Red: 30 Seconds
O:2/00, /06
300
3
Right Yellow, Left Red: 5 Seconds
O:2/00, /05
50
4
Red/Red: 2 Seconds
O:2/00, /04
20
5
Left Green: Right Red: 20 Seconds
O:2/02, /04
200
6
Left Yellow, Right Red: 5 Seconds
O:2/01, /04
50
The 2 SQO commands below will control the intersection. The First Sequencer will use the contents of
B3:1-B3:6 to turn the lights on and off. The second SQO command will below will use the contents of N7:1N7:6 to set the Timer-Preset to hold the sequencer in the desired position for a length of time. Note that
although the Sequencer uses B3:0 and N7:0 to mark the beginning of a list, these positions are never actually
sent to the destinations. I have yet to find out why this is the case.
LogixPro Traffic Light Using Sequencers
The Sequencer Section:
The light control is contained in the 2 sequencer instructions below. The Self-resetting timer enables the
Sequencers to go to the next position, and because you want the sequencers to be in the same position, they
both may use the same control Word.
Note on the Masks:
The Masks of the timers are different than those of the Outputs. The Timers need a mask of “FFFFh” so that
all of the numbers in Binary are not blocked. If you used a mask of 00FFh you would get strange results for
any Preset over 255. In the case of the Outputs, you only need to control Outputs 0-2 and 4-6. Currently the
mask is set to “7F” which includes the walk light on the left side. If you wanted to control the walk lights,
you would need to change the mask to “77h”.
Mask
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
RW RG RY RR LW LG LY LR
Below the Tables used by each sequencer are shown to the right of the sequencer command.
Setting up the simulator.
The simulator does not handle sequencers well and tends to re-start simulations with old information in the
registers. For this reason you want to re-start the simulation with the Right-Lane Parked and add these rungs
to the beginning of your program.