Details of stg instruction – KEYENCE Visual KV Series User Manual
Page 132

2.4 Instruction Details
3-108
2
Chapter 2 Instructions
Details of STG instruction
■ STG instruction
The STG instruction is suitable for sequential step-by-step processing.
The whole process is divided into several operational steps, and one program is
assigned to each step.
The process to turn on several lamps sequentially can be divided into the following
five steps:
1) Wait until the start switch is turned ON.
2) Turn on lamp 1 for 1 second.
3) Turn on lamp 2 for 3 second.
4) Turn on lamp 3 for 5 second.
5) Turn on lamps 1, 2, and 3 simultaneously for 7 seconds.
These five steps are sequentially performed in order as shown in the flowchart
below.
If a ladder program is written for such sequential processing without any STG
instructions, the resulting program may be complicated and difficult to review by
others.
■ I/O assignments
Assign the input and output of the Visual KV Series as follows:
1) Start switch: Turned on when 0000 turns ON.
2) Lamp 1: Lights when 0500 turns ON.
3) Lamp 2: Lights when 0501 turns ON.
4) Lamp 3: Lights when 0502 turns ON.
NO
YES
Start
Start
SW ON?
Turn on lamp 1
for 1 second.
Turn on lamp 2
for 3 second.
Turn on lamp 3
for 5 second.
Turn on lamps 1, 2,
and 3 simultaneously
for 7 seconds.
Sequential processing
0000
0500
KV
COM
COM
0502
0501
Lamp 3
I/O assignment
Start SW
Lamp 1
Lamp 2
STG
KVNKA Chap 02_4bP.p65
08.3.11, 0:00 PM
108