The text of a manual · part 7 of 9
User's Manual Visual KV Series 3 Programming, pages 51 to 60
Pages 51 to 60 of 79
The original document is the PDF (355 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the Keyence KV-16R
Page 51
1.5 Extended Ladder Diagrams
1.4.6 Contact Comment Save Function •
This function transfers contact comments to the Visual KV Series using the "KV IncrediWare (DOS)" or "LADDER BUILDER for KV" programming support software.
•
The Visual KV Series can store not only programs but also comments registered to each contact using the "KV IncrediWare (DOS)" or "LADDER BUILDER for KV" programming support software. A program may not be easy to understand if only device Nos. are used. By registering comments to the contacts, the program can be easily debugged and more efficiently maintained.
•
The number of contact comments that can be transferred is up to 1,000 for both normal transfer and compression transfer.
•
The KV-D20 operator interface panel includes the contact comment display function.
➮
For more about operating procedures, refer to "2.5 Entering Comments/Labels" (p.1-46) and "4.2.2 Setting the comment transfer" (p.2-138).
Note 1: Line comments cannot be stored. Note 2: The KV-P3E(01) handheld programmer cannot read or write contact comments. Note 3: The KV-D20 operator interface panel cannot display contact comments which have been compressed and transferred.
Chapter 1 Programming
3-27
11
Page 52
1.4 Special Functions
1.4.7 Special Functions
KV-300 PLC only
Constant Scan Time Mode In this mode, operation can take place according to a preset scan time (in ms). ■ Setting Write the desired scan time into TM29 (temporary data memory), then turn on special utility relay No. 2303. The scan time can also be written into TM31. Specify a scan time in increments of 10 ms (a value of less than 10 ms is invalid). Here, write a value into TM equivalent to 10 times the scan time.
Example Set the constant scan time to 20 ms. 02008
1
#00200 LDA
TM29 STA
2303 SET
Note 1: The set value for the constant scan time must be greater than the actual scan time. Otherwise, special utility relay 2304 turns on during every scan to disable constant scan time mode. Note 2: If the scan time exceeds the set value, special utility relay no. 2304 turns on during the next scan.
Output Disabled Function During checking of a program, this function clears output from output relays regardless of the program currently running. ■ Setting Turn on special utility relay No. 2300. After one scan is completed, all output relays (00500 to 00503, 07500 to 17915) are cleared.
Example Use the output disabled function by executing FORCED RESET/RESET to special utility relay No. 2300 from the monitor display. ➮
To execute FORCED RESET or RESET, refer to "Chapter 6 Handheld Programmer" (p.1-195).
Input Refresh Disabled Function Set this function if it is desired to turn ON/OFF input relays from the monitor display without activating the machine when checking a program. ■ Setting Turn ON special utility relay No. 2301 to skip input refresh (reading from input relays). Input relays can then be turned ON/OFF with the KV-P3E(01) or with KV IncrediWare (DOS) on the monitor display.
Example Set input relay No. 0000 to ON to disable input refresh; set to OFF to enable input refresh. 0000
2301
Note: If input refresh is disabled, it is not enabled until input relay No. 0000 is turned on from the handheld programmer.
3-28 Chapter 1 Programming
Page 53
1.5 Extended Ladder Diagrams
1.5 Extended Ladder Diagrams This section describes KEYENCE’s unique extended ladder diagram.
1.5.1 Features of Extended Ladder Diagrams The extended ladder diagram is a programming method developed to reduce problems related to design, testing, operation, and maintenance of programs. In a conventional ladder diagram, output instructions can be written only on the right side of a ladder diagram. On the other hand, in an extended ladder diagram, output instructions can be written anywhere except on the left. As the result, the programs shown below can be written. Mixture of input and output circuits Conventional ladder diagram
Only input circuits can be written.
Only output circuits can be written.
Extended ladder diagram
Only input circuits can be assembled.
Both input circuits and output circuits can be assembled.
Only output circuits can be assembled.
Connection of two or more instructions on one line Conventional ladder diagram Extended ladder diagram
Instructions can be written only from the left end to the right end on one line.
Many instructions can be connected.
Branch from output coil Conventional ladder diagram
Branches can be made only from input contacts.
Extended ladder diagram
Branches can also be made from output coils.
There is only a single line, so the ladder diagram is easier to understand. Three lines are required.
Chapter 1 Programming
3-29
11
Page 54
1.5 Extended Ladder Diagrams
1.5.2 Advantages of Extended Ladder Diagrams The number of lines in a ladder diagram can be reduced. Because both output instructions and input instructions can be written side by side, the number of program lines can be reduced. As the result, the contents of the program can be seen at a glance.
Example When DM0000 stores 1000, 0500 turns ON. 2000, 0501 turns ON. 3000, 0502 turns ON. Conventional ladder diagram
1
Extended ladder diagram DM0000 #01000 LDA CMP
2010
0500
#01000 CMP
#02000 CMP
2010
0501
2010
0500
#03000 CMP
2010
0502
2002
#02000 CMP
2010
0501
2002
#03000 CMP
2010
0502
DM0000 LDA
2002
2002
In a conventional ladder diagram, operations performed by the program cannot be easily understood. In an extended ladder diagram, operations performed by the program can be understood at a glance.
Processing sequence is clear. Ladder symbols can be laid out in processing sequence, so the program flow is easier to understand. In addition, maintainability is considerably improved.
Example When the start switch is set to ON, a lamp is lit for three seconds, a buzzer is sounded for two seconds, and then the motor starts to rotate. 0000
1100 DIFU
1100
1000 STG
0500
#00030 T000
T000
1001 JMP
1001 STG
0501
#00020 T001
T001
1002 JMP
1002 STG
0502
0000
1000 SET
ENDS
Conventional ladder diagram 0000 1000
T000
1001
T001
T001
T002
1001
#00020 T001
#00030 T002
1001
0500
1003
3-30 Chapter 1 Programming
Extended ladder diagram
1001 STG
1003
1003
When the start switch (0000) is set to OFF, the motor is stopped and all operations are reset.
#00010 T000
1003
1002
When timer 1 turns ON two seconds later, the buzzer is stopped and the motor (0502) starts to rotate.
0000
1002
1002
When timer 0 turns ON three seconds later, the lamp goes out, a buzzer (0501) is sounded, and timer 1 is activated.
1000 DIFU
T002 T000
When the start switch (0000) is set to ON, a lamp (0500) is lit and timer 0 is activated.
0501
1000 DIFU
1000
1001 SET
0500
#00010 T000
T000
1002 JMP
1002 STG
0501
#00020 T001
T001
1003 JMP
1003 STG
0500
#00030 T002
T002
1001 JMP
0501
By using an extended ladder diagram as shown above, the program can be executed in the sequence of the processing to be performed. So even a person who uses a relay sequence for the first time can understand the processing contents. By combining the STG instruction, double coils can also be used.
Page 55
1.5 Extended Ladder Diagrams Note: When an extended ladder diagram is used, the number of lines in ladder diagram may be reduced. However, this may not necessarily reduce the number of mnemonics in the program. Conventional ladder diagram 0000
Extended ladder diagram
0500
0000
0500
0501
0501
LD 0000 OUT 0500 OUT 0501
LD 0000 OUT 0500 CON OUT 0501 The CON instruction for connection is added. (The scan time is not affected.)
1.5.3 Example of an Extended Ladder Diagram ■ Using W-UE Only when inputs are given in the order "0000 ➞ 0001 ➞ 0002", output 0500 turns ON. Conventional ladder diagram 1002 DIFU
0001 0002 1002
1003 DIFU 0000
1000
1000
1001
1000 1003
At the rising edge of input 0001, 1002 turns ON. At the rising edge of input 1003, 1002 turns ON. If input 0000 is ON, 1000 turns ON.
Extended ladder diagram 0000
0001 1000
1000
0002
1001
0500
1001
Input 0000 Input 0001 Input 0002 Output 0500 turns ON. turns ON. turns ON. turns ON.
If 1000 is ON, 1001 turns ON.
1001 1001
0500
When 1001 turns ON, output 0500 turns ON.
Because the program can be written in only one line when an extended adder diagram is used, it is easier to look at and understand compared with a program written using a conventional ladder diagram.
Chapter 1 Programming
3-31
11
Page 56
1.5 Extended Ladder Diagrams
1
3-32 Chapter 1 Programming
Page 57
Chapter 2 Instructions Describes the concrete usage of instructions in the KV Series. Refer to "Chapter 3 Interrupts" on page 3-191 for details of interrupt instructions. Refer to "Chapter 4 High-speed counters" on page 3-203 for details of the highspeed counters used in the application instruction. 2.1
Instruction List [Visual KV Series] ....................................... 3-34
2.1.1 2.1.2 2.1.3 2.1.4 2.1.5
Basic Instructions ................................................................................. 3-34 Application Instructions ........................................................................ 3-36 Arithmetic Instructions .......................................................................... 3-38 Interrupt Instructions ............................................................................ 3-41 Function No. List (Alphabetical order) .................................................. 3-41
2.2
Instruction List [KV-300 Series, KV-10/80] .......................... 3-42
2.2.1 2.2.2 2.2.3 2.2.4
Basic Instructions ................................................................................. 3-42 Application Instructions ........................................................................ 3-45 Arithmetic Instructions .......................................................................... 3-48 Interrupt Instructions ............................................................................ 3-54
2.3
Convention Details ................................................................. 3-55
2.4
Instruction Details .................................................................. 3-56
2.4.1 2.4.2 2.4.3
Basic Instructions ................................................................................. 3-56 Application Instructions ........................................................................ 3-95 Arithmetic Instructions .......................................................................... 3-134
2.5
Programming Notes ............................................................... 3-189
Page 58
2.1 Instruction List
Visual KV Series
2.1 Instruction List
Visual KV Series
The KV Series uses 80 instructions. The instructions are divided into four categories according to their functions: basic instructions, application instructions, arithmetic instructions, and interrupt instructions. The following is an overview of applications and functions. For details, refer to the respective description pages for each instruction.
2.1.1 Basic Instructions Instruction LOAD
2
Symbol nnnn
LOAD BAR nnnn
AND nnnn
Function
Exec.time (µs)
Bytes
Page
LD
Connects N.O. contact to bus.
0.7 to 1.6
3 (12)
3-57
LDB
Connects N.C. contact to bus.
0.7 to 1.6
3 (12)
3-57
0.7 to 0.9
3 (8)
3-58
0.7 to 0.9
3 (8)
3-58
Mnemonic Operand Operand value
ANB
Connects N.O. contact in 0000 to 17915 series with previous contact. T000 to T249 C000 to C249 Connects N.C. contact in CTC0 to CTC3 series with previous contact.
nnnn
OR
Connects N.O. contact in parallel with previous contact.
0.7 to 0.9
3 (8)
3-60 nnnn
ORB
Connects N.C. contact in parallel with previous contact.
0.7 to 0.9
3 (8)
3-60
0.8
1 (4)
3-61
0.8
1 (4)
3-63
1.5
3 (12)
3-65
1.5
3 (12)
3-65
1.9 to 12.8
3 (14)
3-66
0500 to 1915 2009 2100 to 17915 Forces R/T/C OFF when input 1.9 to 20.5 T000 to T249 is ON. C000 to C249 CTH0 to CTH1 CTC0 to CTC3
3 (14)
3-66
16-bit on-delay T that counts down in 0.1-s decrements.
12.0 to 17.8
2 (6)
3-67
16-bit on-delay T that counts down in 0.01-s decrements.
12.0 to 17.8
2 (6)
3-68
AND BAR nnnn
OR
OR BAR
AND R No. T/C No.
AND LOAD
ANL
OR LOAD
ORL
OUT nnnn
Connects in series blocks made of one or more contacts. Connects in parallel blocks made of one or more contacts.
OUT R No.
OUT BAR
SET nnnn nnnn SET
OUB
0500 to 1915 2009 2300 to 17915 Forces relay ON and holds T000 to T249 this status when input is ON. C000 to C249
SET R No. T/C No.
nnnn RES
RES
0.1-s TIMER
#ddddd Txxx
TMR
0.01-s TIMER
#ddddd T Txxx H
TMH (FUN49)
RESET
Outputs input ON/OFF status 0500 to 1915 to R coil. 2009 2300 to 17915 Outputs inverted input ON/ OFF status to R coil.
T No., # preset value
3-34 Chapter 2 Instructions
000 to 249 #00000 to #65535
Page 59
2.1 Instruction List
Exec.time (µs)
Bytes
Page
16-bit on-delay T that T No., 000 to 249 # preset value #0000 to #65535 counts down in 1-ms decrements.
12.0 to 17.8
2 (7)
3-69
#00000 to # preset value, #65535 Sets 16-bit up-counter. C No., counter 000 to 249 input R 0000 to 17915
12.0 to 17.8
4 (7)
3-72
13.0 to 24.0
2 (10)
3-76
3 (10)
3-78
3 (10)
3-78
3 (11)
3-80
(*)
5 (15)
3-82
Reduces input relay time constant to 10 µs for higher input response.
3.8 to 9.4
3 (8)
3-86
Instruction
Symbol
Mnemonic
1-ms TIMER
#ddddd T S Txxx
TMS (FUN51)
COUNTER
#ddddd Cxxx nnnn
C
UP-DOWN COUNTER
UP DW #ddddd RES
DIFFERENTIATE UP nnnn DIFU
DIFU (FUN10)
DIFFERENTIATE DOWN nnnn DIFD
DIFD (FUN09)
KEEP
KEEP (FUN22)
R No.
SFT (FUN39)
nnnn: 1st R No. mmmm: Last R No.
KEEP
UDC xxx
UDC (FUN52)
SFT
SHIFT
Operand
C No., # preset value
R No.
SET nnnn RES
D nnnn CLK RES mmmm
Visual KV Series
Operand value
000 to 249 #00000 to #65535
Function
Sets a 16-bit up-down counter.
Turns ON R for 1 scan 11.2 to 13.2 time at rising edge of 1000 to 1915 input. 3000 to 9915 Turns ON R for 1 scan 10.0 to 12.8 time at falling edge of input. Turns ON R and holds this 0500 to 1915 status when SET input is ON. 8.2 to 19.8 2009 Turns OFF R when RESET 2100 to 17915 input is ON. 1000 to 1915 Sets shift register. 3000 to 9915 (KV-10) 0000 to 0005 (KV-16) 0000 to 0009 (KV-24) 0000 to 0015 (KV-40) 0000 to 0107
HIGH SPEED
HSP nnnn
HSP (FUN18)
MASTER CONTROL
MC
MC (FUN24)
Selects ON/OFF status of R coils, Ts, or Cs.
0.2
1 (4)
3-89
MCR
MCR (FUN25)
Represents end of MC.
0.2
1 (0)
3-89
MEMSW $xxxx
MEMSW (FUN26)
Sets memory switches.
––
3 (0)
3-92
NOP (FUN30)
Performs no operation.
––
1 (0)
3-94
END
Indicates end of each routine of program.
––
1 (1)
3-94
ENDH
Indicates end of entire program.
––
1 (0)
3-94
MASTER CONTROL RESET MEMORY SWITCH NOP
END
END HI
END
ENDH
• • • •
R No.
$ constant
$ 0000 to $ FFFF
Number of bytes represents the memory capacity required for each instruction. Number in ( ) represents the memory capacity required for object code of each instruction. *1 34 + 0.25 + n x 0.25 (n: No. of shift steps) All operand values are shown in normal notation. The corresponding relay numbers in X-Y-M notation are shown below: Normal notation 0000 to 0415 0500 to 0915 1000 to 6915 7000 to 17915
X-Y-M notation X000 to X04F Y050 to Y09F M1000 to M6915 X700 to X174F or Y750 to Y179F
Chapter 2 Instructions
3-35
12
Page 60
2.1 Instruction List
Visual KV Series
2.1.2 Application Instructions Instruction
Symbol
Mnemonic
WAIT ON nnnn ON mmmm
W-ON
WAIT OFF nnnn OFF mmmm
W-OFF
WAIT UP EDGE WAIT DOWN EDGE
W-UE nnnn
W-DE mmmm
CONNECT
CON (FUN 06)
PUSH
MPS
READ
MRD
POP
MPP
STAGE
2 nnnn mmmm nnnn STG nnnn JMP
JMP (FUN 21)
END STAGE
ENDS
ENDS (FUN 14)
STEP
STP nnnn
STP (FUN 45)
STE
STE (FUN 43)
• • •
Function
Exec.time (µs)
Bytes
Page
5 (12)
3-96
5 (12)
3-96
5 (12)
3-98
1 (0)
3-98
1 (4)
3-102
3.2
1 (4)
3-103
6.8
1 (4)
3-103
10.5 to 13.0
3 (10)
3-103
Executes instructions in STG block when R (operand) is ON. 4.5 to 12.5
3 (8)
3-106
1 (4)
3-106
2.5
3 (10)
3-106
5 (12)
1 (0)
3-114
Turns ON
3-114
R (output operand [mmmm]) when R, T, or C (input operand 10.4 to 12.6 17915 T000 to T249 [nnnn]) is ON. nnnn: R, T, C C000 to C249 Turns ON R (output operand CTC0 to CTC3 [mmmm]) when R, T, or C (input 13.6 to 18.5 Nos. operand [nnnn]) is OFF. mmmm: mmmm: 1000 to 1915 Turns ON R (output operand 3000 to 9915 [mmmm]) at rising edge of R, T, 13.6 to 18.5 R No. 1000 to 1915 or C (input operand [nnnn]). R No. Turns ON R (output operand [mmmm]) at falling edge of R, T, 6.8 to 5.3 or C (input operand [nnnn]). Represents series connection of output instruction together with another instruction. Stores input status and arithmetic flag. Reads input status and arithmetic flag stored with PUSH. Reads & clears input status and arithmetic flag stored with PUSH.
STG (FUN 44)
JUMP
STEP END
Operand Operand value
R, T, C Nos.
3000 to 9915 0000 to 0009 When input is ON, turns R of current stage OFF and moves 4.3 to 7.5 to stage specified by operand. Turns current stage OFF and next stage ON when input is ON.
R No. nnnn: 0000 to
0500 to 9915 Executes program between T000 to T249 STP & STE when R (operC000 to C249 and) is ON. CTC0 to CTC3 11.2 to 13.4 Is used with STEP to make program step.
Number of bytes represents the memory capacity required for each instruction. Number in ( ) represents the memory capacity required for object code of each instruction. All operand values are shown in normal notation. The corresponding relay numbers in X-Y-M notation are shown below: Normal notation 0000 to 0415 0500 to 0915 1000 to 6915 7000 to 17915
3-36 Chapter 2 Instructions
X-Y-M notation X000 to X04F Y050 to Y09F M1000 to M6915 X700 to X174F or Y750 to Y179F