Beruflich Dokumente
Kultur Dokumente
KV-700 Series
Instruction
Reference Manual
Preface
This document describes the instructions used in KV-700 programs. Be sure to
thoroughly read and fully understand this manual before making programs.
Descriptions relating to KV-700 Series hardware and basic descriptions for making
programs are described in "Before You Start Programming" in the KV-700 Series
User's Manual. Beginners to programming should also read this manual together with
the KV-700 Series User's Manual.
Store this manual in a safe place so that you can retrieve it whenever necessary.
See to it that this manual reaches the last person who is going to use the KV-700 Series.
[Tip]
Indicates useful information or information that aids understanding of text descrip-
tions.
General Precautions
• Before you start using KV BUILDER, make sure that the Visual KV Series Basic Unit
and Visual KV Series CPU Unit functions and performance are normal.
• Before using the KV-700 Series, implement sufficient safety measures to prevent
various damage in the event that the KV Series malfunctions.
• Do not modify the KV-700 Series or use it in any way other than described in the
specifications. The functions and performance of products used or modified in this
way cannot be assured.
• When the KV-700 Series is used in combination with other equipment, functions and
performance may be degraded depending on operating conditions, surrounding
environment and other factors. Fully take this into consideration before using the KV-
700 Series in this way.
• Do not use the KV-700 Series for the purpose of protecting human life.
Requests
If the KV-700 Series is to be used in the following conditions or environments, make
sure that the actual operating conditions are well within the published ratings and
functional parameters. Take all necessary safety precautions, such as ensuring that
operation is fail-safe. Also, contact your agent about the following applications.
• Use under conditions and environment not described in this manual.
• Use of the KV-700 Series in nuclear power control, railroad facilities, aircraft facilities,
vehicles, combustion units, medical instruments, amusement machines, and safety
devices
• Use in applications where a major influence to human life and property is anticipated,
and where safety in particular is required
i
This page left intentionally blank.
ii
How This Manual Is Organized
Chapter 1 BRIEF EXPLANATION OF INSTRUCTIONS
This chapter provides an explanation of devices and conventions used in instructions in
this manual, and describes basic knowledge needed in handling instructions such as how
to handle data. (Detailed explanations of instructions in Chapters 2 to 5 assume that
readers of this manual have read and fully understood this chapter.)
Appendices
This chapter presents error code tables, instruction execution times, differences between
the KV-300 and KV-10/16/24/40, text code lists (ASCII), special device tables, and an
instruction index.
iii
Contents
Preface
Safety Precautions ................................................................................ i
How This Manual Is Organized ........................................................... iii
Contents ............................................................................................... iv
Conventions Used In This Manual .................................................... xii
iv
1-5 Configuration of Programs .................................................... 1-34
About Sequence Programs ................................................................. 1-34
1-6 Extended Ladder .................................................................... 1-38
Features of the Extended Ladder Language ...................................... 1-38
Advantages of the Extended Ladder Language.................................. 1-39
1-7 Indirect Specification ............................................................. 1-42
About Indirect Specification ................................................................ 1-42
Indirect specification method ................................................................ 1-42
Device ranges not available for indirect specification ........................... 1-42
Instructions that allow indirect specification in operands ...................... 1-43
1-8 List of Instructions ................................................................. 1-44
Basic Instructions ................................................................................ 1-44
Applied Instructions............................................................................. 1-49
Arithmetic Operation Instructions ........................................................ 1-51
Extended Instructions ......................................................................... 1-65
v
2-3 Comparison Contact Instructions......................................... 2-16
Comparison Contact Instruction List ................................................... 2-16
LD= Connecting devices as NO contacts that turn when "A=B"
to the bus line ...................................................................... 2-20
LD< Connecting devices as NO contacts that turn when "A<B"
to the bus line ...................................................................... 2-20
LD> Connecting devices as NO contacts that turn when "A>B"
to the bus line ...................................................................... 2-20
LD<= Connecting devices as NO contacts that turn when "A<=B"
to the bus line ...................................................................... 2-20
LD>= Connecting devices as NO contacts that turn when "A>=B"
to the bus line ...................................................................... 2-20
LD<> Connecting devices as NO contacts that turn when "A<>B"
to the bus line ...................................................................... 2-20
AND= Connecting devices in series as NO contacts that turn when
"A<=B" ................................................................................. 2-20
AND< Connecting devices in series as NO contacts that turn when
"A<=B" ................................................................................. 2-20
AND> Connecting devices in series as NO contacts that turn when
"A<=B" ................................................................................. 2-20
AND<= Connecting devices in series as NO contacts that turn when
"A<=B" ................................................................................. 2-20
AND>= Connecting devices in series as NO contacts that turn when
"A>=B" ................................................................................. 2-20
AND<> Connecting devices in series as NO contacts that turn when
"A<>B" ................................................................................. 2-20
OR= Connecting devices in parallel as NO contacts that turn when
"A=B" ................................................................................... 2-20
OR< Connecting devices in parallel as NO contacts that turn when
"A<B" ................................................................................... 2-20
OR> Connecting devices in parallel as NO contacts that turn when
"A>B" ................................................................................... 2-20
OR<= Connecting devices in parallel as NO contacts that turn when
"A<=B" ................................................................................. 2-20
OR>= Connecting devices in parallel as NO contacts that turn when
"A>=B" ................................................................................. 2-20
OR<> Connecting devices in parallel as NO contacts that turn when
"A<>B" ................................................................................. 2-20
2-4 Output Instructions ................................................................ 2-22
Output Instruction List ......................................................................... 2-22
OUT Outputting the previous state ............................................... 2-24
OUB Outputting the previous state inverted ................................. 2-24
SET Holding the state of the target relay ON .............................. 2-26
RES Turning the target relay OFF ............................................... 2-26
KEEP Setting/resetting target relays according to the SET/RES
input ..................................................................................... 2-28
DIFU Turning the target relay ON for one scan at the up edge of
the previous state ................................................................ 2-30
DIFD Turning the target relay ON for one scan at the down edge
of the previous state ............................................................ 2-30
ONDL ON delay operation of the target relay ................................. 2-32
OFDL OFF delay operation of the target relay ............................... 2-32
vi
SHOT One-shot operation of the target relay ................................. 2-34
FLIK Flicker operation of the target relay ..................................... 2-36
ALT Alternate operation of the target relay ................................. 2-38
2-5 Bit Output Instructions .......................................................... 2-40
Bit Output Instruction List .................................................................... 2-40
BOUT Outputting the previous state to the specified bit of
a reference word device ...................................................... 2-42
BOUB Outputting the previous state to the specified bit of
a reference word device inverted ......................................... 2-42
BSET Turning the specified bit of a reference word device ON
and holding this state ........................................................... 2-44
BRES Turning the specified bit of a reference word device OFF ... 2-44
2-6 Timer/Counter Instructions ................................................... 2-46
Timer/Counter Instruction List ............................................................. 2-46
TMR 32-bit 100 ms countdown timer ............................................ 2-48
TMH 32-bit 10 ms countdown timer .............................................. 2-50
TMS 32-bit 1 ms countdown timer ................................................ 2-52
C 32-bit total counter ............................................................... 2-56
ITVL Pulse measurement/DM value measurement ...................... 2-60
UDC 32-bit up-down counter ........................................................ 2-64
UDT 32-bit up-down timer ............................................................ 2-66
2-7 Connect/End Instructions ...................................................... 2-68
Connect/End Instruction List ............................................................... 2-68
END Ending the main routine program ........................................ 2-70
ENDH Ending the sequence program ............................................. 2-70
CON Connecting a series of output instructions ........................... 2-72
MPS Storing the previous state to memory .................................. 2-74
MRD Reading a state stored to memory by the MPS instruction .. 2-74
MPP Clearing a state stored to memory by the MPP instruction .. 2-74
ANL Connecting contact blocks in series .................................... 2-76
ORL Connecting contact blocks in parallel .................................. 2-76
vii
W-OFF Turning the target relay ON and holding this state when the
previous state is ON and the detection relay is OFF ........... 3-24
W-UE Turning the target relay ON and holding this state at the up
edge of the detection relay when the previous state is ON .... 3-26
W-DE Turning the target relay ON and holding this state at the
down edge of the detection relay when the previous state
is ON .................................................................................... 3-26
3-5 Flow Instructions .................................................................... 3-28
Flow Instruction List ............................................................................ 3-28
MC Starting master control ......................................................... 3-30
MCR Ending master control .......................................................... 3-30
CALL Calling up a sub-routine ....................................................... 3-34
SBN Starting a sub-routine .......................................................... 3-34
RET Ending a sub-routine ............................................................ 3-34
FOR Starting a repeat .................................................................. 3-38
NEXT Ending a repeat block .......................................................... 3-38
BREAK Forcibly ending a repeat ...................................................... 3-38
viii
4-4 Data Shift Instructions ........................................................... 4-74
Data Shift Instruction List .................................................................... 4-74
SRA Shifting internal registers to the right ................................... 4-76
SLA Shifting internal registers to the left ..................................... 4-78
RRA Rotating internal registers to the right .................................. 4-80
RLA Rotating internal registers to the left .................................... 4-82
WSR Shifting word data to the right .............................................. 4-84
WSL Shifting word data to the left ................................................ 4-86
4-5 Data Conversion Instructions ............................................... 4-88
Data Conversion Instruction List ......................................................... 4-88
TBCD Converting binary to BCD data ............................................ 4-90
TBIN Converting BCD data to binary ............................................ 4-92
MPX Decoding 4 bits to 16 bits .................................................... 4-94
DMX Encoding 4 bits to 16 bits ..................................................... 4-94
GRY Converting binary to gray code ............................................ 4-96
RGRY Converting gray code to binary ............................................ 4-98
DISN Dispersing words (16 bits) to nibbles (4 bits) ..................... 4-100
UNIN Uniting nibbles (4 bits) to words (16 bits) ........................... 4-102
DISB Dispersing words (16 bits) to bytes (8 bits) ........................ 4-104
UNIB Uniting bytes (8 bits) to words (16 bits) ............................. 4-106
SWAP Swapping upper and lower data ........................................ 4-108
XCH Exchanging data ................................................................ 4-110
4-6 Floating Point Instructions .................................................. 4-112
Floating Point Instruction List ............................................................ 4-112
FLOAT Converting binary to a floating point real number .............. 4-114
INTG Converting a floating point real number to binary .............. 4-116
DW.F Moving data ....................................................................... 4-120
LDA.F Moving data to internal registers from a move source ....... 4-122
STA.F Moving data from internal registers to a move destination ... 4-124
MOV.F Moving data from a move source to a move destination ... 4-126
FMOV.F Batch-moving from a move source to a move destination ... 4-128
DISF Dispersing floating point real number into
mantissa/exponent ............................................................. 4-130
UNIF Uniting mantissa/exponent to a floating point real number .. 4-132
ADD.F Adding floating point real number values ........................... 4-134
SUB.F Subtracting floating point real number values ...................... 4-136
MUL.F Multiplying floating point real number values ....................... 4-138
DIV.F Dividing floating point real number values ......................... 4-140
ROOT.F Calculating the square root of floating point real number
values ................................................................................ 4-142
CMP.F Comparing floating point real number values ...................... 4-144
ZCMP.F Comparing a range of floating point real number values ... 4-146
EXP Calculating the exponent ................................................... 4-148
LOG Calculating logarithms ....................................................... 4-150
RAD Converting degrees to radians ........................................... 4-152
DEG Converting radians to degrees ........................................... 4-154
SIN Calculating the sine (sin) value from angles in radians ..... 4-156
COS Calculating the cosine (cos) value from angles in radians ... 4-158
TAN Calculating the tangent (tan) value from angles in radians .. 4-160
ASIN Calculating the angle in radians from the sine (sin) value .... 4-162
ACOS Calculating the angle in radians from the cosine (cos) value 4-164
ATAN Calculating the angle in radians from the tangent (tan) value 4-166
ix
4-7 Text Processing Instructions .............................................. 4-168
Text Processing Instruction List ........................................................ 4-168
ASC Converting binary to Hex ASCII code ................................ 4-170
RASC Converting Hex ASCII code to binary ................................ 4-172
DASC Converting binary to decimal ASCII code .......................... 4-174
RDASC Converting decimal ASCII code to binary .......................... 4-178
SMOV Moving text strings ............................................................. 4-182
SADD Adding text strings ............................................................. 4-184
SCMP Comparing text strings ....................................................... 4-186
DISS Dispersing text strings (byte units) to text strings (word units)4-188
UNIS Uniting text strings (word units) to text strings (byte units) ... 4-190
LEN Measuring the length of text strings ................................... 4-192
RCOM Reading text strings ........................................................... 4-194
x
PLSY Starting Y-axis positioning operation ................................... 5-90
JOGX X-axis jog operation ............................................................. 5-92
JOGY Y-axis jog operation ............................................................. 5-92
ORGX X-axis zero return ................................................................ 5-94
ORGY Y-axis zero return ................................................................ 5-94
TCHX Teaching X-axis operations ................................................. 5-98
TCHY Teaching Y-axis operations ................................................. 5-98
Appendices
xi
Conventions Used In This Manual
Indicates the instruction and a 2-1 Contact Instructions Treats a device as a NO contact, and connects it serially to
AND AND
a circuit.
brief description of processing
by that instruction. ANB AND bar Treats a device as an NC contact, and connects it serially to
a circuit.
BASIC INSTRUCTIONS
Ladder program Input method
S
A N D S
A S
Indicates the basic format of X S
Marked with if the device is
S
an instruction by a ladder A N B S indirectly specified
diagram and coding list. B S
2 L
L
D
D N
I
O T
S
S
A N I S
Contact Instructions A N D N O T S
Explanation of operation
• In the ladder diagram, the device is shown in a serially connected state.
(processing) content of the
00000 00001 00500 LD 00000 instruction
AND 00001
OUT 00500
In this case, when input 00000 is ON, and (AND)00001 are ON, output 00500 turns ON.
• The number of contacts that can be serially connected in the program is not limited.
Operation flag
The operation flag does not change state.
2-6
AND
operation (processing) using
When input relays 00000 and 00001 both are ON, output relay 00500 turns ON. When either (or both)
of input relays 00000 or 00001 is OFF, output relay 00500 turns OFF. an example
00000 00001 00500
ANB
When input relay 00000 is ON, and input relay 00001 is OFF, output relay 00500 turns ON.
Otherwise, output relay 00500 turns OFF.
2
Contact Instructions
Indicates the page or manual "Precautions when using differential execution type instructions" page 1-6 LDP
LDF
ORP
2-7
* This page was made for the purpose of explaining page components,
and differs form an actual page.
xii
Terminology
This manual uses the following terminology excluding some instances.
Term Description
KV-700 Series Programmable Controller KV-700 Series unit made by Keyence
CPU Unit Corporation
PLC Overall term for a programmable controller system configured by
attaching respective units to the Basic Unit and the CPU Unit.
Indicates the overall system.
PC Stands for personal computer. Generally, refers to an NEC PC-
9800 Series, IBM PC and PC-AT compatible machine (DOS/V).
KV BUILDER KV BUILDER Ladder Support Software
Ladder program Program made by using the KV BUILDER Ladder Support Soft-
ware
Symbols
Menus or buttons in descriptions in this manual are expressed using the following
symbols.
Term Description
Indicates the page to refer to for supplementary explana-
tions.
About Data Annotation
# Values prefixed by "#" are expressed in decimal. Basi-
cally, all numerical values are expressed in decimal even
if they are not prefixed by "#".
$ Values prefixed by "$" are expressed in hexadecimal.
[DM00000/DM00001] When 32-bit numerical values are handled, two devices
are used. Programs are scripted using only device Nos.
(in the example on the left, DM00000) to which the lower
16 bits are stored. The example on the left indicates that
32-bit data is being handled.
Symbols used in "Instruction List" page 1-44 onwards
This indicates "(device turns ON) at the up edge of a
signal."
This indicates "for the duration that the signal is ON."
This indicates "(device turns ON) at the down edge of a
signal."
xiii
This page left intentionally blank.
xiv
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
1
Configuration of Instructions
BRIEF EXPLANATION OF INSTRUCTIONS
This chapter provides an explanation of devices and conventions
used in instructions in this manual, and describes basic knowledge
needed in handling instructions such as how to handle data.
(Detailed explanations of instructions in Chapters 2 to 5 assume that
readers of this manual have read and fully understood this chapter.)
For description of functions that are reliant on PLC unit hardware,
refer to the KV-700 User's Manual.
1-1
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Classification of Instructions
181 types and 483 instructions can be used in programs run on the KV-700 CPU Unit.
1-2
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Conventions Used in This Instruction Reference Manual
The KV-700 has 181 types and 483 instructions. Each of these instructions comprises an instruction
and an operand. The following shows the basic concept behind an instruction.
Instruction The 1st operand The 2nd operand The 3rd operand
Operand section
The number of operands differs according to the instruction. (The maximum number of operands
is three, and sometimes instructions do not have an operand.)
1
Configuration of Instructions
The following conventions are used in this manual for expressing instructions and operands.
■ Annotation of instructions
Instructions are each given a name according to differences in their operation. This is called an
"instruction word." For example, the instruction for moving 16-bit data is indicated as "MOV" while
the instruction for comparing two 16-bit data values is indicated as "LD=".
For details on the spelling of instructions, see "List of Instructions" ( page 1-44).
■ Annotation of operands
Targets to be referenced in execution of instructions and storage destinations for data resulting
from having executed an instruction are specified in the operand section of the instruction.
Different roles are assigned to operands depending on the order in which they are arranges, and
their annotation varies according to their differing roles.
For details on handling of numerical values, see "How Data Is Handled" ( page 1-20).
[Example] The 16-bit data move instruction "MOV" is annotated as follows. ( page 4-14)
MOV
S D MOV S D
This indicates that operands follow "reference target" and "storage destination"
in order after the MOV instruction.
Note: The relationship between the operand programming order and the role of the operand
differs according to the instruction. For details, check the respective page for the instruction
in question.
1-3
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
1 [Example] To store 16-bit data #00100 (decimal 100) to data memory DM00000 when input relay
00000 turns ON
Configuration of Instructions
Search for 16-bit move instruction "MOV" from the "Instruction List", and check the
page that gives the required explanation. Open the manual ( page 4-14) that
explains the MOV instruction, and refer to the format of the instruction and the devices
that can be used for the operand. The following kind of explanation will be given there.
S — — — * * — — — —
D — — — — * * —
S : Specifies the source data to be moved or the leading device to which that data is currently stored.
You should be able to see that to store 16-bit data #00100 to DM00000, #00100 should
be specified to S and DM00000 should be specified to D . For this reason, script
the program as follows:
00000 MOV
#00100 DM00000
The explanation also says that S can be specified by "the source data to move or
the device that stores this data." So, you can also script the program as follows:
00000 MOV
TM000 DM00000
In this case, the value currently stored to temporary data memory TM000 is move to
data memory DM00000.
1-4
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Differences in Annotation According to Instruction Execution Type
There are two types of instructions, "every scan execution type" and "differential execution type
(pulse execution type)." With the "every scan execution type," the instruction is executed at every
scan for the duration that the execution condition is satisfied (ON). With the "differential execution
type," the execution is executed only once at the up edge when the execution condition turns ON
or at the down edge when the execution condition turns OFF.
Configuration of Instructions
About Every Scan Execution Type and Differential Execution Type
■ Every scan execution type
These instructions are executed at each scan for the duration that the execution condition is
satisfied (ON).
Scan
ON
Execution Execution condition 1 scan
condition OFF
Instruction
Instruction Unprocessed Execution Unprocessed Execution Unprocessed
Scan
ON
Execution 1 scan
Execution condition
condition OFF
Instruction
Instruction Unprocessed Unprocessed Unprocessed
Executed only once Executed only once
A down edge is detected at (A) as the previous value is ON and the current value is OFF.
A up edge is detected at (B) as the previous value is OFF and the current value is ON.
1-5
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
00000 00
CALL
END
SBN
00
Differential detection device
00001 DM00000 DM00001
LDA STA
RET
ENDH
When the nth and n+1th differential execution type instruction are not executed continu-
ously
ON
00000
OFF
Pattern A
ON
00001 OFF ON
OFF
Pattern B
ON
00001 ON ON
OFF
In pattern A, the up edge is detected as the current value (state of input n+1th input 00001) has
changed to ON (OFF to ON) with the previous value (state of nth input 00001) ON. For this
reason, @LDA and @STA are executed.
In pattern B, the up edge is not detected as the current value (state of n+1th input 00001) also
has not changed from ON (ON to ON) with the previous value (state of nth input 00001) ON. For
this reason, @LDA and @STA are not executed.
The above kind of difference sometimes occurs even if the state of the n+1th differential detection
device is the same.
1-6
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
When a differential execution type instruction is executed twice or more in a single scan
This time
ON
00000
OFF 1
Configuration of Instructions
ON
00001 OFF ON ON
OFF
When the states of the n-1th, nth and n+1th differential detection devices (execution conditions of
differential execution type instruction) are as follows:
n-1th: OFF
nth: ON
n+1th: ON
At the nth instruction, the up edge is detected as the current value (state of nth input 00001) has
changed to ON (OFF to ON) with the previous value (state of n-1th input 00001) OFF. For this
reason, @LDA and @STA are executed.
At the n+1th instruction, the up edge is not detected as the current value (state of n+1th input 00001)
also has not changed from ON (ON to ON) with the previous value (state of nth input 00001) ON.
For this reason, @LDA and @STA are not executed.
1-7
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
(2) When a differential execution type instruction is used between the STP and STE
instruction
The previous value of the differential detection device (execution condition of the differential
execution type instruction) is the state when the program between the previous STP and STE
instructions is executed. If the number of times that the program between the STP and STE
instructions is taken to be n, then the previous value of the n+1th instruction becomes the nth
state.
Care is required when the program between the STP and STE instructions is not executed
continuously between the nth and n+1th instructions.
1
Configuration of Instructions
STP
00000
Derivative detection device
00001 DM00000 DM00001
LDA STA
STE
Pattern A
ON
00001 OFF ON
OFF
Pattern B
ON
00001 ON ON
OFF
In pattern A, the up edge is detected as the current value (state of input n+1th input 00001) has
changed to ON (OFF to ON) with the previous value (state of nth input 00001) ON. For this
reason, @LDA and @STA are executed.
In pattern B, the up edge is not detected as the current value (state of n+1th input 00001) also
has not changed from ON (ON to ON) with the previous value (state of nth input 00001) ON. For
this reason, @LDA and @STA are not executed.
The above kind of difference sometimes occurs even if the state of the n+1th differential detection
device is the same.
1-8
1-1 Configuration of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
(3) When a differential execution type instruction is used between the STG and JMP/ENDS
instructions
The previous value of the differential detection device (execution condition of differential
execution type instruction) becomes the state of the next scan after the program in the previous
stage has ended. (The program between the STG and JMP/ENDS instructions is executed at
execution condition OFF at the next scan after the stage has ended.) If the number of times that
the program in the stage is executed (including the one scan after the stage ends) is taken to be
n, then the previous stage of the n+1th instruction becomes the nth state.
Care is required when the program in the stage is not executed continuously between the nth
and n+1th instructions. 1
Configuration of Instructions
Derivative detection device
01100 00000 01000 00500 #00030 T000
STG T000 JMP
01000
ON
01100
OFF
Pattern A
ON
00000 OFF ON
OFF
Pattern B
ON
00000 ON ON
OFF
In pattern A, the up edge is detected as the current value (state of input n+1th input 00000) has
changed to ON (OFF to ON) with the previous value (state of nth input 00000) ON. For this
reason, input 01000 is set.
In pattern B, the up edge is not detected as the current value (state of n+1th input 00000) also
has not changed from ON (ON to ON) with the previous value (state of nth input 00000) ON. For
this reason, input 01000 remains OFF.
The above kind of difference sometimes occurs even if the state of the n+1th differential detection
device is the same.
About Suffixes
A "suffix" is attached to the end of instruction words. There are five types of suffixes.
.U .D .S .L .F
1-9
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
Device List
1 Device Name
Bit devices
Range Quantity Main Functions
Configuration of Devices
Input relays 00000 to 00009*1 Total of 9530 Devices for capturing ON/OFF information
01000 to 59915*2 inputs, outputs from external devices
Output relays 00500 to 00503 and internal Devices for sending ON/OFF information to
01000 to 59915*2 auxiliary relays external devices
Internal auxiliary 00504 to 00915 Devices that can be used only internally by
relays 01000 to 59915*2 the CPU
Control relays CR0000 to CR3915 640 Devices for controlling PLC function and learn-
ing states
Timers TMR (TMH, TMS, UDT) 000 Total of 512 1 ms, 10 ms, 100 ms subtraction timers
to TMR (TMH, TMS, UDT) timers and and 10 ms up-down timers
511 counters
Counters C (UDC)000 to C (UDC)511 Add counters/up-down counters
High-speed counter CTC0 to CTC3 4 High-speed counter comparators
comparators
Word devices
Data memories DM00000 to DM19999 20000 Devices that can store numerical value data
DM00000 to DM39999*3 40000*3 internally on the PLC. These devices pro-
cess in 16-bit units.
Temporary data TM000 to TM511 512 These memories have the same functions as
memories data memories, and store data during indi-
rect specifications and arithmetic operations.
Control memories CM0000 to CM3999 4000 Devices for controlling PLC function and learn-
ing states
High-speed counters CTH0 to CTH1 2 Addition counters, phase difference counters
Internal registers 1 Devices for storing data and temporary stor-
age
*1 Devices 00010 to 00415 are reserved by the system, and cannot be used.
*2 Devices 01000 to 59915 can be set freely on Unit Editor to input relays, output relays and internal auxiliary relays.
*3 When extended memory is mounted
1-10
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
About Bit Devices
Input relays
• Input relays are devices for capturing ON/OFF information or data on the PLC from an external
device. External devices include buttons and switches (e.g. selector switches, limit switches,
photoelectric switches).
• Device Nos. are configured as follows:
[Example] 1
Configuration of Devices
Channel No. (000 to 599) Contact No. (00 to 15)
12515
Device No. (00000 to 00009, 01000 to 59915)
Device Nos. can be programmed in the ranges 00000 to 000009 and 01000 to 59915
as described above.
• 1-bit is assigned to each input terminal for input relays. Either a NO or NC contact can be specified.
• Input relays having the same No. can be written any number of times in a single program. The
number of times that the same No. can be programmed is not limited.
• Input relay Nos. cannot be used in duplicate with output relays and internal relays.
Output relays
• Output relays are devices for sending ON/OFF instruction or results of arithmetic operation from
the PLC to an external device. External devices include solenoids, electromagnetic switches and
indicators (signal lamps, digital displays).
• Device Nos. are configured as follows:
[Example]
12515
Device No. (00500 to 00503, 01000 to 59915)
Device Nos. can be programmed in the ranges 00500 to 00503 and 01000 to 59915
as described above.
• 1-bit is assigned to each output terminal for output relays. Either a NO or NC contact can be
specified.
• Output relays having the same No. can be written any number of times in a single program. The
number of times that the same No. can be programmed is not limited. Take care to prevent double
coils from being programmed.
• Output relay Nos. cannot be used in duplicate with input relays and internal auxiliary relays.
1-11
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
[Example]
Channel No. (005 to 599) Contact No. (00 to 15)
1
12515
Configuration of Devices
Device Nos. can be programmed in the range 01000 to 59915 as described above.
• Internal auxiliary relays can be used within the range 01000 to 59915.
• Internal auxiliary relays having the same No. can be written any number of times in a single
program. The number of times that the same No. can be programmed is not limited.
• Set power interruption hold by the MEMSW instruction. ( page 3-8)
• Internal auxiliary relay Nos. cannot be used in duplicate with input relays and output relays.
[Tip]
About annotation of devices for relay units
The KV-700 allows devices for relay units to be annotated as relays based upon the unit No. in
addition to regular channel annotation of relays. When programming ladders, relay annotation
can be handled in the same way as regular channel annotation.
Unit No. Unit relay No.
005- 00010
Channel No. Contact No.
Unit No.: Unit Nos. are assigned in the order that units are connected starting from the
CPU in the manner 000, 001, 002, 003, 004 and so forth.
Unit relay No.: The number of relays occupied from 00000 are assigned as relay Nos.
[Example]
1-12
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
CR Control relays
Control relays can be used in the range CR0000 to CR3915. Control relays are special internal
auxiliary relays whose method of use is pre-determined. These are used for controlling PLC
functions, or for learning PLC states. CRs reserved for the system cannot be used.
For details, see "Control Relay/Memory List" ( page A-19).
T Timers
Timers are devices that turn ON when the value (current value) of subtraction type timers whose
operation was started by the TMR/TMH/TMS instructions matches "0" (time up), or when the value
1
Configuration of Devices
of addition/subtraction type timers whose operation was started by the UDT instruction matches the
setting value or "0". There are four types of timers: 1 ms timers, 10 ms timers, 100 ms timers, or up-
down counter timers.
For details on how to change timer current values/setting values and how to read
current values, refer to the TMR, TMH, TMS, or UDT instructions.
"TMR instruction sample program" page 2-54
■ Precautions when using timer instructions (TMR, TMH, TMS, UDT, ONDL, OFDL, SHOT,
FLIK)
When a timer instruction is used between the SBN and RET instructions (in a sub-routine) and
between the STP to STE instructions, program a condition (a condition where execution of the
SBN to RET instructions or the STP to STPE instructions is not stopped during measurement
of the time) where execution of the timer instruction is not stopped.
If execution stops during time measurement, and execution is restarted, the timer may not turn
ON even if the setting value is exceeded.
1-13
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
C Counters
Counters (C) are devices that turn ON when the value (current value) of addition type counters
whose operation is started by the counter instruction becomes (counted up) the same value as the
setting value.
* The ratio between the time that the signal is ON and the time that it is OFF is called the "duty
ratio."
T1 T2
T1
When T1≤T2, the duty ratio becomes x 100 (unit: %).
T1 + T2
T2
When T1>T2, the duty ratio becomes x 100 (unit: %).
T1 + T2
1-14
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
About Word Devices
DM Data memories
Data memories are devices for saving data to be referenced when an instruction performs an
arithmetic operation or for storing the result of an arithmetic operation.
Devices Nos. start with DM and are followed with a No. (decimal).
[Example]
Configuration of Devices
Data memory Nos. can be programmed in the range DM00000 to DM199999 (or DM00000 to
DM39999 when extended memory is mounted*) as described above.
* When extended memory is mounted
• The bit width of a single device is 16 bits, and is 0 to 65535 when devices are handled as unsigned
binary data.
When devices are handled as signed binary data, the values in the range -32768 to 32767 (both
expressed in Hex $0 to $FFFF) can be handled.
DM00001
16 bit
• Two devices can also be used and handled as 32-bit data. In the case of 32-bit data, the lower
16 bits are stored to the data memory of the specified device No., and the upper 16 bits are stored
to the data memory of following device No. When devices are handled as unsigned binary data,
values can be handled in the range 0 to 4294967295, and when devices are handled as signed
binary data, values can be handled in the range -2147483648 to 2147483647 (both expressed in
Hex $0 to $FFFFFFFF).
DM00001 DM00000
32 bit
When the operand of the instruction for handling 32-bit data is specified by a data memory, specify
only the device No. to which the lower 16 bits are stored.
"About Handling 32-bit Data" page 1-24
• Data stored to data memory does not change until new data is next stored to that data memory.
Data is held in the event of a power interruption.
• Temporary data memory (TM) can be used as a substitute for a data memory. Temporary data
memory can be used in the same way as data memories when there are not enough data
memories.
Note, however, that temporary data memories has specific functions, so be sure to thoroughly
read the explanation for the device before you use temporary data memories.
1-15
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
[Tip]
About annotation of devices for data memory units
The KV-700 allows devices for data memory units to be annotated based upon the unit No. in
addition to regular annotation. When programming ladders, data memory annotation can be
handled in the same way as regular annotation.
1 DM005- 00010
Unit No.: Unit Nos. are assigned in the order that units are connected starting from the CPU
Configuration of Devices
[Example]
CM Control memories
Control memories are assigned to CM0000 to CM3999.
Control memories are special internal registers whose method of use is pre-determined. These are
used for controlling PLC functions, or for learning PLC states. CMs reserved for the system cannot
be used.
For details, see "Control Relay/Memory List" ( page A-25).
1-16
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
CTH High-speed counters
High-speed counters are 32-bit counters for capturing short signals that cannot be captured by
regular counter instructions.
The internal clock can also be counted in addition to external inputs.
There are two response frequencies, single-phase 40 kHz and 2-phase 30 kHz, both having a duty
ratio of 50%.
For details, see "Outline of High-speed Counters" ( page 5-69).
KV-700 User's Manual
1
About Internal Registers
Configuration of Devices
Internal registers are devices for storing the result of arithmetic operations by applied instructions,
arithmetic operation instructions and extended instructions, and for temporarily storing data during
arithmetic operation.
Internal registers are made up of 32 bits, by upper 16 bits and lower 16 bits, as shown as follows.
Sometimes only the lower 16 bits are used, while sometimes all of the upper and lower 32 bits are
used. This depends on the instruction word.
"About Suffixes" page 1-28
The internal register of the lower 16 bits is called the "16-bit internal register." The internal register
of 32 bits made by combining the upper and lower 16 bits is called the "32-bit internal register."
The lower 16 bits of the 32-bit internal register becomes a 16-bit internal register.
Data stored to internal registers does not change until new data is next stored.
Values are not saved when the power is turned OFF.
Instructions that handle 16-bit data use only 16-bit internal registers. Instructions that handle 32-bit
data use the 32-bit internal register.
LDA instruction
Internal register
LDA instruction
1-17
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
About Constants
# Decimal constant
Decimal constants are devices that indicate in decimal numerical values that are expressed by two
bit widths, 16 bits and 32 bits.
Decimal constants are annotated by a # prefix followed by the numerical value in decimal.
[Example]
1
Symbol indicating
Configuration of Devices
#06143
The following numerical values can be handled as decimal constants:
16-bit unsigned values: 0 to 65535
32-bit unsigned values: 0 to 4294967295
16-bit signed values: -32768 to 32767
32-bit signed values: -2147483648 to 2147483647
$ Hexadecimal constant
Hexadecimal constants are devices that indicate in hexadecimal numerical values that are
expressed by two bit widths, 16 bits and 32 bits.
Hexadecimal constants are annotated by a # prefix followed by the numerical value in hexadecimal.
[Example]
Symbol indicating
Hex annotation Numerical value
$1AF 7
The following numerical values can be handled as hexadecimal constants:
16 bits: $0000 to $FFFF
32 bits: $00000000 to $FFFFFFFF
1-18
1-2 Configuration of Devices
OF INSTRUCTIONS
BRIEF EXPLANATION
■ Changes in numerical values when maximum and minimum values are exceeded
Numerical values change as follows when the result of arithmetic operation exceeds the
maximum/minimum value range in which 16/32-bit signed/unsigned data can be handled.
Unsigned binary
(Decimal annotation)
HEX
(Hex annotation)
Signed binary
(Decimal annotation)
HEX
(Hex annotation)
1
Configuration of Devices
3 0003 3 0003
2 0002 2 0002
Overflow 1 Overflow 0001 1 0001
0 0000 0 0000
65535 FFFF -1 FFFF
65534 FFFE -2 FFFE
Underflow Underflow FFFD -3 FFFD
65533
65532 FFFC -4 FFFC
...
...
...
32771 ...
8003 -32765 8003
32770 8002 -32766 8002
Overflow Overflow
32770 8001 -32767 8001
32768 8000 -32768 8000
32767 7FFF 32767 7FFF
32766 7FFE Underflow 32766 Underflow 7FFE
32765 7FFD 32765 7FFD
32764 7FFC 32764 7FFC
32763 7FFB 32763 7FFB
...
...
...
Numerical values exceeding the maximum value that can be handled is called an "overflow,"
while numerical values falling below the minimum value that can be handled is called an
"underflow."
1-19
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
■ 16 bits
1-20
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
■ 32 bits
Decimal
Hex Binary
Unsigned Binary Signed Binary
0 0 0 0000 0000 0000 0000 0000 0000 0000 0000
1 1 1 0000 0000 0000 0000 0000 0000 0000 0001
2 2 2 0000 0000 0000 0000 0000 0000 0000 0010
3 3 3 0000 0000 0000 0000 0000 0000 0000 0011
4 4 4 0000 0000 0000 0000 0000 0000 0000 0100
5
6
5
6
5
6
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0101
0110
1
1-21
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
BIN Binary
Binary numbers are expressed by 0 and 1 only. When each binary digit exceeds 1, it is carried out
to the next digit.
MSB
bit bit bit bit
15 8 7 0
1 2
15
2
14
2
13
2
12
2
11
2
10
2
9
2
8
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
Bit weighting
=
=
How Data Is Handled
32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 Decimal value
HEX (Hexadecimal)
Hexadecimal numbers are expressed using binary four bits as one digit. As the values that can be
expressed by a single digit are 0 to 15, ABCDEF are used for values that are greater than 9. When
a digit exceeds F, it is carried out to the next digit.
The range of values that can be stored to each register is $0000 to $FFFF.
0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1
When data is stored as shown above, ordinarily, it is stored as the value #0987 (#2439
in decimal). However, with BCD numbers, this is expressed as "0987" in decimal
annotation.
0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1
1,000's value 100's value 10's value 1's value
0 9 8 7
BCD numbers are a handy method of number representation when handling external data (e.g. from
a digital switch). Note, however, that BCD numbers are handled as binary numbers when the PLC
performs arithmetic operations. When values are read from an external device, convert them to
binary numbers by the TBIN instruction, and when outputting binary numbers to an external device
(e.g. digital display), convert them to BCD by the BCD instruction.
1-22
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
Floating point real numbers
With floating point instructions, values (n) in the following range can be handled:
–3.4E38 ≤ n ≤ –1.4E–45
n=0
1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7)
To be more precise, the precision of floating point real numbers is 32-bit single-precision, and the
number of effective digits is as follows: 1
When the result of arithmetic operations exceeds the above bit widths, an error will occur in the
result.
The size of floating point real numbers can be compared by 32-bit binary data compare instructions
(=.D <>.D >.D >=.D <.D <=.D =.L<>.L >.L >=.L <.L <=.L). Note, however, that when minus numbers
are compared with minus numbers, the size relationship is inverted.
When comparing with 16/32-bit binary data, set the same data format for the data to be compared
by the FLOAT or INTG instruction.
The floating point real number value is a numerical value annotated as follows:
-3
-1.234x2
Sign Mantissa section Exponent section
bit bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
11111100($FC)= 125
11111101($FD)= 126
11111110($FE)= 127
11111111($FF)= Unused
1-23
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
When handling 32-bit data, use the .D or .L suffixes after the instruction.
When specifying a word device as the operand, specify the device to which the lower 16 bits are
stored.
[Example] Use the MOV.D instruction to store the value #200000 to data memories DM00100 and
DM00101.
MOV.D
#200000 DM00100
Unsigned 32-bit data can be handled as a value in the range 0 to 4294967295, and signed 32-bit
data can be handled as a value in the range -2147483648 to 2147483647.
"About Suffixes" page 1-28
"About Handling Bit Devices in Word Units" page 1-25
1-24
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
About Handling Bit Devices in Word Units
Normally (that is, by a sequence instruction), bit devices are processed as 1-bit devices.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
Input relay
5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
1
Output relay
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
Bit devices can be processed in 16-bit or 32-bit groups by arithmetic operation instructions.
When a bit device is specified to the operand of an instruction that processes in word units, the bit
device is handled in word units starting from the specified bit device.
[Example]
MOV
30000 DM00000
30015 30000
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
1 1 1 1 0 0 0 011 1 1 1 0 0 0 0
MOV.D
30000 DM00000
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
1-25
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
When the bit device specified to the operand is not the start of the channel, the bit device is handled
as a word unit straddling the next channel.
MOV
30003 30505
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
1
30604 30505
How Data Is Handled
306ch 305ch
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Note: When the operand is set on a bit device by the STA instruction, and channels are
straddled, data is not moved to the channel that the bit device straddles.
00000 00503
LDA STA
00015 00000
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
? ? ? 1 0 0 0 0 1 1 1 1 0 0 0 0
00601 00515
* 00600 to 00602 is not moved. The value before execution of the instruction is held in
00600 to 00602.
"STA Instruction" page 4-8
1-26
1-3 How Data Is Handled
OF INSTRUCTIONS
BRIEF EXPLANATION
This page left intentionally blank.
1-27
1-4 About Suffixes
OF INSTRUCTIONS
BRIEF EXPLANATION
What Is a "Suffix?"
1 A "suffix" is attached to the end of instruction words. There are five types of suffixes as follows.
About Suffixes
.U .S .D .L .F
* The instruction word that supports suffixes is entered for .
Data memory and internal register values are handled as follows according to the suffix.
Indication of .U is omitted on Ladder Software KV BUILDER. Also, instruction without a suffix are
handled as 16-bit unsigned binary data.
Instructions with suffixes execute binary data in decimal annotation values corresponding to the
suffix.
Accordingly, the result of instruction execution may differ depending on differences in the suffix even
if the binary data is the same.
Accordingly, the relationship between binary data and decimal annotation corresponding to the
suffix is as follows.
BIN Binary 1111111111111111
.U Unsigned decimal 65535
.S Signed decimal –1
1-28
1-4 About Suffixes
OF INSTRUCTIONS
BRIEF EXPLANATION
[Example] To compare 16-bit binary data (1111111111111111) currently stored in DM00000 with
constant #00100
DM00000
> .U LD.U> DM00000 #00100
#00100
Accordingly, DM00000 is greater than #00100, and the contact turns ON.
(65535) 1
About Suffixes
When the suffix is .S, the value of DM00000 becomes -1.
DM00000
> .S LD.S> DM00000 #00100
#00100
Accordingly, DM00000 is less than #00100, and the contact turns OFF.
(-1)
Accordingly, the relationship between binary data and decimal annotation corresponding to the
suffix is as follows.
BIN Binary 11111111111111111111111111111111
.D Unsigned decimal 4294967295
.L Signed decimal –1
When the suffix is .D, the value of DM00000 and DM00001 becomes 4294967295.
DM00000
> .D LD.D> DM00000 #00100
#00100
Accordingly, DM00001 (upper) and DM00000 (lower) is greater than #00100, and the
contact turns ON. (4294967295)
When the suffix is .L, the value of DM00000 and DM00001 becomes -1.
DM00000
> .L LD.L> DM00000 #00100
#00100
Accordingly, DM00001 (upper) and DM00000 (lower) is smaller than #00100, and the
contact turns OFF. (-1)
1-29
1-4 About Suffixes
OF INSTRUCTIONS
BRIEF EXPLANATION
[Tip]
In the xcase of instructions that move data, the execution result is the same even if either of the
.U and .S (.D and .L) suffixes is used for the instruction.
LDA, STA, MOV etc.
The value of binary expressed in decimal has not bearing on the suffix before or after execution
of these instructions.
Only the length of the data (16 bits or 32 bits) has any bearing on the suffix.
1
[Example] In this example, the MOV instruction is used to move DM00000 to DM00010.
About Suffixes
MOV.U
DM00000 DM00010
MOV.S
DM00000 DM00010
DM00000 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
DM00010 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
In this example, the LDA and STA instructions are used to move DM00000/DM00001
to DM00010/DM00011.
DM00000 DM00010
LDA.D STA.D
DM00000 DM00010
LDA.L STA.L
DM00000 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
DM00010 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Additional Explanation
With the .F suffix, binary data is handled as floating point real numbers. Data becomes
32-bit data. Accordingly, with the MOV, LDA and STA instructions, the result will be the
same as when .D or .L is used even if .F is used as the suffix.
MOV.F
DM00000 DM00010
* In the Ladder Support Software KV BUILDER (when a Monitor or Simulator is used), binary data
is expressed in decimal corresponding to the suffix. Accordingly, a different value may be
displayed even if the result of instruction execution is the same.
1-30
1-4 About Suffixes
OF INSTRUCTIONS
BRIEF EXPLANATION
About suffix .F
With the .F suffix, binary data is handled as floating point real number data. Data is 32-bit data.
With floating point real number data, values are annotated (internal annotation) by a special
bit configuration. So, try to avoid parsing the internal annotation to directly manipulate bits.
The floating point real number value is a numerical value annotated as follows:
-1.234x2 -3
1
About Suffixes
Sign Mantissa section Exponent section
bit bit
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1-31
1-4 About Suffixes
OF INSTRUCTIONS
BRIEF EXPLANATION
[Tip]
Numerical values are converted on KV BUILDER according to the suffix.
Input Display
#65535
L D A ( . U ) # 6 5 5 3 5 LDA
–1
L D A . S # 6 5 5 3 5 LDA.S
1 –1
About Suffixes
L D A . S # – 1 LDA.S
#65535
L D A ( . U ) # – 1 LDA
#4294967295
L D A . D # 4 2 9 4 9 6 7 2 9 5 LDA.D
–1
L D A . L # 4 2 9 4 9 6 7 2 9 5 LDA.L
–1
L D A . L # – 1 LDA.L
#4294967295
L D A . D # – 1 LDA.D
1-32
1-4 About Suffixes
OF INSTRUCTIONS
BRIEF EXPLANATION
This page left intentionally blank.
About Suffixes
1-33
1-5 Configuration of Programs
OF INSTRUCTIONS
BRIEF EXPLANATION
Step 0
Sequence program
ENDH
Step 0
END
ENDH
The main routine program is executed at each scan. Be sure to program the main routine program
in a sequence program.
If the main routine program is not written in the sequence program, sub-routine programs or
interrupt programs also cannot written.
1-34
1-5 Configuration of Programs
OF INSTRUCTIONS
BRIEF EXPLANATION
■ Sub-routine program
The sub-routine program is executed by the CALL instruction from within the main routine
program. Sub-routine programs are used to execute the same processing at multiple locations
within the main routine program. Sub-routine programs can also hold programs to be executed
only when preset conditions are satisfied. In this case, write such programs in the sub-routine
program and execute the sub-routine program whenever it is necessary.
"CALL Instruction/SBN Instruction" page 3-34
Program sub-routine programs in steps between the END and ENDH instructions. 1
Configuration of Programs
Step 0
END
Sequence program
SBN00
RET
SBN01 Sub-routine program
RET
ENDH
Sub-routine programs can also be programmed with interrupt programs (explained later) if they
are programmed between the END and ENDH instructions.
Step 0
END
Sequence program
SBN00 RET Sub-routine program
INT000 RETI Interrupt routine program
ENDH
Specify the SBN instruction after the END instruction for the start of the sub-routine program. At
the final step of the sub-routine program, program the RET (return to step following called CALL
instruction) instruction.
Note: To be precise, the sub-routine program is executed when the CALL instruction execution
condition turns ON. Sub-routine programs can also be called (nested) from within sub-
routine programs. Note, however, that sub-routine programs can be programmed only
down to a nesting level of four.
"CALL Instruction/SBN Instruction" page 3-34
1-35
1-5 Configuration of Programs
OF INSTRUCTIONS
BRIEF EXPLANATION
■ Interrupt program
The interrupt program is executed when an interrupt cause set by the INT instruction is
generated.
"INT Instruction" page 5-56
Note: To execute an interrupt program, set execution of the interrupt program to "enabled" by the
EI instruction in the main routine program. The default setting when the program is started
up is "disabled."
1
Configuration of Programs
Program interrupt programs in steps between the END and ENDH instructions.
Step 0
END
Sequence program
INT000
RETI
INT001 Interrupt program
RETI
ENDH
Interrupt programs can also be programmed with sub-routine programs (explained earlier) if they
are programmed between the END and ENDH instructions.
Step 0
END
Sequence program
SBN00 RET Sub-routine program
INT000 RETI Interrupt program
ENDH
Program interrupt programs by specifying the INT instruction after the END instruction.
At the final step of the interrupt program, program the RETI (return to step before interrupt)
instruction.
Though up to eight interrupt programs can be programmed in a single sequence program,
multiple interrupt programs that use the same interrupt cause cannot be programmed.
1-36
1-5 Configuration of Programs
OF INSTRUCTIONS
BRIEF EXPLANATION
■ Precautions relating to execution of interrupt programs
• To execute an interrupt program, set execution of the interrupt program to "enabled" by the EI
instruction in the main routine program. The default setting when the program is started up is
"disabled." When the interrupt program is executing, the interrupt program enters an interrupt
"disabled" state. To set interrupt to "enabled" during execution of the interrupt program,
program the EI instruction into the interrupt program.
• Interrupt programs for interrupt causes that occur before the EI instruction is executed are
executed after interrupt is enabled by the EI instruction. Interrupt causes that are generated
before execution of the EI instruction are stored to memory. 1
Configuration of Programs
• When two or more interrupt causes are stored to memory, program execution starts with the
program for the interrupt cause having the highest priority.
• When an interrupt cause is generated, execution of instructions in the main routine program
is discontinued even during instruction execution.
• When the PLC is operating in the constant scan mode, the corresponding interrupt program
is executed even if an interrupt cause is generated during the wait time in END processing.
"About the interrupt function" page 5-57
1-37
1-6 Extended Ladder
OF INSTRUCTIONS
BRIEF EXPLANATION
1 With conventional ladder languages, output instructions could be written only at the right side of the
ladder program. However, with extended ladder language, it can be written at all position except the
Extended Ladder
left edge, thus enabling programs such as the one shown below to be written.
Only input circuit Only output Only input Input/output Only output
can be written. circuit can circuit can be circuits can circuit can be
be written. incorporated. be mixed. incorporated.
Branches can be input only from input contacts. Branches can also be input from output coils.
MOV
Note: Box type instructions ( ) cannot be programmed in extended ladders.
1-38
1-6 Extended Ladder
OF INSTRUCTIONS
BRIEF EXPLANATION
Advantages of the Extended Ladder Language
Fewer ladder rungs
Input and output instructions can be mixed and programmed next to each other, which reduces the
number of rungs in the ladder program. The content of the ladder program to be executed can also
be understood at a glance.
Extended Ladder
Output 00502 is turned ON when the content is #03000.
[Example] When the Start switch is turned ON, the indicator lights for three seconds, the buzzer
sounds for two seconds, and motor operation is started.
00000 01100 01100 01000 When the start switch (00000) turns ON,
DIFU SET the indicator (00500) lights, and timer
01000 00500 #00030 T000 01001 T000 starts to operate.
STG T000 JMP
01001 00501 #00020 T001 01002 When timer T000 turns ON three sec-
STG T001 JMP onds later, the indicator goes out, the
01002 00502 00000 buzzer (00501) sounds, and timer T001
STG ENDS
starts to operate.
When timer T001 turns ON two seconds
later, sounding of the buzzer stops, and
motor (00502) operation starts.
When the start switch (00000) turns
OFF, motor operation stops and all de-
vices are reset.
1-39
1-6 Extended Ladder
OF INSTRUCTIONS
BRIEF EXPLANATION
[Example]
T001
Extended Ladder
01003
01002 00501
01003
1-40
1-6 Extended Ladder
OF INSTRUCTIONS
BRIEF EXPLANATION
[Example] Output 00500 is turned ON only when inputs 00000, 00001 and 00002 are input in that
order.
00001 01002
DIFU 01002 turns ON at the up edge of input 00001.
00002 01003
DIFU 01003 turns ON at the up edge of input 00002.
01002 00000 01000
01000 turns ON if input 00000 is in an ON state.
01000
1
01003 01000 01001
Extended Ladder
01001 turns ON if input 10000 is in an ON state.
01001
01001 00500
Output 00500 turns ON when 01001 turns ON.
01000 01001
As shown above, extended ladder language can be written on a single rung. This
makes programs easier to view and understand than conventional ladder languages.
1-41
1-7 Indirect Specification
OF INSTRUCTIONS
BRIEF EXPLANATION
The following table shows the relationship between #TMnnn and the value currently stored to
TMnnn.
The range of temporary data memories that can be used is TM000 to TM511. Note, however, that
attention should be paid to prevent duplicate use of these temporary data memories as they are also
used for arithmetic operations.
Note: Data memories DM10000 to DM39999 and relays 08000 to 59915 cannot be indirectly
specified.
1-42
1-7 Indirect Specification
OF INSTRUCTIONS
BRIEF EXPLANATION
Instructions that allow indirect specification in operands
= < > <= >- <> LDA STA
MOV FMOV ADD SUB MUL DIV CMP ZCMP
ANDA ORA EORA DASC RDASC SMOV SADD SCMP
DISS UNIS LEN RCOM XCH
Indirect Specification
When the above ladder is executed, the value of DM00020 is stored to DM00000.
When the above ladder is executed, the values of 07000 to 07015 are stored to 01000
to 01015.
DM00001 Data 2
DM00002 Data 3
DM00003 Data 4
DM00003 Data 5
1-43
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
1 Basic Instructions
List of Instructions
Specification
Object size
Execution
Condition
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
Contact instructions
S Treats a device as an NO contact, and connects
LD it to the left bus line. 4 10 – 2-4
1-44
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Category
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Mnemonic Symbol Description of Instruction
Page
S Connects a device to the left bus line as a contact that inverts and
BLDB B relays the ON/OFF states of specified bits on the device. 6 12 – 2-14
n
List of Instructions
n
1-45
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
Output instructions
D Outputs the previous ON/OFF state.
OUT 4 12 – 2-24
KEEP
Sets and resets the target relay according to SET and RES
SET inputs.
KEEP D 4 8 – 2-28
RES
1-46
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
List of Instructions
n
Timer/counter instructions
S Operation unit 100 ms 32-bit subtraction type ON delay timer
TMR T n 4 6 – 2-48
1-47
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
Connection/end instructions
END Indicates the end of the regular program (main routine
END program). – 1 14 – 2-70
End
ENDH Indicates the end of the entire program.
ENDH – 1 0 – 2-70
1 a b c
Indicates a series connection following an output instruction.
CON – 1 0 – 2-72
List of Instructions
CON CON
MPS Stores the input state and arithmetic operation flag to memory. – 1 4 – 2-74
MPP Reads contents stored to memory by MPS, and clears memory. – 1 4 – 2-74
Connect Connects the contact block in series.
ANL – 1 4 – 2-76
A block B block
ANL
Connects the contact block in parallel.
A block
ORL – 1 4 – 2-76
B block
ORL
1-48
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Applied Instructions
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
Shift instruction
RES
D2 When reset input is ON, all relays from D1 to D2 turn OFF.
The state is not shifted to relays D2 +1 onwards.
1
List of Instructions
Memory switch instruction
MEMSW n Sets a memory switch.
Memory MEMSW S – 6 0 – 3-8
switch
Step instructions
STP Executes the entire program up to the STE instruction when
STP S the relay indicated by the operand is ON. 4 10 – 3-14
Step
STE This instruction is used in a pair with the STP instruction,
STE and indicates the end of the programto be executed by step – 1 0 – 3-14
operation.
Stage processing instructions
S Executes the instruction in the STG block.
STG STG 4 16 – 3-20
Stage
processing S Sets D with S ON when the execution condition is ON.
W-ON ON 7 10 – 3-24
D
1-49
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
Flow instructions
MC Sets the master control relay.
MC 1 2 – 3-30
Master
control MCR Ends the MC instruction.
MCR – 1 2 – 3-30
1-50
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Arithmetic Operation Instructions
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
* Note: Arithmetic operation instructions preceded with @ are differential execution type instructions.
S Executes the instruction only once at the up edge of the
@ *** execution condition.
D
List of Instructions
.S 8
DW DW – 4-4
.D D Writes 32-bit data.
[ S • S +1]→[ D • D +1] 10 12
.L
.U Writes 16-bit data to the 16-bit internal register. 4
S S → 16-bit internal register 8
.S 5
LDA LDA STA 4-6
.D Writes 32-bit data to the 32-bit internal register.
[ S • S +1]→ 32-bit internal register 7 8
.L
.U Writes the content of the 16-bit internal register. 4
D 16-bit internal register → D 8
.S 5
STA LDA STA 4-8
.D Writes the content of the 32-bit internal register. 5
32-bit internal register →[ D • D +1] 8
.L 5
n Writes digital trimmer values to the 32-bit internal register.
TMIN TWIN STA Digital trimmer → 32-bit internal register 3 6 – 4-12
S + D –2 Move D + n –2
S + D –1 Move D + n –1
1-51
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1
Upper Lower Upper Lower
32-bit
internal register + S +1 S = 32-bit
internal register
.L 32 bits 32 bits 32 bits 7 8
(2 words)
List of Instructions
×
32-bit 32-bit
internal register S +1 S = TM001 TM000 internal register
32 bits 32 bits 64 bits
.L (2 words) 7 8
1-52
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
.S
T000 Internal register = 16-bit internal register
32 bits 16 bits
2 4
ROOT LDA ROOT STA — 4-52
.D Calculates the square root of 32-bit data.
2 4
.L
Upper 32 bits Lower 32 bits
List of Instructions
Compares 16-bit data.
.U Comparison Result Arithmetic Flag State 4 8
Value in 16-bit internal register is smaller than CR2009→ ON
specified range. 16-bit internal register< S 2009
Value in 16-bit internal register is within CR2010→ ON
specified range.16-bit internal register= S 2010
.S Value in 16-bit internal register is greater than CR2011→ ON 5 8
specified range. 16-bit internal register> S 2011
S Flag
CMP LDA CMP 4-54
Compares 32-bit data.
.D Comparison Result Arithmetic Flag State 7 8
Value in 32-bit internal register is smaller than CR2009→ ON
specified range.32-bit internal register<[ S • S +1] 2009
Value in 32-bit internal register is within CR2010→ ON
specified range.32-bit internal register=[ S • S +1] 2010
.L Value in 32-bit internal register is greater than CR2011→ ON 7 8
specified range.32-bit internal register>[ S • S +1] 2011
1-53
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
.U 3 6
16-bit
internal register 0000011101000000 1100 1
Upper n bit Delete
"0" is stored. 1
n CR2009
(Carry)
SRA LDA SRA STA – 4-76
Shifts the data in the 32-bit internal register to the right by the
number of specified bits.
bit bit ( n –1) bit
31 32-bit internal register 0
1
"0" is stored.
CR2009
(Carry)
Shifts the data in the 16-bit internal register to the left by the
number of specified bits. bit (16— n )
bit bit
15 0
16-bit
internal register 1110100000011001
.U 3 6
16-bit
internal register 1110 100000011001 00000
Delete Upper n bit
1 "0" is stored.
n CR2009
(Carry)
SLA LDA SLA STA – 4-78
Shifts the data in the 32-bit internal register to the left by the
number of specified bits.
bit bit (32– )
n bit
31 32-bit internal register 0
1
"0" is stored.
CR2009
(Carry)
1-54
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1
(Carry)
0111100000000111
1
Rotated n times (Above processing is repeated n times.)
List of Instructions
bit bit
CR2009 15 0
16-bit
n 0 1111011110000000 internal register
RRA LDA RRA STA – 4-80
Rotates the data in the 32-bit internal register to the right by
the number of specified bits.
bit bit bit bit
CR2009 31 16 15 32-bit internal register 0
0 11110000000011110000000000001111
Flag state varies according
to result of previous arith- (Rotated once)
metic operation.
.D CR2009 4 6
1 01111000000001111000000000000111
(Carry)
Rotated n times (Above processing is repeated n times.)
bit bit
CR2009 31 32-bit internal register 0
0 11110111100000000111100000000000
(Carry)
11110000000011110000000000001111 0
Flag state varies according
(Rotated once) to result of previous arith-
metic operation.
.D CR2009 4 6
11100000000111100000000000011110 1
(Carry)
Rotated n times (Above processing is repeated n times.)
bit bit
31 32-bit internal register 0 CR2009
00000001111000000000000111101111 0
(Carry)
1-55
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
S 1000 0
S +1 2000 0
"0" is stored.
0
0
n1
items S + n2 1000
.U ( S +1) + n2 2000 10 12
1
8000
S + n1 –1 9000
n2
items 8000
List of Instructions
( S +1 ( n1 –1) + n2 9000
WSR
WSR S n1 n2 – 4-84
Shifts 32-bit data to the right.
Before execution After execution
S +1 100000 S 0
S +3 200000 S +2 0
"0" is stored.
0
0
n1
( S +1) +2 n1 100000 S +2 n2
items
.D ( S +3) +2 n2 200000 ( S +2) +2 n2 11 12
800000
S +2 ( n1 –1) +1 900000 S +2 ( n1 –1)
n2
items 800000
( S +2 ( n1 –1) +1) +2 n2 900000 ( S +2 ( n1 –1) +2 n2
S – n2 1000
( S +1) – n2 2000
n2
items
S 1000
.U S +1 2000 10 12
8000
( S + n1 –1) – n2 9000
n1
items 0
0
"0" is stored.
8000 0
S + n1 –1 9000 0
WSL
WSL S n1 n2 – 4-86
Shifts 32-bit data to the left.
Before execution After execution
( S +1) –2 n1 100000 S –2 n2
( S +3) –2 n2 200000 ( S +2) –2 n2
n2
items
S +1 100000 S
.D S +3 200000 S +2 11 12
800000
( S +2 ( n1 –1) +1) –2 n2 900000 ( S +2 ( n1 –1) –2 n2
n1 0
items
0
"0" is stored.
800000 0
S +2 ( n1 –1) +1 900000 S +2 ( n1 –1) 0
1-56
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
List of Instructions
Decodes on digit in 16-bit internal register to 16 bits.
n (#1)th digit
#3 #2 #1 #0
16-bit
internal register 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1
n
MPX LDA MPX STA 3 6 – 4-94
7 n
Bit 7 of 16-bit internal
F E D C B A 9 8 7 6 5 4 3 2 1 0 register is turned ON ("1" is
16-bit
internal register 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 stored) as (#1)th digit is
"0111" (decimal 7).
1-57
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1
"0" is stored to the upper bytes (8 bytes).
Swaps the upper and lower data of the 16-bit internal register.
bit bit bit bit
15 8 7 0
Before
execution 1 2 3 4 ←16-bit internal register: $1234
.U 1 4
After
execution 3 4 1 2 ←16-bit internal register: $3412
SWAP LDA SWAP STA – 4-108
Swaps the upper and lower data of the 32-bit internal register.
↓32-bit internal register: $12345678
bit bit bit bit bit bit bit bit
31 2423 16 15 8 7 0
Before
1 2 3 4 5 6 7 8
.D execution 2 4
After
execution 5 6 7 8 1 2 3 4
↑32-bit internal register: $56781234
Exchanges 16-bit data.
Before execution After execution
bit bit bit bit
15 S1 0 15 S1 0
.U 1 2 3 4 A B C D 7 14
bit bit bit bit
15 S2 0 15 S2 0
XCH A B C D 1 2 3 4
XCH S D 4-110
Exchanges 32-bit data.
Before execution After execution
bit bit bit bit
31 S1 +1 S1 0 31 S1 +1 S1 0
.D 0 1 2 3 4 5 6 7 8 9 A B C D E F 8 14
bit bit bit bit
31 S2 +1 S2 0 31 S2 +1 S2 0
8 9 A B C D E F 0 1 2 3 4 5 6 7
1-58
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
List of Instructions
31 32-bit internal register 0 31 32-bit internal register 0
Move destination
DM00201: +1.234 :DM00200
FMOV.F
FMOV.F S D n S +1 S DM00203: +1.234 :DM00202 10 14 4-128
DM00101: +1.234 :DM00100 DM00205: +1.234 :DM00204
DM00207: +1.234 :DM00206
DM00209: +1.234 :DM00208
Floating 32 bits
Exponent section:
[Example of separation] D2
point
conversion –1.234 x 10–3 Signed 16-bit
binary data
32 bits
Mantissa Exponent (1 word)
1-59
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
conversion
Signed 32-bit
binary data
[Coupling –1.234 x 10–3
example]
16 bits
Mantissa Exponent
(1 word)
List of Instructions
Comparison
Compares ranges of floating point type real number values.
Comparison Result (when S1 • S1 +1]<[ S2 • S2 +1]) Arithmetic Flag State
S1 Flag Value in 32-bit internal register is smaller thanspecified range.
CR2009→ ON
Internal register<[ S1 • S1 +1]<[ S2 • S2 +1]
ZCMP.F LDA.F ZCMP.F 12 14 4-146
Value in internal register is within specified range.
S2 S1 • S1 +1]≤ Internal register <[ S2 • S2 +1]
CR2010→ ON
1-60
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
Quotient/
e ( Floating point type real number
32 bits
) Floating point type real number
32 bits
List of Instructions
Converts the angle in degrees (°) of the floating point type
real number current stored to 32-bit internal register to radians.
RAD LDA.F RAD STA.F 1 4 – 4-152
32-bit internal register 32-bit internal register
Angle
( Floating point type real number )° ( Floating point type real number ) RAD
32 bits 32 bits
Radian Converts the angle in radians of the floating point type real
number current stored to 32-bit internalregister to degrees (°).
conversion
DEG LDA.F DEG STA.F 32-bit internal registerv 32-bit internal register 1 4 – 4-154
( Floating point type real number ) rad. ( Floating point type real number )°
32 bits 32 bits
TAN ( Floating point type real number ) Floating point type real number
32 bits 32 bits
1-61
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1 After
2
3
2
2
2
1
2
0
2
3
2
2
execution
List of Instructions
4 1 3 5
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
ASCII
string Converts 16-bit signed binary data to a decimal ASCII text
conversion string. bit
15
bit
0
bit
15 S
bit
0
D Sign 10,000's
.S 16-bit signed binary data D +1: 1,000's 100's
8 14
16 bits
D +2: 10's 1's No change before
00H is automatically and after instruction
N
stored at the end. D +3: U (00H)
L
execution
* To specify relays at the same time, specify the start (1000, 1100 and so forth) of the channel.
1-62
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
List of Instructions
bit bit bit bit
15 S 0 15 D 0
Decimal
RDASC Converts a decimal ASCII text string to 32-bit unsigned binary
RDASC S D data. bit bit bit bit bit bit
* 4-178
S
15 D +1 0 31 16 15 D 0
ASCII S 1,000,000,000's 100,000,000's 32-bit unsigned binary data
string 32 bits
S +1: 10,000,000's 1,000,000's
conversion .D 8 14
S +2: 100,000's 10,000's
S : A(41H) B(42H)
SMOV S +1: C(43H) D(44H)
Move SMOV S D N 7 14 * 4-182
S +2: E(45H) U
L (00H) D : A(41H) B(42H)
G(47H) H(48H) D +1: C(43H) D(44H)
N
I(49H) J(4AH) D +2: E(45H) U (00H)
L
16 bits 16 bits
S1 A(41H) B(42H)
N
S1 +1 C(43H) U (00H)
L D A(41H) B(42H)
SADD D +1 C(43H) D(44H)
Unite SADD S1 S1 D 10 20 * 4-184
D +2 E(45H) F(46H)
S2 D(44H) E(45H) G(47H)
N
U (00H)
D +3 L
S2 +1 F(46H) G(47H)
N
S2 +2 U (00H)
L
* To specify relays at the same time, specify the start (1000, 1100 and so forth) of the channel.
1-63
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1 SCMP
S1 +5
S1 +6
K(4BH)
M(4DH) N
U
L
L(4CH)
(00H)
S2 +5
S2 +6
K(4BH)
N(4EH) N
L(4CH)
U
L (00H)
Compare is continued until
end code (NUL (00H)) is
found.
Compare SCMP S1 S2 7 14 * 4-186
List of Instructions
When the text string resulting from comparison up to NUL (00H) is the
same, the arithmetic operation flag CR2010 turns ON.
Comparison Result Arithmetic Flag State
When (all characters in S1 )=(all characters in S2 ) CR2010→ ON
When the number of characters n is different, the arithmetic operation
flag changes as follows.
Comparison Result Arithmetic Flag State
When (ASCII code of nth characters in S1 )<(ASCII code of nth characters in S2 ) CR2009→ON
When (ASCII code of nth characters in S1 )>(ASCII code of nth characters in S2 ) CR2011→ON
* To specify relays at the same time, specify the start (1000, 1100 and so forth) of the channel.
1-64
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Extended Instructions
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
List of Instructions
.D register. 2 4
( n words) Compare
S + n –3 1234
Compare 16-bit internal register
S + n –2 3456 bit15 bit0
CR2010 Compare Result
S + n –1 5678 S +2
S
Search SER LDA SER STA – 5-10
n Searches the number of same data as 32-bit internal register
from a specified range.
bit bit bit bit bit 32-bit bit
31 16 15 0 31 internal register 0
Compare
S +1 12345678 S 23456789
Compare
S +3 23456789 S +2 The No. of the devices to which
Compare the same value as that of the 32-
.D S +5 34567890 S +4 8 12
bit internal register is stored is
n items searched. The result is stored to
Compare the 32-bit internal register.
(2 n words) S +2( n –3)+1 45678901 S +2( n –3)
Compare
S +2( n –2 )+1 23456789 S +2( n –2)
Compare bit 32-bit bit
S +2( n –1)+1 56789012 S +2( n –1) 31 internal register 0
Result
S +2
1-65
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1
S + n —1 7654
8 10
.S
S
MAX MAX STA – 5-12
n Searches for the maximum value in a specified range.
bit bit bit bit
31 16 15 0
S +1 12345678 S
S +3
32-bit internal register
23456789 S +2 Largest value bit bit
.D S +5 34567890 S +4 is stored. 31 0 8 10
n items 98765432
S +2( n –3)+1 98765432 S +2( n –3)
(2 n words)
S +2( n –2)+1 87654321 S +2( n –2)
S +2( n –1)+1 76543210 S +2( n –1)
.L 8 10
Search
Searches for the minimum value in a specified range.
bit bit
15 0
S 1234
S +1 2345 16-bit internal register
.U S +2 3456 bit15 bit0 7 10
n items
Smallest value 1234
7654
is stored.
S + n –3
( n words)
S + n –2 8765
S + n –1 9876
.S 8 10
S
MIN MIN STA – 5-16
n Searches for the minimum value in a specified range.
bit bit bit bit
31 16 15 0
S +1 12345678 S
32-bit internal register
S +3 23456789 S +2 Smallest value bit bit
.D S +5 34567890 S +4 is stored. 31 0 8 10
n items 12345678
+2( n –3)+1 76543210 S +2( n –3)
(2 n words) S
S +2( n –2)+1 87654321 S +2( n –2)
S +2( n –1)+1 98765432 S +2( n –1)
.L 8 10
1-66
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1
S + n –1 65535 Average value
List of Instructions
.S 8 10
S
Average
AVG AVG STA – 5-20
value n Calculates the average value of a specified range.
bit bit bit bit
31 16 15 0
S +1 12345678 S
S +3 23456789 S +2
.D 34567890
Average value is stored to 8 10
S +5 S +4
n items 32-bit internal register.
S +2( n –3)+1 78901234 S +2( n –3)
(2 n words) bit 32-bit bit
S +2( n –2)+1 89012345 S +2( n –2) 31 internal register 0
Average
S +2( n –1)+1 90123456 S +2( n –1) Average value
.L 8 10
.S EXT(.U/.S) 16-bit 2
TM000 internal register 4
Extension EXT LDA EXT STA.D – 5-32
Extends values in 32-bit internal register to 64-bit data.
.D 2 4
Upper Lower
32-bit 32-bit
internal register TM001 TM000 internal register
EXT(.D/.L)
.L 2 4
1-67
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
1 S +4 :
S +5 :
Minute
Second
0 to 59
RSEC
Converts second format data to date/time format data.
RSEC S D 7 12 – 5-42
Alarm instruction
Resets the alarm relay and alarm history.
Alarm ARES ARES 1 4 – 5-48
1-68
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
Object size
Specification
Condition
Execution
Byte Size
Indirect
See
Category Mnemonic Symbol Description of Instruction
Page
Positioning instructions
S Starts trapezoidal control of the X-axis.
PLSX PLSX 3 6 – 5-90
Trapezoidal
control Starts trapezoidal control of the Y-axis.
S
PLSY PLSY 3 6 – 5-90
JOGX
CW
Performs jog operation of the X-axis. 1
JOGX CCW 1 4 – 5-92
List of Instructions
High
Jog
operation JOGY Performs jog operation of the Y-axis.
CW
JOGY CCW 1 4 – 5-92
High
1-69
1-8 List of Instructions
OF INSTRUCTIONS
BRIEF EXPLANATION
1
List of Instructions
1-70
2-1 Contact Instructions
BASIC INSTRUCTIONS
2
Contact Instructions
BASIC INSTRUCTIONS
This chapter explains the most basic instructions in writing a se-
quence program.
These instructions enable mechanical control on a level with general
relay sequence circuits.
You can make a complete program merely by using these instruc-
tions.
2-1
2-1 Contact Instructions
* The LD and LDB instructions relate the ON/OFF state of specified devices to instructions from LD
and LDB onwards at each scan. These instructions are used for connecting contacts to the bus
lines (programmed at position (1)).
(1) (2)
00001 00002 00500 (1) LD 00001
(2) AND 00002
OUT 00500
00003 00004 00501
LDB 00003
(3) AND 00004
00005 (3) OR 00005
OUT 00501
2-2
2-1 Contact Instructions
BASIC INSTRUCTIONS
2
Contact Instructions
2-3
Treats a device as a NO contact, and connects it to the left
LD
2-1 Contact Instructions Load
bus line.
LDB Load bar Treats a device as a NC contact, and connects it to the left
bus line.
BASIC INSTRUCTIONS
2 L
L
D I
D N O T
S
S
A N I S
Contact Instructions
A N D N O T S
S — — — — — — — — — — — — —
Explanation of Operation
LD Connects the device specified by S to the bus line as a NO contact.
The ON/OFF state of the device specified by S is related to instructions from LD
onwards.
LDB Connects the device specified by S to the bus line as an NC contact.
The inverted ON/OFF state of the device specified by S is related to instructions
from LDB onwards.
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
2-4
2-1 Contact Instructions
Sample Program
BASIC INSTRUCTIONS
LD
When input relay 00000 is ON, output relay 00500 turns ON. When input relay 00000 is OFF, output
relay 00500 turns OFF.
00000 00500
LDB
When input relay 00000 is ON, output relay 00500 turns OFF. When input relay 00000 is OFF, output 2
relay 00500 turns ON.
Contact Instructions
00000 00500
LD
LDB
AND
ANB
OR
ORB
LDP
LDF
ANP
ANF
ORP
ORF
2-5
2-1 Contact Instructions Treats a device as a NO contact, and connects it serially to
AND AND
a circuit.
2 L
L
D I
D N O T
S
S
A N I S
Contact Instructions
A N D N O T S
S — — — — — — — — — — — — —
Explanation of Operation
AND Connects the device specified by S serially to the circuit as a NO contact.
AND Connects the device specified by S serially to the circuit as an NC contact.
In this case, when input 00000 is ON, and (AND)00001 are ON, output 00500 turns ON.
• The number of contacts that can be serially connected in the program is not limited.
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
2-6
2-1 Contact Instructions
Sample Program
BASIC INSTRUCTIONS
AND
When input relays 00000 and 00001 both are ON, output relay 00500 turns ON. When either (or both)
of input relays 00000 or 00001 is OFF, output relay 00500 turns OFF.
ANB
When input relay 00000 is ON, and input relay 00001 is OFF, output relay 00500 turns ON.
Otherwise, output relay 00500 turns OFF.
2
Contact Instructions
00000 00001 00500
LD
LDB
AND
ANB
OR
ORB
LDP
LDF
ANP
ANF
ORP
ORF
2-7
2-1 Contact Instructions Treats a device as a NO contact, and connects it in parallel
OR OR
to a circuit.
S O R S
S O R B S
O R I S
2 O R N O T S
Constant Indirect
Internal CR CR CR CR
Devices I O auxiliary T C CTC CR DM TM T C CTH CTC CM #/$ #TM 2009 2010 2011 2012
S — — — — — — — — — — — — —
Explanation of Operation
OR Connects the device specified by S in parallel to the circuit as a NO contact.
ORB Connects the device specified by S in parallel to the circuit as an NC contact.
The number of contacts that can be connected in parallel in the program is not limited.
Note: Parallel connections that include a non-contact instruction are not allowed.
Non-contact instructions
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
2-8
2-1 Contact Instructions
Sample Program
BASIC INSTRUCTIONS
OR
When either (or both) of input relays 00000 and 00001 is ON, output relay 00500 turns ON. When
both input relays 00000 or 00001 are OFF, output relay 00500 turns OFF.
00000 00500
00001
2
ORB
Contact Instructions
When input relay 00000 is ON, or input relay 00001 is OFF, output relay 00500 turns ON. When input
relay 00000 is OFF and 00001 is ON, output relay 00500 turns OFF.
00000 00500
00001
LD
LDB
AND
ANB
OR
ORB
LDP
LDF
ANP
ANF
ORP
ORF
2-9
2-1 Contact Instructions
LDP Load pulse
Connects a device that turns ON for one scan at its up
ANP AND pulse
edge.
ORP OR pulse
BASIC INSTRUCTIONS
2
S
Contact Instructions
A N S S
Program P or F at .
S1
At , ↑ is entered in the case of P and O R S
↓ is entered in the case of F.
S — — — — — — — — — — — — —
Explanation of Operation
LDP ANP ORP
This device turns ON only for one scan when the up edge of the bit device speci-
fied by S is detected.
Instruction Operation
LDP Connects the device to the left bus line as a NO contact. This contact turns ON only
for one scan when the up edge of the bit device specified by S is detected.
ANP Connects the device serially as a NO contact. This contact turns ON only for one scan
when the up edge of the bit device specified by S is detected.
ORP Connects the device in parallel to a circuit as a NO contact. This contact turns ON only
for one scan when the up edge of the bit device specified by S is detected.
Instruction Operation
LDF Connects the device to the left bus line as a NO contact. This contact turns ON only
for one scan when the down edge of the bit device specified by S is detected.
ANF Connects the device serially as a NO contact. This contact turns ON only for one scan
when the down edge of the bit device specified by S is detected.
ORF Connects the device in parallel to a circuit as a NO contact. This contact turns ON only
for one scan when the down edge of the bit device specified by S is detected.
2-10
2-1 Contact Instructions
BASIC INSTRUCTIONS
instructions, and between the STG to JMP/ENDS instructions and in a sub-routine
program.
"Precautions when using differential execution type instructions" page 1-6
• Parallel connections that include a non-contact instruction are not allowed.
Non-contact instructions
2
Contact Instructions
Operation flag
The operation flag does not change state.
Execution Timing
LDP, ANP, ORP This instruction is executed for one scan at the up edge of S .
LDP, ANP, ORP This instruction is executed for one scan at the down edge of S .
LD
LDB
Scan
AND
ON
ANB
S
OFF OR
ORP
ORF
Sample Program
When the up edge of input relay 00000 is detected, #00100 is moved to data memory DM00000.
When the down edge is detected, #00200 is moved to data memory DM00001.
00000 MOV
#00100 DM00000
00000 MOV
#00200 DM00001
2-11
2-2 Bit Contact Instructions
Bit contact instructions are for connecting bit contacts to a circuit. Bits of word devices are specified,
and handled as contacts.
The ON/OFF states of contacts are output to devices using output instructions, and are used as
execution conditions for basic instructions, applied instructions, arithmetic calculation instructions,
and extended instructions.
Bit load BLD Connects a device to the left bus line as a contact that 2-14
relays the ON/OFF states of specified bits on the device.
Bit load bar BLDB Connects a device to the left bus line as a contact that
inverts and relays the ON/OFF states of specified bits on
the device.
Bit AND BAND Connects a device serially to a circuit as a contact that
relays the ON/OFF states of specified bits on the device.
Bit AND bar BANB Connects a device serially to a circuit as a contact that
inverts and relays the ON/OFF states of specified bits on
the device.
Bit OR BOR Connects a device in parallel to a circuit as a contact that
relays the ON/OFF states of specified bits on the device.
Bit OR bar BORB Connects a device in parallel to a circuit as a contact that
inverts and relays the ON/OFF states of specified bits on
the device.
bit bit
15 0
1-word device
With bit contact instructions, the bits of word devices are specified and handled as contacts.
[Example] To turn output relay 00500 ON/OFF by the state of bit 6 of DM00000.
DM00000 00500
B
#06
DM00000
2-12
2-2 Bit Contact Instructions
BASIC INSTRUCTIONS
2
2-13
2-2 Bit Contact Instructions
BLD B Bit load
The device functions as a contact for relating the ON/OFF
BAND B Bit AND
state of specified bits of a word device.
BOR B
Bit OR
BASIC INSTRUCTIONS
2 n B
(
B L D B S
)
n
B B S n
Bit Contact Instructions
S
B B A N D S n
( B A S n )
n
B B A N D B S n
( B B S n )
B B O R S n
S
At , B is entered in the case of B and B B O R B S n
n B is entered in the case of B B.
S — — — — — — — — — — — — — — — — —
n — — — — — — — — — — — — — — —
Explanation of Operation
BLD BAND BOR
The instruction itself becomes a NO contact. This contact relates the ON/OFF state of
the n th bit of the word device specified by S to subsequent instructions.
BLDB BANDB BORB
The instruction itself becomes an NC contact. This contact inverts and relates the ON/
OFF state of the n th bit of the word device specified by S to subsequent
instructions.
bit S bit
15 0
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
ON
n th bit of S
OFF
ON
BLD instruction
OFF
ON
BLDB instruction
OFF
2-14
2-2 Bit Contact Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
The instruction is executed at every scan.
Sample Program
When the 0th bit of data memory DM00000 and the 1st bit of data memory DM00001 both are ON,
output relay 00500 turns ON. When either of the 0th bit of DM00000 or the 1st bit of DM00001 is OFF,
output relay 00500 turns OFF.
2
When either of the 3rd bit of data memory DM00000 and the 5th bit of data memory DM00001 is ON,
output relay 00500 turns ON. When the 3rd bit of DM00000 and the 5th bit of DM00001 both are OFF,
output relay 00500 turns OFF.
DM00000 00500
B
#03
BLD
DM00001
BLDB
B
#05 BAND
BANB
BOR
BORB
2-15
2-3 Comparison Contact Instructions
Comparison contact instructions compare the size of two items of data. The result of comparison
operation causes that instruction itself to turn ON/OFF as a contact.
The ON/OFF states of contacts are output to devices using output instructions, and are used as
execution conditions for basic instructions, applied instructions, arithmetic calculation instructions,
and extended instructions.
2-16
2-3 Comparison Contact Instructions
BASIC INSTRUCTIONS
signed AND=.S Turns OFF when condition S1 ≠ S2 is established.
binary
OR=.S
comparison
<.S LD<.S Turns ON when condition S1 < S2 is established.
AND<.S Turns OFF when condition S1 ≥ S2 is established.
OR<.S
>.S LD>.S Turns ON when condition S1 > S2 is established.
AND>.S Turns OFF when condition S1 ≤ S2 is established.
OR>.S
<=.S LD<=.S Turns ON when condition S1 ≤ S2 is established.
AND<=.S Turns OFF when condition S1 > S2 is established. 2
OR<=.S
2-17
2-3 Comparison Contact Instructions
When the suffix is ".U" (.U: Binary data is handled as 16-bit unsigned data.)
DM00000
(.U) LD(.U) DM00000 #00100
#00100
When the suffix is ".S" (.S: Binary data is handled as 1-bit signed data.)
DM00000
S LD.S DM00000 #00100
#00100
2-18
2-3 Comparison Contact Instructions
BASIC INSTRUCTIONS
2
2-19
2-3 Comparison Contact Instructions
= <= (U)
Contact type The result of having performed comparison calcu-
.D
< >= .S
comparison
calculation
lation on the binary data causes the instruction itself
to turn ON/OFF as a contact.
.L
BASIC INSTRUCTIONS
> <>
Ladder program Input method
S1 L D S1 S2
*
* ( * S1 S2 )
S2
S1
A N D * S1 S2
*
( S1 S2 )
S2 *
2
At * , program = < > <> <= or >=.
Comparison Contact Instructions
S1
* O R * S1 S2
S2
S1 — — — — — — — — — — — — — — —
S2 — — — — — — — — — — —
S1 , S2 : Specifies the data to be compared or the device to which that data is stored.
Operation flag
CR2009 ..... No change in state
CR2010 ..... No change in state
CR2011 ..... No change in state
CR2012 ..... ON when indirect specification range is inappropriate. Otherwise, OFF
2-20
2-3 Comparison Contact Instructions
BASIC INSTRUCTIONS
=.D <.D >.D <=.D >=.D <>.D
Unsigned 32-bit binary data specified by S1 and S2 is compared for the
arithmetic calculation. The result of the comparison calculation causes the instruction
itself to turn ON/OFF as a contact.
=.L <.L >.L <=.L >=.L <>.L
Signed 32-bit binary data specified by S1 and S2 is compared for the arithmetic
calculation. The result of the comparison calculation causes the instruction itself to turn
ON/OFF as a contact.
<
>
>=
See "Operation flag" on previous page.
<>
Execution Timing
All contact type comparison calculation instructions are executed at every scan.
Sample Program
Constant #00100 is compared with the current value of counter C000, and output relays 00500 and
00501 are turned ON/OFF by the comparison result.
2-21
2-4 Output Instructions
Output instructions are for turning specified bit devices ON/OFF according to the ON/OFF state
before that instruction.
Set SET Turns the device ON and holds it in this state. 2-26
Keep KEEP Sets and resets the target relay according to SET and 2-28
RES inputs.
Diff up DIFU Scans the target relay once (up differential) at the up 2-30
edge of the previous state.
Diff down DIFD Scans the target relay once (down differential) at the
down edge of the previous state.
ON delay ONDL The target relay performs ON delay operation. 2-32
OFF delay OFDL The target relay performs OFF delay operation.
One shot SHOT The target relay performs one-shot operation. 2-34
Flicker FLIK The target relay performs operation of the flicker 2-36
circuit.
Alternate ALT The target relay performs operation of the alternate 2-38
circuit.
2-22
2-4 Output Instructions
BASIC INSTRUCTIONS
2
Output Instructions
2-23
2-4 Output Instructions
OUT Out
Outputs to a device.
OUB Out bar
BASIC INSTRUCTIONS
D — — — — — — — — — — — — — — — — —
Output Instructions
Explanation of Operation
OUT Outputs the ON/OFF state before that instruction to the device specified by D .
OUB Outputs the inverted ON/OFF state before that instruction to the device specified by
D .
The OUT and OUB instructions are coil drive instructions for output relays and internal auxiliary
relays, and are not used for input relays, timers, and counters.
Operation flag
The operation flag does not change state.
2-24
2-4 Output Instructions
Execution Timing
BASIC INSTRUCTIONS
OUT Outputs the ON/OFF state before the OUT instruction at every scan.
OUB Outputs the ON/OFF state before the OUB instruction at every scan.
Scan
ON
Execution condition
OFF
ON
Output Instructions
instruction
Sample Program
When input relay 00000 is ON, output relay 00500 turns ON. When input relay 00000 is OFF, output
relay 00500 turns OFF.
When input relay 00001 is OFF, output relay 00501 turns ON. When input relay 00001 is ON, output
relay 00501 turns OFF.
00000 00500
OUT
OUB
00001 00501 SET
RES
KEEP
DIFU
DIFD
ONDL
OFDL
SHOT
FLIK
ALT
2-25
2-4 Output Instructions
SET SET Set Turns the device ON and holds it in this state.
SET D — — — — — — — — — — — — — — —
Output Instructions
RES D — — — — — — — — —
Explanation of Operation
SET When the execution condition is ON, the device specified by D turns ON. Once this
device is turned ON, the device is held in an ON state even if the execution condition
turns OFF. (Turn ON devices OFF by the RES instruction.) When the execution
condition is OFF, no processing is executed.
* The current value of timers (TMR, TMH, TMS) and up-down counters (UDC) become
"0".
The current value of counters (C) and up-down timers (UDT) becomes the same
value as the setting value.
00001 00501 ON
SET 00001
OFF
ON
00002 00501 00002
RES OFF
ON
00501
OFF
RES When the execution condition turns ON, the device specified by D turns OFF.
* The current value of timers (TMR, TMH, TMS) becomes the same value as the
setting value.
The current value of counters (C), up-down counters (UDC), up-down timers (UDT),
and high-speed counters (CTH) becomes "0".
Note: The SET or RES instruction programmed later in the program is given priority which of the
instructions is programmed first.
■ About differences between the SET and RES instructions and the KEEP instructions
Basically, the SET and RES instructions and the KEEP instruction execute the same operation.
• As the SET and RES instructions can be used independently, the order of these two
instructions can swapped in the program. There is also the advantage that a program can be
inserted between the SET and RES instructions.
• Fewer program steps are used with the KEEP instruction, so the number of programmed steps
can be reduced when the KEEP instruction is used many times in a program.
"KEEP instruction" page 2-28
2-26
2-4 Output Instructions
• In the following example, when inputs 00000 and 00001 both are ON, output 00500 turns OFF
in the case of the KEEP instruction. With the SET and RES instructions, the SET instruction
BASIC INSTRUCTIONS
programmed later is enabled, and output 00500 turns ON.
00000 00500
RES
00001 00500
SET
00000 KEEP
SET
00500
2
00001
Output Instructions
RES
Operation flag
The operation flag does not change state.
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
Scan
ON OUT
Execution condition OUB
OFF
SET
SET/RES instruction Execution Execution
RES
KEEP
Sample Program DIFU
ONDL
Output relay 00500 turns ON when one of the following conditions is satisfied:
OFDL
• Input relay 00000 turns ON. SHOT
ALT
• Input relay 00003 turns ON.
Also, output relay 00501 turns OFF when one of the following conditions is satisfied:
• Input relay 00004 turns ON.
• Input relay 00005 turns ON.
• Input relay 00006 turns ON.
00000 00500
SET
00001 00002
00003
00004 00501
RES
00005
00006
2-27
2-4 Output Instructions
KEEP Turns ON the relay specified by SET condition ON
SET
KEEP RES
Keep and is held in this state. Turns OFF the relay specified
by RES condition ON.
BASIC INSTRUCTIONS
D — — — — — — — — — — — — — — — — —
Output Instructions
Explanation of Operation
D is turned ON when the SET condition is ON and the RES condition is OFF.
D is turned OFF when the SET condition is OFF and the RES condition is ON.
D is turned OFF when the SET and RES conditions both are ON. (The RES condition is given
priority.)
The state of D is held when the SET and RES conditions both are OFF.
Note: In the following program example, a double coil is formed, so the OUT 00500 pro-
grammed later is given priority.
00000 KEEP
SET
00500
00001
RES
00002 00500
Operation flag
The operation flag does not change state.
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
Scan
ON
Execution condition
OFF
2-28
2-4 Output Instructions
Sample Program
BASIC INSTRUCTIONS
When input relay 00000 is ON and input relay 00001 is OFF, output relay 00500 is turned ON and
is held in this state.
When input relay 00001 is ON, output relay 00500 is turned OFF. When input relays 00000 and
00001 are OFF, the state of output relay 00500 is held.
00000 KEEP
SET
00500
00001
RES
2
Output Instructions
Internal auxiliary relay hold function
The power interruption hold (latch) for the internal auxiliary relays can be set by the memory switch
instruction (MEMSW).
"MEMSW instruction" page 3-6
A relay that has been set once can be held at power OFF also by combining this internal auxiliary
relay with the KEEP instruction (e.g. SET instruction or RES instruction).
MEMSW1
$0001
OUT
00001 KEEP
OUB
SET
SET
01000
RES
00002
RES KEEP
DIFU
ONDL
OFDL
SHOT
FLIK
ALT
2-29
2-4 Output Instructions Turns a device ON for one scan only at the up edge of
DIFU DIFU Diff up the execution condition.
Turns a device ON for one scan only at the down edge
DIFD DIFD Diff down
of the execution condition.
BASIC INSTRUCTIONS
Execution condition D D I F U D
DIFU P L S D
U D
Execution condition D D I F D D
DIFD P L F D
D D
2 Available
Devices I O
Bit Devices
Internal
T C CTC CR DM TM T
Word Devices Constant Indirect
D — — — — — — — — — — — — — — — — — — —
Explanation of Operation
DIFU The device specified by D is turned ON for one scan only at the up edge of the
execution condition.
Duplicate use of the operand with other DIFU instructions is not allowed.
DIFD The device specified by D is turned ON for one scan only at the down edge of the
execution condition.
Duplicate use of the operand with other DIFD instructions is not allowed.
[Tip]
• This instruction cannot be used in interrupt programs.
• Care is required when programming this instruction between the STP and STE instructions,
and between the STG and JMP/ENDS instructions and in a sub-routine program.
"Precautions when using differential execution type instructions" page 1-6
2-30
2-4 Output Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
DIFU The specified operand is turned ON for one scan only at the up edge of the execution
condition.
DIFD The specified operand is turned ON for one scan only at the down edge of the execution
condition.
Scan
ON
2
Output Instructions
Execution condition
OFF
Sample Program
Example of edge synchronization
OUT
When input relay 00001 is OFF at the up edge of input relay (timing input) 00000, output relay 00500
OUB
is turned ON, and is held at this state until input relay 00002 turns ON.
SET
RES
DIFD
01000 00001 01001 ONDL
OFDL
SHOT
01001 00002 00500
FLIK
ALT
00500
2-31
2-4 Output Instructions
ONDL ONDL ON delay The specified relay operates as an ON delay timer.
OFDL OFDL OFF delay The specified relay operates as an OFF delay timer.
BASIC INSTRUCTIONS
n — — — — — — — — — — — — — — — — — —
Output Instructions
D — — — — — — — — — — — — —
n : Specifies the ON delay/OFF delay setting value (0 to 65535) or the device to which the
setting value is stored. Specify the delay in 10 ms units. The delay cannot be specified in
Hex ($).
D : Specifies the device on which ON delay and OFF delay operation is to be performed.
Explanation of Operation
ONDL The device specified by D is operated as an ON delay timer.
(1) D is turned ON after n x 10 ms when the execution condition is ON.
(2) When the execution condition turns OFF, the device specified by D simulta-
neously turns OFF.
(3) If the execution condition turns OFF before n x 10 ms, D does not turn ON.
ON
Execution condition
OFF
ON
D
OFF
n X10 ms n X 10 ms
ON
Execution condition
OFF
ON
D
OFF
n X10 ms n X10 ms
The error of the ONDL and OFDL timers is "within ±(10 ms +1 scan time)."
2-32
2-4 Output Instructions
Note: • The ON delay operates for one scan only even if the setting value of the ONDL instruction
is set to "0".
BASIC INSTRUCTIONS
• The OFF delay operates for one scan only even if the setting value of the OFDL
instruction is set to "0".
• Care must be paid to operation when writing in the RUN mode. For details, see CPU
User's Manual, "Cautions during Writing in the RUN Mode."
[Tip]
• This instruction cannot be used in interrupt programs.
• Care is required when programming this instruction between the STP and STE instructions,
and between the STG and JMP/ENDS instructions and in a sub-routine program.
2
Output Instructions
"Precautions when using timer instructions" page 1-13
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
OUT
Sample Program OUB
SET
(1) When input relay 00000 turns ON for three seconds or more, output relay 00500 turns ON. When
RES
input relay 00000 turns OFF, output relay 00500 also turns OFF.
KEEP
(2) When input relay 00001 turns ON, output relay 00501 turns ON. Output relay 00501 turns OFF
DIFU
when the value set at data memory DM00000 has elapsed after input relay 00001 turns OFF.
DIFD
ONDL
00000 #00300
OFDL
ONDL (1)
00500 SHOT
2-33
2-4 Output Instructions
SHOT SHOT One shot The specified relay operates as a one-shot timer.
Execution condition n
S H O T n D
SHOT
D
n — — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
n : Specifies the setting value (0 to 65535) of the one-shot timer or the device to which the
2 setting value is stored. Specify the delay in 10 ms units. The delay cannot be specified in
Hex ($).
Output Instructions
Explanation of Operation
SHOT The device specified by D turns ON at the up edge of the execution condition, and
turns OFF n x 10 ms later.
Execution condition up edges are ignored for the duration that the device specified by
D is ON.
ON
Execution condition
OFF
ON
D
OFF
n X 10 ms n X 10 ms n X 10 ms
Note: • The one-shot timer operates for one scan only even if the setting value of the SHOT
instruction is set to "0".
• Care must be paid to operation when writing in the RUN mode. For details, see CPU
User's Manual, "Cautions during Writing in the RUN Mode."
[Tip]
• This instruction cannot be used in interrupt programs.
• Care is required when programming this instruction between the STP and STE instructions,
and between the STG and JMP/ENDS instructions and in a sub-routine program.
"Precautions when using timer instructions" page 1-13
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
2-34
2-4 Output Instructions
Sample Program
BASIC INSTRUCTIONS
(1) Output relay 00500 turns ON for 0.2 seconds at the up edge of input relay 00000. Output relay
00500 stays ON for 0.2 seconds after the up edge of input relay 00000 even if input relay 00000
turns OFF.
(2) When input relay 00001 turns ON, output relay 00501 turns ON. Output relay 00501 turns OFF
when the value set at data memory DM00000 has elapsed after input relay 00001 turns OFF.
00000 #00020
SHOT (1)
00500
00001 DM00000
SHOT
00501
(2) 2
Output Instructions
OUT
OUB
SET
RES
KEEP
DIFU
DIFD
ONDL
OFDL
SHOT
FLIK
ALT
2-35
FLIK
2-4 Output Instructions
FLIK Flicker The specified relay is used as the flicker circuit.
n1 — — — — — — — — — — — — — — — — — —
n2 — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
2 n1 : Specifies the setting value (0 to 65535) at which D turns ON or the device to which the
setting value is stored. Specify the delay in 10 ms units. The delay cannot be specified in
Output Instructions
Hex ($).
n2 : Specifies the setting value (0 to 65535) at which D turns OFF or the device to which the
setting value is stored. Specify the delay in 10 ms units. The delay cannot be specified in
Hex ($).
D : Specifies the device on which flicker circuit operation is to be performed.
Explanation of Operation
FLIK (1) The relay specified by D is repeatedly turned ON/OFF for the duration that the
execution condition is ON. The specified relay is executed from the ON state.
The time that the device is ON is n1 x 10 ms, and the time that the device is OFF
is n2 x 10 ms.
(2) D turns OFF when the execution condition turns OFF even with D in an ON
state.
(1) (2)
ON
Execution condition
OFF
ON
D
OFF
n1 X 10 ms n2 X 10 ms n1 X 10 ms n2 X 10 ms n1 X 10 ms
Note: • The flicker circuit turns ON or OFF for one scan only even if the setting value of the FLIK
instruction is set to "0".
• Care must be paid to operation when writing in the RUN mode. For details, see CPU
User's Manual, "Cautions during Writing in the RUN Mode."
[Tip]
• This instruction cannot be used in interrupt programs.
• Care is required when programming this instruction between the STP and STE instructions,
and between the STG and JMP/ENDS instructions and in a sub-routine program.
"Precautions when using timer instructions" page 1-13
Operation flag
The operation flag does not change state.
2-36
2-4 Output Instructions
Execution Timing
BASIC INSTRUCTIONS
The instruction is executed at every scan.
Sample Program
When input relay 00000 is ON, output relay 00500 repeatedly turns ON for one second and turns
OFF for two seconds.
00000 FLIK
#00100 #00200 00500
Output Instructions
OUT
OUB
SET
RES
KEEP
DIFU
DIFD
ONDL
OFDL
SHOT
FLIK
ALT
2-37
2-4 Output Instructions
ALT ALT Alternate Inverts the state of the relay.
Execution condition D
ALT A L T D
D — — — — — — — — — — — — — — — — —
2 Explanation of Operation
The ON/OFF state of the device specified by D is inverted at the up edge of the execution condition.
Output Instructions
ON
Execution condition
OFF
ON
D
OFF
[Tip]
• This instruction cannot be used in interrupt programs.
• Care is required when programming this instruction between the STP and STE instructions,
and between the STG and JMP/ENDS instructions and in a sub-routine program.
"Precautions when using differential execution type instructions" page 1-6
Operation flag
The operation flag does not change state.
Execution Timing
This instruction is executed at the up edge of the execution condition.
Sample Program
The ON/OFF state of output relay 00500 is inverted at the up edge of input relay 00000.
00000 00500
ALT
2-38
2-4 Output Instructions
BASIC INSTRUCTIONS
2
Output Instructions
OUT
OUB
SET
RES
KEEP
DIFU
DIFD
ONDL
OFDL
SHOT
FLIK
ALT
2-39
2-5 Bit Output Instructions
Bit output instructions specify the bits of word devices and handle them as output relays. These
instructions are for turning ON/OFF the bits of word devices by the ON/OFF state before the bit
output instruction.
Bit out bar BOUB Inverts and outputs the previous state to the specified bit
of the reference word device.
Bit set BSET Turns the specified bit of the reference word device ON 2-46
and holds this state.
Bit reset BRES Turns the specified bit of the reference word device
OFF.
bit bit
15 0
1-word device
With bit output instructions, the bits of word devices are specified and handled as contacts.
[Example] When input relay 00000 is ON, data memory DM00000 bit 6 is turned ON. When input
relay 00000 is OFF, bit 6 is turned OFF.
00000 DM00000
B
#06
2-40
2-5 Bit Output Instructions
BASIC INSTRUCTIONS
2
2-41
2-5 Bit Output Instructions
BOUT B Bit out
Reflects the state of the input in the specified bit of the
word device.
BOUB B Bit out bar
BASIC INSTRUCTIONS
D — — — — — — — — — — — — — — — — —
Bit Output Instructions
n — — — — — — — — — — — — — — —
Explanation of Operation
BOUT Outputs the input state (before this instruction) to the n th bit of the device specified
by D .
BOUB Inverts and outputs the input state (before this instruction) to the n th bit of the
device specified by D .
bit bit
15 D 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
Operation flag
The operation flag does not change state.
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
Sample Program
When input relay 00000 is ON, data memory DM00000 bit 5 is turned ON. When input relay 00000
is OFF, data memory DM00000 bit 0 is turned ON.
00000 DM00000
B
#05
DM00000
B
#00
2-42
2-5 Bit Output Instructions
BASIC INSTRUCTIONS
2
BOUB
BSET
BRES
2-43
2-5 Bit Output Instructions
BSET BSET Bit set Turns the specified bit of the word device ON and holds
this state.
BRES BRES Bit reset Turns the specified bit of the word device OFF.
BASIC INSTRUCTIONS
Execution condition D
BRES B R E S D n
n ( B R D n )
2 Available
Devices I O
Bit Devices
Internal
auxiliary T C CTC CR DM TM T
Word Devices
C CTH CTC CM #/$ #TM
Constant Indirect Operation Flag
CR CR CR CR
2009 2010 2011 2012
Bit Output Instructions
D — — — — — — — — — — — — — — — — —
n — — — — — — — — — — — — — — —
Explanation of Operation
BSET When the execution condition is ON, the n th bit of the device specified by D
is turned ON and held in this state.
bit bit
15 D 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
BRES When the execution condition is ON, the n th bit of the device specified by D
is turned OFF.
bit bit
15 D 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Operation flag
The operation flag does not change state.
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
2-44
2-5 Bit Output Instructions
Sample Program
BASIC INSTRUCTIONS
When input relay 00000 is ON, data memory DM00000 bit 5 is set.
When input relay 00001 is ON, data memory DM00000 bit 5 is reset.
00000 DM00000
BSET
#05
00001 DM00000
BRES
#05
BOUB
BSET
BRES
2-45
2-6 Timer/Counter Instructions
Timer/counter instructions are for executing timer and counter operations. They are also used for
contact operands for output to devices in combination with an output instruction or as execution
conditions for basic instructions, applied instructions, arithmetic calculation instructions, and
extended instructions.
2 Instruction
Timer TMR
Mnemonic Brief Description of Operation
Operation unit 100 ms, 32-bit subtraction type ON delay
Page
2-48
timer
Timer/Counter Instructions
High-speed timer TMH Operation unit 10 ms, 32-bit subtraction type ON delay 2-50
timer
High-speed 1 ms TMS Operation unit 1 ms, 32-bit subtraction type ON delay 2-52
timer timer
Counter C 32-bit addition counter 2-56
Interval timer ITVL Sets the mode, and measures the pulse interval and 2-60
DM average values.
Up-down counter UDC 32-bit up-down counter 2-64
Up-down timer UDT Operation unit 10 ms, 32-bit up-down timer 2-66
2-46
2-6 Timer/Counter Instructions
BASIC INSTRUCTIONS
2
Timer/Counter Instructions
2-47
2-6 Timer/CounterTMR
Instructions Operation unit 100 ms, 32-bit subtraction type
TMR Timer
ON delay timer
Execution condition S
T n T M R n S
T n S
T I M n S
T n
2 n
S
— — — — — — — — — — — — — —
— — — — — — — — — — — — — —
—
—
— — — —
Timer/Counter Instructions
Explanation of Operation
When the execution condition is ON, the timer specified by n is started up. The value (setting
value) specified by S becomes the current value when the timer is started up. The current value
is decremented (-1) every 100 ms.
When the current value reaches "#00000", timer T n turns ON.
When the execution condition turns OFF, timer T n turns OFF, and the current value is reset.
Scan
ON
Execution condition
OFF
Value specified by S
Current value
#00000
Timer T n ON
* The device No. n of the timer cannot be used in duplicate with TMR, TMH, TMS, C, UDC, or
UDT instructions.
* The error of the TMR instruction is "within ±(100 ms 1 scan time)."
[Tip]
When the setting value is 0, and the execution condition is ON for two scans or more, timer T n
turns ON.
"Precautions when using timer instructions" page 1-13
"Example of changing timer setting values" page 2-54
"Example of changing timer current values" page 2-54
"Example of reading timer current values" page 2-55
2-48
2-6 Timer/Counter Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
This instruction is executed at each scan for the duration that the execution conditions are ON.
Sample Program
When the input relay 00000 turns ON, timer T000 turns ON for three seconds, and output relay 00500
turns ON. 2
Timer/Counter Instructions
00000 #00030
T000
T000 00500
TMR
TMH
TMS
ITVL
UDC
UDT
2-49
2-6 Timer/CounterTMH
Instructions Operation unit 10 ms, 32-bit subtraction type ON delay
TMH High-speed timer timer
Execution condition S
T
H n T M H n S
T H n S
T I M H n S
T n
2 n
S
— — — — — — — — — — — — — —
— — — — — — — — — — — — — —
—
—
— — — —
Timer/Counter Instructions
Explanation of Operation
When the execution condition is ON, the timer specified by n is started up. The value (setting
value) specified by S becomes the current value when the timer is started up. The current value
is decremented (-1) every 10 ms.
T
When the current value reaches "#00000", the contact specified by timer H n turns ON.
T
When the execution condition turns OFF, the contact specified by timer H n turns OFF, and the
current value is reset.
Scan
ON
Execution condition
OFF
Value specified by s
Current value
#00000
Timer T
H n ON
* The device No. n of the high-speed timer cannot be used in duplicate with the TMR, TMH,
TMS, C, UDC, or UDT instructions.
* The error of the TMH instruction is "within ±(10 ms +1 scan time)."
[Tip]
When the setting value is 0, and the execution condition is ON for two scans or more, timer HT n
turns ON.
"Precautions when using timer instructions" page 1-13
"Example of changing timer setting values" page 2-54
"Example of changing timer current values" page 2-54
"Example of reading timer current values" page 2-55
2-50
2-6 Timer/Counter Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
Sample Program
When input relay 00000 turns ON, timer HT 000 turns ON 0.5 seconds later, and output relay 00500
turns ON. 2
Timer/Counter Instructions
00000 #00050
T
H 000
T000 00500
TMR
TMH
TMS
ITVL
UDC
UDT
2-51
2-6 Timer/CounterTMS
Instructions Operation unit 1 ms, 32-bit subtraction type
TMS High-speed 1 ms timer
ON delay timer
Execution condition S
T n
S n T M S S
( T S n S )
T n
n — — — — — — — — — — — — — — — — — — —
2 S — — — — — — — — — — — — — — —
Timer/Counter Instructions
Explanation of Operation
When the execution condition is ON, the timer specified by n is started up. The value (setting
value) specified by S becomes the current value when the timer is started up. The current value
is decremented (-1) every 1 ms.
T
When the current value reaches "#00000", timer S n turns ON.
T
When the execution condition turns OFF, timer S n turns OFF, and the current value is reset.
Scan
ON
Execution condition
OFF
Value specified by s
Current value
#00000
Timer T
S n ON
* The device No. n of the high-speed 1 ms timer cannot be used in duplicate with the TMR, TMH,
TMS, C, UDC, or UDT instructions.
* The error of the TMS instruction is "within ±(1 ms +1 scan time)."
[Tip]
When the setting value is 0, and the execution condition is ON for two scans or more, timer ST n
turns ON.
"Precautions when using timer instructions" page 1-13
"Example of changing timer setting values" page 2-54
"Example of changing timer current values" page 2-54
"Example of reading timer current values" page 2-55
2-52
2-6 Timer/Counter Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
Sample Program
When input relay 00000 turns ON, timer ST 000 turns ON 7ms later, and output relay 00500 turns ON.
2
00000 #00007
Timer/Counter Instructions
T
S 000
T000 00500
TMR
TMH
TMS
ITVL
UDC
UDT
2-53
2-6 Timer/Counter Instructions
When reading or changing timer setting values or current values on a ladder, use the LDA, STA
and MOV instructions. When a timer is taken as an operand, LDA handles the current value, STA
BASIC INSTRUCTIONS
2 00000 #00100
LDA
T000
STA
Timer/Counter Instructions
• Even if values are changed by a suffix .U instruction, the value is automatically extended to 32
bits, and is stored to the setting value of the timer.
00000 MOV
#00100 T000
00000 MOV
DM00000 T000
• Even if values are changed by a suffix .U instruction, the value is automatically extended to 32
bits, and is stored to the current value of the timer.
2-54
2-6 Timer/Counter Instructions
BASIC INSTRUCTIONS
When input relay 00000 is OFF, the current value of timer T000 is changed to the value
currently stored to data memories DM00000 and DM00001.
00000 MOV.D
#100000 T000
00000 MOV.D
DM00000 T000
Timer/Counter Instructions
Note: Operation as a result of executing the MOV instruction:
When the current value ≤ setting value, the current value is changed to the written
value.
When the current value > setting value, the current value is changed to the same
value as the setting value.
C
00000 T000 DM00000
ITVL
LDA STA
UDC
T001 DM00001
(2) When the current value changes within the range 0 to 4294967295
When input relay 00000 is ON, the current value of timer T000 is stored to data memories
DM00000 and DM00001.
When input relay 00001 is ON, the current value of timer T000 is stored to data memories
DM00010 and DM00011.
00001 MOV.D
T000 DM00010
2-55
2-6 Timer/Counter CInstructions
C Counter 32-bit addition counter
Execution condition S1
C n C n S1 S2
S2 ( C N T n S1 S2 )
C n
2 n
S1
— — — — — — — — — — — — — —
— — — — — — — — — — — — — —
—
—
— — — —
S2
Timer/Counter Instructions
Explanation of Operation
When the execution condition is ON, "1" is added (incremented by one) to the current value of the
counter specified by n at the up edge of the count input specified by S2 . When the current
value becomes the same as the setting value specified by S1 , counter C n turns ON. When
the execution condition is OFF, counter C n turns OFF, and the current value is reset to 0. The
execution condition is used as reset input.
ON
00000 ← Reset input #00012
Count input S2
C000 OFF
00001 ON
Execution condition
C000 OFF
S1
S1
11
8 9 10
7
6
4 5
2 3
Current value 1
ON
C n
* The response speed of the counter instruction is reliant on the scan time.
"About maximum count speed of counters" page 1-14
* n cannot be used in duplicate with the TMR, TMH, TMS, C, UDC, or UDT instructions.
[Tip]
• When "0" is set to the setting value, the counter stays ON at all times when the execution
condition is ON.
• The current value of counter C is held in the PROG mode or when the power is turned OFF.
(for five years or more at 25°C The current value can be cleared when the power is turned OFF
by setting the memory switch instruction (MEMSW).
"MEMSW instruction" page 3-6
2-56
2-6 Timer/Counter Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
Sample Program
When input relay 00001 is counted ten times, output relay 00500 turns ON.
When input relay 00000 turns ON, counter C000 is reset. 2
Timer/Counter Instructions
00000 #00010
C000
00001
C000 00500
TMR
TMH
TMS
ITVL
UDC
UDT
2-57
2-6 Timer/Counter Instructions
When reading or changing counter setting values or current values on a ladder, use the LDA, STA
and MOV instructions. When a counter is taken as an operand, LDA handles the current value,
BASIC INSTRUCTIONS
2 00000 #00100
LDA
C000
STA
Timer/Counter Instructions
• Even if values are changed by a suffix .U instruction, the value is automatically extended to 32
bits, and is stored to the setting value of the counter.
00000 MOV
#00100 C000
00000 MOV
DM00000 C000
• Even if values are changed by a suffix .U instruction, the value is automatically extended to 32
bits, and is stored to the current value of the counter.
2-58
2-6 Timer/Counter Instructions
BASIC INSTRUCTIONS
When input relay 00000 is OFF, the current value of counter C000 is changed to the value
currently stored to data memories DM00000 and DM00001.
00000 MOV.D
#100000 C000
00000 MOV.D
DM00000 C000
Timer/Counter Instructions
Note: Operation as a result of executing the MOV instruction:
When the current value ≤ setting value, the current value is changed to the written
value.
When the current value > setting value, the current value is changed to the same
value as the setting value.
C
00000 C000 DM00000
ITVL
LDA STA
UDC
(2) When the current value changes within the range 0 to 4294967295
When input relay 00000 is ON, the current value of counter C000 is stored to data memories
DM00000 and DM00001.
When input relay 00001 is ON, the current value of counter C001 is stored to data memories
DM00010 and DM00011.
00001 MOV.D
C001 DM00010
2-59
ITVL(.U)
2-6 Timer/Counter Instructions ITVL Measures the pulse interval, pulse
ITVL
PLS
PAUSE Interval timer length and value of data memories in
RES
the preset mode.
ITVL .S
BASIC INSTRUCTIONS
D1 — — — — — — — — — — — — — — — — — — —
Timer/Counter Instructions
D2 — — — — — — — — — — — — — — —
Explanation of Operation
About the two ITVL instruction functions
(1) Pulse measurement mode ..... In this mode, the pulse cycle or pulse width of PLS (pulse input)
is measured.
Specify pulse cycle measurement, pulse width measurement, and measurement unit by the data
table mode setting (in minimum increments of 10 ms).
The maximum measurement pulse width and maximum measurement pulse cycle are as
follows:
ITVL.U ....... 65535 sec
ITVL.S ....... 32767 sec
Pulses of width exceeding the above value cannot be measured. If the pulse width exceeds the
above value, an overflow occurs, and the lower 16 bits of the measured value are stored.
(2) DM measurement mode ........ In this mode, the maximum/minimum values and average
values* of captured measured values are calculated.
Specify the data to capture by the data table mode setting.
* For details on calculated values, read "Data table assignments" for the ITVL and ITVL.S
instructions.
2-60
2-6 Timer/Counter Instructions
ITVL(.U) Pulse measurement and DM measurement are processed by 16-bit unsigned binary
data.
BASIC INSTRUCTIONS
Setting values, measured values, and average values are handled as 16-bit unsigned
data (0 to 65535).
Integrated values are handled as 32-bit unsigned data.
ITVL.S Pulse measurement and DM measurement are processed by 16-bit signed binary
data.
Setting values, measured values, and average values are handled as 16-bit signed
data (-32768 to 32767).
Integrated values are handled as 32-bit signed data.
Timer/Counter Instructions
table" and is configured as follows. Store values for setting operation of the ITVL instruction to the
first four data memories in this data table.
D1 +1 MAX setting value →Sets the maximum value of the measurement range.
Set to initial settings.
D1 +2 MIN setting value →Sets the minimum value of the measurement range.
D1 +3 Average count →Sets the count for calculating the average value.
D1 +4 Measurement value →The measured value of each measurement is stored.
D1 +5 MAX setting value →The maximum value of the measured values is stored.
D1 +6 MIN setting value →The minimum value of the measured values is stored. TMR
D1 +7 Average value →The average value of the count specified at average count is stored. TMH
D1 +9 Integrated value C
→The total value lower 16 bits of the measured value are stored.
(lower) ITVL
D1 +11
Work memory for
.....
• The average value is not calculated when the average count is set to "0". The total value is
calculated, however an overflow will occur when the 32-bit range is exceeded.
• When the average count is reached, the measurement count and total value become "0".
Mode setting
Pulse measurement mode
2-61
2-6 Timer/Counter Instructions
DM measurement mode
* Mode Nos. 20000 to 39999 can be set only when extended memory is mounted on the KV-700.
2 * When an unavailable mode has been set, the content of the data table is initialized.
Timer/Counter Instructions
D2 MAX error →The device turns ON for one scan only when the measured value exceeds the MAX setting value.
D2 +1 MIN error →The device turns ON for one scan only when the measured value exceeds the MIN setting value.
D2 +2 End single count →The device turns ON for one scan only at the end of each measurement.
D2 +3 End average count →The device turns ON for one scan only when the count measurement specified at average count ends.
Operation flag
The operation flag does not change state.
Sample Program
■ Example of pulse interval measurement
01001 turns ON for one scan only when the measurement value
falls below the minimum value of 490 ms.
At MAX error and MIN error, output relay 00500 is output for one-shot of 300 ms.
2-62
2-6 Timer/Counter Instructions
Time chart
BASIC INSTRUCTIONS
ON
1 scan
ON
300 ms 300 ms
2
Timer/Counter Instructions
■ Example of A/D data measurement
Output 00500 turns ON when the analog input value (1 to 5V range) stored to data memory
DM01600 exceeds +3V. When the analog input value falls below +2V, output 00501 is turned
ON. The average value is stored to DM00100.
01000 00500
Turns output relay 00500 ON when the measured value exceeds maximum 3V (2000).
01001 00501
Turns output relay 00501 ON when the measured value falls below minimum 2V (1000).
01003 DM00007 DM00100
LDA STA Stores the average value to DM00100 every 100 measurements.
2-63
UDC
UP
2-6 Timer/Counter Instructions
UDC DW
RES
Up/down counter 32-bit increment/decrement counter
Up input UDC n
UP
U D C n S
Down input S
DW ( C N T R n S )
Reset input
RES
C n
n — — — — — — — — — — — — — — — — — — —
S — — — — — — — — — — — — — — —
Explanation of Operation
"1" is added (incremented) to the current value of the counter at the up edge of the up input.
"1" is deducted (decremented) from the current value of the counter at the up edge of the down input.
Counter UDC n turns ON when the current value digits are incremented or decremented.
The current value is reset to "0" when the reset input is ON.
00002 #00009
DW
00003
RES
C000
ON
ON
00003 (Reset input)
OFF
Setting value
9 9 8 9 8
7 8 7 6 7 6 7 8 7 6
5 6 5 4
3 4 2 3 3 2
Current value
0 1 2 0 1 0 1 0
Contacts C000 O At digit At digit At digit
O O
N rounding up N rounding down N rounding down
* n cannot be used in duplicate with the TMR, TMH, TMS, C, UDC, or UDT instructions.
[Tip]
The current value of up-down counter (UDC) is held in the PROG mode or when the power is
turned OFF. (for five years or more at 25°C The current value can be cleared when the power
is turned OFF by setting the memory switch instruction (MEMSW).
"MEMSW instruction" page 3-6
2-64
2-6 Timer/Counter Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
This instruction is executed at the up edge of the execution condition.
Sample Program
The number of in-warehouse units is counted by input relay 00000.
The number of out-warehouse units is counted by input relay 00001. 2
When the truck is full (10 units), C000 turns ON to turn output relay 00500 ON.
Timer/Counter Instructions
The count is reset by input relay 00002.
Car park
00000 UDC 000 0000 0001
UP
00001 #00009
DW Entrance Exit
00002
RES
C000 00500
TMR
TMH
TMS
ITVL
UDC
UDT
2-65
UDT
UP
2-6 Timer/Counter Instructions Operation unit 10 ms, 32-bit integration/subtraction
UDT DW
RES
Up/down timer
timer
Up input UDT n
UP
S U D T n S
Down input
DW
Reset input
RES
T n
n — — — — — — — — — — — — — — — — — — —
S — — — — — — — — — — — — — — —
Explanation of Operation
When the up input is ON, "1" is added (incremented) every 10 ms to the current value of the timer
specified by S .
When the down input is ON, "1" is subtracted (decremented) every 10 ms to the current value of the
timer specified by S .
When the up and down inputs both are ON or OFF, the current value is held.
(1) T n turns ON when the current value is the same as the setting value with the up input ON.
(2) T n turns OFF when the up input is OFF.
(3) T n turns ON when the current value become "0" with the down input ON.
(4) T n turns OFF when the down input is OFF.
(5) The current value is reset to "0" at the up edge of the reset input.
Up input
OFF
ON
Down input
OFF
ON
Reset input
OFF
Setting value
Current value
0
Timer UDT n ON ON ON ON
* D cannot be used in duplicate with the TMR, TMH, TMS, C, UDC, or UDT instructions.
* The error of the UDT instruction is "within ±(10 ms +1 scan time)."
[Tip]
The current value of UDT is held when operation is stopped or when the power is turned OFF.
(for five years or more at 25°C)
2-66
2-6 Timer/Counter Instructions
Operation flag
The operation flag does not change state.
BASIC INSTRUCTIONS
Execution Timing
This instruction is executed when the up input, down input or reset input is ON.
Sample Program
The time that output relay 00500 turned ON is measured. When input relay 00000 is ON, the
measured value is reset. The measured value is stored to data memories DM00000 and DM00001.
Up to 42949672950 ms (approx. 12000 hours can be measured in 10 ms units.
2
Timer/Counter Instructions
00500 UDT000
UP
CR2003 #4294967295
DW
00000
RES
TMR
TMH
TMS
ITVL
UDC
UDT
2-67
2-7 Connect/End Instructions
Connect instructions include ANL and ORL instructions, and MPS, MRD and MPP instructions. The
ANL and ORL instructions connect two contact blocks (combinations of contacts) in series or in
parallel. The MPS, MRD and MPP instructions are for memorizing or reading ON/OFF states. There
are two end instructions, END for specifying the end of the main routine program, and the ENDH
for specifying the final step of the sequence program.
Contact block
When contact blocks are connected to the bus lines on the left and right to unit the bus lines, the
contact blocks are called a "program block."
Program block
2-68
2-7 Connect/End Instructions
■ About stacks
In ladder diagrams, branch points are expressed using lines.
BASIC INSTRUCTIONS
LD 00000
00000 00500
MPS
00001 00501 OUT 00500
MRD
00002 00502
AND 00001
OUT 00501
MPP
AND 00002
2
Connect/End Instructions
OUT 00502
• When the MPS instruction is executed, the ON/OFF state up to the MPS instruction and the
operation flag state are memorized to an area called a "stack." When multiple MPS instructions
are executed, the ON/OFF state at that moment in time and the operation flag state are
memorized to the stack in the order that the MPS instructions are executed. The ON/OFF state
and operation flag state last memorized by the MPS instruction are memorized to the top of the
stack.
• When the MRD instruction is executed, the ON/OFF state and the operation flag state currently
memorized at the top of the stack are read.
As the ON/OFF state and operation flag state currently memorized to the stack are held as they
are, the same ON/OFF state and operation flag state are read even if the stack is read two or
more times by the MRD instruction.
• When the MPP instruction is executed, the ON/OFF state and the operation flag state currently
memorized at the top of the stack are read.
However, the ON/OFF state and the operation flag state that were memorized at the top of the
stack are deleted, and the ON/OFF state and the operation flag state that were memorized by
execution of the previous MPS instruction rise up to the top of the stack.
SBN
Sub-routine program
Sequence program
RET End of sub-routine program
Write the sub-routine program and
INT interrupt program here as required.
Interrupt program
The END instruction indicates the final step of the main routine program.
• The sub-routine program and interrupt program are scripted after the END instruction of the
main routine program.
The ENDH instruction indicates the final step of the sequence program.
• Programs can be scripted following the ENDH instruction though they are not executed.
2-69
END
2-7 Connect/End Instructions
END End Indicates the end of the main routine program.
ENDH
ENDH End high Indicates the end of the entire program.
BASIC INSTRUCTIONS
E N D
E
END
F E N D
2 ENDH
E N D H
( H )
Connect/End Instructions
— — — — — — — — — — — — — — — — — — — — —
Explanation of Operation
END When the END instruction is executed, the PLC ends the main routine program,
executes END processing, and executes the main routine program again from step 0.
To indicate the end of the program, use the ENDH instruction.
ENDH This indicates the end of the sequence program (that there is no program from here
onwards).
When a sub-routine program or an interrupt program is not to be written in the ladder
program, write the END instruction followed immediately by the ENDH instruction.
Main routine
program
END
ENDH
Operation flag
The operation flag does not change state.
2-70
2-7 Connect/End Instructions
BASIC INSTRUCTIONS
2
Connect/End Instructions
END
ENDH
CON
MPS
MRD
MPP
ANL
ORL
2-71
2-7 Connect/End Instructions Indicates a series connection following an output
CON Connect
instruction.
a b c d
↑ ↑ ↑
CON CON CON
— — — — — — — — — — — — — — — — — — — — —
2 Explanation of Operation
Connect/End Instructions
This instruction is used when writing programs in an extended ladder or when connecting
instructions following an output instruction.
* When the ladder program has been made in Ladder Support Software KV BUILDER, instructions
are automatically converted into mnemonics and incorporated into the program merely by
scripting the instruction after the output instruction.
* Programming this instruction does not influence the scan time.
For details on extended ladders, read "1-6 Extended Ladders" ( page 1-38).
Operation flag
The operation flag does not change state.
2-72
2-7 Connect/End Instructions
BASIC INSTRUCTIONS
2
Connect/End Instructions
END
ENDH
CON
MPS
MRD
MPP
ANL
ORL
2-73
2-7 Connect/End Instructions Push
MPS Stores the input state and operation flag to memory.
→
MPS
2 MRD
→
Connect/End Instructions
→
MPP
— — — — — — — — — — — — — — — — — — — — —
Explanation of Operation
MPS Stores the ON/OFF state and operation flag state up to that instruction to memory, and
executes the instruction from the next step. If two or more of these instructions are
executed in a single block, the ON/OFF states at that moment in time are stored to memory
in the order that the instruction was executed. (Up to eight ON/OFF states can be stored
to memory.)
MRD Reads the ON/OFF state and operation flag state stored in memory by the MPS
instruction, and executes the instruction from the next step by that content. The ON/OFF
state and operation flag state currently stored in memory are held.
The MRD instructions can be used continuously. (In this case, the same content is read.)
MPP Reads the ON/OFF state and operation flag state stored to memory by the MPS
instruction, and executes the instruction from the next step by that content. When two or
more MPS instructions have been executed (two or more ON/OFF states and operation
flag states have been stored to memory), reading is performed in order from the last ON/
OFF state and operation flag state stored to memory. ON/OFF state and operation flag
state read by the MPP instruction are cleared from memory.
2-74
2-7 Connect/End Instructions
00000 00001 00002 00003 00004 00005 00006 00007 00008 00500 LD 00000
MPS . . . . Store ON/OFF state at (1).
BASIC INSTRUCTIONS
(1) (2) (3) (4) (5) (6) (7) (8) 00009 00501 AND 00001
MPS . . . . Store ON/OFF state at (2).
...
00010 00502
AND 00006
MPS . . . . Store ON/OFF state at (7).
00011 00503
AND 00007
MPS . . . . Store ON/OFF state at (8).
00012 00504 AND 00008
OUT 00500
00013 00505
MPP . . . . Read ON/OFF state at (8).
AND 00009
00014 00506
OUT 00501
. . . . Read ON/OFF state at (7).
2
MPP
00015 00507
Connect/End Instructions
AND 00010
OUT 00502
00100 00508
...
MPP . . . . Read ON/OFF state at (2).
AND 00015
OUT 00507
MPP . . . . Read ON/OFF state at (1).
AND 00100
OUT 00508
MRD
MPP
Operation flag
ANL
The operation flag does not change state. ORL
2-75
2-7 Connect/End Instructions AND load
ANL Connects the contact block in series.
Ladder program
A block B block
ANL
2 ORL
C block
Connect/End Instructions
D block
— — — — — — — — — — — — — — — — — — — — —
Explanation of Operation
ANL Connects two contact blocks in series.
Block A and block B are connected in series as shown in the ladder diagram above.
This connection is indicated not by a symbol in the ladder diagram but by connection
lines.
ORL Connects two contact blocks in parallel.
Block C and block D are connected in parallel as shown in the ladder diagram above.
This connection is indicated not by a symbol in the ladder diagram but by connection
lines.
Operation flag
The operation flag does not change state.
2-76
2-7 Connect/End Instructions
Sample Program
BASIC INSTRUCTIONS
Output relays turns ON when the following two conditions (1) and (2) are both satisfied:
(1) Either (or both of) input relay 00000 or 00001 turn ON.
(2) Either (or both of) input relay 00002 or 00003 turn ON.
Connect/End Instructions
The operation of the above program is the same as that of the following program.
ENDH
CON
MPS
MRD
MPP
ANL
ORL
2-77
2-7 Connect/End Instructions
2
Connect/End Instructions
2-78
3-1 Shift Instruction
APPLIED INSTRUCTIONS
APPLIED INSTRUCTIONS 3
Shift Instruction
These instructions are for work progress, program control, and
extended ladders.
These instructions allow you to structurally script basic ladders.
3-1
3-1 Shift Instruction
3
Shift Instruction
3-2
3-1 Shift Instruction
APPLIED INSTRUCTIONS
3
Shift Instruction
SFT
3-3
SFT
3-1 Shift InstructionDCLK
SFT RES
Shift Operates the shift register.
S F T D1 D2
Clock input D1
CLK
Reset input D2
RES
D1 — — — — — — — — — — — — — — — — — —
D2 — — — — — — — — — — — — — —
Explanation of Operation
The ON/OFF state of the data input is captured at the up edge of the clock input.
That state is shifted from D1 to the relay specified by D2 at the clock timing.
When the reset input is ON, all relays at D2 from D1 turn OFF.
The state is not shifted to relays at D2 +1 onwards.
ON
Data input
OFF
ON
Clock input
OFF
ON
Reset input
OFF
ON
D1
OFF
ON
D1 +1
OFF
ON
D1 +2
OFF
ON
D1 +3
OFF
ON
D2 -1
OFF
ON
D2
OFF
Note: Duplicate use of No.1 operands and No.2 operands between two or more SFT instructions
is not possible.
3-4
3-1 Shift Instruction
Operation flag
The operation flag does not change state.
APPLIED INSTRUCTIONS
Execution Timing
This instruction is executed at the up edge of clock input.
Sample Program
■ Batch reset of internal auxiliary relays
When input relay 00000 turns ON, all internal auxiliary relays from 01000 to 01915 turn OFF.
This instruction can be used as a substitute for the RES instruction to reset multiple relays in a
single operation. It can also be used as a substitute for the ZRES instruction.
3
"ZRES Instruction" page 5-24
Shift Instruction
CR2003 SFT
D
CR2003 01000
CLK
00000 01915
RES
CR2008 01000
SET
T001 #00010
T001
CR2003 SFT
D
T001 01000
CLK
CR2003 01005
RES
01000 00500
01001 00501
01002 00502
01003 00503
01004 00504
01005 01000
SET
3-5
3-2 Memory Switch Instruction
3
Memory Switch Instruction
3-6
3-2 Memory Switch Instruction
APPLIED INSTRUCTIONS
3
3-7
MEMSW
3-2 Memory Switch Instruction
MEMSW Memory switch Operates the memory switch.
M E M S W S
S
n — — — — — — — — — — — — — — — — — — —
S — — — — — — — — — — — — — — —
n : Specifies the memory switch No. (0 or 1). Input of "#" and "$" is not allowed.
S : Sets the memory switch ($0000 to $FFFF). Setting in # (decimal) is not allowed.
3
Explanation of Operation
Memory Switch Instruction
MEMSW0
The memory switch has two switches, 0 and 1.
Each switch comprises 16 bits, and switch functions are set by turning these bits ON/OFF.
The content of the memory switches is set when the program is moved.
If the program does not contain the MEMSW instruction, "$0000" is set on the switch.
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 MEMSW0
$0103
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SW1
SW2
SW3
SW4
3-8
3-2 Memory Switch Instruction
MEMSW1
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 MEMSW0
$0216
APPLIED INSTRUCTIONS
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SW1
SW2
SW3
SW4
MEMSW
Note: Set holding of relays set by MEMSW1 only to internal auxiliary relays.
Do not set this function to I/O Units and special units (units other than I/O Units). When
this function is set to I/O relays, the relays do not hold the content of devices. When this
function is set to relays assigned to special units, the program may not function normally.
In the case of programs that detect the up edge of relays at the first scan after operation
is started, the up edge may not be able to be detected and the unit may not operate if that
relay is held.
3-9
3-2 Memory Switch Instruction
(Switch No.)
APPLIED INSTRUCTIONS
$0269 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
SW1 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 (Example)
SW2
SW3 0 2 6 9 (Hex)
SW4
(8) (4) (2) (1)
23 2 2 21 2 0 Hex
0 0 0 0 0
0 0 0 1 1 Power interruption hold set to
relays 45000 to 49915
0 0 1 0 2
0 0 1 1 3
3 0 1 0 0 4
Power interruption hold set to
Memory Switch Instruction
0 1 0 1 5
relays 25000 to 29915, 35000 to 34915
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8 Power interruption hold set to
relays 1000 to 4915, 15000 to 19915
1 0 0 1 9
1 0 1 0 A
1 0 1 1 B
1 1 0 0 C
1 1 0 1 D
1 1 1 0 E
1 1 1 1 F
[Tip]
If an attempt is made to move a program to the KV-700 that has been set as write-protected on
KV BUILDER, the message "Write-protected. Force operation?" will be displayed. Select "Yes"
to forcibly execute the move.
3-10
3-2 Memory Switch Instruction
Operation flag
The operation flag does not change state.
APPLIED INSTRUCTIONS
Execution Timing
This instruction is set when the power is turned ON and when the ladder program is moved to the
KV-700 (including writing in the RUN mode).
Sample Program
• Setting of error cancellation when the unit is turned ON
MEMSW0
$0001 3
MEMSW0
$0002
MEMSW0
$0100
MEMSW
MEMSW1
$0001
MEMSW0
$0010
3-11
3-3 Step Instructions
3-12
3-3 Step Instructions
APPLIED INSTRUCTIONS
3
Step Instructions
STP
STE
3-13
STP
3-3 Step Instructions
STP Step Executes the program up to the STE instruction when
the relay indicated by the operand is ON.
STE
STE Step end This instruction is used in a pair with the STP instruction,
and indicates the end of the program to be executed by
step operation.
APPLIED INSTRUCTIONS
STP
S S T P S
Program A
STE
S T E
3 Program B
Step Instructions
S — — — — — — — — — — — — —
S : Specifies the device to be used as the execution condition in the program between the STP
and STE instructions.
Explanation of Operation
When the device specified by S is ON, the instructions (program A) between the STP and STE
instructions are executed.
When the device specified by S is OFF, the program between the STP and STE instructions is
not executed, and execution jumps to the instruction sequence (program B) after the STE
instruction.
[Example] When input 00000 is ON, output 00500 turns ON/OFF interlocked to ON/OFF of input
00001. When input 00000 is OFF, output 00500 does not turn ON even if input 00001
is ON.
When input 00000 turns OFF with input 00001 and output 00500 both ON, output
00500 stays ON even if input 00001 turns OFF.
00000 01000
STP
01000
00001 00500
This program is not executed
when 01000 is OFF.
STE
3-14
3-3 Step Instructions
[Tip]
• The instruction sequence between the STP and STE instructions that have not been executed do
not affect the scan time.
APPLIED INSTRUCTIONS
• Care is required when programming differential execution type instructions or timer instructions
between the STP and STE instructions.
"Precautions when using differential execution type instructions" page 1-6
"Precautions when using timer instructions" page 1-13
Step Instructions
When inputs 01000 and 01001 both are STP
ON, the program is executed in order (1) (2) 01001
(3) (4).
When input 01000 is ON and input 01001 is Nesting Nesting (2)
level: 1 level: 2
OFF, the program is executed in order (1)
(3) (4), and execution of (2) is skipped. STE
(3)
STP
STE
STE
(4)
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
3-15
3-3 Step Instructions
Sample Program
When input relay 00000 turns ON, output relay 00500 automatically turns ON for two seconds, and
then output relay 00501 turns ON for three seconds.
APPLIED INSTRUCTIONS
STP
01001
T000 01001
RES
T000 00500
3 01001 #00020
Step Instructions
T000
T000 01002
SET
STE
STP
01002
T001 01002
RES
T001 00501
01002 #00030
T001
STE
END
ENDH
3-16
3-3 Step Instructions
APPLIED INSTRUCTIONS
3
Step Instructions
STP
STE
3-17
3-4 Stage Processing Instructions
When a stage ends, program execution jumps to the next stage by the JMP instruction. A stage ends
by the ENDS instruction.
Jump JMP Turns the relay of the currently executing stage OFF,
3 and jumps to the specified stage.
End stage ENDS Turns the relay of the currently executing stage OFF.
Stage Processing Instructions
Wait ON W-ON Sets the device of the No.2 operand with the device 3-24
of the No.1 operand ON.
Wait OFF W-OFF Sets the device of the No.2 operand with the device
of the No.1 operand OFF.
Wait up edge W-UE Sets the device of the No.2 operand at the up edge of 3-26
the device of the No.1 operand.
Wait down edge W-DE Sets the device of the No.2 operand at the down edge
of the device of the No.1 operand.
Flow chart
Power ON
Ladder program
No
Start switch 1000
Start switch ↑ SET
ON?
Yes
01000 01001
Process (1) STG JMP → Process (1)
01001 01002
Process (2) STG JMP → Process (2)
01002 01003
Process (3) STG JMP → Process (3)
01003
Process (4) STG ENDS → Process (4)
When the STG, JMP and ENDS instructions are used, you can write a program for each individual
process.
3-18
3-4 Stage Processing Instructions
APPLIED INSTRUCTIONS
3
3-19
3-4 Stage Processing Instructions
STG STG Stage Executes the instruction in the STG block.
ENDS ENDS End stage Turns the relay of the currently executing stage OFF.
APPLIED INSTRUCTIONS
S S ' S T G S
STG JMP
J M P S
S ' E N D S
STG ENDS
Devices I O auxiliary T C CTC CR DM TM T C CTH CTC CM #/$ #TM 2009 2010 2011 2012
S — — — — — — — — — — — — — — — — — — —
Explanation of Operation
STG When the device specified by S is ON, that STG instruction is executed.
• Be sure to start the STG instruction from the bus line.
• Duplicate programming of STG instruction operands is not allowed. (Duplicate pro-
gramming of the JMP instruction is allowed. "JMP instruction operands" page 3-23)
• Use a differential type contact as the execution condition of the first programmed
STG instruction. If the execution condition continues to stay ON without a differential
type contact used, the JMP instruction will be executed, and the STG instruction will
be executed again even if the stage ends. For this reason, the stage will no longer
end.
• Use stage instructions in combination with the JMP instruction or END instruction.
JMP When the previous state is ON, the currently executing stage ends, and program
execution jumps to the S ' stage.
• Use this instruction in combination with the STG instruction.
ENDS When the previous state is ON, the currently executing stage ends.
• Use this instruction in combination with the STG instruction.
[Memo]
(1) Program execution jumps to STG01001 by
CR2008 01000
SET jump condition 00000 turning ON.
01000 00000 01001 (2) Program execution jumps to STG01002 by
(1) STG JMP input 00500 turning ON and jump condition
01001 00500 00001 01002 00001 turning ON.
(2) STG JMP
(3) Program execution jumps to STG01001 by
01002 00501 00002 01001
(3) STG JMP
input 00501 turning ON and jump condition
00002 turning ON.
Program execution jumps to 01003 by jump
00003 01003 condition 00003 turning ON.
JMP
(4) Program execution ends by input 00502 turn-
01003 00502 00004 ing ON and jump condition 00004 turning ON.
(4) STG ENDS
3-20
3-4 Stage Processing Instructions
[Tip]
• The instruction sequence between the STP and STE instructions or the STG and ENDS
instructions that have not been executed do not affect the scan time.
APPLIED INSTRUCTIONS
• Care is required when programming differential execution type instructions or timer instruc-
tions between the STG and JMP/ENDS instructions.
"Precautions when using differential execution type instructions" page 1-6
"Precautions when using timer instructions" page 1-13
• The table below summarizes the states of instructions between the STG to JMP/ENDS instruc-
tions when operand S of the STG instruction turns OFF.
3
Instruction State
ENDS
W-ON
W-OFF
[Tip]
W-UE
To turn all stage instructions such as emergency stop OFF, use the ZRES or SFT instruction. W-DE
CR2003 SFT
D
1000 Stage start relay
CR2003
CLK
Reset input 1004 Stage end relay
RES
Operation flag
The operation flag does not change state.
Execution Timing
This instruction is executed at each scan for the duration that the stage relay is ON.
3-21
3-4 Stage Processing Instructions
only.
Provide an interlock circuit for outputs (e.g. motor forward or reverse rotation) that might cause
a hazard when both of these stages simultaneously turn ON.
3 Interlock
Stage Processing Instructions
Double coils
Double coils can be used in stage instructions.
* When STG01000 and STG01002 simultaneously turn ON, output 00500 of STG01002
programmed later is given priority.
Note: When stages programmed with double coils simultaneously turn ON, the coil of the stage
programmed later is given priority.
Output hold
To hold output even if STG is OFF, use the SET instruction.
3-22
3-4 Stage Processing Instructions
APPLIED INSTRUCTIONS
In the following ladder, input 01000 is set at all times on the first rung even if input 00001 turns
ON and the JMP instruction is executed. For this reason, input 01000 does not turn OFF.
Accordingly, output relay 00500 does not turn OFF.
STG
01000 00500 00001 01001
STG JMP JMP
ENDS
01002 W-ON
JMP W-OFF
W-UE
01000 00501 00002 01002
W-DE
STG JMP
Sample Program
Output relay 00500 turns ON by the start switch of input relay 00000.
Then, when input 00001 turns ON as a conditional branch, output 00501 turns ON for one second.
When input 00002 turns ON, output 00502 turns ON for two seconds. When each of these
processes ends, program execution returns to the conditional branch, and execution is repeated.
00002 01002
JMP
3-23
3-4 Stage Processing Instructions Sets the device of the No.2 operand with the device
W-ON ON Wait ON
of the No.1 operand ON.
Sets the device of the No.2 operand with the device
W-OFF OFF Wait OFF
of the No.1 operand OFF.
APPLIED INSTRUCTIONS
Execution condition W - O F F S D
S
( W O F F S D )
OFF
D
3
Internal CR CR CR CR
Devices I O auxiliary T C CTC CR DM TM T C CTH CTC CM #/$ #TM 2009 2010 2011 2012
S — — — — — — — — — — — — —
Stage Processing Instructions
D — — — — — — — — — — — — — —
Explanation of Operation
W-ON (1) When the execution condition is ON, the device specified by D is set if the device
specified by S is in an ON state.
(2) D stays ON until the execution condition turns OFF even if S is OFF.
(3) When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
D
OFF
W-OFF (1) When the execution condition is ON, the device specified by D is set if the device
specified by S is in an OFF state.
(2) D stays ON until the execution condition turns OFF even if S is ON.
(3) When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
D
OFF
3-24
3-4 Stage Processing Instructions
Operation flag
The operation flag does not change state.
APPLIED INSTRUCTIONS
Execution Timing
This instruction is executed at each scan for the duration that the execution conditions are ON.
Sample Program
When input relay 00000 turns ON during execution of stage 01000, output relay 00500 turns ON.
When output relay 00500 turns ON for three seconds, program execution jumps to stage 01001.
Input 01100 does not turn OFF even if input 00000 turns OFF before three seconds have elapsed.
STG
JMP
ENDS
W-ON
W-OFF
W-UE
W-DE
3-25
3-4 Stage Processing Instructions Sets the device of the No.2 operand at the up edge
W-UE Wait up edge
of the device of the No.1 operand.
Sets the device of the No.2 operand at the down
W-DE Wait down edge
edge of the device of the No.1 operand.
APPLIED INSTRUCTIONS
Execution condition S W - D E S D
W D E S D
D W D S D
S — — — — — — — — — — — — —
Stage Processing Instructions
D — — — — — — — — — — — — — —
Explanation of Operation
W-UE (1) When the execution condition is ON, the device specified by D is set when the
device specified by S up.
(2) D stays ON until the execution condition turns OFF even if S is OFF.
(3) When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(4) When the execution condition is ON, D does not turn ON unless the up edge
is detected even if S is ON.
D
OFF
W-DE (1) When the execution condition is ON, the device specified by D is set when the
device specified by S down.
(2) D stays ON until the execution condition turns OFF even if S is ON.
(3) When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(4) When the execution condition is ON, D does not turn ON unless the down edge
is detected even if S is ON.
3-26
3-4 Stage Processing Instructions
[Tip]
• This instruction cannot be used in interrupt programs.
• Care is required when programming this instruction between the STP and STE instructions,
APPLIED INSTRUCTIONS
and between the STG and JMP/ENDS instructions and in a sub-routine program.
"Precautions when using differential execution type instructions" page 1-6
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
3
00000 00001
01000
01000 00002
01001
01001 00003
STG
01002
JMP
01002 00500
ENDS
W-ON
W-OFF
W-UE
W-DE
3-27
3-5 Flow Instructions
Master control MCR Indicates the end of the master control range.
reset
Sub-routine call CALL Executes the specified No. sub-routine program. 3-34
3 Sub-routine return RET Ends the sub-routine program, and returns to the sub-
routine call program.
Flow Instructions
Break BREAK Forcibly ends repeated execution between the FOR and
NEXT instructions.
00000 MC MC
00000
00001
00001 00500
00003 MCR
3-28
3-5 Flow Instructions
APPLIED INSTRUCTIONS
3
Flow Instructions
3-29
3-5 Flow Instructions
MC
MC Master control Indicates the end of the master control range.
MCR
MCR Master control reset Indicates the start of the master control range.
APPLIED INSTRUCTIONS
M C R
( I L C )
MCR
3
Available Bit Devices Word Devices Constant Indirect Operation Flag
Flow Instructions
Internal CR CR CR CR
Devices I O auxiliary T C CTC CR DM TM T C CTH CTC CM #/$ #TM 2009 2010 2011 2012
— — — — — — — — — — — — — — — — — — — —
Explanation of Operation
• The MC instruction indicates the start of the master control range.
• The MCR instruction indicates the end of the master control range.
• When the MC instruction execution condition is ON, the program between the MC and MCR
instructions is executed in the same way as the regular program (outside the MC to MCR
instructions).
• When the MC instruction execution condition is OFF, the instructions between the MC to MCR
instructions are executed with the execution condition OFF. As an exception, only the OUB
instruction turns OFF.
Operation of the instructions between the MC to MCR instructions is as follows.
Instruction State
OUT instruction OFF
OUB instruction
TMR instruction Reset
TMH instruction
TMS instruction
ONDL instruction
OFDL instruction
SHOT instruction
FLIK instruction
HKEY instruction
C (counter) instruction State held
SFT instruction
KEEP instruction
SET instruction
RES instruction
High-speed counters
Instructions other than TMIN The instruction is not executed.
3-30
3-5 Flow Instructions
• Output relay 00500 between the MC and MCR instructions and output relay 00500 outside of the
MC to MCR instructions becomes a double coil as follows. For this reason, the output relay
programmed later is given priority.
APPLIED INSTRUCTIONS
00003 00500
00001 MC
00002 00500
←This rung is given priority.
MCR
Flow Instructions
MC
"STP, STE instructions" page 3-12
MCR
STP
(2) Combine the MC to MCR instructions between XXXX
MCR
STE
MC
MC MCR
(3) Combine the STP to STE instructions between CALL
STP
the MC to MCR instructions. XXXX SBN
STE RET
FOR
MCR
NEXT
BREAK
MC
• These instructions cannot be used in the following
MC
applications.
Nesting of MC to MCR instructions MCR
MCR
STP
XXXX
Combination with the STP to STE instructions
MC
STE
MCR
MCR
3-31
3-5 Flow Instructions
[Tip]
The scan time is not shortened even if the input relay for the MC instruction is OFF.
"STP instruction" page 3-12
APPLIED INSTRUCTIONS
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
3
Sample Program
Flow Instructions
When input relay 00000 and internal auxiliary relay 01000 are both ON, output relay 00500 turns
ON/OFF by input relay 00001 ON/OFF. (When input relay 00001 turns ON, output relay 00500 turns
ON, and when input relay 00001 turns OFF, output relay 00500 also turns OFF.)
When either (or both) of input relays 00001 and 01000 turn OFF, output relay 00500 stays OFF (does
not turn ON) regardless of the state of input relay 00001.
00000 01000 MC
00001 00500
MCR
3-32
3-5 Flow Instructions
APPLIED INSTRUCTIONS
3
Flow Instructions
MC
MCR
CALL
SBN
RET
FOR
NEXT
BREAK
3-33
3-5 Flow Instructions
CALL CALL Sub-routine call Executes the specified sub-routine program.
SBN
SBN Sub-routine entry Indicates the start of the sub-routine program.
RET
RET Sub-routine return Ends the sub-routine program.
APPLIED INSTRUCTIONS
SBN
n S B N n
3 RET
R E T
ENDH
Flow Instructions
n — — — — — — — — — — — — — — — — — — —
Explanation of Operation
CALL Executes the sub-routine program specified by n .
SBN Indicates the start of the sub-routine program. Specify the sub-routine No. by n .
Duplicate entry of sub-routine Nos. for the SBN instruction is not allowed. (Duplicate
entry of sub-routine Nos. by the CALL instruction is allowed.)
Program these instructions between the END and ENDH instructions.
RET Indicates the end of the sub-routine program.
[Tip]
• When a sub-routine is executed, the scan time increases by the sub-routine execution time.
• The following instructions are not allowed in sub-routines:
INT, RETI, CTH, STG, JMP, ENDS
• Caution is required when using differential execution type instructions and timer instructions
in sub-routine programs.
"Precautions when using differential execution type instructions" page 1-6
"Precautions when using timer instructions" page 1-13
3-34
3-5 Flow Instructions
[Memo]
The sub-routine program is executed if CALL00 is
Program A
executed during execution of the main routine pro-
Main routine
00
gram. CALL
APPLIED INSTRUCTIONS
Program B
When execution of the sub-routine program ends,
END
program execution returns to program B following
the CALL00 instruction, and the main routine pro-
SBN
gram is executed until the END instruction is pro- 00
Sub-routine
grammed. Sub-routine
program
RET
SBN
01
3
To not execute the CALL instruction (input 00000 = OFF)
Flow Instructions
Program A
00000 00
CALL
Program B
MC
SBN
MCR
Program A
A
CALL
00000 00
Sub-routine SBN
CALL program
RET RET
Program B
B FOR
NEXT
BREAK
00001 00
CALL
■ About sub-routine nesting structures
• Sub-routine instructions can be pro- Program A
grammed down to a nesting level of four. END
• To call a different sub-routine from inside a
sub-routine, the sub-routine to be called SBN
must already be defined (programmed in 01
the above rung). Sub-routine
program A
RET
SBN Call
00
Sub-routine
program B
00000 01
CALL
RET
ENDH
3-35
3-5 Flow Instructions
Sub-routine
program
RET
INT Call
00000
3 Interrupt
program
Flow Instructions
00002 01
CALL
RETI
ENDH
Operation flag
The operation flag does not change state.
Execution Timing
This instruction is executed at each scan for the duration that the execution condition is ON.
3-36
3-5 Flow Instructions
APPLIED INSTRUCTIONS
3
Flow Instructions
MC
MCR
CALL
SBN
RET
FOR
NEXT
BREAK
3-37
3-5 Flow Instructions FOR Repeatedly executes the instruction sequence
FOR Repeat range start between the FOR and NEXT instructions for
the specified number of times in a single scan.
NEXT
NEXT Repeat range end Indicates the end of the repeat range.
BREAK
Forcibly ends repeated execution between the
BREAK Break
APPLIED INSTRUCTIONS
Program to repeat
Execution condition BREAK
B R E A K
NEXT
3 N E X T
Flow Instructions
n — — — — — — — — — — — — — — — — —
n : Specifies the number of times that the program inside the FOR to NEXT instructions is
repeated.
*Can be specified within the range 0 to 65535.
Explanation of Operation
FOR • The program between the FOR to NEXT instructions is executed repeatedly within
a single scan for the number of times specified by n .
• The FOR instruction is executed unconditionally. To disable execution of the FOR
instruction, use the FOR instruction in combination with the STP and SBN instruc-
tions.
NEXT • Execution of this instruction is started from the instruction in the step following the
NEXT instruction after the program is executed for the specified number of times.
BREAK • This instruction is used for forcibly ending repeated execution between the FOR and
NEXT instructions when the execution condition is ON.
• Be sure to program the BREAK instruction between the FOR and NEXT instructions.
• Up to eight BREAK instructions can be used between a single FOR to NEXT
instruction program section. If the FOR to NEXT instructions are nested, up to eight
BREAK instructions can be used in the entire nested structure.
3-38
3-5 Flow Instructions
APPLIED INSTRUCTIONS
FOR
#5
(1)
FOR
#4
(2)
FOR
#3
Nest 3
Nest 2
Nest 1
(3) In this example,
the nesting level 3
NEXT is three.
Flow Instructions
NEXT
NEXT
(4)
• The program section in "Nest 1" is executed five times, and program execution jumps to
program (4).
For this reason, program (1) is executed five times.
MC
• While "Nest 1" is executed once, program (2) in "Nest 2" is executed four times.
MCR
This means that program (2) is executed a total of (5 x 4=) 20 times. CALL
• While "Nest 2" is executed once, program (3) in "Nest 3" is executed three times. SBN
RET
This means that program (3) is executed a total of (5 x 4 x 3=) 60 times.
FOR
NEXT
BREAK
Operation flag
The operation flag does not change state.
Execution Timing
The instruction is executed at every scan.
3-39
3-5 Flow Instructions
Sample Program
16-bit unsigned binary data currently stored to data memories DM00000 to DM00099 is added, and
the calculation result is stored to DM00100. Data is added in order from DM00000, and when the
APPLIED INSTRUCTIONS
result exceeds 1000, the calculation is stopped. At which data block the calculation was stopped is
stored to DM00101.
FOR
#00100
3 DM00100
>=
BREAK
#01000
Flow Instructions
NEXT
3-40
3-5 Flow Instructions
APPLIED INSTRUCTIONS
3
Flow Instructions
MC
MCR
CALL
SBN
RET
FOR
NEXT
BREAK
3-41
3-5 Flow Instructions
3
Flow Instructions
3-42
4-1 Data Move Instructions
4-1
4-1 Data Move Instructions
ARITHMETIC OPERATION INSTRUCTIONS
STA.D
Data Move Instructions
STA.L
Trimmer setting TMIN Stores numerical values set by the digital trimmer in 4-12
value input the access window to internal registers.
Move MOV(.U) Stores 16/32-bit data to a specified device. 4-14
MOV.S
MOV.D
MOV.L
Block move BMOV Moves 16/32-bit data in blocks to a specified device. 4-18
Fill move FMOV(.U) Batch moves the same 16/32-bit data to a specified 4-20
FMOV.S device.
FMOV.D
FMOV.L
DM01000: #00800
DM01001: #00200
DM01002: #00700
DM01003: #01000
DM01004: #00500
DM01005: #00600
DM01006: #00300
DM01007: #00100
DM01008: #00900
DM01009: #00400
4-2
4-1 Data Move Instructions
[Example] Let's assume that input relay 00000 is OFF when the program is started up.
00000 MOV
#010000 DM00000 The content of DM00000 is #00000.
OFF
00000 MOV
#010000 DM00000 The content of DM00000 becomes #01000.
ON
00000 MOV
4
4-3
DW(.U)
4-1 Data MoveDW.D
Instructions
DW
DW DW.S
DW.L
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition S
DW @ D W S D
D
S — — — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — — —
4
S : Specifies the constant to store to data memory or control memory.
Data Move Instructions
S D
1234 1234
16 bits
(1 word)
DW.S The 16-bit signed binary data specified by S is stored to the data memory (DM)
or control memory (CM) specified by D .
S D
–1234 –1234
16 bits
(1 word)
Operation flag
The operation flag does not change state.
4-4
4-1 Data Move Instructions
DW.D The 32-bit unsigned binary data specified by S is stored to the data memory (DM)
or control memory (CM) specified by D / D +1.
S D +1 D
12345678 12345678
32 bits
(2 words)
DW.L The 32-bit signed binary data specified by S is stored to the data memory (DM)
or control memory (CM) specified by D / D +1.
S D +1 D
4
–12345678 –12345678
Operation flag
The operation flag does not change state.
Execution Timing
DW(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
DW
@DW(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution LDA
condition. STA
TMIN
Scan MOV
BMOV
ON
Sample Program
When input relay 00000 is ON, #00100 is stored to data memory DM00000.
00000 #00100
DW
DM00000
4-5
LDA(.U)
4-1 Data Move LDA.D
Instructions LDA
LDA LDA.S
LDA.L
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition S
LDA STA @ L D A S
S — — — * * — — —
4 S : Specifies the data to write to internal registers or the device to which that data is currently
stored.
Data Move Instructions
* When T and C are specified for the device, the current value is read.
* When a bit device is specified, data is handled as continuous 16/32 bits. When a part other
than the start of a channel (e.g. 00002, 00106, 01012) is specified, 16/32 bits are handled
spanning the next channel.
"MOV Instruction" page 4-14
"About Bit Devices" page 1-11
LDA(.U) The 16-bit unsigned binary data specified by S is stored to the 16-bit internal
register.
LDA.S The 16-bit signed binary data specified by S is stored to the 16-bit internal register.
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when the value read from the device specified to the operand is 0.
Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-6
4-1 Data Move Instructions
LDA.D The 32-bit unsigned binary data specified by S is stored to the 32-bit internal
register.
LDA.L The 32-bit signed binary data specified by S is stored to the 32-bit internal register.
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when the value read from the device specified to the operand is 0.
Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON. DW
STA
TMIN
BMOV
LDA(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
FMOV
condition is ON.
@LDA(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
Sample Program
See the sample program for the STA instruction.
"Sample Programs" page 4-10
4-7
STA(.U)
4-1 Data Move STA.D
Instructions STA
STA STA.S
STA.L Stores the data of internal registers to
ARITHMETIC OPERATION INSTRUCTIONS
Store A
@STA(.U) specified devices.
@STA.D
@STA @STA.S
STA
Execution condition D
LDA STA @ S T A D
D — — — — * * — — —
4 D : Specifies the No. of the device to store the internal register data to.
Data Move Instructions
* When T and C are specified for the device, the setting value is stored.
* When a bit device is specified, data is handled as continuous 16 bits. When a part other
than the start of a channel (e.g. 00002, 00106, 01012) is specified, data is not stored to
bits spanning the next channel.
"MOV Instruction" page 4-14
"About Bit Devices" page 1-11
STA.S The 16-bit signed binary data currently stored to 16-bit internal register is stored to the
device specified by D .
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-8
4-1 Data Move Instructions
STA.L The 32-bit signed binary data currently stored to 32-bit internal register is stored to the
device specified by D / D +1.
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON. DW
STA
TMIN
BMOV
STA(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
FMOV
condition is ON.
@STA(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-9
4-1 Data Move Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Sample Programs
Changing the timer setting values
To change the setting value within the range 0 to 65535
When input relay 00000 is ON, the setting value of timer T000 is set to #00100.
When input relay 00000 is OFF, the setting value of timer T000 is changed to the value currently
stored to data memory DM00000.
Note: About the current value when the setting value has been changed
• Operation as a result of executing the STA instruction:
When the current value > setting value, the current value is changed to the same
value as the setting value.
00001 MOV
C000 DM00100
4-10
4-1 Data Move Instructions
00015 00000
CR2002 00000 DM00000 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Input relay
LDA STA
LDA
STA
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 DM00000
The states of data memory DM00000 are output to output relays 00500 to 00515.
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Output rerey
[Tip]
When the bit device specified by the LDA operand spans channels, the states of the 16 bits
spanning across channels are stored to internal register.
1ch 0ch
00102 00003
DW
CR2002 00003 DM00000 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Input relay
LDA STA LDA
LDA STA
MOV
STA
BMOV
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 DM00000
FMOV
[Tip]
When the bit device specified by the STA operand spans channels, the data is not stored to bits
spanning across channels.
6ch 5ch
00602
STA 00503
? ? ? 0 1 0 1 0 1 0 1 0 1 0 1 0 Output relay
4-11
TMIN
4-1 Data Move Instructions
TMIN
Trimmer setting Inputs numerical values set by the digital trimmer
value input in the access window to internal registers.
ARITHMETIC OPERATION INSTRUCTIONS
@TMIN TMIN
Execution condition D
TMIN STA.D @ T M I N D
n — — — — — — — — — — — — — — — — — —
Explanation of Operation
When the execution condition is ON, the value of the digital trimmer is stored to 32-bit internal
register. For details on the function and how to operate the digital trimmers in the access window,
read the KV-700 User's Manual "Chapter 2 Access Window."
Digital trimmer of
Numerical value data
access window Input Move Move destination
of 0 to 4294967295
0 to 4294967295
[Tip]
Each of the upper limit values of the digital trimmers can be set.
To enable preset upper limit values, you must set using the MEMSW instruction.
"MEMSW Instruction" page 3-8
4-12
4-1 Data Move Instructions
Execution Timing
TMIN This instruction is executed at each scan for the duration that the execution
condition is ON.
@TMIN This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
Execution condition
ON
4
OFF
Sample Program
STA
00000 #65535 T000 00500 TMIN
T000
MOV
Output 00500 turns ON when the current value of T000 becomes "#00000". BMOV
4-13
MOV(.U)
4-1 Data Move Instructions MOV
MOV.D
MOV MOV.S
MOV.L
ARITHMETIC OPERATION INSTRUCTIONS
S — — — * * — — — —
4 D — — — — * * —
S : Specifies the source data to be moved or the leading device to which the data is currently
Data Move Instructions
stored.
D : Specifies the device (move destination) to store the data to.
* When devices T and C are specified, the current value becomes the move source (or move
destination).
* When a bit device is specified, data is handled as continuous 16 bits. When a part other
than the start of a channel (e.g. 00002, 00106, 01012) is specified, 16 bits are handled
spanning the next channel.
MOV(.U) The 16-bit unsigned binary data currently stored to the device specified by S is
stored to the device specified by D .
MOV.S The 16-bit signed binary data currently stored to the device specified by S is stored
to the device specified by D .
MOV
[Example] When the constant is specified by S #12345 DM00100
DM00099: 0 DM00099: 0
DM00101: 0 DM00101: 0
DM00102: 0 DM00102: 0
16 bits
(1 word)
4-14
4-1 Data Move Instructions
MOV
DM00098: 0 DM00098: 0
DM00100: 0 DM00100: 0
DM00102: 0 DM00102: 0
16 bits
(1 word)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
4
MOV.D The 32-bit unsigned binary data currently stored to the device specified by S / S
+1 is stored to the device specified by D / D +1.
DW
MOV.L The 32-bit signed binary data currently stored to the device specified by S / S
+1 is stored to the device specified by D / D +1. LDA
STA
TMIN
MOV.D
[Example] When the constant is specified by S #12345678 DM00014
MOV
BMOV
FMOV
State of data memory before instruction execution State of data memory after instruction execution
Upper Lower Upper Lower
MOV.D
[Example] When the device No. is specified by S DM00012 DM00016
State of data memory before instruction execution State of data memory after instruction execution
Upper Lower Upper Lower
4-15
4-1 Data Move Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
"About Indirect Specification" page 1-42
Execution Timing
MOV(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@MOV(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
4 Scan
Data Move Instructions
ON
Execution condition
OFF
Sample Program
When input relay 00000 is ON, the content of data memory DM00000 is moved to DM00100.
00000 MOV
DM00000 DM00100
00000 MOV
#100 C000
00000 MOV
DM00000 C000
• Even if values are changed by a suffix .U instruction, the value is automatically extended to 32 bits,
and is stored to the current value of the counter.
4-16
4-1 Data Move Instructions
01015 01000
CR2002 MOV 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Internal auxiliary relays
01000 DM00000
MOV
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 DM00000
[Tip]
When the bit device specified by the No.1 operand spans channels, the states of the 16 bits
spanning across channels are stored to DM00000.
1ch 0ch
00102 00003
CR2002 MOV 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Input relay
00003 DM00000
MOV
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 DM00000
4
DW
LDA
STA
TMIN
MOV
BMOV
FMOV
4-17
BMOV
BMOV
4-1 Data Move Instructions
Moves 16/32-bit data in blocks to a speci-
Block move
fied device.
ARITHMETIC OPERATION INSTRUCTIONS
BMOV
@BMOV
Ladder program Input method
Execution condition BMOV
S D n B M O V S D n
S — — — — — — — — — — — — —
D — — — — — — — — — —
n — — — — — — — — — — — — — — —
S Move D
S +1 Move D +1
S +2 Move D +2
...
...
...
S + n -2 Move D + n -2
S + n -1 Move D + n -1
[Example]
DM00100: 1 1 :TM104
DM00101: 3 3 :TM105
DM00102: 7 7 :TM106
DM00103: 15 15 :TM107
DM00104: 31 31 :TM108
16 bits 16 bits
(1 word) (1 word)
• Data blocks at the move source and move destination will not be moved if they are partially
duplicated.
4-18
4-1 Data Move Instructions
Execution Timing
BMOV(.U) This instruction is executed at each scan for the duration that the execution
condition is ON.
@BMOV(.U) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
00000 BMOV
DM00000 DM00100 #00010
DW
LDA
STA
TMIN
MOV
BMOV
FMOV
4-19
FMOV(.U)
4-1 Data Move Instructions FMOV
FMOV.D
FMOV FMOV.S
FMOV.L Batch moves the same 16/32-bit
ARITHMETIC OPERATION INSTRUCTIONS
Fill move
@FMOV(.U) data to a specified device.
FMOV
@FMOV.D
@FMOV @FMOV.S
@FMOV.L
S — — — * * — — —
D — — — — — — — — — —
4 n — — — — — — — — — — — — — — —
Data Move Instructions
S : Specifies the move source data or the device to which the data is currently stored.
D : Specifies the leading device of the move destination data block.
n : Specifies the number of data items to move.
* When devices T and C are specified, each of their current values becomes the specified
target.
* Specify the leading channel No. (0000, 0100, 0200 and so forth) as the bit device to be
specified by D . A number midway in the channel (0001, 0102, 0203, and so forth)
cannot be specified.
FMOV(.U) The 16-bit unsigned binary data currently stored to the device specified by S is
moved to n words starting from the device specified by D .
FMOV.S The 16-bit signed binary data currently stored to the device specified by S is moved
to n words starting from the device specified by D .
D
D +1
D +2
...
S
D + n -3
D + n -2
D + n -1
4-20
4-1 Data Move Instructions
Move destination
123 :TM104
Move source 123 :TM105
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state 4
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
FMOV.D The 32-bit unsigned binary data currently stored to the device specified by S / S
+1 is stored to n x 2 words starting from the device specified by D / D +1.
DW
FMOV.L The 32-bit signed binary data currently stored to the device specified by S / S LDA
+1 is stored to n x 2 words starting from the device specified by D / D +1. STA
TMIN
[ D . D +1] MOV
BMOV
[ D +2 . D +3]
FMOV
[ D +4 . D +5]
.
...
[ S S +1]
[ D +2(n–3) . D +2(n–3)+1]
[ D +2(n–2) . D +2(n–2)+1]
[ D +2(n–1) . D +2(n–1)+1]
4-21
4-1 Data Move Instructions
ARITHMETIC OPERATION INSTRUCTIONS
[Example]
S :DM00100, FMOV.D
D :TM104. DM00100 TM104 #00005
n :In case of #00005
Move destination
Upper Lower
Operation flag
CR2009 .......... No change in state
4 CR2010 .......... No change in state
Data Move Instructions
Execution Timing
FMOV(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@FMOV(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
Sample Program
When input relay 00000 is ON, "0" is stored to all data memories DM00000 to DM00099.
00000 FMOV
#00000 DM00000 #00100
4-22
4-1 Data Move Instructions
LDA
STA
TMIN
MOV
BMOV
FMOV
4-23
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
4-24
4-2 Arithmetic/Comparison Instructions
Underflow
Overflow
Underflow
65533 FFFD
-4
Overflow
Underflow
65532 FFFC
...
...
...
32771 -32765 8003
32770 -32766
8002
32769 -32767
8001
32768 -32768
8000
32767 32767 7FFF
32766
32765
32764
32766
32765
7FFE
7FFD
4
32764 7FFC
32763
Arithmetic/Comparison Instructions
32763 7FFB
4294967293 -3 FFFFFFFD
4294967292 -4 FFFFFFFC
Overflow
Underflow
...
...
...
4-25
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
The following five types of data formats can be handled in arithmetic calculation operations.
The data format is judged by the suffix appended to the instruction.
* For details on floating point real numbers, see "Floating point real numbers" ( page 1-23).
An overflow or underflow occurs of the result of addition (ADD instruction) or subtraction (SUB
instruction) exceeds the data format range.
● In case of .U (0 to 65535)
ADD.U 2
4 1
Overflow
When the operation result exceeds 65535
0
[Example] 65535 + 4 = 5
Arithmetic/Comparison Instructions
65535
65534
and the operation flag CR3009 turns ON.
65533
SUB.U 2
1
Underflow
When the operation result falls below 0
0
[Example] 4 – 5 = 65535 65535
65534
and the operation flag CR2009 turns ON.
65533
SUB.S
–32766
When the operation result falls below –32767, the operation
Underflow
–32767
result becomes a plus number. –32768
+32767
[Example] –32766 – 3 = +32767
+32766
and the operation flag CR2009 turns ON. +32765
4-26
4-2 Arithmetic/Comparison Instructions
Overflow
0
[Example] 4294967295 + 5 = 4 4294967295
SUB.D 2
1
Underflow
When the operation result falls below 0
0
[Example] 4 – 5 = 4294967295 4294967295
and the operation flag CR2009 turns ON. 4294967294
4294967293
Overflow
When the operation result exceeds +2147483647, the opera-
–2147483648
tion result becomes a minus number.
Arithmetic/Comparison Instructions
+2147483647
[Example] +2147483647 + 3 = –2147483646 +2147483646
+2147483657
and the operation flag CR2009 turns ON.
SUB.L –2147483646
Underflow
When the operation result falls below –2147483648, the opera- –2147483647
4-27
ADD(.U)
4-2 Arithmetic/Comparison
ADD.D Instructions
ADD ADD.S
ADD.L
ADD
Adds the value specified by the operand to the
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition S
LDA ADD STA @ A D D S ( @ + S )
S — — — — — — — — — — — —
S : Specifies the addition data or the device to which the data is currently stored.
4 The data range that can be handled varies according to the suffix type.
Arithmetic/Comparison Instructions
[Tip]
The ADD and @ADD instructions perform addition in binary. When values stored to internal
register are BCD, convert these values to binary by the TBIN instruction.
"TBIN Instruction" page 4-92
ADD.(.U) 16-bit unsigned binary data and unsigned data in the 16-bit internal register are added,
and the result is stored to the 16-bit internal register.
16-bit internal register S 16-bit internal register
ADD.S 16-bit signed binary data and signed data in the 16-bit internal register are added, and
the result is stored to the 16-bit internal register.
16-bit internal register S 16-bit internal register
4-28
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
32 bits 32 bits 32 bits
(2 words)
[Tip]
The ADD and @ADD instructions perform addition in binary. When values stored to internal
register are BCD, convert these values to binary by the TBIN instruction.
"TBIN Instruction" page 4-92
ADD.D 32-bit unsigned binary data and unsigned data in the 32-bit internal register are
added, and the result is stored to the 32-bit internal register.
32-bit internal register S +1 S 32-bit internal register ADD
ROOT
ADD.L 32-bit signed binary data and signed data in the 32-bit internal register are added, and CMP
the result is stored to the 32-bit internal register.
ZCMP
Operation flag
CR2009 .......... ON when the result exceeds (overflows/underflows) the 32-bit range.
Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-29
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Execution Timing
ADD(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@ADD(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
Sample Program
4 Each time that input relay 00000 turns ON, constant 100 is added to data memory DM00000, and
the result is stored to DM00100.
Arithmetic/Comparison Instructions
Each time that input relay 00001 turns ON, constant –100 is added to data memory DM00100, and
the result is stored to DM00110.
Each time that input relay 00002 turns ON, constant 100000 is added to data memory DM00200,
and the result is stored to DM00210.
Each time that input relay 00003 turns ON, constant –100000 is added to data memory DM00300,
and the result is stored to DM00310.
4-30
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
ADD
SUB
MUL
DIV
INC
DEC
ROOT
CMP
ZCMP
4-31
SUB(.U)
4-2 Arithmetic/Comparison
SUB.D Instructions
SUB SUB.S
SUB.L
SUB
Subtracts the value specified by the operand
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition S
LDA SUB STA @ S U B S
S — — — — — — — — — — — *
* SUB(.U) only
4 S : Specifies the subtraction data or the device to which the data is currently stored.
Arithmetic/Comparison Instructions
The data range that can be handled varies according to the suffix type.
"About Suffixes" page 1-28
16-bit internal
register S = 16-bit internal
register
16 bits 16 bits 16 bits
(1 word)
[Tip]
The SUB and @SUB instructions perform subtraction in binary. When values stored to internal
register are BCD, convert these values to binary by the TBIN instruction.
"TBIN Instruction" page 4-92
SUB.(.U) Unsigned data in the 16-bit internal register is subtracted from 16-bit unsigned binary
data, and the result is stored to the 16-bit internal register.
16-bit internal register S 16-bit internal register
SUB.S Signed data in the 16-bit internal register is subtracted from 16-bit signed binary data,
and the result is stored to the 16-bit internal register.
16-bit internal register S 16-bit internal register
4-32
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
32 bits 32 bits 32 bits
(2 words)
[Tip]
The SUB and @SUB instructions perform subtraction in binary. When values stored to internal
register are BCD, convert these values to binary by the TBIN instruction.
"TBIN Instruction" page 4-92
SUB.D Unsigned data in the 32-bit internal register is subtracted from 32-bit unsigned binary
data, and the result is stored to the 32-bit internal register.
32-bit internal register S +1 S 32-bit internal register ADD
CMP
SUB.L Signed data in the 32-bit internal register is subtracted from 32-bit signed binary data, ZCMP
4-33
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Operation flag
CR2009 .......... ON when the result exceeds (overflows/underflows) the 32-bit range. Otherwise,
OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
Execution Timing
SUB(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@SUB(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
4
Scan
Arithmetic/Comparison Instructions
ON
Execution condition
OFF
Sample Program
Each time that input relay 00000 turns ON, 100 is subtracted from data memory DM00000, and the
result is stored to DM00100.
Each time that input relay 00001 turns ON, constant –100 is subtracted from data memory
DM00100, and the result is stored to DM00110.
Each time that input relay 00002 turns ON, constant 100000 is subtracted to data memory DM00200,
and the result is stored to DM00210.
Each time that input relay 00003 turns ON, constant –100000 is subtracted from data memory
DM00300, and the result is stored to DM00310.
4-34
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
ADD
SUB
MUL
DIV
INC
DEC
ROOT
CMP
ZCMP
4-35
MUL(.U)
4-2 Arithmetic/Comparison
MUL.D Instructions
MUL
MUL MUL.S
MUL.L
Multiplies the value specified by the operand with
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition S
LDA MUL STA @ M U L S ( @ * S )
S — — — — — — — — — — — —
S : Specifies the multiplication data or the device to which the data is currently stored.
4 The data range that can be handled varies according to the suffix type.
Arithmetic/Comparison Instructions
register
16-bit internal
upper 16 bits of the 32-bit internal register
16 bits 16 bits TM000 register and to TM000.
(1 word)
32 bits
[Tip] (2 words)
The MUL and @MUL instructions perform multiplication in binary. When values stored to internal
register are BCD, convert these values to binary by the TBIN instruction.
"TBIN Instruction" page 4-92
MUL(.U) Unsigned data in the 16-bit internal register is multiplied with 16-bit unsigned binary
data, and the result is stored to the 32-bit internal register.
32-bit internal register
MUL.S Signed data in the 16-bit internal register is multiplied with 16-bit signed binary data,
and the result is stored to the 32-bit internal register.
32-bit internal register
4-36
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
32-bit internal register S +1 S TM001 TM000 32-bit internal register
+
[Tip]
The MUL and @MUL instructions perform multiplication in binary. When values stored to internal
register are BCD, convert these values to binary by the TBIN instruction.
"TBIN Instruction" page 4-92
MUL.D 32-bit unsigned binary data and unsigned data in the 32-bit internal register are
multiplied, and the result is stored to the 32-bit internal register and TM000 and TM001.
ADD
SUB
MUL.L 32-bit signed binary data and signed data in the 32-bit internal register are multiplied, ROOT
and the result is stored to the 32-bit internal register and TM000 and TM001. CMP
ZCMP
32-bit internal register S +1 S TM001 TM000 32-bit internal register
Operation flag
CR2009 .......... ON when the result exceeds (overflows/underflows) the 32-bit range.
Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-37
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Execution Timing
MUL(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@MUL(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4 Sample Program
MUL.U
Arithmetic/Comparison Instructions
When input relay 00000 is ON, the 16-bit unsigned binary data currently stored to DM00001 is
multiplied with the 16-bit unsigned binary data currently stored to data memory DM00000, and the
result is stored to DM00010. When input relay 00000 is OFF, constant 100 is multiplied with
DM00000.
The result is stored to DM0010. The result is stored to DM00010/DM00011 when it exceeds the 16-
bit range.
or
4-38
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
00000 DM00000 DM00001 DM00010
LDA.S MUL.S STA.L
00000 DM00000 –100 DM00010
LDA.S MUL.S STA.L
or
DIV
INC
DEC
ROOT
CMP
ZCMP
4-39
DIV(.U)
4-2 Arithmetic/Comparison
DIV.D Instructions
DIV
DIV DIV.S
DIV.L
Divides the value of the internal register with the
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition S
LDA DIV STA @ D I V S
S — — — — — — — — — — — —
4 S : Specifies the division data or the device to which the data is currently stored.
The data range that can be handled varies according to the suffix type.
Arithmetic/Comparison Instructions
TM000
16-bit internal
register ÷ S = Upper Lower
16-bit internal
Remainder: TM001
32 bits 16 bits TM000 register 16 bits
(2 words) (1 word) (1 word)
32 bits
(2 words)
* The upper 16 bits of the quotient are stored to both the upper
16 bits of the 32-bit internal register and to TM000.
[Tip]
The DIV and @DIV instructions perform division in binary. When values stored to internal register
are BCD, convert these values to binary by the TBIN instruction.
"TBIN Instruction" page 4-92
DIV(.U) The 32-bit unsigned binary data of the internal register and TM000 is divided by the 16-
bit unsigned binary data. The result is stored to the 32-bit internal register, and the
remainder is stored to TM0001.
32-bit internal register
DIV.S The 32-bit signed binary data of the internal register and TM000 is divided by the 16-
bit signed binary data. The result is stored to the 32-bit internal register, and the
remainder is stored to TM0001.
32-bit internal register
4-40
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
TM001 TM000 32-bit internal register S +1 S TM001 TM000 32-bit internal register
DIV.D The 64-bit unsigned binary data stored to TM000 and TM001, and to the 32-bit internal
register is divided by the 32-bit unsigned binary data. The result is stored to the 32-
bit internal register and to TM000 and TM001, and the remainder is stored to TM0002
and TM003.
TM001 TM000 32-bit internal register TM001 TM000 32-bit internal register
DIV.L The 64-bit signed binary data stored to TM000 and TM001, and to the 32-bit internal INC
register is divided by the 32-bit signed binary data. The result is stored to the 32-bit DEC
internal register and to TM000 and TM001, and the remainder is stored to TM0002 and ROOT
TM003. CMP
TM001 TM000 32-bit internal register TM001 TM000 32-bit internal register ZCMP
–12345678 ÷ 100 = –123456
64 bits 32bits 64 bits
(2 words) TM003 TM002
Remainder: –78
32bits
(2 words)
Operation flag
CR2009 .......... ON when quotient overflows. Otherwise, OFF
* The quotient overflows only when the suffix is .L and –2147483648 is divided
by "-1".
CR2010 .......... ON when the quotient is "0" as a result of arithmetic calculation. Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when the multiplier (value of device specified by the operand) is "0" or the
indirect specification range specified to the operand is inappropriate.
Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-41
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Execution Timing
DIV(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@DIV(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4 Sample Program
When input relay 00000 is ON, #10000 is divided by the 16-bit unsigned binary data currently stored
Arithmetic/Comparison Instructions
to data memory DM00000 is divided. The result is stored to DM00010, and the remainder is stored
to DM00020.
00000 #10000 DM00000 DM00010
LDA EXT DIV STA
TM001 DM00020
LDA STA
When input relay 00001 is ON, the 32-bit signed binary data currently stored to data memories
DM00100/DM00101 is divided by the 16-bit signed binary data currently stored to data memory
DM00000. The result is stored to DM00010/DM00011, and the remainder is stored to DM00020.
16-bit internal
TM000 register ÷ S
32 bits 16 bits
(2 words) (1 word)
[Example] 16-bit binary data currently stored to data memory DM00000 is divided by 16-bit
binary data currently stored to DM00001. The quotient is stored to DM00020.
CR2002 DM00000 DM00001 DM00020
LDA EXT DIV STA
4-42
4-2 Arithmetic/Comparison Instructions
[Example] 32-bit binary data currently stored to data memories DM00000/DM00001 is divided
by 32-bit binary data currently stored to DM00010/DM00011. The result is stored
to DM00021.
Arithmetic/Comparison Instructions
Though the MUL(.U) and MUL.S instructions perform multiplication by 16-bit data, the result is
calculated by 32-bit data. The DIV.U and DIV.S instructions divide 32-bit data by 16-bit data.
For this reason, when performing multiplication and division operations continuously, operations
are execution successfully even if the product exceeds the 16-bit range during calculations.
[Example] The 16-bit unsigned binary data currently stored to data memory DM00000 that
changes from 0 to 4000 is scaled to 0 to 10000, and stored to DM00001.
SUB
MUL
When the value of DM00000 is #00010
DIV
INC
10 x 10000 ÷ 4000 = 25
DEC
On overflow occurs as the data is handled as 16-bit data. ROOT
On the PLC, however, the data is handled as 32-bit data. CMP
ZCMP
Likewise, though the MUL(.D) and MUL.L instructions perform multiplication by 32-bit data, the
result is calculated by 64-bit data. The DIV.D and DIV.L instructions divide 64-bit data by 32-bit
data.
For this reason, when performing multiplication and division operations continuously, operations
are execution successfully even if the product exceeds the 32-bit range during calculations.
4-43
INC(.U)
4-2 Arithmetic/Comparison
INC.D Instructions
INC
INC INC.S
INC.L Increments the device specified by the
ARITHMETIC OPERATION INSTRUCTIONS
Increment memory
@INC(.U) operand by one.
@INC.D
@INC @INC.S
INC
@INC.L
Execution condition D
INC @ I N C D
D — — — — — — — — — — — — — — —
[Tip]
When the INC and INC.S instructions are executed at every scan, "1" is added at each scan for
the duration that the execution condition is ON. If the INC and INC.S instructions are executed
not at each scan but at the up edge of the execution condition, use the differential type execution
instruction (@INC and @INC.S) as follows.
DM00000
INC
DM00000
INC
01000 01000 DM00000
DIFU INC
4-44
4-2 Arithmetic/Comparison Instructions
When the content of the device before the operation is #4294967295, the result of the
operation becomes #0, and an overflow occurs.
"Cautions relating to arithmetic calculation instructions" page 4-2
INC.L When the execution condition is ON, "1" is added to the signed data of the device
specified by D / D + 1, and the result is stored to the device specified by D /
4
Arithmetic/Comparison Instructions
D +1.
When the content of the device before the operation is #2147483647, the result of the
operation becomes #–2147483648, and an overflow occurs.
"Cautions relating to arithmetic calculation instructions" page 4-2
[Tip]
When the INC.D and INC.L instructions are executed at every scan, "1" is added at each scan
for the duration that the execution condition is ON. If the INC.D and INC.L instructions are
executed not at each scan but at the up edge of the execution condition, use the differential type
execution instruction (@INC.D and @INC.L) as follows.
ADD
SUB
DM00000
INC.D MUL
DIV
DM00000
INC.D INC
CMP
"LDP Instruction ( )" page 2-10 ZCMP
Operation flag
CR2009 .......... ON when the result exceeds (overflows) the 32-bit range. Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... No change in state
4-45
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Execution Timing
INC(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@INC(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4 Sample Program
The total of input relays 00000 to 00003 is counted, and the result is stored to data memory
Arithmetic/Comparison Instructions
DM00000.
00000 DM00000
INC
00001 DM00000
INC
00002 DM00000
INC
00003 DM00000
INC
4-46
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
ADD
SUB
MUL
DIV
INC
DEC
ROOT
CMP
ZCMP
4-47
DEC(.U)
4-2 Arithmetic/Comparison
DEC.D Instructions
DEC
DEC DEC.S
DEC.L Decrements the device specified by
ARITHMETIC OPERATION INSTRUCTIONS
Decrement memory
@DEC(.U) the operand by one.
@DEC.D DEC
@DEC @DEC.S
@DEC.L
Execution condition D
DEC @ D E C D
D — — — — — — — — — — — — — — —
DEC.S When the execution condition is ON, "1" is subtracted the signed data of the device
specified by D , and the result is stored to the device specified by D .
When the content of the device before the operation is #–32768, the result of the
operation becomes #32767, and an overflow occurs.
"Cautions relating to arithmetic calculation instructions" page 4-25
[Tip]
When the DEC and DEC.S instructions are executed at every scan, "1" is added at each scan
for the duration that the execution condition is ON. If the DEC and DEC.S instructions are
executed not at each scan but at the up edge of the execution condition, use the differential type
execution instruction (@DEC and @DEC.S) as follows.
DM00000
DEC
DM00000
DEC
01000 01000 DM00000
DIFU DEC
4-48
4-2 Arithmetic/Comparison Instructions
When the content of the device before the operation is #0, the result of the operation
becomes #4294967295, and an overflow occurs.
"Cautions relating to arithmetic calculation instructions" page 4-25
4
DEC.L When the execution condition is ON, "1" is subtracted from the signed data of the
Arithmetic/Comparison Instructions
device specified by D / D +1, and the result is stored to the device specified by
D / D +1.
When the content of the device before the operation is #–2147483648, the result of the
operation becomes #2147483647, and an overflow occurs.
"Cautions relating to arithmetic calculation instructions" page 4-25
[Tip]
When the DEC.D and DEC.L instructions are executed at every scan, "1" is added at each scan
for the duration that the execution condition is ON. If the DEC.D and DEC.L instructions are
executed not at each scan but at the up edge of the execution condition, use the differential type ADD
execution instruction (@DEC.D and @DEC.L) as follows. SUB
MUL
DM00000 DIV
DEC.D
INC
DM00000
DEC
DEC.D
ROOT
01000 01000 DM00000
DIFU DEC.D CMP
ZCMP
Operation flag
CR2009 .......... ON when the result exceeds (underflows) the 32-bit range. Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... No change in state
4-49
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Execution Timing
DEC(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@DEC(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4 Sample Program
The value of data memory DM00000 is decremented by "1" at each respective up edge of input
Arithmetic/Comparison Instructions
00000 DM00000
DEC
00001 DM00000
DEC
00002 DM00000
DEC
4-50
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
ADD
SUB
MUL
DIV
INC
DEC
ROOT
CMP
ZCMP
4-51
ROOT(.U)
4-2 Arithmetic/Comparison
ROOT.D Instructions
ROOT
ROOT ROOT.S
ROOT.L
Calculates the square root of the
ARITHMETIC OPERATION INSTRUCTIONS
@ROOT.L
Execution condition
LDA ROOT STA @ R O O T
— — — — — — — — — — — — — — — — — — — *
* CR2012 changes state
The data range that can be handled varies according to the suffix type.
4 "About Suffixes" page 1-28
only with the ROOT.S
and ROOT.L instruc-
tions.
Arithmetic/Comparison Instructions
Upper Lower
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... Only when the value to be calculated is a minus value only when the ROOT.S
instruction is executed. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
4-52
4-2 Arithmetic/Comparison Instructions
ROOT.L When the execution condition is ON, the square root of the 64-bit signed binary data
currently stored to temporary data memories TM000 and TM001, and the 32-bit
internal register is calculated, and is stored again to the 32-bit internal register.
Decimal points in the calculation result are discarded.
"About Internal Registers" page 1-17
Arithmetic/Comparison Instructions
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... Only when the value to be calculated is a minus value only when the ROOT.L
instruction is executed. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
SUB
ROOT(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
MUL
condition is ON.
DIV
@ROOT(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution INC
condition. DEC
ROOT
CMP
Scan ZCMP
ON
Execution condition
OFF
Sample Program
When input relay 00000 is ON, the square root of 16-bit unsigned binary data currently stored to data
memory DM00000 is calculated, and the average value is stored to DM00010.
4-53
CMP(.U)
4-2 Arithmetic/Comparison
CMP.D Instructions
CMP
CMP CMP.S
CMP.L Compares the value currently stored to the
ARITHMETIC OPERATION INSTRUCTIONS
Compare
@CMP(.U) internal register with the specified binary data,
@CMP.D
@CMP @CMP.S
CMP
@CMP.L
S — — — — — — — — — — —
CMP.S The sizes of the 16-bit signed binary data currently stored to the 16-bit internal register
and the 16-bit signed binary data currently stored to the device specified by S are
compared. The operation flag changes as follows according to the comparison results.
Operation flag
CR2009 .......... ON when the value to be compared (value of 16-bit internal register) is smaller than
the value currently stored to the specification operand ( S ). Otherwise, OFF
CR2010 .......... ON when the value to be compared (value of 16-bit internal register) is equal to the
value currently stored to the specification operand ( S ). Otherwise, OFF
CR2011 .......... ON when the value to be compared (value of 16-bit internal register) is greater than
the value currently stored to the specification operand ( S ). Otherwise, OFF
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
"About Indirect Specification" page 1-42
4-54
4-2 Arithmetic/Comparison Instructions
CMP.L The sizes of the 32-bit signed binary data currently stored to the 32-bit internal
register and the 32-bit signed binary data currently stored to the device specified by
S / S +1 are compared. The state of the operation flag changes as follows
according to the comparison results.
Arithmetic/Comparison Instructions
Operation flag
CR2009 ............ ON when the value to be compared (value of 32-bit internal register) is smaller than the
value currently stored to the specification operand ( S / S +1). Otherwise, OFF
CR2010 ............ ON when the value to be compared (value of 32-bit internal register) is equal to the
value currently stored to the specification operand ( S / S +1). Otherwise, OFF
CR2011 ............ ON when the value to be compared (value of 32-bit internal register) is greater than the
value currently stored to the specification operand ( S / S +1). Otherwise, OFF
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ADD
ate. Otherwise, OFF
SUB
The instruction is not executed when CR2012 has turned ON.
MUL
"About Indirect Specification" page 1-42
DIV
INC
ROOT
CMP(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution CMP
condition is ON.
ZCMP
@CMP(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-55
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Sample Program
#01000 is compared with the value currently stored to data memory DM00000.
Output relay 00500 turns ON when the value is smaller than #01000.
Output relay 00501 turns ON when the value equals #01000.
Output relay 00502 turns ON when the value is greater than #01000.
CR2010 00501
DM00000=1000
CR2011 00502
DM00000>1000
4 [Tip]
a b
Arithmetic/Comparison Instructions
Assuming LDA CMP that the internal register is a and the operand is b,
then,
CR2009
a<b
CR2011
a≤b
CR2010
a=b
CR2009
a≥b
CR2011
a>b
4-56
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
ADD
SUB
MUL
DIV
INC
DEC
ROOT
CMP
ZCMP
4-57
ZCMP(.U)
4-2 Arithmetic/Comparison
ZCMP.D Instructions
ZCMP
ZCMP ZCMP.S Compares the value currently stored to
ZCMP.L
ARITHMETIC OPERATION INSTRUCTIONS
@ZCMP.L
S1 — — — — — — — — — — —
S2 — — — — — — — — — — —
* The maximum value and minimum value are automatically judged whichever of
Arithmetic/Comparison Instructions
The data range that can be handled varies according to the suffix type.
"About Suffixes" page 1-28
ZCMP.S When the execution condition is ON, the sizes of the range specified by S1 and
S2 , and the 16-bit signed binary data currently stored to the internal register are
compared. The state of the operation flag changes as follows according to the
comparison results.
4-58
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
The state of the operation flag changes as follows according to the comparison results.
ZCMP.L When the execution condition is ON, the size of the range specified by S1 / S1 +1
and S2 / S2 +1 and the 32-bit signed binary data currently stored to 32-bit internal
register are compared.
The state of the operation flag changes as follows according to the comparison results.
ROOT
CMP
Operation flag ZCMP
CR2009 .......... ON when the value to be compared (value of internal register) is smaller than the
specified range (range specified by operand). Otherwise, OFF
CR2010 .......... ON when the value to be compared (value of internal register) is within the specified
range (range specified by operand). Otherwise, OFF
CR2011 .......... ON when the value to be compared (value of internal register) is greater than the
specified range (range specified by operand). Otherwise, OFF
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-59
4-2 Arithmetic/Comparison Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Execution Timing
ZCMP(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@ZCMP(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4
Sample Program
Arithmetic/Comparison Instructions
When the value currently stored to data memory DM00000 is greater than #02000, output relays
00500 turns ON.
When the value currently stored to DM00000 is #01000 to #02000, output relay 00501 turns ON.
When the value currently stored to DM00000 is less than #01000, output relay 00502 turns ON.
CR2009 00502
DM00000<1000<2000
4-60
4-2 Arithmetic/Comparison Instructions
Arithmetic/Comparison Instructions
ADD
SUB
MUL
DIV
INC
DEC
ROOT
CMP
ZCMP
4-61
4-3 Logical Arithmetic Operation Instructions
ARITHMETIC OPERATION INSTRUCTIONS
4-62
4-3 Logical Arithmetic Operation Instructions
4-63
ANDA(.U)
4-3 Logical Arithmetic Operation Instructions
ANDA ANDA.D
ANDA
Calculates the logical AND of values in
AND A internal registers and values specified by
ARITHMETIC OPERATION INSTRUCTIONS
@ANDA(.U)
@ANDA @ANDA.D
ANDA operands.
Execution condition S
LDA ANDA STA @ A N D A S
S — — — — — — — — —
S : Specifies the data to be logically ANDed or the device to which the data is currently stored.
"About Suffixes" page 1-28
4
Logical Arithmetic Operation Instructions
specified by S and the content of the internal register is calculated, and Internal register 0 0 1 1
the result is stored to the internal register. S 0 1 0 1
Internal register (Result) 0 0 0 1
The result of this operation is "1" only when both the internal register and
bits in the binary data specified by S are "1".
"About Internal Registers" page 1-17
ANDA(.U) The logical AND of the 16-bit binary data specified by S and the content of the 16-
bit internal register is calculated, and the result is stored to the 16-bit internal register.
bit bit
15 0
DM00000
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit AND bit
15 0
$00FF
S 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ANDA
bit bit
15 0
DM00000
16-bit internal register 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 STA
ANDA.D The logical AND of the 32-bit binary data specified by S / S +1 and the content
of the 32-bit internal register is calculated, and the result is stored to the 32-bit internal
register.
4-64
4-3 Logical Arithmetic Operation Instructions
Execution Timing
ANDA(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@ANDA(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan 4
Execution condition
OFF
Sample Program
The values of the 2-digit BCD digital switch (input relays 00000 to 00007) are stored to data memory
DM00000. ANDA
ORA
CR2002 00000 $00FF DM00000 EORA
LDA ANDA STA
COM
NEG
4-65
ORA(.U)
4-3 Logical Arithmetic Operation Instructions
ORA ORA.D ORA
Calculates the logical OR of values in internal
OR A
registers and values specified by operands.
ARITHMETIC OPERATION INSTRUCTIONS
@ORA(.U)
@ORA @ORA.D ORA
Execution condition S
LDA ORA STA @ O R A S
S — — — — — — — — —
S : Specifies the data to be logically ORed or the device to which the data is currently stored.
"About Suffixes" page 1-28
4
Logical Arithmetic Operation Instructions
ORA(.U) The logical OR of the 16-bit binary data specified by S and the content of the 16-
bit internal register is calculated, and the result is stored to the 16-bit internal register.
bit bit
15 0
DM00000
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit OR bit
15 0
$00FF
S 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ORA
bit bit
15 0
DM00000
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 STA
ORA.D The logical OR of the 32-bit binary data specified by S / S +1 and the content
of the 32-bit internal register is calculated, and the result is stored to the 32-bit internal
register.
4-66
4-3 Logical Arithmetic Operation Instructions
Execution Timing
ORA(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@ORA(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan 4
Execution condition
OFF
Sample Program
The current value of counter C000 is output at a 2-digit BCD to output relays 00500 to 00507.
ANDA
Note, however, that changing of the states of output relays 00508 to 00515 must be prevented.
ORA
CR2002 C000 $00FF DM00000 00500 The current value of C000 is converted to
LDA TBCD ANDA ORA STA BCD, and the lower two digits of BCD are left
behind in the 16-bit internal register.
The 16-bit internal register and DM00000 is
ORed and the result is output to output
relays 00500 to 00515.
4-67
EORA(.U)
4-3 Logical Arithmetic Operation Instructions
EORA EORA.D
EORA
Calculates the logical exclusive OR of
Exclusive OR values in internal registers and values
ARITHMETIC OPERATION INSTRUCTIONS
@EORA(.U)
@EORA @EORA.D
EORA specified by operands.
S — — — — — — — — —
S : Specifies the data to be exclusively ORed or the device to which the data is currently stored.
"About Suffixes" page 1-28
4
Logical Arithmetic Operation Instructions
specified by S and the content of the internal register is calculated, and Internal register 0 0 1 1
the result is stored to the internal register. S 0 1 0 1
Internal register (Result) 0 1 1 0
The result of this operation is "1" only when the internal register and bits
in the binary data specified by S are different.
"About Internal Registers" page 1-17
EORA(.U) The exclusive OR of the 16-bit binary data specified by S and the content of the
16-bit internal register is calculated, and the result is stored to the 16-bit internal
register.
bit bit
15 0
DM00000
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit EOR bit
15 0
$00FF
S 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 EORA
bit bit
15 0
DM00000
16-bit internal register 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 STA
EORA.D The exclusive OR of the 32-bit binary data specified by S / S +1 and the content
of the 32-bit internal register is calculated, and the result is stored to the 32-bit internal
register.
4-68
4-3 Logical Arithmetic Operation Instructions
Execution Timing
EORA(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@EORA(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan 4
Execution condition
OFF
Sample Program
When the setting value currently stored to data memory DM00000 matches the ON/OFF state of
input relays 30000 to 30007, output relay 00500 is turned ON. ANDA
ORA
CR2008 $00AA DM00000 EORA
LDA STA
COM
bit bit
15 0
$00FF 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 Operand
bit bit
15 0
4-69
COM(.U)
4-3 Logical Arithmetic Operation Instructions
COM COM.D COM
@COM(.U)
@COM @COM.D COM
Execution condition
LDA COM STA @ C O M
— — — — — — — — — — — — — — — — — — — —
4
Explanation of Operation
Logical Arithmetic Operation Instructions
COM When the execution condition is ON, each of the bits in 16-bit internal registers is
inverted (0→1, 1→0).
"About Internal Registers" page 1-17
[Example] bit
15
bit
0
COM.D When the execution condition is ON, each of the bits in internal registers is inverted
(0→1, 1→0).
"About Internal Registers" page 1-17
[Example] bit
31
bit bit
16 15
bit
0
[Tip]
When the COM instruction is executed at every scan, the bits are inverted at each scan for the
duration that the execution condition is ON. If the COM instruction is executed not at each scan
but at the up edge of the execution condition, use the differential type execution instruction
(@COM) as follows.
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA COM STA
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA COM STA
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... No change in state
4-70
4-3 Logical Arithmetic Operation Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
The states of input relays 00000 to 00003 are inverted and output to output relays 00500 to 00503.
ANDA
ORA
EORA
COM
NEG
4-71
NEG(.U)
4-3 Logical Arithmetic Operation Instructions
NEG NEG.D
NEG
@NEG(.U)
@NEG @NEG.D
NEG
Execution condition
LDA NEG STA @ N E G
— — — — — — — — — — — — — — — — — — — — —
The data range that can be handled varies according to the suffix type.
"About Suffixes" page 1-28
4
Logical Arithmetic Operation Instructions
Explanation of Operation
When the execution condition is ON, the plus/minus sign of the data currently stored to internal
registers is inverted (2's complement is calculated), and the result is stored to internal registers.
"About Internal Registers" page 1-17
NEG(.U) When the execution condition is ON, the plus/minus sign of the 16-bit data currently
stored to 16-bit internal registers is inverted (2's complement is calculated).
[Example]
bit bit
15 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 1
bit bit
15 0
NEG.U When the execution condition is ON, the plus/minus sign of the 32-bit data currently
stored to 32-bit internal registers is inverted (2's complement is calculated).
[Example]
bit bit bit bit
31 16 15 0
10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
bit bit
31 0
4-72
4-3 Logical Arithmetic Operation Instructions
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA NEG STA
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA NEG STA
Operation flag
The operation flag does not change state.
4
Execution Timing
Scan
ON
Execution condition
OFF
ORA
@NEG(.U/.D) 1 scan execution
EORA
COM
When input relay 00000 is ON, the difference between the 16-bit signed binary data currently stored
to data memories DM00000 and DM00001 is calculated, and the absolute value is stored to
DM00002.
4-73
4-4 Data Shift Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Word shift left WSL(.U) Shifts 16-bit data to the left. 4-86
4-74
4-4 Data Shift Instructions
4-75
SRA(.U)
4-4 Data Shift Instructions
SRA SRA.D
SRA
This instruction shifts the bit content of internal
Shift right A registers to the right by the specified number
ARITHMETIC OPERATION INSTRUCTIONS
@SRA(.U)
@SRA @SRA.D
SRA of bits.
Execution condition n
LDA SRA STA @ S R A S
n — — — — — — — — — — — — — — — — —
n : Specifies the number of bits to shift to the right. With the SRA.U instruction, the number of
bits can be specified within the range 1 to 16, and with the SRA.D instruction, the number
of bits can be specified within the range 1 to 32.
4 "About Suffixes" page 1-28
Data Shift Instructions
bit ( n –1)
bit bit
15 0
16-bit internal
register 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
16-bit internal 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
register
Upper n bit Delete
Store "0". 1
CR2009
(Carry)
SRA.D When the execution condition is ON, the state of the 32-bit internal register is shifted
to the right by specified n bits.
"0" is stored to the upper n bits, the state of bit( n –1) is stored to CR2009, and
the result is stored to the 32-bit internal register.
"About Internal Registers" page 1-17
bit ( n –1)
bit bit
31 0
32-bit internal
register 1 1 1 0 10 0 0 0 0 0 1 1 0 0 1 1 11 0 10 0 0 0 0 0 1 1 0 0 1
32-bit internal
register 0 0 0 0 01 1 1 0 1 0 0 0 0 0 0 1 10 0 11 1 1 0 1 0 0 0 0 0 0 1 10 0 1
Store "0". 1
CR2009
(Carry)
4-76
4-4 Data Shift Instructions
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA SRA STA
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA SRA STA
Operation flag
CR2009 .......... ON when a carry is stored after the operation. Otherwise, OFF
CR2010 .......... ON when the operation result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... No change in state 4
Scan
ON
Execution condition
OFF
SRA(.U/.D) SRA
Execution Execution
SLA
RLA
WSR
Sample Program WSL
The BCD data (two digit's worth) from the digital switch entered to input relays 30008 to 30015 is
stored to data memory DM00000.
30000 #08 DM00000
LDA SRA STA
Digital switch
2 4
30015 30000
0 0 1 0 0 1 0 0 30000 to 30015
LDA
0 0 1 0 0 1 0 0 Internal register
SRA
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 Internal register
STA
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 DM00000
4-77
SLA(.U)
4-4 Data Shift Instructions
SLA SLA.D
SLA
This instruction shifts the bit content of internal
Shift left A registers to the left by the specified number of
ARITHMETIC OPERATION INSTRUCTIONS
@SLA(.U)
@SLA @SLA.D
SLA bits.
Execution condition n
LDA SLA STA @ S L A S
n — — — — — — — — — — — — — — — — —
n : Specifies the number of bits to shift to the left. With the SLA.U instruction, the number of bits
can be specified within the range 1 to 16, and with the SLA.D instruction, the number of bits
can be specified within the range 1 to 32.
4
"About Suffixes" page 1-28
Data Shift Instructions
bit (16 – n )
bit bit
15 0
16-bit internal
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 register
16-bit internal
1 11 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 register
Delete Lower n bit
1
Store "0".
CR2009
(Carry)
SLA.D When the execution condition is ON, the state of the 32-bit internal register is shifted
to the left by specified n bits.
"0" is stored to the lower n bits, the state of bit(32- n ) is stored to CR2009, and
the result is stored to the 32-bit internal register.
"About Internal Registers" page 1-17
bit (32 – n )
bit bit
31 0
32-bit internal
1 1 1 0 10 0 0 0 0 0 1 1 0 0 1 1 11 0 10 0 0 0 0 0 1 1 0 0 1 register
32-bit internal
1 11 0 10 0 0 0 00 1 1 0 0 1 1 1 1 0 1 0 00 0 00 1 1 0 0 1 0 0 0 0 0 register
Delete Lower n bit
1 Store "0".
CR2009
(Carry)
4-78
4-4 Data Shift Instructions
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA SLA STA
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA SLA STA
Operation flag
CR2009 .......... ON when a carry is stored after the operation. Otherwise, OFF
CR2010 .......... ON when the operation result is 0 (zero). Otherwise, OFF
4
CR2011 .......... No change in state
Execution Timing
SLA(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@SLA(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
SRA
ON
SLA
Execution condition
OFF RRA
RLA
SLA(.U/.D) Execution Execution
WSR
WSL
@SLA(.U/.D) 1 scan execution
Sample Program
The 2-digit BCD data currently stored to each of data memories DM00000 and DM00001 are stored
to DM00000 as 4-digit BCD data with the DM00001 as the upper two digits.
DM00000
34 DM00010
DM00001 1234
12
4-79
RRA(.U)
4-4 Data Shift Instructions
RRA RRA.D
RRA
This instruction rotates the bit content of
Rotate right A internal registers to the right by the speci-
ARITHMETIC OPERATION INSTRUCTIONS
@RRA(.U)
@RRA @RRA.D
RRA fied number of times.
Execution condition n
LDA RRA STA @ R R A n
n — — — — — — — — — — — — — — — — —
n : RRA(.U) specifies the number of times that the bit content is to be rotated to the right within
the range 1 to 16.
4 RRA.D specifies the number of times that the bit content is to be rotated to the right within
the range 1 to 32.
Data Shift Instructions
bit bit
CR2009 15 0
CR2009
1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1
(Carry)
Rotate n times (The above processing is repeated n times.)
bit bit
CR2009 15 0
RRA.D When the execution condition is ON, the bit content of 32-bit internal registers is rotated
to the right for the number of times specified by n . The state of the carry flag
(CR2009) is entered to the MSB.
(The following operation is repeated n number of times.)
bit bit bit bit
CR2009 31 16 15 0
CR2009
1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
(Carry)
4-80
4-4 Data Shift Instructions
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA RRA STA
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA RRA STA
Operation flag
CR2009 .......... ON when a carry is stored after the operation. Otherwise, OFF
CR2010 .......... ON when the operation result is 0 (zero). Otherwise, OFF
4
CR2011 .......... No change in state
Execution Timing
RRA(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@RRA(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
SRA
ON
SLA
Execution condition
OFF RRA
RLA
RRA(.U/.D) Execution Execution
WSR
WSL
@RRA(.U/.D) 1 scan execution
Sample Program
Of the error sensors connected to input relays 30000 to 30015, the number of sensors that are
currently outputting an error is stored to data memory DM00000.
4-81
RLA(.U)
4-4 Data Shift Instructions
RLA RLA.D
RLA
This instruction rotates the bit content of
Rotate left A internal registers to the left by the specified
ARITHMETIC OPERATION INSTRUCTIONS
@RLA(.U)
@RLA @RLA.D
RLA number of times.
Execution condition S
LDA RLA STA @ R L A S
n — — — — — — — — — — — — — — — — —
n : RLA(.U) specifies the number of times that the bit content is to be rotated to the left within
the range 1 to 16.
4 RLA.D specifies the number of times that the bit content is to be rotated to the left within the
range 1 to 32.
Data Shift Instructions
CR2009
1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 1
(Carry)
RLA.D When the execution condition is ON, the bit content of 32-bit internal registers is rotated
to the left for the number of times specified by n . The state of the carry flag
(CR2009) is entered to the LSB.
bit bit bit bit
31 16 15 0 CR2009
CR2009
1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1
(Carry)
4-82
4-4 Data Shift Instructions
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA RLA STA
DM ✽ ✽ ✽ ✽ DM ✽ ✽ ✽ ✽
LDA RLA STA
Operation flag
CR2009 .......... ON when a carry is stored after the operation. Otherwise, OFF
CR2010 .......... ON when the operation result is 0 (zero). Otherwise, OFF
4
CR2011 .......... No change in state
Execution Timing
RLA(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@RLA(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
SRA
ON
SLA
Execution condition
OFF RRA
RLA
RLA(.U/.D) Execution Execution
WSR
WSL
@RLA(.U/.D) 1 scan execution
Sample Program
Of the error sensors connected to input relays 30000 to 30015, the number of sensors that are
currently outputting an error is stored to data memory DM00000.
FOR
The FOR to NEXT instructions are executed
#00016
16 times.
4-83
WSR(.U)
4-4 Data Shift Instructions WSR
WSR WSR.D Shifts the word device to
Word shift right the right (towards the larger
ARITHMETIC OPERATION INSTRUCTIONS
WSR
@WSR(.U)
@WSR @WSR.D
number device No.).
S — — — — — — — — — — — — — — — — —
n1 — — — — — — — — — — — — — — —
n2 — — — — — — — — — — — — — — —
S 1000 0
S +1 2000 0
Store "0".
0
n1 items 0
...
S + n2 1000
( S +1)+ n2 2000
8000
S + n1 –1 9000
...
n2 items
8000
( S + n1 –1)+ n2 9000
WSR.D When the execution condition is ON, n1 number of 32-bit data items starting from
the device specified by S / S +1 are shifted to the right (towards the larger device
No.) by n2 number of items. "0" is stored to n2 data starting from S .
S +1 100000 S 0
S +3 200000 S +2 0
Store "0".
0
n1 items 0
...
( S +1)+2 n2 100000 S +2 n2
( S +3)+2 n2 200000 ( S +2)+2 n2
800000
S +2( n1 –1)+1 900000 S +2( n1 –1)
...
n2 items
800000
( S +2( n1 –1)+1)+2 n2 900000 ( S +2( n1 –1)+2 n2
4-84
4-4 Data Shift Instructions
Execution Timing
WSR(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@WSR(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
00000 WSR
DM00000 #00100 #00001
SRA
SLA
RRA
RLA
WSR
WSL
4-85
WSL(.U)
4-4 Data Shift Instructions WSL
WSL WSL.D Shifts the word device to
Word shift left the left (towards the smaller
ARITHMETIC OPERATION INSTRUCTIONS
@WSL(.U) WSL
@WSL @WSL.D
number device No.).
S — — — — — — — — — — — — — — — — —
n1 — — — — — — — — — — — — — — —
n2 — — — — — — — — — — — — — — —
S – n2 1000
n2 items ( S +1) – n2 2000
...
S 1000
S +1 2000
8000
( S + n1 –1) – n2 9000
...
n1 items
0
0
Store "0".
8000 0
S + n1 –1 9000 0
WSL.D When the execution condition is ON, n1 number of 32-bit data items starting from
the device specified by S / S +1 are shifted to the left (towards the smaller device
No.) by n2 number of items. "0" is stored to n2 data starting from S + n1 –
n2 .
Before execution After execution
( S +1) –2 n2 100000 S –2 n2
( S +3) –2 n2 ( S +2) –2 n2
200000
n2 items
...
S +1 100000 S
S +3 200000 S +2
800000
( S +2( n1 –1) +1) –2 n2 900000 ( S –2( n1 –1) –2 n2
...
n1 items
0
0
Store "0".
800000 0
S +2( n1 –1)+1 900000 S +2( n1 –1) 0
4-86
4-4 Data Shift Instructions
Execution Timing
WSL(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@WSL(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
00000 WSL
DM01000 #00100 #00001
SRA
SLA
RRA
RLA
WSR
WSL
4-87
4-5 Data Conversion Instructions
ARITHMETIC OPERATION INSTRUCTIONS
4-88
4-5 Data Conversion Instructions
4-89
TBCD(.U)
4-5 Data Conversion Instructions
TBCD TBCD.D TBCD Converts the binary data currently
Transfer BCD stored to internal registers to BCD
ARITHMETIC OPERATION INSTRUCTIONS
@TBCD(.U)
@TBCD @TBCD.D TBCD
data.
Execution condition
LDA TBCD STA @ T B C D
— — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
Data Conversion Instructions
TBCD(.U) When the execution condition is ON, the 16-bit binary data currently stored to 16-bit
internal register is converted to 4-digit BCD data, and the result is stored to 16-bit
internal register.
When the operation result exceeds the 4-digit BCD data range 0 to 9999, operation flag
CR2012 turns ON. At this time, the value of the 16-bit internal register does not change
before or after execution of the instruction.
"About Internal Registers" page 1-17
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
1234
BCD
Conversion
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
1 2 3 4
TBCD.D When the execution condition is ON, the 32-bit binary data currently stored to 32-bit
internal register is converted to 8-digit BCD data, and the result is stored to 32-bit
internal register.
When the operation result exceeds the 8-digit BCD data range 0 to 99999999,
operation flag CR2012 turns ON. At this time, the value of the 32-bit internal register
does not change before or after execution of the instruction.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
12345678
BCD
Conversion
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
1 2 3 4 5 6 7 8
4-90
4-5 Data Conversion Instructions
Execution Timing
TBCD(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@TBCD(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan 4
Execution condition
OFF
Sample Program
When input relay 00000 is ON, the value of data memory DM00000 is converted to BCD, and is
output to output relays 30500 to 30515.
TBCD
00000 DM00000 30500
LDA TBCD STA TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-91
TBIN(.U)
4-5 Data Conversion InstructionsTBIN
TBIN TBIN.D
Converts the BCD data currently stored
Transfer BIN
to internal registers to binary data.
ARITHMETIC OPERATION INSTRUCTIONS
@TBIN(.U)
@TBIN @TBIN.D
TBIN
Execution condition
LDA TBIN STA @ T B I N
— — — — — — — — — — — — — — — — — — — —
4
Explanation of Operation
Data Conversion Instructions
TBIN(.U) When the execution condition is ON, the 4-digit BCD data currently stored to 16-bit
internal register is converted to 16-bit binary data, and the result is stored to 16-bit
internal register.
When the 4-digit BCD data is outside of the range (0 to 9999), operation flag CR2012
turns ON. At this time, the value of the 16-bit internal register does not change before
or after execution of the instruction.
"About Internal Registers" page 1-17
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
1 2 3 4
BIN
Conversion
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
1234
TBIN.D When the execution condition is ON, the 8-digit BCD data currently stored to 32-bit
internal register is converted to 32-bit binary data, and the result is stored to 32-bit
internal register.
When the 8-digit BCD data is outside of the range (0 to 99999999), operation flag
CR2012 turns ON. At this time, the value of the 32-bit internal register does not change
before or after execution of the instruction.
"About Internal Registers" page 1-17
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
1 2 3 4 5 6 7 8
BIN
Conversion
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Internal register 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
12345678
4-92
4-5 Data Conversion Instructions
Execution Timing
TBIN(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@TBIN(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan 4
Execution condition
OFF
Sample Program
When input relay 30100 is ON, the 4-digit BCD data captured by input relays 30000 to 30015 is
converted to binary data, and the result is stored to data memory DM00000.
TBCD
30100 30000 DM00000
LDA TBIN STA TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-93
4-5 Data Conversion Instructions
MPX MPX
Multiplex Decodes the number of 1-digit units (four bits) in
(4→16 decode) internal register to 16-bit binary data.
@MPX
ARITHMETIC OPERATION INSTRUCTIONS
MPX
DMX DMX
Demultiplex Encodes the bit position of the MSB whose 16-bit
(16→4 encode) binary data in the internal register is "1" to a 4-digit
@DMX DMX numerical value.
4 Available
Devices I O
Bit Devices
Internal
auxiliary T C CTC CR DM TM T
Word Devices Constant Indirect
n — — — — — — — — — — — — — — — — — — *
* With the MPX instruc-
n : Specifies the number of digits to be multiplexed. tion, CR2012 does not
change state.
Explanation of Operation
MPX When the execution condition is ON, the n th digit of the 16-bit internal register is
binarized. The bit indicated by that numerical value is turned ON (stored).
"About Internal Registers" page 1-17
[Example] When the data currently stored to 16-bit internal register is $71 and n is #1
n (#1)th digit
#3 #2 #1 #0
16-bit
internal register 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1
DMX When the execution condition is ON, the position of the MSB of the bits that are ON ("1")
is stored to 16-bit internal register as binary data.
"About Internal Registers" page 1-17
[Example] When the data currently stored to 16-bit internal register is 138 (10001010 in binary)
Ignore
F E D C B A 9 8 7 6 5 4 3 2 1 0
16-bit
internal register 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0
4-94
4-5 Data Conversion Instructions
Execution Timing
MPX DMX This instruction is executed at each scan for the duration that the execution
condition is ON.
@MPX @DMX This instruction is executed for one scan only at the up edge of the execution
condition.
Scan 4
Execution condition
OFF
Sample Program
MPX When binary digital switch one digit is connected to input relay (30004 to 30007), and
lamps 0 to 15 are connected to each of output relays (30500 to 301515) TBCD
The worker lights the lamp matched to the setting of the digital switch by BIN TBIN
MPX
RGRY
DISN
When the digital switch is set to "8", output relay (30508) turns ON, and lamp "8" lights.
UNIN
DISB
DMX When sensors 0 to 15 are each connected to input relays (30000 to 30015), and binary UNIB
display one digit is connected to output relays (30500 to 30503) SWAP
* Note, however, that this sample program assumes that multiple sensors do not turn
ON at the same time.
4-95
GRY(.U)
4-5 Data Conversion Instructions
GRY GRY.D GRY
Gray code Converts the values currently stored to
conversion internal registers to gray code.
ARITHMETIC OPERATION INSTRUCTIONS
@GRY(.U)
@GRY @GRY.D
GRY
Execution condition
LDA GRY STA @ G R Y
— — — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
Data Conversion Instructions
GRY(.U) When the execution condition is ON, the 16-bit binary data currently stored to 16-bit
internal register is converted to gray code.
"About Internal Registers" page 1-17
GRY.D When the execution condition is ON, the 32-bit binary data currently stored to 32-bit
internal register is converted to gray code.
"About Internal Registers" page 1-17
Operation flag
The operation flag does not change state.
4-96
4-5 Data Conversion Instructions
Scan
ON
Execution condition
OFF
Sample Program
The 16-bit unsigned binary data currently stored to data memory DM00000 is converted to gray 4
code. The result is stored to DM00010.
TBCD
TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-97
RGRY(.U)
4-5 Data Conversion Instructions
RGRY RGRY.D RGRY
Gray code reverse
Converts the gray code currently
stored to internal registers to
conversion
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA RGRY STA @ R G R Y
— — — — — — — — — — — — — — — — — — — — —
4
Explanation of Operation
Data Conversion Instructions
RGRY(.U) When the execution condition is ON, the gray code currently stored to 16-bit internal
register is converted to 16-bit binary data.
"About Internal Registers" page 1-17
"Gray code table" page 4-96
RGRY.D When the execution condition is ON, the gray code currently stored to 32-bit internal
register is converted to 32-bit binary data.
"About Internal Registers" page 1-17
"Gray code table" page 4-96
Operation flag
The operation flag does not change state.
Execution Timing
RGRY(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@RGRY(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-98
4-5 Data Conversion Instructions
TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-99
DISN
4-5 Data Conversion Instructions
DISN Disperses data into nibble units (4-bit units),
Disperse nibble and stores each of these to four word
ARITHMETIC OPERATION INSTRUCTIONS
DISN
@DISN devices.
S — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
Explanation of Operation
DISN When the execution condition is ON, the content of the device specified by S is
dispersed to digits (4 bits), and is stored to four word devices starting from the device
specified by D . "0" is stored to the upper 12 bits.
bit bit bit bit
15 8 7 0
1 2 3 4 : S
bit bit bit bit
15 8 7 0
0 0 0 4 : D
0 0 0 3 : D +1
0 0 0 2 : D +2
0 0 0 1 : D +3
Operation flag
The operation flag does not change state.
Execution Timing
DISN This instruction is executed at each scan for the duration that the execution
condition is ON.
@DISN This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-100
4-5 Data Conversion Instructions
00000 DISN
DM00000 DM00010
TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-101
UNIN
4-5 Data Conversion Instructions
UNIN Unites the lower four bits of the four word
Unite nibble
devices to 16-bit data.
ARITHMETIC OPERATION INSTRUCTIONS
UNIN
@UNIN
Ladder program Input method
Execution condition UNIN
S D U N I N S D
S — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
S : Specifies the leading device to which the data to unite is currently stored.
Explanation of Operation
UNIN When the execution condition is ON, the lower four bits of the four word devices starting
from the device specified by S are united into 16-bit binary data, and is stored to
the device specified by D .
bit bit bit
15 4 0
S : 1
S +1 : 2
S +2 : 3
S +3 : 4
D : 4 3 2 1
Operation flag
The operation flag does not change state.
Execution Timing
UNIN This instruction is executed at each scan for the duration that the execution
condition is ON.
@UNIN This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-102
4-5 Data Conversion Instructions
00000 UNIN
DM00000 DM00010
TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-103
DISB
4-5 Data Conversion Instructions
DISB Disperses data into byte units (8-bit units),
Disperse byte and stores each of these to two word
ARITHMETIC OPERATION INSTRUCTIONS
DISB
@DISB devices.
S — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
Explanation of Operation
DISB When the execution condition is ON, the 16-bit data currently stored to the device
specified by S is dispersed to an upper byte (8 bits) and a lower byte (8 bits), and
is stored to two word devices starting from the device specified by D . "0" is stored
to the upper 8 bits.
bit bit bit bit
15 8 7 0
S : 1 2 3 4
D : 0 0 3 4
D +1 : 0 0 1 2
"0" is stored to
upper byte (8 bits).
Operation flag
The operation flag does not change state.
Execution Timing
DISB This instruction is executed at each scan for the duration that the execution
condition is ON.
@DISB This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-104
4-5 Data Conversion Instructions
TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-105
4-5 Data Conversion UNIB
Instructions
UNIB Unites the lower eight bits of the two word
Unite byte
devices to 16-bit data.
ARITHMETIC OPERATION INSTRUCTIONS
UNIB
@UNIB
Ladder program Input method
Execution condition UNIB
S D U N I B S D
S — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
S : Specifies the leading device to which the data to unite is currently stored.
Explanation of Operation
UNIB When the execution condition is ON, the lower four bytes (8 bits) of the device starting
from the device specified by S are united into 16-bit binary data, and is stored to
the device specified by D .
S : 3 4
S +1 : 1 2
D : 1 2 3 4
Operation flag
The operation flag does not change state.
Execution Timing
UNIB This instruction is executed at each scan for the duration that the execution
condition is ON.
@UNIB This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-106
4-5 Data Conversion Instructions
30100 DM00001
LDA STA
UNIB
DM00000 DM00010
TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-107
SWAP(.U)
4-5 Data Conversion Instructions
SWAP SWAP.D SWAP
Swaps the upper and lower data of the
Swap
internal register.
ARITHMETIC OPERATION INSTRUCTIONS
@SWAP(.U)
@SWAP @SWAP.D
SWAP
Execution condition
LDA SWAP STA @ S W A P
— — — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
Data Conversion Instructions
SWAP(.U) When the execution condition is ON, the values of the upper byte (upper 8 bits) and
lower byte (lower 8 bits) of the 16-bit data currently stored to 16-bit internal register are
swapped, and stored to 16-bit internal register.
"About Internal Registers" page 1-17
SWAP.D When the execution condition is ON, the values of the upper word (upper 16 bits) and
lower word (lower 16 bits) of the 32-bit data currently stored to 32-bit internal register
are swapped, and stored to 32-bit internal register.
"About Internal Registers" page 1-17
4-108
4-5 Data Conversion Instructions
Execution Timing
SWAP(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@SWAP(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
TBCD
TBIN
MPX
DMX
GRY
RGRY
DISN
UNIN
DISB
UNIB
SWAP
XCH
4-109
InstructionsXCH
XCH(.U)
4-5 Data Conversion
XCH XCH.D
Exchange Swaps the content of two devices.
XCH
ARITHMETIC OPERATION INSTRUCTIONS
@XCH(.U)
@XCH @XCH.D
S1 — — — — — — — — — — — — — — —
S2 — — — — — — — — — — — —
Explanation of Operation
XCH(.U) When the execution condition is ON, the 16-bit data currently stored to the devices
specified by S1 and S2 is swapped.
1 2 3 4 A B C D
A B C D 1 2 3 4
XCH.D When the execution condition is ON, the 32-bit data currently stored to the devices
specified by S1 / S1 +1 and S2 / S2 +1 is swapped.
0 1 2 3 4 5 6 7 8 9 A B C D E F
8 9 A B C D E F 0 1 2 3 4 5 6 7
4-110
4-5 Data Conversion Instructions
Execution Timing
XCH(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
@XCH(.U/.D) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
4
Execution condition
Sample Program
When input relay 00000 is ON, 16-bit unsigned binary data currently stored to data memories
DM00000 to DM00009 is exchanged in order starting from DM00000. When the exchange is
completed, the program sequence between the FOR to NEXT instructions ends.
TBCD
FOR
#00009 TBIN
MPX
RGRY
FOR
DISN
#00009
UNIN
NEXT
01000 BREAK
NEXT
4-111
4-6 Floating Point Instructions
ARITHMETIC OPERATION INSTRUCTIONS
INTG.D Converts a floating point real number value to 32-bit unsigned binary data.
INTG.L Converts a floating point real number value to 32-bit signed binary data.
Write data memory DW.F Stores floating point real number values to data memory. 4-120
Load A LDA.F Stores floating point real number values to 32-bit internal register. 4-122
Store A STA.F Stores floating point real number values currently stored to 32-bit internal 4-124
register to specified devices.
Move MOV.F Stores floating point real number values to specified devices. 4-126
Fill move FMOV.F Batch moves floating point real number values to specified devices. 4-128
Disperse F DISF Disperses floating point real number values into a mantissa and exponent. 4-130
Unite F UNIF Units the mantissa and exponent into a floating point real number value. 4-132
Add ADD.F Adds floating point real number values. 4-134
Subtract SUB.F Subtracts floating point real number values. 4-136
Multiply MUL.F Multiplies floating point real number values. 4-138
Divide DIV.F Divides floating point real number values. 4-140
Root ROOT.F Calculates the square root of floating point real number values. 4-142
Compare CMP.F Compares floating point real number values. 4-144
Zone compare ZCMP.F Compares a range of floating point real number values. 4-146
Exponent arithmetic EXP Calculates the exponent of floating point real number values. 4-148
operation
Logarithmic arithmetic LOG Calculates the natural logarithm of floating point real number values. 4-150
operation
Radian RAD Converts the unit of angles from degrees (°) to radians. 4-152
Degree DEG Converts the unit of angles from radians to degrees (°). 4-154
Sine SIN Calculates the sine value from an angle (radians). 4-156
Cosine COS Calculates the cosine value from an angle (radians). 4-158
Tangent TAN Calculates the tangent from an angle (radians). 4-160
Arc sine ASIN Calculates the angle (radians) from the sine value. 4-162
Arc cosine ACOS Calculates the angle (radians) from the cosine value. 4-164
Arc tangent ATAN Calculates the angle (radians) from the tangent value. 4-166
4-112
4-6 Floating Point Instructions
When comparing with 16/32-bit binary data, set the same data format for the data to be compared
by the FLOAT or INTG instruction.
Note: When the result of arithmetic operations on floating point real numbers exceeds the
effective numbers of the mantissa in the internal expression, the result is rounded
according to the following rules:
1.The result is rounded to the nearest of the two floating point real numbers that
approximate the result.
2.When the result is in the middle of the two approximating floating point real numbers, the
result is rounded in the direction where the final digit of the mantissa becomes 0.
4-113
FLOAT(.U)
4-6 Floating Point Instructions
FLOAT.D
FLOAT FLOAT.S FLOAT
FLOAT.L Floating point Converts the data of internal regis-
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA FLOAT STA.F @ F L O A T
— — — — — — — — — — — — — — — — — — — — —
4 The data range that can be handled varies according to the suffix type.
"About Suffixes" page 1-28
Floating Point Instructions
Explanation of Operation
FLOAT(.U) When the execution condition is ON, the 16-bit unsigned binary data currently stored
to 16-bit internal register is converted to a floating point real number, and the result is
stored to 32-bit internal register.
"About Internal Registers" page 1-17
16 bits 32 bits
FLOAT.D When the execution condition is ON, the 32-bit unsigned binary data currently stored
to 32-bit internal register is converted to a floating point real number, and the result is
stored to 32-bit internal register.
"About Internal Registers" page 1-17
32 bits 32 bits
Note: As floating point real numbers are processed a single precision of 32 bits, the effective
number of digits becomes 24 bits.
When the integer value exceeds the range –16777216 to 16777215 (24-bit binary data),
an error will occur during conversion. The conversion result becomes the value obtained
by discarding 0 and inserting 1 at the 25th bit from the start of the integer values, and
discarding from the 26th bit onwards.
Operation flag
The operation flag does not change state.
4-114
4-6 Floating Point Instructions
16 bits 32 bits
FLOAT.L When the execution condition is ON, the 32-bit signed binary data currently stored to
32-bit internal register is converted to a floating point real number, and the result is
stored to 32-bit internal register.
"About Internal Registers" page 1-17
32 bits 32 bits
Operation flag
The operation flag does not change state.
Execution Timing
FLOAT(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution FLOAT
condition is ON.
INTG
@FLOAT(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution DW.F
condition. LDA.F
STA.F
Scan MOV.F
FMOV.F
ON
SUB.F
DIV.F
ROOT.F
CMP.F
Sample Program ZCMP.F
EXP
The 16-bit unsigned binary data currently stored to data memory DM00000 is converted to a floating
LOG
point real number, and the result is stored to DM00010/DM00011.
RAD
COS
TAN
ASIN
ACOS
ATAN
4-115
INTG(.U)
4-6 Floating Point Instructions
INTG.D
INTG INTG.S
INTG
@INTG.L
Execution condition
LDA.F INTG STA @ I N T G
— — — — — — — — — — — — — — — — — — — —
The data range that can be handled varies according to the suffix type.
4 "About Suffixes" page 1-28
Floating Point Instructions
Explanation of Operation
INTG(.U) When the execution condition is ON, the floating point real number currently stored to
32-bit internal register is converted to 16-bit unsigned binary data.
The operation result is stored to 16-bit internal register. An error with the stored value
occurs as the digits past the decimal point of the floating point real number before
conversion are discarded.
"About Internal Registers" page 1-17
32 bits 16 bits
INTG.D When the execution condition is ON, the floating point real number currently stored to
internal register is converted to 32-bit unsigned binary data.
The operation result is stored to 16-bit internal register. An error with the stored value
occurs as the digits past the decimal point of the floating point real number before
conversion are discarded.
"About Internal Registers" page 1-17
32 bits 32 bits
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the data to be converted is outside the floating point real number
range or when the converted data is outside the 16/32-bit unsigned binary
range. Otherwise OFF
The instruction is not executed when CR2012 has turned ON.
4-116
4-6 Floating Point Instructions
32 bits 16 bits
INTG.L When the execution condition is ON, the floating point real number currently stored to
32-bit internal register is converted to 32-bit signed binary data.
4
The operation result is stored to 32-bit internal register. An error with the stored value
32 bits 32 bits
Operation flag
CR2009 .......... No change in state FLOAT
DW.F
CR2011 .......... No change in state
LDA.F
CR2012 .......... ON when the data to be converted is outside the floating point real number STA.F
range or when the converted data is outside the 16/32-bit signed binary range. MOV.F
Otherwise OFF
FMOV.F
The instruction is not executed when CR2012 has turned ON.
DISF
UNIF
ADD.F
Execution Timing
SUB.F
INTG(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution MUL.F
condition is ON. DIV.F
@INTG(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution ROOT.F
condition. CMP.F
ZCMP.F
EXP
Scan LOG
ON RAD
TAN
@INTG(.U/.D/.S/.L) 1 scan execution ASIN
ACOS
ATAN
4-117
4-6 Floating Point Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Sample Programs
The floating point real number currently stored to data memories DM00000/DM00001 is converted
to 16-bit unsigned binary data, and the result is stored to DM00010.
The floating point real number currently stored to data memories DM00000/DM00001 is converted
to 16-bit signed binary data, and the result is stored to DM00010.
4 The floating point real number currently stored to data memories DM00000/DM00001 is converted
to 32-bit unsigned binary data, and the result is stored to DM00010/DM00011.
Floating Point Instructions
The floating point real number currently stored to data memories DM00000/DM00001 is converted
to 32-bit signed binary data, and the result is stored to DM00010/DM00011.
4-118
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-119
4-6 Floating Point Instructions
DW.F DW.F
Write data memory Stores floating point real numbers to
(floating point real number) data memory.
ARITHMETIC OPERATION INSTRUCTIONS
@DW.F DW.F
S — — — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — — —
S : Specifies the floating point real number to write to data memory or control memory.
4 The floating point real number range is –3.4E38 to 1.4E–45, 1.4E–45 to 3.4E38 and 0.
D : Specifies the destination device to write the floating point real number specified by S to.
Floating Point Instructions
Explanation of Operation
When the execution condition is ON, the floating point real number specified by S is stored to
the data memory (DM) or control memory (CM) specified by D / D +1.
D +1 D
S : +1.234567 Floating point real number
32 bits
(2 words)
Operation flag
The operation flag does not change state.
Execution Timing
DW.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@DW.F This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-120
4-6 Floating Point Instructions
+1.23456E10 –1.23456E–10
DW.F DW.F
DM00004 DM00006
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-121
4-6 Floating Point Instructions
LDA.F LDA.F
Load A Stores floating point real numbers to
(floating point real number) 32-bit internal register.
ARITHMETIC OPERATION INSTRUCTIONS
@LDA.F LDA.F
Execution condition S
LDA.F STA.F @ L D A . F S
S — — — — — — — — —
S : Specifies the floating point real number data to write to 32-bit internal registers or the device
to which that data is currently stored.
4
Explanation of Operation
Floating Point Instructions
When the execution condition is ON, the floating point real number currently stored to the device
specified by S is stored to the 32-bit internal register.
"About Internal Registers" page 1-17
S : +1.234 +1.234
32 bits
+1.234 +1.234
32 bits
32 bits
(2 words)
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when the value read from the device specified to the operand is 0.
Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-122
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
See the sample program for the STA.F instruction.
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-123
4-6 Floating Point Instructions
STA.F STA.F
Store A Stores the floating point real number of
(floating point real number) 32-bit internal register to a specified
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition D
LDA.F STA.F @ S T A . F D
D — — — — — — — — — — — —
D : Specifies the device to store the data of the 32-bit internal register to.
4 Explanation of Operation
Floating Point Instructions
When the execution condition is ON, the floating point real number currently stored to the internal
device is stored to the device specified by D / D +1.
"About Internal Registers" page 1-17
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
Execution Timing
STA.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@STA.F This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-124
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-125
MOV.F
4-6 Floating Point Instructions
MOV.F Move Stores floating point real
(floating point real number) numbers to a specified device.
ARITHMETIC OPERATION INSTRUCTIONS
MOV.F
@MOV.F
Ladder program Input method
Execution condition MOV.F
S D M O V . F S D
S — — — — — — — — — —
D — — — — — — — — —
S : Specifies the source data to be moved or the device to which the data is currently stored.
4 D : Specifies the device (move destination) to store the data to.
Floating Point Instructions
Explanation of Operation
When the execution condition is ON, the floating point real number specified by S is stored to
the device specified by D .
MOV.F
[Example] When the constant is specified by S +1.234 DM00014
State of data memory before instruction execution State of data memory after instruction execution
DM00011: 0 :DM00010 S : 1.234 DM00011: 0 :DM00010
32 bits (2words)
MOV.F
[Example] When the device No. is specified by S DM00012 DM00016
State of data memory before instruction execution State of data memory after instruction execution
DM00011: 0 :DM00010 DM00011: 0 :DM00010
32 bits (2words)
4-126
4-6 Floating Point Instructions
Execution Timing
MOV.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@MOV.F This instruction is executed for one scan only at the up edge of the execution
condition.
4
Scan
Execution condition
OFF
Sample Program
When input relay 00000 is ON, "floating point real number + 1.234" is stored to data memories
DM00010/DM00011. When input relay 00000 is OFF, the floating point real number currently stored
FLOAT
to DM00000/DM00001 is stored to DM00010/DM00011.
INTG
DW.F
00000 MOV.F
+1.234 DM00010 LDA.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-127
4-6 Floating Point Instructions
FMOV.F FMOV.F
Fill move (floating
Batch moves floating point
real numbers to a specified
point real number)
ARITHMETIC OPERATION INSTRUCTIONS
device.
@FMOV.F FMOV.F
S — — — — — — — — — —
D — — — — — — — — — —
n — — — — — — — — — — — — — — —
S : Specifies the move source data or the device to which the data is currently stored.
4 The floating point real number range is –3.4E38 to 1.4E–45, 1.4E–45 to 3.4E38 and 0.
Floating Point Instructions
Explanation of Operation
When the execution condition is ON, the floating point real number currently stored to the device
specified by S is moved to n x 2 words leading from the device specified by D .
Move destination
D +1 D
DM00201: +1.234 :DM00200
Move source
S +1 S DM00203: +1.234 :DM00202
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the indirect specification range specified to the operand is inappropri-
ate. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-128
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, floating point real number #1.234 is stored to data memories
00000 FMOV.F
+1.234 DM00100 #00010
00000 FMOV.F
DM00000 S
DM00100 D
#00010
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-129
DISF
4-6 Floating Point Instructions Disperse F (disperse Disperses a floating point real
DISF mantissa/exponent of number into a mantissa and
floating point real exponent, and stores each of
ARITHMETIC OPERATION INSTRUCTIONS
DISF
@DISF number) these to a specified device.
S — — — — — — — — — — — — — — — —
D1 — — — — — — — — — — — — —
D2 — — — — — — — — — — — — —
Explanation of Operation
When the execution condition is ON, the mantissa of the floating point real number currently stored
to the device specified by S / S +1 is stored to the device specified by D1 / D1 +1, and the
exponent is stored to the device specified by D2 . Seven digits are calculated for the mantissa
section.
D1 +1 D1
Mantissa section: 32-bit signed binary data
S +1 S 32 bits
(2 words)
Floating point real number Disperse
32 bits D2
Exponent section: 16-bit signed binary data
32 bits
Example of dispersion of –1.234 x 10–3 (1word)
Mantissa Exponent
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the data to disperse is outside the floating point real number range.
Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-130
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the floating point real number currently stored to data memories
00000 DISF
DM00000 DM00010 DM00012
DM00011 DM00010
Mantissa –5678900
section:
DM00001 DM00000 32 bits
(1 word)
–5.6789E10 Disperse
FLOAT
DM00012
Exponent INTG
+4
section: DW.F
32 bits
(1 word) LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-131
UNIF
4-6 Floating Point Instructions Unite F (unite mantissa Unites the specified mantissa
UNIF and exponent to and exponent, and stores the
UNIF floating point real united floating point real
ARITHMETIC OPERATION INSTRUCTIONS
S1 — — — — — — — — — — — — — — — —
S2 — — — — — — — — — — — — —
D — — — — — — — — — — — — —
D : Specifies the device to store the floating point real number made by uniting S1 and S2 .
Explanation of Operation
When the execution condition is ON, the floating point real number is stored to the device specified
by D / D +1. The floating point real number takes the 32-bit signed binary data currently stored
to the device specified by S1 / S1 +1 as its mantissa, and the 16-bit signed binary data currently
stored to the device specified by S2 as its exponent.
S1 +1 S1
Mantissa section: 32-bit signed binary data
32 bits D +1 D
(2 words)
Unite Floating point real number
S2 32 bits
16 bits
(1word)
Example of unit
Mantissa section: –1234 (32-bit signed binary data)
Unite –1.234 x 10–3
Exponent section: –6 (16-bit signed binary data) (Floating point real number)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the result exceeds the floating point real number range. Otherwise, OFF
4-132
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the floating point real number is stored to DM00010/DM00011. The
00000 UNIF
DM00000 DM00002 DM00010
DM00001 DM00000
Mantissa section: +987654
32 bits
(2 words) DM00011 DM00010 FLOAT
+9.87654E10 INTG
DW.F
DM00002
LDA.F
Exponent section: +5
STA.F
16 bits
(1word) MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-133
4-6 Floating Point Instructions Adds the floating point real number specified
ADD.F ADD.F
Add (floating point by the operand to the floating point real num-
real number) ber of the 32-bit internal register, and stores
ARITHMETIC OPERATION INSTRUCTIONS
@ADD.F ADD.F
the result again to the 32-bit internal register.
Execution condition S
LDA.F ADD.F STA.F @ A D D . F D
S — — — — — — — — — — — —
S : Specifies the addition data or the device No. to which the data is currently stored.
* When word devices (DM, TM, CM) are used as the operand, use two words.
4
Floating Point Instructions
Explanation of Operation
When the execution condition is ON, the floating point real number specified by S / S +1 and
the floating point real number of the 32-bit internal register are added, and the result is stored to the
32-bit internal register.
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... ON when the result is outside the floating point real number range. Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate or the addition data is
outside the floating point real number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
Execution Timing
ADD.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@ADD.F This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-134
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-135
4-6 Floating Point Instructions Subtracts the floating point real number speci-
SUB.F SUB.F
Subtract (floating fied by the operand from the floating point real
point real number) number of the 32-bit internal register, and stores
ARITHMETIC OPERATION INSTRUCTIONS
@SUB.F SUB.F
the result again to the 32-bit internal register.
Execution condition S
LDA.F SUB.F STA.F @ S U B . F S
S — — — — — — — — — — — —
S : Specifies the subtraction data or the device to which the data is currently stored.
* When word devices (DM, TM, CM) are used as the operand, use two words.
4
Explanation of Operation
Floating Point Instructions
When the execution condition is ON, the floating point real number specified by S / S +1 is
subtracted from the floating point real number of the 32-bit internal register, and the result is stored
to the 32-bit internal register.
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits) bits)
Operation flag
CR2009 .......... ON when the result is outside the floating point real number range. Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate or the subtraction data is
outside the floating point real number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
Execution Timing
SUB.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@SUB.F This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-136
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-137
4-6 Floating Point Instructions Multiplies the floating point real number speci-
MUL.F MUL.F
Multiply (floating fied by the operand with the floating point real
point real number) number of the 32-bit internal register, and stores
ARITHMETIC OPERATION INSTRUCTIONS
@MUL.F MUL.F
the result again to the 32-bit internal register.
Execution condition S
LDA.F MUL.F STA.F @ M U L . F S
S — — — — — — — — — — — —
S : Specifies the multiplication data or the device to which the data is currently stored.
* When word devices (DM, TM, CM) are used as the operand, use two words.
4
Floating Point Instructions
Explanation of Operation
When the execution condition is ON, the floating point real number specified by S / S +1 and
the floating point real number of the 32-bit internal register are multiplied, and the result is stored
to the 32-bit internal register.
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... ON when the result is outside the floating point real number range. Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate or the multiplication data
is outside the floating point real number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
Execution Timing
MUL.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@MUL.F This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-138
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-139
4-6 Floating Point Instructions Divides the floating point real number of the 32-
DIV.F DIV.F
Divide (floating bit internal register by the floating point real
point real number) number specified by the operand, and stores the
ARITHMETIC OPERATION INSTRUCTIONS
@DIV.F DIV.F
result again to the 32-bit internal register.
Execution condition S
LDA.F DIV.F STA.F @ D I V . F S
S — — — — — — — — — — — —
S : Specifies the division data or the device to which the data is currently stored.
* When word devices (DM, TM, CM) are used as the operand, use two words.
4
Floating Point Instructions
Explanation of Operation
When the execution condition is ON, the floating point real number of the 32-bit internal register is
divided by the floating point real number specified by S / S +1, and the result is stored to the
32-bit internal register.
32-bit internal register S +1 S 32-bit internal register
Floating point real number Floating point real number Floating point real number
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... ON when the result is outside the floating point real number range. Otherwise, OFF
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... ON when the divider is 0 or when indirect specification range is inappropriate or
the division data is outside the floating point real number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
Execution Timing
DIV.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@DIV.F This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-140
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-141
4-6 Floating Point Instructions Calculates the square root of the floating
ROOT.F ROOT.F
Root (floating point point real number currently stored to 32-bit
real number) internal register, and stores the result to the
ARITHMETIC OPERATION INSTRUCTIONS
@ROOT.F ROOT.F
32-bit internal register.
Execution condition
LDA.F ROOT.F STA.F @ R O O T . F
— — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
When the execution condition is ON, the square root of the floating point real number currently stored
Floating Point Instructions
to 32-bit internal register is calculated. The operation result is stored to the 32-bit internal register
as a floating point real number.
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is a minus value or is outside
the floating point real number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
Execution Timing
ROOT.F This instruction is executed at each scan for the duration that the execution
condition is ON.
@ROOT.F This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-142
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-143
4-6 Floating Point Instructions
CMP.F CMP.F
Compare (floating
Compares the floating point real number cur-
rently stored to 32-bit internal register with a
point real number)
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition S
LDA.F CMP.F STA.F @ C M P . F S
S — — — — — — — — — — —
Explanation of Operation
When the execution condition is ON, the size of the value specified by S / S +1 is compared
with the floating point real number currently stored to the 32-bit internal register. The state of the
operation flag changes as follows according to the comparison results.
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... ON when the value to be compared (value of internal register) is smaller than
S / S +1. Otherwise, OFF
CR2010 .......... ON when the value to be compared (value of internal register) is equal to
S / S +1. Otherwise, OFF
CR2011 .......... ON when the value to be compared (value of internal register) is greater than
S / S +1. Otherwise, OFF
CR2012 .......... ON when indirect specification range specified to the operand is inappropriate
or the data to be compared is outside the floating point real number range.
Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-144
4-6 Floating Point Instructions
Execution Timing
CMP.F This instruction is executed at each scan for the duration that the execution
condition is ON.
4
Scan
ON
Execution condition
OFF
FLOAT
INTG
DW.F
Sample Program
LDA.F
When input relay 00000 is ON, the floating point real number currently stored to data memories STA.F
DM00000/DM00001 is compared with floating point real number #1.234. MOV.F
Output relay 00500 turns ON when the value is smaller than +1.234. FMOV.F
DISF
Output relay 00501 turns ON when the value equals +1.234.
UNIF
Output relay 00502 turns ON when the value is greater than +1.234. ADD.F
SUB.F
ROOT.F
CR2010 00501 CMP.F
ZCMP.F
EXP
CR2011 00502
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-145
4-6 Floating Point Instructions
ZCMP.F ZCMP.F Compares the floating point real number cur-
Zone compare rently stored to 32-bit internal register with a
ARITHMETIC OPERATION INSTRUCTIONS
specified range.
@ZCMP.F ZCMP.F
S1 — — — — — — — — — — —
S2 — — — — — — — — — — —
* When word devices (DM, TM, CM, #TM) are used as the operand, use two words.
Explanation of Operation
When the execution condition is ON, the size of the range specified by S1 / S1 +1 and S2 /
S2 +1 and the floating point real number currently stored to 32-bit internal register are compared.
The state of the operation flag changes as follows according to the comparison results.
Operation flag
CR2009 .......... ON when the value to be compared (value of internal register) is smaller than the
specified range (range specified by operand). Otherwise, OFF
CR2010 .......... ON when the value to be compared (value of internal register) is within the specified
range (range specified by operand). Otherwise, OFF
CR2011 .......... ON when the value to be compared (value of internal register) is greater than the
specified range (range specified by operand). Otherwise, OFF
CR2012 .......... ON when indirect specification range is inappropriate or the addition data is
outside the floating point real number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-146
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When the floating point real number currently stored to data memories DM00000/DM00001 is
INTG
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-147
4-6 Floating Point Instructions
EXP EXP
Exponent arith-
Calculates the exponent function taking the floating
point real number currently stored to 32-bit internal
metic operation
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA.F EXP STA.F @ E X P
— — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
When the execution condition is ON, the exponent function value is calculated taking the floating
Floating Point Instructions
point real number currently stored to 32-bit internal register as the exponent. The operation result
is stored to the 32-bit internal register as a floating point real number. The calculation is performed
taking e=2.7128.
"About Internal Registers" page 1-17
32-bit internal register 32-bit internal register
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... ON when the operation result is outside the floating point real number range.
Otherwise, OFF
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the data to perform the operation on is outside the floating point real
number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
Execution Timing
EXP This instruction is executed at each scan for the duration that the execution
condition is ON.
@EXP This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-148
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-149
4-6 Floating Point Instructions
LOG LOG
Logarithmic arith- Calculates the logarithm of the floating point real
metic operation number currently stored to 32-bit internal register.
ARITHMETIC OPERATION INSTRUCTIONS
@LOG LOG
Execution condition
LDA.F LOG STA.F @ L O G
— — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
When the execution condition is ON, the logarithm of the floating point real number currently stored
Floating Point Instructions
to 32-bit internal register is calculated. The operation result is stored to the 32-bit internal register
as a floating point real number.
The calculation is performed taking e=2.7128
"About Internal Registers" page 1-17
32-bit internal register 32-bit internal register
Log ( Floating point type real number ) Floating point type real number
32 bits 32 bits
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is "0", a minus value or is
outside the floating point real number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
Execution Timing
LOG This instruction is executed at each scan for the duration that the execution
condition is ON.
@LOG This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-150
4-6 Floating Point Instructions
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-151
4-6 Floating Point Instructions
RAD RAD
Converts the angle (degrees) of the floating point real
Radian
number currently stored to 32-bit internal register to radians.
ARITHMETIC OPERATION INSTRUCTIONS
@RAD RAD
Execution condition
LDA.F RAD STA.F @ R A D
— — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
When the execution condition is ON, the angle (degrees) of the floating point real number currently
Floating Point Instructions
π .. 0.01745(rad.)
1° = =
180
180 .. 57.23°
1(rad.) = =
π
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is outside the floating point real
number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
4-152
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the angle (degrees) of the floating point real number currently stored
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-153
4-6 Floating Point Instructions
DEG DEG
Converts the angle (radians) unit of the floating point real
Degree
number currently stored to 32-bit internal register to degrees.
ARITHMETIC OPERATION INSTRUCTIONS
@DEG DEG
Execution condition
LDA.F DEG STA.F @ D E G
— — — — — — — — — — — — — — — — — — — —
Explanation of Operation
4
When the execution condition is ON, the angle (radians) of the floating point real number currently
Floating Point Instructions
stored to 32-bit internal register is converted to degrees. The operation result is stored to the 32-bit
internal register as a floating point real number.
"About Internal Registers" page 1-17
π .. 0.01745(rad.)
1° = =
180
180 .=. 57.23°
1(rad.) =
π
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is outside the floating point real
number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
4-154
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the angle (radians) of the floating point real number currently stored
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-155
4-6 Floating Point SIN
Instructions
SIN Calculates the sine (sin) value of the angle (radians) of the float-
Sine
ing point real number currently stored to 32-bit internal register.
ARITHMETIC OPERATION INSTRUCTIONS
@SIN SIN
Execution condition
LDA.F SIN STA.F @ S I N
— — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
When the execution condition is ON, the sine (sin) value of the angle (radians) of the floating point
Floating Point Instructions
real number currently stored to 32-bit internal register is calculated. The operation result is stored
to the 32-bit internal register as a floating point real number.
"About Internal Registers" page 1-17
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is outside the floating point real
number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
4-156
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the sine (sin) value of the angle of the floating point real number
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-157
4-6 Floating Point Instructions
COS COS Calculates the cosine (cos) value of the angle (radians) of
Cosine the floating point real number currently stored to 32-bit
ARITHMETIC OPERATION INSTRUCTIONS
internal register.
@COS COS
Execution condition
LDA.F COS STA.F @ C O S
— — — — — — — — — — — — — — — — — — — —
Explanation of Operation
4
When the execution condition is ON, the cosine (cos) value of the angle (radians) of the floating point
Floating Point Instructions
real number currently stored to 32-bit internal register is calculated. The operation result is stored
to the 32-bit internal register as a floating point real number.
"About Internal Registers" page 1-17
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is outside the floating point real
number range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
4-158
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the cosine (cos) value of the angle of the floating point real number
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-159
4-6 Floating Point Instructions
TAN TAN Calculates the tangent (tan) value of the angle (radians) of
Tangent the floating point real number currently stored to 32-bit
ARITHMETIC OPERATION INSTRUCTIONS
internal register.
@TAN TAN
Execution condition
LDA.F TAN STA.F @ T A N
— — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
When the execution condition is ON, the tangent (tan) value of the angle (radians) of the floating point
Floating Point Instructions
real number currently stored to 32-bit internal register is calculated. The operation result is stored
to the 32-bit internal register as a floating point real number.
"About Internal Registers" page 1-17
π π 3π
Logically, tan ( ) = +∞, tan ( 3π )= –∞. However, as tan ( ), tan ( ) becomes
2 2 2 2
π 3π
a rounded figure in the calculation, both tan ( ) and tan ( ) does not exceed the values
2 2
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is outside the floating point real
number range. Otherwise, OFF
4-160
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the tangent (tan) value of the angle of the floating point real number
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-161
4-6 Floating Point Instructions
ASIN ASIN Calculates the angle (radians) from the sine (sin) value
Arc sine expressed as a floating point real number currently stored
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA.F ASIN STA.F @ A S I N
— — — — — — — — — — — — — — — — — — — —
Explanation of Operation
4
When the execution condition is ON, the angle (radians) is calculated from the sine (sin) value
Floating Point Instructions
expressed as a floating point real number currently stored to 32-bit internal register. The operation
result is stored to the 32-bit internal register as a floating point real number.
"About Internal Registers" page 1-17
π .. 0.01745(rad.)
1° = =
180
180 .. 57.23°
1(rad.) = =
π
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on exceeds the range –1.0 to 1.0.
Otherwise, OFF
4-162
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the inverse sine (sin–1) of the floating point real number currently
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-163
4-6 Floating Point Instructions
ACOS ACOS Calculates the angle (radians) from the cosine (cos)
Arc cosine value expressed as a floating point real number cur-
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA.F ACOS STA.F @ A C O S
— — — — — — — — — — — — — — — — — — — —
Explanation of Operation
4
When the execution condition is ON, the angle (radians) is calculated from the cosine (cos) value
Floating Point Instructions
expressed as a floating point real number currently stored to 32-bit internal register. The operation
result is stored to the 32-bit internal register as a floating point real number.
"About Internal Registers" page 1-17
π .. 0.01745(rad.)
1° = =
180
180 .=. 57.23°
1(rad.) =
π
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on exceeds the range –1.0 to 1.0.
Otherwise, OFF
4-164
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the inverse cosine (cos-1) of the floating point real number currently
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-165
4-6 Floating Point Instructions
ATAN ATAN Calculates the angle (radians) from the tangent (tan)
Arc tangent value expressed as a floating point real number cur-
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA.F ATAN STA.F @ A T A N
— — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
When the execution condition is ON, the angle (radians) is calculated from the tangent (tan) value
Floating Point Instructions
expressed as a floating point real number currently stored to 32-bit internal register. The operation
result is stored to the 32-bit internal register as a floating point real number.
"About Internal Registers" page 1-17
π .. 0.01745(rad.)
1° = =
180
180 .=. 57.23°
1(rad.) =
π
[Tip]
The value (n) that can be handled in floating point real numbers is as follows:
–3.4E38 ≤ n ≤ –1.4E–45, n=0, 1.4E–45 ≤ n ≤ 3.4E38 (eff. number of digits: approx. 7, 24 bits)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the value to perform the operation on is outside the floating point real
number range. Otherwise, OFF
4-166
4-6 Floating Point Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
When input relay 00000 is ON, the inverse tangent (tan–1) of the floating point real number currently
FLOAT
INTG
DW.F
LDA.F
STA.F
MOV.F
FMOV.F
DISF
UNIF
ADD.F
SUB.F
MUL.F
DIV.F
ROOT.F
CMP.F
ZCMP.F
EXP
LOG
RAD
DEG
SIN
COS
TAN
ASIN
ACOS
ATAN
4-167
4-7 Text Processing Instructions
ARITHMETIC OPERATION INSTRUCTIONS
4-168
4-7 Text Processing Instructions
4-169
4-7 Text Processing Instructions
ASC ASC(.U) ASC
Hex ASCII code Converts binary data in internal
conversion registers to Hex ASCII code string.
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA ASC STA @ A S C
— — — — — — — — — — — — — — — — — — — — —
4 Explanation of Operation
ASC(.U) When the execution condition is ON, the binary data of the lower eight bits currently
Text Processing Instructions
stored to 16-bit internal register are converted to ASCII character code annotated in
Hex, and the result is stored to 16-bit internal register.
"About Internal Registers" page 1-17
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
0 0 A 5
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
Operation flag
The operation flag does not change state.
Execution Timing
ASC(.U) This instruction is executed at each scan for the duration that the execution
condition is ON.
@ASC(.U) This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
4-170
4-7 Text Processing Instructions
DM00000 DM00010
Conversion
0 0 F 7 4 6 3 7
RASC
DASC
RDASC
SMOV
SADD
SCMP
DISS
UNITS
LEN
RCOM
4-171
4-7 Text Processing Instructions
RASC RASC(.U) RASC
Hex ASCII code Converts Hex ASCII code string in
reverse conversion internal registers to binary data.
ARITHMETIC OPERATION INSTRUCTIONS
Execution condition
LDA RASC STA @ R A S C
— — — — — — — — — — — — — — — — — — — —
Explanation of Operation
4
RASC(.U) When the execution condition turns ON, the Hex ASCII character code currently stored
Text Processing Instructions
to the internal register is converted to binary data and is stored to the lower eight bites
of the 16-bit internal register as binary data. "0" is stored to the upper eight bits.
"About Internal Registers" page 1-17
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
3 6 4 3
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
The Hex ASCII character codes are converted when both the upper eight bits and lower
eight bits of the internal register before conversion are $30 to $39 or $41 to $46, and
the upper eight bits are $00, and the lower eight bits are $30 to $39 or $41 to $46. When
either of the upper eight bits or lower eight bits is not in this range, the Hex ASCII
character codes are not converted. At this time, special auxiliary relay CR2012 turns
ON.
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when there are ASCII character codes that cannot be handled. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"ASCII Code Table" page A-18
4-172
4-7 Text Processing Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
The Hex ASCII character code currently stored to data memory DM00000 is converted to binary
DM00010 DM00010
4 6 3 7 0 0 F 7
Conversion
0 0 3 7 0 0 0 7
ASC
RASC
DASC
RDASC
SMOV
SADD
SCMP
DISS
UNITS
LEN
RCOM
4-173
DASC(.U)
4-7 Text Processing Instructions
DASC.D DASC
DASC DASC.S
DASC.L Decimal ASCII Converts numerical values to a
ARITHMETIC OPERATION INSTRUCTIONS
@DASC @DASC.S
@DASC.L
S — — — — — — — — — — — — * — — —
D — — — — — — — — — — — — *
4 * When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
S : Specifies the numerical value to convert to decimal ASCII text string or the device in which
Text Processing Instructions
DASC.D When the execution condition is ON, the 32-bit unsigned binary data specified by
S is converted to decimal ASCII character code text string, and is stored as follows
starting from the device specified by D . End code NUL(00H) is stored at the end
of the text string.
D +4: + –
N
D +5: U
L
(00H)
4-174
4-7 Text Processing Instructions
Explanation of Operation: DASC.S DASC.L (16/32-bit signed binary → decimal ASCII code
conversion)
DASC.S When the execution condition is ON, the 16-bit signed binary data specified by S
is converted to decimal ASCII character code text string, and is stored as follows 4
starting from the device specified by n . End code NUL(00H) is stored at the end
D +2: + –
N
D +3: U
L
(00H)
ASC
DASC.L When the execution condition is ON, the 32-bit signed binary data specified by S
RASC
is converted to decimal ASCII character code text string, and is stored as follows
DASC
starting from the device specified by n . End code NUL(00H) is stored at the end
RDASC
of the text string.
SMOV
SADD
bit bit bit bit bit bit
31 S +1 16 15 S 0 15 0 SCMP
UNITS
32 bits D +1: 100,000,000,'s 10,000,000's
LEN
D +2: 1000,000's 100,000's
RCOM
D +3: 10,000's 1,000's
N
D +5: – U
L
(00H)
00H is automatically
stored at the end.
4-175
4-7 Text Processing Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate or the value after conversion
exceeds the range of devices. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"ASCII Code Table" page A-18
"About Indirect Specification" page 1-42
Execution Timing
DASC(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@DASC(.U/.D/.S/.L) This instruction is executed for one scan only at the up edge of the execution
4 condition.
Text Processing Instructions
Scan
ON
Execution condition
OFF
[Example] The 16-bit unsigned binary data currently stored to data memory DM00000 is
converted to ASCII text string, and the result is stored to DM00010.
00000 DASC
DM00000 DM00010
Zero suppress ON
DM00010: 1(31H) 2(32H)
CR2814: ON
N
DM00011: 3(33H) U
L
(00H)
DM00012:
4-176
4-7 Text Processing Instructions
[Example] The 16-bit signed binary data currently stored to data memory DM00000 is converted
to ASCII text string, and the result is stored to DM00010.
CR2002 DASC.S
DM00000 DM00010
DM00013:
ASC
DASC
The 16-bit unsigned binary data currently stored to data memory DM00000 is converted to decimal
RDASC
ASCII code, and the result is stored to DM00100 to DM00105.
SMOV
SADD
CR2002 DASC
DM00000 DM00010 SCMP
DISS
UNITS
LEN
RCOM
4-177
RDASC(.U)
4-7 Text Processing Instructions
RDASC.D RDASC
RDASC RDASC.S
Converts decimal
RDASC.L Decimal ASCII code
ARITHMETIC OPERATION INSTRUCTIONS
S — — — — — — — — — — — — * — — —
D — — — — — — — — — — — — *
4 * When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
S : Specifies the decimal ASCII text string to convert to numerical value or the device in which
Text Processing Instructions
Explanation of Operation: RDASC RDASC.D (ASCII text string → 16/32-bit unsigned binary
data conversion)
RDASC(.U) When the execution condition is ON, the decimal ASCII text string (end code NUL(00H)
is required at the end of the text string) starting from the device specified by S is
converted to 16-bit unsigned binary data, and is stored to the device specified by D .
RDASC.D When the execution condition is ON, the decimal ASCII text string (end code NUL(00H)
is required at the end of the text string) starting from the device specified by S is
converted to 32-bit unsigned binary data, and is stored to the device specified by
D / D +1.
S +4: + –
N
S +5: U
L
(00H) NUL (00H) is required at end of text string.
4-178
4-7 Text Processing Instructions
Explanation of Operation: RDASC.S RDASC.L (ASCII text string → 16/32-bit unsigned binary
data conversion) 4
RDASC.S When the execution condition is ON, the decimal ASCII text string (NUL(00H) is
S +2: + –
N
S +3: U
L
(00H) NUL (00H) is required at end of text string.
RDASC.L When the execution condition is ON, the decimal ASCII text string (NUL(00H) is
required at the end of the text string) starting from the device specified by S is ASC
converted to 32-bit signed binary data, and is stored to the device specified by D / RASC
D +1.
DASC
RDASC
bit bit bit bit bit bit
15 0 31 D +1 16 15 D 0 SMOV
S Sign 1,000,000,000's 32-bit signed binary data SADD
UNITS
S +3: 10,000's 1,000's
LEN
S +4: 100's 10's
RCOM
N
S +5: – U (00H)
L NUL (00H) is required at end of text string.
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate, or a relay other than the
leading channel is specified, or the text string contains inappropriate characters, or
when the value after conversion exceeds the 16/32-bit signed binary data range.
Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"ASCII Code Table" page A-18
"About Indirect Specification" page 1-42
4-179
4-7 Text Processing Instructions
ARITHMETIC OPERATION INSTRUCTIONS
Execution Timing
RDASC(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
condition is ON.
@RDASC(.U/.D/.S/.L)This instruction is executed for one scan only at the up edge of the execution
condition.
Scan
ON
Execution condition
OFF
CR2002 RDASC
DM00000 DM00010
bit bit
15 0
CR2002 RDASC.S
DM00000 DM00100
bit bit
15 0
4-180
4-7 Text Processing Instructions
00000 RDASC.D
DM00000 DM00010
bit bit
15 0
4
When input relay 00000 is ON, the ASCII text string currently stored to data memory DM00000 is
00000 RDASC.L
DM00000 DM00010
bit bit
15 0
RDASC
SMOV
SADD
SCMP
DISS
UNITS
LEN
RCOM
4-181
SMOV
4-7 Text Processing Instructions
SMOV
Move text string Stores text strings to a specified device.
ARITHMETIC OPERATION INSTRUCTIONS
SMOV
@SMOV
Ladder program Input method
Execution condition SMOV
S D S M O V S D
S — — — — — — — — — — — — * — — —
D — — — — — — — — — — — — *
* When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
4 S : Specifies the leading device to which the source text string data to be moved is currently
stored.
Text Processing Instructions
D : Specifies the leading device (move destination) to store the data to.
Range of DMs, TMs and CMs that can be used for operands:
DM00000 to DM19872 (when memory is not expanded) TM000 to TM384
DM00000 to DM39872 (when memory is expanded) CM0000 to CM3872
Explanation of Operation
When the execution condition is ON, the text string data (end code NUL(00H) is required at the end
of the text string) currently stored starting from the device specified by S is stored starting from
the device specified by D . End code NUL(00H) is stored at the end of the text string. Up to 256
1-byte characters can be handled as the text string.
S D
Text string data Move Text string data
[Example]
State of device before instruction execution State of device after instruction execution
...
S : A(41H) B(42H)
S +1 : C(43H) D(44H)
...
N
S +2 : E(45H) U
L
(00H) D : A(41H) B(42H)
...
16 bits 16 bits
4-182
4-7 Text Processing Instructions
Execution Timing
SMOV This instruction is executed at each scan for the duration that the execution
condition is ON.
@SMOV This instruction is executed for one scan only at the up edge of the execution
condition.
4
Execution condition
OFF
RASC
The ASCII text string currently stored starting from data memory DM00000 is stored to DM00100 DASC
onwards. RDASC
SMOV
CR2002 SMOV
SADD
DM00000 DM00100
SCMP
DISS
UNITS
LEN
RCOM
DM00000: A(41H) B(42H) DM00100: A(41H) B(42H)
DM00005: DM00105:
...
...
4-183
SADD
4-7 Text Processing Instructions
SADD Unites the text string of the
Add text string
specified device.
ARITHMETIC OPERATION INSTRUCTIONS
SADD
@SADD
Ladder program Input method
Execution condition SADD
S1 S2 D S A D D S1 S2 D
S1 — — — — — — — — — — — — * — — —
S2 — — — — — — — — — — — — *
D — — — — — — — — — — — — *
* When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
4 S1 : Specifies the leading device to which the text string to unite is currently stored.
Text Processing Instructions
S2 : Specifies the leading device to which the text string to unite is currently stored.
D : Specifies the leading device to which the united text string is to be stored.
Range of DMs, TMs and CMs that can be used for operands:
DM00000 to DM19872 (when memory is not expanded) TM000 to TM384
DM00000 to DM39872 (when memory is expanded) CM0000 to CM3872
Explanation of Operation
When the execution condition is ON, the text string currently stored starting from the device specified
by S1 is united with the text string currently stored starting from the device specified by S2 .
The result of the union is stored starting from the device specified by D , and the end code
NUL(00H) is stored at the end of the text string.
The end code NUL(00H) is required at the end of the text strings specified by S1 and S2 . Up
to 256 1-byte characters can be handled as the text string.
S1 A(41H) B(42H)
N
S1 +1 C(43H) U (00H)
L D A(41H) B(42H)
D +1 C(43H) D(44H)
D +2 E(45H) F(46H)
N
S2 D(44H) E(45H) D +3 G(47H) U
L
(00H)
S2 +1 F(46H) G(47H)
N
S2 +2 U
L
(00H)
Note: • Prevent the text string that starts S1 and S2 from being duplicated on D . If the
same text strings are specified, CR2012 will turn ON, and the instruction will not be
executed.
• Prevent the text string after it is united from exceeding 256 characters.
4-184
4-7 Text Processing Instructions
Execution Timing
SADD This instruction is executed at each scan for the duration that the execution
condition is ON.
4
@SADD This instruction is executed for one scan only at the up edge of the execution
Scan
ON
Execution condition
OFF
ASC
DASC
The ASCII text string currently stored starting from data memory DM00000 is united with the ASCII RDASC
text string currently stored starting from DM00100, and the result is stored to DM00200 onwards. SMOV
SADD
CR2002 SADD
SCMP
DM00000 DM00100 DM00200
DISS
UNITS
LEN
4-185
SCMP
4-7 Text Processing Instructions
SCMP
Compare text string Compares text strings.
ARITHMETIC OPERATION INSTRUCTIONS
SCMP
@SCMP
Ladder program Input method
Execution condition SCPM
S1 S2 S C M P S1 S2
S1 — — — — — — — — — — — — *
S2 — — — — — — — — — — — — *
* When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
4 S1 : Specifies the leading device to which the ASCII text string to compare is currently stored.
S2 : Specifies the leading device to which the ASCII text string to compare is currently stored.
Text Processing Instructions
Range of DMs, TMs and CMs that can be used for operands:
DM00000 to DM19872 (when memory is not expanded) TM000 to TM384
DM00000 to DM39872 (when memory is expanded) CM0000 to CM3872
Compare
Compare
...
When the text strings are found to be the same as a result of comparing up to end code NUL(00H),
operation flag CR2010 turns ON.
Compare Result State of Operation Flag
When (all characters of S1 ) = (all characters of S2 ) CR2010→ON
4-186
4-7 Text Processing Instructions
Execution Timing
SCMP This instruction is executed at each scan for the duration that the execution
condition is ON. 4
@SCMP This instruction is executed for one scan only at the up edge of the execution
Scan
ON
Execution condition
OFF
ASC
RASC
Sample Program DASC
RDASC
The ASCII text string currently stored starting from data memory DM00000 is compared in order
from the start of the ASCII text string currently stored starting from DM00100. SMOV
SADD
When all characters match as a result of the comparison, output relay 00500 turns ON. When even
SCMP
one character does not match, output relay 00501 turns ON.
DISS
UNITS
CR2009 00501
CR2011
4-187
DISS
4-7 Text Processing Instructions
DISS Disperses text strings in byte units into
Disperse text string
text strings in word units.
ARITHMETIC OPERATION INSTRUCTIONS
DISS
@DISS
Ladder program Input method
Execution condition DISS
S D D I S S S S2 D
S — — — — — — — — — — — — * — — —
D — — — — — — — — — — — — *
* When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
4 S : Specifies the leading device to which the text string to disperse is currently stored.
D : Specifies the leading device to which the dispersed text string is to be stored.
Text Processing Instructions
Range of DMs, TMs and CMs that can be used for operands:
DM00000 to DM19872 (when memory is not expanded) TM000 to TM384
DM00000 to DM39872 (when memory is expanded) CM0000 to CM3872
Explanation of Operation
When the execution condition is ON, the text string of byte units currently stored starting from the
device specified by S is dispersed, and is stored in word units starting from the device specified
by D . The end code NUL(00H) is required at the end of the text strings specified by S . Up
to 256 1-byte characters can be handled as the text string.
D 0 a(61H)
S a(61H) b(62H) D +1 0 b(62H)
S +1 c(63H) d(64H) D +2 0 c(63H)
N
S +2 e(63H) U
L
(00H) D +3 0 d(64H)
D +4 0 e(65H)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate, or a relay other than the
leading channel is specified, or the text string to be dispersed including the end code
exceeds 256 characters, or the storage destination device for the text string that is
united exceeds the device range. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-188
4-7 Text Processing Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
The ASCII text string in byte units currently stored starting from data memory DM00000 is dispersed
CR2002 DISS
DM00000 DM00100
ASC
RASC
DASC
RDASC
SMOV
SADD
SCMP
DISS
UNITS
LEN
RCOM
4-189
UNIS
4-7 Text Processing Instructions
UNIS Unites text strings in word units into
Unite text string
text strings in byte units.
ARITHMETIC OPERATION INSTRUCTIONS
UNIS
@UNIS
Ladder program Input method
Execution condition UNIS
S D n U N I S S D n
S — — — — — — — — — — — — * — — —
D — — — — — — — — — — — — *
n — — — — — — — — — — — — — — —
4 * When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
: Specifies the leading device to which the text string to unite is currently stored.
S
Text Processing Instructions
D : Specifies the leading device to which the united text string is to be stored.
n : Specifies the number of characters to unit within the range 1 to 255.
Range of DMs, TMs and CMs that can be used for operands:
DM00000 to DM19872 (when memory is not expanded) TM000 to TM384
DM00000 to DM39872 (when memory is not expanded) CM0000 to CM3872
Explanation of Operation
When the execution condition is ON, the text string in word units currently stored starting from the
device specified by S is stored in byte units to the device specified by D . The number of
characters to unit is specified by n .
S a(61H)
S +1 b(62H) D a(61H) b(62H)
S + n -1 z(7AH) D +( n /2)-1
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate or a relay other than the
leading channel is specified. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-190
4-7 Text Processing Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
The ASCII text string currently stored in word units to data memories DM00000 to DM00099 is united
CR2002 UNIS
DM00000 DM00100 #00100
ASC
RASC
DASC
RDASC
SMOV
SADD
SCMP
DISS
UNITS
LEN
RCOM
4-191
LEN
4-7 Text Processing Instructions
LEN Counts the number of characters in
Detect text string length
text strings.
ARITHMETIC OPERATION INSTRUCTIONS
LEN
@LEN
Ladder program Input method
Execution condition LEN
S D L E N S D
S — — — — — — — — — — — — * — — —
D — — — — — — — — — — — — *
* When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
4 S : Specifies the leading device to which the text string whose number of characters to count
is currently stored.
Text Processing Instructions
Explanation of Operation
When the execution condition is ON, the number of characters in the text string data (end code
NUL(00H) is required at the end of the text string) currently stored starting from the device specified
by S is counted. The number of characters is stored in binary data to the device specified by
D . Up to 256 1-byte characters can be handled as the text string.
S a(61H) b(62H) D 26
16 bits
S +1 c(63H) d(64H) (1 word)
S +2 e(65H) f(66H)
:
w(77H) x(78H)
y(79H) z(7AH)
N
U (00H)
L
Note: 2-byte characters (shift JIS, etc.) are counted as two characters.
4-192
4-7 Text Processing Instructions
Execution Timing
LEN This instruction is executed at each scan for the duration that the execution
condition is ON.
@LEN This instruction is executed for one scan only at the up edge of the execution 4
condition.
Execution condition
OFF
RASC
The length (number of characters) of the ASCII text string currently stored starting from data memory DASC
DM00000 is counted, and is stored to DM00100. RDASC
SMOV
CR2002 LEN
SADD
DM00000 DM00100
SCMP
DISS
UNITS
RCOM
DM00001: C(43H) D(44H)
4-193
RCOM
4-7 Text Processing Instructions
RCOM Reads the comment of a speci-
Read comment
fied device.
ARITHMETIC OPERATION INSTRUCTIONS
RCOM
@RCOM
Ladder program Input method
Execution condition RCOM
S D R C O M S D
S — — — — — — —
D — — — — — — — — — — — — *
* When indirectly specifying a relay, specify the leading channel (1000, 1100 and so forth).
Range of DMs, TMs and CMs that can be used for operands:
DM00000 to DM19872 (when memory is not expanded) TM000 to TM384
DM00000 to DM39872 (when memory is expanded) CM0000 to CM3872
Explanation of Operation
When the execution condition is ON, the comment of the device specified by S is read, and is
stored starting from the device specified by D . End code NUL(00H) is stored at the end of the
text string.
Up to 32 1-byte characters can be handled as the text string.
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when indirect specification range is inappropriate or a relay other than the
leading channel is specified. Otherwise, OFF
The instruction is not executed when CR2012 has turned ON.
"About Indirect Specification" page 1-42
4-194
4-7 Text Processing Instructions
Scan
ON
Execution condition
OFF
Sample Program 4
The device comment "STARTING" of input relay 00000 is stored to DM00100, and the device
CR2002 RCOM
DM00000 DM00100
RCOM
00000 DM00200
SCMP
DISS
UNITS
LEN
RCOM
4-195
4-7 Text Processing Instructions
ARITHMETIC OPERATION INSTRUCTIONS
4
Text Processing Instructions
4-196
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
EXTENDED INSTRUCTIONS
These instructions are for data processing, clock processing, high-
speed processing, and positioning processing.
5-1
5-1 Data Processing Instructions
Bit count BCNT Counts the number of bits currently ON in internal 5-6
registers.
Data count DCNT Counts the number of data items that are the same as 5-8
internal registers in a specified range.
Search SER Searches the number of data items that are the same 5-10
as internal registers in a specified range.
Search max. MAX Searches the maximum value in a specified range. 5-12
value
5 Search min. value MIN Searches the minimum value in a specified range. 5-16
Data Processing Instructions
Extend data EXT Extends the signs of data in internal registers. 5-32
5-2
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
5
5-3
HKEY
5-1 Data Processing Instructions Stores Hex key data to the read control relays by
HKEY Hex key input
time division.
S1 — — — — — — — — — — — — — — — — — —
EXTENDED INSTRUCTIONS
S2 — — — — — — — — — — — — — —
S1 : Specifies the leading device of the input relays to perform reading on.
S2 : Specifies the leading device of the output relays to perform timing output of reading on.
Explanation of Operation
• Four input relay and output relays each are used starting from the No. specified by S1 and S2 .
• When the execution condition is ON, the information of the four bits specified by S1 are captured
while being divided into four times, and is stored to control relays CR3600 to CR3615. Eight scans
5 (approx. 80 ms when the scan time is 10 ms or less) are required until input processing ends.
• Only one HKEY instruction can be used in a program.
Data Processing Instructions
• Execution of the instruction is canceled. CR3600 to CR3615 are reset when the scan time exceeds
200 ms.
0 1 2 3
C D E F
The HKEY instruction turns special auxiliary relays (CR3600 to CR3615) corresponding to the input
keys ON.
Relay No. CR3600 CR3601 CR3602 CR3603 CR3604 CR3605 CR3606 CR3607 CR3608 CR3609 CR3610 CR3611 CR3612 CR3613 CR3614 CR3615
Corresponding key 0 1 2 3 4 5 6 7 8 9 A B C D E F
Multiple key enable/disable, and end of key reading timing change according to the state of the
special auxiliary relays.
[Tip]
• With the HKEY instruction, use the transistor output type unit to turn outputs ON/OFF at every
scan.
• Set so that the input time constant is less than the scan time.
Note: When the relay assigned to the KL Series is specified as the operand, set so that the "scan
time of KV-700 is greater than the KL communication cycle time." The CPU scan time can
be set as a fixed scan time.
5-4
5-1 Data Processing Instructions
Operation flag
The operation flag does not change.
Execution Timing
HKEY This instruction is executed at each scan for the duration that the execution condition
is ON.
EXTENDED INSTRUCTIONS
Scan
ON
Execution
condition OFF
Sample Program
Changing the setting value of internal counters by BCD digital switch
When input relay 00004 is ON, and control relay CR3515 turns ON, the setting value of counter C000 5
changes to the value set by the digital switch (connected to input relays 00000 to 00003).
00004 HKEY
00000
00500
CR3515 CR3600 C000
LDA TBIN STA
END
ENDH
HKEY
BCNT
Connect the KV-700 to the digital switch as follows. (Be sure to insert a diode.) DCNT
SER
MAX
MIN
AVG
0 1 2 3
10 10 10 10
ZRES
BCD digital
FIFOW
switch
FIFOR
Diode EXT
1 2 4 8
+ COM 00000 00001 00002 00003
24 VDC KV-700
– COM 00500 00501 00502 00503
5-5
BCNT(.U)
5-1 Data Processing Instructions Counts the number of bits currently ON in
BCNT BCNT.D
BCNT Bit count
internal registers.
— — — — — — — — — — — — — — — — — — —
The data range that can be handled varies according to the suffix type.
"About Suffixes" page 1-28
Explanation of Operation
BCNT(.U) When the execution condition is ON, the bits in 16-bit internal registers that are
currently ON are detected, and the number of ON bits is stored to 16-bit internal register
as 16-bit binary data.
"About Internal Registers" page 1-17
5
Data Processing Instructions
[Example] When #10313 (10100001001001 in binary) is currently stored to 16-bit internal register
bit bit
15 0
16-bit internal
0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1
register
16-bit internal
#00005
register
BCNT.D When the execution condition is ON, the bits in 32-bit internal registers that are
currently ON are detected, and the number of ON bits is stored to 32-bit internal register
as 32-bit binary data.
"About internal registers" page 1-17
32-bit internal
#00009
register
5-6
5-1 Data Processing Instructions
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... No change in state
EXTENDED INSTRUCTIONS
Execution Timing
BCNT(.U/.D) This instruction is executed at each scan for the duration that the execution
condition is ON.
Scan
ON
Execution
condition OFF
Sample Program 5
The number of relays in internal relays 01000 to 01015 that are ON is counted, and the result is
HKEY
BCNT
DCNT
SER
MAX
MIN
AVG
ZRES
FIFOW
FIFOR
EXT
5-7
5-1 Data Processing Instructions
DCNT(.U) Detects devices of the same value as the
DCNT DCNT.D
DCNT Data count internal register in the specified range, and
counts the number of devices.
Internal CR CR CR CR
Devices I O auxiliary T C CTC CR DM TM T C CTH CTC CM #/$ #TM 2009 2010 2011 2012
S — — — — — — — — — — — — — — — —
n — — — — — — — — — — — — — — —
Explanation of Operation
DCNT(.U) When the execution condition is ON, n number of data items starting from S
is compared with each respective 16-bit internal register. The number of data items
5 having the same value as the value in 16-bit internal registers is stored to the 16-bit
internal register. The number of data items is stored in 16-bit unsigned binary data.
Data Processing Instructions
DCNT.D When the execution condition is ON, n number of data items starting from S
is compared with each respective 32-bit internal register. The number of data items
having the same value as the value in 32-bit internal registers is stored to the 32-bit
internal register. The number of data items is stored in 32-bit unsigned binary data.
S +3 23456789 S +2 Compare
The same value as the value of
S +5 34567890 S +4 Compare the 32-bit internal register is
n items stored.
The number of data items is
(2 n words) S +2 ( n –3) +1 12345678 S +2 ( n –3) Compare counted. The result is stored in
the 32-bit internal register.
S +2 ( n –2) +1 45678901 S +2 ( n –2) Compare
Result 2
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when result is 0 (zero). Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... No change in state
5-8
5-1 Data Processing Instructions
Execution Timing
DCNT(.U/.D) This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
EXTENDED INSTRUCTIONS
DCNT(.U/.D) Execution Execution
Sample Programs
(1) 16-bit unsigned binary data count
When input relay 00000 is ON, the 16-bit unsigned binary data currently stored to data memory
DM00000 is compared with the 16-bit unsigned binary data currently stored to DM00100 to
DM00199. The number of devices to which the same value is stored is stored to DM00010.
When input relay 00000 is ON, the 32-bit unsigned binary data currently stored to data memories BCNT
DM00000/DM00001 is compared with the 32-bit unsigned binary data currently stored to DCNT
DM00100 to DM00299. The number of devices to which the same value is stored is stored to SER
DM00010/DM00011. MAX
MIN
00000 DM00000 DM00100 DM00010
AVG
LDA.D DCNT.D STA.D
#00100 ZRES
FIFOW
FIFOR
When input relay 00000 is ON, the 32-bit signed binary data currently stored to data memories
DM00000/DM00001 is compared with the 32-bit signed binary data currently stored to DM00100
to DM00299. The number of devices to which the same value is stored is stored to DM00010/
DM00011.
5-9
5-1 Data Processing Instructions
SER(.U) Detects devices of the same value as the
SER SER.D
SER Search internal register in the specified range, and
detects their device Nos.
Internal CR CR CR CR
Devices I O auxiliary T C CTC CR DM TM T C CTH CTC CM #/$ #TM 2009 2010 2011 2012
S — — — — — — — — — — — — — — — —
n — — — — — — — — — — — — — — —
Explanation of Operation
5 SER(.U) When the execution condition is ON, n number of data items starting from S
is compared with each respective 16-bit internal register. The device Nos. currently
Data Processing Instructions
stored with the same value as the value in 16-bit internal registers is stored to the 16-
bit internal register. The device Nos. are stored in 16-bit unsigned binary data.
bit bit 16-bit internal register
15 0 bit15 bit0
S +1 2345 Compare
The No. of the device to which the
same value as the 16-bit internal
S +2 3456 Compare
register is stored.
n items The result is stored in the 16-bit
internal register.
( n word)
S + n –3 1234 Compare
SER.D When the execution condition is ON, n number of data items starting from S
is compared with each respective 32-bit internal register. The device Nos. of the lower
16 bits currently stored with the same value as the value in 32-bit internal registers is
stored to the 32-bit internal register. When two or more are detected, the smallest
device No. is stored. The device Nos. are stored in 32-bit unsigned binary data.
S +3 23456789 S +2 Compare
The No. of the device to which
S +5 34567890 S +4 Compare the same value as the 32-bit
n items internal register is stored.
The result is stored in the 32-bit
(2 n words) S +2 ( n –3) +1 45678901 S +2 ( n –3) Compare internal register.
Result S +2
Note: • Only the device No. is stored as the result. There is no difference in DM, TM and CM
device types.
• When there are no matching devices, nothing is written to internal registers. Accordingly,
the value that was last stored by LDA remains in the internal register.
5-10
5-1 Data Processing Instructions
Operation flag
CR2009 .......... No change in state
CR2010 .......... ON when the search target is found in the specified range. Otherwise, OFF
CR2011 .......... No change in state
CR2012 .......... No change in state
EXTENDED INSTRUCTIONS
Execution Timing
SER(.U/.D) This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
Sample Programs 5
(1) 16-bit unsigned binary data search
BCNT
00000 DM00000 DM00100 CR2010 DM00010 DCNT
LDA.S SER STA.S
#00100 SER
MAX
(3) 32-bit unsigned binary data search MIN
When input relay 00000 is ON, the 32-bit unsigned binary data currently stored to data memories AVG
DM00000/DM00001 is compared with the 32-bit unsigned binary data currently stored to ZRES
DM00100 to DM00299. The device Nos. to which the same value is stored are stored to FIFOW
DM00010/DM00011. FIFOR
EXT
00000 DM00000 DM00100 CR2010 DM00010
LDA.D SER.D STA.D
#00100
5-11
MAX(.U)
5-1 Data Processing Instructions
MAX.D Calculates the maximum value of binary
MAX MAX.S
MAX Search max. value data currently stored in a specified range,
and stores this to internal registers.
MAX.L
S — — — — — — — — — — — — — — — — —
n — — — — — — — — — — — — — — —
5
Explanation of Operation: MAX(.U) MAX.D (maximum value of 16/32-bit unsigned binary data)
Data Processing Instructions
MAX(.U) When the execution condition is ON, each of n items of data starting from S is
compared. Currently stored values are compared as 16-bit unsigned binary data. As
a result of comparison, the maximum value is stored to 16-bit internal register.
bit bit
15 0
n items 9876
( n word)
S + n –3 9876
S + n –2 8765
S + n –1 7654
MAX.D When the execution condition is ON, each of n items of data starting from S is
compared. Currently stored values are compared as 32-bit unsigned binary data. As
a result of comparison, the maximum value is stored to 32-bit internal register.
bit bit bit bit
31 16 15 0
Operation flag
The operation flag does not change.
5-12
5-1 Data Processing Instructions
Explanation of Operation: MAX.S MAX.L (maximum value of 16/32-bit signed binary data)
MAX.S When the execution condition is ON, each of n items of data starting from S
is compared. Currently stored values are compared as 16-bit signed binary data. As
a result of comparison, the maximum value is stored to 16-bit internal register.
bit bit
15 0
EXTENDED INSTRUCTIONS
range is
16-bit internal register
S +2 3456 stored. bit15 bit0
n items 3456
( n word)
S + n –3 9876
S + n –2 8765
S + n –1 7654
MAX.L When the execution condition is ON, each of n items of data starting from S
is compared. Currently stored values are compared as 32-bit signed binary data. As
a result of comparison, the maximum value is stored to 32-bit internal register.
bit
31
bit bit
16 15
bit
0
5
S +1 12345678 S The maximum
Operation flag
The operation flag does not change. HKEY
BCNT
DCNT
Execution Timing SER
MAX(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution MAX
AVG
Scan ZRES
FIFOW
ON
Execution
FIFOR
condition OFF
EXT
5-13
5-1 Data Processing Instructions
Sample Programs
(1) 16-bit unsigned binary data max. value search
When input relay 00000 is ON, the 16-bit unsigned binary data currently stored to data memories
DM00000 to DM00099 is compared. The maximum value is stored to DM01000.
5-14
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
5
BCNT
DCNT
SER
MAX
MIN
AVG
ZRES
FIFOW
FIFOR
EXT
5-15
MIN(.U)
5-1 Data Processing Instructions
MIN.D Calculates the minimum value of binary data
MIN MIN.S
MIN Search min. value currently stored in a specified range, and
stores this to internal registers.
MIN.L
S — — — — — — — — — — — — — — — — —
n — — — — — — — — — — — — — — —
5
Explanation of Operation: MIN(.U) MIN.D (minimum value of 16/32-bit unsigned binary data)
Data Processing Instructions
MIN(.U) When the execution condition is ON, each of n items of data starting from S
is compared. Currently stored values are compared as 16-bit unsigned binary data. As
a result of comparison, the minimum value is stored to 16-bit internal register.
bit bit
15 0
S 1234
The minimum
S +1 2345 value in this
range is 16-bit internal register
S +2 3456 stored. bit15 bit0
n items 1234
( n word)
S + n –3 7654
S + n –2 8765
S + n –1 9876
MIN.D When the execution condition is ON, each of n items of data starting from S
is compared. Currently stored values are compared as 32-bit unsigned binary data. As
a result of comparison, the minimum value is stored to 32-bit internal register.
S +1 12345678 S
The minimum
S +3 23456789 S +2 value in this
range is bit bit
S +5 34567890 S +4 stored. 31
32-bit internal register
0
n items 12345678
(2 n words) S +2 ( n –3) +1 76543210 S +2 ( n –3)
S +2 ( n –2) +1 87654321 S +2 ( n –2)
S +2 ( n –1) +1 98765432 S +2 ( n –1)
Operation flag
The operation flag does not change.
5-16
5-1 Data Processing Instructions
Explanation of Operation: MIN.S MIN.L (minimum value of 16/32-bit signed binary data)
MIN.S When the execution condition is ON, each of n items of data starting from S
is compared. Currently stored values are compared as 16-bit signed binary data. As
a result of comparison, the minimum value is stored to 16-bit internal register.
bit bit
15 0
S 1234
The minimum
value in this
EXTENDED INSTRUCTIONS
S +1 2345
range is 16-bit internal register
S +2 3456 stored. bit15 bit0
n items –3456
( n word)
S + n –3 –3456
S + n –2 –2345
S + n –1 –1234
MIN.L When the execution condition is ON, each of n items of data starting from S
is compared. Currently stored values are compared as 32-bit signed binary data. As
a result of comparison, the minimum value is stored to 32-bit internal register.
bit
31
bit bit
16 15
bit
0
5
S +1 12345678 S
Operation flag
The operation flag does not change. HKEY
BCNT
DCNT
Execution Timing SER
MIN(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution MAX
AVG
Scan ZRES
FIFOW
ON
Execution
FIFOR
condition OFF
EXT
5-17
5-1 Data Processing Instructions
Sample Programs
(1) 16-bit unsigned binary data min. value search
When input relay 00000 is ON, the 16-bit unsigned binary data currently stored to data memories
DM00000 to DM00099 is compared. The minimum value is stored to DM01000.
5-18
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
5
BCNT
DCNT
SER
MAX
MIN
AVG
ZRES
FIFOW
FIFOR
EXT
5-19
AVG(.U)
5-1 Data Processing Instructions
AVG.D Calculates the average value of binary data
AVG AVG.S
AVG Average currently stored in a specified range, and
stores this to internal registers.
AVG.L
S — — — — — — — — — — — — — — — — —
n — — — — — — — — — — — — — — —
S : Specifies the leading device of the range to calculate the average value.
n : Specifies the number of data items whose average value is to be calculated.
The data range that can be handled varies according to the suffix type.
"About Suffixes" page 1-28
5
Explanation of Operation: AVG(.U) AVG.D (average value of 16/32-bit unsigned binary data)
Data Processing Instructions
AVG(.U) When the execution condition is ON, the average value of n number of 16-bit
unsigned binary data items starting from S is calculated and stored to 16-bit internal
register.
bit bit
15 0
S 16
S +1 256
S +2 4096
n items The Average value is stored in the
16-bit internal register.
S + n –3 16383
16-bit internal register
S + n –2 32767 bit15 bit0
AVG(.D) When the execution condition is ON, the average value of n number of 32-bit
unsigned binary data items starting from S is calculated and stored to 32-bit internal
register.
S +1 12345678 S
S +3 23456789 S +2
S +5 34567890 S +4
n items The Average value is stored in the
(2 n words) S +2 ( n –3) +1 32-bit internal register.
78901234 S +2 ( n –3)
S +2 ( n –2) +1 89012345 S +2 ( n –2) bit
31
32-bit internal register bit
0
Operation flag
The operation flag does not change.
5-20
5-1 Data Processing Instructions
Explanation of Operation: AVG.S AVG.L (average value of 16/3-bit signed binary data)
AVG.S When the execution condition is ON, the average value of n number of 16-bit
signed binary data items starting from S is calculated and stored to 16-bit internal
register.
bit bit
15 0
S –32700
EXTENDED INSTRUCTIONS
S +1 –16350
S +2 –8175
n items The Average value is stored in the
( n word) 16-bit internal register.
S + n –3 8175
16-bit internal register
S + n –2 16350 bit15 bit0
AVG.L When the execution condition is ON, the average value of n number of 32-bit
signed binary data items starting from S is calculated and stored to 32-bit internal
register.
5
bit bit bit bit
S +1 –90123456 S
S +3 –89012345 S +2
S +5 –78901234 S +4
n items The Average value is stored in the
(2 n words) S +2 ( n –3) +1 32-bit internal register.
78901234 S +2 ( n –3)
S +2 ( n –2) +1 89012345 S +2 ( n –2) bit
31
32-bit internal register bit
0
Operation flag
The operation flag does not change. HKEY
BCNT
DCNT
MAX
AVG(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution
MIN
condition is ON.
AVG
ZRES
Scan
FIFOW
ON
Execution FIFOR
condition OFF EXT
5-21
5-1 Data Processing Instructions
Sample Programs
(1) 16-bit unsigned binary data average value calculation
When input relay 00000 is ON, the average value of 16-bit unsigned binary data currently stored
to data memories DM00000 to DM00099 is calculated, and the average value is stored to
DM01000.
#00100
5
(3) 32-bit unsigned binary data average value calculation
Data Processing Instructions
When input relay 00000 is ON, the average value of 32-bit unsigned binary data currently stored
to data memories DM00000/DM00001 to DM00198/DM00199 is calculated, and the result is
stored to DM01000/DM01001.
5-22
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
"WSR Instruction" page 4-84
CR2008 DM00000
ZRES
DM00119
00000 WSR.D
DM00100 #00010 #00001
MOV.D
DM00000 DM00100
DM00100
AVG.D
DM01000
STA.D
5
#00010
BCNT
DCNT
SER
MAX
MIN
AVG
ZRES
FIFOW
FIFOR
EXT
5-23
5-1 Data Processing Instructions Resets all values currently stored in the specified
ZRES ZRES Zone reset
range.
S1 — — — — — — — — — — — — — — —
S2 — — — — — — — — — — —
Explanation of Operation
When the execution condition is ON, devices in the range specified by S1 to S2 are reset.
S1 2048 Reset 0
S1 +1 4096 Reset 0
S1 +2 8192 Reset 0
: :
S2 –2 16384 Reset 0
S2 –1 32767 Reset 0
S2 65535 Reset 0
01002: ON ON :01002
01003: ON ON :01003
01004: ON ON :01004
Operation flag
The operation flag does not change.
5-24
5-1 Data Processing Instructions
Execution Timing
ZRES This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
EXTENDED INSTRUCTIONS
ZRES Execution Execution
Sample Program
When input relay 00000 is ON, data memories DM00000 to DM00099 are reset.
When 00000 is OFF, internal auxiliary relays 01000 to 01115 are reset.
00000 DM00000
ZRES
DM00099
00000 01000
ZRES
01115
5
BCNT
DCNT
SER
MAX
MIN
AVG
ZRES
FIFOW
FIFOR
EXT
5-25
FIFOW(.U)
5-1 Data Processing Instructions FIFOW
FIFOW FIFOW.D
Write FIFO Writes data to the FIFO table.
S — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — — — —
S : Specifies the device currently stored with the data to write to the data block.
D : Specifies the leading device of the data table.
The data range that can be handled varies according to the suffix type.
"About Suffixes" page 1-28
Explanation of Operation
5 About data tables and data block
The FIFOW and FIFOR instructions execute FIFO (First In First Out) processes using a group of
Data Processing Instructions
devices called a "data table." The figure below shows the structure of a data table.
bit bit
15 0
D n Number of data items: The number of data items written to the data block
As the initial settings, reset (store "0") the number of data items (n) to be stored to D . Also, set
the maximum number of stored data items to D +1.
As the leading device D of the data table, specify the same device as leading device S of
the data table for the corresponding FIFOR instruction.
FIFOW(.U) When the execution condition is ON, the 16-bit data specified at S is stored to the
end of the data block.
• The storage destination of the data becomes D + (n + 2).
• n is incremented (by 1) after storage.
n D n+1 D
max : D +1 max : D +1
A : D +2 A : D +2
n items B : D +3 n+1 items B : D +3
bit S bit D : D D : D
15 0 + (n+1) + (n+1)
E Spare : D + (n+2) E : D + (n+2)
Spare : D + (n+3) Spare : D + (n+3)
5-26
5-1 Data Processing Instructions
FIFOW.D When the execution condition is ON, the 32-bit binary data specified by S / S +1
is stored to the end of the data block that starts with D +2.
• The storage destination of the data becomes D + n.
bit bit
31 0
D +1 : n D
D +3 : max : D +2
D +5 : A : D +4
EXTENDED INSTRUCTIONS
n items D +7 : B : D +6
:
bit
S +1 S bit
D + (2n+3) : D : D + (2n+2)
31 0
bit bit
31 0
D +1 : n+1 D
D +3 : max : D +2 5
D +5 : A : D +4
n+1 items :
D + (2n+3) : D : D + (2n+2)
D + (2n+5) : E : D + (2n+4)
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
HKEY
CR2011 .......... No change in state
BCNT
CR2012 .......... ON when the maximum number of stored data items is 0, when the stored data DCNT
exceeds the maximum number of stored data items, or at a maximum number SER
of stored data items that will cause the data table to exceed the range of de- MAX
vices. Otherwise OFF.
MIN
The instruction is not executed when CR2012 has turned ON.
AVG
ZRES
FIFOW
Execution Timing
FIFOR
FIFOW(.U/.D) This instruction is executed at each scan for the duration that the execution EXT
condition is ON.
Scan
ON
Execution
condition OFF
Sample Program
See the sample program for the FIFOR instruction.
"Sample Program" page 5-30
5-27
FIFOR(.U)
5-1 Data Processing Instructions FIFOR
FIFOR FIFOR.D
Read FIFO Reads data from the FIFO data table.
S — — — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
Explanation of Operation
5 About data tables and data block
The FIFOW and FIFOR instructions execute FIFO (First In First Out) processes using a group of
Data Processing Instructions
devices called a "data table." The figure below shows the structure of a data table.
bit bit
15 0
S n Number of data items: The number of data items written to the data block
As the leading device S of the data table, specify the same device as leading device D of
the data table for the corresponding FIFOW instruction.
FIFOR(.U) (1) When the execution condition is (2) After the data is stored, the content of
ON, the 16-bit data currently the data block is pushed forward by
stored to S +2 is stored to the one data item.
device specified by D .
n is decremented (by 1) after storage.
bit bit bit bit
15 0 15 0
S n S n-1
bit bit bit bit
S +1 max 15 D 0 S +1 max 15 D 0
S +2 A S +2 B A
S +3 B S +3 C
:
S +n D S +n E
5-28
5-1 Data Processing Instructions
FIFOR.D (1) When the execution condition is ON, the 32-bit data currently stored to S +4/
S +5 is stored to the device specified by D / D +1.
bit bit
31 0
S +1 : n : S
: S +2 bit bit
S +3 max 31 D +1 D 0
S +5 : A : S +4
S +7 : B : S +6
EXTENDED INSTRUCTIONS
S + (2n+1) : D : S + (2n)
S + (2n+3) : E : S + (2n+2)
(2) After the data is stored, the content of the data block is pushed forward by one data
item.
n is decremented (by 1) after storage.
bit bit
31 0
S +1 : n-1 : S
S +3
S +5 :
max
B
: S +2
: S +4
bit
31 D +1
A
D bit
0
5
S + (2n+1) : E : S + (2n)
Store "0".
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
HKEY
CR2011 .......... No change in state BCNT
CR2012 .......... ON when there is not data in the data table, when the maximum number of DCNT
stored data items exceeds the range of devices, or when the number of data SER
items is greater than the maximum number of stored data items. MAX
Otherwise OFF. MIN
The instruction is not executed when CR2012 has turned ON. AVG
ZRES
FIFOW
Execution Timing FIFOR
FIFOR(.U/.D) This instruction is executed at each scan for the duration that the execution EXT
condition is ON.
Scan
ON
Execution
condition OFF
5-29
5-1 Data Processing Instructions
Sample Program
ON Non-defective article
OFF Defective article
Input relay 00002: Discharge confirmation input
Output relay 00002: Discharge output
Timing sensor
00000 Defective
product box
When input relay 00000 (timing input) has turned ON, #0000 is written to the data table is the item
is judged as non-defective, and #1111 is written to the data table is the item is judged as defective.
When input relay 00002 (discharge confirmation input) has turned ON, output relay turns ON for one
second if the item is judged as non-defective, and the item is discharged.
5 If 11 or more workpieces are fed in from the inspection point to the discharge point, an error is output
from 00501.
Data Processing Instructions
00002 FIFOR
DM00100 DM00001
DM00001 #00100
= SHOT
$1111 00500
bit bit
15 0
DM00100:
Data content bit bit
DM00101: 10 15 0
Non-defective article: $0000: Non-defective
Data
$0000 DM00102: FIFOR DM00001 article
table
Defective article: $1111: Defective
DM00103: article
$1111
:
One-shot output
bit bit DM00105:
15 0 of 00501
DM00000 FIFOW DM00106:
5-30
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
5
BCNT
DCNT
SER
MAX
MIN
AVG
ZRES
FIFOW
FIFOR
EXT
5-31
EXT(.U)
5-1 Data Processing Instructions
EXT.D
EXT EXT.S
EXT Extend data Extends the data in internal registers.
EXT.L
– — — — — — — — — — — — — — — — — — — — —
EXT(.U) Extends 16-bit unsigned binary data currently stored to 16-bit internal registers to 32
bits.
Stores $0000 to temporary data memory TM000 and to the upper 16 bits of the 32-bit
internal register.
1234
1234 TM000 16-bit internal register
16-bit 1234
(1 word)
32-bit
(2 words)
EXT.S Extends 16-bit signed binary data currently stored to 16-bit internal registers to 32 bits.
Stores $0000 if the data is plus or $FFFF if the data is minus to temporary data memory
TM000 and to the upper 16 bits of the 32-bit internal register.
–1234
–1234 TM000 16-bit internal register
16-bit –1234
(1 word)
32-bit
(2 words)
Operation flag
The operation flag does not change.
5-32
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
Upper Lower
EXT (.D/.L)
EXT.D Extends 32-bit unsigned binary data currently stored to 32-bit internal register to 64
bits. Stores $00000000 to temporary data memories TM000/TM001.
12345678 12345678
32-bit 64-bit
(2 words) (4 words)
EXT.L Extends 32-bit signed binary data currently stored to 32-bit internal register to 64 bits.
5
Stores $00000000 if the data is plus or $FFFFFFFF if the data is minus to temporary
–12345678 –12345678
32-bit 64-bit
(2 words) (4 words)
Operation flag
The operation flag does not change.
HKEY
DCNT
EXT(.U/.D/.S/.L) This instruction is executed at each scan for the duration that the execution SER
condition is ON. MAX
MIN
Scan AVG
ON ZRES
Execution
condition OFF
FIFOW
FIFOR
EXT(.U/.S) Execution Execution EXT
5-33
5-1 Data Processing Instructions
Sample Programs
The 16-bit unsigned binary data currently stored to data memory DM00000 is extended to 32 bits,
and 32-bit unsigned binary data currently stored to DM00010/DM00011 is added. The result is
stored to DM00020/DM00021.
The 16-bit signed binary data currently stored to data memory DM00000 is extended to 32 bits, and
32-bit signed binary data currently stored to DM00010/DM00011 is added. The result is stored to
DM00020/DM00021.
5 The 32-bit unsigned binary data currently stored to data memory DM00000/DM00001 is extended
to 64 bits, and is divided by 32-bit unsigned binary data currently stored to DM00010/DM00011. The
Data Processing Instructions
TM002 DM00022
LDA.D STA.D
5-34
5-1 Data Processing Instructions
EXTENDED INSTRUCTIONS
5
5-35
5-2 Clock Processing Instructions
Date/time → Sec- SEC Converts date/time format data to second format 5-40
onds conversion data.
Seconds → Date/ RSEC Converts second format data to date/time format 5-42
time conversion data.
Adjust AJST Adjusts the calendar timer by ±30 seconds. 5-44
5
Clock Processing Instructions
5-36
5-2 Clock Processing Instructions
EXTENDED INSTRUCTIONS
5
5-37
5-2 Clock ProcessingWTIME
Instructions Write time
WTIME Writes the time data to the calendar timer.
S — — — — — — — — — — — — — — — —
S : Specifies the leading device to which the time data is currently stored.
Explanation of Operation
When the execution condition is ON, the time data starting from the device specified by S is
written to the calendar timer. If the time data is inappropriate, CR2012 turns ON and the data is not
written to the calendar timer.
The calendar timer's time data is stored to control memories CM0700 to CM0706.
The following shows the format of the time data.
5 bit bit
15 0
Clock Processing Instructions
S Year 0 to 99 Indicates the lower two digits of the Western calendar year.
S +1 : Month 1 to 12
S +2 : Day 1 to 31
S +4 : Minute 0 to 59
S +5 : Second 0 to 59
[Tip]
The time data can be specified using either unsigned data or signed data.
Note: The time data cannot be written directly to control memories CM0700 to CM0706.
If time data is written directly, the time will be overwritten by the system, and written values
will be invalidated.
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the data to be written is inappropriate as time data. Otherwise OFF.
The instruction is not executed when CR2012 has turned ON.
5-38
5-2 Clock Processing Instructions
Execution Timing
WTIME This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
EXTENDED INSTRUCTIONS
WTIME Execution Execution
Sample Program
At the up edge of input relay 00000, the time data currently stored to data memories DM00000 to
DM00006 is written to the calendar timer.
(The time data of DM00000 to DM00006 is written from the access window or touch panel.)
00000 DM00000
WTIME 5
SEC
RSEC
AJST
5-39
SEC
5-2 Clock Processing Instructions Date/time → Converts date/time format data to second
SEC Seconds conversion format data.
S — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
S : Specifies the leading device to which the time data is currently stored.
D : Specifies the leading device to which the data after conversion to second format data is to
be stored.
Explanation of Operation
When the execution condition is ON, the six words of date/time data starting from the device
specified by S is converted to seconds referenced to "year 2000, January 1st, 0:0:0", and is
5 written to D / D +1 as two words (32-bit unsigned binary data).
Clock Processing Instructions
S +4 : Minute 0 to 59
S +5 : Second 0 to 59
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the data to be written is inappropriate as date/time data. Otherwise OFF.
The instruction is not executed when CR2012 has turned ON.
Execution Timing
SEC This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
5-40
5-2 Clock Processing Instructions
Sample Program
See the sample program for the RSEC instruction.
"Sample Program" page 5-43
EXTENDED INSTRUCTIONS
5
SEC
RSEC
AJST
5-41
RSEC
5-2 Clock Processing Instructions Seconds → Converts second format data to date/time
RSEC Date/time conversion format data.
S — — — — — — — — — — — — — — — —
D — — — — — — — — — — — — —
S : Specifies the leading device to which the second data is currently stored.
D : Specifies the leading device to which the data after conversion to date/time format data is
to be stored.
Explanation of Operation
When the execution condition is ON, the second data (32-bit unsigned binary data) currently stored
to the device specified by S is converted to date/time data referenced to "year 2000, January
5 1st, 0:0:0". The result is stored to D onwards.
Clock Processing Instructions
Operation flag
CR2009 .......... No change in state
CR2010 .......... No change in state
CR2011 .......... No change in state
CR2012 .......... ON when the data to be written is inappropriate as date/time data. Otherwise OFF.
The instruction is not executed when CR2012 has turned ON.
Execution Timing
RSEC This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
5-42
5-2 Clock Processing Instructions
Sample Program
Output the expiry date from the date of production. Let's assume that the expiry date is 30 days
(2592000 seconds) from the production date.
The result is stored to DM00100 onwards.
CR2002 SEC
CM00700 DM00000
EXTENDED INSTRUCTIONS
DM00000 #2592000 DM00010
LDA ADD.D STA.D
RSEC
DM00010 D00100
bit bit
15 0
WTIME
SEC
RSEC
AJST
5-43
5-2 Clock ProcessingAJST
Instructions Adjust
AJST Adjusts the calendar timer by ±30 seconds.
– — — — — — — — — — — — — — — — — — — — —
Explanation of Operation
Sets the "seconds" setting to "0" when the "seconds" setting of the current time of the KV-700's built-
in calendar timer is 0 to 29. When the "seconds" setting is 3 to 59 seconds, the "minutes" setting is
rounded up and the "seconds" setting is set to "0". The time data of the calendar timer is currently
stored to control memories CM00700 to CM00706.
Operation flag
5 The operation flag does not change.
Clock Processing Instructions
Execution Timing
AJST This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
Sample Program
The calendar timer is adjusted by ±30 seconds at the up edge of input relay 00000.
00000
AJST
5-44
5-2 Clock Processing Instructions
EXTENDED INSTRUCTIONS
5
SEC
RSEC
AJST
5-45
5-3 Alarm Instruction
5
Alarm Instruction
5-46
5-3 Alarm Instruction
EXTENDED INSTRUCTIONS
5
Alarm Instruction
5-47
5-3 Alarm Instruction ARES Resets currently operating alarm relays and the
ARES Alarm relay reset
alarm history.
– — — — — — — — — — — — — — — — — — — — —
Explanation of Operation
Resets currently operating alarm relays and the alarm history.
Operation flag
The operation flag does not change.
5 Execution Timing
Alarm Instruction
ARES This instruction is executed at each scan for the duration that the execution condition
is ON.
5-48
5-3 Alarm Instruction
EXTENDED INSTRUCTIONS
5
Alarm Instruction
ARES
5-49
5-4 High-speed Processing Instructions
High-speed HSP Reduces the time constant of the input relay to speed up 5-52
input response.
Disable interrupt DI Disables execution of the interrupt program. 5-54
Interrupt INT Executes the interrupt program from the INT to the 5-56
RETI instructions.
Return interrupt RETI Indicates the end of the interrupt program.
comparator
5-50
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
5
5-51
HSP
5-4 High-speed Processing InstructionsHigh-speed Reduces the time constant of the input
HSP relay to speed up input response.
D — — — — — — — — — — — — — — — — — — —
D : Specifies the device No. of the relay for reducing the input time constant.
Available relays are 00000 to 00009.
Explanation of Operation
When the execution condition is ON, the input time constant of the device specified by D is set
to 10 µs.
Be sure to set this instruction when using the INT and CTH instructions.
5
Note: When an input time constant setting using control relay CR2305 and an input time constant
High-speed Processing Instructions
using the HSP instruction are programmed together, the HSP instruction is given priority.
• For details on how to change the input time constant of the CPU Unit, refer to KV-700 User's
Manual "Input Time Constant Selection Function."
• For details on how to change the input time constant of the Expansion Input Unit, refer to KV-700
User's Manual "Input Time Constant Selection Function."
Operation flag
The operation flag does not change.
Execution Timing
HSP This instruction is executed at each scan for the duration that the execution condition
is ON.
Scan
ON
Execution
condition OFF
5-52
5-4 High-speed Processing Instructions
Sample Program
Set the input time constant of input relay 00000 to 10 µs.
CR2002 HSP
00000
EXTENDED INSTRUCTIONS
5
DI
EI
INT
RETI
CTH
CTC
5-53
5-4 High-speed Processing Instructions
DI EI Disable interrupt Disables execution of the interrupt program.
Execution condition
EXTENDED INSTRUCTIONS
DI D I
— — — — — — — — — — — — — — — — — — — — —
Explanation of Operation
DI When the execution condition is ON, execution of the interrupt program is disabled.
EI When the execution condition is ON, execution of the interrupt program is enabled.
The interrupt program disabled by the DI instruction is enabled (disable canceled).
• Once the EI instruction is executed, interrupts up to execution of the DI instruction are enabled.
• Interrupts are disabled at all times when operation is started.
• Up to eight interrupts can be stored if they occur during execution of the DI instruction (interrupts
are disabled).
When the EI instruction is executed, interrupts stored to memory are executed. Note, however,
that even if interrupts caused by the CTC instruction are stored to memory, the interrupts are
deleted from memory if CTC is reset during that time.
• To execute another interrupt program while an interrupt program is being executed, execute the
EI instruction in the interrupt program. The sequence program accepts nesting of interrupt
programs down to a nesting level of four.
"About the Interrupt Function" page 5-57
Operation flag
The operation flag does not change.
Execution Timing
EI, DI This instruction is executed at the up edge of the execution condition.
Scan
ON
Execution
condition OFF
5-54
5-4 High-speed Processing Instructions
Sample Program
When input relay 00000 is ON, execution of the interrupt program is disabled.
When input relay 00000 is OFF, execution of the interrupt program is enabled.
00000
DI
EXTENDED INSTRUCTIONS
00000
EI
DI
EI
INT
RETI
CTH
CTC
5-55
INT The interrupt program is executed up to RETI at the
5-4 High-speed Processing Instructions
INT Interrupt
up edge or down edge of the operand.
RET
RETI Return interrupt Indicates the end of the interrupt program.
Interrupt program
EXTENDED INSTRUCTIONS
RETI
R E T I
( I R E T )
S — — — — — — — — — — — — — — — — —
Explanation of Operation
5
INT Specifies the start of the interrupt routine.
High-speed Processing Instructions
Operation flag
The operation flag does not change.
Execution Timing
INT, RETI These instructions are executed once when an interrupt cause is generated.
Scan
Sample Program
CR2008
EI
END
INT
00000
CR2002 00500
SET
RETI
ENDH
5-56
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
Scan processing is discontinued while the interrupt program is executed. When the interrupt
program ends, the scan processing is resumed from where it was discontinued.
KV-700 User's Manual "About Scan Time"
5
Input
Interrupt program input processing: The relays (00000 to 00009) to which direct input is HSP
enabled and high-speed counters CTH are refreshed DI
(information is updated). With other devices, the EI
information of input processing at the scan that the INT
interrupt was input is held. RETI
Interrupt program output processing: The relays (00500 to 00503) to which direct input is CTH
enabled are output at all times during program execu- CTC
tion. Other output relays wait for output processing at
the scan that the interrupt was input before they are
output after the interrupt program ends.
"About direct input" page 5-60
"About direct output" page 5-61
[Tip]
When execution of the interrupt program starts, the values of internal registers, input relays
00000 to 00009, operation flags TM000 to TM003 are stored on the system. When execution of
the interrupt program ends, the memorized values are overwritten. The values of these devices
do not affect the main routine even if they are changed during execution of the interrupt program.
New values after a change are valid only during execution of the interrupt program.
The main routine is affected if the values of other devices are changed during execution of the
interrupt program.
5-57
5-4 High-speed Processing Instructions
EI
END
5 INT
00000
Interrupt program
High-speed Processing Instructions
RETI
KV-700 User's Manual "Input Time Con-
stant Selection Function"
ENDH
"INT Instruction" page 5-56
"EI, DI Instruction" page 5-54
With interrupts caused by external inputs, the INT instruction is executed at the up edge or down
edge of input relays (00000 to 00003). Up edge/down edge is set in control relays.
With interrupts caused by high-speed counter comparators, the INT instruction is executed
when the setting value of high-speed counter comparators matches the current value of high-speed
counters CTH.
5-58
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
tor CTC2 matches the current value
INT CTC3 CTC3 When setting value of high-speed counter compara-
tor CTC3 matches the current value
INT00000 > INT00001 > INT00002 > INT00003 > INT CTC2 > INT CTC3 > INT CTC0 > INT CTC1
When the EI instruction is programmed in an interrupt program, interrupts can be nested (an
interrupt within an interrupt). Note, however, that interrupts having the same interrupt cause
cannot be nested.
HSP
DI
EI
INT
RETI
CTH
CTC
5-59
5-4 High-speed Processing Instructions
Direct Input/Output
■ About direct input
"Direct input/output" is a function for loading the state of input relays (00000 to 00009) during
interrupt program execution. Input relays other than these adopt a state acquired by input
processing of that scan also during execution of the interrupt program.
The state acquired by direct input is valid only during execution of the interrupt program, and is
invalid by the main routine program. In the main routine program, the state of input processing
EXTENDED INSTRUCTIONS
[Example]
ON
00000
OFF
ON
00001
OFF
ON
5 30000
OFF
Input
process- Interrupt program
ing
00001: ON
30000: OFF
OFF ON OFF ON
As input relay 00001 is direct input, the state during execution of the interrupt program is loaded.
Input relay 30000 is handled as the state of input processing of the main routine program even
in the interrupt program.
Direct input is valid only in the interrupt program.
In the main routine program, input relay 00001 is in an OFF state regardless of whether the relay
is before or after execution of the interrupt program.
Input relay 00001 is in an ON state only during the interrupt program.
5-60
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
STA instruction, output relays are output by output processing of the main routine program.
[Example]
00501: Output
30500: Output
Input
process- (1) (2) (3) (4)
ing
CR2002 00501
(2)
CR2002 00502
(3) SET
CR2002 30500
(4) SET
• At rung (4), output 30500 turns ON by internal processing. However, as it is not a direct output CTH
5-61
5-4 High-speed Processing Instructions
About differences between the input capture function and the current value of high-speed
counters during interrupt programs
5
• The input capture function captures the value at the moment that the interrupt cause is generated
High-speed Processing Instructions
Current value of
high-speed counter CTH0 ...... 10 11 12 ............. 99 100 101 ............................ 999 1000 1001
Input capture function Interrupt program
Input CTH0
process- LDA STA
ing
(1) (2)
100 1000
(1) As the input capture function captures the value at the moment that the interrupt cause is
generated (not reliant on scan time), the current value of high-speed counter CTH0 becomes
#00100.
(2) As the value acquired by the interrupt program is the value acquired by input processing of the
interrupt program, the current value of high-speed counter CTH0 to be acquired becomes
#01000.
As shown above, when an error in the time occurs from when an interrupt cause is generated up to
execution of the interrupt program, an error occurs in the current value of the high-speed counter
to be acquired.
5-62
5-4 High-speed Processing Instructions
Sample Program
■ Example of application of an interrupt using a signal converter
A minute pulse is converted to a pulse of fixed width and output using interrupt processing.
• The minute pulse that is input by input relay 00000 is converted to a pulse having an ON width
of one second from output relay 00500.
• Output relay 00500 turns ON for one second from the up edge of input relay 00000.
EXTENDED INSTRUCTIONS
Scan
ON
ON
CR2008
EI The interrupt is enabled at power ON.
CR2002 HSP
The input time constant of input relay 00000
5
00000
is set to 10 µs.
END
CR2002 00500
SET
HSP
RETI DI
EI
INT
ENDH
RETI
CTH
CTC
5-63
5-4 High-speed Processing Instructions
Scan
ON
ON
ON
CR2002 CTH0
00004 The high-speed counter of input relay 00004
is set to CTH0, and the setting value is set to
#10000 #10000.
CTC0
00000 00500
When input relay 00000 turns ON, output
RES
00500 turns OFF.
END
INT
CTC0 When the value of high-speed counter com-
parator CTC0 becomes #10000, the inter-
rupt program is executed, and output relay
CR2002 00500
SET 00500 turns ON.
RETI
ENDH
5-64
5-4 High-speed Processing Instructions
ON
EXTENDED INSTRUCTIONS
• Control relay CR2100 is used to measure the pulse width in 1 µs units.
• The input capture value (CM1610/CM1611) when input relay 00000 is ON, is stored to data
memory DM00010/DM00011.
The value of DM00010/DM00011 is subtracted from the input capture value when 00000 is
OFF.
This value becomes the pulse width.
• The measured value is stored to data memory DM00000/DM00001 in 1 µs units.
CR2008
EI
The interrupt is enabled at power ON.
5
CR2002 CTH0
CR2100 The 1 µs internal clock is counted by high-
speed counter CTH0.
END
INT
00000 The interrupt is executed at input relay 00000.
First, the interrupt is executed at the up edge
CR2701 CM1610 DM00010 KEEP of input relay 00000, and the current value
LDA.D STA.D SET (CM1610/CM1611) at that time is stored to HSP
DM00010/DM00011, and the interrupt po- DI
CR2701
larity is changed to down edge by turning
CR2701 CM1610 DM00010 DM00000 EI
CR2701 ON.
LDA.D SUB.D STA.D RES
INT
Next, the interrupt is executed by the down
RETI
edge of input relay 00000, and the pulse
RETI width of input relay 00000 is calculated by CTH
subtracting DM00010/DM00011 at the up CTC
edge from the current value (CM1610/
ENDH CM1611) at that time. The result is stored to
DM00000/DM00001.
Finally, CR2701 is turned OFF to change
the interrupt polarity to up edge.
5-65
5-4 High-speed Processing Instructions
Sensor 1 ON
Sensor 2
Input relay 00002
OFF
EXTENDED INSTRUCTIONS
Sensor 2 ON
• The passage time from input relay 00002 up to input relay 00003 is measured.
• The measured value is stored to data memory DM00000/DM00001 in 1 µs units.
CR2008 CR2704 CR2705 CR2706 CR2707
EI RES RES RES RES At power ON, interrupt is enabled, and the
interrupt polarity of input relays 00002 and
CR2002 HSP 00003 is set to up edge.
00002
5 The input time constant of input relay
00002 is set to 10 µs.
HSP
High-speed Processing Instructions
00003
The input time constant of input relay 00003
is set to 10 µs.
CR2002 CTH1
CR2200 The 1 µs internal clock is counted by high-
speed counter CTH1.
END
INT
00002
When INT00002 is executed, the current
RETI value of CTH1 is automatically stored (by
input capture) to CM1614/CM1615.
INT
00003
When INT00003 is executed, the current
value of CTH1 is automatically stored (by
CR2002 CM1616 CM1614 DM00000 input capture) to CM1616/CM1617.
LDA.D SUB.D STA.D
The passage time between the two points is
calculated by subtracting the input capture
RETI value of INT00002 from the input capture
value of INT00003.
The result is stored to DM00000/DM00001.
ENDH
5-66
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
5
DI
EI
INT
RETI
CTH
CTC
5-67
CTH
5-4 High-speed Processing Instructions Executes operation of response
CTH 32-bit high-speed counter
frequency 50 kHz 32-bit (0 to
4294967295) addition/subtraction
CTC CTC High-speed counter comparator counters.
S
CTC n C T C n S
CTC n
CTH n — — — — — — — — — — — — — — — — — — —
S — — — — — — — — — — — — —
CTC n — — — — — — — — — — — — — — —
5 S — — — — — — — — — — — — — — —
High-speed Processing Instructions
Explanation of Operation
CTH When the execution condition is ON, the device specified by S is counted.
When the execution condition is OFF, the count value is cleared.
When an external input (00004, 00005) is counted, the input time constant must be
reduced.
KV-700 User's Manual "About the Input Time Constant"
"HSP Instruction" page 5-52
CTC Turns ON when the setting value specified by S matches the current value of the
high-speed counter.
With the high-speed counter function, set the count method or reset method in control relays CR and
data memory DM. Read the description for the respective setting item.
"Outline of High-speed Counters" page 5-69
"High-speed Counter Specifications" page 5-72
"Setting Count Input" page 5-75
"Reset Method" page 5-78
"Comparator Match Output" page 5-81
"Preset Function" page 5-80
"Ring Counter Function" page 5-82
"High-speed counter application example" page 5-84
5-68
5-4 High-speed Processing Instructions
Execution Timing
CTH This instruction is executed at each scan for the duration that the execution condition
is ON.
CTC This instruction is executed at each scan during high-speed counter operation.
Scan
EXTENDED INSTRUCTIONS
ON
Execution
condition OFF
CTC
Internal clock 2
CR2200 (1.0 µs) 00501 *
CR2201 (10.0 µs) Control circuit
(direct clock pulse)
CR2202 (100.0 µs) CTH1 setting value
High-speed counter
A phase 00005 External input comparator Interrupt function
00005 CTC2
(B phase 00007) INT CTC2
(00007) CTC3 INT CTC3
5-69
5-4 High-speed Processing Instructions
CR2105 When CTC0 is ON, direct output (00500) OFF Execute. Do not execute.
CR2106 When CTC0 is ON, direct output (00500) ON Execute. Do not execute.
CR2107 When CTC0 is ON, direct output (00500) ON/OFF reversal Execute. Do not execute.
CR2108 When CTC1 is ON, direct output (00500) Disable output. Enable output.
CR2109 When CTC1 is ON, direct output (00500) OFF Execute. Do not execute.
CR2110 When CTC1 is ON, direct output (00500) ON Execute. Do not execute.
CR2111 When CTC1 is ON, direct output (00500) ON/OFF reversal Execute. Do not execute.
CR2112 When CTC1 is ON, CTH0 auto clear Execute. Do not execute.
5 CR2113
CR2114
CTH0 count input method
selection
OFF
OFF
ON
OFF
OFF
ON
ON
ON
OFF
OFF OFF
ON
High-speed Processing Instructions
At ON At OFF
CR2402 Ring counter use by CTH0 Execute. Do not execute.
[Tip]
The initial state of CR2104 and CR2108 is ON. Otherwise, these devices are OFF.
Note: To turn a control relay ON, use the SET instruction. To turn a control relay OFF, use the RES
instruction.
5-70
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
CR2205 When CTC2 is ON, direct output (00501) OFF Execute. Do not execute.
CR2206 When CTC2 is ON, direct output (00501) ON Execute. Do not execute.
CR2207 When CTC2 is ON, direct output (00501) ON/OFF reversal Execute. Do not execute.
CR2208 When CTC3 is ON, direct output (00500) Disable output. Enable output.
CR2209 When CTC3 is ON, direct output (00500) OFF Execute. Do not execute.
CR2210 When CTC3 is ON, direct output (00500) ON Execute. Do not execute.
CR2211 When CTC3 is ON, direct output (00500) ON/OFF reversal Execute. Do not execute.
CR2212 When CTC3 is ON, CTH1 auto clear Execute. Do not execute.
At ON At OFF
CR2404 Ring counter use by CTH1 Execute. Do not execute.
INT
RETI
[Tip] CTH
The initial state of CR2204 and CR2208 is ON. Otherwise, these devices are OFF. CTC
Note: To turn a control relay ON, use the SET instruction. To turn a control relay OFF, use the RES
instruction.
5-71
5-4 High-speed Processing Instructions
A phase B phase
CTH0 00004 00006
CTH1 00005 00007
Short externally input signals are counted. Single-phase, phase difference and 2-pulse can be
5 input.
The count method is set by control relays.
High-speed Processing Instructions
The internal clock is counted. As the time can be measured from the count value, this input can
be used as a high-precision timer.
[Example]
CTH0
Count of internal clock (1.0 µs) by CTH0 CR2100
Pulses output by the direct clock pulse function can be counted without being wired externally.
See CPU Hardware Manual "Direct Clock Pulse Output."
[Example]
CTH0
Count of direct clock pulse from 00501 00501
5-72
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
■ Setting value (CTC)
The setting values of high-speed counters are set in high-speed counter comparators CTC0 to
CTC3.
Setting values can be set within the range 0 to 4294967295. A CTC turns ON when the setting
value matches the current value.
Set CTC OFF by the RES instruction. Setting values are automatically reset when an interrupt
is applied by CTC.
Setting Value
CTH0 CTC0
CTH1
CTC1
CTC2
5
[Example] CTH0
00004
Setting of CTC0 and CTC1
#00100
CTC 0
#100000
CTC 1
Note: CTCs do not turn ON when the current value is rewritten with the same value as the CTC
HSP
by the current value being changed.
DI
CTCs turn ON only when the current value has equaled CTC after a count up or count
EI
down.
INT
RETI
CTH
■ Reading/changing current values, rewriting setting values
CTC
(1) Reading current values
The current value is read by the LDA or MOV instruction.
"LDA Instruction" page 4-6
"MOV Instruction" page 4-14
5-73
5-4 High-speed Processing Instructions
#00100 CTH0
To change the current value of CTH0 to 100
Note: Current values are overwritten as 32-bit data even if they are changed by the MOV.U
instruction.
When the current value has been changed to a value greater than the CTC to which an
5 automatic reset is specified, the current value is changed to "value of CTC - 1".
The current value cannot be changed to a value greater than the CTC to which an automatic
High-speed Processing Instructions
reset is specified.
Note: Setting values are overwritten as 32-bit data even if they are changed by the MOV.U
instruction.
5-74
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
W/out W/ 1X 2X 4X
direction direction
CR2113 OFF ON OFF ON OFF ON
CR2114 OFF OFF ON ON OFF OFF
CR2115 OFF OFF OFF OFF ON ON
(1) Single-phase
Set this when counting single-phase pulses.
DI
EI
W/ direction The count is incremented at the up edge of the A phase when the B phase is
INT
OFF.
RETI
The count is decremented at the up edge of the A phase when the B phase is CTH
ON.
CTC
5-75
5-4 High-speed Processing Instructions
1X The count is incremented at the up edge of the A phase when the B phase is OFF.
The count is decremented at the down edge of the A phase when the B phase is OFF.
ON
(A phase)
EXTENDED INSTRUCTIONS
0004
OFF
ON
(B phase)
0006 OFF
(counter value)
CTH0
0 1 2 3 4 3 2 1 0
2X The count is incremented at the up edge of the A phase when the B phase is OFF.
The count is decremented at the down edge of the A phase when the B phase is OFF.
The count is decremented at the up edge of the A phase when the B phase is ON.
The count is incremented at the down edge of the A phase when the B phase is ON.
5
ON
(A phase)
High-speed Processing Instructions
0004 OFF
ON
(B phase)
0006 OFF
(counter value)
CTH0
0 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 0
4X The count is incremented at the up edge of the A phase when the B phase is OFF.
The count is decremented at the down edge of the A phase when the B phase is OFF.
The count is decremented at the up edge of the A phase when the B phase is ON.
The count is incremented at the down edge of the A phase when the B phase is ON.
The count is decremented at the up edge of the B phase when the A phase is OFF.
The count is incremented at the down edge of the B phase when the A phase is OFF.
The count is incremented at the up edge of the B phase when the A phase is ON.
The count is decremented at the down edge of the B phase when the A phase is ON.
ON
(A phase)
0004 OFF
ON
(B phase)
0006 OFF
(counter value)
CTH0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
5-76
5-4 High-speed Processing Instructions
(3) 2-pulse
The pulse that is input in 2-pulse method is counted.
The pulse is incremented at the up edge of the A phase, and decremented at the up edge of the
B phase.
ON
(A phase)
EXTENDED INSTRUCTIONS
0004 OFF
ON
(B phase)
0006 OFF
(counter value)
CTH0
0 1 2 3 4 3 2 1 0
DI
EI
INT
RETI
CTH
CTC
5-77
5-4 High-speed Processing Instructions
Reset Method
Clearing the current value of a high-speed counter is called a "reset."
There are four reset methods:
Reset by RES instruction
Reset by execution condition OFF
Automatic reset by a count up
EXTENDED INSTRUCTIONS
Scan
CTH0
RES
Scan
Execution condition
5-78
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
CTC1 CR2112 preset value of CTH0 becomes the same as the setting
values of CTC0 and CTC1.
CTH1 CTC2 CR2203 If control relays CR2203 and CR2212 are turned ON in
advance, the current value of CTH1 is cleared when the
CTC3 CR2212 preset value of CTH1 becomes the same as the setting
values of CTC2 and CTC3.
Scan
CTH
CTH=CTC
5
Note: When the current value has been changed to a value greater than CTC to which an
automatic reset is specified, the current value is changed to "value CTC - 1".
The current value cannot be changed to a value greater than the CTC to which an
automatic reset is specified.
DI
Set the preset value to "0" to execute the preset.
EI
"Preset Function" page 5-80 INT
RETI
Scan CTH
CTC
CTH
* The current value is reset when the external reset input turns ON.
[Tip]
With resets by "execution condition OFF" or the "RES instruction," a delay of one scan maximum
until the reset is performed occurs. With resets by "automatic reset by a count up" or "external
input," the reset is performed without the scan time being influenced.
5-79
5-4 High-speed Processing Instructions
Preset Function
The preset function changes the current value of the high-speed counter to the preset value. The
current value is changed by external input.
Preset Input Preset Value Storage Destination
Upper Lower
CTH0 00008 CM1605 CM1604
CTH1 00009 CM1607 CM1606
EXTENDED INSTRUCTIONS
When the preset value is set to "0" and the preset is executed, the preset can be used as a reset
for the high-speed counters.
[Example] To reset at the up edge of 00008 (high-speed counter reset), the setting for presetting
CTH0 to "0"
5-80
5-4 High-speed Processing Instructions
CTH0 setting
Relay No. Description ON OFF
EXTENDED INSTRUCTIONS
CR2104 When CTC0 is ON, direct output (00500) Disable output. Enable output.
CR2106 When CTC0 is ON, direct output (00500) ON Execute. Do not execute.
CR2108 When CTC1 is ON, direct output (00500) Disable output. Enable output.
CR2110 When CTC1 is ON, direct output (00500) ON Execute. Do not execute.
CTH1 setting
Relay No. Description ON OFF
CR2204 When CTC2 is ON, direct output (00501) Disable output. Enable output.
CR2206 When CTC2 is ON, direct output (00501) ON Execute. Do not execute.
CR2208 When CTC3 is ON, direct output (00501) Disable output. Enable output.
CR2210 When CTC3 is ON, direct output (00501) ON Execute. Do not execute. 5
[Example] Setting for direct output of output relay 00500 when CTC0 turns ON
When high-speed counter CTH0 matches the value (100) set by high-speed counter
comparator, the output relay is directly output.
When input relay 00000 turns ON, output relay 00500 is turned OFF. HSP
DI
CR2002 CR2103 CTH0
0001 EI SET RES EI
Always ON CTH0 when CTC0 is ON INT
CR2002 Auto-clear
HSP
0002 00004 RETI
Always
ON CTH
CTH0
0003 00004 CTC
#100
0004 CTC 0
00000 00500
0005 RES
END
0006
INT
0007 CTC0
CR2002 00500
0008 SET
Always ON
RETI
0009
ENDH
0010
0011
5-81
5-4 High-speed Processing Instructions
upper limit value. When the counter overflows from the upper limit value, the count returns to 0.
Overflow Overflow
Underflow Underflow
4294967294 1 Upper limit value -1 1
5 2 2
High-speed Processing Instructions
4 3 4 3
[Example] Ring counter setting for upper limit value 100000 for CTH0
CR2402
SET
Note: When the current value of the high-speed counter has been changed to a value greater
than the upper limit value of the ring counter, the current value is changed to the upper limit
value. The current value does not change when the upper limit value is changed to a value
smaller than the current value.
5-82
5-4 High-speed Processing Instructions
Extended Functions
High-speed counters have the following three extended functions in addition to regular high-speed
counting. These functions use the high-speed counter.
Note that extended functions cannot be used in combination with regular high-speed counting.
EXTENDED INSTRUCTIONS
This function sets any frequency and outputs this as a pulse.
This function enables motor speed control.
5
For details on extended functions, refer to the KV-700 User's Manual.
DI
EI
INT
RETI
CTH
CTC
5-83
5-4 High-speed Processing Instructions
00000
HSP
00005
HSP
00006
HSP
00007
CR2002 CTH0
00004 Input of phase difference of 00004 and 00006
#60000
CTC0 The setting value of counter comparator CTC0 is
taken as #60000.
CTH1
Input of phase difference of 00005 and 00007
00005
END
INT
CTC0
RETI
ENDH
5-84
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
CTH1 ≥ #01000 → 00500 turns ON.
CTH1 ≥ #02000 → 00501 turns ON.
CTH1 ≥ #03000 → 00502 turns ON.
CR2002 HSP
00005
00001 CTH1 5
00005
INT
RETI
CR2008 CR2203 CTH1
SET RES CTH
CTC
CR2002 HSP
00005
CR2002 CTH1
00005
#60000
CTC2
5-85
5-4 High-speed Processing Instructions
HSP
00006
5 HSP
00008
High-speed Processing Instructions
00500 CTH0
00004
#60000
CTC0
END
INT
CTH0
CR2002 00500
SET
RETI
ENDH
Initial setting
Control relays
• When CR2103 is turned ON, the current value of CTH0 is cleared when CTC0 is ON.
• The high-speed counter resolution is 1X if CR2113 is OFF, CR2114 is ON, and CR2115 is OFF.
• When CR2400 is turned ON and CR2401 is turned OFF, external reset is enabled (preset
function) ↓
Reset at up edge of input 00008
5-86
5-4 High-speed Processing Instructions
EXTENDED INSTRUCTIONS
CR2008 CR2113 CR2114 CR2115 CTH0 CR2400 CR2401
SET SET RES RES SET RES
CR2002 HSP
00004
HSP
00006
HSP
00008
CR2002 CTH0
00004
5
CR2002 CTH0 #00002 30000
STA
END
ENDH
Initial setting
Special auxiliary relays
HSP
• The high-speed counter resolution is 2X if CR2113 is ON, CR2114 is ON, and CR2115 is OFF.
DI
• When CR2400 is turned ON and CR2401 is turned OFF, external reset is enabled (preset
EI
function) ↓
INT
Reset at up edge of input 00008
RETI
CTH
CTC
5-87
5-5 Positioning Instructions
5 Teach X-axis TCHX Loads the current position of the X-axis. 5-98
Positioning Instructions
Teach Y-axis TCHY Loads the current position of the Y-axis. 5-98
Yes
Change parameters
For details on the settings of these parameters, refer to the KV-700 Series User's Manual "Motor
Control." Also, for details on KV BUILDER operations, refer to the KV BUILDER User's Manual
"Editing Point Parameters."
5-88
5-5 Positioning Instructions
Point parameters
Common to Both X-/Y-axes Remarks
Target value/travel No.0 CM2060/CM2061
EXTENDED INSTRUCTIONS
No.1 CM2070/CM2071
:
No.31 CM2370/CM2371
Startup speed No.0 CM2062
No.1 CM2072
:
No.31 CM2372
Acceleration/deceleration time No.0 CM2063
No.1 CM2073
:
No.31 CM2373
Run speed No.0 CM2064/CM2065
No.1 CM2074/CM2075
:
No.31 CM2374/CM2375 5
Operation mode No.0 CM2066
Positioning Instructions
No.1 CM2076
:
No.31 CM2376
System parameters
X-axis Y-axis Remarks
Assignment of 00000 to 00003 CM2000 CM2030
Output format CM2000 CM2030
Current position comparators 0.1 CM2000 CM2030 The values must be set when a com-
parator is used.
Input sensor enable CM2001 CM2031
Input sensor polarities CM2001 CM2031
Current position comparator 0 CM2002 CM2032 Set when using a comparator as a
Current position comparator 1 CM2004 CM2034 substitute for a limit sensor.
Zero return startup speed CM2006 CM2036
Zero return acceleration/decelera- CM2007 CM2037
tion time
Zero return run speed CM2008 CM2038
Jog startup speed CM2010 CM2040
Jog acceleration/deceleration time CM2011 CM2041
Jog run speed CM2012 CM2042
Error/warning code CM2024 CM2054
Control relays
X-axis Y-axis Remarks
Limit switch CW input CR3000 CR3100 1=ON, 0=OFF
Limit switch CCW input CR3001 CR3101 1=ON, 0=OFF
Origin sensor input CR3002 CR3102 1=ON, 0=OFF
Pulse output in progress CR3009 CR3109 1=Pulse output in progress
Error CR3007 CR3107 1=Error state (cleared when "0" is stored)
Warning CR3008 CR3108 1=Warning state (cleared when "0" is stored)
Zero return locus/ CR3013 CR3113 1=Zero return in progress
zero return in progress
5-89
5-5 Positioning Instructions
PLSX PLSX Trapezoidal control X-axis Starts trapezoidal control of the X-axis.
PLSY PLSY Trapezoidal control Y-axis Starts trapezoidal control of the Y-axis.
Execution condition S
EXTENDED INSTRUCTIONS
PLSY P L S Y S
S — — — — — — — — — — — — — — — — — — —
5 Explanation of Operation
Positioning Instructions
When the execution condition turns ON, the pulse is output according to the point parameter setting
specified by S .
Frequency (Hz)
Target value/travel amount (number of output pulses)
Run speed
Start speed
(stop speed)
Time (ms)
Acceleration Deceleration
time time
During point travel, flags CR3009 (X-axis) and CR3109 (Y-axis) turn ON during pulse output, and
turn OFF when pulse output ends. The point parameter Nos. during operation are stored to CM2025
(X-axis) and CM2055 (Y-axis).
To perform an emergency stop, set CR3009 (X-axis) and CR3109 (Y-axis) OFF. When an
emergency stop has been performed, the emergency stop error is generated, error code 30 is stored
to CM2024 (X-axis) and CM2054 (Y-axis), and the pulse output in progress flags turns OFF. Also,
CR3007 (X-axis) and CR3107 (Y-axis) turn ON.
5-90
5-5 Positioning Instructions
Note: The following describes the precautions to follow in the position mode.
• New operations cannot be started during pulse output. The PLSX and PLSY instructions
are ignored if an attempt is made to execute them during pulse output. (The PLSX and
PLSY instructions are not executed even if current pulse output ends.)
• Instructions cannot be accepted and are ignored during generation of an error.
• When pulse output was stopped by an emergency stop, the current position information
is not assured. Also, the duty of the last pulse by which pulse output stopped is not
EXTENDED INSTRUCTIONS
assured.
• The pulse output in progress flags CR3009 (X-axis) and CR3109 (Y-axis) turn ON/OFF
at each scan (The pulse output in progress flags during ON for one scan even if there
were every few output pulses and pulse output ended within one scan.) Perform a pulse
output operation handshake using the pulse output in progress flags.
• When the parameter is such that the number of output pulses is "0", the pulse output in
progress flag does not turn ON, and warnings are not output.
Operation flag
The operation flag does not change.
5
Positioning Instructions
Execution Timing
PLSX, PLSY This instruction is executed at each scan for the duration that the execution
condition is ON.
Scan
ON
Execution
condition OFF
PLSX
JOGX
At the up edge that input relay 00000 turns ON, the pulse is output according to the setting of point
JOGY
parameter No.00.
ORGX
ORGY
00000 00
PLSX TCHX
TCHY
5-91
JOGX
5-5 Positioning Instructions
JOGX CW
CCW
High
Jog operation X-axis Performs jog operation of the X-axis.
JOGY
JOGY CW
CCW
High
Jog operation Y-axis Performs jog operation of the Y-axis.
CCW signal
EXTENDED INSTRUCTIONS
CCW
High signal
High
CW signal JOGX
CW J O G Y
CCW signal
CCW
High signal
High
— — — — — — — — — — — — — — — — — — — — —
Set jog operation, acceleration/deceleration time, run speed and other details using the parameter
setup function on KV BUILDER.
Explanation of Operation
When the CW and CCW signals are ON, pulse output is started at the start speed.
Frequency (Hz)
CW/CCW signal High signal High signal CW/CCW signal
ON! ON! OFF! OFF!
Run speed
Start speed
(Stop speed)
Time (ms)
When the CW (or CCW) signal is ON and the High signal is ON, the start speed accelerated to the
run speed.
When the High signals turns OFF, the run speed decelerates to the start speed. If the CW (or CCW)
turns OFF even when the High signal is ON, the run speed decelerates to the start speed and stops.
During operation, the pulse output in progress flags CR3009 (X-axis) and CR3109 (Y-axis) turn ON,
and turn OFF when pulse output ends.
Travel inside the limit sensor range is possible even if the limit error occurs.
To make an emergency stop, turn CR3009 (X-axis) and CR3109 (Y-axis) OFF.
Operation stops immediately when an emergency stop has been made. Also, the emergency stop
error occurs, CR3007 (X-axis) and CR3107 (Y-axis) turn ON, error code 30 is stored to CM2024 (X-
axis) and CM2054 (Y-axis), and the pulse output in progress flags turn OFF.
5-92
5-5 Positioning Instructions
Note: • New jog operations cannot be started during pulse output. (The JOGX and JOGY
instructions are ignored if an attempt is made to execute them during pulse output.)
• The pulse output in progress flags CR3009 (X-axis) and CR3109 (Y-axis) turn ON/OFF
at each scan (The pulse output in progress flags during ON for one scan even if there
were every few output pulses and pulse output ended within one scan.) Perform a pulse
output operation handshake using the pulse output in progress flags.
• Instructions cannot be accepted and are ignored during generation of an error.
EXTENDED INSTRUCTIONS
• When pulse output was stopped by an emergency stop, the current position information
is not assured. Also, the duty of the last pulse by which pulse output stopped is not
assured.
Operation flag
The operation flag does not change.
Execution Timing
JOGX, JOGY These instructions are executed at each scan for the duration that the execution
condition is ON. 5
Positioning Instructions
Scan
ON
Execution
condition OFF
Sample Program
00001 JOGX
CCW
JOGY
00002 ORGX
High
ORGY
TCHX
TCHY
5-93
ORGX
5-5 Positioning Instructions
ORGX Zero return X-axis Starts zero-return of the X-axis.
Execution condition
EXTENDED INSTRUCTIONS
ORGY O R G Y
— — — — — — — — — — — — — — — — — — — — —
Set zero return operation, using the parameter setup function on KV BUILDER.
Explanation of Operation
When the execution condition is ON, a zero return is started.
5 During a zero return, the zero return in progress flags CR3004 (X-axis) and CR3104 (Y-axis), and
pulse output in progress flags CR3009 (X-axis) and CR3109 (Y-axis).
Positioning Instructions
The pulse of the pulse output in progress flag (operation during a zero return is clockwise) is
disrupted, however, the zero return in progress flag stays ON.
To cancel a zero return (perform an emergency stop), set pulse output in progress flags CR3009
(X-axis) and CR3109 (Y-axis) OFF. When an emergency stop has been performed, the emergency
stop error is generated, error code 30 is stored to CM2024 (X-axis) and CM2054 (Y-axis), and the
pulse output in progress flag turns OFF. Also, CR3007 (X-axis) and CR3107 (Y-axis) turn ON.
When zero return ends (or, stops due to an error), the zero return in progress flags and pulse output
in progress flags turn OFF and the current values return to zero.
5-94
5-5 Positioning Instructions
EXTENDED INSTRUCTIONS
Origin Start point
CCW Origin Start point CW CCW CW
5
Start point Origin
Positioning Instructions
CCW Origin CW CCW CW
Start point
JOGX
JOGY
Wide origin sensor Wide origin sensor
ORGX
ORGY
TCHX
[Zero return direction] CW [Zero return direction] CCW
Start point Within home sensor Start point Within home sensor TCHY
detection range detection range
5-95
5-5 Positioning Instructions
Operation flag
The operation flag does not change.
Execution Timing
ORGX, ORGY These instructions are executed at each scan for the duration that the execution
condition is ON.
EXTENDED INSTRUCTIONS
Scan
ON
Execution
condition OFF
Sample Program
5 00000
ORGX
Positioning Instructions
00000
↑ ORGY
5-96
5-5 Positioning Instructions
EXTENDED INSTRUCTIONS
5
Positioning Instructions
PLSX
PLSY
JOGX
JOGY
ORGX
ORGY
TCHX
TCHY
5-97
TCHX
5-5 Positioning Instructions
TCHX Teach X-axis Loads the current position of the X-axis.
TCHY TCHY Teach Y-axis Loads the current position of the Y-axis.
Execution condition
EXTENDED INSTRUCTIONS
TCHY T C H Y
— — — — — — — — — — — — — — — — — — — — —
Explanation of Operation
The current value is stored to the target value/travel of the specified point parameter No. at the up
edge of the execution condition.
5 (1) The point parameter No. for storing the current value (as the target value/travel) is stored to
CM2025 (X-axis) and CM2055 (Y-axis) within the range 0 to 31.
Positioning Instructions
TCHY instruction
To store the current value of the Y-axis as the target value of point No.10
Store "10" to CM2055.
Execute the TCHY instruction.
The content of CM2050 and CM2051 (current value of Y-axis) is moved to CM2160 and
CM2161 (target value/travel of point No.10).
5-98
5-5 Positioning Instructions
Note: The following describes the precautions to follow in the position mode.
• Point parameter Nos. stored to CM2025 outside the 0 to 31 range are ignored. An error
or a warning is not generated in this case.
• Point parameter Nos. are common to the X- and Y-axes. Point parameter Nos. are
ignored if they outside the 0 to 31 range. An error or a warning is not generated in this
case.
The following describes the precautions to follow in the speed control mode.
EXTENDED INSTRUCTIONS
• Values can be stored even in the speed control mode.
• No operations are performed while an error is generated.
Operation flag
The operation flag does not change.
Execution Timing
TCHX, TCHY Level operation of the execution conditions
5
Scan
Positioning Instructions
ON
Execution
condition
OFF
Sample Program
00000
TCHX
PLSX
PLSY
JOGX
JOGY
ORGX
ORGY
TCHX
TCHY
5-99
5-5 Positioning Instructions
5
Positioning Instructions
5-100
1 About Storage of Arithmetic Operations (Internal Registers/Temporary memory)
APPENDICES
code lists (ASCII/JIS), special device lists, and an instruction index.
A-1
1 About Storage of Arithmetic Operations (Internal Registers/Temporary memory)
MUL.D 32-bit internal register x S+1 S = TM001 TM000 32-bit internal register
MUL.L Upper Lower Upper Lower Upper Lower
4-52
ROOT.D
TM001 TM000 32-bit internal register = 32-bit internal register
ROOT.L Upper Lower Upper Lower
A-2
1 About Storage of Arithmetic Operations (Internal Registers/Temporary memory)
(2) Signed 16-bit binary data + signed 16-bit binary data = signed 16-bit binary data
DM00000 + DM00001 = DM00010
APPENDICES
(3) Unsigned 16-bit binary data + unsigned 32-bit binary data = unsigned 32-bit binary data
DM00000 + [DM00002/DM00003] = [DM00010/DM00011]
(5) Unsigned 32-bit binary data + unsigned 32-bit binary data = unsigned 32-bit binary data
[DM00000/DM00001] + [DM00002/DM00003] = [DM00010/DM00011]
(6) Signed 32-bit binary data + signed 32-bit binary data = signed 32-bit binary data
[DM00000/DM00001] + [DM00002/DM00003] = [DM00010/DM00011]
A-3
1 About Storage of Arithmetic Operations (Internal Registers/Temporary memory)
■ Subtraction (SUB)
(1) Unsigned 16-bit binary data – unsigned 16-bit binary data = unsigned 16-bit binary data
DM00000 – DM00001 = DM00010
(2) Signed 16-bit binary data – signed 16-bit binary data = signed 16-bit binary data
DM00000 – DM00001 = DM00010
(3) Unsigned 32-bit binary data – unsigned 16-bit binary data = unsigned 32-bit binary data
[DM00000/DM00001] – DM00002 = [DM00010/DM00011]
(4) Signed 32-bit binary data – signed 16-bit binary data = signed 32-bit binary data
[DM00000/DM00001] – DM00002 = [DM00010/DM00011]
(5) Unsigned 32-bit binary data – unsigned 32-bit binary data = unsigned 32-bit binary data
[DM00000/DM00001] – [DM00002/DM00003] = [DM00010/DM00011]
(6) Signed 32-bit binary data – signed 32-bit binary data = signed 32-bit binary data
[DM00000/DM00001] – [DM00002/DM00003] = [DM00010/DM00011]
A-4
1 About Storage of Arithmetic Operations (Internal Registers/Temporary memory)
■ Multiplication (MUL)
(1) Unsigned 16-bit binary data x unsigned 16-bit binary data = unsigned 32-bit binary data
DM00000 x DM00001 = [DM00010/DM00011]
(2) Signed 16-bit binary data x signed 16-bit binary data = signed 32-bit binary data
DM00000 x DM00001 = [DM00010/DM00011]
APPENDICES
(3) Unsigned 16-bit binary data x unsigned 32-bit binary data = unsigned 64-bit binary data
DM00000 x [DM00002/DM00003] = [DM00010/DM00011/DM00012/DM00013]
TM000 DM00012
(4) Unsigned 16-bit binary data x unsigned 32-bit binary data = unsigned 64-bit binary data
DM00000 x [DM00002/DM00003] = [DM00010/DM00011/DM00012/DM00013]
TM000 DM00012
LDA.L STA.L
(5) Unsigned 32-bit binary data x unsigned 32-bit binary data = unsigned 64-bit binary data
[DM00000/DM00001] x [DM00002/DM00003] = [DM00010/DM00011/DM00012/DM00013]
TM000 DM00012
LDA.D STA.D
(6) Signed 32-bit binary data x signed 32-bit binary data = signed 64-bit binary data
[DM00000/DM00001] x [DM00002/DM00003] = [DM00010/DM00011/DM00012/DM00013]
TM000 DM00012
LDA.L STA.L
A-5
1 About Storage of Arithmetic Operations (Internal Registers/Temporary memory)
■ Division (DIV)
(1) Unsigned 16-bit binary data ÷ unsigned 16-bit binary data = unsigned 16-bit binary data
Remainder: Unsigned 16-bit binary data
DM00000 ÷ DM00001 = DM00010 to DM00020
TM001 DM00020
LDA STA
(2) Signed 16-bit binary data ÷ signed 16-bit binary data = signed 16-bit binary data
Remainder: Signed 16-bit binary data
DM00000 ÷ DM00001 = DM00010 to DM00020
TM001 DM00020
LDA.S STA.S
(3) Unsigned 32-bit binary data ÷ unsigned 16-bit binary data = unsigned 32-bit binary data
Remainder: Unsigned 16-bit binary data
[DM00000/DM00001] ÷ DM00002 = [DM00010/DM00011] to DM00020
TM001 DM00020
LDA STA
(4) Signed 32-bit binary data ÷ signed 16-bit binary data = signed 32-bit binary data
Remainder: Signed 16-bit binary data
[DM00000/DM00001] ÷ DM00002 = [DM00010/DM00011] to DM00020
TM001 DM00020
LDA.S STA.S
(5) Unsigned 32-bit binary data ÷ unsigned 32-bit binary data = unsigned 32-bit binary data
Remainder: Unsigned 32-bit binary data
[DM00000/DM00001] ÷ [DM00002/DM00003] = [DM00010/DM00011] to [DM00012/
DM00013]
TM002 DM00020
LDA.D STA.D
(6) Unsigned 32-bit binary data ÷ unsigned 32-bit binary data = unsigned 32-bit binary data
Remainder: Unsigned 32-bit binary data
[DM00000/DM00001] ÷ [DM00002/DM00003] = [DM00010/DM00011] to [DM00012/
DM00013]
TM002 DM00020
LDA.L STA.L
A-6
1 About Storage of Arithmetic Operations (Internal Registers/Temporary memory)
(7) Unsigned 32-bit binary data x unsigned 32-bit binary data ÷ unsigned 32-bit binary data
= unsigned 64-bit binary data
Remainder: Unsigned 32-bit binary data
[DM00000/DM00001] x [DM00002/DM00003] ÷ [DM00004/DM00005] = [DM00010/DM00011/
DM00012/DM00013] to [DM00020/DM00021]
(8) Signed 32-bit binary data x signed 32-bit binary data ÷ signed 32-bit binary data
= signed 64-bit binary data
Remainder: Signed 32-bit binary data
[DM00000/DM00001] x [DM00002/DM00003] ÷ [DM00004/DM00005]
= [DM00010/DM00011/DM00012/DM00013] to [DM00020/DM00021]
APPENDICES
CR2002 DM00000 DM00002 DM00004 DM00010
LDA.L MUL.L DIV.L STA.L
A-7
2 Error No. Tables
between FOR and NEXT exceeds Limit the number of BREAK instructions
eight. between FOR and NEXT to within eight.
(In a nested structure, the number
of nested instructions exceeds
eight.)
15 Convert System error occurred. Clear the error, and turn the unit ON
16 Opecode again.
17 Operand If this error occurs frequently, contact
your agent.
Error No. Tables
18 Operand Range
19 Object Size The ladder object size has ex- Ether add on expanded memory, or re-
ceeded the maximum size. duce the size of the ladder program.
20 Code Size The ladder code size has exceeded
the maximum size.
30 Cycletime Over Scan time is 300 ms or faster. Review the program.
Make sure that there are not too many
repeated FOR to NEXT instructions.
Make sure that the interrupt program is
not being executed at a fast rate.
40 No Ladder The program is not registered. Register the ladder program before oper-
ating the main unit.
50 Unit Kobetu Expansion and Special Unit settings Use the Ladder Support software or
Chksum are corrupted. Memory Card to register unit setup infor-
51 Unit Conf Info Unit setup information is not set. mation.
A-8
2 Error No. Tables
APPENDICES
57 No End Unit The End Unit is not connected. Turn the KV OFF, and connect the End
Unit.
80 FROM Broken Flash ROM error Contact your agent.
81 SRAM Broken Hardware malfunction
82 Extend Memory Expanded memory was removed or Execute an all clear, and transfer the
Change inserted. ladder program again.
83 Low Battery The backup battery voltage has Replace the backup battery.
dropped.
A-9
2 Error No. Tables
the environment.
255 No Error Message System error occurred. Clear the error, and turn the unit ON
again.
If this error occurs frequently, contact
your agent.
Error No. Tables
A-10
3 Operation Processing Times List
Basic Instructions
● Contact instructions ● Output instructions
Instruction Byte Object Processing time (µs) Instruction Byte Object Processing time (µs)
size size MIN MAX size size MIN MAX
LD 4 10 0.1 0.4 OUT 4 12 0.5 0.8
LDB OUB 4 12 0.5 0.8
AND 4 6 0.4 0.4 SET 4 12 0.9 4.1
ANB
RES 4 12 0.9 3.5
OR 4 6 0.4 0.4
KEEP 4 8 2.6 2.6
ORB
DIFU 4 12 2.8 2.8
LDP 4 14 3 3
APPENDICES
LDF DIFD 4 12 2.8 2.8
ANP 4 12 3 3 ONDL 7 12 6 6
ANF OFDL 7 12 6.3 6.3
ORP 4 12 3 3 SHOT 7 26 5.7 5.7
ORF
FLIK 10 26 7.8 7.8
ALT 4 12 3.7 3.7
● Bit contact instructions
Instruction Byte Object Processing time (µs) ● Bit output instructions
A-11
3 Operation Processing Times List
* 1 When 500 to 59915 is set to the operand Differential execution type arithmetic operation in-
structions are provided. The result of execution be-
comes the value obtained by adding the above fig-
● Memory switch instructions
ures to the each scan execution type instructions.
Instruction Byte Object Processing time (µs)
size size MIN MAX
● Data move instructions
MEMSW 6 0 0 0
Instruction Byte Object Processing time (µs)
size size MIN MAX
● Step instructions DW(.U) 7 10 1.7 1.7
Processing time (µs) DW.S 8 10 1.7 1.7
APPENDICES
A-12
3 Operation Processing Times List
APPENDICES
MUL.D 7 8 4.3 14.5 WSL(.U) 10 12 17.9 20500.0*1
MUL.L 7 8 6.2 16.8 WSL.D 11 12 18.5 20500.0*2
DIV(.U) 4 8 5.5 11.7
*1 When 39999 words are shifted
DIV.S 5 8 16.1 22.1 *2 When 19999 double-words are shifted
DIV.D 7 8 9.8 51.3
DIV.L 7 8 10.8 55.6
● Data transfer instructions
INC(.U) 4 8 3.4 3.4
Instruction Byte Object Processing time (µs)
INC.S 5 8 3.6 3.6
size size MIN MAX
A-13
3 Operation Processing Times List
ZRES 7 12 10.1
CMP.F 7 8 11.2 19.8
FIFOW(.U) 7 12 7.0 7.0
ZCMP.F 12 14 18.9 34.3
FIFOW.D 8 12 11.3 11.3
EXP 1 4 360 360
LOG 1 4 370 370 FIFOR(.U) 7 12 9.5 20500.0*3
RAD 1 4 42.7 42.7 FIFOR.D 8 12 16.0 20500.0*4
DEG 1 4 44.3 44.3 EXT(.U) 1 4 1.5 1.5
SIN 1 4 210 210 EXT.S 2 4 1.5 1.5
COS 1 4 190 190 EXT.D 2 4 1.7 1.7
TAN 1 4 290 290 EXT.L 2 4 1.8 1.8
ASIN 1 4 440 440
ACOS 1 4 460 460
*1 When 40000 words are calculated
ATAN 1 4 230 230
*2 When 20000 double-words are calculated
*3 When the data of 39998 words is stored
*1 When 20000 double-words are calculated *4 When the data of 19998 double-words is stored
● Text processing instructions
Instruction Byte Object Processing time (µs) ● Clock processing instructions
size size MIN MAX Processing time (µs)
Instruction Byte Object
ASC 1 4 2.4 2.4 size size MIN MAX
RASC 1 4 2.4 2.4 WTIME 4 8 39.7 39.7
DASC(.U) 7 14 30.2 35.4 SEC 7 12 21.8 21.8
DASC.D 8 14 61.8 67.0
RSEC 7 12 34.1 34.1
DASC.S 8 14 30.7 36.2
AJST 1 4 32.7 32.7
DASC.L 8 14 62.7 67.9
RDASC(.U) 7 14 32.3 37.2
RDASC.D 8 14 60.9 65.8
RDASC.S 8 14 35.0 40.0
RDASC.L 8 14 62.1 67.1
SMOV 7 14 12.9 480*1
SADD 10 20 28.1 490.0*1
SCMP 7 14 15.8 850.0*1
DISS 7 16 14.4 390.0*1
UNIS 10 16 10.0 160.0*1
LEN 7 14 9.7 180.0*1
RCOM 7 12 63.0 63.0*1
*1 When 255 characters are calculated
A-14
3 Operation Processing Times List
APPENDICES
RETI 1 4 45.0 75.0
CTH 6 6 3.0 15.0
CTC 3 0 0 0
● Positioning instructions
Instruction Byte Object Processing time (µs)
size size MIN MAX
PLSX 3 6 6.0 6.0
A-15
4 Differences Between KV-300 & Visual KV Series
Differences in Instructions
■ Changes in data size
Instruction Details of Change
TMR The setting value was changed from 16 bits to 32 bits.
TMH
TMS
C
UDC
CTC
TMIN The digital trimmer value was changed from 16 bits to 32 bits.
APPENDICES
A-16
4 Differences Between KV-300 & Visual KV Series
APPENDICES
0007 DM00007 The content of DM00007 is measured to calculate the average
value.
: : :
39998 DM39998 The content of DM39998 is measured to calculate the average
value.
39999 DM39999 The content of DM39999 is measured to calculate the average
value.
40000 onwards Communications is not possible.
A-17
4 Differences
5 Text Code Table
Between KV-300 & Visual KV Series
A-18
6 Special Device List
Control Relay CR
With control relays (CR0000 to CR3915), you can check the operation state of the CPU Unit, set input time constants,
set high-speed counters, and make other settings.
Control relay reserved for the system cannot be used.
★ Reference pages are the page Nos. of pages in the KV-700 User's Manual. ★
Attribute
Device No. R: Read only Function
Blank: R/W
CR0000 Reserved for system
:
CR0715
APPENDICES
CR0800 Reserved for system
:
CR0915
CR1000 Reserved for system
:
CR1715
CR1800 Reserved for system
CR1801 Reserved for system
CR1815 Cam switch function, cam switch function stopped when turn ON
and OFF during operation
CR1900 Reserved for system
:
CR2001
CR2002 R ON at all times
CR2003 R OFF at all times
CR2004 R 10 ms clock pulse (at 50% duty)
CR2005 R 100 ms clock pulse (at 50% duty)
CR2006 R 1s clock pulse (at 50% duty)
CR2007 R OFF only for 1 scan at start of operation
CR2008 R ON only for 1 scan at start of operation
CR2009 ON when result of arithmetic operation is minus or overflows
CR2010 R ON when result of arithmetic operation is zero
CR2011 R ON when result of arithmetic operation is plus
CR2012 R ON at arithmetic operation execution error
CR2013 Reserved for system
:
CR2015
A-19
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CR2100 R CTH0 dedicated internal clock (1 µs)
CR2101 R CTH0 dedicated internal clock (10 µs)
CR2102 R CTH0 dedicated internal clock (100 µs)
ON: Execute.
CR2103 Automatically clear CTH0. OFF: Do not execute.
Operation when highspeed ON: Disable output.
CR2104 counter comparator CTC0 Disable/enable direct output to 00500. OFF: Enable output.
ON: Execute.
CR2105 is ON Turn OFF direct output to 00500. OFF: Do not execute.
ON: Execute.
CR2106 Turn ON direct output to 00500. OFF: Do not execute.
CR2107 Invert ON/OFF of output to 00500 each time that high-speed counter ON: Execute.
OFF: D o n o t e x e c u t e .
comparator CTC0 turns ON.
ON: Disable output.
CR2108 Operation when highspeed Disable/enable direct output to 00500. OFF: Enable output.
ON: Execute.
CR2109 counter comparator CTC1 Turn OFF direct output to 00500. OFF: Do not execute.
CR2111 Invert ON/OFF of output to 00500 each time that high-speed counter ON: Execute.
OFF: D o n o t e x e c u t e .
comparator CTC1 turns ON.
ON: Execute.
CR2112 Automatically clear CTH0 when high-speed counter comparator CTC1 is ON. OFF: Do not execute.
CR2207 Invert ON/OFF of output to 00501 each time that high-speed counter ON: Execute.
OFF: D o n o t e x e c u t e .
comparator CTC2 turns ON.
ON: Disable output.
CR2208 Operation when highspeed Disable/enable direct output to 00501. OFF: Enable output.
ON: Execute.
CR2209 counter comparator CTC3 Turn OFF direct output to 00501. OFF: Do not execute.
is ON ON: Execute.
CR2210 Turn ON direct output to 00501. OFF: Do not execute.
CR2211 Invert ON/OFF of output to 00501 each time that high-speed counter ON: Execute.
OFF: D o n o t e x e c u t e .
comparator CTC3 turns ON.
ON: Execute.
CR2212 Automatically clear CTH1 when high-speed counter comparator CTC3 is ON. OFF: Do not execute.
Single-phase 1X 2X 4X 2 pulses
CR2213 High-speed counter CTH1
W/out direction W/ direction
count input mode selec-
CR2214 CR2213 OFF ON OFF ON OFF ON
tion.
CR2214 OFF OFF ON ON OFF OFF
CR2215 CR2215 OFF OFF OFF OFF ON ON
ON: Execute.
CR2300 Disable external outputs OFF: Do not execute.
ON: Execute.
CR2301 Disable external input refreshing OFF: Do not execute.
CR2304 R ON for 1 scan only at fixed scan time setting value exceeded
CR2305 Set input time constant of all CPU Unit inputs. ON: Set.
OFF: Do not set. (10 ms)
(Determine referring to CM1620 when ON.)
CR2306 R ON at backup battery error
CR2307 Reserved for system
:
CR2315
A-20
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
Unused Up edge Down edge Level
CR2400 CTH0 external signal preset
CR2400 OFF ON OFF ON
CR2401 CR2401 OFF OFF ON ON
ON: Use.
CR2402 CTH0 ring counter OFF: Do not use.
APPENDICES
CR2415 Specified frequency pulse output, error
ON: Execute.
CR2500 Frequency counter, start of operation OFF: Do not execute.
CR2509 Cam switch, output response impossible warning (generated when output does not track during cam
switch operation)
CR2510 R Cam switch, error
CR2511 Reserved for system
:
CR2615
CR2700 INT0 interrupt polarity Up edge Down edge Both edges
CR2700 OFF ON OFF ON
CR2701 CR2701 OFF OFF ON ON
A-21
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CR2803 R Serial communications, ON for 1 scan only at text data receive error
CR2804 Serial communications, start sending text data (ON while data is being sent)
ON: Perform.
CR2805 Serial communications, receive text data in word units OFF: Do not perform.
ON: Perform.
CR2806 Serial communications, send text data in word units OFF: Do not perform.
CR2915
CR3000 X-axis, limit switch CW input
CR3001 X-axis, limit switch CCW input
CR3002 X-axis, origin sensor input
CR3003 X-axis, stop sensor input
CR3004 R X-axis, zero return in operation
CR3005 X-axis, zero return completed
CR3006 Reserved for system
Special Device List
A-22
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CR3200 Logging function, trigger setting
CR3201
CR3202 Logging function, time stamp ON
CR3203 Logging function, start
CR3204 Logging function, write during operation
CR3205 Logging function, CPU buffer overflow
CR3206 Logging function, registered device error
CR3207 Logging function, write error
CR3208 Logging function, MMC data overflow
CR3209 Logging function, MMC insufficient free space
CR3210 Logging function, logging execution in progress
CR3211 Reserved for system
APPENDICES
:
CR3215
CR3300 Alarm relay Alarm 0
: :
CR3415 Alarm 31
CR3500 R Turn ON if one of alarm relays CR3300 to CR3415 is ON.
ON: Leave history.
CR3501 Leave history when alarm relay state changes to OFF from ON. OFF: Do not leave history.
A-23
6 Special Device List
Control Memory CM
With control memory (CM0000 to CM3999), you can set various special CPU Unit functions.
Control memory reserved for the system cannot be used.
Attribute
Device No. R: Read only Function
Blank: R/W
CM0000 1st line display device setting
CM0001 1st line display device setting
CM0002 2nd line display device setting
CM0003 2nd line display device setting
CM0004 Operation panel KV-D30 3rd line display device setting
page 0
CM0005 3rd line display device setting
CM0006 4th line display device setting
CM0007 4th line display device setting
APPENDICES
A-24
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CM0210 Page 1, display attribute setting
: Operation panel KV-D30 :
CM0389 Page 18, display attribute setting
CM0390 1st line display attribute setting
CM0391 1st line display attribute setting
CM0392 2nd line display attribute setting
CM0393 2nd line display attribute setting
Operation panel KV-D30
CM0394 3rd line display attribute setting
page 19
CM0395 3rd line display attribute setting
CM0396 4th line display attribute setting
CM0397 4th line display attribute setting
CM0398 Template 1 setting
CM0399 Template 2 setting
APPENDICES
CM0400 Operation panel KV-D30, move enable/disable setting
CM0401 Operation panel KV-D30, page switching setting
CM0402 Operation panel KV-D30, current display page
CM0403 Reserved for system
:
CM0409
CM0410 Operation panel KV-D30, used by CM direct accessing
:
A-25
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CM1100 Number of sent text data
CM1101 R Received sent data 1
: :
CM1199 Received sent data 99
CM1200 Reserved for system
:
CM1399
CM1400 Cam switch function, set leading output relay No.
CM1401 Cam switch function, comparator value in multi-stage compare mode
CM1402 Cam switch function, number of pulses in cycle of device input to CTH0
CM1403 Cam switch function, absolute type input address
CM1404 R Cam switch function, current angle
CM1405 R Cam switch function, error No.
APPENDICES
CM1473
CM1474 Reserved for system
:
CM1479
CM1480 R Frequency counter function, frequency measurement results (Hz/rpm)
CM1481 R
CM1482 Frequency counter function, measurement cycle (ms)
CM1483 Frequency counter function, average number of measurements
CM1484 Reserved for system
:
CM1489
CM1490 Specified frequency pulse output function, set frequency (Hz)
CM1491
CM1492 Reserved for system
:
CM1499
CM1500 R Reserved for system
:
CM1531
CM1532 R Reserved for system
:
CM1563
A-26
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CM1564 R Reserved for system
CM1565 Reserved for system
:
CM1569
CM1570 Reserved for system
:
CM1577
CM1578 Reserved for system
:
CM1599
CM1600 CTH0 ring counter upper limit value
CM1601
CM1602 CTH1 ring counter upper limit value
APPENDICES
CM1603
CM1604 CTH0 preset input
CM1605
CM1606 CTH1 preset input
CM1607
CM1608 Reserved for system
CM1609
CM1610 R Input capture at INT0 generation
A-27
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CM1712 Digital trimmer 6 upper limit value
CM1713
CM1714 Digital trimmer 7 upper limit value
CM1715
CM1716 Reserved for system
:
CM1719
CM1720 Access window, user message 1
CM1721 Access window, user message 2 (max. 32 characters)
:
CM1737
CM1738 Access window, operation disabled setting
CM1739 Reserved for system
APPENDICES
:
CM1999
CM2000 X-axis, I/O setting
CM2001 X-axis, sensor enable
CM2002 X-axis, current value comparator 0
CM2003
CM2004 X-axis, current value comparator 1
CM2005
Special Device List
A-28
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CM2030 Y-axis, I/O setting
CM2031 Y-axis, sensor enable
CM2032 Y-axis, current value comparator 0
CM2033
CM2034 Y-axis, current value comparator 1
CM2035
CM2036 Y-axis, zero return: startup frequency
CM2037 Y-axis, zero return: acceleration/deceleration time
CM2038 Y-axis, zero return: operation frequency
CM2039
CM2040 Y-axis, jog operation: startup frequency
CM2041 Y-axis, jog operation: acceleration/deceleration time
APPENDICES
CM2042 Y-axis, jog operation: operation frequency
CM2043
CM2044 Y-axis, change current value setting value
CM2045
CM2046 Y-axis, change operation speed setting value in speed control mode
CM2047
CM2048 Reserved for system
CM2049 Y-axis, M code
A-29
6 Special Device List
Attribute
Device No. R: Read only Function
Blank: R/W
CM2370 Target value/travel
CM2371 Startup frequency
CM2372 Acceleration/deceleration time
CM2373 Operation frequency
CPU positioning function
CM2374
Point parameter 31
CM2375 Operation mode
CM2376 Number of specified stop sensor pulses
CM2377 Reserved for system
CM2378
CM2379
CM2380 Reserved for system
:
CM2599
APPENDICES
: :
CM2670 trigger selection details 6
CM2671 Logging function, number of registered devices
CM2672 Logging function, Memory Card storage capacity
CM2673 Reserved for system
:
CM3999
A-30
7 Index
7 Index [D]
data blocks ............................................................ 4-2
Data memories .......................................... 1-10, 1-15
[Numbers/Symbols] Decimal ............................................................... 1-22
.D ............................................................ 1-28, 4-27 Differential execution type ..................................... 1-5
.F ...................................................................... 1-28 direct input ........................................................... 5-60
.L ............................................................ 1-28, 4-27 direct output ........................................................ 5-61
.S ............................................................ 1-28, 4-26
.U ............................................................ 1-28, 4-26 [E]
$ .......................................................................... 1-18 Every scan execution type .................................... 1-5
# .......................................................................... 1-18 EXTENDED INSTRUCTIONS ............................... 5-1
16-bit internal register ......................................... 1-17 Extended instructions ............................................ 1-2
32-bit Data ........................................................... 1-24 Extended Ladder ................................................. 1-38
32-bit internal register ......................................... 1-17
APPENDICES
[F]
[A]
Floating point real numbers ................................. 1-23
About annotation of devices for data memory units ...
............................................................................ 1-16
[H]
About annotation of devices for relay units ......... 1-12
HEX ..................................................................... 1-22
APPLIED INSTRUCTIONS ................................... 3-1
High-speed counter comparators .... 1-10, 1-14, 5-69
Applied instructions ............................................... 1-2
Index
Comparator Match Output ............................. 5-81
Arithmetic instructions ........................................... 1-2
High-speed counters (CTH) ............ 1-10, 1-17, 5-69
ARITHMETIC OPERATION INSTRUCTIONS ...... 4-1
Changing the current value (CTH) ................. 5-74
ASCII ................................................................... 1-24
Changing the setting value (CTC) .................. 5-74
ASCII code .......................................................... 1-24
Extended Functions ....................................... 5-83
ASCII Code Table .............................................. A-18
Preset Function .............................................. 5-80
Reading current values .................................. 5-73
[B]
Reset Method ................................................. 5-78
BASIC INSTRUCTIONS ....................................... 2-1
Setting Count Input ........................................ 5-75
Basic instructions .................................................. 1-2
BDC..................................................................... 1-22
[I]
BDC (Binary Coded Decimal) ............................. 1-22
Indirect Specification ........................................... 1-42
BIN ...................................................................... 1-22
Input Capture Function ........................................ 5-62
Binary .................................................................. 1-22
Input relays................................................ 1-10, 1-11
Bit Devices ................................................ 1-10, 1-11
Internal Annotation of Floating Point Real Numbers 1-23
Handling Bit Devices in Word Units ............... 1-25
Internal auxiliary relays ............................. 1-10, 1-12
Internal Registers ...................................... 1-10, 1-17
[C]
16-bit internal register .................................... 1-17
CM ...................................................................... A-24
32-bit internal register .................................... 1-17
contact blocks ..................................................... 2-68
Interrupt Function ................................................ 5-57
Control Memory ............................... 1-10, 1-16, A-24
Interrupt program ................................................ 1-36
Control Relay ................................... 1-10, 1-13, A-19
Interrupt program execution conditions .......... 5-58
Count input types ................................................ 5-72
Counters .................................................... 1-10, 1-14
[J]
About the maximum count speed of counters 1-14
Jog operation ...................................................... 5-92
changing counter current values .................... 2-58
changing counter setting values .................... 2-58
reading counter current values ...................... 2-59 [M]
CR ...................................................................... A-19 Main routine program .......................................... 1-34
A-31
7 Index
[O]
operands ............................................................... 1-3
Output relays ............................................. 1-10, 1-11
[P]
Point parameters ................................................. 5-89
Positioning Instructions ....................................... 5-88
program blocks .................................................... 2-68
[R]
Ring Counter Function ........................................ 5-82
[S]
APPENDICES
[T]
Teach .................................................................. 5-98
Temporary data memories ........................ 1-10, 1-16
Timers ....................................................... 1-10, 1-13
About timer error ............................................ 1-13
changing timer current values ........................ 2-54
changing timer setting values ........................ 2-54
reading timer current values .......................... 2-55
Trapezoidal control .............................................. 5-88
Types of Interrupt Causes ................................... 5-58
[U]
unsigned binary ................................................... 1-22
[W]
Word Devices ............................................ 1-10, 1-15
word device bit specification .......................... 2-12
[X]
Example of changing counter setting values ....... 2-58
[Z]
zero-return ........................................................... 5-94
A-32
8 Instruction
7 Index
APPENDICES
ANL ..................................................................... 2-76 DIV.F ................................................................. 4-140
ANP ..................................................................... 2-10 DMX .................................................................... 4-94
ARES .................................................................. 5-48 DW ........................................................................ 4-4
ASC ................................................................... 4-170 DW.F ................................................................. 4-120
ASIN .................................................................. 4-162
ATAN ................................................................. 4-166 [E]
AVG..................................................................... 5-20 EI ......................................................................... 5-54
Instruction
Index
END ..................................................................... 2-70
[B] ENDH .................................................................. 2-70
BAND .................................................................. 2-14 ENDS .................................................................. 3-20
Index
BANDB ................................................................ 2-14 EORA .................................................................. 4-68
BCNT .................................................................... 5-6 EXP ................................................................... 4-148
BLD ..................................................................... 2-14 EXT ..................................................................... 5-32
BLDB ................................................................... 2-14
BMOV .................................................................. 4-18 [F]
BOR .................................................................... 2-14 FIFOR ................................................................. 5-28
BORB .................................................................. 2-14 FIFOW ................................................................. 5-26
BOUB .................................................................. 2-42 FLIK ..................................................................... 2-36
BOUT .................................................................. 2-42 FLOAT ............................................................... 4-114
BREAK ................................................................ 3-38 FMOV .................................................................. 4-20
BRES .................................................................. 2-44 FMOV.F ............................................................. 4-128
BSET ................................................................... 2-44 FOR ..................................................................... 3-38
[C] [G]
C .......................................................................... 2-56 GRY .................................................................... 4-96
CALL ................................................................... 3-34
CMP .................................................................... 4-54 [H]
CMP.S ................................................................. 4-54
HKEY .................................................................... 5-4
CMP.F ............................................................... 4-144
HSP ..................................................................... 5-52
COM .................................................................... 4-70
CON .................................................................... 2-72
[I]
COS .................................................................. 4-158
INC ...................................................................... 4-44
CTC ..................................................................... 5-68
INT ...................................................................... 5-56
CTH ..................................................................... 5-68
A-33
7 Index
8 Instruction Index
[L] [R]
LD.......................................................................... 2-4 RAD ................................................................... 4-152
LDA ....................................................................... 4-6 RASC ................................................................ 4-172
APPENDICES
A-34
8 Instruction7 Index
[T]
TAN ................................................................... 4-160
TBCD .................................................................. 4-90
TBIN .................................................................... 4-92
TCHX .................................................................. 5-98
TCHY .................................................................. 5-98
TMH .................................................................... 2-50
TMIN ................................................................... 4-12
TMR .................................................................... 2-48
TMS..................................................................... 2-52
[U]
UDC .................................................................... 2-64
UDT ..................................................................... 2-66
APPENDICES
UNIB .................................................................. 4-106
UNIF .................................................................. 4-132
UNIN ................................................................. 4-102
UNIS .................................................................. 4-190
[W]
W-DE ................................................................... 3-26
Instruction
Index
W-OFF ................................................................ 3-24
W-ON .................................................................. 3-24
W-UE ................................................................... 3-26
Index
WSL .................................................................... 4-86
WSR .................................................................... 4-84
WTIME ................................................................ 5-38
[X]
XCH................................................................... 4-110
[Z]
ZCMP .................................................................. 4-58
ZCMP.F ............................................................. 4-146
ZRES ................................................................... 5-24
A-35
Revision History
Printing Date Version Revision Details
(2) KEYENCE is pleased to offer suggestions on the use of its various Products. They
are only suggestions, and it is Buyer's responsibility to ascertain the fitness of the
Products for Buyer's intended use. KEYENCE will not be responsible for any
damages that may result from the use of the Products.
(3) The Products and any samples ("Products/Samples") supplied to Buyer are not to
be used internally in humans, for human transportation, as safety devices or fail-
safe systems, unless their written specifications state otherwise. Should any
Products/Samples be used in such a manner or misused in any way, KEYENCE
assumes no responsibility, and additionally Buyer will indemnify KEYENCE and
hold KEYENCE harmless from any liability or damage whatsoever arising out of any
misuse of the Products/Samples.