P15C Sequencer Functions 1
P15C Sequencer Functions 1
CY3 EXT
CY2EXT
CY5EXT
CY1EXT
CY4EXT
CY3RET
CY1RET
CY2RET
CY6RET
CY5RET
CY4RET
CY6EXT
NU
NU
NU
NU
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
MASK 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 1
D E 3 F
Sequence of Operation:
1. Extend cylinder #1
2. Extend cylinders #3 & #4
3. Extend cylinder #5
4. Extend cylinder #2 & #6
5. Return cylinder #6
6. Return cylinder #2
7. Return cylinder #5
8. Return cylinder #3 & #4
9. Return cylinder #1
Sequencer Instruction:
PB #1 SQO
SEQUENCER OUTPUT EN
FILE #B12:0
MASK DE3Fh
DEST O:2.0 DN
CONTROL R6:2
LENGTH 10
POSITION XX
Data File Transfer Diagram:
Output
Word O:2
Mask
Sequencer File B12
0
1
Position
count = 3 2
3
4
5
6
7
8
9
10
11
Sequencer File Setup:
CY3 EXT
CY2EXT
CY1EXT
CY5EXT
CY4EXT
CY1RET
CY3RET
CY2RET
CY4RET
CY6RET
CY5RET
CY6EXT
NU
NU
NU
NU
Output
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 Word
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0=0000h
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1=0000h
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2=0002h
3 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 3=0420h
4 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 4=1000h
5 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 5=8008h
6 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6=4000h
7 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 7=0004h
8 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 8=0800h
9 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 9=0210h
10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 10=0001h
11
Warning On Sequencer SQO Operation:
It is important to point out that the sequencer will step each time
the button is pressed even if the previous step was not completed.
In a manual mode type of operation, this is only a minor problem
because an operator will be present to watch the operation. If
however, you were going to use a sequencer output file to control
a mechanism in auto mode it becomes a major problem.
Warning On Sequencer SQO Operation:
A common mistake many inexperienced programmers make is
attempting to use SQO instructions to control the automatic
machine cycle. At first glance it seems to be so much easier than
writing all those rungs of code we would normally need if we
were using standard ladder logic. We could just use two timers
tied together for step timing and run the whole machine in auto
cycle with just one sequencer instruction. Although this seems
like a good idea, it has some major problems.
Warning On Sequencer SQO Operation:
The first major control problem is the lack of any mechanical
position feedback. In our standard ladder programming we use
the position switches on the mechanisms to trigger the next
movement. If the previous output movement is not sensed to be
complete, the sequence stops. In this SQO program the sequence
will step regardless of the completion of the previous step. If a
mechanism becomes jammed, the sequence will continue anyway
and may cause extensive damage to our equipment.
Warning On Sequencer SQO Operation:
The second problem with using an SQO-only design is that of
timing. Because we only have one set of step timers running, we
must chose a time delay between steps that is long enough for the
slowest mechanism in the machine. This means most of the other
mechanisms will have completed their movement and be waiting
for the next step time-out. Due to this timing limitation, the
machine will cycle at a much slower rate that it is capable of.
Warning On Sequencer SQO Operation:
An additional problem will occur if some variable in the machine
design changes. If the air pressure is set lower or some of the
cylinder seals become worn, the machine will have repeated jam
ups because it cannot sense the changes and the timer will
assume everything takes the same amount of time to complete as
before.
SQO-SQC Combination:
For the reasons previously given, the use of sequencer output
instructions by themselves to control the auto cycle of a machine
is not recommended. The way to overcome these feedback
problems is to use a combination of the SQC and SQO
instructions working together.
SQC Instruction Format and Memory Allocation:
STEP SQC
SEQUENCER COMPARE EN
FILE #B12:20
MASK 0FFFFh
SOURCE I:02 DN
CONTROL R6:9
LENGTH 8
POSITION XX FD
15 14 13 12 11 10 9 8 0
EN DN ER FD
SEQUENCER LENGTH
STEP POSITION
SQC Addresses and Variables:
All the addresses and variables are the same format as was shown
in the SQO instruction except the FD status bit.
FD- found bit, which is set on when a match is found between
the contents of the input word and the contents of the word being
pointed to in the SQC file. The contents of the input word are
passed through the mask before the compare function is
performed.
SQC-SQO Data Transfer and Handshake Interface:
Input Output
B12:5 B12:4
Word EN Word
SQC SQO
Instruction FD Instruction Mask
Mask
SQC Data SQO Data
SQC B12:30 B12:10 SQO
Position Position
counter B12:31 B12:11 counter
B12:32 B12:12
B12:33 B12:13
B12:34 B12:14
B12:35 B12:15
B12:36 B12:16
B12:37 B12:17
B12:38 B12:18
B12:39 B12:19
NU LAMP 15 (Position 1)
NU NU
NU NU
NU NU
NU NU
NU LAMP 3( Cyl 3 Ext)
NU LAMP 2 (Cyl 2 Ext)
START PB LAMP 1( Cyl 1 Ext)
TIMER 2 DN Bit TIMER 2
TIMER 1 DN Bit TIMER 1
CY3RET LS CY3RET
CY3 EXT LS CY3 EXT
CY2RET LS CY2RET
CY2EXT LS CY2EXT
CY1RET LS CY1RET
Input – Output Word Bit Assignments:
CY1EXT LS CY1EXT
Input
Word
Word
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 B12:4
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 B12:5
Output
Operational Sequence:
1) When switched to Run mode light lamp 15 and wait for the Start PB.
2) When start PB closes extend cylinder 1, light lamp 1, turn off lamp 15.
3) When cylinder 1 extend switch closes extend cylinder 2 and light lamp 2.
4) When cylinder 2 extend switch closes wait 5 seconds.
5)When timer is done extend cylinder 3 and light lamp 3.
6) When cylinder 3 extend switch closes return cylinder 3 and turn off lamp 3
7) When Cylinder 3 return switch closes wait 3 seconds.
8) When timer is done return cylinder 2 and turn off lamp 2.
9) When cylinder 2 return switch is closed return cylinder 1 and turn off lamp 1.
10) When cylinder 1 return switch closes move to step 1
Output Data Table:
LAMP 15 (Position 1)
CY3 EXT
TIMER 2
TIMER 1
CY1EXT
CY2EXT
CY3RET
CY2RET
CY1RET
NU
NU
NU
NU
Output
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 Word B12:4
TIMER 2 DN Bit
TIMER 1 DN Bit
CY3 EXT LS
CY1EXT LS
CY2EXT LS
CY3RET LS
CY2RET LS
CY1RET LS
START PB
NU
NU
NU
NU
NU
NU
NU
Input
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 Word B12:5
STEP SQL
SEQUENCER LOAD EN
FILE #B12:20
SOURCE I:02
CONTROL R6:9 DN
LENGTH 8
POSITION XX
15 14 13 12 11 10 9 8 0
EN DN ER
SEQUENCER LENGTH
STEP POSITION
SQL Instruction Use:
The SQL instruction can be used to load a sequence of data
values into successive memory locations or to transfer a sequence
of memory locations into a sequencer file. Each time the input
rung goes from False to True the SQL instruction will copy the
source word to the position in the file currently being pointed to
by the position counter. In this way a programmer can load
different pre-stored programs into a sequencer operation or
record the actual input conditions that exist when a SOQ
instruction runs.
SQL File Address:
The file address is the first word in the processor file where data
will be stored by the sequencer instruction. It can be a bit or
word type file and you must use the (#) character in front of it to
indicate it is a file address. Using the pre-assigned B3 file can
cause problems if the programmer is not careful when allocating
new bit functions.
SQL Source Address:
The source address can be a word address or a file address. In
both cases it is the input address for the SQL instruction. Each
time the rung conditions go from FALSE to TRUE, the contents
of this address are stored at the file word pointed to by the
position counter. If the address is a file address then the two files
will be stepped in sequence as the load instruction runs.
SQL Control Word:
This is the position of the three status words allocated in the
control file that are used to keep track of status bits and position
counts for this instruction. The programmer must be careful to
keep track of the control addresses used in his program. If you
assign the same control address to more than one instruction
unpredictable operation will result.
SQL Length Variable:
Contains the number of steps assigned to the
instruction beginning at step 1. All SQL instructions
start at position 0 when the PLC is switched from
program mode to run mode. Due to this extra state all
sequencer files use file length +1 number of words.
SQL Position Variable:
The actual position in our sequence file being loaded from the
input word.
SQL Status Bits:
EN- The enable bit, which is on any time the rung conditions are TRUE.
DN- The done bit, which is set on when the sequencer steps to the last
position in the file. The next FALSE-to-True transition of the rung
clears this bit and resets the position counter to position 1. Note that
position 0 is only encountered when the PLC is switched from program
to run mode.
ER- The error bit, which is set on if the processor sees a negative
position value or no length value. This error condition would only be
encountered if you were changing the sequencer’s setup values as part of
the ladder program.