KVS Ladder Instruction
KVS Ladder Instruction
Chapter
BRIEF EXPLANATION
OF INSTRUCTIONS
Chapter
BASIC
INSTRUCTIONS
■ Related manuals
All of the following PDF manuals can be accessed from KV STUDIO's Help function. In addition, the
latest version of PDF manuals can be downloaded from the Keyence web site.
● Common
Designation Note
KV-8000/7000/5000/3000/1000 Series
This Manual describes a variety of instructions in ladder diagram
and KV Nano Series
programming.
Instruction Reference Manual
KV-8000/7000/5000/3000/1000 Series
This Manual describes script programming and available operators,
and KV Nano Series
control statements and functions.
Script Programming Manual
KV STUDIO User's Manual This manual describes how to operate "KV STUDIO".
KV-5500/5000/3000/1000 Series This manual describes the system macros available for the KV-
System Macro Manual 5500/5000/3000/1000 Series.
Important It indicates cautions and limitations that must be followed during operation.
■ General Precautions
• Verify that the KV-8000/7500/7300/5500/5000/3000/1000 and the KV Nano Series
are operating normally in terms of functionality and performance when
operating KV STUDIO.
• Verify that this device is operating normally in terms of functionality and
performance before the start of work and when operating the device.
• Provide a safety circuit that bypasses PLC to enable failsafe operation of the
entire system in the event that the PLC fails.
WARNING
• Output circuit or internal circuit malfunctions sometimes prevent control from
being performed normally. Be sure to provide a safety circuit in control systems
where circuit malfunction may lead to fire or other serious accidents.
• Do not use this product for the purpose to protect a human body or a part of
human body.
• This product is not intended for use as explosion-proof product. Do not use this
product in a hazardous location and/or potentially explosive atmosphere.
When this product is used with methods other than what is mentioned in this
CAUTION
instruction manual, the protection provided by the product may be ruined.
• Proceed with care when modifying the KV-1000/700 Series, or when using it in a
manner that falls outside of the ranges indicated in its specifications, since
KEYENCE is unable to guarantee device functionality or performance in such
situations.
NOTICE
• Use this product in combination with other devices only after careful
consideration, since the product may fail to satisfy its functionality and
performance capabilities as a result of the conditions and environment in which
it is used.
909GB
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1
KV-8000 CPU Function Version
The functions of the KV-8000 Series differ depending on the CPU function version.
The CPU function version can be checked using "Tools" → "Check CPU Function Version" → "PLC" in
the KV STUDIO menu (* KV STUDIO Ver.10.0 or later is required).
The CPU function version can be updated using "Tools" → "Check CPU Function Version" → "PLC" →
"Update System Program" in the KV STUDIO menu. (* KV STUDIO Ver.10.0 or later is required.)
Chapter 1 BRIEF EXPLANATION in this manual, and describes basic knowledge needed in handling instructions such
OF INSTRUCTIONS as how to handle data. (Detailed explanations of instructions in Chapters 2 to 5
1
assume that readers of this manual have read and fully understood this chapter.)
5
3
These instructions are for work progress, program control, and
APPLIED
Chapter INSTRUCTIONS
extended ladders.
These instructions allow you to structurally script basic ladders.
A
ARITHMETIC
4
These instructions are for executing comparisons, arithmetical calculations,
Chapter OPERATION logical calculations, data move, and text string processing. These
INSTRUCTIONS instructions allow you to simply script complex arithmetic calculation circuits.
5
These instructions are for data processing, clock processing,
EXTENDED
Chapter INSTRUCTIONS
high-speed processing, and positioning processing, and
memory card control.
3 Within the ladder diagram editing area of KV STUDIO, single click the unit to be inserted into
reference ladder diagram, choose "Edit(E)" → "List edit(L)" in the menu, and then "list edit"
dialog box is displayed.
Other
• +
Paste the copied Mnemonics to the "list edit"
dialog box.
Paste by choosing "paste" in the right-click
menu of the dialog box.
Symbols
Menus or buttons in descriptions in this manual are expressed using the following symbols.
Term Explanation
Values prefixed by "#" are expressed in decimal. Basically, all numerical
#
values are expressed in decimal even if they are not prefixed by "#".
$ Values prefixed by "$" are expressed in hexadecimal.
When 32-bit numerical values are handled, two devices are used. Programs
are scripted using only device Nos. (in the example on the left, DM0) to which
"DM0·DM1"
the lower 16 bits are stored. The example on the left indicates that 32-bit data
is being handled.
This indicates "(device turns ON) at the rising edge of a signal."
This indicates "for the duration that the signal is ON."
This indicates "(device turns OFF) at the falling edge of a signal."
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. )
From a functional perspective, the instructions that can be used in the KV-8000/7500/7300/5500/5000/
3000/1000 and KV Nano Series programs are classified into the following categories.
■ Basic Instructions
1 This chapter explains the most basic instructions in writing a sequence program.
Types of Instruction
These instructions are sufficient for enabling mechanical control on the same level as that of a general-
purpose relay sequence circuit.
■ Applied Instructions
These instructions are for project progress, program control, and extended ladders. These instructions
enable structured programming for basic ladders.
■ Extended Instructions
These instructions are for data processing, clock processing, high-speed processing, and positioning
processing, and memory card control.
For information about other instructions for CPU built-in features, see User's Manual of the CPU unit
used.
Reference For searching instruction word, please refer to the following screens.
• Search desired instructions words "Contents" (Page 8)
• Search instruction words with the Arabic numeral sequence index "Instruction
Index" (Page A-102)
BRIEF EXPLANATION OF
INSTRUCTIONS
Each instruction is composed of operands and operators. Their definitions are as follows:
1
4th operand 5th operand
operand section
Structure of Instruction
Operand values vary depending on instructions (There may be more than 6 operands or no operands).
In this manual, operands and operators are represented as follows:
■ Instruction Code
Depending on operations, individual instructions have different names. These are called "instruction
operator", or simply called "instruction". For example, instructions for 16-bit data transfer are
represented as "MOV", whereas instructions for comparison of 2 16-bit data are represented as "LD=".
In addition, process data can be differentiated by adding "suffix" at the end of instruction words.
"Suffix" (Page 1-28)
"Data Processing" (Page 1-31)
■ Operand Code
The reference objects for instruction execution and storage of instruction execution result data are all specified with operands.
For operands, different queuing sequences are assigned to different functions which accordingly have different representations.
Main function Name Conventions used in this manual
Assign a reference object before Source S (when multiple constants exist S1 S2 …)
functions are executed.
Assign a storage area for function Destination D (when multiple constants exist D1 D2 …)
execution results
Example
"MOV", the 16-bit data transmission instruction is shown as follows:
MOV
S D MOV S D
As shown in this figure, behind "MOV", operands are arranged in the order of "reference object" and "storage position".
Point Depending on functions, operand sequences are different for different instructions.
For more information, please see respective instruction explanation screens.
Specify a device, variable or constant for each operand and then execute the instruction.
Example
Transfer constant "0" to device "DM0".
MOV
#0 DM0
For details on devices, variables and constants, please see "Device and Constant" (Page 1-4) and
"Variable" (Page 1-26).
The devices or constants used in an instruction operand vary depending on instruction words.
Device is such elements as relays, timers, counters, and data memories used in the CPU unit. In
programming, devices are described behind the instruction, which are used for assignment of data
used in the instruction and storage of instruction execution results.
* For details on each device, see User's Manual of the CPU unit used.
1
KV-8000 Series
Device and Constant
Device List
■ Bit device
When start Indirect
Local Index
*1 Number of operation specifying(*)*6
Device name Range Main functions device Modify
points (Power ON, Refer-
(@)*1 (:Z/:#) Store
PRG →RUN) ence
Device used for
Input relay*8 R000 to R199915*2 capturing ON/OFF - Yes Yes Yes No
Total 32000 info from peripherals.
points for
Device used for
input, output,
Output relay*8 R000 to R199915*2 sending ON/OFF Clear/hold*3 Yes Yes Yes No
and internal
info to peripherals
auxiliary
relays. Devices that can be
Internal
R000 to R199915*2 used in CPU and Clear/hold*3 Yes Yes Yes No
auxiliary relay
expansion unit
Link relay B00 to B7FFF*7 32768 Clear/hold*3 No Yes Yes No
Internal Devices that can be
MR000 to MR399915 64000 Clear Yes Yes Yes No
auxiliary relay only used in CPU
Latch relay LR000 to LR99915 16000 Hold Yes Yes Yes No
10μs, 1ms, 10ms,
100ms down
Timer (contact) T0 to T3999 4000 counter, 10ms Clear Yes Yes Yes No
contact device of
up/down counter
Devices that can be
Counter used for up counter
C0 to C3999 4000 Clear/hold*5 Yes Yes Yes No
(contact) and up/down
counter contact
Devices used for
controlling PLC
Control relay*4 CR000 to CR7915 1280 function or capturing Hold No No No No
the status from
peripherals.
*1 Since they are used for local device, their reserved number is limited by the usable range of global devices.
"Local device list" (Page 1-11)
*2 R000 to R199915 can be specified as extended I/O relay with Unit Monitor.
*3 Clear/Hold settings can be made in the "Power Failure Holding" option.
*4 "KV-8000 series User's Manual "CR/CM table""
*5 Hold/Clear setups can be made in the "Power Failure Holding" option. (only for contacts and current values)
*6 "Store" is a device that can be described as "*(device)". "Lookup" is a device that can be indirectly specified.
"KV-8000 series User's Manual "Indirect specifying""
*7 Specify all device No. in HEX.
*8 "DR" represents direct processing.
"KV-8000 series User's Manual "About direct processing""
INSTRUCTIONS
■ Word device
When start Indirect
Local Index
Number of operation specifying(*)*7
Device name Range *1 Main functions device Modify
points (Power ON,
1
Refer-
(@)*1 (:Z/:#) Store
PRG →RUN) ence
*2 Yes Yes Yes Yes
Data memory DM0 to DM65534 65535 Clear/hold
■ Constant
Constant Range Main Functions
#0 to #65535 (unsigned 16-bit)
-32768 to +32767 (signed 16-bit) Used for specifying DEC constant.
DEC(#)
#0 to #4294967295 (unsigned 32-bit) * XYM Marking is represented by "K".
-2147483648 to +2147483647 (signed 32-bit)
-3.4E+38 ≤ N ≤ -1.4E-45
Single precision
N=0 Used for specifying single precision
floating point type
+1.4E-45 ≤ N ≤ +3.4E+38 floating point type real number.
real number
(Significant digit : 7 digit)
-1.79E+308 ≤ N ≤ -2.23E-308
Double precision
N=0 Used for specifying double precision
floating point type
+2.23E-308 ≤ N ≤ +1.79E+308 floating point type real number.
real number
(Significant digit : 16 digit)
$0000 to $FFFF (16-bit) Used for specifying HEX constant.
HEX($)
$00000000 to $FFFFFFFF (32-bit) * XYM Marking is represented by "H".
Fixed text string ("") Example) "Type ABC", "MON/08:30:15" Used for specifying fixed text string.
■ Internal register
Number When start operation
Device name Range Main functions
of points (Power ON, PROG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)
INSTRUCTIONS
Local device list
The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through "CPU system setting" → "Assignment of all
local devices setting" on the "Workspace". 1
Local device Global device Total
Device name*1
Point • If relays (R) and temporary data memories (TM) are used a local device, the
number of relays and data memories must be specified.
• The following devices must be processed as global devices or global variables.
- Devices assigned to expansion units
- The device / variable referenced by such peripherals as touch panel
- Common device / variable in the whole project
- Device / variable for inter-module data transmission
• Where possible, local devices should be coded from 0 and use consecutive numbers.
• Since R and DM are assigned to the expansion unit, as a global device, there
must be an area to be used. When using local devices, please use MR or EM first.
• If local devices or global devices are used outside the specified range, then an
conversion error will occur.
• For the KV-8000/7000 Series, when an index modification or indirect
specification is used to specify outside of the usable range of local devices or
global devices, an operation error will occur.
• When various instructions using the leading device as the operands and index
modification or indirect specifying are used, the range of the local devices and
global devices that can be used should not be exceeded.
• When the index modification, indirect reference or array element is dynamically
specified using devices or variables in the KV-8000 series, a calculation error
may occur or an unintended area may be referenced once an area beyond the
range of devices or work area is accessed.
• When the index modification, indirect reference or array element isdynamically specified
using devices or variables, the range of devices or work area should not be exceeded.
KV-7000 Series
Device List
1
■ Bit device
Device and Constant
INSTRUCTIONS
■ Word device
When start Indirect
Local Index
Number of operation specifying(*)*7
Device name Range *1 Main functions device Modify
points (Power ON,
1
Refer-
(@)*1 (:Z/:#) Store
PRG →RUN) ence
*2 Yes Yes Yes Yes
Data memory DM0 to DM65534 65535 Clear/hold
■ Constant
Constant Range Main Functions
#0 to #65535 (unsigned 16-bit)
-32768 to +32767 (signed 16-bit) Used for specifying DEC constant.
DEC(#)
#0 to #4294967295 (unsigned 32-bit) * XYM Marking is represented by "K".
-2147483648 to +2147483647 (signed 32-bit)
-3.4E+38 ≤ N ≤ -1.4E-45
Single precision
N=0 Used for specifying single precision
floating point type
+1.4E-45 ≤ N ≤ +3.4E+38 floating point type real number.
real number
(Significant digit : 7 digit)
-1.79E+308 ≤ N ≤ -2.23E-308
Double precision
N=0 Used for specifying double precision
floating point type
+2.23E-308 ≤ N ≤ +1.79E+308 floating point type real number.
real number
(Significant digit : 16 digit)
$0000 to $FFFF (16-bit) Used for specifying HEX constant.
HEX($)
$00000000 to $FFFFFFFF (32-bit) * XYM Marking is represented by "H".
Fixed text string ("") Example) "Type ABC", "MON/08:30:15" Used for specifying fixed text string.
■ Internal register
Number When start operation
Device name Range Main functions
of points (Power ON, PROG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)
1-10 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
BRIEF EXPLANATION OF
Device and Constant
INSTRUCTIONS
Local device list
The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through“CPU system setting”→“Assignment of
all local devices setting”on the “Workspace”. 1
Local device Global device
Point • If relays (R) and temporary data memories (TM) are used a local device, the
number of relays and data memories must be specified.
• The following devices must be used as a global device:
- Devices assigned to expansion units
- The devices referenced by such peripherals as touch panel
- Common devices in the whole project
- Devices for inter-module data transmission
• Where possible, local devices should be coded from 0 and use consecutive numbers.
• Since R and DM are assigned to the expansion unit, as a global device, there
must be an area to be used. When using local devices, please use MR or EM first.
• If local devices or global devices are used outside the specified range, then an
conversion error will occur.
• For the KV-7000 Series, when an index device or indirect specification is used to
specify outside of the usable range of local devices or global devices, an
operation error will occur.
• When various instructions using the leading device as the operands and index
modification or indirect specifying are used, the range of the local devices and
global devices that can be used should not be exceeded.
KV-5500/5000/3000 Series
Device List
1
■ Bit device
Device and Constant
INSTRUCTIONS
■ Word device
When start Indirect
Local Index
Number of operation specifying(*)*7
Device name Range *1 Main functions device Modify
points (Power ON,
1
Refer-
(@)*1 (:Z/:#) Store
PROG →RUN) ence
*2 Yes Yes Yes Yes
Data memory DM0 to DM65534 65535 Clear/hold
1
Attribute Sign Range Description
specifying (*) device (@) modify(:)
Device P P0 to P9 Devices are used as argument No No Yes
Device and Constant
■ Constant
Constant Range Main Functions
#0 to #65535 (unsigned 16-bit)
-32768 to +32767 (signed 16-bit) Used for specifying DEC constant.
DEC(#)
#0 to #4294967295 (unsigned 32-bit) * XYM Marking is represented by "K".
-2147483648 to +2147483647 (signed 32-bit)
-3.4+E38 ≤ N ≤ -1.4E-45
Single precision
N=0 Used for specifying single precision
floating point type
+1.4E-45 ≤ N ≤ +3.4E+38 floating point type real number.
real number
(Significant digit : 7 digit)
-1.79E+308 ≤ N ≤ -2.23E-308 Used for specifying double precision
Double precision
N=0 floating point type real number.
floating point type
+2.23E-308 ≤ N ≤ +1.79E+308 * Supported with CPU function
real number *
(Significant digit : 16 digit) version 2.0 and higher.
$0000 to $FFFF (16-bit) Used for specifying HEX constant.
HEX($)
$00000000 to $FFFFFFFF (32-bit) * XYM Marking is represented by "H".
Fixed text string
Example) "Type ABC", "MON/08:30:15" Used for specifying fixed text string.
("")
■ Internal register
When start
Number of operation
Device name Range Main functions
points (Power ON,
PROG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)
INSTRUCTIONS
Local device list
The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through“CPU system setting”→“Assignment of
all local devices setting”on the “Workspace”. 1
Local device Global device
Point • If relays (R) and temporary data memories (TM) are used a local device, the
number of relays and data memories must be specified.
• The following devices must be used as a global device:
- KV-5500/5000/3000 PLC I/O relays
- Expansion unit device
- The devices referenced by such peripherals as touch panel
- Common devices in the whole project
- Devices for inter-module data transmission
• Where possible, local devices should be coded from 0 and use consecutive
numbers.
• Since R and DM are assigned to the expansion unit, as a global device, there
must be an area to be used. When using local devices, please use MR or EM
first.
• If local devices or global devices are used outside the specified range, then an
conversion error will occur.
• When various instructions using the leading device as the operands and index
modification or indirect specifying are used, the range of the local devices and
global devices that can be used should not be exceeded.
KV-1000 Series
Device List
1
■ Bit device
Device and Constant
Indirectly
When start *8
Device Number of Local Pointer specified (*)
Range*1 Main functions operation device modify Refer-
name point Power (@)(@)*1 (: Z/: #) ence Source
( ON ) address
address
R000 to R015 Device used for capturing ON/
Input relay - Yes Yes Yes No
(R1000 to R59915*3) Total 9536 OFF info from peripherals.
points for input,
R500 to R507 Device used for capturing ON/
Output relay output, and Clear*4 Yes Yes Yes No
(R1000 to R59915*3) OFF info from peripherals.
internal auxiliary
R508 to R915*2 relays. Devices that can be used
Clear *4 Yes Yes Yes No
Internal auxiliary R1000 to R59915*3 in CPU and expansion unit
relay
MR000 to MR99915*5 16000 Clear Yes Yes Yes No
Devices that can be only
Internal auxiliary
used in CPU
relay LR000 to LR99915 16000 Hold Yes Yes Yes No
(Latch relay)
*1 The range of the global devices that can be used is restricted by number of devices that is reserved for the local
devices.
"Local device list" (Page 1-11)
*2 R100 to R415 are reserved for the system and cannot be used.
*3 R1000 to R59915 can be specified as extended I/O relay with Unit Monitor.
*4 The MEMSW instruction can be used to specifying clear/hold.
*5 MR94000 to MR99915 is reserved for the system and cannot be used.
*6 "CR/CM List" (Page A-43)
*7 The MEMSW instruction can be used to specify hold/clear. (only for contacts and current values)
*8 "Store" is a device that can be described as "* (device)". "Lookup" is a device that can be indirectly specified.
INSTRUCTIONS
■ Word device
When start Indirectly
Device Number of Local Pointer specified (*)*8
Range*1 Main functions operation device modify
name point Power (@)(@)*1 (: Z/: #) Refer- Store
1
( ON ) ence
Data memory DM0 to DM65534 65535 Hold*2 Yes Yes Yes Yes
Device for storing
Expansion data EM0 to EM65534*3 65535 Hold*2 Yes Yes Yes Yes
numerical data (16-bit)
*1 The range of the global devices that can be used is restricted by number of devices that is reserved for the local
devices.
"Local device list" (Page 1-11)
*2 The MEMSW instruction can be used to specifying clear/hold.
*3 EM64535 to EM65534,FM31767 to FM32766 is reserved for the system and cannot be used.
*4 "CR/CM List" (Page A-43)
*5 Up/down timers (UDT) hold the current value.
*6 Z11 and Z12 are reserved for the system and cannot be used.
*7 The MEMSW instruction can be used to specify hold/clear. (only for contacts and current values)
*8 "Store" is a device that can be described as "* (device)". "Lookup" is a device that can be indirectly specified.
Reference The macro argument devices that can only be used in a macro are listed as follows:
Indirect
Local Pointer
speci-
Attribute Sign Range Description device modify
fying
(@) (:)
(*)
Device P P0 to P9 Devices are used as argument No No Yes
Device values or constants are used as
Value V V0 to V9 No No No
argument for processing.
Leading UR0 to Leading device assigned to extended unit
UR No No Yes
relay UR9 processed as argument
Unit
Leading UM0 to The leading device assigned to extended
UM No No Yes
DM UM9 unit is processed as an argument.
■ Constant
Constant Range Main functions
#0 to #65535 (unsigned 16-bit)
1 DEC(#)
-32768 to +32767 (signed 16-bit)
#0 to #4294967295 (unsigned 32-bit)
Use for specifying DEC constant
■ Internal register
When start
Number of
Device name Range Main functions operation
point Power ON
( PROG → RUN )
Device for temporary data storage
Internal register - 1 point Clear
(16-bit/32-bit)
The number and range of the local devices and global devices that can be used when a project is created
are shown in the following table.
Local device Global device
Device name*1 Total number
Reserved devices in the whole project*2 Counts/range
9600 points (600 CH) 9600 points
Relay (R) *3 None.
R000 to R59915 (600 CH)
Internal auxiliary 7200 points (450 CH) 16000 points
8000 (500 CH)
relay (MR)*3 MR000 to MR44915 (1000 CH)*4
8000 points (500 CH) 16000 points
Latch relay (LR)*3 8000 (500 CH)
LR000 to LR49915 (1000 CH)
Timer (T) *5
1500 Timer/Counter 1000
Timer/Counter
T0 to T999
Counter (C) *5 1500 4000
C0 to C999
40535
Data memory (DM) 25000 65535
DM0 to DM40534
Expansion data 19535
45000 65535*4
memory (EM) EM0 to EM19534
Expansion data 11767
20000 32767*4
memory (FM) FM0 to FM11766
Temporary data 512
None. 512
memory (TM) TM0 to TM511
*1 High-speed counters (CTH), high-speed counter comparator (CTC), control relays (CR), control
memories (CM), and index registers (Z) cannot be used as a device.
INSTRUCTIONS
*2 When a project is created, the device area used for global devices can be guaranteed as a whole (this
area is calculated according to the assumption that 10 modules are used and 50 macros are called).
The number of reserved devices can be changed as required.
*3 Number can be set in“ch”unit.
*4 This number includes the workspace used for script devices. 1
*5 Operands used as timer and counter instructions can be described as @+ (device code number)
Point • If relays (R) and temporary data memories (TM) are used a local device, the
number of relays and data memories must be specified.
• The following devices must be used as a global device:
- KV-1000 PLC I/O relays
- Expansion unit device
- The devices referenced by such peripherals as touch panel
- Common devices in the whole project
- Devices for inter-module data transmission
• Where possible, local devices should be coded from 0 and use consecutive
numbers.
• Since R and DM are assigned to the expansion unit, as a global device, there
must be an area to be used. When using local devices, please use MR or EM
first.
• If local devices or global devices are used outside the specified range, then an
conversion error will occur.
• When various instructions using the leading device as the operands and index
modification or indirect specifying are used, the range of the local devices and
global devices that can be used should not be exceeded.
KV Nano Series
Device List
1
■ Bit device
Device and Constant
Index Indirect
Start of Operation Local *2
Device Number of Main Modifica Specification (*)
Range*1 Device
Name Points Function PROG tion
Power On (@)*1
RUN (:Z/:#) Reference Storage
Devices used to
R000 to R203*4 capture ON/OFF
Input relay*3 Yes Yes Yes No
(R1000 to 59915*5) information from
Total 9600 peripherals
points for the Devices used to
R500 to R607*6 input, output, output ON/OFF Clear Clear
Output relay*3 Yes Yes Yes No
(R1000 to 59915*5) and internal information to
auxiliary relays peripherals
Devices used by
Internal
R1000 to R59915*3 the CPU and by Yes Yes Yes No
auxiliary relay
expansion units
Link relay B00 to B1FFF*8 8192 Devices that can Clear Clear No Yes Yes No
Internal only be used
MR000 to MR59915 9600 internally by the Clear Clear Yes Yes Yes No
auxiliary relay
Latch relay LR000 to LR19915 3200 CPU Hold Hold Yes Yes Yes No
Among T0 to Among T0 to
Contact device for
T9, only holds T9, only holds
the 10 μs, 1 ms, 10
the devices the devices
ms, and 100 ms
Timer (contact) T0 to T511 512 that are being that are being Yes Yes Yes No
down timers and
used by the used by the
for the 10 ms up/
UDT UDT
down timer
instruction instruction
Contact device for
Counter the up counter and Clear and
C0 to C255 256 Hold Yes Yes Yes No
(contact) the up/down hold*7
counter
High-speed
Contact device for
counter
CTC0 to CTC7*9 8*9 the high-speed Hold Hold No No No No
comparator
counters
(contact)
Devices used to
control the PLC
Control relay CR000 to CR8915 1440 functions and to Clear Clear No No No No
capture the PLC
status
*1 Because this is used as a local device, the applicable range of global devices is limited by the number
of reserved local devices. "KV Nano Series User's Manual "List of Local Devices""
*2 The devices that have "Yes" in the Storage column can be written as "* (device)." The devices that
have "Yes" in the Reference column can be specified indirectly.
"KV Nano Series User's Manual "Indirect Specification""
*3 To perform direct processing, write "DR."
*4 The range of devices that can be used varies according to the unit.
KV-N14**: R000 to R007. KV-N24**: R000 to R013. KV-N40**: R000 to R107.
KV-N60**: R000 to R203. KV-NC32T: R000 to R015
*5 You can use the Unit Editor to set R1000 to R59915 to expansion I/O relays.
The unassigned input and output relays that have numbers smaller than R1000 are reserved for the
system, so you cannot use these relays.
*6 The range of devices that can be used varies according to the unit.
KV-N14**: R500 to R505. KV-N24**: R500 to R509. KV-N40**: R500 to R515.
KV-N60**: R500 to R607. KV-NC32T: R500 to R515
*7 You can change the clear/hold setting by using "Power off holding" in the CPU system settings (this
only applies to contacts and current values).
*8 Use hexadecimal numbers to specify the device numbers.
*9 The range of devices that can be used varies according to the unit.
KV-N14**: CTC0 to CTC3 (4). KV-N24**: CTC0 to CTC3 (4). KV-N40**: CTC0 to CTC5 (6).
KV-N60**: CTC0 to CTC7 (8). KV-NC32T: CTC0 to CTC5 (6)
INSTRUCTIONS
■ Word device
Index Indirect
Number Start of Operation Local *2
Device * Modifica Specification (*)
Range 1 of Main Function Device
Name tion
Points Power On
Clear and
PROG
RUN
(@)*1
(:Z/:#) Reference Storage
1
Data Memory DM0 to DM32767 32768 Hold Yes Yes Yes Yes
Devices that can store hold*3
Device P P0 to P9 No No Yes
argument.
The device's value or constant
Value V V0 to V9 No No No
is received as the argument.
The leading relay (R) assigned
Leading
UR UR0 to UR9 to the expansion unit is received No No Yes
R
as the argument.
The leading data memory (DM)
Leading entry assigned to the expansion
Unit UM UM0 to UM9 No No Yes
DM unit is received as the
argument.
The unit number of the
Number UV UV0 to UV9 expansion unit is received as No No No
the argument.
■ Constants
Constant Range Main Function
Used to specify decimal constants.
#0 to #65535 (unsigned 16 bit)
Reference
When you select
-32768 to +32767 (signed 16 bit)
Decimal (#) XYM marking mode,
#0 to #4294967295 (unsigned 32 bit)
this is displayed as
-2147483648 to +2147483647 (signed 32 bit)
"K."
-3.4E + 38 ≤ N ≤ -1.2E - 38
Single precision
N=0 Used to specify single precision
floating-point real
+1.2E - 38 ≤ N ≤ +3.4E + 38 floating-point constants.
number
(Approximately 7 significant digits)
-1.79E + 308 ≤ N ≤ -2.23E - 308
Double precision
N=0 Used to specify double precision
floating-point real
2.23E - 308 ≤ N ≤ 1.79E + 308 floating-point constants.
number
(Approximately 16 significant digits)
Used to specify hexadecimal
constants.
$0000 to $FFFF (16 bit) Reference
When you select
Hexadecimal ($)
$00000000 to $FFFFFFFF (32 bit) XYM marking mode,
this is displayed as
"H."
Fixed character Used to specify fixed character
Examples) "Model number ABC," "MON/08:30:15"
string (" ") strings.
■ Internal registers
Start of
Operation
Number of
Device Name Range Main Function (Power On,
Points
PROG
RUN)
A device used to temporarily store data
Internal register - 1 Clear
(16 bit, 32 bit, 64 bit)
INSTRUCTIONS
Local device list
The number of local and global devices that are reserved when you create a project and the default ranges
of these devices are shown below. To change the reserved number of local devices, from the workspace,
open the "CPU system setting" dialog box, and then click "Entire assignment setting of local devices." 1
Local Device Global Device
• If you are using relays (R) and temporary memory entries (TM) as local devices,
Point
you have to set the number of devices that you will use.
• The following devices must be processed as global devices.
• KV Nano Series I/O relays
• Devices assigned to expansion units
• Devices that are referenced by connected peripherals such as touch panels
• Devices that are common to the entire project
• Devices that have to transfer data between modules
• The first local device is number 0. Use local devices with as small numbers as
possible.
• Because R devices are assigned to expansion units, an area that is used as
global devices is required. For local devices, use MR devices with a higher
priority.
• If you use a local device or global device outside of the usable range, a
conversion error will occur.
• When you are using instructions in which you specify the leading device in the
operands, index modification, and indirect specification, do not exceed the
usable range of local and global devices.
Example
DM0:#1 This means DM1.
R1000:#1 This means R1001.
Example
@DM0 @R10000
INSTRUCTIONS
● XYM marking
The designation of device by XYM notation of the list below is possible for device (R(DR)/MR/LR/DM/
EM/FM).
Device Name
KEYENCE
Marking
XYM Marking
Device Number during XYM
Marking
1
*1 The scope of device number that can be used differs for KV Nano series.
X(DX):0000 to 599F
Y(DY):0000 to 599F
M:00000 to15999
‘ L:0000 to199F
D:00000 to32767
*2 The scope of device number that can be used differs for KV-5500/5000/3000 series.
M:00000 to15999
To display it in XYM notation, select 【Tool】 → 【Option】 from the KV STUDIO menu and put a check
on “Display in XYM” with “Configuration of Display Mode”.
Variable
Variable is an element with the data type and name defined that can be used when programming. KV
STUDIO allows you to use devices or variables for programming.
1 Unlike devices, variables can be programmed with names defined by KV STUDIO, and the defined
variables are automatically assigned to the work area of the CPU unit. Therefore, it is not necessary to
manage the functions assigned to the devices in the device map like devices. In addition, since the VT5
Device and Constant
series and Soft-VT also support variable programming, it is not necessary to change the device number
on the touch panel display in combination with the device number on the PLC side.
Point • Variables can be used only with KV STUDIO Ver11.0 or later, and the compatible
model is only KV-8000 Ver.2.0 or later.
• Variables can be used on the touch panel display only with VT STUDIO Ver.8.0 or
later, and the compatible model is only the VT5 series.
When using variables, it is necessary to define the data type in advance. The CPU unit automatically
assigns the required data size to the work area according to the defined data type*1.
The size of work area and specifications of variables that can be used with KV-8000 are as follows.
Item Content
Bit (VB) 64000 points
Word (VM) 589824 words
Work area size
Timer (T) 4000 points
Counter (C) 4000 points
Definable number 100000
Variable specifications
Maximum length of variable name 128 characters
*1 It is also possible to manually assign to the device of the CPU unit instead of the work area. For
details, refer to "KV-8000 Series User's Manual".
The data types and data sizes of variables that can be used with KV-8000 are as follows.
Data type Data size
Type name Description (In bits)
BOOL Bit 1
UINT 1-word unsigned integer 16
INT 1-word signed integer 16
UDINT 2-word unsigned integer 32
DINT 2-word signed integer 32
REAL Single-precision floating point type 32
LREAL Double-precision floating point type 64
(Number of characters + 1) × 8 rounded up to
STRING String
an integral multiple of 16
TIMER Timer ―
COUNTER Counter ―
Array ― Set the data size of the data type×Array size
Structure ― By definition*1
Function block Function block By definition*1
*1 Structures and function blocks are data types used by setting multiple data types. Therefore, the
data size is determined by the settings. For details, refer to "KV-8000 Series User's Manual".
INSTRUCTIONS
MEMO
The instruction with "suffixes" such as ".U", ".S", ".D", ".L", ".F" and ".DF" can process different data
types, i.e: unsigned 16-bit BIN data, signed 16-bit BIN data, unsigned 32-bit BIN data, signed 32-bit
BIN data, single precision floating point type real number and double precision floating point type real
number.
1
Definition of Suffixes
Suffix
The suffix indicates a symbol attached to the instruction as a concluding remark. 5 types of suffixes
available:
Example
ADD(.U) MOV.(U)
ADD.S MOV.S
ADD.D MOV.D
ADD.L MOV.L
ADD.F MOV.F
ADD.DF MOV.DF
-3.4E+38 ≤ N ≤-1.4E-45
N =0
+1.4E-45 ≤ N ≤+3.4E+38
(Significant bits : 7 digit)
Point .DF (double precision floating point type real number) can be used with KV-8000/
7000 Series CPU units, KV-5000/3000 Series CPU units that have CPU function
version 2.0 or higher and KV Nano Series base units.
"KV-5000/3000 CPU Function Version" (Page 4)
□.U is omitted in KV STUDIO. In addition, the instructions without suffix are processed as unsigned 16-
bit BIN data.
According to the suffixes, the corresponding instructions process BIN data with DEC.
Thus, the execution result of instructions may differ if the suffixes are different, even if the same BIN
data.
INSTRUCTIONS
Difference between .U and .S
□.U BIN data is processed as unsigned 16-bit data.
□.S BIN data is processed as signed 16-bit data.
Thus, the relationship between BIN data and corresponding DEC representation of suffix is shown
below.
1
Suffix
BIN BIN When the value of 1111111111111111
□ .U Unsigned DEC 65535
□ .S Signed DEC -1
For constant, please see " Data Processing" (Page 1-31).
Example
When 16-bit BIN (1111111111111111) data stored in DM0 is compared with constant #100
If the suffix is .U, the value of DM0 is 65535.
DM0
> .U LD.U> DM0 #100
#100
Thus, if DM0>#100, the contact becomes ON.
(65535)
Example
When BIN data(11111111111111111111111111111111) stored in DM0/DM1 is compared with
constant #100
If the suffix is .D, the value of DM0/DM1 is 4294967295.
DM0
> .D LD.D> DM0 #100
#100
Thus, DM1 (high bit) /DM0 (low bit) > #100, the contact becomes ON.
(4294967295)
Suffix
INSTRUCTIONS
Reference For data transfer, the execution result is the same when either .U or .S in the suffixes is
used.
1 The instructions are executed independently of the DEC value of BIN data.
The suffix is only related to data length (16/32-bit) .
Suffix
Example
Example for sending DM0 to DM10 using MOV instruction.
MOV.U
DM0 DM10
MOV.S
DM0 DM10
DM0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
DM10 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
DM0 DM10
LDA.D STA.D
DM0 DM10
LDA.L STA.L
DM0 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
DM10 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
Remarks
For suffix .F, the BIN data is processed as single precision floating point type real number,
and changed into 32-bit data. Thus, the same result from use of .D and .L could be obtained
even if suffix .F is used in MOV, LDA and STA instructions.
MOV.F
DM0 DM10
BRIEF EXPLANATION OF
INSTRUCTIONS
There are 5 types of processable value in ladder program: BIN, DEC (unsigned/signed), HEX, BIN-
coded DEC (BCD) and float real number (single precision/double precision).
The text strings, ASCII codes/Shift-JIS codes can also be processed.
BIN Data 1
Data Processing
These are processed through BIN system in data in KV-8000/7500/7300/5500/5000/3000/1000 PLC and
KV Nano Series.
A 1-bit BIN is processed by unit of "bit". A bit has two states: "0 (OFF) " and "1(ON)".
Higher bits
0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0
嚣
嚣
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 Weight for each bit
3276816384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 DEC number
Higher bits
Area for continuous 2 words is used when processing 32-bit data. Lower 16-bit data is processed in
low-bit device, and higher 16-bit data processed in high-bit device.
Area for continuous 4 words is used when processing 64-bit data. The low-order 16 bits of data is
handled with four words in order from the word device having the smallest number.
Data Processing
INSTRUCTIONS
■ BIN
1 Only "0" and "1" are used to represent BIN data in "KV-8000/7500/7300", "KV-5500/5000/3000/1000"
and "KV Nano Series". Every bit is carried if it's larger than 1.
Data Processing
The highest
嚣
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 Weight for each bit
32768163848192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 DEC number
(Example) 0110110100110001
■ DEC
BIN data in "KV-8000/7500/7300", "KV-5500/5000/3000/1000" and "KV Nano Series" are represented
by DEC system.
● Unsigned
For 16-bit data, the range of processable value is 0 to +65535; for 32-bit data the range of processable
value is 0 to 4294967295.
● Signed
The positive or negative value is judged through highest bit. (0:positive; 1:negative)
For 16-bit data, the range of processable value is -32768 to +32767; for 32-bit data is -2147483648 to
+2147483647.
Reference These can be entered as instruction operand. The starting position of value is marked with
"#" or symbol.
(Example) #1000, +12, -25489
■ HEX
BIN data in "KV-8000/7500/7300", "KV-5500/5000/3000/1000" and "KV Nano Series" are represented
by HEX system.
The HEX data can process 4 bits BIN as 1 bit. The value that can be represented by 1 bit is DEC 0 to
15, thus, the values bigger than 9 are represented by A, B, C, D, E, F, or carried if bigger than F.
For 16-bit data, the range of processable value is $0000 to $FFFF; for 32-bit data the range of
processable value is $00000000 to $FFFFFFFF .
Reference These can be entered as instruction operand. The starting position of value is marked with "$".
(Example) $00FF
INSTRUCTIONS
■ BIN coded DEC
Both BIN-coded DEC and HEX process BIN 4 bits as 1 bit. The same with DEC system, the bit is
carried if bigger than 9, thus A to F symbols are not used.
For 16-bit data, the range of processable value is 0000 to 9999; for 32-bit data the range of processable
value is 00000000 to 99999999.
1
Data Processing
Example
As stated above,
value $0987 (#2439 in DEC ) is processed as “0987” in DEC in BCD after storing 16-bit data.
0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1
thousand hundred ten one
0 9 8 7
BIN coded DEC value is a simple representation method when data is processed externally (digital
switch).
But, it's necessary to process as BIN data for arithmetic operation in "KV-8000/7500/7300", "KV-5500/
5000/3000/1000" PLC and "KV Nano Series". When reading from external device, convert into BIN data
using TBIN instruction; when outputting to external device (digital display, etc), convert into BCD using
TBCD instruction.
Reference To input BIN coded DEC value BCD) in the instruction operand, add a prefix "$" into the
value as HEX input.
Data Processing
INSTRUCTIONS
N= 0
-308
+2.23×10 ≤ N ≤ +1.79×10308
Point .DF (double precision floating point type real number) can be used with KV-8000/
7000 Series CPU units, KV-5000/3000 Series CPU units that have CPU function
version 2.0 or higher and KV Nano Series base units.
"KV-5000/3000 CPU Function Version" (Page 4)
INSTRUCTIONS
Relationship Between Numerical Representation
The correlation between BIN, DEC (unsigned/signed), HEX, BIN-coded DEC (BCD) is represented below.
1
■ 16-bit data
Data Processing
DEC HEX BIN Coded
BIN BIN
Unsigned Signed (HEX) DEC(BCD)
0 +0 0 0000 0000 0000 0000 0000 0000 0000 0000 0000
1 +1 1 0000 0000 0000 0001 0001 0000 0000 0000 0001
2 +2 2 0000 0000 0000 0010 0002 0000 0000 0000 0010
3 +3 3 0000 0000 0000 0011 0003 0000 0000 0000 0011
4 +4 4 0000 0000 0000 0100 0004 0000 0000 0000 0100
5 +5 5 0000 0000 0000 0101 0005 0000 0000 0000 0101
6 +6 6 0000 0000 0000 0110 0006 0000 0000 0000 0110
7 +7 7 0000 0000 0000 0111 0007 0000 0000 0000 0111
8 +8 8 0000 0000 0000 1000 0008 0000 0000 0000 1000
9 +9 9 0000 0000 0000 1001 0009 0000 0000 0000 1001
10 +10 A 0000 0000 0000 1010 0010 0000 0000 0001 0000
11 +11 B 0000 0000 0000 1011 0011 0000 0000 0001 0001
12 +12 C 0000 0000 0000 1100 0012 0000 0000 0001 0010
13 +13 D 0000 0000 0000 1101 0013 0000 0000 0001 0011
14 +14 E 0000 0000 0000 1110 0014 0000 0000 0001 0100
15 +15 F 0000 0000 0000 1111 0015 0000 0000 0001 0101
16 +16 10 0000 0000 0001 0000 0016 0000 0000 0001 0110
99 +99 63 0000 0000 0110 0011 0099 0000 0000 1001 1001
100 +100 64 0000 0000 0110 0100 0100 0000 0001 0000 0000
32767 +32767 7FFF 0111 1111 1111 1111 0999 0000 1001 1001 1001
32768 -32768 8000 1000 0000 0000 0000 1000 0001 0000 0000 0000
65534 -2 FFFE 1111 1111 1111 1110 9998 1001 1001 1001 1000
65535 -1 FFFF 1111 1111 1111 1111 9999 1001 1001 1001 1001
Data Processing
INSTRUCTIONS
■ 32-bit data
DEC HEX
BIN
unsigned Signed (HEX)
0 +0 0 0000 0000 0000 0000 0000 0000 0000 0000
1 1
2
+1
+2
1
2
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0001
0010
Data Processing
2147483647 +2147483647 7FFFFFFF 0111 1111 1111 1111 1111 1111 1111 1111
2147483648 -2147483648 8000000 1000 0000 0000 0000 0000 0000 0000 0000
4294967294 -2 FFFFFFFE 1111 1111 1111 1111 1111 1111 1111 1110
4294967295 -1 FFFFFFFF 1111 1111 1111 1111 1111 1111 1111 1111
INSTRUCTIONS
■ Value change when exceeding max. or min.
When the calculated results exceed the max./min. value, the following data changes are available
according to data types.
● For 16-bit data 1
Value change for 65535 above Value change when exceeding max. or min.
Data Processing
Unsigned DEC HEX Signed DEC HEX
3 0003 3 0003
2 0002 2 0002
1 0001 1 0001
0 0000 0 0000
65535 FFFF -1 FFFF
65534 FFFE -2 FFFE
65533 FFFD -3 FFFD
65532 FFFC -4 FFFC
… … … …
32771 8003 -32765 8003
32770 8002 -32766 8002
32769 8001 -32767 8001
32768 8000 -32768 8000
32767 7FFF 32767 7FFF
32766 7FFE 32766 7FFE
32765 7FFD 32765 7FFD
32764 7FFC 32764 7FFC
0 1.4×10-45 3.4×1038
(1.4E-45) (3.4E38)
0 (display as “----“)
0 2.23×10-308 1.79×10308
(2.23E-308) (1.79E+308)
0 (display as “----“)
Data Processing
INSTRUCTIONS
Character Code
Various text numbers are called as character codes to process the text strings in the ladder program.
1 The following text codes can be processed in KV STUDIO.
Data Processing
■ ASCII code
8 bits are used to represent 1 DBC case text code.
(Example) A···$41 1···$31
Reference These can be input as operand of text processing instruction and calendar contact
instruction. The text strings are included by """.
Example) "Type ABC" "MON/08:30:15"
■ Other languages
On the KV-8000/7000 Series, character codes in the language set in "Other settings" - "Project
language settings" in "CPU system setting" can be used.
BRIEF EXPLANATION OF
INSTRUCTIONS
There are two types of instructions: "every-scan execution type and differential execution type" (pulse execution
type). For "every scanning execution type", execute this instruction for every scanning if the execution condition is
established (ON) ; for "differential execution type", execute one time at the rising edge if the execution condition is
established (ON), otherwise execute one time at the falling edge if the execution condition is unestablished (OFF).
The instructions with prefix "@" are executed as differential execution type instructions. 1
*Instructions only with or without differential execution type ones may occur sometimes.
A B A B
one scan
If the previous value is ON, and current value is OFF, A detects the falling edge.
If the previous value is OFF, and current value is ON, B detects the rising edge.
scanning, or isn't executed within the continuous scanning time of [n]th sub-routine program and
[n+1]th sub-routine execution.
R000 #0
CALL
END
SBN
#0
Execution condition of differential
execution type instruction
R001 DM0 DM1
LDA STA
RET
ENDH
When [n]th and [n+1]th differential execution type instructions aren't executed continuously
Program scan
Subroutine n n+1
ON
R000
OFF
Mode A
ON
R001 OFF ON
OFF
Mode B
ON
R001 ON ON
OFF
In mode A, the previous value (state of [n]th R001) is OFF, the current value (state of [n+1]th R001)
turns to ON, the rising edge is detected. Thus, @LDA, @STA are executed.
In mode B, the previous value (state of [n]th R001) is ON, the current value (state of [n+1]th R001) is
also ON without change, the rising edge cannot detected. Thus, @LDA, @STA are not executed.
The aforementioned different situation may sometimes occur even if the state of [n+1]th execution
condition of differential execution type instruction is the same.
INSTRUCTIONS
When differential execution type instructions are executed over 2 times during one scanning.
Program scan
This time
ON
R001 OFF ON ON
OFF
When the execution condition of differential execution type instruction of [n-1]th, [n]th and [n+1]th has
the following states,
n-1-th : OFF
n-th : ON
n+1-th : ON
If the previous value of the nth instruction (state of R001 of the (n-1)th instruction) is OFF, when the current value
(state of R001 of the nth instruction) is ON, a rising edge will be detected. Thus, @LDA, @STA are executed.
If the previous value of the (n+1)th instruction (state of R001 of the nth instruction) is ON and the current
value (state of R001 of the (n+1)th instruction) is also ON, a rising edge will not be detected when no
change occurs. Thus, @LDA, @STA are not executed.
STP
R000
Execution condition of differential execution type instruction
R001 DM0 DM1
LDA STA
STE
Program scan
Mode A
ON
R001 OFF ON
OFF
Mode B
ON
R001 ON ON
OFF
In mode A, the previous value (state of [n]th R001) is OFF, the current value (state of [n+1]th R001) turns to
ON, the rising edge is detected. Thus, @LDA, @STA are executed.
In mode B, the previous value (state of [n]th R001) is ON, the current value (state of [n+1]th R001) is
also ON without change, the rising edge cannot detected. Thus, @LDA, @STA are not executed.
The aforementioned different situation may sometimes occur even if the state of [n+1]th execution
condition of differential execution type instruction is the same.
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-41
BRIEF EXPLANATION OF
1 executed during the next scan after the control stage is finished when the execution condition is OFF). When
number of times of execution of the program in the control stage (including 1 scan after the control stage is
finished) is set to n, the previous value of the [n+1]th instruction will be in the state of the nth instruction.
Every-scan Execution Type and Differential Execution Type
Due attention shall be paid if the programs in stage are not executed continuously during n-th and n+1-th.
Execution condition of differential execution type instruction
R1100 R000 R1000 R500 #30 T0
STG ↑ T0 JMP
R1000
Program scan
ON
R1100
OFF
Mode A
ON
R000 OFF ON
OFF
Mode B
ON
R000 ON ON
OFF
In mode A, the previous value (state of [n]th R000) is OFF, the current value (state of [n+1]th R000)
turns to ON, the rising edge is detected. Thus, R1000 is not be reset.
In mode B, the previous value (state of [n]th R000) is ON, the current value (state of [n+1]th R000) is
also ON without change, the rising edge cannot detected. Thus, R1000 is still OFF.
The aforementioned different situation may sometimes occur even if the state of [n+1]th execution
condition of differential execution type instruction is the same.
INSTRUCTIONS
(4) When used between CJ/NCJ and LABEL instructions
The previous value of execution condition of differential execution type instruction is under the state
when routine between previous CJ/NCJ to LABEL instruction program is executed. When the program
execution times between CJ/NCJ and LABEL instructions are set as n, the [n+1]th previous value is
under [n]th state.
1
Due attention shall be paid if the programs between CJ/NCJ and LABEL instructions are not executed
R000 CJ
#10
Execution condition of differential
execution type instruction
R001 DM0 DM1
LDA STA
LABEL
#10
Program scan
ON
R000
OFF
mode A
ON
R001 OFF ON
OFF
mode B
ON
R001 ON ON
OFF
In mode A, the previous value (state of [n]th R001) is OFF, the current value (state of [n+1]th R001)
turns to ON, the rising edge is detected. Thus, @LDA, @STA are executed.
In mode B, the previous value (state of [n]th R001) is ON, the current value (state of [n+1]th R001) is
also ON without change, the rising edge cannot detected. Thus, @LDA, @STA are not executed.
The aforementioned different situation may sometimes occur even if the state of [n+1]th execution
condition of differential execution type instruction is the same.
The section describe the conventions and cautions used in the operand list of various instructions.
This section explains how to read the operand table and how to specify operands.
The instruction operand is specified as bit data or word data. Bit data and word data are generic names
for the following devices and variables.
Bit data..............Bit devices, bit specification of word data and BOOL type variables
Word data .........Word devices, word specification of bit data and UINT / INT / UDINT / DINT / REAL /
LREAL / STRING type variables
The operand can be specified as bit data or word data, but if there are restrictions that only one of them
can be specified or a specific device cannot be specified, a note should be provided below the operand
table.
INSTRUCTIONS
Device specified for operand
This section describes the devices that can be specified for the instruction operand. The devices
supported by each CPU unit are as follows. A specific device may not be specified depending on the
instructions, so that a note should be provided below the operand table. 1
KV-5500
KV-7500
The instruction operand can also be specified as a variable. Please specify a variable / label of the data
type that can be specified for each operand.
1 Example) ITVL instruction
*1
D1 Specify the leading device of the data table. 16 bits×16
D1 occupies 16×16 bits, so an array of UINT or INT or a structure type variable / label with data size
of 16 bits can be specified.
D2 occupies 4 bits, so a BOOL array or structure type variable can be specified.
A conversion error will occur if a variable / label with the data size smaller than the occupied size of the
operand is specified. However, no conversion error occurs for variables assigned to global devices.
Point Variables are supported only by KV-8000 with CPU function version 2.0 or later. For
other models, use labels instead of variables.
The processing of bit data and word data differs depending on the operand as follows.
· If bit data is specified in the operand for specifying of common word data, but this
bit data isn't specified from the starting point of the channel, straddle to the next
Bit data channel for processing.
S
But, there are also instructions only specifying the leading point of the channel.
· The numbers of occupied size may differ depending upon the instructions.
D
· If word data is specified in the operand for specifying of common bit data, process only
Word data the lowest valid bit. Bits other than LSB do not change.
· The numbers of occupied size may differ depending upon the instructions.
· Notwithstanding the suffix, occupy the continuous 16-bit, even if staddling the channel.
· The value is processed as 16-bit unsigned BIN data.
Bit data
· If T, C, CTH and CTC are already specified, the lower 16-bit value is used, but
n
higher 16-bit value is neglected.
· Notwithstanding the suffix, 1 word is occupied.
Word data
· The value is processed as unsigned 16-bit BIN data.
INSTRUCTIONS
Word Unit Processing of Bit Data
Generally (for sequence control program instructions), the size of bit data processed is 1 bit.
1
R006 R30500
R R R R R R R R R R R R R R R R
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
5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
Input relay
Processing object
Output relay
R R R R R R R R R R R R R R R R
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
In the arithmetic operation instruction, the bit data can be grouped into 16-bit or 32-bit for processing.
If a bit data is specified to an instruction operand for processing by word unit, process the bit data by
unit of word starting from the specifying bit data.
Point When BOOL type variables are processed in 16 bits or 32 bits with calculation
instructions, they should be defined as arrays.
Example
MOV
R30000 DM0
R30015 R30000
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
MOV.D
R30000 DM0
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
If the bit device specified to operand isn't at the starting position of channel, process the bit data by
word unit by straddling the next channel.
MOV
1
R30003 DM30505
R30102 R30003
Conventions and Cautions in Operand List
301ch 300ch
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
R30604 R30505
306ch 305ch
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Point • The processing speed will decline when processing the word unit by straddling
channel.
• Only when using the KV-1000 series, if the operand is set with a bit data using
the STA instruction, bits cross over channels cannot be sent across the
channels.
R30003 R30503
< LDA > < STA >
R30102 R30003
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
R30600 R30515
* Don't transfer the data of R30600 to R30602. Maintain the value in R30600 to
R30602 before executing the instructions.
• For the KV-8000/7000 Series, only the bit data at the starting position of the
channel can be specified for some instruction operands.
INSTRUCTIONS
Bit Data Processing of Word Data
Example
When the value of DM1000 is #46563($B5E3)
DM1000 EM1001
DM1000˙#46563($B5E3)
1 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1
Lowest bit
1: Contact ON
0: Contact OFF
When the contact is ON in the aforementioned example, the lowest significant bit (LSB) of
EM1001 is changed to "1".
EM1001=#14($E)
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
EM1001=#15($F)
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
Example
Process 12 bit (13rdbit) of DM1200.12 DM1200.
DM1200
0 1 1 1 0 1 1 0 0 1 1 0 1 1 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
When using array / structure type variables with KV-8000 of CPU function version 2.0 or later, check if
1 the occupied size of each operand of the instruction exceeds the device or variable area.
Conventions and Cautions in Operand List
1. When a local variable or a global variable assigned to the work area is specified
Check if the occupied size of the operand exceeds the size assigned as a variable.
Example)When the array variable Array_A of INT[5] is written as "BMOV DM0 Array_A[0] EM0"
When the value stored in EM0 is 6 or more, the first and second operands of BMOV occupy 6
words, but since Array_A has only 5 words, a calculation error will occur and the instruction cannot
be executed.
3. When a device / variable is specified for the subscript of an array type variable
Check if the subscript value exceeds the number of elements in the array.
Example)When Array_A with 10 elements is written as Array_A[DM0]
When the value stored in DM0 is 10 or more, it exceeds the number of elements 10, so a
calculation error will occur and the instruction cannot be executed. However, if an array / structure
type variable assigned to the global device is used and the range accessed by the operand is within
the range of the global device, no calculation error will occur.
For example, when written as "BMOV EM0 Array_A[DM0] #5", but DM0 is 6 or more, no calculation
error will occur if the end of Array_A is within the range of the global device.
Point Out-of-range access of operands is checked under any of the following conditions.
• When an operand with variable occupied size is specified as variable
• When a value other than a constant is specified for the array subscript
INSTRUCTIONS
Other Matters Needing Attention
■ Precautions when "Number of characters" is indicated as the occupied size of the operand
When "Number of characters" is indicated as the occupied size of the operand table, the number of
bytes up to NULL is processed as the number of characters. For example, if a string of 10 single-byte
characters such as ASCII code is specified, the number of characters will be "10". If a string of 10
double-byte characters such as Shift-JIS is specified, the number of characters will be "20".
● When using local variables or global variables assigned to the work area
The instruction processing area should not exceed the specified variable area when programming.
Otherwise, a conversion error or calculation error will occur.
1
Conventions and Cautions in Operand List
ORB
Contact Instructions
L D S A S
S X S
X I C S
B S
L D B S
L D I S
L D N O T S
A N I S
A N D N O T S
X I O S
A N D S A S
S X S
X I C S
L D S
A N B S B S
L D I S
L D N O T S
A N I S
A N D N O T S
L D B N O T S
X I O S
O R S
O R B S O R I S
S **For B, “1” is filled in . O R N O T S
*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in S , the state of the LSB is loaded.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
KV-1000 BLD/BLDB instruction can be used if state other than that of LSB is to be loaded.
Description of Operation
LD S is connected to the power rail as a NO contact.
ON/OFF state of S is transferred to the instructions after LD.
LDB S is connected to the power rail as a NC contact.
The inverted ON/OFF state of S is transferred to the instructions after LDB.
AND S is connected in series to the circuit block as a NO contact.
ANB S is connected in series to the circuit block as a NC contact.
OR S is connected in parallel to the circuit block as a NO contact.
ORB S is connected in parallel to the circuit block as a NC contact.
BASIC INSTRUCTIONS
Scan
ON
S
OFF
LD instruction ON
AND instruction
OR instruction OFF
ON
LDB instruction
ANB instruction
ORB instruction OFF
2
Reference There is no restriction to the number of contacts that can be connected in parallel or in
Contact Instructions
series.
Point Parallel connection that includes a intruction other than contact instruction is not
allowed.
Operation flag
Sample Program
When 0 bit of input relays R000 and DM0 is ON (or both are ON) and R001 is OFF, R500 will be ON.
LDP,ANP,ORP,LDF,ANF,ORF
BASIC INSTRUCTIONS
ORP OR pulse
ORF
Contact Instructions
OR pulse fall
L D F S F S
S A N P S P S
L D P S
A N F S
F S
L D F S
O R P S P S
L D P S
O R F S
S F S
when P in fill ↑; L D F S
when F in fill ↓.
*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with DR.
*2 When word data is specified in S , the state of the LSB is loaded.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
KV-1000 BLD/BLDB instruction can be used if state other than that of LSB is to be loaded.
Description of Operation
LDP, ANP, ORP Only 1 scan is ON when rising edge of S is detected.
Instruction Operation
Connected to the left power rail as NC contact. This contact turns ON only for
LDP
1 scan when the rising edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANP
ON only for 1 scan when the rising edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns ON only for 1
ORP
scan when the rising edge of S is detected.
Instruction Operation
Connected to the left power rail as NC contact. This contact turns ON only for
LDF
1 scan when the falling edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANF
ON only for 1 scan when the falling edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns ON only for 1
ORF
scan when the falling edge of S is detected.
2-4 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Contact Instructions
BASIC INSTRUCTIONS
Scan
ON
S
OFF
LDP instruction ON
ANP instruction
ORP instruction OFF
ON
LDF instruction
ANF instruction
ORF instruction OFF
2
• This instruction cannot be used in interrupt programs or in the initialization
Contact Instructions
Point
module.
• Attention should be paid when used in subroutines, among STP to STE
instructions, STG to JMP/ENDS instructions, CJ (NCJ) to LABEL instructions
and FOR to NEXT instructions.
"Precautions on the use of differential execution type instructions", page 1-40
• Parallel connection that includes a intruction other than contact instruction is
not allowed.
Operation flag
Sample Program
When the rising edge of input relay R000 is detected, #100 is transferred to data memory DM0. When
the falling edge is detected, #200 is transferred to data memory DM1.
(Mnemonics list)
R000 MOV
#100 DM0 LDP R000
MOV #100 DM0
R000 MOV LDF R000
#200 DM1 MOV #200 DM1
ORFB
Contact Instructions
S A N P B S L D P B S
A N F B S L D F B S
O R P B S
O R F B S
S
↑is entered in the case of PB, and
↓is entered in the case of FB.
*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in S , the state of the LSB is loaded.
A bit of word data can be specified.
Description of Operation
LDPB, ANPB, ORPB Only 1 scan is OFF when rising edge of S is detected.
Instruc
Operation
tion
Connected to the left power rail as NC contact. This contact turns OFF only
LDPB
for 1 scan when the rising edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANPB
OFF only for 1 scan when the rising edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns OFF only for
ORPB
1 scan when the rising edge of S is detected.
LDFB, ANFB, ORFB Only 1 scan is OFF when falling edge of S is detected.
Instruc
Operation
tion
Connected to the left power rail as NC contact. This contact turns OFF only
LDFB
for 1 scan when the falling edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANFB
OFF only for 1 scan when the falling edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns OFF only for
ORFB
1 scan when the falling edge of S is detected.
BASIC INSTRUCTIONS
Scan
ON
S
OFF
LDPB instruction ON
ANPB instruction
ORPB instruction OFF
ON
LDFB instruction
ANFB instruction
ORFB instruction OFF
2
• This instruction cannot be used in interrupt programs or in the initialization
Contact Instructions
Point
module.
• Attention should be paid when used in subroutines, among STP to STE
instructions, STG to JMP/ENDS instructions, CJ (NCJ) to LABEL instructions
and FOR to NEXT instructions.
"Precautions on the use of differential execution type instructions", page 1-40
• Parallel connection that includes a intruction other than contact instruction is
not allowed.
Operation flag
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate
• (KV-8000/7500/7300/5500/5000/3000 only) When DR is specified and the expansion I/O unit
does not support direct input / output
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification, index modification or DR is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The contact turns OFF when CR2012 is ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
Timer 0 will be reset when rising edge of R000 is detected.
Counter 0 will be reset when rising edge of R001 is detected.
(Mnemonics list)
R000 #100
T0 LDPB R000
TMR #0 #100
R001 #2 LDFB R001
C0 C #0 #2 R002
R002
AND
BLD,BAND,BOR,BLDB,BANB,BORB bar
BORBit OR
BORBBit OR bar
BASIC INSTRUCTIONS
BLD(.U)
BLD BLD.D B Bit load
Operate as a contact for
BAND(.U)
BAND
transferring ON/OFF
BAND.D B Bit AND
information of the
specified bit of word data.
BOR(.U)
BOR BOR.D B
Bit OR
2 BLDB(.U)
BLDB BLDB.D B Bit load bar
Operate as a contact for
Bit Contact Instructions
B B O R S n
S
B B O R B S n
n
BASIC INSTRUCTIONS
Description of Operation
BLD(.U), BLD.D,BAND(.U), BAND.D, BOR(.U), BOR.D
The instruction itself becomes a normally open contact. This contact transfers the ON/
OFF status of the n bit of S to the subsequent instructions.
BLDB(.U), BLDB.D, BANB(.U), BANB.D, BORB(.U), BORB.D
The instruction itself becomes a normally closed contact. This contact transfers inverted 2
ON/OFF status of the n bit of S to the subsequent instructions.
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
bit15 bit 0
bit n bit 1
ON
bit S of n
OFF
ON
BLD instruction
OFF
ON
BLDB instruction
OFF
Operation flag
Sample Program
Only when both the 0th bit of data memory DM0 and the 1st bit of data memory DM1 are ON, will the
output relay R500 be ON. If either the 0th bit of DM0 or the 1st bit of DM1 is OFF, the output relay
R500will be OFF.
2 DM0
B
DM1
B
R500 (Mnemonics list)
BLD DM0 #0
#0 #1 BAND DM1 #1
Bit Contact Instructions
OUT R500
Only when both the 3rd bit of data memory DM0 and the 5th bit of data memory DM1 both are ON, will
the output relay R500 be ON. Only when both the 3rd bit of data memory DM0 and the 5th bit of data
memory DM1 are OFF, will the output relay R500 be OFF.
BASIC INSTRUCTIONS
MEMO
NO contact in ON to bus
LD<>When "A<>B" connect
NO contact in ON to bus
= <=
AND=When "A=B" connect
NO contact in ON serially to
□.S ※
Instruction itself is used as a
AND>When "A>B" connect
NO contact in ON serially to
circuit block
Contact type
AND<=When "A<=B" connect
NO contact in ON serially to
< >=
NO contact in ON serially to
※
comparison
circuit block
AND<>When "A<>B" connect
operation
circuit block
comparison operation.
contact in ON in parallel to
circuit block
OR>When "A>B" connect NO
□.DF
contact in ON in parallel to
circuit block
> <>
OR<=When "A<B" connect
※ NO contact in ON in parallel
to circuit block
OR>=When "A>B" connect
NO contact in ON in parallel
to circuit block
OR<>When "A<>B" connect
NO contact in ON in parallel
to circuit block
S2
S1 A N D ※ S1 S2
※ ( ※ S1 S2 )
S2
O R ※ S1 S2
Point When comparing array or structure type variables, only the occupied size of the
operand from the start of the variables is compared, even if the contact type
comparison operation instruction is used. The BBCMP instruction is used to
compare all elements or members of an array or structure.
"BBCMP Instruction"(page 5-54)
BASIC INSTRUCTIONS
Description of Operation
2
Unsigned 16-bit BIN data specified by S1 / S2 are compared. This instruction itself
is used asa contact to turn ON/OFF according to the result of comparison operation.
=.S, <.S, >.S, <=.S, >=.S, <>.S
□.F (single precision floating point type real number data compare instructions)
Reference If a single precision floating point type real number is input as a constant in an operand to
be compared, the number of effective digits which can be input is seven, so the
comparison may not match the actual operation results. In this case, a comparison can be
made by comparing the operation results as an integer in the ladder program.
"Arithmetic/Comparison Instructions", page 4-40
□.DF (double precision floating point type real number data compare instructions)
Reference If a double precision floating point type real number is input as a constant in an operand to
be compared, the number of effective digits which can be input is 16, so the comparison
may not match the actual operation results. In this case, a comparison can be made by
comparing the operation results as an integer in the ladder program.
"Arithmetic/Comparison Instructions", page 4-40
BASIC INSTRUCTIONS
Operation flag
* The contact turns OFF when CR2012 is ON. When OR=, OR<, OR>, OR<=, OR>=, or OR<>, the
instruction is not executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
Current value of counter C0000 is compared with constant #01000. Output relays R00500 to
R00503are turned ON/OFF according to the comparison result.
(Mnemonics list)
R000 #9999
C0 LDB R000
R001 C #0 #9999 R001
LD CR2002
CR2002 C0 DM0
LDA C0
LDA STA
CON
STA DM0
DM0 R500 LD< DM0 #1000
< ① OUT R500
#1000 LD= DM0 #1000
OUT R501
DM0 R501 LD> DM0 #1000
= ② OUT R502
#1000 LD>= DM0 #1000
DM0 R502 AND<= DM0 #2000
> ③ OUT R503
#1000
DM0 DM0 R503
>= <= ④
#1000 #2000
OUT,OUB
BASIC INSTRUCTIONS
OUT Out
Outputs ON/OFF status.
OUB Out bar
2
Y D
D
O U B D ( O B D )
Output Instructions
*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , it is output to LSB.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
KV-1000 To output to other bits, use the BOUT/BOUB instructions.
Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.
Description of Operation
OUT Outputs the ON/OFF state before the instruction to D .
OUB Inverts the ON/OFF state before the instruction and outputs to D .
Scan
ON
Execution condition
OFF
ON
BASIC INSTRUCTIONS
Point Double coil
When multiple OUT and OUB instructions are used on the same output relay, the
last programmed instruction in program is output first.
When R001 is OFF, R0500 will not be ON even if R000 turns ON.
R000 R500 R000 R500
2
SET
Output Instructions
Operation flag
Sample Program
If input relay R000 turns ON, then output relay R500 turns ON. If input relay R000 turns OFF, then
R500turns OFF.
If input relay R001 turns OFF, then output relay R501 turns ON. If input relay R001 turns ON, then
R501turns OFF.
SET SET
Set Turns the bit ON and remains in this state.
@SET SET
RES RES
Reset Turns the bit OFF.
@RES RES
S E T D ( S D )
SET
Execution condition D
@ S E T D ( @ S D )
SET
Execution condition D R E S D R D
RES R S T D
Execution condition D @ R E S D @ R D
RES @ R S T D
*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , the LSB is turned ON/OFF.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.
Description of Operation
SET When the execution condition is ON, D is turned ON. Once turned ON, the bit
remains in ON state even if the execution condition is OFF (The ON bit is turned OFF with
the RES instruction, etc.). When the execution condition is OFF, no processing is
executed.
* The current values of timers (TMR, TMH, TMS, TMU) and up/down counters (UDC)
change to "0".
The current values of counters (C, OUTC) and up/down timers (UDT) change to setting
values.
RES When the execution condition is ON, D is turned OFF.
* The current values of timers (TMR, TMH, TMS, TMU) becomes the same value as the
setting value.
The current values of counters (C, OUTC), up/down counters (UDC), up/down timers
(UDT), and high-speed counters (CTH) change to "0".
@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).
BASIC INSTRUCTIONS
Point The SET and RES instructions programmed later in the program will be executed
first.
Scan
ON
2
Execution condition
OFF
Output Instructions
@SET, @RES Only 1 scan
Operation flag
Sample Program
Output relay R500 turns ON when one of the following conditions is established:
• Input relay R000 turns ON;
• Both input relay R001 and R002 turn ON;
• Input relay R003 turns ON;
Output relay R501 turns OFF when one of the following conditions is established:
• Input relay R004 turns ON;
• Input relay R005 turns ON;
• Input relay R006 turns ON;
R006
KEEP
The bit is turned ON and remains in this state
KEEP SET
RES
Keep when the SET condition turns ON. The bit is
turned OFF when the RES condition turns on.
2 RES condition
RES
Output Instructions
*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , the LSB is set/reset.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.
Description of Operation
D will be ON when the SET condition is ON and the RES condition is OFF.
D will be OFF when the SET condition is OFF and the RES condition is OFF.
D will be OFF when both the SET condition and the RES condition are ON (The RES condition is
given priority).
The state of D is kept when both the SET condition and the RES condition are OFF.
R002 R500
Scan
ON
Execution
OFF
condition
KEEP instruction Execution Execution
BASIC INSTRUCTIONS
■Difference between the SET/RES instruction and the KEEP instruction
Basically, the SET/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
be swapped in the program. There is also the advantage that a program can be inserted between the
SET and RES instructions.
• Fewer program steps can be 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.
2
• In the following example, when both input relays R000 and R001 are ON, output R500 will turn OFF
Output Instructions
through the KEEP instruction. For the SET and RES instructions, the SET instruction hereafter is
enabled, and output R500 turns ON.
Operation flag
Sample Program
If input relay R000 is ON and R001 is OFF, then output relay R500 turns ON and remains this state.
If input relay R001 is ON, then output relay R500 turns OFF. If R000 and R001 are OFF, the state of
output relay R500 is kept.
DIFU
Only 1 scan ON on the rising edge of the
DIFU Differential up
execution condition.
DIFD
Only 1 scan ON on falling edge of the
DIFD Differential down
execution condition.
Execution condition D I F U D U D
D
P L S D
DIFU
2 Execution condition D
DIFD
D I F D D D
P L
D
F D
Output Instructions
*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , the LSB is set/reset.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
Description of Operation
DIFU D is turned ON only for 1 scan at the rising edge of the execution condition.
Duplicate use of the operand with other DIFU instructions is not allowed.
DIFD D is turned ON only for 1 scan at the falling edge of the execution condition.
Duplicate use of the operand with other DIFD instructions is not allowed.
scan
ON
execution instraction
OFF
BASIC INSTRUCTIONS
Precautions when using the DIFD instruction in an extended ladder program
R000 R1000 R1000 R500 When writing DIFD instruction as (a), since R1000 is ON during
(a) DIFD input R000 OFF scanning, R000 and R1000 cannot be ON at the
same time. Output R500 is not ON in this case.
R000 R1000
DIFD
(b)
R1000 R500 When programming as (b) or (c), R500 will be ON during R000 OFF
s caning.
2
Output Instructions
R000 R1000 R1000 R500
(c) DIFU
Even if programming DIFU instruction as (d), input R1000 and R500
R000 R1000 R1000 R500 are ON while input R000 is ON.
(d) DIFU
Output Instructions
BASIC INSTRUCTIONS
Operation flag
Sample Program
Example for edge synchronization
On the rising edge of the input relay (timing input) R000, if R001 is OFF, then output relay R500 will be
ON, and is kept in this state until R002 is also ON.
(Mnemonics list)
R000 R1000
DIFU LD R000
DIFU R1000
LD R1000
R1000 R001 R1001 ANB R001
OUT R1001
LD R1001
R1001 R002 R500 OR R500
ANB R002
OUT R500
R500
BASIC INSTRUCTIONS
MEMO
Output Instructions
ONDL
The specified bit operates as an ON delay
ONDL ON delay
timer.
OFDL
The specified bit operates as an ON delay
OFDL OFF delay
timer.
2 Execution condition n
OFDL O F D L n D
D
Output Instructions
*1 When word data is specified in D , the LSB performs ON delay / OFF delay operation.
Bit specification of word data cannot be used.
Point • When outputting to an input relay, state of the input terminal is overridden at the
next scan.
• When D is used by OUT and other instructions, it operates as a double coil.
Description of Operation
ONDL D operates as an ON delay timer.
(1) When the execution condition is ON, D is turned ON after n ×10ms.
(2) When the execution condition is OFF, D will also be OFF.
(3) If the execution condition is OFF before n X10ms, then D does not turn ON.
ON
Execution condition
OFF
ON
D
OFF
n × 10ms n × 10ms
OFDL D operates as an ON delay timer.
(1) When the execution condition is ON, D will also be ON.
(2) D will be OFF after n X10ms since the execution condition is OFF.
(3) If the execution condition is ON before n ×10ms, then D does not turn OFF.
ON
Execution condition
OFF
ON
D
OFF
n × 10ms n × 10ms
BASIC INSTRUCTIONS
Operation flag
Output Instructions
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
(1)When input relay R000 turns ON for three seconds or more, output relay R500 will also turn ON.
When R000 turns OFF, R500 will also turn OFF.
(2)When input relay R001 turns ON, output relay R501 will also turn ON. R501 will turn OFF after the
time set at data memory DM0 has elapsed since R001 turns OFF.
(Mnemonics list)
R000 #300
ONDL LD R000
R500 ONDL #300 R500
R001 LD R001
DM0 OFDL DM0 R501
OFDL
R501
SHOT
The specified bit operates as a one-shot
SHOT One shot
timer
1-bit
D
Output Instructions
Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.
Description of Operation
SHOT D is turned ON at the rising edge of the execution condition. D turns OFF after
n X10ms.
The rising edge of the execution condition is ignored when D is ON.
ON
Execution condition
OFF
ON
D
OFF
BASIC INSTRUCTIONS
Operation flag
Output Instructions
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
(1)Output relay R500 turns ON for 0.2 seconds at the rising edge of input relay R000. R500 will stay ON
for 0.2 s from start of the rising edge of R000 even if R000 turns OFF.
(2)When input relay R001 turns ON, output relay R501 will also turn ON. R501 will turn OFF when the
value set at data memory DM000 has elapsed after R001 turns ON.
(Mnemonics list)
R000 #20
SHOT LD R000
R500 SHOT #20 R500
R001 LD R001
DM0 SHOT DM0 R501
SHOT
R501
FLIK FLIK
Flicker The specified bit is used as a flicker circuit.
2
Specifies the setting value (0 to 65535) when D turns ON or
n1 16 bits
the reference source of the setting value. The delay unit is 10 ms.
Specifies the setting value (0 to 65535) when D turns OFF or
16 bits
Output Instructions
n2
the reference source of the setting value. The delay unit is 10 ms.
D Specifies the target to perform the flicker circuit operation.*1 1-bit
Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.
Description of Operation
FLIK (1) D is repeatedly turned ON/OFF while the execution condition is ON. Operation will
start from the ON state.
The ON time is n1 X10ms, and the OFF time is n2 X10ms.
(2)While D is ON, if the execution condition is OFF, D will turn OFF.
(DAY) (MONTH)
ON
Execution condition
OFF
ON
D
OFF
BASIC INSTRUCTIONS
Operation flag
Output Instructions
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
When input relay R000 is ON, output relay R500 will repeatedly turn ON for 1s then OFF for 2s.
(Mnemonics list)
R000 FLIK
#100 #200 R500 LD R000
FLIK #100 #200 R500
2 *1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
Output Instructions
*2 When word data is specified in S , the state of the LSB will be inverted.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.
Description of Operation
The state of D is inverted at the rising edge of the execution condition.
ON
Execution
condition OFF
ON
D
OFF
Operation flag
BASIC INSTRUCTIONS
Sample Program
The ON/OFF state of output relay R500 is inverted on the rising edge of input relay R0000.
Output Instructions
BOUT,BOUB
BASIC INSTRUCTIONS
BOUT(.U)
BOUT BOUT.D B Bit out
Reflects the input status to
the specified bit of the word
BOUB(.U)
BOUB
data.
BOUB.D B Bit out bar
2
Execution condition D
B B O U T D n
n ( B O D n )
Bit Output Instructions
D
B B O U B D n
n ( B O B D n )
BASIC INSTRUCTIONS
Description of Operation
BOUT Outputs the input state (before this instruction) to the n th bit of D .
BOUB Inverts the input state (before this instruction) and outputs to the n th bit of D .
bit
15
D bit
0
bit
31
D +1 bit bit
16 15
D bit
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
Operation flag
Sample Program
When input relay R000 is ON, the 5th bit of data memory DM000 is turned ON.
When R000 is OFF, the 0th bit of DM0 is turned ON.
(Mnemonics list)
R000 DM0
B LD R000
#5 BOUT DM0 #5
BOUB DM0 #0
DM0
B
#0
BSET(.U)
BSET BSET.D BSET
To turn the specified bit of the
Set word data ON and hold this
@BSET(.U)
@BSET
state.
@BSET.D BSET
BRES(.U)
BRES BRES.D BRES
To turn the specified bit of the
2 @BRES(.U)
Reset
word data OFF.
@BRES @BRES.D BRES
Bit Output Instructions
Execution condition D
BSET @ B S E T D n
n ( @ B S D n )
Execution condition D
BRES B R E S D n
n ( B R D n )
Execution condition D
BRES @ B R E S D n
n ( @ B R D n )
Description of Operation
BSET When the execution condition is ON, the n th bit of D is turned ON, and held in
this state.
BASIC INSTRUCTIONS
bit
15
D bit
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
BRES
Bit31 Bit16
n th bit of D
Bit1 Bit0
is turned OFF.
2
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
@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).
Operation flag
Sample Program
When input relay R000 is ON, the 5th bit of data memory DM000 is set.
When input relay R001 is ON, the 5th bit of data memory DM0 is reset.
(Mnemonics list)
R000 DM0
BSET LD R000
#5 BSET DM0 #5
LD R001
BRES DM0 #5
R001 DM0
BRES
#5
TMH
10ms high-speed
T
10 ms, 32-bit ON delay down timer.
H
timer
TMS
1ms high-speed
T
1 ms, 32-bit ON delay down timer.
S
timer
2
Execution condition S
T n T M R n S
n T n S
T
Timer/Counter Instructions
T I M n S
O U T T n S
Execution condition S
T
H n T M H n S
T H n S
T n
T I M H n S
O U T H n S
Execution condition S
T
S n T M S n S
T S n S
T n
T I M H H n S
O U T S n S
*1 Only constants and variables / labels specified as TIMER (timer) type can be specified.
Point The No. n of the timer cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series TMR, TMH, TMS, UDT, TMU
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT
BASIC INSTRUCTIONS
Description of Operation
When the execution condition is ON, the timer specified by n is started. The value specified by
S (setting value) becomes the current value when the timer is started. The current value will
decrement (-1) every 100 ms (TMR), 10 ms (TMH) or 1 ms (TMS).
2
When the current value becomes "#0", the timer T n turns ON.
When the execution condition is OFF, the timer T n turns OFF, and the current value is reset.
Timer/Counter Instructions
Scan
ON
Execution condition
OFF
Value set in S
Current value
#0
Timer T n ON
T
H n
T
S n
Point • The error range of the TMR instruction is ± (100 ms + 1 scan period).
• The error range of the TMH instruction is ± (10 ms + 1 scan period).
• The error range of the TMS instruction is ± (1ms + 1 scan period).
• When S is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", timer T n will be ON while the execution
condition is ON.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
Operation flag
Sample Program
When input relay R000 turns ON, timer T0 turns ON 3 seconds later, and output relay R500 turns ON.
2 T0 R500
LD T0
OUT R500
Timer/Counter Instructions
When input relay R000 turns ON, timer T0 turns ON 0.5 seconds later, and output relay R500 turns ON.
When input relay R000 turns ON, timer T0 turns ON 7ms later, and output relay R500 turns ON.
(Mnemonics list)
R000 #7
T
S 0 LD R000
TMS #0 #7
LD T0
T0 R500 OUT R500
#100000
DW.D
T0
Point If the current value <= setting value, then the current value is changed to the
written value.
If the current value > setting value, then the current value is changed to the same
value as the setting value.
BASIC INSTRUCTIONS
(3) Reading the setting value
DM0
• When the setting value is not set as a constant ( T0 ): Can be read by the LDA.D or MOV.D
instruction.
Timer/Counter Instructions
DM0 DM10
LDA.D STA.D
OR
DM0
T0
MOV.D
DM0 DM10
#100
• When the setting value is set by a constant ( T0
): Cannot be read.
• To change the setting value by the MOV.D instruction: can be changed only when a constant is not
DM0
specified ( T0 ).
Point If the current value <= setting value, the current value is not changed.
If the current value > setting value, then the current value is changed to the same
value as the setting value.
TMU
10μs high-speed
T
10μs, 32-bit ON delay down timer.
U
timer
2 Operation
n
Explanation
Specifies the timer number (0 to 3999).*1
Occupied size
16 bits
Specifies the setting value of the timer. Can be set within the range
Timer/Counter Instructions
S 32 bits
of 0 to 4294967295.
*1 Only constants and variables / labels specified as TIMER (timer) type can be specified.
Point • The TMU instruction can be used with KV-8000/7000 Series CPU units, KV-5000/
3000Series CPU units that have CPU function version 2.0 or higher and with KV
Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4
• The No. n of the timer cannot be same as with No. of the following
instructions.
TMR, TMH, TMS, UDT, TMU
Description of Operation
When the execution condition is ON, the timer specified by n is started. The value specified by
S (setting value) becomes the current value when the timer is started. The current value will
decrement (-1) every 10 μs.
When the current value becomes "#0", the timer T n turns ON.
When the execution condition is OFF, the timer T n turns OFF, and the current value is reset.
Scan
ON
Execution condition
OFF
Value set in S
Current value
#0
T
Timer U n ON
Point • The error range of the TMU instruction is "± 10 μs + 1 scan period".
• When S is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", timer T n will be ON while the execution
condition is ON.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
BASIC INSTRUCTIONS
Operation flag
CR2012
outside the operand range occurs; Otherwise OFF.
It will not change when indirect specification or index modification is not specified, and the
2
access outside the operand range is not checked.
Timer/Counter Instructions
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
When input relay R000 turns ON, timer T0 turns ON 70μs later, and output relay R500 turns ON.
(Mnemonics list)
R000 #7
T
U 0 LD R000
TMU #0 #7
LD T0
T0 R500 OUT R500
UDT
UDT
UP
DW Up/down timer 10 ms, 32-bit up/down timer.
RES
2
DW
Reset input
RES
Timer/Counter Instructions
T n
*1 Only constants and variables / labels specified as TIMER (timer) type can be specified.
Point The No. n of the timer cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series TMR, TMH, TMS, TMU, UDT
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT
Description of Operation
The current value of the timer specified by S is incremented by 1 every 10 ms when up input is ON.
The current value of the timer specified by S is decremented by 1 every 10 ms when down input is
ON.
The current value is kept when up and down inputs both turn ON or OFF.
Reset is performed while reset input is ON.
(1) T n turns ON when the current value is the same as the setting value while up input is ON.
(2) T n turns OFF when the up input is OFF.
(3) T n turns ON when the current value becomes "0" while the down input is ON.
(4) T n turns OFF when the down input is OFF.
(5) The current value is reset to "0" when the reset input is ON.
(1) (2) (3) (4) (5)
ON
Up counting input
OFF
ON
Set value
Current value
0
Timer UDT n ON ON ON ON
BASIC INSTRUCTIONS
Point • The error range of the UDT instruction is (± 10 μs + 1 scan period or less)
• When S is not specified as a constant, the setting value is updated at every
scan during operation.
• If "0" is set in the setting value, the timer UDT n is normal ON, when both up
input and down input are ON.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit 2
used.
Timer/Counter Instructions
• This instruction cannot be used in interrupt programs or in the initialization
module.
Reference The current value of the up/down counter is kept when operation is stopped or when the
power is turned OFF.
* When using the KV Nano Series, the value is cleared when the power is turned OFF if
a number other than 0 to 9 is specified for the timer number.
Operation flag
Sample Program
The time for which the output relay R500 has turned ON is measured. When input relay R000 turns ON,
the measurement value is reset. The measurement value is stored in data memories DM0/ DM1. Unit is
10 ms
Measurement can be performed up to 42949672950 ms (approx. 12000 hours).
(Mnemonics list)
R500 UDT0
UP LD R500
#4294967295 LD CR2003
CR2003
LD R000
DW
UDT #0 #4294967295
R000 LD CR2002
RES MOV.D T0 DM0
CR2002 MOV.D
T0 DM0
C n
*1 Only constants and variables / labels specified as COUNTER (timer) type can be specified.
*2 When word data is specified, the LSB of the device is used for input counting.
Bit specification of word data cannot be used.
Point The No. n of the counter cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series C, OUTC, UDC
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT
Description of Operation
When the execution condition is ON, "1" is added to the current value of n at the rising edge of
S2 . When the setting value specified by S1 is equal to the current value, counter C n will
turn ON. When the execution condition is OFF, counter C n will turn OFF, and the current value will
be reset to "0". The execution condition is used as reset input.
ON
R000 ←reset input #12 Count input S2
C0 OFF
R001 ON
Execution condition
OFF
C0
S1
S1
11
8 9 10
7
6
4 5
2 3
Current value 1
ON
C n
BASIC INSTRUCTIONS
Point • The response speed of the counter instruction depends on the scan time.
Refer to "The maximal counting speed of counters" in the User's Manual of the
CPU unit used.
• When S1 is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", counter C
execution condition is ON.
n will be ON while the
2
• Attention should be when performing writing operation in the RUN mode.
Timer/Counter Instructions
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.
Reference The current value of counter C is kept in the PROG mode or when the power is turned
OFF.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series The current value can be cleared when the
power is turned OFF in CPU system setting.
KV-1000 The current value can also be cleared when the power is turned OFF through
setting the memory switching instruction (MEMSW).
"MEMSW instruction", page 3-4
Operation flag
Sample Program
When input relay R001 is counted 10 times, output relay R500 will turn ON.
When input relay R000 turns ON, counter C0 will be reset.
(Mnemonics list)
R000 #10
C0 LDB R000
R001 C #0 #10 R001
LD C0
C0 R500 OUT R500
MOV.D
C0 DM0
#100000
DW.D
C0
Point
If the current value <= setting value, then the current value is changed to the
written value.
If the current value > setting value, then the current value is changed to the same
value as the setting value.
DM0
・When the setting value is set in the device( C0
)
:Can be read by the LDA.D or MOV.D instruction.
R001
OR
DM0
C0
R001
MOV.D
DM0 DM10
#100
・When the setting value is set by a constant ( C0 ): Cannot be read.
R001
BASIC INSTRUCTIONS
(4) Changing setting value
Timer/Counter Instructions
To change the setting value by the MOV.D instruction: DM0
The setting value can be changed only when the device is specifed ( C0 ) .
R001
Point If the current value <= setting value, the current value is not changed.
If the current value > setting value, then the current value is changed to the same
value as the setting value.
C n
*1 Only constants and variables / labels specified as COUNTER (timer) type can be specified.
Point The No. n of the counter cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series C, OUTC, UDC
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT
Description of Operation
The current value of the counter specified in n is incremented by 1 at the rising edge of the
execution condition.
When the setting value specified by S is equal to the current value, counter C n will turn ON.
The RES instruction is used to reset counters.
ON
R000 #12 Execution condition
C0 R000 OFF
S
12
11
C0 9 10
8
7
6
4 5
2 3
Current value 1
R001 C0
RES ON
C n ON
OFF
ON
Reset
OFF
Point • The response speed of the counter instruction depends on the scan time.
Refer to "The maximal counting speed of counters" in the User's Manual of the
CPU unit used.
• When the setting value is set to "0", counter C n turns ON.
• Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.
BASIC INSTRUCTIONS
Reference The current value of counter C is kept in the PROG mode or when the power is turned
OFF.
KV-8000/7500/7300/5500/5000/3000 The current value can be cleared when the power is
turned OFF in CPU system setting.
KV-1000 The current value can also be cleared when the power is turned OFF through
setting the memory switching instruction (MEMSW).
"MEMSW instruction", page 3-4 2
Timer/Counter Instructions
Operation flag
Sample Program
When the rising edge of input relay R000 is counted 10 times, output relay R500 will turn ON.
When input relay R001 turns ON, counter C0 will be reset.
(Mnemonics list)
R000 #10
C0 LD R000
OUTC #0 #10
LD C0
C0 R500 OUT R500
LD R001
RES C0
R001 C0
RES
2 Reset input
PAUSE
D2
RES
Timer/Counter Instructions
Description of Operation
BASIC INSTRUCTIONS
Input functions
PLS (pulse input) .................. Measurement input
In pulse measurement mode: becomes the pulse input for measuring period
and pulse width.
In DM measurement mode: measurement values are captured during PLS
(pulse input) ON scanning. Please use CR2002 in PLS
(pulse input) in order to load at each scan. 2
PAUSE (measurement pause Measurement is paused when ON.
Timer/Counter Instructions
input)...
RES (reset input)................... When RES turns ON, the content of the data table is initialized.
The measurement values, average values, measurement times and
accumulated values will become "0".
The max. measurement value becomes "65535" when suffix is .U; and
becomes"32767" when suffix is .S.
The min. measurement value becomes "0" when suffix is .U; and becomes"-
32768" when suffix is .S.
ITVL(.U) Pulse measurement and DM measurement are processed by unsigned 16-bit BIN data.
Setting values, measurement values, and average values are processed as unsigned16-
bit data (0 to 65535).
Accumulated values are processed as unsigned 32-bit data.
ITVL.S Pulse measurement and DM measurement are processed by signed 16-bit BIN data.
Setting values, measurement values, and average values are processed as signed 16-bit
data (-32768 to 32767).
Accumulated values are processed as signed 32-bit data.
D1 +1 MAX setting value ->Set up max. value of measurement range. Default set
D1 +9 Lower bits of accumulated value ->Store lower 16 bits of accumulated value of measured value.
D1 +10 Higher bits of accumulated value ->Store higher 16 bits of accumulated value of measured value.
D1 +11
...
Work memory for system ->Work memory for calculating values above. (Use forbidden).
D1 +15
• The average value will not be calculated when the averaging times is set to "0".
2 Although product is calculated, overflow will occur when the 32-bit range is exceeded,
and value will be stored in the low-order 16 bits.
• When the averaging times is reached, the measurement count accumulated value will
Timer/Counter Instructions
become "0".
Mode setting
Pulse measurement mode
* When an unavailable mode has been set, the content of the data table is initialized.
* The mode number that can be used with the KV Nano Series is up to 32767 and the DM number
isup to DM32767.
D2 MAX error ->Only 1 scan ON when measured value larger than MAX. setting value.
D2 +1 MIN error ->Only 1 scan ON when measured value larger than MIN. setting value.
Point • Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.
BASIC INSTRUCTIONS
Operation flag
Timer/Counter Instructions
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
ON
1 scan
ON
2
ON
OFF
1 scan
ON
OFF
300ms 300ms
BASIC INSTRUCTIONS
MEMO
Timer/Counter Instructions
UDC
UDC
UP
DW UP/DOWN counter 32-bit up/down counter
RES
2
DW ( C N T R n S )
Reset input
RES
Timer/Counter Instructions
C n
*1 Only constants and variables / labels specified as COUNTER (timer) type can be specified.
Point The No. n of the counter cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series C, OUTC, UDC
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT
Description of Operation
Current value of the counter is incremented by 1 (+1) on the rising edge of the input.
Current value of the counter is decremented by 1 (-1) on the falling edge of the input.
Counter UDC n turns ON when current value incremented/decremented by 1.
The current value is reset to 0 when reset input turns ON.
R001 UDC 0
UP
R002 #9
DW
R003
RES
C0
ON
ON
R003(Reset input)
OFF
Set value
9 9 8 9 8
7 8 7 6 7 6 7 8 7 6
4 5 6 5 4
Current value 2 3 2 3 3 2
0 1 0 1 0 1 0
Contact C0 O Bit increase O
Bit decrease
O
Bit decrease
N N N
BASIC INSTRUCTIONS
Point • When S is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", counter UDC n is always ON when up
input or down input turns ON. When it is OFF, the reset input will be ON.
• Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used. 2
• This instruction cannot be used in interrupt programs or in the initialization
Timer/Counter Instructions
module.
Reference The current value of up/down counter is kept in the PROG mode or when the power is
turned OFF.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series The current value can be cleared when the
power is turned OFF in CPU system setting.
KV-1000 The current value can also be cleared when the power is turned OFF through
setting the memory switching instruction (MEMSW).
"MEMSW instruction", page 3-4
Operation flag
Sample Program
The number of coming-in vehicles is counted by inpuput relay R000. Park
R000 R001
The number of going-out vehicles is counted by input relay R001.
When count is full (10 vehicles), C0 turns ON to turn output relay
R00500 ON. Entrance Exit
The count is reset by input relay R002.
→ →
R000 UDC 0
(Mnemonics list)
UP
LD R000
#9
R001 LD R001
DW
LD R002
R002
RES
UDC #0 #9
LD C0
C0 R500 OUT R500
2
performed as follows. The input method for contacts is the same as that of the instructions other than
timer instruction.
Timer/Counter Instructions
T@ n T I M @ n S
O U T T @ n S
T M H @ n S
High-speed timer
T H @ n S
S
T T I M H @ n S
H @ n
O U T H @ n S
Up/down Timer
UDT@ n
UP
S n S
U D T @
DW
RES
Counter
S1 C @ n S1 S2
C@ n ( C N T n S1 S2 )
S2
Output counter
S n
O U T C @ S
C@ n @C n
L D @ C n
Up/down counter
UDC@ n
UP
S U D C @ n S
DW ( C N T R n S )
RES
BASIC INSTRUCTIONS
MEMO
Timer/Counter Instructions
END END
End To indicate the end of the master program.
ENDH ENDH
End High To indicate the end of the entire program.
E N D ( E )
2 END
Connection/End Instructions
ENDH
E N D H ( H )
Description of Operation
END The END instruction are the instructions of the final program segment of common master
program.
When the END instruction is executed, the master program is completed by PLC, and the
common master program will be executed again from the program segment 0 after END
processing. The final end of program is indicated by ENDH instruction.
For details on macro modules, see User's Manual of the CPU unit used.
ENDH The ENDH instruction indicates the end of the whole program (there is no program above
this position).
When a sequence control program or an interrupt program is not written, the END
instruction and the ENDH instruction will be written continuously.
Master
program
END
ENDH
BASIC INSTRUCTIONS
Operation flag
Connection/End Instructions
Sequence programs are named as follows according to their function.
Master subroutine
SBN
• END instructions
The END instruction are the instructions of the final program segment of common master program.
Common sub-routine and interrupt program are programmed after the END instruction. However,
interrupt program cannot be used in macros.
• ENDH instructions
ENDH instructions are the final instructions of the final program segment of the executed sequence
control program.
Program can be scripted following the ENDH instruction, but they are not executed.
For details on macro modules, see User's Manual of the CPU unit used.
CON
To indicate a series connection following an
Connect
output instruction.
Ladder Input mo
a b c d
↑ ↑ ↑
CON CON CON
2 Description of Operation
Connection/End Instructions
This instruction is used to connect instructions after the output instruction when a program is written in
an extended ladder program.
* If an instruction is written after the output instruction when creating a ladder diagram with KV
STUDIO, it will be inserted automatically during conversion.
* Scan time is not influenced.
For details on extended ladders, see User's Manual of the CPU unit used.
Operation flag
BASIC INSTRUCTIONS
MEMO
Connection/End Instructions
MPP
To read the content in memory by the MPS instruction,
Pop
and clear memory.
2 Ladder program
Connection/End Instructions
→
MPS
→
MRD
→
MPP
Description of Operation
MPS Stores the ON/OFF state and operation flag state up to that instruction, and executes the
instruction from the next step. If this instruction is executed two or more times in a circuit
block, then ON/OFF state at that moment will be stored in the execution sequence. (up
to8 states can be stored.)
MRD Reads the stored ON/OFF state and operation flag by the MPS instruction, and executes
the instructions from the program segment using the content read. The ON/OFF state and
operation flag state stored in memory will be held.
The MRD instruction can be used continuously. (In this case, the same content is read.)
BASIC INSTRUCTIONS
MPP Reads the stored ON/OFF state and operation flag by the MPS instruction, and executes
the instructions from the program segment using the content read. When two or more
MPS instructions are executed (two or more ON/OFF states and operation flag states are
stored), the stored ON/OFF states and operation flag states are read in sequence by the
MPS instruction. Then the ON/OFF states and operation flag states read by the MPP
instruction are cleared from memory.
R000 R001 R002 R003 R004 R005 R006 R007 R008 R500 LD R000
. . . . Store ON/OFF status in (1)
2
MPS
Connection/End Instructions
→
→
① ② ③ ④ ⑤ ⑥ ⑦ ⑧ R009 R501 AND R001
MPS . . . . Store ON/OFF status in (2)
...
R010 R502
AND R006
MPS . . . . Store ON/OFF status in (7)
R011 R503
AND R007
MPS . . . . Store ON/OFF status in (8)
R012 R504 AND R008
OUT R500
R013 R505
MPP . . . . Read ON/OFF status in (8).
R014 R506 AND R009
OUT R501
MPP . . . . Read ON/OFF status in (7).
R015 R507
AND R010
OUT R502
R100 R508
...
MPP . . . . Read ON/OFF status in (2).
AND R015
OUT R507
MPP . . . . Read ON/OFF status in (1).
AND R100
OUT R508
Point Please use the MPS instruction and MPP instruction in pair.
If number of MPS instructions is different from that of MPP instructions, then a conversion
error will occur when the program is edited through KV STUDIO, and the program cannot
be executed
Operation flag
Ladder program
2
ANL ORL
Block C
Connection/End Instructions
Description of Operation
ANL Connects two contact circuit blocks in series.
As shown in the ladder diagram above, circuit block A and circuit block B are connectedin
series. This connection is indicated by a connection line instead of a symbol.
Operation flag
When the circuit blocks are connected to the left and right power rails, the contact circuit blocks
arecalled "program circuit block".
Program block
BASIC INSTRUCTIONS
Sample Program
Output relay R501 turns ON when one of the following conditions (1), (2), (3) or (4) is satisfied.
(1)Both input relay R000 and R002 turn ON.
(2)Both input relay R000 and R003 turn ON.
2
(3)Both input relay R001 and R002 turn ON.
(4)Both input relay R001 and R003 turn ON.
(Mnemonics list)
Connection/End Instructions
R000 R002 R501
LD R000
AND R002
R000 R003 LD R000
AND R003
ORL
LD R001
R001 R002 AND R002
ORL
LD R001
R001 R003 AND R003
ORL
OUT R501
The operation of the above program is the same as that of the following program.
INV
ON/OFF status To invert the previous ON/OFF state before
inversion this instruction.
Ι Ν V
Description of Operation
2 INV Inverts the previous ON/OFF state before this instruction.
Connection/End Instructions
Scan
ON
Before INV
instruction OFF
ON
After INV
instruction
OFF
Point • The "previous ON/OFF state" only refers to the circuit elements connected by ANL/
ORL.
p
R1002
• Cannot be connected to left and right power rails directly. Attention should also be paid
when used in OR circuit.
This is described as follows as an example.
●When inverting is
possible
○
●When inverting is
not possible
×
BASIC INSTRUCTIONS
Operation flag
Connection/End Instructions
When R000 or DM0.3 is ON and DR001 is OFF, "10" will be stored in DM0. Otherwise, "20" will be
stored in DM0.
(Mnemonics list)
R000 DR001 MOV
#10 DMO LD R000
OR DM0.3
ANB DR001
MOV #10 DM0
INV
DMO.3 MOV MOV #20 DM0
#20 DMO
MEP
Only 1 scan period is ON on the rising edge
MEP
of the previous execution condition.
MEF
Only 1 scan period is ON on the falling edge
MEF
of the previous execution condition.
M E P
2
Connection/End Instructions
M E F
Description of Operation
MEP Only 1 scan period is ON on the rising edge of the execution condition before this
instruction.
MEF Only 1 scan period is ON on the falling edge of the execution condition before this
instruction.
Scan
ON
Before MEP/MEF
instruction
OFF
ON
Before MEP
instruction
OFF
ON
Before MEF
instruction OFF
Point • This instruction cannot be used in interrupt programs or in the initialization module.
• Attention should be paid when used among the STP to STE instructions, among the
STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL instructions in
subroutine.
"Precautions on the use of differential execution type instructions", page 1-40
• The "previous ON/OFF state" only refers to the circuit elements connected by ANL/
ORL.
R1002
It does not detect the rising edge for AND state of R1000 and R1002. It only
detects the rising edge for R1002.
As in the example in which R1002 is ON, even when R1000 is ON, the circuit
does not operate.
If R1000 is ON and when R1002 is ON, the circuit operates.
• Cannot be connected to left and right power rails directly. Attention should also be paid
when used in OR circuit.
Since the instruction is the same as the INV instruction, please read the content about
INV instruction together.
"INV instruction", page 2-70
BASIC INSTRUCTIONS
●When inverting is
possible
○
○
2
●When inverting is
×
Connection/End Instructions
not possible
Operation flag
Sample Program
Only 1 scan will be performed on the rising edge of the execution condition with R000, R001 and R002
combined (OFF->ON), and R500 will be ON.
(Mnemonics list)
R000 R002 R500
LD R000
ORB R001
AND R002
MEP
OUT R500
R001
RFSX
RFSX
To refresh the states of the
Input refresh
specified number of input relays.
@RFSX
RFSX
RFSY
RFSY
To refresh the states of the
Output refresh
specified number of output relays.
@RFSY
RFSY
Reference When only 1 point is refreshed ( n =1), DR (direct input / output relay) can be used
instead of the RFSX/RFSY instruction.
BASIC INSTRUCTIONS
Description of Operation
Generally, inputs/outputs will be refreshed in batch after the end instruction is executed. Used when
inputs/outputs are refreshed during 1 scan period.
RFSX When the execution condition is ON, states of the number of input relays specified by
2
n starting from D will be refreshed.
@RFSX This instruction is executed for one scan at the rising edge of the execution condition.
Point Inputs and outputs for expansion units that do not support direct input/output
cannot be refreshed.
Operation flag
Sample Program
When R1000 is ON, 8 input relays will be refreshed from the input relay R008 of the CPU unit.
When R01000 is ON, 32 output relays will be refreshed from the R30000 assigned to the expansion
output unit.
MEMO
2
Direct I/O Instructions
APPLIED INSTRUCTIONS
APPLIED INSTRUCTIONS
These instructions are for work progress, program control, and extended
ladders.
These instructions allow you to structurally script basic ladders.
SFT
SFT
D
Shift Operates the shift register
APPLIED INSTRUCTIONS
CLK
RES
Description of Operation
The data input ON/OFF state is read at the rising edge of the clock input.
That state is shifted from D1 to the bit specified by D2 in sync with the clock pulse.
When reset input is ON, all bits from D1 to D2 turn OFF.
Only bits within the range of D1 to D2 are shifted. Other bits are not shifted.
ON
Data input
OFF
ON
Clock input
OFF
ON
Reset input
OFF
ON
D1 D1
OFF
ON
D1 +1 D1 −1
OFF
ON
D1 +2 D1 −2
OFF
ON
D1 +3 D1 −3
OFF
ON
D2 −1 D2 +1
OFF
ON
D2 D2
OFF
APPLIED INSTRUCTIONS
Operation flag
Shift Instructions
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
R1003 R1000
SET
MEMSW
MEMSW
MEMSW
Memory switch Operates the memory switch.
APPLIED INSTRUCTIONS
*1 Only constants can be specified. Cannot be specified by "$". ("#" can be omitted)
*2 Only constants can be specified. Cannot be specified by "#".
Memory Switch Instruction
Description of Operation
This instruction is set when powering ON and when the ladder program is transferred (including writing
in the RUN mode).
MEMSW0
3210 3210 3210 3210
$0103
0000 0000 0000 0000
SW1
SW2
SW3
SW4
APPLIED INSTRUCTIONS
MEMSW1
MEMSW1
3210 3210 3210 3210
$ 0216
0000 0000 0000 0000
SW1
SW2
SW3
SW4
Point Set holding of relays set by MEMSW1 only to internal auxiliary relays.
Do not set this function to relays assigned to I/O unit and special unit (unit other
than I/O Unit). When this function is set to I/O relays, the relays do not hold the
content of device. When this function is set to relays assigned to special unit, the
program may not function normally.
MEMSW2
MEMSW2
3210 3210 3210 3210
$0 0 0 3
0000 0000 0000 0000
SW1
SW2
SW3
SW4
3
2 Operation at fixed scanning time (unit selectable) 500μs 1ms
3 Reserved for system ─ ─
0 When power ON or PROG→RUN, EM0 to EM19999 clear Hold
Memory Switch Instruction
* Settings made by comparator match output destination selection are enabled by comparator match
output and specified frequency pulse output.
For details on specified frequency pulse output, see KV-1000 Series User's Manual,"5-1 High-
speed Counters".
For details on comparator match output, see KV-1000 Series User's Manual, "Chapter 6
Frequency Counters".
Point When comparator match output has been specified to R504 or R505 in MEMSW2, it
can output different frequencies.
KV-1000 Series User's Manual "1-3 CPU Unit", "Specifications"
APPLIED INSTRUCTIONS
Example for memory switch setting
Specify the memory switch No. in HEX.
Reference If an attempt is made to transfer program to KV-1000 that has been write-protected on
KVSTUDIO, "The PLC is write-protected. Continue?" will be displayed. Select "Yes" to
execute the transfer forcedly.
Operation flag
Sample Program
Clear DM0 to DM9999 when powering ON.
(Mnemonics list)
MEMSW0
MEMSW #0 $100
$0100
STE
STP instruction, and indicates end of the
Step end
program to be executed by step
operation.
3 Program A
STE
S T E
Step Instructions
Program B
Description of Operation
When S is ON, the program (program A) between the STP and STE instructions is executed.
When S is OFF, the program between the STP and STE instructions is not executed, and
execution jumps to the next program (program B) after the STE instruction.
Example When input R000 is ON, output R500 turns ON/OFF interlocked to input R001 ON/OFF.
When input R000 is OFF, output R500 does not turn ON even if input R001 is ON.
When R000 turns OFF with both R001 and R500 are ON, R500 holds ON even if
inputR001 turns OFF.
R000 R1000
STP
R1000
This program is
R001 R500
← not executed when
R1000 is OFF.
STE
Point • The instruction sequence between the STP and STE instructions that have not
been executed do not affect the scan time.
• Attention is required when programming differential execution type instructions,
timer or macro instructions between the STP and STE instructions.
"Precautions on the use of differential execution type instructions", page 1-40
"Macro Instructions", page 3-42
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
APPLIED INSTRUCTIONS
About nesting structure
The STP and STE instructions can be programmed up to
STP
a nesting level of 16. R1000
In the program shown on the right, (1) (2) (3) are not
executed when R1000 is OFF, and execution starts from (4). ①
When R1000 and R1001 both are ON, the program is
STP
executed in order (1) (2) (3) (4).
3
R1001
When R1000 is ON and R1001 is OFF, the program is
1st 2nd
executed in order (1) (3) (4), and execution of (2) is level level ②
Step Instructions
skipped.
STE
STE
Operation flag
* When CR2012 has turned ON, the program sequence between the STP and STE instructions is not
executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
When input relay R000 turns ON, output relay R500 automatically turns ON for 2s, and then R501 turns
ON for 3s.
(Mnemonics list)
R000 R1000 R1000 R1001
DIFU SET LD R000
DIFU R1000
CON
STP AND R1000
3 T0
R1001 SET R1001
STP R1001
LD T0
R1001
RES R1001
Step Instructions
RES
LDB T0
OUT R500
T0 R500 LD R1001
TMR #0 #20
LD T0
R1001 #20 SET R1002
T0 STE
STP R1002
LD T1
T0 R1002 RES R1002
SET LDB T1
OUT R501
LD R1002
STE
TMR #1 #30
STE
STP
R1002
T1 R1002
RES
T1 R501
R1002 #30
T1
STE
APPLIED INSTRUCTIONS
MEMO
Step Instructions
JMP
Turns the bit of the current executing stage OFF,
JMP Jump stage
and jumps to the specified stage.
ENDS ENDS End stage Turns the bit of the current executing stage OFF.
D D '
3 STG
D '
JMP S T G
J M P
D
D
STG ENDS
Stage Processing Instructions
E N D S
Description of Operation
STG When D is ON, the |STG| will operate as ON contact.
When D is OFF, it will jump to the start of next block.
When D is turned from ON to OFF, the |STG| will operate as OFF contact.
• Be sure to start the STG instruction from the power rail.
• Duplicate programming of STG instruction operands is not allowed.
• The D of initial STG shall be set in differential condition.
• OR connection of STG instructions are not allowed.
• Multiple STG instructions cannot be configured in the same block.
• At least 1 JMP/ENDS instruction must be configured in the block identical with STG.
JMP When the previous status is ON, the stage relay operating currently will be reset and
D ' will be set.
• Please configure in the block configured with STG instruction.
ENDS When the previous state is ON, the currently executing stage ends.
• Please configure in the block configured with STG instruction.
"About contact circuit blocks and program circuit blocks", page 2-68
APPLIED INSTRUCTIONS
■STG instructions
"Stage instructions" are suited to successively processing (sequential processing) in keeping with
specific processes.
The entire program is divided up into smaller processes, and the program is executed one process at a
time.
Flow chart
Power ON
3
Ladder program
Start switch R1000
No
Start switch ON? ↑ SET
R1001 R1002
Process(2) STG JMP →Process(2)
R1002 R1003
Process(3) STG JMP →Process(3)
R1003
Process(4) STG ENDS →Process(4)
When the STG, JMP and ENDS instructions are used, you can write a program for each individual
process.
• When D of the STG instruction turns from ON to OFF, the coils in the same
block turns OFF and the states of the SHOT and OFDL instructions are held since
the STG instruction operates as an OFF contact.
• When the block is only programmed with JMP/ENDS instructions and without STG
instruction, the operation cannot be ensured due to uncertain relay reset by JMP/
ENDS.
• When a box script is used based on the STG instruction, it will always be executed
regardless of the state of the STG instruction.
Reference To turn all stage instructions OFF such as in an emergency stop, use the ZRES or SFT
instruction.
Reset input R1000 Leading relay of st
ZRES
R1004 End relay of stage
CR2003 SFT
D
R1000 Leading relay of st
CR2003
CLK
Reset input R1004 End relay of stage
RES
Operation flag
APPLIED INSTRUCTIONS
■Precautions on stage instructions
Interlock
When a stage migrates, the previous and next stages turn ON simultaneously for one scan only.
Provide an interlock circuit for outputs (e.g. forward or reverse rotation of motor) that might cause a
hazard when both of these stages simultaneously turn ON.
R1001
STG
R500 R501 R002 R1002
JMP
3
* When STG R1000 and R1002 turn ON simultaneously, output R500 of STG R1002 programmed
later is given priority.
Point When stages programmed with duplicate coils turn ON simultaneously, the coil of
the stage programmed later is given priority.
Output hold
To hold output even if STG is OFF, you can use the SET instruction.
R001
R1001 R002
ENDS
instruction is executed. Accordingly, output relay R500 does not turn OFF.
R002 R1002
JMP
APPLIED INSTRUCTIONS
Sample Program
Output relay R500 turns ON by the start switch of input relay R000.
Then, when R001 turns ON as a conditional branch, R501 turns ON for 1s. When R002 turns ON, R502
turns ON for 2s. When each of these processes ends, program execution returns to the conditional
branch, and execution is repeated.
(Mnemonics list)
R000 R1100 R1100 R1000
3
DIFU SET LD R000
DIFU R1100
R1000 CON
R500 R001 R1001
AND R1100
STG JMP
W-ON ON Wait ON Sets the No.2 operand with the No.1 operand ON.
APPLIED INSTRUCTIONS
W-OFF OFF Wait OFF Sets the No.2 operand with the No.1 operand OFF.
Execution condition S
3 OFF W - O F F S D
(W O F F S D )
D
Operation Explanation Occupied size
Stage Processing Instructions
*1 When word data is specified, the LSB is processed. Bits other than LSB do not change.Bit
specifying can not be used for word devices.
Description of Operation
W-ON (1)When the execution condition is ON, D is set if S is ON.
(2) D holds ON until the execution condition turns OFF even if S turns OFF.
(3)When the execution condition turns OFF, D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(1) (2) (3) (4)' (5)'
ON
Execution condition S Execution
condition OFF
ON ON
D S
OFF
ON
D
OFF
D
OFF
APPLIED INSTRUCTIONS
Operation flag
Sample Program
When input relay R000 turns ON during execution of stage R1000, output relay R500 turns ON.
When output relay R500 turns ON for 3s, program execution jumps to stage R1001. R1100 does not
turn OFF even if R000 turns OFF before 3s have elapsed.
(Mnemonics list)
R1000 R000 R1100 R500 #30 T0 R1001
STG ON T0 JMP STG R1000
R1100 W-ON R000 R1100
CON
AND R1100
OUT R500
CON
TMR #0 #30
CON
AND T0
JMP R1001
W-UE
Sets the No.2 operand at the rising edge of the No.1
↑ Wait rising edge
operand.
APPLIED INSTRUCTIONS
W-DE
Sets the No.2 operand at the falling edge of the No.1
↓ Wait falling edge
operand.
Execution condition S W - D E S D
3 ↓
D
W D E
W D S
S
D
D
S Specifies the bit data whose rising edge or falling edge is detected.*1 1 bit
D Specifies the bit data to be set at the rising/falling edge of S .*1 1 bit
*1 When word data is specified, the LSB is processed. Bits other than LSB do not change.Bit
specifying can not be used for word devices.
Description of Operation
W-UE (1)When the execution condition is ON, D is set at the rising edge of S .
(2) D holds ON until the execution condition turns OFF even if S turns OFF.
(3)When the execution condition turns OFF, 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 rising edge is
detected even if S is ON.
(1) (2) (3) (4)
ON
Execution condition S Execution condition
OFF
↑ ON
D S
OFF
ON
D
OFF
W-DE (1)When the execution condition is ON, D is set at the falling edge of S .
(2) D holds ON until the execution condition turns OFF even if S turns ON.
(3)When the execution condition turns OFF, 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 falling edge is
detected even if S is OFF.
(1) (2) (3) (4)
ON
Execution condition S Execution condition
↓ OFF
ON
D S
OFF
ON
D
OFF
Point • This instruction cannot be used in interrupt programs or in the initialization module.
• Attention should be paid when used in subroutines, among STP to STE instructions,
STG to JMP/ENDS instructions and CJ/NCJ/GOTO to LABEL instructions.
"Precautions on the use of differential execution type instructions", page 1-40
APPLIED INSTRUCTIONS
Operation flag
Sample Program
When the input relay is ON, and the order in which input relays R001 to R003 turn ON is R001→R002
→R003, output relay R500 turns ON.
R1002 R500
Scan
ON
R000
OFF
ON
R001
OFF
ON
R1000
OFF
ON
R002
OFF
ON
R1001
OFF
ON
R003
OFF
ON
R1002
OFF
ON
R500 ON
OFF
MC,MCR
3
M C R ( I L C )
MCR
Flow Instructions
Description of Operation
Master routine is used to install contacts on the left power rail, and to switch between program blocks
through ON/OFF. The schematic diagram of the circuit is as follows.
Display ladder software Conceptual diagram
R000 MC MC
R000
R001
R001 R500 This part will be OF
R003 MCR
APPLIED INSTRUCTIONS
• When the MC instruction execution condition is OFF, the instructions between the MC to MCR
instructions are executed with the execution condition OFF.
The following instructions are exceptions.
Instrucition State
OUB OFF
OFDL instruction
Reset
SHOT instruction
C instruction/CTH instruction/HSP State held
3
instruction
CJ/NCJ/GOTO instructions No branch
MCALL instruction During execution of macros, instructions in the macro are executed only for one scan
Flow Instructions
MSTRT instruction with the execution condition OFF, and then execution stops at the next scan. This
instruction is not executed when the macro stops.
• KV-8000/7500/7300/5500/5000/3000, KV Nano Series During monitoring, the display content will be as follows
when the execution condition of MC instruction is OFF.
R000 MC
R001 R500
R002 R501
MCR
R003 R502
• Output relay R500 between the MC and MCR instructions and output relay R500 outside of the MC to
MCR instructions becomes a double coil as follows. For this reason, the output relay programmed
later is given priority.
R003 R500
R001 MC
R002 R500
←Preference
MCR
• Use the MC and MCR instructions in the following combinations: other MC to MCR instructions, STP
to STE instructions, STG to JMP/ENDS instructions, CJ/NCJ/GOTO to LABEL instructions, and FOR
to NEXT instructions.
MC
MCR
MC
MCR
STE
MCR
MC
MCR
MC STE
MCR
Operation flag
APPLIED INSTRUCTIONS
Sample Program
When input relay R000 and internal auxiliary relay R1000 are both ON, output relay R500 turns ON/
OFF by R001 ON/OFF. (When R001 turns ON, R500 turns ON, and when R001 turns OFF, R500 turns
OFF.)
When either (or both) R000 and R1000 turn OFF, R500 stays OFF (does not turn ON) regardless of the
state of R001.
3
(Mnemonics list)
R000 R1000 MC
LD R000
AND R1000
MC
Flow Instructions
R001 R500
LD R001
OUT R500
MCR
MCR
CALL
rou
CALL Sub-routine call Executes the specified sub-routine. tin
APPLIED INSTRUCTIONS
SBN SBN
Sub-routine entry Indicates the start of the sub-routine.
SBN
cal
l
RET RET
Sub-routine return Ends the sub-routine. Sub
-
rou
tin
Ladder program Input mode e
Execution condition n ent
CALL C A L L n ry
3
END
SBN
Flow Instructions
n S B N n
RET
R E T
ENDH
Description of Operation
CALL When the execution condition is ON, the specified sub-routine in n will be executed
during each scan.
SBN Indicates the start of the sub-routine. Specify the sub-routine No. in n .
Duplicate entry of the sub-routine No. for the SBN instruction is not allowed. (Duplicate
entry of sub-routine Nos. by the CALL instruction is allowed.)
Programming these instructions between the END and ENDH instructions.
RET Indicates end of the sub-routine.
#0
during execution of the main routine program. CALL
When execution of the sub-routine ends, program Program B
END
execution returns to program (B) following the CALL 000
instruction, and the main routine program is executed SBN
#0
until the END instruction is programmed.
Subroutine
Subroutine
Program
RET
SBN
#1
APPLIED INSTRUCTIONS
Point • 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, STG, JMP, ENDS, MEMSW
• Caution is required when using differential execution type instructions, timer
instructions, and macro instructions in sub-routines.
"Precautions on the use of differential execution type instructions", page 1-40
"Macro Instructions", page 3-42
Refer to "Precautions when using timing instructions" in the User's Manual of 3
the CPU unit used.
Flow Instructions
No execute the CALL instruction (input R000 = OFF)
Program A
R000 #0
CALL
Program B
SBN
Program A
プログラム A #0
R000 #0
Subroutine
CALL
Program
RET
Program B
プログラム B
Subroutine
Program A
RET
SBN call
#0
Subroutine
Program B
R000 #1
CALL
RET
ENDH
Point When the nested structure contains more than 17 levels, PLC host error 10 will
occur, and operation will stop.
3
• To call a sub-routine from inside an interrupt Program
program, the sub-routine to be called must already END
be defined (programmed in the previous rung) for
Flow Instructions
SBN
the KV-5500/5000/3000/1000. #1
Subroutine
Program
RET
INT call
R000
Interrupt
program
R002 #1
CALL
RETI
ENDH
Operation flag
APPLIED INSTRUCTIONS
MEMO
Flow Instructions
*1 Enter the module name directly (" " can be omitted). (" "can be omitted) Up to 24 half-width
3 alphanumerics, and12 full-width alphanumerics (24 for the KV-8000/7000 Series) can be
specified.
Flow Instructions
Reference Since module name list will be displayed at time of entering, you can simply make
selection to enter.
Description of Operation
ECALL When the execution condition is ON, the sub-routine specified in n of the module
specified in S will be executed. All types of modules (Fixed cycle, Initialization, Every
scan, Standby, Inter-unit synchronization, etc.) can be specified for S , but macros
cannot be specified.
Reference • When subroutine of the self-module, CALL instruction can also be used.
• When a local device / variable is used in the subroutine called by the ECALL instruction,
the program will be executed with the local device / variable of the module on the called
side instead of the calling side.
• For other Description of Operation, please read CALL instruction.
"CALL instruction" (page 3-26)
Point • 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, STG, JMP, ENDS, MEMSW
• Caution is required when using differential execution type instructions, timer
instructions, and macro instructions in sub-routines.
"Precautions on the use of differential execution type instructions", page 1-40
"Macro Instructions", page 3-42
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
APPLIED INSTRUCTIONS
Operation flag
3
"Out-of-range access of operands", page 1-50
Flow Instructions
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
Execute sub-routine of "Module 1" when R000 is ON.
FOR.D
instructions for the specified number of
times in a single scan.
NEXT
NEXT
NEXT Indicates the end of the repeat range.
BREAK
BREAK Ends execution of the FOR to NEXT
Break
instructions forcedly.
3
FOR
S F O R S
Loop program
Flow Instructions
Description of Operation
FOR(.U) • The program between the FOR and NEXT instructions is executed repeatedly within 1
scan for the number of loops specified by S .
• The FOR instruction is executed forcedly. To disable execution, specify "0" to S .
FOR.D • The program between the FOR and NEXT instructions is executed repeatedly within 1
scan for the number of loops specified by [ S / S +1].
• The FOR instruction is executed forcedly. To disable execution of programs between
the FOR and NEXT instructions, specify "0" to [ S / S +1].
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 16 BREAK instructions can be used between a single FOR to NEXT instruction
program section. If the FOR to NEXT instructions are nested, up to 16 BREAK
instructions can be used in the entire nested structure.
APPLIED INSTRUCTIONS
Example The FOR instruction can be programmed up to a nesting level of 16.
FOR
#5
FOR
#4
2 nested
1 nested
3 nested
Flow Instructions
←
NEXT
NEXT
NEXT
Point • When instructions are nested beyond the nesting level of 17, the "FOR-NEXT
error" is generated and the instruction cannot be executed.
• When an excessive number of repeats is set causing the scan time exceed
300ms, the"Scan time over" error is generated, and the instruction cannot be
executed.
Operation flag
* When CR2012 has turned ON, the program sequence between the FOR and NEXT instructions is
not executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
16-bit unsigned BIN data currently stored to data memories DM0 to DM99 is added, and the result is
stored to DM100. Data is added successively from DM0, and when the result exceeds 1000, the
calculation is stopped. At which data block the calculation was stopped is stored to DM101.
When indirect specification was stored
CR2002 ADRSET
(Mnemonics list)
3
DM0 TM10 LD CR2002
ADRSET DM0 TM10
#0 DM100 #0 DM101 LDA #0
LDA STA LDA STA CON
Flow Instructions
STA DM100
FOR CON
#100 LDA #0
CON
CR2002 STA DM101
*TM10 DM100 DM100 DM101
FOR #100
LDA ADD STA INC
LD CR2002
MPS
ADRINC LDA #TM10
TM10
CON
ADD DM100
DM100 BREAK CON
>= STA DM100
#1000
CON
NEXT INC DM101
MPP
ADRINC TM10
LD>= DM100 #1000
BREAK
NEXT
For details on indirect specification, refer to "Indirect Specification" in the User's Manual of the CPU unit
used.
APPLIED INSTRUCTIONS
MEMO
Flow Instructions
CJ CJ
APPLIED INSTRUCTIONS
NCJ NCJ
3 Execution condition CJ
n C J n
Flow Instructions
GOTO
n G O T O n
LABEL
n L A B E L n
Description of Operation
CJ When the execution condition is ON, program execution jumps to the line with the LABEL
instruction specified by n .
NCJ When the execution condition is OFF, program execution jumps to the line with the LABEL
instruction specified by n .
GOTO Program execution jumps unconditionally to the line with the LABEL instruction specified
by n .
LABEL Specifies the jump destination of the CJ, NCJ or GOTO instructions.
Scan
ON
Execution condition
OFF
CJ Execute Execute
APPLIED INSTRUCTIONS
Example When the execution condition is ON, program execution jumps to LABEL instruction
#010specified by the CJ instruction, the program jumps to (1), (2), and the program is
executed.
When the execution condition is OFF, program execution jumps to LABEL
instruction#020specified by the GOTO instruction, and program (2) is executed.
Flowchart
Execution condition CJ
#10
3
OFF
Execution condition
GOTO
#20 ON
Flow Instructions
LABEL LABEL #10
#10
Point • The instruction sequence between the CJ, NCJ, GOTO instructions and the
LABEL instruction that have not been executed do not affect the scan time.
• Attention must be paid to prevent a cycle time over (scan time 300ms or more)
when the CJ, NCJ or GOTO instruction causes a jump to a step having a step No.
smaller than the currently executing step.
LABEL
#10
R000 CJ
#20
This part will be ON when input relay
GOTO R000 is ON. Cycle timeout abnormality
#10 happens due to abnormal disconnection
from program (1).
LABEL
#20
Operation flag
Sample Program
3 When input relay R000 turns ON, output relay R500 automatically turns ON for 2s, and then R501 turns
Flow Instructions
ON for 3s.
(Mnemonics list)
R000 R1000 R1000 R1001
DIFU SET LD R000
DIFU R1000
CON
R1001 T0 R500
AND R1000
SET R1001
LD R1001
R1001 #20 ANB T0
T0 OUT R500
LD R1001
TMR #0 #20
T0 CJ LD T0
#1 CJ #1
GOTO #2
GOTO LABEL #1
#2 LDB T1
OUT R501
LD R1001
LABEL TMR #1 #30
#1 LD T1
RES R1001
T1 R501 LABEL #2
R1001 #30
T1
T1 R1001
RES
LABEL
#2
APPLIED INSTRUCTIONS
MEMO
Flow Instructions
SCJ
SCJ Performs a jump to the LABEL instruction.
Conditional branch
(With 1 scan ON delay)
APPLIED INSTRUCTIONS
3 Description of Operation
Flow Instructions
SCJ When the execution condition is switched from OFF to ON, it will be transferred to the line
with the LABEL instruction specified by n during ON period from the next scan.
Scan
ON
Execution
OFF
condition 1 scan 1 scan
ON
SCJ Execution
condition OFF
Point When SCJ instruction is written in RUN mode, if the execution condition is ON
when writing operation is finished, transferring will occur at once, without having
to wait 1 scan.
Operation flag
* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
APPLIED INSTRUCTIONS
Sample Program
When CJ instruction is used, R500 will not be OFF. When SCJ instruction is used, SCJ instruction will
be OFF.
MR000 #20
TMR #0 #20
LD T0
SCJ #1
3
T0
LDB T0
Flow Instructions
T0 OUT R500
SCJ
LABEL #1
#1
T0 R500
LABEL
#1
*1 The number of operands other than the macro name and the data that can be specified differ as
follows depending on the argument settings set in the macro to be executed.
•P : Devices, variables and labels can be specified. Constants cannot be specified.
•V : Devices, variables, labels and constants can be specified.
• Unit : Only constants can be specified.
*2 Handling of T, C, TIMER type variables and COUNTER type variables differs depending on the
instruction used in the macro.
Example) For the MOV instruction, the current value is handled. For details, refer to the operation
description of the respective instruction.
*3 "", # and $ cannot be used. Directly enter the name of the macro set in KV STUDIO.
Up to 12 half-width alphanumerics and 6 full-width alphanumerics can be specified.
However, up to 12 full-width alphanumerics can also be specified in the KV-8000/7000 series.
*4 When an ID No. is used, the format becomes "(macro name)_(ID No.)". Example) Batch
transmit_2
For details on ID No., see the User's Manual of the CPU unit used.
APPLIED INSTRUCTIONS
Description of Operation
MCALL The sub-routine macro specified by S is executed at every scan when the execution
condition is ON.
Execution of the specified macro is started from scans where the execution condition
changes from OFF to ON.
MSTRT The self-hold type macro specified by S is executed at every scan when the
execution condition is ON.
Execution of the specified macro is started from scans where the execution condition
3
Macro Instructions
changes from OFF to ON.
Once execution is started, the macro continues to be executed even if the execution
condition is OFF.
MEND Self-hold type macros with a MEND instruction written to them stop when the execution
condition is ON.
The OFF process when stopped differs according to the CPU unit. Refer to the instruction manual for
each CPU unit for details.
Point • Writing in the RUN mode is not possible if the MCALL/MSTRT instruction is added
or deleted.
• To stop execution of a self-hold macro, use the MEND instruction in the macro.
When the MSTRT instruction execution condition holds ON, the MEND instruction
is ignored.
• The MEND instruction cannot be programmed in modules and sub-routine macros.
• Other macros cannot be stopped by the MEND instruction.
APPLIED INSTRUCTIONS
Operation flag
CR2009 The state depends on the processing result in the macro to execute.
CR2010 The state depends on the processing result in the macro to execute.
CR2011 The state depends on the processing result in the macro to execute.
ON when the indirect specification or index modification range is inappropriate, the unit specified
by UR/UV/UM while using the KV-8000/7000 series is not connected, or an access outside the
operand range occurs. Otherwise it is OFF.
CR2012
It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked. 3
"Out-of-range access of operands", page 1-50
Macro Instructions
* The macro is not executed when the argument is inappropriate.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Point The state of the operation flag does not change by the MEND instruction.
Sample Program
The sub-routine macro (macro A) is executed with EM0 as argument 1 and #10 as argument 2 when
input relay R000 is ON.
At the rising edge of input relay R001, execution of self-hold macro "Macro B" is started with #1 as
argument 1 (unit No.) and #10 as argument 2.
When input relay R002 is ON, execution of self-hold macro "Macro B" is stopped.
・・・・
マクロB
(Mnemonics list)
FB,FEND,FUN
FB
Function block
Calls the specified function block.
call
APPLIED INSTRUCTIONS
3 〔 …〕
F B S Argument 1 Argument 2
Input1 Output1
InOut1 InOut1
UnitNo
Function Block Instructions
Input1 Output1
F U N 〔
S Argument 1 Argument 2 …〕
InOut1 InOut1
UnitNo
*1 The number of operands other than the function block / function name and the data that can be specified
differ as follows depending on the argument settings set in the function block / function to be executed.
• IN : Devices, variables, labels and constants can be specified.
• OUT : Devices, variables and labels can be specified. Constants cannot be specified.
• IN-OUT : Devices, variables and labels can be specified. Constants cannot be specified.
• Unit : Devices, variables, labels and constants can be specified.
*2 Handling of T, C, TIMER type variables and COUNTER type variables specified for the IN-OUT
argument differs depending on the instruction used in the function block / function.
Example) For the MOV instruction, the current value is handled. For details, refer to the operation
description of the respective instruction.
*3 "", # and $ cannot be used. Directly enter the name of the function block/function set in KV
STUDIO. Up to 64 characters can be entered regardless of full-width or half-width.
Point The FB instruction, FEND instruction and FUN instruction can be used with the KV-8000
series CPU units and KV-7000 Series CPU units with CPU function version 2.0 or later.
"KV-8000 CPU Function Version", page 2
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
FB The function block specified by S starts up when the execution condition is ON.
Execution of the specified function block is started from the scan where the execution
condition changes from OFF to ON.
Once execution starts, the function block continues to be executed even if the execution
condition is OFF.
FEND Function blocks with a FEND instruction written to them stop when the execution
condition is ON.
FUN The function specified by S is executed when the execution condition is ON.
APPLIED INSTRUCTIONS
The OFF process when stopped differs according to the program settings. Refer to the instruction
manual for the CPU unit for details.
Point • Writing in RUN mode is not possible if the number or sequence of calls of the FB
instruction is changed.
• Function block stops in the following cases.
• When the read source program stops
• When a FEND instruction is executed in a function block
• If the FBCALL/FBSTRT/FB instruction execution condition stays ON, the FEND
instruction is ignored.
• The FEND instruction cannot be written in the module or function. 3
• The FEND instruction cannot be used to stop other function blocks.
• In the following cases the function block/function being executed is canceled when FBSTRT
the execution condition for each set of instructions turns OFF. The function block
execution resumes when each set of instructions is executed. The previous state of
differential execution type instructions in function blocks is not initialized at this
time. (If it is written in the initialization module only, 1 scan is executed when
operation starts.)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to sub-routine
(between the SBN~RET instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to conditional branch
(between the CJ/NCJ~LABEL instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to step (between the
STP~STE instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to interrupt (between
the INT~RETI instructions)
• When an FBCALL/FBSTRT/FB instruction is written to stage (between the
STG~JMP instructions)
• FB instructions cannot be used in functions.
• FB/FUN instructions cannot be used in macros.
• FBCALL/FBSTRT/FB/FUN instructions that call the function block/function itself
cannot be used in that function block/function.
• Sub-routine programs can be used in function blocks/functions, but interrupt
program scan not be used.
• When performing a certain function block/function multiple times in a project, the
global devices / global variables / global labels used for the OUT/OUB instruction in a
function block/function will become double coil.
"KV-7000 Series User's Manual"
"KV-8000 Series User's Manual"
Operation flag
CR2009 The state depends on the processing result in the function block/function to execute.
CR2010 The state depends on the processing result in the function block/function to execute.
CR2011 The state depends on the processing result in the function block/function to execute.
ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the unit specified in the "Unit" argument type is not connected
• When the unit specified in the "Unit" argument type and the unit specified in the argument
3
CR2012
settings differ
• When an access outside the operand range occurs
Function Block Instructions
Point The state of the operation flag cannot be changed by the FEND instruction.
Sample Program
Function block "Function block A" execution starts with variable 1 (unit number) as #1 and variable 2 as
DM0 at the rising edge of input relay R000.
Function block "Function block A" stops when input relay R001 is ON.
Function block A
・・・・
(Mnemonics list)
Function "Function B" is executed with variable 1 as EM0 and variable 2 as MR000 when input relay
R002 is on.
R002 Function B
(Mnemonics list)
APPLIED INSTRUCTIONS
MEMO
FBCALL,FBSTRTL
FBCALL
Function block
Calls the specified function block.
call
APPLIED INSTRUCTIONS
FBSTRT
Function block
Calls the specified function block.
start
EN
Input1
EN0
InOut1
F B C A L L S1 S2 〔 Argument 1 Argument 2
…〕
InOut1 Output1
UnitNo
3 Execution condition
S2
S1 ※1
Input1 InOut1
InOut1 Output1
UnitNo
*1 The number (0 to 64) and attributes of arguments from the No.3 operand onwards differ
depending on the argument settings set to the function block to be executed.
*2 Only constants can be specified. Directly enter the function block name (Up to 64 characters
regardless of half-width or full-width) or instance name (Up to 128 characters regardless of half-
width or full-width).
Point The FBCALL instruction and FBSTRT instruction can be used with KV-8000 series
CPU units with CPU function version 2.0 or later.
"KV-8000 CPU Function Version", page 2
Description of Operation
FBCALL When the execution condition is ON, the instances of the function blocks specified by
S1 and S2 are executed by the arguments specified by the third and subsequent
operands.
Execution of the specified function block is started from the scan where the execution
condition changes from OFF to ON.
Once started, the execution of the function block continues while the execution condition
is ON.
When the execution condition turns OFF, the execution of the function block stops.
FBSTRT When the execution condition is ON, the instances of the function blocks specified by
S1 and S2 are executed by the arguments specified by the third and subsequent
operands.
Execution of the specified function block is started from the scan where the execution
condition changes from OFF to ON.
Once execution starts, the function block continues to be executed even if the execution
condition is OFF.
When the function block is stopped, the FEND instruction is executed in the function block.
APPLIED INSTRUCTIONS
The OFF process when stopped differs according to the program settings. For details, refer to the CPU
Unit User's Manual.
• In the following cases, the function block being executed is canceled when the
execution condition for each set of instructions turns OFF. The function block
execution resumes when each set of instructions is executed. The previous state
of differential execution type instructions in function blocks is not initialized at
this time. (If it is written in the initialization module only, 1 scan is executed when
operation starts.)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to sub-routine
(between the SBN~RET instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to conditional
branch (between the CJ/NCJ~LABEL instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to step (between
the STP~STE instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to interrupt
(between the INT~RETI instructions)
• When an FBCALL/FBSTRT/FB instruction is written to stage (between the
STG~JMP instructions)
• FBCALL/FBSTRT/FB instructions cannot be used in functions.
• FBCALL/FBSTRT/FB/FUN instructions cannot be used in macros.
• FBCALL/FBSTRT/FB/FUN instructions that call the function block itself cannot
be used in that function block.
• Sub-routines can be used in function blocks, but interrupt programs cannot be
used.
• When performing a certain function block multiple times in a project, the global
devices / global variables / global labels used for the OUT/OUB instruction in a
function block will become double coil.
"KV-8000 Series User's Manual"
Operation flag
CR2009 The state depends on the processing result in the function block to execute.
CR2010 The state depends on the processing result in the function block to execute.
CR2011 The state depends on the processing result in the function block to execute.
ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the unit specified in the "Unit" argument type is not connected
• When the unit specified in the "Unit" argument type and the unit specified in the argument
3
CR2012
settings differ
• When an access outside the operand range occurs
Function Block Instructions
Point The state of the operation flag cannot be changed by the FEND instruction.
Sample Program
The instance named "Instance A" of the function block "Function Block A" is executed with argument
1(unit number) as #1 and argument 2 as DM0 at the rising edge of input relay R000.
"Instance A" of "Function Block A" stops when input relay R001 is ON.
(Mnemonics list)
The instance named "Instance B" of the function block "Function Block B" is executed with argument 1
as EM0 and argument 2 as MR000 when input relay R002 is ON. Execution stops when input relay
R002 turns OFF.
APPLIED INSTRUCTIONS
MEMO
MDSTRT,MDSTOP
MDSTRT
MDSTRT Starts execution of the
Module execution start
specified module.
APPLIED INSTRUCTIONS
MDSTOP
MDSTOP Stops execution of the
Module execution stop
specified module.
*1 Use of " ", # , $ is not allowed. Directly enter the name of the module set on KV STUDIO.
The number of characters that can be entered is as follows.
• KV-8000、KV-7000 (CPU function version 2.0 or later)
Up to 64 characters regardless of half-width or full-width
• KV-7000 (CPU function version lower than 2.0)
Up to 24 characters regardless of half-width or full-width
• KV-5500/5000/3000/1000, KV Nano Series
Up to 24 half-width alphanumerics, or up to 12 full-width alphanumerics
Description of Operation
MDSTRT When the execution condition is ON, the module specified by S is started.
The specified module starts operating from the next scan.
Nothing happens on modules that are already started up.
MDSTOP When the execution condition is ON, the module specified by S is started.
Nothing happens on modules that are already stopped.
This instruction can also stop the self-module.
The OFF process when stopped differs according to the CPU unit. Refer to the instruction manual for
each CPU unit for details.
Point • The initial state of differential execution type instructions at start of module execution is
ON when the rising edge is detected, and OFF when the falling edge is detected.
Differentiation is never detected immediately when execution is started.
• When the MDSTRT and MDSTOP instructions have been executed multiple times in
the same scan on the same module, execution follows the module instruction that was
last executed.
• Do not stop all modules. All programs will not be executed when all modules have
stopped. So, restore this state by one of the following methods. (Execution cannot be
restored unless program execution is temporarily stopped.)
◆ Turn the CPU unit OFF then back ON again.
◆ Switch the RUN-PROG selector switch on the CPU unit to PROG then back
to RUN again.
◆ Turn the RUN mode of the program OFF then back ON again in KV STUDIO.
Operation flag
APPLIED INSTRUCTIONS
Sample Program
When the rising edge of input relay R000 is detected, the module currently selected by mode switching
(R001 to R003) is executed, and execution of all modules is stopped when input relay R009 turns ON.
During execution of one of the modules, execution of other modules cannot be started.
Module Instructions
R003 MDSTRT MDSTRT Module1
Module3 ③ MRD
AND R002
R009 MDSTOP MDSTRT Module2
Module1 MPP
AND R003
④ MDSTRT Module3
MDSTOP LD R009
Module2 MDSTOP Module1
MDSTOP Module2
MDSTOP MDSTOP Module3
Module3
*1 For details on the module execution ON bit, see "Modules" in the User's Manual of the CPU unit
used.
ZPUSH,ZPOP
ZPUSH.S
ZPUSH ZPUSH.L
ZPUSH
APPLIED INSTRUCTIONS
ZPOP.S
ZPOP ZPOP.L
ZPOP
Index Reads the value of the
register batch index register from the
@ZPOP.S restore specified data block.
3 @ZPOP @ZPOP.L
ZPOP
Index Register Instructions
Description of Operation
ZPUSH.S When the execution condition is ON, the values of the Z1 to Z10 index registers are stored
to the data block specified by D . After the instruction is executed, the value of
[ D +0] is incremented by 1.
bit bit
15 0
bit
15
bit
0
Purge times D +0
Z1 Z1 D +1
Z2 Z2 D +2
…
APPLIED INSTRUCTIONS
ZPUSH.L When the execution condition is ON, the values of the Z1 to Z10 index registers are stored
to the data block specified by D . After the instruction is executed, the value of
[ D +0] is incremented by 1.
bit bit bit bit
31 16 15 0
bit
31
bit bit
16 15
bit
0
Purge times D +0
Z1 Z1 D +2 D +1
Z2 Z2 D +4 D +3
…
…
Z10 Z10 D +20 D +19 3
Reserved for system Reserved for system D +22 D +21
ZPOP.S When the execution condition is ON, the value of the data block (index register stored by
"ZPUSH instruction") specified by D is read to the Z1 to Z10 index registers. After the
instruction is executed, the value of D +0 is decremented by 1.
bit bit
15 0
D +1 Z1 Z1
D +2 Z2 Z2
…
Reserved Reserved
D +12 for system for system
ZPOP.L When the execution condition is ON, the value of the data block (index register stored by
"ZPUSH instruction") specified by D is read to the Z1 to Z10 index registers. After the
instruction is executed, the value of D +0 is decremented by 1.
bit bit bit bit
31 16 15 0
D +1 D +2 Z1 Z1
D +3 D +4 Z2 Z2
…
@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).
Reference • The ZPUSH and ZPOP instructions are programmed nested. When nesting these
instructions, specify the same start.
• KV-8000/7500/7300/5500/5000/3000, KV Nano Series It will become .L when inputting without suffix
specifying.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-57
Index Register Instructions
APPLIED INSTRUCTIONS
• For .L
bit bit bit bit
31 16 15 0
ZPUSH
DM0 3 DM0
Z1 DM1・DM2
ZPUSH
DM0
3 DM0
ZPOP
Reserved for system DM47・DM48
DM0 Z1 DM49・DM50
Index Register Instructions
ZPOP
DM0 Reserved for system DM71・DM72
• For (.S)
bit bit
15 0
ZPUSH
DM0 3 DM0
Z1 DM1
ZPUSH
DM0
…
…
Reserved for
ZPUSH system DM12
DM0
Z1 DM13
ZPOP
…
DM0 …
Reserved for
system DM24
ZPOP
DM0 Z1 DM25
…
ZPOP
Reserved for
DM0 system DM36
Point • [ D +0] should be set to "0" before executing the first ZPUSH instruction. This
is not necessary from the second ZPUSH instruction onwards.
• The ZPUSH and ZPOP instructions are used in pairs.
• Do not write to the range of D occupied by the ZPUSH instruction with other
instructions.
Operation flag
APPLIED INSTRUCTIONS
Sample Program
In the main routine, the values of index registers Z1 and Z2 are executed by +01000 and +02000, and
only in the sub-routine, the values of index registers Z1 and Z2 are executed by +03000 and +04000.
Main routine
メインプログラム
CR2008 #0
DW Resets the number of purges.
DM0
CR2008 +01000
DW.S
+02000
DW.S
Sets the values of index registers
Z1 and Z2 to
3
Z1 Z2
END
サブルーチンプログラム
Subroutine SBN
#0
CR2002 +03000 +04000 Sets the values #3000 and #4000 of index
DW.S DW.S
Z1 Z2 registers Z1 and Z2 to be used in the sub-routine.
CR2002 ZPOP
DM0 Restores the values purged to DM0 onwards to
index registers Z1 to Z10.
RET
Ends the sub-routine.
ENDH
(Mnemonics list)
LD CR2008
DW #0 DM0
LD CR2008
DW.S +1000 Z1
CON
DW.S +2000 Z2
CALL #0
END
SBN #0
LD CR2002
ZPUSH DM0
LD CR2002
DW.S +3000 Z1
CON
DW.S +4000 Z2
LD CR2002
ZPOP DM0
RET
ENDH
ADRSET ADRSET
Stores the address of the
APPLIED INSTRUCTIONS
Set address
target to be indirectly specified
@ADRSET ADRSET
Description of Operation
ADRSET When the execution condition is ON, the address of S is stored in [ D / D +1]
since indirect specification of S is performed. (The value to store is not the value of
S )
When "* D " is specified to the operand by an instruction (MOV, INC, ADD) that can be
indirectly specified after the ADRSET instruction, this means that S has been specified.
The "address" of S and not the value of
D +1 D
S is stored to [ D ・ D +1]
S Sのアドレス
Address of ※
S*
@ADRSET This instruction is executed for one scan at the rising edge of the execution condition.
Operation cannot be assured when the following operation is not followed. (Some device /
variable values may be corrupted to prevent ladders from operating normally).
• Before using * D , be sure to set the address to D by the ADRSET instruction.
NOTICE • Never generate or manipulate addresses by any means other than the ADRSET,
ADRINC, ADRADD, ADRDEC, and ADRSUB instructions.
• However, execution is possible when the address is copied (the contents of the address
do not change) with the MOV instruction, etc.
APPLIED INSTRUCTIONS
Operation flag
Sample Program
When input relay R000 is ON, store the value of DM0 in DM100.
(Mnemonics list)
R000 ADRSET
DM0 DM500 ① LD R000
ADRSET DM0 DM500
MOV *DM500 DM100
MOV
*DM500 DM100 ②
When input relay R000 is ON, store the #12345 in DM0 and the #56789 in DM5.
(Mnemonics list)
R000 ADRSET
DM0 DM500 ① LD R000
ADRSET DM0 DM500
MOV #12345 *DM500
MOV MOV.S +5 Z1
#12345 *DM500 ② MOV #56789 *DM500:Z1
MOV.S
+5 Z1 ③
MOV
#56789 *DM500 : Z1 ④
ADRINC ADRINC
Increment address
Address incremented by
APPLIED INSTRUCTIONS
1.
@ADRINC ADRINC
ADRDEC ADRDEC
Decrement address
Address decremented by
1.
@ADRDEC ADRDEC
Description of Operation
ADRINC When the execution condition is ON, the address currently stored in D is
incremented by 1.
D +1 D D +1 D
Address Address+1
ADRDEC When the execution condition is ON, the address currently stored in D is
decremented by 1.
D +1 D D +1 D
Address Address−1
@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).
Operation cannot be assured when the following operation is not followed. (Some device /
variable values may be corrupted to prevent normal operation).
NOTICE
• Never generate or manipulate addresses by any means other than the
ADRSET,ADRINC, ADRADD, ADRDEC, and ADRSUB instructions.
APPLIED INSTRUCTIONS
Operation flag
Sample Program
ADRINC When input relay R000 is ON, store the value of DM0 to DM100 and the value of DM1 toDM101.
(Mnemonics list)
R000 ADRSET
DM0 DM500 ① LD R000
ADRSET DM0 DM500
MOV MOV *DM500 DM100
② ADRINC DM500
*DM500 DM100
MOV *DM500 DM101
ADRINC
DM500 ③
MOV
*DM500 DM101 ④
ADRDEC When input relay R000 is ON, store the value of DM20 to DM100 and the value of DM19
to DM101.
(Mnemonics list)
R000 ADRSET
DM20 DM500 ① LD R000
ADRSET DM20 DM500
MOV MOV *DM500 DM100
② ADRDEC DM500
*DM500 DM100
MOV *DM500 DM101
ADRDEC
DM500 ③
MOV
*DM500 DM101 ④
ADRADD(.S)
ADRADD ADRADD.L ADRADD
APPLIED INSTRUCTIONS
Address
Add the address.
@ADRADD(.S)
addition
@ADRADD @ADRADD.L ADRADD
ADRSUB ADRSUB(.S)
ADRSUB.L
ADRSUB
Address
Subtract the address.
@ADRSUB(.S)
subtraction
APPLIED INSTRUCTIONS
Description of Operation
ADRADD(.S) When the execution condition is ON, the address currently stored in D is added
to the value of S .
D +1 D S D +1 D
Address + Value of S Address+Value of S
ADRSUB(.S) When the execution condition is ON, the value of S is subtracted from the
address stored in D .
D +1 D S D +1 D
Address − Value of S Addres + Value of S
ADRSUB.L When the execution condition is ON, the value of [ S / S +1] is subtracted
from the address stored in D .
D +1 D S +1 S D +1 D
Address − Signed 32-bit BIN data Addres + Value of S
@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).
Operation cannot be assured when the following operation is not followed. (Some device /
variable values may be corrupted to prevent normal operation).
NOTICE
• No other methods other than using the ADRSET/ADRINC/ADRADD/ADRDEC/
ADRSUB instructions are allowed to generate and operate addresses.
Point For the ADRSUB instruction, if the value of S is -32768, then the reference
destination D is -32768.
Operation flag
Sample Program
ADRADD When input relay R000 is ON, store the value of DM0 in DM100.
(Mnemonics list)
R000 ADRSET
DM0 DM500 ① LD R000
ADRSET DM0 DM500
ADRADD +5 DM500
ADRADD MOV *DM500 DM100
+5 DM500 ②
MOV
*DM500 DM100 ③
ADRSUB When input relay R000 is ON, store the value of DM0 in DM100.
(Mnemonics list)
R000 ADRSET
DM10 DM500 ① LD R000
ADRSET DM10 DM500
ADRSUB +5 DM500
ADRSUB MOV *DM500 DM100
+5 DM500 ②
MOV
*DM500 DM100 ③
APPLIED INSTRUCTIONS
MEMO
FRSET FRSET
File register groups
Switch the current bank No.
of the file register to the
APPLIED INSTRUCTIONS
witching
@FRSET FRSET specified No.
Description of Operation
FRSET When the execution condition is ON, switch the current bank No. of the file register to the
specified No. of n .
@FRSET This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
When input relay R000 is ON at the rising edge, switch the current group of file register to Group 1.
APPLIED INSTRUCTIONS
MEMO
KV-8000/7500/KV-7300
3
n1 n2 S D F R S T M n1 n2 S D
File Register Instructions
KV-5500/5000/3000
Description of Operation
FRSTM At the rising edge of execution condition, it will save all file registers of the bank No.
n2 in batch to the storage (memory card for KV-5000/3000 series) specified by n1
in binary format (the file will always be overwritten).
File No. S is specified with number.
The created file is named as \FR\FR (file No. is 3-digit).FRU*.
*The file extension for KV-5500/5000/3000 is FRB.
Create a new folder if there is no "FR" folder.
The end notification is written in D , and the error notification of abnormal end is
written in [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions", page 5-154
Point The command will not be executed when the storage device instructions in
execution relay (CR3214) is ON. Please implement exclusive control using CR3214.
APPLIED INSTRUCTIONS
Operation flag
Sample Program
When input relay R000 is ON at the rising edge, store the file register of Group 0 into the memory card
with the file No. 10.
(Mnemonics list)
KV-8000/7500/7300
LDP R000
R000 CR3214 FRSTM ANB CR3214
#0 #0 #10 MR000 FRSTM #0 #0 #10 MR000
(Mnemonics list)
KV-5500/5000/3000
LDP R000
ANB CR3214
R000 CR3214 FRSTM FRSTM #0 #10 MR000
#0 #10 MR000
FRLDM
Batch read file memory card (CPU memory)
For KV-5000 / 3000 series register into the file register of the
FRLDM specified group.
KV-8000/7500/7300
3
n1 n2 S D F R L D M n1 n2 S D
File Register Instructions
KV-5500/5000/3000
Description of Operation
FRLDM It will read the data saved in the storage (memory card for KV-5000/3000 series) specified
by n1 to the file register of the bank No. n2 in batch (according to the FRSTM
instruction or the "File Register Settings" of KV STUDIO) at the rising edge of the
execution condition. (The file will always be overwritten).
File No. S is specified with number.
The read file is named as \FR\FR (file No. is 3-digit).FRU*.
*The file extension for KV-5500/5000/3000 is FRB.
The end notification is written in D , and the error notification of abnormal end is
written in [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions", page 5-154
Point The command will not be executed when the storage device instructions in
execution relay (CR3214) is ON. Please implement exclusive control using CR3214.
3-72 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
File Register Instructions
APPLIED INSTRUCTIONS
Operation flag
Sample Program
When input relay R000 is ON at the rising edge, read the data of file No. 10 in the memory card into the
file register of Group 0.
(Mnemonics list)
KV-8000/7500/7300
LDP R000
R000 CR3214 ANB CR3214
FRLDM
FRLDM #0 #0 #10 MR000
#0 #0 #10 MR000
(Mnemonics list)
KV-5500/5000/3000
LDP R000
R000 CR3214 FRLDM ANB CR3214
#0 #10 MR000 FRLDM #0 #10 MR000
D2
Point • The UPSTRT instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UPSTRT instruction can be used with the KV-8000 series CPU units and KV-
7000Series CPU units that have CPU function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
At the rising edge of the execution condition, the unit program specified by S in the No. n1 unit
starts according to the parameters specified by S +2.
If the 0 bit of S +3 is OFF, an assignable empty slot is automatically used.
If the 0 bit of S +3 is ON, the slot specified by S +1 is used.
When the instruction is complete, the used slot number is stored in D1 , and the execution results
are stored in D2 and D2 +1.
S ~: Request details
APPLIED INSTRUCTIONS
D2 ~: Execution result storage destination
Execution result storage destination Content
Turns OFF when executing the instruction, turns ON when
Completion
0 bits complete. Turns ON regardless of whether the instruction ends
bit
D2 normally or abnormally.
Execution If memory cannot be allocated, turns ON simultaneously with the
1 bit
failed bit completion bit. Turns OFF when executing the instruction
3
The completion code is stored when the instruction is complete.
0 : Started normally.
1 : The specified unit program does not exist.
ON
Execution condition
OFF
ON
Execution failed bit
OFF
(specified in the instruction)
ON
Completion bit
OFF
(specified in the instruction)
If the unit program start instruction is executed at the rising edge of the execution condition, the process
will continue even if the input conditions are turned OFF at the next scan.
The completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.
When the instruction is executed, 1 is added to the number of unit program instructions being executed,
and is subtracted when execution is complete.
3 Instructions that are put into standby will be executed when there are 15 or fewer instructions being
executed, regardless of whether the execution condition turns OFF during standby.
Unit Program Instructions
Unit program instructions are executed between the rising edge of the execution condition and when
the completion bit turns ON. If the execution condition turns OFF part way through, they will be counted
as instructions being executed until the completion bit turns ON. If the execution condition turns ON, the
completion bit will always turn ON at some point.
After the completion bit turns ON, even if the execution condition turns ON continuously, the instruction
will not be counted as an instruction being executed.
Scan
ON
Execution condition
OFF
* The number of unit program instruction executions is the total number of UPSTRT/UPSTOP/
UFSUS/UFRSM/UMALLOC instructions being executed.
Operation flag
APPLIED INSTRUCTIONS
Sample Program
MR000 is turned ON, and the number 0 unit program on the KV-XH16ML connected to unit No. 1 is
started from block number 2. An An assignable slot number is automatically stored in DM10. If the unit
program fails to start, a completion code is stored in DM12.
(Mnemonics list)
MR000 MOV
#0 DM0 LD MR000
Program number MOV #0 DM0
MOV
#2 DM2
MOV #2 DM2
RES DM3.0
UPSTRT #1 DM0 DM10 DM11
3
LDP DM11.0
DM11.1 MOV
DM12 DM21
Execution failed bit Completion code
3 n2
D
Specifies the storage location for the slot number to stop forcefully.
Specifies the start to store the results.
16 bits
16 bits x2
Unit Program Instructions
Point • The UPSTOP instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UPSTOP instruction can be used with the KV-8000 series CPU units and KV-
7000Series CPU units that have CPU function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
At the rising edge of the execution condition, the unit program being executed in the slot specified by
n2 in the No. n1 unit is stopped forcefully, and the slot becomes empty.
When the instruction is complete, the execution results are stored in D and D +1.
Point There is a limit to the number of unit program instructions including UPSTOP instructions
that can be executed simultaneously.
"Number of unit program instructions that can be executed simultaneously", page 3-76
APPLIED INSTRUCTIONS
D ~: Execution result storage destination
Operation flag
Sample Program
MR000 is turned ON, and the flow being executed in the number 0 slot on the KV-XH16ML connectedto
unit No.
(Mnemonics list)
MR000 UPSTOP
#1 #0 DM0 LD MR000
KV-XH16ML UPSTOP #1 #0 DM0
slot.
UFRSM UFRSM
Resume flow Resume a suspended flow.
3 n1 n2 D U F R S M n1 n2 D
Point • The UFSUS instruction/UFRSM instruction can be used on KV STUDIO Ver. 9.0 or
later only.
• The UFSUS instruction/UFRSM instruction can be used with the KV-8000 series CPU
units and KV-7000 Series CPU units that have CPU function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
UFSUS At the rising edge of the execution condition, the flow being executed in the slot specified
by n2 in the No. n1 unit is suspended according to the method specified in n3 .
When the instruction is complete, the execution results are stored in D and D +1.
UFRSM At the rising edge of the execution condition, the suspended flow in the slot specified by
n2 in the No. n1 unit is resumed.
When the instruction is complete, the execution results are stored in D and D +1.
n3 : Request details
APPLIED INSTRUCTIONS
D ~: Execution result storage destination
Point There is a limit to the number of unit program instructions including UFSUS/UFRSM
instructions that can be executed simultaneously.
"Number of unit program instructions that can be executed simultaneously", page 3-76
Operation flag
Sample Program
MR000 is turned ON, and the flow being executed in the number 0 slot on the KV-XH16ML connectedto
unit No. 1 is suspended. MR001 is turned ON and the suspended flow is resumed.
(Mnemonics list)
MR000 UFSUS
#1 #0 #1 DM0 LD MR000
KV-XH16ML UFSUS #1 #0 #1 DM0
LD MR001
MR001 UFRSM UFRSM #1 #0 DM10
3 #1
KV-XH16ML
#0 DM10
Unit Program Instructions
APPLIED INSTRUCTIONS
MEMO
3
Cannot be specified by "$". (1 to 48)
Specifies the reference destination in which the number of words to
n2 16 bits
allocate is stored.
Unit Program Instructions
Point • The UMALLOC instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UMALLOC instruction can be used with the KV-8000 series CPU units and KV-
7000 Series CPU units that have CPU function version 2.0 or later only.
"KV-8000 CPU Function Version", page 2
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
At the rising edge of the execution condition, an area of the number of words specified by n2 from
the buffer memory of the No. n1 unit is allocated. The start address of the allocated area is stored in
D2 and the execution results are stored in D1 .
If allocation fails, #0 is stored in D2 .
Point There is a limit to the number of unit program instructions including UMALLOC
instructions that can be executed simultaneously.
"Number of unit program instructions that can be executed simultaneously", page 3-76
APPLIED INSTRUCTIONS
Operation flag
3
• When the unit with the unit number specified by n1 is not a KV-8000/7000 Series
high performance expansion unit (X-Unit)
CR2012 • When a 16-bit area cannot be allocated when bit data was specified in n1 and n2
Sample Program
MR000 is turned ON, and 1000 words of the buffer memory of the KV-XH16ML connected to unit No.
1is allocated.
(Mnemonics list)
MR000 UMALLOC
#1 #1000 DM0 DM1 LD MR000
KV-XH16ML UMALLOC #1 #1000 DM0 DM1
UREAD(.U)
UREAD.S
APPLIED INSTRUCTIONS
U R E A D n1 n2 D n3
n1 n2 D n3
( F R O M n1 n2 D n3 )
*1 For KV-5500/5000/3000 and KV Nano series, specify a value within the range of 0 to 32767 for
n2 and 1 to 32768 for n3 .
Description of Operation
Read the data in buffer memory of expansion special unit into the storage location.
For the contents in buffer memory, refer to User's Manual of corresponding units.
UREAD(.U) When the execution condition is ON, n3 words of data are read from the address
UREAD.S specified by n2 of the buffer memory in No. n1 expansion unit, and are stored
staring from D .
UREAD.D When the execution condition is ON, n3 ×2 words of data are read from the address
UREAD.L specified by n2 of the buffer memory in No. n1 expansion unit, and are stored
UREAD.F staring from D .
@UREAD.□ This instruction is executed for one scan at the rising edge of the execution condition.
APPLIED INSTRUCTIONS
Operation flag
Sample Program
It will read out the data of input capture at the start-up of IN000, input capture of fall time ofKV-SIR32XT
connected to unit No.1 to DM0 to DM1, DM2 to DM3.
(Mnemonics list)
5 85($'/
'02
LD R30000
UREAD.L #1 #0 DM0 #2
UWRIT(.U)
UWRIT.S
APPLIED INSTRUCTIONS
U W R I T n1 n2 S n3
n1 n2 S n3
( T O n1 n2 S n3 )
*1 For KV-5500/5000/3000 and KV Nano series, specify a value within the range of 0 to 32767 for
n2 and 1 to 32768 for n3 .
Description of Operation
Write data into the specified buffer memory area of expansion special unit.
For the contents in buffer memory, refer to User's Manual of corresponding units.
UWRIT(.U) When the execution condition is ON, n3 words of data starting from S are
UWRIT.S written into the buffer memory area starting from the address specified by n2 in
No. n1 expansion unit.
UWRIT.D When the execution condition is ON, n3 ×2 words of data starting from S are
UWRIT.L written into the buffer memory area starting from the address specified by n2 in
UWRIT.F No. n1 expansion unit.
@UWRIT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point If a constant is specified in S , write the specified value into all spaces. (same
operation with UFILL instruction)
"UFILL instruction", page 3-90
APPLIED INSTRUCTIONS
Operation flag
Sample Program
DM0 to DM1 will be written to the cycle of PWM0 of KV-SIR32XT connected to unit No.1.
(Mnemonics list)
5 8:5,7'
'02
LD R30000
UWRIT.D #1 #258 DM0 #1
UFILL(.U)
UFILL.S
APPLIED INSTRUCTIONS
U F I L L n1 n2 S n3
n1 n2 S n3
*1 For KV-5500/5000/3000 and KV Nano series, specify a value within the range of 0 to 32767 for
n2 and 1 to 32768 for n3 .
Description of Operation
Same 16/32-bit data are written in batch in the buffer memory area of the expansion special unit.
For the contents in buffer memory, refer to User's Manual of corresponding units.
UFILL(.U) When the execution condition is ON, 16-bit BIN data specified by S is written into
UFILL.S the area of n3 words from the address specified by n2 of the buffer memory in
the No. n1 expansion unit.
UFILL.D When the execution condition is ON, 32-bit BIN data specified by S is written into
UFILL.L the area of n3 ×2 words from the address specified by n2 of the buffer memory in
UFILL.F the No. n1 expansion unit.
@UFILL.□ This instruction is executed for one scan at the rising edge of the execution condition.
APPLIED INSTRUCTIONS
Operation flag
Sample Program
It writes "0" to the data memory range worth 16 characters for cyclic transmission of CPU internal
Ethernet port (during the configuration of FL-net) of KV-5000.
3 n
Specifies the number of dimensions (1 to 8) to get the number 16 bits
of elements.
D Specifies the result storage location. 32 bits
Size Acquisition Instructions
*1 Only array type variable name can be specified in S . Variables other than arrays or elements
other than variables cannot be specified.
*2 Variable-length array of FB argument cannot be specified.
Point The ACNT instruction can be used only with KV-8000 with CPU function version 2.0
or later.
Description of Operation
ACNT When the execution condition is ON, the number of elements in the No. n dimension
of the array specified by S is stored in [ D / D +1].
Point The ACNT instruction obtains the number of elements instead of the word size. For
example, when UDINT (2-word unsigned integer) is specified as 4 dimensions, 4 is
stored in [ D / D +1]. Word size 8 is not stored.
APPLIED INSTRUCTIONS
Operation flag
Sample Program
At the rising edge of input relay R000, the number of elements in the second dimension of 5×4 two-
dimensional array Array_A is stored in DM0. Then, 0 is stored in Array_A[4,0],
Array_A[4,1]…Array_A[4,3].
CR2002 MOV. D
#0 Array_A[#4, idx]
Always ON
idx
INC. D
NEXT
specified variable.
3 *1
D Specifies the result storage location.
Point The WSIZE instruction can be used only with KV-8000 with CPU function version
2.0 or later.
Description of Operation
WSIZE When the execution condition is ON, the word size occupied by S is stored in [ D /
D +1].
member3 REAL
Point • The WSIZE instruction obtains the word size. For example, when an array type
variable or structure type variable with 4 UDINT type data (2-word unsigned
integer) is specified, 8 is stored in [ D / D +1] as 2 words × 4 = 8 words. The
number of elements or the number of members is not stored.
• D stores the word size including the offset. For details on the offset, refer to
the User's Manual of the CPU unit used.
Operation flag
APPLIED INSTRUCTIONS
Sample Program
The word size occupied by the variable "Products_A" is calculated at the rising edge of input relay
MR000 and stored in DM0. Then, 0 is stored in the area occupied by "Products_A".
3
#0 Products_A DM0
Point The above reference program can be used only when the word size of the variable is
BSIZE
BSIZE Get the bit size occupied by the
Get bit size
APPLIED INSTRUCTIONS
specified variable.
3 *1
D Specifies the result storage location.
Point The BSIZE instruction can be used only with KV-8000 with CPU function version 2.0
or later.
Description of Operation
BSIZE When the execution condition is ON, the bit size occupied by S is stored in [ D /
D +1].
D +1 D
Number of elements 20
→ The number of elements is 20 for the INT type (16 bits), so 16 bits × 20 = 320 bits
[ D / D +1] stores the bit size including the offset. For details on the offset,
Point
refer to the User's Manual of the CPU unit used.
Operation flag
APPLIED INSTRUCTIONS
Sample Program
The bit size occupied by the array type variable "ResultBits" is calculated at the rising edge of input
relay MR000 and stored in DM0. The end number of the array is stored in the UDINT type variable du
Size Of Bit, and all bits of "ResultBits" are reset.
3
BSIZE ResultBits DM0
― .L DM0 +1 duSizeOfBit
CAL-.L DM0 +1 duSizeOfBit
ZRES ResultBits[#0] ResultBits[duSizeOfBit]
• The unit type judgment instruction can be used with the KV-8000 series CPU unit
sand KV-7000 Series CPU units that have CPU function version 2.1 or later only.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
The unit type of the No. n unit is checked at the rising edge of the execution condition, and D
turns ON if it matches the unit type corresponding to the instruction. D turns OFF if there is no
match or if it is not connected.
Operation flag
Sample Program
Checks if the unit connected to unit No.1 is KV-XH16ML on the first scan of the function block, and
stores the result in MR000.
ARITHMETIC OPERATION
INSTRUCTIONS
ARITHMETIC OPERATION
INSTRUCTIONS
These instructions are for executing comparisons, arithmetical calculations,
logical calculations, data transfer, and text string processing.
These instructions allow you to program the complex arithmetic calculation
circuits simply.
MOV(.U)
MOV.S
MOV.D
MOV
MOV
MOV.L
MOV.F
ARITHMETIC OPERATION
MOV.DF
Data move Stores 16/32/64-bit data.
@MOV(.U)
@MOV.S
INSTRUCTIONS
@MOV.D
@MOV
MOV
@MOV.L
@MOV.F
@MOV.DF
4
Ladder program Input mode
Execution condition MOV
S D M O V S D
Data Move Instructions
Description of Operation
MOV(.U) When the execution condition is ON, 16-bit unsigned BIN data currently stored in S is
stored to D .
MOV.S When the execution condition is ON, 16-bit signed BIN data currently stored in S is
stored to D .
ARITHMETIC OPERATION
Example MOV
#12345 DM100
When the constant is specified to S
INSTRUCTIONS
Data memory status before executing instruction Data memory status after executing instruction
DM99: 0 DM99: 0
DM101: 0 DM101: 0
DM102:
16-bit
(1 word)
0 DM102: 0
4
Data memory status before executing instruction Data memory status before executing instruction
DM98: 0 DM98: 0
DM100: 0 DM100: 0
DM102: 0 DM102: 0
16-bit
(1 word)
MOV.D When the execution condition is ON, 32-bit unsigned BIN data currently stored in [ S /
S +1] is stored to [ D / D +1].
MOV.L When the execution condition is ON, 32-bit signed BIN data currently stored in [ S /
S +1] is stored to [ D / D +1].
Example MOV.D
When the constant is specified to S #12345678 DM14
Data memory status before executing instruc Data memory status after executing instruction
Higher bit Lower bit Higher bit Lower bit
DM11: 0 :DM10 S DM11: 0 :DM10
DM13: 0 :DM12 : #12345678 DM13: 0 :DM12
DM15: 0 :DM14 Transfer DM15: 12345678 :DM14 : [ D ・ D +1]
DM17: 0 :DM16 DM17: 0 :DM16
DM19: 0 :DM18 DM19: 0 :DM18
32-bit
(2 words)
Data memory status before executing instruction Data memory status after executing instruction
Higher bit Lower bit Higher bit Lower bit
DM11: 0 :DM10 DM11: 0 :DM10
DM13: 12345678 :DM12 : [ S ・ S +1] DM13: 12345678 :DM12
DM15: 0 :DM14 DM15: 0 :DM14
DM17: 0 :DM16 Transfer DM17: 12345678 :DM16 : [ D ・ D +1]
MOV.F When the execution condition is ON, single precision floating point type real number
specified by S is stored to D .
ARITHMETIC OPERATION
Example MOV.F
When the constant is specified to S
+1.234 DM14
INSTRUCTIONS
Data memory status before executing instruction Data memory status after executing instruction
DM11: 0 :DM10 S :1.234 DM11: 0 :DM10
4
32-bit (2 words)
MOV.F
When the device No. is specified to S
DM12 DM16
Data Move Instructions
Data memory status before executing instruction Data memory status after executing instruction
DM11: 0 :DM10 DM11: 0 :DM10
32-bit (2 words)
MOV.DF When the execution condition is ON, double precision floating point type real number
specified by S is stored to D .
Data memory status before executing instruction Data memory status after executing instruction
DM13: 0 :DM10 S :+1.23456789 DM13: 0 :DM10
64-bit (4 words)
MOV.DF
When the device is specified to S
DM14 DM22
Data memory status before executing instruction Data memory status after executing instruction
64-bit (4 words)
@MOV.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
When input relay R000 is ON, the content of DM0 is moved to DM100.
(Mnemonics list)
R000 MOV
LD R000
DM0 DM100
MOV DM0 DM100
1110101010101010 DM0
Reference When the bit data specified by the No.1 operand straddles channels, the states of the 16
bits straddling the channels is stored to DM0.
1ch 0ch
→ (Mnemonics list)
R102 → R003
CR2002 MOV 1110101010101010 Input relay LD CR2002
R003 DM0 MOV R003 DM0
MOV
1110101010101010 DM0
Reference When the bit data specified by the No.2 operand straddles channels, the data is stored to
the 16 bits straddling the channels.
(Mnemonics list)
CR2002 MOV 1110101010101010 DM0
DM0 R1005 LD CR2002
R1104
11ch 10ch
→
→ MOV
R1005
MOV DM0 R1005
1110101010101010 Internal auxiliary relay
LDA(.U)
LDA.S
LDA.D
LDA LDA.L
LDA.F
LDA
ARITHMETIC OPERATION
LDA.DF
Load A Stores data to internal registers.
@LDA(.U)
@LDA.S
INSTRUCTIONS
@LDA.D
@LDA @LDA.L
@LDA.F
LDA
@LDA.DF
4
Ladder program Input mode
Execution condition S
LDA STA L D A S
Data Move Instructions
Execution condition S
LDA STA @ L D A S
Description of Operation
LDA(.U) When the execution condition is ON, 16-bit unsigned BIN data specified by S is
stored to the 16-bit internal register.
S 16-bit internal registe
1234 → 1234
16-bit 16-bit
(1 word) (1 word)
LDA.S When the execution condition is ON, 16-bit signed BIN data specified by S is stored
to the 16-bit internal register.
S 16-bit internal registe
−1234 → −1234
16-bit 16-bit
(1 word) (1 word)
LDA.D When the execution condition is ON, 32-bit unsigned BIN data specified by [ S /
S +1] is stored to the 32-bit internal register.
S +1 S 32-bit internal register
12345678 → 12345678
32-bit 32-bit
(2 words) (2 words)
LDA.L When the execution condition is ON, 32-bit signed BIN data specified by [ S /
S +1] is stored to the 32-bit internal register.
ARITHMETIC OPERATION
S +1 S 32-bit internal register
−12345678 → −12345678
32-bit 32-bit
INSTRUCTIONS
(2 words) (2 words)
LDA.F When the execution condition is ON, single precision floating point type real number
specified by S is stored to the 32-bit internal register.
S : +1.234
32-bit internal register
+1.234
4
+1.234 +1.234
32-bit
32-bit
(2 words)
LDA.DF When the execution condition is ON, double precision floating point type real number
specified by S is stored to the 64-bit internal register.
S : +1.23456789 +1.23456789
64-bit
+1.23456789 +1.23456789
64-bit
64-bit
(4 words)
@LDA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
See the sample program for the STA instruction.
"STA instruction sample program", page 4-12
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
STA(.U)
STA.S
STA.D
STA STA.L
STA.F
STA
ARITHMETIC OPERATION
STA.DF
Read data from internal registers
Store A and store it to the specified
@STA(.U) reference destination.
@STA.S
INSTRUCTIONS
@STA.D
@STA @STA.L
@STA.F
STA
@STA.DF
4
Ladder program Input mode
Execution condition D
LDA STA S T A D
Data Move Instructions
Execution condition D
LDA STA @ S T A D
Description of Operation
STA(.U) When the execution condition is ON, 16-bit unsigned BIN data currently stored in the 16-
bit internal register is stored to D .
STA.S When the execution condition is ON, 16-bit signed BIN data currently stored in the 16-bit
internal register is stored to D .
STA.D When the execution condition is ON, 32-bit unsigned BIN data currently stored in the 32-
bit internal register is stored to [ D / D +1].
32-bit internal register D +1 D
12345678 → 12345678
32-bit 32-bit
(2 words) (2 words)
STA.L When the execution condition is ON, 32-bit signed BIN data currently stored in the 32-bit
internal register is stored to [ D / D +1].
ARITHMETIC OPERATION
32-bit internal register D +1 D
−12345678 → −12345678
32-bit 32-bit
INSTRUCTIONS
(2 words) (2 words)
STA.F When the execution condition is ON, single precision floating point type real number
currently stored in the internal register is stored to [ D / D +1].
@STA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
STA instr
Sample Program
ARITHMETIC OPERATION
When input relay R000 is OFF, the setting value of timer T0 is changed to the value currently stored
toDM0.
(Mnemonics list)
R000 #100 T0
LDA STA LD R000
LDA #100
4
CON
R000 DM0 T0 STA T0
LDA STA LDB R000
LDA DM0
Data Move Instructions
CON
STA T0
Point About the current value when the setting value has been changed
• When the current value > setting value as a result of having executed the STA
instruction, the current value is changed to the same value as the setting value.
STA
1110101010101010 DM0
R515
STA R500
Reference When the bit data specified by the LDA operand straddles channels, the states of the 16
bits straddling channels are stored to the internal register
ARITHMETIC OPERATION
1ch 0ch
→ (Mnemonics list)
R102 → R003
CR2002 R003 DM0 1110101010101010 Input relay LD CR2002
LDA STA LDA R003
INSTRUCTIONS
LDA
CON
1110101010101010
16-bit
internal register
STA DM0
STA
1110101010101010 DM0
Reference KV-1000 When the bit data specified by the STA operand straddles channels, the data is
stored to bits straddling channels.
(Mnemonics list)
4
CR2002 DM0 R503 1110101010101010 DM0
PLDA(.U)
PLDA PLDA.D PSTA
Only the specified bits of
Partial load the data are stored in
@PLDA(.U) internal register.
@PLDA
ARITHMETIC OPERATION
@PLDA.D PSTA
Execution condition S
PLDA STA P L D A S n
n
Execution condition S
PLDA STA @ P L D A S n
n
Description of Operation
PLDA(.U) S For bit data
When the execution condition is ON, the n bits from S are stored to the 16-bit
internal register. For the unspecified high bits side, 0 is stored.
0001111010101010 0000000101010101
0000111101010101 0000000101010101
ARITHMETIC OPERATION
the 32-bit internal register. For the unspecified high bits side, 0 is stored.
S 32-bit internal register
bit bit
31 0
INSTRUCTIONS
00011110101010101010101010101010 00000001010101010101010101010101
00011101010101010101010101010101 00000001010101010101010101010101
@PLDA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 DMO
PLDA STA LD CR2002
#8 PLDA R000 #8
常時ON CON
STA DM0
PSTA(.U)
PSTA PSTA.D PSTA
Read the specified number
of bits from the internal
Partial store register and store it in the
@PSTA(.U) specified reference
@PSTA
ARITHMETIC OPERATION
Execution condition D
LDA PSTA P S T A D n
n
Execution condition D
LDA PSTA @ P S T A D n
n
Description of Operation
PSTA(.U) D For bit data
When the execution condition is ON, the number of bits specified by n from the LSB
of the 16-bit unsigned BIN data stored in the 16-bit internal register is stored starting with
D .
0000000101010101 0001111010101010
0000000101010101 0000111101010101
ARITHMETIC OPERATION
of the 32-bit unsigned BIN data stored in the 32-bit internal register is stored starting with
D .
D
INSTRUCTIONS
bit 32-bit internal register bit
31 0
00000001010101010101010101010101 00011110101010101010101010101010
00000001010101010101010101010101 00011101010101010101010101010101
@PSTA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 DMO
LDA PSTA LD CR2002
#8 LDA R000
Always ON CON
PSTA DM0 #8
TMIN TMIN
Trimmer capacitor value
Inputs numerical values set by the
digital trimmer capacitor in the
storage access window to an internal
@TMIN TMIN
register.
ARITHMETIC OPERATION
T M I N n
Execution condition n
TMIN STA.D @ T M I N n
Description of Operation
TMIN When the execution condition is ON, the value of the digital trimmer is stored to the 32-bit
internal register.
For details on the functions and how to operate the digital trimmer in the access window,
see "Access Window" in the User's Manual of the CPU unit used.
@TMIN This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the value captured from the digital trimmer is "0". Otherwise, OFF.
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
DW(.U)
DW.S
DW.D
DW DW.L
DW.F
DW
ARITHMETIC OPERATION
DW.DF
Write data Store the constants to the reference
@DW(.U) memory destination.
@DW.S
INSTRUCTIONS
@DW.D
@DW @DW.L
@DW.F
DW
@DW.DF
4
Ladder program Input mode
Execution condition S
DW D W S D
Data Move Instructions
Execution condition S
DW @ D W S D
D
Operand Explanation Occupied size
S Specifies the constant to store.*1 —
.U .S 16 bits
D Specifies the storage location for the constant. .D .L .F 32 bits
.D 64 bits
Description of Operation
ARITHMETIC OPERATION
DW(.U) When the execution condition is ON, 16-bit unsigned BIN data specified by S is
stored to D .
INSTRUCTIONS
S D
1234 1234
16-bit
(1 word)
DW.S When the execution condition is ON, 16-bit signed BIN data specified by S is stored
to D .
S D 4
−1234 −1234
DW.D When the execution condition is ON, the 32-bit unsigned BIN data specified by S is
stored to [ D / D +1].
S D +1 D
12345678 12345678
32-bit
(2 words)
DW.L When the execution condition is ON, 32-bit signed BIN data specified by S is stored
to [ D / D +1].
S D +1 D
−12345678 −12345678
32-bit
(2 words)
DW.F When the execution condition is ON, single precision floating point type real number
specified by S is stored to [ D / D +1].
S D +1 D
+1.2345 +1.2345
32-bit
(2 words)
DW.DF When the execution condition is ON, double precision floating point type real number
specified by S is stored to [ D / D +1/ D +2/ D +3].
S D +3 D +2 D +1 D
+1.23456789 +1.23456789
64-bit (4 words)
@DW.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
Sample Program
When input relay R000 turns ON, #100 is stored to data memory DM0.
(Mnemonics list)
R000 #100
DW LDP R000
DM0 DW #100 DM0
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
BMOV(.U)
BMOV
BMOV
BMOV.D
Moves 16/32-bit data
Block
in blocks to the
@BMOV(.U) move
reference destination.
@BMOV
BMOV
ARITHMETIC OPERATION
@BMOV.D
.U 16 bits× n
D Specifies the start of the move destination data block.
.D 32 bits× n
Specifies the number of data items to move (1 to 65535: 16-bit
n 16 bits
unsigned BIN)
Description of Operation
BMOV(.U) When the execution condition is ON, the content of n words starting from S is
moved in a block to n words starting from D .
S Transfer D
S +1 Transfer D +1
S +2 Transfer D +2
...
...
...
S + n -2 Transfer D + n -2
S + n -1 Transfer D + n -1
DM100: 1 1 :EM104
DM101: 3 3 :EM105
DM102: 7 7 :EM106
DM103: 15 15 :EM107
DM104: 31 31 :EM108
16-bit 16-bit
(1word) (1word)
BMOV.D When the execution condition is ON, the content of n ×2 words starting from [ S /
S +1] is moved in a block to n ×2 words starting from [ D / D +1].
ARITHMETIC OPERATION
[ S ・ S +1] Transfer [ D ・ D +1]
[ S +2・ S +3] Transfer [ D +2・ D +3]
...
...
...
[ S ・
+2(n−2) S +2(n−2)+1] Transfer [ D ・
+2(n−2) D +2(n−2)+1]
[ S ・
+2(n−1) S +2(n−1)+1] Transfer [ D ・
+2(n−1) D +2(n−1)+1]
INSTRUCTIONS
Example S :DM100 BMOV.D
D :EM5 DM100 EM5 #3
n :For #3
4
Transfer source device Transfer destination device
Higher bit Lower bit Higher bit Lower bit
@BMOV.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • Data blocks at the move source and move destination will be moved successfully evenif
they are partially duplicated.
• Specifying an excessively large value for n will considerably lengthen the scan
time.
Operation flag
Sample Program
When input relay R000 is ON, the data block of DM0 to DM9 is moved as a block to DM100 to DM109.
(Mnemonics list)
R000 BMOV
DM0 DM100 #10 LD R000
BMOV DM0 DM100 #10
FMOV(.U)
FMOV.S
FMOV.D
FMOV
FMOV
FMOV.L
FMOV.F
ARITHMETIC OPERATION
FMOV.DF
Moves 16/32/64-bit
Batch
data to the reference
@FMOV(.U) move
destination in batch.
@FMOV.S
INSTRUCTIONS
@FMOV.D
@FMOV
FMOV
@FMOV.L
@FMOV.F
@FMOV.DF
Description of Operation
FMOV(.U) When the execution condition is ON, 16-bit unsigned BIN data currently stored in S
is stored to n words starting from D .
FMOV.S When the execution condition is ON, 16-bit signed BIN data currently stored in S is
stored to n words starting from D .
ARITHMETIC OPERATION
D
D +1
D +2
INSTRUCTIONS
...
S
D + n -3
D + n -2
D + n -1
Example S
D
:DM100
:EM104
FMOV
DM100 EM104 #5 4
n :For #5
123 :EM104
Transfer source 123 :EM105
FMOV.D When the execution condition is ON, 32-bit unsigned BIN data currently stored in [ S /
S +1] is moved to n ×2 words starting from [ D / D +1].
FMOV.L When the execution condition is ON, 32-bit signed BIN data currently stored in [ S /
S +1] is moved to n ×2 words starting from [ D / D +1].
[ D ・ D +1]
[ D +2・ D +3]
[ 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]
FMOV.F When the execution condition is ON, single precision floating point type real number
stored in S is moved to n ×2 words starting from D .
ARITHMETIC OPERATION
Example FMOV.F
S : DM100
DM100 DM200 #5
D : DM200
INSTRUCTIONS
n : For #5
D +1 D
DM201: +1.234 :DM200
4
32-bit DM207: +1.234 :DM206
(2 words)
DM209: +1.234 :DM208
32-bit
Data Move Instructions
(2 words)
FMOV.DF When the execution condition is ON, double precision floating point type real number
stored in S is moved to n ×4 words starting from D .
Example FMOV.DF
S : DM100
DM100 DM200 #5
D : DM200
n : For #5
D +3 D +2 D +1 D
DM203: +1.23456789 :DM200
@FMOV.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point Specifying an excessively large value for n will considerably lengthen the scan time.
Operation flag
Sample Program
ARITHMETIC OPERATION
When input relay R000 turns ON, "0" is stored to data memories DM0 to DM99.
(Mnemonics list)
R000 FMOV
#0 DM0 #100 LD R000
INSTRUCTIONS
FMOV #0 DM0 #100
PMOV(.U) PMOV
PMOV PMOV.D
Partial
Moves any continuous bit
information to the specified
PMOV move bit position of the reference
@PMOV(.U)
@PMOV
ARITHMETIC OPERATION
@PMOV.D destination.
INSTRUCTIONS
4
S n1 D @ P M O V S n1 D
n2 n3 n2 n3
.U 16 bits
S Specifies the move source data.
.D 32 bits
Specifies the bit position of the move source.
When the suffix is .U, 0 to 15 is specified as the value of n1 ; when
the suffix is .D, 0 to 31 is specified as the value of n1 .
For constants
When suffix is .U: The value is the LSB when "0" and the MSB
when "15".
n1 When suffix is .D: The value is the LSB when "0" and the MSB 16 bits
when "31".
For non-constants
The following values will be used when the value of n1 is
out of the range of 0 to 15 or 0 to 31.
When the suffix is .U: The value of the low-order 4 bits is used.
When the suffix is .D: The value of the low-order 5 bits is used.
.U 16 bits
D Specifies the move destination.
.D 32 bits
Specifies the bit position of the move destination.
When the suffix is .U, 0 to 15 is specified as the value of n2 ; when
the suffix is .D, 0 to 31 is specified as the value of n2 .
For constants
When suffix is .U: The value is the LSB when "0" and the MSB
when "15".
n2 When suffix is .D: The value is the LSB when "0" and the MSB 16 bits
when "31".
For non-constants
The following values will be used when the value of n2 is
out of the range of 0 to 15 or 0 to 31.
When the suffix is .U: The value of the low-order 4 bits is used.
When the suffix is .D: The value of the low-order 5 bits is used.
Specifies the number of bits to move.
n3 When suffix is .U: A number within the range 1 to 16 can be specified. 16 bits
When suffix is .D: A number within the range 1 to 32 can be specified.
Description of Operation
ARITHMETIC OPERATION
PMOV(.U) When the execution condition is ON, n3 bits from the n1 th bit of S are moved
to the ( n2 + n3 -1)th bit from the n2 th bit of D . Original values are saved for
bits of sections where bits are not moved to.
INSTRUCTIONS
n3
bit bit
15 0
n1
bit
15
bit
0
4
D
Execution
Example condition PMOV
DM100 #4 DM200
#2 #8
PMOV.D When the execution condition is ON, n3 bits from the n1 th bit of [ S / S +1]
are moved to the ( n2 + n3 -1)th bit from the n2 th bit of [ D / D +1].
Original values are saved for bits of sections where bits are not moved to.
n3
bit bit bit bit
31 16 15 0
[ S ・ S +1]
n1
[ D ・ D +1]
n2
@PMOV.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
4 It will not change when all of n1 , n2 and n3 are constants, and indirect specification
or index modification is not specified for S and D , and the access outside the operand
range is not checked.
Data Move Instructions
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, 8 bits from the 4th bit of DM100 are moved to the 9th bit from the 2nd bit
of DM200.
(Mnemonics list)
INSTRUCTIONS
R000 PMOV
DM100 #4 DM200 LD R000
PMOV DM100 #4 DM200 #2 #8
#2 #8
BYLMOV
BYLMOV Moves any continuous byte
Byte
information to the specified
sequence
byte position of the reference
move
@BYLMOV
BYLMOV destination in order from the
(L→H)
ARITHMETIC OPERATION
low-order byte.
4
n2 n3 n2 n3
S
Specifies the byte position of the move source (starting from the
n1 low-order byte of S ). 16 bits
Specifiable range is 0 to 65535.
Specifies the start of the move destination (byte sequence storage
D 8 bits×( n1 + n3 +1)
location).*1
Specifies the byte position of the move destination (starting from
n2 the low-order byte of D ). 16 bits
Specifiable range is 0 to 65535.
Specifies the number of bytes to move.
n3 16 bits
Specifiable range is 1 to 65535.
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
BYLMOV When the execution condition is ON, n3 bytes from the n1 th byte of S
(counting from the low-order byte) are moved to the ( n2 + n3 - 1)th byte from the
n2 th byte of D (counting from the low-order byte). The original values are saved
in the bytes where data is not moved.
@BYLMOV Only one scan is executed at the rising edge of the execution conditions.
Example The following operation takes place when n1 =3, n2 =0 and n3 =6.
ARITHMETIC OPERATION
Move start position n1
Move source data Data to move
Position 0
bit bit
15 0
INSTRUCTIONS
S A(41H) B(42H) S +1 C(43H) D(44H)
S +1 C(43H) D(44H) S +2 E(45H) 1(31H)
S +2 E(45H) 1(31H) Number of S +3 2(32H) 3(33H)
S +3 2(32H) 3(33H) move bytes n3 S +4 F(46H) G(47H)
S +4 F(46H) G(47H)
4
7(37H) S(53H)
T(54H) 8(38H)
D 1(31H) C(43H)
D +1 3(33H) E(45H)
D +2 G(47H) 2(32H)
D +3
Operation flag
Sample Program
When input relay R000 turns ON, data in the 4th byte to 8th byte counting from the low-order byte
ofDM100 is moved to the 2nd byte and following counting from the low-order byte.
(Mnemonics list)
R000 BYLMOV
DM100 #4 DM200 LD R000
BYLMOV DM100 #4 DM200 #2 #8
#2 #8
high-order byte.
Specifies the byte position of the move source (starting from the
n1 high-order byte of S ). 16 bits
Specifiable range is 0 to 65535.
Specifies the start of the move destination (byte sequence storage
D 8 bits×( n1 + n3 +1)
location).* 1
Specifies the byte position of the move destination (starting from
n2 the high-order byte of D ). 16 bits
Specifiable range is 0 to 65535.
Specifies the number of bytes to move.
n3 16 bits
Specifiable range is 1 to 65535.
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
BYBMOV When the execution condition is ON, n3 bytes from the n1 th byte of S
(counting from the high-order byte) are moved to the ( n2 + n3 - 1)th byte from the
n2 th byte of D (counting from the high-order byte). The original values are saved
in the bytes where data is not moved.
@BYBMOV This instruction is executed for one scan at the rising edge of the execution condition.
ARITHMETIC OPERATION
Example
Position 0
Move start
Move source data position n1 Data to move
INSTRUCTIONS
bit bit
15 0
4
S +4 F(46H) G(47H)
7(37H) S(53H)
T(54H) 8(38H)
D D(44H) E(45H)
D +1 1(31H) 2(32H)
D +2 3(33H) F(46H)
D +3
Operation flag
Sample Program
When input relay R000 turns ON, data in the 4th byte to 8th byte counting from the high-order byte
ofDM100 is moved to the 2nd byte and following counting from the high-order byte.
(Mnemonics list)
R000 BYBMOV
DM100 #4 DM200 LD R000
BYBMOV DM100 #4 DM200 #2 #8
#2 #8
BBMOV
BBMOV
4 Operand Explanation
n
Occupied area
S Specifies the start of the move source data block. bits
Data Move Instructions
Point The BBMOV instruction can be used only with KV-8000 with CPU function version
2.0 or later.
Description of Operation
BBMOV When the execution condition is ON, the content of [ n / n +1] bits starting from
S is moved in a block to n bits starting from D .
Example S =DM10
S =EM10.5
n =10
DM10
bit15 bit0
EM10
bit15 bit0
Operation flag
Sample Program
ARITHMETIC OPERATION
Move the contents of Axis1 to Axis2.
INSTRUCTIONS
LDP MR000
BSIZE Axis1 SizeOfBit
BBMOV
Axis1 Axis2 SizeOfBit
BBMOV Axis1 Axis2 SizeOfBit
ADD(.U)
ADD.S
ADD.D
ADD ADD.L
ADD.F
ADD
Adds the value specified by the
ARITHMETIC OPERATION
ADD.DF
operand to the value of the
Add internal register, and stores the
@ADD(.U) result again to the internal
@ADD.S
INSTRUCTIONS
register.
@ADD.D
@ADD @ADD.L
@ADD.F
ADD
@ADD.DF
4
Ladder program Input mode
Execution condition S
※
LDA ADD STA A D D S ( + S )
Arithmetic/Comparison Instructions
Execution condition S
LDA ADD STA @ A D D S ( @ + S )※
*For KV-1000 CPU unit, description
can be omitted.
Operand Explanation Occupied size
.U .S 16 bits
S Specifies the addition data. .D .L .F 32 bits
.DF 64 bits
Description of Operation
ADD(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S and
the unsigned data of the 16-bit internal register are added, and the result is stored to 16-bit
internal register again.
ADD.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /
S +1] and the unsigned data of the 32-bit internal register are added, and the result is
ARITHMETIC OPERATION
stored to 32-bit internal register again.
INSTRUCTIONS
32-bit 32-bit 32-bit
(2 words)
ADD.L When the execution condition is ON, the 32-bit signed BIN data specified by [ S /
S +1] and the signed data of the 32-bit internal register are added, and the result is
stored to 32-bit internal register again.
Arithmetic/Comparison Instructions
1234 5678 + −8765 4321 = −7530 8643
32-bit 32ビット 32-bit
(2ワード)
ADD.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.
ADD.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.
@ADD.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The ADD and @ADD instructions perform operation in BIN. When values stored
to internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ARITHMETIC OPERATION
ON if the operation results exceed 16/32 bits (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Otherwise,
OFF.
INSTRUCTIONS
4 operand, and the access outside the operand range is not checked.
• For suffix "F"
- ON when the indirect specification or index modification range is inappropriate, the
CR2012
Arithmetic/Comparison Instructions
operation data is not within the single precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
- ON when the indirect specification or index modification range is inappropriate, the
operation data is not within the double precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
Sample Program
ARITHMETIC OPERATION
Each time that input relay R000 turns ON, the constant 100 is added to DM0, and the result is stored
toDM100.
(Mnemonics list)
INSTRUCTIONS
R000 DM0 #100 DM100
LDA ADD STA LDP R000
LDA DM0
CON
ADD #100
CON
STA DM100
Each time input relay R000 turns ON, the constant -100 is added to DM0, and the result is stored to
DM110.
4
Arithmetic/Comparison Instructions
(Mnemonics list)
R001 DM100 −100 DM110
LDA.S ADD.S STA.S LDP R001
LDA.S DM100
CON
ADD.S -100
CON
STA.S DM110
Each time input relay R002 turns ON, the constant 100000 is added to [DM200/DM201],
and the result is stored to [DM210/DM211].
(Mnemonics list)
R002 DM200 #100000 DM210
LDA.D ADD.D STA.D LDP R002
LDA.D DM200
CON
ADD.D #100000
CON
STA.D DM210
Each time that input relay R003 turns ON, the constant -100000 is added to [DM300/DM301], and the
result is stored to [DM310/DM311].
(Mnemonics list)
R003 DM300 −100000 DM310
LDA.L ADD.L STA.L LDP R003
LDA.L DM300
CON
ADD.L -100000
CON
STA.L DM310
SUB(.U)
SUB.S
SUB.D
SUB SUB.L
SUB.F
SUB
Subtracts the value specified by
ARITHMETIC OPERATION
SUB.DF
the operand from the value of the
Subtract internal register, and stores the
@SUB(.U) result again to the internal
@SUB.S
INSTRUCTIONS
register.
@SUB.D
@SUB @SUB.L
@SUB.F
SUB
@SUB.DF
4
Ladder program Input mode
Execution condition S
※
LDA SUB STA S U B S ( − S )
Arithmetic/Comparison Instructions
Execution condition S
LDA SUB STA @ S U B S ( @ − S )※
*For KV-1000 CPU unit, description
can be omitted.
Operand Explanation Occupied size
.U .S 16 bits
S Specifies the subtraction data. .D .L .F 32 bits
.DF 64 bits
Description of Operation
SUB(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S is
subtracted from the unsigned data of the 16-bit internal register, and the result is stored to
16-bit internal register again.
SUB.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /
S +1] is subtracted from the unsigned data of the 32-bit internal register, and the
ARITHMETIC OPERATION
result is stored to 32-bit internal register again.
INSTRUCTIONS
32-bit 32-bit 32-bit
(2 words)
SUB.L When the execution condition is ON, the 32-bit signed BIN data specified by [ S /
S +1] is subtracted from the signed data of the 32-bit internal register, and the result
is stored to 32-bit internal register again.
Arithmetic/Comparison Instructions
87654321 −12345678 = 99999999
32-bit 32-bit 32-bit
(2 words)
SUB.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.
SUB.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.
@SUB.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The SUB and @SUB instructions perform operation in BIN. When values stored
to internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ARITHMETIC OPERATION
ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Other wise
,OFF.
INSTRUCTIONS
4 operand, and the access outside the operand range is not checked.
• For suffix "F"
- ON when the indirect specification or index modification range is inappropriate, the
CR2012
Arithmetic/Comparison Instructions
operation data is not within the single precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
- ON when the indirect specification or index modification range is inappropriate, the
operation data is not within the double precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
Sample Program
ARITHMETIC OPERATION
Each time that input relay R000 turns ON, 100 is subtracted from DM0, and the result is stored toDM10.
(Mnemonics list)
R000 DM0 #100 DM10
LDP R000
INSTRUCTIONS
LDA SUB STA
LDA DM0
CON
SUB #100
CON
STA DM10
Each time that input relay R001 turns ON, 100 is subtracted from DM100, and the result is stored
toDM110.
(Mnemonics list)
4
R001 DM100 −100 DM110
Arithmetic/Comparison Instructions
LDA.S SUB.S STA.S LDP R001
LDA.S DM100
CON
SUB.S -100
CON
STA.S DM110
Each time that input relay R002 turns ON, the constant 100000 is subtracted from [DM200/
DM201],and the result is stored to [DM210/DM211].
(Mnemonics list)
R002 DM200 #100000 DM210
LDA.D SUB.D STA.D LDP R002
LDA.D DM200
CON
SUB.D #100000
CON
STA.D DM210
Each time that input relay R003 turns ON, the constant -100000 is subtracted from [DM300/
DM301],and the result is stored to [DM310/DM311].
(Mnemonics list)
R003 DM300 −100000 DM310
LDA.L SUB.L STA.L LDP R003
LDA.L DM300
CON
SUB.L -100000
CON
STA.L DM310
MUL(.U)
MUL.S
MUL.D
MUL MUL.L
MUL.F
MUL
Multiplies the value specified by
ARITHMETIC OPERATION
MUL.DF
the operand with the value of the
Multiply internal register, and stores the
@MUL(.U) result again to the internal
@MUL.S
INSTRUCTIONS
register.
@MUL.D
@MUL @MUL.L
@MUL.F
MUL
@MUL.DF
4 Ladder program
Execution condition S
Input mode
※
LDA MUL STA M U L S ( * S )
Arithmetic/Comparison Instructions
Execution condition S
LDA MUL STA @ M U L S ( @ * S )※
*For KV-1000 CPU unit, description
can be omitted.
Operand Explanation Occupied size
.U .S 16 bits
S Specifies the multiplication data. .D .L .F 32 bits
.DF 64 bits
Description of Operation
ARITHMETIC OPERATION
MUL(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S and
the unsigned data of the 16-bit internal register are multiplied, and the result is stored to 32-
bit internal register.
INSTRUCTIONS
The operation result is also divided and stored into TM0 (high-order 16 bits) and 16-bit
internal register (low-order 16 bits).
32-bit internal register
16-bit 16-bit
(1 word)
56088
32-bit
4
Arithmetic/Comparison Instructions
MUL.S When the execution condition is ON, the 16-bit signed BIN data specified by S and the
signed data of the 16-bit internal register are multiplied, and the result is stored to 32-bit
internal register. The operation result is also divided and stored into TM0 (high-order 16
bits) and 16-bit internal register (low-order 16 bits).
32-bit internal register
MUL.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /
S +1] and the unsigned data of the 32-bit internal register are multiplied, and the
result is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register (low-order 32
bits).
MUL.L When the execution condition is ON, the 32-bit signed BIN data specified by [ S /
S +1] and the signed data of the 32-bit internal register are multiplied, and the result
is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register.
MUL.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.
MUL.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
ARITHMETIC OPERATION
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.
@MUL.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The MUL and @MUL instructions perform operation in BIN. When values stored
4 to internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
Arithmetic/Comparison Instructions
Operation flag
ON if the operation results exceed 16/32 bits (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Otherwise,
OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state
• For suffix "U/S/D/L"
- ON when the indirect specification or index modification range is inappropriate, or an
access outside the operand range occurs; Otherwise OFF.
- It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
• For suffix "F"
- ON when the indirect specification or index modification range is inappropriate, the
CR2012
operation data is not within the single precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
- ON when the indirect specification or index modification range is inappropriate, the
operation data is not within the double precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
Sample Program
ARITHMETIC OPERATION
MUL.U
When input relay R000 is ON, the 16-bit unsigned BIN data currently stored in DM0 is multiplied with
the 16-bit unsigned BIN data currently stored in DM1. The result is stored to DM10.
INSTRUCTIONS
When R000 is OFF, the constant 100 is multiplied with DM0. The result is stored to DM10.
The result is stored to [DM10/DM11] when it exceeds the 16-bit range.
R000
LDA
DM0
MUL
#100
STA
DM10
LD R000
LDA DM0 4
CON
LDA MUL STA
MUL DM1
Arithmetic/Comparison Instructions
CON
STA DM10
LDB R000
LDA DM0
CON
MUL #100
CON
STA DM10
or
(Mnemonics list)
R000 DM0 DM1 DM10
LDA MUL STA LD R000
MPS
TM0 DM11 LDA DM0
LDA STA CON
R000 DM0 #100 DM10 MUL DM1
LDA MUL STA CON
STA DM10
TM0 DM11
MPP
LDA STA LDA TM0
CON
STA DM11
LDB R000
MPS
LDA DM0
CON
MUL #100
CON
STA DM10
MPP
LDA TM0
CON
STA DM11
MUL.S
When input relay R000 is ON, the 16-bit signed BIN data currently stored in DM0 is multiplied with the
ARITHMETIC OPERATION
16-bit signed BIN data currently stored in DM1. The result is stored to DM10.
When R000 is OFF, the constant -100 is multiplied with DM0. The result is stored to DM10. The result is
stored to [DM10/DM11] when it exceeds the 16-bit range.
INSTRUCTIONS
4
MUL.S DM1
CON
STA.S DM10
LDB R000
Arithmetic/Comparison Instructions
LDA.S DM0
CON
MUL.S -100
CON
STA.S DM10
or
(Mnemonics list)
R000 DM0 DM1 DM10
LDA.S MUL.S STA.S LD R000
MPS
TM0 DM11 LDA.S DM0
LDA.S STA.S CON
R000 DM0 −100 DM10 MUL.S DM1
LDA.S MUL.S STA.S CON
STA.S DM10
TM0 DM11
MPP
LDA.S STA.S LDA.S TM0
CON
STA.S DM11
LDB R000
MPS
LDA.S DM0
CON
MUL.S -100
CON
STA.S DM10
MPP
LDA.S TM0
CON
STA.S DM11
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Arithmetic/Comparison Instructions
DIV(.U)
DIV.S
DIV.D
DIV DIV.L
DIV.F
DIV
ARITHMETIC OPERATION
@DIV.D
@DIV @DIV.L
@DIV.F
DIV
@DIV.DF
4 Ladder program
Execution condition S
Input mode
Execution condition S
LDA DIV STA @ D I V S ( @ / S )※
Description of Operation
DIV(.U) When the execution condition is ON, the 32-bit unsigned BIN data stored in TM0 and the
16-bit internal register are divided by the 16-bit unsigned BIN data specified by S ,
and the result (quotient) is stored to the 32-bit internal register and the remainder is
stored to TM1.
The operation result (quotient) is also divided and stored into TM0 (high-order 16 bits)
and 16-bit internal register (low-order 16 bits).
32-bit internal register
DIV.S When the execution condition is ON, the 32-bit signed BIN data stored in TM0 and the 16-
bit internal register are divided by the 16-bit signed BIN data specified by S , and the
result (quotient) is stored to the 32-bit internal register and the remainder is stored to
TM1.
The operation result (quotient) is also divided and stored into TM0 (high-order 16 bits)
and 16-bit internal register (low-order 16 bits).
32-bit internal register
DIV.D When the execution condition is ON, the 64-bit unsigned BIN data stored in TM0, TM1
and the 32-bit internal register are divided by the 32-bit unsigned BIN data specified by
ARITHMETIC OPERATION
[ S / S +1], and the result (quotient) is stored to 64-bit unsigned BIN data (TM0,
TM1 and 32-bit internal register), and the remainder is stored to TM2 and TM3.
TM1 TM0 32-bit internal register S +1 S TM1 TM0 32-bit internal register
INSTRUCTIONS
12345678 ÷ 100 = 123456
64-bit 32-bit 64-bit
(2 word) TM3 TM2
Remainder: 78
32-bit
(2 word)
DIV.L When the execution condition is ON, the 64-bit signed BIN data stored in TM0, TM1 and
the 32-bit internal register are divided by the 32-bit signed BIN data specified by [
S +1], and the result (quotient) is stored to 64-bit signed BIN data (TM0, TM1 and 32-
S /
4
Arithmetic/Comparison Instructions
bit internal register), and the remainder is stored to TM2 and TM3.
TM1 TM0 32-bit internal register S +1 S TM1 TM0 32-bit internal register
DIV.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.
DIV.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.
@DIV.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The DIV and @DIV instructions perform operation in BIN. When values stored to
internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ARITHMETIC OPERATION
ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Other wise,
OFF.
INSTRUCTIONS
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, #10000 is divided by the unsigned 16-bit BIN data currently stored
toDM0. The result is stored to DM10, and the remainder is stored to DM20.
(Mnemonics list)
INSTRUCTIONS
R000 #10000 DM0 DM10
LDA EXT DIV STA LD R000
MPS
TM1 DM20
LDA STA LDA #10000
CON
EXT
CON
DIV DM0
4
CON
STA DM10
MPP
LDA TM1
Arithmetic/Comparison Instructions
CON
STA DM20
When input relay R001 is ON, the 32-bit signed BIN data currently stored in DM100/DM101 is divided
by the 16-bit signed BIN data currently stored in DM0. The result is stored to DM10/DM11, and the
remainder is stored to DM20.
(Mnemonics list)
R001 DM101 TM0
LDA.S STA.S LD R001
MPS
DM100 DM0 DM10
LDA.S DM101
LDA.S DIV.S STA.L
CON
TM1 DM20 STA.S TM0
LDA.S STA.S MRD
LDA.S DM100
CON
DIV.S DM0
CON
STA.L DM10
MPP
LDA.S TM1
CON
STA.S DM20
Example 16-bit BIN data currently stored to DM0 is divided by the 16-bit BIN data currently stored
toDM1. The result (quotient) is stored to DM20.
(Mnemonics list)
CR2002 DM0 DM1 DM20
LDA EXT DIV STA LD CR2002
LDA DM0
CON
EXT
CON
DIV DM1
CON
STA DM20
The DIV.D and DIV.L instructions execute the calculation "64-bit data / 32-bit data".
During calculation of 32-bit data ÷ 32-bit data,
it is necessary to set the temporary data TM1 TM0 32-bit internal register ÷ S +1 S
INSTRUCTIONS
64-bit 32-bit
memoryTM0 and TM1 that store the high- (2 words)
4 Example 32-bit BIN data currently stored to DM0/DM1 is divided by the 32-bit BIN data currently
stored to [DM10/DM11].
The result (quotient) is stored to [DM20/DM21].
Arithmetic/Comparison Instructions
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.D EXT.D DIV.D STA.D LD CR2002
LDA.D DM0
CON
EXT.D
CON
DIV.D DM10
CON
STA.D DM20
Example The unsigned 16-bit BIN data stored to DM0 that changes from 0 to 4000 is scaled to 0to
10000, and stored to DM1.
(Mnemonics list)
CR2002 DM0 #10000 #4000 DM1
LDA MUL DIV STA LD CR2002
LDA DM0
CON
MUL #10000
CON
DIV #4000
CON
STA DM1
10 × 10000 ÷ 4000 = 25
An overflow occurs as the data is handled as 16-bit data.
On the PLC, however, the data is handled as 32-bit data.
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 executed
successfully even if the product exceeds the 32-bit range during calculations.
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Arithmetic/Comparison Instructions
INC(.U)
INC.S
INC INC.D
INC.L
INC
Increment
@INC(.U) value by 1.
@INC.S
@INC @INC.D
@INC.L
INC
INSTRUCTIONS
4 Execution condition D
INC @ I N C D ( @ + + D )
Arithmetic/Comparison Instructions
Description of Operation
INC(.U) When the execution condition is ON, the 16-bit unsigned BIN data of D is
incremented by 1, and the result is stored to D .
An overflow occurs if the operation result is greater than 65535.
(When the count before the operation is 65535, the count becomes 0, and an overflow
occurs.)
INC.S When the execution condition is ON, the 16-bit signed BIN data of D is incremented
by 1, and the result is stored to D .
An overflow occurs if the operation result is greater than +32767.
(When the count before the operation is +32767, the count becomes -32768, and an
overflow occurs.)
INC.D When the execution condition is ON, the 32-bit unsigned BIN data of [ D / D +1] is
incremented by 1, and the result is stored to [ D / D +1].
An overflow occurs if the operation result is greater than 4294967295.
(When the count before the operation is 4294967295, the count becomes 0, and an
overflow occurs.)
INC.L When the execution condition is ON, the 32-bit signed BIN data of [ D / D +1] is
incremented by 1, and the result is stored to [ D / D +1].
An overflow occurs if the operation result is greater than +2147483647.
(When the count before the operation is +2147483647, the count becomes -2147483648,
and an overflow occurs.)
@INC.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The INC and @INC instructions perform operation in BIN. When values stored to
internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Reference When the INC instruction is executed at every scan, the bits are incremented at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
ARITHMETIC OPERATION
of the execution condition, use the differential type instruction as follows.
16-bit data
INSTRUCTIONS
DM0
INC
DM0
INC
R1000 R1000 DM0
DIFU INC
32-bit data
DM0
INC.D
4
Arithmetic/Comparison Instructions
DM0
INC.D
R1000 R1000 DM0
DIFU INC.D
Operation flag
CR2009 ON when the operation result exceeds the 16/32-bit range. Otherwise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
ARITHMETIC OPERATION
The total of input relays R000 to R003 is counted, and the result is stored to DM0.
(Mnemonics list)
R000 DM0
LDP R000
INSTRUCTIONS
INC
INC DM0
LDP R001
R001 DM0
INC DM0
INC LDP R002
INC DM0
R002 DM0 LDP R003
INC INC DM0
4 R003 DM0
INC
Arithmetic/Comparison Instructions
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Arithmetic/Comparison Instructions
DEC(.U)
DEC.S
DEC DEC.D
DEC.L
DEC
Decrement
@DEC(.U) value by 1.
@DEC.S
@DEC @DEC.D
@DEC.L
DEC
INSTRUCTIONS
4 Execution condition D
DEC @ D E C D ( @ − − D )
Arithmetic/Comparison Instructions
Description of Operation
DEC(.U) When the execution condition is ON, the 16-bit unsigned BIN data of D is
decremented by 1, and the result is stored to D .
An underflow occurs if the operation result is smaller than 0.
(When the count before the operation is 0, the count becomes 65535, and anoverflow
occurs.)
DEC.S When the execution condition is ON, the 16-bit signed BIN data of D is decremented
by 1, and the result is stored to D .
An underflow occurs if the operation result is smaller than -32768.
(When the count before the operation is -32768, the count becomes+32767, and an
underflow occurs.)
DEC.D When the execution condition is ON, the 32-bit unsigned BIN data of [ D / D +1] is
decremented by 1, and the result is stored to [ D / D +1].
An underflow occurs if the operation result is smaller than 0.
(When the count before the operation is 0, the count becomes 4294967295, and an
overflow occurs.)
DEC.L When the execution condition is ON, the 32-bit signed BIN data of [ D / D +1] is
decremented by 1, and the result is stored to [ D / D +1].
An underflow occurs if the operation result is smaller than -2147483648.
(When the count before the operation is -2147483648, the count becomes +2147483647,
and an overflow occurs.)
@DEC.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The DEC and @DEC instructions perform decrementing in BIN. When values
stored to internal register are BCD, convert these values to BIN by the TBIN
instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
4-64 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Arithmetic/Comparison Instructions
Reference When the DEC instruction is executed at every scan, the bits are decremented at each
scan when the execution condition is ON. If it is executed not at each scan but at the rising
ARITHMETIC OPERATION
edge of the execution condition, use the differential type instruction as follows.
16-bit data
INSTRUCTIONS
DM0
DEC
DM0
DEC
R1000 R1000 DM0
DIFU DEC
32-bit data
DM0
DEC.D
4
Arithmetic/Comparison Instructions
DM0
DEC.D
R1000 R1000 DM0
DIFU DEC.D
Operation flag
CR2009 ON when the operation result exceeds the 16/32-bit range. Otherwise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
The value of DM0 is decremented by 1 at each respective rising edge of input relays R000, R001
andR002.
(Mnemonics list)
R000 DM0
DEC LDP R000
DEC DM0
LDP R001
R001 DM0 DEC DM0
DEC LDP R002
DEC DM0
R002 DM0
DEC
ROOT(.U)
ROOT.S
ROOT.D
ROOT ROOT.L
ROOT.F
ROOT
ARITHMETIC OPERATION
@ROOT.D
@ROOT @ROOT.L
@ROOT.F
ROOT
@ROOT.DF
4
Ladder program Input mode
Execution condition
LDA ROOT STA R O O T ( S Q R T )
Arithmetic/Comparison Instructions
Execution condition
LDA ROOT STA @ R O O T ( @ S Q R T )
Description of Operation
ROOT(.U) When the execution condition is ON, the square root of the unsigned 32-bit BIN data
currently stored to temporary data memory TM0 and 16-bit internal register is calculated,
and the result is stored again to the 16-bit internal register.
The decimal point and below in the calculation result are discarded.
ROOT.S When the execution condition is ON, the square root of the signed 32-bit BIN data
currently stored to temporary data memory TM0 and 16-bit internal register is calculated,
and the result is stored again to the 16-bit internal register.
The decimal point and below in the calculation result are discarded.
ROOT.D When the execution condition is ON, the square root of the unsigned 64-bit BIN data
currently stored to temporary data memory TM0, TM1 and 32-bit internal register is
calculated, and the result is stored again to the 32-bit internal register.
The decimal point and below in the calculation result are discarded.
ROOT.L When the execution condition is ON, the square root of the signed 64-bit BIN data
currently stored to temporary data memory TM0, TM1 and 32-bit internal register is
calculated, and the result is stored again to the 32-bit internal register.
The decimal point and below in the calculation result are discarded.
ROOT.F When the execution conditions is ON, the square root of the single precision floating point
type real number stored in the 32-bit internal register is calculated.
ARITHMETIC OPERATION
The operation result is stored to the 32-bit internal register as a single precision floating
point type real number.
INSTRUCTIONS
Single precision floating point type real number Single precision floating point type real number
32-bit 32-bit
ROOT.DF When the execution conditions is ON, the square root of the double precision floating
point type real number stored in the 64-bit internal register is calculated.
The operation result is stored to the 64-bit internal register as a double precision floating
point type real number.
4
64-bit internal register 64-bit internal register
Arithmetic/Comparison Instructions
Double precision floating point type real number Double precision floating point type real number
64-bit 64-bit
@ROOT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The ROOT and @ROOT instructions perform the square root calculation in BIN.
When values stored to internal register are BCD, convert these values to BIN by
the TBIN instruction.
"TBIN instruction", page 4-160
Operation flag
Sample Program
When input relay R000 is ON, the square root of the unsigned 16-bit BIN data currently stored to DM0is
calculated, and the result is stored to DM10.
(Mnemonics list)
R000 DM0 DM10
LDA EXT ROOT STA LD R000
LDA DM0
CON
EXT
CON
ROOT
CON
STA DM10
POW(.U)
POW.S
POW.D
POW POW.L
POW.F
POW
The internal register value is
ARITHMETIC OPERATION
POW.DF
exponentiated with the value
Exponenti
specified in the operand, and the
@POW(.U) ation
results are stored in the internal
@POW.S
INSTRUCTIONS
register again.
@POW.D
@POW @POW.L
@POW.F
POW
@POW.DF
4
Ladder program Input mode
Execution condition S
LDA POW STA P O W S
Arithmetic/Comparison Instructions
Execution condition S
LDA POW STA @ P O W S
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000 Series
CPU units that have CPU function version 2.0 or higher and with KV Nano Series base
units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
POW(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S and
the unsigned data of the 16-bit internal register are exponentiated, and the result is stored
to 32-bit internal register.
The operation result is also divided and stored into TM0 (high-order 16 bits) and 16-bit
internal register (low-order 16 bits).
32-bit internal register
POW.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /
ARITHMETIC OPERATION
S +1] and the unsigned data of the 32-bit internal register are exponentiated, and the
result is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register (low-order 32
bits).
INSTRUCTIONS
32-bit internal register S +1 S TM1 TM0 32-bit internal register
123 4 228886641
32-bit 32-bit 64-bit
(2 words)
POW.L When the execution condition is ON, the 32-bit signed BIN data specified by [ S / 4
S +1] and the signed data of the 32-bit internal register are exponentiated, and the
Arithmetic/Comparison Instructions
result is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register (low-order 32
bits).
-23 +6 -148035889
32-bit 32-bit 64-bit
(2 words)
POW.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are exponentiated, and the result is stored in the 32-bit internal
register.
POW.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are exponentiated, and the result is stored
in the 64-bit internal register.
@POW.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The POW and @POW instructions perform decrementing in BIN. When values
stored to internal register are BCD, convert these values to BIN by the TBIN
instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ARITHMETIC OPERATION
ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Otherwise,
OFF.
INSTRUCTIONS
4 • When the operation results exceed the unsigned 32-bit (.U), signed 32-bit (.S), unsigned 64-
bit (.D) or signed 64-bit (.L) range
• When an access outside the operand range occurs
Arithmetic/Comparison Instructions
Sample Program
POW.U
When the input relay R000 is ON, the unsigned 16-bit BIN data stored in the data memory DM0 andthe
unsigned 16-bit BIN data stored in DM2 are exponentiated, and the operation results are stored
in[DM10.DM11].
When R000 is OFF, DM0 is exponentiated with the constant 10, and the operation results are stored
in[DM10.DM11].
(Mnemonics list)
R000 DM0 DM2 DM10
LDA POW STA.D LD R000
R000 DM0 #10 DM10 LDA DM0
CON
LDA POW STA.D
POW DM2
CON
STA.D DM10
LDB R000
LDA DM0
CON
POW #10
CON
STA.D DM10
or
(Mnemonics list)
R000 DM0 DM2 DM10
ARITHMETIC OPERATION
LDA POW STA LD R000
MPS
TM0 DM11
LDA DM0
LDA STA CON
POW DM2
INSTRUCTIONS
R000 DM0 #10 DM10
LDA POW STA CON
STA DM10
TM0 DM11
MPP
LDA STA LDA TM0
CON
STA DM11
LDB R000
MPS
LDA DM0
CON
POW #10
4
CON
Arithmetic/Comparison Instructions
STA DM10
MPP
LDA TM0
CON
STA DM11
POW.S
When the input relay R000 is ON, the signed 16-bit BIN data stored in the data memory DM0 and the
signed 16-bit BIN data stored in DM2 are exponentiated, and the operation results are stored in [DM10/
DM11].
When R000 is OFF, DM0 is exponentiated with the constant 10, and the operation results are stored
in[DM10.DM11].
or
(Mnemonics list)
R000 DM0 DM2 DM10
LDA.S POW.S STA.S LD R000
MPS
TM0 DM11
LDA.S DM0
LDA.S STA.S CON
R000 DM0 #10 DM10 POW.S DM2
LDA.S POW.S STA.S CON
STA.S DM10
TM0 DM11
MPP
LDA.S STA.S LDA.S TM0
CON
STA.S DM11
LDB R000
MPS
LDA.S DM0
CON
POW.S #10
CON
STA.S DM10
MPP
LDA.S TM0
CON
STA.S DM11
CMP(.U)
CMP.S
CMP.D
CMP CMP.L
CMP.F
CMP
ARITHMETIC OPERATION
CMP.DF
Compares the value currently stored
Data
to the internal register with the
@CMP(.U) comparison
specified BIN data.
@CMP.S
INSTRUCTIONS
@CMP.D
@CMP @CMP.L
@CMP.F
CMP
@CMP.DF
4
Ladder program Input mode
Execution condition S Operation flag
LDA CMP C M P S
Arithmetic/Comparison Instructions
Description of Operation
ARITHMETIC OPERATION
CMP(.U) The sizes of the unsigned 16-bit BIN data currently stored in the 16-bit internal register
and the unsigned 16-bit BIN data currently stored in S are compared. The operation
flag changes as shown in the table below according to the compare result.
INSTRUCTIONS
CMP.S The sizes of the signed 16-bit BIN data currently stored in the 16-bit internal register and
the signed 16-bit BIN data currently stored in S are compared. The operation flag
changes as shown in the table below according to the compare result.
State of Operation
Compare Result
4
Flag
Value of 16-bit internal register is less than S
CR2009→ON
Value of 16-bit internal register < S
Arithmetic/Comparison Instructions
Value of 16-bit internal register is equal to S
CR2010→ON
Value of 16-bit internal register = S
Value of 16-bit internal register is greater than S
CR2011→ON
Value of 16-bit internal register > S
CMP.D When the execution condition is ON, the sizes of the unsigned 32-bit BIN data currently
stored in the 32-bit internal register and the unsigned 32-bit BIN data currently stored in
[ S / S +1] are compared. The operation flag changes as shown in the table below
according to the compare result.
CMP.L The sizes of the signed 32-bit BIN data currently stored in the 32-bit internal register and
the signed 32-bit BIN data currently stored in [ S / S +1] are compared. The
operation flag changes as shown in the table below according to the compare result.
State of Operation
Compare Result
Flag
Value of 32-bit internal register is less than [ S / S +1]
CR2009→ON
Value of 32-bit internal register < [ S / S +1]
Value of 32-bit internal register is equal to [ S / S +1]
CR2010→ON
Value of 32-bit internal register = [ S / S +1]
Value of 32-bit internal register is greater than [ S / S +1]
CR2011→ON
Value of 32-bit internal register > [ S / S +1]
CMP.F When the execution condition is ON, compare the single precision floating point type real
number stored in 32-bit internal register and the specified size of [ S / S +1]. The
operation flag changes as follows according to the compare result.
State of Operation
Compare Result
Flag
Value of 32-bit internal register is less than specified value
CR2009→ON
Value of 32-bit internal register < [ S / S +1]
Value of 32-bit internal register is equal to specified value
CR2010→ON
Value of 32-bit internal register = [ S / S +1]
Value of 32-bit internal register is greater than specified value
CR2011→ON
Value of 32-bit internal register > [ S / S +1]
CMP.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
ARITHMETIC OPERATION
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.
State of Operation
INSTRUCTIONS
4
CR2011→ON
Value of 64-bit internal register > [ S / S +1/ S +2/ S +3]
@CMP.□ This instruction is executed for one scan at the rising edge of the execution condition.
Arithmetic/Comparison Instructions
Reference If a single precision floating point type real number is input as a constant in an operand to
be compared, the number of effective digits which can be input is seven, so the
comparison may not match the actual operation results. In this case, a comparison can be
made by comparing the operation results as an integer in the ladder program.
Operation flag
ON when the value of the internal register is less than the value stored to the specified operand.
CR2009
Otherwise, OFF.
ON when the value of the internal register is the same as the value stored to the specified
CR2010
operand. Otherwise, OFF.
ON when the value of the internal register is greater than the value stored to the specified
CR2011
operand. Otherwise, OFF.
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the comparison data is outside the single precision floating point type real number
range (only when the suffix is "F")
• When the comparison data is outside the double precision floating point type real number
CR2012 range (only when the suffix is "DF")
• When an access outside the operand range occurs
It will not change when the suffix is ".U/.S/.D/.L" and the indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50
Sample Program
ARITHMETIC OPERATION
#1000 is compared with the value currently stored to DM0.
INSTRUCTIONS
LDA DM0
CR2010 R501 CON
② CMP #1000
CON
MPS
CR2011 R502 AND CR2009
③ OUT R500
MRD
AND CR2010
OUT R501
MPP
4
AND CR2011
Arithmetic/Comparison Instructions
OUT R502
(1) DM0<1000: Output relay R500 turns ON when the value is less than #1000.
(2) DM0=1000: Output relay R501 turns ON when the value is equal to #1000.
(3) DM0>1000: Output relay R502 turns ON when the value is greater than #1000.
a b
Reference As shown in LDA CMP , assuming that the internal register is a and the operand is
b, then,
CR2009 CR2010 CR2011
a<b a=b a>b
CR2009 CR2010 CR2011
a≧b a≠b a≦b
.
ZCMP(.U)
ZCMP.S
ZCMP.D
ZCMP ZCMP.L
ZCMP.F
ZCMP
ARITHMETIC OPERATION
@ZCMP.D
@ZCMP @ZCMP.L
@ZCMP.F
ZCMP
@ZCMP.DF
4
Ladder program Input mode
Execution condition S1 Operation flag
LDA ZCMP Z C M P S1 S2
Arithmetic/Comparison Instructions
S2
Description of Operation
ARITHMETIC OPERATION
ZCMP(.U) When the execution condition is ON, the sizes of the range specified by S1 , S2 ,
and the unsigned 16-bit BIN data currently stored in the internal register are compared.
The operation flag changes as follows according to the compare result.
INSTRUCTIONS
ZCMP.S When the execution condition is ON, the sizes of the range specified by S1 , S2 ,
and the signed 16-bit BIN data currently stored in the internal register are compared. The
operation flag changes as follows according to the compare result.
State of Operation
Compare Result (when S1 < S2 ) Flag
Value of 16-bit internal register is less than specified range
Value of 16-bit internal register < S1 < S2
CR2009→ON 4
Value of 16-bit internal register is within specified range
Arithmetic/Comparison Instructions
CR2010→ON
S1 ≦ Value of 16-bit internal register ≦ S2
Value of 16-bit internal register is greater than specified range
CR2011→ON
S1 < S2 < Value of 16-bit internal register
ZCMP.D When the execution condition is ON, the sizes of the range specified by [ S1 / S1 +
1], [ S2 / S2 + 1], and the unsigned 32-bit BIN data currently stored in the 32-bit
internal register are compared.
The operation flag changes as shown in the table below according to the compare result.
ZCMP.L When the execution condition is ON, the sizes of the range specified by [ S1 / S1 +
1], [ S2 / S2 + 1], and the signed 32-bit BIN data currently stored in the 32-bit
internal register are compared.
The operation flag changes as follows according to the compare result.
State of
Compare Result (when [ S1 / S1 +1] < [ S2 / S2 +1]) Operation Flag
Value of 32-bit internal register is less than specified range
CR2009→ON
Value of 32-bit internal register < [ S1 / S1 +1] < [ S2 / S2 +1]
Value of 32-bit internal register is within specified range
CR2010→ON
[ S1 / S1 +1] ≦ Value of 32-bit internal register ≦ [ S2 / S2 +1]
Value of 32-bit internal register is greater than specified range
CR2011→ON
[ S1 / S1 +1] < [ S2 / S2 +1] < Value of 32-bit internal register
ZCMP.F When the execution condition is ON, compare the range specified by [ S1 / S1 +1],
[ S2 / S2 + 1] and the size of the single precision floating point type real number
stored in 32-bit internal register.
The operation flag changes as follows according to the compare result.
State of
Compare Result (when [ S1 / S1 +1] < [ S2 / S2 +1]) Operation Flag
Value of 32-bit internal register is less than specified range
CR2009→ON
Value of 32-bit internal register < [ S1 / S1 +1] < [ S2 / S2 +1]
Value of 32-bit internal register is within specified range
CR2010→ON
[ S1 / S1 +1] ≦ Value of 32-bit internal register ≦ [ S2 / S2 +1]
Value of 32-bit internal register is greater than specified range
CR2011→ON
[ S1 / S1 +1] < [ S2 / S2 +1] < Value of 32-bit internal register
ZCMP.DF When the execution condition is ON, compare the range specified by [ S1 / S1 +1/
S1 +2/ S1 +3], [ S2 / S2 +1/ S2 +2/ S2 +3] and the size of the double
ARITHMETIC OPERATION
precision floating point type real number stored in 64-bit internal register.
The operation flag changes as follows according to the compare result.
@ZCMP.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ON when the value of the internal register is less than the value specified by the
CR2009
operand.Otherwise, OFF.
ON when the value of the internal register is within the range specified by the specified operand.
CR2010 Otherwise, OFF.
*Including min. and max. boundary values.
ON when the value of the internal register is greater than the range specified by the specified
CR2011
operand. Otherwise, OFF.
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the comparison data is outside the single precision floating point type real number
range (only when the suffix is "F")
• When the comparison data is outside the double precision floating point type real number
CR2012 range (only when the suffix is "DF")
• When an access outside the operand range occurs
It will not change when the suffix is ".U/.S/.D/.L" and the indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50
Sample Program
ARITHMETIC OPERATION
When the value currently stored to data memory DM0 is greater than #2000, output relay R500 turns
ON.
When the value currently stored to DM0 is between #1000 to #2000, R501 turns ON.
INSTRUCTIONS
When the value currently stored to DM0 is less than #1000, R502 turns OFF.
CR2009 R502
CON
MPS
AND CR2011
4
③ OUT R500
Arithmetic/Comparison Instructions
MRD
AND CR2010
OUT R501
MPP
AND CR2009
OUT R502
① 1000<2000<DM0
② 1000≦DM0≦2000
③ DM0<1000<2000
ANDA
ANDA(.U)
ANDA ANDA.D ANDA Calculates the logical
"AND" of values in internal
AND A
@ANDA(.U) registers and values
@ANDA specified by operands.
ARITHMETIC OPERATION
@ANDA.D ANDA
Execution condition S
LDA ANDA STA A N D A S
Execution condition S
LDA ANDA STA @ A N D A S
4
Operand Explanation Occupied size
.U 16 bits
S Specifies the data to perform the logical "AND" operation.
.D 32 bits
Logical Operation Instructions
Description of Operation
When the execution condition is ON, the logical AND of the BIN data Logical AND truth table
specified by S and the content of the internal register is calcu- Internal register 0 0 1 1
lated, and the result is stored to the internal register. The result of this S 0 1 0 1
operation is "1" only when both the internal register and bits in BIN
Internal register (result) 0 0 0 1
data specified by S are "1".
ANDA(.U) The logical "AND" of the 16-bit BIN 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
DM0
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
AND bit
0
$00FF
S 0000000011111111 ANDA
bit bit
15 0
DM0
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 BIN 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.
@ANDA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 $00FF DM0
LDA ANDA STA LD CR2002
LDA R000
CON
ANDA $FF
CON
STA DM0
ORA(.U)
ORA ORA.D ORA Calculates the logical "OR"
of values in internal registers
OR A
@ORA(.U) and values specified by
@ORA operands.
ARITHMETIC OPERATION
@ORA.D ORA
Execution condition S
LDA ORA STA O R A S
Execution condition S
LDA ORA STA @ O R A S
4
Operand Explanation Occupied size
.U 16 bits
S Specifies the data to perform the logical "OR" operation.
.D 32 bits
Logical Operation Instructions
Description of Operation
When the execution condition is ON, the logical OR of the BIN data specified by Logical OR truth table
S and the content of the internal register is calculated, and the result is Internal register 0 0 1 1
stored to the internal register.
The result of this operation is "1" only when either or both the internal register S 0 1 0 1
and bits in the BIN data specified by S are "1". Internal register (result) 0 1 1 1
ORA(.U) The logical "OR" of the 16-bit BIN 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
DM0
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
OR bit
0
$00FF
S 0000000011111111 ORA
bit bit
15 0
DM0
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 BIN 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.
@ORA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
The current value of counter C0 is output at 2-digit BCD to output relays R500 to R507.
Note, however, that changing of the states of R508 to R515 must be prevented.
(Mnemonics list)
R000 #99
C0 ① LDB R000
R001 C #0 #99 R001
CR2002 R500 $FF00 DM0 LD CR2002
LDA ANDA STA ② LDA R500
CON
ANDA $FF00
CR2002 C0 $00FF DM0 R500 CON
LDA TBCD ANDA ORA STA ③ STA DM0
LD CR2002
LDA C0
CON
(1) Set counter C0. TBCD
CON
(2) Store R508 to R515 of output relay to DM0. ANDA $FF
(3) Perform BCD conversion to the current value of C0, and save CON
ORA DM0
the data of low-order 2 bits of BCD to 16-bit internal register. CON
Perform OR operation (logical "OR") for 16-bit internal register STA R500
and DM0, and then output to R500 to R515.
EORA(.U)
EORA EORA.D EORA
Exclusive OR
Calculates the logical
"Exclusive OR" of values in
@EORA(.U) operation internal registers and values
@EORA specified by operands.
ARITHMETIC OPERATION
@EORA.D EORA
Execution condition S
LDA EORA STA E O R A S
( X O R A S 、X O R S )
Execution condition S
LDA EORA STA @ E O R A S
( @ X O R A S 、@ X O R S )
4 Operand Explanation
S
.D 32 bits
Logical Operation Instructions
Description of Operation
When the execution condition is ON, the logical exclusive OR of the BIN data
Logical XOR truth table
specified by S and the content of the internal register is calculated, and the
Internal register 0 0 1 1
result is stored to the internal register.
S 0 1 0 1
The result of this operation is "1" only when the internal register and bits in the BIN
data specified by S are different. Internal register (result) 0 1 1 0
EORA(.U) The logical "Exclusive OR" of the 16-bit BIN 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
DM0
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
XOR bit
0
$00FF
S 0000000011111111 EORA
bit bit
15 0
DM0
16-bit internal register 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 STA
EORA.D The logical "Exclusive OR" of the 32-bit BIN 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.
@EORA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
When the setting value currently stored in DM0 matches the ON/OFF state of input relays R30000 to
R30007, output relay R500 is turned ON.
ENRA
ENRA(.U)
ENRA ENRA.D ENRA
Exclusive
Calculates the logical
"Exclusive NOR" of values
NOR in internal registers and
@ENRA(.U) operation values specified by
@ENRA
ARITHMETIC OPERATION
Execution condition S
LDA ENRA STA E N R A S
( X N O R A S )
Execution condition S
LDA ENRA STA @ E N R A S
( @ X N O R A S )
4 Operand
S
Explanation
Description of Operation
When the execution condition is ON, the logical "Exclusive Logical XNOR truth table
NOR" of the BIN data specified by S and the content of Internal register 0 0 1 1
the internal register is calculated, and the result is stored to S 0 1 0 1
the internal register. The result of the logical "Exclusive NOR" Internal register (result) 1 0 0 1
is "1" when the internal register and bits in the BIN data
specified by S are the same.
ENRA(.U) The logical "Exclusive NOR" of the 16-bit BIN 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
DM0
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
XNOR bit
0
$00FF
S 0000000011111111 ENRA
bit bit
15 0
DM0
16-bit internal register 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 STA
ENRA.D The logical "Exclusive NOR" of the 32-bit BIN 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.
@ENRA.□ This instruction is executed for one scan at the rising edge of the execution condition.
4-86 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Logical Operation Instructions
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
If even one bit of the setting values currently stored in DM0 matches the ON/OFF state of input relays
R30000 to R30015, output relay R500 is turned ON.
(Mnemonics list)
CR2002 R30000 DM0 CR2010 R500
LDA ENRA LD CR2002
LDA R30000
CON
ENRA DM0
bit bit CON
15 0
ANB CR2010
$5554 0101010101010100 Input relay R30000 to R30015 OUT R500
bit ENRA bit
15 0
COM(.U)
COM COM.D COM
Inverts each of the bits in
Bit inversion
@COM(.U) internal registers.
@COM
ARITHMETIC OPERATION
@COM.D COM
Execution condition
LDA COM STA C O M
Execution condition
LDA COM STA @ C O M
4 Description of Operation
Logical Operation Instructions
COM(.U) When the execution condition is ON, each of the bits in 16-bit internal registers is inverted
("0→1", "1→0").
bit bit
Example 15 0
bit bit
15 0
COM.D When the execution condition is ON, each of the bits in internal registers is inverted ("0→
1", "1→0").
bit bit
31 0
@COM.□ This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the COM instruction is executed at every scan, the bits are inverted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction (@COM) as follows.
DM**** DM****
LDA COM STA
DM**** DM****
LDA COM STA
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state
INSTRUCTIONS
CR2012 No change in state
Sample Program
The state of input relays R00 to R003 are inverted and output to R500 to R503.
ΜR000 R000
LDA COM
$000F
ANDA
R500
STA
(Mnemonics list)
LD MR000
4
LDA R000
NEG(.U)
NEG.S
NEG.D
NEG NEG.L
NEG.F
NEG
ARITHMETIC OPERATION
NEG.DF
Inverts the sign (2's
Sign inversion
@NEG(.U) complement).
@NEG.S
INSTRUCTIONS
@NEG.D
@NEG @NEG.L
@NEG.F
NEG
@NEG.DF
4
Ladder program Input mode
Execution condition
LDA NEG STA N E G
Logical Operation Instructions
Execution condition
LDA NEG STA @ N E G
Description of Operation
When the execution condition is ON, the plus/minus sign of the data currently stored in internal
registers is inverted (2's complement is calculated), and the result is stored to internal registers.
NEG(.U) / NEG.S
When the execution condition is ON, the plus/minus sign of the 16-bit data currently
stored in 16-bit internal registers is inverted (2's complement is calculated).
bit bit
Example 15 0
10000000000000000
0011000000111001
bit bit
15 0
NEG.D / NEG.L
When the execution condition is ON, the plus/minus sign of the 32-bit data currently
ARITHMETIC OPERATION
stored in 32-bit internal registers is inverted (2's complement is calculated).
INSTRUCTIONS
32-bit internal register 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 ←Before
executing
#12345678
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
0000000010111110 0110000101001110
bit bit
31 0
#-12345678
←After
executing 4
NEG.DF When execution condition is ON, double precision floating point type real number stored
in 64-bit internal register will be negated.
64-bit internal register 64-bit internal register
Double precision floating point type real number −1× Double precision floating point type real number
64-bit 64-bit
@NEG.□ This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the NEG instruction is executed at every scan, the sign is inverted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction (@NEG) as follows.
DM**** DM****
LDA NEG STA
DM**** DM****
LDA NEG STA
Operation flag
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, the difference between the signed 16-bit BIN data currently stored in
DM0 and DM1 is calculated, and the absolute value is stored to DM2.
(Mnemonics list)
INSTRUCTIONS
4
MPP
AND<.S DM0 DM1
LDA.S DM2
CON
Logical Operation Instructions
NEG.S
CON
STA.S DM2
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
SRA(.U)
SRA SRA.D SRA Shifts the bit content of
internal registers to the
Shift right
@SRA(.U) smaller bit No. by the specified
@SRA number of bits.
ARITHMETIC OPERATION
@SRA.D SRA
Execution condition n
LDA SRA STA S R A n
Execution condition n
LDA SRA STA @ S R A n
4 Operand Explanation
Specifies the number of bits to shift.*1*2
Occupied size
n SRA.U can be specified within the range 0 to 16, and SRA.D can be 16 bits
Shift Instructions
Description of Operation
SRA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
The result is stored to the 16-bit internal register.
bit ( n -1)
bit bit
15 0
16-bit
internal 1110100000011001
register
16-bit
internal 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 10 0 1
register
Higher n bit Delete
Filled with 0 1
CR2009
(Carry)
SRA.D When the execution condition is ON, the state of the 32-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
The result is stored to the 32-bit internal register.
bit ( n -1)
bit bit
31 0
32-bit
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
ARITHMETIC OPERATION
internal
register
INSTRUCTIONS
32-bit
internal
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
register
Higher n bit Delete
Filled with 0
1
CR2009
(Carry)
This instruction is executed for one scan at the rising edge of the execution condition.
4
@SRA.□
Reference When the SRA instruction is executed at every scan, the bits are shifted at each scan
Shift Instructions
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM**** DM****
LDA SRA STA
DM**** DM****
LDA SRA STA
Operation flag
Sample Program
ARITHMETIC OPERATION
The BCD data (2 digits) from the digital switch entered to input relays R30008 to R30015 is stored
toDM0.
(Mnemonics list)
INSTRUCTIONS
00100100 R30000∼R30015
LDA
SRA
STA
0000000000100100 DM0
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Shift Instructions
SLA(.U)
SLA SLA.D SLA Shifts the bit content of
internal registers to the larger
Shift left
@SLA(.U) bit No. by the specified
@SLA number of bits.
ARITHMETIC OPERATION
@SLA.D SLA
Execution condition n
LDA SLA STA S L A n
Execution condition n
LDA SLA STA @ S L A n
4
Operand Explanation Occupied size
Specifies the number of bits to shift.*1*2
n SRA.U can be specified within the range 0 to 16, and SRA.D can be 16 bits
Shift Instructions
Description of Operation
SLA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted left
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
The result is stored to the 16-bit internal register.
bit (16− n )
bit bit
15 0
16-bit
1110100000011001 internal
register
16-bit
1 11 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 internal
register
Delete Lower n bit
1
Filled with 0
CR2009
(Carry)
SLA.D When the execution condition is ON, the state of the 32-bit internal register is shifted left
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
The result is stored to the 32-bit internal register.
bit (32− n )
bit bit
31 0
32-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 internal
ARITHMETIC OPERATION
register
INSTRUCTIONS
32-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 internal
register
Delete Lower n bit
1 Filled with 0
CR2009
(Carry)
This instruction is executed for one scan at the rising edge of the execution condition.
4
@SLA.□
Reference When the ASLA instruction is executed at every scan, the bits are shifted at each scan
Shift Instructions
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM**** DM****
LDA SLA STA
DM**** DM****
LDA SLA STA
Operation flag
Sample Program
The 2-digit BCD data currently stored to each of DM0 and DM1 are stored to DM10 as 4-digit BCDdata
with the DM1 as the higher 2 digits.
(Mnemonics list)
CR2002 DM1 #8 DM0 DM10
LDA SLA ORA STA LD CR2002
LDA DM1
CON
DM0 SLA #8
34 DM10 CON
ORA DM0
DM1 1234 CON
12 STA DM10
ASRA(.U)
ASRA.S
ASRA ASRA.D
ASRA.L
ASRA
Shifts the bit content of
Arithmetic right internal registers to the
ARITHMETIC OPERATION
4 Execution condition
LDA
n
ASRA STA @ A S R A n
Shift Instructions
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
ARITHMETIC OPERATION
ASRA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
INSTRUCTIONS
The result is stored to the 16-bit internal register.
bit
( n −1) bit
bit
15 0
16-bit Internal register before execution: 59417
internal 1110100000011001
register
4
Execute ASRA.U instruction with n=5
16-bit
internal
000001110100000011 00 1
Internal register after execution: 1856
register
Shift Instructions
High-order n bit Delete
1
0 is stored
CR2009
(carry)
ASRA.S When the execution condition is ON, the state of the 16-bit internal register is shifted right
by n bits (towards the low-order bit).
If "value stored in internal register ≧0", 0 is stored in the high-order n bits. If "value
stored in internal register <0", 1 is stored. The bit ( n -1) status is stored in CR2009.
The result is stored to the 16-bit internal register.
bit
( n −1)
bit bit
15 0
Internal register before execution: -1000
16-bit
internal 1111110000011000
register
Execute ASRA.S instruction with n=4
16-bit
internal
111111111100000110 00
Internal register after execution: -63
register
High-order n bit Delete
1
Sign value is stored
Greater than 0 : 0 CR2009
Less than 0: 1 (carry)
ASRA.D When the execution condition is ON, the state of the 32-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
The result is stored to the 32-bit internal register.
bit( n −1)
bit bit
31 0
32-bit 3894011929
11101000000110011110100000011001
internal
register
n=5
32-bit
internal 0000011101000000110011110100000011 00 1
121687872
register
High-order n bit Delete
1
0 is stored
CR2009
(carry)
ASRA.L When the execution condition is ON, the state of the 32-bit internal register is shifted right
by n bits (towards the low-order bit).
ARITHMETIC OPERATION
If "value stored in internal register ≧0", 0 is stored in the high-order n bits. If "value
stored in internal register <0", 1 is stored. The bit ( n -1) status is stored in CR2009.
The result is stored to the 32-bit internal register.
INSTRUCTIONS
bit( n −1)
bit bit
31 0
n=4
32-bit
4
internal 11111001000011001111000011001010 1 1 1 0 −116592438
register
High-order n bit Delete
Shift Instructions
1
Sign value is stored
Greater than 0 : 0 CR2009
Less than 0: 1 (carry)
@ASRA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the ASLA instruction is executed at every scan, the bits are shifted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM DM
LDA ASRA STA
DM DM
LDA ASRA STA
Operation flag
Sample Program
ARITHMETIC OPERATION
The BCD data (6 digits worth) from the digital switch input into the input relay -R30008 to R30115 is
stored in the data memory DM0, DM1.
(Mnemonics list)
INSTRUCTIONS
CR2002 R30000 #8 DM0
LDA.D ASRA.D STA.D LD CR2002
LDA.D R30000
CON
ASRA.D #8
CON
STA.D DM0
4
Digital switch
1 2 3 4 5 6
Shift Instructions
R30008
R30115 R30000
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 R30000∼R30115
LDA.D
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 Internal register
ASRA.D
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 Internal register
STA.D
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 DM0
ASLA(.U)
ASLA.S
ASLA ASLA.D
ASLA.L
ASLA
Shifts the bit content of
Arithmetic left internal registers to the larger
ARITHMETIC OPERATION
4 Execution condition
LDA
n
ASLA STA @ A S L A n
Shift Instructions
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
ASLA(.U) / ASLA.S
When the execution condition is ON, the state of the 16-bit internal register is shifted left
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
The result is stored to the 16-bit internal register.
(16− n )
bit
bit bit
15 0
16-bit Internal register before
1110100000011001 internal execution: 59417
register
16-bit
11 10 10000001100100000 Internal register after execution: 800
internal
register
Delete Low-order n bit
1 0 is stored
CR2009
(carry)
ASLA.D / ASLA.L
When the execution condition is ON, the state of the 32-bit internal register is shifted left
ARITHMETIC OPERATION
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
The result is stored to the 32-bit internal register.
INSTRUCTIONS
(32− n )
bit
bit bit
31 0
32-bit
11101000000110011110100000011001 3894011929
internal
register
n=5
4
32-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 internal 54330144
register
Delete Low-order n bit
Shift Instructions
1
0 is stored
CR2009
(carry)
@ASLA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the ASLA instruction is executed at every scan, the bits are shifted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM DM
LDA ASLA STA
DM DM
LDA ASLA STA
Operation flag
Sample Program
ARITHMETIC OPERATION
The 6-digit BCD data stored in data memory DM0, DM1 is merged with the 2-digit BCD data stored
inDM2, and is stored as 8-digit BCD data in DM10, DM11.
(Mnemonics list)
INSTRUCTIONS
4
STA.D DM10
DM0, DM1
DM10, DM11
123456
Shift Instructions
DM2 12345678
78
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Shift Instructions
RRA(.U)
RRA RRA.D RRA Rotates the bit content of
internal registers towards the
Right rotate
@RRA(.U) smaller bit No. by the specified
@RRA number of bits.
ARITHMETIC OPERATION
@RRA.D RRA
Execution condition n
LDA RRA STA R R A n
Execution condition n
LDA RRA STA @ R R A n
4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RRA.U can be specified within the range 0 to 16, and RRA.D can be 16 bits
Shift Instructions
*1 When the value of n is "0", the state of CR2009 does not change.
*2 When n is not specified as a constant, operation is as follows when the value of n is 17
or more (.U) / 33 or more (.D).
When suffix is .U: the remainder value obtained by dividing the value of n by 17 is taken as
the number of bits to rotate.
When suffix is .D: the remainder value obtained by dividing the value of n by 33 is taken as
the number of bits to rotate.
Description of Operation
RRA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated right by n bits (towards the low-order bit). The state of the carry flag
(CR2009) is entered to the MSB.
(The following bit manipulation is repeated for n times.)
bit bit
CR2009 15 0
CR2009
1 0111100000000111
(Carry)
n cycle (Rotate n bits)
bit bit
CR2009 15 0
RRA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated right by n bits (towards the low-order bit). The state of the carry flag
ARITHMETIC OPERATION
(CR2009) is entered to the MSB.
(The following bit manipulation is repeated for n times.)
32-bit internal register
INSTRUCTIONS
bit bit bit bit
CR2009 31 16 15 0
0 1111000000001111 0000000000001111
Status of flag varies
with previous operation
results.
(1-bit cycle)
CR2009
1
(Carry)
0111100000000111 1000000000000111
4
n cycle (Rotate n bits)
Shift Instructions
bit bit
CR2009 31 0
0 1111011110000000 0111100000000000
(Carry)
32-bit internal register
@RRA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the RRA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM**** DM****
LDA SLA STA
DM**** DM****
LDA SLA STA
Operation flag
Sample Program
ARITHMETIC OPERATION
Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS
CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
② LDA R30000
#16
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RRA #1
4
RRA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Shift Instructions
RLA(.U)
RLA RLA.D RLA Rotates the bit content of
internal registers towards the
Left rotate
@RLA(.U) larger bit No. by the specified
@RLA number of bits.
ARITHMETIC OPERATION
@RLA.D RLA
Execution condition n
LDA RLA STA R L A n
Execution condition n
LDA RLA STA @ R L A n
4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RLA.U can be specified within the range 0 to 16, and RLA.D can be 16 bits
Shift Instructions
*1 When the value of n is "0", the state of CR2009 does not change.
*2 When n is not specified as a constant, operation is as follows when the value of n is 17
or more (.U) / 33 or more (.D).
When suffix is .U: the remainder value obtained by dividing the value of n by 17 is taken as
the number of bits to rotate.
When suffix is .D: the remainder value obtained by dividing the value of n by 33 is taken as
the number of bits to rotate.
Description of Operation
RLA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated left by n bits (towards the high-order bit). The state of the carry flag
(CR2009) is entered to the LSB.
(The following bit manipulation is repeated for n times.)
bit bit
15 0 CR2009
CR2009
1110000000011110 1
(Carry)
bit bit
15 0 CR2009
RLA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated left by n bits (towards the high-order bit). The state of the carry flag
ARITHMETIC OPERATION
(CR2009) is entered to the LSB.
(The following bit manipulation is repeated for n times.)
32-bit internal register
INSTRUCTIONS
bit bit bit bit
31 16 15 0 CR2009
1111000000001111 0000000000001111 0
Status of flag varies with
(1-bit cycle) previous operation results.
CR2009
1110000000011110 0000000000011110 1
(Carry) 4
n cycle(Rotate n bits)
Shift Instructions
bit bit
31 0 CR2009
0000000111100000 0000000111101111 0
(Carry)
32-bit internal register
@RLA.□ This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the RLA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM**** DM****
LDA RLA STA
DM**** DM****
LDA RLA STA
Operation flag
Sample Program
ARITHMETIC OPERATION
Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS
CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
LDA R30000
#16 ②
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RLA #1
4
RLA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Shift Instructions
RRNCA(.U)
RRNCA RRNCA.D RRNCA
No-carry right
Rotates the bit content of
internal registers towards
the smaller bit No. by the
@RRNCA(.U) rotation
specified number of bits
@RRNCA
ARITHMETIC OPERATION
Execution condition n
LDA RRNCA STA R R N C A n
Execution condition n
LDA RRNCA STA @ R R N C A n
4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RRNCA.U can be specified within the range 0 to 15, and RRNCA.D 16 bits
Shift Instructions
Description of Operation
RRNCA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated right by n bits (towards the low-order bit).
The state of the LSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)
bit bit
15 0
(1-bit cycle)
0111100001111000
bit bit
15 0
CR2009(Carry) 1
RRNCA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated right by n bits (towards the low-order bit).
ARITHMETIC OPERATION
The state of the LSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)
INSTRUCTIONS
bit bit bit bit
31 16 15 0
(1-bit cycle)
4
01111000011110000111100001111000
Shift Instructions
bit bit
31 0
CR2009(Carry) 1
@RRNCA.□This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the RRNCA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM**** DM****
LDA RRNCA STA
DM**** DM****
LDA RRNCA STA
Operation flag
Sample Program
ARITHMETIC OPERATION
Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS
CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
LDA R30000
#16 ②
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RRNCA #1
4
RRNCA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Shift Instructions
RLNCA(.U)
RLNCA RLNCA.D RLNCA
No-carry left
Rotates the bit content of
internal registers towards
the larger bit No. by the
@RLNCA(.U) rotation
specified number of bits
@RLNCA
ARITHMETIC OPERATION
Execution condition n
LDA RLNCA STA R L N C A n
Execution condition n
LDA RLNCA STA @ R L N C A n
4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RLNCA.U can be specified within the range 0 to 15, and RLNCA.D 16 bits
Shift Instructions
Description of Operation
RLNCA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated left by n bits (towards the high-order bit).
The state of the MSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)
bit bit
15 0
1-bit cycle
1110000111100001
bit bit
15 0
CR2009(Carry) 0
RLNCA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated left by n bits (towards the high-order bit).
ARITHMETIC OPERATION
The state of the MSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)
INSTRUCTIONS
bit bit bit bit
31 16 15 0
(1-bit cycle)
4
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
Shift Instructions
bit bit
31 0
CR2009(Carry) 0
@RLNCA.□This instruction is executed for one scan at the rising edge of the execution condition.
Reference When the RLNCA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM**** DM****
LDA RLNCA STA
DM**** DM****
LDA RLNCA STA
Operation flag
Sample Program
ARITHMETIC OPERATION
Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS
CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
LDA R30000
#16 ②
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RLNCA #1
4
RLNCA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
Shift Instructions
WSR(.U)
WSR WSR.D
WSR
Word data
Shifts the word data
towards the larger
@WSR(.U) right shift device No. (larger
@WSR WSR
array subscript).
ARITHMETIC OPERATION
@WSR.D
*1 CR cannot be specified.
Description of Operation
WSR(.U) When the execution condition is ON, n1 16-bit data starting from D are shifted
towards larger device No. (larger array subscript) by n2 .
"0" is stored to n2 data starting from D .
Before executing After executing
D 1000 0
D +1 2000 0
Filled with 0
0
0
...
n1
D + n2 1000
( D +1)+ n2 2000
8000
D + n1 −1 9000
...
n2
8000
( D + n1 −1)+ n2 9000
WSR.D When the execution condition is ON, n1 32-bit data starting from [ D / D +1]
are shifted towards larger device No. (larger array subscript) by n2 .
"0" is stored to n2 data starting from D .
Before executing After executing
D +1 100000 D 0
D +3 200000 D +2 0
Filled with 0
0
0
...
n1
( D +1)+2 n2 100000 D +2 n2
( D +3)+2 n2 200000 ( D +2)+2 n2
800000
D +2( n1 −1)+1 900000 D +2( n1 −1)
...
n2
800000
( D +2( n1 −1)+1)+2 n2 900000 ( D +2( n1 −1)+2 n2
@WSR.□ This instruction is executed for one scan at the rising edge of the execution condition.
ARITHMETIC OPERATION
the low-order 16 bits of the shift source data is stored to the low-order 16 bits of the
shift destination data.
"0" is stored to both the high-order and low-order bits of the shift source data.
INSTRUCTIONS
Before execution After execution
Higher 16 Bits Lower 16 Bits Higher 16 Bits Lower 16 Bits
Shift source data $0001 $0002 $0000 $0000
Shift destination data $0003 $0004 $0000 $0002
Operation flag 4
Shift Instructions
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When n1 =0
• When the shifted result exceeds the device / work area range
CR2012 • When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50
Sample Program
Each time input relay R000 turns ON, the content of DM0 to DM99 is shifted by 1 word towards the
larger device No. (larger array subscript).
(Mnemonics list)
R000 WSR
DM0 #100 #1 LDP R000
WSR DM0 #100 #1
WSL(.U)
WSL
WSL
WSL.D Shifts the word data
Word data left towards the smaller
@WSL(.U) shift device No. (smaller
@WSL
WSL
array subscript).
ARITHMETIC OPERATION
@WSL.D
*1 CR cannot be specified.
Description of Operation
WSL(.U) When the execution condition is ON, n1 16-bit data starting from D are shifted
towards smaller device No. (smaller array subscript) by n2 .
"0" is stored to n2 data starting from D + n1 - n2 .
Before executing After executing
D − n2 1000
D ( +1)−
n2 2000
n2
...
D 1000
D +1 2000
8000
( D + n1 −1)−+n2 9000
...
n1
0
0
Filled with 0
8000 0
D + n1 −1 9000 0
WSL.D When the execution condition is ON, n1 32-bit data starting from [ D / D +1]
are shifted towards smaller device No. (smaller array subscript) by n2 .
"0" is stored to n2 data starting from D + n1 - n2 .
Before executing After executing
( D +1)−2 n2 100000 D −2 n2
( D +3)−2 n2 200000 ( D +2)−2 n2
n2
...
D +1 100000 D
D +3 200000 D +2
800000
( D +2( n1 −1)+1)−2 n2 900000 ( D +2( n1 −1)−2 n2
...
n1
0
0
Filled with 0
800000 0
D +2( n1 −1)+1 900000 D +2( n1 −1) 0
@WSL.□ This instruction is executed for one scan at the rising edge of the execution condition.
ARITHMETIC OPERATION
the low-order 16 bits of the shift source data is stored to the low-order 16 bits of the
shift destination data.
"0" is stored to both the high-order and low-order bits of the shift source data.
INSTRUCTIONS
Before execution After execution
Higher 16 Bits Lower 16 Bits Higher 16 Bits Lower 16 Bits
Shift source data $0001 $0002 $0000 $0000
Shift destination data $0003 $0004 $0000 $0002
Operation flag 4
Shift Instructions
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When n1 =0
• When the shifted result exceeds the device / work area range
CR2012 • When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50
Sample Program
Each time input relay R000 turns ON, the content of DM1000 to DM1099 is shifted by 1 word towards
the smaller device No. (smaller array subscript).
(Mnemonics list)
R000 WSL
DM1000 #100 #1 LDP R000
WSL DM1000 #100 #1
BSR(.U)
BSR
BSR
BSR.D Shifts the bit data
Bit data right towards the larger
@BSR(.U) shift device No. (larger
@BSR
BSR
array subscript).
ARITHMETIC OPERATION
@BSR.D
Description of Operation
BSR(.U) When the execution condition is ON, the state of n1 data starting from D is
shifted towards larger device No. (larger array subscript) by the number of times specified
by n2 .
n2 data starting from D are turned OFF (0 is stored).
Example BSR
MR101 #3 #4
“0”is filled in
BSR.D When the execution condition is ON, the state of n1 data starting from [ D /
D +1] is shifted towards larger device No. (larger array subscript) by the number of
times specified by n2 .
n2 data starting from D are turned OFF (0 is stored).
@BSR.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the shifted result exceeds the device / work area range
• When n1 is 0
• When the indirect specification or index modification range is inappropriate
• When a timer/counter has been specified by indirect specification in D or [ D /
CR2012 D +1]
• When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index 4
modification is not specified in the operand, and the access outside the operand range is not
Shift Instructions
checked.
"Out-of-range access of operands", page 1-50
Sample Program
Each time input relay R000 turns ON, the content of internal auxiliary relays MR000 to MR007 is shifted
towards the larger device No. (larger array subscript) by 8 bits at a time.
(Mnemonics list)
R000 BSR
MR000 #8 #8 LDP R000
BSR MR000 #8 #8
BSL(.U)
BSL
BSL
BSL.D Shifts the bit data
Bit data left towards the smaller
@BSL(.U) shift device No. (smaller
@BSL
BSL
array subscript).
ARITHMETIC OPERATION
@BSL.D
Description of Operation
BSL.U When the execution condition is ON, the state of n1 data starting from D is
shifted towards smaller device No. (smaller array subscript) by the number of times
specified by n2 .
n2 data starting from D + n1 - n2 are turned OFF (0 is stored).
Example BSL
MR109 #2 #3
Filled with 0
BSL.D When the execution condition is ON, the state of n1 data starting from [ D /
D +1] is shifted towards smaller device No. (smaller array subscript) by the number of
times specified by n2 .
n2 data starting from D + n1 - n2 are turned OFF (0 is stored).
@BSL.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the shifted result exceeds the device / work area range
• When n1 is 0
• When the indirect specification or index modification range is inappropriate
• When a timer/counter has been specified by indirect specification in D or [ D /
CR2012 D +1]
• When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index 4
modification is not specified in the operand, and the access outside the operand range is not
Shift Instructions
checked.
"Out-of-range access of operands", page 1-50
Sample Program
Each time input relay R000 turns ON, the content of internal auxiliary relays MR10008 to MR10015 is
shifted towards the smaller device No. (smaller array subscript) by 8 bits at a time.
(Mnemonics list)
R000 BSL
MR10008 #8 #8 LDP R000
BSL MR10008 #8 #8
LIMIT(.U)
LIMIT.S
LIMIT
LIMIT
LIMIT.D
LIMIT.L Perform upper /
Upper/lower
lower limit
ARITHMETIC OPERATION
limit
@LIMIT(.U) control for input
control
@LIMIT.S data.
@LIMIT
LIMIT
@LIMIT.D
@LIMIT.L
INSTRUCTIONS
Description of Operation
When the execution condition is ON, the upper/lower limit control is performed in upper limit and
lower limit for the input value, and the result is stored as output value.
Output value Output value
Upper limit
Input value
Input value
Lower limit
LIMIT(.U) When the execution condition is ON, S1 (upper limit), S2 (lower limit) and S3
(input value) are used as unsigned 16-bit BIN data to perform upper/lower limit control,
and the result is stored in D .
LIMIT.S When the execution condition is ON, S1 (upper limit), S2 (lower limit) and S3
(input value) are used as signed 16-bit BIN data to perform upper/lower limit control, and
the result is stored in D .
LIMIT.D When the execution condition is ON, [ S1 / S1 +1] (upper limit), [ S2 / S2 +1]
(lower limit)
ARITHMETIC OPERATION
and [ S3 / S3 +1] (input value) are used as unsigned 32-bit BIN data to perform
upper/lower limit control, and the result is stored in [ D / D +1].
LIMIT.L When the execution condition is ON, [ S1 / S1 +1] (upper limit), [ S2 / S2 +1]
INSTRUCTIONS
(lower limit)
and [ S3 / S3 +1] (input value) are used as signed 32-bit BIN data to perform upper/
lower limit control, and the result is stored in [ D / D +1].
@LIMIT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
When input relay R00 is ON, the values
(upper limit: 3500, lower limit: 500) used for performing limit control for analog data stored in DM10000
are stored in DM0.
(Mnemonics list)
R000 LIMIT
#500 #3500 DM10000 DM0 LD R000
Analog data amplitude LIMIT #500 #3500 DM10000 DM0
BANDC(.S)
BANDC
BANDC
BANDC.L Performs
Dead
dead band
band
@BANDC(.S) control for
control
@BANDC
BANDC
input data.
ARITHMETIC OPERATION
@BANDC.L
4 Operand Explanation
.S 16 bits
Occupied size
.S 16 bits
S2 Specifies the upper limit of dead band (no output space).
.L 32 bits
.S 16 bits
S3 Specifies the input value of dead band control.
.L 32 bits
.S 16 bits
D Specifies the storage location for output value of dead band control.
.L 32 bits
Description of Operation
When the execution condition is ON, the dead band control is performed in upper limit and lower
limit for the input value, and the result is stored as output value.
Output value Output value
input value
input value
BANDC(.S) When the execution condition is ON, S1 (lower limit), S2 (upper limit) and S3
(input value) are used as signed 16-bit BIN data to perform dead band control, and the
result is stored in D .
* In D , the value is stored within the rang of signed 16-bit BIN data.
• D ≦-32768→ D =-32768
• D ≧+32767→ D =+32767
BANDC.L When the execution condition is ON, [ S1 / S1 +1] (lower limit), [ S2 / S2 +1]
(upper limit)
ARITHMETIC OPERATION
and [ S3 / S3 +1] (input value) are used as signed 32-bit BIN data to perform dead
band control, and the result is stored in [ D / D +1].
INSTRUCTIONS
[ S1 ・ S1 +1]>[ S3 ・ S3 +1] [ S3 ・ S3 +1] (Input value)
(Lower limit) (Input value) −[ S1 ・ S1 +1] (Lower limit)
[ S2 ・ S2 +1]>[ S3 ・ S3 +1] [ S3 ・ S3 +1] (Input value)
(Upper limit) (Input value) −[ S2 ・ S2 +1] (Upper limit)
[ S1 ・ S1 +1]≦[ S3 ・ S3 +1]≦[ S2 ・ S2 +1]
0
(Lower limit)
* In [ D / D
(Input value) (Upper limit)
+1], the value is stored within the rang of signed 32-bit BIN data.
4
@BANDC.□This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
When input relay R000 is ON, the values (upper limit: 2000, lower limit: 1000) used for performing dead
band control for analog data stored in DM10000 are stored in DM0.
(Mnemonics list)
R000 BANDC.S
+1000 +2000 DM10000 DM0 LD R000
Analog data amplitude BANDC.S +1000 +2000 DM10000 DM0
ZONE(.S)
ZONE
ZONE
ZONE.L
Performs zone
Zone
control for input
@ZONE(.S) control
data.
@ZONE
ZONE
ARITHMETIC OPERATION
@ZONE.L
4 Operand Explanation
.S 16 bits
Occupied size
.S 16 bits
S2 Specifies the positive offset to be added to input value.
.L 32 bits
.S 16 bits
S3 Specifies the input value of zone control.
.L 32 bits
.S 16 bits
D Specifies the storage location for output value of zone control.
.L 32 bits
Description of Operation
When the execution condition is ON, the zone control is performed in negative offset and positive
offset for the input value, and the result is stored as output value.
Output value Output value
Positive offset
input value
input value
Negative offset
ZONE(.S) When the execution condition is ON, S1 (negative offset), S2 (positive offset) and
S3 (input value) are used as signed 16-bit BIN data to perform zone control, and the
result is stored in D .
* In D , the value is stored within the rang of signed 16-bit BIN data.
• D ≦-32768→ D =-32768
• D ≧+32767→ D =+32767
ARITHMETIC OPERATION
BIN data to perform zone control, and the result is stored in [ D / D +1].
INSTRUCTIONS
[ S3 / S3 +1] (Input value) <0
+ [ S1 / S1 +1] (Negative offset)
[ S3 / S3 +1] (Input value) =0 0
[ S3 / S3 +1] (Input value)
[ S3 / S3 +1] (Input value) >0
+ [ S2 / S2 +1] (Positive offset)
* In [ D / D +1], the value is stored within the rang of signed 32-bit BIN data.
• [
• [
D
D
/
/
D
D
+1]≦-2147483648→[
+1]≧+2147483647→[
D
D /
/ D
D
+1]=-2147483648
+1]=+2147483647
4
Operation flag
Sample Program
When input relay R00 is ON, the values
(negative: -1000, positive: +500) used for performing zone control for analog data stored in DM10000
are stored in DM0.
(Mnemonics list)
R000 ZONE.S
-1000 +500 DM10000 DM0 LD R000
Analog data amplitude ZONE.S -1000 +500 DM10000 DM0
APR(.U)
APR.S
APR.D
APR
APR
APR.L
APR.F To perform
ARITHMETIC OPERATION
APR.DF
approximation
Linear
calculation for
@APR(.U) approximation
input data in
@APR.S
INSTRUCTIONS
specified line.
@APR.D
@APR
APR
@APR.L
@APR.F
@APR.DF
4
Ladder program Input mode
Execution condition APR
S1 S2 n D A P R S1 S2 n D
Data Control Instructions
Point The APR.DF (@APR.DF) instruction can be used with the KV-8000 series CPU units
and KV-7000 Series CPU units that have CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
ARITHMETIC OPERATION
APR(.U) / APR.S
When the execution condition is ON, the approximation calculation is performed for the
"input value" of linear approximation stored in S1 according to "linear data table" of
INSTRUCTIONS
n logs starting from S2 .
The linear approximation calculation searches in which range of linear data table S1
(input value) is located, and the linear approximation is performed at previous and next
two points. The calculation result is stored in D (approximate result).
4
Y Foldline data form
(X2,Y2) (X3,Y3)
Index X Y
X 5 26 6
XP (X6,Y6) Number
6 28 0 of records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
Please store data of X in ascending order
Index X Y
S2 0 S2 S2 +1
Table start 1 S2 +2 S2 +3
2 S2 +4 S2 +5
3 S2 +6 S2 +7
4 S2 +8 S2 +9
5 S2 +10 S2 +11
6 S2 +12 S2 +13
(*n=7)
In n (logs), store the logs of linear data table. In addition, n is set to 2 or more.
APR.D / APR.L
When the execution condition is ON, the approximation calculation is performed for the
ARITHMETIC OPERATION
S1 +1] (input value) is located, and the linear approximation is performed at previous
and next two points.
The calculation result is stored in [ D / D +1] (approximate result).
Y Foldline data form
(X2,Y2) (X3,Y3)
4 YP [ S2 ・ S2 +1 ]
Index
0
X
0
Y
10
Table start 1 8 13
Data Control Instructions
(X1,Y1)
2 14 20
(X0,Y0) 3 20 20 n
(X4,Y4) (X5,Y5)
4 23 6
X 5 26 6
XP (X6,Y6) Number of
6 28 0 records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
The linear data table is stored from [ S2 / S2 +1] (table start) in the order of (X0,Y0),
(X1,Y1)…(Xn-1,Yn-1), (Xn,Yn).
The X value in linear data table is set in ascending order.
(X0<X1<…<Xk<…<Xn)
Index X Y
[ S2 ・ S2 +1 ] 0 S2・S2 +1 S2 +2・S2 +3
Table start 1 S2 +4・S2 +5 S2 +6・S2 +7
2 S2 +8・S2 +9 S2 +10・S2 +11
3 S2 +12・S2 +13 S2 +14・S2 +15
4 S2 +16・S2 +17 S2 +18・S2 +19
5 S2 +20・S2 +21 S2 +22・S2 +23
6 S2 +24・S2 +25 S2 +26・S2 +27
(*n=7)
In n (logs), store the logs of linear data table. In addition, n is set to 2 or more.
APR.F When the execution condition is ON, the approximation calculation (single precision
floating point type) is performed for the "input value" of linear approximation stored in
ARITHMETIC OPERATION
[ S1 / S1 +1] according to "linear data table" of n logs starting from [ S2 /
S2 +1].
The linear approximation calculation searches in which range of linear data table [ S1 /
INSTRUCTIONS
S1 +1] (input value) is located, and the linear approximation is performed at previous
and next two points.
The calculation result is stored in [ D / D +1] (approximate result).
Y Foldline data form
(X2,Y2) (X3,Y3)
YP [ S2 ・ S2 +1 ]
Index
0
X
0
Y
5.2
4
Table start 1 3.3 6.8
X 5 12.2 2.1
XP (X6,Y6) Number of
6 15.5 0 records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
The linear data table is stored from [ S2 / S2 +1] (table start) in the order of (X0,Y0),
(X1,Y1)…(Xn-1,Yn-1), (Xn,Yn).
Index X Y
[ S2 ・ S2 +1 ] 0 S2・S2 +1 S2 +2・S2 +3
Table start 1 S2 +4・S2 +5 S2 +6・S2 +7
2 S2 +8・S2 +9 S2 +10・S2 +11
3 S2 +12・S2 +13 S2 +14・S2 +15
4 S2 +16・S2 +17 S2 +18・S2 +19
5 S2 +20・S2 +21 S2 +22・S2 +23
6 S2 +24・S2 +25 S2 +26・S2 +27
(*n=7)
In n (logs), store the logs of linear data table. In addition, n is set to 2 or more.
APR.DF When the execution condition is ON, the approximation calculation (double precision
floating point type) is performed for the "input value" of linear approximation stored in
ARITHMETIC OPERATION
S1 +1/ S1 +2/ S1 +3] (input value) is located, and the linear approximation is
performed at previous and next two points.
The calculation result is stored in [ D / D +1/ D +2/ D +3] (approximate
result).
Y Foldline data form
4 (X2,Y2) (X3,Y3)
Index X Y
YP [
Data Control Instructions
S2 ・ S2 +1・ 0 0 5.2
S2 +2・ S2 +3 ] 1 3.3 6.8
(X1,Y1) Table start 2 5.7 13.9
(X0,Y0) 3 7.9 13.9 n
(X4,Y4) (X5,Y5)
4 9.9 2.1
X 5 12.2 2.1
XP (X6,Y6) Number of
6 15.5 0 records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
The linear data table is stored from [ S2 / S2 +1/ S2 +2/ S2 +3] (table start) in
the order of (X0,Y0), (X1,Y1)…(Xn-1,Yn-1), (Xn,Yn).
The X value in linear data table is set in ascending order.
(X0<X1<…<Xk<…<Xn)
Index X Y
[ S2 ・ S2 +1・ 0 S2・S2 +1・S2 +2・S2 +3 S2 +4・S2 +5・S2 +6・S2 +7
S2 +2・ S2 +3] 1 S2 +8・S2 +9・S2 +10・S2 +11 S2 +12・S2 +13・S2 +14・S2 +15
Table start 2 S2 +16・S2 +17・S2 +18・S2 +19 S2 +20・S2 +21・S2 +22・S2 +23
3 S2 +24・S2 +25・S2 +26・S2 +27 S2 +28・S2 +29・S2 +30・S2 +31
4 S2 +32・S2 +33・S2 +34・S2 +35 S2 +36・S2 +37・S2 +38・S2 +39
5 S2 +40・S2 +41・S2 +42・S2 +43 S2 +44・S2 +45・S2 +46・S2 +47
6 S2 +48・S2 +49・S2 +50・S2 +51 S2 +52・S2 +53・S2 +54・S2 +55
(*n=7)
In n (logs), store the logs of linear data table. In addition, n is set to 2 or more.
@APR.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
APR(.U) • ON when n <2 or n >32767.
APR.S • ON when the range of specified data table is inappropriate.
APR.D • ON when the indirect specification or index modification range is inappropriate.
APR.L • ON when an access outside the operand range occurs.
Otherwise, OFF
APR.F • ON when n <2 or n >32767.
•
•
ON when the range of specified data table is inappropriate.
ON when the indirect specification or index modification range is inappropriate. 4
• ON when the values are outside the range of single precision floating point is
Sample Program
Series is scaled (0 to 255 → -1000 to +1000) using the two data tables from DM0 and stored in DM100.
Index X Y
Table start DM0 0 0 -1000 DM1 2
INSTRUCTIONS
Number of records
4 CR2008 +0
DW.S
-1000
DW.S
+255
DW.S
+1000
DW.S
DM0 DM1 DM2 DM3
Data Control Instructions
ON for 1 scan
at operation start Tabel start
R000 APR.S
CM1630 DM0 #2 DM100
Volume0 Tabel start Result after ar
ithmetic operation
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
Data Control Instructions
Description of Operation
ARITHMETIC OPERATION
RAMP When the execution condition is ON, the D (output value) value is approached to the
specified inclination ( S2 (change rate) / S3 (time unit)) until the value matches
S1 (input value).
INSTRUCTIONS
When the output value is overwritten by an instruction other than the RAMP instruction,
the output approaches the input value at the specified inclination.
ON
Execution
condition OFF
Value
S1
(input
value) 4
Time
Reference When used in combination with the PIDAT instruction, the PIDAT instruction’s target
value can be gradually changed at a constant inclination.
“PIDAT Instruction”, (page 5-126)
Operation flag
Sample Program
ARITHMETIC OPERATION
(1)When the internal relay MRO turns ON, the output value stored in data memory DM100 is changed
from +200 to +1000 at a rate of 50 per second.
(Mnemonics list)
INSTRUCTIONS
MR000 +200
DW.S LDP MR000
DM100 DW.S +200 DM100
MR000 LD MR000
RAMP RAMP +1000 #50 #0 DM100
+1000 #50 #0 DM100
4 ON
MR0
Data Control Instructions
OFF
DM100
1000
250
200
Time
1seconds
16 seconds
(2)When the internal relay MRO turns ON, the output value stored in data memory DM100 is changed
to the target value set in data memory DM200. When the output value increases, it changes at a rate
ARITHMETIC OPERATION
of 50 per second, and when the output value decreases, it changes at a rate of 100 per second.
(Mnemonics list)
MR000 +0
DW.S LDP MR000
INSTRUCTIONS
DM100 DW.S +0 DM100
MR000 DM200 LD MR000
RAMP MPS
>=.S DM200 #50 #0 DM100 AND>=.S DM200 DM100
DM100 RAMP DM200 #50 #0 DM100
MPP
DM200 RAMP AND<.S DM200 DM100
<.S DM200 #100 #0 DM100 RAMP DM200 #100 #0 DM100
4
DM100
ON
0 300 100
DM200
DM100
300
100
Time
6 seconds 2 seconds
Time
TPOUT TPOUT Turns the bit ON/OFF at a
proportional
specified ON time and cycle.
output
ARITHMETIC OPERATION
*1 When bit data is specified, 1 bit is occupied. When word data is specified, the LSB of 1 word is
Data Control Instructions
used as an output relay. Bits other than LSB do not change.Bit specifying can not be used for
word devices.
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", (page 4)
Description of Operation
ARITHMETIC OPERATION
TPOUT While the execution condition is ON, D is turned ON for S1 ms at the control
cycle specified with S2 ms.
INSTRUCTIONS
Execution ON
condition OFF
If the execution
condition turns
OFF, the output
relay also turns
4
OFF.
D ON
OFF
S1 ×1ms S1 ×1ms S1' ×1ms
Reference When used in combination with the PIDAT instruction, the PIDAT instruction operation
amount output value can be changed to a pulse output with the TPOUT instruction.
“PIDAT Instruction”, (page 5-126)
Operation flag
Sample Program
ARITHMETIC OPERATION
While the internal relay MR0 is ON, the output relay R500 turns ON and performs pulse output at a1
second (1000ms) cycle for the ON time stored in data memory DM100.
(Mnemonics list)
INSTRUCTIONS
ON
MR0
4
OFF
Data Control Instructions
R500
One second(1000ms)
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Data Control Instructions
Description of Operation
ARITHMETIC OPERATION
LLFLT Description of Parameters
Parameter Explanation
Specifies the cycle time for executing the instruction. (1
INSTRUCTIONS
D1 Sampling period (TS) to 60000m)
Specify a value smaller than the lag time and lead time.
Specifies the time constant for the lag element. (0 to
D1 +
Lag time (T1) 65535ms)
1
Lag is disabled if 0 is specified.
Specifies the time constant for the lead element. (0 to
D1 +2 Lead time (T2) 65535ms)
Lead is disabled if 0 is specified.
4
X : S input value
Y : D2 output value
T1:( D1 +1 )delay time input value
T2:( D1 +2 )lead time
1+ T2 s
Y (s) = X (s)
1+ T1 s output value
When T2<T1
Time
Reference When used in combination with the PIDAT instruction, this can be used to eliminate the
noise elements of the measured value or when using together with the feed forward
control.
“PIDAT Instruction”, (page 5-126)
Point • If writing is attempted during RUN, the sampling cycle ( D1 +1) is initialized, and the
output value ( D2 ) is initialized with the input value ( S ).
• This instruction cannot be used in interrupt programs or in the initialization module.
• Attention should be paid when used among the STP to STE instructions, among the
STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL instructions in
subroutine.
Refer to "Precautions when using timing instructions" in the User's Manual of the CPU
unit used.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit used.
Operation flag
ARITHMETIC OPERATION
4 •
•
When a timer/counter has been specified by indirect specification in D1 or
When an access outside the operand range occurs
D2
* The instruction is executed even when the operation cycle is exceeded. If CR2012 turns ON in any
other case, the instruction is not executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
While the internal relay MR0 is ON, a lead-lag filter having 1 second(1000ms) sampling cycle, 5second
(5000ms) lag time, and 0 lead time (disabled) is applied on the input value stored in data memory
DM200. The resulting output value is stored in data memory DM100.
(Mnemonics list)
MR000 #1000 #5000 #0
DW DW DW LD MR000
DM500 DM501 DM502 DW #1000 DM500
CON
MR000 LLFLT DW #5000 DM501
DM200 DM500 DM100 CON
DW #0 DM502
LD MR000
LLFLT DM200 DM500 DM100
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
TBCD(.U)
TBCD TBCD.D TBCD
Binary → Converts BIN data stored in
BCD internal registers to BCD
@TBCD(.U) data.
@TBCD
conversion
ARITHMETIC OPERATION
@TBCD.D TBCD
Execution condition
LDA TBCD STA T B C D
Execution condition
LDA TBCD STA @ T B C D
4 Description of Operation
Data Conversion Instructions
TBCD(.U) When the execution condition is ON, the 16-bit BIN data currently stored in the 16-bit
internal register is converted to 4-bit BCD data, and the result is stored in the 16-bit
internal register.
When the operation result exceeds the 4-bit BCD data range of 0 to 9999, operation flag
CR2012 turns ON. At this time, the value of the 16-bit internal register is not changed
before or after execution of the instruction.
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
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
1 2 3 4
TBCD.D When the execution condition is ON, the 32-bit BIN data currently stored in the 32-bit
internal register is converted to 8-bit BCD data, and the result is stored in the 32-bit
internal register.
When the operation result exceeds the 8-bit BCD data range of 0 to 99999999, operation
flag CR2012 turns ON. At this time, the value of the 32-bit internal register is not changed
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
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
1 2 3 4 5 6 7 8
This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when the BIN data currently stored in the internal register is outside of the range. Otherwise,
CR2012
OFF
TBIN(.U)
TBIN TBIN.D TBIN
BCD → Converts BCD data stored in
Binary internal registers to BIN
@TBIN(.U) data.
@TBIN
conversion
ARITHMETIC OPERATION
@TBIN.D TBIN
Execution condition
LDA TBIN STA T B I N
Execution condition
LDA TBIN STA @ T B I N
4 Description of Operation
Data Conversion Instructions
TBIN(.U) When the execution condition is ON, the 4-bit BCD data currently stored in the 16-bit
internal register is converted to 16-bit BIN data, and the result is stored in the 16-bit
internal register.
When the 4-bit BCD data is outside of the range (0 to 9999), operation flag CR2012 turns
ON. At this time, the 16-bit internal register is not changed before or after execution of the
instruction.
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
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
1234
TBIN.D When the execution condition is ON, the 8-bit BCD data currently stored in the 32-bit
internal register is converted to 32-bit BIN data, and the result is stored in the 32-bit
internal register.
When the 8-bit BCD data is outside of the range (0 to 99999999), operation flag CR2012
turns ON. At this time, the 32-bit internal register is not changed 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
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
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
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
12345678
@TBIN.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when the BCD data currently stored in the internal register is outside of the range.Otherwise,
CR2012
OFF
MPX
t
MPX s
4 bits → 16 bits To decode number of 1-digit (4-bit) in
→
internal register to 16-bit BIN data.
@MPX
decode
MPX
1
ARITHMETIC OPERATION
DMX DMX
16 bits → 4 bits
To encode bit position of the MSB
whose 16-bit BIN data in the internal
b
i
@DMX
encode t
DMX register is "1" to a 4-bit value. s
INSTRUCTIONS
4
LDA MPX STA @ M P X
Execution condition
LDA DMX STA D M X
Execution condition
Data Conversion Instructions
Description of Operation
MPX When the execution condition is ON, the n th digit of the 16-bit internal register is
digitized. The bit indicated by that value is turned ON ("1" is stored).
Example When the data currently stored in the 16-bit internal register is $71 and
n is #1.
n bit (#1)
#3 #2 #1 #0
16-bit
internal 0000000001110001
register
DMX When the execution condition is ON, the position of the MSB of the bits that are ON ("1")is
stored in 16-bit internal register as BIN data.
Example When the data currently stored in 16-bit internal register is 138 (10001010
in BIN)
omitted
16-bit F E D C B A 9 8 7 6 5 4 3 2 1 0
internal 0000000010001010
register
The highest bit is bit7 in ON devices, so “7”
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when the value of the data (internal register) to be operated on is "0". Otherwise, OFF
CR2012
No change in the MPX instruction.
DMX When sensors 0 to 15 are connected to input relays R30000 to R30015 respectively,
and one bit of BIN indicator is connected to output relays R30500 to R30503.
Which sensor is ON is indicated by the BIN display.
*Note, however, that this sample program assumes that multiple sensors are not ON at
the same time.
(Mnemonics list)
CR2002 R30000 R30500
LDA DMX STA LD CR2002
LDA R30000
CON
DMX
CON
STA R30500
GRY(.U)
GRY GRY.D GRY
Gray code
To convert the values
currently stored in
@GRY(.U) conversion internal registers to Gray
@GRY code.
ARITHMETIC OPERATION
@GRY.D GRY
RGRY(.U)
RGRY RGRY.D RGRY To convert the Gray code
INSTRUCTIONS
4 Execution condition
LDA GRY STA G R Y
Data Conversion Instructions
Execution condition
LDA GRY STA @ G R Y
Execution condition
LDA RGRY STA R G R Y
Execution condition
LDA RGRY STA @ R G R Y
Description of Operation
GRY(.U) When the execution condition is ON, the 16-bit BIN data currently stored in the 16-bit
internal register is converted to gray code.
GRY.D When the execution condition is ON, the 32-bit BIN data currently stored in the 32-bit
internal register is converted to gray code.
RGRY(.U) When the execution condition is ON, the gray code currently stored in the 16-bit internal
register is converted to 16-bit BIN data.
RGRY.D When the execution condition is ON, the gray code currently stored in the 32-bit internal
register is converted to 32-bit BIN data.
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.
bit
Decimal
ARITHMETIC OPERATION
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
INSTRUCTIONS
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
4 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
5 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
6 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
7 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
8
9
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
0
0
0
1
4
65535 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Operation flag
Sample Program
ARITHMETIC OPERATION
The unsigned 16-bit BIN data currently stored in data memory DM0 is converted to Gray code. The
result is stored to DM10. The result is stored to DM10.
(Mnemonics list)
INSTRUCTIONS
4 The 8-bit gray code captured by input relays R000 to R007 is converted to unsigned 16-bit BIN data.
The result is stored to DM0.
Data Conversion Instructions
(Mnemonics list)
CR2002 R000 $00FF DM0
LDA ANDA RGRY STA LD CR2002
LDA R000
CON
ANDA $FF
CON
RGRY
CON
STA DM0
When converting remainder gray codes, the relationship between A: resolution, n: input bit count andm:
remainder gray setting value is as follows.
m = (2n–A)/ 2 (n is a value that satisfies the relation 2n-1< A ≦2n)
When the resolution is 360, n = 9 (input mask bit 9 bits (H01FF)), m = 76
Remainder Gray codes of resolution 360 loaded by input relays R30000 to R30008 are converted to 16-
bit unsigned BIN data.
The result is stored to DM0.
(Mnemonics list)
CR2002 R30000 $01FF #76 DM0
LDA ANDA RGRY SUB STA LD CR2002
常時ON LDA R30000
CON
ANDA $01FF
CON
RGRY
CON
SUB #76
CON
STA DM0
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
DISN(.U)
DISN
DISN
DISN.D To disperse data into nibbles
Disperse (in 4 bits) and store each of
@DISN(.U) nibble them to the reference
@DISN
DISN
destination.
ARITHMETIC OPERATION
@DISN.D
4 KV-1000
Data Conversion Instructions
Description of Operation
DISN(.U) KV-1000 When the execution condition is ON, the content of S (16 bits) is dispersed
to 4 digits bit wise (4 bits), and is stored in D to D +3. "0" is stored in the
high-order bits from Bit 4.
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
KV-8000/7500/7300/5500/5000/3000,
KV-5500/5000/3000, KV Nano Series
KV Nano Series When performing above operation, the bits
stored after dispersed by n can be used.
DISN.D KV-1000 When the execution condition is ON, the content of S (32 bits) is dispersed
to 4 digits bit wise (4 bits), and is stored in D to D +7. "0" is stored in the
ARITHMETIC OPERATION
high-order bits from Bit 4.
bit bit bit bit bit bit bit bit
31 24 23 16 15 8 7 0
S +1 1 2 3 4 5 6 7 8 : S
INSTRUCTIONS
bit bit bit bit
15 8 7 0
0 0 0 8 : D
0 0 0 7 : D +1
0 0 0 6 : D +2
0 0 0 5 : D +3
0 0 0 4 : D +4
0 0 0 3 : D +5
0
0
0
0
0
0
2
1
:
:
D
D
+6
+7
4
@DISN.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
■ KV-1000
When input relay R000 is ON, the 4-bit BCD data currently stored in data memory DM0 is dispersed bit
wise in nibbles. The result is stored in 4 words starting from DM10.
(Mnemonics list)
R000 DISN
DM0 DM10 LD R000
DISN DM0 DM10
UNIN(.U)
UNIN
UNIN
UNIN.D To unite low-order 4 bits of
data stored in the reference
Unite nibble
@UNIN(.U) source to 16-bit (32-bit) BIN
@UNIN
UNIN
data.
ARITHMETIC OPERATION
@UNIN.D
4 KV-1000
Data Conversion Instructions
Description of Operation
UNIN(.U) KV-1000 When the execution condition is ON, the low-order 4 bits of S to S +3
are united into 16-bit BIN data, and are stored in D .
bit bit bit
15 4 0
S : 1
S +1 : 2
S +2 : 3
S +3 : 4
D : 4 3 2 1
UNIN.D KV-1000 When the execution condition is ON, the low-order 4 bits of S to S +7
are united into 32-bit BIN data, and are stored in D .
ARITHMETIC OPERATION
bit bit bit bit bit
15 8 7 4 0
S : 1
S +1 : 2
INSTRUCTIONS
S +2 : 3
S +3 : 4
S +4 : 5
S +5 : 6
S +6 : 7
S +7 : 8
4
bit bit bit bit bit bit bit bit
31 24 23 16 15 8 7 0
D +1: 8 7 6 5 4 3 2 1 : D
@UNIN.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
■ KV-1000
When input relay R000 is ON, the BCD data currently stored in the low-order 4 bits of data memories
DM0 to DM3 are united. The result is stored to DM10.
(Mnemonics list)
R000 UNIN
DM0 DM10 LD R000
UNIN DM0 DM10
DISB(.U)
DISB
DISB
DISB.D To disperse data into bytes
Disperse (in 8 bits) and store each of
@DISB(.U) byte them to the reference
@DISB
DISB
destination.
ARITHMETIC OPERATION
@DISB.D
INSTRUCTIONS
4 KV-1000
Data Conversion Instructions
Description of Operation
DISB(.U) KV-1000 When the execution condition is ON, the content of S (16 bits) is dispersed
to 2 digits bit wise (8 bits), and is stored in D to D +1. "0" is stored in the
high-order bits from Bit 8.
bit bit bit bit
15 8 7 0
S : 1 2 3 4
D : 0 0 3 4
D +1 : 0 0 1 2
Filled with 0 in
higher bytes (8-bits).
KV-8000/7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits
stored after dispersed by n can be used.
DISB.D KV-1000 When the execution condition is ON, the content of S (32 bits) is dispersed
to 4 digits bit wise (8 bits), and is stored in D to D +3. "0" is stored in the
ARITHMETIC OPERATION
high-order bits from Bit 8.
bit bit bit bit bit bit bit bit
15 8 7 0 15 8 7 0
S +1: 1 2 3 4 5 6 7 8 : S
INSTRUCTIONS
bit bit bit bit
15 8 7 0
D : 0 0 7 8
D +1 : 0 0 5 6
D +2 : 0 0 3 4
D +3 : 0 0 1 2
Filled with 0
in higher bytes (8-bits). 4
KV-8000/7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits
@DISB.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
■ KV-1000
The data loaded from input relays R30000 to R30015 are dispersed into bytes, and stored in data
memories DM10 and DM11.
(Mnemonics list)
CR2002 DISB
R30000 DM10 LD CR2002
DISB R30000 DM10
UNIB(.U)
UNIB
UNIB
UNIB.D To unite low-order 8 bits of
data stored in the reference
Unite byte
@UNIB(.U) source to 16-bit (32-bit) BIN
@UNIB
UNIB
data.
ARITHMETIC OPERATION
@UNIB.D
INSTRUCTIONS
4
S D n
KV-1000
Data Conversion Instructions
Description of Operation
UNIB(.U) KV-1000 When the execution condition is ON, the low-order 8 bits of S to S +1
are united into 16-bit BIN data, and are stored in D .
bit bit bit bit
15 8 7 0
S : 3 4
S +1 : 1 2
D : 1 2 3 4
UNIB.D KV-1000 When the execution condition is ON, the low-order 8 bits of S to S +3
are united into 32-bit BIN data, and are stored in D .
ARITHMETIC OPERATION
bit bit bit bit
15 8 7 0
S : 7 8
S +1 : 5 6
INSTRUCTIONS
S +2 : 3 4
S +3 : 1 2
D
KV-8000/7500/7300/5500/5000/3000, KV Nano Series
+1: 1 2 3 4 5 6 7 8
@UNIB.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
■ KV-1000
The 4-bit BCD data captured by input relays R30000 to R30007 (low-order 2 bits after uniting) and
R30100 to R30107 (high-order 2 bits after uniting) are united, and stored in data memory DM10.
(Mnemonics list)
CR2002 UNIB
R30000 DM10 LD CR2002
UNIB R30000 DM10
SWAP(.U)
SWAP SWAP.D SWAP
To swap the high-order / low-
Swap order data of the internal
@SWAP(.U) register.
@SWAP
ARITHMETIC OPERATION
@SWAP.D SWAP
Execution condition
LDA SWAP STA S W A P
Execution condition
LDA SWAP STA @ S W A P
4 Description of Operation
Data Conversion Instructions
SWAP(.U) When the execution condition is ON, the values of the high-order byte (high-order 8 bits)
and low-order byte (low-order 8 bits) of the 16-bit data currently stored in 16-bit internal
register are swapped, and stored in 16-bit internal register.
After
3 4 1 2 ←16-bit internal register:$3412
executing
SWAP.D When the execution condition is ON, the values of the high-order word (high-order 16 bits)
and low-order word (low-order 16 bits) of the 32-bit data currently stored in 32-bit internal
register are swapped, and stored in 32-bit internal register.
Before
1 2 3 4 5 6 7 8 ←32-bit internal register:$12345678
executing
After
executing 5 6 7 8 1 2 3 4 ←32-bit internal register:$56781234
@SWAP.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, the high-order and low-order bytes of data memory DM0 are swapped,
and stored in DM10.
(Mnemonics list)
INSTRUCTIONS
R000 DM0 DM10
LDA SWAP STA LD R000
LDA DM0
CON
SWAP
CON
STA DM10
BSWAP BSWAP
Block
Swaps the high-order byte and low-
order byte of data in a specified
swap
@BSWAP BSWAP range.
ARITHMETIC OPERATION
D B S W A P
4
D
low-order byte are swapped.
n Specifies the range of data to be swapped. 16 bits
Data Conversion Instructions
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
BSWAP When the execution condition is ON, the high-order byte (high-order 8 bits) and low-order
byte (low-order 8 bits) of n data starting from D are swapped.
high-order 8 bits low-order 8 bits high-order 8 bits low-order 8 bits
D 12 34 34 12 D
D +1 56 78 78 56 D +1
D +2 9A BC BC 9A D +2
D +3 DE FG FG DE D +3
D + n −2 ST UV UV ST D + n −2
D + n −1 WX YZ YZ WX D + n −1
@BSWAP This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
When the input relay R000 is ON, the high-order bytes and low-order bytes of data memory DM0
toDM99 are swapped.
(Mnemonics list)
INSTRUCTIONS
R000 BSWAP LD R000
DM0 #100 BSWAP DM0 #100
XCH(.U)
XCH
XCH
XCH.D
To exchange data of
Exchange two reference
@XCH(.U) destinations.
@XCH
XCH
ARITHMETIC OPERATION
@XCH.D
4
Operand Explanation Occupied size
.U 16 bits
D1 Specifies the data to be exchanged.
.D 32 bits
Data Conversion Instructions
.U 16 bits
D2 Specifies the data to be exchanged.
.D 32 bits
Description of Operation
XCH(.U) When the execution condition is ON, the 16-bit data currently stored in D1 and D2
are exchanged.
1 2 3 4 A B C D
bit
15
D2 bit
0
bit
15
D2 bit
0
A B C D 1 2 3 4
XCH.D When the execution condition is ON, the 32-bit data currently stored in [ D1 / D1 +1]
and [ D2 / D2 +1] are exchanged.
Example When the execution condition is ON, the 32-bit data currently stored in
[ D1 / D1 +1] and [ D2 / D2 +1] are exchanged.
Before executing After executing
bit
31
D1 +1 D1 bit
0
bit
31
D1 +1 D1 bit
0
0 1 2 3 4 5 6 7 8 9 A B C D E F
bit
31
D2 +1 D2 bit
0
bit
31
D2 +1 D2 bit
0
8 9 A B C D E F 0 1 2 3 4 5 6 7
@XCH.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF. It will not change when indirect specification
CR2012 or index modification is not specified in the operand, and the access outside the operand range is
not checked.
"Out-of-range access of operands", page 1-50
Sample Program
When input relay R000 is ON, the unsigned 16-bit BIN data currently stored in data memories DM0
toDM9 is exchanged in order of the smallest value starting from DM0. When the exchange is
completed, the program sequence between the FOR and NEXT instructions ends.
(Mnemonics list)
FOR
#9 FOR #9
LD R000
R000 #0 TM10 #1 TM11 R1000 LDA #0
LDA STA LDA STA RES CON
STA TM10
CON
FOR LDA #1
#9 CON
STA TM11
CON
#TM10 XCH
RES R1000
> #TM10 #TM11
FOR #9
#TM11
LD> #TM10 #TM11
R1000 XCH #TM10 #TM11
SET SET R1000
CR2002 TM10 TM11 LD CR2002
INC INC INC TM10
CON
INC TM11
NEXT
NEXT
LDB R1000
BREAK
R1000 BREAK NEXT
NEXT
DECO DECO
8-bit decode
To decode the numbers of the low-order
n bits of the internal register
@DECO DECO to 2n bit BIN data (n=1 to 8)。
ARITHMETIC OPERATION
Execution condition D
LDA DECO @ D E C O D n
n
Operand Explanation Occupied size
*1 When word data is specified, the LSB of continuous 2n word data becomes the storage location
Data Conversion Instructions
for the decode result (Other bits than the LSB do not change).
*2 Devices other than DM/EM/ZF can be used only with KV-8000/7000 Series CPU unit, KV-5000/
3000 Series CPU unit with CPU function version 2.0 or later, and KV Nano Series base units.
Description of Operation
DECO When the execution condition is ON, the low-order n bits of the internal register are
decoded. (From here on, the decoded DEC value is set to "K".)
In the continuous 2n bits starting from D , the (K + Start No.) bit is turned ON ("1" is
stored). Others are turned OFF ("0" is stored).
Example When the data currently stored in the internal register is #5, D is
MR100, and n is #3
@DECO This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
• When n ≧9
• When the continuous 2 n bit data starting from D exceeds the device / work area
range
• When the indirect specification or index modification range is inappropriate
CR2012 • When an access outside the operand range occurs
ON in the above cases. Otherwise, OFF.
It will not change when n is a constant and indirect specification or index modification is not
specified for D , and the access outside the operand range is not checked. 4
"Out-of-range access of operands", page 1-50
Sample Program
When BIN digital switch one bit is connected to input relays R30000 to R30003, and lamps 0 to 15 are
connected to each of output relays R30500 to R30515.
The worker lights the lamp matched to the setting of the BIN digital switch.
When the digital switch is set to "8", output relay R30508 turns ON, and lamp "8" lights.
(Mnemonics list)
CR2002 R30000 R30500
LDA DECO LD CR2002
#4 LDA R30000
CON
DECO R30500 #4
ENCO ENCO
8-bit encode
To encode "1" (ON) positions in the
specified continuous n bit data to an 8-bit
@ENCO ENCO value.
ARITHMETIC OPERATION
Execution condition S
ENCO STA @ E N C O S n
n
Operand Explanation Occupied size
4 S
n
Specifies the start to store the encode target.*1
Specifies the number of bits (1 to 256) to encode.*2
1 bit×
16 bits
n
*1 When word data is specified, the LSB of continuous word data becomes the storage
Data Conversion Instructions
location for the decode result (Other bits than the LSB do not change).
*2 Devices other than DM/EM/ZF can be used only with KV-8000/7000 Series CPU unit, KV-5000/
3000 Series CPU unit with CPU function version 2.0 or later, and KV Nano Series base units.
Description of Operation
ENCO When the execution condition is ON, the positions of bits turned ON (set to 1) in the
continuous n bits starting from S are stored as BIN data in the 16-bit internal
register.
When multiple bits in n bits are ON ("1"), the LSB is valid.
The value of 0 to ( n -1) is stored in the 16-bit internal register.
@ENCO This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
• When the data specified by S and n exceed the device / work area range
CR2012
• When n bits from S are not ON
• When the indirect specification or index modification range is inappropriate
INSTRUCTIONS
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
4
"CR/CM List", page A-43
Sample Program
ABS(.S)
ABS.L
ABS ABS.F
ABS.DF
ABS
Absolute
ARITHMETIC OPERATION
4 Execution condition
LDA ABS STA @ A B S
Data Conversion Instructions
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
ABS(.S) When the execution conditions turn ON, if the data stored in the 16-bit internal register is
less than 0, the sign is reversed (two's complement operation), and the value is stored in
the internal register.
This is not executed if the value stored in the internal register is greater than 0.
bit bit
15 0
10000000000000000
1100111111000111
bit bit
15 0
ABS.L When the execution conditions turn ON, if the data stored in the 32-bit internal register is
less than 0, the sign is reversed (two's complement operation), and the value is stored in
the internal register.
This is not executed if the value stored in the internal register is greater than 0.
bit bit bit bit
31 16 15 0
100000000000000000000000000000000
10110110011010011111110100101110
ABS.F When the execution condition is ON, if the single precision floating point type real number
stored in the 32-bit internal register is less than 0, the sign is reversed and the value is
ARITHMETIC OPERATION
stored in the internal register.
This is not executed if the value stored in the internal register is greater than 0.
INSTRUCTIONS
32-bit internal register 32-bit internal register
Single precision floating point type real number -1 × Single precision floating point type real number
32-bit 32-bit
ABS.DF When the execution conditions turn ON, if the double precision floating point type real
number stored in the 64-bit internal register is less than 0, the sign is reversed and the
value is stored in the internal register. 4
This is not executed if the value stored in the internal register is greater than 0.
Double precision floating point type real number -1 × Double precision floating point type real number
64-bit 64-bit
@ABS.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
CPMSET CPMSET
CIP message Creates the data sent with
creation CIP messaging.
@CPMSET CPMSET
ARITHMETIC OPERATION
S1 S2 D C P M S E T S1 S2 D
Specifies the start of the transmit data of the CIP data type to be Number of CIP
D
created.*1 characters*2
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
CPMSET When the execution condition is ON, the data stored in S1 is added to the area
following the data size (in bytes) stored in D + 0 in the data type specified with the
high-order 4 bits of S2 and the data size (in bytes) specified with the low-order 12 bits
of S2 .
The data size of D +0 is updated after the data is added.
When the data is added for the first time, 0 is stored in D +0 before the instruction is
executed.
The CPMSET instruction is used to create the CIP data type text string data and numeric
data.
For details on the CIP data types, refer to "EtherNet/IP Function User's Manual".
bit bit
15 0
S2
Data type Data size (byte unit)
Example The operation of the CPMSET instruction is explained using creation of the following type
of CIP data type send data as an example.
ARITHMETIC OPERATION
Send data to be created
bit bit
15 0
INSTRUCTIONS
13(000DH) Data size (byte unit)
22H 11H 2-byte numeric data 2211H
5(0005H) CIP text string type data "ABCDE"
The CIP text string type data specifies
B(42H) A(41H)
the data size with the leading word,
D(44H) C(43H) and stores the text string in the order
4
of low-order byte to high-order byte.
33H E(45H)
55H 44H 4-byte numeric data 66554433H
data is stored following D + 1, and the stored data size (in bytes) is added to
D +0.
Data storage start position: 0
Specifies 2-byte numeric data bit bit
15 0
S2 0002H
0(0000H) D +0
bit bit
15 0 D +1
S1 +0 22H 11H
Example 2) Convert the text string "ABCDE" into CIP text string type data, and add it. In
this example, the data is added after the Example 1) 2-byte numeric data.
ARITHMETIC OPERATION
Specify 1000H (text string)* in S2 , and execute CPMSET instruction. Convert the
text string specified after S1 into CIP text string type data, and add to the end of
the CIP message specified in D created in Example 1). The added data size (in
INSTRUCTIONS
bytes)
is added to D +0.
*If 0 is specified for the low-order 12 bits of S2 , the text string up to NULL (00H)
is converted.
4
CIP message created in Example 1)
bit bit
15 0
2(0002H) D +0
Specifies text string
Data Conversion Instructions
Example 3) The 4-byte numeric data is stored. In this example, the data is added after the
Example 2) text string data.
0004H (4 bytes other than text string) is specified in S2 , and the CPMSET
instruction is executed.
The numeric data is added after the CIP message specified in D created in
Example 2). The added data size (in bytes) is added to D +0.
bit bit
15 0
Specifies 4-byte numeric data 9 D +0
Point When 1 (text string) is specified for the high-order 4 bits of S2 , and 1 to 1999 is
specified for the low-order 12 bits of S2 , a text string with the specified number
ARITHMETIC OPERATION
of bytes is stored. 00H is added to the characters following NULL(00H). The
specified number of characters is added to D +0.
INSTRUCTIONS
Specifies number of characters
00H is stored after
S2 16(0010H) NULL(00H)
High-order Low-order
bit bytes bytes bit bit bit
15 0 Low-order bytes 15 0
S1 +0 ① A(41H) ② B(42H)
Low-order bytes Data size (byte unit) D +0
of character size 3⇒21
4
High-order bytes
S1 +1 ③ C(43H) NUL(00H) of character size
D +1
Low-order bytes
S1 +2 ① A(41H) of character size
D +2
High-order bytes
S1 +6 ・
・ ・
・ ・
・
@CPMSET Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
ARITHMETIC OPERATION
When the input relay MR000 turns ON, the data is converted into CIP data in the order of unsigned 16-
bit BIN data (1234), text string (ABCD: 4 bytes), and unsigned 32-bit BIN data (1234567890), and is
stored in DM1 and following. The total data is stored in DM0.
INSTRUCTIONS
(Mnemonics list)
MR000 MOV
#1234 @DM0 LDP MR000
MOV #1234 @DM0
CPMSET @DM0 #2 DM0
CPMSET SMOV "ABCD" @DM0
CPMSET @DM0 $1000 DM0
4
@DM0 #2 DM0 MOV.D #1234567890 @DM0
CPMSET @DM0 #4 DM0
SMOV
Data Conversion Instructions
“ABCD” @DM0
CPMSET
@DM0 $1000 DM0
MOV.D
#1234567890 @DM0
CPMSET
@DM0 #4 DM0
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
S1 S2 D1 D2 C P M G E T S1 S2 D1 D2
Specifies the byte offset position from the start of the received data
D1 16 bits
that specifies the retrieve position.
Number of CIP
D2 Specifies the storage location for the retrieved data.*1
characters*2
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
CPMGET When the execution condition is ON, the data following the byte offset position specified in
D1 of the data stored after S1 is stored in D2 with the data type specified by
the high-order 4 bits of S2 and the data size (in bytes) specified by the low-order 12
bits of S2 . After storing the data, the byte offset position of D1 is updated.
When retrieving from the start of the received data, the instruction is executed after storing
0 in D1 . The byte offset position is updated, so continuous data can be retrieved.
The CPMGET instruction is used to read the numeric value or text string of the CIP data
type received with CIP messaging, etc.
For details on the CIP data types, refer to "EtherNet/IP Function User's Manual".
bit bit
15 0
S2
Data type Data size (byte unit)
Example The usage of the CPMGET instruction is explained using the following received data as
an example.
ARITHMETIC OPERATION
Received data
bit bit
15 0
INSTRUCTIONS
S1 +0 13(000DH) Data size (byte unit)
S1 +1 22H 11H 2-byte numeric data 2211H
S1 +2 5(0005H) CIP text string type data "ABCDE"
S1 +3 B(42H) A(41H) The CIP text string type data specifies
S1 +4 D(44H) C(43H)
the data size with the leading word,
and stores the text string in the order
S1 +5 33H E(45H) of low-order byte to high-order byte.
S1 +6
S1 +7
55H 44H
66H 4-byte numeric data 66554433H
4
S2 0002H D1 0
Offset position: 0
bit bit
15 0
S1 +0 13(000DH)
S1 +1 22H 11H
S1 +2 5(0005H) Retrieve data
S1 +3 B(42H) A(41H)
S1 +4 D(44H) C(43H)
D2 22H 11H
S1 +5 33H E(45H)
S1 +6 55H 44H
D1 2(0+2)
S1 +7 66H
Add data size to D1
Example 2) Read the CIP text string type data following the offset position 2.
Specify 2 (offset position 2) in D1 and 1000H (text string) in S2 , and execute
ARITHMETIC OPERATION
4
S1 +1 22H 11H
S1 +2 5(0005H)
S1 +3 B(42H) A(41H) Retrieve data
Data Conversion Instructions
Example 3)Four bytes of numeric data following offset position 9 are read
out.
Specify 9 (offset position 9) in D1 and 0004H (four bytes
other than text string) in S2 , and then execute the CPMGET
instruction.
Offset position: 0
Offset position: Specify 9
bit bit
15 0 D1 9
S1 +0 13(000DH)
S1 +1 22H 11H
S1 +2 5(0005H)
S1 +3 B(42H) A(41H) Specify 4 bytes of numeric data
@CPMGET Only one scan is executed at the rising edge of the execution conditions.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When a bit other than the start of the channel is specified when bit data is specified for S1
and D
• When the high-order 4 bits of S2 are 1 (text string) and the low-order 12 bits are 0, and a
text string with the length of 2000 or more contained in S1 is specified
• When the high-order 4 bits of S2 is 1 (text string), and the low-order 12 bits of S2 is
2000 or more
• When the high-order 4 bits of S2 is 0 (not text string), and the low-order 12 bits of S2 is 4
CR2012 0
Sample Program
When the input relay MR000 is ON, the data stored from DM0 with the CIP data type is converted in
order of 2-byte numeric data, text string data and 4-byte numeric data, and stored in DM1000,DM2000
and DM3000.
MOV
(Mnemonics list)
MR000
#0 @DM0 LDP MR000
MOV #0 @DM0
CPMGET DM0 #2 @DM0 DM1000
CPMGET CPMGET DM0 $1000 @DM0 DM2000
DM0 #2 @DM0 DM1000 CPMGET DM0 #4 @DM0 DM3000
CPMGET
DM0 $1000 @DM0 DM2000
CPMGET
DM0 #4 @DM0 DM3000
FLOAT(.U)
FLOAT.S Binary →
FLOAT FLOAT.D
FLOAT.L
FLOAT
Single
To convert data of internal
precision
registers to single
ARITHMETIC OPERATION
floating point
@FLOAT(.U) precision floating point
type real
@FLOAT.S type real number.
@FLOAT @FLOAT.D
@FLOAT.L
FLOAT
number
conversion
INSTRUCTIONS
4 Execution condition
LDA FLOAT STA.F @ F L O A T
Floating Point Instructions
Description of Operation
FLOAT(.U) When the execution condition is ON, the unsigned 16-bit BIN data currently stored in
the16-bit internal register is converted to a single precision floating point type real
number, and the result is stored in the 32-bit internal register.
Before executing After executing
16-bit internal registerbit
bit bit 32-bit internal register bit
15 0 31 0
Unsigned 16-bit BIN data Single precision floating point type real number
16-bit 32-bit
FLOAT.S When the execution condition is ON, the signed 16-bit BIN data currently stored in the 16-
bit internal register is converted to a single precision floating point type real number, and
the result is stored in the 32-bit internal register.
Before executing After executing
16-bit internal registerbit
bit bit 32-bit internal register bit
15 0 31 0
16-bit 32-bit
FLOAT.D When the execution condition is ON, the unsigned 32-bit BIN data currently stored in the
32-bit internal register is converted to a single precision floating point type real number,
and the result is stored in the 32-bit internal register.
Before executing After executing
bit 32-bit internal register bit bit 32-bit internal register bit
31 0 31 0
Unsigned 32-bit BIN data Single precision floating point type real number
32-bit 32-bit
FLOAT.L When the execution condition is ON, the signed 32-bit BIN data currently stored in the32-
bit internal register is converted to a single precision floating point type real number, and
the result is stored in the 32-bit internal register.
Before executing After executing
bit 32-bit internal register bit bit 32-bit internal register bit
31 0 31 0
Signed 32-bit BIN data Single precision floating point type real number
32-bit 32-bit
@FLOAT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point The precision of single precision floating point type point real numbers is 32-bit,
the significant digit is 24-bit.
ARITHMETIC OPERATION
When the integer value exceeds the range of -16777216 to 16777215 (24-bit BIN),
the25th bit afterward is rounded.
INSTRUCTIONS
Operation flag
DFLOAT(.U)
DFLOAT.S Binary →
DFLOAT DFLOAT.D
DFLOAT.L
DFLOAT
Double
To convert data of
precision
internal registers to
ARITHMETIC OPERATION
floating point
@DFLOAT(.U) double precision floating
type real
@DFLOAT.S point type real number.
@DFLOAT @DFLOAT.D
@DFLOAT.L
DFLOAT
number
conversion
INSTRUCTIONS
4 Execution condition
LDA DFLOAT STA.DF @ D F L O A T
Floating Point Instructions
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
DFLOAT(.U) When the execution condition is ON, the unsigned 16-bit BIN data currently stored in
the16-bit internal register is converted to a double precision floating point type real
number, and the result is stored in the 64-bit internal register.
Before executing After executing
16-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit
15 0 63 48 47 32 31 16 15 0
Unsigned
16-bit BIN data
Double precision floating point type real number
16-bit 64-bit
DFLOAT.S When the execution condition is ON, the signed 16-bit BIN data currently stored in the16-
bit internal register is converted to a double precision floating point type real number, and
the result is stored in the 64-bit internal register.
Before executing After executing
16-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit
15 0 63 48 47 32 31 16 15 0
Signed
16-bit BIN data
Double precision floating point type real number
16-bit 64-bit
DFLOAT.D When the execution condition is ON, the unsigned 32-bit BIN data currently stored in the
32-bit internal register is converted to a double precision floating point type real number,
and the result is stored in the 64-bit internal register.
Before executing After executing
32-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
32 16 15 0 63 48 47 32 31 16 15 0
Unsigned 32-bit BIN data Double precision floating point type real number
32-bit 64-bit
DFLOAT.L When the execution condition is ON, the signed 32-bit BIN data currently stored in the 32-
bit internal register is converted to a double precision floating point type real number, and
ARITHMETIC OPERATION
the result is stored in the 64-bit internal register.
Before executing After executing
32-bit internal register 64-bit internal register
bit bit bit bit
INSTRUCTIONS
bit bit bit bit bit bit bit bit
32 16 15 0 63 48 47 32 31 16 15 0
Signed 32-bit BIN data Double precision floating point type real number
32-bit 64-bit
@DFLOAT.□This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag 4
Sample Program
The unsigned 16-bit BIN data currently stored in data memory DM0 is converted to a double precision
floating point type real number, and the result is stored in "DM10/DM11/DM12/DM13".
(Mnemonics list)
CR2002 DM0 DM10
LD CR2002
LDA DFLOAT STA.DF LDA DM0
CON
DFLOAT
CON
STA.DF DM10
INTG(.U)
INTG.S Single
INTG INTG.D
INTG.L
INTG precision
floating point
The single precision floating
point type data in the internal
type real
ARITHMETIC OPERATION
4 Execution condition
LDA.F INTG STA @ I N T G
Floating Point Instructions
Point • The range of the single precision floating point type real number is shown below.
−3.4E+38≦N≦−1.4E−45
N=0
1.4E−45≦N≦3.4E+38
(Number of effective
digits: approx. 7)
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)
• The range of the double precision floating point type real number is shown
below.
−1.79E+308 ≦ N ≦-2.23E−308
N=0
2.23E−308 ≦ N ≦ 1.79E+308
(Number of effective digits: approx. 16)
Description of Operation
INTG(.U) When the execution condition is ON, the single precision floating point type real number
currently stored in the 32-bit internal register is converted to unsigned 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the single precision floating point type real number are discarded
before conversion.
Before executing After executing
bit 32-bit internal register bit bit 16-bit internal register bit
31 0 15 0
Single precision floating point type real number Unsigned 16-bit BIN data
32-bit 16-bit
INTG.S When the execution condition is ON, the single precision floating point type real number
currently stored in the 32-bit internal register is converted to signed 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the single precision floating point type real number are discarded
before conversion.
Before executing After executing
bit 32-bit internal register bit bit 16-bit internal register bit
31 0 15 0
Single precision floating point type real number Signed 16-bit BIN data
32ビット 16-bit
INTG.D When the execution condition is ON, the single precision floating point type real number
currently stored in the 32-bit internal register is converted to unsigned 32-bit BIN data.
ARITHMETIC OPERATION
The operation result is stored in the 32-bit internal register. There will be errors in stored
value as decimal part of the single precision floating point type real number are discarded
before conversion.
INSTRUCTIONS
Before executing After executing
bit 32-bit internal register bit bit 32-bit internal register bit
31 0 31 0
Single precision floating point type real number Unsigned 32-bit BIN data
32-bit 32-bit
INTG.L When the execution condition is ON, the single precision floating point type real number
currently stored in the 32-bit internal register is converted to signed 32-bit BIN data.
The operation result is stored in the 32-bit internal register. There will be errors in stored
4
Single precision floating point type real number Signed 32-bit BIN data
32-bit 32-bit
@INTG.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
The single precision floating point type point real numbers currently stored in data memories "DM0/
DM1" are converted respectively and stored as follows.
Unsigned 16-bit BIN data is stored in DM10.
INSTRUCTIONS
4
LDA.F INTG STA
MPS
LDA.F DM0
DM0 DM20
CON
LDA.F INTG.S STA.S INTG
Floating Point Instructions
CON
DM0 DM30 STA DM10
MRD
LDA.F INTG.D STA.D
LDA.F DM0
CON
DM0 DM40 INTG.S
LDA.F INTG.L STA.L CON
STA.S DM20
MRD
LDA.F DM0
CON
INTG.D
CON
STA.D DM30
MPP
LDA.F DM0
CON
INTG.L
CON
STA.L DM40
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
DINTG(.U)
DINTG.S Double
DINTG DINTG.D
DINTG.L
DINTG
precision
floating point
The double precision floating
point type data in the internal
type real
ARITHMETIC OPERATION
4 Execution condition
LDA.DF DINTG STA @ D I N T G
Floating Point Instructions
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
• Refer to “INTG Instructions”for details on the range of the double precision
floating point type real number.
Description of Operation
DINTG(.U) When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to unsigned 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the double precision floating point type real number are
discarded before conversion.
Before executing After executing
64-bit internal register 16-bit internal registe
bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 15 0
Unsigned
Double precision floating point type real number 16-bit BIN data
64-bit 16-bit
DINTG.S When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to signed 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the double precision floating point type real number are
discarded before conversion.
Before executing After executing
64-bit internal register 16-bit internal registe
bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 15 0
Unsigned
Double precision floating point type real number 16-bit BIN data
64-bit 16-bit
DINTG.D When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to unsigned 32-bit BIN data.
ARITHMETIC OPERATION
The operation result is stored in the 32-bit internal register. There will be errors in stored
value as decimal part of the double precision floating point type real number are
discarded before conversion.
INSTRUCTIONS
Before executing After executing
64-bit internal register 32-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 32 16 15 0
Double precision floating point type real number Unsigned 32-bit BIN data
4
64-bit 32-bit
DINTG.L When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to signed 32-bit BIN data.
Double precision floating point type real number Signed 32-bit BIN data
64-bit 32-bit
@DINTG.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
The double precision floating point type point real numbers currently stored in data memories "DM0/
DM1/DM2/DM3" are converted respectively and stored as follows.
Unsigned 16-bit BIN data is stored in DM10.
INSTRUCTIONS
4
LDA.DF DINTG STA
MPS
LDA.DF DM0
CON
DINTG
Floating Point Instructions
DM0 DM20
CON
LDA.DF DINTG.S STA.S
STA DM10
MRD
LDA.DF DM0
DM0 DM30 CON
DINTG.S
LDA.DF DINTG.D STA.D CON
STA.S DM20
MRD
DM0 DM40 LDA.DF DM0
CON
LDA.DF DINTG.L STA.L DINTG.D
CON
STA.D DM30
MPP
LDA.DF DM0
CON
DINTG.L
CON
STA.L DM40
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
DFTOF
Double-precision
DFTOF DFTOF The double precision floating
floating point type
point type data in the internal
real number →
register is converted into a
@DFTOF
Single-precision
@DFTOF DFTOF single precision floating point
floating point type
ARITHMETIC OPERATION
Execution condition
LDA.DF DFTOF STA.F D F T O F
Execution condition
LDA.DF DFTOF STA.F @ D F T O F
4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Floating Point Instructions
Description of Operation
DFTOF When the execution conditions are ON, the double precision floating point type data
stored in the 64-bit internal register is converted into a single precision floating point type
real number, and the results are stored in the 32-bit internal register.
Before executing After executing
64-bit internal register 32-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 32 16 15 0
64-bit 32-bit
@DFTOF This instruction is executed for one scan at the rising edge of the execution condition.
Point The precision of the single precision floating point type real number stored in the
32-bit internal register after the instruction is executed will be lower than before the
execution, so an error will occur.
Operation flag
Sample Program
ARITHMETIC OPERATION
The double precision floating point type real number stored in the data memory [DM0/DM1/DM2/
DM3]is converted into a single precision floating point type real number, and stored in [DM10/DM11].
(Mnemonics list)
INSTRUCTIONS
CR2002 DM0 DM10
LDA.DF DFTOF STA.F LD CR2002
LDA.DF DM0
CON
DFTOF
CON
STA.F DM10
FTODF
FTODF
Single-precision
FTODF FTODF The single precision floating
floating point type
point type data in the internal
real number →
register is converted into a
@FTODF
Double-precision
@FTODF FTODF double precision floating
floating point type
ARITHMETIC OPERATION
Execution condition
LDA.F FTODF STA.DF F T O D F
Execution condition
LDA.F FTODF STA.DF @ F T O D F
4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
Floating Point Instructions
Description of Operation
FTODF When the execution conditions are ON, the single precision floating point type data stored
in the 32-bit internal register is converted into a double precision floating point type real
number, and the results are stored in the 64-bit internal register.
Before executing After executing
32-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
32 16 15 0 63 48 47 32 31 16 15 0
32-bit 64-bit
@FTODF This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
The single precision floating point type real number stored in the data memory [DM0/DM1] is converted
into a double precision floating point type real number, and stored in [DM10/DM11/DM12/DM13].
(Mnemonics list)
CR2002 DM0 DM10
LDA.F FTODF STA.DF LD CR2002
LDA.F DM0
CON
FTODF
CON
STA.DF DM10
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
To disperse a single
DISF Single-precision
DISF
precision floating point
floating point type real
type real number into a
number → Mantissa
mantissa and exponent,
@DISF DISF and exponent
and store them in the
ARITHMETIC OPERATION
separation
reference destination.
Point Refer to "INTG instruction", page 4-202 for details on the range of the double
precision floating point type real number.
Description of Operation
DISF When the execution condition is ON, the mantissa of the single precision floating point
type real number currently stored in [ S / S +1] is stored in [ D1 / D1 +1], and
the exponent is stored in D2 . The mantissa part is calculated as seven digits.
D1 +1 D1
S +1 S Mantissa: Signed 32-bit BIN data
Mantissa Exponent
@DISF This instruction is executed for one scan at the rising edge of the execution condition.
Point When the single precision floating point type real number (BIN) is converted to mantissa
part (DEC) and exponent part (DEC), error occurs sometimes in DISF instruction.
Operation flag
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, the single precision floating point type real number currently stored in
data memories "DM0/DM1" is dispersed, and the mantissa is stored in "DM10/DM11" and the exponent
is stored in DM12.
INSTRUCTIONS
(Mnemonics list)
R000 DISF
DM0 DM10 DM12 LD R000
DISF DM0 DM10 DM12
DM11 DM10
Mantissa: −5678900
UNIF
Specifies the storage location for the single precision floating point
D 32 bits
type real number formed by uniting S1 and S2 .
Point Refer to "INTG instruction", page 4-202 for details on the range of the double
precision floating point type real number.
Description of Operation
UNIF When the execution condition is ON, the single precision floating point type real number
united by signed 32-bit BIN data stored in [ S1 / S1 +1] as mantissa and signed 16-
bit BIN data stored in S2 as exponent is stored in [ D / D +1].
S1 +1 S1
Mantissa: Signed 32-bit BIN data
D +1 D
32-bit
(2 word) Unite Floating real number
S2 32-bit
(2 words)
Mantissa: Signed 16-bit BIN data
16-bit
(1 word)
@UNIF This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when the result is outside the floating point range, or the indirect specification or index
modification range is inappropriate, and an access outside the operand range occurs; Otherwise
CR2012
OFF.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
4
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
DM1 DM0
仮数部: +987654
32-bit
(2 words)
DM11 DM10
+9.87654E10
DM2 32-bit
(2 words)
指数部: +5
16-bit
(1 word)
@EXP.DF EXP
is obtained.
LOG(.F)
LOG LOG.DF LOG
The natural logarithm of the
INSTRUCTIONS
4 Execution condition
LDA.F EXP STA.F E X P
Floating Point Instructions
Execution condition
LDA.F EXP STA.F @ E X P
Execution condition
LDA.F LOG STA.F L O G
Execution condition
LDA.F LOG STA.F @ L O G
Point Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.
Description of Operation
EXP(.F) When the execution condition is ON, the exponent function value is calculated taking the
single precision floating point type real number currently stored in 32-bit internal register
as the exponent. The operation result is stored to the 32-bit internal register as a single
precision floating point type real number.
The operation is performed taking e=2.718282.
32-bit internal register 32-bit internal register
32-bit
Single precision floating point type real number
32-bit
Reference For common logarithm operation, EXP.DF will be executed after storing the
value obtained by splitting exponent by 0.434294 in 32-bit internal register.
EXP.DF When the execution condition is ON, the exponent function value is calculated taking the
double precision floating point type real number currently stored in 64-bit internal register
ARITHMETIC OPERATION
as the exponent. The operation result is stored to the 64-bit internal register as a double
precision floating point type real number.
The operation is performed taking e = 2.718281828459045.
INSTRUCTIONS
64-bit internal register 64-bit internal register
64-bit
Double precision floating point type real number
64-bit
Reference For common logarithm operation, EXP.DF will be executed after storing the
value obtained by splitting exponent by 0.434294481903252 in 64-bit
internal register. 4
LOG(.F) When the execution conditions are ON, the common logarithm of the single precision
LOG.DF When the execution conditions are ON, the common logarithm of the double precision
floating point type real number stored in the 64-bit internal register is obtained. The
operation result is stored to the 64-bit internal register as a double precision floating point
type real number.
64-bit internal register 64-bit internal register
D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
EXP.(F): ON when the operation results are not within the range of the single precision floating
point type real number. Otherwise, OFF.
CR2009 EXP.DF: ON when the operation results are not within the range of the double precision floating
point type real number. Otherwise, OFF.
LOG does not change.
CR2010 No change in state
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• EXP(.F): When value to be operated on exceeds the single precision floating point type real
number range
• EXP.DF: When value to be operated on exceeds the double precision floating point type real
CR2012 number range
• LOG(.F): When value to be operated on is 0 or negative, or exceeds the single precision
floating point type real number range
• LOG.DF: When value to be operated on is 0 or negative, or exceeds the double precision
floating point type real number range
Sample Program
ARITHMETIC OPERATION
When the input relay R000 is ON, ex is calculated taking the single precision floating point type real
number currently stored in data memories DM0/DM1 as the exponent. The results are stored in [DM10/
DM11].
INSTRUCTIONS
(Mnemonics list)
R000 DM0 DM10
LDA.F EXP STA.F LD R000
LDA.F DM0
CON
EXP
CON
STA.F DM10
4 When input relay R000 is ON, the logarithm of the single precision floating type real number stored in
data memories "DM0/DM1" is calculated. The results are stored in [DM10/DM11].
Floating Point Instructions
(Mnemonics list)
R000 DM0 DM10
LDA.F LOG STA.F LD R000
LDA.F DM0
CON
LOG
CON
STA.F DM10
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
@LOG10(.F)
@LOG10 @LOG10.DF LOG10 type real number stored in the
64-bit internal register is
obtained.
INSTRUCTIONS
Execution condition
4
LDA.F LOG10 STA.F @ L O G 1 0
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Floating Point Instructions
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
• Refer to “INTG Instructions” for details on the single precision floating
point type real number and double precision floating point type real number
range.
Description of Operation
LOG10(.F) When the execution conditions are ON, the common logarithm of the single precision
floating point type real number stored in the 32-bit internal register is obtained. The
operation result is stored to the 32-bit internal register as a single precision floating point
type real number.
32-bit internal register 32-bit internal register
Log10 Single precision floating point type real number Single precision floating point type real number
32-bit 32-bit
LOG10.DF When the execution conditions are ON, the common logarithm of the double precision
floating point type real number stored in the 64-bit internal register is obtained. The
operation result is stored to the 64-bit internal register as a double precision floating point
type real number.
64-bit internal register 64-bit internal register
64-bit 64-bit
@LOG10.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
When the relay R000 is ON, the common logarithm of the floating point type real number stored in data
memory [DM0/DM1] is obtained. The results are stored in [DM10/DM11].
(Mnemonics list)
INSTRUCTIONS
R000 DM0 DM10
LDA.F LOG10 STA.F LD R000
LDA.F DM0
CON
LOG10
CON
STA.F DM10
RAD(.F)
RAD RAD.DF RAD
The angle (°) unit of the (single
precision/double precision) floating
Radian point type real number currently
@RAD(.F) stored in the internal register is
@RAD
ARITHMETIC OPERATION
DEG(.F)
DEG DEG.DF DEG
The angle (radians) unit of the
INSTRUCTIONS
4 Execution condition
LDA.F RAD STA.F R A D
Floating Point Instructions
Execution condition
LDA.F RAD STA.F @ R A D
Execution condition
LDA.F DEG STA.F D E G
Execution condition
LDA.F DEG STA.F @ D E G
Point Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.
Description of Operation
RAD(.F) When the execution condition is ON, the angle (°) unit of the single precision floating point
type real number currently stored in the 32-bit internal register is converted to radians.
The operation result is stored to the 32-bit internal register as a single precision floating
point type real number.
32-bit internal register 32-bit internal register
Single precision floating point type real number Single precision floating point type real number
rad
32-bit 32-bit
RAD.DF When the execution condition is ON, the angle (°) unit of the double precision floating
point type real number currently stored in the 64-bit internal register is converted to
radians.
The operation result is stored to the 64-bit internal register as a double precision floating
point type real number.
64-bit internal register 64-bit internal register
D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r
rad
64-bit 64-bit
DEG(.F) When the execution condition is ON, the angle (radians) unit of the single precision
floating point type real number currently stored in the 32-bit internal register is converted
ARITHMETIC OPERATION
to degrees (°). The operation result is stored to the 32-bit internal register as a single
precision floating point type real number.
32-bit internal register 32-bit internal register
INSTRUCTIONS
Single precision floating point type real number
rad Single precision floating point type real number
32-bit 32-bit
DEG.DF When the execution condition is ON, the angle (radians) unit of the double precision
floating point type real number currently stored in the 64-bit internal register is converted
to degrees (°). The operation result is stored to the 64-bit internal register as a double
precision floating point type real number. 4
64-bit internal register 64-bit internal register
64-bit 64-bit
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, the angle (°) unit of the single precision floating point type real number
currently stored in data memories "DM0/DM1" is converted to radians.
The result is stored in "DM10/DM11" as a single precision floating point type real number.
INSTRUCTIONS
(Mnemonics list)
R000 DM0 DM10
LDA.F RAD STA.F LD R000
LDA.F DM0
CON
RAD
CON
STA.F DM10
4 When input relay R000 is ON, the angle (radians) unit of the single precision floating point type real
number currently stored in data memories "DM0/DM1" is converted to degrees (°).
Floating Point Instructions
The result is stored in "DM10/DM11" as a single precision floating point type real number.
(Mnemonics list)
R000 DM0 DM10
LDA.F DEG STA.F LD R000
LDA.F DM0
CON
DEG
CON
STA.F DM10
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano (cos) value from the angle
in radians (rad)
TANCalculate the tangent
(tan) value from the angle
SIN,COS,TAN in radians (rad)
@SIN.DF SIN
register.
COS(.F) Obtains the cosine (cos) value of
COS COS.DF COS the angle (in radians) of the
INSTRUCTIONS
(single precision/double
Cosine
@COS(.F) precision) floating point type real
@COS @COS.DF COS number stored in the internal
register.
TAN(.F) Obtains the tangent (tan) value
@TAN.DF TAN
register.
Point • The range of the single precision floating point type real number which can be
handled with the SIN(.F), COS(.F) and TAN(.F) instructions is as follows:
−1.7E+7≦N≦−1.4E−45
N=0
1.4E−45≦N≦1.7E+7
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)
(effective number of digits: approx. 7 digits)
• The range of the double precision floating point type real number which can be
handled with the SIN.DF, COS.DF and TAN.DF instructions is as follows:
9.01E+15 ≦ N ≦ 2.23E308
N=0
+2.23E308 ≦ N ≦ +9.01E+15
(effective number of digits:
approx. 16)
ȧ 3ȧ
• With TAN, ideally TAN( )=+∞、TAN( )=ー∞ but due to the operation,
2 2
ȧ 3ȧ
2 and 2 are rounded values, so a value range which exceeds either
ȧ 3ȧ
TAN ( )or TAN ( )cannot be handled.
Description of Operation
ARITHMETIC OPERATION
SIN(.F) / COS(.F) / TAN(.F)
When the execution condition is ON, the sine (sin), cosine (cos) and tangent (tan) value of
the angle (radians) of the single precision floating point type real number currently stored
INSTRUCTIONS
in the 32-bit internal register is calculated. The operation result is stored to the 32-bit
internal register as a single precision floating point type real number.
COS Single precision floating point type real number Single precision floating point type real number
4
32-bit 32-bit
TAN
SIN.DF / COS.DF / TAN.DF
COS Double precision floating point type real number Double precision floating point type real number
64-bit 64-bit
TAN
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, the sine (sin) value of the angle of the single precision floating point type
real number currently stored in data memories "DM0/DM1" is stored in "DM10/DM11", the cosine (cos)
value is stored in "DM20/DM21", and the tangent (tan) value is stored in "DM30/DM31".
INSTRUCTIONS
(Mnemonics list)
R000 DM0 DM10
LDA.F SIN STA.F LD R000
MPS
DM0 DM20 LDA.F DM0
LDA.F COS STA.F CON
SIN
DM0 DM30 CON
COS
CON
STA.F DM20
MPP
LDA.F DM0
CON
TAN
CON
STA.F DM30
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
ASIN,ACOS,ATAN
ASIN(.F)
ASIN ASIN.DF ASIN
To calculate the angle (radians)
from sine (sin) of the (single
Arc sine precision/double precision) floating
@ASIN(.F) point type real number currently
@ASIN
ARITHMETIC OPERATION
ACOS(.F)
ACOS ACOS.DF ACOS
To calculate the angle (radians)
INSTRUCTIONS
ATAN(.F)
Point Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.
Description of Operation
ASIN(.F) / ACOS(.F) / ATAN(.F)
When the execution condition is ON, the angle (radians) is calculated from the sine (sin)
value, cosine (cos) value and tangent (tan) value of the single precision floating point type
real number currently stored in the 32-bit internal register. The operation result is stored
to the 32-bit internal register as a single precision floating point type real number.
ACOS Single precision floating point typereal number Single precision floating point typereal number
32-bit 32-bit
ATAN
ASIN.DF / ACOS.DF / ATAN.DF
When the execution condition is ON, the angle (radians) is calculated from the sine (sin)
value, cosine (cos) value and tangent (tan) value of the double precision floating point
type real number currently stored in the 64-bit internal register. The operation result is
stored to the 64-bit internal register as a double precision floating point type real number.
ACOS Double precision floating point typereal number Double precision floating point typereal number
ARITHMETIC OPERATION
64-bit 64-bit
ATAN
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.
INSTRUCTIONS
Reference (°) and radian (rad) are calculated as follows:
Ǹ 180
1°= ≒ 0.01745(rad), 1(rad)= ≒ 57.23°
180 Ǹ
Operation flag
4
CR2009 No change in state
Sample Program
When input relay R000 is ON, the angle calculated from the sine (sin) value of the single precision
floating point type real number currently stored in data memory "DM0/DM1" is stored in "DM10/DM11".
Likewise, the angle calculated from the cosine (cos) value is stored in "DM20/DM21", and the angle
calculated from the tangent (tan) value is stored in "DM30/DM31".
(Mnemonics list)
R000 DM0 DM10
LDA.F ASIN STA.F LD R000
MPS
DM0 DM20 LDA.F DM0
LDA.F ACOS STA.F CON
ASIN
DM0 DM30 CON
LDA.F ATAN STA.F STA.F DM10
MRD
LDA.F DM0
CON
ACOS
CON
STA.F DM20
MPP
LDA.F DM0
CON
ATAN
CON
STA.F DM30
ATAN2(.F)
ATAN2 ATAN2.DF ATAN2
Arc
Calculate the angle (radians)
from the coordinates (X, Y) of
@ATAN2(.F) tangent 2 the (single/double precision)
@ATAN2 floating point type real number.
ARITHMETIC OPERATION
@ATAN2.DF ATAN2
Execution condition S1
ATAN2 STA.F A T A N 2 S1 S2
S2
Execution condition S1
ATAN2 STA.F @ A T A N 2 S1 S2
S2
4 S1
Specifies the Y coordinate of the target point, or the start in which it is .F
stored. .DF
32 bits
64 bits
Specifies the X coordinate of the target point, or the start in which it is .F 32 bits
Floating Point Instructions
S2
stored. .DF 64 bits
Point • Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.
• The ATAN2 instruction can be used only with the KV-8000 series CPU units and
KV-7000 Series CPU units with CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
ATAN2(.F)
When the execution condition is ON, the angle (radians) of the X axis relative to the single
precision floating point type real number is calculated from the Y coordinate of the single
precision floating point type real number specified with [ S1 / S1 +1] and the X
coordinate of the single precision floating point type real number specified with [ S2 /
S2 +1]. The operation result is stored in the 32-bit internal register.
ATAN2.DF
When the execution condition is ON, the angle (radians) of the X axis relative to the
double precision floating point type real number is calculated from the Y coordinate of the
double precision floating point type real number specified with [ S1 / S1 +1/ S1 +2/
S1 +3] and the X coordinate of the double precision floating point type real number
specified with [ S2 / S2 +1/ S2 +2/ S2 +3]. The operation result is stored in the
64-bit internal register.
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.
Reference The ATAN instruction uses the TAN value to calculate the angle of -π/2(rad) < θ < π/
2(rad), while the ATAN2 instruction uses coordinates (S2, S1) to calculate the angle of -
ARITHMETIC OPERATION
π(rad)< θ ≦ π(rad).
Y
INSTRUCTIONS
S1
θ
S2 X
ȧ 180
1°= ≒ 0.01745(rad)、 1(rad)= ≒ 57.23°です。
ȧ
4
180
Operation flag
Sample Program
When input relay R000 is ON, the angle (radians) on the X axis is calculated from the single precision
floating point type real number Y coordinate stored in "DM0/DM1" and the single precision floating point
type real number X coordinate stored in "DM2/DM3", and is stored in "DM10/DM11".
(Mnemonics list)
R000 DM0 DM10
ATAN2 STA.F LD R000
DM2 ATAN2 DM0 DM2
CON
STA.F DM10
ASC ASC(.U)
ASC
HEX ASCII Convert BIN data in internal
code registers to HEX ASCII character
@ASC @ASC(.U)
ASC
conversion code
ARITHMETIC OPERATION
Execution condition
LDA ASC STA A S C
Execution condition
LDA ASC STA @ A S C
4 Description of Operation
ASC(.U) When the execution condition is ON, the binary data of the lower 8 bits currently stored to
Text Processing Instructions
16-bit internal registers is converted to ASCII character codes annotated in HEX, and the
result is stored to 16-bit internal register.
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 2 1 0 3 2 1 0 3 2 1 0 3 • 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
@ASC(.U) This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
The data currently stored to the lower 8 bits of data memory DM0 is converted to HEX ASCII character
code. The result is stored to DM10.
(Mnemonics list)
INSTRUCTIONS
R000 DM0 DM10
LDA ASC STA LD R000
LDA DM0
CON
ASC
DM0 DM10 CON
conversion
0 0 F 7 4 6 3 7 STA DM10
RASC RASC(.U)
RASC HEX ASCII Convert HEX ASCII character
code reverse code in internal registers to
@RASC @RASC(.U)
RASC
conversion binary data.
ARITHMETIC OPERATION
Execution condition
LDA RASC STA R A S C
Execution condition
LDA RASC STA @ R A S C
4 Description of Operation
RASC(.U) When the execution condition is ON, the HEX ASCII character code currently stored to
Text Processing Instructions
the internal register is converted and stored to the lower eight bits of the 16-bit internal
register as binary data. "0" is stored to the upper 8 bits.
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 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 only when both the high-order 8 bits and
low-order 8 bits of the internal register before conversion are 0 to 9 (30H to 39H) or A to F
(41H to 46H), and the high-order 8 bits are 0 (00H), and the low-order 8 bits are 0 to 9
(30H to 39H) or A to F (41H to 46H).
When either of the upper 8 bits or lower 8 bits is outside of this range, HEX ASCII
character codes are not converted. The operation flag CR2012 turns ON at this time.
@RASC(.U) This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
The HEX ASCII character code currently stored to data memory DM0 is converted to binary data. The
result is stored to DM10.
(Mnemonics list)
INSTRUCTIONS
R000 DM0 DM10
LDA RASC STA LD R000
LDA DM0
CON
DM0 DM10 RASC
CON
4 6 3 7 0 0 F 7 STA DM10
conversion
0 0 3 7 0 0 0 7
4
DASC(.U)
DASC.S
DASC
DASC
DASC.D
DASC.L
Decimal ASCII Convert numerical
ARITHMETIC OPERATION
Description of Operation
DASC(.U) When the execution condition is ON, the unsigned 16-bit binary data specified by S
is converted to decimal ASCII text string, and is stored as follows starting from D .
End code NULL (00H) is stored at the end of text string.
bit
15
S bit
0
bit
15
bit
0
DASC.S When the execution condition is ON, the signed 16-bit binary data specified by S is
converted to decimal ASCII text string, and is stored as follows starting from D . End
code NULL (00H) is stored at the end of text string.
bit
15
S bit
0
bit
15
bit
0
D +2: 十 一
N
D +3: U
L
(00H)
DASC.D When the execution condition is ON, the unsigned 32-bit binary data specified by S
is converted to decimal ASCII text string, and is stored as follows starting from D .
ARITHMETIC OPERATION
End code NULL (00H) is stored at the end of text string.
bit
31
S +1 bit
16
bit
15
S bit
0
bit
15
bit
0
hundred
Unsigned 32-bit BIN data D billion million
INSTRUCTIONS
32-bit D +1: ten million million
hundred
D +2: thousand ten thousand
Ended with
“00H”.
No change before and
after executing instruction.
4
DASC.L When the execution condition is ON, the signed 32-bit binary data specified by S is
hundred
Unsigned 32-bit BIN data D billion million
@DASC.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
"Zero suppression" is a function for omitting "0" (zeros) not required in the upper digits.
Example The unsigned 16-bit binary data currently stored to data memory DM0 is converted toan
INSTRUCTIONS
R000 DASC
DM0 DM10
bit
15
DM0 bit
0
bit
15
bit
0
4
Without zero suppression
00123 DM10: 0(30H) 0(30H)
CR2814:OFF
16ビット DM11: 1(31H) 2(32H)
Text Processing Instructions
N
DM12: 3(33H) U
L
(00H)
DM12:
Example The 16-bit signed binary data currently stored to data memory DM0 is converted to an
ASCII text string, and the result is stored to DM10.
CR2002 DASC.S
DM0 DM10
bit
15
DM0 bit
0
bit
15
bit
0
Without omitting
12345 DM10: +(2BH) 1(31H)
CR2815:OFF
16ビット DM11: 2(32H) 3(33H)
DM12: 4(34H) 5(35H)
N
DM13: U
L
(00H)
Without omitting
DM10: 1(31H) 2(32H)
CR2815:ON
DM11: 3(33H) 4(33H)
N
DM12: 5(33H) U
L
(00H)
DM13:
Sample Program
ARITHMETIC OPERATION
The signed 16-bit binary data currently stored to data memory DM0 is converted to decimal ASCII
code, and the result is stored to DM10 onwards.
(Mnemonics list)
INSTRUCTIONS
CR2002 CR2814 CR2815
RES RES LD CR2002
MPS
RES CR2814
DASC.S
CON
DM0 DM10 RES CR2815
MPP
DASC.S DM0 DM10
bit
15
DM0
−01234
bit
0
bit
15
−(2DH) 0(30H)
bit
0 4
DM10:
The unsigned 16-bit data #1234 is converted to decimal ASCII code, and the zero-suppressed
(0'somitted) data is stored to DM10 onwards. (The data is stored with the + sign omitted.)
(Mnemonics list)
CR2002 CR2814 CR2815
SET SET LD CR2002
MPS
SET CR2814
DASC
CON
#1234 DM10 SET CR2815
MPP
DASC #1234 DM10
bit bit
15 0
Point To prevent erroneous operation, set CR2814 and CR2815 before executing the
instructions.
RDASC(.U)
RDASC.S
RDASC
RDASC
RDASC.D
RDASC.L
Decimal ASCII Convert decimal
ARITHMETIC OPERATION
Description of Operation
RDASC(.U) When the execution condition is ON, the decimal ASCII text string (NULL (00H) is
required at the end of the text string) starting from S is converted to unsigned 16-bit
binary data, and is stored to D .
bit
15
S bit
0
bit
15
D bit
0
RDASC.S When the execution condition is ON, the decimal ASCII text string (NULL (00H) is
required at the end of the text string) starting from S is converted to signed 16-bit
binary data, and is stored to D .
bit
15
S bit
0
bit
15
D bit
0
RDASC.D When the execution condition is ON, the decimal ASCII text string (NULL (00H) is
required at the end of the text string) starting from S is converted to unsigned 32-bit
binary data, and is stored to [ D / D +1].
bit
15
S bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
hundred
S billion million
Signed 32-bit BIN data
RDASC.L When the execution condition is ON, the decimal ASCII text string (NULL (00H) is
required at the end of the text string) starting from S is converted to signed 32-bit
ARITHMETIC OPERATION
binary data, and is stored to [ D / D +1].
bit
15
bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
INSTRUCTIONS
hundred
S +1: million ten million
million hundred
S +2: thousand
4
S +5: one U (00H)
L String must be ended with NUL(00H).
@RDASC.□ This instruction is executed for one scan at the rising edge of the execution condition.
"Zero suppression" is a function for omitting "0" (zeros) not required in the upper digits.
Data that is already zero-suppressed is converted correctly.
INSTRUCTIONS
Example The ASCII text string currently stored to data memory DM0 is converted to unsigned 16-
bit binary data. The result is stored to DM100.
CR2002 RDASC
DM0 DM100
bit bit
15 0
4 DM0:
DM1:
1(31H)
3(33H)
2(32H)
0(30H)
bit
15
DM100
1230
bit
0
N
Text Processing Instructions
DM2: U
L
(00H)
Example The ASCII text string currently stored to data memory DM0 is converted to signed 16-bit
binary data. The result is stored to DM10.
CR2002 RDASC.S
DM0 DM10
bit bit
15 0
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, the ASCII text string currently stored to data memory DM0 is converted
to 32-bit unsigned binary data. The results are stored in [DM10/DM11].
(Mnemonics list)
INSTRUCTIONS
R000 RDASC.D
DM0 DM10 LD R000
RDASC.D DM0 DM10
bit bit
15 0
4
1234567890
When input relay R000 is ON, the ASCII text string currently stored to data memory DM0 is converted
to 32-bit signed binary data. The results are stored in [DM10/DM11].
(Mnemonics list)
R000 RDASC.L
DM0 DM10 LD R000
RDASC.L DM0 DM10
bit bit
15 0
HASC(.U)
HASC
HASC
HASC.D
HEX ASCII Convert numerical
code values (HEX) to HEX
@HASC(.U) conversion ASCII text string.
@HASC
HASC
ARITHMETIC OPERATION
@HASC.D
4
Operand Explanation Occupied size
Specifies the storage location for the numerical value (HEX) to .U 16 bits
S
convert to a HEX ASCII text string. .D 32 bits
Text Processing Instructions
Specifies the storage location for the converted ASCII character 8 bits × (number of
D
code.*1 characters + 1)
Specifies the number of digits of the numerical value (HEX) to be
n 16 bits
stored within the range of 0 to 8. (0 to 4 for .U, 0 to 8 for .D)
Description of Operation
HASC(.U) When the execution condition is ON, the numerical values of 1 to n digits are
converted to HEX ASCII text string from the low-order side of the unsigned 16-bit binary
data specified by S , and are stored starting from D . End code NULL (00H) is
stored at the end of text string.
When n =0, zeros are suppressed.
n=1 n=2
N
HEX ASCII string D C(43H) U
L
(00H) D 2(32H) C(43H)
N
D +1 U
L
(00H)
n=3 n=4
D 1(31H) 2(32H) D 0(30H) 1(31H)
N
D +1 C(43H) U
L
(00H) D +1 2(32H) C(43H)
N
U (00H)
D +2 L
n=0
D 1(31H) 2(32H)
N
D +1 C(43H) U
L
(00H)
HASC.D When the execution condition is ON, the numerical values of 1 to n digits are
converted to HEX ASCII text string from the low-order side of the unsigned 32-bit binary
ARITHMETIC OPERATION
data specified by [ S / S +1], and are stored starting from D . End code NULL
(00H) is stored at the end of text string.
When n =0, zeros are suppressed.
INSTRUCTIONS
Example digit (n) 8 7 6 5 4 3 2 1
Unsigned 32-bit BIN data S +1・ S 0 0 1 2 C D E 0
n=1 n=2
N
HEX ASCII string D 0(30H) U
L
(00H) D E(45H) 0(30H)
4
N
D +1 U
L
(00H)
n=7 n=8
D 1(31H) 2(32H)
D +1 C(43H) D(44H)
D +2 E(45H) 0(30H)
N
D +3 U
L
(00H)
@HASC.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
ARITHMETIC OPERATION
The unsigned 16-bit binary data currently stored to data memory DM0 is converted to HEX ASCII code,
and the result is stored to DM10 onwards.
(Mnemonics list)
INSTRUCTIONS
CR2002 HASC
DM0 DM10 #3 LD CR2002
HASC DM0 DM10 #3
DM0 bit
15
bit
0
4 DM11: A(41H)
N
U
L (00H)
Text Processing Instructions
Unsigned 32-bit data $00123ABC is converted to HEX ASCII code, and the zero-suppressed
(0'somitted) data is stored to DM10 onwards.
(Mnemonics list)
CR2002 HASC.D
$00123ABC DM10 #0 LD CR2002
HASC.D $123ABC DM10 #0
bit bit
15 0
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
RHASC(.U)
RHASC
RHASC
RHASC.D Convert HEX ASCII
HEX ASCII
text string to
code reverse
@RHASC(.U) numerical values
conversion
@RHASC
RHASC
(HEX).
ARITHMETIC OPERATION
@RHASC.D
4 Operand Explanation
Specifies the HEX ASCII text string to convert to numerical values
Occupied size
8 bits × (number of
S
(HEX).* 1 characters + 1)
Text Processing Instructions
Specifies the storage location for the converted numerical value .U 16 bits
D
(HEX). .D 32 bits
Description of Operation
RHASC(.U) When the execution condition is ON, the HEX ASCII text string (NULL (00H) is required at
the end of the text string) starting from S is converted to unsigned 16-bit binary data,
and is stored to D .
S 1(31H) 2(32H) D
S +1 C(43H) D(44H) 1 2 C D
N
S +2 U
L (00H)
bit bit
15 0
D
S 1(31H) 2(32H)
N
0 1 2 C
S +1 C(43H) U
L (00H)
bit bit
15 0
D
S 1(31H) 2(32H)
N
0 0 1 2
S +1 U
L (00H)
bit
15
bit
0
D
N
S 1(31H) U
L (00H) 0 0 0 1
bit
15
bit
0
D
N
S U
L (00H) 0 0 0 0
RHASC.D When the execution condition is ON, the HEX ASCII text string (NULL (00H) is required at
the end of the text string) starting from S is converted to unsigned 32-bit binary data,
ARITHMETIC OPERATION
and is stored to [ D / D +1].
INSTRUCTIONS
bit bit
15 0
S 1(31H) 2(32H)
S +1 A(41H) B(42H) D +1 D
S +2 C(43H) D(44H) 1 2 A B C D 1 4
S +3 1(31H) 4(34H)
4
N
S +4 U
L (00H)
bit bit
15 0
bit
15
bit
0
D +1 D
N
S 1(31H) U
L (00H) 0 0 0 0 0 0 0 1
bit
15
bit
0
D +1 D
N
S U
L (00H) 0 0 0 0 0 0 0 0
@RHASC.□This instruction is executed for one scan at the rising edge of the execution condition.
Point Use uppercase A to F (41H to 46H) in HEX ASCII text strings. Lowercase characters
are not supported. Lowercase characters are not supported.
Operation flag
Sample Program
ARITHMETIC OPERATION
The HEX ASCII text string (end code NULL (00H) is required at the end of the text string) starting from
data memory DM0 is converted to unsigned 16-bit binary data is stored to DM10.
(Mnemonics list)
INSTRUCTIONS
CR2002 RHASC
DM0 DM10 LD CR2002
RHASC DM0 DM10
bit bit
15 0
DM10
DM0 0(30H) 1(31H)
0 0 1 A
4
N
DM1 A(41H) U
L (00H)
Text Processing Instructions
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
FASC
Single-
FASC
FASC
precision
floating point
Convert single precision floating point
type real
type real numbers to text strings.
@FASC FASC number →
ARITHMETIC OPERATION
String
conversion
INSTRUCTIONS
Specifies the reference source that stores the single precision floating
S2 32 bits
point real number to be converted to a text string.
8 bits × (number of
D Specifies the start to store the converted text string.* 1
characters + 1)
Description of Operation
FASC Description of Parameters
Parameter Explanation
S1 Display format 0: Decimal point format1: Exponent format
specification
S1 +1 Total number Total number of digits of stored text (1 to 24)
of digits
S1 +2 Number of Number of digits past decimal point of stored text (0 to 7)
digits
* The "number of digits" includes sign, decimal point and symbol E for exponent format in
addition to the numerical value.
Parameter Explanation
CR2814 Zero suppress Unwanted zeros in the stored text are omitted.
(Zeros past the decimal point are not omitted.)
CR2815 + sign The + sign of the stored text is omitted.
omission
When the execution condition is ON, the single precision floating point type real number
specified by S2 is converted to HEX ASCII text string, and is stored starting from
D according to the contents of the parameters ( S1 to S1 +2).
End code NULL (00H) is stored at the end of text string.
@FASC This instruction is executed for one scan at the rising edge of the execution condition.
ARITHMETIC OPERATION
S1 : 0 (decimal point format) S2 ・ S2 +1: +12.3 (single precision floating point type real num
S1 +1 : 7 (total number of digits) CR2815 : OFF (+ sign not omitted)
S1 +2 : 2 (number of digits decimal point) CR2814 : OFF (zerosare not suppressed)
INSTRUCTIONS
bit
15
“+012.30” bit
0
D +(31H) 0(30H)
S2 +1 S2
D +1 1(31H) 2(32H)
+12.3
D +2 . (2EH) 3(33H)
Single precision floating point type real number N
D +3 0(30H) U
L (00H)
When S2 is 23.45 4
Total number Number of Text string to be stored to D
+ sign
*An error occurs and the result is not stored as the total number of digits is 10.
(CR2012turns ON.)
S2 When the digits past the decimal point of the value / S2 +1 is fewer than the
number of digits specified by number of digits past the decimal point ( S1 +2), the low-
order digits are packed with "0".
S2 When the digits past the decimal point of the value / S2 +1 is greater than the
number of digits specified by number of digits past the decimal point ( S1 +2), the
following digit is rounded to the nearest whole number.
When the number of digits past the decimal point ( S1 +2) is zero, the decimal point "."
is not output.
Operation flag
ARITHMETIC OPERATION
4 CR2012
• When a timer/counter is specified in D by indirect specification
• When the total number of digits and the number of digits past the decimal point does not
satisfy the following conditions
Text Processing Instructions
number of digits past decimal point = 0 1 ≤ total number of digits ≤ 24 5 ≤ total number of digits ≤ 24
Number of digits past decimal point Number of digits past decimal point
0 < number of digits past +2 ≤ total number of digits +6 ≤ total number of digits
decimal point ≤ 7 3 ≤ total number of digits ≤ 24 7 ≤ total number of digits ≤ 24
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, single precision floating point type real number +1.23456 is convertedto
text string and stored to data memory [DM1000 and onwards], and-1.23456E-10 is converted totext
string and stored to data memory "DM2000 onwards".
INSTRUCTIONS
(Mnemonics list)
R000 CR2814 CR2815
RES SET ① LD R000
MPS
#0 #10 #5 RES CR2814
② CON
4
DW DW DW
SET CR2815
DM0 DM1 DM2
MRD
FASC DW #0 DM0
DM0 +1.23456 DM1000 ③ CON
To prevent erroneous operation, set CR2814 and CR2815 before executing the instructions.
RFASC
RFASC
String → Single
Convert text strings to single
precision floating
precision floating point type
point type real
@RFASC real numbers.
RFASC
number
ARITHMETIC OPERATION
S D R F A S C S D
D 32 bits
type real number.
Description of Operation
RFASC When the execution condition is ON, the text string from S up to NULL (00H) is
interpreted as the text string of a single precision floating point type real number, and is
converted to a single precision floating point type real number. The resulting numerical
value is stored to [ D / D +1].
S +(2BH) 0(30H)
D +1 D
S +1 1(31H) 2(32H)
+12.3
S +2 .(2EH) 3(33H)
N Single precision floating point type real number
S +3 U
L (00H)
S +(2BH) 1(31H)
S +1 .(2EH) 2(32H) D +1 D
@RFASC This instruction is executed for one scan at the rising edge of the execution condition.
ARITHMETIC OPERATION
Point
indirectly specified in D .
The format of the text string must satisfy the following conditions.
INSTRUCTIONS
• Only the following characters can be used in text strings: +(2BH), -(2DH), E(45H), .(2EH),
0(30H) to 9(39H).
• 0(30H) to 9 (39H) is required to either the left or right of the decimal point.(2EH).
• The text string must conform to the following format:
+
㧙
Sign Value
4
Sign: +, - or no sign is allowed
+ +
E㧙
㧙
Sign Value Sign 8CNWG
Operation flag
Sample Program
ARITHMETIC OPERATION
When input relay R000 is ON, the text string of the single precision floating point type real number
currently stored to data memory [DM01000 onwards] is converted to the numerical value of the single
precision floating point type real number and stored to [DM01000/DM01001].
INSTRUCTIONS
(Mnemonics list)
R000 RFASC
DM0 DM1000 LD R000
RFASC DM0 DM1000
4
Text Processing Instructions
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
LEN
LEN
Detect text string Count the number of charactersin
length text strings.
@LEN LEN
ARITHMETIC OPERATION
S D L E N S D
Description of Operation
LEN When the execution condition is ON, the number of characters in the text string (NULL
(00H) is required at the end of the text string) currently stored starting from S is
counted. The number of characters is stored in binary data to D . Up to 1999 1-byte
characters can be handled as the text string.
S a(61H) b(62H) D 26
16-BIT
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
@LEN This instruction is executed for one scan at the rising edge of the execution condition.
Point 2-byte characters (shift JIS, etc.) are counted as two characters.
Operation flag
ARITHMETIC OPERATION
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 by indirect specification
• When a timer/counter is specified in S by indirect specification
INSTRUCTIONS
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
bit bit
15 0
The length (number of characters) of text string "12AB" is counted and stored to DM100.
(Mnemonics list)
CR2002 LEN
“12AB” DM100 LD CR2002
LEN "12AB" DM100
DM100
“12AB” 4
SMOV
SMOV
Move text
Store a text string.
string
@SMOV SMOV
ARITHMETIC OPERATION
S D S M O V S D
Description of Operation
SMOV When the execution condition is ON, the text string data (NULL (00H) is required at the
end of the text string) currently stored starting from S is stored starting from D .
End code NULL (00H) is stored at the end of text string. Up to 1999 1-byte characters can
be handled as the text string.
S D
String data Transfer String data
Example
…
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-bit 16-bit
@SMOV This instruction is executed for one scan at the rising edge of the execution condition.
Point • 2-byte characters (shift JIS, etc.) are counted as two characters.
• Program operation is normal even if the areas of S and D are overlapping.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S
and D
CR2012 • When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When D exceeds the device / work area range when the text string of S is stored in 4
D
Sample Program
The text string currently stored starting from data memory DM0 is stored to DM100 onwards.
(Mnemonics list)
CR2002 SMOV
DM0 DM100 LD CR2002
SMOV DM0 DM100
bit bit
15 0
SADD
SADD
Unite text
Unite the text strings.
string
@SADD SADD
ARITHMETIC OPERATION
S1 S2 D S A D D S1 S2 D
8 bits × (number of
D Specifies the storage location for the united text string. 1
characters + 1)
Description of Operation
SADD When the execution condition is ON, the text string currently stored starting from S1 is
united with the text string currently stored starting from S2 .
The result of the union is stored starting from D . End codeNULL (00H) is stored at
the end of text string.
The end code NULL (00H) is required at the end of the text string specified by S1 /
S2 . Up to 1999 1-byte characters can be handled asthe 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)
@SADD This instruction is executed for one scan at the rising edge of the execution condition.
Point • 2-byte characters (shift JIS, etc.) are counted as two characters.
• Program operation is normal even if the areas of S1 , S2 and D are
overlapping.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text strings specified by S1 and S2 do not contain the end code "NULL
(00H)"
• When the text string after the union including the end code (NULL (00H)) exceeds
2000characters
• When a bit other than the start of the channel is specified when bit data is specified for S1 ,
CR2012
S2 and D
• When a timer/counter has been specified by indirect specification in S1 , S2 and 4
D
Sample Program
The text string currently stored starting from data memory DM0 is united with the text string currently
stored starting from data memory DM100, and the result is stored to DM200 onwards.
(Mnemonics list)
CR2002 SADD
DM0 DM100 DM200 LD CR2002
SADD DM0 DM100 DM200
DM0: A(41H) B(42H)
The text string "ABCD" is united with the text string currently stored starting from data memory
DM100,and is stored to DM200 onwards.
(Mnemonics list)
CR2002 SADD
“ABCD” DM100 DM200 LD CR2002
SADD "ABCD" DM100 DM200
SRGHT
SRGHT
Cut the specified number of
Cut text
characters from the right edge (end)
string on right
@SRGHT SRGHT of the text string.
ARITHMETIC OPERATION
S D n S R G H T S D n
Description of Operation
SRGHT When the execution condition is ON, a text string with number of characters specified by
n is cut from the right edge (end) of the text string currently stored starting from
S , and the result is stored starting from D . End code NULL (00H) is stored at the
end of text string.
When the number of characters in the text string currently stored starting from S is
less than n , the entire text string is stored starting from D .
S and D may overlap.
When "0" is specified to n , only one character's worth of NULL is stored to D .
bit bit
Example 15 0
S A(41H) B(42H)
S +1 C(43H) D(44H)
S +2 E(45H) F(46H)
@SRGHT This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When the text string stored after D exceeds the device / work area range
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 and D
• When a timer/counter is specified in S and D by indirect specification
• When the indirect specification and index modify range is inappropriate 4
• When n is specified as 2000 or more
Sample Program
ARITHMETIC OPERATION
Four characters are cut from the right edge (end) of the text string data currently stored starting from
data memory DM0, and the result is stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS
CR2002 SRGHT
DM0 DM100 #4 LD CR2002
SRGHT DM0 DM100 #4
bit bit
15 0
4
DM2: E(45H) F(46H)
DM101: J(4AH) K(4BH)
DM3: G(47H) H(48H) N
DM102: U
L (00H)
DM4: I (49H) J(4AH)
Text Processing Instructions
N
DM5: K(4BH) U
L (00H)
Five characters are cut from the right edge (end) of the entered text string data, and the result isstored
starting from DM100.
(Mnemonics list)
CR2002 SRGHT
“ABCDEFGHIJKLM” DM100 #5 LD CR2002
SRGHT "ABCDEFGHIJKLM" DM100 #5
bit bit
15 0
“ABCDEFGHI
JKLM” DM101: K(4BH) L(4CH)
Five N
DM102: M(4DH) U
L (00H)
characters
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
SLEFT SLEFT
Cut text
Cut the specified number of
characters from the left edge (start)
string on left
@SLEFT SLEFT of the text string.
ARITHMETIC OPERATION
S D n S L E F T S D n
characters + 1)
Specifies the number of characters (number of bytes in range 0 to
n 16 bits
1999) to be cut.
Description of Operation
SLEFT When the execution condition is ON, a text string with number of characters specified by
n is cut from the left edge (start) of the text string currently stored starting from
S , and the result is stored starting from D . End code NULL (00H) is stored at the
end of text string.
When the number of characters in the text string currently stored starting from S is
less than n , the entire text string is stored starting from D .
S and D may overlap.
When "0" is specified to n , only one character's worth of NULL is stored to D .
bit bit
Example 15 0
K(4BH) L(4CH)
String must be ended
M(4DH) N(4EH) with NUL(00H).
S(53H) T(54H)
N
U(55H) U
L (00H)
@SLEFT This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When the text string stored after D exceeds the device / work area range
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 and D
• When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate 4
• When n is specified as 2000 or more
Sample Program
ARITHMETIC OPERATION
Four characters are cut from the left edge (start) of the text string data currently stored starting from
data memory DM0, and the result is stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS
CR2002 SLEFT
DM0 DM100 #4 LD CR2002
SLEFT DM0 DM100 #4
bit bit bit bit
15 0 15 0
4
N
DM2: E(45H) F(46H) DM102: U
L (00H)
N
DM5: K(4BH) U
L (00H)
Five characters are cut from the left edge (start) of the entered text string data, and the result is stored
starting from DM100.
(Mnemonics list)
CR2002 SLEFT
“ABCDEFGHIJKLM” DM100 #5 LD CR2002
SLEFT "ABCDEFGHIJKLM" DM100 #5
bit bit
15 0
“ABCDEFGHI
JKLM” DM101: C(43H) D(44H)
N
5 words DM102: E(45H) U
L (00H)
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
SMID
SMID
Cut text string Cut part of a text string.
ARITHMETIC OPERATION
SMID
@SMID
INSTRUCTIONS
4 S
n2
D n1 @ S M I D S D n1 n2
Text Processing Instructions
Description of Operation
SMID When the execution condition is ON, a text string with number of characters specified by
n2 is cut from the position specified by n1 in the text string currently stored
starting from S .
The cut text string is stored starting from D . End codeNULL (00H) is stored at the
end of text string.
When the number of characters in the text string currently stored starting from S is
less than n1 + n2 , the entire text string from n1 onwards is stored starting from
D .
S and D may overlap.
When "0" is specified to n2 , only one character's worth of NULL is stored to D .
@SMID This instruction is executed for one scan at the rising edge of the execution condition.
Example Position 0
ARITHMETIC OPERATION
Cut position n1
bit bit
15 0
INSTRUCTIONS
S +1 C(43H) D(44H) D +1 E(45H) F(46H)
S +2 E(45H) F(46H)
n2 words
K(4BH) L(4CH)
N
K(4BH) L(4CH) U
L (00H)
Operation flag
Sample Program
ARITHMETIC OPERATION
Five characters are cut from cut leading position 1 of the text string data currently stored starting
fromdata memory DM0. The cut five characters are stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS
CR2002 SMID
DM0 DM100 #1 LD CR2002
SMID DM0 DM100 #1 #5
#5
Four characters are cut from cut leading position 2 of the entered text string data. The cut four
characters are stored starting from DM100.
(Mnemonics list)
CR2002 SMID
“ABCDEFGHIJKLM” DM100 #2 LD CR2002
SMID "ABCDEFGHIJKLM" DM100 #2 #4
#4
bit bit
15 0
“ABCDEFGHI
JKLM” DM101: E(45H) F(46H)
N
4 words DM102: U
L (00H)
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
SRPLC
SRPLC
Replace text
Replace part of a text string.
string section
ARITHMETIC OPERATION
SRPLC
@SRPLC
INSTRUCTIONS
4 S1
n1
S2
n2
D @ S R P L C S1 S2
n1
D
n2
Text Processing Instructions
Description of Operation
SRPLC When the execution condition is ON, a text string with number of characters specified by
n2 is replaced from the position specified by n1 in the text string currently stored
starting from S1 with the text string currently stored starting from S2 .
The text string after the replacement is stored starting from D . End code NULL (00H)
is stored at the end of text string.
When the number of characters in the text string currently stored starting from S1 is
less than n1 + n2 , the entire text string from n1 onwards is stored starting from
S2 .
S1 or S2 and D may overlap.
@SRPLC This instruction is executed for one scan at the rising edge of the execution condition.
Example Position 0
ARITHMETIC OPERATION
Destination string Replace position n1 Text string to be
bit
15
bit
0
replaced
INSTRUCTIONS
S1 +1 C(43H) D(44H) S2 +1 Z(5AH) U
L (00H)
I(49H) J(4AH)
S(53H) T(54H)
U(55H)
N
U
L (00H)
4
String must be ended
D A(41H) B(42H)
D +1 C(43H) D(44H)
D +3 Z(5AH) G(47H)
D +4 H(48H) I(49H)
T(54H) U(55H)
N
U
L (00H)
Operation flag
ARITHMETIC OPERATION
4 CR2012
end code (NULL)
• When a bit other than the start of the channel is specified when bit data is specified for S1 ,
S2 and D
Text Processing Instructions
Sample Program
ARITHMETIC OPERATION
Two characters are replaced with the text string currently stored starting from data memory DM100from
the replacement leading position 4 in the text string currently stored starting from data memoryDM0.
The text string after the replacement is stored from DM200.
INSTRUCTIONS
(Mnemonics list)
CR2002 SRPLC
DM0 DM100 DM200 LD CR2002
#4 #2 SRPLC DM0 DM100 DM200 #4 #2
Position 0
4
Replace position:4
Text string to
be replaced
Character D (replacement start position 3, number of characters 1) in text string (ABCDEF) is replaced
with a text string (XYZ). The text string (ABCXYZEF) after replacement is stored from DM0.
(Mnemonics list)
CR2002 SMID
“ABCDEF” “XYZ” DM0 LD CR2002
#3 #1 SRPLC "ABCDEF" "XYZ" DM0 #3 #1
bit bit
15 0
SINS
SINS
Insert text Insert a specified text string
string into a text string.
ARITHMETIC OPERATION
SINS
@SINS
INSTRUCTIONS
4 S1
n
S2 D @ S I N S S1 S2 D n
Text Processing Instructions
Description of Operation
SINS When the execution condition is ON, the text string currently stored starting from S2 is
inserted from the position specified by n in the text string currently stored starting
from S1 .
The text string after the insertion is stored starting from D .
S1 or S2 and D may overlap.
@SINS This instruction is executed for one scan at the rising edge of the execution condition.
ARITHMETIC OPERATION
searched
bit bit searched
15 0
INSTRUCTIONS
N
S1 +2 E(45H) F(46H) S2 +1 U
L (00H)
4
S(53H) T(54H)
N
U(55H) U
L (00H)
D A(41H) B(42H)
D +1 C(43H) D(44H)
D +2 E(45H) F(46H)
D +3 G(47H) H(48H)
D +4 I (49H) J(4AH)
D +5 K(4BH) L(4CH)
D +6 M(4DH) N(4EH)
S(53H) T(54H)
N
U(55H) U
L (00H)
Operation flag
ARITHMETIC OPERATION
4
• When the length of the text string after the insertion exceeds 2000 characters including the
end code (NULL (00H))
CR2012
• When a bit other than the start of the channel is specified when bit data is specified for
Text Processing Instructions
S1 , S2 and D
• When a timer/counter has been specified by indirect specification in S1 , S2 and
D
• When the indirect specification and index modify range is inappropriate
• When the end of the text string stored in D is outside the device / work area range
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
ARITHMETIC OPERATION
The text string currently stored starting from data memory DM100 is inserted starting from insertion leading
position 3 of the text string currently stored starting from data memory DM0. The text string after the insertion
is stored from DM200.
INSTRUCTIONS
(Mnemonics list)
CR2002 SINS
DM0 DM100 DM200 LD CR2002
#3 SINS DM0 DM100 DM200 #3
4
Text string to be searched
Text string to be
searched
The text string (XYZ) is inserted following character C (insertion leading position 3) in the text string
(ABCDEF). The text string (ABCXYZDEF) after insertion is stored from DM0.
(Mnemonics list)
CR2002 SINS
“ABCDEF” “XYZ” DM0 LD CR2002
#3 SINS "ABCDEF" "XYZ" DM0 #3
bit bit
15 0
SDEL
SDEL
Delete text Delete a specified part of a
string section textstring.
ARITHMETIC OPERATION
SDEL
@SDEL
INSTRUCTIONS
4 S
n2
D n1 @ S D E L S D n1 n2
Text Processing Instructions
Description of Operation
SDEL When the execution condition is ON, a text string with number of characters specified by
n2 is cut from the position specified by n1 in the text string currently stored
starting from S .
The text string after the deletion is stored starting from D . End code NULL (00H) is
stored at the end of text string.
When the total of n1 and n2 exceeds the text string length, n1 to the end of
the text string (NULL (00H)) is deleted.
S and D may overlap.
@SDEL This instruction is executed for one scan at the rising edge of the execution condition.
ARITHMETIC OPERATION
Delete start position n1
bit bit
15 0
INSTRUCTIONS
S +1 C(43H) D(44H) n2 words D +1 E(45H) F(46H)
S +2 E(45H) F(46H) D +2
K(4BH) L(4CH)
K(4BH) L(4CH)
S(53H) T(54H)
N
S(53H) T(54H) U(55H) U (00H)
4
L
N
U(55H) U
L (00H) String must be ended
with NUL (00H) .
String must be ended
Operation flag
Sample Program
ARITHMETIC OPERATION
Five characters are deleted from deletion leading position 1 of the text string data currently stored
starting from data memory DM0. The text string after deletion is stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS
CR2002 SDEL
DM0 DM100 #1 LD CR2002
SDEL DM0 DM100 #1 #5
#5
4 DM0:
DM1:
A(41H)
C(43H)
B(42H)
D(44H)
DM100:
DM101:
A(41H)
H(48H)
G(47H)
I(49H)
Text Processing Instructions
Four characters are deleted from the deletion leading position 2 of the entered text string data. The text
string after deletion is stored starting from DM100.
(Mnemonics list)
CR2002 SDEL
“ABCDEFGHIJKLM” DM100 #2 LD CR2002
SDEL "ABCDEFGHIJKLM" DM100 #2 #4
#4
bit bit
15 0
“ABCDEFGHI
JKLM” DM1: G(47H) H(48H)
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
STRIM STRIM
Delete ends of
Deletes the tab and space at
the front and end of a
text string
@STRIM STRIM
specified text string.
ARITHMETIC OPERATION
S T R I M
D
characters + 1)
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000 Series CPU
units that have CPU function version 2.0 or higher and with KV Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
STRIM When the execution condition is ON, the 1-byte space and tab at the end of the text string
data (The end code NULL (00H) is required at the end of the text string) stored starting
from S1 is all deleted according to the details of parameter ( S2 ), and the resulting
text string is stored starting from D .
Specifying the parameter
bit S2 bit
15 0
@STRIM This instruction is executed for one scan at the rising edge of the execution condition.
Example When "3" is specified for parameter S2 and the instruction is executed
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When S1 does not contain the end code
• When text string including end code (NULL(00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S1
and D
CR2012
• When a timer/counter has been specified by indirect specification in S1 or D
• When the indirect specification and index modify range is inappropriate
• When D exceeds the device / work area range when the result is stored in D 4
• When an access outside the operand range occurs
Sample Program
All 1-byte spaces and tabs at the head and end of the text string stored in data memory DM0 and
following are deleted, and the results are stored in DM100 and following.
(Mnemonics list)
CR2002 STRIM LD CR2002
DM0 $0003 DM100 STRIM DM0 $0003 DM100
SFIND
SFIND
Search text Search a specified text string
string from a text string.
ARITHMETIC OPERATION
SFIND
@SFIND
INSTRUCTIONS
4 S1
n
S2 D @ S F I N D S1 S2 D n
Text Processing Instructions
Description of Operation
SFIND When the execution condition is ON, the text string currently stored starting from S2 is inserted
from the position specified by n in the text string currently stored starting from S1 .
The start position (number of bytes) of the text string specified by S2 from the first found
position onwards specified by n in the text string specified by S1 is stored to D .
When the text string specified by S2 is not found, or the length of the S2 text string
is 0, $FFFF is stored to D .
@SFIND This instruction is executed for one scan at the rising edge of the execution condition.
Example Position 0
Position n
Destination text string
to be searched Text string to be searched
S1 +4 C(43H) D(44H)
When n =6, string “CDE” is in position8 after position6.
S1 +5 E(45H) F(46H)
D 8
S(53H) T(54H)
Search range
N
U(55H) U
L (00H)
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S1 and S2 does not contain the end code "NULL
(00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When (length of S1 text string) < n + (length of S2 text string) (Length of text
string does not include the end code "NULL (00H)")
CR2012
• When a bit other than the start of the channel is specified when bit data is specified for S1
and S2 4
• When a timer/counter has been specified by indirect specification in S1 or S2
Sample Program
ARITHMETIC OPERATION
The text string currently stored starting from data memory DM100 is searched starting from the start
(position 0) of the text string currently stored starting from data memory DM0. "4" is stored to DM200as
the text string is detected at position 4.
INSTRUCTIONS
(Mnemonics list)
CR2002 SFIND
DM0 DM100 DM200 LD CR2002
SFIND DM0 DM100 DM200 #0
#0
Position 0
4
Position 4 Text string to be searched
DM3: E(45H) F(46H) As n =0, so search from start position, n is 4 , first time inspecting XY.
The text string (XY) is searched from the start of the text string (ABCXYDEF). "3" is stored to DM0.
(Mnemonics list)
CR2002 SFIND
“ABCXYDEF” “XY” DM0 LD CR2002
SFIND "ABCXYDEF" "XY" DM0 #0
#0
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
SFINDN
SFINDN
Search a specified text
Search text
string from a specified
string
@SFINDN
SFINDN text string range.
ARITHMETIC OPERATION
S1 S2 S3 D S F I N D N S1 S2 S3 D
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
ARITHMETIC OPERATION
SFINDN When the execution condition is ON, the text string currently stored starting from S2 is
searched from the position specified by S3 +1 in the text string of S3 bytes
currently stored starting from S1 .
INSTRUCTIONS
The start position (number of bytes) of the text string specified by S2 from the first
found position onwards specified by S3 +1 in the text string specified by S1 is
stored to D .
When the text string specified by S2 is not found, or the length of the S2 text string
is 0, $FFFF is stored to D .
Description of Parameters 4
@SFINDN This instruction is executed for one scan at the rising edge of the execution condition.
Position S3 +1
Operation flag
ARITHMETIC OPERATION
4 CR2012 • When a bit other than the start of the channel is specified when bit data is specified for S1
and S2
• When a timer/counter has been specified by indirect specification in S1 , S2 and
Text Processing Instructions
D
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
Sample Program
ARITHMETIC OPERATION
The text string stored from data memory DM100 is searched from for from the 5th byte (position 4)head
of the 100-byte text string stored starting from data memory DM0 to the 5th byte (position 4) ofthe 100-
byte text string stored from data memory DM0.
INSTRUCTIONS
(Mnemonics list)
CR2002 #18 #4
DW DW LD CR2002
DM300 DM301 DW #18 DM300
CR2002 CON
SFINDN DW #4 DM301
DM0 DM100 DM300 DM200 LD CR2002
SFINDN DM0 DM100 DM300 DM200
Position 4
DM200 14
SCMP SCMP
Compare
Compare text strings.
text strings
@SCMP SCMP
ARITHMETIC OPERATION
SCMP S C M P S1 S2
S2
characters + 1)
Description of Operation
SCMP When the execution condition is ON, the text string currently stored starting from S1 is
compared with the text string currently stored starting from S2 . Comparison is
performed one byte at a time from each of the starts. The end code NULL (00H) is
required at the end of the text string specified by S1 and S2 . Up to 1999 1-byte
characters can be handled as the text string.
Compared
Compared
S1 +4 I(49H) J(4AH) S2 +4
• • I(49H) J(4AH)
Operation flag CR2010 turns ON if the text strings are the same as a result of having
performed a compare up to NULL (00H).
Compare Result State of Operation Flag
When (all characters of S1 ) = (all characters of S2 ) CR2010→ON
When the nth character is different, the operation flag changes as follows:
Compare Result State of Operation Flag
When (ASCII code of nth character of S1 ) < (ASCII code of nth
CR2009→ON
character of S2 )
When (ASCII code of nth character of S1 ) > (ASCII code of nth
CR2011→ON
character of S2 )
@SCMP This instruction is executed for one scan at the rising edge of the execution condition.
4-304 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Text Processing Instructions
Operation flag
ARITHMETIC OPERATION
ON when nth character is different, and the ASCII code of the nth character of S1 is smaller
CR2009
than the ASCII code of the nth character of S2 . Otherwise, OFF.
ON when all of the ASCII code of S1 is the same as all of the ASCII code of
CR2010
INSTRUCTIONS
S2 .Otherwise, OFF.
ON when nth character is different, and the ASCII code of the nth character of S1 is greater
CR2011
than the ASCII code of the nth character of S2 . Otherwise, OFF.
ON in the following cases. Otherwise, OFF.
• When the text strings specified by S1 and S2 do not contain the end code "NULL
(00H)"
CR2012
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S1 4
and S2
Sample Program
ARITHMETIC OPERATION
The text string currently stored starting from data memory DM100 is compared in order from the startof
the text string currently stored starting from data memory DM0.
When all characters match as a result of the comparison, output relay R500 turns ON.
INSTRUCTIONS
When even one character does not match, output relay R501 turns ON.
(Mnemonics list)
CR2002 DM0 CR2010 R500
SCMP LD CR2002
DM100 SCMP DM0 DM100
CON
CR2009 R501
MPS
4 CR2011
AND CR2010
OUT R500
MPP
LD CR2009
Text Processing Instructions
OR CR2011
ANL
OUT R501
The text string currently stored starting from DM100 is compared in order from text string "12AB".
When all characters match as a result of the comparison, output relay R500 turns ON.
When even one character does not match, output relay R501 turns ON.
(Mnemonics list)
CR2002 “12AB” CR2010 R500
SCMP LD CR2002
DM100 SCMP "12AB" DM100
CON
CR2009 R501
MPS
AND CR2010
OUT R500
CR2011 MPP
LD CR2009
OR CR2011
ANL
OUT R501
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
DISS
DISS
Disperse text strings in bytes
Disperse text string
into text strings in words.
@DISS DISS
ARITHMETIC OPERATION
S D D I S S S D
Description of Operation
DISS When the execution condition is ON, the text string in bytes currently stored starting from
S is dispersed, and is stored in words starting from D . The end code NULL
(00H) is required at the end of S . Up to 1999 1-byte characters can be handled asthe
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)
@DISS This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 and D
• When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs 4
"Out-of-range access of operands", page 1-50
Sample Program
The byte unit text string currently stored starting from data memory DM0 is dispersed to word units, and
is stored to DM100 onwards.
(Mnemonics list)
CR2002 DISS
DM0 DM100 LD CR2002
DISS DM0 DM100
DM103 0 B(42H)
The ASCII text string "12AB" is dispersed to word units, and is stored to DM100 onwards.
(Mnemonics list)
CR2002 DISS
“12AB” DM100 LD CR2002
DISS "12AB" DM100
bit bit
15 0
DM100 0 1(31H)
DM102 0 A(41H)
DM103 0 B(42H)
UNIS
UNIS
Unite text strings in words
Unite text string
into text strings in bytes.
@UNIS UNIS
ARITHMETIC OPERATION
S D n U N I S S D n
4
S
1 8 bits × (number of
D Specifies the storage location for the united text string.
characters + 1)
Text Processing Instructions
Description of Operation
UNIS When the execution condition is ON, the text string in words currently stored starting from
S is stored in bytes to D . The number of characters to unite is specified by
n .
S a(61H)
S +1 b(62H) D a(61H) b(62H)
n : :
S + n -1 z(7AH) D +( n /2)-1
@UNIS This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the value of n is 2000 or more
• When a bit other than the start of the channel is specified when bit data is specified for S
and D
CR2012 • When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When the united text string length cannot be stored in the area starting with D
• When an access outside the operand range occurs 4
"Out-of-range access of operands", page 1-50
Sample Program
The text string currently stored in word units to six data memories (DM0 to DM5) starting from DM0 is
united to word units, and is stored to DM100 onwards.
(Mnemonics list)
CR2002 UNIS
DM0 DM100 #6 LD CR2002
UNIS DM0 DM100 #6
DM102 B(42H)
DM103 C(43H)
RCOM
RCOM
Read the comment of the
Read comment
device.
@RCOM
RCOM
ARITHMETIC OPERATION
KV-1000
Description of Operation
ARITHMETIC OPERATION
RCOM KV-1000 When the execution condition is ON, the device comment of S is read, and is
stored starting from D1 . End code NULL (00H) is stored at the end of text string.
Up to 32 1-byte characters can be handled as the text string.
INSTRUCTIONS
S comment
...
(single byte) while full-width characters
are stored by Shift JIS (double byte).
KV-5500/5000/3000, KV Nano Series The same processing as KV-1000 is performed at the rising
edge of the execution condition. The end notification is written into D2 , which is OFF
when the instruction execution starts and ON when the comment read ends.
KV-8000/7500/7300 The same processing is performed as KV-1000 at the rising edge of the
execution condition. Up to 32 characters can be processed. If all of the characters are
half-width characters, 33 bytes (32 bytes + NULL) are occupied, and if all of the
characters are full-width characters, 65 bytes (2×32 bytes + NULL) are occupied. When
stored, the character codes follow the project language settings. If a character that does
not exist in the project language configuration is used inside the device comment, the
device comment will be read out by replacing it with "_".
Point • The local device comment is read when both the local device comment and the global
device comment exit.
• KV-8000/7500/7300/5500/5000/3000, KV Nano Series After reading the comment with D2 ,
please read the following comments when reading multiple device comments.
• Device comment 1 (fixed) is read for the KV-8000/7000 Series.
• Variable / label comments cannot be read.
@RCOM This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
■ KV-1000
The device comment "STARTING" of input relay R000 is stored to DM100, and the device
comment"Quantity" of data memory DM0 is stored to DM200.
(Mnemonics list)
CR2002 RCOM
R000 DM100 LD CR2002
RCOM R000 DM100
RCOM DM0 DM200
RCOM
DM0 DM200
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
CPSASC CPSASC
CIP text string
type data
CIP text string type data is
converted into text string data.
@CPSASC CPSASC conversion
ARITHMETIC OPERATION
S D C P S A S C S D
D
characters + 1)
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
CPSASC When the execution condition is ON, the CIP text string type data stored in S is
converted and stored starting from D .
The CPSASC instruction is used to convert CIP text string type data.
For details on the CIP data type, refer to "EtherNet/IP Function User's Manual".
Example The operation of the CPSASC instruction is explained using the following type of CIP text
string type data as an example.
When the CPSASC instruction is executed, the CIP text string type data is converted and stored.
CIP text string type data Converted text string data
bit bit
15 0
S +0 5(0005H) A(41H) B(42H) D +0
S +1 B(42H) A(41H) C(43H) D(44H) D +1
S +2 D(44H) C(43H) E(45H) NULL(00H) D +1
S +3 E(45H)
Add NULL (00H) to end, interchange
high-order bytes and low-order bytes of
text string having data size, and then store.
@CPSASC Only one scan is executed at the rising edge of the execution conditions.
4-316 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Text Processing Instructions
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When a bit other than the start of the channel is specified when bit data is specified for S
and D
• When the text string stored in D is outside the device / work area range
• When a timer/counter has been specified by indirect specification in S or D
CR2012 • When data size specified with start word of S is 0 or 2000 or more
• When the CIP text string type data specified by
range
S is outside the device / work area
4
• When the indirect specification or index modification range is inappropriate
Sample Program
When the input relay MR000 is ON, the CIP text string type data stored after DM0 is converted and
stored in DM1000 and following.
(Mnemonics list)
MR000 CPSASC
LD MR000
DM0 DM1000
CPSASC DM0 DM1000
S D1 D2 R C P S A S C S D1 D2
D1
data.*1 characters*2
Specifies the storage location for the data size (number of bytes) of
D2 16 bits
CIP text string type data stored in D1 after conversion.
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
RCPSASC When the execution condition is ON, the text string data stored in S is converted into
CIP text string type data, and is stored starting from D1 .After conversion, the data size
(number of bytes) of the CIP text string type data stored in D1 is stored in D2 .
The RCPSASC instruction is used to convert text string data into CIP text string type data.
For details on the CIP data type, refer to "EtherNet/IP Function User's Manual".
Example The operation of the RCPSASC instruction is explained using the following type of CIP
text string type data as an example.
Text string "ABCDE"
bit bit
15 0
S +0 A(41H) B(42H)
S +1 C(43H) D(44H)
S +2 E(45H) NULL(00H) CIP text string type data "ABCDE"
@RCPSASC Only one scan is executed at the rising edge of the execution conditions.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When a bit other than the start of the channel is specified when bit data is specified for
S , D1 and D2
• When the S text string exceeds 2000 characters, including the NULL (00H)
• When the text string stored in D1 is outside the device / work area range
CR2012 • When a timer/counter has been specified by indirect specification in S or D1
•
•
When there is no NULL (00H) at the end of the text string stored in S
When the length of the text string stored in S is 0 4
• When the indirect specification or index modification range is inappropriate
Sample Program
When the input relay MR000 is ON, the text string stored after DM0 is converted into CIP text string
type data, and stored in DM1000 and following. The data volume (byte unit) stored after DM1000 is
stored in DM2000
(Mnemonics list)
MR000 RCPSASC
DM0 DM1000 DM2000 LDP MR000
RCPSASC DM0 DM1000 DM2000
CAL+
CAL+(.U)
CAL+.S
CAL+.D
CAL+ CAL+.L
CAL+.F
+
Add values
ARITHMETIC OPERATION
+.DF
ofOperand1
Add andOperand2and
@CAL+(.U) store the result into
@CAL+.S
INSTRUCTIONS
Operand3.
@CAL+.D
@CAL+ @CAL+.L
@CAL+.F
+
@CAL+.DF
4
Ladder program Input mode
Execution condition
C A L + S1 S2 D
+ S1 S2 D
Simple Operation Instructions
( + S1 S2 D )
Execution condition @ C A L + S1 S2 D
+ S1 S2 D
( @ + S1 S2 D )
Description of Operation
CAL+(.U) When the execution condition is ON, add unsigned 16-bit BIN data in S1 and S2 ,
and store the result into D .
S1 S2 D
1234 + 4321 = 5555
16-bit 16-bit 16-bit
(1 word) (1 word) (1 word)
CAL+.S When the execution condition is ON, add signed 16-bit BIN data in S1 and S2 , and
store the result into D .
S1 S2 D
1234 + −4321 = −3087
16-bit 16-bit 16-bit
(1 word) (1 word) (1 word)
CAL+.D When the execution condition is ON, add unsigned 32-bit BIN data in [ S1 / S1 +1]
and [ S2 / S2 +1], and store the result into [ D / D +1].
ARITHMETIC OPERATION
S1 +1 S1 S2 +1 S2 D +1 D
12345678 + 87654321 = 99999999
32-bit 32-bit 32-bit
INSTRUCTIONS
(2 words) (2 words) (2 words)
CAL+.L When the execution condition is ON, add signed 32-bit BIN data in [ S1 / S1 +1] and
[ S2 / S2 +1], and store the result into [ D / D +1].
S1 +1 S1 S2 +1 S2 D +1 D
12345678
32-bit
+ −87654321
32-bit
= −75308643
32-bit
4
(2 words) (2 words) (2 words)
CAL+.F When the execution condition is ON, add the single precision floating point type real
numbers in [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into [ D /
D +1].
S1 +1 S1 S2 +1 S2 D +1 D
Single precision floating
point type real number + Single precision floating
point type real number = Single precision floating
point type real number
−3.4E+38≦N≦−1.4E−45
N=0
1.4E−45≦N≦3.4E+38
(number of eff. digits: approx. 7).
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)
CAL+.DF When the execution condition is ON, add the double precision floating point type real
numbers in [ S1 / S1 +1/ S1 +2/ S1 +3] and [ S2 / S2 +1/ S2 +2/
S2 +3], and store the result into [ D / D +1/ D +2/ D +3].
S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number + Double precision floating point
type real number = Double precision floating point
type real number
−1.79E+308 ≦ N ≦ −2.23E−308
N = 0
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).
.
@CAL+.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The CAL+ and @CAL+ instructions perform operation in binary. The BCD number
must be converted to BIN with TBIN instruction before storing.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ARITHMETIC OPERATION
ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009
real number (.F) or double precision floating point type real number (.DF) range. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
INSTRUCTIONS
4 CR2012
• For suffix "F"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the single precision floating point type real number range, and an access
Simple Operation Instructions
Sample Program
When input relay R000 is ON, add unsigned 16-bit BIN data stored in DM0 and DM2, and store the
result into DM2.
(Mnemonics list)
R000
+ DM0 DM2 DM4 LDP R000
CAL+ DM0 DM2 DM4
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
CAL-(.U)
CAL-.S
CAL-.D
CAL- CAL-.L
CAL-.F
−
Subtract the value
ARITHMETIC OPERATION
@CAL-.DF
4
Ladder program Input mode
Execution condition
C A L − S1 S2 D
− S1 S2 D
Simple Operation Instructions
(− S1 S2 D )
Execution condition @ C A L − S1 S2 D
− S1 S2 D
( @ − S1 S2 D )
Description of Operation
CAL-(.U) When the execution condition is ON, subtract unsigned 16-bit BIN data in S2 from
S1 , and store the result into D .
S1 S2 D
5555 − 4321 = 1234
16-bit 16-bit 16-bit
(1 word) (1 word) (1 word)
CAL-.S When the execution condition is ON, subtract signed 16-bit BIN data in S2 from
S1 , and store the result into D .
S1 S2 D
5555 − −4321 = 9876
16-bit 16-bit 16-bit
(1 word) (1 word) (1 word)
CAL-.D When the execution condition is ON, subtract unsigned 32-bit BIN data in [ S2 /
S2 +1] from [ S1 / S1 +1], and store the result into [ D / D +1].
ARITHMETIC OPERATION
S1 +1 S1 S2 +1 S2 D +1 D
99999999 − 12345678 = 87654321
32-bit 32-bit 32-bit
INSTRUCTIONS
(2 words) (2 words) (2 words)
CAL-.L When the execution condition is ON, subtract signed 32-bit BIN data in [ S2 / S2 +1]
from [ S1 / S1 +1], and store the result into [ D / D +1].
S1 +1 S1 S2 +1 S2 D +1 D
87654321
32-bit
− −12345678
32-bit
= 99999999
32-bit
4
(2 words) (2 words) (2 words)
CAL-.F When the execution condition is ON, subtract the single precision floating point type real
number in [ S2 / S2 +1] from [ S1 / S1 +1], and store the result into [ D /
D +1].
S1 +1 S1 S2 +1 S2 D +1 D
Single precision floating point
type real number − Single precision floating point
type real number = Single precision floating point
type real number
−3.4E+38≦N≦−1.4E−45
N=0
1.4E−45≦N≦3.4E+38
(number of eff. digits: approx. 7).
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)
CAL-.DF When the execution condition is ON, subtract the double precision floating point type real
number in [ S2 / S2 +1/ S2 +2/ S2 +3] from [ S1 / S1 +1/ S1 +2/
S1 +3], and store the result into [ D / D +1/ D +2/ D +3].
S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number − Double precision floating point
type real number = Double precision floating point
type real number
−1.79E+308 ≦ N ≦ −2.23E−308
N = 0
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).)
@CAL-.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The CAL- and @CAL- instructions perform operation in binary. The BCD number
mustbe converted to BIN with TBIN instruction before storing.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ARITHMETIC OPERATION
ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009
real number (.F) or double precision floating point type real number (.DF) range. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
INSTRUCTIONS
data is not within the single precision floating point type real number range, and an access
outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the double precision floating point type real number range, and an access
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
Sample Program
Each time input relay R000 is ON, subtract unsigned 16-bit BIN data stored in DM2 from DM0, and
store the result into DM4.
(Mnemonics list)
R000
− DM0 DM2 DM4 LDP R000
CAL- DM0 DM2 DM4
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
CAL*(.U)
CAL*.S
CAL*.D
CAL* CAL*.L
CAL*.F
*
Multiply values of
ARITHMETIC OPERATION
CAL*.DF
Operand 1 and
Multiply Operand 2 and
@CAL*(.U) store the result
@CAL*.S
INSTRUCTIONS
into Operand 3.
@CAL*.D
@CAL* @CAL*.L
@CAL*.F
*
@CAL*.DF
4
Ladder program Input mode
Execution condition
C A L * S1 S2 D
* S1 S2 D
Simple Operation Instructions
(* S1 S2 D )
Execution condition @ C A L * S1 S2 D
* S1 S2 D
( @ * S1 S2 D )
Description of Operation
CAL*(.U) When the execution condition is ON, multiply unsigned 16-bit BIN data in S1 and
S2 , and store the result into [ D / D +1].
S1 S2 D +1 D
5555 × 456 = 2533080
16-bit 16-bit 32-bit
(1 word) (1 word) (2 words)
CAL*.S When the execution condition is ON, multiply signed 16-bit BIN data in S1 and S2 ,
and store the result into [ D / D +1].
S1 S2 D +1 D
−123 × 123 = −15129
16-bit 16-bit 32-bit
(1 word) (1 word) (2 words)
CAL*.D When the execution condition is ON, multiply unsigned 32-bit BIN data in [ S1 /
S1 +1] and [ S2 / S2 +1], and store the result into [ D / D +1/ D +2/
D +3].
S1 +1 S1 S2 +1 S2 D +3 D +2 D +1 D
1234 × 5678 = 7006652
32-bit 32-bit 64-bit
(2 words) (2 words) (4 words)
CAL*.L When the execution condition is ON, multiply signed 32-bit BIN data in [ S1 / S1 +1]
and [ S2 / S2 +1], and store the result into [ D / D +1/ D +2/ D +3].
ARITHMETIC OPERATION
S1 +1 S1 S2 +1 S2 D +3 D +2 D +1 D
−1234 × 5678 = −7006652
32-bit 32-bit 64-bit
INSTRUCTIONS
(2 words) (2 words) (4 words)
CAL*.F When the execution condition is ON, multiply the single precision floating point type real
numbers in [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into [ D /
D +1].
S1 +1 S1 S2 +1 S2 D +1 D
× =
4
Single precision floating point Single precision floating point Single precision floating point
type real number type real number type real number
CAL*.DF When the execution condition is ON, multiply the double precision floating point type real
numbers in [ S1 / S1 +1/ S1 +2/ S1 +3] and [ S2 / S2 +1/ S2 +2/
S2 +3], and store the result into [ D / D +1/ D +2/ D +3].
S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number × Double precision floating point
type real number = Double precision floating point
type real number
−1.79E+308 ≦ N ≦ −2.23E−308
N = 0
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).
@CAL*.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The CAL* and @CAL* instructions perform operation in binary. The BCD number
mustbe converted to BIN with TBIN instruction before storing.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ARITHMETIC OPERATION
ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009
real number (.F) or double precision floating point type real number (.DF) range. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
INSTRUCTIONS
4 CR2012
• For suffix "F"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the single precision floating point type real number range, and an access
Simple Operation Instructions
Sample Program
When input relay R000 is ON, add unsigned 16-bit BIN data stored in DM0 and DM2, and store the
result into DM4.
(Mnemonics list)
R000
* DM0 DM2 DM4 LDP R000
CAL* DM0 DM2 DM4
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
CAL/(.U)
CAL/.S
CAL/.D
CAL/ CAL/.L
CAL/.F
/
Divide the value of
ARITHMETIC OPERATION
@CAL/.D Operand 3.
@CAL/ @CAL/.L
@CAL/.F
/
@CAL/.DF
4
Ladder program Input mode
Execution condition
C A L / S1 S2 D
/ S1 S2 D
Simple Operation Instructions
( / S1 S2 D )
Execution condition @ C A L / S1 S2 D
/ S1 S2 D
( @ / S1 S2 D )
Description of Operation
CAL/(.U) When the execution condition is ON, divide unsigned 16-bit BIN data in S1 by S2 ,
and store the result (quotient) into D and the remainder into D +1.
S1 S2 D D +1
12345 ÷ 100 = 123 Remainder: 45
16-bit 16-bit 16-bit 16-bit
(1 word) (1 word) (1 word) (1 word)
CAL/.S When the execution condition is ON, divide signed 16-bit BIN data in S1 by S2 ,
and store the result (quotient) into D and the remainder into D +1.
S1 S2 D D +1
−12345 ÷ 100 = −123 Remainder: −45
16-bit 16-bit 16-bit 16-bit
(1 word) (1 word) (1 word) (1 word)
CAL/.D When the execution condition is ON, divide unsigned 32-bit BIN data in [ S1 / S1 +1]
by [ S2 / S2 +1], and store the result (quotient) into [ D / D +1] and the
ARITHMETIC OPERATION
remainder into [ D +2/ D +3].
S1 +1 S1 S2 +1 S2 D +1 D
12345678 ÷ 100 = 123456
INSTRUCTIONS
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
D +3 D +2
Remainder: 78
32-bit
(2 words)
CAL/.L When the execution condition is ON, divide signed 32-bit BIN data in [ S1 / S1 +1] by
[ S2 / S2 +1], and store the result (quotient) into [
into [ D +2/ D +3].
D / D +1] and the remainder
4
D +3 D +2
Remainder: −78
32-bit
(2 words)
CAL/.F When the execution condition is ON, divide the single precision floating point type real
number in [ S1 / S1 +1] by [ S2 / S2 +1], and store the quotient into [ D /
D +1].
S1 +1 S1 S2 +1 S2 D +1 D
Single precision floating point
type real number ÷ Single precision floating point
type real number = Single precision floating point
type real number
−3.4E+38≦N≦−1.4E−45
N=0
1.4E−45≦N≦3.4E+38
(number of eff. digits: approx. 7)
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)
.
CAL/.DF When the execution condition is ON, divide the double precision floating point type real
number in [ S1 / S1 +1/ S1 +2/ S1 +3] by [ S2 / S2 +1/ S2 +2/ S2 +3],
and store the quotient into [ D / D +1/ D +2/ D +3].
S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number ÷ Double precision floating point
type real number = Double precision floating point
type real number
−1.79E+308 ≦ N ≦ −2.23E−308
N = 0
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).
@CAL/.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point • The CAL/ and @CAL/ instructions perform operation in binary. The BCD number
must be converted to BIN with TBIN instruction before storing.
ARITHMETIC OPERATION
Operation flag
ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009
real number (.F) or double precision floating point type real number (.DF) range. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
Sample Program
When the input relay R000 is ON, divide unsigned 16-bit BIN data which stored in DM0 from the data in
DM2, then store the quotient into DM4, and store the residue into DM5.
(Mnemonics list)
R000
/ DM0 DM2 DM4 LDP R000
CAL/ DM0 DM2 DM4
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
CAL&(.U)
CAL& CAL&.D &
Logic
Perform logical
"AND" operation
for the values of
@CAL&(.U) AND
Operand 1 and
@CAL&
ARITHMETIC OPERATION
@CAL&.D &
Operand 2.
4
( @ W A N D S1 S2 D )
Operand Explanation Occupied size
.U 16 bits
Specifies the data to perform the logical "AND" operation.
Simple Operation Instructions
S1
.D 32 bits
.U 16 bits
S2 Specifies the data to perform the logical "AND" operation.
.D 32 bits
Specifies the storage location for the result of the logical "AND" .U 16 bits
D
operation. .D 32 bits
Description of Operation
When execution condition is ON, the specified BIN data of S1 and S2 , Logical AND true table
When the state of the same bit of S1 and S2 is "1", the same bit of S1 0 0 1 1
S2 0 1 0 1
D become "1".
D 0 0 0 1
CAL&(.U) When the execution condition is ON, perform logical "AND" for the 16-bit unsigned BIN
data specified by S1 and S2 , and store the result into D .
Example
& S1 S2 D
bit bit
15 0
S1 1111000011110000
S2 0000000011111111
bit bit
15 0
D 0000000011110000
CAL&.D When the execution condition is ON, perform logical "AND" for the 32-bit unsigned BIN
data specified by [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into
ARITHMETIC OPERATION
[ D / D +1].
Example
INSTRUCTIONS
&. D S1 S2 D
S1 ・ S1 +1 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
S2 ・ S2 +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
4
bit bit
31 0
D ・ D +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 0 0 0
Operation flag
Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
CR2002 (Mnemonics list)
& R000 $00FF DM0
LD CR2002
Always ON
CAL& R000 $00FF DM0
@CAL|.D |
2.
Execution condition C A L | S1 S2 D
| S1 S2 D (| S1 S2 D )
(W O R S1 S2 D )
Execution condition @ C A L | S1 S2 D
| S1 S2 D ( @ | S1 S2 D )
4
( @ W O R S1 S2 D )
Operand Explanation Occupied size
.U 16 bits
Specifies the data to perform the logical "OR" operation.
Simple Operation Instructions
S1
.D 32 bits
.U 16 bits
S2 Specifies the data to perform the logical "OR" operation.
.D 32 bits
Specifies the storage location for the result of the logical "OR" .U 16 bits
D
operation. .D 32 bits
Description of Operation
D 0 1 1 1
CAL|(.U) When the execution condition is ON, perform logical "OR" for the 16-bit unsigned BIN
data specified by S1 and S2 , and store the result into D .
Example
| S1 S2 D
bit bit
15 0
S1 1111000011110000
bit OR bit
15 0
S2 0000000011111111
bit bit
15 0
D 1111000011111111
CAL|.D When the execution condition is ON, perform logical "OR" for the 32-bit unsigned BIN
data specified by [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into
ARITHMETIC OPERATION
[ D / D +1].
Example
INSTRUCTIONS
|. D S1 S2 D
S1 ・ S1 +1 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
bit OR bit
31 0
S2 ・ S2 +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
4
bit bit
31 0
D ・ D +1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1
Operation flag
Sample Program
Perform the logical "OR" operation for the data of internal auxiliary relay MR000 to MR015 and MR100
to MR115, and output the result into the output relay R30000 to R30015.
(Mnemonics list)
CR2002
| MR000 MR100 R30000 LD CR2002
Always ON CAL| MR000 MR100 R30000
@CAL^.D ^
Operand 2.
Execution condition C A L ^ S1 S2 D
^ S1 S2 D ( ^ S1 S2 D )
(W X O R S1 S2 D )
Execution condition @ C A L ^ S1 S2 D
^ S1 S2 D ( @ ^ S1 S2 D )
4
( @ W X O R S1 S2 D )
Operand Explanation Occupied size
.U 16 bits
Specifies the data to perform the logical "Exclusive OR" operation.
Simple Operation Instructions
S1
.D 32 bits
.U 16 bits
S2 Specifies the data to perform the logical "Exclusive OR" operation.
.D 32 bits
Specifies the storage location for the result of the logical "Exclusive .U 16 bits
D
OR" operation. .D 32 bits
Description of Operation
When the executive condition is ON, perform the Exclusive OR of the Exclusive OR true table
specified BIN data S1 of S2 and , and store into D . Device status bit
CAL^(.U) When the execution condition is ON, perform logical "Exclusive OR" for the 16-bit
unsigned BIN data specified by S1 and S2 , and store the result into D .
Example
^ S1 S2 D
bit bit
15 0
S1 1111000011110000
S2 0000000011111111
bit bit
15 0
D 1111000000001111
CAL^.D When the execution condition is ON, perform logical "Exclusive OR" for the 32-bit
unsigned BIN data specified by [ S1 / S1 +1] and [ S2 / S2 +1], and store the
ARITHMETIC OPERATION
result into [ D / D +1].
Example
INSTRUCTIONS
^.D S1 S2 D
S1 ・ S1 +1 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
S2 ・ S2 +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
4
bit bit
31 0
D ・ D +1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
Operation flag
Sample Program
The last data of R30000 to R30015 is stored in the internal auxiliary relay MR000 to MR015 in advance,
and R500 is turend ON when any changes occur.
(Mnemonics list)
CR2002
^ R30000 MR000 DM0 LD CR2002
Always ON CAL^ R30000 MR000 DM0
MPS
CR2010 #100 ANB CR2010
SHOT SHOT #100 R500
R500 MPP
the operation result is zero
MOV R30000 MR000
MOV
R30000 MR000
~
CAL (.U)
~
CAL CAL~.D ~
Bit inversion
Invert all bits of
@CAL~(.U) the specified data.
@CAL~ ~.D
ARITHMETIC OPERATION
@CAL ~
Execution condition C A L ~ S D
~ S D ( ~
(N O T
S
S
D )
D )
(C M L S D )
Execution condition @ C A L ~ S D
~
4
S D (@ ~ S D )
(@ N O T S D )
(@ C M L S D )
Simple Operation Instructions
Description of Operation
CAL~(.U) When the execution condition is ON, invert all bits of the unsigned 16-bit BIN data
specified in S ("0→1", "1→0"), and store the result into D .
Example
~ S D
bit bit
15 0
S 1111000010101010
bit bit
15 0
D 0000111101010101
CAL~.D When the execution condition is ON, invert all bits of the unsigned 32-bit BIN data
specified in [ S / S +1] ("0→1", "1→0"), and store the result into [ D / D +1].
Example
~.D S D
S ・ S +1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
bit bit
31 0
D ・ D +1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
@CAL~.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state
INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
The state of input relays R00 to R003 are inverted and output to R500 to R503.
(Mnemonics list)
CR2002
Always ON
~ R000 MR000 LD CR2002
CAL~ R000 MR000
CAL& MR000 $000F R500
CAL>>
CAL>>(.U)
CAL>>.S
CAL>> CAL>>.D
CAL>>.L
>> Shift the bit
content of the
specified data to
ARITHMETIC OPERATION
Shift right
@CAL>>(.U) the smaller bit No.
@CAL>>.S by the specified
@CAL>> @CAL>>.D
@CAL>>.L
>> number of bits.
INSTRUCTIONS
4 Execution condition
>> D n
@ C A L > > D n
( @ > > D n )
Simple Operation Instructions
Point The CAL>>.S (@CAL>>.S) instruction and CAL>>.L (@CAL>>.L) instruction can be usedwith
KV-8000/7000 Series CPU units, KV-5000/3000 Series CPU units that have CPUfunction
version 2.0 or higher and with KV Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
CAL>>(.U) When the execution condition is ON, shift the unsigned 16-bit BIN data specified by
D right (shift to the smaller bit No.) by the number of bits specified by n , and
store the result into D .
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
bit
( n −1)
bit bit
15 0
D 1110100000011001
D 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 10 0 1
n
higher bits Delete
Filled with 0 1
CR2009
(Carry)
CAL>>.S When the execution condition is ON, shift the signed 16-bit BIN data specified by D
right (shift to the smaller bit No.) by the number of bits specified by n , and store the
ARITHMETIC OPERATION
result into D .
0 is stored in the high-order n bit when " D ≧0", and 1 is stored when " D <
0". The bit ( n -1) status is stored in CR2009.
INSTRUCTIONS
bit
( n −1)
bit bit
15 0
D 1111110000011000
D 11111111110000011000
CAL>>.D When the execution condition is ON, shift the unsigned 32-bit BIN data specified by
[ D / D +1] right (shift to the smaller bit No.) by the number of bits specified by
n , and store the result into [ D / D +1].
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
( n −1)
bit
bit bit
31 0
D ・ D +1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
D ・ D +1 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
Filled with 0
1
CR2009
(Carry)
CAL>>.L When the execution condition is ON, shift the signed 16-bit BIN data specified by [ D /
D +1] right (shift to the smaller bit No.) by the number of bits specified by n , and
store the result into [ D / D +1].
0 is stored in the high-order n bit when "[ D / D +1]≧0", and 1 is stored when
"[ D / D +1]<0". The bit ( n -1) status is stored in CR2009.
( n −1)
bit
bit bit
15 0
D D +1 10010000110011110000110010101110
D D +1 11111001000011001111000011001010 1 1 1 0
@CAL>>.□ This instruction is executed for one scan at the rising edge of the execution condition.
CAL>>When the SRA instruction is executed at every scan, the bits are shifted at
ARITHMETIC OPERATION
eachscan for the duration that the execution condition is ON. If the SRA instruction
isexecuted not at each scan but at the rising edge of the execution condition, use
thedifferential type execution instruction as follows.
INSTRUCTIONS
Operation flag
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
Sample Program
The BCD data (2 digits) from the digital switch entered to input relays R30008 to R30015 is stored
toDM0.
(Mnemonics list)
CR2002
>> R30000 #8 LD CR2002
Always ON CAL>> R30000 #8
CAL& $00FF R30000 DM0
& $00FF R30000 DM0
MEMO
ARITHMETIC OPERATION
INSTRUCTIONS
4
CAL<<(.U)
CAL<<.S
CAL<< CAL<<.D
CAL<<.L
<< Shift the bit
content of the
specified data to
ARITHMETIC OPERATION
Shift left
@CAL<<(.U) the larger bit No.
@CAL<<.S by the specified
@CAL<< @CAL<<.D
@CAL<<.L
<< number of bits.
INSTRUCTIONS
4 Execution condition
<< D n
@ C A L < < D n
( @ < < D n )
Simple Operation Instructions
Point The CAL<<.S (@CAL<<.S) instruction and CAL<<.L (@CAL<<.L) instruction can be
usedwith KV-8000/7000 Series CPU units, KV-5000/3000 Series CPU units that have
CPUfunction version 2.0 or higher and with KV Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
CAL<<(.U) When the execution condition is ON, shift the unsigned 16-bit BIN data specified by
D left (shift to the larger bit No.) by the number of bits specified by n , and store
the result into D .
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
bit (16− n )
bit bit
15 0
1110100000011001 D
1 11 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 D
1
Filled with 0
CR2009
(Carry)
CAL<<.S When the execution condition is ON, shift the signed 16-bit BIN data specified by D
left (shift to the larger bit No.) by the number of bits specified by n , and store the
ARITHMETIC OPERATION
result into D .
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
(16− n
bit )
INSTRUCTIONS
bit bit
15 0
1110100000011001 D
111010000001100100000 D
Delete
1
lower n bits
4
Filled with 0
CAL<<.D When the execution condition is ON, shift the unsigned 32-bit BIN data specified by
[ D / D +1] left (shift to the larger bit No.) by the number of bits specified by n ,
and store the result into [ D / D +1].
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
(32− n
bit )
bit bit
31 0
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 D ・ D +1
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 D ・ D +1
1 Filled with 0
CR2009
(Carry)
CAL<<.L When the execution condition is ON, shift the signed 32-bit BIN data specified by [ D /
D +1] left (shift to the larger bit No.) by the number of bits specified by n , and
store the result into [ D / D +1].
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
(32− n
bit )
bit bit
31 0
11101000000110011110100000011001 D D +1
1 1 1 0 100000011001111010000001100100000 D D +1
1
Filled with 0
CR2009
(Carry)
@CAL<<.□ This instruction is executed for one scan at the rising edge of the execution condition.
CAL<<When the SRA instruction is executed at every scan, the bits are shifted at
ARITHMETIC OPERATION
eachscan for the duration that the execution condition is ON. If it is executed not at each
scan but at the rising edge of the execution condition, use the differential type instruction.
INSTRUCTIONS
Operation flag
Sample Program
The data stored in the low-order 8 bits of data memory DM0 and DM1 is stored in DM10 with DM1 as
the high-order bit.
(Mnemonics list)
CR2002
<< DM1 #8 LD CR2002
Always ON CAL<< DM1 #8
CAL| DM0 DM1 DM10
EXTENDED INSTRUCTIONS
EXTENDED
INSTRUCTIONS
These instructions are for data processing, clock processing, high-speed
processing, and positioning processing, and memory card control.
For information about other instructions for CPU built-in features, see User's
Manual of the CPU unit used.
HKEY
HKEY Stores Hex key data to be read to
Hex key input
the control relay in time interval.
Description of Operation
5
• When the execution condition is ON, the information of the four bits specified by S
is captured in time interval (in the sequence D → D +1→ D +2→ D +3) into four times.
(8 scanning counts are required for processing.)
Data Processing Instructions
DC24V KV-5500/5000/3000/1000
COM1 R500 R501 R502 R503
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
0
Corresponding key 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.
Reference • With the HKEY instruction, use the Transistor Output Unit to turn outputs ON/OFF at every scan.
• Set so that the input time constant is less then the scan time.
Point • At least approx 80 ms is required to process this instruction even when the scan
time is10 ms/operation or less.
• Execution of the instruction is cancelled when the scan time exceeds 200 ms.
• When the assigned relay is specified in the KLseries PLC, make sure that "the
scan time of the KV-8000/7500/7300/5500/5000/3000/1000PLC is greater than the
KL communication cycle time". The CPU scan time can be set as a fixed scan time.
• Only HKEY instruction can be used in a program.
• This instruction cannot be used in interrupt programs or in the initialization module.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
CR2012 No change in state
Sample Program
Changing the setting value of internal counters by the BCD digital switch
3 2 1 0
5
10 10 10 10
BCD Digital switch
Set value: $5679
DC24V KV-5500/5000/3000/1000
− COM1 R500 R501 R502 R503
When input relay R004 is ON, the 16 inputs of the BCD digital switch are read, and control relay C3515
turns ON, the setting value of C0 is changed to the value (5679) specified by the digital switch.
(Mnemonics list)
R004 HKEY
R000 LD R004
R500 HKEY R000 R500
LD CR3515
CR3515 CR3600 C0
LDA CR3600
LDA TBIN STA
CON
TBIN
END CON
STA C0
ENDH
Execution condition S
SEG STA @ S E G S n
n
Operand Explanation Occupied size
.U 16 bits
S Specifies the (word) data that stores the data to be decoded.
.D 32 bits
5 n Specifies the number of digits (0 to 3 for .U, and 0 to 7 for .D).* 1 16 bits
*1 The following values are used when the value exceeds 0 to 3 or 0 to 7 when a value other than a
Data Processing Instructions
Description of Operation
SEG(.U) When the execution condition is ON, the n th digit of S is decoded to data for 7-
segment display, and the result is stored to the low-order 8 bits of the 16-bit internal
register. The high-order 8 bits do not change.
DM0 0001001000110100
F E D C B A 9 8 7 6 5 4 3 2 1 0
16-bit internal
register 01011011
SEG.D When the execution condition is ON, the n th digit of [ S / S +1] is decoded to
data for 7-segment display, and the result is stored to the low-order 8 bits of the 16-bit
internal register. The high-order 8 bits do not change.
Example When [ S / S +1] is DM0/DM1, the currently stored data is $12345678, and n
is #3
$12345678
EXTENDED INSTRUCTIONS
#7 #6 #5 #4 #3 #2 #1 #0
F E D C B A 9 8 7 6 5 4 3 2 1 0
16-bit internal
register 01101101
@SEG.□ This instruction is executed for one scan at the rising edge of the execution condition.
Value of
Specified Digit
16-bit internal register Bit0
5
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Bit5
Bit1
$1 0 0 0 0 0 1 1 0
$2 0 1 0 1 1 0 1 1
$3 0 1 0 0 1 1 1 1
$4 0 1 1 0 0 1 1 0 Bit6
$5 0 1 1 0 1 1 0 1
$6 0 1 1 1 1 1 0 1 Bit4
Bit2
$7 0 0 1 0 0 1 1 1
$8 0 1 1 1 1 1 1 1
$9 0 1 1 0 1 1 1 1
Bit3
$A 0 1 1 1 0 1 1 1
$B 0 1 1 1 1 1 0 0
$C 0 0 1 1 1 0 0 1
$D 0 1 0 1 1 1 1 0
$E 0 1 1 1 1 0 0 1
$F 0 1 1 1 0 0 0 1
Operation flag
Sample Program
When input relay R000 is ON, the data ($24) stored in DM0 is output to the 7-segment display from
output relays R30000 to R30015.
EXTENDED INSTRUCTIONS
(Mnemonics list)
R000 $24 DM0 #8 DM0 R30000
DW SEG RLNCA SEG STA LD R000
DM0 #1 #0 DW $24 DM0
CON
a a SEG DM0 #1
CON
f b f b RLNCA #8
CON
g g SEG DM0 #0
CON
7-segment 7-segment
STA R30000
e c display e c display
5
(2nd digit) (1st digit)
d d
Data Processing Instructions
a b c d e f g a b c d e f g
KV-B16TA
R30000
R30001
R30002
R30003
R30004
R30005
R30006
R30007
COM0
R30008
R30009
R30010
R30011
R30012
R30013
R30014
R30015
COM1
MEMO
EXTENDED INSTRUCTIONS
5
BCNT(.U)
BCNT BCNT.D BCNT
Bit
Count the number of bits
currently ON in the internal
@BCNT(.U) count
register.
@BCNT @BCNT.D BCNT
EXTENDED INSTRUCTIONS
Execution condition
LDA BCNT STA @ B C N T
Description of Operation
5 BCNT(.U) When the execution condition is ON, the bits in 16-bit internal register that are currently
ON are detected, and the number of ON bits is stored to16-bit internal register as 16-bit
Data Processing Instructions
BIN data.
① ② ③ ④ ⑤
16-bit internal
register #5
BCNT.D When the execution condition is ON, the bits in 32-bit internal register that are currently
ON are detected, and the number of ON bits is stored to 32-bit internal register as 32-bit
BIN data.
① ② ③ ④ ⑤ ⑥ ⑦⑧ ⑨
32-bit internal
register #9
@BCNT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
CR2012 No change in state
Sample Program
The number of relays in internal relays R1000 to R1015 that are ON is counted, and the result is stored
to data memory DM0.
(Mnemonics list)
CR2002 R1000 DM0
LDA BCNT STA LD CR2002
LDA R1000
CON
5
BCNT
DCNT(.U)
DCNT DCNT.D DCNT
Data
Detect the data with the same
value as the internal register
@DCNT(.U) count in the specified range, and
@DCNT @DCNT.D DCNT count its number.
EXTENDED INSTRUCTIONS
Execution condition S
LDA DCNT STA @ D C N T S n
n
Description of Operation
DCNT(.U) When the execution condition is ON, n data stored starting from S is compared
with the 16-bit internal register respectively. The number of data having thesame value in
16-bit internal registers is stored to the 16-bit internal register. The numberof data is
stored in unsigned 16-bit BIN data.
bit bit 16-bit internal register
15 0 bit15 bit0
DCNT.D When the execution condition is ON, n data stored starting from S is compared
with the 32-bit internal register respectively. The number of data having thesame value in
32-bit internal registers is stored to the 32-bit internal register. The numberof data is
stored in unsigned 32-bit BIN data.
EXTENDED INSTRUCTIONS
bit bit bit bit bit 32-bit internal register bit
31 16 15 0 31 0
S +3 23456789 S +2 Compare
Count number of devices which store
S +5 34567890 S +4 Compare the same value as that in 16-bit
internal register.The result is stored
…
…
…
n
to 16-bit internal register.
(2 n word) S +2( n -3)+1 12345678 S +2( n -3) Compare
Compare 2
@DCNT.□ This instruction is executed for one scan at the rising edge of the execution condition.
5
Operation flag
Sample Program
When input relay R000 is ON, the unsigned 16-bit BIN data currently stored to data memory DM0 is
compared with the unsigned 16-bit BIN data currently stored to DM100 to DM199. The number of data
storing the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 DM10
LDA DCNT STA LD R000
#100 LDA DM0
CON
DCNT DM100 #100
CON
STA DM10
compared with the signed 16-bit BIN data currently stored in DM100 to DM199. The number of data
storing the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 DM10
LDA.S DCNT STA LD R000
#100 LDA.S DM0
CON
DCNT DM100 #100
CON
STA DM10
MEMO
EXTENDED INSTRUCTIONS
5
SER
SER(.U)
SER SER.D SER Detects devices of the same
value as the internal register in
Search
@SER(.U) the specified range, and
@SER @SER.D SER detects their device No.
EXTENDED INSTRUCTIONS
5
.D 32 bits x n
n Specifies the number of data to be detected or its storage location. 16 bits
Data Processing Instructions
Description of Operation
SER(.U) When the execution condition is ON, n data stored starting from S is compared
with the 16-bit internal register respectively. The data No. storing the same value as the
16-bit internal register is stored to the 16/32-bit internal register. When multiple data
numbers are detected, the smallest data No. is stored. The data No. is stored in unsigned
16/32-bit BIN data.
bit bit 16-bit internal register
15 0 bit15 bit0
SER.D When the execution condition is ON, n data stored starting from S is compared
with the 32-bit internal register respectively. The data No. for the low-order 16 bits of the
data number storing the same value as the 32-bit internal register is stored in the 32-bit
internal register. When multiple data numbers are detected, the smallest data No. is
EXTENDED INSTRUCTIONS
stored. The data No. is stored in unsigned 32-bit BIN data.
bit bit bit bit bit 32-bit internal register bit
31 16 15 0 31 0
5
bit 32-bit internal register bit
31 0
Result S +2
@SER.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
Sample Program
When input relay R000 is ON, the unsigned 16-bit BIN data currently stored to data memory DM0 is
compared with the unsigned 16-bit BIN data currently stored to DM100 to DM199. The data No. storing
the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 CR2010 DM10
LDA SER STA LD R000
#100 LDA DM0
CON
SER DM100 #100
CON
AND CR2010
STA DM10
When input relay R000 is ON, the signed 16-bit BIN data currently stored in data memory DM0 is
compared with the signed 16-bit BIN data currently stored in DM100 to DM199. The data No. storing
the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 CR2010 DM10
LDA.S SER STA LD R000
#100 LDA.S DM0
CON
SER DM100 #100
CON
AND CR2010
STA DM10
MEMO
EXTENDED INSTRUCTIONS
5
DSER(.U)
DSER
DSER
DSER.D Search for
data within
Search
@DSER(.U) the specified
@DSER
DSER
@DSER.D range.
EXTENDED INSTRUCTIONS
Description of Operation
DSER(.U) When the execution condition is ON, the unsigned 16-bit BIN data specified by S1 is
the keyword to search the range of n words starting from S2 .
• The position of the first matched data (counted from S2 ) is stored in D .
• The number of data matched with the keyword is stored in D +1.
• In case no matching is found, "0" is stored in D and D +1.
bit bit S1
15 0 bit15 bit0
Position at first
S2 1234 When 3456
D
S2 +1 2345 When
3
S2 +2 3456 When
16-bit
n
:
…
( n word)
S2 + n −3 1234 When Number of consistence
D +1
S2 + n −2 3456 When
2
5678 When Result
S2 + n −1 16-bit
DSER.D When the execution condition is ON, the unsigned 32-bit BIN data specified by [ S1 /
S1 +1] is the keyword to search the range of n words starting from [ S2 /
S2 +1].
• The position of the first matched data (counted from [ S2 / S2 +1]) is stored in
D .
• The number of data matched with the keyword is stored in [ D +1].
• In case no matching is found, "0" is stored in D and [ D +1].
EXTENDED INSTRUCTIONS
n
:
…
(2× n word)
S2 +
( n −3)+1 45678901 S2 +
( n −3) When Number of consistence
D +1
S2 +
( n −2)+1 23456789 S2 +
( n −2) When
2
56789012 Result
S2 +
( n −1)+1 S2 +
( n −1) When
16-bit
@DSER.□ Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When input relay R000 is ON, the number of data with the value "1234" from DM0 to DM999 and their
No. counted from the start are searched.
(Mnemonics list)
R000 DSER
#1234 DM0 DM1000 #1000 LD R000
search start Leading search destination Leading search result DSER #1234 DM0 DM1000 #1000
MAX,MIN
MAX(.U)
MAX.S
MAX.D
MAX MAX.L
MAX.F
MAX
@MAX.DF
MIN(.U)
MIN.S
MIN.D
MIN MIN.L MIN
5 MIN.F
MIN.DF Calculates the minimum value of
Search BIN data currently stored in a
min.value specified range, and stores it to
Data Processing Instructions
@MIN(.U)
@MIN.S the internal register.
@MIN.D
@MIN @MIN.L
@MIN.F
MIN
@MIN.DF
Execution condition S
MAX STA @ M A X S n
n
Execution condition S
MIN STA M I N S n
n
Execution condition S
MIN STA @ M I N S n
n
Operand Explanation Occupied size
.U .S 16 bits x n
S Specifies the start of the range to be detected. .D .L .F 32 bits x n
.DF 64 bits x n
Specifies the number of data to be detected or its storage
n 16 bits
location.
Point The MAX.F (@MAX.F) instruction, MAX.DF (@MAX.DF) instruction, MIN.F (@MIN.F)
instruction and MIN.DF (@MIN.DF) instruction can be used with the KV-8000 series
CPU units and KV-7000 series CPU units with CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
MAX(.U) / MIN(.U)
When the execution condition is ON, data starting from is compared
EXTENDED INSTRUCTIONS
n S
respectively. Currently stored values are compared as unsigned 16-bit BIN data. As a
result of comparison, the maximum value (MAX.D) or the minimum value (MIN.D) is
stored to 16-bit internal register.
bit bit
15 0
S 1234
MAX(.U): store Max. value
S +1 2345 16-bit internal register
bit15 bit0
S +2 3456 9876
n
…
5
( n word) S + n −3 9876 MIN(.U): store Min. value
S + n −2 8765 16-bit internal register
bit15 bit0
S + n −1 7654 1234
S 1234
MAX.L:store Max value
S +1 2345 32-bit internal register
bit15 bit0
S +2 3456 3456
n
…
S + n −1 −3456 −3456
MAX.D / MIN.D
When the execution condition is ON, n data starting from S is compared
respectively. Currently stored values are compared as unsigned 32-bit BIN data. As a
result of comparison, the maximum value (MAX.D) or the minimum value (MIN.D) is
EXTENDED INSTRUCTIONS
S +1 12345678 S
MAX.D:store Max value
S +3 23456789 S +2 bit
31
32-bit internal register bit
0
S +5 34567890 S +4 98765432
n
(2 n word) S +2( n −3)+1 98765432 S +2( n −3) MIN.D:store min value
S +2( n −2)+1 87654321 S +2( n −2) bit
31
32-bit internal register bit
0
5 MAX.L / MIN.L
When the execution condition is ON, n data starting from S is compared
Data Processing Instructions
respectively. Currently stored values are compared as signed 32-bit BIN data. As a result
of comparison, the maximum value (MAX.D) or the minimum value (MIN.D) is stored to
32-bit internal register.
bit bit bit bit
31 16 15 0
S +1 12345678 S
MAX.L:store Max value
S +3 23456789 S +2 bit
31
32-bit internal register bit
0
S +5 34567890 S +4 34567890
…
n
(2 n word) S +2( n −3)+1 −12345678 S +2( n −3) MIN.L:store Min value
S +2( n −2)+1 −23456789 S +2( n −2) bit
31
32-bit internal register bit
0
MAX.F / MIN.F
When the execution condition is ON, n data starting from S is compared
respectively. Stored values are compared as single precision floating point type real
numbers. As a result of comparison, the maximum value (MAX.F) or the minimum value
(MIN.F) is stored to 32-bit internal register.
bit bit bit bit
31 16 15 0
S +1 1.234 S
MAX.L:store Max value
S +3 2.345 S +2 bit
31
32-bit internal register bit
0
S +5 3.456 S +4 3.456
…
n
( 2 n word) S +2( n −3)+1 −1.234 S +2( n −3) MIN.F:store Min value
S +2( n −2)+1 −2.345 S +2( n −2) bit
31
32-bit internal register bit
0
MAX.DF / MIN.DF
When the execution condition is ON, n data starting from S is compared
respectively. Stored values are compared as double precision floating point type real
numbers.
EXTENDED INSTRUCTIONS
As a result of comparison, the maximum value (MAX.DF) or the minimum value
(MIN.DF)is stored to 64-bit internal register.
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
S +3 1.2345678 S
MAX.DF:store Max value
S +7 2.3456789 S +4 bit
63
64-bit internal register bit
0
n
( 4 n word) S +4 ( n −3)+3 −1.234567 S +4 ( n −3) MIN.DF:store Min value
S +4 ( n −2)+3 −2.345789 S +4 ( n −2) bit 64-bit internal register bit
5
63 0
@MAX.□ / MIN.□
Operation flag
Sample Program
(1) Unsigned 16-bit BIN data max. value search/min. value search
EXTENDED INSTRUCTIONS
When input relay R000 is ON, the unsigned 16-bit BIN data currently stored to data memories DM0 to DM99
is compared. The maximum value is stored to DM1000. Also, the minimum value is stored to DM1001.
(Mnemonics list)
R000 DM0 DM1000
MAX STA LD R000
#100 MPS
MAX DM0 #100
DM0 DM1001
CON
MIN STA STA DM1000
#100 MPP
MIN DM0 #100
CON
STA DM1001
5 (2) Signed 16-bit BIN data max. value search/min. value search
Data Processing Instructions
When input relay R000 is ON, the signed 16-bit BIN data currently stored in data memories DM0 to DM99
is compared. The maximum value is stored to DM1000. Also, the minimum value is stored to DM1001.
(Mnemonics list)
R000 DM0 DM1000
MAX.S STA.S LD R000
#100 MPS
MAX.S DM0 #100
DM0 DM1001
CON
MIN.S STA.S STA.S DM1000
#100 MPP
MIN.S DM0 #100
CON
STA.S DM1001
(3) Unsigned 32-bit BIN data max. value search/min. value search
When input relay R000 is ON, the unsigned 32-bit BIN data currently stored in data memories [DM0/
DM1] to [DM198·DM199] is compared. The maximum value is stored to [DM1000·DM1001]. Also, the
minimum value is stored to [DM1002/DM1003].
(Mnemonics list)
R000 DM0 DM1000
MAX.D STA.D LD R000
#100 MPS
MAX.D DM0 #100
DM0 DM1002
CON
MIN.D STA.D STA.D DM1000
#100 MPP
MIN.D DM0 #100
CON
STA.D DM1002
(4) Signed 32-bit BIN data max. value search/min. value search
When input relay R000 is ON, the signed 32-bit BIN data currently stored in data memories [DM0/DM1]
to [DM198·DM199] is compared. The maximum value is stored to [DM1000·DM1001]. Also, the
minimum value is stored to [DM1002/DM1003].
(Mnemonics list)
R000 DM0 DM1000
MAX.L STA.L LD R000
#100 MPS
MAX.L DM0 #100
DM0 DM1002
CON
MIN.L STA.L STA.L DM1000
#100 MPP
MIN.L DM0 #100
CON
STA.L DM1002
(5) Single precision floating point type real number max. value search/min. value
search
When input relay R000 is ON, the single precision floating point type real number stored in data
EXTENDED INSTRUCTIONS
memories [DM0/DM1] to [DM198·DM199] is compared. The maximum value is stored to
[DM1000·DM1001]. Also, the minimum value is stored to [DM1002/DM1003].
(Mnemonics list)
R000 DM0 DM1000
MAX.F STA.F LD R000
#100 MPS
MAX.F DM0 #100
DM0 DM1002
CON
MIN.F STA.F STA.F DM1000
#100 MPP
MIN.F DM0 #100
CON
STA.F DM1002
(6) Double precision floating point type real number max. value search/min. value
5
AVG(.U)
AVG.S
AVG.D
AVG AVG.L
AVG.F
AVG
@AVG.DF
5 Execution condition S
n
AVG STA @ A V G S n
Data Processing Instructions
Point The AVG.F (@AVG.F) instruction and AVG.DF (@AVG.DF) instruction can be used
with the KV-8000 series CPU units and KV-7000 Series CPU units with CPU function
version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
AVG(.U) When the execution condition is ON, the average value of n unsigned 16-bit BIN
data starting from is calculated and stored to 16-bit internal register.
EXTENDED INSTRUCTIONS
S
bit bit
15 0
S 16
S +1 256
S +2 4096
n …
…
( n word) S + n −3 16383 Average value is stored to 16-bit internal register.
S -32700
S +1 -16350
S +2 -8175
n
…
AVG.D When the execution condition is ON, the average value of n unsigned 32-bit BIN
data starting from S is calculated and stored to 32-bit internal register.
bit bit bit bit
31 16 15 0
S +1 12345678 S
S +3 23456789 S +2
S +5 34567890 S +4
…
…
…
AVG.L When the execution condition is ON, the average value of n signed 32-bit BIN data
starting from S is calculated and stored to 32-bit internal register.
bit bit bit bit
31 16 15 0
S +1 -90123456 S
S +3 -89012345 S +2
S +5 -78901234 S +4
n
…
AVG.F When the execution condition is ON, the average value of n single precision floating
point type real numbers starting from S is calculated, and the result is stored in the
32-bit internal register.
bit bit bit bit
31 16 15 0
EXTENDED INSTRUCTIONS
S +1 1.234 S
S +3 2.345 S +2
S +5 3.456 S +4
n
…
Average value is stored
( 2 n Word) S +2( n -3)+1 −1.234 S +2( n -3) to 32-bit internal register
AVG.DF When the execution condition is ON, the average value of n double precision floating
point type real numbers starting from S is calculated, and the result is stored in the
S +3 1.2345678 S
Data Processing Instructions
S +7 2.3456789 S +4
S +11 3.4567890 S +8
n
…
…
Average value is stored
( 4 n word) S +4( n -3)+1 −1.234567 S +4( n -3) to 64-bit internal register
@AVG.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the suffix is .F and the values specified by S and n are outside the single
precision floating point type real number range
• When the suffix is .DF and the values specified by S and n are outside the double
precision floating point type real number range
• When the suffix is .F and the total during calculation is outside of the single precision floating
point type real number range
CR2012 • When the suffix is .DF and the total during calculation is outside of the double precision floating
point type real number range
• When n =0
• When a value other than the constant is specified for n , and S + n exceeds the
device or work area range
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
EXTENDED INSTRUCTIONS
When input relay R000 is ON, the average value of the unsigned 16-bit BIN data currently stored to
data memories DM0 to DM99 is calculated, and the result is stored to DM1000.
(Mnemonics list)
R000 DM0 DM1000
AVG STA LD R000
#100 AVG DM0 #100
CON
STA DM1000
(5) Single precision floating point type real number average value calculation
When input relay R000 is ON, the average value of the single precision floating point type real numbers
stored in data memories [DM0/DM1] to [DM198·DM199] is calculated, and the result is stored to
[DM1000·DM1001].
(Mnemonics list)
R000 DM0 DM1000
AVG.F STA.F LD R000
#100 AVG.F DM0 #100
CON
STA.F DM1000
(6) Double precision floating point type real number average value calculation
When input relay R000 is ON, the average value of the double precision floating point type real
numbers stored in data memories [DM0/DM1·DM2·DM3] to [DM396·DM397·DM398·DM399] is
calculated, and the result is stored to [DM1000·DM1001·DM1002·DM1003].
(Mnemonics list)
R000 DM0 DM1000
AVG.DF STA.DF LD R000
#100 AVG.DF DM0 #100
CON
STA.DF DM1000
Example of application
The average value of travel distance data (expressed as unsigned 32-bit BIN data) is calculated, and
stored to data memories [DM1000/DM1001].
EXTENDED INSTRUCTIONS
The travel distance data is currently stored in [DM0/DM1]. The latest ten data are stored to [DM100/
DM101] to [DM118/DM119].
At the rising edge of input relay R000, the travel distance data is stored to data memories, and the
latest ten data are updated. The correct value will not be calculated unless the average value is
measured for ten times or more from the start of measurement.
"WSR Instruction", page 4-124
(Mnemonics list)
CR2008 DM0
ZRES LD CR2008
5
DM119 ZRES DM0 DM119
LDP R000
R000 WSR.D
WSR.D DM100 #10 #1
↑ DM100 #10 #1 MOV.D DM0 DM100
Data Processing Instructions
DM100 DM1000
AVG.D STA.D
#10
MEMO
EXTENDED INSTRUCTIONS
5
WSUM(.U)
WSUM.S
WSUM.D
WSUM WSUM.L
WSUM.F
WSUM
Calculates the total value of
WSUM.DF
BIN data currently stored in
Word total
a specified range, and
EXTENDED INSTRUCTIONS
@WSUM(.U) calculation
stores it to the internal
@WSUM.S
register.
@WSUM.D
@WSUM @WSUM.L
@WSUM.F
WSUM
@WSUM.DF
5 Execution condition
n
S
S n
Data Processing Instructions
WSUM STA @ W S U M
n
Point The WSUM.F (@WSUM.F) instruction and WSUM.DF (@WSUM.DF) instruction can
beused with the KV-8000 series CPU units and KV-7000 Series CPU units that have
CPUfunction version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3
Description of Operation
WSUM(.U) When the execution condition is ON, the total value of n unsigned 16-bit BIN data
starting from S is calculated, and the result is stored to 32-bit internal register.
bit bit
15 0
S 16
S +1 256
S +2 4096
n
…
S + n −2 32767
32-bit internal register
WSUM.S When the execution condition is ON, the total value of n signed 16-bit BIN data
starting from S is calculated, and the result is stored to 32-bit internal register.
bit bit
15 0
S -32700
EXTENDED INSTRUCTIONS
S +1 -16350
S +2 -8175
n
…
…
High 16 bits are stored to high 16 bit and
( n word)
S + n −3 8175 TM0 of 32-bit internal register
S + n −2 16350
32-bit internal register
WSUM.D When the execution condition is ON, the total value of n unsigned 32-bit BIN data
starting from S is calculated, and the result is stored to 32-bit internal register and
5
S +1 12345678 S
S +3 23456789 S +2
S +5 34567890 S +4
…
…
…
n
(2 n word) S +2( n -3)+1 78901234 S +2( n -3)
S +2( n -2)+1 89012345 S +2( n -2) Higher Lowest
S +2( n -1)+1 90123456 S +2( n -1) Total TM1 TM0 32-bit internal register
64-bit
WSUM.L When the execution condition is ON, the total value of n signed 32-bit BIN data
starting from S is calculated, and the result is stored to 32-bit internal register and
temporary data memory TM0/TM1. The result is calculated as 64-bit data.
bit bit bit bit
31 16 15 0
S +1 -90123456 S
S +3 -89012345 S +2
S +5 -78901234 S +4
…
…
…
n
(2 n word) S +2( n -3)+1 78901234 S +2( n -3)
S +2( n -2)+1 89012345 S +2( n -2) Higher Lower
S +2( n -1)+1 90123456 S +2( n -1) Total TM1 TM0 32-bit internal register
64-bit
WSUM.F When the execution condition is ON, the total value of n single precision floating
point type real numbers starting from S is calculated, and the result is stored in the
32-bit internal register.
bit bit bit bit
31 16 15 0
S +1 1.234 S
S +3 2.345 S +2
S +5 3.456 S +4
…
…
…
n
( 2 n word) S +2( n -3)+1 −1.234 S +2( n -3)
S +2( n -2)+1 −2.345 S +2( n -2)
−3.456 32-bit internal register
S +2( n -1)+1 S +2( n -1) Total
32-bit
WSUM.DF When the execution condition is ON, the total value of n double precision floating
point type real numbers starting from S is calculated, and the result is stored in the
64-bit internal register.
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
EXTENDED INSTRUCTIONS
S +3 1.2345678 S
S +7 2.3456789 S +4
S +11 3.4567890 S +8
…
…
…
n
( 4 n word) S +4( n -3)+3 −1.234567 S +4( n -3)
S +4( n -2)+3 −2.345789 S +4( n -2)
64-bit internal register
S +4( n -1)+3 −3.456890 S +4( n -1) Total
64-bit
@WSUM.□ This instruction is executed for one scan at the rising edge of the execution condition.
5 Operation flag
CR2009 No change in state
Data Processing Instructions
Sample Program
WSUM (.U)
When input relay R000 is ON, the total value of the unsigned 16-bit BIN data currently stored in data
EXTENDED INSTRUCTIONS
memories DM0 to DM99 is calculated, and the result is stored to DM1000.
The result is stored to "DM1000 · DM1001" when it exceeds the 16-bit range.
When the operation result is 0 to 65535
(Mnemonics list)
R000 DM0 DM1000
WSUM STA LD R000
#100 WSUM DM0 #100
CON
STA DM1000
or
(Mnemonics list)
R000 DM0 DM1000
WSUM STA LD R000
#100 MPS
WSUM DM0 #100
TM0 DM1001
CON
LDA STA STA DM1000
MPP
LDA TM0
CON
STA DM1001
WSUM.S
When input relay R000 is ON, the total value of the signed 16-bit BIN data currently stored in data
memories DM0 to DM99 is calculated, and the result is stored to DM1000.
The result is stored to "DM1000 · DM1001" when it exceeds the 16-bit range.
When the operation result is -32768 to 32767
(Mnemonics list)
R000 DM0 DM1000
WSUM.S STA.S LD R000
#100 WSUM.S DM0 #100
CON
STA.S DM1000
or
(Mnemonics list)
R000 DM0 DM1000
WSUM.S STA LD R000
#100 MPS
WSUM.S DM0 #100
TM0 DM1001
CON
LDA STA STA DM1000
MPP
LDA TM0
CON
STA DM1001
BSUM BSUM
Byte total
Calculates the total value of high-order/low-
order 8 bits of the BIN data currently stored
calculation within a specified range, and stores it to the
@BSUM BSUM
internal register.
Execution condition S
BSUM STA B S U M S n
n
Execution condition S
BSUM STA @ B S U M S n
n
5
Description of Operation
Data Processing Instructions
BSUM When the execution condition is ON, the total value of high-order and lower-order 8 bits of
the BIN data currently stored in a specified range starting from S is calculated, and
stored to 32-bit internal register.
The high-order 16 bits of the 32-bit internal register are also stored to temporary data
memory TM0. When n is an odd number, up to the high-order 8 bits of the last data
are calculated.
Calculation is performed from high-order to low-order bits. When n is an odd
number, the low-order 8 bits of the last word data are ignored.
16-bit
(1 word)
bit bit bit bit
15 8 7 0
S BDh 21h
BDh
S +1 B4h DDh Higher 16 bits of 32-bit internal register
21h
are also stored to TM0
S +2 B7h B0h B4h
・
・ TM0
…
・
S + n ÷2−3 4Eh 43h 45h
Overwrite
4Bh
S + n ÷2−2 59h 45h 45h
+ Higher Lower
@BSUM This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When a timer/counter is specified in S
• When a bit other than the start of the channel is specified when bit data is specified for S
• When the value of n is 0
• When the indirect specification or index modification range is inappropriate
CR2012 • When a value other than the constant is specified for n , and S + n exceeds
the device or work area range
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
5
Sample Program
When input relay R000 is ON, the ASCII text string currently stored starting from data memory DM0 is
totaled in bytes, and the result is stored to [DM1000·DM1001].
(Mnemonics list)
R000 LEN
DM0 DM100 ① LD R000
LEN DM0 DM100
BSUM DM0 DM100
DM0 DM1000 CON
BSUM STA.D ② STA.D DM1000
DM100
(1) The number of characters in the text string currently stored starting from DM0 is counted, and the number
of characters is stored to DM100.
(2) The value currently stored starting from DM0 is totaled in bytes, and the result is stored to [DM1000/
DM1001].
CRC
CRC Calculates the CRC value of a
Calculate specified number of devices /
CRC value variables, and stores it to the
@CRC
CRC
internal register.
5
characters + 1)
Specifies the number of data (1- 65535).
n S1 +1 is ON: Specifies the number in 1-byte (8-bit) unit. 16 bits
Data Processing Instructions
Description of Operation
CRC When the execution condition is ON, the CRC value of n data starting from S2 is
calculated in the operation mode specified by S1 .
The operation of the CRC instruction changes as shown in the following table depending
on the value of operation mode S1 .
S1 +1
operation 1 2 1 2 1
3 4 3 4 2
n −1 n n n
The value set to 16-bit internal register is The CRC default is fixed at
S1 +2 CRC default
used as the CRC default. 0x0000.
Operation data The bit alignment (order) of data to be The bit position is not inverted.
S1 +3 bit order operated on is inverted in byte units, and
inversion the CRC value is calculated.
* S1 + 2 and S1 + 3 are normally used in OFF state. Set these as necessary to match the
equipment to be used.
@CRC This instruction is executed for one scan at the rising edge of the execution condition.
Reference The following describes an example relating operation data bit order inversion in byte
units.
EXTENDED INSTRUCTIONS
Operation data
bit order CRC-ITU-T S1 +0: ON CRC-16 S1 +0: OFF
inversion
bit bit bit bit
Not inverted 7 0 7 0
Operation flag
5
CR2009 No change in state
Sample Program
The CRC value of 128 words (256 bytes) from DM1000 to DM1127 is calculated by CRC-ITU-T
(CCITT).
The result is stored to DM128, and the DM1000 to DM1128 (including the CRC value) send data is
created.
(Mnemonics list)
CR2002 R1000 R1001 R1002 R1003
SET RES RES RES LD CR2002
MPS
SET R1000
CRC
CON
R1000 DM1000 #256 RES R1001
CON
DM128 RES R1002
STA CON
RES R1003
MRD
CRC R1000 DM1000 #256
MPP
STA DM128
ZRES ZRES
Zone reset
Resets (stores 0) all values
stored in a specified range.
@ZRES ZRES
Execution condition D1
ZRES Z R E S D1 D2
D2
Execution condition D1
ZRES @ Z R E S D1 D2
D2
5
D2
is stored).* 1 16 bits × ( D2 - D1 +1) for words
*1 CR cannot be specified.
Data Processing Instructions
Description of Operation
ZRES When the execution condition is ON, D1 to D2 are reset (0 is stored).
When word data is specified
bit bit bit bit
15 0 15 0
D1 2048 Reset 0
D1 +1 4096 Reset 0
D1 +2 8192 Reset 0
: :
…
D2 −2 16384 Reset 0
D2 −1 32767 Reset 0
D2 65535 Reset 0
R1002: ON ON :R1002
R1003: ON ON :R1003
R1004: ON ON :R1004
@ZRES This instruction is executed for one scan at the rising edge of the execution condition.
Point • The current values of timers (TMR, TMH, TMS, TMU) becomes the same value as
the setting value.
• The current value of counters (C, OUTC), up-down counters (UDC), and up-down
EXTENDED INSTRUCTIONS
timers (UDT) becomes "0".
Operation flag
Sample Program
When input relay R000 turns ON, "0" is stored to data memories DM0 to DM99.
When R000 is OFF, internal auxiliary relays R1000 to R1115 are reset.
(Mnemonics list)
R000 DM0
ZRES LD R000
DM99 ZRES DM0 DM99
LDB R000
R000 R1000
ZRES R1000 R1115
ZRES
R1115
EXT(.U)
EXT.S
EXT EXT.D
EXT.L
EXT
@EXT.D EXT
@EXT.L
Execution condition
LDA EXT STA.D @ E X T
5
Description of Operation
Data Processing Instructions
The values of 16-bit internal registers are extended to 32 bits. This instruction is used for addition,
subtraction, multiplication, and division arithmetic operation calculations.
"ADD Instruction", page 4-40
"SUB Instruction", page 4-44
"MUL Instruction", page 4-48
"DIV Instruction", page 4-54
"ROOT Instruction", page 4-66
EXT(.U) When the execution condition is ON, the unsigned 16-bit BIN data currently stored in 16-
bit internal register is extended to 32 bits.
$0 is stored to the high-order 16 bits and temporary data memory TM0 of the 32-bit
internal register.
1234
1234 TM0 16-bit internal register
16-bit 1234
(1 word)
32-bit
(2 word)
EXT.S When the execution condition is ON, the signed 16-bit BIN data currently stored in 16-bit
internal register is extended to 32 bits.
$0 is stored to the high-order 16 bits and temporary data memory TM0 of 32-bit internal
register if the data is positive, and $FFFF is stored if the data is negative.
−1234
−1234 TM0 16-bit internal register
16-bit −1234
(1 word)
32-bit
(2 word)
The values of 32-bit internal registers are extended to 64 bits. This instruction is used for addition,
subtraction, multiplication, and division arithmetic operation calculations.
"MUL Instruction", page 4-48
"DIV Instruction", page 4-54
EXTENDED INSTRUCTIONS
"ROOT Instruction", page 4-66
EXT(.D/.L)
EXT.D When the execution condition is ON, the unsigned 32-bit BIN data currently stored in 32-
bit internal register is extended to 64 bits. $0 is stored to temporary data memories
[TM0·TM1].
TM1 TM0 32-bit internal register
12345678
32-bit
(2 word)
12345678
64-bit
(4 word)
5
−12345678 −12345678
32-bit 64-bit
(2 word) (4 word)
@EXT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
"
Sample Program
The unsigned 16-bit BIN data currently stored in data memory DM0 is extended to unsigned 32-bit BIN
data, and the unsigned 32-bit BIN data currently stored in [DM10/DM11] is added. The result is stored
EXTENDED INSTRUCTIONS
to [DM20/DM21].
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA EXT ADD.D STA.D LD CR2002
LDA DM0
CON
EXT
CON
ADD.D DM10
CON
STA.D DM20
The signed 16-bit BIN data currently stored in data memory DM0 is extended to signed 32-bit BIN data,
5 and the signed 32-bit BIN data currently stored in [DM10/DM11] is added. The result is stored to
[DM20/DM21].
Data Processing Instructions
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.S EXT.S ADD.L STA.L LD CR2002
LDA.S DM0
CON
EXT.S
CON
ADD.L DM10
CON
STA.L DM20
The unsigned 32-bit BIN data currently stored in data memories [DM0/DM1] is extended to 64-bit
unsigned BIN data, and divided by the unsigned 32-bit BIN data currently stored in [DM10/DM11]. The
quotient is stored to [DM20/DM21] and the remainder is stored to [DM22/DM23].
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.D EXT.D DIV.D STA.D LD CR2002
MPS
TM2 DM22 LDA.D DM0
LDA.D STA.D CON
EXT.D
CON
DIV.D DM10
CON
STA.D DM20
MPP
LDA.D TM2
CON
STA.D DM22
The signed 32-bit BIN data currently stored in data memory [DM0/DM1] is extended to 64-bit data, and
the signed 32-bit BIN data currently stored in [DM10/DM11] is added. The quotient is stored to [DM20/
DM21] and the remainder is stored to [DM22/DM23].
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.L EXT.L DIV.L STA.L LD CR2002
MPS
TM2 DM22 LDA.L DM0
LDA.L STA.L CON
EXT.L
CON
DIV.L DM10
CON
STA.L DM20
MPP
LDA.L TM2
CON
STA.L DM22
MEMO
EXTENDED INSTRUCTIONS
5
BCMP(.U)
BCMP
BCMP.S
BCMP BCMP.D
BCMP.L Compare
data Compares the BIN data in
@BCMP(.U) between two specified ranges.
@BCMP.S BCMP blocks
@BCMP
EXTENDED INSTRUCTIONS
@BCMP.D
@BCMP.L
5
D @ B C M P S1 S2 D n
n
.U .S 16 bits x n
S1 Specifies the start of the data block to compare.
.D .L 32 bits x n
.U .S 16 bits x n
S2 Specifies the start of the data block to compare.
.D .L 32 bits x n
D Specifies the start to store the comparison result.* 1 n bits
n Specifies the number of data to compare. 16 bits
*1 When bit data is specified, n continuous bits are occupied. When word data is specified, the
LSB of continuous n words becomes the result storage location. Bits other than LSB do not
change.
Description of Operation
BCMP(.U) When the execution condition is ON, n unsigned 16-bit BIN data starting from S1
and unsigned 16-bit BIN data starting from are compared, and the result is
EXTENDED INSTRUCTIONS
n S2
stored to the bit data starting from D .
bit
15
bit
0
When bit
15
bit
0
Result
S1 1234 S2 1234 D ON
S1 +1 5678 S2 +1 5678 D +1 ON
S1 +2 0 S2 +2 1000 D +2 OFF
n
…
…
( n word)
S1 + n −2 4567 S2 + n −2 5678 D + n −2 OFF
S1 + n −1 7890 S2 + n −1 7890 D + n −1 ON
CR2010 : OFF
5
BCMP.S When the execution condition is ON, n signed 16-bit BIN data starting from S1
S1 +1 5678 S2 +1 5678 D +1 ON
S1 +2 0 S2 +2 1000 D +2 OFF
n
…
…
( n word)
S1 + n −2 4567 S2 + n −2 5678 D + n −2 OFF
S1 + n −1 −7890 S2 + n −1 −7890 D + n −1 ON
CR2010 : OFF
BCMP.D When the execution condition is ON, n unsigned 32-bit BIN data starting from S1
and n unsigned 32-bit BIN data starting from S2 are compared, and the result is
stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When bit
31
bit bit
16 15
bit
0
Result
S1 +1 12345678 S1 S2 +1 12345678 S2 D ON
S1 +3 56780123 S1 +2 S2 +3 56780123 S2 +2 D +1 ON
(2 n word)
S1 +2( n −2)+1 45670123 S1 +2( n −2) S2 +2( n −2)+1 56780123 S2 +2( n −2) D + n −2 OFF
S1 +2( n −1)+1 78903456 S1 +2( n −1) S2 +2( n −1)+1 78903456 S2 +2( n −1) D + n −1 ON
CR2010 : OFF
BCMP.L When the execution condition is ON, n signed 32-bit BIN data starting from S1
and n signed 32-bit BIN data starting from S2 are compared, and the result is
stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When bit
31
bit bit
16 15
bit
0
Result
S1 +1 −12345678 S1 S2 +1 −12345678 S2 D ON
S1 +3 −56780123 S1 +2 S2 +3 −56780123 S2 +2 D +1 ON
(2 n word)
S1 +2( n −2)+1 45670123 S1 +2( n −2) S2 +2( n −2)+1 56780123 S2 +2( n −2) D + n −2 OFF
S1 +2( n −1)+1 78903456 S1 +2( n −1) S2 +2( n −1)+1 78903456 S2 +2( n −1) D + n −1 ON
CR2010 : OFF
@BCMP.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
The value currently stored to data memories DM0 to DM2 and the value currently stored to data
memories DM100 to DM102 are each compared.
When all three match, output relay R500 turns ON.
When DM0 and DM100 match, output relay R501 turns ON.
When DM1 and DM101 match, output relay R502 turns ON.
When DM2 and DM102 match, output relay R503 turns ON.
(Mnemonics list)
CR2002 BCMP
DM0 DM100 MR000 LD CR2002
BCMP DM0 DM100 MR000 #3
#3 LD CR2010
OUT R500
CR2010 R500 LD MR000
OUT R501
LD MR001
OUT R502
LD MR002
MR000 R501 OUT R503
MR001 R502
MR002 R503
MEMO
EXTENDED INSTRUCTIONS
5
BCMPI(.U)
BCMPI
BCMPI.S
BCMPI BCMPI.D
BCMPI.L
Compare Compares specified BIN
block value data with BIN data in a
@BCMPI(.U) data specified range.
BCMPI
@BCMPI.S
@BCMPI
EXTENDED INSTRUCTIONS
@BCMPI.D
@BCMPI.L
5 n
.U .S 16 bits x n
S1 Specifies the start of the data block to compare.
.D .L 32 bits x n
.U .S 16 bits
S2 Specifies the value to compare.
.D .L 32 bits
D Specifies the start to store the comparison result.* 1 n bits
n Specifies the number of data to compare. 16 bits
*1 When bit data is specified, n continuous bits are occupied. When word data is specified, the
LSB of continuous n words becomes the result storage location. Bits other than LSB do not
change.
Description of Operation
BCMPI(.U) When the execution condition is ON, n unsigned 16-bit BIN data starting from S1
and the unsigned 16-bit BIN data stored in are compared, and the result is stored
EXTENDED INSTRUCTIONS
S2
to the bit data starting from D .
bit
15
bit
0
When Result
S1 1234 D ON
S1 +1 5678 D +1 OFF
bit bit
15 0
S1 +2 0 D +2 OFF
n S2 1234
…
…
( n )word
S1 + n −2 1234 D + n −2 ON
S1 + n −1 7890 D + n −1 OFF
CR2010 : OFF
5
BCMPI.S When the execution condition is ON, n signed 16-bit BIN data starting from S1
S1 +1 −5678 D +1 OFF
bit bit
15 0
S1 +2 0 D +2 OFF
n S2 −1234
…
( n )word …
S1 + n −2 −1234 D + n −2 ON
S1 + n −1 7890 D + n −1 OFF
CR2010 : OFF
BCMPI.D When the execution condition is ON, n unsigned 32-bit BIN data starting from S1
and the unsigned 32-bit BIN data stored in [ S2 / S2 +1] are compared, and the result
is stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When Result
S1 +1 12345678 S1 D ON
S1 +3 56780123 S1 +2 D +1 OFF
bit bit bit bit
31 16 15 0
S1 +5 10002000 S1 +4 D +2 OFF
n S2 +1 12345678 S2
…
(2 n word)
S1 +2( n −2)+1 12345678 S1 +2( n −2) D + n −2 ON
S1 +2( n −1)+1 78903456 S1 +2( n −1) D + n −1 OFF
CR2010 : OFF
BCMPI.L When the execution condition is ON, n signed 32-bit BIN data starting from S1
and the signed 32-bit BIN data stored in [ S2 / S2 +1] are compared, and the result is
stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When Result
S1 +1 −12345678 S1 D ON
S1 +3 −56780123 S1 +2 D +1 OFF
bit bit bit bit
31 16 15 0
S1 +5 10002000 S1 +4 D +2 OFF
n S2 +1 −12345678 S2
…
(2 n word)
S1 +2( n −2)+1 45670123 S1 +2( n −2) D + n −2 OFF
S1 +2( n −1)+1 78903456 S1 +2( n −1) D + n −1 OFF
CR2010 : OFF
@BCMPI.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
EXTENDED INSTRUCTIONS
5 to S1 , S2 and D
"Out-of-range access of operands", page 1-50
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
The value currently stored to data memories DM0 to DM2 and the value currently stored to data
memory DM100 are each compared.
EXTENDED INSTRUCTIONS
When all three match, output relay R500 turns ON.
When DM0 and DM100 match, output relay R501 turns ON.
When DM1 and DM100 match, output relay R502 turns ON.
When DM2 and DM100 match, output relay R503 turns ON.
(Mnemonics list)
CR2002 BCMPI
DM0 DM100 MR000 LD CR2002
BCMPI DM0 DM100 MR000 #3
#3 LD CR2010
OUT R500
5
CR2010 R500 LD MR000
OUT R501
LD MR001
OUT R502
MR001 R502
MR002 R503
BBCMP BBCMP
Continuous bit Compares 2 continuous bit
data comparison data.
@BBCMP BBCMP
5
D Specifies the start of the storage location for comparison results.*1 1 bit
Point The BBCMP instruction can be used only with KV-8000 with CPU function version
2.0 or later.
Description of Operation
BBCMP When the execution condition is ON, the content of n bits starting from S1 is
compared with the content of n bits starting from S2 . If all bits of n match,
D is turned ON.
Even if only one bit is different, D is turned OFF.
n bits
+0 +1 +2 … + n -2 + n -1
D turns ON as all bit
S1 ON OFF OFF … ON OFF data matches.
S2 ON OFF OFF … ON OFF
Operation flag
Sample Program
The contents of two structure type variables Axis1 and Axis2 are compared. If all members match,
MR100 is turned ON; otherwise MR101 is turned OFF (Axis1 and Axis2 are the same structure type
EXTENDED INSTRUCTIONS
variable).
(Mnemonics list)
R000 BSIZE
↑ Axis1 SizeOfBit_A LDP MR000
BSIZE Axis1 SizeOfBit_A
MPS
BSIZE BSIZE Axis2 SizeOfBit_B
Axis2 SizeOfBit_B MPP
AND= SizeOfBit_A SizeOfBit_B
BBCMP Axis1 Axis2 SizeOfBit_A CmpResult
SizeOfBit_A BBCMP MPS
= Axis1 Axis2 SizeOfBit_A CmpResult AND CmpResult
5
SizeOfBit_B OUT MR100
MPP
CmpResult MR100 ANB CmpResult
OUT MR101
RND
RND
D Random
number Generate a random number.
@RND
RND occur
D
Description of Operation
5 RND When the execution condition is ON, a random number is generated from the value stored
Data Processing Instructions
@RND In the rising edge of the execution condition, random numbers occur only in one-time
scanning.
Reference When the "M series" are used in the algorithm where the random number occurs, periodic
values can be generated.
Operation flag
* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Sample Program
Random numbers occur at the rising edge of Input Relay R000. When Input Relay R001 is ON, the
random number is initialized.
EXTENDED INSTRUCTIONS
(Mnemonics list)
R000 RND
↑ DM0 LDP R000
RND DM0
Random number generation Random number LD R001
MOV #0 DM0
R001 ΜΟV
#0 DM0
Reset Random number
SORT(.U)
SORT.S
SORT SORT.D
SORT.L
SORT
SORT
@ SORT.D
@ SORT.L
5 Operand
S
Explanation
Specifies the sort parameter.*1
Occupied size
16 bits
.U .S 16 bits x
Data Processing Instructions
n
D Specifies the start of the data table to be sorted.
.D .L 32 bits x n
n Specifies the data to be sorted. (1 to 65535) 16 bits
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
Description of Operation
SORT(.U)/SORT.S
When the execution condition is ON, 16-bit BIN data from are sorted
EXTENDED INSTRUCTIONS
n D
according to the parameter specified with S .
Example When S =0
After SORT instruction execution
Before SORT instruction execution (sorted in ascending order)
bit bit bit bit
15 0 15 0
D 123 3 D
D +1 15 15 D +1
D +2 84 21 D +2
3
1398
84
123
5
SORT.D/SORT.L
When the execution condition is ON, n 32-bit BIN data from D are sorted
according to the parameter specified with S .
After SORT
Example When S =1 instruction execution
Before SORT (sorted in
bit bit bit bit
31 instruction execution 0 31 descending order) 0
D ・ D +1 12345 6665321 D ・ D +1
D +2・ D +3 2165 619987 D +2・ D +3
D +4・ D +5 8004 78261 D +4・ D +5
31 12345
619987 8004
6665321 2165
D +2(n-1)・ D +2(n-1)+1 78261 31 D +2(n-1)・ D +2(n-1)+1
@SORT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Point The SORT instruction sorts all data when the instruction is execution. Therefore, if
a large value is specified in n , the scan time may increase significantly.
If the effect onto the scan time needs to be adjusted, divide the data to be sorted
into several scans using the SORTN instruction.
"SORTN Instruction", page 5-62
Operation flag
5 KV-8000/7500/7300/5500/5000/3000
KV Nano Series
When CR2012 is ON, error details are stored in CM5150 to CM5176.
When CR2012 is ON, error details are stored in CM2250 to CM2276.
Data Processing Instructions
Sample Program
When the input relay R000 is ON, the unsigned 16-bit binary data in data memory DM0 to DM99 (100
words) is sorted in ascending order.
(Mnemonics list)
R000 SORT LD R000
#0 DM0 #100 SORT #0 DM0 #100
When the input relay R000 is ON, the signed 32-bit binary data in data memory DM100 to DM149 (data
size: 25=50 words) is sorted in descending order.
(Mnemonics list)
R000 SORT.L LD R000
#1 DM100 #25 SORT.L #1 DM100 #25
MEMO
EXTENDED INSTRUCTIONS
5
SORTN(.U)
SORTN.S Binary data
SORTN SORTN The data in a specified
SORTN.D partition
range is sorted.
SORTN.L sort
5 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Data Processing Instructions
Devices Content
S Sorting method Specifies the sorting method with the LSB of S .
Number of Specifies the number of comparisons to be made in one
S +1 comparison scan.
times If 0 is specified, the comparison is executed as 1.
bit bit
15 S 0
*2 When bit data is specified, 1 continuous bit is occupied. When word data is specified, the LSB is
used as the notification bit data. Bits other than LSB do not change.
Description of Operation
SORTN(.U)/SORTN.S
When the execution condition is ON, 16-bit BIN data from are sorted
EXTENDED INSTRUCTIONS
n D1
according to the parameter specified with S . When sorting is completed, an end
notification is written in D2 .
When the execution conditions turn OFF, the SORTN instruction operation stops even if
sorting is in progress. The end notification is not written to D2 at this time.
D1
D1 +1
123
15
1
3
D1
D1 +1
5
84 15
SORTN.D/SORTN.L
When the execution condition is ON, n 32-bit BIN data from D are sorted
according to the parameter specified with S . When sorting is completed, an end
notification is written in D2 .
EXTENDED INSTRUCTIONS
When the execution conditions turn OFF, the SORTN instruction operation stops even if
sorting is in progress. The end notification is not written to D2 at this time.
Scan
ON
SORTN execution
condition OFF
5
SORTN instruction execution execution
ON
Data Processing Instructions
D2 :
Completion OFF
notice relay
Point • If executing sort with multiple scans, the SORTN instruction will be canceled
when the execution conditions turn OFF. In this case, even if the execution
conditions are turned ON again, sorting will start from be beginning.
• When starting the next sort in succession after one sorting process, turn the
execution conditions OFF once before turning them ON again.
• Do not change the values of the data table being sorted, S , S +1 or
D1 during the sorting process. Sorting may not finish even when the
completion notification relay D2 turns ON.
Operation flag
Sample Program
When the internal relay MR000 is ON, the unsigned 16-bit binary data in data memory DM0 to DM999
(1000 words) is sorted in ascending order. 20 comparisons are made in one scan.
EXTENDED INSTRUCTIONS
#0 #20 MR100 (Mnemonics list)
MR000 MR200
DW DW LDP MR000
DM2000 DM2001 OR MR100
MR100 ANB MR200
DW #0 DM2000
CON
DW #20 DM2001
CON
MR100 SORTN OUT MR100
DM2000 DM0 #1000 MR200 LD MR100
SORTN DM2000 DM0 #1000 MR200
When the input relay R000 turns ON, the signed 32-bit binary data in data memory DM0 to DM1999 5
(number of data items: 1000 = 2000 words) is sorted in descending order. 100 comparisons are made
FIFOW(.U)
FIFOW FIFOW.D
FIFOW
Description of Operation
D +2 A
D +n+1 C
Before executing this instruction, reset (store "0") the number of data (n) stored in D . Also, set the
maximum number of data items to " D +1".
As the start D of the data table, specify the same target as the start S of the data table of the
corresponding FIFOR instruction.
FIFOW(.U) When the execution condition is ON, 16-bit binary data specified by S is stored to the
end of the data block.
• The data is stored to D +(n+2).
• n is incremented by 1 (+1) after storage.
EXTENDED INSTRUCTIONS
bit bit bit bit
15 0 15 0
n D n+1 D
max : D +1 max : D +1
A : D +2 A : D +2
n B : D +3 n+1 B : D +3
…
bit
15
S bit
0
C : D +(n+1) C : D +(n+1)
D +1 : n D
D +3 : max : D +2
D +5 : A : D +4
n D +7 : B : D +6
:
bit bit
31 0
D +1 : n+1 D
D +3 : max : D +2
D +5 : A : D +4
D +7 : B : D +6
n+1 :
D +(2n+3) : C : D +(2n+2)
D +(2n+5) : D : D +(2n+4)
@FIFOW.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions
Sample Program
See the sample program for the FIFOR instruction.
"Sample Program", page 5-72
MEMO
EXTENDED INSTRUCTIONS
5
FIFOR(.U)
FIFOR FIFOR.D
FIFOR
Read
Reads data from FIFO
(First In First Out) data
@FIFOR(.U) FIFO
table.
@FIFOR
FIFOR
@FIFOR.D
EXTENDED INSTRUCTIONS
5 D2
Specifies the storage location for the data read from the data .U 16 bits
block. .D 32 bits
Table Processing Instructions
Description of Operation
D1 +2 A
D1 +3 B Data block:
store data processed by FIFO
A is the data stored at first while C is the last .
…
D1 +n+1 C
As the start D1 of the data table, specify the same target as the start D2 of the data table of the
corresponding FIFOR instruction.
FIFOR(.U) (1)When the execution condition is ON, the 16-bit binary data stored in D1 +2 is stored
to D2 .
(2) The contents of the data block after the data is stored are shifted up.
n is decremented by one (-1) after the data is shifted.
EXTENDED INSTRUCTIONS
bit bit bit bit
15 0 15 0
D1 n D1 n-1
D1 +1 max bit
15
D2 bit
0
D1 +1 max bit
15
D2 bit
0
D1 +2 A D1 +2 B A
D1 +3 B D1 +3 C
…
D1 +4 C
: D1 +n E
D1 +n+1 E
FIFOR.D (1)When the execution condition is ON, the 32-bit binary data stored in [ D1 +4/
D1 +5] is stored to [ D2 / D2 +1].
5
D1 +1 : n : D1
D1 +3 max : D1 +2 bit
31
D2 +1 D2 bit
0
D1 +5 : A : D1 +4
D1 +7 : B : D1 +6
D1 +9 : C : D1 +8
…
D1 +(2n+1) : D : D1 +(2n)
D1 +(2n+3) : E : D1 +(2n+2)
(2) The contents of the data block after the data is stored are shifted up.
n is decremented by one (-1) after the data is shifted.
bit bit
31 0
D1 +1 : n-1 : D1
D1 +3 max : D1 +2 bit
31
D2 +1 D2 bit
0
D1 +5 : B : D1 +4 A
D1 +7 : C : D1 +6
…
D1 +(2n+1) : E : D1 +(2n)
Filled with 0
@FIFOR.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions
Sample Program
Detection Discharging
technics technics
When input relay R000 (timing input) is ON, $0 is written to the data table if the item is judged as non
defective, and $1111 is written to the data table if the item is judged as defective.
When input relay R002 (discharge confirmation input) is ON, output relay R500 turns ON for one
second if the item is judged as non-defective, and the item is discharged.
If 11 or more work pieces are fed from the inspection point to the discharge point, error is output
fromR501.
(Mnemonics list)
CR2008 #0 #10
DW DW LD CR2008
DM100 DM101 DW #0 DM100
CON
R000 R001 $0 DM0 FIFOW
DW #10 DM101
↑ LDA STA DM0 DM100
EXTENDED INSTRUCTIONS
LDP R000
MPS
R001 $1111 DM0 FIFOW AND R001
LDA STA DM0 DM100 LDA $0
CON
STA DM0
R000 CR2012 R501 CON
↑ SET FIFOW DM0 DM100
MPP
R002 FIFOR ANB R001
↑ DM100 DM1 LDA $1111
CON
DM1 #100 STA DM0
= SHOT CON
$1111 FIFOW DM0 DM100
5
R500
LDP R000
AND CR2012
SET R501
LDP R002
DM100 :
Data memory DM101 : 10 bit bit
$0000:OK
15 0
LIFOW(.U)
LIFOW LIFOW.D
LIFOW
Write
Stores the data to LIFO
(Last In First Out) data
@LIFOW(.U) LIFO
table.
@LIFOW
LIFOW
@LIFOW.D
EXTENDED INSTRUCTIONS
Description of Operation
D +2 A
D +n+1 C
Before executing this instruction, reset (store "0") the number of data (n) stored in D . Also, set the
maximum number of data items to " D +1".
As the start D of the data table, specify the same target as the start S of the data table of the
corresponding FIFOR instruction.
LIFOW(.U) When the execution condition is ON, 16-bit binary data specified by S is stored to the
end of the data block.
• The data is stored to D +(n+2).
• n is incremented by 1 (+1) after storage.
EXTENDED INSTRUCTIONS
bit bit bit bit
15 0 15 0
n D n+1 D
max : D +1 max : D +1
A : D +2 A : D +2
n B : D +3 n+1 B : D +3
…
bit
15
S bit
0
C : D +(n+1) C : D +(n+1)
D +1 : n D
D +3 : max : D +2
D +5 : A : D +4
n D +7 : B : D +6
:
bit bit
31 0
D +1 : n+1 D
D +3 : max : D +2
D +5 : A : D +4
D +7 : B : D +6
n+1 :
D +(2n+3) : C : D +(2n+2)
D +(2n+5) : D : D +(2n+4)
@LIFOW.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions
Sample Program
See the sample program for the LIFOR instruction.
"Sample Program", page 5-80
MEMO
EXTENDED INSTRUCTIONS
5
LIFOR(.U)
LIFOR LIFOR.D
LIFOR
Read
Reads data from LIFO
(Last In First Out) data
@LIFOR(.U) LIFO table.
@LIFOR
LIFOR
@LIFOR.D
EXTENDED INSTRUCTIONS
5 D2
Specifies the storage location for the data read from the data .U 16 bits
block. .D 32 bits
Table Processing Instructions
Description of Operation
About data table and data block
The LIFOW and LIFOR instructions perform LIFO (Last In First Out) process using a set of data called
a "data table." The figure below shows the structure of a data table.
bit bit
15 0
D1 +2 A
D1 +n+1 C
As the start D1 of the data table, specify the same target as the start D2 of the data table of the
corresponding LIFOW instruction.
LIFOR(.U) (1)When the execution condition is ON, the 16-bit binary data stored in D1 +n+1 is
stored to D2 .
(2)After the data is stored, n is decremented by one (-1).
bit bit bit bit
EXTENDED INSTRUCTIONS
15 0 15 0
D1 n D1 n-1
D1 +1 max D1 +1 max
D1 +2 A D1 +2 A
D1 +3 B D1 +3 B
…
:
D1 +n C bit
15
D2 bit
0
D1 +n C bit
15
D2 bit
0
Filled with 0
LIFOR.D (1)When the execution condition is ON, the 32-bit binary data stored in [ D1 +(2n+2)/
D1 +(2n+3)] is stored to [ D2 / D2 +1].
5
D1 +1 : n : D1
D1 +3 max : D1 +2
D1 +5 : A : D1 +4
D1 +7 : B : D1 +6
…
D1 +(2n+3) : D : D1 +(2n+2)
D1 +1 : n-1 : D1
D1 +3 max : D1 +2
D1 +5 : A : D1 +4
D1 +7 : B : D1 +6
…
Filled with 0
@LIFOR.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions
Sample Program
When operation is started, an all clear is performed on the data of the LIFO data table, and the
maximum number of stored data (#5) is set.
When input relay R000 has turned ON, the data of data memory DM0 is stored to the data block at the
end of the LIFO data table.
When input relay R001 has turned ON or when the maximum number of stored data has been
exceeded, the data block at the end of the LIFO data table is stored to data memory DM1.
(Mnemonics list)
CR2008 #0 #5
DW DW LD CR2008
DM100 DM101 DW #0 DM100
CON
R000 LIFOW
DW #5 DM101
↑ DM0 DM100
LDP R000
LIFOW DM0 DM100
R001 LIFOR LDP R001
↑ DM100 DM1 LDP R000
AND CR2012
ORL
R000 CR2012 LIFOR DM100 DM1
↑
DM0 : 77 DM1 : 77
MEMO
EXTENDED INSTRUCTIONS
5
FWRIT(.U)
FWRIT FWRIT.D
FWRIT
Description of Operation
FWRIT(.U) When the execution condition is ON, the 16-bit binary data specified by S is
overwritten to the n th data block in the data table for the 16-bit binary data specified
by D .
bit
15
S bit
0
bit
15
bit
0
bit
15
bit
0
E Number of data N : D N : D
Max number of storage data max : D +1 max : D +1
1 st A : D +2 A : D +2
Data table
2 nd B : D +3 B : D +3
…
Data block
(store data) n th C E
…
FWRIT.D When the execution condition is ON, the 32-bit binary data specified by [ S / S +1]
is overwritten to the n th data block in the data table for the 32-bit binary data
specified by D .
bit
31
S +1 S bit
0
Number of data D +1 N D D +1 N D
Max number of storage data D +3 max D +2 D +3 max D +2
1 st D +5 A D +4 D +5 A D +4
Data table
2 nd D +7 B D +6 D +7 B D +6
(store data)
Data block
@FWRIT.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the value of n is "0" or greater than number of data (N)
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data exceeds the device / work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Sample Program
When input relay R000 is turned ON, the data of data memory DM0 is overwritten to the second data
block in the FIFO/LIFO data table.
(Mnemonics list)
R000 FWRIT
DM0 DM100 #2 LD R000
FWRIT DM0 DM100 #2
FINS(.U)
FINS FINS.D
FINS
Description of Operation
FINS(.U) When the execution condition is ON, the 16-bit binary data specified by S is inserted
between the n th and ( n +1)th data blocks in the data table specified by D .
bit
15
S bit
0
bit
15
bit
0
bit
15
bit
0
2 nd B : D +3 B : D +3
…
Data block
(store data) n th C C
…
E
…
N th D : D +N+1
D : D +(N+1)+1
FINS.D When the execution condition is ON, the 32-bit binary data specified by [ S / S +1]
is inserted between the n th and ( n +1)th data blocks in the data table specified
by D .
bit
31
S +1 S bit
0
2 nd D +7 B D +6 D +7 B D +6
(store data)
Data block
D +(2n+5) E D +(2n+4)
…
N th D +(2N+3) D D +(2N+2)
D +(2N+5) D D +(2N+4)
@FINS.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the value of n is greater than number of data (N)
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data exceeds the device / work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Sample Program
When input relay R000 is turned ON, the data of data memory DM0 is inserted between the second
and third data blocks in the FIFO/LIFO data table.
(Mnemonics list)
R000 FINS
DM0 DM100 #2 LD R000
FINS DM0 DM100 #2
36841 :DM105
FDEL(.U)
FDEL FDEL.D
FDEL
Delete
Deletes a data block from
from data
@FDEL(.U) the data table.
table
@FDEL
FDEL
@FDEL.D
EXTENDED INSTRUCTIONS
Description of Operation
FDEL(.U) When the execution condition is ON, the n th data block in the data table for 16-bit
binary data specified by D is deleted.
bit bit bit bit
15 0 15 0
2 nd B : D +3 B : D +3
…
Data block
(store data) n th C D : D +N
…
0 : D +N+1
N th D : D +N+1 Filled with 0.
FDEL.D When the execution condition is ON, the n th data block in the data table for 32-bit
binary data specified by [ D / D +1] is deleted.
bit bit bit bit
31 0 31 0
2 nd D +7 B D +6 D +7 B D +6
(store data)
Data block
D +(2N+3) 0 D +(2N+2)
N th D +(2N+3) D D +(2N+2) Filled with 0
@FDEL.□ This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the value of n is "0" or greater than number of data (N)
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data exceeds the device / work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
5
* The contact turns OFF when CR2012 is ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Sample Program
When input relay R000 is ON, the second data block in the FIFO/LIFO data table is deleted.
(Mnemonics list)
R000 FDEL
DM100 #2 LD R000
FDEL DM100 #2
WTIME WTIME
Write time
Writes the time data to the
calendar timer.
@WTIME WTIME
Execution condition S
WTIME W T I M E S
Execution condition S
WTIME @ W T I M E S
Description of Operation
5 WTIME When the execution condition is ON, the time data 7 words (112 bits) starting from S
is written to the calendar timer.
Clock Processing Instructions
The calendar timer's time data is stored to control memories CM700 to CM706.
The following shows the format of the time data.
bit bit
15 0
S +1 : month 1∼12
S +2 : day 1∼31
S +4 minute 0∼59
S +5 : second 0∼59
week:0:(sunday) 1:(monday) 2:(tuesday) 3:(wednesday)
S +6 : week 0∼6 4:(Thursday) 5:(Firday) 6:(Saturday)
@WTIME This instruction is executed for one scan at the rising edge of the execution condition.
Point • The time data cannot be written directly to control memories CM700 to CM706. If
time data is written directly, the time will be overwritten by the system, and
written values will be invalidated.
• When the WTIME instruction is used, specify the time data in the correct format
(year/month/day/hour/minute/second).
The day of the week is not checked for the year, month, day, hour, minutes, and
seconds settings.
• The WTIME instruction cannot be used with KV-N14 □□ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
When the data to be written is inappropriate as time data, a timer / counter is specified indirectly
to S , the indirect specification or index modification range is inappropriate, and an access
CR2012
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
5
"CR/CM List", page A-43
Sample Program
SEC,RSEC
SEC
SEC
Date time →
Converts date/time format
Seconds
data to second format data.
@SEC
SEC conversion
RSEC RSEC
Converts second format
EXTENDED INSTRUCTIONS
Seconds → Date/
data to date/time format
time conversion
@RSEC RSEC data.
Description of Operation
SEC When the execution condition is ON, the six words (96 bits) of date/time data starting from
S is converted to seconds, and is stored to the two words (unsigned 32-bit BIN data)
starting from D .
Data is converted referenced to "year 2000, January 1st, 0:0:0.
bit
15
bit
0
bit
31
D +1 bit bit
16 15
D bit
0
S +4 : minute 0∼59
S +5 : second 0∼59
RSEC When the execution condition is ON, the two words (unsigned 32-bit BIN data) of second
data starting from S is converted to date/time data, and is stored to the six words (96
bits) starting from D .
Data is converted referenced to "year 2000, January 1st, 0:0:0.
EXTENDED INSTRUCTIONS
bit
31
S +1 bit bit
16 15
S bit
0
bit
15
bit
0
@SEC/@RSEC This instruction is executed for one scan at the rising edge of the execution condition.
Operation flag 5
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 date of production.
The result is stored to DM100 and subsequent memories.
CR2002
(Mnemonics list)
SEC
CM700 DM0 LD CR2002
SEC CM700 DM0
DM0 #2592000 DM10 MPS
LDA.D ADD.D STA.D LDA.D DM0
CON
RSEC ADD.D #2592000
DM10 DM100 CON
STA.D DM10
MPP
bit
15
bit
0
RSEC DM10 DM100
CM700 : 10 10 DM100 : 11 11
CM701 : 12 12 DM101 : 01 01
CM702 : 20 20 DM102 : 19 19
CM704 : 10 10 DM104 : 10 10
CM705 : 10 10 DM105 : 10 10
AJST AJST
Adjust
Adjusts the calendar timer
by±30 seconds.
@AJST AJST
Execution condition
AJST A J S T
Execution condition
AJST @ A J S T
Description of Operation
AJST When the execution condition is ON, the "seconds" setting is set to "0" when the
5
"seconds"setting of the current time of the built-in calendar time is 0 to 29. When the
"seconds"setting is 30 to 59 seconds, the "minutes" setting is rounded up and is set to "0".
The calendar timer's time data is stored to control memories CM700 to CM706.
Clock Processing Instructions
@AJST This instruction is executed for one scan at the rising edge of the execution condition.
Point The AJST instruction cannot be used with KV-N14 □ □ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate.
Operation flag
Sample Program
The calendar timer is adjusted by ±30 seconds at the leading edge of input relay R000.
(Mnemonics list)
R000
AJST LDP R000
AJST
MEMO
EXTENDED INSTRUCTIONS
5
LDWK
second range
ANDWKB
Turns OFF in the specified day
of week / hour / minute /
Load week
second range
ORWK
WK Turns ON in the specified day
of week / hour / minute /
second range
ORWKB
Turns OFF in the specified day
ANDWK
second range
5
S1 WK L D W K S1 S2
S2 WK L D W K B S1 S2
Weekly Contact Instructions
S1 WK A N D W K S1 S2
S2 WK A N D W K B S1 S2
WK O R W K S1 S2
S1
When WK, installation WK WK O R W K B S1 S2
fill Filled with
S2 When WKB, installation WK
Description of Operation
LDWK ANDWK ORWK
The instruction itself becomes a normally open contact. This contact turns ON from the
day of week/hour/minute/second specified by [ S1 / S1 +1] until the day of week/
hour/minute/second specified by [ S2 / S2 +1].
Point The above instructions cannot be used with KV-N14 □ □ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate. The contact operates as OFF.
EXTENDED INSTRUCTIONS
Enter character string Enter HEX
“Week/HH: MM: SS" $ (HH) (MM) (SS) (Week)
(Chinese) Sunday to Saturday
Input Form at
Day
of (Numeral) 0 to 6 (Numeral) $0 to $6
week (English) sun to sat
5
Weekday and time is separated with "/".
Note $
Hour/minute/second is separated with ":".
When entering Monday 08: 30: 15 When entering Monday 08: 30: 15
■Format of S1 and S2
The day of the week and time can be set according to the following format.
Operand 1 S1 +1 S1
Operand 2 S2 +1 S2
Data configuration bit31 to bit24 bit23 to bit16 bit15 to bit8 bit7 to bit0
Content Hour Minute Second Day of week
0 to 59 (Second), 0 (Sunday) to 6
Setting 0 to 23 (Hour), FF*2 0 to 59 (Minute), FF*2
FF*2 (Saturday), FF*2
range*1 (24 or more invalid) (60 or more invalid)
(60 or more invalid) (7 or more invalid)
Example WK
“FRI/17:15:00”
17:15:00
08:30:00
Monday 00:00:00
08:30:00
Start Contact ON
Contact turns on between
Monday 08:30:00 to Friday 17:15:00.
The contact turns ON when the time data, hours/minutes/seconds/day of week (CM703 to
CM706) currently stored in the calendar timer is [ S1 / S1 +1] ≦ time data currently
stored in the calendar timer ≦ [ S2 / S2 +1].
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-95
Weekly Contact Instructions
ON.
[ S1 / S1 +1]=[ S2 / S2 +1] Only the start day of the week time turns ON.
[ S1 / S1 +1]>[ S2 / S2 +1] From the start day of the week time until the end day of the week
time turns ON across two weeks.
Example 1. Start: Monday 08:30:00 End: Wednesday 07:30:00 ON between Monday 08:30:00 and Wednesday 07:30:00.
Example 2. Start: Sunday 10:00:00 End: Sunday 10:00:00 ON at Sunday 10:00:00 only (for approx. 1 second)
Example 3. Start: Saturday 08:15:00 End: Monday 08:30:00 ON between Saturday 08:15:00 to Monday 08:30:00
5 FF can be used in a special meaning when the day of the week, hours, minutes, and seconds are
specified.
Weekly Contact Instructions
( = MON/23:00:00 to THU/17:59:59)
( = MON/00:00:00 to FRI/23:59:59)
The start hour/minute/second specified by FF is regarded as 00:00:00 as the
minimum time, and as 23:59:59 as the maximum time.
■Types of FF specification
Only the following six FF types can be specified.
S1 S2 Explanation
FF/□:□:□ FF/□:□:□ Specifies the day of the week by FF.
FF/FF:□:□ FF/FF:□:□ Specifies the day of the week and hour by FF.
FF/FF:FF:□ FF/FF:FF:□ Specifies the day of the week, hour and minute by FF.
□/□:□:FF □/□:□:FF Specifies seconds by FF.
□/□:FF:FF □/□:FF:FF Specifies minutes and seconds by FF.
□/FF:FF:FF □/FF:FF:FF Specifies hour, minute and seconds by FF.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when the day of week/hours/minutes/seconds setting specified by S1 and S2 is
incorrect, the indirect specification or index modification range is inappropriate, and an access
CR2012
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
5
"CR/CM List", page A-43
Sample Program
Output relay R500 is turned ON between 8:30:00 to 17:15:00 on Monday to Friday excluding December
31 to January 3 every year.
Output relay R500 is continuously turned ON between 8:30:00 on Monday and 17:15:00 on Friday for
start data memory DM101/DM100 ($81E/$1) and end data memory DM103/DM102 ($110F/$5).
DM100 R500 (Mnemonics list)
WK LDWK DM100 DM102
DM102 OUT R500
ANDCALTurns ON in the
LDCAL,ANDCAL,ORCAL,LDCALB,ANDCALB,ORCALB specified year / month / day
range
ANDCALBTurns OFF in the
specified year / month / day
LDCAL
range
ORCALTurns ON in the
specified year / month / day
range
Load calendar
ORCALBTurns OFF in the
specified year / month / day
CAL range
ORCAL CAL
OR calendar
EXTENDED INSTRUCTIONS
ORCALB CAL
AND calendar bar
CAL S1 S2
5
S1 L D C A L
S2 CAL L D C A L B S1 S2
Calendar Contact Instructions
S1 CAL A N D C A L S1 S2
S2 CAL A N D C A L B S1 S2
CAL O R C A L S1 S2
S1
When CAL, installation CAL CAL O R C A L B S1 S2
fill Filled with
S2 When CALb, installation CAL
Description of Operation
LDCAL ANDCAL ORCAL
The instruction itself becomes a normally open contact. This contact turns ON from the
year/month/day specified by [ S1 / S1 +1] until the year/month/day specified by
[ S2 / S2 +1].
LDCALB ANDCALB ORCALB
The instruction itself becomes a normally closed contact. This contact turns OFF from the
year/month/day specified by [ S1 / S1 +1] until the year/month/day specified by
[ S2 / S2 +1].
Point The above instructions cannot be used with KV-N14 □ □ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate. The contact operates as OFF.
EXTENDED INSTRUCTIONS
Enter character string Enter HEX
"YY / MM / DD " $ (YY) (MM) (DD)
Input Format
When entering Oct 16, 2004 When entering Oct 16, 2004
Example
" 04 / 10 / 16 " $40A10
■Format of S1 and S2 5
Operand 1 S1 +1 S1
Operand 2 S2 +1 S2
Data
bit31 to bit24 bit23 to bit16 bit15 to bit8 bit7 to bit0
configuration
Content Reserved Year Month Day
00 to 99 (year), FF
Setting 01 to 12 (month), FF 01 to 31 (day), FF
- (Enter 00H) (100 or more invalid*1
range*2 (13 or more invalid) (32 or more invalid)
)
Example "08/02/16"
CAL
"12/10/28"
Year 2012
October 28 2007 2008 2009 2010 2011 2012 2013
End
October 28
February 16
Year 2008
February 16
Start Contact ON
Contact turns ON during February 16, 2008 and October 2
The contact turns ON when the calendar data, year/month/day (CM700 to CM702)
currently stored in the calendar timer is
[ S1 / S1 +1] ≦ calendar data currently stored in the calendar timer ≦
[ S2 / S2 +1].
[ S1 / S1 +1]=[ S2 / S2 +1] Only the start day of the week time turns ON.
Turns ON during January 1, 2000 to end year/month/day, and
[ S1 / S1 +1]>[ S2 / S2 +1]
from start year/month/day to December 31, 2099.
Example.1 Start: 2004, August 26 End: 2004, December 1 Turns ON between 2004, August 26 to 2004, December 1.
Example.2 Start: 2004, August 26 End: 2004, August 26 Turns ON only on 2004, August 26. (for one day)
Example 3 Start: 2004, December 1 End: 2004, August 26 Turns ON between 2000, January 1 to 2004, August 26,
and 2004, December 1 to 2099, December 31.
Point Do not set non-existent dates (e.g. April 31, 2004) in the calendar as year/month/
FF can be used in a special meaning when the year, month, and day are specified.
1. The item (year/month/day) value can be omitted.
Example
ON during 2012 January to 2014 February 12/01/FF to 14/02/FF
(=12/01/01 to 14/02/29)
ON during 2012 12/ FF/FF to 12/FF/FF
(=12/01/01 to 12/12/31)
ON until 2012, February 16 FF/FF/FF to 12/02/16
(=00/01/01 to 12/02/16)
ON from 2010, March 14 and onwards 10/03/14 to FF/FF/FF
(=10/03/14 to 99/12/31)
■Types of FF specification
Only the following six FF types can be specified.
S1 S2 Explanation
FF/□/□ FF/□/□ Specifies the year by FF.
FF/FF/□ FF/FF/□ Specifies the year and month by FF.
□/□/FF □/□/FF Specifies the day by FF.
□/FF/FF □/FF/FF Specifies the month and day by FF.
FF/FF/FF □/□/□ Specifies all items in S1 by FF.
□/□/□ FF/FF/FF Specifies all items in S2 by FF.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when the year/month/day setting specified by S1 and S2 is incorrect, the indirect
specification or index modification range is inappropriate, and an access outside the operand
CR2012
range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
5
"CR/CM List", page A-43
Sample Program
Output relay R500 is turned ON between 8:30:00 to 17:15:00 on Monday to Friday excluding December
31 to January 3 every year.
Output relay R500 is continuously turned ON during 2010, December 31 to 2011, January 3 when start
data memory DM101/DM100 ($A/$C1F) and end data memory DM103/M102 ($B/$103).
ARES
Resets the currently operating alarm relay
ARES Alarm reset
and alarm history.
Description of Operation
Resets the currently operating alarm relay and alarm history. (CR3300 to CR3415)
For details on alarm relay and alarm history specification, refer to User's Manual of the CPU unit used.
Operation flag
MEMO
EXTENDED INSTRUCTIONS
5
Alarm Instruction
HSP
HSP High speed Reduces the time constant of the input
HSP relay to speed up input response.
Description of Operation
When the execution condition is ON, the input time constant of D is set to 10μs.
Be sure to set this instruction when using the INT and CTH instructions.
Point • When an input time constant setting using control relay CR2305 and an input time
constant using the HSP instruction are programmed together, the HSP instruction is
given priority.
• When the HSP instruction execution condition is OFF, the input time constant is
specified by CR2305.
• If a relay that the HSP instruction cannot use is specified, no error occurs and the
instruction is not executed.
(In the situation above, the KV Nano Series and KV STUDIO will not generate a
conversion error)
• For details on how to change the input time constant of the CPU unit, refer to "KV-5500/5000/
3000 Series User's Manual" "2-7 Input and Output", "KV-1000 User's Manual" "10-3 Input Time
Constant Switching Function" or "KV Nano Series User's Manual" "4-10 Input and Output".
• The input time constant of the Expansion Input Unit is set using the KV STUDIO's Unit Editor. For
details on how to change the input time constant, refer to "KV STUDIO User's Manual" "Chapter
3 UNIT EDITOR".
Operation flag
The operation flag does not change.
Sample Program
The input time constant of input relay R000 is set to 10μs.
(Mnemonics list)
CR2002 HSP
R000 LD CR2002
HSP R000
MEMO
EXTENDED INSTRUCTIONS
5
DI
Disable
DI Disables execution of interrupt programs.
interrupt
EI
Enable
EI Enables execution of interrupt programs.
interrupt
Execution condition
EI E I
Execution condition
DI D I
Description of Operation
DI When the execution condition is ON, execution of the interrupt program is disabled.
5
This instruction is used to temporarily disable interrupt.
EI When the execution condition is ON, execution of the interrupt program is enabled.
High-speed Processing Instruction
Operation flag
The operation flag does not change.
EXTENDED INSTRUCTIONS
Sample Program
When input relay R000 is ON, execution of the interrupt program is disabled.
When input relay R000 is OFF, execution of the interrupt program is enabled.
(Mnemonics list)
R000
DI LD R000
DI
R000 LDB R000
EI
EI
DIC
Interrupt disabled
DIC Sets the interrupt disabled range.
range
D
EI
Description of Operation
CR2002 D CR2002 D
DIC DIC
D D
EI EI
OFF ON
Status for interrupt forbidden Status for interrupt enabled
Output Input
Output Input process process
process process Interrupt forbidden range
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
RETI
RETI Indicates the end of the interrupt
Interrupt end
program.
EXTENDED INSTRUCTIONS
KV-8000 KV-7500/7300
Interrupt program
RETI
R E T I
( I R E T )
INT
S I N T S
( I S )
Interrupt program
RETI
R E T I
( I R E T )
Description of Operation
INT Specifies the start of the interrupt program.
RETI Specifies the end of the interrupt program.
EXTENDED INSTRUCTIONS
Point • Internal registers, index registers, operation flags, R000 to R015*, TM0 to TM3 are
automatically purged at the start of the interrupt program, and each of these purged
values are restored when execution of the interrupt program ends.
* R000 to R015 are not purged for the KV-8000/7000 Series.
• KV-8000/7500/7300/5500/5000/3000 The index register is saved / restored only by default
after Z11. You can set Z1 to Z10 to Save/Enter processing by clicking "CPU system
settings" → "Fixed period execution module and user interrupt setting".
• KV-1000 All the index registers (Z1 to Z12) are subject to Save/Enter processing. To use
an index register used in master program also in the interrupt program, please copy the 5
index register to other data using ZPUSH/ZPOP or MOV instruction.
Operation flag
Scan
Sample Program
KV-8000/7500/7300
EXTENDED INSTRUCTIONS
When using KV-8000/7500/7300, interrupt is executed at both the rising edge and falling edge of the
unit number 1 input (IN005), and the DM10 value is counted up.
(Mnemonics list)
CR2002 LD CR2002
EI EI
Constant ON
LD CR2008
CR2008 IEDGE KV-SIR32XT Detection
IEDGE #1 #5 #3
Unit No. Input No.
#1 #5 conditions #3 END
ON 1 scan INT #1 #5
KV-SIR32XT
at start of
operation END LD CR2002
INC DM10
RETI
5 INT
Unit No.
#1
KV-SIR32XT
Interrupt factor
R34005
#5
ENDH
DM10
High-speed Processing Instruction
CR2002
INC
constant ON
RETI
ENDH
ENDH
MEMO
EXTENDED INSTRUCTIONS
5
interrupt s
Sets detection conditions used for d
detection
interrupt.
@IEDGE
e
IEDGE
conditions t
write e
EXTENDED INSTRUCTIONS
*1 Only constants can be specified for KV-7500/7300 with CPU function version lower than 2.1.
*2 When specifying bit data, specify the start of the channel.
High-speed Processing Instruction
Description of Operation
IEDGE When the execution condition is ON, 1 word of data specified in S is set as the
interrupt detection condition of the n2 factor of the n1 unit.
EXTENDED INSTRUCTIONS
The detection conditions are as follows according to the value of S .
S Detection condition
0 to 1 Rising edge
2 Falling edge
3 Both rising and falling
edges
Point • When 4 to 65535 is specified in S , no calculation error occurs, but the detection
conditions will not be changed.
• When this instruction is complete, the above detection condition setting is changed.
5
Operation flag
Sample Program
Refer to the "INT instruction" (Page 5-110)
5 Input process
High-speed Processing Instruction
Input process
Occur for
Scan time
interrupt condition
Operate Operation
program interrupt
program
Output process
MEMO
EXTENDED INSTRUCTIONS
5
PID
PID
PAUSE
MANUAL PID Control Performs PID control.
RES
PAUSE P I D D1 D2
MANUAL Input D1
MANUAL
RES Input D2
RES
Description of Operation
• The manipulated variable (MV) (PID operation by KP: proportional constant, KI: integral constant, and
KD: differential constant) is calculated from the deviation between the setting value (SV) and the
measured value (PV) read by the specified sampling cycle (TS).
• The target object to measured by the calculated manipulated variable (MV) is manipulated, and the
measured value (PV) is read at the next cycle (TS). This operation is repeated, and the manipulated
variable (MV) is controlled until the measured value (PV) = setting value (SV).
• The work area is reset by RES input turning ON. PID operation is not performed while RES input is
ON.
Operation is started when the state of the RES input changes from ON to OFF.
• When MANUAL input turns ON, the mode changes to the manual operation mode, and when it turns
OFF, the mode changes to the automatic operation mode.
• While PAUSE input is ON, PID operation is discontinued, and when it turns OFF, PID operation is
resumed.
0 Time
EXTENDED INSTRUCTIONS
・Proportion constant (K P )
measured ・Integral constant (T I )
value Set value
・Differential constant (T D )
(PV ) (SV )
・Comparison constant 2 Degree of freedom
coefficient (α)
・Integral constant 2 Degree of freedom
PID control instruction coefficient (β)
・Lower limit for operating quantity (M VLL )
・Upper limit for operating quantity (M VHL )
・Limit for operating quantity change amplitude
Manual operating Operating
quantity (ΔM VL )
quantity
(MV MAN ) (MV )
Flag relay
5
Positive operation/negative operation
MANUAL Selected constant invert timer
2 Coefficient setting for degree of freedom
Control object
machine
Measured of heater ect Operating
value quantity
Reference • The operation method used in PID control is target value filter 2 degree of freedom PID
method.
Target value filter 2 degree of freedom PID block diagram
SV 1+αβTI S SVF − EV 1
+
MV
KP 1+
1+βTI S + TI S −
(D)
KPTDS
1+μTDS
PV
• Operation is as follows by the target value filter 2 degree of freedom PID method.
<simple PID method> <target value filter 2 degree
of freedom PID method>
Scan
ON
RES input
EXTENDED INSTRUCTIONS
OFF
ON
PAUSE input
OFF
5 D1 +3 *1 Differential constant
Proportional constant
TD Constant of differential action
D1 +11 *1 Measured value PV Value observed from control target −32768 to 32767
D1 +12 Manipulated variable MV Result of PID operation −32768 to 32767
Manual mode Manually sets the manipulate variable. (Enabled
D1 +13 *2 manipulated variable M VMAN only when "MANUAL input" is ON.) −32768 to 32767
D1 +14
…
EXTENDED INSTRUCTIONS
Constant reflection operation formula at each operation. When OFF, they are reflected in the operation
D2 +1*1
timing selection formula only at the falling edge of RES input.
This setting is valid at all times, and can be switched during operation.
When ON, the user setting of the 2 degree of freedom coefficient α and β is reflected.
When OFF, the default value is used.
2 degree of freedom
D2 +2*1 • When the constant reflection timing selection is ON, this can be switched at all times.
coefficient setting
• When the constant reflection timing selection is OFF, this is switched at the falling
edge of the RES input.
D2 +4 *2 Operation completed This turns ON for one scan when the operation is executed.
D2 +5*2
Measured value change Turns ON for one scan when there is a change that results in the preset manipulated
amount exceeded variable change limit value (ΔMVL) being exceeded.
5
Operation cycle Turns ON for one scan when the operation cycle exceeds twice the sampling cycle
Data settings
Measuring value(PV)
PID instruction
in program
①period Default value, execute PID Unprocessed Execute calculation Execute calculation Unprocessed Execute calculation Execute calculation Unprocessed
②period Default value, execute PID Unprocessed Unprocessed Execute calculation Unprocessed Unprocessed Execute calculation Unprocessed
operating quantity
(MVHL)
Proportion
32767
constant
(KP)
Upper limit for (scope)
operating quantity
(MVLL)
−32768
5
Set value(S V )
Value after converted by −2048 +2047
AD converter Proportional
Band (P)
PID Control Instructions
5(%)
When a temperature controller with temperature range of 0 to 200℃ is used and the proportional band
is set to 5% (temperature range 10℃), the temperature range of the proportional band at setting value
100℃ becomes 95℃ to 105℃.
Manipulated variable upper limit value at 95°C (M VHL ) : +32767
Manipulated variable lower limit value at 105°C (M VLL ) : -32768
Value obtained by converting 95°C on an A/D converter : -2048
Value obtained by converting 105°C on an A/D converter : +2047
Time
* As deviation is not solved by adjustment of the proportional constant (KP), use the integral constant
(TI) to adjust deviation.
Time
* Increase the integral constant setting when hunting occurs over a long cycle.
5-122 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
PID Control Instructions
EXTENDED INSTRUCTIONS
constant (TI) is decreased.
Temperature (1) Though the response to external
① disturbance is fast when a large
①
② differential constant (TD) is set, hunting
increases.
Set value (2) Both response to external disturbance
and hunting become medium-size when
③ a medium-size differential constant (TD)
② is set.
(3) Though the response to external
Interfere disturbance is slow when a small
differential constant (TD) is set, hunting
5
Time decreases.
* - Decrease the differential constant setting when hunting occurs over a short cycle.
This is set by the user in the manual operation mode. (This is required for balance-less and bump-less
switching.)
It can be rewritten only in the manual mode. In the automatic operation mode, the same value as the
manipulated variable (MV) is stored at execution of the operation.
Flag settings
●Forward/reverse operation D2 +0
ON for forward operation and OFF for reverse operation. This is reflected in the operation formula only
at the falling edge of RES input.
Reference For example, when controlling temperature, forward operation is a cooling operation which
increases the manipulated variable when the measured value is higher than the setting
value. Reverse operation is a heating operation which increases the manipulated variable
when the measured value is lower than the setting value.
●Operation completed D2 +4
Turns ON for one scan at each operation of the sampling cycle (TS).
5-124 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
PID Control Instructions
EXTENDED INSTRUCTIONS
●Operation cycle exceeded D2 +6
Turns ON for one scan when the operation cycle exceeds twice the sampling cycle (TS). Operation
continues even if this alarm occurs.
Point • RES input must be turned ON once before the operation is started. (Be sure to
input CR2008 to the RES signal to start operation after the program is started
up.)
• The PID instruction cannot be written in the initialization execution module and
interrupt program.
• Operations are not performed while the PAUSE input is ON. In this case,
5
Operation flag
Sample Program
PID control is performed after one scan at the rising edge of PLC.
(Mnemonics list)
R000 PID
PAUSE LD R000
R001 DM0 LD R001
LD CR2008
MANUAL
PID DM0 R10000
CR2008 R10000
RES
PIDAT
PIDAT PID control with
Performs PID control.
automatic tuning
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or later and KV Nano Series base
units.
Description of Operation
The PIDAT instruction is an instruction that adds the AT (automatic tuning) function to the PID operation.
• The manipulated variable (MV) (PID operation by KP: proportional constant, KI: integral constant, and
KD: differential constant) is calculated from the deviation between the setting value (SV) and the
measured value (PV) read by the specified sampling cycle (TS).
• The target object to measured by the Upper limit for
operating quantity
calculated manipulated variable (MV) is ( ) Operating quantity ( Mv)
PIDAT instruction
Parameters
・ Manual manipulated value( )
EXTENDED INSTRUCTIONS
・Sampling cycle( )
Measured ・Proportional constant( )
Set value ・Integral constant( )
value
( )
( ) ・Differential constant( )
・Proportional constant 2 degree of freedom coefficient(α)
・Integral constant 2 degree of freedom coefficien(β)
・Differential constant 2 degrees of freedom coefficient(γ)
PID control instruction ・Manipulated variable lower limit value( )
・Manipulated variable upper limit value( )
・Manipulated variable change width restrictionvalue( )
AT result
Manual Operating ・Measured value change width( )
is applied
operating quantity AT parameters
quantity
5
( ) ・AT adjustment parameter( )
( )
・AT hysteresis( )
・AT timeout time
・AT calculation control method
OFF
ON
AT start/operating flag
(bit 2 of D1 +2)
A/D D/A
conversion conversion
Control object
machine
Measured of heater ect Operating
value
quantity
Reference The operation method used in PID control is target value filter full 2 degree of freedom PID method.
Setting value
Target value filter after target Proportional + integral element Operating
Set value value filter quantity
1+αβ + +
1
1+
1+β ー +
αγ
Incomplete
Measured differential element
value +
ー 1+μ
With simple PID control, if overshoot relative to the target value tracking is suppressed, the
stability against disturbance slows down. Conversely, if the stability against disturbance is
sped up, overshoot will occur, and the target value tracking will slow down.
With 2 degree of freedom PID control, both the target value track ability and the
EXTENDED INSTRUCTIONS
When appearance of overshoot is When stability with respect to external Overshoot can be prevented and
prevented, stability with respect to disturbance is set faster, overshoot stability with respect to external
external disturbance slows down. appears and the reaction with respect disturbance can be speeded up.
to the target value slows down.
5 The PIDAT instruction cannot be written in the initialization execution module and
Point
PID Control Instructions
interrupt program.
■List of parameters
*1 The PIDAT instruction automatically turns OFF when automatic tuning is finished.
EXTENDED INSTRUCTIONS
OFF : Reverse operation
ON : Forward operation
2 degree of freedom coefficient setting
(Usually set to OFF.)
Sets whether to change the 2 degree of freedom
Bit 1 coefficient for the proportional constant, differential
constant and integral constant from the default value.
OFF : Use default value
ON : Apply the D1+8 to 10 value
Bit 2, 3 Reserved (fixed to OFF)
Integral/differential constant unit setting 5
Changes the unit for the integral constant and
Bit
Bit 12 to 15 Setting details
15 14 13 12
OFF OFF OFF OFF PID control
OFF OFF OFF ON PI control
OFF OFF ON OFF P control
*2 When using automatic tuning, these constants are automatically set after automatic tuning. When
not using automatic tuning, set them manually.
*3 If "0" or a value larger than "30001" is set, the integral operation will be disabled.
*4 If "0" is set, the differential operation will be disabled.
*5 If "0" is set, operation will take place with the default value "1.00".
5-130 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
PID Control Instructions
EXTENDED INSTRUCTIONS
* If the measured value fluctuates and prevents a 0*6,
D1 +16 AT hysteresis h
normal limit cycle from being generated, 1 to 3500
increase this value. However, the automatic
tuning accuracy will drop if this value is set too
large.
Set the timeout time for automatic tuning.
0*7,
D1 +17 AT timeout time ― Setting range: 1 to 1440 minutes (24 hours)
1 to 1440
Default value: 1440
Operation completed
Bit 0 ― Turns ON when the operation is executed, and
turns OFF when not executed. 5
Manipulated variable exceeded
5
• Manipulated variable lower limit (MVLL) ( D1 +11)
• Manipulated variable upper limit (MVHL) ( D1 +12)
• Manipulated variable (MV) ( D2 )*2
PID Control Instructions
*1 Operation will take place even if other bits are OFF (invalid). If other bits are turned
ON (valid), store the setting value in the corresponding parameter.
*2 PID operation is executed using the manipulated variable (MV) value at the rising
edge of the execution condition as the manipulated variable default value.
Symb
Parameter Item Reflection timing
ol
EXTENDED INSTRUCTIONS
S Measured value PV
D1 +0 Setting value SV
Manual manipulated At each PIDAT instruction operation cycle
D1 +1 MVMAN
variable
D1 +2 Operation control flag ―
Only at the rising edge of PIDAT instruction execution
Bit 0
condition
Differs depending on the constant reflection timing selection
( D1 +2: bit 4) setting.
5
• D1 +2: When bit 4 is
Operatio Bit 1
D1 +3 ― OFF : Only at the rising edge of PIDAT instruction
n setting
execution condition
* The manipulated variable could fluctuate greatly if the manipulated variable lower limit or upper limit
is changed while the execution condition is ON.
ON
Execution conditions
EXTENDED INSTRUCTIONS
OFF
Sampling cycle( )
③
Details of
①Initialization process ②PID operation execution Automatic tuning execution PID operation execution PID operation execution
PIDAT instruction operation
ON
Operation complete
( D1 +18:0bit)OFF
AT start/operating flag ON ③
(
D1 +2: 2 bit)OFF ④
(1)The PIDAT instruction executes the initialization process in one scan at the rising edge of the
execution condition.
(2)While the execution condition is ON, PID operation is executed as each sampling cycle (TS) passes.
5 When PID operation is executed, the operation completed flag ( D1 +18: bit 0) turns ON for one scan.
(3)When the AT start/operating flag ( D1 +2: bit 2) turns ON, automatic tuning is executed at the next
PID Control Instructions
sampling cycle.
(4)When automatic tuning is finished, the AT start/operating flag automatically turns OFF.
●Initialization process
The PIDAT instruction executes the initialization process in one scan at the rising edge of the execution
condition.
• The parameters for which the reflection timing is "rising edge of PIDATinstruction execution
condition" are read to the work area ( D1 +20 to D1 +51).
• The value set in manipulated variable ( D2 ) is read in as the manipulated variable default value.
Setting value ( )
AT hysteresis ( )
Measured value( )
Manipulated value( )
EXTENDED INSTRUCTIONS
condition is turned from OFF to ON.
Time Time
Data settings
Sets the measured value observed from the control target equipment.
Reference Use the RAMP instruction to change the setting value at a set inclination.
"RAMP instruction", page 4-146
Sets the manipulated variable for the manual mode. During the manual mode, the manual manipulated
variable (MVMAN) is stored in the manipulated variable (MV) ( D2 ).
PID Control Instructions
ReserReserReserReserReserReserReserReserReserReserReser Reser
ved ved ved ved ved ved ved ved ved ved ved ved
(0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0)
Unlike when the execution condition is OFF, the initialization process is not executed when operation
resumes.
This function can be used to stop the operation when preparing the equipment, or for special control,
etc.
EXTENDED INSTRUCTIONS
If automatic tuning ends abnormally, the operation flag CR2012 turns ON and the error details (error
code) are stored in CM5157.
●Constant (KP, TI, TD, α, β, γ, MVLL, MVHL, ΔMVL, ΔPVL) reflection timing selection
D1 +2: Bit 4
When this bit turns ON, the parameters (KP, TI, TD, α, β, γ, MVLL, MVHL, ΔMVL, ΔPVL) are reflected to the
operation formula at each sampling cycle.
5
When this bit is OFF, the parameters are reflected to the operation formula only at the rising edge of the
■Operation setting D1 +3
The operation is set with the ON and OFF status of the bit position of D1 +3.
bit bit bit bit bit bit bit bit bit bit bit
15 14 13 12 9 8 6 5 4 1 0
Forward/reverse operation
Reference For example, when controlling temperature, forward operation is a cooling operation which
increases the manipulated variable when the measured value is higher than the setting
value. Reverse operation is a heating operation which increases the manipulated variable
when the measured value is lower than the setting value.
Reference Set this to ON to adjust the target value filter. Normally, this is set to OFF.
The target value filter is adjusted to improve the target value tracking response without
changing the disturbance response performance.
Set this to ON if the control target response is fast, and OFF if it is slow.
PID Control Instructions
Reference
EXTENDED INSTRUCTIONS
exceeds the value set with measured value change (ΔPVL), the measured value change exceeded
( D1 +18: bit 3) output turns ON.
Measured value(PV)
PIDAT instruction
in program
Operation Operation Operation
Operation
①Cycle PIDAT executed No process execution
execution
No process
execution
No process
with default value execution
②Cycle PIDAT executed No process No process Operation Operation
No process No process No process
with default value execution execution
①Sampling cycle ( )
②Sampling cycle ( )
5
Set value( )
Set value
( )
Value after converted by AD converter ー2048 +2047
Proportional Band
PID Control Instructions
( )
5(%)
When a temperature controller with temperature range of 0 to 200℃ is used and the proportional band
is set to 5% (temperature range 10℃), the temperature range of the proportional band at setting value
100℃ becomes 95℃ to 105℃.
Manipulated variable lower limit value at 105°C (M VLL ) : -32768
Value obtained by converting 95°C on an A/D converter : -2048
Value obtained by converting 105°C on an A/D converter : +2047
Assuming the above, the proportional band becomes
[+32767−
(−32768)]
÷[+2047−
(−2048)]
≒ 16.000
=16.000
* As deviation is not solved by adjustment of the proportional constant (KP), use the integral constant
(TI) to adjust deviation.
EXTENDED INSTRUCTIONS
Temperature (1) Though startup is quick when a small integral
① constant (T I ) is set, hunting increases.
② (2) Both startup and hunting become medium-
size when a medium-size integral constant
Set value (T I ) is set.
(3) Though startup is slow when a large integral
constant (T I ) is set, hunting decreases.
③
Time
* Increase the integral constant setting when hunting occurs over a long cycle.
Interfere
Time
※· Decrease the differential constant setting when hunting occurs over a short cycle.
· Set a small differential constant on control systems (e.g. pressure or flow rate) having a fast response
or control systems having vibrating elements.
Reference To confirm the effect of the target value filter, it is recommended to monitor the setting
value after target value filter (SVF) with the real-time chart monitor.
Increases when
Setting value β is increased
When γ=1/α is set, the deviation differential takes place, and the response when the target value
changes can be improved. However, the fluctuation in the manipulated variable will increase.
* The set value is valid only when the 2 degree of freedom coefficient setting ( D1 +3: bit 1) is ON. If
set to OFF, 1.25 will be applied in the operation formula as the default value.
5 Manipulated variable exceeded ( D1 +18: bit 1) turns ON when the manipulated variable is less than
this value.
This is valid in the automatic and manual modes. ON and OFF is controlled within this value range
PID Control Instructions
EXTENDED INSTRUCTIONS
■AT time out time D1 +17
Set this if automatic tuning does not end because the measured value (PV) does not change, etc.
When the time out time elapses, the AT start/operating flag ( D1 +2: bit 2) turns OFF, and the PID
control is started with the PID constants applied before automatic tuning is started.
5
The operation of the PIDAT instruction is confirmed with the bit position ON and OFF status of
D1 +18.
Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv
ed ed ed ed ed ed ed ed ed ed ed ed
Operation completed
PID operation is executed at the rising edge of the execution condition using this value as the
manipulated variable default value.
* This value is used as the manipulated variable default value, so set an appropriate value.
* It is recommended to output this value to the control target regardless of the mode.
* When not using integral operation, add an offset value to this value.
5 Reference • When converting to a pulse output, input this value with the "TPOUT instruction".
"TPOUT instruction", page 4-150
PID Control Instructions
• When limit control is performed for the manipulated variable, use the "LIMIT instruction"
to limit the upper/lower limits of this value.
"LIMIT instruction", page 4-132
Point • If the rising edge cannot be detected in the execution condition (when a constant
ON is used for the execution condition, or a PIDAT instruction is wirtten in FOR
to NEXT and so on), clear the work area to zero once before executing the
instruction. The initialization process will be executed.
• Parameter ( D1 ) cannot be shared by multiple PIDAT instructions.
• Turn the execution condition OFF before adding a PIDAT instruction with write
during RUN. The initialization process will not be executed.
• This function cannot be used in an interrupt program or initialization module.
• When there is no integral (constant (TI) is 0 or 3000.1 (sec) or more), the target
value filter is disabled as an exception only in this case as the effect of the target
value filter is excessive. (Proportional constant 2 degree of freedom coefficient
(α) = 1.)
Operation flag
* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, the following error codes (error details) are
stored in CM5157.
KV Nano Series When CR2012 is ON, the following error codes (error details) are stored in CM2257.
●Error codes
Value
Details of error Operation during error Countermeasures
(decimal)
0 Normal operation ― ―
EXTENDED INSTRUCTIONS
24 Operation setting out of range
25 Sampling cycle out of range
26 Proportional constant out of range
27 Integral constant out of range
28 Differential constant out of range
Proportional constant 2 degree of
29
freedom coefficient out of range
Integral constant 2 degree of
30
freedom coefficient out of range
Correct the parameter stored in D1 .
Differential constant 2 degree of
31 PID operation is stopped.
freedom coefficient out of range
32
Manipulated variable upper/lower
limit value out of range
(Out of range or upper limit ≦ lower
5
limit)
Sample Program
PID operation is executed using the setting value stored in data memory DM1000 as a target, and PID
control is performed after the pulses are output from the output relay R500 at the obtained manipulated
EXTENDED INSTRUCTIONS
variable. The PID control parameters (proportional constant, integral constant, differential constant) are
automatically tuned and set. A gradual change is obtained by providing an inclination to the setting
value.
PID operation
Settin value (PIDAT instruction)
Time KV-5500/5000/3000
CR2007 MR000
SET
OFF 1 scan at start of
operation
MR000 PIDAT
DM10100 DM1000 DM999
EXTENDED INSTRUCTIONS
ch0 Setting Manipulated
measurement value value
input value
MR000 CR2012
’PIDAT error process
Operation
execution error
Manipulated value is converted to pulse output with TPOUT instruction
The PIDAT instruction manipulated value is input in the ON time, and
the upper limit of the PIDAT instruction's manipulated value is used for
the cycle.
The lower limit of the PIDAT instruction's manipulated value is set to 0.
MR000 TPOUT
DM999 DM1012 R500
5
DM1002.2 MR100
AT start/ In automatic
operating flag tuning
DM1002.2 MR001
RES
AT start/
AT execution
operating flag
conditions
MWRIT/MPRINT
MMKDIR/ MRMDIR
MDEL/MREN
Read
MCOPY/MMOV
Write
MREAD/MREADL Storage device PC
(memory card or (Microsoft Excel etc.)
5
MFREE/MFREEK CPU memory)
KV-8000
KV-7500/7300 MSTAT
KV-5500/5000/3000
Storage Device Instructions
KV-NC32T
●Read and write data with a non-uniform data type line by line (MREADL/MPRINT
instructions)
These instructions can read and write data with a non-uniform data type such as "serial number +
unsigned decimal data". If the text string read with the MREADL instruction is combined with the SPRIT
function, data can be easily split by "," and stored in devices.
●Create and delete folders in the storage device (memory card or CPU memory)
(MMKDIR/MRMDIR instructions)
These instructions can create folders to use for backups, create folders by date, and delete
unnecessary folders.
●Delete the files in the storage device (memory card or CPU memory) (MDEL
instruction)
This instruction can delete files saved on the storage device (memory card or CPU memory) that are no
longer necessary from a ladder program.
●Rename files in the storage device (memory card or CPU memory) (MREN
instruction)
This instruction can change both the file name and the extension, so you can freely change the
extension to ".txt" and ".log".
●Check the free space of storage device (memory card or CPU memory) (MFREE/
MFREEK instructions)
These instructions can check the free space on the storage device (memory card or CPU memory) and
EXTENDED INSTRUCTIONS
generate an alarm in advance when the space has increased. The MFREEK instruction can check the
free space in kilobytes to offer support for large capacity memory cards.
●Check the status of files in storage device (memory card or CPU memory)
(MSTAT instruction)
This instruction can check the status of a file on the storage device (memory card or CPU memory) (Is
the file read-only? What is the file size? When was the last modified time?). By checking the file before
deleting it, this instruction can provide a fail safe device against accidentally deleting the most recent
file.
5
Storage Device Instruction List
*1 This instruction can only be used with the KV-8000/7500/7300/5500/5000/3000 and KV-NC32T.
*2 This instruction can only be used with KV-8000/7000 Series CPU units, KV-5500/5000/3000
Series with CPU function version 2.0 or later and KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
Reference • Storage device is a generic term for a storage area. For KV-8000/7500/7300 it refers to
memory cards or CPU memory. For KV-5500/5000/3000/1000 and KV Nano Series it
refers to memory cards.
• When KV-8000/7500/7300/5500/5000/3000 is used, there is file register (FRSTM/
FRLDM) instructions other than the storage device instructions as a instruction
statement which reads and writes to the storage device. The read and write format is
fixed with the file register instructions. Therefore, compared with the MWRIT and
MREAD instructions, these instructions may be able to read and write at high speed
when reading and writing a large number of data. (The only data that can be read and
written is FM.)
MMOV ○ ○ ○ - - ○ -
MREN ○ ○ ○ - - ○ -
MFREEK ○ ○ ○ - - ○ -
MSTAT ○ ○ ○ - - ○ -
■When saving unsigned binary values and 1-word data line by line
The following file is created.
EXTENDED INSTRUCTIONS
DM501 MWRIT "ABC\MWRIT 1 word line feed" DM1000 #10 DM500 MR001
Write mode
MWRIT
"ABC\MWRIT linefeed" DM1000 #10
Folder name Save head device Amount of saved data
File name
DM500 MR001
Save format MWRIT complete
■When saving unsigned binary values and 10-word data line by line
The following file is created.
MWRIT
"ABC\MWRIT linefeed" DM1000 #50
Folder name Save head device Amount of saved data
File name
DM500 MR001
Save format MWRIT
instruction executed
■When reading unsigned binary values and data with line feed every 10 words
The CSV file data below is read to DM1100 to DM1149.
EXTENDED INSTRUCTIONS
MREAD instruction settings
Folder: ABC File name: MREAD_DATA
MREAD
"ABC¥MREAD_DATA" DM1100 #50
Folder name Read head device Amount of
File name read data
DM600 MR101
read format Reading complete
Error
Code Content Cause How to handle
0 Normal ― ―
Memory card not Either the memory card is not inserted or Insert the memory card, and completely
1
inserted the memory card slot cover is open. close the memory card slot cover.
The file name contains characters that are
2 Abnormal file name Specify the file name correctly.
not allowed.
The specified file or directory does not
3 File does not exist Specify the file name correctly.
exist.
5
The specified file or directory already
4 File already exists Rename the file or directory.
exists.
The file system of the memory card is in
5 File load error Check the file system of the memory card.
Storage Device Instructions
error.
• Remove the write protection from the
• The specified file is write-protected. specified file.
• The memory card is write-protected. • Remove the write protection from the
6 File write error
• The file system of the memory card is in memory card.
error. • Check the file system of the memory
card.
Abnormal file read The specified read/write position indicates
7 Correctly specify the read/write position.
Write position outside of the file range.
The file could not be saved successfully
Not enough space on
8 due to insufficient space on the memory Delete the unnecessary file.
memory card
card.
Data not conforming to the specified format
Either correct the content of the file, or
9 Format error or out-of-range data was saved when the
select the correct format.
file was read.
When accessing the same file, use
Another function is accessing the specified
10 File access competition exclusive control between the storage
file, so the instruction was not executed.
device instruction and other functions.
• New files/folders cannot be created as
4096 files and/or folders are stored in the
CPU memory restricted CPU memory. Confirm the restrictions of the executed
11
error • The file/folder that the device is storage device instruction.
attempting to create exceeds the16th
hierarchy.
The instruction was not executed due to the Confirm the restrictions of the executed
1000 Other errors
file system restriction. storage device instruction.
Point The value stored in CM2390 will be cleared to 0 if closed successfully after the execution
of next storage device instructions.
MEMO
EXTENDED INSTRUCTIONS
5
MWRIT
MWRIT
Storage Write data to the memory
write card (CPU memory).
5
Specifies the start to store save format-related parameters and the
D1 16 bits x 6
save state of the data.
D2 Specifies the storage location for the notification bit.*5 1 bit × 2
Storage Device Instructions
Description of Operation
MWRIT This instruction writes n data (16-bit/32-bit/ASCII text string) starting from S2 to
the memory card (memory card or CPU memory for the KV-8000/7000 Series) according
to the content of parameters ( D1 to D1 +4) under the file name specified by S1
at the rising edge of the execution condition.
The number of actually saved data is written to D1 +5, the completion notification is
written to D2 , and the error notification for an abnormal end is written to D2 +1.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
5-156 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Storage Device Instructions
EXTENDED INSTRUCTIONS
S2 +2 34567
Storage
Device
…
When file S1 .CSV
S2 + n −2 45678
12345, 23456, 34567,・・・, 45678, 56789
S2 + n −1 56789
32-bit data
bit bit bit bit
31 16 15 0
…
Device hen file S1 .CSV
S2 +2 • n −2)+1 2345678901 S2 +2 • n −2)
S2 +2 (• n −1)+1 3456789012 S2 +2 ( n −1)
12345678, 123456789, 1234567890,・・・ ・・
・, 2345678901, 3456789012 5
ASCII text string
n −3 a (61H) b (62H) n −2
n −1 c (63H) 1 (31H) n
* When writing ASCII character strings, the first character string with " (quotation
marks) is specified.
To enter several ASCII character strings with " (quotation marks), execute the
MWRIT instruction for the appropriate number of times.
Alternatively, specify character strings inside " (quotation marks) in the write data amount.
Scan
ON
Execution condition
OFF
Read process
ON
End notice ( D2 )
OFF
Read position
( D1 )+3, +4
Number of read data ( D1 +5)
ON
CR3214
(Storage instruction OFF
executing)
* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/retrieval
processing time.
Point If the following storage instructions are executed while CR3214 (Storage instruction
being executed) is OFF, they may not be executed. To execute storage instructions
continuously, check that the completion notification of the previous storage instruction
is ON before executing the next storage instruction.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-157
Storage Device Instructions
Point When the setting of save format D1 has been specified in BIN data, it is stored
as follows:
16-bit data
EXTENDED INSTRUCTIONS
bit bit
15 0
12345 3039H
3930A05B
23456 5BA0H
32-bit data
bit bit bit bit
31 16 15 0
1234567890 499602D2H
D20296493538D08B
2345678901 8BD03835H
5 S1 setting
Specify the name of the file to save data within 1 to 249 characters (including end code NULL(0H) and folder name).
Storage Device Instructions
Example of
folder structure File Folder
File
DM4 NULL(00H)
Point • File names are automatically appended with an extension according to the save
format setting D1 .
• For KV-8000/7000 series, storage to be saved can be designated by adding "0:\"
or "1:\"in the beginning.
n setting range
Set the number of data to save. The setting range changes according to the setting value of D1 .
D1 setting
0,2,4,6 (16 bits) 1,3,5,7,9 (32 bits) 8(ASCII)
value
Setting range 1 to 65535 1 to 32767 0 to 1999
EXTENDED INSTRUCTIONS
D1
setting 0 1 2 3 4 5 6 7 8 9
value
16bit 32bit 16bit 32bit ASCII Floating
Details 16bit 32bit 16bit 32bit
unsigne unsigne signed signed text real
saved BIN BIN HEX HEX
d BIN d BIN BIN BIN string number
Extension
appended .BIN .CSV
to S1
Save
BIN data Comma Separated Value
format
5
Reference When the save format is set to ASCII string, the kana or Chinese characters can be written
Mode Content
Holds the content of the current file, and adds and saves data to the end of that file.
A new file is made if the file does not exist.
0: Add mode Example
File name: ABC (data to save) File name: ABC
+
Holds the content of the current file, and overwrites and saves data to a position in
the file specified by the write position ( D1 +3) from the start of the file. An error
1: Write position occurs if the file does not exist.
specification mode 1
Example
(offset from start of file)
File name: ABC (data to save) File name: ABC
([ D1 +3・ D1 +4]
Write position )
Holds the content of the current file, and overwrites and saves data to a position in
the file specified by the write position ( D1 +4) from the end of the file. An error
occurs if the file does not exist.
2: Write position
Example
specification mode 2
File name: ABC (data to save) File name: ABC
(offset from end of file)
Write position [
( D1 +3・ D1 +4]
)
Deletes the content of the file and writes data. A new file is made if the file does not
exist.
D1 +2
EXTENDED INSTRUCTIONS
bit bit
15 0 Add line feed OFF ON OFF ON
Fixed digit
output OFF OFF ON ON
Setting value 0 1 2 3
Add line feed (Set end of file processing when outputting as a CSV file.)
OFF : Inserts a comma ($2C).
ON : Inserts a line feed CR+LF ($D$A).
Fixed digit output (The number of digits in the data is fixed when outputting
as a .CSV file.)
OFF : Variable (Zero suppression is ON.)
* When "2" or "3" is specified to D1 , fixed digits is set at all times.
ON : The number of digits can be fixed by the following number of digits.
5 Save format
D1
2 3 4
16bit 32bit
5
16bit 32bit
6 7 8 9
KV-8000/7500/7300/5500/5000/3000、KV
KV-8000/7500/7300/5500/5000/3000, KV NanoNanoシリーズ
Series
0 : Line feed (for CSV file export, line feeding (not including the
file end) is performed.)
1∼255 : Line feeding at the specified comma.
* D1 Line feeding cannot effected when 0, 1, or 8 is specified.
* When KV-1000, 0 is set.
file index.............................................Position separated in 1-byte units from the start of the stored file
16-bit BIN data
TEST1.BIN 0 10 0 0 C 0 0 7 B 0 0 D 20 4 39 30 A 0 5B 0 78 76 E B 2D 5 D D F F F F
16-bit data
TEST1.CSV 1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
(31H) (2CH) (31H) (32H) (2CH) (31H) (32H) (33H) (2CH) (31H) (32H) (33H) (34H) (2CH) (31H) (32H) (33H) (34H) (35H) (2CH)
ASCII data
TEST1.CSV " A B C D " , " 1 2 3 4 " , " ァ ィ ゥ ェ
(22H) (41H) (42H) (43H) (44H) (22H) (2CH) (22H) (31H) (32H) (33H) (34H) (22H) (2CH) (22H) (B1H) (B2H) (B3H) (B4H) (22H)
[ D1 +3/ D1 +4] are enabled only when write position specification mode 1 or 2 is set for the write
mode ( D1 +1).
When data has been written to the storage device, the following are stored in ( D1 +3) and
( D1 +4). (0 is stored immediately after power is turned on)
① When ( D1 +1) = 0
(Reserved for the system)
② When ( D1 +1) = 1
The next writing position is stored in ( D1 +3) and ( D1 +4).
*The number increases by the number of bytes written every time the instruction is executed.
③ When ( D1 +1) = 2
The next writing position is stored in ( D1 +3) and ( D1 +4).
*The number decreases by the number of bytes written every time the instruction is executed.
④ When ( D1 +1) = 3
(Reserved for the system)
Also, data can be written from the specified position by setting a value (offset value) to the write position
([ D1 +3/ D1 +4]) before the instruction is executed.
Example1 When the write mode " D1 +1" is "1" .... Write position specification mode
(offset from start of file) file index position
EXTENDED INSTRUCTIONS
Setting value Stored value
[ D1 +3・ Description [ D1 +3・
D1 +4] D1 +4]
Data is overwritten from the start of the file.
Example File name: ABC (data to save) File name: ABC
$0 $4
$0 $4
$5
$5
5
$1∼ $0 $1
* Quotes ["] are added before and after the data when 8 is specified for D1 .
Example 2 When the write mode " D1 +1" is "2"...... After the write position specification mode
(offset from end of file) is executed, the stored value is $0 at all times.
$22222221 $22222225
$22222222
$1∼
When $00000002 is set
File name: ABC (data to save*) File name: ABC
$22222220 $22222224
$22222222
* Quotes ["] are added before and after the data when 8 is specified for D1 .
Point Pay attention to the following when specifying the position to write to.
When specifying the pointer in the data
…Pointer position
...Corrupted data
5
D1 +5: Number of written data
Storage Device Instructions
The number of actually written data is stored after write processing to the storage device ends.
Number
Stored
Save format of Data
Content value
D1 to Write
D1 +5
n
0. 16bit BIN Example
1. 32bit BIN
File name: ABC (data to save)
2. 16bit HEX 4
3. 32bit HEX File name: ABC
4. unsigned 16-bit
BIN
4 File name: ABC (data to save)
5. unsigned 32-bit Example
Size exceed
BIN
6. signed 16-bit BIN File name: ABC 2
7. signed 32-bit BIN
9. Floating real
number
Example File name: ABC S2 S2 +39
Free space (for 100 characters) NULL
Text string data of 40 characters + NULL 40
File name: ABC
40 characters
8. ASCII text
40
string Example File name: ABC S2 S2 +39
Free space (for 30 characters) NULL
Text string data of 40 characters + NULL
Size exceed 30
File name: ABC
30 characters 10 characters
Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D2 ON when write processing to the storage device ends. It becomes ON either
notification
when the command is normally finished, or abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.
5-162 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Storage Device Instructions
Point • Set the save format, write mode and options to appropriate values before
executing the instruction.
• When setting the write position, set appropriate values before executing the instruction.
• The result of END processing after execution of the instruction is completed is
EXTENDED INSTRUCTIONS
written for the write position, number of written data, completion notification,
and error notification.
• When save format 8 (ASCII text string) is set, the text string preceding the end
code (NULL) from D2 is output enclosed by double quotation marks ("").
• When the text string is longer than the number of data (n) to write, only the number
of data (n) characters to write are from the start of the text string are stored.
• Double quotation marks (") in text strings are converted to two double quotation
marks ("").
Example 12" AB" 345(NULL) "12" "AB" "345"
• File names are automatically appended with an extension according to the save
format setting.
5
• Several scans are sometimes required for writing to the device. If the value of the
D1 D2
Operation flag
Sample Program
Each time R1000 turns ON, data memories DM1000 to DM1099 are added to the file "ABC\DATA"*.
The save format is CSV file format. ON is output to R500 after writing ends.
EXTENDED INSTRUCTIONS
5
CON
MWRIT RES R1004
"ABC¥DATA" DM1000 #100 ⑤
DM500 R1004
Storage Device Instructions
(4) DM502 (Option): Insert a comma at end of data, and change number of data digits.
The values of data memories DM1000 to DM1099 are written to the memory card in CSV file format.
Each time that R1000 turns ON, the file is written to folder "ABC" with the execution date and time taken
as the file name. ON is output to R500 after writing ends.
EXTENDED INSTRUCTIONS
RES ① LD CR2008
1 scan ON
RES R1004
R1000 R1004 CM700 DM0 LDP R1000
↑ LDA TBCD ASC STA ② ANB R1004
calendar timer (Year)
MPS
CM701 DM1 LDA CM700
LDA TBCD ASC STA ③ CON
calendar timer (Month)
TBCD
CM702 DM2 CON
LDA TBCD ASC STA ④ ASC
calendar timer (Day)
CON
CM703 DM3 STA DM0
LDA TBCD ASC STA ⑤ MRD
calendar timer (Hour)
LDA CM701
CM704
LDA
calendar timer (Minute)
TBCD ASC
DM4
STA ⑥
CON
TBCD
CON
5
$0 DM5 ASC
The values of data memories DM1000 to DM1099, and then DM2000 to DM2199 are written to the
memory card in CSV file format.
Each time that R1000 turns ON, the file is written to folder "ABC" with the execution date and timetaken
as the file name. ON is output to R500 after writing ends.
EXTENDED INSTRUCTIONS
5
LDA STA ⑤
STA DM0
MRD
SADD LDA CM701
"ABC\" DM0 DM10 ⑥ CON
Storage Device Instructions
TBCD
#6 CON
DW ⑦ ASC
DM500 CON
#3 STA DM1
DW ⑧ MRD
DM501 LDA CM702
#0 CON
DW ⑨ TBCD
DM502 CON
MWRIT ASC
DM10 DM1000 #100 ⑩ CON
DM500 R1004 STA DM2
MRD
R1004 R1006 #0 LDA $0
DW ⑪ CON
DM501
STA DM3
MWRIT MRD
DM10 DM2000 #200 ⑫ SADD "ABC\" DM0 DM10
DM500 R1006 MRD
R1006 R500 R1004 DW #6 DM500
SET RES ⑬ MRD
DW #3 DM501
(1) The completion notification is reset to its initial state. MRD
DW #0 DM502
(2) Calendar timer (Year) 00 to 99 is converted to ASCII code MPP
and stored to DM0. MWRIT DM10 DM1000 #100 DM500 R1004
(3) Calendar timer (Month) 01 to 12 is converted to ASCII code LD R1004
ANB R1006
and stored to DM1. DW #0 DM501
(4) Calendar timer (Day) 01 to 31 is converted to ASCII code and MWRIT DM10 DM2000 #200 DM500 R1006
stored to DM2. LD R1006
(5) NULL (OOH) is stored to DM3 (the ASCII codes of DM1 to SET R500
CON
DM2 are converted to character strings). RES R1004
(6) The calendar timers and folder name "ABC" are united into a
single text string, and stored to DM10 to
make"ABC\yymmdd". (Folder name and file name are made.)
(7) DM500 (Save format): singed 16-bit BIN, CSV file
(8) DM501 (Write mode): New mode
(9) DM502 (Option): Insert a comma at end of data, and change
number of data digits
(10) Start of save <folder>: ABC <file name>: DM10
<save destination>: DM1000 to DM1099 (100)
<completion notification>: R1004 <alarm notification>: R1005
(11) DM501 (Write mode): Add mode
(12) Start of save <folder>: ABC <file name>: DM10
<save destination>: DM2000 to DM2199 (200)
<completion notification>: R1006 <error notification>: R1007
(13) Process completion output is turned ON and completion
notification is reset.
5-166 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Storage Device Instructions
MEMO
EXTENDED INSTRUCTIONS
5
MREAD
MREAD
Storage Reads data from memory
read card (CPU memory).
5 D2
Specifies the start to store the parameters related to the read data
type, etc. and the data read status.
16 bits x2
Description of Operation
MREAD n data (16-bit/32-bit/ASCII text string) of the content of the parameters ([ D2 to
+4]) are saved at the rising edge of the execution condition to the data starting
EXTENDED INSTRUCTIONS
D2
from D1 from the file specified by S .
The number of actually saved data is written to D2 +5, the completion notification is
written to D3 , and the error notification for an abnormal end is written to D3 +1.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
5
When file S .BIN Parameter D1 12345
D2 ∼ D2 +4
3930A05B0787・・・6EB2D5DD D1 +1 23456
D1 +2 34567
Storage
…
When file S .CSV
D1 + n −2 45678
12345, 23456, 34567,・・・, 45678, 56789
D1 + n −1 56789
32-bit data
bit bit bit bit
31 16 15 0
…
S .CSV
12345678, 123456789, 1234567890,・・・ ・・・, D1 +2 ( n −2)+1 2345678901 D1 +2 ( n −2)
2345678901, 3456789012 D1 +2 ( n −1)+1 3456789012 D1 +2 ( n −1)
* Specify the start string separated by " when reading ASCII string, and specify a value
larger than the maximum number of characters of the string enclosed by " for the
number n of read data.
Scan
ON
Execution condition
OFF
Read process
ON
End notice ( D3 )
OFF
* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is
OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/access
processing time.
Point When the setting of read format [ D2 + 0] has been specified in BIN data, it is
stored as follows:
16-bit data
EXTENDED INSTRUCTIONS
bit bit
15 0
12345 3039H
3930A05B
23456 5BA0H
32-bit data
bit bit bit bit
31 16 15 0
1234567890 499602D2H
D20296493538D08B
2345678901 8BD03835H
5 S setting
Specify the name of the file to read from the storage device in the range of 1 to 247 characters
Storage Device Instructions
DM4 NULL(00H)
Point When designating storage with the KV-8000/7000 series, it can be executed without
"\" (backslash).
n setting range
Sets the number of data to read. The setting range changes according to the setting value of D2 .
D2 setting
0,2,4,6 (16 bits) 1,3,5,7,9 (32 bits) 8(ASCII)
value
n setting range 1 to 65535 1 to 32767 0 to 1999*
* When reading an ASCII text string, specify a value larger than the maximum number of characters in
the text string enclosed with (").
EXTENDED INSTRUCTIONS
D2
setting 0 1 2 3 4 5 6 7 8 9
value
16bit 32bit 16bit 32bit ASCII Floating
Details 16bit 32bit 16bit 32bit
unsigned unsigned signed signed text real
saved BIN BIN HEX HEX
BIN BIN BIN BIN string number
Extension
appended .BIN .CSV
to S
Save
BIN data Comma Separated Value
format
5
D2 +1: Read mode setting
Mode Content
Data is read from the start of the file at all times.
0: Regular mode Example File name:ABC
Read position
Data is read from a position specified by the read position from the start of the
1: Read position file.
specification mode 1
Example File name: ABC
(offset from start of file)
Read position(
[ D2 +3・ D2 +4])
Data is read from a position specified by the read position from the end of the file.
2: Read position
Example File name: ABC
specification mode 2
(offset from end of file)
Read position([ D2 +3・ D2 +4])
Sets "0".
File index・・・・Position separated in 1-byte units from the start of the stored file
EXTENDED INSTRUCTIONS
16-bit data
TEST1.CSV 1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
(31H) (2CH) (31H) (32H) (2CH) (31H) (32H) (33H) (2CH) (31H) (32H) (33H) (34H) (2CH) (31H) (32H) (33H) (34H) (35H) (2CH)
ASCII
TEST1.CSV " A B C D " , " 1 2 3 4 " , " ァ ィ ゥ ェ "
(22H) (41H) (42H) (43H) (44H) (22H) (2CH) (22H) (31H) (32H) (33H) (34H) (22H) (2CH) (22H) (B1H) (B2H) (B3H) (B4H) (22H)
[ D2 +3/ D2 +4] are enabled only when read position specification mode 1 or 2 is set for the read
mode ( D2 +1).
5 After the reading from the storage device is finished, the position counting from the start of the file to the
end of the newly read data is stored in the read position ([ D2 +3/ D2 +4]). When reading is
performed again in this state, the next data will be read.
Storage Device Instructions
Also, data can be read from the specified position by setting a value (offset value) to the read position
([ D2 +3/ D2 +4]) before executing the instruction.
The position to read from can be specified in 8-bit (1-byte) units.
Point When reading ASCII text strings, set the number of data to read n to a value
larger than the maximum number of characters in the text string enclosed with (").
If a number of data to read less than the maximum number of characters is set, the
data read out next may differ from the actual data.
Example1 When the read mode " D2 +1" is "1"… Read position specification mode (offset from start of file)
Data is read from the specified position counting from the start of the file.
Example When $1 is set
File name: ABC number of data to read File name: ABC
n $5
#4
$0 $1 $5
Example 2 When the read mode " D2 +1" is "2"... Read position specification mode (offset from end
EXTENDED INSTRUCTIONS
Setting value Stored value
[ D2 +3・ Description [ D2 +3・
D2 +4] D2 +4]
$0 error
Data is read from the specified position counting from the end of the file.
Example When $6 is set
File name: ABC number of data to read File name: ABC
n $2
#4 $22222220
$1∼ $2222221C $22222222
When $4 is set
File name: ABC number of data to read File name: ABC
$22222220 $22222222
n
#4 $22222222
$0
5
The number of data actually read from the storage device are stored after read processing is
completed.
Read Stored
Save format Number
Content value
D2 of Data
D2 +5
n
0. 16bit BIN Example File name: ABC D1 D1 +39
1. 32bit BIN 100 items of data
40
2. 16bit HEX 40 items of data
3. 32bit HEX read from file ABC
4. unsigned 16-bit
Example File name: ABC
BIN D1 D1 +29
40 30 items of data
5. unsigned 32-bit
30 items of data
BIN read from file ABC
30
6. signed 16-bit BIN
7. signed 32-bit BIN
9. Floating real
number
Example File name: ABC D1 D1 +39
100 characters of data NULL
40
40 characters of data
8. ASCII text + NULL read
40
string Example File name: ABC D1 D1 +29
30 characters of data NULL
30
30 characters of data
+ NULL read
Item Content
EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts, and turns ON
Completion when read processing to the memory card ends.
D3
notification It becomes ON either when the command is normally finished, or abnormally
finished.
Error This device turns OFF when execution ends successfully, and turns ON
D3 +1 notification when execution ends in error.
Point • When the data to read is outside the specified format range, an error occurs, and
an error code is output to CM2390 to end read processing.
• During a CSV file read, when there are spaces, commas, or line feeds at the file
5 index positions after the data is read, the file index to be output to the result data
becomes the data position following the comma or line feed. (Reading of the
space, comma or line feed at the end of the data is skipped.)
Storage Device Instructions
• During a CSV file read, reading of empty fields (e.g. sections with continuous
commas ",") is skipped, and data is not stored. The data to be read next is stored
to the next storage location (not skipped storage location). During this operation,
skipped data is counted as the number of data.
• The result of END processing after execution of the instruction is completed is
written for the read position, number of read data, completion notification, and
error notification.
• When a text string contains two continuous double quotation marks ("), the
double quotation marks are read as a single character.
• Individual double quotation marks in a text string (including before and after the text
string) are ignored.
Example "12" "AB" "345" 12" AB" 345(NULL)
• File names are automatically appended with an extension according to the read
format setting.
• Several scans are sometimes required for reading to the device. During
execution of the MREAD instruction, data values read from the memory card are
written in order to the start of the specified storage location.
For this reason, do not read data in a range processed by the MREAD instruction
before the completion notification turns ON.
The portion of data in some cases may not be reflected. To prevent this, please
implement exclusive control by using the completion notification D3 or
CR3214 (Storage instruction executing).
• When CR3214 is ON during the execution of storage device instructions, MREAD
command can not be executed. Therefore, it is necessary to implement exclusive
control by using CR3214 as follows.
D2 D3
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
On in the following cases; OFF in other cases.
• When the text string specified by S does not contain the end code (NULL)
• When the text string specified by S exceeds 247 characters (including NULL)
• When a timer/counter is specified in S by indirect specification
• When a bit other than the start of the channel is specified when bit data is specified for S ,
CR2012 D1 and D2
• When a value outside of the range is specified to a parameter
• When a value is specified for reservation of a parameter
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
5
* The instruction is not executed when CR2012 turns ON.
Sample Program
When R1000 turns ON, the data (100 items) in the file "DATA.CSV" under the folder* "ABC" in the
memory card is read, and is stored to data memories DM1000 to DM1099.
ON is output to R500 after reading ends.
KV-8000/7500/7300
Description of Operation
MFREE Free space in the storage is stored in bytes to [ D1 / D1 +1] at the rising edge of the
execution condition.
EXTENDED INSTRUCTIONS
The completion notification is written to D2 , and the error notification for an abnormal
end is written to [ D2 +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Example D1 +1 D1
Remaining capacity
Storage 32-bit BIN data
Scan
5
Execution condition
OFF
Capture process
ON
End notice( D2 )
OFF
Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D2 ON when acquisition of free space on the storage device ends. The device
notification
turns ON whichever way execution ends, successfully or in error.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.
Point • The result of END processing after execution of the instruction is completed is
written for the completion notification and error notification.
• Several scans are sometimes required for acquiring free space.
• The get free space sometimes differs from the actual free space when file
operations were being performed via an FTP server function during acquisition
processing or the logging function was being used.
• While the storage device instructions is in execution, MFREE command can not
be executed while the CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
RXXXXX CR3214 MFREE
D1 D2
Operation flag
Sample Program
When R1000 turns ON, the free space in the memory card is retrieved in bytes and stored in data
memory [DM1000/DM1001].
MEMO
EXTENDED INSTRUCTIONS
5
MMKDIR
MMKDIR Creating storage Creates a folder in the memory
folder card (CPU memory).
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.
Description of Operation
MMKDIR The folder specified by S in the storage device is made at the rising edge of the
execution condition.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
EXTENDED INSTRUCTIONS
Device Device
Example
of folder Folder A
Folder A
structure
Folder A
When a folder already exists, nothing Prepare a new folder (folder A) in advance. It
Note happens, processing ends successfully, and cannot be prepared together with folder B.
the completion notification relay turns ON.
5
Scan
ON
Execution condition
Capture process
ON
End notice( D )
OFF
ON
CR3214
(Storage instruction executing) OFF
Item Content
Turns OFF when execution of the instruction starts, and turns ON when the
Completion folder has finished being made.
D
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.
Point • Several scans are sometimes required for making the folder.
• The result of END processing after execution of the instruction is completed is
written for the notification bit.
• The storage location when indirect specification or index modification is
specified to the notification bit data becomes the storage location at the rising
edge of the execution condition.
• While the storage device instructions is in execution, MMKDIR command can not
be executed while the CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
RXXXXX CR3214 MMKDIR
S D
Operation flag
Sample Program
The folder currently stored to data memory DM1000 is made each time that R1000 turns ON.
If the folder already exists, the folder is not made and processing is completed. The folder is output
toR500 after processing is completed.
(Mnemonics list)
CR2008 R1004
RES ① LD CR2008
1 scan ON RES R1004
R1000 R1004 LD R1000
MMKDIR ANB R1004
DM1000 R1004 ②
MMKDIR DM1000 R1004
LD R1004
R1004 R500 R1004 SET R500
SET RES ③ CON
RES R1004
MEMO
EXTENDED INSTRUCTIONS
5
MRMDIR
MRMDIR Delete storage Deletes the specified folder in the
folder memory card (CPU memory).
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.
Description of Operation
MRMDIR The folder specified by S in the storage device is deleted at the rising edge of the
execution condition.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
• ON when the text string specified by S does not contain the end code "NULL"
• ON when the text string including end code exceeds 247 characters
• ON when the relay specified in S is not Timer, Counter, or start of the channel
CR2012 • ON when the indirect specification or index modify range is inappropriate.
• When an access outside the operand range occurs
Otherwise, OFF
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
5
For more information, please refer to "Logging/Tracing" in the User's Manual of the CPU unit used.
MDEL
MDEL Delete storage Deletes the specified file in the
file memory card (CPU memory).
Description of Operation
MDEL The file specified by S in the storage device is deleted at the rising edge of the
execution condition.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
• ON when the text string specified by S does not contain the end code "NULL"
• ON when the text string including end code exceeds 247 characters
• ON when the relay specified in S is not Timer, Counter, or start of the channel
CR2012 • ON when the indirect specification or index modify range is inappropriate.
• When an access outside the operand range occurs
Otherwise, OFF
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
5
For more information, please refer to "Logging/Tracing" in the User's Manual of the CPU unit used.
S1 S2 D M P R I N T S1 S2 D
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/
3000Series CPU units with CPU function version 2.0 or higher and with KV-
NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
• To include a folder name in the file name, the folder must be created beforehand.
• When designating storage with the KV-8000/7000 series, it can be executed
without "\" (backslash).
Description of Operation
MPRINT The text string in the storage device specified with S2 is written to the end of the file
specified with at the rising edge of the execution condition.
EXTENDED INSTRUCTIONS
S1
If the file specified with S1 is not found, a new file will be created.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Example
To write one line of new product data in
Storage "Product information.TXT" in the storage device
5
Device
"Product information.TXT" before instruction is executed "Product information.TXT" after instruction is executed
* To put entries on new lines as in the example above, the CR+LF new line code
must be entered at the end of the line.
Input CR/LF using the CHR instruction to enterCHR(H0D)/CHR(H0A).
Point • The completion notification and error notification are written as the result of the
END process when execution of the instruction is completed.
• If CR3214 is ON when another storage device instruction is being executed, the
MPRINT instruction cannot be executed. Therefore, the implementation of
exclusive control is necessary by using CR3214 as follows.
Example
RXXXXX CR3214 MPRINT
S1 S2 n
Scan
ON
Execution Condition
OFF
Write process
ON
CR3214
(Storage instruction executing)
OFF
* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is
OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/retrieval
processing time.
S1 setting
Specify the name of the file storing the data with 1 to 247 characters (including end code NULL (00H)
and folder name).
EXTENDED INSTRUCTIONS
File
Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D ON when write processing to the storage device ends. It becomes ON either
notification
when the command is normally finished, or abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.
Operation flag
Sample Program
When the internal relay MR000 turns ON, the text string stored in data memory from DM0 is writtenonto
the end of the "Product Information.TXT" file in the storage device. R500 turns ON if a write erroroccurs.
EXTENDED INSTRUCTIONS
(Mnemonics list)
MR000 MPRINT
"Product LDP MR000
DM0 MR100
Information.TXT"
MPRINT "Product Information.TXT" DM0 MR100
LD MR100
MR100 MR101 R500 AND MR101
SET SET R500
Memory
Card
Text string stored in data memory from DM0
Point To put entries on new lines as in the example above, the CR+LF new line code must
be entered at the end of the line.
Input CR/LF using the CHR instruction to enter CHR(H0D)/CHR(H0A).
S D1 D2 D3 M R E A D L S D1 D2 D3
5 *1
D3 Specifies the storage location for the notification bit.*4
*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters: ASCII code (1 byte)
2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 4 continuous bits are occupied. When word data is specified, the LSB
of 4 continuous words is used as notification bit data. Bits other than LSB do not change.
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/
3000Series CPU units with CPU function version 2.0 or higher and with KV-
NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
Description of Operation
MREADL At the rising edge of the execution condition, 1 line of data is read from the position of
[ D2 / D2 +1] bytes in the file specified by , and stored starting with .
EXTENDED INSTRUCTIONS
S D1
If there is no line feed code (CR(0DH), LF(0AH), CR+LF) in the read data, [ D2 +2]
bytes are read and [ D3 +3] is turned ON.
The completion notification is written in D3 . If the process ends abnormally, an error
notification is written in [ D3 +1]. If the read data contains EOF, [ D3 +2] turns ON.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Scan
5
ON
Execution Condition
OFF
( D2・D2 +1)
Read position
ON
CR3214
(Storage instruction executing) OFF
* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is
OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/access
processing time.
S setting
Specify the name of the file to read from the storage device in the range of 1 to 247 characters(including
end code NUL (00H) and folder name).
EXTENDED INSTRUCTIONS
File
File index・・・・・・・・・・・・・Position limited in one byte unit from leading data of stored file
1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
TEST1.TXT (31H)(2CH)(31H)(32H)(2CH)(31H)(32H)(33H)(2CH)(31H)(32H)(33H)(34H)(2CH)(31H)(32H)(33H)(34H)(35H)(2CH)
The data from the position specified with [ D2 / D2 +1] to the line feed position is read out.
After the reading from the storage device is finished, the position counting from the start of the file to the
end of the newly read data is stored in the read position ([ D2 / D2 +1]). When reading is performed
again in this state, the next data will be read.
The position to be read out can be specified in 8-bit unit (1-byte unit).
EXTENDED INSTRUCTIONS
D2 +4] D2 +4]
Read from the position at the start of the file.
Example File name: ABC.TXT
$0 Text string to read out CR(0DH) $8
$0
Sets "0".
Item Content
EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts, and turns
Completion ON when read processing to the memory card ends.
D3
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D3 +1 notification when execution ends in error.
After one line is read in, the system judges whether the file end has been
File end
D3 +2 reached. This device turns ON if the file end is reached, and turns OFF if the
notification
file end is not reached.
No line return This device turns ON if there is no line return code within the read upper limit
D3 +3
code notification bytes, and turns OFF if there is a line return code.
5
Point • The result of END processing after execution of the instruction is completed is
Storage Device Instructions
Operation flag
Sample Program
When the internal relay MR000 turns ON, the data from byte 10 of the file "DATA.csv" in the memory
card to the line feed position is read, and stored in data memory from DM0. R500 turns ON when a
EXTENDED INSTRUCTIONS
read error occurs.
5
AND MR101
SET R500
*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters: ASCII code (1 byte)
2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of 2 continuous words is used as notification bit data. Bits other than LSB do not change.
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
• To include a folder name in the file name, the folder must be created beforehand.
Description of Operation
MCOPY At the rising edge of the execution condition, the file specified with S1 is copied to
following the parameters specified in .
EXTENDED INSTRUCTIONS
S2 S3
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Example Specify the copy source file name and copy destination file name in the range of 1 to
247characters (including end code NUL (00H) and folder name).
Folder name:ABC
File name: DATA.csv Folder name:XYZ File name: TEST.csv 5
DM0 A(41H) B(42H) DM0 X(58H) Y(59H)
<MCOPY execution>
When migrating to a different storage (Only KV-8000/7500/7300 can be used)
Folder name:ABC
<MCOPY execution>
* When migrating to a different storage, you can choose to migrate files and subfolders
inside the folder all together by designating the folder.
Scan
ON
Execution Condition
OFF
EXTENDED INSTRUCTIONS
Copy process
ON
End notice
( D )
OFF
ON
CR3214
(Storage instruction executing)
OFF
Point • If a folder is specified in S1 , all files directly under the S1 folder are copied
Storage Device Instructions
Item Content
EXTENDED INSTRUCTIONS
The device turn OFF when the instruction execution starts, and turns ON
Completion when change is completed.
D
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.
Example
RXXXXX CR3214 MCOPY
S1 S2 S3 D
Operation flag
Sample Program
When the internal relay MR000 turns ON, the file "DATA.csv" in the folder "ABC" in the memory card is
copied into the folder "XYZ" with the file name "TEST.csv". If a file already exists, it is overwritten.
EXTENDED INSTRUCTIONS
(Mnemonics list)
MR000 SMOV LDP MR000
"ABC¥DATA.csv" DM0
SMOV "ABC\DATA.csv" DM0
SMOV "XYZ\TEST.csv" DM100
SMOV MCOPY DM0 DM100 #0 MR100
"XYZ¥TEST.csv" DM100 LD MR100
AND MR101
SET R500
MCOPY
DM0 DM100 #0 MR100
Copied file
MEMO
EXTENDED INSTRUCTIONS
5
5
Specifies parameters related to the file move format or storage
S3 16 bits
location.*1
D Specifies the storage location for the notification bit.*4 1 bit ×2
Storage Device Instructions
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
• To include a folder name in the file name, the folder must be created beforehand.
Description of Operation
MMOV At the rising edge of the execution condition, the file specified with S1 in the storage
device is moved to following the parameters specified in .
EXTENDED INSTRUCTIONS
S2 S3
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Example Specify the move source file name and move destination file name in the range of 1 to247
characters (including end code NUL (00H) and folder name).
Folder name:ABC File name: DATA.csv Folder name:XYZ File name: TEST.csv 5
DM0 A(41H) B(42H) DM0 X(58H) Y(59H)
<MMOV execution>
When moving to a different storage (Only KV-8000/7500/7300 can be used)
Folder name:ABC
Folder name:DEF
<MMOV execution>
* When moving to a different storage, you can choose to move files and subfolders
inside the folder all together by designating the folder.
Scan
ON
Execution Condition
OFF
EXTENDED INSTRUCTIONS
Move process
ON
End notice
( D )
OFF
ON
CR3214
(Storage instruction executing)
OFF
Point • If a folder is specified in S1 , all files directly under the S1 folder are moved
Storage Device Instructions
Item Content
EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts, and turns
Completion ON when moving ends.
D
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.
Example
RXXXXX CR3214 MMOV
S1 S2 S3 D
Operation flag
Sample Program
When the internal relay MR000 turns ON, the file "DATA.csv" in the folder "ABC" in the memory card is
moved to the folder "XYZ" with the file name "TEST.csv". If a file already exists, it is overwritten.
EXTENDED INSTRUCTIONS
(Mnemonics list)
MR000 SMOV LDP MR000
"ABC¥DATA.csv" DM0
SMOV "ABC\DATA.csv" DM0
SMOV "XYZ\TEST.csv" DM100
SMOV MMOV DM0 DM100 #0 MR100
"XYZ¥TEST.csv" DM100 LD MR100
AND MR101
SET R500
MMOV
DM0 DM100 #0 MR100
Moved file
MEMO
EXTENDED INSTRUCTIONS
5
5
name.
D Specifies the storage location for the notification bit.*4 1 bit ×2
*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters: ASCII code (1 byte)
2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of 2 continuous words is used as notification bit data. Bits other than LSB do not change.
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
Description of Operation
MREN At the rising edge of the execution condition, the file name specified with S1 is
changed to the file name specified with .
EXTENDED INSTRUCTIONS
S2
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions", page 5-154
Specify the folder name + file name to be changed and the file name after change in the
5
Example
range of 1 to 247 characters (including the end code NULL (00H)).
Specify the extension along with the file name.
<MREN execution>
Scan
ON
Execution Condition
OFF
Copy process
ON
End notice
( D )
OFF
ON
CR3214
(Storage instruction executing)
OFF
Item Content
EXTENDED INSTRUCTIONS
The device turn OFF when the instruction execution starts, and turns ON
Completion when change is completed.
D
notification It becomes ON either when the command is normallyfinished, or abnormally
finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.
Example
RXXXXX CR3214 MREN
S1 S2 D
Operation flag
Sample Program
When the internal relay MR000 turns ON, the file "DATA.csv" in the folder "ABC" in the memory card is
changed to "TEST.csv". R500turns ON if an error occurs.
EXTENDED INSTRUCTIONS
(Mnemonics list)
MR000 SMOV LDP MR000
"ABC¥DATA.csv" DM0
SMOV "ABC\DATA.csv" DM0
MREN DM0 "TEST.csv" MR100
MREN LD MR100
DM0 “TEST.csv” MR100 AND MR101
SET R500
MR100 MR101 R500
SET
KV-8000/7500/7300
KV-5500/5000/3000 KV Nano
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• To get the free space in kilobytes, use the MFREEK instruction.
"MFREE instruction", page 5-176
Description of Operation
MFREEK Free space in the storage is stored in bytes to [ D1 / D1 +1] at the rising edge of the
execution condition.
EXTENDED INSTRUCTIONS
The completion notification is written to D2 , and the error notification for an abnormal
end is written to [ D2 +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Example D1 +1 D1
Free space
Storage 32-bit BIN data
Device
5
Scan
ON
Execution Condition
OFF
Capture process
ON
End notice
( D2 )
OFF
Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D2 ON when acquisition of free space on the storage device ends. The device
notification
turns ON whichever way execution ends, successfully or in error.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.
Point • The result of END processing after execution of the instruction is completed is
written for the completion notification and error notification.
• Several scans are sometimes required for acquiring free space.
• The get free space sometimes differs from the actual free space when file
operations were being performed via an FTP server function during acquisition
processing or the logging function was being used.
• The MFREEK instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
RXXXXX CR3214 MFREEK
D1 D2
Operation flag
5 KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Storage Device Instructions
Sample Program
When the internal relay MR000 turns ON, the free space in the memory card is stored in DM0, DM1.
R500turns ON if an error occurs.
(Mnemonics list)
MR000 MFREEK LDP MR000
DM0 MR100 MFREEK DM0 MR100
LD MR100
AND MR101
MR100 MR101 R500 SET R500
SET
DM1 DM0
Free space
Storage 32-bit BIN data
Device
MEMO
EXTENDED INSTRUCTIONS
5
S D1 D2 M S T A T S1 D1 D2
Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
Description of Operation
MSTAT At the rising edge of the execution condition, the status of the file in the storage device
specified with S is retrieved, and the results are stored in D1 to D1 +9.
The completion notification is written to D2 , and the error notification for an abnormal
end is written to [ D2 +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
Acquisition
result Details of retrieval
EXTENDED INSTRUCTIONS
storage
File attribute
5
5 ON when archive
6∼15 (Reserved: fixed to 0)
D1 +1 (Reserved)
Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion ON when completed.
D2
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.
D2 +2 Presence This device turns ON when the file or folder is present, and turns OFF when absent.
Operation flag
Sample Program
When the internal relay MR000 turns ON, the status of the file "DATA" in the folder "ABC" in the memory
card is retrieved and stored in data memory DM100 to DM109. R500turns ON if an error occurs.
(Mnemonics list)
MR000 SMOV LDP MR000
"ABC¥DATA.csv" DM0
SMOV "ABC\DATA.csv" DM0
MSTAT DM0 DM100 MR000
MSTAT LD MR100
DM0 DM100 MR000 AND MR101
SET R500
MR100 MR101 R500
SET
MEMO
EXTENDED INSTRUCTIONS
5
AWNUM
Display user message 1 in
AWNUM Display user message 1
access window.
Description of Operation
AWNUM When the execution condition turns from OFF to ON, the value of S is displayed as
user message 1 in the access window.
5 When the execution condition turns from ON to OFF, the display of user message 1 is
canceled.
Access Window Instructions
Reference For details on user message display, refer to "User's Information" in "KV-5500/5000/
3000 Series User's Manual", "2-12 User's Information" in "KV-1000 Series User's
Manual", or "4-11 Access Window" in "KV Nano Series (Terminal Block Type) User's
Manual".
Point • At the rising edge of execution condition, CR2900 is set; at the falling edge of
execution condition, CR2900 is reset. When the execution condition is ON, the
value specified in S is always copied to CM1720, and the result is rapidly
reflected to the access window.
• When the execution condition is ON, if the value of S is changed, the display
content of user message 1 is also changed.
• If the access window is operated, message display will be canceled even if the
execution condition is ON (CR2900 is reset at this time). In such case, it is
necessary to change the execution condition from OFF to ON in order to display
user message 1 again.
• When both user message 1 and user message 2 are ON, user message 1 is
displayed on a priority.
• When multiple AWNUM instructions exist in a project, the state of access window
is based on the last AWNUM instruction executed.
• This instruction cannot be used in interrupt programs or in the initialization
module.
• There is no access window in KV-NC32T. If the expansion access window
cassette is not connected with the KV-NC32T or KV Nano Series, an error does
not occur and nothing is executed. At this time, KV STUDIO will not generate a
conversion error.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when the indirect specification and index modify range is inappropriate.Otherwise, OFF. Does
CR2012
not change when indirect specification or index modify is not specified to the operand.
Sample Program 5
AWMSG
Display user message 2 in
AWMSG Display user message 2
access window.
*1 When a bit device has been specified in S , specify the start device of the channel.
*2 When ASCII strings are specified using constants, enclose with " ". # and $ cannot be used.
In addition, please input with less than DBC case 24 characters.
5 Description of Operation
AWMSG
Access Window Instructions
When the execution condition turns from OFF to ON, the string stored starting with S
is displayed as user message 2 in the access window.
When the execution condition turns from ON to OFF, the display of user message 2 is
canceled.
Reference For details on user message display, refer to "User's Information" in "KV-5500/5000/
3000 Series User's Manual", "2-12 User's Information" in "KV-1000 Series User's
Manual", or "4-11 Access Window" in "KV Nano Series (Terminal Block Type) User's
Manual".
Point • At the rising edge of execution condition, CR2901 is set; at the falling edge of
execution condition, CR2901 is reset. When the execution condition is ON, the
string stored starting with S is always copied to CM1721 to CM1737, and the
result is reflected immediately to the access window.
• When the execution condition is ON, if the text string currently stored starting
from S is changed, the display content of user message 2 is also changed.
• If the access window is operated, message display will be canceled even if the
execution condition is ON (CR2901 is reset at this time). In such case, it is
necessary to change the execution condition from OFF to ON in order to display
user message again.
• When both user message 1 and user message 2 are ON, user message 1 is
displayed on a priority.
• When multiple AWMSG instructions exist in a project, the state of access window
is based on the last AWMSG instruction executed.
• Character strings that can be displayed in the access window are only 1-byte
characters (ASCII codes 20h to 7Eh, A1h to DFh) up to 24 characters from the
start of the character string stored starting with S .
2-byte characters such as Chinese characters cannot be displayed.
• This instruction cannot be used in interrupt programs or in the initialization
module.
• There is no access window in KV-NC32T. If the expansion access window
cassette is not connected with the KV-NC32T or KV Nano Series, an error does
not occur and nothing is executed. At this time, KV STUDIO will not generate a
conversion error.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When the range of S is inappropriate
CR2012 • When a bit other than the start of the channel is specified when bit data is specified for S
• When a timer/counter is specified in S by indirect specification
• When the indirect specification and index modify range is inappropriate
AWSHOW
Display user message in
AWSHOW Display user message
access window.
Description of Operation
AWSHOW The user message with the ID specified in S is displayed in the access window at the
rising edge of the execution condition.
To turn the user message OFF, operate the access window, execute the AWHIDE
For more details about user message display, refer to "User Messages" in the User's
Reference
Access Window Instructions
Point • When the execution condition is ON, no changes will be made even if the S
value is changed.
• CR that supports the user message with the ID specified at the rising edge of the
execution conditions is set.
• When AWSHOW instruction and AWHIDE instruction are executed simultaneously,
priority will be given to the instruction that was executed afterwards within the
ladder program.
• If there are several AWSHOW instructions in a project, the access window
follows the first executed AWSHOW instruction.
• This instruction cannot be used in interrupt programs or in the initialization
module.
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
CR2012 • When the S value is outside the range of 1 to 63
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
Sample Program 5
AWHIDE
Hide the user message being
AWHIDE Hide user message
displayed in access window.
Description of Operation
AWHIDE The user message with the ID specified in S is hidden at the rising edge of the
execution condition.
Reference For more details about user message display, refer to "User Messages" in the User's
5 Manual of the CPU unit used.
Access Window Instructions
Point • When the execution condition is ON, no changes will be made even if the S
value is changed.
• CR that supports the user message with the ID specified at the rising edge of the
execution conditions is reset.
• When AWSHOW instruction and AWHIDE instruction are executed simultaneously,
priority will be given to the instruction that was executed afterwards within the
ladder program.
• This instruction cannot be used in interrupt programs or in the initialization
module.
Operation flag
Sample Program
When relay R1000 turns ON, the ID1 user message being displayed in the access window is hidden.
EXTENDED INSTRUCTIONS
(Mnemonics list)
R1000 AWHIDE
#1 LD R1000
AWHIDE #1
RFSFRC
R F S F R C
Description of Operation
RFSFRC Free operation counter is updated to the latest value when the execution condition is ON.
The updated free operation counter values are as follows.
KV-8000/7500/7300 CM1030 to CM1031: 1 ms counter
CM1032 to CM1033: 10 μs counter
5
CM1034 to CM1035: 1 μs counter
CM1036 to CM1037: 0.1 μs counter
KV-5500/5000/3000, KV Nano CM708 to CM709: 1 ms counter
Free Operation Counter Instruction
Operation flag
Sample Program
When using KV-8000, the transit time between two points is calculated using the latest value of the free
operation counter.
(Mnemonics list)
DR34000 RFSFRC
LD DR34000
Pass point 1 OR DR34001
RFSFRC
DR34001 LD DR34000
MOV.L CM1030 DM0
Pass point 2 LD DR34001
CAL-.L CM1030 DM0 DM2
DR34000 MOV.L
CM1030 DM0
Pass point 1
Free running counter Passing time
(1ms)
DR34001
- .L CM1030 DM0 DM2
Pass point 2
Free running counter Passing time Passing time
(1ms) at point 1
MEMO
EXTENDED INSTRUCTIONS
5
n4 D
n4 D
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4
Description of Operation
SPRD At the rising edge of execution condition, the parameter specified with n4 for the
sensor with node address n2 and slot number n3 connected to the n1 unit is
read. When completed, the completion bit is stored in bit 0 of D , the execution failed
bit in bit 1 of D , the completion code in D + 1, the detailed completion code in
D + 2, the number of array elements (1 when not an array) in D +3, and the
contents of the read parameter in D +4 onwards.
EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts,
Completion and turns ON when reading of the parameters is completed.
Bit 0
bit Turns ON regardless of whether the instruction ends normally
or abnormally.
D If execution of the instruction fails, this device turns ON
Execution
Bit 1 simultaneously with the completion bit.
failed bit
This device turns OFF when execution of the instruction starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code is stored when reading of the parameters
D +1 Completion code
is completed. (Normally 0)
Point The execution will fail if an "Ethernet/IP device reserved" sensor is specified.
ON
Execution condition
OFF
ON
1 bit of D
OFF
ON
0 bit of D
OFF
Number of
Number of sensor setting executions
instruction executions (unit)
(CM1650)
D +1 0 when successful At failure
If the sensor parameter read instruction is executed at the rising edge of the execution conditions, the
process will continue even if the input conditions are turned OFF at the next scan.
The completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.
When the instruction is executed, the number of sensor setting instruction executions is incremented by
1, and is decremented when the execution finishes.
If 16 sensor setting instructions have already been executed, the sensor setting instruction will not be
executed even if the execution conditions turn ON. The next sensor setting instruction can be executed
after the number of executed sensor setting instructions drops below 16.
Scan
EXTENDED INSTRUCTIONS
ON
Execution condition
OFF
Operation flag
Sample Program
An example for reading the current incoming light amount (parameter No. 805) of the FS-N series
connected to the Keyence EtherNet/IP communication adaptor NU-EP1 is explained below.
EXTENDED INSTRUCTIONS
When the input relay MR000 turns ON, the contents of parameter No. 805 (current incoming light
amount) for the node address 1, slot No. 1 sensor connected to the unit No. 1 KV-EP21V are read out
and stored in DM0 and following.
(Mnemonics list)
MR000 SPRD
#1 #1 #1 LD MR000
SPRD #1 #1 #1 #805 DM0
LDP DM0.0
MPS
ANB DM0.1
#805 DM0 MOV DM3 DM100
MOV DM4 DM102
MRD
5
AND DM0.1
MOV
DM4 DM102
Setting value
DM0.1 MOV
DM1 EM0
Execution failed bit
Completion code
MR000
RES
Reference By using the optional RT EDIT SETTING when directly inputting the SPRD instruction
(read sensor parameter) with <KV STUDIO>, the parameter No. and name will appear in
the candidate display, facilitating the selection from the menu.
Sensor
SPWR SPWR Writes the specified sensor
parameter
parameters.
write
n1 n2 n3 S P W R
n4 D
n4 D
5 n4
D
Specifies the parameter number or its storage location.
Specifies the result storage location.*2
16 bits
16 bits × 4*3
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4
Description of Operation
SPWR At the rising edge of execution condition, the setting values set with D +4 onward are
written into the parameter specified with n4 for the sensor with node address n2
and slot number n3 connected to the n1 unit. When completed, the completion bit
is stored in bit 0 of D , the execution failed bit in bit 1 of D , the completion code in
D +1, and the detailed completion code in D +2.
EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts,
Completion and turns ON when writing of the parameters is completed.
Bit 0
bit Turns ON regardless of whether the instruction ends normally
or abnormally.
D If execution of the instruction fails, this device turns ON
Execution
Bit 1 simultaneously with the completion bit.
failed bit
This device turns OFF when execution of the instruction starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code when parameter writing is completed is
D +1 Completion code
stored. (Normally 0)
Point The execution will fail if an "Ethernet/IP device reserved" sensor (adaptor) is
specified.
ON
Execution condition
OFF
ON
1 bit of D
OFF
ON
0 bit of D
OFF
Number of
Number of sensor setting executions
instruction executions (unit)
(CM1650)
If the sensor parameter read instruction is executed at the rising edge of the execution conditions, the
process will continue even if the input conditions are turned OFF at the next scan.
The completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.
When the instruction is executed, the number of sensor setting instruction executions is incremented by
1, and is decremented when the execution finishes.
If 16 sensor setting instructions have already been executed, the sensor setting instruction will not be
executed even if the execution conditions turn ON. The next sensor setting instruction can be executed
after the number of executed sensor setting instructions drops below 16.
EXTENDED INSTRUCTIONS
Scan
ON
Execution condition
OFF
Operation flag
Sample Program
An example for changing the setting values (parameter No. 833) of the FS-N series connected to the
Keyence EtherNet/IP communication adaptor NU-EP1 is explained below.
EXTENDED INSTRUCTIONS
When the input relay MR0 turns ON, the setting value 500 specified with DM4 and following is written to
parameter No. 833 (setting value) of the node address 1, slot No. 1 sensor connected to the unit No.1
KV-EP21V. The results are stored in DM0 and following.
(Mnemonics list)
MR000 MOV
#500 DM4 LD MR000
MOV #500 DM4
Setting value SPWR #1 #1 #1 #833 DM0
LDP DM0.0
SPWR MPS
#1 #1 #1
ANB DM0.1
OUT R500
MRD
5
AND DM0.1
DM0.1 MOV
DM1 EM0
Execution failed bit
Completion code
MR000
RES
Reference By using the optional RT EDIT SETTING when directly inputting the SPWR instruction
(read sensor parameter) with <KV STUDIO>, the parameter No. and name will appear in
the candidate display, facilitating the selection from the menu.
n4 D
n4 D
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4
Description of Operation
SSVC At the rising edge of execution condition, the service specified with n4 for the sensor
with node address n2 and slot number n3 connected to the n1 unit is
executed. When completed, the completion bit is stored in bit 0 of D , the execution
failed bit in bit 1 of D , the completion code in D +1, and the detailed completion
code in D +2.
EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts,
Completion
Bit 0 Turns ON regardless of whether the instruction ends normally
bit
or abnormally.
If execution of the instruction fails, this device turns ON
D Execution
Bit 1 simultaneously with the completion bit.
failed bit
This device turns OFF when execution of the instruction starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code is stored when execution of the service is
D +1 Completion code
completed. (Normally 0)
5
The detailed completion code is stored when execution of the
D +2 Detailed completion code
service is completed.
D +3 Reserved for system 0 (Fixed value)
Point The execution will fail if an "Ethernet/IP device reserved" sensor is specified.
ON
Execution condition
OFF
ON
1 bit of D
OFF
ON
0 bit of D OFF
Number of
Number of sensor setting executions
instruction executions (unit)
(CM1650)
The sensor service execution instruction is executed at the rising edge of the execution
conditions.Theprocess continue seven if the input conditions are OFF at the net scan.
When the instruction is executed, the number of sensor setting instruction executions is incrementedby
1, and is decremented when the execution finishes.
The completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.
If 16 sensor setting instructions have already been executed, the sensor setting instruction will not be
executed even if the execution conditions turn ON. The next sensor setting instruction can be executed
after the number of executed sensor setting instructions drops below 16.
EXTENDED INSTRUCTIONS
Scan
ON
Execution condition
OFF
Operation flag
Sample Program
An example for using the zero shift execution (service No. 11) service of the FS-N series connected to
the Keyence EtherNet/IP communication adaptor NU-EP1 is explained below.
EXTENDED INSTRUCTIONS
When the input relay MR0 turns ON, the service No. 11 (zero shift execution) service of the node
address 1, slot No. 1 sensor connected to the unit No. 1 KV-EP21V is executed. The results are stored
in DM0 and following.
(Mnemonics list)
MR000 SSVC
#1 #1 #1 LD MR000
SSVC #1 #1 #1 #11 DM0
LDP DM0.0
MPS
ANB DM0.1
#11 DM0
Results storage
OUT R500
MRD
AND DM0.1
5
device MOV DM1 EM0
DM0.1 MOV
DM1 EM0
Execution failed bit
Completion code
MR000
RES
Reference By using the optional RT EDIT SETTING when directly inputting the SSVC instruction
(read sensor parameter) with <KV STUDIO>, the parameter No. and name will appear in
the candidate display, facilitating the selection from the menu.
RFSCI(.U)
RFSCI.S
RFSCI RFSCI.D
RFSCI.L
RFSCI
RFSCI.F
Refresh cyclic Refreshes the cyclic
communication communication input
@RFSCI(.U) input data.
EXTENDED INSTRUCTIONS
@RFSCI.S
@RFSCI @RFSCI.D
@RFSCI.L
RFSCI
@RFSCI.F
5
Execution condition RFSCI
D n @ R F S C I D n
Specifies the start for refreshing the cyclic communication input .U .S 16 bits× n
D
data.* 1*2 .D .L .F 32 bits× n
n Specifies the number of data items to refresh.* 3 —
*1 Only R, B, DM, W and the variables and labels assigned to them can be specified.
*2 When specifying bit data, specify the start of the channel.
*3 Only constants and variables / labels set as constants can be specified.
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4
Description of Operation
RFSCI(.U) When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the unsigned 16-bit BIN data assigned to D .
RFSCI.S When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the signed 16-bit BIN data assigned to D .
KV-EP21V
CPU unit Cyclic communication data
DM100 Leading word
DM101 Leading word+1
DM102 Leading word+2
DM103 Leading word+3
DM104 Leading word+4
Refresh data in Leading word+5
DM105
specified range.
RFSCI.D When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the unsigned 32-bit BIN data assigned to [ D / D +1].
RFSCI.L When the execution condition is ON, the cyclic communication input data specified by
EXTENDED INSTRUCTIONS
n is refreshed from the signed 32-bit BIN data assigned to [ D / D +1].
KV-EP21V
CPU unit Cyclic communication data
DM101 DM100 Leading word+1 Leading word
DM103 DM102 Leading word+3 Leading word+2
DM105 DM104 Leading word+5 Leading word+4
5
DM107 DM106 Leading word+7 Leading word+6
DM109 DM108 Leading word+9 Leading word+8
DM111 DM110 Leading word+11 Leading word+10
RFSCI.F When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the single precision floating point type real number assigned to
[ D / D +1].
Area 1 Connection 1
Range specified with
refresh instruction code
Area 2 Connection 2
5
• If there are devices / variables which have not been assigned to the cyclic
Cyclic Communication Refresh Instruction
communication data are found in the range specified with the operand, only the
devices / variables assigned to the connection will be refreshed.
EtherNet/IP unit
CPU unit
Cyclic communication data
Area 1 Connection 1
Area 2 Connection 2
@RFSCI.□ Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When cyclic communication is normal, ten words of cyclic communication input data assigned after
data memory DM100 is refreshed.
(Mnemonics list)
RFSCI
DM10260.0
DM100 #10 LD DM10260.0
RFSCI DM100 #10
Normal node 1
MEMO
EXTENDED INSTRUCTIONS
5
RFSCO(.U)
RFSCO.S
RFSCO RFSCO.D
RFSCO.L
RFSCO
Refreshes the
Refresh cyclic
RFSCO.F cyclic
communication
@RFSCO(.U) communication
output
@RFSCO.S output data.
@RFSCO
EXTENDED INSTRUCTIONS
RFSCO
@RFSCO.D
@RFSCO.L
@RFSCO.F
*1 Only R, B, DM, W and the variables and labels assigned to them can be specified.
*2 When specifying bit data, specify the start of the channel.
*3 Only constants and variables / labels set as constants can be specified.
Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4
Description of Operation
RFSCO(.U) When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the unsigned 16-bit BIN data assigned to S .
RFSCO.S When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the signed 16-bit BIN data assigned to S .
KV-EP21V
CPU unit
Cyclic communication data
DM100 Leading word
DM101 Leading word+1
DM102 Leading word+2
DM103 Leading word+3
DM104 Leading word+4
Refresh data in Leading word+5
DM105
specified range.
RFSCO.D When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the unsigned 32-bit BIN data assigned to [ S / S +1].
RFSCO.L When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the signed 32-bit BIN data assigned to [ S / S +1].
EXTENDED INSTRUCTIONS
DM102 #3
Refresh data in
specified range.
5
Area 1 Connection 1
Range specified with
refresh instruction code
Area 2 Connection 2
• If there are devices / variables which have not been assigned to the cyclic
communication data are found in the range specified with the operand, only the
devices / variables assigned to the connection will be refreshed.
EtherNet/IP unit
CPU unit device
Cyclic communication data
Area 1 Connection 1
Area 2 Connection 2
@RFSCO.□Only one scan is executed at the rising edge of the execution conditions.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-249
Cyclic Communication Refresh Instruction
Operation flag
Sample Program
When cyclic communication is normal, ten words of cyclic communication output data assigned after
data memory DM100 is refreshed.
(Mnemonics list)
RFSCO
DM10260.0
5 Normal node 1
DM100 #10 LD DM10260.0
PSTA DM100 #10
Cyclic Communication Refresh Instruction
APPENDICES
This chapter describes instruction execution time, character code table
(ASCII), control relay/control memory table and instruction index, etc.
4-40
APPENDICES
SUB.U
16-bit 16-bit
SUB.S internal register - S = internal register
4-44
SUB.D 32-bit internal register - S+1 S = 32-bit internal register
SUB.L Upper Lower Upper Lower Upper Lower
Arithmetic Operation Storage
ROOT.D
TM001 TM000 32-bit internal register = 32-bit internal register
ROOT.L Upper Lower Upper Lower
4-66
32-bit internal register 32-bit internal register
ROOT.F
Single precision floating point type real number Single precision floating point type real number
■ Add (ADD)
(1) Unsigned 16-bit BIN data + unsigned 16-bit BIN data = unsigned 16-bit BIN data
DM00000 + DM00001 = DM00010
(2) Signed 16-bit BIN data + signed 16-bit BIN data = signed 16-bit BIN data
APPENDICES
DM00000 + DM00001 = DM00010
(3) Unsigned 16-bit BIN data + unsigned 32-bit BIN data = unsigned 32-bit BIN data
DM00000 + [DM00002·DM00003] = [DM00010·DM00011]
(4) Signed 16-bit BIN data + signed 32-bit BIN data = signed 32-bit BIN data
DM00000 + [DM00002·DM00003] = [DM00010·DM00011]
(5) Unsigned 32-bit BIN data + unsigned 32-bit BIN data = unsigned 32-bit BIN data
[DM00000·DM00001] + [DM00002·DM00003] = [DM00010·DM00011]
(6) Signed 32-bit BIN data + signed 32-bit BIN data = signed 32-bit BIN data
[DM00000·DM00001] + [DM00002·DM00003] = [DM00010·DM00011]
■ Subtract (SUB)
(1) Unsigned 16-bit BIN data - unsigned 32-bit BIN data = unsigned 32-bit BIN data
DM00000 - DM00001 = DM00010
(2) Signed 16-bit BIN data - signed 32-bit BIN data = signed 16-bit BIN data
DM00000 - DM00001 = DM00010
(3) Unsigned 32-bit BIN data - unsigned 32-bit BIN data = unsigned 32-bit BIN data
[DM00000·DM00001] - DM00002 = [DM00010·DM00011]
(4) Signed 32-bit BIN data - signed 16-bit BIN data = signed 32-bit BIN data
[DM00000·DM00001] - DM00002 = [DM00010·DM00011]
(5) Unsigned 32-bit BIN data - unsigned 32-bit BIN data = unsigned 32-bit BIN data
[DM00000·DM00001] - [DM00002·DM00003] = [DM00010·DM00011]
(6) Signed 32-bit BIN data - signed 32-bit BIN data = signed 32-bit BIN data
[DM00000·DM00001] - [DM00002·DM00003] = [DM00010·DM00011]
■ Multiply (MUL)
(1) Unsigned 16-bit BIN data x unsigned 16-bit BIN data = unsigned 32-bit BIN data
DM00000 × DM00001 = [DM00010·DM00011]
(2) Signed 16-bit BIN data x signed 16-bit BIN data = signed 32-bit BIN data
DM00000 × DM00001 = [DM00010·DM00011]
APPENDICES
LDA.S MUL.S STA.L
(3) Unsigned 16-bit BIN data x unsigned 32-bit BIN data = unsigned 64-bit BIN data
DM00000 × [DM00002·DM00003] = [DM00010·DM00011·DM00012·DM00013]
(4) Signed 16-bit BIN data x signed 32-bit BIN data = signed 64-bit BIN data
DM00000 × [DM00002·DM00003] = [DM00010·DM00011·DM00012·DM00013]
TM000 DM00012
LDA.L STA.L
(5)Unsigned 32-bit BIN data x unsigned 32-bit BIN data = unsigned 64-bit BIN data
[DM00000·DM00001] × [DM00002·DM00003] = [DM00010·DM00011·DM00012·DM00013]
TM000 DM00012
LDA.D STA.D
(6) Signed 32-bit BIN data x signed 32-bit BIN data = signed 64-bit BIN data
[DM00000·DM00001] × [DM00002·DM00003] = [DM00010·DM00011·DM00012·DM00013]
TM000 DM00012
LDA.L STA.L
■ Divide (DIV)
(1) Unsigned 16-bit BIN data ÷ unsigned 16-bit BIN data = unsigned 16-bit BIN data
Remainder: unsigned 16-bit BIN data
DM00000 ÷ DM00001 = DM00010・・・ DM00020
TM001 DM00020
LDA STA
(2) Signed 16-bit BIN data ÷ signed 16-bit BIN data = signed 16-bit BIN data
APPENDICES
TM001 DM00020
LDA.S STA.S
Arithmetic Operation Storage
(3) Unsigned 32-bit BIN data ÷ unsigned 16-bit BIN data = unsigned 32-bit BIN data
Remainder: unsigned 16-bit BIN data
[DM00000·DM00001] ÷ DM00002 = [DM00010 x DM00011] ··· DM00020
TM001 DM00020
LDA STA
(4) Signed 32-bit BIN data ÷ signed 16-bit BIN data = signed 32-bit BIN data
Remainder: signed 16-bit BIN data
[DM00000·DM00001] ÷ DM00002 = [DM00010·DM00011] ··· DM00020
TM001 DM00020
LDA.S STA.S
(5) Unsigned 32-bit BIN data ÷ unsigned 32-bit BIN data = unsigned 32-bit BIN data
Remainder: unsigned 32-bit BIN data
[DM00000·DM00001] ÷ [DM00002·DM00003] = [DM00010·DM00011] ··· [DM00020·DM00021]
TM002 DM00020
LDA.D STA.D
(6) Unsigned 32-bit BIN data ÷ unsigned 32-bit BIN data = unsigned 32-bit BIN data
Remainder: unsigned 32-bit BIN data
[DM00000·DM00001] ÷ [DM00002·DM00003] = [DM00010·DM00011] ··· [DM00020·DM00021]
TM002 DM00020
LDA.L STA.L
(7) Unsigned 32-bit BIN data × unsigned 32-bit BIN data ÷ unsigned 32-bit BIN data
= unsigned 64-bit BIN data
APPENDICES
Remainder: unsigned 32-bit BIN data
[DM00000·DM00001] × [DM00002·DM00003] ÷ [DM00004·DM00005]
=[DM00010·DM00011·DM00012·DM00013] ··· [DM00020·DM00021]
(8) Signed 32-bit BIN data × signed 32-bit BIN data ÷ signed 32-bit BIN data = signed 64-bit BIN data
Remainder: signed 32-bit BIN data
[DM00000·DM00001] × [DM00002·DM00003] ÷ [DM00004·DM00005]
= [DM00010·DM00011·DM00012·DM00013] ··· [DM00020 x DM00021]
(6) Square root of double precision floating point type real number data
[DM00000·DM00001·DM00002·DM00003] = [DM00010·DM00011·DM00012·DM00013]
APPENDICES
KV Nano Series R, MR, LR, B, VB, TM
For the KV-8000/7000 Series, if one of the devices below is specified in S instead of
DM, the processing time differs.
Destination device Difference in processing time
R, MR, LR, B, VB, TM -0.002 (µs)
EM,FM,ZF,W,VM +0.041 (µs)
■ Operation error
When either of the settings is configured in "CPU system setting*" → "the action when an error occurs in setting ",
processing time increases when the instruction to detect the error (manipulate CR2012) is executed.
• "Calculation error " is assigned to " Continue (low level error)"
• "Keep in error log" is configured
APPENDICES
log" is configured. In these cases, CR2012 operates according to the specification for each instruction.
"KV Studio User's Manual "CPU system setting""
■ Direct I/O
KV-8000/7500/7300/5500/5000/3000, KV Nano Series For direct I/O, the standards of added processing time are
shown below.
Condition KV-8000 (μs) KV-7500/7300 (μs) KV-5500/5000/3000 (μs) KV Nano Series (μs)
Source 0.734 0.734 5.400 0.600
Destination 0.682 0.682 4.700 0.600
The processing time of the instructions is as follows. The processing time varies within ±30%.
Basic Instructions
APPENDICES
LD< .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.120 0.300 0.300
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 4.100
LD> .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 3.800
LD<= .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.120 0.300 0.160
APPENDICES
Execution condition is OFF 0.075 0.075 0.670 1.250 4.000
OFDL – Execution condition is ON 0.090 0.090 0.830 1.725 4.900
Execution condition is OFF 0.087 0.087 0.720 1.275 2.900
SHOT – Execution condition is ON 0.147 0.147 0.860 2.225 6.900
Execution condition is OFF 0.136 0.136 0.840 1.900 6.400
FLIK – Execution condition is ON 0.154 0.154 0.800 2.000 5.500
Execution condition is OFF 0.107 0.107 0.810 1.550 7.100
3.190
Applied Instructions
APPENDICES
ECALL – At the time of non-execution 0.021 0.021 0.090 – 0.240
At the time of execution 0.196 0.287 1.830 – 7.600
FOR to NEXT .U.D S =#1 0.150 0.150※1 1.770 2.875 3.900
S =#1000 43.213 43.213 352.000 700.000 260.500
BREAK – Execution condition is ON 0.161 0.161 0.520 0.750 3.600
Execution condition is OFF 0.023 0.023 0.060 0.075 0.480
CJ – At the time of non-execution 0.035 0.035 0.090 0.175 0.230
OFF
ADRINC – Execution condition is ON 0.029 0.029 0.090 0.225 1.400
Execution condition is OFF 0.021 0.021 0.070 0.225 0.100
ADRDEC – Execution condition is ON 0.029 0.029 0.090 0.225 1.700
Execution condition is OFF 0.021 0.021 0.070 0.225 0.100
ADRADD .S Execution condition is ON 0.040 0.040 0.100 0.350 1.900
Execution condition is OFF 0.035 0.035 0.100 0.300 0.240
Operation Processing Time Table
APPENDICES
1000 words (CPU Ethernet/ 125.631 125.631 400.000 – –
FL-net)
At the time of non-execution 0.021 0.021 0.070 – 0.290
UFILL .U.S.D.L.F 1 word (expansion unit) 1.155*2 1.155*2 7.300 – 31.000
1000 words (expansion unit) 36.272*2 36.272*2 375.000 – 424.000
1 word (CPU Ethernet/FL-net) 2.357 2.357 17.750 – –
1000 words (CPU Ethernet/ 68.098 68.098 116.380 – –
condition is OFF
Constant is specified 0.006 0.006 0.020 0.050 0.160
Constant is specified, Execution 0.006 0.006 0.020 0.050 0.150
condition is OFF
.F DM is specified 0.015 0.015 0.100 0.175 0.160
DM is specified, Execution 0.009 0.009 0.030 0.100 0.200
condition is OFF
Constant is specified 0.009 0.009 0.040 0.100 0.260
Constant is specified, Execution 0.009 0.009 0.020 0.050 0.240
condition is OFF
.DF DM is specified 0.029 0.029 0.280 – 1.200
DM is specified, Execution 0.026 0.026 0.130 – 0.210
condition is OFF
Constant is specified 0.029 0.029 0.180 – 1.000
Constant is specified, Execution 0.029 0.029 0.130 – 0.250
condition is OFF
STA .U.S Execution condition is ON 0.003 0.003 0.010 0.025 0.110
Execution condition is OFF 0.003 0.003 0.010 0.025 0.120
.D.L.F Execution condition is ON 0.003 0.003 0.010 0.025 0.030
Execution condition is OFF 0.003 0.003 0.010 0.025 0.130
.DF Execution condition is ON 0.035 0.035 0.250 – 0.770
Execution condition is OFF 0.029 0.029 0.180 – 0.390
PLDA .U Execution condition is ON 0.029 0.029 0.150 – 1.600
Execution condition is OFF 0.029 0.029 0.100 – 0.250
.D Execution condition is ON 0.032 0.032 0.160 – 1.600
Execution condition is OFF 0.032 0.032 0.110 – 0.250
PSTA .U Execution condition is ON 0.038 0.038 0.180 – 1.700
Execution condition is OFF 0.038 0.038 0.130 – 0.250
.D Execution condition is ON 0.041 0.041 0.190 – 2.000
Execution condition is OFF 0.041 0.041 0.140 – 0.250
TMIN – Execution condition is ON 0.023 0.023 0.130 0.250 −
Execution condition is OFF 0.018 0.018 0.060 0.175 −
APPENDICES
n =#1000 30.675 30.675 81.420 184.7 89.200
n =#1000, Execution 0.012 0.012 0.060 0.150 0.250
condition is OFF
.D n =#1 0.153 0.153 0.980 2.025 10.500
n =#1, Execution condition 0.012 0.012 0.060 0.150 0.250
is OFF
n =#1000 32.116 32.116 133.960 275.900 169.700
n =#1000, Execution 0.012 0.012 0.060 0.150 0.250
APPENDICES
S = Constant, Execution 0.107 0.107 0.370 0.925 0.290
condition is OFF
.DF S = Constant 0.136 0.136 2.860 – 2.800
S = Constant, Execution 0.133 0.133 0.050 – 0.390
condition is OFF
INC .U.S.D.L Execution condition is ON 0.026 0.026 0.130 0.250 0.380
Execution condition is OFF 0.018 0.018 0.060 0.200 0.190
DEC .U.S.D.L Execution condition is ON 0.026 0.026 0.130 0.250 0.290
APPENDICES
Execution condition is OFF 0.012 0.012 0.060 0.150 0.460
APPENDICES
Execution condition is OFF 0.084 0.084 0.290 0.725 1.200
TBIN .U Execution condition is ON 0.012 0.012 0.040 0.100 3.700
Execution condition is OFF 0.012 0.012 0.040 0.100 1.200
.D Execution condition is ON 0.023 0.023 0.080 0.200 4.200
Execution condition is OFF 0.023 0.023 0.080 0.200 1.200
MPX – Execution condition is ON 0.018 0.018 0.060 0.150 0.940
Execution condition is OFF 0.018 0.018 0.060 0.150 0.920
APPENDICES
Execution condition is OFF 0.006 0.006 0.020 – 0.150
FTODF – Execution condition is ON 0.098 0.098 0.680 – 3.900
Execution condition is OFF 0.006 0.006 0.020 – 0.150
DISF – Execution condition is ON 0.943 0.943 0.850 1.500 17.500
Execution condition is OFF 0.012 0.012 0.040 0.125 0.310
UNIF – Execution condition is ON 0.414 0.414 1.320 2.850 41.700
Execution condition is OFF 0.040 0.150
APPENDICES
n =#4, Execution condition is 0.021 0.021 0.070 0.200 0.260
OFF
.D n =#8 0.854 0.854 3.980 7.875 8.100
n =#8, Execution condition is 0.021 0.021 0.070 0.200 0.260
OFF
RHASC .U Execution condition is ON 0.480 0.480 2.630 5.125 11.300
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
.D Execution condition is ON 4.470 8.850
APPENDICES
Constant, Execution condition is
OFF
CAL– .U.S.D.L S1 =DM, S2 = Constant 0.021 0.021 0.110 – 0.990
S1 =DM, S2 = 0.012 0.012 0.040 – 0.300
Constant, Execution condition is
OFF
.F S1 =DM, S2 = Constant 0.044 0.044 0.180 – 2.300
S1 =DM, S2 = 0.041 0.041 0.130 – 0.260
Constant, Execution condition is
*1 The processing time is as follows when the CPU function version is 2.0 or lower.
UNIN instruction(.U / .D) :when the execution condition is OFF 0.018
UNIB instruction(.U / .D) :when the execution condition is OFF 0.018
RCOM instruction :when the execution condition is ON 0.025,
when the execution condition is OFF 0.029
CPSASC instruction :when the execution condition is OFF 0.009
Extended Instructions
APPENDICES
.D Execution condition is ON 0.076 0.076 0.610 1.000 2.400
Execution condition is OFF 0.015 0.015 0.050 0.150 0.110
BCNT .U Execution condition is ON 0.006 0.006 0.020 0.050 1.700
Execution condition is OFF 0.006 0.006 0.020 0.050 0.100
.D Execution condition is ON 0.012 0.012 0.040 0.100 2.200
Execution condition is OFF 0.012 0.012 0.040 0.100 0.100
DCNT .U n =#1 0.092 0.092 0.640 1.125 10.800
APPENDICES
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.F n =#1 0.119 0.119 – – –
n =#1000 51.796 51.796 – – –
Execution condition is OFF 0.012 0.012 – – –
.DF n =#1 0.139 0.139 – – –
n =#1000 60.431 60.431 – – –
Execution condition is OFF 0.012 0.012 – – –
APPENDICES
N (table length) =1000, insert 49.034 49.034 151.240 352.650 110.700
position: start
Execution condition is OFF 0.012 0.012 0.060 0.175 0.300
FDEL .U N (table length) =1 0.194 0.194 1.090 2.350 19.900
N (table length) =1000, delete 47.598 47.598 126.020 327.175 93.300
position: start
Execution condition is OFF 0.009 0.009 0.050 0.125 0.390
APPENDICES
FCNT – Execution condition is ON - - 0.760 1.475 4.700
Execution condition is OFF - - 0.590 1.400 4.400
RCNT – Execution condition is ON - - 1.260 1.950 10.700
Execution condition is OFF - - 1.010 1.875 6.100
PLSOUT – Execution condition is ON - - 0.670 1.025 4.500
Execution condition is OFF - - 0.540 0.950 3.900
MCMP – n =#1 0.411 0.411 2.020 3.900 21.100
condition
MPRINT – 1 character, Execution condition is 0.253 0.337 1.740 – 14.870
OFF
1 character, At the rising edge of 2.400 2.400 2.850 – 28.300
execution condition
1999 characters, Execution 0.256 0.256 136.410 – 147.230
condition is OFF
1999 characters, At the rising 31.138 31.138 138.870 – 160.580
edge of execution condition
MREADL – Execution condition is OFF 0.449 0.449 1.900 – 22.390
At the rising edge of execution 2.488 2.488 3.060 – 36.140
condition
MCOPY – Execution condition is OFF 0.271 0.305 1.310 – 15.590
At the rising edge of execution 2.700 2.700 3.630 – 31.240
condition
MMOV – Execution condition is OFF 0.271 0.305 1.310 – 15.470
At the rising edge of execution 2.650 2.650 3.630 – 31.230
condition
MREN – Execution condition is OFF 0.265 0.299 1.630 – 14.250
At the rising edge of execution 2.613 2.613 3.650 – 29.560
condition
MFREEK – Execution condition is OFF 0.216 0.216 0.990 – 8.600
At the rising edge of execution 2.063 2.063 1.120 – 18.150
condition
MSTAT – Execution condition is OFF 0.288 0.322 1.510 – 14.490
At the rising edge of execution 2.300 2.300 2.570 – 27.860
condition
AWNUM – At the rising edge of execution 0.560 1.100 5.400
- -
condition
Execution condition is OFF - - 0.490 1.225 5.100
AWMSG – 1 character, At the rising edge of 0.900 1.950 9.900
- -
execution condition
24 characters, At the rising edge of 2.810 6.625 11.800
- -
execution condition
Execution condition is OFF - - 0.860 1.725 6.600
A-40 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Operation Processing Time Table
APPENDICES
Execution condition is OFF 0.282 0.304 1.300 – 8.660
SSVC – Execution condition is ON 4.281 6.888 2.260 – 23.790
Execution condition is OFF 0.282 0.303 1.300 – 8.410
RFSFRC – Execution condition is ON 0.044 0.044 0.070 – 0.600
Execution condition is OFF 0.044 0.044 0.050 – 0.240
RFSCI .U.S.D.L. 1 word (expansion unit) 3.567 3.567 5.400 – 27.760
F
1 word (CPU Ethernet/IP) 3.818 3.818 12.900 – –
MEMO
APPENDICES
Operation Processing Time Table
Control relays (CR0000 - CR7915) can be used to perform operations such as checking the operation
status of the CPU unit and setting and monitoring the built-in functions.
Control relays reserved for the system cannot be used.
Attribute
CR R: Read only Function
Blank: Read/write
Logging and tracing execution (ON: enabled, OFF:
CR0000
disabled)
CR0001 R Logging or tracing operation in progress
CR0002 R Logging or tracing file writing completion
APPENDICES
CR0003 R Logging buffer less than 50% warning
CR0004 R Logging buffer overflow
CR0005 R Data to be written in RUN mode during logging present
CR0006 and
- Reserved for the system
CR0007 Logging or tracing function (ID0)
CR0008 R Logging or tracing error
CR0009 R Logging trace No memory space error
CR0010 R Logging or tracing device or trigger setting error
CR0011 R Tracing file save trigger monitor
CR/CM List
CR0012 R Tracing data capture completion
CR0013 R Logging or tracing setting to be written present
CR0014 and
- Reserved for the system
CR0015
CR0100 to
Logging or tracing function (ID1 to ID9)
CR0915
CR1000 to
Real-time chart monitor (ID10)
CR1015
CR1100 to
- Reserved for the system
CR2001
CR2002 R Always turned ON
CR2003 R Always turned OFF
CR2004 R 10 ms clock pulse (duty cycle: 50%)
CR2005 R 100 ms clock pulse (duty cycle: 50%)
CR2006 R 1 s clock pulse (duty cycle: 50%)
CR2007 R Turned OFF for just one scan when operation starts
CR2008 R Turned ON for just one scan when operation starts
CR2009 Turned ON when the calculation result is negative or when an overflow occurs
CR2010 R Turned ON when the calculation result is zero
CR2011 R Turned ON when the calculation result is positive
CR2012 R Turned ON when a calculation execution error occurs
CR2013 to
- Reserved for the system
CR2302
CR2303 Fixed scan time operation (ON: enabled, OFF: disabled)
Turned ON for just one scan when the scan time setting (the fixed scan time operation and END
CR2304 R
processing time settings) is exceeded
CR2305 - Reserved for the system
CR2306 R Indicates backup battery errors (ON: error, OFF: normal)
CR2307 Clears the minimum and maximum scan time values
Sets the END processing time (ON: enabled, OFF: disabled; if CR2303 is turned ON at the same
CR2308
time, CR2303 is given priority)
CR2309 and
- Reserved for the system
CR2310
CR2311 R Indicates RTC low voltage error (ON: error has occurred, OFF: normal)
CR2312 - Reserved for the system
CR2313 Forces switch of the VT sensor application screen (ON: switch, OFF: do not switch)
Project password authentication status (ON: authentication disabled, OFF: authentication
CR2314 R
enabled)
Attribute
CR R: Read only Function
Blank: Read/write
CR2315 to
- Reserved for the system
CR2813
Zero suppression during execution of DASC and FASC instructions (all suffixes; ON: execute,
CR2814
OFF: do not execute)
Omission of "+" during execution of DASC.S, DASC.L, and FASC instructions (ON: execute,
CR2815
OFF: do not execute)
CR2900 to
- Reserved for the system
CR3005
CR3100 R Inter-unit synchronization refreshing time exceeded
CR3101 to
- Reserved for the system
CR3115
CR3200 CPU memory save save request
APPENDICES
CR3208 to
- Reserved for the system
CR3209
CR3210 R Arbitrary logging/trace operation
CR3211 to - Reserved for the system
CR3213
CR3214 R Storage instruction executing
CR3215 - Reserved for the system
CR3300 to
Alarm relay
CR3415
CR3500 R Alarm operation relay (ON: one of CR3300 to CR3415 is turned ON)
Record an entry in the log when an alarm relay switches from ON to OFF (ON: record, OFF: do
CR3501
not record)
CR3502 The alarm relay log is cleared when this switches from OFF to ON
CR3503 to
- Reserved for the system
CR3512
CR3513 R Logging internal buffer overflow
CR3514 HKEY instruction - Disables multiple keys
CR3515 R HKEY instruction - Scan completion
CR3600 to
R HKEY information storage area
CR3615
CR3700 to
- Reserved for the system
CR3901
CR3902 R Indicates that the serious error log is full
CR3903 R Indicates that the minor error log is full
CR3904 R RUN-PRG selector switch status (ON: RUN, OFF: PROG)
CR3905 R A serious error has occurred
CR3906 R A minor error has occurred
CR3907 to
Reserved for the system
CR3908
CR3909 Clears the current error (Set this relay in the ladder program)
CR3910 Clear all error and event history when OFF→ON
CR3911 to
- Reserved for the system
CR4000
CR4001 to
R Expansion unit status (expansion units 1 - 48)
CR4300
CR4301 to
- Reserved for the system
CR4315
CR4400 R AW up key being pressed
CR4401 R AW down key being pressed
Attribute
CR R: Read only Function
Blank: Read/write
CR4402 R AW left key being pressed
CR4403 R AW right key being pressed
CR4404 R AW MENU key being pressed
CR4405 R AW ENT key being pressed
CR4406 to
- Reserved for the system
CR4414
CR4415 R AW user message being displayed
CR4500 AW line 1 blinking
CR4501 AW line 2 blinking
CR4502 AW line 3 blinking
CR4503 AW line 4 blinking
APPENDICES
CR4504 to
- Reserved for the system
CR4600
CR4601 to
AW user message 1 to 63
CR4915
CR5000 to
- Reserved for the system
CR5315
CR5400 Memory card mount request
CR5401 Memory card unmount request
CR5402 R Memory card used
CR/CM List
CR5403 R Memory card recognized
CR5404 R Memory card is available
CR5405 R Memory card is write protected
CR5406 to
- Reserved for the system
CR5407
CR5408 CPU memory mount request
CR5409 CPU memory unmount request
CR5410 R CPU memory used
CR5411 R CPU memory recognized
CR5412 to
- Reserved for the system
CR4915
CR5500 Project load execution request
CR5501 - Reserved for the system
CR5502 Project save execution request
CR5503 - Reserved for the system
CR5504 R Project load execution complete
CR5505 R Project load execution failure
CR5506 R Project save execution complete
CR5507 R Project save execution failure
CR5508 Recipe load request
CR5509 - Reserved for the system
CR5510 R Recipe load complete
CR5511 R Recipe load failed
CR5512 Recipe save request
CR5513 - Reserved for the system
CR5514 R Recipe save complete
CR5515 R Recipe save failed
Attribute
CR R: Read only Function
Blank: Read/write
CR5600 Operation record 0 Save request
CR5601 R Operation record 0 Operating
CR5602 R Operation record 0 Save trigger monitor
CR5603 R Operation record 0 Saving
CR5604 R Operation record 0 Collecting
CR5605 R Operation record 0 Setting error
CR5606 - Reserved for the system
Operation recorder function (ID0)
DR5607 R Operation record 0 Save completed
CR5608 R Operation record 0 Save error
CR5609 R Device record 0 Buffer shortage
CR5610 to
APPENDICES
Control memory entries (CM0000 - CM7599) can be used to perform operations such as checking the
operation status of the CPU unit and setting and monitoring the built-in functions.
Control memory entries reserved for the system cannot be used.
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold
CM0000 and
- Reserved for the system
CM0699
CM0700 R Read from RTC (year)
CM0701 R Read from RTC (month)
APPENDICES
CM0702 R Read from RTC (day)
CM0703 R Read from RTC (hour)
CM0704 R Read from RTC (minute)
CM0705 R Read from RTC (second)
CM0706 R Read from RTC (day of the week)
CM0707 to
- Reserved for the system
CM709
CM0710 R File register current bank number
CM0711 to
CR/CM List
- Reserved for the system
CM0899
CM900 R CPU function version
CM901 to
- Reserved for the system
CM906
CM907 R Project Version
CM908 to
- Reserved for the system
CM999
CM1000 and
R Scan time measuring value (1 μs) (32-bit)
CM1001
CM1002 and
R END processing time measured value (1 μs unit) (32-bit)
CM1003
CM1004 and
R Minimum fixed scanning time (1 μs unit) (32-bit)
CM1005
CM1006 and
R Maximum fixed scanning time (1 μs unit) (32-bit)
CM1007
CM1008 and
Fixed scanning time run set value (1 μs unit) (32-bit)
CM1009
CM1010 and
END processing time set value (1 μs unit) (32-bit)
CM1011
CM1012 and
R Scanning time when setting is exceeded (1 μs unit) (32-bit)
CM1013
CM1014 and
R END processing time exceeds value (1 μs unit) (32-bit)
CM1015
CM1016 to
- Reserved for the system
CM1029
CM1030 and
R 32-bit 1 ms Free Run counter
CM1031
CM1032 and
R 32-bit 10 μs Free Run counter
CM1033
CM1034 and
R 32-bit 1 μs Free Run counter
CM1035
CM1036 and
R 32-bit 0.1 μs Free Run counter
CM1037
CM1038 to
- Reserved for the system
CM1499
CM1500 to
R Log/trace (ID0 to ID9) File Save Counter
CM1509
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold
CM1510 to
- Reserved for the system
CM1629
CM1630 to
R Log/trace Ring Buffer minimum free space (ID0 to ID9) (KBytes)
CM1639
CM1640 to
- Reserved for the system
CM1649
CM1650 R Number of sensor setting instruction executions
CM1651 to
- Reserved for the system
CM1657
CM1658 R Number of consecutive project password authentication failures Yes
CM1659 R Total number of project password authentication failures Yes
CM1660 to
R Logging, trace ring buffer free capacity (ID0 - ID9) (in kbyte units)
APPENDICES
CM1669
CM1670 to
- Reserved for the system
CM1679
CM1680 to
R Log/trace File Save Counter (ID0 to ID9) (Memory card use) Yes
CM1689
CM1690 to
- Reserved for the system
CM1699
CM1700 and
Digital trimmer 0 upper limit (32-bit)
CM1701
CM1702 and
CR/CM List
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold
APPENDICES
CM1870 - Recipe load Drive number Yes
CM1871 Recipe load Folder number Yes
CM1872 Reserved for the system
CM1873 Recipe load Completion code Yes
CM1874 Reserved for the system
CM1875 Recipe save Drive number Yes
CM1876 Recipe save Reference folder number Yes
CM1877 Recipe save Output folder number Yes
CM1878 Recipe save Completion code
CR/CM List
Yes
CM1879 Reserved for the system
CM1880 Project load drive number (request)
CM1881 Project load folder number (request)
CM1882 R Project load drive number (complete)
CM1883 R Project load folder number (complete)
CM1884 R Project load completion code
CM1875 to
- Reserved for the system
CM1877
CM1888 Project save drive number (request)
CM1889 Project save folder number (request)
CM1890 R Project save drive number (complete)
CM1891 R Project save folder number (complete)
CM1892 R Project save completion code
CM1893 to
- Reserved for the system
CM1999
CM2000 to
R Device record 0 Average sampling period
CM2001
CM2002 to Device record 0 Average number of changed
R
CM2003 Operation recorder devices
CM2004 to function (ID0)
R Device record 0 Maximum collection period
CM2005
CM2006 to
− Reserved for the system
CM2009
CM2010 to
Operation recorder function (ID1~ID3)
CM2039
CM2040 to
− Reserved for the system
CM2389
CM2390 R Error code for storage device instruction
Power OFF during storage access
CM2391 (Becomes value other than 0 during occurrence. Please change it to 0 from
the program.)
CM2392 Memory card retry occurrence times (still hold in case of power off)
CM2393 Memory card check error times (still hold in case of power off)
CM2394 Memory card timeout occurrence times (still hold in case of power off)
CM2395 Reset delay time when error occurs on the memory card
CM2396 to
− Reserved for the system
CM2399
CM2400 to
R Inter-unit synchronization refreshing beginning time (0.1μs)
CM2401
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold
CM2402 to
R Inter-unit synchronization refreshing finishing time (0.1μs)
CM2403
CM2404 to Inter-unit synchronization refreshing beginning time maximum (0.1μs)
Yes
CM2405 (To reset, please change it to 0 from this program.)
CM2406 to Inter-unit synchronization refreshing finishing time maximum (0.1μs)
Yes
CM2407 (To reset, please change it to 0 from this program.)
CM2408 to
R Inter-unit synchronization refreshing operation time (0.1μs)
CM2409
CM2410 to
− Reserved for the system
CM5099
Year and month (Indicated as decimal values. The
CM5100 R last two digits show Month, and previous digits from Yes
hundred show Year. Example: 1210 → October 2012)
APPENDICES
APPENDICES
10 Incorrect trigonometric function instruction operand.
11 Data could not be converted.
12 Incorrect table specification.
13 Incorrect time comparison instruction operand.
14 Incorrect cam switch operand.
15 Incorrect frequency counter instruction operand.
16 Divide by zero.
17 Illegal logging ID.
18 Direct processing error.
19 Unit on which direct processing cannot be performed.
20 Jump destination subroutine does not exist.
CR/CM List
21 Data being written during RUN mode, so instruction cannot be executed.
22 Error for expansion unit-dedicated instructions (unit number).
23 Reserved for the system.
24 PIDAT, outside of operation setting range.
25 PIDAT, outside of sampling period range.
Detailed information,
26 PIDAT, outside of comparison constant range.
piece 1
27 PIDAT, outside of integral constant range.
(CM0712/CM5157)
28 PIDAT, outside of differential constant range.
29 PIDAT comparison constant, two-degree freedom parameters outside of range.
30 PIDAT integral constant, two-degree freedom parameters outside of range.
31 PIDAT differential constant, two-degree freedom parameters outside of range.
32 PIDAT, outside of operation quantity upper limit or lower limit range.
33 PIDAT, outside of operation quantity change width limit range.
34 PIDAT, outside of measured value change width range.
35 PIDAT, AT state transition error.
36 PIDAT, outside of operation control flag range.
37 Operation period exceeded.
38 PIDAT, outside of AT adjustment parameter range.
39 PIDAT, outside of AT hysteresis range.
40 PIDAT, outside of AT timeout range.
41 PIDAT, outside of AT calculation control mode setting range.
42 PIDAT, AT timeout.
43 PIDAT, AT comparison constant exceeded.
44 PIDAT, AT integral constant exceeded.
45 PIDAT, AT differential constant exceeded.
46 Root of negative number cannot be calculated.
47 Incorrect ABS instruction operand.
48 Calculation overflow.
49 UR, UM, or UV unit not connected.
50 Unit device (R) not assigned.
51 Unit device (DM) not assigned.
52 Unit categories disagree.
53 Operation recorder ID illegal
54 Stack overflow
Detailed information,
piece 2 Fixed to 00H.
(CM5158)
Detailed information,
piece 3 Upper bits of the step number at which the error occurred.
(CM5159)
Detailed information,
piece 4 Lower bits of the step number at which the error occurred.
(CM5160)
Detailed Information,
Description
Piece n
Detailed information,
The module name is saved according to settings made in the project language.
pieces 5 to 20
(Data other than the module name is 00H.)
(CM5161 to CM5176)
* When CR2012 is ON, CM0712 stores immediate values, and CM5150 to CM5176 stores values
after several scans.
• Error numbers 50, 53, 55, 56, 58, 59 and 63(Unit number errors)
Detailed Information, Piece n Description
Detailed information, piece 1 Unit number (the unit number will not be stored if it cannot be
(CM5107) determined according to the occurrence conditions of the error)
Detailed information, pieces 2 to 20
Fixed to 00H
(CM5108 to CM5126)
APPENDICES
(CM5109 to CM5126)
• Error number 127 (Auto loading failure error)
Detailed Information, Piece n Description
Detailed information, piece 1
(CM5157) Detailed content of the error
Control relays (CR0000 - CR7915) can be used to perform operations such as checking the operation
status of the CPU unit and setting and monitoring the built-in functions.
Control relays reserved for the system cannot be used.
Attribute
CR R: Read only Function
Blank: Read/write
CR0000 Logging and tracing execution (ON: enabled, OFF: disabled)
CR0001 R Logging or tracing operation in progress
CR0002 R Logging or tracing file writing completion
CR0003 R Logging buffer less than 50% warning
APPENDICES
CR0004 R Logging buffer overflow
CR0005 R Data to be written in RUN mode during logging present
CR0006
and - Reserved for the system
CR0007
Logging or tracing function (ID0)
CR0008 R Logging or tracing error
CR0009 R Logging trace No memory space error
CR0010 R Logging or tracing device or trigger setting error
CR0011 R Tracing file save trigger monitor
CR/CM List
CR0012 R Tracing data capture completion
CR0013 R Logging or tracing setting to be written present
CR0014
and - Reserved for the system
CR0015
CR0100 to
Logging or tracing function (ID1 to ID9)
CR0915
CR1000 to
Real-time chart monitor (ID10)
CR1015
CR1100 to
- Reserved for the system
CR2001
CR2002 R Always turned ON
CR2003 R Always turned OFF
CR2004 R 10 ms clock pulse (duty cycle: 50%)
CR2005 R 100 ms clock pulse (duty cycle: 50%)
CR2006 R 1 s clock pulse (duty cycle: 50%)
CR2007 R Turned OFF for just one scan when operation starts
CR2008 R Turned ON for just one scan when operation starts
CR2009 Turned ON when the calculation result is negative or when an overflow occurs
CR2010 R Turned ON when the calculation result is zero
CR2011 R Turned ON when the calculation result is positive
CR2012 R Turned ON when a calculation execution error occurs
CR2013 to
- Reserved for the system
CR2302
CR2303 Fixed scan time operation (ON: enabled, OFF: disabled)
Turned ON for just one scan when the scan time setting (the fixed scan time operation and END
CR2304 R
processing time settings) is exceeded
CR2305 - Reserved for the system
CR2306 R Indicates backup battery errors (ON: error, OFF: normal)
CR2307 Clears the minimum and maximum scan time values
Sets the END processing time (ON: enabled, OFF: disabled; if CR2303 is turned ON at the same
CR2308
time, CR2303 is given priority)
CR2309
and - Reserved for the system
CR2310
CR2311 R Indicates RTC low voltage error (ON: error has occurred, OFF: normal)
CR2312 - Reserved for the system
CR2313 Forces switch of the VT sensor application screen (ON: switch, OFF: do not switch)
Attribute
CR R: Read only Function
Blank: Read/write
CR2314 R Project password authentication status (ON: authentication disabled, OFF: authentication enabled)
CR2315 to
- Reserved for the system
CR2813
Zero suppression during execution of DASC and FASC instructions (all suffixes; ON: execute,
CR2814
OFF: do not execute)
Omission of "+" during execution of DASC.S, DASC.L, and FASC instructions (ON: execute,
CR2815
OFF: do not execute)
CR2900 to - Reserved for the system
CR3115
CR3200 CPU memory save save request
CR3201 R CPU memory save being performed
CR3202 R CPU memory save complete
APPENDICES
Attribute
CR R: Read only Function
Blank: Read/write
CR4403 R AW right key being pressed
CR4404 R AW MENU key being pressed
CR4405 R AW ENT key being pressed
CR4406 to
- Reserved for the system
CR4414
CR4415 R AW user message being displayed
CR4500 AW line 1 blinking
CR4501 AW line 2 blinking
CR4502 AW line 3 blinking
CR4503 AW line 4 blinking
CR4504 to
APPENDICES
- Reserved for the system
CR4600
CR4601 to
AW user message 1 to 63
CR4915
CR5000 to
- Reserved for the system
CR5315
CR5400 Memory card mount request
CR5401 Memory card unmount request
CR5402 R Memory card used
CR5403 R Memory card recognized
CR/CM List
CR5404 R Memory card is available
CR5405 R Memory card is write protected
CR5406 to
- Reserved for the system
CR5407
CR5408 CPU memory mount request
CR5409 CPU memory unmount request
CR5410 R CPU memory used
CR5411 R CPU memory recognized
CR5412 to
- Reserved for the system
CR7915
Control memory entries (CM0000 - CM5999) can be used to perform operations such as checking the
operation status of the CPU unit and setting and monitoring the built-in functions.
Control memory entries reserved for the system cannot be used.
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold
CM0000 and
- Reserved for the system
CM0699
CM0700 R Read from RTC (year)
CM0701 R Read from RTC (month)
APPENDICES
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold
CM1510 to
- Reserved for the system
CM1629
CM1630 to
R Log/trace Ring Buffer minimum free space (ID0 to ID9) (KBytes)
CM1639
CM1640 to
- Reserved for the system
CM1649
CM1650 R Number of sensor setting instruction executions
CM1651 to
- Reserved for the system
CM1657
CM1658 R Number of consecutive project password authentication failures Yes
CM1659 R Total number of project password authentication failures Yes
CM1660 to
R Logging, trace ring buffer free capacity (ID0 - ID9) (in kbyte units)
APPENDICES
CM1669
CM1670 to
- Reserved for the system
CM1679
CM1680 to
R Log/trace File Save Counter (ID0 to ID9) (Memory card use) Yes
CM1689
CM1690 to
- Reserved for the system
CM1699
CM1700 and
Digital trimmer 0 upper limit (32-bit)
CM1701
CM1702 and
CR/CM List
Digital trimmer 1 upper limit (32-bit)
CM1703
CM1704 and
Digital trimmer 2 upper limit (32-bit)
CM1705
CM1706 and
Digital trimmer 3 upper limit (32-bit)
CM1707
CM1708 and
Digital trimmer 4 upper limit (32-bit)
CM1709
CM1710 and
Digital trimmer 5 upper limit (32-bit)
CM1711
CM1712 and
Digital trimmer 6 upper limit (32-bit)
CM1713
CM1714 and
Digital trimmer 7 upper limit (32-bit)
CM1715
CM1716 to
- Reserved for the system
CM1719
CM1720 R AW user message display number
CM1721 to
- Reserved for the system
CM1735
CM1736 AW initial display language setting
CM1737 AW initial comment number setting
CM1738 Access window operation disabled setting
CM1739 - Reserved for the system
CM1740 to
R Ladder project name (up to 32 characters + end code)
CM1772
CM1773 to
- Reserved for the system
CM1779
CM1780 Access window initial screen setting, enabled
CM1781 Access window initial screen setting, device type
CM1782 Access window initial screen setting, screen ID
CM1783 Access window initial screen setting, screen ID
CM1784 Access window initial screen setting, device number
CM1785 Access window initial screen setting, device number
CM1786 Access window initial screen setting, display format
CM1787 Access window initial screen setting, device name representation
CM1788 Access window initial screen setting, key lock status
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold
CM1870 to
- Reserved for the system
CM2389
CM2390 R Error code for storage device instruction
Power OFF during storage access
CM2391 (Becomes value other than 0 during occurrence. Please change it to 0 from
the program.)
CM2392 Memory card retry occurrence times (still hold in case of power off)
CM2393 Memory card check error times (still hold in case of power off)
CM2394 Memory card timeout occurrence times (still hold in case of power off)
CR/CM List
CM2395 Reset delay time when error occurs on the memory card
CM2396 to
- Reserved for the system
CM5099
CM5100 R Year and month Yes
CM5101 R Day Yes
CM5102 R Hour Yes
CM5103 R Minute Yes
CM5104 R Second Yes
Details of the latest
CM5105 R Number Yes
serious error
CM5106 R Number of valid pieces of data Yes
CM5107 R Detailed information, piece 01* Yes
CM5108 R Detailed information, piece 02* Yes
: R Yes
CM5126 R Detailed information, piece 20* Yes
CM5127 to
- Reserved for the system
CM5149
CM5150 R Year and month Yes
CM5151 R Day Yes
CM5152 R Hour Yes
CM5153 R Minute Yes
CM5154 R Second Yes
Details of the latest minor
CM5155 R Number Yes
error
CM5156 R Number of valid pieces of data Yes
CM5157 R Detailed information, piece 01* Yes
CM5158 R Detailed information, piece 02* Yes
: R Yes
CM5176 R Detailed information, piece 20* Yes
CM5177 to
- Reserved for the system
CM5871
CM5872 to
R Used amount of CPU memory(32 bit, Byte unit) Yes
CM5873
CM5874 to
- Reserved for the system
CM5999
* The detailed information which depends on the occurring error number is displayed in the following page.
* When a computing error (No.128) occurs, the detailed information 1 of the next page will be stored to
computing error detailed information (CM0712).
APPENDICES
10 Incorrect trigonometric function instruction operand.
11 Data could not be converted.
12 Incorrect table specification.
13 Incorrect time comparison instruction operand.
14 Incorrect cam switch operand.
15 Incorrect frequency counter instruction operand.
16 Divide by zero.
17 Illegal logging ID.
18 Direct processing error.
19 Unit on which direct processing cannot be performed.
20 Jump destination subroutine does not exist.
CR/CM List
21 Data being written during RUN mode, so instruction cannot be executed.
22 Error for expansion unit-dedicated instructions (unit number).
23 Reserved for the system.
24 PIDAT, outside of operation setting range.
Detailed information,
25 PIDAT, outside of sampling period range.
piece 1
26 PIDAT, outside of comparison constant range.
(CM0712/CM5157)
27 PIDAT, outside of integral constant range.
28 PIDAT, outside of differential constant range.
29 PIDAT comparison constant, two-degree freedom parameters outside of range.
30 PIDAT integral constant, two-degree freedom parameters outside of range.
31 PIDAT differential constant, two-degree freedom parameters outside of range.
32 PIDAT, outside of operation quantity upper limit or lower limit range.
33 PIDAT, outside of operation quantity change width limit range.
34 PIDAT, outside of measured value change width range.
35 PIDAT, AT state transition error.
36 PIDAT, outside of operation control flag range.
37 Operation period exceeded.
38 PIDAT, outside of AT adjustment parameter range.
39 PIDAT, outside of AT hysteresis range.
40 PIDAT, outside of AT timeout range.
41 PIDAT, outside of AT calculation control mode setting range.
42 PIDAT, AT timeout.
43 PIDAT, AT comparison constant exceeded.
44 PIDAT, AT integral constant exceeded.
45 PIDAT, AT differential constant exceeded.
46 Root of negative number cannot be calculated.
47 Incorrect ABS instruction operand.
48 Calculation overflow.
49 UR, UM, or UV unit not connected.
50 Unit device (R) not assigned.
51 Unit device (DM) not assigned.
52 Unit categories disagree.
Detailed information,
piece 2 Fixed to 00H.
(CM5158)
Detailed information,
piece 3 Upper bits of the step number at which the error occurred.
(CM5159)
Detailed information,
piece 4 Lower bits of the step number at which the error occurred.
(CM5160)
Detailed Information,
Description
Piece n
Detailed information,
The module name is saved according to settings made in the project language.
pieces 5 to 20
(Data other than the module name is 00H.)
(CM5161 to CM5176)
• Error numbers 50, 53, 55, 56, 58, 59 and 63(Unit number errors)
Detailed Information, Piece n Description
Detailed information, piece 1 Unit number (the unit number will not be stored if it cannot be
(CM5107) determined according to the occurrence conditions of the error)
Detailed information, pieces 2 to 20
Fixed to 00H
(CM5108 to CM5126)
• Error number 54 (Number of units error)
APPENDICES
Control relay (CR0000 to CR3915) can be used to check the operating state of CPU units, set or monitor embedded
functions.
The system-reserved control relay cannot be used.
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
CR0004 R Logging buffer overflow
CR0005 R Logging write during RUN
Logging /tracking
CR0006 to CR0007 - Reserved for the system
function (ID0)
CR0008 R Logging/trace error
CR0009 R Logging/trace memory plugboard without capacity error
CR0010 R Abnormal logging/trace device/trigger setting
CR0011 R Trace file saving trigger monitor
CR/CM List
CR0012 R Trace data acquisition end
CR0013 to CR0015 - Reserved for the system
Logging/trace
CR0100 to CR0915 (identical with CR0000 to CR0015)
function (ID1 to ID9)
Real-time graphic
CR1000 to CR1015 (identical with CR0000 to CR0015)
monitor (ID10)
CR1100 to CR2001 - Reserved for the system
CR2002 R Always ON
CR2003 R Always OFF
CR2004 R 10ms clock pulse (Duty ratio %: 50%)
CR2005 R 100ms clock pulse (Duty ratio %: 50%)
CR2006 R 1s clock pulse (Duty ratio %: 50%)
CR2007 R OFF scan period at operation start
CR2008 R ON scan period at operation start
CR2009 ON when operation result is negative or overflowed
CR2010 R ON when the operation result is 0
CR2011 R ON when the operation result is positive
CR2012 R ON when operation execution error
CR2013 to CR2015 - Reserved for the system
CR2100 R CTH0 special internal clock (1µs)
CR2101 R CTH0 special internal clock (10µs)
CR2102 R CTH0 special internal clock (100µs)
CR2103 Auto reset of CTH0 (ON: enable, OFF: disable)
Comparator match output to R500/R504 is disabled (ON: enable,
CR2104
Operation when OFF: disable)
high-speed Comparator match output to R500/R504 is set as OFF (ON:
CR2105
counter enable, OFF: disable)
comparator Comparator match output to R500/R504 is set as ON (ON:
CR2106
CTC0 is ON enable, OFF: disable)
Invert ON/OFFstate of comparator match output to R500/R504
CR2107
whenever in ON state (ON: enable, OFF: disable)
Attributes
Device No. R: Read only. Function
Blank: R/W
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
signal preset CR2401 OFF OFF ON ON
CR/CM List
CR2407 Detect CTH1 overflow/underflow (ON: detected OFF: undetected)
CR2408 CTH 0 preset disable (ON: disable, OFF: not disable)
CR2409 CTH 1 preset disable (ON: disable, OFF: not disable)
CR2410 CTH0 internal permit relay (ON: enable counting, OFF: disable counting)
CR2411 CTH1 internal permit relay (ON: enable counting, OFF: disable counting)
CR2412 R CTH0 change direction (ON: at the side of subtraction, OFF: at the side of adding)
CR2413 R CTH1 change direction (ON: at the side of subtraction, OFF: at the side of adding)
CR2414 R CTH0 special internal block (50ns)
CR2415 R CTH1 special internal block (50ns)
CR2500 Start operation (ON: enable, OFF: disable)
Attributes
Device No. R: Read only. Function
Blank: R/W
communication
CR2804 Start to send text data (ON during sending)
CR2805 Receive text data in bytes (ON: enable, OFF: disable)
CR2806 Send text data in bytes (ON: enable, OFF: disable)
CR2807 to CR2813 - Reserved for the system
Zero suppression is performed when DASC instruction (all suffixes) and FASC
CR2814
instruction are executed (ON: enable, OFF: disable)
When DASC.S, DASC.L and FASC instruction execution are executed, "+" is
CR2815
omitted. (ON: enable OFF: disable)
CR2900 User message display1 (ON: display, OFF: not display)
Access window
CR2901 User message display2 (ON: display, OFF: not display)
CR2902 to CR2915 - Reserved for the system
CR3000 Limit switch CW input
CR3001 Limit switch CCW input
CR3002 Origin sensor input
CR3003 Stop sensor input
CR3004 R In the course of zero suppression
CR3005 R Origin suppression end
CR3006 Positioning end relay
CR3007 CPU positioning Error/clearing error
CR3008 function axis X Warning/clearing warning
CR3009 Pulse output/emergency stop
CR3010 Driver operation start
CR3011 Current value change request (level detection)
CR3012 Operation speed change request (level detection)
CR3013 Consistency relay of comparator 2
CR3014 -
Reserved for the system
CR3015 -
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
CR3110 Driver operation start
CR3111 Current value change request (level detection)
CR3112 Operation speed change request (level detection)
CR3113 Consistency relay of comparator 2
CR3114 -
Reserved for the system
CR3115 -
CR3200 to CR3209 - Reserved for the system
CR3210 R Random Logging / trace memory plugboard in use
CR/CM List
CR3211 R Memory card in use
CR3212 R Memory card identification end
CR3213 R With Memory card
CR3214 R Memory card instruction in execution
CR3215 R Memory plugboard write protection (ON: write protection, OFF: without write protection)
CR3300 to CR3415 Warning relay
CR3500 R Warning relay in operation (ON when one of CR3300 to CR3415 is ON)
CR3501 When warning relay ON → OFF, process the log (ON: reserve, OFF: without reserve)
CR3502 When OFF turns to ON, clear Warning relay log
CR3503 to CR3513 - Reserved for the system
CR3514 HKEY Multikey disable
CR3515 R instruction Scanning end
CR3600 to CR3615 R Information storage area of HKEY instruction
Attributes
Device No. R: Read only. Function
Blank: R/W
Control memory (CM0000 - CM5999) may realize confirmation of CPU unit action state, settings or
monitoring of built-in functions etc.
Control memory reversed in the system cannot be used.
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
CM0010 to CM0199 Page 1 to 19 (same as CM0000 to CM0009)
CM0200, CM0201 Set up 1st line display attribute
CM0202, CM0203 Set up 2nd line display attribute
CM0204, CM0205 Operation panel Set up 3rd line display attribute
KV-D30
CM0206, CM0207 Set up 4th line display attribute
0 Pages
CM0208 Setup module 1
CM0209 Setup module 2
CR/CM List
CM0210 to CM0399 Page 1 to 19 (same as CM0200 to CM0209)
CM0400 For conversion enable/inhibited setting
CM0401 For settings of page conversion
CM0402 Operation panel Current display page
CM0403 to CM0409 KV-D30 Reserved for system
CM0410 to CM0415 Direct access function
CM0416 to CM0499 - Reserved for system
CM0500 to CM0699 - Reserved for system
CM0700 R (year)
CM0701 R (month)
CM0702 R (day)
Read from
CM0703 R (hour)
calendar timer
CM0704 R (Minute)
CM0705 R (s)
CM0706 R (week)(0: (Sun), 1 (Mon), 2: (Tues) 3: (Wed) 4: (Thur) 5: (Fri), 6 (Sat))
CM0707 - Reserved for system
CM0708, CM0709 R Free Run Counter (32-bit, 1ms)
CM0710 R Current memory No.of FM
CM0711 R If V2.0 CPU functional version is used, save "2", for other situations, save "0"
CM0712 R Execution time of constant cycle module (10µs unit)
CM0713 to CM0715 - Reserved for system
CM0716 Maximum exeuction time (10µs unit) for Fixed Period Module
CM0717 to CM0719 - Reserved for system
CM0720 R Scan time measuring value (10µs unit)
CM0721 Fixed scanning time run set value (10µs unit)
Exceeds scanning time set up (-fixed scanning time running/END processing time
CM0722 R
settings) scanning time (10µs unit)
CM0723 END processing time measured value (10µs unit)
CM0724 to CM0725 - Reserved for system
CM0726 R Minimum fixed scanning time (10µs unit)
CM0727 R Maximum fixed scanning time (10µs unit)
CM0728 END processing time set value (10µs unit)
Exceeds scanning time set up (-fixed scanning time running/END processing time
CM0729
settings) scanning time (10µs unit)
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-67
CR/CM List
Attributes
Device No. R: Read only. Function
Blank: R/W
Attributes
Device No. R: Read only. Function
Blank: R/W
CM1740 to CM1756 LD project name (up to 32 characters +end character (00 H))
CM1757 to CM1763 Access window display project name (up to 12 characters + end character (00 H))
CM1764 to CM1774 Bluetooth device identification name (up to 20 characters + terminal code (00H)) *1
CM1775 to CM1779 Reserved for system
CM 1780 AW initial menu setting is enabled
CM1781 AW initial menu setting device type
CM1782,CM1783 AW initial menu setting menu ID
CM1784,CM1785 AW initial menu setting device No.
CM1786 AW initial menu setting display format
CM1787 AW initial menu setting device name representation
APPENDICES
CM1788 AW initial menu setting key lock state
CM1789 AW initial menu setting display language
CM1790 Automatic loading folder No. When powered on (request)
CM1791 Automatic loading folder No. When powered on (completed)
CM1792 Automatic loading folder No. For PROG/RUN (request)
CM1793 Automatic loading folder No. For PROG/RUN (completed)
CM1794 to CM1799 Reserved for system
Year month (decimal number, lower two 2 digits represent month,
CR/CM List
CM1800 digits above hundred digit represent year.
Example: 707 -> June, 2007
CM1801 Serious error log day
(latest)
CM1802 hour(0 to 23)
CM1803 minute
CM1804 Error No.
CM1805 to CM1899 Error log (2 to 20 records, same as CM1800 to CM1804)
Year month (decimal number, lower two 2 digits represent month,
CM1900 digits above hundred digit represent year.
Example: 707 -> June, 2007
CM1901 Power ON log day
(latest)
CM1902 hour(0 to 23)
CM1903 minute
CM1904 second
CM1905 to CM1999 Power ON log (2 to 20 records, same as CM1800 to CM1804)
Attributes
Device No. R: Read only. Function
Blank: R/W
Attributes
Device No. R: Read only. Function
Blank: R/W
CM2391 Power OFF when accessing memory plug-in board (when occurred: the value other than 0)
CM2392 Memory card retry occurrence times (still hold in case of power off)
CM2393 Memory card check error times (still hold in case of power off)
CM2394 Memory card timeout occurrence times (still hold in case of power off)
When error occurs on the memory card reset delay time
CM2395
(in ms, upper limit is 10000[10 s], do not reset if set to 65535)
CM2392 to CM2399 Reserved for system
Interrupt times (INT0 to INT3, CTC2, CTC3, CTC0, CTC1, positioning X axis,
CM2400 to CM2416
positioning Y axis, INT4 to INT9, fixed cycle module)
CM2417 to CM2999 - Reserved for system
CM3000 Number of received texts
APPENDICES
CM3001 to CM3999 Text received data (1998-byte)
CM4000 Number of sending texts
CM4001 to CM4999 Text send data (1998-byte)
Year month (decimal number, lower two 2 digits represent month,
CM5000 digits above hundred digit represent year.
Example: 707 -> June, 2007
CM5001 Power OFF log day
(latest)
CM5002 hour(0 to 23)
CR/CM List
CM5003 minute
CM5004 second
CM5005 to CM5099 Power OFF log (2 to 20 units the same with CM5000 to CM5004)
Year month (decimal number, lower two 2 digits represent month,
CM5100 digits above hundred digit represent year.
Example: 707 -> June, 2007
CM5101 day
CM5102 HH
CM5103 minute
CM5104 Latest serious second
error detail
CM5105 Error No.
information 1 unit*
CM5106 Effective data number of expansion information
CM5107 Detailed information 1*
CM5108 Detailed information 2*
: :
: :
CM5126 Detailed information 20*
Year month (decimal number, lower two 2 digits represent month,
CM5150 digits above hundred digit represent year.
Example: 707 -> June, 2007
CM5151 day
CM5152 hour
CM5153 minute
CM5154 Latest general second
warning detail
CM5155 * Error No.
information 1 unit
CM5156 Effective data number of expansion information
CM5157 Detailed information 1*
CM5158 Detailed information 2*
: :
: :
CM5176 Detailed information 20*
CM5177 to CM5999 - Reserved for system
* Detailed information error is coded as follows:
17 Record ID illegal
18 Direct Processing Error
19 The units cannot direct processed
20 Subroutine does not exist for transfer target
21 Writing during RUN, cannot execute command
22 Expansion unit special command object error (unit No.)
23 Reserved for system
24 PIDAT operation setting out-of-range
25 PIDAT sampling period out-of-range
26 PIDAT constant of proportionality out-of-range
27 PIDAT integral constant out-of-range
28 PIDAT differential constant out-of-range
29 PIDAT constant of proportionality two degree freedom parameters are out of scope
30 PIDAT integral constant two degree freedom parameters are out of scope
31 PIDAT differential constant two degree freedom parameters are out of scope
32 PIDAT operation quantity upper limit value/lower limit value out-of-range
33 PIDAT operation quantity change amplitude critical value is out of scope
34 PIDAT measured value change amplitude is out of scope
35 PIDAT AT state transition exception
36 PIDAT operational control mark is out of scope
37 PIDAT operation period is out of scope
38 PIDAT AT adjusting parameters are out of scope
39 PIDAT AT lagging is out of scope
40 PIDAT AT timeout value is out of scope
41 PIDAT AT calculation control mode setting is out of range
42 PIDAT AT timeout
43 PIDAT AT constant of proportionality is out of scope
44 PIDAT AT integral constant is out of scope
45 PIDAT AT differential constant is out of scope
46 Root of negative number cannot be calculated
47 Independent variable of ABS command is incorrect
48 Operation overflow
Detailed information 2 00H fixed
Detailed information 3 Step number high bit error
Detailed information 4 Step number low bit error
Detailed information 5 to 20 Use SJIS to store module name.(the part other than module name is 00H)
APPENDICES
• When No.127 (auto loading failure error)
Detailed information n Description
Details of error
Detailed information 1
For details, refer to "Errors during load/save execution".
Detailed information 2 to 20 00H fixed
CR/CM List
Detailed information n Description
Detailed information 1 Unit No.
Detailed information 2 Error No. of each unit
Detailed information 3 to 20 00H fixed
Control relays (CR0000 to CR8915) can be used to perform operations such as checking the operation
status of the base unit and setting and monitoring the built-in functions.
Control relays reserved for the system cannot be used.
Attribute
CR R: Read only Function
Blank: Read/write
Logging and tracing execution (ON: enabled, OFF:
CR0000
disabled)
CR0001 R Logging or tracing operation in progress
CR0002 R Logging or tracing file writing completion
APPENDICES
Attribute
CR R: Read only Function
Blank: Read/write
CR2209 to
- Reserved for the system
CR2215
CR2300 External output disabled (ON: execute, OFF: do not execute)
CR2301 External input refresh disabled (ON: execute, OFF: do not execute)
CR2302 - Reserved for the system
CR2303 Fixed scan time operation (ON: enabled, OFF: disabled)
Turned ON for just one scan when the scan time setting (the fixed scan time operation and END
CR2304 R
processing time settings) is exceeded
Sets the input time constant of all inputs of the base unit
CR2305
(ON: the value is set according to CM1620, OFF: the value is not set)
CR2306 - Reserved for the system
CR2307 Clears the minimum and maximum scan time values
APPENDICES
Sets the END processing time (ON: enabled, OFF: disabled; if CR2303 is turned ON at the same
CR2308
time, CR2303 is given priority)
CR2309 Reserved for the system
CR2310 R Indicates the presence of a calendar timer (ON: present, OFF: not present)
This is turned ON when a clock data lost error occurs (it is turned OFF when the clock data is
CR2311 R
written)
CR2312 - Reserved for the system
CR2313 Forces switch of the VT sensor application screen (ON: switch, OFF: do not switch)
CR2314 Project password authentication status (ON: authentication disabled, OFF: authentication enabled)
CR/CM List
CR2315 to
- Reserved for the system
CR2515
INT0 interrupt polarity
CR2600, Rising Edge Falling Edge Both Rising and Falling Edges
CR2601 CR2600 OFF ON OFF ON
CR2601 OFF OFF ON ON
CR2602, Rising Edge Falling Edge Both Rising and Falling Edges
CR2603 CR2602 OFF ON OFF ON
CR2603 OFF OFF ON ON
CR2604, Rising Edge Falling Edge Both Rising and Falling Edges
CR2605 CR2604 OFF ON OFF ON
CR2605 OFF OFF ON ON
CR2606, Rising Edge Falling Edge Both Rising and Falling Edges
CR2607 CR2606 OFF ON OFF ON
CR2607 OFF OFF ON ON
CR2608 to
Reserved for the system
CR2813
Zero suppression during execution of DASC and FASC instructions (all suffixes; ON: execute,
CR2814
OFF: do not execute)
Omission of "+" during execution of DASC.S, DASC.L, and FASC instructions (ON: execute, OFF:
CR2815
do not execute)
User message display 1
CR2900
(ON: displayed, OFF: hidden)
Access window
User message display 2
CR2901
(ON: displayed, OFF: hidden)
CR2902 to
- Reserved for the system
CR2914
CR2915 R Indicates the presence of an access window cassette (ON: connected, OFF: not connected)
CR3000 Project load execution request
CR3001 - Reserved for the system
CR3002 Project save execution request
CR3003 - Reserved for the system
CR3004 Project load execution completion
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-75
CR/CM List
Attribute
CR R: Read only Function
Blank: Read/write
CR3005 Project load execution failure
CR3006 Project save execution completion
CR3007 Project save execution failure
CR3008 to
- Reserved for the system
CR3209
CR3210 R Optional logging or tracing memory card is in use
CR3211 R Memory card is in use
CR3212 R Memory card recognition complete
CR3213 R Memory card present
CR3214 R Memory card executing instructions
CR3215 R Memory card write protection
APPENDICES
CR3300 to
- Alarm relays
CR3415
CR3500 R Alarm operation relay (ON: one of CR3300 to CR3415 is turned ON)
Record an entry in the log when an alarm relay switches from ON to OFF (ON: record, OFF: do not
CR3501
record)
CR3502 The alarm relay log is cleared when this switches from OFF to ON
CR3503 to
Reserved for the system
CR3513
CR3514 Disables multiple keys
HKEY instruction
CR3515 R Scan completion
CR/CM List
CR3600 to
R HKEY information storage area
CR3615
CR3700 F1 customize switch 1
CR3701 F2 customize switch 2
CR3702 F3 customize switch 3
CR3703 F4 customize switch 4
CR3704 LED1 customize indicator 1
CR3705 LED2 customize indicator 2
CR3706 LED3 customize indicator 3
CR3707 LED4 customize indicator 4
CR3708 Green back light (lights when this is turned ON)
CR3709 Red back light (lights when this is turned ON)
Operator panel KV-D30 System message display language (ON: Japanese, OFF:
CR3710
English)
CR3711 Buzzer ON
Screen display setting (ON: positive display, OFF:
CR3712
negative display)
CR3713 Alarm interrupt enable (ON: enabled, OFF: disabled)
Page switching (switches to the page indicated by the
CR3714
value of CM0401 on a rising edge; forced OFF)
CR3715 Disables page switching using the "▲" and "▼" keys
(ON: disabled, OFF: enabled)
CR3800 Sets external output 0 to ON when this is turned ON
CR3801 Sets external output 1 to ON when this is turned ON
CR3802 to
- Reserved for the system
CR3815
CR3900 The serious error log is cleared when this switches from OFF to ON
CR3901 The minor error log is cleared when this switches from OFF to ON
CR3902 R Indicates that the serious error log is full
CR3903 R Indicates that the minor error log is full
CR3904 R RUN-PROG selector switch status (ON: RUN, OFF: PROG)
CR3905 R A serious error has occurred
CR3906 R A minor error has occurred
CR3907 The power on log is cleared when this switches from OFF to ON
CR3908 The power off log is cleared when this switches from OFF to ON
CR3909 Clears the current error
Attribute
CR R: Read only Function
Blank: Read/write
CR3910 to
- Reserved for the system
CR4115
CR4200 R CTH0 dedicated internal clock (50 ns)
CR4201 R CTH0 dedicated internal clock (1 μs)
CR4202 R CTH0 dedicated internal clock (10 μs)
CR4203 R CTH0 dedicated internal clock (100 μs)
CR4204 - Reserved for the system
CR4205 R Indicates the presence of CTH0 (ON: present, OFF: not present)
CR4206 Detects overflows and underflows of CTH0 (ON: detected, OFF: not detected)
CR4207 R Indicates the change direction of CTH0 (ON: down counting, OFF: up counting)
CTH0 external signal preset
APPENDICES
CR4208, Not Used Rising Edge Falling Edge Level
CR4209 CR4208 OFF ON OFF ON
CR4209 OFF OFF ON ON
CR/CM List
Automatic reset of CTH0 (ON: execute, OFF: do not
CR4303
execute)
Comparator matching output disabled when comparator
CR4304
CTC0 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4305 Action when high-speed counter comparator CTC0 is turned ON (ON: execute, OFF: do
comparator CTC0 is turned ON not execute)
Comparator matching output turned ON when comparator
CR4306
CTC0 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4307 time that comparator CTC0 is turned ON (ON: execute,
OFF: do not execute)
Comparator matching output disabled when comparator
CR4308
CTC1 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4309 comparator CTC1 is turned ON (ON: execute, OFF: do
not execute)
Action when high-speed counter Comparator matching output turned ON when comparator
CR4310
comparator CTC1 is turned ON CTC1 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4311 time that comparator CTC1 is turned ON (ON: execute,
OFF: do not execute)
Automatic reset of CTH0 (ON: execute, OFF: do not
CR4312
execute)
High-speed counter CTH0 count input mode selection
Single Phase
1x 2x 4x 2-Pulse
CR4313 to W/O Direction W/ Direction
CR4315 CR4313 OFF ON OFF ON OFF ON
CR4314 OFF OFF ON ON OFF OFF
CR4315 OFF OFF OFF OFF ON ON
Attribute
CR R: Read only Function
Blank: Read/write
CTH1 external signal preset
execute)
Comparator matching output disabled when comparator
CR4504
CTC2 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4505 Action when high-speed counter comparator CTC2 is turned ON (ON: execute, OFF: do
comparator CTC2 is turned ON not execute)
Comparator matching output turned ON when comparator
CR4506
CTC2 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4507 time that comparator CTC2 is turned ON (ON: execute,
CR/CM List
Attribute
CR R: Read only Function
Blank: Read/write
Automatic reset of CTH2 (ON: execute, OFF: do not
CR4703
execute)
Comparator matching output disabled when comparator
CR4704
CTC4 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4705 Action when high-speed counter comparator CTC4 is turned ON (ON: execute, OFF: do
comparator CTC4 is turned ON not execute)
Comparator matching output turned ON when comparator
CR4706
CTC4 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4707 time that comparator CTC4 is turned ON (ON: execute,
OFF: do not execute)
Comparator matching output disabled when comparator
APPENDICES
CR4708
CTC5 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4709 comparator CTC5 is turned ON (ON: execute, OFF: do
not execute)
Action when high-speed counter Comparator matching output turned ON when comparator
CR4710
comparator CTC5 is turned ON CTC5 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4711 time that comparator CTC5 is turned ON (ON: execute,
OFF: do not execute)
Automatic reset of CTH2 (ON: execute, OFF: do not
CR4712
CR/CM List
execute)
CTH2 count input mode selection
Single Phase
1x 2x 4x 2-Pulse
CR4713 to W/O Direction W/ Direction
CR4715 CR4713 OFF ON OFF ON OFF ON
CR4714 OFF OFF ON ON OFF OFF
CR4715 OFF OFF OFF OFF ON ON
Attribute
CR R: Read only Function
Blank: Read/write
Comparator matching output disabled when comparator
CR4908
CTC7 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4909 comparator CTC7 is turned ON (ON: execute, OFF: do
not execute)
Action when high-speed counter Comparator matching output turned ON when comparator
CR4910
comparator CTC7 is turned ON CTC7 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4911 time that comparator CTC7 is turned ON (ON: execute,
OFF: do not execute)
Automatic reset of CTH3 (ON: execute, OFF: do not
CR4912
execute)
Multiplication mode selection of CTH3
APPENDICES
Single Phase
1x 2x 4x 2-Pulse
CR4913 to W/O Direction W/ Direction
CR4915 CR4913 OFF ON OFF ON OFF ON
CR4914 OFF OFF ON ON OFF OFF
CR4915 OFF OFF OFF OFF ON ON
CR5000 to
- Reserved for the system
CR5315
CR5400 Start operation (ON: execute, OFF: do not execute)
CR/CM List
Attribute
CR R: Read only Function
Blank: Read/write
CR5600 Start operation (ON: execute, OFF: do not execute)
CTH2 input source setting
Single Phase Double
CR5601, W/O W/ Phase 2-Pulse
CR5602 Direction Direction 1x
CR5601 OFF ON OFF ON
Frequency counter (CH2)
CR5602 OFF OFF ON ON
APPENDICES
CR5605
use)
CR5606,
- Reserved for the system
CR5607
CR5608 Specified frequency pulse output (CTH2; ON: execute, OFF: do not execute)
CR/CM List
Attribute
CR R: Read only Function
Blank: Read/write
CR5609 Specified frequency pulse output (CTH2) error
CR5610 to
- Reserved for the system
CR5615
CR5700 Start operation (ON: execute, OFF: do not execute)
CTH3 input source setting
Single Phase Double
CR5701, W/O W/ Phase 2-Pulse
CR5702 Direction Direction 1x
CR5701 OFF ON OFF ON
Frequency counter (CTH3)
CR5702 OFF OFF ON ON
CR5703 Switches between Hz and rpm (ON: rpm, OFF: Hz)
APPENDICES
CR5715
CR5800 to
- Reserved for the system
CR5915
CR6000 to
For built-in serial assignment
CR6515
CR6600 to
For extension function assignment 1
CR7115
CR7200 to
For extension function assignment 2
CR7715
CR7800 to
- Reserved for the system
CR7915
CR8000 Forced stop
CR8001 Deceleration stop
CR8002 Error clear
CR8003 Warning clear
CR8004 Current coordinate change request (level detection)
CR8005 Operating speed change request (level detection)
CR8006 CPU positioning function, axis 1 Target coordinate change request (level detection)
CR8007 to
- Reserved for the system
CR8011
CR8012 Limit switch CW direction input
CR8013 Limit switch CCW direction input
CR8014 Origin sensor input
CR8015 Stop sensor input
CR8100 Forced stop
CR8101 Deceleration stop
CR8102 Error clear
CR8103 Warning clear
CR8104 Current coordinate change request (level detection)
CR8105 Operating speed change request (level detection)
CR8106 CPU positioning function, axis 2 Target coordinate change request (level detection)
CR8107 to
- Reserved for the system
CR8111
CR8112 Limit switch CW direction input
CR8113 Limit switch CCW direction input
CR8114 Origin sensor input
CR8115 Stop sensor input
Attribute
CR R: Read only Function
Blank: Read/write
CR8200 Forced stop
CR8201 Deceleration stop
CR8202 Error clear
CR8203 Warning clear
CR8204 Current coordinate change request (level detection)
CR8205 Operating speed change request (level detection)
CR8206 CPU positioning function, axis 3 Target coordinate change request (level detection)
CR8207 to
Reserved for the system
CR8211
CR8212 Limit switch CW direction input
CR8213 Limit switch CCW direction input
APPENDICES
CR8214 Origin sensor input
CR8215 Stop sensor input
CR8300 Forced stop
CR8301 Deceleration stop
CR8302 Error clear
CR8303 Warning clear
CR8304 Current coordinate change request (level detection)
CR8305 Operating speed change request (level detection)
CR8306 CPU positioning function, axis 4 Target coordinate change request (level detection)
CR/CM List
CR8307 to
Reserved for the system
CR8311
CR8312 Limit switch CW direction input
CR8313 Limit switch CCW direction input
CR8314 Origin sensor input
CR8315 Stop sensor input
CR8400 R Turned ON during pulse output
CR8401 R Positioning complete relay
CR8402 R Error
CR8403 R Warning
CR8404 R Origin returning operation in progress
CR8405 R CPU positioning function, axis 1 Origin returning operation complete
CR8406 to
- Reserved for the system
CR8413
Indicates the presence of axis 1 (ON: present, OFF: not
CR8414 R
present)
CR8415 R Comparator 2 matching relay
CR8500 R Turned ON during pulse output
CR8501 R Positioning complete relay
CR8502 R Error
CR8503 R Warning
CR8504 R Origin returning operation in progress
CR8505 R CPU positioning function, axis 2 Origin returning operation complete
CR8506 to
- Reserved for the system
CR8513
Indicates the presence of axis 2 (ON: present, OFF: not
CR8514 R
present)
CR8515 R Comparator 2 matching relay
Attribute
CR R: Read only Function
Blank: Read/write
CR8600 R Turned ON during pulse output
CR8601 R Positioning complete relay
CR8602 R Error
CR8603 R Warning
CR8604 R Origin returning operation in progress
CR8605 R CPU positioning function, axis 3 Origin returning operation complete
CR8606 to
- Reserved for the system
CR8613
Indicates the presence of axis 3 (ON: present, OFF: not
CR8614 R
present)
CR8615 R Comparator 2 matching relay
CR8700 R Turned ON during pulse output
APPENDICES
Control memory entries (CM0000 to CM8999) can be used to perform operations such as checking the
operation status of the base unit and setting and monitoring the built-in functions.
Control memory entries reserved for the system cannot be used.
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM0000,
Device setting displayed on the first line Set
CM0001
CM0002,
Device setting displayed on the second line Set
CM0003
APPENDICES
CM0004, Operator panel KV-D30
Device setting displayed on the third line Set
CM0005 Page 0
CM0006,
Device setting displayed on the fourth line Set
CM0007
CM0008,
Reserved for the system Set
CM0009
CM0010 to
Page 1 to 19 (the same as CM0000 to CM0009) Set
CM0199
CM0200,
Attribute setting displayed on the first line Set
CM0201
CR/CM List
CM0202,
Attribute setting displayed on the second line Set
CM0203
CM0204,
Operator panel KV-D30 Attribute setting displayed on the third line Set
CM0205
Page 0
CM0206,
Attribute setting displayed on the fourth line Set
CM0207
CM0208 Template 1 setting Set
CM0209 Template 2 setting Set
CM0210 to
Page 1 to 19 (the same as CM0200 to CM0209) Set
CM0399
CM0400 For enabling and disabling transitions Set
CM0401 For the page switching setting Set
CM0402 Current page displayed Set
CM0403 to Operator panel KV-D30 Reserved for the system Set
CM409
CM0410 to
Direct access function Set
CM415
CM0416 to
Reserved for the system Set
CM0499
CM0500 to
- Reserved for the system
CM699
CM0700 R Read from RTC (year)
CM0701 R Read from RTC (month)
CM0702 R Read from RTC (day)
CM0703 R Read from RTC (hour)
CM0704 R Read from RTC (minute)
CM0705 R Read from RTC (second)
CM0706 R Read from RTC (day of the week)
CM0707 - Reserved for the system
CM0708,
R 32-bit, 1 ms, free-run counter
CM709
CM0710 Reserved for the system
CM0711 R CPU function version
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM0712 to
- Reserved for the system
CM719
CM0720 R Scan time measured value (in units of 10 μs)
CM0721 Set value during fixed scan time operation (in units of 10 μs)
Scan time (in units of 10 μs) when the scan time setting (the fixed scan time
CM0722 R
operation and END processing time settings) is exceeded
CM0723 R END processing time measured value (in units of 10 μs)
CM0724,
- Reserved for the system
CM725
CM0726 R Minimum scan time value (in units of 10 μs)
CM0727 R Maximum scan time value (in units of 10 μs)
APPENDICES
CM1605
CM1606,
R Input capture when INT3 occurs
CM1607
CM1608 to
- Reserved for the system
CM1619
CM1620 Input time constant setting ○
CM1621 to
- Reserved for the system
CM1629
CM1630,
R Analog volume 0
CM1631
CM1632,
R Analog volume 1
CM1633
CM1634 to
- Reserved for the system
CM1649
CM1650 R Number of sensor setting instruction executions
CM1651 to
- Reserved for the system
CM1657
CM1658 R Number of consecutive project password authentication failures ○
CM1659 R Total number of project password authentication failures ○
CM1660 to
R Free space in the logging or tracing ring buffer (in units of kB; ID0 to ID10)
CM1669
CM1670 to
- Reserved for the system
CM1679
CM1680 R Logging or tracing 0 file save counter ○
CM1681 R Logging or tracing 1 file save counter ○
CM1682 R Logging or tracing 2 file save counter ○
CM1683 R Logging or tracing 3 file save counter ○
CM1684 R Logging or tracing 4 file save counter ○
CM1685 R Logging or tracing 5 file save counter ○
CM1686 R Logging or tracing 6 file save counter ○
CM1687 R Logging or tracing 7 file save counter ○
CM1688 R Logging or tracing 8 file save counter ○
CM1689 R Logging or tracing 9 file save counter ○
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM1690 to
- Reserved for the system
CM1699
CM1700 R AutoLoad folder No. (request) ○
CM1701 R RunLoad folder No. (request) ○
CM1702 R Folder No. during project load (request) ○
CM1703 R Folder No. during project save (request) ○
CM1704 to
Reserved for the system
CM1709
CM1710 R Completion code of automatic loading when power is turned on
CM1711 R Automatic loading folder No. during power-on (complete)
APPENDICES
CM1712 R Automatic loading completion code during PROG→RUN ○
CM1713 R Automatic loading folder No. during PROG→RUN (complete) ○
CM1714 R Completion code during project load ○
CM1715 R Folder No. during project load (complete) ○
CM1716 R Completion code during project save ○
CM1717 R Folder No. during project save (complete) ○
CM1718,
- Reserved for the system
CM1719
CR/CM List
CM1720 User message 1 ○
CM1721 to User message 2
CM1737 (up to 24 characters + end code (00H)) ○
CM1738 Access window operation disabled setting ○
CM1739 Reserved for the system
CM1740 to Ladder project name
CM1756 (up to 32 characters + end code (00H))
CM1757 to Project name to be displayed in the access window
CM1763 (up to 12 characters + end code (00H))
CM1764 to
- Reserved for the system
CM1779
CM1780 Access window initial screen setting, enabled ○
CM1781 Access window initial screen setting, device type ○
Access window
CM1782 Access window initial screen setting, screen ID ○
CM1783 Access window initial screen setting, screen ID ○
CM1784 Access window initial screen setting, device number ○
CM1785 Access window initial screen setting, device number ○
CM1786 Access window initial screen setting, display format ○
Access window initial screen setting, device name
CM1787 ○
representation
CM1788 Access window initial screen setting, key lock status ○
Access window initial screen setting, display
CM1789 ○
language
CM1790 to
- Reserved for the system
CM2199
CM2200 Year and month ○
CM2201 Day ○
CM2202 Hour ○
CM2203 Minute ○
CM2204 Seconds ○
CM2205 Detailed information of Number ○
the latest serious error, 1
CM2206 Detailed information, number of valid pieces of data ○
unit
CM2207 Detailed information, piece 01 ○
CM2208 Detailed information, piece 02 ○
: ○
CM2226 Detailed information, piece 20 ○
CM2227 to
- Reserved for the system
CM2249
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM2250 Year and month ○
CM2251 Day ○
CM2252 Hour ○
CM2253 Minute ○
CM2254 Seconds ○
Detailed information of
CM2255 the latest minor error, Number ○
1 unit*1
CM2256 Detailed information, number of valid pieces of data ○
CM2257 Detailed information, piece 01 ○
CM2258 Detailed information, piece 02 ○
APPENDICES
: ○
CM2276 Detailed information, piece 20 ○
CM2277 to
- Reserved for the system
CM2388
CM2389 R Number of connected expansion units
CM2390 R Error code for memory card instructions
CM2391 Power OFF when accessing memory card ○
CM2392 Memory card retry occurrence times ○
CR/CM List
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM4828,
- Reserved for the system
CM4829
CM4830 Constant when rotation direction is detected ○
CM4831 Enable, clear, and sign setting ○
CM4832,
High-speed counter Ring counter lower limit ○
CM4833
function (CTH3)
CM4834,
Ring counter upper limit ○
CM4835
CM4836,
Preset input ○
CM4837
CM4838,
- Reserved for the system ○
CM4839
APPENDICES
CM4840 to
- Reserved for the system
CM4899
CM4900,
R Frequency measured result (Hz or rpm)
CM4901
CM4902 Number of pulses per rotation ○
Frequency counter
CM4903 function (CTH0) Number of scans ○
CM4904 External input source ○
CM4905 - Reserved for the system
CM4906 Set frequency (Hz) ○
CR/CM List
Specified frequency pulse
CM4908 Duty cycle (0 to 100%) ○
output function (CH0)
CM4909 - Reserved for the system
CM4910,
R Frequency measured result (Hz or rpm)
CM4911
CM4912 Number of pulses per rotation ○
Frequency counter
CM4913 function (CTH1) Number of scans ○
CM4914 External input source ○
CM4915 - Reserved for the system
CM4916 Set frequency (Hz) ○
Specified frequency pulse
CM4918 Duty cycle (0 to 100%) ○
output function (CH1)
CM4919 - Reserved for the system
CM4920,
R Frequency measured result (Hz or rpm)
CM4921
CM4922 Number of pulses per rotation ○
Frequency counter
CM4923 function (CTH2) Number of scans ○
CM4924 External input source ○
CM4925 - Reserved for the system
CM4926 Set frequency (Hz) ○
Specified frequency pulse
CM4928 Duty cycle (0 to 100%) ○
output function (CH2)
CM4929 - Reserved for the system
CM4930,
R Frequency measured result (Hz or rpm)
CM4931
CM4932 Number of pulses per rotation ○
Frequency counter
CM4933 function (CTH3) Number of scans ○
CM4934 External input source ○
CM4935 - Reserved for the system
CM4936 Set frequency (Hz) ○
Specified frequency pulse
CM4938 Duty cycle (0 to 100%) ○
output function (CH3)
CM4939 Reserved for the system
CM4940 to
- Reserved for the system
CM4999
CM5000 to
For built-in serial assignment
CM5999
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM6000 to
For extension function assignment 1
CM6999
CM7000 to
For extension function assignment 2
CM7999
CM8000,
Target value or travel Set
CM8001
CM8002 Acceleration rate Set
CM8003 Deceleration rate Set
CM8004, CPU positioning function,
axis 1
Operation frequency Set
CM8005
CM8006 Point parameter 1 Operation mode Set
APPENDICES
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8800 I/O setting
CM8801 Sensor enable
CM8802,
Comparator 0, current value
CM8803
CM8804,
Comparator 1, current value
CM8805
CM8806,
Comparator 2, positioning
CM8807
CM8808 Starting speed
CM8809 Origin returning operation: starting frequency
CM8810 Origin returning operation: acceleration rate
APPENDICES
CM8811 Origin returning operation: deceleration rate
CM8812,
Origin returning operation: operation frequency
CM8813
CM8814 Origin returning operation: detailed settings
CM8815 JOG operation: starting frequency
CM8816 JOG operation: acceleration rate
CM8817 CPU positioning function, JOG operation: deceleration rate
axis 1
CM8818,
JOG operation: operation frequency
CR/CM List
CM8819
CM8820,
Home position
CM8821
CM8822,
- Reserved for the system
CM8823
CM8824,
Current coordinate change value
CM8825
CM8826, Operation speed change value during speed control
CM8827 mode
CM8828,
Target coordinate change value
CM8829
CM8830,
R Output pulse, current coordinate
CM8831
CM8832,
R Output frequency, current value
CM8833
CM8834 R Error code
CM8835 R Execution point number
CM8836 to
- Reserved for the system
CM8839
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8840 I/O setting
CM8841 Sensor enable
CM8842,
Comparator 0, current value
CM8843
CM8844,
Comparator 1, current value
CM8845
CM8846,
Comparator 2, positioning
CM8847
CM8848 Starting speed
CM8849 Origin returning operation: starting frequency
CM8850 Origin returning operation: acceleration rate
APPENDICES
CM8859
CM8860,
Home position
CM8861
CM8862,
- Reserved for the system
CM8863
CM8864,
Current coordinate change value
CM8865
CM8866, Operation speed change value during speed control
CM8867 mode
CM8868,
Target coordinate change value
CM8869
CM8870,
R Output pulse, current coordinate
CM8871
CM8872,
R Output frequency, current value
CM8873
CM8874 R Error code
CM8875 R Execution point number
CM8876 to
- Reserved for the system
CM8879
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8880 I/O setting
CM8881 Sensor enable
CM8882,
Comparator 0, current value
CM8883
CM8884,
Comparator 1, current value
CM8885
CM8886,
Comparator 2, positioning
CM8887
CM8888 Starting speed
CM8889 Origin returning operation: starting frequency
CM8890 Origin returning operation: acceleration rate
APPENDICES
CM8891 Origin returning operation: deceleration rate
CM8892,
Origin returning operation: operation frequency
CM8893
CM8894 Origin returning operation: detailed settings
CM8895 JOG operation: starting frequency
CM8896 JOG operation: acceleration rate
CM8897 CPU positioning function, JOG operation: deceleration rate
axis 3
CM8898,
JOG operation: operation frequency
CR/CM List
CM8898
CM8900,
Home position
CM8901
CM8902,
Reserved for the system
CM8903
CM8904,
Current coordinate change value
CM8905
CM8906, Operation speed change value during speed control
CM8907 mode
CM8908,
Target coordinate change value
CM8909
CM8910,
R Output pulse, current coordinate
CM8911
CM8912,
R Output frequency, current value
CM8913
CM8914 R Error code
CM8915 R Execution point number
CM8916 to
Reserved for the system
CM8919
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8920 I/O setting
CM8921 Sensor enable
CM8922,
Comparator 0, current value
CM8923
CM8924,
Comparator 1, current value
CM8925
CM8926,
Comparator 2, positioning
CM8927
CM8928 Starting speed
CM8929 Origin returning operation: starting frequency
CM8930 Origin returning operation: acceleration rate
APPENDICES
CM8939
CM8940,
Home position
CM8941
CM8942,
Reserved for the system
CM8943
CM8944,
Current coordinate change value
CM8945
CM8946, Operation speed change value during speed control
CM8947 mode
CM8948,
Target coordinate change value
CM8949
CM8950,
R Output pulse, current coordinate
CM8951
CM8952,
R Output frequency, current value
CM8953
CM8954 R Error code
CM8955 R Execution point number
CM8956 to
Reserved for the system
CM8959
APPENDICES
10 Incorrect trigonometric function instruction operand.
11 Data could not be converted.
12 Incorrect table specification.
13 Incorrect time comparison instruction operand.
14 Incorrect cam switch operand.
15 Incorrect frequency counter instruction operand.
16 Divide by zero.
17 Illegal logging ID.
18 Direct processing error.
19 Unit on which direct processing cannot be performed.
20 Jump destination subroutine does not exist.
CR/CM List
21 Data being written during RUN mode, so instruction cannot
be executed.
22 Error for expansion unit-dedicated instructions (unit number).
23 Reserved for the system.
24 PIDAT, outside of operation setting range.
25 PIDAT, outside of sampling period range.
26 PIDAT, outside of comparison constant range.
27 PIDAT, outside of integral constant range.
28 PIDAT, outside of differential constant range.
29 PIDAT comparison constant, two-degree freedom
parameters outside of range.
30 PIDAT integral constant, two-degree freedom parameters
outside of range.
31 PIDAT differential constant, two-degree freedom parameters
outside of range.
32 PIDAT, outside of operation quantity upper limit or lower limit
range.
33 PIDAT, outside of operation quantity change width limit range.
34 PIDAT, outside of measured value change width range.
35 PIDAT, AT state transition error.
36 PIDAT, outside of operation control flag range.
37 Operation period exceeded.
38 PIDAT, outside of AT adjustment parameter range.
39 PIDAT, outside of AT hysteresis range.
40 PIDAT, outside of AT timeout range.
41 PIDAT, outside of AT calculation control mode setting range.
42 PIDAT, AT timeout.
43 PIDAT, AT comparison constant exceeded.
44 PIDAT, AT integral constant exceeded.
45 PIDAT, AT differential constant exceeded.
46 Root of negative number cannot be calculated.
47 Incorrect ABS instruction operand.
48 Calculation overflow.
49 UR, UM, or UV unit not connected.
50 Unit device (R) not assigned.
51 Unit device (DM) not assigned.
Detailed information, piece 2 Fixed to 00H
Detailed information, piece 3 Upper bits of the step number at which the error occurred
Detailed information, piece 4 Lower bits of the step number at which the error occurred
Detailed information, pieces 5 to 20 The module name is saved in SJIS format (any parts not occupied with
the module name are "00H")
• Error numbers 50, 53, 55, 56, 58, and 59 (unit number errors)
Detailed Information, Piece n Explanation
Unit number (the unit number will not be stored if it cannot be
Detailed information, piece 1
determined according to the occurrence conditions of the error)
Detailed information, pieces 2 to 20 Fixed to 00H
Detailed information, piece 1 Unit number of the expansion unit whose assignment is being overlapped
Detailed information, piece 2 Type of device that is being overlapped (R—relay: 1, DM: 2)
Number of the device that is being overlapped
Detailed information, piece 3
(channel number when the device type is R—relay, example: R1000 10)
Detailed information, pieces 4 to 20 Fixed to 00H
• Error numbers 96, 97, 98, 99, and 101 (extension adapter error)
Detailed Information, Piece n Explanation
Extension adapter number (left: 1, right: 2)
Detailed information, piece 1
(0 is stored when the slot cannot be determined)
Detailed information, piece 2 Reserved for the system
Detailed information, pieces 3 to 20 Fixed to 00H
Higher 4 bits
0 1 2 3 4 5 6 7 8 9 A B C D E F
N D S
0 U
L
L
E P 0 @ P ` p ー タ ミ
S D
1 O
H
C
1 ! 1 A Q a q 。 ア チ ム
S D
2 T
X
C
2 ” 2 B R b r 「 イ ツ メ
APPENDICES
E D
3 T
X
C
3 # 3 C S c s 」 ウ テ モ
E D
4 O
T
C
4 $ 4 D T d t 、 エ ト ヤ
E N
5 N
Q
A
K % 5 E U e u ・ オ ナ ユ
Lower 4 bits
A S
6 C
K
Y
N & 6 F V f v ヲ カ ニ ヨ
B E
7 ’ 7 G W g w ァ キ ヌ ラ
8 BS AN ( 8 H X h
C
x ィ ク ネ リ
9 HT EM ) 9 I Y i y ゥ ケ ノ ル
A LF UB * : J Z j
S
z ェ コ ハ レ
B VT C + ; K [
E
S k { ォ サ ヒ ロ
C FF → , < L \ l | ャ シ フ ワ
D CR ← ー = M ] m } ュ ス ヘ ン
E SO ↑ . > N ^ n ~ ョ セ ホ ゛
S D
F I ↓ / ? O _ o E
L ッ ソ マ °
C Counter
Timer, counter OUTC Output counter
instructions
ITVL Interval timer
UDC Up/down counter
UDT Up/down timer
Connection/
MEP/MEF Mep/Mef
End Instruction
Shift Instruction SFT Shift
STG/JMP/ENDS Stage / Jump / end stag,e
Stage processing
W-ON/W-OFF Wait ON/ Wait OFF
Applied instruction
Instructions W-UE/W-DE Wait rising edge / Wait falling edge
Sub-routine entry/Sub-routine return/to LABEL
Flow instruction SBN/RET/SCJ
instruction
File Register Instructions FRSTM/FRLDM File Register batch save / File Register batch read
RAMP/TPOUT/ Ramp signal, time proportional output, lead-lag
Arrithmetic Data control instructions
LLFLT filter
operation
instructions Text processing RCOM Character string readout
instruction
Data processing HKEY Hex key input
instructions SORTN Split and sort binary data
Cam switch instructions ABSENC/INCENC Abstract encoder / incremental encoder
Frequency counter
FCNT/RCNT Measure frequency / Measure speed
instructions
PID control instruction PID/PIDAT PID / PID with auto tuning
MWRIT/MREAD/ Write storage device/read storage device/get storage
MFREE/MMKDIR device space/create storage device directory
Extended MRMDIR/MDEL Delete storage device file/folder
Instructions Storage device
Write storage device text string / read one storage
instructions MPRINT/MREADL/
device line / copy storage device file / move
MCOPY/MMOV/
storage device file / rename storage device file /
MREN/MFREEK/
get storage device free space in kilobyte unit / get
MSTAT
storage device file status
Access window AWNUM/AWMSG User message 1/2
instructions AWSHOW/AWHIDE Display user message/delete user message
Sensor setting SPRD/SPWR/ Read sensor parameter / write sensor parameter
instruction SSVC / execute sensor service
A-98 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Instruction Table Cannot be Used
● Function block
* The FEND (function block end) instruction is written in the function block. It cannot be used in other types of
programs such as functions or modules.
● Function
APPENDICES
Function block
Instructions FBSTRT Instance type function block start
instructions
FBCALL Instance type function block call
● Macro
* The MEND (macro end) instruction is written in the self-hold type macro. It cannot be used in other types of
programs such as sub-routine type macros or modules.
● Subroutine
APPENDICES
P
Precautions on the use of differential execution
type .......................................................................1-40
Index
Relationship between numerical representation ...1-35
16-bit data ············································ 1-35
32-bit data ············································ 1-36
Value change when exceeding max. or
min. ····················································· 1-37
Representation of numerical value .......................1-32
BIN ····················································· 1-32
BIN Coded DEC ····································· 1-33
DEC signed ·········································· 1-32
DEC unsigned ······································· 1-32
Double precision floating point type real
number ················································ 1-34
HEX ···················································· 1-32
Single precision floating point type real
number ················································ 1-33
S
Shift JIS code ........................................................1-38
Single precision floating point type real number ...1-33
Structure of Instruction ............................................1-3
Instruction Code ······································ 1-3
Operand Code ········································· 1-3
Processing time of instructions ···················· 1-3
Subroutine ............................................................ A-99
Suffix .....................................................................1-28
Definition of Suffixes ······························· 1-28
Difference between .D and .L ··················· 1-29
Difference between .U and .S ··················· 1-29
System device ............................. 1-7, 1-11, 1-15, 1-18
T
Types of Instruction .................................................1-2
Applied Instructions ·································· 1-2
Arithmetic Operation Instructions ················· 1-2
Basic Instructions ····································· 1-2
Extended Instructions ······························· 1-2
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-101
Instruction Index
BCMP ................................................................... 5-47
Symbols BCMPI .................................................................. 5-51
BCNT ...................................................................... 5-9
< ..........................................................................2-12 BLD ......................................................................... 2-8
<= .......................................................................2-12 BLDB ...................................................................... 2-8
<> .......................................................................2-12 BMOV ................................................................... 4-24
= ..........................................................................2-12 BOR ........................................................................ 2-8
> ..........................................................................2-12 BORB ..................................................................... 2-8
>= .......................................................................2-12 BOUB ................................................................... 2-34
BOUT .................................................................... 2-34
BREAK ................................................................. 3-33
A BRES .................................................................... 2-36
BSET .................................................................... 2-36
ABS .....................................................................4-186 BSIZE ................................................................... 3-98
APPENDICES
AJST .....................................................................5-94
ALT .......................................................................2-31 C ........................................................................... 2-46
ANB .........................................................................2-2 CAL- ................................................................... 4-324
AND ........................................................................2-2 CAL^ ................................................................... 4-340
ANDA ....................................................................4-80 CAL* ................................................................... 4-328
ANDCAL .............................................................5-101 CAL/ .................................................................... 4-332
ANDCALB ...........................................................5-101 CAL& .................................................................. 4-336
ANDWK .................................................................5-96 CAL+ ................................................................... 4-320
ANDWKB ..............................................................5-96 CAL<< ................................................................ 4-348
ANF .........................................................................2-4 CAL>> ................................................................ 4-344
ANFB ......................................................................2-6 CAL | ................................................................ 4-338
ANL .......................................................................2-68 CAL~ ................................................................... 4-342
ANP .........................................................................2-4 CALL ..................................................................... 3-27
ANPB ......................................................................2-6 CHGSP ....................................................................* 1
APR .....................................................................4-138 CHGSPX .................................................................* 1
ARES ..................................................................5-105 CHGSPY .................................................................* 1
ASC .....................................................................4-236 CHGTGT .................................................................* 1
ASIN ....................................................................4-232 CJ ......................................................................... 3-37
ASLA ...................................................................4-104 CMP ...................................................................... 4-72
ASRA ..................................................................4-100 COM ..................................................................... 4-88
ATAN ..................................................................4-232 CON ...................................................................... 2-64
ATAN2 ................................................................4-234 COS .................................................................... 4-228
AVG ......................................................................5-27 CPMGET ............................................................ 4-194
AWHIDE ..............................................................5-239 CPMSET ............................................................. 4-188
AWMSG ..............................................................5-235 CPSASC ............................................................. 4-316
AWNUM ..............................................................5-233 CRC ...................................................................... 5-39
AWSHOW ...........................................................5-237
D
B
DASC .................................................................. 4-240
BANB ......................................................................2-8 DCNT .................................................................... 5-11
BAND ......................................................................2-8 DEC ...................................................................... 4-64
BANDC ...............................................................4-134 DECO ................................................................. 4-182
BBCMP .................................................................5-55 DEG .................................................................... 4-224
BBMOV .................................................................4-38 DFLOAT ............................................................. 4-200
*1 Refer to the user's manual for the CPU or base unit.
DFTOF ................................................................4-210
DI ........................................................................5-109 H
DIC ......................................................................5-111
DIFD ......................................................................2-22 HASC .................................................................. 4-248
DIFU ......................................................................2-22 HKEY ...................................................................... 5-2
DINTG .................................................................4-206 HOME ......................................................................* 1
DISB ....................................................................4-172 HOMEX ...................................................................* 1
DISF ....................................................................4-214 HOMEY ...................................................................* 1
DISN ...................................................................4-168 HSP .................................................................... 5-107
DISS ....................................................................4-308
DIV ........................................................................4-54
DMX ....................................................................4-162 I
DSER ....................................................................5-19
DW ........................................................................4-20 INC ....................................................................... 4-60
APPENDICES
INCENC ...................................................................* 1
INT ...................................................................... 5-113
E INTG ................................................................... 4-202
INV ........................................................................ 2-70
ECALL ...................................................................3-31 IS_ □□□ ........................................................... 3-100
EI .........................................................................5-109 ITVL ...................................................................... 2-52
ENCO ..................................................................4-184
END ......................................................................2-62
ENDH ....................................................................2-62 J
Instruction Index
ENDS ....................................................................3-12
ENRA ....................................................................4-86 JMP ...................................................................... 3-12
EORA ....................................................................4-84 JOG .........................................................................* 1
EXP .....................................................................4-218 JOGX .......................................................................* 1
EXT .......................................................................5-43 JOGY .......................................................................* 1
F K
KEEP .................................................................... 2-20
FASC ..................................................................4-256
FB .........................................................................3-48
FBCALL ................................................................3-52
FBSTRT ................................................................3-52
L
FCNT ...................................................................... * 1
LABEL .................................................................. 3-37
FDEL .....................................................................5-88
LD ........................................................................... 2-2
FEND ....................................................................3-48
LDA ......................................................................... 4-6
FIFOR ...................................................................5-72
LDB ......................................................................... 2-2
FIFOW ..................................................................5-68
LDCAL ................................................................ 5-101
FINS ......................................................................5-86
LDCALB .............................................................. 5-101
FLIK ......................................................................2-29
LDF ......................................................................... 2-4
FLOAT ................................................................4-198
LDFB ...................................................................... 2-6
FMOV ....................................................................4-26
LDP ......................................................................... 2-4
FOR ......................................................................3-33
LDPB ...................................................................... 2-6
FRLDM ..................................................................3-74
LDWK ................................................................... 5-96
FRSET ..................................................................3-70
LDWKB ................................................................. 5-96
FRSTM ..................................................................3-72
LEN ..................................................................... 4-264
FTODF ................................................................4-212
LIFOR ................................................................... 5-80
FUN .......................................................................3-48
LIFOW .................................................................. 5-76
FWRIT ...................................................................5-84
LIMIT .................................................................. 4-132
LLFLT ................................................................. 4-154
G LOG .................................................................... 4-218
LOG10 ................................................................ 4-222
GOTO ...................................................................3-37 LOGD ......................................................................* 1
LOGE .......................................................................* 1
GRY ....................................................................4-164
*1 Refer to the user's manual for the CPU or base unit.
ORG ........................................................................ * 1
M ORGX ...................................................................... * 1
ORGY ...................................................................... * 1
MAX ......................................................................5-21 ORWK .................................................................. 5-96
MC ........................................................................3-23 ORWKB ................................................................ 5-96
MCALL ..................................................................3-43 OUB ...................................................................... 2-16
MCMP ..................................................................... * 1 OUT ...................................................................... 2-16
MCOPY ...............................................................5-209 OUTC ................................................................... 2-50
MCR ......................................................................3-23
MDEL ..................................................................5-197
MDSTOP ...............................................................3-56 P
MDSTRT ...............................................................3-56
MEF ......................................................................2-72 PID ..................................................................... 5-121
MEMSW ..................................................................3-4 PIDAT ................................................................. 5-130
APPENDICES
MPRINT ..............................................................5-199
MPS ......................................................................2-66
MPX ....................................................................4-162
R
MRD ......................................................................2-66
RAD .................................................................... 4-224
MREAD ...............................................................5-179
RAMP ................................................................. 4-146
MREADL .............................................................5-203
RASC ................................................................. 4-238
MREN .................................................................5-221
RCOM ................................................................ 4-312
MRMDIR .............................................................5-195
RCNT ....................................................................... * 1
MSTAT ................................................................5-229
RCPSASC .......................................................... 4-318
MSTRT ..................................................................3-43
RDASC ............................................................... 4-244
MUL ......................................................................4-48
RES ...................................................................... 2-18
MWRIT ................................................................5-167
RET ...................................................................... 3-27
RETI ................................................................... 5-113
N RFASC ............................................................... 4-260
RFSCI ................................................................. 5-255
RFSCO ............................................................... 5-260
NCJ .......................................................................3-37
RFSFRC ............................................................. 5-241
NEG ......................................................................4-90
RFSPS .................................................................... * 1
NEXT ....................................................................3-33
RFSPSX .................................................................. * 1
RFSPSY .................................................................. * 1
RFSX .................................................................... 2-74
O RFSY .................................................................... 2-74
RGRY ................................................................. 4-164
OFDL ....................................................................2-25
RHASC ............................................................... 4-252
ONDL ....................................................................2-25
RLA .................................................................... 4-112
OR ...........................................................................2-2
RLNCA ............................................................... 4-120
ORA ......................................................................4-82
RND ...................................................................... 5-58
ORB ........................................................................2-2
ROOT ................................................................... 4-66
ORCAL ................................................................5-101
RRA .................................................................... 4-108
ORCALB .............................................................5-101
RRNCA ............................................................... 4-116
ORF ........................................................................2-4
RSEC ................................................................... 5-92
ORFB ......................................................................2-6
ORL .......................................................................2-68
ORP ........................................................................2-4
ORPB ......................................................................2-6
*1 Refer to the user's manual for the CPU or base unit.
S U
SADD ..................................................................4-268 U_ □□□□□ (Unit special instruction)
SBN .......................................................................3-27 For KV-XLE02/EP21V/KV-NC1EP
SCJ .......................................................................3-41 U_CSTOP .....................................................* 2
SCMP ..................................................................4-304 U_CSTRT ......................................................* 2
SDEL ...................................................................4-290 U_CREG .......................................................* 2
SEC .......................................................................5-92 U_CERR ........................................................* 2
SEG ........................................................................5-5 U_MSGTO .....................................................* 2
SER .......................................................................5-15 U_MSGSND ..................................................* 2
SET .......................................................................2-18 U_MSGRCV ..................................................* 2
U_MSGST .....................................................* 2
SFIND .................................................................4-296
U_NDTO ........................................................* 2
SFINDN ...............................................................4-300
APPENDICES
U_NDSTAT ...................................................* 2
SFT .........................................................................3-2
U_SBMON .....................................................* 2
SHOT ....................................................................2-27
U_SBNAME ...................................................* 2
SIN ......................................................................4-228 U_STMON .....................................................* 2
SINS ....................................................................4-286 U_SLREG ......................................................* 2
SLA .......................................................................4-98 For KV-XLE02/EP21V/LE21V/LE20V/KV-NC1EP
SLEFT .................................................................4-274 U_ELCYC (KV-EP21V/LE21V/NC1EP) .....* 2
SMID ...................................................................4-278 U_ELSTAT(KV-EP21V/LE21V/NC1EP).... * 2
SMOV .................................................................4-266 U_FCSTAT*3 .................................................* 2
SORT ....................................................................5-60 U_MLATTA ....................................................* 2
Instruction Index
SORTN .................................................................5-64 U_MLSTAT ....................................................* 2
SPRD ..................................................................5-243 U_MLSUB .....................................................* 2
SPWR .................................................................5-247 U_MLTEXT ....................................................* 2
SRA .......................................................................4-94 U_MLTO ........................................................* 2
SRGHT ...............................................................4-270 U_MLTOGR ..................................................* 2
SRPLC ................................................................4-282 U_SOPEN .....................................................* 2
SSVC ..................................................................5-251 U_SRCVNP ...................................................* 2
STA .......................................................................4-10 U_SRDBUF ...................................................* 2
U_SSTAT ......................................................* 2
STE .........................................................................3-8
U_SUDPTO ...................................................* 2
STG .......................................................................3-12
U_SWRBUF ..................................................* 2
STP .........................................................................3-8
For KV-XLE02/XL202/XL402
STRIM .................................................................4-294
U_PLSTAT ....................................................* 2
SUB .......................................................................4-44 U_PLCYC ......................................................* 2
SWAP .................................................................4-176 U_PRDBUF ...................................................* 2
For KV-XLE02
U_CCTTO .....................................................* 2
T U_CCTSND ...................................................* 2
U_CCTRCV ...................................................* 2
TAN .....................................................................4-228 U_CCTST ......................................................* 2
TBCD ..................................................................4-158 U_SSELPT ....................................................* 2
TBIN ....................................................................4-160 For KV-SC20V/SSC02
TCH ......................................................................... * 1 U_RDCNT .....................................................* 2
TCHX ...................................................................... * 1 U_RDCPT0 ...................................................* 2
TCHY ...................................................................... * 1 U_RDCPT1 ...................................................* 2
TMH ......................................................................2-38 U_RDHZ ........................................................* 2
TMIN .....................................................................4-18 U_RDRPM .....................................................* 2
TMR ......................................................................2-38 U_WRCNT ....................................................* 2
TMS ......................................................................2-38 U_WRCTC0 ..................................................* 2
TMU ......................................................................2-42 U_WRCTC1 ..................................................* 2
TPOUT ................................................................4-150 U_WRPST .....................................................* 2
TRGD ...................................................................... * 1 For KV-SSC02
TRGR ...................................................................... * 1 U_DISOCP ....................................................* 2
U_RDBF ........................................................* 2
For KV-AD40V/SAD04
U_RDAD ........................................................* 2
U_RDADB .....................................................* 2
*1 Refer to the user's manual for the CPU or base unit.
*2 Please refer to related unit user's manual.
*3 Only KV-XLE02/EP21V/LE21V/KV-NC1EP is supported.
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-105
Instruction Index
APPENDICES
Instruction Index
E 1101-3
Copyright (c) 2018 KEYENCE CORPORATION. All rights reserved. 084575GB 2050-1 909GB Printed in Japan