Professional Documents
Culture Documents
(Plc4me - Com) Instruction Reference Manual
(Plc4me - Com) Instruction Reference Manual
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-7000/5000/3000/1000 Series
This Manual describes a variety of instructions in ladder diagram
and KV Nano Series
programming.
Instruction Reference Manual
KV-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-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.
449GB
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1
KV-7500/7300 Series CPU Function Version
The KV-7000 Series functions differ according to 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. 8 or later is required).
The CPU function version can be updated using "Tools"→"Check CPU function version"→"PLC"→
"System program update" in the KV STUDIO menu (* KV STUDIO Ver. 8.1 or later is required).
■ Differences in CPU function according to CPU function version
Release date July 2017 June 2016 December 2015 June 2015 March 2015
CPU function version 2.2 2.1 2.0 1.1 1.0
KV STUDIO compatible version 9.2 or later 9.1 or later 9.0 or later 8.1 or later 8.0 or later
Compatible KV-7500 Yes Yes Yes Yes Yes
CPU unit KV-7300 Yes Yes Yes Yes Yes
KV-XLE02
Compatible KV-XL402 Yes No
expansion KV-XL202
unit KV-XH16ML
Yes No
KV-XH04ML
Project name Up to 64 characters Up to 32 characters
Program name Up to 64 characters Up to 24 characters
Program comment Up to 256 characters Up to 32 characters
OFF processing setting when
Yes No
program execution is stopped
Assignment for interrupt program
CPU Yes No
of work area for script text string
function
Inter-unit synchronization Yes No
Inter-unit synchronization
Yes No
read/write CPU device
KV socket communication Yes*1 No
Function block function Yes (compatible with unspecified unit argument types) Yes No
Application package Yes No No
Function block instruction 3 instructions added (FB,FEND,FUN) No additions
Unit program instruction 5 instructions added (UMALLOC,UPSTRT, UPSTOP,UFSUS,UFRSM) No additions
Instructions Floating point instruction 1 instruction added (ATAN2) No additions
script Data control instruction Specifications of 1 instruction expanded (APR)*2 No additions
Data processing instruction Specifications of 4 instructions expanded (MAX,MIN,AVG,WSUM)*3 No additions
Unit type judgment instruction Yes No
*1 KV socket communication can only be used with the KV-7500.
*2 Double precision floating point type real numbers can now be specified in linear approximation
instructions (APR). (Scaling)
*3 Single/double precision floating point type real numbers can now be specified in search max.
value (MAX), search min. value (MIN), average (AVG), and word sum (WSUM) instructions.
KV Nano Series CPU Function Version
The KV Nano Series functions differ according to 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. 7 or later is required).
The CPU version can be updated using "Tools"→"Check CPU function version"→"System program
update" in the KV STUDIO menu (* KV STUDIO Ver. 7.1 or later is required).
■ Differences in CPU function according to CPU function version
KV-N14*/N24*/N40*/N60*
CPU Function version Release date Compatible functions
Ver. 1.0 October 17, 2012 Initial version
Ver. 2.0 May 15, 2013 Compatible with EtherNet/IP unit KV-NC1EP
KV-NC32T
CPU Function version Release date Compatible functions
Ver. 2.0 May 15, 2013 Initial version
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.
APPENDICES
Arithmetic Operation Storage ································································A-2
Internal registers/temporary data memory storage state list······································· A-2
Operation Processing Time Table ··························································A-9
Design of Processing Time················································································· A-9
Basic Instructions ··························································································· A-10
Applied Instructions ························································································ A-13
Arithmetic Operation Instructions ······································································· A-16
Extended Instructions······················································································ A-30
Instruction Size Table ········································································· A-40
Calculation Method of Byte Size ··································································A-40
About Destination Size ··············································································A-41
Operand Table Size (For the KV Nano Series) ····················································· A-41
Instruction Size Table················································································A-42
CR/CM List ························································································ A-71
Control Relays CR (For KV-7500/7300) ······························································ A-71
Control Memory CM (For KV-7500/7300) ···························································· A-74
Control Relays CR (For KV-5500/5000/3000)······················································· A-79
Control Memory CM (For KV-5500/5000/3000)····················································· A-85
Control Relays CR (For KV Nano series)····························································· A-92
Control Memory Entries CM (For KV Nano series) ···············································A-103
Character Code Table ······································································· A-115
ASCII Code Table ·························································································A-115
Instruction Table Cannot be Used ······················································ A-116
Index ······························································································ A-118
Instruction Index ·············································································· A-120
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.
Term Explanation
Programmable Controller An electronic device which can control freely the machines by altering
programs, which is also called "PLC (Programmable Logic Controller)".
《KV-7500/7300/5500/5000/ Programmable Controller KV-5500/5000/3000/1000 Series unit made by
3000/1000》 Keyence Corporation
KV-7000/5000/3000/1000 The generic term for expansion units that can be connected to the KV-7000/
Series 5000/3000/1000 CPU unit.
CPU unit KV-7500/7300/5500/5000/3000/1000
KV-N14/N24/N40/N60/NC32T Base unit made by Keyence Corpration
KV Nano Series The generic term for expansion units that can be connected to the KV-N14/
N24/N40/N60/NC32T base unit.
Base unit KV-N14/N24/N40/N60/NC32T
KV-7000 Series expansion unit Expansion I/O units and expansion special units other than CPU units that
can be used with the KV-7000 Series.
KV-5000/3000/1000 Series Expansion I/O units and expansion special units other than CPU units that
expansion unit can be used with the KV-5500/5000/3000/1000 Series.
KV Nano Series expansion unit The expansion I/O unit, expansion special unit which can be used by KV
Nano series other than the basic unit.
KV STUDIO Supportive software for the programming of KV Series.
Ladder program Program made by using the KV STUDIO Ladder Support Software
《KV-5000 Ver.1.1》 Indicates KV-5000/3000 released after September 10, 2009, of which the
《KV-3000 Ver.1.1》 CPU function version 1.1 is indicated as Ver. 1.1 on the serial label on the
side.
Used for distinction from KV-5000/3000 older than CPU function version 1.1.
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-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 "KV-7000 Series User’s
Manual", "KV-5500/5000/3000 Series User’s Manual", "KV-1000 Series User’s Manual" or
"KV Nano Series User’s Manual".
Reference For searching instruction word, please refer to the following screens.
• Search desired instructions words "Contents" (Page 6)
• Search instruction words with the Arabic numeral sequence index "Instruction
Index" (Page A-120)
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 (in some cases instructions have 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-23)
"Data Processing" (Page 1-26)
■ 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
functions are executed. S2 …)
Assign a storage area for function Destination D (when multiple constants exist D1
execution results D2 …)
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".
Example
Transfer constant "0" to device "DM0".
MOV
#0 DM0
For more information about device and constant, please see "Device and Constant" (Page 1-5).
The devices or constants used in an instruction operand vary depending on instruction words.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-3
BRIEF EXPLANATION OF
Structure of Instruction
INSTRUCTIONS
Process time of individual instructions vary depending on specified operands or execution conditions.
"Arithmetic Operation Storage" (Page A-2)
BRIEF EXPLANATION OF
INSTRUCTIONS
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 "KV-7000 Series User’s Manual", "KV-5500/5000/3000 Series User's
Manual", "KV-1000 Series Programming Manual" or "KV Nano Series User's Manual". 1
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 *9 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 *9 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 *9 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-8)
*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-7000 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-7000 series User's Manual "Indirect specifying""
*7 Specify all device No. in HEX.
*8 "DR" represents direct processing.
"KV-7000 series User's Manual "About direct processing""
*9 For CPU function versions older than 2.2, the number of points for R is 16000 and the range is
R00000 to R99915.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-5
BRIEF EXPLANATION OF
■ 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
Device and Constant
Expansion data
EM0 to EM65534 65535 Clear/hold*2 Yes Yes Yes Yes
memory
Device for storing
Dial mode
524288 numerical data No
ZF0 to ZF524287 *2
File register (16-bit) Clear/hold Yes Yes Yes
Current bank (32768×16
Yes*9
FM0 to FM32767 bank)
Link register W0 to W7FFF*8 32768 Clear/hold*2 No Yes Yes Yes
Temporary Device for storing
TM0 to TM511 512 Clear Yes Yes Yes Yes
memory numerical data (16-bit)
10μs, 1ms, 10ms, 100ms Current value :
Timer
down counter, 10ms Clear*4
(current/setting T0 to T3999 4000 Yes Yes Yes No
current/setting value of Setting value:
value)
up/down counter (32-bit) Hold
Counter Current/setting value
(current/setting C0 to C3999 4000 of up counter and up/ Clear/hold*6 Yes Yes Yes No
value) down counter (32-bit)
Devices that can be
Index register Z1 to Z12*5 12 used in index Clear No No No No
modify (32-bit)
Devices used for
controlling PLC
Control
CM0 to CM5999 6000 function or capturing Hold No No No No
memory*3
the status from
peripherals (16-bit).
*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-8)
*2 Clear/Hold settings can be made in the "Power Failure Holding" option.
*3 "KV-7000 series User's Manual "CR/CM table""
*4 Up/down timers (UDT) hold the current value.
*5 Z11 and Z12 are reserved for the system and cannot be used.
*6 Hold/Clear setups can be made in the "Power Failure Holding" option. (only for contacts and current values)
*7 "Store" is a device that can be described as "*(device)". "Lookup" is a device that can be indirectly specified.
"KV-7000 series User's Manual "Indirect specifying""
*8 Specify all device No. in HEX.
*9 Bank switching can not be available for local devices.
INSTRUCTIONS
■ Macro operand device
The macro operand devices used only in macros are shown as follows.
Indirect Local Index
Attribute Sign Range Description
specifying (*) device (@) modify(:)
Device P P0 to P9 Devices are used as argument. No No Yes 1
Device values or constants are
Value V V0 to V9 No No No
■ 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", "Month/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)
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-7
BRIEF EXPLANATION OF
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
1 local devices setting” on the “Workspace”.
Local device Global device
Device and Constant
Total
Device name*1 Reserved devices in the whole
Counts/range number
project*2
32000 points (2000 CH) 32000 points
Relay (R) *3 None
R000 to R199915 (2000 CH)
32000 points (200 CH) 64000 points
Internal auxiliary relay (MR)*3 32000 points (200 CH)
MR000 to MR199915 (4000 CH)
8000 points (500 CH) 16000 points
Latch relay (LR)*3 8000 points (500 CH)
LR000 to LR49915 (1000 CH)
2500
Timer (T)*4 1500 points 4000 points
T0 to T2499
2500
Counter (C) *4 1500 points 4000 points
C0 to C2499
40535
Data memory (DM) 25000 points 65535 points
DM0 to DM40534
20535
Expansion data memory (EM) 45000 points 65535 points
EM0 to EM20534
512
Temporary data memory (TM) None 512 points
TM000 to TM511
*1 Link relays (B), link registers (W), file registers (ZF), control relays (CR), control memories (CM),
and index registers (Z) cannot be used as device.
When using @FMxxx, local devices in workspace will be occupied.
*2 When a project is created, the device area used for global devices can be guaranteed as a
whole(suppose 10 modules are used and 50 counts of macro calling).
The number of reserved devices can be changed as required.
*3 Number can be set in “ch” unit.
*4 "@+ (device code)" can be used only when the device code is specified as an operand for timer/
counter instructions. (Example for inputting mnenomic : TMR @0 #100).
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.
INSTRUCTIONS
KV-5500/5000/3000 Series
Device List
1
■ Bit device
■ 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
Device and Constant
Expansion data
EM0 to EM65534 65535 Clear/hold*2 Yes Yes Yes Yes
memory
Device for storing
Dial mode
131072 points numerical data No
ZF0 to ZF131071 *2
File register (16-bit) Clear/hold Yes Yes Yes
Current group (32768×4
Yes*9
FM0 to FM32767 bank) points
Link register W0 to W3FFF*8 16384 Clear/hold*2 No Yes Yes Yes
Temporary Device for storing
TM0 to TM511 512 Clear Yes Yes Yes Yes
memory numerical data (16-bit)
10μs, 1ms, 10ms, 100ms Current value :
Timer
down counter, 10ms clear*4
(current/setting T0 to T3999 4000 Yes Yes Yes No
current/setting value of Setting value:
value)
up/down counter (32-bit) Hold
Counter Current/setting value
(current/setting C0 to C3999 4000 of up counter and up/ Clear/hold*6 Yes Yes Yes No
value) down counter (32-bit)
High-speed High-speed
counte CTH0 to CTH1 2 counter current Clear/hold*6 No No No No
(current value) value (32-bit)
High-speed counter
High-speed counter
comparator CTC0 to CTC3 4 Clear/hold*2 No No No No
setting value (32-bit)
(setting value)
Devices that can be
Index register Z1 to Z12*5 12 used in index Clear No No No No
modify (32-bit)
Devices used for
controlling PLC
Control
CM0 to CM5999 6000 function or capturing Hold No No No No
memory*3
the status from
peripherals (16-bit).
*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-8)
*2 Clear/Hold settings can be made in the "Power Failure Holding" option.
*3 "KV-5500/5000/3000 series User's Manual "CR/CM table""
*4 Up/down timers (UDT) hold the current value.
*5 Z11 and Z12 are reserved for the system and cannot be used.
*6 Hold/Clear setups can be made in the "Power Failure Holding" option. (only for contacts and current values)
*7 "Store" is a device that can be described as "*(device)". "Lookup" is a device that can be indirectly specified.
"KV-5500/5000/3000 series User's Manual "Indirect specifying""
*8 Specify all device No. in HEX.
*9 Bank switching can not be available for local devices.
INSTRUCTIONS
■ Macro operand device
The macro operand devices used only in macros are shown as follows.
Indirect Local Index
1
Attribute Sign Range Description
specifying (*) device (@) modify(:)
Device P P0 to P9 Devices are used as argument No No Yes
■ 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", "Month/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)
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
1 local devices setting” on the “Workspace”.
Local device Global device
Device and Constant
Total
Device name*1 Reserved devices in the whole
Counts/range number
project*2
16000 points (1000 CH) 16000 points
Relay (R) *3 None.
R000 to R99915 (1000 CH)
8000 points (500 CH) 16000 points
Internal auxiliary relay(MR)*3 8000 points (500 CH)
MR000 to MR49915 (1000 CH)
8000 points (500 CH) 16000 points
Latch relay (LR)*3 8000 points (500 CH)
LR000 to LR49915 (1000 CH)
2500
Timer (T)*4 1500 4000
T0 to T2499
2500
Counter (C) *4 1500 4000
C0 to C2499
40535
Data memory (DM) 25000 65535
DM0 to DM40534
20535
Expansion data memory (EM) 45000 65535
DM0 to DM20534
512
Temporary data memory (TM) None. 512
TM000 to TM511
*1 Link relays (B), link registers (W), file registers (FM/ZF), high-speed counters (CTH), high-speed counter
comparator (CTC), control relays (CR), control memories (CM), and index registers (Z) cannot be used as device.
When using @FMxxx, local devices in workspace will be occupied.
*2 When a project is created, the device area used for global devices can be guaranteed as a
whole(suppose 10 modules are used and 50 counts of macro calling. )
The number of reserved devices can be changed as required.
*3 Number can be set in “ch” unit.
*4 "@+ (device code)" can be used only when the device code is specified as an operand for timer/
counter instructions. (Example for inputting mnenomic : TMR @0 #100).
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.
INSTRUCTIONS
KV-1000 Series
Device List
1
■ Bit device
*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-8)
*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-71)
*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.
■ Word device
When start Indirectly
Local Pointer specified (*)*8
Device Number of
name Range*1 point Main functions operation device modify
Power (@)(@)*1 (: Z/: #) Refer- Store
1
( ON ) ence
Data memory DM0 to DM65534 65535 Hold*2 Yes Yes Yes Yes
*3 Device for storing
Expansion data EM0 to EM65534 65535 Hold*2 Yes Yes Yes Yes
Device and Constant
*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-8)
*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-71)
*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.
INSTRUCTIONS
■ Constant
Constant Range Main functions
#0 to #65535 (unsigned 16-bit)
1
-32768 to +32767 (signed 16-bit)
DEC(#) Use for specifying DEC constant
#0 to #4294967295 (unsigned 32-bit)
-2147483648 to +2147483647 (signed 32-bit)
■ Internal register
When start
Number of
Device name Range point Main functions operation
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 *2
Total number
Reserved devices in the whole project 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.
*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.
1 *4 This number includes the workspace used for script devices.
*5 Operands used as timer and counter instructions can be described as @+ (device code number)
Device and Constant
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.
INSTRUCTIONS
KV Nano Series
Device List
1
■ Bit device
*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)
■ Word device
Index Indirect
Number Start of Operation Local *2
Device * Modifica Specification (*)
Range 1 of Main Function Device
Name tion
1 Points Power On
Clear and
PROG
RUN
(@)*1
(:Z/:#) Reference Storage
Data Memory DM0 to DM32767 32768 Hold Yes Yes Yes Yes
Devices that can store hold*3
Device and Constant
INSTRUCTIONS
■ Macro argument devices
The macro argument devices, which can only be used in macros, are listed below.
Indirect Local Index
Attribute Symbol Range Description Specification Device
(*) (@)
Modification
(:) 1
The device is received as the
■ Constants
Constant Range Main Function
Used to specify decimal constants.
#0 to #65535 (unsigned 16 bit)
When you select
-32768 to +32767 (signed 16 bit) Reference
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) When you select
Hexadecimal ($) Reference
$00000000 to $FFFFFFFF (32 bit) XYM marking mode,
this is displayed as
"H."
Fixed character Used to specify fixed character
Examples) "Model number ABC," "Month/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)
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,
1 open the "CPU system setting" dialog box, and then click "Entire assignment setting of local devices."
Local Device Global Device
Device and Constant
• 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.
INSTRUCTIONS
Device Notation Method
Example
DM0:Z01 If the value of Z1 is 100, this means DM100.
R1000:Z01 If the value of Z1 is 100, this means R1604.
Example
DM0:#1 This means DM1.
R1000:#1 This means R1001.
Example
@DM0 @R10000
● XYM marking
The designation of device by XYM notation of the list below is possible for device (R(DR)/MR/LR/DM/
EM/FM).
1 Device Name
KEYENCE
Marking
XYM Marking
Device Number during XYM
Marking
Device and Constant
*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”.
BRIEF EXPLANATION OF
INSTRUCTIONS
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-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 2)
□.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.
Suffix
INSTRUCTIONS
1 Thus, the relationship between BIN data and corresponding DEC representation of suffix is shown
below.
Suffix
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)
INSTRUCTIONS
Reference For data transfer, the execution result is the same when either .U or .S in the suffixes is
used.
The instructions are executed independently of the DEC value of BIN data. 1
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
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.
1 BIN Data
Data Processing
These are processed through BIN system in device and internal register in KV-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
Use continuous 2 words when 32-bit device is processed in DM/EM/FM/TM 16-bit word devices. Lower
16-bit data is processed in low-bit device, and higher 16-bit data processed in high-bit device.
When handling a 64-bit device with a 16-bit word device, such as DM/EM/FM/TM, use four continuous
words. The low-order 16 bits of data is handled with four words in order from the word device having the
smallest number.
INSTRUCTIONS
Representation of Numerical Value
■ BIN
Only "0" and "1" are used to represent BIN data in "KV-7500/7300", "KV-5500/5000/3000/1000" and
1
"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-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-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
Data Processing
INSTRUCTIONS
1 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.
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-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 codedDEC valueBCD) in the instruction operand, add a prefix "$" into the
value as HEX input.
INSTRUCTIONS
■ Double precision floating point type real number
The double precision floating point type real number are processed by taking 64-bit data as value with
DEC points.
The value within the following range can be used (N) .
-1.79×10 308 ≤ N ≤ -2.23×10 -308
1
Data Processing
N= 0
-308
+2.23×10 ≤ N ≤ +1.79×10308
Point .DF (double precision floating point type real number) can be used with KV-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 2)
Data Processing
INSTRUCTIONS
The correlation between BIN, DEC (unsigned/signed), HEX, BIN-coded DEC (BCD) is represented below.
1
■ 16-bit data
Data Processing
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
INSTRUCTIONS
■ 32-bit data
DEC HEX
BIN
unsigned Signed (HEX)
0 +0 0 0000 0000 0000 0000 0000 0000 0000 0000
1
2
+1
+2
1
2
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0001
0010
1
Data Processing
3 +3 3 0000 0000 0000 0000 0000 0000 0000 0011
4 +4 4 0000 0000 0000 0000 0000 0000 0000 0100
5 +5 5 0000 0000 0000 0000 0000 0000 0000 0101
6 +6 6 0000 0000 0000 0000 0000 0000 0000 0110
7 +7 7 0000 0000 0000 0000 0000 0000 0000 0111
8 +8 8 0000 0000 0000 0000 0000 0000 0000 1000
9 +9 9 0000 0000 0000 0000 0000 0000 0000 1001
10 +10 A 0000 0000 0000 0000 0000 0000 0000 1010
11 +11 B 0000 0000 0000 0000 0000 0000 0000 1011
12 +12 C 0000 0000 0000 0000 0000 0000 0000 1100
13 +13 D 0000 0000 0000 0000 0000 0000 0000 1101
14 +14 E 0000 0000 0000 0000 0000 0000 0000 1110
15 +15 F 0000 0000 0000 0000 0000 0000 0000 1111
16 +16 10 0000 0000 0000 0000 0000 0000 0001 0000
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
Data Processing
INSTRUCTIONS
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 “----“)
INSTRUCTIONS
Character Code
Various text numbers are called as character codes to process the text strings in the ladder program.
The following text codes can be processed in KV STUDIO. 1
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" "Month/08:30:15"
■ Other languages
On the KV-7000 Series, character codes in the language set in "Other settings" - "Project language
settings" in "CPU system setting" can be used.
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).
1 The instructions with prefix "@" are executed as differential execution type instructions.
*Instructions only with or without differential execution type ones may occur sometimes.
Every-scan Execution Type and Differential Execution Type
■ OVERVIEW
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.
INSTRUCTIONS
■ Precautions on the use of differential execution type instructions
(1) When used between SBN and RET instructions (in sub-routine)
The previous value of differential detection device (execution condition of differential execution type
instruction) is under the state when previous sub-routine is executed. 1
Due attention shall be paid if differential execution type instruction is executed over 2 times during one
R000 #0
CALL
END
SBN
#0
Differential detection device
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 differential
detection device is the same.
When differential execution type instructions are executed over 2 times during one scanning.
Program scan
This time
ON
R000
OFF
ON
R001 OFF ON ON
OFF
When the differential detection device of [n-1]th, [n]th and [n+1]th (execution condition of differential
execution type instruction) 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
Differential detection device
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 differential
detection device is the same.
1-36 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
BRIEF EXPLANATION OF
Every-scan Execution Type and Differential Execution Type
INSTRUCTIONS
(3) When used between STG and JMP/ENDS instructions
The previous value of the differential detection device (the execution condition of the differential type execution
instruction) is in the next scan state after the program in the control stage is finished (The program between the
STG to JMP/ENDS instructions will be 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
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
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 differential
detection device is the same.
1 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.
Due attention shall be paid if the programs between CJ/NCJ and LABEL instructions are not executed
Every-scan Execution Type and Differential Execution Type
R000 CJ
#10
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 differential
detection device is the same.
BRIEF EXPLANATION OF
INSTRUCTIONS
The section describe the conventions and cautions used in the operand list of various instructions.
The following describe the conventions used in the operand list and basic cautions for specifying
1
D ○ ○ ○ ○ ○ ○ ○ ○ ○ − − − − − ○ − − ○ ○ ○
n ○ ○ ○ ○ ○ ○ ○ ○ ○ − − ○ ○ ○ ○ ○ − ○ ○ ○
· If bit device is specified in the operand for specifying of common word device, but
this bit device isn't specified from the starting point of the channel, straddle to the
Bit device next channel for processing.
S
But, there are also instructions only specifying the leading point of the channel.
· The numbers of occupied devices may differ depending upon the instructions.
D
· If word device is specified in the operand for specifying of common bit device, process
Word device only the lowest valid bit. Bits other than LSB do not change.
· The numbers of occupied devices 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 device
· 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 device
· The value is processed as unsigned 16-bit BIN data.
In general (i.e. sequence instruction), the bit device is processed as 1-bit device.
1
R006 R30500
Conventions and Cautions in Operand List
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 device can be grouped into 16-bit or 32-bit for processing.
If a bit device is specified to an instruction operand for processing by word unit, process the bit device
by unit of word starting from the specifying bit device.
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
INSTRUCTIONS
If the bit device specified to operand isn't at the starting position of channel, process the bit device by
word unit by straddling the next channel.
MOV
1
R30003 DM30505
R30102 R30003
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 device 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-7000 Series, only the bit device at the starting position of the channel
can be specified for some instruction operands.
If a word device is generally specified to the instruction operand for processing bit device, process only
the lowest significant bit (LSB) of specified word device as bit device.
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
INSTRUCTIONS
How to Specify Operand
The specifying methods of operand are generally divided into the followings.
• Specify through specifying global device 1
• Specify through specifying local device
For the each device, see "Device and Constant" (Page 1-5).
■ Specify device
Specify directly by circling the device with "○" in operand using .
S ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ
D ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ
MOV
DM1000 DM10
D1 ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ
ADRSET
MR1000 EM0
ITVL
PLS
DM0
PAUSE
ˆEM0
RES
D1 ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ
ITVL
PLS
DM0
PAUSE
MR000:Z1
RES
D1 ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ
ADRSET
MR1000 EM0
ITVL
PLS
DM0
PAUSE
ˆEM0:Z1
RES
INSTRUCTIONS
Specify local device in the operand
D1 ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ
ITVL
PLS
DM0
PAUSE
@MR000
RES
D1 ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ
ADRSET
MR1000 @EM0
ITVL
PLS
DM0
PAUSE
ˆ@EM0
RES
Index
Indirect Local
Bit device Word device Const specifying device modify
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ :#/:Z
(B) (W) (ZF)
D1 ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ
ITVL
PLS
DM0
PAUSE
@MR000:Z1
RES
■ Specify the local device with index modification and indirect specifying
In the local device @DM/@EM/@FM/@TM specified in 2nd operand of ADRSET instruction, the device
with indirect specifying (*) and index modification (:#/ :Z) can be specified in the operand. But, in the 1st
operand of ADRSET instruction, the device with "○" circled by must be specified.
Example) ADRSET instruction
D1 ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ
ADRSET
MR1000 @EM0
ITVL
PLS
DM0
PAUSE
ˆ@EM0:Z1
RES
INSTRUCTIONS
Specify constant in the operand
Specify directly the constant in the operand when "○" exists in the constant column.
D1 ƻ ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ ƻ
MOV MOV
#1000 DM10 $10AB DM10
When " ○ " exists in the indirect specifying (#TM) column, specify in the operand by adding "#" before
TM0 to TM511.
D1 ƻ ƻ ƻ ƻ ƻ ƻ ƻ
D2 ƻ ƻ ƻ ƻ ƻ ƻ ƻ
+1.2345
DW.F
#TM1
LD
to NC contact.
OR Connected in
ORB
Contact Instructions
S㩷 L D S A S
X S
L D B B S
S
L D I S
L D N O T S
A N I S
A N D N O T S
A N D S A S
S X 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
O R S
O R B S O R I S
S **For B, “1” is filled in . O R N O T S
Operand Explanation
S Specifies the bit to be connected to the left power rail.
KV-1000 BLD/LBDB 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 LD.
BASIC INSTRUCTIONS
AND S is connected in series to the circuit block as a NO.
ANB S is connected in series to the circuit block as a NC.
OR S is connected in parallel to the circuit block as a NO.
ORB S is connected in parallel to the circuit block as a NC.
Scan
S
ON
OFF
2
LD instruction ON
Contact Instructions
AND instruction
OR instruction OFF
LDB instruction ON
ANB instruction
ORB instruction OFF
Reference There is no restriction to the number of contacts that can be connected in parallel or in 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.
R000 R001 R500 (mnemonics list)
LD R000
OR DM0
DM0 ANB R001
OUT R500
when falling
LDP
edge (ON->OFF)
of bit device is
Load pulse
specifed.
ANP Only 1 scan
period is ON
when falling
edge (ON->OFF)
of bit device is
AND pulse
period is ON
when rising edge
ORP
period is ON
when rising edge
OR pulse
(OFF->ON) of bit
device is
specifed.
ORF Only 1 scan
period is ON
when falling
LDF
edge (ON->OFF)
of bit device is
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
O R P S F S
L D F S
O R F S
S
when P in ǂ fill ↑;
when F in ǂ fill ↓.
Operand Explanation
S Specifies the bit for detecting rising edge or falling edge.
KV-1000 To load the status of bits other than the LSB, use the BLD or BLDB instruction.
Description of Operation
LDP, ANP, ORP Only 1 scan period will be ON when rising edge of the specified bit device
is detected by S .
Instruc
tion Operation
Connected to the left power rail as a NO contact. This contact turns ON only for 1
LDP
scan when the rising edge of the specified bit device is detected by S .
Connected in serires to the circuit block as a NO contact. This contact turns ON only
ANP
for 1 scan when the rising edge of the specified bit device is detected by S .
Connected in parallel to the circuit block as a NO contact. This contact turns ON only
ORP
for 1 scan when the rising edge of the specified bit device is detected by S .
BASIC INSTRUCTIONS
LDF, ANF, ORF Only 1 scan period is ON when falling edge of the specified bit device is detected by S .
Instruc
tion Operation
Connected to the left power rail as a NO contact. This contact turns ON only for 1
LDF
scan when the falling edge of the specified bit device is detected by S .
Connected in series to the circuit block as a NO contact. This contact turns ON only
ANF
for 1 scan when the falling edge of the specified bit device is detected by S .
ORF
Connected in series to the circuit block as a NO contact. his contact turns ON only
for 1 scan when the falling edge of the specified bit device is detected by S .
2
Contact Instructions
Scan
ON
S
OFF
LDP instruction ON
ANP instruction
ORP instruction OFF
ON
LDF instruction
ANF instruction
ORF instruction OFF
Operation flag
* The contact does not turn OFF when CR2012 turns ON.
KV-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 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
LDPB
edge of bit
device is
Pulse bar
specifed.
ANPB Only 1 scan
period is OFF
when falling
edge of bit
device is
specifed.
ANPB Only 1 scan period is OFF when rising ANFB Only 1 scan
ORPB
of bit device is
specifed.
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.
Description of Operation
LDPB, ANPB, ORPB Only 1 scan period is ON when rising edge of the specified bit device is
detected by S .
Instruc
Operation
tion
Connected to the left power rail as NC contact. This contact turns ON only for
LDPB
1 scan when the rising edge of the specified bit device is detected by S .
Connected in series to the circuit block as a NC contact. This contact turns
ANPB ON only for 1 scan when the rising edge of the specified bit device is
detected by S .
Connected in parallel to the circuit block NC. This contact turns ON only for 1
ORPB
scan when the rising edge of the specified bit device is detected by S .
BASIC INSTRUCTIONS
LDFB, ANFB, ORFB Only 1 scan period is OFF when the falling edge of the specified bit
device is detected by S .
Instruc Operation
tion
Connected to the left power rail as a NC contact. This contact turns OFF only for
LDFB
1 scan when the falling edge of the specified bit device is detected by S .
2
Connected in series to the circuit block as a NC contact. This contact turns OFF only
ANFB
for 1 scan when the falling edge of the specified bit device is detected by S .
Connected in parallel to the circuit block as a NC contact. This contact turns OFF only
ORFB
Contact Instructions
for 1 scan when the falling edge of the specified bit device is detected by S .
Scan
ON
S
OFF
LDPB instruction ON
ANPB instruction
ORPB instruction OFF
ON
LDFB instruction
ANFB instruction
ORFB instruction OFF
Operation flag
* The contact does not turn OFF when CR2012 turns ON.
KV-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-71)
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
connect
BLD(.U)
it to bus.
Bit load
BLDB Treat
To treat device as a
specified
B
BLD.D
bit of
word
device
BAND
and
BAND.D
block.
BOR
word
BOR(.U) device.
device
Bit OR
as NC
contact,
and
BOR.D B
BANB
connect
it to bus.
Treat
specified
BLDB
bit of
BLDB(.U)
word
B
To treat device as a
as NO
BLDB.D
contact,
2
and
connect
BANB
to circuit
BANB.D bit of
device
as NO
BORB
contact,
BORB(.U) device.
and
Bit OR bar
connect
it serially
BORB.D
to circuit
B BORB
block.
Treat
specified
bit of
word
device
as NC
contact,
( B A S n )
n B B L D B S n
( B B S n )
S
B B A N D S n
( B A S n )
n
B B A N B S n
( B B S n )
B B O R S n
S
B B O R B S n
n
Operand Explanation
S Specifies the device whose bit status is to be read.*2
n The position of the device specified by S S . (0 to 15 if suffix is .U; 0 to 31 if suffix is .D)*3
*1 KV-7500/7300/5500/5000/3000, KV Nano Series When bit is specified for word device by constant,
BASIC INSTRUCTIONS
Description of Operation
BLD(.U), BLD.D,BAND(.U), BAND.D, BOR(.U), BOR.D
The instruction itself is a NO contact. This contact transfers the ON/OFF status of n
bits of the word device specified by S to subsequent instructions.
BLDB(.U), BLDB.D, BANB(.U), BANB.D, BORB(.U), BORB.D
The instruction itself is a NC contact. This contact transfers inverted ON/OFF status of 2
n bits of the word device specified by S to subsequent instructions.
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
bit15 bit0
bit n bit1
ON
bit n of S
OFF
ON
BLD instruction
OFF
ON
BLDB instruction
OFF
Operation flag
* The contact does not turn OFF when CR2012 turns ON.
KV-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
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 R500
will be OFF.
(mnemonics list)
2
DM0 DM1 R500
B B BLD DM0 #0
#0 #1 BAND DM1 #1
OUT R500
Bit contact instructions
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" connec
= <=
NO contact in ON to
bus.
(.U) ※
LD>= When "A>B" connec
< >= ※
comparison
NO contact in ON
serially to circuit
comparison operation.
serially to circuit
block
AND> When "A>B" connec
.DF
> <>
NO contact in ON
serially to circuit
※ block
AND<= When "A<=B"
connect NO contac
in ON serially to
circuit block
AND>= When "A>=B"
connect NO contac
in ON serially to
circuit block
2
connect NO contac
in ON serially to
circuit block
OR= When "A=B" connec
S1 NO contact in ON i
*
L D
* S1 S2
OR<
parallel to circuit
block
When "A<B" connec
NO contact in ON i
(
* S1 S2 ) parallel to circuit
Compare Contact
Instructions
block
S2 OR> When "A>B" connec
NO contact in ON i
parallel to circuit
block
S1 A N D
* S1 S2 OR<= When "A<=B"
connect NO contac
in ON in parallel to
*
circuit block
S2
(
* S1 S2 ) OR>=
OR<>
When "A>=B"
connect NO contac
in ON in parallel to
circuit block
When "A<>B"
connect NO contac
* S1 S2 in ON in parallel to
O R circuit block
S1
Please fill * = , < , > , <> , <= , >=
*
S2
Available Devices ( ): Not supported on the KV-1000 Index
Indirect Local modifi
Bit device Word device Const
Operand specifying Device cation
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
S1 - - - - *4 *2 *2 *2*5 *2*5 *3
S2 - - - - *4 *2 *2 *2*5 *2*5 *3
Operand Explanation
S1 Specifies the data to compare or the device to which that data are stored. *1
S2 Specifies the data to compare or the device to which that data are stored. *1
Point • The □.DF instruction can be used with KV-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 2)
• When a timer (T), counter (C) or high-speed counter (CTH) has been specified, the
current value will be read.
• When a high-speed counter comparator (CTC) has been specified, the setting value
will be read.
BASIC INSTRUCTIONS
Operation Description
Compare Contact
Instructions
Unsigned 16-bit BIN data in S1 / S2 are compared. This instruction itself is used as
a contact to turn ON/OFF according to the result of comparion operation.
.F (single precision floating point type real number data compare instructions)
LD<.F AND<.F OR<.F " S1 +1• S1 "<" S2 +1• S2 " " S1 +1• S1 ">=" S2 +1• S2 "
LD>.F AND>.F OR>.F " S1 +1• S1 ">" S2 +1• S2 " " S1 +1• S1 "<=" S2 +1• S2 "
LD<=.F AND<=.F OR<=.F " S1 +1• S1 "<=" S2 +1• S2 " " S1 +1• S1 ">" S2 +1• S2 "
LD>=.F AND>=.F OR>=.F " S1 +1• S1 ">=" S2 +1• S2 " " S1 +1• S1 "<" S2 +1• S2 "
LD<>.F AND<>.F OR<>.F " S1 +1• S1 " " S2 +1• S2 " " S1 +1• S1 "=" S2 +1• S2 "
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-38)
.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-38)
BASIC INSTRUCTIONS
Operation flag
Compare Contact
Instructions
ON when the indirect specification or index modification range is inappropriate or the
operation data is not within the single precision or double precision floating point type real
number range. Otherwise, OFF.
* The contact turns OFF when CR2012 is ON. When OR=, OR<, OR>, OR<=, OR>=, or OR<>, the
instruction is not executed.
KV-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
Current value of counter C0000 is compared with constant #01000. Output relays R00500 to R00503
are turned ON/OFF according to the comparison result.
OUT Out
To output to a device.
OUB Out bar
2 D
O U B D ( O B D )
Output Instructions
Operand Explanation
D Specifies the device to output. *1 *2
*1 When a word device has been specified in D , the device will be output to LSB.
KV-7500/7300/5500/5000/3000, KV Nano Series Bit specifying of word device.
KV-1000 To output to other bits, use the BOUT and BOUB instructions.
Point When outputting to an input relay, state of the input terminal is overriden 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
ON
BASIC INSTRUCTIONS
Point Duplicate coils
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 R500
turns OFF.
If input relay R001 turns OFF, then output relay R501 turns ON. If input relay R001 turns ON, then R501
turns OFF.
R000 R500 ; (mnemonics list)
LD R000
OUT R500
R001 R501 LD R001
OUB R501
OUT,OUB
BASIC INSTRUCTIONS
SET SET
Set
Set instruction. The device is ON, and
remains in this state.
@SET SET
RES RES
Reset
Reset Instruction. The device is OFF, and
remains in this state.
@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
Operand Explanation
D Specifies the device to be turned ON/OFF. *1 *2
*1 When a word device has been specified in D , the LSB is turned ON/OFF.
KV-7500/7300/5500/5000/3000, KV Nano Series Bit specifying of word device can be performed.
*2 Can not be used when bit specifying of word device is used in D .
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
When outputting to an input, the state of the input terminal is overriden at the next scan.
Point
Description of Operation
SET When the execution condition is ON, the device specified by D is turned ON. Once
this device is turned ON, the device remains in ON state even if the execution condition
is not established (reset by the RES instruction). When the execution condition is OFF, no
processing is executed.
* The current value 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, the device specified by D is turned OFF.
* The current value 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 during only 1 scan period on the rising edge of
execution (OFF→ON).
2-18 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Output Instructions
BASIC INSTRUCTIONS
Point The SET and RES instructions programmed later in the program will be executed first.
Scan
ON
Execution condition
OFF
Output Instructions
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
2
RES condition
RES
Output Instructions
Operand Explanation
D Specifies the device to set/reset. *1 *2
Point When outputting to an input relay, the state of the input terminal is overriden 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 ON.
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
10
Execution condition
1((
BASIC INSTRUCTIONS
Difference between the SET and RES instructions 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 R000 and R001 ON, output R500 will turn OFF through the
Output Instructions
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 F
D
D
Output Instructions
Operand Explanation
D Specifies the device to set/reset. *1 *2
*1 When a word device has been specified in D , the last bit is set/reset.
KV-7500/7300/5500/5000/3000, KV Nano Series Bit specifying of word device can be performed.
Point When outputting to an input relay, the state of the input terminal will be overriden at the
next scan.
Description of Operation
DIFU Turns ON the device specified by D for only 1 scan period on the rising edge of the
execution condition.
Duplicate use of the operand with other DIFU instructions is not allowed.
DIFD Turns ON the device specified by D for only 1 scan period on 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 programming DIFD instruction as (a), since R1000 is ON
(a) DIFD during input R000 OFF scaning, R000 and R1000 can’t 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 scaning.
2
Output Instructions
R000 R1000 R1000 R500
(c) DIFU
Even if programming DIFU instruction as (d), input R1000 and
R500 are ON while input R000 is ON.
R000 R1000 R1000 R500
(d) DIFU
Operation flag
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
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
ONDL
The specified bit device performs ON delay
ONDL ON delay
operation.
OFDL
The specified bit device perfoms OFF delay
OFDL OFF delay
operation.
Ladder program Input mode
Execution condition n
ONDL O N D L n D
D
2
Execution condition n
OFDL O F D L n D
D
Output Instructions
Operand Explanation
Specifies the setting value (0 to 65535) of the ON delay/OFF delay or the device to which the setting
n
value is stored. The delay unit is 10 ms. *1*2
D Specifies the device to perform ON delay and OFF delay operation.*3
*1 When a bit device has been specified in n , continuous 16 bits will be occupied. Operation
is normal even if the relay straddles channels. When a word device has been specified, one
word will be occupied.
*2 "$"(HEX) cannot be used.
*3 When a word device has been specified in D , the LSB performs ON delay or OFF delay
operation. Bit specifying of word device cannot be used.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point When ouputting to an input relay, the state of the input terminal will be overriden at the next scan.
Description of Operation
ONDL The device specified by D is operated as an ON delay timer.
(1) When the execution condition is ON, D is turned ON after n x 10 ms.
(2) When the execution condition is OFF, the device specified by D will also be OFF.
(3) If the execution conditions is OFF before n x 10 ms, then D does not turn ON.
(1) (2) (3)
ON
Execution condition
OFF
ON
D
OFF
n × 10ms n × 10ms
BASIC INSTRUCTIONS
(1) (2) (3)
ON
Execution condition
OFF
ON
D
OFF
2
n × 10ms n × 10ms
Operation flag
Output Instructions
CR2009 No change in status
CR2010 No change in status
CR2011 No change in status
ON when one of the following conditions is established. Otherwise, OFF.
• When a timer/counter is specified in D by indirect specifying
CR2012
• When the indirect specifying or index modification range is inappropriate
The state will not change if indirect specifying or index modification is not specified.
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 (1) LD R000
R500 ONDL #300 R500
R001 LD R001
DM0 OFDL DM0 R501
OFDL (2)
R501
SHOT SHOT One shot To specify bit device as an one shot timer.
MR DM EM
Word device
specifying Device
Operand Explanation
Specifies the setting value of the one-shot timer (0 to 65535), or the device to which the setting value is stored.
n
The unit is 10 ms. *1*2
D . *3
Specifies the device to perform one-shot timer operation.
*1 When a bit device has been specified in n , continuous 16 bits will be occupied. When a
word device has been specified, one word will be occupied.
*2 "$" cannot be used.
*3 When a word device has been specified in D , the LSB will be operate as a one-shot timer.
Bit specifying word device cannot used.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point When outputting to an input relay, the state of the input terminal will be overriden at the
next scan.
Description of Operation
SHOT Turns ON the device specified by D on the rising edge of the detection execution
condition, and turns D OFF after n x 10 ms.
The rising edge of the execution condition is ignored when the device specified by
D is ON.
ON
Execution condition
OFF
ON
D
OFF
BASIC INSTRUCTIONS
Operation flag
CR2012
• When a timer/counter is specified in D by indirect specifying
• When the indirect specifying or index modification range is inappropriate
2
The state will not change when indirect specifying or index modification is not specified.
Output Instructions
* The instruction is not executed when CR2012 turns ON.
KV-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
(1)Output relay R500 turns ON for 0.2 seconds on 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
2
modifi
Bit device Word device *1
Const Indirect Local cation
specifying Device
Operand
MR DM EM
Output Instructions
Operand Explanation
Specifies the setting value (0 to 65535) when D turns ON or the device to which the setting value is stored.
n1
Unit is 10 ms.*1*2
Specifies the setting value (0 to 65535) D turns OFF or the device to which the setting value is stored.
n2
Unit is 10 ms.*1*2
D Specifies the device on which flicker circuit operation is to be performed.*3
*1 When a bit device has been specified in n1 and n2 , continuous 16 bits will be occupied.
When a word device has been specified, one word will be occupied.
*2 "$" cannot be used.
*3 When a word device has been specified in D , the LSB will operate as a flicker circuit.
Bit specifying of word device cannot be used.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point When outputting to an input relay, the state of the input terminal will be overriden at the
next scan.
Description of Operation
FLIK (1)The device specified by D is repeatedly turned ON/OFF while the execution
condition is ON. Operation will start from the state in which the specified device is ON.
The ON time is n1 x 10 ms, and the OFF time is n2 x 10 ms.
(2)While D is ON, if the execution condition is OFF, D will turn OFF.
(1) 㩷 (2)
㪦㪥
Execution condition
㪦㪝㪝
㪦㪥
㪛
㪦㪝㪝
BASIC INSTRUCTIONS
Operation flag
CR2012
• When a timer/counter is specified in D by indirect specifying
• When the indirect specifying or index modification range is inappropriate
2
No change in state when indirect specifying or index modification is not specified.
Output Instructions
* The instruction is not executed when CR2012 turns ON.
KV-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, 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 Operand
R (DR)
MR
LR T C
DM
CTC CR TM
EM
FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
Output Instructions
- - - *2 - - - - - - -
D
Operand Explanation
D Specifies the device whose state is to be inverted*1
*1 When a word device has been specified in D , then state of the LSB will be inverted.
KV-7500/7300/5500/5000/3000, KV Nano Series Bit specifying of word device can be performed.
Point When outputting to an input relay, the state of the input terminal will be overriden at the
next scan.
Description of Operation
The state of the device specified by D is inverted on the rising edge of the execution condition.
10
Execution condition
1((
10
&
1((
Operation flag
BASIC INSTRUCTIONS
Sample Program
The ON/OFF state of output relay R500 is inverted on the rising edge of input relay R0000.
R000 R500 (mnemonics list)
ALT
LD R000
ALT R500
Output Instructions
BOUT BOUT(.U)
BOUT.D
B Bit out
To map input state to the
specified bit of word device.
BOUB BOUB(.U)
BOUB.D
B Bit out bar
2 B
n
B O U
( B O
T
D
D
n )
n
Bit output instructions
D
B B O U B D n
n ( B O B D n )
Operand Explanation
D Specifies the device for mapping the input state.*1
n Specifies the bit of D for mapping. (0 to 15 when suffix is .U; 0 to 31 when suffix is .D).*2 *3
*1 When a bit device has been specified in D , then the relay of device No. will be calculated
by the value of "device No. + n ". Operation is normal even if relays straddle channels.
*2 When a bit device has been specified in n , continuous 16 bits will be occupied.
When a word device has been specified in n , one word will be occupied.
*3 KV-7500/7300/5500/5000/3000, KV Nano Series When a constant is used to perform bit specifying for
word device, even if OUT/OUB instruction is used, same operation will be possible.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
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 bit of D .
bit
15
D bit
0
bit
31
D +1 bit
16
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
Operation flag
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
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.
BSET BSET(.U)
BSET.D
BSET
Set
To turn the specified bit of the
word device ON and hold this
@BSET @BSET(.U)
@BSET.D
BSET state.
BRES BRES(.U)
BRES.D
BRES
Reset
To turn the specified bit of the
word device OFF.
@BRES @BRES(.U) BRES
2
@BRES.D
Execution condition D
BSET B S E T D n
n ( B S D n )
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 )
Operand Explanation
D Specifies the device to be set or reset (including bit).*1
n Specifies the of D for mapping. (0 to 15 when suffix is .U; 0 to 31 when suffix is .D).*2 *3
*1 When a bit device has been specified in D , the relay of the device No. will be calcualted by
the value of "device No.+ n ". Operation is normal even if relays straddle channels.
*2 When a bit device has been specified in n , continuous 16 bits will be occupied.
When a word device has been specified in n , one word will be occupied.
*3 KV-7500/7300/5500/5000/3000, KV Nano Series When a constant is used to perform bit specifying for
word device, even if SET/RES instruction is used, same operation will be possible.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
BASIC INSTRUCTIONS
Description of Operation
BSET When the execution condition is ON, the n th bit of D is turned ON, and held in
this state.
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 When the execution condition is ON, the n th bit of D is turned OFF.
bit
15
D bit
0
For 16bit (suffix .U)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@ The above operation will operformed on the rising edge (OFF→ON) of the execution
condition.
Operation flag
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Sample Program
When input relay R000 is ON, the 5th bit of data memory DM000 is set.
When input relay R000 is ON, the 5th bit of data memory DM000 is reset.
TMS
10 ms, 32-bit ON delay
subtraction timer
1ms, 32-bit ON delay
TMR,TMS subtraction timer
BASIC INSTRUCTIONS
TMH T
H High-speed timer 10 ms, 32-bit ON delay down timer.
TMS
1ms high-speed
T
1ms, 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
Operand Explanation
n Specifies the device No. (0 to 3999) of the timer.*1
S Specifies the setting value of the timer. Can be set within the range of 0 to 4294967295.*2
Point The device No. n of the timer cannot be same as with No. of the following
instructions.
KV-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).
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. 2
Scan
Timer/Counter
Instructions
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 a device has been specified in S , 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 paid when performing writing in the RUN mode.
KV-7000 Series User's Manual, "About Writing in the RUN mode"
KV-5500/5000/3000 Series User's Manual, "About Writing in the RUN mode"
KV-1000 Series Programming Manual, "About Writing in the RUN mode"
KV Nano Series User's Manual, "About Writing in the RUN mode"
• This instruction cannot be used in the interrupt program or in the initialization module.
KV-7000 Series User's Manual, "Precautions when using timing instructions"
KV-5500/5000/3000 Series User's Manual, "Precautions when using timing instructions"
KV-1000 Series Programming Manual, "Precautions when using timing instructions"
KV Nano Series User's Manual, "Precautions when using timing instructions"
"Reading and Changing the Timer Current Value/Setting Value" (Page 2-38)
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 0000 LD R000
TMS #0 #7
LD T0
T0 R500 OUT R500
"DM0/DM1". MOV.D
T0 DM0
#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 set in the device ( T0 ): Can be read by the LDA.D or MOV.D
instruction.
Timer/Counter
Instructions
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 the device is
DM0
specified ( T0 ).
Point If the current value <= setting value, the current value is not changed.
If the current value > setting value, the current value is changed to the same value as the
setting value.
2 Bit devices
Available Devices
Word devices
( ): Not supported on the KV-1000 Index
Indirect Local modifi
Const specifying Device cation
Operand
Timer/Counter
Instructions
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
n - - - - - - - - - - - - - - - - - -
S - - - - *3 *4 *4 -
Operand Explanation
n Specifies the device No. (0 to 3999) of the timer.*1
S Specifies the setting value of the timer. Can be set within the range of 0 to 4294967295.*2
Point • The TMU instruction can be used with KV-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 2)
• The device No. n of the timer cannot be same as with No. of the following instructions.
TMR, TMH, TMS, UDT, TMU
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 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
2
Execution condition
Timer/Counter
Instructions
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 or less).
• When a device has been specified in S , 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 paid when performing writing in the RUN mode.
KV-7000 Series User's Manual, "About Writing in the RUN mode"
KV-5500/5000/3000 Series User's Manual, "About Writing in the RUN mode"
KV Nano Series User's Manual, "About Writing in the RUN mode"
• This instruction cannot be used in the interrupt program or in the initialization module.
KV-7000 Series User's Manual, "Precautions when using timing instructions"
KV-5500/5000/3000 Series User's Manual, "Precautions when using timing instructions"
KV nano Series User's Manual, "Precautions when using timing instructions"
"Reading and Changing the Timer Current Value/Setting Value" (Page 2-38)
Operation flag
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
7&6
UDT
72
&9 Up/down timer 10 ms, 32-bit up/down timer.
4'5
2 Reset input
DW
RES
Timer/Counter
Instructions
T n
S - - - - *3 *4 *4 -
Operand Explanation
n Specifies the device No. (0 to 3999) of the timer.*1
S Specifies the setting value of the timer. Can be set within the range of 0 to 4924967295. Unit is 10 ms*2
*1 For the KV Nano Series, the device number range is 0 to 511. Specify 0 to 9 when the values
must be retained while the power is off.
*2 When a bit device has been specified, 32 continuous bits are occupied.
When a word device has been specified, continuous two words will be processed.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Point The device No. n of the timer cannot be the same as the No. of the following instructions.
KV-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.
BASIC INSTRUCTIONS
(1) (2) (3) (4) (5)
㪦㪥
Up counting input
㪦㪝㪝
㪦㪥
2
Set value
Current value
㪇
Timer/Counter
Instructions
Timer UDT 㫅 㪦㪥 㪦㪥 㪦㪥 㪦㪥
Point • The error range of the UDT instruction is (± 10 μs + 1 scan period or less)
• When a device has been specified in S , the setting value is updated at every scan
during operation.
• If the "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 paid when performing writing in the RUN mode.
KV-7000 Series User's Manual, "About Writing in the RUN mode"
KV-5500/5000/3000 Series User's Manual, "About Writing in the RUN mode"
KV-1000 Series Programming Manual, "About Writing in the RUN mode"
KV Nano Series User's Manual, "About Writing in the RUN mode"
• This instruction cannot be used in the interrupt program 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 device 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
Operand Explanation
n Specifies the device No. (0 to 3999) of the counter.*1
S1 Specifies the setting value of the counter. Can be specified within the range of 0 to 4294967295.*2
S2 Specifies the device to be used for input counting.*3
Point The device No. n of the counter cannot be the same as the No. of the following
instructions.
KV-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 the counter specified by n
on the rising edge of the counting input of S2 . When the setting value specifed by S1 is equal to
the setting 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.
KV-5500/5000/3000 Series User's Manual, "The maximal counting speed of counters".
KV-1000 Series Programming Manual, "The maximal counting speed of counters".
KV Nano Series Programming Manual, "The maximal counting speed of counters".
• When a device has been specified in S1 , the setting value is updated at every scan
during operation.
• When the setting value is set to "0", counter C n will be ON while the execution
2
condition is ON.
Timer/Counter
Instructions
• Attention should be paid when performing writing in the RUN mode.
KV-7000 Series User's Manual, "About Writing in the RUN mode"
KV-5500/5000/3000 Series User's Manual, "About Writing in the RUN mode"
KV-1000 Series Programming Manual, "About Writing in the RUN mode"
KV Nano Series User's Manual, "About Writing in the RUN mode"
• This instruction cannot be used in the interrupt program 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-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" (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, the current value is changed to the written value.
If the current value > setting value, the current value is changed to the same value as the
setting value.
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 the setting value
• The setting value can be changed by the STA.D instruction.
• To change the setting value by the MOV.D instruction: The setting value can be changed only when 2
DM0
Timer/Counter
Instructions
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, the current value is changed to the same value as the
setting value.
C n
Operand Explanation
n Specifies the device No. (0 to 3999) of the counter. *1
S Specifies the setting value of the counter. Can be specified within the range of 0 to 4294967295.*2
Point The device No. n of the counter cannot be the same as the No. of the following
instructions.
KV-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 device n is incremented by 1 on the rising edge of the execution
condition.
When the setting value S is equal to the current value, counter C n turns ON.
The RES instruction is used to reset counters.
ON
R000 #12 Execution condition
R000
C0 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
BASIC INSTRUCTIONS
Point • The response speed of the counter instruction depends on the scan time.
KV-7000 Series User's Manual, "The maximal counting speed of counters"
KV-5500/5000/3000 Series User's Manual, "The maximal counting speed of counters"
KV-1000 Series Programming Manual, "The maximal counting speed of counters"
KV Nano Series User's Manual, "The maximal counting speed of counters"
• When the setting value is set to "0", counter C n changes to the ON state.
• Attention should be paid when performing writing in the RUN mode.
2
KV-7000 Series User's Manual, "About Writing in the RUN mode"
Timer/Counter
Instructions
KV-5500/5000/3000 Series User's Manual, "About Writing in the RUN mode"
KV-1000 Series Programming Manual "About Writing in the RUN mode"
KV Nano Series User's Manual, "About Writing in the RUN mode"
• This instruction cannot be used in the interrupt program 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-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 be cleared when the power is turned OFF through setting
the memory switching instruction (MEMSW).
"MEMSW" (Page 3-4)
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
ITVL
BASIC INSTRUCTIONS
ITVL
To measure the pulse
2 Reset input
PAUSE
D2
RES
Timer/Counter
Instructions
Operand Explanation
D1 Specifies the leading device of the data table.*1
D2 Specifies the leading device of the flag relay.*2
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 only during PLS
(pulse input) ON. Please use CR2002 in PLS (pulse
input) in order to capture measurement values at 2
each scan.
Timer/Counter
Instructions
PAUSE (measurement pause input)... Measurement is paused when ON.
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 min. measurement value becomes "0" when suffix is .U; and becomes
"-32768" when suffix is .S.
The max. measurement value becomes "65535" when suffix is .U; and becomes
"32767" 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 unsigned
16-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 +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 lower 16 bits.
• When the averaging times is reached, the measurement count accumulated value will
Timer/Counter
Instructions
become "0".
Mode setting
Pulse measurement mode
Pulse Period
Pulse width Measurement
Measurement
* 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 is
up 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.
D2 +2 1 measuring completed ->Only 1 scan ON after each measurement.
D2 +3 Average value measurement completed ->Only 1 scan ON after measurement completed of average count specifying.
Point • Attention should be paid when performing writing in the RUN mode.
KV-7000 Series User's Manual, "About Writing in the RUN mode"
KV-5500/5000/3000 Series User's Manual, "About Writing in the RUN mode"
KV-1000 Series Programming Manual, "About Writing in the RUN mode"
KV Nano Series User's Manual, "About Writing in the RUN mode"
• This instruction cannot be used in the interrupt program or in the initialization module.
BASIC INSTRUCTIONS
Operation flag
CR2012
• When a bit device or timer/counter is specified in D1 by indirect specifying
• When a word device or timer/counter is specified in D2 by indirect specifying
2
• When the indirect specifying or index modification range is inappropriate
Timer/Counter
Instructions
State will not change when indirect specifying or index modification is not specified.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Sample Program
Output 1 pulse for 300 ms from output relay R500 when MAX error or MIN error.
ON
1 scan
ON
300ms 300ms
2
#1600 DM0 Measure contents in DM1600. LD CR2008
CR2008 MOV #1600 DM0
MOV
Set max. value of measurement range as 3V(2000). LD CR2008
#2000 DM1
MOV #2000 DM1
Timer/Counter
Instructions
BASIC INSTRUCTIONS
MEMO
Timer/Counter
Instructions
7&%
UDC
72
&9 UP/DOWN counter 32-bit up/down counter
4'5
2
DW ( C N T R n S )
Reset input
RES
Timer/Counter
Instructions
C n
Operand Explanation
n Specifies the device No. (0 to 3999) of the counter. *1
S Specifies the setting value of the counter. Can be specified within the range of 0 to 4294967295.*2
Point The device No. n of the counter cannot be the same as the No. of the following
instructions.
KV-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
BASIC INSTRUCTIONS
ON
ON
R003(Reset input)
OFF
Set value
9 9 8 9 8
7 8 7 8 7 6
2
7 6 7 6
5 6 5 4
Current value 3 4 3 3 2
0 1 2 0 1 2 0 1 0
Contact C0 O Bit increase Bit decrease Bit decrease
O O
Timer/Counter
Instructions
N N N
Point • When a device has been specified in S , 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 counting
input or down counting input turns ON. When it is OFF, the reset input will be ON.
• Attention should be paid when performing writing in the RUN mode.
KV-7000 Series User's Manual, "About Writing in the RUN mode"
KV-5500/5000/3000 Series User's Manual, "About Writing in the RUN mode"
KV-1000 Series Programming Manual, "About Writing in the RUN mode"
KV Nano Series User's Manual, "About Writing in the RUN mode"
• This instruction cannot be used in the interrupt program or in the initialization module.
Reference The current value of up/down counter is kept in the PROG mode or when the power is
turned OFF.
KV-7500/7300/5500/5000/3000, KV Nano Series The current value can be cleared when the
power is turned OFF in CPUsystem setting.
KV-1000 The current value can be cleared when the power is turned OFF through setting
the memory switching instruction (MEMSW).
"MEMSW" (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 Entrance Exit
R00500 ON.
→ →
The count is reset by input relay R002.
R000 UDC 0
(mnemonics list)
UP
LD R000
#9
R001 LD R001
LD R002
DW
R002
RES
UDC #0 #9
LD C0
C0 R500 OUT R500
2
How to Input When Using Local Devices
Timer/Counter
Instructions
When local devices are used in the operands of non-timer instructions, input format of " @DM0"
(exampe) can be used. However,when local devices are used in the operands of timer instructions
(except for inverval timer), the input format is different from that for other instructions, input can be
performed as follows. The input method for contacts is the same as that of the instructions other than
timer instruction.
High-speed timer
5 T M H @ n S
6
* " P T H n S
T I M H n S
Up/down Timer
7&6" P
72
5 U D T @ n S
&9
4'5
Counter
5 C @ n S1 S2
%" P ( C N T n S1 S2 )
5
Output counter
5 O U T C @ n S
%" P "% P
L D @ C n
Up/down counter
7&%" P
72
5 U D C @ n S
&9 ( C N T R n S )
4'5
BASIC INSTRUCTIONS
MEMO
Timer/Counter
Instructions
END,E,ENDH
BASIC INSTRUCTIONS
END
'0&
End To indicate the end of the master program.
ENDH
'0&*
End High To indicate the end of the entire program.
E
E N D
2
F E N D
END
Instruction
Connection/End
ENDH
E N D H ( H )
Description of Operation
END The END instruction indicates the final program segment of the common master program
in macro module.
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 KV-7000 User's Manual, KV-5500/5000/3000
Series User's Manual, KV-1000 Programming Manual or KV Nano Series User's
Manual.
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
Instruction
Connection/End
Sequence programs are named as follows according to their function.
Master subroutine
㪪㪙㪥
• 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 macro modules, see KV-7000 User's Manual, KV-5500/5000/3000 Series User's
Manual, KV-1000 Programming Manual or KV Nano Series User's Manual.
CON
To indicate a series connection following an
Connect
output instruction.
2 Operand
Bit device Word device
Indirect Local modifi
Constant specifying Device cation
MR DM EM
Instruction
Connection/End
Description of Operation
This instruction is used to connect instructions after an instruction is output when a program is written
in an extended ladder program.
* Inserted automatically when converted if intructions are discribed after they are output when the
ladder program is created in KV STUDIO.
* Scan time is not influenced.
For details on extended ladders, see KV-7000 User's Manual, KV-5500/5000/3000 Series
User's Manual, "KV-1000 Series Programming Manual or KV Nano Series User's Manual".
Operation flag
BASIC INSTRUCTIONS
MEMO
Instruction
Connection/End
memory.
MPP
To read the content in memory by the MPS instruction,
Pop
and clear memory.
2 Ladder program
Instruction
Connection/End
→
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 to
8 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.)
R000 R500 LD R000
MPS ・・・ Log ON/OFF status in (1).
(1) → OUT R500
R001 R501 MRD ・・・ Read ON/OFF status in (1).
AND R001
OUT R501
R002 R502 MRD ・・・ Read ON/OFF status in (1).
AND R002
OUT R502
R003 R503
MRD ・・・ Read ON/OFF status in (1).
AND R003
OUT R503
R004 R504
MRD ・・・ Read ON/OFF status in (1).
AND R004
OUT R504
R005 R505
MPP ・・・ Read ON/OFF status in (1) and clear MPS.
AND R005
OUT R505
BASIC INSTRUCTIONS
MPP Stores the ON/OFF state and operation flag state before this instruciton by the MPS
instruction, and executes the instructions from the next program segment. 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
→
Instruction
Connection/End
(1) (2) (3) (4) (5) (6) (7) (8) 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
ANL,OR,ORL
BASIC INSTRUCTIONS
Ladder program
ANL ORL
2 Block C
Instruction
Connection/End
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 connected
in 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 are
called "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.
(3)Both input relay R001 and R002 turn ON.
(4)Both input relay R001 and R003 turn ON. 2
R000 R002 R501 (mnemonics list)
Instruction
Connection/End
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.
R000 R002 R501 (mnemonics list)
LD R000
OR R001
R001 R003 LD R002
OR R003
ANL
OUT R501
INV
To invert the previous ON/OFF state before
Inverse
this instruction.
Ι Ν V
Description of Operation
INV Inverts the previous ON/OFF state before this instruction.
Scan
ON
Before INV
instruction OFF
ON
After INV
instruction OFF
Point • The "previous ON/OFF state" refers to the circuit elements connected by ANL/ORL.
Example R1000 R1001 MR000
R1002
AND state of 1000 and R1002 are not inverted, only R1002 is inverted.
• 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
Instruction
Connection/End
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 DM0 LD R000
OR DM0.3
ANB DR001
MOV #10 DM0
INV
DM0.3 MOV MOV #20 DM0
#20 DM0
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
Instruction
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 tbe interrupt program 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 insub-routines.
"Precautions on the use of differential execution type instructions" (Page 1-35)
• The "previous ON/OFF state" refers to the circuit elements connected by ANL/ORL.
Example R1000 R1001 MR000
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. 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 instruciton together.
"INV instruction" (Page 2-68)
BASIC INSTRUCTIONS
● When inverting is ○
possible
2
● When inverting is ×
Connection/End
Instruction
not possible
Operation flag
Sample Program
Only 1 scan will be performed on the rising edge of the execution condition with R000/R001/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 specified
Input refresh
number of input relays.
@RFSX
RFSX
RFSY
RFSY
To refresh the states of the
Output refresh
specifed number of output relays.
@RFSY
RFSY
2
Ladder program Input mode
Direct I/O instructions
Operand Explanation
D Specifies the leading device for refreshing I/O state.
n Specifies number of relays for which I/O state is to be refreshed. (1 to 256 bit) *1 *2
*1 When a bit device has been specified in n , 16 continuous bits will be processed.
When a relay other than the leading relay of the channel (e.g. MR002 or R1012) is specified, 16
bits will be processed straddling the next channel.
"Word Unit Processing of Bit Device" (Page 1-40)
*2 When 1-bit refreshing is performed ("1" is specified in n ), instruction words that can use
direct input/output relays directly (DR) are available.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
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, starting from the device No. of D , states of the
specified number of input relays ( n ) will be refreshed.
@RFSX Only 1 scan period is ON on rising edge of execution condition 2
Point Inputs and outputs for expansion units that do not support direct input/output cannot be
refreshed.
Operation flag
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
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
unit.
MEMO
2
Direct I/O instructions
APPLIED INSTRUCTIONS
APPLIED INSTRUCTIONS
These instructions are for project progress, program control, and extended
ladders.
These instructions enable structured programming for basic ladders.
5(6
SFT
&
Shift Operates the shift register
APPLIED INSTRUCTIONS
%.-
4'5
Operand Explanation
D1 Specifies the leading relay device.*1
D2 Specifies the end relay device.*1
*1 When a word device has been specified, the LSB is shifted. Bits other than LSB do not change.
Bit specifying can not be used for word devices.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
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 relay specified by D2 in sync with the clock pulse.
When reset input is ON, all relays from D1 to D2 turn OFF.
When the device No. specified by D1 is less than the device No. specified by D2 , the state is
not shifted to relays [ D2 +1] onwards. …(1)
When the device No. specified by D1 is greater than the device No. specified by D2 , the state
is not shifted to relays [ D2 -1] onwards. …(2)
㪦㪥
Data input
㪦㪝㪝
㪦㪥
Clock input
㪦㪝㪝
㪦㪥
Reset input
㪦㪝㪝
(1) (2) 㪦㪥
㪛㪈 㪛㪈
㪦㪝㪝
㪦㪥
㪛㪈 㪂㪈 㪛㪈 䋭㪈
㪦㪝㪝
㪦㪥
㪛㪈 㪂㪉 㪛㪈 䋭㪉
㪦㪝㪝
㪦㪥
㪛㪈 㪂㪊 㪛㪈 䋭㪊
㪦㪝㪝
㪦㪥
㪛㪉 䋭㪈 㪛㪉 㪂㪈
㪦㪝㪝
㪦㪥
㪛㪉 㪛㪉
㪦㪝㪝
APPLIED INSTRUCTIONS
Point • Duplicate use of D1 and D2 between two or more SFT instructions is not allowed.
• This instruction cannot be used in interrupt programs or in the initialization module.
Operation flag
Shift Instruction
CR2012 • When different types of devices are specified by indirect specifying in D1 and D2
• When the indirect specifying or index modify range is inappropriate.
No change in state when indirect specifying and index modify are not specified.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Sample Program
R1003 R1000
SET
MEMSW
MEMSW
Memory switch Operates the memory switch.
APPLIED INSTRUCTIONS
3
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ :#/:Z
(B) (W) (ZF)
*1
n
struction
Memory Switch In-
- - - - - - - - - - - - - - - - - - -
*2
S - - - - - - - - - - - - - - - - - - -
Operand Explanation
n Specifies memory switch No. (0 to 2).*1
S Sets the memory switch ($0000 to $FFFF).*2
Operation Description
This instruction is set when powering ON and when the ladder program is transferred (including
writing in the RUN mode).
APPLIED INSTRUCTIONS
MEMSW0
3210 3210 3210 3210
$0103
0000 0000 0000 0000
SW1
SW2
SW3
SW4
3
Clear current value (or CTH) and contacts (or CTC) of counter and
high-speed counter when powering ON or PROG→RUN
Enable Disable 3
struction
Memory Switch In-
0 Digital trimmer upper limit Enable Disable
SW2 1 Write protection of host program Enable Disable
2 Reserved for system ─ ─
3 Reserved for system ─ ─
0 When power ON or PROG→RUN, DM0 to DM9999 Clear Hold
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
3
MEMSW2
3210 3210 3210 3210
$0 0 0 3
0000 0000 0000 0000
SW1
SW2
SW3
struction
Memory Switch In-
SW4
* 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.
struction
Memory Switch In-
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5 Off-hold relay R25000 to R29915, 30000 to 34915 series.
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8 Off-hold relay R1000 to R4915, 15000 to R19915 series.
1 0 0 1 9
1 0 1 0 A
1 0 1 1 B
1 1 0 0 C
1 1 0 1 D
1 1 1 0 E
1 1 1 1 F
Reference If an attempt is made to transfer program to KV-1000 that has been write-protected on KV
STUDIO, "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
STP Step
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano instruc
STP,STE
tion
Executes the program up to the STE start
STP
STP STE Step
Step instruction when the specified bit device
APPLIED INSTRUCTIONS
instruc
is ON. tion
This instruction is used in pairs with the end
STE
STE
Step end STP instruction, and indicates end of the
program to be executed by step operation.
Program A
3 STE
S T E
Step Instructions
Program B
Operand Explanation
Specifies the device to be used as the execution condition in the program between the STP and STE
S
instructions.*1
Operation Description
When the device specified by S is ON, the instructions (program A) between the STP and STE
instructions are executed.
When the device specified by S is OFF, the program between the STP and STE instructions is not
executed, and execution jumps to the instruction sequence (program B) after the STE instruction.
Example When input 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 input
R001 turns OFF.
R000 R1000
STP
R1000
This program is
R001 R500
← not executed when
R1000 is OFF.
STE
APPLIED INSTRUCTIONS
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-35)
"KV-7000 Series User's Manual "Precautions when using timer instructions""
"KV-5500/5000/3000 Series User's Manual "Precautions when using timer instructions""
3
"KV-1000 Series Programming Manual "Precautions when using timer instructions""
"KV Nano Series User's Manual "Precautions when using timer instructions""
"Macro Instructions" (Page 3-44)
Step Instructions
About nesting structure
(3)
STE
(4)
Operation flag
* When CR2012 has turned ON, the program sequence between the STP and STE instructions is not
executed.
KV-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 turns ON, output relay R500 automatically turns ON for 2s, and then R501 turns
ON for 3s.
LDB T0
T0 R500 OUT 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
STE LD R1002
TMR #1 #30
STE
STP
R1002
T1 R1002
RES
T1 R501
R1002 #30
T1
STE
APPLIED INSTRUCTIONS
MEMO
Step Instructions
STG Stage
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano start
STG,JMP,ENDS,ENDS
JMP Stage
STG
jump
STG Stage Executes the instruction in the stage. ENDS End
APPLIED INSTRUCTIONS
stage
JMP
Turns the bit device of the current executing
JMP Jump
stage OFF, and jumps to the specified stage.
ENDS
Turns the bit device of the currently executing
ENDS End stage
stage OFF.
D D '
3 STG
D '
JMP S
J
T G
M P
D
D
struction
Stage Processing In-
STG ENDS E N D S
Operand Explanation
D Specifies the device to be used as the stage No.
Description of Operation
STG When D is ON, the STG will operates as ON contact.
When D is OFF, it will jump to the beginning of next block.
When D is turned from ON to OFF, the STG will operates 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 can not 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-66).
APPLIED INSTRUCTIONS
■ About the STG instruction
"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
Ladder program
No
Start switch ON?
Start switch
↑
R1000
SET
3
Yes
struction
Stage Processing In-
R1000 R1001
Process(1) STG JMP →Process(1)
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.
Point • This instruction cannot be used in interrupt programs or in the initialization module.
• D of | STG | and D ' of | JMP | can occupy the channels of relays.
• D is the STG program block that is OFF, which does not influence scan time.
• Attention is required when programming differential execution type instructions, timer or
macro instructions between the STG and JMP/ENDS instructions.
"Precautions on the use of differential execution type instructions" (Page 1-35)
"KV-7000 Series User's Manual "Precautions when using timer instructions""
"KV-5500/5000/3000 Series User's Manual "Precautions when using timer instructions""
"KV-1000 Series Programming Manual "Precautions when using timer instructions""
"KV Nano Series User's Manual "Precautions when using timer instructions""
"Macro Instructions" (Page 3-44)
• The STG instruction cannot be used in sub-routines.
• When the operand D of the STG instruction becomes ON the states of each of the
STG instructions becomes the state when the execution condition of the respective
instruction turned OFF. The states of the SHOT and OFDL instructions are held.
• When the block is only programmed with JMP/ENDS instructions and without STG
instruction, the operation can not be ensured due to uncertain relay reset by MP/ENDS.
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 stage
ZRES
R1004 End relay of stage
CR2003 SFT
D
R1000 Leading relay of stage
CR2003
3 Reset input
CLK
R1004 End relay of stage
RES
struction
Stage Processing In-
Operation flag
Interlock
Double coils
Double coils can be used in stage instructions.
* When STG R1000 and R1002 turn ON simultaneously, output R500 of STG R1002 programmed
later is given priority.
APPLIED INSTRUCTIONS
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.
3
R1001 R501 R001 R1002
STG SET JMP
struction
Stage Processing In-
The STG instruction does not turn OFF when there is no JMP or ENDS instruction even if R00001 turns
ON when the STG instruction is ON.
R001
R1001 R002
ENDS
R002 R1002
JMP
3
R1000 R501 R002 R1002
STG JMP
struction
Stage Processing In-
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
DIFU SET LD R000
DIFU R1100
R1000 CON
R500 R001 R1001
AND R1100
STG JMP SET R1000
STG R1000
R002 R1002 OUT R500
JMP CON
MPS
AND R001
R1001 R501 #10 T0 R1000 JMP R1001
STG T0 JMP MPP
AND R002
R1002 R502 #20 T1 R1000 JMP R1002
STG T1 JMP STG R1001
OUT R501
CON
TMR #0 #10
CON
AND T0
JMP R1000
STG R1002
OUT R502
CON
TMR #1 #20
CON
AND T1
JMP R1000
APPLIED INSTRUCTIONS
MEMO
struction
Stage Processing In-
device
W-ON
Sets the device of the No.2 operand with the device of the
ON Wait ON No.2
of the No.1 operand ON.
APPLIED INSTRUCTIONS
operan
W-OFF
Sets the device of the No.2 operand with the device d with
OFF Wait OFF
of the No.1 operand OFF. the
device
of the
Ladder program Input mode
No.1
Execution condition S operan
ON W - O N S D d ON.
D ( W O N S D ) W-OFF Sets
the
device
Execution condition S of the
3 OFF W - O F F S D No.2
( W O F F S D )
D operan
d with
Available Devices ( ): Not supported on the KV-1000
the
struction
Stage Processing In-
Index
*1 Local device
Bit Devices Word Devices Const Ind Spec Device Modify
Operand of the
MR DM EM No.1
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ :#/:Z operan
(B) (W) (ZF) d OFF.
S - *3 *2 - - - - - - -
D - - - - *2 - - - - - - -
Operand Explanation
S Specifies the device whose ON/OFF state is to be detected.*1
D Specifies the device to be set by the ON/OFF state of S .*1
*1 When a word device has been specified, the LSB is proecessed. Bits other than LSB do not change.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTC cannot be used with the KV-7000 Series.
Description of Operation
W-ON (1)When the execution condition is ON, the device specified by D is set if the device
specified by S is in an ON state.
(2) D holds ON until the execution condition turns OFF even if S turns OFF.
(3)When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(1) (2) (3) (1)' (3)'
ON
Execution condition S Execution condition
OFF
ON ON
D S
OFF
ON
D
OFF
W-OFF (1)When the execution condition is ON, the device specified by D is set if the device
specified by S is in an OFF state.
(2) D holds ON until the execution condition turns OFF even if S turns ON.
(3)When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(1) (2) (3) (1)' (3)'
ON
Execution condition S Execution condition
OFF
OFF ON
D S
OFF
ON
D
OFF
APPLIED INSTRUCTIONS
Point This instruction cannot be used in interrupt programs or in the initialization module.
Operation flag
CR2012
• When a timer/counter has been specified by indirect specification to D 3
• When the indirect specification or index modify range is inappropriate.
struction
Stage Processing In-
No change in state when indirect specification and index modify are not specified.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
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 bit device of the No.2 operand at the rising
↑ Wait rising edge No.2
edge of the bit device of the No.1 operand. operan
APPLIED INSTRUCTIONS
W-DE
Sets the bit device of the No.2 operand at the falling d at the
↓ Wait falling edge rising
edge of the bit device of the No.1 operand.
edge
of the
Ladder program Input mode bit
device
Execution condition S W - U E S D
of the
↑ W U E S D No.1
D W U S D
operan
d.
Execution condition S W - D E S D W-DE Sets
3 ↓ W D E S D the bit
D W D S D device
of the
Available Devices ( ): Not supported on the KV-1000 No.2
struction
Stage Processing In-
Index
Local Modify operan
Bit Devices Word Devices*1 Const Ind Spec
Operand Device d at the
MR DM EM falling
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ :#/:Z edge
(B) (W) (ZF) of the
*3 *2 bit
S - - - - - - - -
device
- - - - *2 - - - - - - -
D of the
No.1
Operand Explanation operan
S Specifies the device whose rising edge or falling edge is detected.*1 d.
*1 When a word device has been specified, the LSB is processed. Bits other than LSB do not change.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTC cannot be used with the KV-7000 Series.
Description of Operation
W-UE (1)When the execution condition is ON, the device specified by D is set if the device
specified by S is at the rising edge.
(2) D holds ON until the execution condition turns OFF even if S turns OFF.
(3)When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(4)When the execution condition is ON, D does not turn ON unless the rising edge
is detected even if S is ON.
(1) (2) (3) (4)
ON
D
OFF
W-DE (1)When the execution condition is ON, the device specified by D is set if the device
specified by S is at the falling edge.
(2) D holds ON until the execution condition turns OFF even if S turns ON.
(3)When the execution condition turns OFF, the device specified by D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
APPLIED INSTRUCTIONS
(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. 3
• Attention is required when programming this instruction between the STP and STE
struction
Stage Processing In-
instructions, and between the STG and JMP/ENDS instructions, CJ/NCJ/GOTO to
LABEL instructions, and in a sub-routine.
"Precautions on the use of differential execution type instructions" (Page 1-35)
Operation flag
Sample Program
When the input relay is ON, and the order in which input relays R001 to R003 turn ON is R00 R002
R003, output relay turns ON.
3 LD R1001
R1001
W-UE R003 R1002
R1001 R003
LD R1002
↑
R1002 OUT R500
struction
Stage Processing In-
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
APPLIED INSTRUCTIONS
MEMO
struction
Stage Processing In-
MC
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Indicat
MC,CR
es the
start of
master
control
3
M C R ( I L C )
MCR
Flow Instruction
Description of Operation
Master routine is used to install contacts on the left power rail, and to switch between program blocks
through ON/OFF.
Display ladder software Conceptual diagram
R000 MC MC
R000
R001
R001 R500 This part will be OFF
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.
Instruction State
OUB OFF
OFDL
Reset
SHOT
C instruction/CTH instruction/HSP
State held
instruction
CJ/NCJ/GOTO No branch 3
MCALL During execution of macros, instructions in the macro are executed only for one
Flow Instruction
scan with the execution condition OFF, and then execution stops at the next scan.
MSTRT
This instruction is not executed when the macro stops.
• KV-7500/7300/5500/5000/3000 and 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
MCR
STE
3 MCR instructions
STP
XXXX
Flow Instruction
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.
(Mnemonics list)
R000 R1000 MC
LD R000
R001 R500
AND R1000
MC
LD R001
3
OUT R500
Flow Instruction
MCR
MCR
SBN Sub-
SBN
SBN entry
Sub-routine entry Indicates the start of the sub-routine. RET Sub-
routin
RET
RET e
Sub-routine return Ends the sub-routine. return
CALL/SBN/RET
3 END
SBN
Flow Instruction
n S B N n
RET
R E T
ENDH
Operand Explanation
S Specifies the macro name.*2
*1 The sub-routine No. can be specified within the range 0 to 99 ("#" can be omitted). The sub-
routine No. cannot be specified in $ (HEX).
Description of Operation
CALL When execution condition is ON, the specified subroutine in n will be executed
during each scan.
SBN Indicates the start of the sub-routine. Specify the sub-routine No. by 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
When execution of the sub-routine ends, program CALL
execution returns to program (B) following the CALL 000 Program(B)
END
instruction, and the main routine program is executed until
the END instruction is programmed. SBN
#0
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-35)
"KV-7000 Series User's Manual "Precautions when using timer instructions""
"KV-5000/3000 Series User's Manual "Precautions when using timer instructions"" 3
"KV-1000 Series Programming Manual "Precautions when using timer instructions""
Flow Instruction
"KV Nano Series User's Manual "Precautions when using timer instructions""
"Macro Instructions" (Page 3-44)
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
#0
call
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
Program
be defined (programmed in the previous rung) for
END
the KV-5500/5000/3000/1000.
Flow Instruction
SBN
#1
Subroutine
Program
RET
INT
R000
call
Interrupt program
R002 #1
CALL
RETI
ENDH
Operation flags
APPLIED INSTRUCTIONS
MEMO
Flow Instruction
subro
of
speci
Ladder program Input mode fied
modu
Execution condition ECALL le.
S n E C A L L S n
n - - - - *3 *4 *4 -
Operand Explanation
S Specifies the module name. *1
n Specifies the sub-routine No. (0 to 99) *2
*1 Enter the name of the macro directly. (" "can be omitted) Up to 24 half-width alphanumerics, and
12 full-width alphanumerics (24 for the KV-7000 Series) can be specified.
Reference Since module name list will be displayed at time of entering, you can simply make
selection to enter.
*2 The sub-routine No. can be specified within the range of 0 to 99 ("#" can be omitted). The sub-
routine No. cannot be specified in $ (HEX).
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
ECALL When execution condition is ON, n of the module specified in S will execute
the subroutine specified in S . You can specify all kinds of modules (fixed period,
initialization, each scan, waiting, etc.), but you cannot specify macros.
Reference • When subroutine of the self-module, CALL instruction can also be used.
• In the subroutine called by the ECALL instruction, when a local device is used, program
will be executed in the local device of the called part instead of the calling part.
• For other Description of Operation , please read CALL instruction.
"CALL instruction" (Page 3-28)
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-35)
"KV-7000 Series User's Manual "Precautions when using timer instructions""
"KV-5500/5000/3000 Series User's Manual "Precautions when using timer instructions""
"KV-1000 Series Programming Manual "Precautions when using timer instructions""
"KV Nano Series User's Manual "Precautions when using timer instructions""
"Macro Instructions" (Page 3-44)
APPLIED INSTRUCTIONS
Operation flag
* KV-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. 3
"CR/CM List" (Page A-71)
Flow Instruction
Sample Program
Execute sub-routine of "Module 1" when R000 is ON.
R000 ECALL (Mnemonics list)
“Module 1” #1 LD R000
ECALL "Module1" #1
NEXT
Repeatedly executes the instruction
Repea
NEXT
NEXT t force
NEXT Indicates the end of the repeat range.
end
FOR, NEXT
BREAK
BREAK Ends execution of the FOR to NEXT
Break
instructions forcedly.
3 FOR
S F O R S
Flow Instruction
Loop program
Execution condition BREAK
B R E A K
NEXT
N E X T
Operand Explanation
Specifies the number of loops that the program inside the FOR to NEXT instructions is repeated. *1
S FOR (.U) can be specified within the range 0 to 65535, and FOR.D can be specified within the range 0 to
4294967295.
*1 When a bit device has been specified, 16/32 continuous bits are processed.
When a relay other than the leading relay (e.g.MR002, R1012) of the channel has been
specified, the relay is processed in16/32 bits straddling the next channel.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
FOR(.U) • The program between the FOR and NEXT instructions is executed repeatedly within a
single 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 with in a
single 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.
3-34 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Flow Instruction
APPLIED INSTRUCTIONS
Example The FOR instruction can be programmed up to a nesting level of 16.
FOR
#5
FOR
#4
2 nested
3 nested
1 nested
Flow Instruction
←
NEXT
NEXT
NEXT
• The program section in "Nest 1" is executed for 5 times, and program execution jumps
to program (4).
For this reason, program (1) is executed 5 times.
• While "Nest 1" is executed once, program (2) in "Nest 2" is executed 4times.
This means that program (2) is executed a total of (5 x 4=) 20 times.
• While "Nest 2" is executed once, program (3) in "Nest 3" is executed 3 times.
This means that program (3) is executed a total of (5 x 4 x 3=) 60 times.
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-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
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)
DM0 TM10 LD CR2002
3 #0
LDA
DM100
STA
#0
LDA
DM101
STA
ADRSET DM0 TM10
LDA #0
CON
STA DM100
Flow Instruction
FOR CON
#100 LDA #0
CON
CR2002 #TM10 DM100 DM100 DM101 STA DM101
LDA ADD STA INC FOR #100
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
APPLIED INSTRUCTIONS
MEMO
Flow Instruction
jump
CJ
CJ condit
Conditional ionally
APPLIED INSTRUCTIONS
GOTO
GOTO Unconditional Performs a jump unconditionally to the ction
branch LABEL instruction. NCJ
Perfor
LABEL
LABEL Sets the jump destination of the CJ or ms a
Label
GOTO instructions. jump
condit
ionally
Ladder program Input mode
3
to the
Execution condition NCJL
CJ
n C J n ABEL
instru
Flow Instruction
Description of Operation
CJ When the execution condition is ON, program execution jumps to the rung programmed
with the LABEL instruction specified by n .
NCJ When the execution condition is OFF, program execution jumps to the rung programmed
with the LABEL instruction specified by n .
GOTO Program execution jumps unconditionally to the rung programmed 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 #010
specified 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.
Execution condition Flowchart
CJ
#10
OFF
Execution condition
GOTO
#20 ON
LABEL
#10
LABEL #10 3
Flow Instruction
LABEL LABEL #20
#20
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
• Attention must be paid when using differential execution type instructions, or timer or
macro instructions between the CJ, NCJ or GOTO instructions and the LABEL
instruction.
"Precautions on the use of differential execution type instructions" (Page 1-35)
"KV-7000 Series User's Manual "Precautions when using timer instructions""
"KV-5500/5000/3000 Series User's Manual "Precautions when using timer instructions""
"KV-1000 Series Programming Manual "Precautions when using timer instructions""
"KV Nano Series User's Manual "Precautions when using timer instructions""
"Macro Instructions" (Page 3-44)
• Jumps are not possible across the SBN to RET instructions.
• Jumps are not possible across modules.
• KV-1000 The CJ, NCJ or GOTO instructions must be used in pairs with the LABEL
instruction.
• To use a CJ instruction between a FOR and NEXT instruction, pair it with a LABEL
instruction.
Operation flag
Sample Program
3 When input relay R000 turns ON, output relay R500 automatically turns ON for 2s, and then R501 turns
Flow Instruction
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 Instruction
ms a
jump
SCJ
SCJ Conditional Performs a jump to the LABEL
to the
branch instruction.(1 scan ON delay)
APPLIED INSTRUCTIONS
LABE
L
Ladder program Input mode instru
ction.(
Execution condition SCJ 1
n S C J n scan
ON
Available Devices ( ): Not supported on the KV-1000 delay)
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
3 n - -
(B)
- - - -
(W) (ZF)
- - - - - - - - - - - -
Flow Instruction
Operand Explanation
n Specifies the label No.(0 to 999) *1
*1 The sub-routine No. can be specified within the range 0 to 999 ("#" can be omitted). The sub-
routine No. cannot be specified in $ (HEX).
Description of Operation
SCJ When the execution condition is switched from OFF to ON, it will be transferred to the
rung containing the LABEL instruction specified by n during ON period from the
next scan ON.
Scan
ON
Execution condition
OFF
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-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.
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
T0
TMR #0 #20
LD T0
SCJ #1
3
LDB T0
Flow Instruction
T0 OUT R500
SCJ LABEL #1
#1
T0 R500
LABEL
#1
MCALL
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Execu
MCART,MEND
tes
Executes the specified sub- the
MCALL
MCALL
Macro call routine macro. (Programming specif
APPLIED INSTRUCTIONS
ied
within module)
sub-
Executes the specified self- routin
MSTRT
MSTRT
Macro start hold macro. Execute e type
(Programming within module) macro
.
Stops execution of the self-
MEND
MEND MSTRT
Macro end hold macro.(Programming Execu
within self-hold macro) tes
the
specif
Ladder program Input mode ied
Operand Explanation
S Specifies the macro name.*2
*1 The number (0 to 10) and attributes from the No.2 operand onwards differs according to the
argument current set to the macro to be executed.
Devices that can be used for each attribute are as follows.
*2 Use of " ", # , $ is not allowed. Directly enter the name of the macro set on KV STUDIO.
Up to 12 half-width alphanumerics, and 6 full-width alphanumerics (12 for the KV-7000 Series)
can be specified.
*3 When an ID No. is used, the format becomes "(macro name)_(ID No.)". Example) Batch send_2
For details on ID Nos., see KV-1000 Series Programming Manual "Chapter 3 Using Macro",
KV-7000 Series User's Manual "4-9 Macro", KV- 5000/3000 series User's Manual "3-9 Macro"
and KV Nano Series User's Manual "4-9 Macro".
*4 Handling of timers/counters changes according to the instruction to be used in macros.
Example) When the MOV instruction is programmed, the current value is handled. For details,
refer to the description for the respective instruction.
*5 Specify the expansion unit No. When the macro palette is used, select the target expansion unit
from the list to specify the unit.
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
3-44 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Macro Instructions
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 starts up 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.
KV-7000 Series User's Manual "4-9 Macro"
KV-5500/5000/3000 Series User's Manual "3-9 Macro"
KV-1000 Series Programming Manual "Chapter 3 Using Macro"
KV Nano Series User's Manual "4-9 Macro"
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.
• The previous state of differential execution type instructions in macros is initialized every
time that execution of a macro is started. (rising edge differentiation: ON, falling edge
differentiation: OFF)
• When T/C/CTH has been specified to an operand whose MCALL/MSTRT instruction
attribute is a value, the following values are handed over to the macro:
T/C : Current value (32-bit data)
CTH : Current value (32-bit data)
CTC : Setting value (32-bit data)
• In the following cases the macro being executed stops when each module stops or
when the execution condition for each set of instructions turns OFF.
• When an MCALL/MSTRT instruction is written to the module
• When an MCALL/MSTRT instruction is written to master control (in the MC - MCR
instructions)
• When an MCALL instruction is written to stage (in the STG - JMP instructions)
• In the following cases the macro being executed is canceled when the execution
condition for each set of instructions turns OFF.
The macro execution resumes when each set of instructions is executed.
The previous state of differential execution type instructions in macros is not initialized at
this time.
(If it is written in the initialization module only, 1 scan is executed when operation starts.)
• When an MCALL/MSTRT instruction is written to sub-routine (in the SBN - RET
instructions)
3 • When an MCALL/MSTRT instruction is written to conditional branch (in the CJ/
NCJ - LABEL instructions)
Macro 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.
It is ON when indirect designation or the scope of index modification is inappropriate, or when
the unit designated at UR/UV/UM while using the KV-7000 series is not connected. Otherwise it
CR2012
is OFF.
Does not change when indirect specification or index modify is not specified to the operand.
Point The state of the operation flag does not change by the MEND instruction.
APPLIED INSTRUCTIONS
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.
R000 MCALL Macro A (Mnemonics list)
EM0 #10 LD R000
MCALL Macro A EM0 #10
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. 3
R001 MSTRT Macro B (Mnemonics list)
Macro Instructions
↑ #1 #10 LDP R001
MSTRT Macro B #1 #10
When input relay R002 is ON, execution of self-hold macro "Macro B" is stopped.
Macro B
(Mnemonics list)
B
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Call
FB,FEND,FUN
s up
func
FB
Function block
Calls the specified function block. tion
call
APPLIED INSTRUCTIONS
bloc
k
FEND FEND Function block Stops execution of the function block. END
end (Written in the function block) Stop
s
Call
Ladder program Input mode s up
func
Execution condition S *1
tion
* …*
3
F B S Argument 1 Argument 2
Input1 Output1
*1
InOut1 InOut1
UnitNo
Instructions
Function Block
Execution condition S *1
Input1 Output1
F U N S * Argument 1 Argument 2 …*
*1
InOut1 InOut1
UnitNo
Available Devices
Index
Local Modify
Bit Devices Word Devices Const Ind Spec Device
Operand
MR DM EM
R DR LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
B W ZF
S - - - - - - - - - - - - - - - - - - - -
Operand Explanation
S Specifies the function block/function name. *2
*1 The number (0 to 64) and attributes of arguments from the No.2 operand onwards differ
according to the argument settings set to the function block/function to be executed.
Devices that can be used for each argument type are as follows.
Available Devices
Index
Local Modify
Bit Devices*3 Word Devices* 4 Const Ind Spec Device Argument
Argument
type MR DM/EM *5 IN Unit
R DR LR T/C CTC CR FM/ZF T *5 CTH Z* CM #/$ #TM *
5
@ OUT UR : #/: Z
B TM/W C CTC IN-OUT UM
UV
In - *7 - *6 *8 - *6 -
OUT - - - *9 *6 *8 - *4 *6 - - -
IN-OUT - *11 - - *11 - - - - - -
Unit*10 - - - - - - -
*2 "", # and $ cannot be used. Directly enter the name of the function block/function name set in KV
STUDIO.
*3 When a bit device is specified in an argument where the display format is not bits (BOOL) or text
string (STRING), 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel is specified, the
relay is handled in 16/32/64 bits straddling the next channel.
Specify the leading device of the channel for arguments where the display format is text string
(STRING).
*4 Bit 0 is handled when a word device is specified in an argument where the display format is bits
(BOOL).
However, if the argument type is OUT, Z cannot be specified in arguments where the display
format is bits (BOOL).
3-48 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Function Block Instructions
APPLIED INSTRUCTIONS
*5 T, C and Z cannot be specified for arguments where the display format is double precision
floating point (LREAL) or text string (STRING).
*6 The bit position of the word device can be specified for arguments where the display format is
bits (BOOL).
*7 T and C can be specified for arguments where the display format is bits (BOOL). The timer/
counter contact is handed over.
*8 Handled as the timer/counter current value (32 bit data).
*9 CR2000 to CR2015 cannot be specified.
*10 Specifies the unit number.
*11 Handling of timers/counters changes according to the instruction to be used in function block/
function.
3
Example) The current value is handled when the MOV instruction is programmed. For more
Instructions
Function Block
details, refer to each instruction.
Point The FB instruction, FEND instruction and FUN instruction can be used with KV-7000
Series CPU units with CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version" (Page 2)
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.
The OFF process when stopped differs according to the program settings. Refer to the instruction
manual for the CPU unit for details.
KV-7000 Series User's Manual "4-8 Function Block"
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 FB instruction execution condition stays ON, the FEND instruction is ignored.
• The FEND instruction cannot be written in the module or function.
• The FEND instruction cannot be used to stop other function blocks.
• The previous state of differential execution type instructions in function blocks is
initialized every time the execution of the function block is started. (Rising edge
differentiation: ON, falling edge differentiation: OFF)
• Differential execution type instructions and timer instructions cannot be used in functions.
• In the following cases the function block/function being executed stops when each module/
function block stops or when the execution condition for each set of instructions turns OFF.
• When an FB/FUN instruction is written to a module/function block
• When an FB/FUN instruction is written to master control (in the MC - MCR instructions)
• When an FUN instruction is written to stage (in the STG - JMP instructions)
• In the following cases the function block/function being executed is canceled when the
execution condition for each set of instructions turns OFF. The macro execution
resumes when each set of instructions is executed. The previous state of differential
execution type instructions in macros is not initialized at this time. (If it is written in the
initialization module only, 1 scan is executed when operation starts)
• When an FB/FUN instruction is written to sub-routine (in the SBN - RET
instructions)
• When an FB/FUN instruction is written to conditional branch (in the CJ/NCJ -
3 LABEL instructions)
• When an FB/FUN instruction is written to step (in the STP - STE instructions)
Instructions
Function Block
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.
This flag is ON in the following instances. Otherwise, it is OFF.
• When the indirect specification or index modification range is inappropriate
CR2012 • 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
settings differ
Point The state of the operation flag does not change by the FEND instruction.
APPLIED INSTRUCTIONS
Sample Program
Function block "Function block A" execution starts with argument 1 (unit number) as #1 and argument
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
・・・・ 3
Instructions
Function Block
(Mnemonics list)
Function "Function B" is executed with argument 1 as EM0 and argument 2 as MR000 when input relay
R002 is on.
R002 Function B (Mnemonics list)
MDTSRT
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Mod
MDSSTOP
ule
exec
MDSTRT
MDSTRT Module execution Starts execution of the
ution
start specified module.
APPLIED INSTRUCTIONS
start
MDSTOP
MDSTOP
MDSTOP Module execution Stops execution of the
Mod
stop specified module. ule
exec
ution
Ladder program Input mode
stop
Execution condition MDSTRT
S M D S T R T S
Operand Explanation
S Specifies the module name. *1
*1 Use of " ", # , $ is not allowed. Directly enter the name of the module set on KV STUDIO.
Up to 24 half-width alphanumerics, and 12 full-width alphanumerics (24 for the KV-7000 Series)
can be specified.
Description of Operation
MDSTRT When the execution condition is ON, the module specified by S is started up.
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 up.
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.
KV-7000 Series User's Manual "4-8 Modules"
KV-5500/5000/3000 Series User's Manual "3-8 Modules"
KV-1000 Series Programming Manual "2-1 Outline and Features of Modules - Standby module"
KV Nano Series User's Manual "4-8 Modules"
Point • The initial state of differential execution type instructions at start of module execution is
ON in the case of rising edge detection and OFF in the case of falling edge detection.
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 KV-7500/7300/5500/5000/3000/1000 or KV Nano Series OFF then back
ON again.
Switch the RUN-PROG selector switch on the KV-7500/7300/5500/5000/
3000/1000 or KV Nano Series unit to PROG then back to RUN again.
Turn program execution OFF then back ON again.
• Execution of the initialization module cannot be started or stopped.
APPLIED INSTRUCTIONS
Operation flag
Sample Program
When the rising edge of input relay R000 is detected, the module currently selected by mode
3
Module Instructions
selection (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.
*1 For details on the module execution ON bit, see KV-7000 Series User's Manual
"4-8 Modules" KV-5500/5000/3000 series User's Manual "3-8 Modules" KV-1000
Programming Manual "2-2 Before you start using modules" KV Nano Series User's Manual
"Modules".
ZPUSH Index
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano regist
ZPUSH,ZPOP
er
batch
ZPUSH ZPUSH.S
ZPUSH.L
ZPUSH
Purges the value of the purge
APPLIED INSTRUCTIONS
ZPOP
e
ZPOP.S ZPOP
ZPOP.L Reads the value of the
Index register
index register from the
batch restore
@ZPOP @ZPOP.S
@ZPOP.L
ZPOP specified data block.
D Z P U S H D
Operand Explanation
D Specifies the leading device ofthe purge destination data block.*1
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
Point No suffix for KV-1000 .
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 3
…
structions
Index Register In-
Z10 Z10 D +20 D +19
Reserved for system Reserved for system D +22 D +21
Reserved for system Reserved for system D +24 D +23
ZPOP.S When the execution condition is ON, the value of the data block (index register stored by
the 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
…
ZPOP.L When the execution condition is ON, the value of the data block (index register stored by
the 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
…
@ This instruction is executed for one scan at the rising edge of the execution condition.
Reference • The ZPUSH and ZPOP instructions are programmed nested. When nesting these
instructions, specify the same leading device.
• KV-7500/7300/5500/5000/3000, KV Nano Series It will become .L when inputting without suffix
specifying.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-55
Index Register Instructions
APPLIED INSTRUCTIONS
• For .L
bit bit bit bit
31 16 15 0
ZPUSH
DM0 3 DM0
Z1 DM1DM2
ZPUSH
DM0
3 DM0
ZPOP
Reserved for system DM47DM48
DM0 Z1 DM49DM50
structions
Index Register In-
ZPOP
DM0 Reserved for system DM71DM72
• For (.S)
bit bit
15 0
ZPUSH
DM0 3 DM0
Z1 DM1
ZPUSH
DM0
…
…
ZPUSH Reserved for system DM12
DM0
Z1 DM13
ZPOP
…
DM0 …
Reserved for system DM24
ZPOP
DM0 Z1 DM25
…
ZPOP
DM0 Reserved for system DM36
Point • Set "0" to [ D +0] before executing the initial 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 in 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
Z1
+02000
DW.S
Z2
Sets the values of index registers Z1 and Z2 to
+01000 and +02000 respectively. 3
structions
Index Register In-
#0
CALL Executes the sub-routine.
END
Subroutine
SBN
#0
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
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Store
ADRSESET
s the
ADRSET
addre
ADRSET Stores the address of the
ss of
device to be indirectly
APPLIED INSTRUCTIONS
Operand Explanation
S Specifies the device to be indirectly specified.
D Specifies the word device to store the device No. (address) specified by S . *1
Description of Operation
ADRSET When the execution condition is ON, the address of the device specified by S is
stored in [ D / D +1] to indirectly specify the device specified by ADRSET S .
(The value to store is not the value of S .)
When [* D ] is specified to the operand by an instruction 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
5 Address of S* S is stored to [ D / D +1].
* For all devices that can be
specified by S ,
addresses (two words) are
assigned internally on the CPU.
@ADRSET This instruction is executed for one scan at the rising edge of the execution condition.
APPLIED INSTRUCTIONS
Operation cannot be assured when the following operation is not followed. (Some device
values may be corrupted, and prevent ladders from being operated 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.
• Note, however, that addresses are sometimes copied (No change for content of
addresses) by the MOV instruction, for example.
Operation flag 3
structions
Indirect specifying in-
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when the indirect specification and index modify range is inappropriate. Otherwise, OFF.
CR2012
Does not change when indirect specification or index modify is not specified to the operand.
Sample Program
When input relay R000 is ON, store the value of DM0 in DM100.
(Mnemonics list)
R000 ADRSET
DM0 DM500 (1) LD R000
ADRSET DM0 DM500
MOV *DM500 DM100
MOV
*DM500 DM100 (2)
When input relay R000 is ON, store the #12345 in DM0 and the #56789 in DM5.
(Mnemonics list)
R000 ADRSET
DM0 DM500 (1) LD R000
ADRSET DM0 DM500
MOV #12345 *DM500
MOV MOV.S +5 Z1
#12345 *DM500 (2)
MOV #56789 *DM500:Z1
MOV.S
+5 Z1 (3)
MOV
#56789 *DM500 : Z1 (4)
addre
ADRINC ADRINC
Device address
ss
incre
APPLIED INSTRUCTIONS
Increment address
incremented by 1. mente
@ADRINC ADRINC
d with
1.
3
1.
Execution condition ADRINC
D A D R I N C D
structions
Indirect specifying in-
Operand Explanation
ADRINC: Specifies the device where the address to increment is stored. *1
D
ADRDEC: Specifies the device where the address to decrement is stored. *1
Description of Operation
ADRINC When the execution condition is ON, the address currently stored in the device specified
by 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 the device specified
by D is decremented by 1.
D +1 D D +1 D
Address Address-1
@ 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
values may be corrupted, and prevent ladders from being operated normally.)
NOTICE
• Never generate or manipulate addresses by any means other than the ADRSET,
ADRINC, ADRADD, ADRDEC, and ADRSUB instructions.
APPLIED INSTRUCTIONS
Operation flag
structions
Indirect specifying in-
KV-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
ADRINC When input relay R000 is ON, store the value of DM0 to DM100 and the value of DM1 to
DM101.
(Mnemonics list)
R000 ADRSET
DM0 DM500 (1) LD R000
ADRSET DM0 DM500
MOV MOV *DM500 DM100
(2) ADRINC DM500
*DM500 DM100
MOV *DM500 DM101
ADRINC
DM500 (3)
MOV
*DM500 DM101 (4)
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 (1) LD R000
ADRSET DM20 DM500
MOV MOV *DM500 DM100
(2) ADRDEC DM500
*DM500 DM100
MOV *DM500 DM101
ADRDEC
DM500 (3)
MOV
*DM500 DM101 (4)
addit
ADRADD.L
Address
Add the address. Addr
addition
@ADRADD
ess
@ADRADD(.S) ADRADD
subtr
@ADRADD.L
actio
n
ADRSUB ADRSUB(.S)
ADRSUB.L
ADRSUB
Address
Subtract the address.
subtraction
@ADRSUB @ADRSUB(.S)
@ADRSUB.L
ADRSUB
S D A D R A D D S D
Operand Explanation
ADRADD: Specifies the value to add or the device to store that value. *1
S
ADRSUB: Specifies the value to subtract or the device to store that value. *1
ADRADD: Specifies the device where the address to be added is stored.*2
D
ADRSUB: Specifies the device where the address to be subtracted is stored.*2
APPLIED INSTRUCTIONS
Description of Operation
ADRADD(.S) When the execution condition is ON, the address currently stored to the device
specified by D is added to the value of the device specified by S .
D +1 D S D +1 D
Address + Value of S Address+ Value ofS
structions
Indirect specifying in-
ADRADD.L When the execution condition is ON, the address currently stored to the device
specified by D is added to the value of the device specified by [ S /
S +1].
D +1 D S +1 S D +1 D
Address + Signed 32-bit BIN data Addres + Value of S
ADRSUB(.S) When the execution condition is ON, the value of the device specified by S is
subtracted from the address in D .
ADRSUB.L When the execution condition is ON, the value of the device specified by [ S /
S +1] is subtracted from the address in D .
D +1 D S +1 S D +1 D
Address - Signed 32-bit BIN data Addres + Value of S
@ This instruction is executed for one scan at the rising edge of the execution
condition.
If the following operations are not followed, normal operation cannot be guaranteed.
(Values of some devices may be corrupt, and ladder program may not be executed
NOTICE normally).
• 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 value of reference
3 destination D is -32768.
Operation flag
structions
Indirect specifying in-
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
APPLIED INSTRUCTIONS
Sample Program
ADRADD When input relay R000 is ON, store the value of DM5 in DM100.
(Mnemonics list)
R000 ADRSET
DM0 DM500 (1) LD R000
ADRSET DM0 DM500
ADRADD +5 DM500
ADRADD MOV *DM500 DM100
+5 DM500 (2)
MOV
*DM500 DM100 (3)
3
structions
Indirect specifying in-
(1) Store the value of DM0 in [DM500/DM501].
(2) +5 is added to the address stored in [DM500/DM501].
(3) Value of the device of the address (+5 is added) stored in [DM500/DM501] (DM5) is
stored in DM100.
ADRSUB When input relay R000 is ON, store the value of DM5 in DM100.
(Mnemonics list)
R000 ADRSET
DM10 DM500 (1) LD R000
ADRSET DM0 DM500
ADRADD +5 DM500
ADRSUB MOV *DM500 DM100
+5 DM500 (2)
MOV
*DM500 DM100 (3)
FRSET Switch
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the
FRSET
curren
FRSET FRSET t
Switch the current group No. group
File register group
APPLIED INSTRUCTIONS
Operand Explanation
n Specifies the current group No. after switching or the device saving this No. *1
(0 to 15 for the KV-7000 Series, 0 to 3 for KV-5500/5000/3000)
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*2 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
FRSET When execution condition is ON, switch the current group 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
APPLIED INSTRUCTIONS
Sample Program
When input relay R000 is ON at the rising edge, switch the current group of file register to Group 1.
(Mnemonics list)
R000 FRSET
#1 LDP R000
FRSET #1
Instructions
File Register
FRSTM
File register all
saved at once to the memory specifi
For the KV-5000/3000 Series saving ed
card (CPU memory) in
group
FRSTM binary format. to the
memo
ry
card
KV-7500/7300
in
Ladder program Input mode binary
form.
Execution condition FRSTM
3 n1 n2 S D F R S T M n1 n2 S D
Instructions
File Register
KV-5500/5000/3000
D ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
Operand Explanation
n1(-*3) Specifies the drive No., or the leading device on which the drive No. is stored (0: Memory card, 1: CPU memory). *1
n2(n*3) Specifies the group No. or the leading device which the No. is stored (0 to 15). *1 *4
S Specify the file No. storing the data or the leading device storing the No (0 to 999). *1
D Specify the leading address for notification bit device. *2
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*2 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of LSB of two continuous words is used as the notification bit device.
Bits other than the lowermost bit do not change.
*3 The selection of drive number is not necessary for KV-5500/5000/3000.
*4 The group No. range is 0 to 3 for KV-5500/5000/3000.
*5 CTH and CTC cannot be used with the KV-7000 Series.
APPLIED INSTRUCTIONS
Description of Operation
FRSTM During the start-up of operating condition, it will save all of file register of the bank
number n2(n) at once to the designated storage n1(-) (memory card for KV-5000/
3000 series) 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 the KV-5000/3000 Series is FRB.
Create a new folder if there is no "FR" folder. 3
If 10 is stored in , \FR\FR010.FRU (or FR010.FRB) will be created.
Instructions
File Register
Example S
Write end notification into D , Write error notification of abnormal end into D +1.
• D becomes OFF at the start of command execution and ON when writing process
to the storage is finished. It becomes ON either when the command is normally
finished, or abnormally finished.
• This device turns OFF when D +1 execution ends successfully, and turns ON
when execution ends in error.
The error code is stored to CM2390.
"List of Error Codes for Storage Device Instructions" (Page 5-157)
Point The command will not be executed when the storage device instructions in execution
relay (CR3214) is ON. Please implement exclusive control using CR3214.
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-7500/7300
LDP R000
R000 FRSTM FRSTM #0 #0 #10 MR000
#0 #0 #10 MR000
(Mnemonics list)
KV-5500/5000/3000
LDP R000
FRSTM #0 #10 MR000
R000 FRSTM
#0 #10 MR000
FRLDM
Batch read file memory card (CPU memory) memo
register into the file register of the ry
For the KV-5000/3000 Series
card
FRLDM specified group. into
the file
regist
er of
KV-7500/7300
the
specifi
Ladder program Input mode ed
Execution condition FRLDM group.
3
n1 n2 S D F R L D M n1 n2 S D
KV-5500/5000/3000
Instructions
File Register
Ladder program
Input mode
Execution condition FRLDM
n S D F R L D M n S D
n2(n* )3
○ − ○ − − − ○ ○ ○ ○ ○ ○*5 ○*5 ○ ○ ○ − ○ ○ ○
S ○ − ○ − − − ○ ○ ○ ○ ○ ○*5 ○*5 ○ ○ ○ − ○ ○ ○
D ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
Operand Explanation
n1(-*3) Specifies the drive No., or the leading device on which the drive No. is stored (0: Memory card, 1: CPU memory). *1
n2(n*3) Specifies the group No. or the leading device which the No. is stored (0 to 15). *1 *4
S Specify the file No. reading the data or the leading device storing the No (0 to 999). *1
D Specify the leading address for notification bit device. *2
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*2 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of LSB of two continuous words is used as the notification bit device.
Bits other than LSB do not change.
*3 The selection of drive number is unnecessary for KV-5500/5000/3000.
*4 The scope of bank numbers that can be designated is 0 to 3 for KV-5500/5000/3000.
*5 CTH and CTC cannot be used with the KV-7000 Series.
APPLIED INSTRUCTIONS
Description of Operation
FRLDM It will read out the data at once, saved (by FRSTM command or the [file register
configuration] of "KV STUDIO") in the storage (memory card for KV-5000/3000 series)
designated at n1(-) to the file register of the bank number n2(n)at the start-up of the
operation condition.
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. 3
When 10 is stored in , \FR\FR010.FRU (or FR010.FRB) will be read out.
Instructions
File Register
Example S
Write end notification into D , and write error notification of abnormal end into
[ D +1].
• D turns OFF at the start of command execution and turns ON at the finish of
writing processing to the storage. The device turns ON whichever way execution
ends, successfully or in error.
• This device turns OFF when [ D +1] execution ends successfully, and turns ON
when execution ends in error.
The error code is stored to CM2390.
"List of Error Codes for Storage Device Instructions" (Page 5-157)
Point The command will not be executed when the storage device instructions execution relay
(CR3214) is ON. Please control it exclusively with CR3214.
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-7500/7300
LDP R000
R000 FRLDM #0 #0 #10 MR000
FRLDM
#0 #0 #10 MR000
(Mnemonics list)
KV-5500/5000/3000
LDP R000
FRLDM #0 #10 MR000
R000 FRLDM
#0 #10 MR000
UPSTRT Unit
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano pro
UPSTRT
gra
Available Devices
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
3 R DR LR T
B
C CTC CR TM FM T
W ZF
C CTH CTC Z CM #/$ #TM * @ :#/:Z
n1 ○ − ○ − − − ○ ○ ○ − − − − ○ ○ ○ − ○ ○ ○
Unit Program
Instructions
S ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
D1 ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
D2 ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
Operand Explanation
n1 Specifies the unit number, or the device in which it is stored. Cannot be specified by "$". (1 to 48)*1
S Specifies the leading device in which the details of the unit program to be executed are stored.*2
D1 Specifies the device in which the started slot number is stored.*3
D2 Specifies the leading device to store the results in.*4
*1 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. MR002, or R1012) of the channel has been specified, 16 bits are
occupied straddling the next channel.
When a word device has been specified, one word is occupied.
*2 When a bit device has been specified, 64 continuous bits are occupied. Those that are not the
first of the channel cannot be specified.
When a word device has been specified, 4 continuous words are occupied.
*3 When a bit device has been specified, 16 continuous bits are occupied. Those that are not the
first of the channel cannot be specified.
When a word device has been specified, one word is occupied.
*4 When a bit device has been specified, 32 continuous bits are occupied. Those that are not the
first of the channel cannot be specified.
When a word device has been specified, 2 continuous words are occupied.
Point • The UPSTRT instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UPSTRT instruction can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version" (page 2)
Description of Operation
At the rising edge of the execution condition the unit program specified by S in the n1 unit
starts, following 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.
APPLIED INSTRUCTIONS
S —: Request details device
Unit Program
Instructions
Execution result storage Description
destination device
Turns OFF when executing the instruction, turns ON when
Completion
0 bit complete. Turns ON regardless of whether the instruction ends
bit
D2 normally or abnormally.
Execution If execution of the instruction fails, turns ON simultaneously with the
1 bit
failed bit completion bit. Turns OFF when executing the instruction.
The completion code is stored when the instruction is complete.
0: Started normally.
1: The specified unit program does not exist.
2: There are no empty slots.
3: Operation enabled is OFF.
4: A unit program error has occurred.
5: The specified slot does not exist.
D2 +1 Completion code 6: The specified slot is in use.
7: The unit program is already being executed.
8: The specified block does not exist.
9: The unit program has already stopped being executed.
10: The specified unit program is not flow.
100: An error has occurred on the unit.
1000: The specified unit does not exist.
1001: The specified unit is illegal.
ON
Execution condition
OFF
ON
Execution failed bit
(specified in the instruction) OFF
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 result storage destination device completion bit and failed bit 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.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-73
Unit Program Instructions
APPLIED INSTRUCTIONS
3 instructions are in standby, they will be executed in the order in which they were put into standby.
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 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
Start block number
LDP DM11.0
MPS
Unit Program
Instructions
DM3.0 ANB DM11.1
( RES ) MOV DM10 DM20
Slot specification MPP
method AND DM11.1
UPSTRT MOV DM12 DM21
#1 DM0 DM10 DM11
KV-XH16ML Program number Start slot number Result storage
destination
DM11.0 DM11.1 MOV
DM10 DM20
Completion bit Execution failed bit Start slot number
DM11.1 MOV
DM12 DM21
Execution failed bit Completion code
gra
Force the unit program m
ed
specified slot to stop. sto
p
Ladder program Input mode
Execution condition UPSTOP
n1 n2 D1 U P S T O P n1 n2 D1
Available Devices
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
3 MR
R DR LR T
B
DM EM
C CTC CR TM FM T
W ZF
C CTH CTC Z CM #/$ #TM * @ :#/:Z
Unit Program
Instructions
n1 ○ − ○ − − − ○ ○ ○ − − − − ○ ○ ○ − ○ ○ ○
n2 ○ − ○ − − − ○ ○ ○ − − − − − ○ ○ − ○ ○ ○
D1 ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
Operand Explanation
n1 Specifies the unit number, or the device in which it is stored. Cannot be specified by "$". (1 to 48)*1
n2 Specifies the device in which the slot number to stop forcefully is stored.*1
D1 Specifies the leading device to store the results in.*2
*1 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. MR002, or R1012) of the channel has been specified, 16 bits are
occupied straddling the next channel.
When a word device has been specified, one word is occupied.
*2 When a bit device has been specified, 32 continuous bits are occupied. Those that are not the
first of the channel cannot be specified.
When a word device has been specified, 2 continuous words are occupied.
Point • The UPSTOP instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UPSTOP instruction can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version" (page 2)
Description of Operation
At the rising edge of the execution condition the unit program being executed in the slot specified by
n2 in the n1 unit is stopped forcefully, and the slot becomes empty.
When the instruction is complete, the execution results are stored in D1 and D1 +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-74)
APPLIED INSTRUCTIONS
D1 —: Execution result storage destination device
Unit Program
Instructions
2: There are no empty slots.
3: Operation enabled is OFF.
4: A unit program error has occurred.
5: The specified slot does not exist.
D1 +1 Completion code 6: The specified slot is in use.
7: The unit program is already being executed.
8: The specified block does not exist.
9: The unit program has already stopped being executed.
10: The specified unit program is not flow.
100: An error has occurred on the unit.
1000: The specified unit does not exist.
1001: The specified unit is illegal.
Operation flag
Sample Program
MR000 is turned ON, and the unit program being executed in the number 0 slot on the KV-XH16ML
connected to unit No. 1 is forcefully stopped.
(Mnemonics list)
MR000 UPSTOP
#1 #0 DM0 LD MR000
KV-XH16ML UPSTOP #1 #0 DM0
pen
Suspend the flow being d
UFSUS UFSUS
Suspend flow executed in the specified flow
APPLIED INSTRUCTIONS
UFRSM
slot. Res
UFRSM UFRSM um
Resume flow Resume a suspended flow. e
flow
3 n1 n2 D1 U F R S M n1 n2 D1
Unit Program
Instructions
Available Devices
Index
Local Modify
Bit Devices Word Devices Const Ind Spec Device
Operand
MR DM EM
R DR LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ :#/:Z
B W ZF
n1 ○ − ○ − − − ○ ○ ○ − − − − ○ ○ ○ − ○ ○ ○
n2 ○ − ○ − − − ○ ○ ○ − − − − − ○ ○ − ○ ○ ○
n3 ○ − ○ − − − ○ ○ ○ − − − − − ○ ○ − ○ ○ ○
D1 ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
Operand Explanation
n1 Specifies the unit number, or the device in which it is stored. Cannot be specified by "$". (1 to 48)*1
n2 Specifies the device in which the slot number to suspend or resume is stored.*1
n3 Specifies the device in which the suspend method is stored.*2
D1 Specifies the leading device to store the results in.*3
*1 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. MR002, or R1012) of the channel has been specified, 16 bits are
occupied straddling the next channel.
When a word device has been specified, one word is occupied.
*2 When a bit device has been specified, 16 continuous bits are occupied. Those that are not the
first of the channel cannot be specified.
When a word device has been specified, one word is occupied.
*3 When a bit device has been specified, 32 continuous bits are occupied. Those that are not the
first of the channel cannot be specified.
When a word device has been specified, 2 continuous words are occupied.
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 KV-7000 Series CPU
units that have CPU function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version" (page 2)
APPLIED INSTRUCTIONS
Description of Operation
UFSUS At the rising edge of the execution condition the flow being executed in the slot specified
by n2 in the n1 unit is suspended, following the method specified in n3 .
When the instruction is complete, the execution results are stored in D1 and
D1 +1.
UFRSM At the rising edge of the execution condition the suspended flow in the slot specified by
n2 in the n1 unit is resumed.
When the instruction is complete, the execution results are stored in D1 and
3
Unit Program
Instructions
D1 +1.
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-74)
Operation flag
3 CR2012
• When the unit with the unit number specified by n1 is not a KV-7000 Series high-
performance expansion unit (X-Unit)
• When a 16-bit device cannot be allocated when a bit device was specified in n1 and
Unit Program
Instructions
n2
• When a bit device other than the timer, counter or the leading one of the channel is specified
in D1
• When the indirect specification or index modification range is inappropriate
Sample Program
MR000 is turned ON, and the flow being executed in the number 0 slot on the KV-XH16ML connected
to 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
#1 #0 DM10
KV-XH16ML
APPLIED INSTRUCTIONS
MEMO
Unit Program
Instructions
cat
Allocate an area of the e
er
can be used freely. me
mor
Ladder program Input mode y
Available Devices
Index
Local Modify
Bit Devices Word Devices Const Ind Spec Device
Operand
3 MR DM EM
R DR LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ :#/:Z
B W ZF
Unit Program
n1
Instructions
○ − ○ − − − ○ ○ ○ − − − − ○ ○ ○ − ○ ○ ○
n2 ○ − ○ − − − ○ ○ ○ − − − − − ○ ○ − ○ ○ ○
D1 ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
D2 ○ − ○ − − − ○ ○ ○ − − − − − ○ − − ○ ○ ○
Operand Explanation
n1 Specifies the unit number, or the device in which it is stored. Cannot be specified by "$". (1 to 48)*1
n2 Specifies the device in which the number of words to allocate is stored.*1
D1 Specifies the device to store the results in.*2
D2 Specifies the device in which the leading address of the allocated area is stored.*2
*1 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. MR002, or R1012) of the channel has been specified, 16 bits are
occupied straddling the next channel.
When a word device has been specified, one word is occupied.
*2 When a bit device has been specified, 16 continuous bits are occupied. Those that are not the
first of the channel cannot be specified.
When a word device has been specified, one word is occupied.
Point • The UMALLOC instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UMALLOC instruction can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version" (page 2)
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 n1 unit is allocated. The leading 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 .
APPLIED INSTRUCTIONS
D1 : Result storage destination device
Point There is a limit to the number of unit program instructions including UMALLOC 3
instructions that can be executed simultaneously.
Unit Program
Instructions
"Number of unit program instructions that can be executed simultaneously" (Page 3-74)
Operation flag
Sample Program
MR000 is turned ON, and 1000 words of the buffer memory of the KV-XH16ML connected to unit No. 1
is allocated.
(Mnemonics list)
MR000 UMALLOC
#1 #1000 DM0 DM1 LD MR000
KV-XH16ML UMALLOC #1 #1000 DM0 DM1
UREAD Read
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano data
UREAD
of the
UREAD(.U) speci
fied
UREAD
UREAD.S UREAD
APPLIED INSTRUCTIONS
UREAD.D buffe
UREAD.L Read Read data of r
UREAD.F buffer the specified mem
ory
@UREAD(.U) memory buffer memory into
@UREAD.S instruction into device.
@UREAD
UREAD devic
@UREAD.D e.
@UREAD.L
@UREAD.F
n1
n1
n2
n2
D n3
D
)
n3
Buffer Memory In-
structions
Operand Explanation
n1 Specify the unit No. or the device saving the unit No.. Cannot be specified by "$". (0 to 48) *1*2
n2 Specify the leading address No. of the buffer memory reading data. (0 to 32767) *1 *7
D Specify the leading device to which the read data is to be stored.*1
n3 Specify the number of data to read. (1 to 32768) *1 *7
*1 When a bit device has been specified, 16 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in 16 bits straddling the next channel. (Only the leading relay of
the channel can be specified when using the KV-7000 Series.)
*2 When value in n1 is equal to 0, specify CPU unit. Instruction is executed only when KV-7500/
5500/5000 is used.
*3 Current value is used when specifying T/C. T/C cannot be used in D when using the
KV-7000 Series.
*4 When the suffix is ".F" , it can not be used.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
*7 For the KV-7000 Series, a leading address No. of the buffer memory between 0 and 59999 can
be specified, and a number of data to read between 1 and 60000 can be specified.
APPLIED INSTRUCTIONS
Description of Operation
Read the data in buffer memory of expansion special unit into the specified device.
For the contents in buffer memory, refer to User's Manual of corresponding units.
UREAD(.U) When execution condition is ON, n3 words of data are read from the buffer
UREAD.S memory of n1 expansion unit starting from n2 , and are stored in the devices
staring from D .
UREAD.D When execution condition is ON, words of data are read from the buffer
3
n3
UREAD.L memory of n1 expansion unit starting from n2 , and are stored in the devices
UREAD.F
staring from D .
Operation flag
Sample Program
It will read out the data of input capture at the start-up of IN000, input capture of fall time of
KV-SIR32XT connected to unit No.1 to DM0 to DM1, DM2 to DM3.
UWRIT(.U)
UWRIT.S
UWRIT
UWRIT
APPLIED INSTRUCTIONS
@UWRIT
UWRIT
@UWRIT.D memory.
@UWRIT.L
@UWRIT.F
n1
T
n2
n1
S
n2
n3 )
S n3
Buffer Memory In-
structions
Operand Explanation
n1 Specify the unit No. or the device which the No. is stored. Cannot be specified by "$". (0 to 48) *1*2
n2 Specify the leading address number of the buffer memory writing data. (0 to 32767) *1 *7
S Specify the writing data or the leading device to which that data is stored.*1
n3 Specify the number of data to be written.(1 to 32768) *1 *7
*1 When a bit device has been specified, 16 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in 16 bits straddling the next channel. (Only the leading relay of
the channel can be specified when using the KV-7000 Series.)
*2 When value in n1 is equal to 0, specify CPU unit. Instruction is executed only when KV-7500/
5500/5000 is used.
*3 Current value is used when specifying T/C.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
*6 T and C cannot be set in S for the KV-7000 Series.
*7 For the KV-7000 Series, a leading address No. of the buffer memory between 0 and 59999 can
be specified, and a number of data to be written between 1 and 60000 can be specified.
Description of Operation
Write the data in buffer memory of expansion special unit into the specified device.
For the contents in buffer memory, refer to User's Manual of corresponding units.
UWRIT(.U) When execution condition is ON, n3 words of data starting from S are written
UWRIT.S into the buffer memory of n1 expansion unit starting from n2 .
UWRIT.D When execution condition is ON, n3 x2 words of data starting from S are
UWRIT.L written into the buffer memory of n1 expansion unit starting from n2 .
UWRIT.F
@UWRIT.□ This instruction is executed for one scan at the rising edge of the execution condition.
3-86 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Buffer Memory Instructions
APPLIED INSTRUCTIONS
Point If a constant is specified in S , write the specified value into to all spaces (same
operation with UFILL instruction).
"UFILL instruction" (Page 3-88)
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)
R30000 UWRIT.D
#1 #258 DM0 #1 LD R30000
UWRIT.D #1 #258 DM0 #1
UFILL(.U)
UFILL.S
UFILL
UFILL
APPLIED INSTRUCTIONS
UFILL.D
UFILL.L Write the specified
Fill in
UFILL.F 16/32-bit data in
buffer
@UFILL(.U) batch to the buffer
memory
@UFILL.S memory.
@UFILL
UFILL
@UFILL.D
@UFILL.L
@UFILL.F
.CFFGTRTQITCO +PRWVOQFG
3
'ZGEWVKQPEQPFKVKQP 7(+..
7 ( + . . P P 5 P
P P 5 P
Buffer Memory In-
structions
'ZGEWVKQPEQPFKVKQP 7(+..
" 7 ( + . . P P 5 P
P P 5 P
Operand Explanation
n1 Specify the unit No. or the device which the No. is stored. Cannot be specified by "$". (0 to 48)*1*2
n2 Specify the leading address No. of the buffer memory writing data. (0 to 32767) *1 *7
S Specify the writing data or the device to which that data is stored. *1
n3 Specify the number of data to be written.(1 to 32768) *1 *7
*1 When a bit device has been specified, 16 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in 16 bits straddling the next channel. (Only the leading relay of
the channel can be specified when using the KV-7000 Series.)
*2 When value in n1 is equal to 0, specify CPU unit. Instruction is executed only when KV-7500/
5500/5000 is used.
*3 Current value is used when specifying T/C.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
*6 T and C cannot be set in S for the KV-7000 Series.
*7 For the KV-7000 Series, a leading address No. of the buffer memory between 0 and 59999 can
be specified, and a number of data to be written between 1 and 60000 can be specified.
APPLIED INSTRUCTIONS
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 execution condition is ON, specified n3 words of 16-bit BIN data are written
UFILL.S into S starting from n2 of the n1 expansion unit.
UFILL.D When execution condition is ON, specified n3 words of 32-bit BIN data are written
UFILL.L into starting from of the expansion unit.
3
S n2 n1
UFILL.F
@UFILL.□ This instruction is executed for one scan at the rising edge of the execution condition.
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.
Available Devices
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
3 R DR LR
B
T C CTC CR TM FM T
W ZF
C CTHCTC Z CM #/$ #TM * @ :#/:Z
n1 - - - - - - - - -
Unit type judgment
instruction
D - - - - - - - - - - -
Operand Explanation
n1 Specify the unit No. or the device which the No. is stored. Cannot be specified by "$". (0 to 48)*1
D Specify the bit device in which to store the result notification. *2
Point • The unit type judgment instruction can be used in KV STUDIO Ver. 9.1 or later only.
• The unit type judgment instruction can be used with KV-7000 Series CPU units
that have CPU function version 2.1 or later only.
"KV-7500/7300 Series CPU Function Version" (page 2)
Description of Operation
The unit type of the n1 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.
APPLIED INSTRUCTIONS
Operation flag
MEMO
3
Unit type judgment
instruction
MOV
MOV(.U)
MOV.S
4 S D M O V S D
Execution condition
Data Move Instructions
MOV
S D @ M O V S D
D - - - - *6 *4 *4 *4*7 *4*7 *5 -
Operand Explanation
S Specifies the move source data or the device to which that data is stored.*1 *3
D Specifies the device to store the data to. *2 *3
*1 When device T, C or CTH are specified, the current value becomes the move source. When
device CTC is specified, the setting value becomes the specified move source.
*2 When device T, C or CTH are specified, the current value becomes the move destination. When
device CTC is specified, the setting value becomes the move destination.
*3 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*4 When the suffix is ".F" or ".DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF".
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The MOV.DF (@MOV.DF) instruction can be used with KV-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 2)
Description of Operation
MOV(.U) When the execution condition is ON, unsigned 16-bit BIN data currently stored in S
is stored to D .
MOV.S When the execution condition is ON, signed 16-bit BIN data currently stored in S is
stored to D .
Example MOV
When the constant is specified to S
#12345 DM100
Data memory status before executing instruction Data memory status after executing instruction
DM99: 0 DM99: 0
DM101: 0 DM101: 0
DM102: 0 DM102: 0
4
16-bit
(1 word)
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, unsigned 32-bit BIN data currently stored to the
device specified by [ S / S +1] is stored to the device specified by [ D /
D +1].
MOV.L When the execution condition is ON, signed 32-bit BIN data currently stored to the
device specified by [ S / S +1] is stored to the device specified by [ D /
D +1].
Data memory status before executing instruction Data memory status after executing instruction
Higher bit Lower bit Higher bit Lower bit
MOV.D
When the device is specified to S
DM12 DM16
Data memory status before executing instruction Data memory status after executing instruction
MOV.F When the execution condition is ON, single precision floating point type real number
specified by S is stored to the device specified by D .
Data memory status before executing instruction Data memory status after executing instruction
DM11: 0 :DM10 S : 1.234 DM11: 0 :DM10
DM13: 0 :DM12 DM13: 0 :DM12
DM15: 0 :DM14 Transfer DM15: +1.234 :DM14 : D
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
DM13: -1.234 :DM12: S DM13: -1.234 :DM12
DM15: 0 :DM14 DM15: 0 :DM14
DM17: 0 :DM16 Transfer DM17: -1.234 :DM16 : D
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 the device specified by D .
Example MOV.DF
When the constant is specified to S +1.23456789 DM18
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 before executing instruction
DM13: 0 :DM10 DM13: 0 :DM10
64-bit (4 words)
Point Operation cannot be performed when indirect specifying in D is used to specify T and
C.
@MOV. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 DM0
Reference When the bit device 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 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Input relay LD CR2002
R003 DM0 MOV R003 DM0
MOV
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 DM0
Reference When the bit device specified by the No.2 operand straddles channels, the data is stored
to the 16 bits straddling the channels.
(Mnemonics list)
CR2002 MOV 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 DM0
DM0 R1005 LD CR2002
R1104
11ch 10ch
→
→ MOV
R1005 MOV DM0 R1005
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Internal auxiliary relay
LDA
LDA(.U)
LDA.S
LDA LDA.D
LDA.L
LDA
LDA.F
LDA.DF
Load A Stores data to internal registers.
@LDA(.U)
@LDA.S
@LDA @LDA.D
@LDA.L
LDA
@LDA.F
@LDA.DF
4 LDA STA L D A S
Execution condition S
Data Move Instructions
LDA STA @ L D A S
Operand Explanation
S Specifies the data to write to internal registers or the device to which that data is currently stored. *1 *2
*1 When T, C, or CTH have been specified to the device, the current value is read. When device
CTC has been specified, the setting value is read.
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bits straddling the next channel.
*3 When the suffix is ".F" or ".DF", it can not be used.
*4 Z cannot be specified if the suffix is ".DF".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The LDA.DF (@LDA.DF) instruction can be used with KV-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 2)
Description of Operation
LDA(.U) When the execution condition is ON, unsigned 16-bit BIN data specified by S is
stored to the 16-bit internal register.
S 16-bit internal register
1234 → 1234
16-bit 16-bit
(1 word) (1 word)
LDA.S When the execution condition is ON, signed 16-bit BIN data specified by S is stored
to the 16-bit internal register.
S 16-bit internal register
-1234 → -1234
16-bit 16-bit
(1 word) (1 word)
LDA.D When the execution condition is ON, unsigned 32-bit BIN data specified by [ S /
S +1] is stored to the 32-bit internal register.
12345678 → 12345678
32-bit
(2 words)
32-bit
(2 words) 4
-12345678 → -12345678
32-bit 32-bit
(2 words) (2 words)
LDA.F When the execution condition is ON, single precision floating point type real number
stored in device specified by S is stored to the 32-bit internal register.
LDA.DF When the execution condition is ON, double precision floating point type real number
stored in device 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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
See the sample program for the STA instruction.
"Sample Program" (Page 4-12)
MEMO
MOA
STA(.U)
STA.S
STA STA.D
STA.L
STA
STA.F
STA.DF Stores data in internal registers
Store A
@STA(.U) to specified device.
@STA.S
@STA @STA.D
@STA.L
STA
@STA.F
@STA.DF
4 LDA STA S T A D
D
Data Move Instructions
Execution condition
LDA STA @ S T A D
Operand Explanation
D Stores data in internal registers to a specified device. *1 *2
*1 When T, C or CTC have been specified to D , they are stored as the setting value.
*2 KV-7500/7300/5500/5000/3000, KV Nano Series When a bit device other than the start of the channel has
been specified to D , data straddling the next channel is not stored.
KV-1000 When a bit device other than the start of the channel has been specified to D , data
straddling the next channel is not stored.
*3 When the suffix is ".F" or ".DF", it can not be used.
*4 Z cannot be specified if the suffix is ".DF".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The STA.DF (@STA.DF) instruction can be used with KV-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 2)
Description of Operation
STA(.U) When the execution condition is ON, unsigned 16-bit BIN data currently stored to the 16-
bit internal register is stored to the device specified by D .
STA.S When the execution condition is ON, signed 16-bit BIN data currently stored to the 16-bit
internal register is stored to the device specified by D .
STA.D When the execution condition is ON, unsigned 32-bit BIN data currently stored to the 32-
bit internal register is stored to the device specified by [ D / D +1].
32-bit internal register D +1 D
12345678 → 12345678
32-bit
(2 words)
32-bit
(2 words) 4
STA.L When the execution condition is ON, signed 32-bit BIN data currently stored to the 32-bit
STA.F When the execution condition is ON, single precision floating point type real number
currently stored to the internal register is stored to the device specified by [ D /
D +1].
STA.DF When the execution condition is ON, double precision floating point type real number
currently stored to the internal register is stored to the device specified by [ D /
D +1/ D +2/ D +3].
@STA. Only one scan is executed at the rising edge of the execution conditions.
Point This program will not function correctly when T or C is specified to D by indirect
specification.
Operation flags
Sample Program
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
111 0 1 0 1 0 1 0 1 0 1 0 1 0 DM0
R515
STA R500
Reference When the bit device specified by the LDA operand straddles channels, the states of the
16 bits straddling channels are stored to the internal register.
1ch 0ch
→ (Mnemonics list)
R102 → R003
CR2002 R003 DM0 111 0 1 0 1 0 1 0 1 0 1 0 1 0 Input relay LD CR2002
LDA STA LDA R003
LDA
CON
111 0 1 0 1 0 1 0 1 0 1 0 1 0
16-bit internal register
STA DM0
STA
111 0 1 0 1 0 1 0 1 0 1 0 1 0 DM0
Reference KV-1000 When the bit device specified by the STA operand straddles channels, the data is
not stored to bits straddling channels.
(Mnemonics list)
4
CR2002 DM0 R503 111 0 1 0 1 0 1 0 1 0 1 0 1 0 DM0
? ? ? 0 1 0 1 0 1 0 1 0 1 0 1 0 Output relay
PLDA PLDA(.U)
PLDA.D
PLDA
Partial load
Only the specified bit
counts of the data are
@PLDA @PLDA(.U)
@PLDA.D
PLDA
stored in internal register.
Execution condition S
PLDA STA @ P L D A S n
n
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *3 *4 *4 -
n - - - - *3 *4 *4 -
Operand Explanation
S Specifies the data to write to internal registers or the device to which that data is currently stored. *1 *2
n S is used to specify the bit counting to be loaded in the specified device portion (U:0-16, D:0-32).
*1 When T, C, or CTH have been specified to the device, the current value is read. The setting
value is read when CTC is specifed in device.
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
PLDA(.U) When the device specified with S is a bit device
When the execution condition is ON, the n bits in S are stored in the 16-bit
internal register. For the unspecified high bits side, 0 is stored.
0 0 0 1111 0 1 0 1 0 1 0 1 0 0000000101010101
0 0 0 0 1111 0 1 0 1 0 1 0 1 0000000101010101
n
4-14 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions
0 0 0 1111 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 00000001010101010101010101010101
0 0 0 111 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 00000001010101010101010101010101
@PLDA. Only one scan is executed at the rising edge of the execution conditions.
Operation flags
* KV-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-71)
Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 DM0
PLDA STA LD CR2002
#8 PLDA R000 #8
Constant ON CON
STA DM0
PLDA
PSTA PSTA(.U)
PSTA.D
PSTA
Partial store
Store the counting of
specified bits in internal
@PSTA @PSTA(.U)
@PSTA.D
PSTA
register into the device.
Ladder program
Input mode
Execution condition D
LDA PSTA P S T A D n
n
Execution condition D
LDA PSTA @ P S T A D n
n
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
D - - - - *3 - *4 - -
n - - - - *3
*4 *4 -
Operand Explanation
D Specifies the data to write to internal registers or the device to which that data is currently stored. *1 *2
n D is used to specify the bit counting to be loaded in the specified device portion (U:0-16 D:0-32)
*1 When T, C or CTC have been specified in device, they are stored as the setting value.
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
PSTA(.U) When the device specified with D is a bit device
When the execution condition is ON, the bit counting of n low bits in unsigned 16-
bit BIN data stored in internal register is specified for D , with the leading device
being the lowest bit.
00000001010101010101010101010101 0 0 0 1111 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
@PSTA. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
* KV-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-71)
Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 DM0
LDA PSTA LD CR2002
#8 LDA R000
Always ON CON
PSTA DM0 #8
TMIN TMIN
Trimmer
Inputs numerical values set by the
digital trimmer in the access
@TMIN TMIN window to an internal register.
Execution condition n
TMIN STA.D @ T M I N n
4
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
Data Move Instructions
Operand Explanation
n Specifies the digital trimmer No. (0 to 7).*1
*1 When a device has been specified to n , the values of the lower 3 bits are used.
*2 "$" cannot be used.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
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 KV-7000 Series User's Manual "5-2 Access Window", KV-5500/5000/3000
User's Manual 2-1ACCESS WINDOW "Digital Trimmer" or KV-1000 User's Manual
"Chapter 2 ACCESS WINDOW."
4
3 CM1707 CM1706
4 CM1709 CM1708
5 CM1711 CM1710
@TMIN Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
DW
DW(.U)
DW.S
DW DW.D
DW.L
DW
DW.F
DW.DF Write data
Stores constants directly to data memory.
@DW(.U) memory
@DW.S
@DW @DW.D
@DW.L
DW
@DW.F
@DW.DF
Execution condition S
4 DW
D
D W S D
S
Data Move Instructions
Execution condition
DW @ D W S D
D
Operand Explanation
S Specifies the constant to store.*1
D Specifies the device to store the constant to. *2 * 3 *4
*1 The range of numerical values that can be handled differs according to the instruction suffix.
*2 When a bit device has been specified to D , continuous 16 bits (.U/.S), 32 bits (.D/.L/.F), or
64 bits (.DF) are occupied. When a relay other than the start relay (e.g. MR002, R1012) of the
channel has been specified, the relay is handled in16/32/64 bits straddling the next channel.
When a word device has been specified to D , one word (.U/.S), two words (.D/.L/.F) or four
words (.DF) are occupied.
*3 When devices T, C and CTH have been specified, the device is written to the current value.
When device CTC has been specified, this device is written to the setting value.
*4 When the suffix is “.F" or “.DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF"
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The DW.DF (@DW.DF) instruction can be used with KV-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 2)
Description of Operation
DW(.U) When the execution condition is ON, unsigned 16-bit BIN data specified by S is
stored to the device specified by D .
S D
1234 1234
16-bit
(1 word)
DW.S When the execution condition is ON, signed 16-bit BIN data specified by S is stored
to the device specified by D .
S D 4
-1234 -1234
DW.D When the execution condition is ON, unsigned 32-bit BIN data specified by S is
stored to the device specified by [ D • D +1].
S D +1 D
12345678 12345678
32-bit
(2 words)
DW.L When the execution condition is ON, signed 32-bit BIN data specified by S is stored
to the (word) device specified by [ 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 the device specified by [ 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 the device specified by [ D / D +1/ D +2/
D +3].
S D +3 D +2 D +1 D
+1.23456789 +1.23456789
64-bit (4 words)
@DW. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When input relay R000 turns ON, #100 is stored to data memory DM0.
MEMO
DW
4
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
Data Move Instructions
Operand Explanation
S Specifies the leading device of the move source data block.*1 *3
D Specifies the leading device of the move destination data block.*2 *3
n Specifies the number of data items to move. (1 to 65535: unsigned 16-bit BIN)*4
*1 When device T, C is specified, the current value becomes the move source.
*2 When device T, C is specified, the current value becomes the move destination.
*3 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*4 n is handled as unsigned 16-bit BIN at all times regardless of the instruction suffix.
When T, C, CTC or CTH has been specified, only the lower 16 bits are used.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
BMOV(.U) When the execution condition is ON, the content of n words starting from the
device specified by S is moved in a block to n words starting from the device
specified by 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
BMOV.D When the execution condition is ON, the content of n x 2 words starting from the
device specified by [ S / S +1 is moved in a block to n x 2 words starting
from the device specified by [ D / D +1].
[ 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]
@BMOV. Only one scan is executed at the rising edge of the execution conditions.
Point • Data blocks at the move source and move destination will be moved successfully even
if 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
DW
FMOV(.U)
FMOV.S
4 S D n F M O V S D n
FMOV
Data Move Instructions
Execution condition
S D n @ F M O V S D n
Operand Explanation
S Specifies the move source data or the device to which that data is stored.*1 *2
D Specifies the leading device of the move destination data block.*1 *2
n Specifies the number of data items to move. (0 to 65535: unsigned 16-bit BIN)*3
*1 When device T, C, CTH are specified, each of their current values becomes the specified move
source. When device CTC is specified, the setting value becomes the specified move source.
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the start relay (e.g.MR002, R1012) of the channel has been specified,
the relay is handled in16/32/64 bits straddling the next channel.
*3 n is handled as unsigned 16-bit BIN at all times regardless of the instruction suffix.
When T, C, CTC or CTH has been specified, only the lower 16 bits are used.
*4 When the suffix is “.F" or “.DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF"
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The FMOV.DF (@FMOV.DF) instruction can be used with KV-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 2)
Description of Operation
FMOV(.U) When the execution condition is ON, unsigned 16-bit BIN data currently stored to the
device specified by S is moved to n words starting from the device specified
by D .
4-26 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions
FMOV.S When the execution condition is ON, signed 16-bit BIN data currently stored to the
device specified by S is moved to n words starting from the device specified
by D .
D
D +1
D +2
...
S
D + n -3
D + n -2
D + n -1
FMOV.D When the execution condition is ON, unsigned 32-bit BIN data currently stored to the
device specified by [ S / S +1] is moved to n x 2 words starting from the
device specified by [ D / D +1].
FMOV.L When the execution condition is ON, unsigned 32-bit BIN data currently stored to the
device specified by [ S / S +1] is moved to n x 2 words starting from the
device specified by [ 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 to the device specified by S is moved to n x 2 words starting from the
device specified by D .
Example FMOV.F
S : DM100
DM100 DM200 #5
D : DM200
n : For #5
D +1 D
DM201: +1.234 :DM200
4 32-bit
(2 words)
DM207: +1.234 :DM206
32-bit
(2 words)
FMOV.DF When the execution condition is ON, double precision floating point type real number
stored to the device specified by S is moved to n x 4 words starting from the
device specified by D .
@FMOV. Only one scan is executed at the rising edge of the execution conditions.
Point Specifying an excessively large value for n will considerably lengthen the scan time.
Operation flag
Sample Program
When input relay R000 turns ON, "0" is stored to DM0 to DM99.
(Mnemonics list)
R000 FMOV
#0 DM0 #100 LD R000
FMOV #0 DM0 #100
KV-1000 KV Nano
continuous bit
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
information in
device to
DW specified bit
position
PMOV
PMOV PMOV(.U)
PMOV.D
Partial
Moves any continuous bit
information in a device to a
PMOV move specified bit position in a
@PMOV @PMOV(.U)
@PMOV.D
specified device.
4
S n1 D @ P M O V S n1 D
n2 n3 n2 n3
Data Move Instructions
Operand Explanation
S Specifies the device of the move source.*1 *2
Specifies the device or constant for specifying the bit position of the move source.*5
When the suffix is .U, specifies 0 to 15 as the value of n1 , and specifies 0 to 31 as the value of
n1 when the suffix is .D.
In the case of numerical values
.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 when "31".
In the case of devices*4
The following values are used when the value of n1 exceeds 0 to 15 or 0 to 31.
.When suffix is .U: The values of the lower 4 bits of the specified device are used.
.When suffix is .D: The values of the lower 5 bits of the specified device are used.
D Specifies the device of the move destination.*1 *2
Specifies the device or constant for specifying the bit position of the move destination.*5
When the suffix is .U, specifies 0 to 15 as the value of n2 , and specifies 0 to 31 as the value of
n2 when the suffix is .D.
In the case of numerical values
.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 when "31".
In the case of devices*4
The following values are used when the value of n2 exceeds 0 to 15 or 0 to 31.
.When suffix is .U: The values of the lower 4 bits of the specified device are used.
.When suffix is .D: The values of the lower 5 bits of the specified device are used.
Specifies the device or constant for specifying the bit position of the move destination.*3 *5
n3 .When suffix is .U: A number within the range 1 to 16 can be specified.
.When suffix is .D: A number within the range 1 to 32 can be specified.
*1 When a bit device has been specified, continuous 16 bits (.U suffix instructions)/32 bits (.D suffix
instructions) are occupied.
When a word device has been specified, one word (.U suffix instructions)/continuous two words (.D
suffix instructions) are occupied.
*2 S and D may be the same device.
*3 When a device has been specified to n3 , the instruction will not be executed when the value
of n3 is "0".
*4 When, for example, the suffix is .U, DM01000 has been specified to n1 ( n2 ), and that value is
20 (BIN: 0000 0000 0001 0100), "4" is used as the value of n1 ( n2 ) as the value of the lower 4
bits is "4" (0100).
*5 When a bit device has been specified to n1 to n3 , 16 continuous bits are occupied. 4
When a word device has been specified, one word is occupied.
Description of Operation
PMOV(.U) When the execution condition is ON, n3 bits from the n1 th bit of the device
specified by S are moved to [ n2 + n3 -1] th bit from the n2 th bit of the
device specified by D . Original values are saved for bits of sections where bits are
not moved to.
n3
bit bit
15 0
n1
bit bit
15 0
n2
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 the device
specified by [ S / S +1] are moved to ( n2 + n3 -1) th bit from the n2 th
bit of the device specified by [ 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
4
31 16 15 0
[ D / D +1]
Data Move Instructions
n2
Execution
Example condition PMOV.D
DM100 #4 DM200
#2 #8
@PMOV. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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)
R000 PMOV
DM100 #4 DM200 LD R000
PMOV DM100 #4 DM200 #2 #8
#2 #8
4
n2 n3 n2 n3
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *5 - - - - - - -
n1 - - - - *5 *6 *6 -
D - - - - *5 - - - - - - -
n2 - - - - *5 *6 *6
-
n3 - - - - *5 *6 *6 -
Operand Explanation
S Specifies the leading device of the move source byte sequence.*1 *2
Specifies a device which indicates the move source byte position (leading with low-order byte of
n1
S ), or specifies a constant. *4 Specifiable range is 0 to 65535.
D Specifies the leading device of the move destination (byte sequence storage destination). *1 *2
Specifies a device which indicates the move destination byte position (leading with low-order byte of
n2
D ), or specifies a constant. *4 Specifiable range is 0 to 65535.
Specifies a device which indicates the number of bytes to move, or specifies a constant. *3 *4
n3
Specifiable range is 1 to 65535.
*1 When specifying a bit device, specify the head of the channel. If a bit device other than the head
is specified, CR2012 will turn ON, and the instruction will not be executed.
*2 S and D may be the same device.
*3 When a device is specified for n3 , if the n3 value is 0, CR2012 will turn ON and the
instruction will not be executed.
*4 When a bit device has been specified to n1 to n3 , 16 continuous bits are occupied.
When a word device has been specified, one word is occupied.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Description of Operation
BYLMOV When the execution conditions turn ON, the data from the n1 byte to the n3 byte of
the device (counting from the low-order byte) specified with S is moved to the n2
byte to the [ n2 + n3 -1) byte of the device (counting from the low-order byte)
specified with D . The original values are saved in the bytes where data is not moved.
4-34 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions
@BYLMOV Only one scan is executed at the rising edge of the execution conditions.
4
S +4 F(46H) G(47H)
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 of
DM100 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
4
n2 n3 n2 n3
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *5
- - - - - - -
n1 - - - - *5 *6 *6 -
D - - - - *5 - - - - - - -
n2 - - - - *5 *6 *6 -
n3 - - - - *5 *6 *6 -
Operand Explanation
S Specifies the leading device of the move source byte sequence.*1 *2
Specifies a device which indicates the move source byte position (leading with high-order byte of
n1
S ), or specifies a constant. *4 Specifiable range is 0 to 65535.
D Specifies the leading device of the move destination (byte sequence storage destination). *1 *2
Specifies a device which indicates the move destination byte position (leading with high-order byte of
n2
D ), or specifies a constant. *4 Specifiable range is 0 to 65535.
Specifies a device which indicates the number of bytes to move, or specifies a constant. *3 *4
n3
Specifiable range is 1 to 65535.
*1 When specifying a bit device, specify the head of the channel. If a bit device other than the head
is specified, CR2012 will turn ON, and the instruction will not be executed.
*2 S and D may be the same device.
*3 When a device is specified for n3 , if the n3 value is 0, CR2012 will turn ON and the
instruction will not be executed.
*4 When a bit device has been specified to n1 to n3 , 16 continuous bits are occupied.
When a word device has been specified, one word is occupied.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Description of Operation
BYBMOV When the execution conditions turn ON, the data from the n1 byte to the n3 byte of
the device (counting from the high-order byte) specified with S is moved to the n2
byte to the n2 + n3 -1) byte of the device (counting from the high-order byte)
specified with D . The original values are saved in the bytes where data is not moved.
4-36 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions
@BYBMOV Only one scan is executed at the rising edge of the execution conditions.
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 of
DM100 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
KV-1000 KV Nano
operation of 16/
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
32-bit BIN
ADD
ADD(.U)
ADD.S
ADD ADD.D
ADD.L
ADD
Adds the value specified by the
ADD.F
operand to the value of the
ADD.DF
Add internal register, and stores the
@ADD(.U) result again to the internal
@ADD.S
register.
@ADD @ADD.D
@ADD.L
ADD
@ADD.F
@ADD.DF
4 Execution condition
LDA
S
ADD STA A D D S ( + S )
*
Instructions
Arithmetic/Comparison
Execution condition S
LDA ADD STA @ A D D S ( @ + S )*
*For KV-1000 CPU unit, description can be omitted.
Operand Explanation
S Specifies the addition operation data or the device to which the data is currently stored. *1 *2
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32/64 bits straddling the next channel.
*3 When the suffix is ".F" or ".DF", it can not be used.
*4 Z cannot be specified if the suffix is ".DF".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The ADD.DF (@ADD.DF) instruction can be used with KV-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 2)
Description of Operation
ADD(.U) When the execution condition is ON, unsigned 16-bit 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.S When the execution condition is ON, signed 16-bit BIN data specified by S and the
signed data of the 16-bit internal register are added, and the result is stored to 16-bit
internal register again.
16-bit internal register S 16-bit internal register
ADD.D When the execution condition is ON, unsigned 32-bit BIN data specified by [ S /
S +1] and the unsigned data of the 32-bit internal register are added, and the result
is stored to 32-bit internal register again.
4
Instructions
Arithmetic/Comparison
32-bit internal register S +1 S 32-bit internal register
ADD.L When the execution condition is ON, signed 32-bit 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.
32-bit internal register S +1 S 32-bit internal register
ADD.F When the execution condition is ON, operate the single precision floating point type real
number specified by [ S / S +1] and the single precision floating point type real
number stored in the 32-bit internal register, and the result is stored in the 32-bit internal
register.
ADD.DF When the execution condition is ON, operate the double precision floating point type real
number specified by [ S / S +1/ S +2/ S +3] and the single precision
floating point type real number stored in the 64-bit internal register, and the result is
stored in the 64-bit internal register.
@ADD. Only one scan is executed at the rising edge of the execution conditions.
Point • The ADD and @ADD instructions perform addition in BIN. When values stored to
internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
Arithmetic/Comparison Instructions
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. 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.
Otherwise, OFF.
- Status does not change when not using an indirect specification or index modification for
4 the operand.
• For suffix "F”
CR2012 - ON when the indirect specification or index modification range is inappropriate or the
Instructions
Arithmetic/Comparison
operation data is not within the single precision floating point type real number range.
Otherwise, OFF.
• For suffix "DF”
- ON when the indirect specification or index modification range is inappropriate or the
operation data is not within the double precision floating point type real number range.
Otherwise, OFF.
Sample Program
Each time that input relay R000 turns ON, the constant 100 is added to DM0, and the result is stored to
DM100.
(Mnemonics list)
R000 DM0 #100 DM100
LDA ADD STA LDP R000
LDA DM0
CON
ADD #100
CON
STA DM100
Each time that input relay R001 turns ON, the constant -100 is added to DM100, and the result is
stored to DM110.
(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 that 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
4-40 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions
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
Instructions
Arithmetic/Comparison
ADD
SUB(.U)
SUB.S
SUB SUB.D
SUB.L
SUB
Subtracts the value specified by
SUB.F
the operand to the value of the
SUB.DF
Subtract internal register, and stores the
@SUB(.U) result again to the internal
@SUB.S register.
@SUB @SUB.D
@SUB.L
SUB
@SUB.F
@SUB.DF
4 Execution condition
LDA
S
SUB STA S U B S ( - S )
*
Instructions
Arithmetic/Comparison
Execution condition S
LDA SUB STA @ S U B S ( @ - S )*
*For KV-1000 CPU unit, description can be omitted.
Operand Explanation
S Specifies the subtraction data or the device to which the data is currently stored.*1 *2
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32/64 bits straddling the next channel.
*3 When the suffix is ".F" or ".DF", it can not be used.
*4 Z cannot be specified if the suffix is ".DF".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The SUB.DF (@SUB.DF) instruction can be used with KV-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 2)
Description of Operation
SUB(.U) When the execution condition is ON, unsigned 16-bit 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.S When the execution condition is ON, unsigned 16-bit BIN data specified by S is
subtracted from the signed 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, unsigned 32-bit BIN data specified by [ S /
S +1] is subtracted from the unsigned data of the 32-bit internal register, and the
result is stored to 32-bit internal register again.
4
Instructions
Arithmetic/Comparison
32-bit internal register S +1 S 32-bit internal register
SUB.L When the execution condition is ON, signed 32-bit 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.
32-bit internal register S +1 S 32-bit internal register
SUB.F When the execution condition is ON, operate the single precision floating point type real
number specified by [ S / S +1] and the single precision floating point type real
number stored in the 32-bit internal register, and the result is stored in the 32-bit internal
register.
SUB.DF When the execution condition is ON, operate 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 stored in the 64-bit internal register, and the result is
stored in the 64-bit internal register.
@SUB. Only one scan is executed at the rising edge of the execution conditions.
Point • The SUB and @SUB instructions perform addition in BIN. When values stored to
internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
Arithmetic/Comparison Instructions
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. Otherwise,
OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 ON when the operation result is larger than "0". Otherwise, OFF.
• For suffix "U/S/D/L”
- ON when the indirect specification or index modification range is inappropriate.
Otherwise, OFF.
- Status does not change when not using an indirect specification or index modification for
4 the operand.
• For suffix "F”
CR2012 - ON when the indirect specification or index modification range is inappropriate or the
Instructions
Arithmetic/Comparison
operation data is not within the single precision floating point type real number range.
Otherwise, OFF.
• For suffix "DF”
- ON when the indirect specification or index modification range is inappropriate or the
operation data is not within the double precision floating point type real number range.
Otherwise, OFF.
Sample Program
Each time that input relay R000 turns ON, 100 is subtracted from DM0, and the result is stored to
DM10.
(Mnemonics list)
R000 DM0 #100 DM10
LDA SUB STA LDP R000
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 to
DM110.
(Mnemonics list)
R001 DM100 -100 DM110
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
4-44 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions
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
Instructions
Arithmetic/Comparison
ADD
MUL(.U)
MUL.S
MUL MUL.D
MUL.L
MUL
Multiplies the value specified by
MUL.F
the operand to the value of the
MUL.DF
Multiply internal register, and stores the
@MUL(.U) result again to the internal
@MUL.S register.
@MUL @MUL.D
@MUL.L
MUL
@MUL.F
@MUL.DF
4 Execution condition
LDA
S
MUL STA M U L S ( * S )
*
Instructions
Arithmetic/Comparison
Execution condition S
LDA MUL STA @ M U L S ( @ * S )*
*For KV-1000 CPU unit, description can be omitted.
Operand Explanation
S Specifies the multiplication data or the device to which the data is currently stored. *1 *2
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32/64 bits straddling the next channel.
*3 When the suffix is ".F" or ".DF", it can not be used.
*4 Z cannot be specified if the suffix is ".DF".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The MUL.DF (@MUL.DF) instruction can be used with KV-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 2)
Description of Operation
MUL(.U) When the execution condition is ON, unsigned 16-bit BIN data specified by S and the
unsigned data of the 16-bit internal register are multiplied, and the result is stored to 16-bit
internal register again.
The operation result is also divided into TM000 (upper 16 bits) and 16-bit internal register
(lower 16 bits), and stored.
32-bit internal register
16-bit internal register S 56088
123 × 456 = TM0 16-bit internal register
MUL.S When the execution condition is ON, signed 16-bit BIN data specified by S and the
signed data of the 16-bit internal register are multiplied, and the result is stored to 16-bit
internal register again. The operation result is also divided into TM000 (upper 16 bits) and
16-bit internal register (lower 16 bits), and stored.
32-bit internal register
16-bit internal register S -15129
-123 × 123 = TM0 16-bit internal register
MUL.D When the execution condition is ON, unsigned 32-bit BIN data specified by [ S /
4
Instructions
Arithmetic/Comparison
S +1] and the unsigned data of the 32-bit internal register are multiplied, and the
result is stored divided into TM0, TM1 (upper 32 bits) and 32-bit internal register (lower
32-bits).
MUL.L When the execution condition is ON, signed 32-bit BIN data specified by [ S /
S +1] and the signed data of the 32-bit internal register are multiplied, and the result
is stored divided into TM0, TM1 (upper 32 bits) and 32-bit internal register (lower 32-
bits).
MUL.F When the execution condition is ON, operate the single precision floating point type real
number specified by [ S / S +1] and the single precision floating point type real
number stored in the 32-bit internal register, and the result is stored in the 32-bit internal
register.
MUL.DF When the execution condition is ON, operate 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 stored in the 32-bit internal register, and the result is
stored in the 32-bit internal register.
@MUL. Only one scan is executed at the rising edge of the execution conditions.
Arithmetic/Comparison Instructions
Point • The MUL and @MUL instructions perform addition in BIN. When values stored to
internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
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. Otherwise,
OFF.
4 CR2010
CR2011
ON when the operation result is "0". Otherwise, OFF.
No change in state
• For suffix "U/S/D/L”
Instructions
Arithmetic/Comparison
Sample Program
MUL.U
When input relay R000 is ON, the unsigned 16-bit BIN data currently stored to DM0 is multiplied with
the unsigned 16-bit BIN data currently stored to DM1, and 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.
R000
LDA
DM0
MUL
#100
STA
DM10
LD R000
LDA DM0 4
CON
LDA MUL STA
MUL DM1
Instructions
Arithmetic/Comparison
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
Arithmetic/Comparison Instructions
MUL.S
When input relay R000 is ON, the signed 16-bit BIN data currently stored to DM0 is multiplied with the
signed 16-bit BIN data currently stored to DM1, and 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.
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
Instructions
Arithmetic/Comparison
ADD
DIV(.U)
DIV.S
DIV DIV.D
DIV.L
DIV
@DIV @DIV.D
@DIV.L
DIV
@DIV.F
@DIV.DF
4 Execution condition
LDA
S
DIV STA D I V S ( / S )*
Instructions
Arithmetic/Comparison
Execution condition S
LDA DIV STA @ D I V S ( @ / S )*
Operand Explanation
S Specifies the division operation data or the device to which the data is currently stored. *1 *2
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32/64 bits straddling the next channel.
*3 When the suffix is ".F" or ".DF", it can not be used.
*4 Z cannot be specified if the suffix is ".DF".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The DIV.DF (@DIV.DF) instruction can be used with KV-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 2)
Description of Operation
DIV(.U) When the execution condition is ON, the unsigned 32-bit BIN data stored to TM0 and the
16-bit internal register are divided by the unsigned 16-bit 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 into TM000 (upper 16 bits) and 16-bit internal
register (lower 16 bits), and stored.
32-bit internal register
DIV.S When the execution condition is ON, the signed 32-bit BIN data stored to TM0 and the 16-
bit internal register are divided by the signed 16-bit 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 into TM000 (upper 16 bits) and 16-bit
internal register (lower 16 bits), and stored.
32-bit internal register
DIV.D When the execution condition is ON, the unsigned 64-bit BIN data stored to TM0, TM1 and
4
Instructions
Arithmetic/Comparison
the 32-bit internal register are divided by the unsigned 32-bit BIN data specified by
[ S / S +1], and the operation result (quotient) is stored to 64-bit unsigned BIN data
(TM000, TM001 and 32-bit internal register), and the remained is stored to TM2 and TM3.
TM1 TM0 32-bit internal register S +1 S TM1 TM0 32-bit internal register
12345678 ÷ 100 = 123456
64-bit 32-bit 64-bit
(2 word) TM3 TM2
Remainder: 78
32-bit
(2 words)
DIV.L When the execution condition is ON, the signed 64-bit BIN data stored to TM0, TM1 and
the 32-bit internal register are divided by the signed 32-bit BIN data specified by
[ S / S +1], and the operation result (quotient) is stored to 64-bit signed BIN data
(TM0, TM1 and 32-bit internal register), and the remained is stored to TM2 and TM3.
TM1 TM0 32-bit internal register S +1 S TM1 TM0 32-bit internal register
-12345678 ÷ 100 = -123456
64-bit 32-bit 64-bit
(2 words) TM3 TM2
Remainder: -78
32-bit
(2 words)
DIV.F When the execution condition is ON, the mantissa of the single precision floating point
type real number currently stored to the device specified by [ S / S +1] and the
single precision floating point type real number stored in the 32-bit internal register, and
the result is stored in the 32-bit internal register.
DIV.DF When the execution condition is ON, the mantissa of the double precision floating point
type real number currently stored to the device specified by [ S / S +1/ S +2/
S +3] and the double precision floating point type real number stored in the 64-bit
internal register, and the result is stored in the 64-bit internal register.
@DIV. Only one scan is executed at the rising edge of the execution conditions.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-53
ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions
Point • The DIV and @DIV instructions perform addition in BIN. When values stored to internal
register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
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. Otherwise,
OFF.
4 CR2010
CR2011
ON when the operation result is "0". Otherwise, OFF.
No change in state
• For suffix "U/S/D/L”
Instructions
Arithmetic/Comparison
Sample Program
When input relay R000 is ON, #10000 is divided by the unsigned 16-bit BIN data currently stored to
DM0. The result is stored to DM10, and the remainder is stored to DM20.
(Mnemonics list)
R000 #10000 DM0 DM10
LDA EXT DIV STA LD R000
MPS
TM1 DM20
LDA STA LDA #10000
CON
EXT
CON
DIV DM0
CON
STA DM10
MPP
LDA TM1
CON
STA DM20
When input relay R001 is ON, the signed 32-bit BIN data currently stored to DM100/DM101 is divided
by the signed 16-bit BIN data currently stored to 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 4
LDA.S TM1
CON
Instructions
Arithmetic/Comparison
STA.S DM20
Example 16-bit BIN data currently stored to DM0 is divided by the 16-bit BIN data currently stored to
DM1. 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
Arithmetic/Comparison Instructions
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].
(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
The MUL.U and MUL.S instructions perform multiplication by 16-bit data, and the result is calculated
by 32-bit data. The DIV.U and DIV.S instructions divide 32-bit data by 16-bit data.
For this reason, when performing multiplication and division operations continuously, operations are
executed successfully even if the product exceeds the 16-bit range during calculations.
Example The unsigned 16-bit BIN data stored to DM0 that changes from 0 to 4000 is scaled to 0
to 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
Instructions
Arithmetic/Comparison
ADD
INC(.U)
INC INC.S
INC.D
INC
@INC @INC.S
@INC.D
INC
@INC.L
Execution condition D
4
INC @ I N C D ( @ + + D )
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
D - - - - *3 - - - -
Operand Explanation
D Specifies the device to increment by 1. *1 *2
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
Description of Operation
INC(.U) When the execution is ON, the unsigned 16-bit BIN data of the device specified by
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 is ON, the signed 16-bit BIN data of the device specified by 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 is ON, the unsigned 32-bit BIN data of the device specified by
[ 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 is ON, the signed 32-bit BIN data of the device specified by [ 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. Only one scan is executed at the rising edge of the execution conditions.
Point • The INC and @INC instructions perform addition in BIN. When values stored to internal
register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction" (Page 4-158)
• 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 the INC instruction is executed not at each
scan but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
16-bit data 4
DM0
Instructions
Arithmetic/Comparison
INC
DM0
INC
R1000 R1000 DM0
DIFU INC
32-bit data
DM0
INC.D
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 and index modify range is inappropriate. Otherwise, OFF.
CR2012
Does not change when indirect specification or index modify is not specified to the operand.
Arithmetic/Comparison Instructions
Sample Program
The total of input relays R000 to R003 is counted, and the result is stored to DM0.
(Mnemonics list)
R000 DM0
INC LDP R000
INC DM0
LDP R001
R001 DM0
INC DM0
INC LDP R002
INC DM0
R002 DM0 LDP R003
INC INC DM0
4 R003 DM0
INC
Instructions
Arithmetic/Comparison
MEMO
Instructions
Arithmetic/Comparison
ADD
DEC(.U)
DEC DEC.S
DEC.D
DEC
@DEC @DEC.S
@DEC.D
DEC
@DEC.L
Execution condition D
4
DEC @ D E C D ( @ - - D )
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
D - - - - *3 - - - -
Operand Explanation
D Specifies the device to decrement by 1.*1 *2
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
Description of Operation
DEC(.U) When the execution condition is ON, the unsigned 16-bit BIN data of the device
specified by D is decremented by 1, and the result is stored to D .
An underflow occurs if the operation result is less than 0.
(When the count before the operation is 0, the count becomes 65535, and an underflow occurs.)
DEC.S When the execution condition is ON, the signed 16-bit BIN data of the device specified
by D is decremented by 1, and the result is stored to D .
If operation result is less than -32768, underflow will occur.
(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 unsigned 32-bit BIN data of the device
specified by [ D / D +1] is decremented by 1, and the result is stored to [ D /
D +1].
An underflow occurs if the operation result is less than 0.
(When the count before the operation is 0, the count becomes 4294967295, and an
underflow occurs.)
DEC.L When the execution condition is ON, the signed 32-bit BIN data of the device specified
by [ D / D +1] is decremented by 1, and the result is stored to [ D / D +1].
If operation result is less than -2147483648, underflow will occur.
(When the count before the operation is -2147483648, the count becomes
+2147483647, and an underflow occurs.)
@DEC. Only one scan is executed at the rising edge of the execution conditions.
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-158)
• Operation can be enabled correctly even if overflow occurs.
Reference When the DEC instruction is executed at every scan, the bits are decremented at each
scan when the execution condition is ON. If the INC instruction is executed not at each
scan but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
16-bit data 4
DM0
Instructions
Arithmetic/Comparison
DEC
DM0
DEC
R1000 R1000 DM0
DIFU DEC
32-bit data
DM0
DEC.D
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 and index modify range is inappropriate. Otherwise, OFF.
CR2012
Does not change when indirect specification or index modify is not specified to the operand.
Sample Program
The value of DM0 is decremented by 1 at each respective rising edge of input relays R000, R001 and
R002.
(Mnemonics list)
R000 DM0
DEC LDP R000
DEC DM0
LDP R001
R001 DM0 DEC DM0
DEC LDP R002
DEC DM0
R002 DM0
DEC
ADD
ROOT(.U)
ROOT.S
ROOT ROOT.D
ROOT.L
ROOT
@ROOT @ROOT.D
@ROOT.L
ROOT
@ROOT.F
@ROOT.DF
Execution condition
Instructions
Arithmetic/Comparison
Point The ROOT.DF (@ROOT.DF) instruction can be used with KV-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 2)
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.
Higher 32 bits Lower 32 bits Higher bit Lower bit
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.
The operation result is stored to the 32-bit internal register as a single precision floating
point type real number.
Instructions
Arithmetic/Comparison
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.
@ROOT. Only one scan is executed at the rising edge of the execution conditions.
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-158)
Operation flag
Sample Program
When input relay R000 is ON, the square root of the unsigned 16-bit BIN data currently stored to DM0
is 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
POW(.U)
POW.S
POW POW.D
POW.L
POW
The internal register value is
POW.F
exponentiated with the value
POW.DF Exponenti
specified in the operand, and the
@POW(.U) ation
results are stored in the internal
@POW.S
register again.
@POW @POW.D
@POW.L
POW
@POW.F
@POW.DF
Execution condition S
Instructions
Arithmetic/Comparison
Operand Explanation
S Specifies exponential data, or the device storing the exponentiated data.*3 *4
Point This instruction can be used with KV-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 2)
Description of Operation
POW(.U) When the execution conditions are ON, the unsigned 16-bit BIN data specified with
S and the unsigned data of the 16-bit internal register are exponentiated, and the
operation results are stored in the 32-bit internal register.
The operation results are also divided and saved in TM0 (high order 16 bits) and 16-bit
internal register (low order 16 bits).
32-bit internal register
16-bit internal register S 20736
12 4 TM0 16-bit internal register
POW.S When the execution conditions are ON, the signed 16-bit BIN data specified with S
and the signed data of the 16-bit internal register are exponentiated, and the operation
results are stored in the 32-bit internal register.
The operation results are also divided and saved in TM0 (high order 16 bits) and the 16-
bit internal register (low order 16 bits).
32-bit internal register
16-bit internal register S -13824
-24 +3 TM0 16-bit internal register
POW.D When the execution conditions are ON, the unsigned 32-bit BIN data specified with
4
[ S / S +1] and the unsigned data of the 32-bit internal register are
Instructions
Arithmetic/Comparison
exponentiated, and the operation results are stored in the divided and saved in TM0
and TM1 (high order 32 bits) and the 32-bit internal register (low order 32 bits).
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 conditions are ON, the signed 32-bit BIN data specified with
[ S / S +1] and the signed data of the 32-bit internal register are exponentiated,
and the operation results are stored in the divided and saved in TM0 and TM1 (high
order 32 bits) and the 32-bit internal register (low order 32 bits).
32-bit internal register S +1 S TM1 TM0 32-bit internal register
-23 +6 -148035889
32-bit 32-bit 64-bit
(2 words)
POW.F When the execution conditions are ON, thesingle precision floating point type real
number specified with [ S / S +1] and the single precision floating point type real
number of the 32-bit internal register are exponentiated, and the operation results are
stored in the 32-bit internal register.
32-bit internal register S +1 S 32-bit internal register
Single precision floating point type real number Single precision floating point type real number Single precision floating point type real number
POW.DF When the execution conditions are ON, the double precision floating point type real
number specified with [ 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
operation results are stored in the 64-bit internal register.
64-bit internal register S +3 S +2 S +1 S 64-bit internal register
Double precision floating point type real number Double precision floating point type real number Double precision floating point type real number
@POW. Only one scan is executed at the rising edge of the execution conditions.
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-158)
• Operation can be enabled correctly even if overflow occurs.
Arithmetic/Comparison Instructions
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. 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 one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When a value less than 0 is specified for S
4 CR2012
• When the operation results exceed the unsigned 32-bit (.U), signed 32-bit (.S), unsigned 64-
bit (.D) or signed 64-bit (.L) range
For suffix "F/DF"
Instructions
Arithmetic/Comparison
Sample Program
POW.U
When the input relay R000 is ON, the unsigned 16-bit BIN data stored in the data memory DM0 and
the 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
LDA POW STA LD R000
MPS
TM0 DM11
LDA DM0
LDA STA CON
R000 DM0 #10 DM10 POW DM2
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
Instructions
Arithmetic/Comparison
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
ADD
CMP(.U)
CMP.S
CMP CMP.D
CMP.L
CMP
CMP.F
Compares the value currently stored
CMP.DF
Compare to the internal register with the
@CMP(.U) specified BIN data.
@CMP.S
@CMP @CMP.D
@CMP.L
CMP
@CMP.F
@CMP.DF
4 LDA CMP C M P S
LDA CMP @ C M P S
Operand Explanation
S Specifies the device to compare with the internal data.*1 *2
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32/64 bits straddling the next channel.
*3 When the suffix is ".F" or ".DF", it can not be used.
*4 Z cannot be specified if the suffix is ".DF".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The CMP.DF (@CMP.DF) instruction can be used with KV-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 2)
Description of Operation
CMP(.U) The sizes of the unsigned 16-bit data currently stored to the 16-bit internal register and
the unsigned 16-bit BIN data currently stored to the device specified by S are
compared. The operation flag changes as shown in the table below according to the
compare result.
CMP.S The sizes of the signed 16-bit data currently stored to the 16-bit internal register and the
signed 16-bit BIN data currently stored to the device specified by S are compared.
The operation flag changes as shown in the table below according to the compare
result.
State of Operation
4
Compare Result Flag
Instructions
Arithmetic/Comparison
Value of 16-bit internal register is less than S
CR2009 -> ON
16-bit internal register < S
Value of 16-bit internal register is equal to S
CR2010 -> ON
16-bit internal register = S
Value of 16-bit internal register is greater than S
CR2011 -> ON
16-bit internal register > S
CMP.D The sizes of the unsigned 32-bit data currently stored to the 32-bit internal register and
the unsigned 32-bit BIN data currently stored to the device specified by [ 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 32-bit signed data currently stored to the 32-bit internal register and the
signed 32-bit BIN data currently stored to the device specified by [ S / S +1] are
compared. The operation flag changes as shown in the table on the following page
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
32-bit internal register < [ S / S +1]
Value of 32-bit internal register is equal to [ S / S +1]
CR2010 -> ON
32-bit internal register = [ S / S +1]
Value of 32-bit internal register is greater than [ S / S +1]
CR2011 -> ON
32-bit internal register > [ S / S +1]
CMP.F When 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.
Arithmetic/Comparison Instructions
CMP.DF When the execution conditions are ON, the double precision floating point type real
number specified with [ 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
operation results are stored in the 64-bit internal register.
State of Operation
Compare Result Flag
Value of 64-bit internal register is less than specified value
CR2009 -> ON
64-bit internal register < [ S / S +1/ S +2/ S +3]
Value of 64-bit internal register is equal to specified value
CR2010 -> ON
64-bit internal register = [ S / S +1/ S +2/ S +3]
Value of 64-bit internal register is greater than specified value
CR2011 -> ON
4 64-bit internal register > [ S / S +1/ S +2/ S +3]
@CMP. Only one scan is executed at the rising edge of the execution conditions.
Instructions
Arithmetic/Comparison
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
CR2009
operand. 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 any of the following conditions are established. Otherwise, OFF.
• When the indirect specifying 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")
CR2012
• When the comparison data is outside the double precision floating point type real number
range (only when the suffix is "DF")
Does not change when the suffix is ".U/.S/.D/.L" and indirect specification or index modify is not
specified in the operand.
Sample Program
#1000 is compared with the value currently stored to DM0.
Instructions
Arithmetic/Comparison
OUT R502
DM0<1000: Output relay R500 turns ON when the value is less than #1000.
DM0=1000: Output relay R501 turns ON when the value is equal to #1000.
DM0>1000: Output relay R502 turns ON when the value is greater than #1000.
a b
Reference Assuming LDA CMP 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
ADD
ZCMP(.U)
ZCMP.S
ZCMP ZCMP.D
ZCMP.L
ZCMP
@ZCMP @ZCMP.D
@ZCMP.L
ZCMP
@ZCMP.F
@ZCMP.DF
4 LDA ZCMP
S2
Z C M P S1 S2
LDA ZCMP @ Z C M P S1 S2
S2
S2 - - - - *6 *4 *4 *4*7 *4*7 *5
Operand Explanation
S1 Specifies the device for determining the range to compare with the internal register. *1 *2 *3
S2 Specifies the device for determining the range to compare with the internal register. *1 *2 *3
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32/64 bits straddling the next channel.
*3 The max. value and min. value are automatically judged whichever of S1 , S2 they are
specified to.
*4 When the suffix is ".F" or ".DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF".
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The ZCMP.DF (@ZCMP.DF) instruction can be used with KV-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 2)
Description of 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 to the internal register are compared.
The operation flag changes as follows according to the compare result.
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 to 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
16-bit internal register < S1 < S2
CR2009 -> ON
4
Value of 16-bit internal register is within specified range
CR2010 -> ON
Instructions
Arithmetic/Comparison
S1 ≤ 16-bit internal register ≤ S2
Value of 16-bit internal register is greater than specified range
CR2011 -> ON
S1 < S2 < 16-bit internal register
* When S1 < S2 , swap each of the settings for S1 and S2 in the above table.
ZCMP.D When the execution condition is ON, the size of the range specified by [ S1 / S1 +1],
[ S2 / S2 +1] and the unsigned 32-bit BIN data currently stored to 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 size of the range specified by [ S1 / S1 +1],
[ S2 / S2 +1] and the signed 32-bit BIN data currently stored to 32-bit internal register
are compared.
The operation flag changes as follows according to the compare result.
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.
Arithmetic/Comparison Instructions
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
precision floating point type real number stored in 64-bit internal register. The operation
flag changes as follows according to the compare result.
@ZCMP. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
ON when the value of the internal register is less than the value specified by the operand.
CR2009
Otherwise, OFF.
ON when the value of the internal register is within the range specified by the specified
CR2010 operand. 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 with the following conditions. Otherwise, OFF.
• When the indirect specifying 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")
CR2012 • When the comparison data is outside the double precision floating point type real number
range (only when the suffix is "DF")
Does not change when the suffix is ".U/.S/.D/.L" and indirect specification or index modify is not
specified in the operand.
Sample Program
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.
When the value currently stored to DM0 is less than #1000, R502 turns OFF.
CR2009 R502
DM0<1000<2000
CON
MPS
AND CR2011
4
OUT R500
Instructions
Arithmetic/Comparison
MRD
AND CR2010
OUT R501
MPP
AND CR2009
OUT R502
ANDA ANDA(.U)
ANDA.D
ANDA Calculates the logical AND
of values in internal
AND A
registers and values
@ANDA @ANDA(.U)
@ANDA.D
ANDA specified by operands.
Execution condition S
LDA ANDA STA @ A N D A S
4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify
MR DM EM
Instructions
Arithmetic Operation
Operand Explanation
S Specifies the data to be logically ANDed or the device currently storing that data.*1
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTH and CTC cannot be used with the KV-7000 Series.
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
data specified by S are "1". Internal register (result) 0 0 0 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 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 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.
4
DM0
16-bit internal register 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 STA.D
@ANDA. Only one scan is executed at the rising edge of the execution conditions.
Instructions
Arithmetic Operation
Operation flag
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 ORA(.U)
ORA.D
ORA Calculates the logical OR of
values in internal registers
OR A
and values specified by
@ORA @ORA(.U)
@ORA.D
ORA operands.
Execution condition S
LDA ORA STA @ O R A S
Operand Explanation
S Specifies the data to be logically ORed or the device currently storing that data.*1
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the execution condition is ON, the logical OR of the BIN data Logical OR 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. S 0 1 0 1
The result of this operation is "1" only when either or both the internal
register 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 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 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.
4
DM0
32-bit internal register 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 STA.D
@ORA. Only one scan is executed at the rising edge of the execution conditions.
Instructions
Arithmetic Operation
Operation flag
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 (1) LDB R000
R001 C #0 #99 R001
LD CR2002
CR2002 R500 $FF00 DM0 LDA R500
LDA ANDA STA (2)
CON
ANDA $FF00
CR2002 C0 $00FF DM0 R500 CON
LDA TBCD ANDA ORA STA (3) STA DM0
LD CR2002
LDA C0
CON
(1) Setup counter C0. TBCD
CON
(2) Store R508 to R515 of output relay to DM0. ANDA $FF
(3) BCD conversion to current value of C0 Save data of low 2 bits of CON
ORA DM0
BCD to 16-bit internal register. OR operation (logical “OR”) CON
between 16-bit internal register and DM0 then output to R500 to STA R500
R515.
ADD
EORA EORA(.U)
EORA.D
EORA Calculates the logical
exclusive OR of values in
Exclusive OR
internal registers and values
@EORA @EORA(.U)
@EORA.D
EORA specified by operands.
4
Available Devices ( ): Not supported on the KV-1000
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
Instructions
Arithmetic Operation
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *2 *3 *3
Operand Explanation
S Specifies the data to be logically exclusively ORed or the device currently storing that data.*1
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the execution condition is ON, the logical exclusive OR of the Logical XOR truth table
BIN data specified by S and the content of the internal register is Internal register 0 0 1 1
calculated, and the 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 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 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 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 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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag 4
Instructions
Arithmetic Operation
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state
ON when the indirect specification and index modify range is inappropriate. Otherwise, OFF.
CR2012
Does not change when indirect specification or index modify is not specified to the operand.
Sample Program
When the setting value currently stored to DM0 matches the ON/OFF state of input relays R30000 to
R30007, output relay R500 is turned ON.
(Mnemonics list)
CR2008 $00AA DM0
LDA STA LD CR2008
LDA $AA
CR2002 R30000 $00FF DM0 CR2010 R500 CON
LDA ANDA EORA STA DM0
LD CR2002
bit bit LDA R30000
15 0
CON
$BBBB 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 Input relay R30000 to R30015 ANDA $FF
bit ANDA bit
CON
15 0
EORA DM0
$00FF 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 Operand CON
bit bit
AND CR2010
15 0
OUT R500
$00BB 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 16-bit internal register
bit EORA bit
15 0
ENRA ENRA(.U)
ENRA.D
ENRA
Exclusive
Calculates the logical
exclusive NOR of values in
NOR internal registers and values
@ENRA @ENRA(.U)
@ENRA.D
ENRA specified by operands.
Available Devices
4
( ): Not supported on the KV-1000
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
Instructions
Arithmetic Operation
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *2 *3 *3
Operand Explanation
S Specifies the data to be exclusively NORed or the device currently storing that data.*1
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the execution condition is ON, the exclusive NOR of the BIN Logical XNR truth table
data specified by S and the content of the internal register is Internal register 0 0 1 1
calculated, and the result is stored to the internal register. The result S 0 1 0 1
of this operation is "1" only when the internal register and bits in the
BIN data specified by S are the same. Internal register (result) 1 0 0 1
ENRA(.U) The 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 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 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 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.
4
DM0
32-bit internal register 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 0 0 0 0 STA.D
@ENRA. Only one scan is executed at the rising edge of the execution conditions.
Instructions
Arithmetic Operation
Operation flag
Sample Program
If even one bit of the setting values currently stored to 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
15
bit
0
CON
ANB CR2010
$5554 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 Input relay R30000 to R30015 OUT R500
bit ENRA bit
15 0
ADD
COM COM(.U)
COM.D
COM
Inverts each of the bits in
Complement
internal registers.
@COM @COM(.U)
@COM.D
COM
Execution condition
LDA COM STA @ C O M
4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify
MR DM EM
Instructions
Arithmetic Operation
Description of Operation
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
COM.D When the execution condition is ON, each of the bits in 32-bit internal registers is
inverted ("0 -> 1", "1 -> 0").
@COM. Only one scan is executed at the rising edge of the execution conditions.
Reference When the COM instruction is executed at every scan, the bits are inverted at each scan
when the execution condition is ON. If the COM instruction is executed not at each scan
but at the rising edge of the execution condition, use the differential type execution
instruction (@COM) as follows.
Operation flag
Sample Program
The state of input relays R00 to R003 are inverted and output to R500 to R503.
MR000 R000
LDA
$000F
ANDA COM
R500
STA
(Mnemonics list)
LD MR000
4
LDA R000
Instructions
Arithmetic Operation
CON
ANDA $F
CON
COM
CON
STA R500
ADD
NEG(.U)
NEG.S
NEG NEG.D
NEG.L
NEG
NEG.F
NEG.DF Inverts the sign (2's
Negate sign
@NEG(.U) complement).
@NEG.S
@NEG @NEG.D
@NEG.L
NEG
@NEG.F
@NEG.DF
Execution condition
Instructions
Arithmetic Operation
Point The NEG.DF (@NEG.DF) instruction can be used with KV-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 2)
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
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 1
bit bit
15 0
NEG.D / NEG.L
When the execution condition is ON, the plus/minus sign of the 32-bit data currently
stored in 32-bit internal registers is inverted (2's complement is calculated).
10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
bit bit
31 0
NEG.F When execution condition is ON, single precision floating point type real number stored
in 32-bit internal register will be negated. 4
32-bit internal register 32-bit internal register
Instructions
Arithmetic Operation
Single precision floating point type real number −1 × Single precision floating point type real number
32-bit 32-bit
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. Only one scan is executed at the rising edge of the execution conditions.
Reference When the NEG instruction is executed at every scan, the sign is inverted at each scan
when the execution condition is ON. If the COM instruction is executed not at each scan
but at the rising edge of the execution condition, use the differential type execution
instruction (@NEG) as follows.
Operation flag
Sample Program
When input relay R000 is ON, the difference between the signed 16-bit BIN data currently stored to
DM0 and DM1 is calculated, and the absolute value is stored to DM2.
(Mnemonics list)
R000 DM0 DM1 DM2
LDA.S SUB.S STA.S LD R000
MPS
LDA.S DM0
DM0 DM2 DM2
CON
< .S LDA.S NEG.S STA.S SUB.S DM1
DM1 CON
STA.S DM2
MPP
4 AND<.S DM0 DM1
LDA.S DM2
CON
Instructions
Arithmetic Operation
NEG.S
CON
STA.S DM2
MEMO
Instructions
Arithmetic Operation
ADD
SRA SRA(.U)
SRA.D
SRA Shifts the bit content of
internal registers to the
Shift right A
smaller bit No. by the specified
@SRA @SRA(.U)
@SRA.D
SRA number of bits.
Execution condition n
LDA SRA STA @ S R A n
4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify
MR DM EM
Data Shift Instructions
*1 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*2 When the value of n is "0", the state of the MSB is stored to CR2009.
*3 When a device has been specified to n , operation is as follows when the value of n is
17 or more (.U) / 33 or more (.D).
Value of internal register=0, CR2009=OFF, CR2010=ON
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
SRA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted
n bits towards the smaller bit No.
"0" is stored to the upper n bits, the state of bit ( n -1) is stored to CR2009, and
the result is stored to the 16-bit internal register.
bit ( n -1)
bit bit
15 0
Filled with 0
1
CR2009
(Carry)
SRA.D When the execution condition is ON, the state of the 32-bit internal register is shifted
n bits towards the smaller bit No.
"0" is stored to the upper n bit, the state of bit ( n -1) is stored to CR2009, and
the result is stored to the 32-bit internal register.
bit ( n -1 )
bit bit
31 0
4
Higher n bit Delete
Filled with 0 1
@SRA. Only one scan is executed at the rising edge of the execution conditions.
Reference When the SRA instruction is executed at every scan, the bits are shifted at each scan
when the execution condition is ON. If the SRA instruction is executed not at each scan
but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
Operation flag
Sample Program
The BCD data (2 digits) from the digital switch entered to input relays R30008 to R30015 is stored to
DM0.
(Mnemonics list)
MR000 R30000 #8 DM0
LDA SRA STA LD MR000
LDA R30000
CON
SRA #8
Digital switch
CON
STA DM0
2 4
4 R30015 R30000
Data Shift Instructions
0 0 1 0 0 1 0 0 R30000 to R30015
LDA
0 0 1 0 0 1 0 0 Internal register
SRA
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 Internal register
STA
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 DM0
MEMO
ADD
SLA SLA(.U)
SLA.D
SLA Shifts the bit content of
internal registers to the larger
Shift left A
bit No. by the specified
@SLA @SLA(.U)
@SLA.D
SLA number of bits.
Execution condition n
LDA SLA STA @ S L A n
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
Specifies the number of bits to shift.*1 *2 *3
n
SRA.U can be specified within the range 0 to 16, and SRA.D can be specified within the range 0 to 32.
*1 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*2 When the value of n is "0", the state of the LSB is stored to CR2009.
*3 When a device has been specified to n , operation is as follows when the value of n is
17 or more (.U) / 33 or more (.D).
Value of internal register=0, CR2009=OFF, CR2010=ON
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
SLA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted
n bits towards the larger bit No.
"0" is stored to the lower n bits, the state of bit (16- n ) is stored to CR2009, and
the result is stored to the 16-bit internal register.
bit (16- n )
bit bit
15 0
1
Filled with 0
CR2009
(Carry)
SLA.D When the execution condition is ON, the state of the 32-bit internal register is shifted
n bits towards the larger bit No.
"0" is stored to the lower n bit, the state of bit (32- n ) is stored to CR2009, and
the result is stored to the 32-bit internal register.
bit (32- n )
bit bit
31 0
4
Delete n
Lower bit
1 Filled with 0
@SLA. Only one scan is executed at the rising edge of the execution conditions.
Reference When the SLA instruction is executed at every scan, the bits are shifted at each scan when the
execution condition is ON. If the SRA instruction is executed not at each scan but at the rising
edge of the execution condition, use the differential type execution instruction as follows.
Operation flag
Sample Program
The 2-digit BCD data currently stored to each of DM0 and DM1 are stored to DM10 as 4-digit BCD
data 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
DM1 1234 ORA DM0
CON
12 STA DM10
KV-1000 KV Nano
register
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
ASRA
ASRA(.U)
ASRA ASRA.S
ASRA.D
ASRA
Shift the bit content of internal
ASRA.L Arithmetic right registers towards the smaller
@ASRA(.U)
shift bit No. by the specified
number of bits.
@ASRA @ASRA.S
@ASRA.D
ASRA
@ASRA.L
Execution condition n
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
n *2 *3 *3
- - - - -
Operand Explanation
Specifies the number of bits to shift the bit. *1
n
ASRA.U, ASRA.S can be specified within the range 0 to 16, and ASRA.D, ASRA.L can be specified within the range 0 to 32.
*1 • When a bit device has been specified to n , 16 continuous bits are occupied. When a
word device has been specified, one word is occupied.
• When the n value is 0, the MSB status is stored in CR2009.
• When a device has been specified to n , operation is as follows when the value of n
Point This instruction can be used with KV-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 2)
Description of Operation
ASRA(.U) When the execution conditions are ON, the n bits which specify the status of the 16-
bit internal register are shifted toward the smaller bit number.
0 is stored in the high-order n bit. The bit ( n -1) status is stored in CR2009. The
results are stored in the 16-bit internal register.
bit
bit ( n -1) bit
15 0
16-bit Internal register before execution: 59417
internal register 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
16-bit
internal register
0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
Internal register after execution: 1856
4
1
0 is stored
CR2009
(carry)
ASRA.S When the execution conditions are ON, the n bits which specify the status of the 16-
bit internal register are shifted toward the smaller bit number.
If "value stored in internal register ≥0”, 0 is stored in the high-order n bit. If "value
stored in internal register<0”, 1 is stored. The bit ( n -1) status is stored in CR2009.
The results are stored in the 16-bit internal register.
bit ( n -1)
bit bit
15 0
Internal register before execution: -1000
16-bit
internal register 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0
16-bit
internal register
1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0
Internal register after execution: -63
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 conditions are ON, the n bits which specify the status of the 32-
bit internal register are shifted toward the smaller bit number.
0 is stored in the high-order n bit. The bit ( n -1) status is stored in CR2009. The
results are stored in the 32-bit internal register.
bit ( n -1)
bit bit
31 0
32-bit 3894011929
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 register
n=5
32-bit 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
internal register 121687872
High-order n bit Delete
1
0 is stored
CR2009
(carry)
ASRA.L When the execution conditions are ON, the n bits which specify the status of the 32-
bit internal register are shifted toward the smaller bit number.
If "value stored in internal register ≥0”, 0 is stored in the high-order n bit. If "value
stored in internal register<0”, 1 is stored. The bit ( n -1) status is stored in CR2009.
The results are stored in the 32-bit internal register.
bit ( n -1)
bit bit
31 0
32-bit 1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 -1865478994
internal register
n=4
32-bit
11111001000011001111000011001010 1 1 1 0
4
internal register -116592438
1
Data Shift Instructions
@ASRA. Only one scan is executed at the rising edge of the execution conditions.
Reference When the ASRA instruction is executed at every scan, the bits are shifted at each scan
when the execution condition is ON. If the ASRA instruction is executed not at each scan
but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
DM DM
LDA ASRA STA
DM DM
LDA ASRA STA
Operation flag
Sample Program
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)
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
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 to 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
ASLA(.U)
ASLA ASLA.S
ASLA.D
ASLA
Shift the bit content of internal
ASLA.L Arithmetic left registers towards the larger bit
@ASLA(.U)
shift No. by the specified number
of bits.
@ASLA @ASLA.S
@ASLA.D
ASLA
@ASLA.L
Execution condition n
LDA ASLA STA @ A S L A n
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
n - - - - *2 *3 *3
-
Operand Explanation
Specifies the number of bits to shift the bit.*1
n
ASLA.U, ASLA.S can be specified within the range 0 to 16, and ASLA.D, ASLA.L can be specified within the range 0 to 32.
*1 • When a bit device has been specified to n , 16 continuous bits are occupied. When a
word device has been specified, one word is occupied.
• When the n value is 0, the LSB status is stored in CR2009.
• When a device has been specified to n , operation is as follows when the value of n
is 17 or more (.U/.S) / 33 or more (.D/.L).
Internal register value = 0, CR2009=OFF, CR2010=ON
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Description of Operation
ASLA(.U) / ASLA.S
When the execution conditions are ON, the n bits which specify the status of the
16-bit internal register are shifted toward the larger bit number.
0 is stored in the low-order n bit. The bit (16- n ) status is stored in CR2009. The
results are stored in the 16-bit internal register.
bit (16- n )
bit bit
15 0
16-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 Internal register before execution: 59417
internal register
16-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 Internal register after execution: 800
internal register
1
0 is stored
CR2009
(carry)
ASLA.D / ASLA.L
When the execution conditions are ON, the n bits which specify the status of the 32- 4
bit internal register are shifted toward the larger bit number.
n=5
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 54330144
1
0 is stored
CR2009
(carry)
@ASLA. Only one scan is executed at the rising edge of the execution conditions.
Reference When the ASLA instruction is executed at every scan, the bits are shifted at each scan
when the execution condition is ON. If the SRA instruction is executed not at each scan
but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
DM DM
LDA ASLA STA
DM DM
LDA ASLA STA
Operation flag
Sample Program
The 6-digit BCD data stored in data memory DM0, DM1 is merged with the 2-digit BCD data stored in
DM2, and is stored as 8-digit BCD data in DM10, DM11.
(Mnemonics list)
CR2002 DM0 #8 DM2 DM10
LDA.D ASLA.D ORA STA.D LD CR2002
LDA.D DM0
CON
ASLA.D #8
CON
ORA DM2
CON
STA.D DM10
4 DM0, DM1
DM10, DM11
123456
Data Shift Instructions
DM2 12345678
78
MEMO
RLA
RRA RRA(.U)
RRA.D
RRA Rotates the bit content of
internal registers towards the
Right rotate A
smaller bit No. by the specified
@RRA @RRA(.U)
@RRA.D
RRA number of bits.
Execution condition n
LDA RRA STA @ R R A n
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
Specifies the number of bits to rotate the bit. *1
n
RRA.U can be specified within the range 0 to 16, and RRA.D can be specified within the range 0 to 32.
*1 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*2 When the value of n is "0", the state of CR2009 does not change.
*3 When a device has been specified to n , 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.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
RRA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated n bits towards the smaller bit No. The state of the carry flag (CR2009) is
entered to the MSB.
(The following bit manipulation is repeated n times.)
bit bit
CR2009 15 0
CR2009
1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1
(Carry)
n cycle (Rotate n bits)
bit bit
CR2009 15 0
(Carry)
RRA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated n bits towards the smaller bit No. The state of the carry flag (CR2009) is
entered to the MSB.
(The following bit manipulation is repeated n times.)
32-bit internal register
bit bit bit bit
CR2009 31 16 15 0
0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
Status of flag varies
with previous operation
(1-bit cycle)
results.
CR2009
1
(Carry)
0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
4
n cycle (Rotate n bits)
0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
(Carry)
32-bit internal register
@RRA. Only one scan is executed at the rising edge of the execution conditions.
Reference When the RRA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If the RRA instruction is executed not at each scan
but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
Operation flag
Sample Program
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.
MEMO
RLA
RLA RLA(.U)
RLA.D
RLA Rotates the bit content of
internal registers towards the
Left rotate A
larger bit No. by the specified
@RLA @RLA(.U)
@RLA.D
RLA number of bits.
Execution condition n
LDA RLA STA @ R L A n
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
Specifies the number of bits to rotate the bit.*1 *2 *3
n
RLA.U can be specified within the range 0 to 16, and RLA.D can be specified within the range 0 to 32
*1 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*2 When the value of n is "0", the state of CR2009 does not change.
*3 When a device has been specified to n , 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.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
RLA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated n bits towards the smaller bit No. The state of the carry flag (CR2009) is
entered to the LSB.
(The following bit manipulation is repeated n times.)
bit bit
15 0 CR2009
CR2009
1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 1
(Carry)
n cycle (Rotate n bits)
bit bit
15 0 CR2009
RLA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated n bits towards the smaller bit No. The state of the carry flag (CR2009) is
entered to the LSB.
(The following bit manipulation is repeated n times.)
32-bit internal register
bit bit bit bit
31 16 15 0 CR2009
1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0
Status of flag varies with
previous operation results.
(1-bit cycle)
CR2009
4
1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1
(Carry)
0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0
(Carry)
32-bit internal register
@RLA. Only one scan is executed at the rising edge of the execution conditions.
Reference When the RLA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If the RLA instruction is executed not at each scan
but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
Operation flag
Sample Program
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)
CR2002 #0 R30000
DW LDA (1) LD CR2002
DM0 DW #0 DM0
CON
FOR LDA R30000
#16 (2)
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RLA #1
CON
4
RLA INC (3)
AND CR2009
INC DM0
NEXT NEXT
Data Shift Instructions
MEMO
RLA
Execution condition n
LDA RRNCA STA @ R R N C A n
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
Specifies the number of bits to rotate.*1 *2
n
RRNCA.U can be specified within the range 0 to 15, and RRNCA.D can be specified within the range 0 to 31.
*1 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied
*2 When a device has been specified to n , operation is as follows when the value of n is
16 or more (.U) / 32 or more (.D).
When suffix is .U: the remainder value obtained by dividing the value of n by 16 is taken as
the number of bits to rotate.
When suffix is .D: the remainder value obtained by dividing the value of n by 32 is taken as
the number of bits to rotate.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
RRNCA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated n bits towards the smaller bit No.
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 n times.)
bit bit
15 0
0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0
CR2009(Carry) 1
RRNCA.D When the execution condition is ON, the bit content of the 32-bit internal register is no
carry rotated n bits towards the smaller bit No.
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 n times.)
bit bit bit bit
31 16 15 0
32-bit internal register
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-bit cycle)
4
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
@RRNCA.Only one scan is executed at the rising edge of the execution conditions.
Reference When the RRNCA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If the RRNCA instruction is executed not at each
scan but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
Operation flag
Sample Program
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)
CR2002 #0 R30000
DW LDA (1) LD CR2002
DM0 DW #0 DM0
CON
FOR
(2) LDA R30000
#16
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RRNCA #1
CON
4
RRNCA INC (3)
AND CR2009
INC DM0
NEXT NEXT
Data Shift Instructions
MEMO
RLA
Execution condition n
LDA RLNCA STA @ R L N C A n
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
Specifies the number of bits to rotate the bit. *1 *2
n
RLNCA.U can be specified within the range 0 to 15, and RLNCA.D can be specified within the range 0 to 31.
*1 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied
*2 When a device has been specified to n , operation is as follows when the value of n is
16 or more (.U) / 32 or more (.D).
When suffix is .U: the remainder value obtained by dividing the value of n by 16 is taken as
the number of bits to rotate.
When suffix is .D: the remainder value obtained by dividing the value of n by 32 is taken as
the number of bits to rotate.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
RLNCA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is no
carry rotated n bits towards the smaller bit No .
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 n times.)
bit bit
15 0
1-bit cycle
1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1
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 no
carry rotated n bits towards the smaller bit No.
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 n times.)
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
CR2009(Carry) 0
@RLNCA.Only one scan is executed at the rising edge of the execution conditions.
Reference When the RLNCA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If the RLNCA instruction is executed not at each
scan but at the rising edge of the execution condition, use the differential type execution
instruction as follows.
Operation flag
Sample Program
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)
CR2002 #0 R30000
DW LDA (1) LD CR2002
DM0 DW #0 DM0
CON
FOR
(2) LDA R30000
#16
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RLNCA #1
CON
4
RLNCA INC (3)
AND CR2009
INC DM0
NEXT NEXT
Data Shift Instructions
MEMO
RLA
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
D Specifies the leading device to be shifted. *1
n1 Specifies the number of devices to be shifted. *2
n2 Specifies the number of times devices are to be shifted. *2
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*2 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, 1 word is occupied.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
WSR(.U) When the execution condition is ON, n1 16-bit data starting from D are shifted
left -towards 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 to the right-towards 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
4
800000
( D +2 ( n1 -1) +1) +2 n2 900000 ( D +2 ( n1 -1) +2 n2
Point When a timer/counter (32-bit) has been specified to D by a .U suffix instruction, "0" is
stored to the higher 16 bits of the shift destination data, and the value of the lower 16 bits
of the shift source data is stored to the lower 16 bits of the shift destination data.
"0" is stored to both the higher and lower 16 bits of the shift source data.
Operation flag
Sample Program
Each time that input relay R000 turns ON, the content of DM0 to DM99 is shifted 1 word to the right
towards the larger device No.
(Mnemonics list)
R000 WSR
DM0 #100 #1 LDP R000
WSR DM0 #100 #1
RLA
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
D Specifies the leading device to be shifted. *1
n1 Specifies the number of devices to be shifted. *2
n2 Specifies the number of times devices are to be shifted. *2
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*2 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, 1 word is occupied.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
WSL(.U) When the execution condition is ON, n1 16-bit data starting from D are shifted to
the left-towards by n2 .
"0" is stored to n2 data starting from [ D + n1 - n2 ].
D - n2 1000
( D +1) - n2 2000
n2
...
D 1000
D +1 2000
8000
( D + n1 -1) - n2 9000
...
n1
0
0
Delete
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 left-towards 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
4
800000 0
D +2 ( n1 -1) +1 900000 D +2 ( n1 -1) 0
Point When a timer/counter (32-bit) has been specified to D by a .U suffix instruction, "0" is
stored to the higher 16 bits of the shift destination data, and the value of the lower 16 bits
of the shift source data is stored to the lower 16 bits of the shift destination data.
"0" is stored to both the higher and lower 16 bits of the shift source data.
Operation flag
Sample Program
Each time that input relay R000 turns ON, the content of DM1000 to DM1099 is shifted 1 word to the
left towards the smaller device No.
(Mnemonics list)
R000 WSL
DM1000 #100 #1 LDP R000
WSL DM1000 #100 #1
RLA
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
D Specifies the leading device to be shifted. *1
n1 Specifies the number of devices to be shifted. *2
n2 Specifies the number of times devices are to be shifted. *2
*1 When a bit device has been specified, the program will function normally even if the bit device
straddles channels.
When a word device has been specified, the LSB of n1 word devices is targeted for shifting.
Bits other than LSB do not change.
*2 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
BSR(.U) When the execution condition is ON, the state of n1 devices starting from D are
shifted right-towards by n2 .
n2 devices starting from D are turned OFF (stored with "0").
Example BSR
MR101 #3 #4
“0” is filled in
BSR.D When the execution condition is ON, the state of n1 devices starting from [ D /
D +1] are shifted to the right-towards by n2 .
n2 devices starting from D are turned OFF (stored with "0").
@BSR. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
Each time that input relay R000 turns ON, the content of internal auxiliary relays MR000 to MR007 is
shifted to the right-towards by 8 bits at a time.
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions
Operand Explanation
D Specifies the leading device to be shifted. *1
n1 Specifies the number of devices to be shifted. *2
n2 Specifies the number of times devices are to be shifted. *2
*1 When a bit device has been specified, the program will function normally even if the bit device
straddles channels.
When a word device has been specified, the LSB of n1 word devices is targeted for shifting.
Bits other than LSB do not change.
*2 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, 1 word is occupied.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
BSL.U When the execution condition is ON, the state of n1 devices starting from D are
shifted towards the smaller device No. by n2 .
n2 devices 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 devices starting from [ D /
D +1] are shifted towards the smaller device No. by n2 .
n2 devices starting from [ D + n1 - n2 ] are turned OFF ("0" is stored).
@BSL. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
Each time that input relay R000 turns ON, the content of internal auxiliary relays MR10008 to MR10015
is shifted towards the smaller device No. by 8 bits at a time.
LIMIT
LIMIT(.U)
Execution condition
4
LIMIT
S1 S2 S3 D @ L I M I T S1 S2 S3 D
instructions
Data control
Operand Explanation
S1 Specifies the lower limit (MIN output limit value) or the leading device for storing the value. *1 *2 *3 *4
S2 Specifies the upper limit (MAX output limit value) or the leading device for storing the value.*1 *2 *3 *4
S3 Specifies input value of upper/lower limit control or the leading device for storing the value.**1 *2 *3 *4
D Specifies the leading device for storing output value of upper/lower limit control.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are processed.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is processed in 16/32 bits straddling the next channel.
*3 When specifying CTH, current value is processed. When using CTC, current value is processed.
*4 When the suffix is ".S", the lower 16 bits of C, CTH and CTC are processed as "signed 16-bit BIN data".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the execution condition is ON, the upper/lower limit control is performed in upper and lower
value 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 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 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 .
instructions
Data control
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 is ON, [ S1 / S1 +1] (upper limit), [ S2 / S2 +1] (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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When the 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.
LIMIT
4
Available Devices ( ): Not supported on the KV-1000
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
instructions
Data control
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - *5 *6 *6
-
S2 - - - - *5 *6 *6
-
S3 *5 *6 *6
- - - - -
D *5
- - - - - - - - -
Operand Explanation
S1 Specifies the lower limit of dead band (no output space) or the leading device for storing the value. *1 *2 *3 *4
S2 Specifies the upper limit of dead band (no output space) or the leading device for storing the value. *1 *2 *3 *4
S3 Specifies the leading device for storing the input value of dead band control. *1 *2 *3 *4
D Specifies the leading device for storing the output value of dead band control.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are processed.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is processed in 16/32 bits straddling the next channel.
*3 When specifying CTH, current value is processed. When using CTC, current value is processed.
*4 When The suffix is ".S", the lower 16 bits of C, CTH and CTC are processed as "signed 16-bit BIN
data".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the execution condition is ON, the dead band control is performed in upper and lower value 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 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 4
BANDC.L When the execution is ON, [ S1 / S1 +1] (lower limit), [ S2 / S2 +1] (upper
instructions
Data control
limit) 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].
* In [ D / D +1], the value is stored within the rang of signed 32-bit BIN data.
• [ D / D +1] ≤ -2147483648 ->[ D / D +1] = -2147483648
• [ D / D +1] ≥ +2147483647-> [ D / D +1] = +2147483647
@BANDC. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When the relay R000 is ON, the values (upper limit: 2000, lower limit: 1000) used for performing limit
control for analog data stored in DM10000 are stored in DM0
LIMIT
4
Available Devices ( ): Not supported on the KV-1000
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
instructions
Data control
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 *5 *6 *6
- - - - -
*5 *6 *6
S2 - - - - -
S3 *5 *6 *6
- - - - -
D *5
- - - - - - - - -
Operand Explanation
S1 Specifies the negative offset to be added to input value or the leading device for storing the value. *1 *2 *3 *4
S2 Specifies the positive offset to be added to input value or the leading device for storing the value. *1 *2 *3 *4
S3 Specifies the input value of zone control and the leading device for storing the value. *1 *2 *3 *4
D Specifies the leading device for storing the output value of zone control.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are processed.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is processed in 16/32 bits straddling the next channel.
*3 When specifying CTH, current value is processed. When using CTC, current value is processed.
*4 When The suffix is ".S", the lower 16 bits of C, CTH and CTC are processed as "signed 16-bit BIN
data".
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the execution condition is ON, the zone control is performed in negative 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 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 .
Condition
Condition Value stored in D
S3 (Input value) = 0 0
* In D , the value is stored within the rang of signed 16-bit BIN data.
• D ≤ -32768 -> D = -32768
• D ≥ +32767 -> D = +32767 4
instructions
Data control
ZONE.L When the execution is ON, [ S1 / S1 +1] (negative offset), [ S2 / S2 +1]
(positive offset) and [ S3 / S3 +1] (input value) are used as signed 32-bit BIN data
to perform zone control, and the result is stored in [ D / D +1].
* In [ D / D +1], the value is stored within the rang of signed 32-bit BIN data.
• [ D / D +1] ≤ - 2147483648 -> [ D / D +1] = -2147483648
• [ D / D +1] ≥ + 2147483647 -> [ D / D +1] = +2147483647
@ZONE. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When the relay R000 is ON, the values (negative: -1000, positive: +500) used for performing limit
control for analog data stored in DM10000 are stored in DM0.
APR(.U)
APR.S
4 S1 S2 n D A P R S1 S2 n D
Execution condition
instructions
Data control
APR
S1 S2 n D @ A P R S1 S2 n D
Operand Explanation
S1 Specifies the input value of linear approximation or the leading device for storing the value. *1 *2 *4
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are processed.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is processed in 16/32/64 bits straddling the next channel.
*3 n is handled as unsigned 16-bit binary at all times regardless of the suffix.
When T, C, CTC or CTH has been specified, only the lower 16 bits are used.
*4 When specifying T, C, CTH, current value is processed. When using CTC, current value is
processed.
*5 Cannot be specified when the suffix is ".F" or ".DF".
*6 Z cannot be specified when the suffix is ".DF".
*7 EM and FM (ZF) cannot be used with the KV Nano Series.
*8 CTH and CTC cannot be used with the KV-7000 Series.
Point The APR.DF (@APR.DF) instruction can be used with KV-7000 Series CPU units that
have CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version" (Page 2)
Description of Operation
APR(.U) / APR.S
When the execution is ON, the approximation calculation is performed for the "input
value" of linear approximation stored in S1 according to "linear data list" of n
instructions
Data control
Index X Y
YP S2 0 0 10
Table start 1 8 13
(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 records
6 28 0
Y2-Y1
YP = (XP-X1)+Y1 (*n=7)
X2-X1
Please store data of X in ascending order
The X value in linear data list is set in ascending order. (X0<X1<…<Xk< …<Xn)
The linear data list is stored from the device No. specified by S2 (list start) according
to the order of (X0,Y0), (X1,Y1) ... (Xn-1,Yn-1),(Xn,Yn).
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 list. Additionally, n is set to 2 or more.
APR.D / APR.L
When the execution is ON, the approximation calculation is performed for the "input
value" of linear approximation stored in [ S1 / S1 +1] according to "linear data list"
of n logs starting from [ S2 / S2 +1].
When the linear approximation calculation is performed, find in which range of linear
data list [ S1 / 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 Index X Y
YP [ S2 / S2 +1 ] 0 0 10
Table start 1 8 13
instructions
Data control
(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 records
6 28 0
Y2-Y1
YP = (XP-X1)+Y1 (*n=7)
X2-X1
The linear data list is stored from the device No. specified by [ S2 / S2 +1].
(list start) according to the order of (X0,Y0), (X1,Y1)...(Xn-1,Yn-1),(Xn,Yn).
The X value in linear data list 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 list. Additionally, n is set to 2 or more.
APR.F When the execution is ON, the approximation calculation (single precision floating point
type) is performed for the "input value" of linear approximation stored in [ S1 /
S1 +1] according to "linear data list" of logs starting from [ S2 / S2 +1].
When the linear approximation calculation is performed, find in which range of linear
data list [ S1 / 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)
Index X Y
YP
4
[ S2 / S2 +1 ] 0 0 5.2
Table start 1 3.3 6.8
(X1,Y1)
2 5.7 13.9
instructions
Data control
(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 records
6 15.5 0
Y2-Y1
YP = (XP-X1)+Y1 (*n=7)
X2-X1
The linear data list is stored from the device No. specified by [ S2 / S2 +1].
(list start) according to the order of (X0,Y0), (X1,Y1)...(Xn-1,Yn-1),(Xn,Yn).
The X value in linear data list 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 list. Additionally, n is set to 2 or more.
APR.DF When the execution is ON, the approximation calculation (double precision floating point
type) is performed for the "input value" of linear approximation stored in [ S1 /
S1 +1/ S1 +2/ S1 +3] according to "linear data list" of logs starting from [ S2 /
S2 +1/ S2 +2/ S2 +3].
When the linear approximation calculation is performed, find in which range of linear
data list [ S1 / 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).
4 YP [ S2 / S2 +1/
Index
0
X
0
Y
5.2
S2 +2 / S2 +3 ] 1 3.3 6.8
instructions
Data control
X 5 12.2 2.1
XP (X6,Y6) Number of records
6 15.5 0
Y2-Y1
YP = (XP-X1)+Y1 (*n=7)
X2-X1
The linear data list is stored from the device No. specified by [ S2 / S2 +1/
S2 +2/ S2 +3].
(list start) according to the order of (X0,Y0), (X1,Y1)...(Xn-1,Yn-1),(Xn,Yn).
The X value in linear data list 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 list. Additionally, n is set to 2 or more.
@APR. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
instructions
Data control
CR2012
• ON when the result is outside the single precision floating point real number
Otherwise, OFF
APR.DF • ON when n <2, or n >32767.
• ON when the range of specified data list is inappropriate
• ON when the indirect specifying and index modification range are inappropriate
• ON when a value outside of the double precision floating point range is entered.
• ON when the result is outside of the double precision floating point type real
number range.
Otherwise, OFF
Sample Program
Index X Y
Table start DM0 0 0 -1000 DM1 2
DM2 1 255 1000 DM3
Number of records
4
instructions
Data control
R000 APR.S
CM1630 DM0 #2 DM100
Volume0 Tabel start Result after ar
ithmetic operation
MEMO
instructions
Data control
LIMIT
D - - - - *4
- - - - - - -
Operand Explanation
S1 Specifies the input value or the device storing the input value.*1 *2
S2 Specifies the change rate per time unit ( S3 ) or the device storing the change rate.*1 *3
S3 Specifies the time unit (0: second unit, 1: minute unit, 2: hour unit). *1
D Specifies the device for storing the output value. *2
*1 • When a bit device has been specified, 16 continuous bits are processed.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is processed in 16/32 bits straddling the next channel.
• When specifying CTH, current value is processed. When using CTC, current value is
processed.
• T, C, CTH and CTC process the low-order 16-bit.
*2 Handled as signed 16-bit BIN data.
*3 Handled as unsigned 16-bit data.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Description of Operation
RAMP When the execution conditions are 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).
When the output value is overwritten by an instruction other than the RAMP instruction,
the output approaches the input value at the specified inclination.
Execution ON
condition OFF
Value
S1
(input
value) 4
instructions
Data control
D
(output
value)
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-130)
Operation flag
Sample Program
1. When the internal relay MR0 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)
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
instructions
Data control
OFF
DM100
1000
250
200
Time
1 seconds
16 seconds
2. When the internal relay MR0 turns ON, the output value stored in data memory DM100 is changed
to the target value set with data memory DM200. When the output value increases, it changes at a
rate 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
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
DM100
DM200 #100 #0 DM100 RAMP DM200 #100 #0 DM100
4
instructions
Data control
ON
MR0
OFF
0 300 100
DM200
DM100
300
100
Time
6 seconds 2 seconds
LIMIT
*3
D - - - - - - - - - - -
Operand Explanation
Specifies the time to keep D ON, or the device storing the time.*1
S1
The specifiable range is 0 to 65535(ms).
Specifies the cycle to turn D ON/OFF, or the device storing the cycle.*1
S2
The specifiable range is 1 to 65535 (ms).
D Specifies the device to turn ON/OFF. *2
*1 • When a bit device has been specified, 16 continuous bits are processed.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is processed in 16/32 bits straddling the next channel.
• When specifying CTH, current value is processed. When using CTC, current value is
processed.
• T, C, CTH and CTC process the low-order 16-bit.
• Handled as unsigned 16-bit data.
*2 When a bit device is specified, it occupies one bit. When a word device is specified, the LSB of
one word is used as the output relay. The bits other than the LSB does not change.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Description of Operation
TPOUT While the execution conditions are ON, D (output relay) is turned ON for just S1
ms at the control cycle specified with S2 ms.
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
instructions
Data control
S2 ×1ms S2 ×1ms S2' ×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-130)
Operation flag
Sample Program
While the internal relay MR0 is ON, the output relay R500 turns ON and performs pulse output at a
1 second (1000ms) cycle for the ON time stored in data memory DM100.
(Mnemonics list)
MR000 TPOUT LD MR000
DM100 #1000 R500 TPOUT DM100 #1000 R500
ON
MR0
4
OFF
instructions
Data control
R500
MEMO
instructions
Data control
LIMIT
LLFLT
LLFLT Lead-lag Passes input through lead-lag filter
filter and then outputs.
*4
- - - - - - -
D2 - - - - - - - - - - -
instructions
Data control
Operand Explanation
S Specifies the filter input value, or the device storing that value.*1 *2
D1 Specifies the parameter, or the device storing that parameter. *3
D2 Specifies the device storing the filter output value. *1
*1 • When a bit device has been specified, 16 continuous bits are processed.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is processed in 16/32 bits straddling the next channel.
• Processes as signed 16-bit BIN data.
*2 • When specifying CTH, current value is processed. When using CTC, setting value is
processed.
• T, C, CTH and CTC process the low-order 16-bit.
*3 • If a bit device is specified, 48 continuous bits are occupied.
• Specify the channel’s leading device for the bit device.
• When a word device is specified, 3 continuous words are occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Description of Operation
LLFLT Description of Parameters
Device Description
Specifies the cycle time for executing the instruction. (1
D1 Sampling cycle (Ts) to 60000ms)
Specify a value smaller than the lag time and lead time.
Specifies the time constant for the lag element. (0 to
D1 +1 Lag time (T1) 65535ms)
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
instructions
Data control
When the execution conditions are ON, the lead-lag operation is executed for S (X:
input value) at each D1 (Ts: sampling cycle), and stored in D2 (Y: output value).
D2 (output value) is initialized with S (input value) at the rising edge of the
execution conditions.
When the following values are established,
the output value is calculated with the following formula.
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-130)
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 an interrupt program or initialization module.
• Caution is required when using in a subroutine program, between the STP to STE
instructions, between the STG to JMP/ENDS instructions or between the CJ (NCJ) to
LABEL instructions.
KV-7000 Series User's Manual "Precautions when using timer instructions"
KV-5500/5000/3000 Series User's Manual "Precautions when using timer instructions"
KV Nano Series User's Manual "Precautions when using timer instructions"
• Caution is required when using write during RUN.
KV-7000 Series User's Manual "About Write During RUN"
KV-5500/5000/3000 Series User's Manual "About Write During RUN"
KV Nano Series User's Manual "About Write During RUN"
Operation flag
Sample Program
While the internal relay MR0 is ON, a lead-lag filter having 1 second (1000ms) sampling cycle, 5
second (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
instructions
Data control
ADD
TBCD TBCD(.U)
TBCD.D
TBCD
To convert BIN data stored in
Transfer BCD internal registers to BCD
@TBCD @TBCD(.U)
@TBCD.D
TBCD data.
Execution condition
LDA TBCD STA @ T B C D
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion
Description of Operation
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
internal register 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
1234
BCD conversion
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
internal register 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
1 2 3 4
TBCD.D When the execution condition is ON, the 32-bit 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
internal register
0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
12345678
BCD conversion
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
internal register
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
1 2 3 4 5 6 7 8
@TBCD. Only one scan is executed at the rising edge of the execution conditions.
4-156 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions
Operation flag
Instructions
Data Conversion
Sample Program
When input relay R000 is on, the value of data memory DM0 is converted to BCD, and is outputted to
output relays R30500 to R30515.
(Mnemonics list)
R000 DM0 R30500
LDA TBCD STA LD R000
LDA DM0
CON
TBCD
CON
STA R30500
ADD
TBIN TBIN(.U)
TBIN.D
TBIN
To convert BCD data stored
Transfer BIN in internal registers to BIN
@TBIN @TBIN(.U)
@TBIN.D
TBIN
data.
Execution condition
LDA TBIN STA @ T B I N
4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify
MR DM EM
Instructions
Data Conversion
Description of Operation
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
internal register
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
1 2 3 4
BIN conversion
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
internal register
0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
1234
TBIN.D When the execution condition is ON, the 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 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 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
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
internal register
1 2 3 4 5 6 7 8
BIN conversion
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
internal register
12345678
@TBIN. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Data Conversion
Sample Program
When input relay R30100 is ON, the 4-bit BCD data captured by input relays R30000 to R30015 is
converted to BIN data, and the result is stored in data memory DM0.
(Mnemonics list)
R30100 R30000 DM0
LDA TBIN STA LD R30100
LDA R30000
CON
TBIN
CON
STA DM0
ADD
MPX MPX
Multiplex To decode number of 1-digit (4-bit) in
(4 ->16 decode) internal register to 16-bit BIN data.
@MPX MPX
DMX DMX
Demultiplex
To encode bit position of the MSB
whose 16-bit BIN data in the internal
(16 ->4 encode)
@DMX DMX register is "1" to a 4-bit value.
4 Execution condition
LDA DMX STA D M X
Execution condition
Instructions
Data Conversion
Operand Explanation
n Specifies the number of units to be connected.
Description of Operation
MPX When the execution condition is ON, Bit n of the 16-bit internal register is
binarized. The bit indicated by that value is turned ON ("1" 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
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
F E D C B A 9 8 7 6 5 4 3 2 1 0
@ Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Data Conversion
Sample Program
MPX When BIN digital switch one bit is connected to input relays R30004 to R30007, 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.
(Mnemonics list)
CR2002 R30000 #1 R30500
LDA MPX STA LD CR2002
LDA R30000
CON
MPX #1
When the digital switch is set to "8", output relay R30508 turns ON, CON
and lamp "8" lights. STA R30500
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
ADD
GRY GRY(.U)
GRY.D
GRY
Gray code
To convert the values
currently stored in
conversion internal registers to gray
@GRY @GRY(.U)
@GRY.D
GRY code.
RGRY RGRY(.U)
RGRY.D
RGRY
Gray code reverse
To convert the gray code
currently stored in
conversion internal registers to BIN
@RGRY @RGRY(.U)
@RGRY.D
RGRY data.
4
LDA GRY STA G R Y
Execution condition
LDA GRY STA @ G R Y
Instructions
Data Conversion
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.
@ Only one scan is executed at the rising edge of the execution conditions.
bit
Decimal
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
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
10 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
Instructions
Data Conversion
11 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
12 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
13 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1
14 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
65535 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Operation flag
Sample Program
The unsigned 16-bit BIN data currently stored in data memory DM0 is converted to gray code. The
result is stored in DM10.
(Mnemonics list)
CR2002 DM0 DM10
LDA GRY STA LD CR2002
LDA DM0
CON
GRY
CON
STA DM10
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 in DM0.
Instructions
Data Conversion
(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 and
m: 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
Resolution 360 remainder gray codes captured 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 GRY SUB STA LD CR2002
Always ON LDA R30000
CON
ANDA $01FF
CON
GRY
CON
SUB #76
CON
STA DM0
MEMO
Instructions
Data Conversion
KV-1000 KV Nano
into nibble
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
unit (4-bit)
ADD
4 KV-1000
Operand Explanation
S Specifies the device for storing the data to be dispersed.*1
D Specify the leading device for storing the dispersed data. *1
n Specify the number of dispersed data. (.U:0 to 4 .D: 0 to 8) *1 *2
*1 When a relay other than the leading relay (MR002, R1012 etc.) of the channel has been
specified, the relay is processed straddling the next channel.
*2 When the number is 0, the relay is not executed.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
DISN(.U) KV-1000 When the execution condition is ON, the content of the device (16-bits)
specified by S is dispersed to 4 digits bitwise (4-bits), and is stored in four
devices (16-bits) starting from D . "0" is stored in the upper 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-7500/7300/5500/5000/3000, KV Nano Series When performing above operation, but the bits
stored after splitted by n can be used.
4-166 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions
DISN.D KV-1000 When the execution condition is ON, the content of the device (32 bits)
specified by S is dispersed to 8 digits bitwise (4-bits), and is stored in
eight devices (16-bits) starting from D . "0" is stored in the upper 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
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
:
4
0 0 0 4 D +4
0 0 0 3 : D +5
0 0 0 2 : D +6
Instructions
Data Conversion
0 0 0 1 : D +7
@DISN. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
■ KV-1000
When input R000 is ON, the 4-bit BCD data currently stored in data memory DM0 is dispersed bitwise
in nibble unit. The result is stored in four words starting from DM10.
(Mnemonics list)
R000 DISN
DM0 DM10 LD R000
DISN DM0 DM10
ADD
@UNIN data.
@UNIN(.U) UNIN
@UNIN.D
4 KV-1000
Operand Explanation
S Specifies the device for storing the data to be united. *1
D Specifies the device to store the united data to. *1
n Specify the number of united data. (.U:0 to 4 .D:0 to 8) *1 *2
*1 When a relay other than the leading relay (MR002, R1012 etc.) of the channel has been
specified, the relay is processed straddling the next channel.
*2 When 0, the relay is not executed.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
UNIN(.U) KV-1000 When the execution condition is ON, the lower 4-bits of the four word devices
(16-bits) starting from the device specified by S are united into 16-bit BIN
data, and are stored in the device specified by D .
bit bit bit
15 4 0
S : 1
S +1 : 2
S +2 : 3
S +3 : 4
D : 4 3 2 1
UNIN.D KV-1000 When the execution condition is ON, the lower 4-bits of the eight word devices
(16-bits) starting from the device specified by S are united into 32-bit BIN
data, and are stored in the device specified by D .
bit bit bit bit bit
15 8 7 4 0
S : 1
S +1 : 2
S +2 : 3
S +3 : 4
S +4 : 5
S +5 : 6
S +6 : 7
4
S +7 : 8
D +1 : 8 7 6 5 4 3 2 1 : D
Instructions
Data Conversion
KV-7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits stored
after splitted by n can be united.
@UNIN. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
■ KV-1000
When input relay R000 is ON, the BCD data currently stored in the lower 4-bits of data memories DM0
to DM3 are united. The result is stored in DM10.
(Mnemonics list)
R000 UNIN
DM0 DM10 LD R000
UNIN DM0 DM10
ADD
4 KV-1000
Operand Explanation
S Specifies the device for storing the data to be dispersed.*1
D Specify the leading device for storing the dispersed data. *1
n Specify the number of dispersed data. (.U:0 to 2, .D: 0 to 4) *1 *2
*1 When a relay other than the leading relay (MR002, R1012 etc.) of the channel has been
specified, the relay is processed straddling the next channel.
*2 When the number is 0, the relay is not executed.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
DISB(.U) KV-1000 When the execution condition is ON, the content of the device (16-bits) specified by
S is dispersed to 2 digits bitwise (8-bits), and is stored in two devices (16-bits)
starting from the device specified by D . "0" is stored in the upper 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-7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits stored
after splitted by n can be united.
4-170 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions
DISB.D KV-1000 When the execution condition is ON, the content of the device (32 bits)
specified by S is dispersed to 4 digits bitwise (8-bits), and is stored in four
devices (16-bits) starting from D . "0" is stored in the upper 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
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
4
Filled with 0
in higher bytes (8-bits).
KV-7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits stored
Instructions
Data Conversion
after splitted by n can be united.
@DISB. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
■ KV-1000
The data captured from input relays R30000 to R30015 is dispersed into byte units, and stored in data
memories DM10 and DM11.
(Mnemonics list)
CR2002 DISB
R30000 DM10 LD CR2002
DISB R30000 DM10
ADD
4 KV-1000
Operand Explanation
S Specifies the device for storing the data to be united. *1
D Specifies the device to store the united data to. *1
n Specify the number of united data. (.U:0 to 2 .D:0 to 4) *1 *2
*1 When a relay other than the leading relay (MR002, R1012 etc.) of the channel has been
specified, the relay is processed straddling the next channel.
*2 When the number is 0, the relay is not executed.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
UNIB(.U) KV-1000 When the execution condition is ON, the lower 8-bits of the two word devices
(16-bits) starting from the device specified by S are united into 16-bit BIN
data, and are stored in the device specified by D .
bit bit bit bit
15 8 7 0
S : 3 4
S +1 : 1 2
D : 1 2 3 4
KV-7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits stored
after splitted by n can be united.
UNIB.D KV-1000 When the execution condition is ON, the lower 8-bits of the four word devices
(16-bits) starting from the device specified by S are united into 32-bit BIN
data, and are stored in the device specified by D .
bit bit bit bit
15 8 7 0
S : 7 8
S +1 : 5 6
S +2 : 3 4
S +3 : 1 2
D +1 :
bit
31
1 2
bit
24
bit
23
3 4
bit
16
bit
15
5 6
bit
8
bit
7
7 8
bit
0
: D
4
When performing above operation, but the bits
Instructions
Data Conversion
KV-7500/7300/5500/5000/3000, KV Nano Series
@UNIB. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
■ KV-1000
The 4-bit BCD data captured by input relays R30000 to R30007 (lower 2 bits after uniting) and R30100
to R30107 (upper 2 bits after uniting) are united, and are stored in data memories DM10.
(Mnemonics list)
CR2002 UNIB
R30000 DM10 LD CR2002
UNIB R30000 DM10
ADD
SWAP SWAP(.U)
SWAP.D
SWAP
To swap the upper and lower
Swap
data of the internal register.
@SWAP @SWAP(.U)
@SWAP.D
SWAP
Execution condition
LDA SWAP STA @ S W A P
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion
Description of Operation
SWAP(.U) When the execution condition is ON, the values of the upper byte (upper 8-bits) and
lower byte (lower 8-bits) of the 16-bit data currently stored in 16-bit internal register are
swapped, and stored in 16-bit internal register.
SWAP.D When the execution condition is ON, the values of the upper word (upper 16-bits) and
lower word (lower 16-bits) of the 32-bit data currently stored in 32-bit internal register are
swapped, and stored in 32-bit internal register.
@SWAP. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When input relay R000 is ON, the upper and lower bytes of data memory DM0 are swapped, and
stored in DM10.
(Mnemonics list)
R000 DM0 DM10
LDA SWAP STA LD R000
LDA DM0
CON
SWAP
CON
STA DM10
Instructions
Data Conversion
BSWAP
BSWAP
BSWAP
The high-order byte and low-order
Block swap byte of data in a specified range
@BSWAP are swapped.
BSWAP
Operand Explanation
D Specifies the leading device of the data block in which the high-order byte and low-order byte are swapped. *1
n Specifies the range of data to be swapped. *1
Point This instruction can be used with KV-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 2)
Description of Operation
BSWAP When the execution conditions are ON, the high-order byte (high-order 8 bits) and low-
order byte (low-order 8 bits) of the n items of data leading with 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 Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Data Conversion
"CR/CM List" (Page A-71)
Sample Program
When the input relay R000 is ON, the high-order bytes and low-order bytes of data memory DM0 to
DM99 are swapped.
(Mnemonics list)
R000 BSWAP LD R000
DM0 #100 BSWAP DM0 #100
XCH
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion
*1 When a bit device has been specified, 16/32 continuous bits are processed.
When a relay other than the leading relay (MR002, R1012 etc.) of the channel has been
specified, the relay is processed straddling the next channel.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
Description of Operation
XCH(.U) When the execution condition is ON, the 16-bit data currently stored in the devices
specified by 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 16-bit data currently stored in the devices
specified by [ D1 / D1 +1] and [ D2 / D2 +1] are exchanged.
Example When the execution condition is ON, the 32-bit data currently stored in the
devices specified by [ 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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Data Conversion
Sample Program
When input relay R000 is ON, the unsigned 16-bit BIN data currently stored in data memories DM0 to
DM9 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
To decode the numbers of the lower n
DECO
bits of the internal register to
8-bit decode
2n bit BIN data.
@DECO DECO
(n = 1 to 8)
Execution condition D
LDA DECO @ D E C O D n
n
Operand Explanation
D Specifies the leading device for storing the decode result.*1
n Specifies the number of bits (8-bits) to decode. *2
*1 When a word device has been specified, the LSB of continuous 2n number of word devices
becomes the destination storage device of decode result.
*2 If a bit device is specified, 16 continuous bits are occupied. When a word device is specified, 1
word is occupied.
*3 This instruction can be used with KV-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 2)
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
DECO When the execution condition is ON, the lower n bits of the internal register are
decoded. (From here on, the decoded DEC value is set to "K".)
In the continuous 2n number of devices, the [K + Leading No.] device starting from
D is turned ON ("1" is stored). Other devices 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 Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Data Conversion
KV-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-71)
Sample Program
When BIN digital switch one bit is connected to input relays R30000 to R30003, and lamps 0 to 15 are
connected to output relays R30500 to R30515 respectively.
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 of specified
continuous n number of bit devices to an
@ENCO ENCO 8-bit value.
Execution condition S
ENCO STA @ E N C O S n
n
Operand Explanation
S Specifies the leading device for storing encode object. *1
n Specifies the number of bits (1 to 256) to encode. *2
*1 When a word device has been specified, the LSB of continuous n word devices becomes
the encode object.
*2 If a bit device is specified, 16 continuous bits are occupied. When a word device is specified,
1 word is occupied
*3 This instruction can only be specified with KV-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 2)
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
ENCO When the execution condition is ON, in continuous n devices starting from S ,
the positions of ON ("1") devices are stored in 16-bit internal register as BIN data.
When a multiple number of n devices is ON ("1"), the device having the smallest
device No. is the valid device.
The value of 0 to [ n -1] is stored in the 16-bit internal register.
@ENCO Only one scan is executed at the rising edge of the execution conditions.
4-182 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions
Operation flag
Instructions
Data Conversion
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List" (Page A-71)
Sample Program
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, the multiple sensors are not turned ON at the same time.
When sensor "8" is ON, the BIN display indicates "8".
(Mnemonics list)
CR2002 R30000 R30500
ENCO STA LD CR2002
#16 ENCO R30000 #16
CON
STA R30500
ABS
ABS(.S)
ABS ABS.L
ABS.F
ABS
ABS.DF Absolute
Retrieves the absolute value.
@ABS(.S)
value
@ABS @ABS.L
@ABS.F
ABS
@ABS.DF
Execution condition
4
LDA ABS STA @ A B S
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
Point This instruction can be used with KV-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 2)
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
bit bit
15 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1
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.
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 1 0 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 1 0
ABS.F When the execution conditions turn ON, if the single precision floating point type real 4
number stored in the 32-bit internal register is less than 0, the sign is reversed and the
Instructions
Data Conversion
value is stored in the internal register.
This is not executed if the value stored in the internal register is greater than 0.
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.
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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
CPMSET
CPMSET CPMSET
CIP message Creates the data sent with
creation CIP messaging.
@CPMSET CPMSET
4 Bit Devices
Available Devices
Word Devices
( ): Not supported on the KV-1000
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - *3 - - - - - - -
S2 - - - - *3 *4 *4 -
D - - - - *3 - - - - - - -
Operand Explanation
S1 Specifies the leading device of the additional send data. *1
S2 Specifies the type or size (byte unit) of the additional send data, or the device storing that information. *2
D Specifies the leading device of the CIP data type send data to be created. *1
Point This instruction can be used with KV-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 2)
Description of Operation
CPMSET When the execution conditions are ON, the data stored in S1 is added to the area
following the data size (byte unit) stored in D +0 in the data type specified with the
high-order 4bits of S2 and the data size (byte unit) specified with the low-order
12 bits of S2 .
The D +0 data size 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.
Refer to the "EtherNet/IP Function User's Manual" for details on the CIP data types.
bit bit
15 0
S2
Data type Data size (byte unit)
2 or more: Reserved
data following NULL(00H).
-
4
for system
Instructions
Data Conversion
Example The operation of the CPMSET instruction is explained using creation of the following type
of CIP data type send data as an example.
Send data to be created
bit bit
15 0
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
of low-order byte to high-order byte.
33H E(45H)
55H 44H 4-byte numeric data 66554433H
The numeric data is stored in the order
66H
of low-order byte to high-order byte.
Example 2) Convert text string "ABCDE" into CIP text string type data, and add. In this
example, the data is added after the Example 1) 2-byte numeric data.
Specify 1000H (text string) * for 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 with D created in
Example 1). The added data size (byte unit) 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.
CIP message created in Example 1)
bit bit
4
15 0
2(0002H) D +0
Specifies text string
bit bit 22H 11H D +1
Instructions
Data Conversion
15 0 S2 1000H
D +2
S1 +0 A(41H) B(42H)
S1 +1 C(43H) D(44H) Add data size
S1 +2 E(45H) NULL(00H) bit bit
15 0
Text string 9(2→9) D +0
Text string up to NULL(00H) is data size 22H 11H D +1
converted into CIP text string type data 5(0005H) D +2
and added. B(42H) A(41H) D +4
D(44H) C(43H) D +5
E(45H) D +6
D +7
Example 3) 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 with D created in Example 2). The added data size
(byte unit) 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 of
bytes is stored. If the text string contains NULL(00H), 00H is added to the characters
following NULL(00H). The specified number of characters is added to D +0.
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
① A(41H) ② B(42H) Low-order bytes Data size (byte unit)
S1 +0 of character size 3->21 D +0
High-order bytes
4
S1 +1 ③ C(43H) NUL(00H) of character size D +1
Instructions
Data Conversion
S1 +3 ② B(42H) of character size D +3
S1 +6
@CPMSET Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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.
(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
Instructions
Data Conversion
“ABCD” @DM0
CPMSET
@DM0 $1000 DM0
MOV.D
#1234567890 @DM0
CPMSET
@DM0 #4 DM0
MEMO
Instructions
Data Conversion
CPMSET
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion
Operand Explanation
S1 Specifies the leading device of data received as CIP data type. *1
Specifies the type or size (byte unit) of data to be retrieved, or the parameter storing that
S2
information. *2
Specifies the device which stores the byte offset position from the start of the receive data
D1
specifying the retrieve position. *1
Point This instruction can be used with KV-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 2)
Description of Operation
CPMGET When the execution conditions turn ON, the data following the byte offset position, specified
with D1 of the data stored after S1 is stored in D2 with the data type specified
with the high-order 4 bits of S2 and the data size [byte unit] specified with the low-order
12 bits of S2 . After storing the data, the D1 byte offset position is updated.
When retrieving from the head 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.
Refer to the "EtherNet/IP Function User's Manual" for details on the CIP data types.
bit bit
15 0
S2
Data type Data size (byte unit)
Instructions
Data Conversion
2 or more: Reserved –
for system
Example The usage of the CPMGET instruction is explained using the following received data as
an example.
Received data
bit bit
15 0
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 55H 44H
S1 +7 66H 4-byte numeric data 66554433H
Example 2) Read the CIP text string type data following offset position 2.
Specify 2 (offset position 2) in D1 and 1000H (text string) in S2 , and
execute the CPMGET instruction.
If 0 is specified in the low-order 12 bits of S2 , the text string having the
size specified with offset position is read out.
4 S1
S1
+1
+2
22H
5(0005H)
11H
Instructions
Data Conversion
If the size of the S1 text string is larger than the character size specified
with the low-order 12 bits of S2 , the character size specified with the
low-order 12 bits of S2 is retrieved.
The character size specified with the low-order 12 bits of S2 and two
bytes are added to D1 .
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
S1 +4 D(44H) C(43H) S2 0004H
S1 +5 33H E(45H)
S1 +6 55H 44H D1 13(9+4)
@CPMGET Only one scan is executed at the rising edge of the execution conditions.
Operation flag
CR2012
• When the high-order 4 bits of S2 are 0 (not text string), and the low-order 12 bits of S2
are 0 4
• When the high-order 4 bits of S2 are 2 or more
Instructions
Data Conversion
• When D1 before execution is larger than the data size specified with S1 +0
• When D1 after execution exceeds the data size specified with S1 +0
• When the indirect specification or index modification range is inappropriate
• When exceeding the D device end when storing the result in the D2 device after execution
• When timer or counter is indirectly specified for S1 , D2
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 FLOAT.S
FLOAT.D
FLOAT
Integer to To convert data of internal
FLOAT.L single precision registers to single
floating point precision floating point
@FLOAT(.U)
conversion type real number.
@FLOAT @FLOAT.S
@FLOAT.D
FLOAT
@FLOAT.L
Execution condition
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
Description of Operation
FLOAT(.U) When the execution condition is ON, the unsigned 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
bit
15
16-bit internal register bit
0
bit
31 32-bit internal register bit
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
bit
15
16-bit internal register bit0 bit
31 32-bit internal register bit
0
Signed 16-bit BIN data Single precision floating point type real number
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
31
32-bit internal register bit
0
bit
31
32-bit internal register bit
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 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.
Signed 32-bit BIN data Single precision floating point type real number
32-bit 32-bit
@FLOAT. Only one scan is executed at the rising edge of the execution conditions.
4-196 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions
Point The precision of single precision floating point type point real numbers is 32-bit, the
significant digit is 24-bit.
When the integer value exceeds the range of -16777216 to 16777215 (24-bit BIN), the
25th bit afterward is rounded.
Operation flag
Instructions
Floating Point
Sample Program
The unsigned 16-bit BIN data currently stored in data memory DM0 is converted to a single precision
floating point type real number, and the result is stored in "DM10/DM11".
(Mnemonics list)
CR2002 DM0 DM10
LDA FLOAT STA.F LD CR2002
LDA DM0
CON
FLOAT
CON
STA.F DM10
DFLOAT(.U)
DFLOAT DFLOAT.S
DFLOAT.D
DFLOAT Integer to
double
To convert data of
DFLOAT.L internal registers to
precision
double precision floating
@DFLOAT(.U) floating point
point type real number.
@DFLOAT @DFLOAT.S
@DFLOAT.D
DFLOAT conversion
@DFLOAT.L
Execution condition
Point This instruction can be used with KV-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 2)
Description of Operation
DFLOAT(.U) When the execution condition is ON, the unsigned 16-bit BIN data currently stored in the
16-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 the
16-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 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
Signed 32-bit BIN data Double precision floating point type real number
32-bit 64-bit
@DFLOAT.Only one scan is executed at the rising edge of the execution conditions.
Operation flag 4
CR2009 No change in state
Instructions
Floating Point
CR2010 No change in state
CR2011 No change in state
CR2012 No change in state
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
FLOAT
INTG(.U)
INTG INTG.S
INTG.D
INTG Single
precision
The single precision floating
INTG.L point type data in the internal
floating point
register is converted to binary
@INTG(.U) to integer
data.
@INTG @INTG.S
@INTG.D
INTG conversion
@INTG.L
Execution condition
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
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
31 32-bit internal register bit
0
bit
15
16-bit internal register bit
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
31
32-bit internal register bit
0
bit
15 16-bit internal register bit
0
Single precision floating point type real number Signed 16-bit BIN data
32-bit 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.
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.
Before executing After executing
bit
31
32-bit internal register bit
0
bit
31
32-bit internal register bit
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
Instructions
Floating Point
value as decimal part of the single precision floating point type real number are
discarded before conversion.
Before executing After executing
bit
31
32-bit internal register bit
0
bit
31
32-bit internal register bit
0
Single precision floating point type real number Signed 32-bit BIN data
32-bit 32-bit
@INTG. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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.
Signed 16-bit BIN data is stored in DM20.
Unsigned 32-bit BIN data is stored in "DM30/DM31".
Signed 32-bit BIN data is stored in "DM40/DM41".
(Mnemonics list)
CR2002 DM0 DM10
LDA.F INTG STA LD CR2002
4 DM0 DM20
MPS
LDA.F DM0
CON
LDA.F INTG.S STA.S INTG
Instructions
Floating Point
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
Instructions
Floating Point
DFLOA
DINTG(.U)
DINTG DINTG.S
DINTG.D
DINTG Double
precision
The double precision floating
DINTG.L point type data in the internal
floating point
register is converted to binary
@DINTG(.U) to integer
data.
@DINTG @DINTG.S
@DINTG.D
DINTG conversion
@DINTG.L
Execution condition
Available Devices
Instructions
Floating Point
Point • This instruction can be used with KV-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 2)
• Refer to "INTG instruction" 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 register
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 register
bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 15 0
Signed
Double precision floating point type real number 16-bit BIN data
4
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.
Instructions
Floating Point
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.
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
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.
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.
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 Signed 32-bit BIN data
64-bit 32-bit
@DINTG. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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.
Signed 16-bit BIN data is stored in DM20.
Unsigned 32-bit BIN data is stored in "DM30/DM31".
Signed 32-bit BIN data is stored in "DM40/DM41".
(Mnemonics list)
CR2002 DM0 DM10
LD CR2002
4
LDA.DF DINTG STA
MPS
LDA.DF DM0
CON
DINTG
Instructions
Floating Point
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
Instructions
Floating Point
DFTOF
The double precision floating
DFTOF DFTOF Double precision
point data in the internal
to single
register is converted into a
precision floating
@DFTOF @DFTOF DFTOF
point conversion
single precision floating point
type real number.
Execution condition
LDA.DF DFTOF STA.F @ D F T O F
Point This instruction can be used with KV-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 2)
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 31 16 15 0
Double precision floating point type real number Single precision floating point
type real number
64-bit 32-bit
@DFTOF Only one scan is executed at the rising edge of the execution conditions.
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
Instructions
Floating Point
"CR/CM List" (Page A-71)
Sample Program
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)
CR2002 DM0 DM10
LDA.DF DFTOF STA.F LD CR2002
LDA.DF DM0
CON
DFTOF
CON
STA.F DM10
FTODF
The single precision floating
FTODF FTODF Single precision
point data in the internal
to double
register is converted into a
precision floating
@FTODF @FTODF FTODF
point conversion
double precision floating
point type real number.
Execution condition
LDA.F FTODF STA.DF @ F T O D F
4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Floating Point
Point This instruction can be used with KV-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 2)
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
31 16 15 0 63 48 47 32 31 16 15 0
Single precision floating point Double precision floating point type real number
type real number
32-bit 64-bit
@FTODF Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Floating Point
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
To disperse a single
DISF
DISF
Disperse F precision floating point
(Disperse mantissa/ type real number into a
exponent of single mantissa and exponent,
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *4 - - - - - -
D1 - - - - *4 - - - - -
D2 - - - - *4 - - - - -
Operand Explanation
S Specifies the leading device for storing the dispersed data.*1 *2
D1 Specifies the leading device for storing the mantissa. *1
D2 Specifies the device for storing the exponent.*3
*1 When a bit device has been specified, 32 continuous bits are processed. When a relay other
than the leading relay (MR002, R1012 etc.) of the channel has been specified, the relay is
processed straddling the next channel.
When a word device has been specified, continuous two words are occupied.
*2 The constant setting range is the range of single precision floating point type real number.
*3 When a bit device has been specified, 16 continuous bits are processed. When a relay other
than the leading relay (MR002, R1012 etc.) of the channel has been specified, the relay is
processed straddling the next channel.
When a word device has been specified, continuous one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
Point Refer to "INTG instruction" for details on the range of the single 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 Only one scan is executed at the rising edge of the execution conditions.
Point When the single precision floating point type real number (BIN) is converted to mantissa
part (DEC) and and exponent part (DEC), error occurs sometimes in DISF instruction.
Operation flag
Instructions
Floating Point
KV-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-71)
Sample Program
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.
(Mnemonics list)
R000 DISF
DM0 DM10 DM12 LD R000
DISF DM0 DM10 DM12
DM11 DM10
Mantissa: -5678900
32-bit
DM1 DM0 (2 words)
-5.6789E10 Separate
DM12
Exponent: +4
16-bits
(1 word)
4
Available Devices ( ): Not supported on the KV-1000
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
Instructions
Floating Point
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - *3 *4 *4 - -
S2 - - - - *3 *4 *4 - -
D - - - - *3 - - - - - - -
Operand Explanation
S1 Specifies the leading word device for storing the mantissa. *1
S2 Specifies the device for storing the exponent. *2
D Specifies the leading device for storing the single precision floating point type real number made by uniting S1 and S2 . *1
*1 When a bit device has been specified, 32 continuous bits are processed. When a relay other
than the leading relay (MR002, R1012 etc.) of the channel has been specified, the relay is
processed straddling the next channel.
When a word device has been specified, continuous two words are occupied.
*2 When a bit device has been specified, 16 continuous bits are processed. When a relay other
than the leading relay (MR002, R1012 etc.) of the channel has been specified, the relay is
processed straddling the next channel.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Point Refer to "INTG instruction" for details on the range of the single 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)
Exponent: Signed 16-bit BIN data
16-bit
(1 word)
@UNIF Only one scan is executed at the rising edge of the execution conditions.
Point • This program will not operated correctly when T or C is indirectly specified by D .
• When mantissa part (DEC) and and exponent part (DEC) are converted to single
precision floating point type real number (BIN), error occurs sometimes in UNI
instruction.
Operation flag
Instructions
Floating Point
* The instruction is not executed when CR2012 turns ON.
KV-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-71)
Sample Program
When input relay R000 is ON, the single precision floating point type real number is stored in "DM0/
DM1". This floating real number takes the signed 32-bit BIN data currently stored in data memories
"DM10/DM11" as its mantissa, and the signed16-bit BIN data currently stored in DM12 as its exponent.
(Mnemonics list)
R000 UNIF
DM0 DM2 DM10 LD R000
UNIF DM0 DM2 DM10
DM1 DM0
+987654
Mantissa:
32-bit
(2 words)
DM11 DM10
+9.87654E10
DM2 32-bit
(2 words)
Exponent: +5
16-bit
(1 word)
DISF
@LOG @LOG(.F)
@LOG.DF
LOG
operation real number stored in the
internal register is obtained.
4 Execution condition
LDA.F EXP STA.F E X P
Instructions
Floating Point
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 the "INTG instruction" for details on the single precision floating point type
real number and double precision floating point type real number range.
• The EXP.DF instruction and LOG.DF instruction can be used with KV-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 2)
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 in the 32-bit internal register as a single
precision floating point type real number.
The operation is performed taking e = 2.718282
e( )
Single precision floating point type real number Single precision floating point type real number
32-bit 32-bit
Reference For common logarithm operation, EXP(.F) will be executed after storing the
value obtained by splitting exponent by 0.434294 in internal 32-bit 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 as the exponent. The operation result is stored in the 64-bit internal register as a
double precision floating point type real number.
The operation is performed taking e = 2.718281828459045.
e( )
Double precision floating point type real number Double precision floating point type real number
64-bit 64-bit
Reference For common logarithm operation, EXP.DF will be executed after storing the
value obtained by splitting exponent by 0.434294481903252 in internal 64-
bit register. 4
LOG(.F) When the execution condition is ON, the logarithm of the single precision floating point
Instructions
Floating Point
type real number currently stored in the 32-bit internal register is calculated. The
operation result is stored in the 32-bit internal register as a single precision floating point
type real number.
Loge ( Single precision floating point type real number ) Single precision floating point type real number
32-bit 32-bit
LOG.DF When the execution condition is ON, the logarithm of the double precision floating point
type real number currently stored in the 64-bit internal register is calculated. The
operation result is stored in the 64-bit internal register as a double precision floating
point type real number.
64-bit internal register 64-bit internal register
Loge ( Double precision floating point type real number ) Double precision floating point type real number
64-bit 64-bit
@ Only one scan is executed at the rising edge of the execution conditions.
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
The flag is ON in the following instances. 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
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 result is stored in "DM10/
DM11".
(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 result is stored in "DM10/DM11".
Instructions
Floating Point
(Mnemonics list)
R000 DM0 DM10
LDA.F LOG STA.F LD R000
LDA.F DM0
CON
LOG
CON
STA.F DM10
MEMO
Instructions
Floating Point
LOG10
@LOG10 @LOG10(.F)
@LOG10.DF
LOG10
double precision floating point
type real number stored in the
64-bit register is obtained.
Execution condition
LDA.F LOG10 STA.F @ L O G 1 0
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
Point • This instruction can be used with KV-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 2)
• Refer to the "INTG instruction" 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 results are stored in the 32-bit internal register as the 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 results are stored in the 64-bit internal register as the double precision floating
point type real number.
64-bit internal register 64-bit internal register
Log10 ( Double precision floating point type real number ) Double precision floating point type real number
64-bit 64-bit
@LOG10. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Floating Point
Sample Program
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)
R000 DM0 DM10
LDA.F LOG10 STA.F LD R000
LDA.F DM0
CON
LOG10
CON
STA.F DM10
DISF
@RAD @RAD(.F)
@RAD.DF
RAD
stored in the internal register is
converted to radians.
The angle (radians) unit of the
DEG DEG(.F)
DEG.DF
DEG
(single precision/double precision)
Degree floating point type real number
@DEG @DEG(.F)
@DEG.DF
DEG
currently stored in the internal
register is converted to degrees (°).
4
LDA.F RAD STA.F R A D
Execution condition
LDA.F RAD STA.F
Instructions
Floating Point
@ 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 the "INTG instruction" for details on the single precision floating point type
real number and double precision floating point type real number range.
• The RAD.DF instruction and DEG.DF instruction can be used with KV-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 2)
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 in 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 in the 64-bit internal register as a double precision floating
point type real number.
64-bit internal register 64-bit internal register
Double precision floating point type real number Double precision floating point type real number 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
to degrees (°). The operation result is stored in 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
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 in the 64-bit internal register as a double
precision floating point type real number. 4
64-bit internal register 64-bit internal register
Instructions
Floating Point
Double precision floating point type real number rad Double precision floating point type real number
64-bit 64-bit
@ Only one scan is executed at the rising edge of the execution conditions.
π 180
1° = ≒ 0.01745(rad), 1(rad) = ≒ 57.23°
180 π
Operation flag
Sample Program
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.
(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/M1" is converted to degrees (°).
Instructions
Floating Point
The result is stored in "DM10/M11" 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
Instructions
Floating Point
SIN
(radians)
SIN(.F)
SIN.DF
SIN the angle (radian unit) of the
Sine (single precision/double
precision) floating point type real
@SIN @SIN(.F)
@SIN.DF
SIN number stored in the internal
register.
Obtains the cosine (cos) value of
COS COS(.F)
COS.DF
COS the angle (radian unit) of the
(single precision/double
Cosine precision) floating point type real
@COS @COS(.F)
@COS.DF
COS number stored in the internal
register.
Obtains the tangent (tan) value
TAN TAN(.F)
TAN.DF
TAN of the angle (radian unit) of the
(single precision/double
Tangent precision) floating point type real
4 @TAN @TAN(.F)
@TAN.DF
TAN number stored in the internal
register.
Instructions
Floating Point
Execution condition
LDA.F SIN STA.F @ S I N
Execution condition
LDA.F COS STA.F C O S
Execution condition
LDA.F COS STA.F @ C O S
Execution condition
LDA.F TAN STA.F T A N
Execution condition
LDA.F TAN STA.F @ T A N
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.23E-308
N=0
+2.23E-308 ≤ N ≤ +9.01E+15
(effective number of digits: approx. 16)
• The SIN.DF instruction, COS.DF instruction and TAN.DF instruction can be used with
KV-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 2)
π 3π π 3π
• With TAN, ideally TAN ( )=+∞, TAN ( )=-∞, but due to the operation, and are rounded
2 2 2 2
π 3π
values, so a value range which exceeds either TAN ( ) or TAN ( ) cannot be handled.
2 2
Description of 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 in the 32-bit internal register is calculated. The operation result is stored in 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
TAN
4
32-bit 32-bit
Instructions
Floating Point
When the execution condition is ON, the sine (sin), cosine (cos) and tangent (tan) value
of the angle (radians) of the double precision floating point type real number currently
stored in the 64-bit internal register is calculated. The operation result is stored in the 64-
bit internal register as a double precision floating point type real number.
COS ( Double precision floating point type real number ) Double precision floating point type real number
@ Only one scan is executed at the rising edge of the execution conditions.
π 180
1° = ≒ 0.01745(rad), 1(rad)= ≒ 57.23°
180 π
Operation flag
Sample Program
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".
(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
Instructions
Floating Point
KV-1000 KV Nano
(radians)
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
from the sine
(sin) value
DISFOS,ATAN ACOS Calculates
the angle
(radians)
from the
ASIN
cosine (cos)
value
Arc sine
value
@ACOS @ACOS(.F)
@ACOS.DF
ACOS
currently stored in 32-bit
internal register.
ATAN ATAN(.F)
ATAN.DF
ATAN
Arc
To calculate the angle (radians)
from tangent (tan) of the floating
tangent real number currently stored in
4 @ATAN @ATAN(.F)
@ATAN.DF
ATAN 32-bit internal register.
Instructions
Floating Point
Execution condition
LDA.F ASIN STA.F @ A S I N
Execution condition
LDA.F ACOS STA.F A C O S
Execution condition
LDA.F ACOS STA.F @ A C O S
Execution condition
LDA.F ATAN STA.F A T A N
Execution condition
LDA.F ATAN STA.F @ A T A N
Point • Refer to the "INTG instruction" for details on the single precision floating point type
real number and double precision floating point type real number range.
• The ASIN.DF instruction, ACOS.DF instruction, and ATAN.DF instruction can be used
with KV-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 2)
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 in the 32-bit internal register as a single precision floating point type real number.
-
ASIN 1 32-bit internal register 32-bit internal register
ACOS-1 ( Single precision floating point typereal number ) Single precision floating point typereal number
-
ATAN 32-bit 32-bit
@ Only one scan is executed at the rising edge of the execution conditions.
1° =
π
≒ 0.01745(rad), 1(rad)=
180
≒ 57.23°
4
180 π
Instructions
Floating Point
Operation flag
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
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-231
ATAN2Calculates the
a
n
(
r
a
ATAN2
d
@ATAN2 @ATAN2(.F) t
@ATAN2.DF c
o
o
r
d
i
n
a
Execution condition S1
X
,
Y
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
Available Devices
Index
Local Modify
4
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R DR LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM 㸨 @ : #/ : Z
Instructions
Floating Point
B W ZF
S1 - - - - - - - - - -
S2 - - - - - - - - - -
Operand 説 明
S1 Specifies the Y coordinate of the target point, or the leading device in which it is stored.*1
S2 Specifies the X coordinate of the target point, or the leading device in which it is stored.*1
*1 When a bit device has been specified, 32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 32/64 bits straddling the next channel.
Point • Refer to the "INTG instruction" 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 with KV-7000 Series CPU units that have CPU
function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version" (Page 2)
Description of Operation
ATAN2(.F) When the execution condition is ON, the angle (radians) on the single precision floating
point type real number X axis is calculated from the single precision floating point type
real number Y coordinate specified with [ S1 / S1 +1] and the single precision
floating point type real number X coordinate 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) on the double precision floating
point type real number X axis is calculated from the double precision floating point type
real number Y coordinate specified with [ S1 / S1 +1/ S1 +2/ S1 +3] and the
double precision floating point type real number X coordinate specified with [ S2 /
S2 +1/ S2 +2/ S2 +3]. The operation result is stored in the 64-bit internal register.
@ Only one scan is executed at the rising edge of the execution conditions.
Reference The ATAN instruction uses the TAN value to find the angle up to -π/2(rad)< θ < π/2(rad).
The ATAN2 instruction uses coordinates (S2, S1) to find the angle up to -π(rad)< θ ≦
4
π(rad).
Instructions
Floating Point
Y
S1
θ
S2 X
π 180
1° = ≒ 0.01745 (rad), 1 (rad) = ≒ 57.23°
180 π
When S1=0 and S2≧0, θ=0°=0 (rad).
When S1=0 and S2<0, θ=180°=π (rad).
When S1>0 and S2=0, θ=90°=π/2 (rad).
When S1<0 and S2=0, θ=-90°=-π/2 (rad).
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
LD R000
ATAN2 STA.F
ATAN2 DM0 DM2
DM2
CON
STA.F DM10
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-233
Text Processing Instructions
ASC Converts
binary to
ASC
Execution condition
LDA ASC STA @ A S C
R (DR)
MR
LR T
DM EM
C CTC CR TM FM T C CTH CTC Z CM #/$ #TM *
Device
@ : #/ : Z
(B)
Instructions
Text Processing
(W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
Description of Operation
ASC(.U) When the execution condition is ON, the binary data of the lower 8 bits currently stored
to 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 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
@ASC(.U) Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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)
R000 DM0 DM10
LDA ASC STA LD R000
LDA DM0
CON
ASC
conversion CON
DM0 DM10
STA DM10
0 0 F 7 4 6 3 7
Instructions
Text Processing
ASC
Execution condition
LDA RASC STA @ R A S C
Description of Operation
RASC(.U) When the execution condition is ON, the HEX ASCII character code currently stored to
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
0 0 1 1 0 1 1 0 0 1 0 0 0 0 1 1
Before conversion :16-bit internal register
3 6 4 3
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
The HEX ASCII character codes are converted when both the upper 8 bits and lower 8 bits of
the internal register before conversion are 0 to 9 (30H to 39H) or A to F (41H to 46H), and the
upper 8 bits are 0 (00H), and the lower 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) Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
The HEX ASCII character code currently stored to data memory DM0 is converted to binary data. The
result is stored to DM10
(Mnemonics list)
R000 DM0 DM10
LDA RASC STA LD R000
LDA DM0
CON
RASC
DM0 DM10 CON
STA DM10
4 6 3 7 conversion 0 0 F 7
0 0 3 7 0 0 0 7 4
Instructions
Text Processing
ASC
DASC(.U)
4 S D @ D A S C
( @ D S T R S
S
D )
D
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *4 *5 *5 *3
D - - - - *4
- - - - - -
Operand Explanation
S Specifies the numerical value to convert to decimal ASCII text string or the device in which that is currently stored.*1, *3
D Specifies the leading device to which the ASCII character code after conversion is to be stored.*2
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*2 For bit devices, specify the leading device of the channel.
*3 Specify the constant by a "#". Constants cannot be specified by a "$".
"ASCII Code Table" (Page A-115)
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
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 the
device specified by 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 16-bit signed binary data specified by S is
converted to decimal ASCII text string, and is stored as follows starting from the device
specified by D . End code NULL (00H) is stored at the end of text string.
bit
15
S bit
0
bit
15
bit
0
DASC.D When the execution condition is ON, the 32-bit unsigned binary data specified by S
is converted to decimal ASCII text string, and is stored as follows starting from the
device specified by D . End code NULL (00H) is stored at the end of text string.
S +1 S
4
bit bit bit bit bit bit
31 16 15 0 15 0
Instructions
Text Processing
D +2: hundred thousand ten thousand
DASC.L When the execution condition is ON, the 32-bit signed binary data specified by S is
converted to decimal ASCII text string, and is stored as follows starting from the device
specified by D . 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
@DASC. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Example The unsigned 16-bit binary data currently stored to data memory DM0 is converted to
an ASCII text string, and the result is stored to DM10.
R000 DASC
DM0 DM10
bit
15
DM0 bit
0
bit
15
bit
0
Without zero suppression
4 00123
16-bit
CR2814: OFF
DM10:
DM11:
0(30H)
1(31H)
0(30H)
2(32H)
Instructions
Text Processing
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-bit 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
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)
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:
Instructions
Text Processing
DM11: 1(31H) 2(32H)
The unsigned 16-bit data #1234 is converted to decimal ASCII code, and the zero-suppressed (0's
omitted) 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.
KV-1000 KV Nano
ASCII code to
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
binary
ASC
RDASC(.U)
4 S D @ R D A S C
( @ D V A L S
S
D )
D
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *3 - - - - - -
D - - - - *3 - - - -
Operand Explanation
S Specifies the leading device to which the decimal ASCII text string to convert to binary data is currently stored. *1
D Specifies the device to store the converted binary data to.*2
Description of Operation
RDASC(.U) When the execution condition is ON, the decimal ASCII text string (end code NULL
(00H) is required at the end of the text string) starting from the device specified by
S is converted to unsigned 16-bit binary data, and is stored to the device specified
by D .
bit
15
S bit
0
bit
15
D bit
0
RDASC.S When the execution condition is ON, the decimal ASCII text string (end code NULL (00H)
is required at the end of the text string) starting from the device specified by S is
converted to 16-bit signed binary data, and is stored to the device specified by D .
bit
15
S bit
0
bit
15
D bit
0
RDASC.D When the execution condition is ON, the decimal ASCII text string (end code NULL
(00H) is required at the end of the text string) starting from the device specified by
S is converted to 32-bit unsigned binary data, and is stored to the device specified
by " D • D +1".
bit
15
S bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
S +5:
N
U
L
(00H) String must be ended with NUL(00H). 4
Instructions
Text Processing
RDASC.L When the execution condition is ON, the decimal ASCII text string (end code NULL
(00H) is required at the end of the text string) starting from the device specified by
S is converted to 32-bit signed binary data, and is stored to the device specified by
" D • D +1".
bit
15
bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
@RDASC.Only one scan is executed at the rising edge of the execution conditions.
Operation flag
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
Instructions
Text Processing
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
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 result is stored to [DM10/DM11].
(Mnemonics list)
R000 RDASC.D
DM0 DM10 LD R000
RDASC.D DM0 DM10
bit bit
15 0
DM2:
DM3:
5(35H)
7(37H)
6(36H)
8(38H)
4
Instructions
Text Processing
DM4: 9(39H) 0(30H)
N
DM5: U
L
(00H)
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 result is stored to "DM10/DM11".
(Mnemonics list)
R000 RDASC.L
DM0 DM10 LD R000
RDASC.L DM0 DM10
bit bit
15 0
ASC
4
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
Instructions
Text Processing
Operand Explanation
S Specifies the numerical value (HEX) to convert to HEX ASCII text string or the device in which that is currently stored.*1 *3
D Specifies the leading device to which the ASCII character code after conversion is to be stored.*2
Specifies the number of digits of the numerical value (HEX) to be stored within the range 0 to 8.
n
(0 to 4 in the case of .U suffix instructions, and 0 to 8 in the case of .D suffix instructions)*4
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*2 For bit devices, specify the leading device of the channel.
*3 Specify the constant by a "$". Constants cannot be specified by a "#".
*4 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
"ASCII Code Table" (Page A-115)
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
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 lower side of the unsigned 16-bit binary
data specified by S , and are stored starting from the device specified by D .
End code NULL (00H) is stored at the end of text string.
When n = 0, zeros are suppressed.
Bit (n) 4 3 2 1
Example
Unsigned 16bit BIN data S 0 1 2 C
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 lower side of the 32-bit unsigned binary data
specified by " S • S +1", and are stored starting from the device specified by
D . End code NULL (00H) is stored at the end of text string.
When n = 0, zeros are suppressed.
digit (n) 8 7 6 5 4 3 2 1
Example 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)
N
4
D +1 U
L
(00H)
n=7 n=8
Instructions
Text Processing
D 0(30H) 1(31H) D 0(30H) 0(30H)
D 1(31H) 2(32H)
D +1 C(43H) D(44H)
D +2 E(45H) 0(30H)
N
D +3 U
L
(00H)
@HASC. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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)
CR2002 HASC
DM0 DM10 #3 LD CR2002
HASC DM0 DM10 #3
DM0 bit
15
bit
0
4 DM11: A(41H)
N
U
L (00H)
Instructions
Text Processing
Unsigned 32-bit data $00123ABC is converted to HEX ASCII code, and the zero-suppressed (0's
omitted) 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
Instructions
Text Processing
ASC
4
Available Devices ( ): Not supported on the KV-1000
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
Instructions
Text Processing
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *3 - - - - - -
D - - - - *3 - - - -
Operand Explanation
S Specifies the leading device to which the HEX ASCII text string to convert to numerical values (HEX) is currently stored. *1
D Specifies the leading device to which the numerical value (HEX) after conversion is to be stored.*2
Description of Operation
RHASC(.U) When the execution condition is ON, the HEX ASCII text string (end code NULL (00H) is
required at the end of the text string) starting from the device specified by S is
converted to unsigned 16-bit binary data, and is stored to the device specified by
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)
4
bit bit
15 0
D
S 1(31H) 2(32H)
N
0 0 1 2
S +1 U
Instructions
Text Processing
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 (end code NULL (00H) is
required at the end of the text string) starting from the device specified by S is
converted to 32-bit unsigned binary data, and is stored to the device specified by
" D • D +1".
S 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)
N
S +4 U
L (00H)
bit bit
15 0
S 1(31H) 2(32H)
D +1 D
S +1 A(41H) B(42H)
0 1 2 A B C D 3
S +2 C(43H) D(44H)
N
S +3 3(33H) U
L (00H)
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.Only one scan is executed at the rising edge of the execution conditions.
Point Use uppercase A to F (41H to 46H) in HEX ASCII text strings. Lowercase characters are
not supported.
Operation flag
KV-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-71)
Sample Program
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)
CR2002 RHASC
DM0 DM10 LD CR2002
RHASC DM0 DM10
bit bit
15 0
DM10
DM0 0(30H) 1(31H)
N
0 0 1 A
DM1 A(41H) U
L (00H)
MEMO
Instructions
Text Processing
Single
FASC
FASC
precision
Convert single precision floating point
floating point
type real numbers to text strings.
@FASC text string
FASC
conversion
Operand Explanation
S1 Specifies the leading device to which parameters are stored.*1
S2 Specifies the leading device to which the floating real number to be converted to a text string is currently stored.*2 *3
D Specifies the leading device to which the text string after conversion is to be stored.*4
*1 When a bit device has been specified, 48 continuous bits are occupied.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is occupied in 48 bits straddling the next channel.
When a word device has been specified, three continuous words are occupied.
*2 When a bit device has been specified, 32 continuous bits are occupied.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is occupied in 32 bits straddling the next channel.
When a word device has been specified, two continuous words are occupied.
*3 Refer to the "INTG instruction" for details on the single precision floating point type real
number and double precision floating point type real number range.
*4 For bit devices, specify the leading device of the channel.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
Description of Operation
FASC Description of parameters
Device Explanation
S1 Display format 0: Decimal point format
specification 1: Exponent format
S1 +1 Total number of digits Total number of digits of stored text (1 to 24)
S1 +2 Number of digits Number of digits past decimal point of stored text (0 to 7)
* The "number of digits" includes sign, decimal point and symbol E for exponent format
in addition to the numerical value.
Device Explanation
CR2814 Zero suppress Unwanted zeros in the stored text are omitted.
(Zeros past the decimal point are not omitted.)
CR2815 + sign omission The + sign of the stored text is omitted.
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 the
device specified by D according the content of the parameter ( S1 to S1 +2).
End code NULL (00H) is stored at the end of text string.
@FASC Only one scan is executed at the rising edge of the execution conditions.
Instructions
Text Processing
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
Total number Number of + sign Text string to be stored to D
of digits digits Zero suppress omission Decimal point format Exponent format
CR2814
S1 +1 S1 +2 CR2815 S1 : 0 S1 : 1
OFF "+000023.5" "+02.3E+01"
OFF
ON "0000023.5" "002.3E+01"
1
OFF "+23.5" "+2.3E+01"
ON
ON "23.5" "2.3E+01"
OFF "+00023.45" "+2.35E+01"
OFF
ON "000023.45" "02.35E+01"
9 2
OFF "+23.45" "+2.35E+01"
ON
ON "23.45" "2.35E+01"
OFF "+0023.450" "+2.345E+01"*
OFF
ON "00023.450" "2.345E+01"
3
OFF "+23.450" "+2.345E+01"*
ON
ON "23.450" "2.345E+01"
* An error occurs and the result is not stored as the total number of digits is 10. (CR2012
turns ON.)
When the digits past the decimal point of the value S2 • S2 +1 is fewer than the
number of digits specified by number of digits past the decimal point ( S1 +2), the
lower digits are packed with zeros.
When the digits past the decimal point of the value S2 • 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
4 CR2012
specified to D
• When a timer/counter is specified to D by indirect specification
• When the total number of digits and the number of digits past the decimal point does not
Instructions
Text Processing
Sample Program
When input relay R000 is ON, single precision floating point type real number +1.23456 is converted
to text string and stored to data memory [DM1000 and onwards], and -1.23456E-10 is converted to
text string and stored to data memory "DM2000 onwards".
(Mnemonics list)
R000 CR2814 CR2815
RES SET 1 LD R000
MPS
#0 #10 #5 RES CR2814
2 CON
DW DW DW
SET CR2815
DM0 DM1 DM2
MRD
FASC
DM0 +1.23456 DM1000 3
DW #0 DM0
CON
DW #10 DM1
4
CON
Instructions
Text Processing
CR2814 CR2815
4 DW #5 DM2
SET RES
MRD
FASC DM0 +1.23456 DM1000
#1 #15 #5 MRD
DW DW DW 5 SET CR2814
DM100 DM101 DM102 CON
RES CR2815
FASC MRD
DM100 -1.23456E-10 DM2000 6
DW #1 DM100
CON
DW #15 DM101
CON
DW #5 DM102
MPP
FASC DM100 -1.23456E-10 DM2000
To prevent erroneous operation, set CR2814 and CR2815 before executing the instructions.
KV-1000 KV Nano
precision floating
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
point
ASC
RFASC
RFASC
Single precision
Convert text strings to single
floating point text
precision floating point type
string reverse
@RFASC real numbers.
RFASC
conversion
MR
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *3 - - - - - -
D - - - - *3 - - - - - -
Operand Explanation
S Specifies the leading device to which the single precision floating point text string is stored.*1
D Specifies the leading device to which the single precision floating point type real number is stored.*2
Description of Operation
RFASC When the execution condition is ON, the text string from S up to NULL (00H) is
interpreted as being 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 Only one scan is executed at the rising edge of the execution conditions.
Point This program will not function correctly when timers or counters (T, C)are specified to
D by indirect specification.
The format of the text string must satisfy the following conditions.
• 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:
+
4
-
Sign Value
Instructions
Text Processing
Sign: +, - or no sign is allowed
+ E +
_
-
Sign Value Sign Value
Operation flag
Sample Program
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].
(Mnemonics list)
R000 RFASC
DM0 DM1000 LD R000
RFASC DM0 DM1000
4
Instructions
Text Processing
MEMO
Instructions
Text Processing
KV-1000 KV Nano
length
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
ASC
LEN
LEN
Operand Explanation
S Specifies the text string whose number of characters is to be counted or the leading device to which
that text string is currently stored.*1 *2
D Specifies the device to store the counted number of characters to.*3
*1 For bit devices, specify the leading device of the channel.
*2 To specify a text string using constants, enclose with " ". (up to 31 1-byte characters). The
characters "#" and "$" cannot be used.
1-byte characters: ASCII code (1 byte)
2-byte characters: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"ASCII Code Table" (Page A-115)
*3 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. MR002, or R1012) of the channel has been specified, 16 bits are
occupied straddling the next channel.
When a word device has been specified, one continuous word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
Description of Operation
LEN When the execution condition is ON, the number of characters in the text string (end
code NULL (00H) is required at the end of the text string) currently stored starting from
the device specified by S is counted. The number of characters is stored in binary
data to the device specified by D . Up to 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 Only one scan is executed at the rising edge of the execution conditions.
Point 2-byte characters (shift JIS, etc.) are counted as two characters.
Operation flag
Instructions
Text Processing
KV-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-71)
Sample Program
The length (number of characters) of the text string currently stored starting from data memory DM0 is
counted, and is stored to DM100.
(Mnemonics list)
CR2002 LEN
DM0 DM100 LD CR2002
LEN DM0 DM100
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
ASC
SMOV
SMOV
Move text
Store a text string to a specified device.
string
@SMOV
SMOV
Operand Explanation
S Specifies the text string to move or the leading device to which the text string is currently stored. *1 *2
D Specifies the leading device (move destination) to store the text string to. *1
Description of Operation
SMOV When the execution condition is ON, the text string data (end code NULL (00H) is required
at the end of the text string) currently stored starting from the device specified by S is
stored starting from the device specified by D . End code 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 Only one scan is executed at the rising edge of the execution conditions.
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
Instructions
Text Processing
KV-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-71)
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
ASC
SADD
SADD
4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify
MR DM EM
Instructions
Text Processing
Operand Explanation
S1 Specifies the text string to unite or the leading device to which the text string is currently stored. *1 *2
S2 Specifies the text string to unite or the leading device to which the text string is currently stored. *1 *2
D Specifies the leading device to which the united text string is to be stored.*1
Description of Operation
SADD When the execution condition is ON, the text string currently stored starting from the
device specified by S1 is united with the text string currently stored starting from the
device specified by S2 .
The result of the union is stored starting from the device specified by D . NULL (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 as the text string.
S1 A(41H) B(42H)
N
S1 +1 C(43H) U (00H)
L D A(41H) B(42H)
D +1 C(43H) D(44H)
D +2 E(45H) F(46H)
N
S2 D(44H) E(45H) D +3 G(47H) U
L
(00H)
S2 +1 F(46H) G(47H)
N
S2 +2 U
L
(00H)
@SADD Only one scan is executed at the rising edge of the execution conditions.
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
Instructions
Text Processing
• When a device other than the leading device of the channel is used when a bit device is
CR2012
specified to S1 , S2 and D .
• When a timer/counter has been specified by indirect specification to S1 , S2 and
D
• When the indirect specification or index modify range is inappropriate
• When exceeding the D device end when the united text string is stored in 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
ASC
SRGHT
SRGHT
Cut the specified number of
Cut text
characters from the right edge (end)
string on right
@SRGHT of the text string.
SRGHT
Ladder program
Input mode
Execution condition
SRGHT
S D n S R G H T S D n
Execution condition
@SRGHT
S S
D D
n @ S R G H T S D n
4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify
MR DM EM
Instructions
Text Processing
Operand Explanation
S Specifies the source text string to cut or the leading device to which the text string is currently stored.*1 *2
D Specifies the leading device to which the text string after the cut is to be stored.*1
n Specifies the number of characters (number of bytes in range 0 to 1999) to be cut. *3
Description of Operation
SRGHT When the execution condition is ON, a text string of number of characters specified by
n is cut from the right edge (end) of the text string currently stored starting from the
device specified by S , and the result is stored starting from the device specified by
D . NULL (00H) is stored at the end of text string.
When the number of characters in the text string currently stored starting from the device
specified by S is smaller than n , the entire text string is stored starting from the
device specified by D .
The devices specified by 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)
4
N N
U(55H) U
L (00H) U(55H) U
L (00H)
String must be ended with NULL(00H). String must be ended with NULL(00H).
Instructions
Text Processing
@SRGHT Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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)
CR2002 SRGHT
DM0 DM100 #4 LD CR2002
SRGHT DM0 DM100 #4
bit bit
15 0
4
DM2: E(45H) F(46H)
DM101: J(32H) K(33H)
DM3: G(47H) H(48H) N
DM102: U
L (00H)
DM4: I (49H) J(4AH)
Instructions
Text Processing
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 is
stored starting from DM100.
(Mnemonics list)
CR2002 SRGHT
“ABCDEFGHIJKLM” DM100 #5 LD CR2002
SRGHT "ABCDEFGHIJKLM" DM100 #5
bit bit
15 0
MEMO
Instructions
Text Processing
ASC
SLEFT SLEFT
Cut text
Cut the specified number of
characters from the left edge (start)
string on left
@SLEFT SLEFT of the text string.
Ladder program
Input mode
Execution condition
SLEFT
S D n S L E F T S D n
4
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
Instructions
Text Processing
Operand Explanation
S Specifies the source text string to cut or the leading device to which the text string is currently stored.*1 *2
D Specifies the leading device to which the text string after the cut is to be stored.*1
n Specifies the number of characters (number of bytes in range 0 to 1999) to be cut. *3
Description of Operation
SLEFT When the execution condition is ON, a text string of number of characters specified by
n is cut from the left edge (start) of the text string currently stored starting from the
device specified by S , and the result is stored starting from the device specified by
D . NULL (00H) is stored at the end of text string.
When the number of characters in the text string currently stored starting from the device
specified by S is smaller than n , the entire text string is stored starting from the
device specified by D .
The devices specified by 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 with NUL(00H).
M(4DH) N(4EH)
S(53H) T(54H)
U(55H)
N
U
L (00H)
4
String must be ended with NUL(00H).
Instructions
Text Processing
@SLEFT Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
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)
CR2002 SLEFT
DM0 DM100 #4 LD CR2002
SLEFT DM0 DM100 #4
bit bit bit bit
15 0 15 0
4
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
MEMO
Instructions
Text Processing
ASC
SMID
SMID
Cut text string Cut part of a text string.
SMID
@SMID
Ladder program Input mode
Execution condition SMID
S D n1 S M I D S D n1 n2
n2
Operand Explanation
S Specifies the source text string to cut or the leading device to which the text string is currently stored.*1 *2
D Specifies the leading device to which the text string after the cut is to be stored.*1
Specifies the cut leading position (number of bytes).*3
n1
The start character of the text string specified by S is taken to be "0".
n2 Specifies the number of characters (number of bytes in range 0 to 1999) to be cut. *3
Description of Operation
SMID When the execution condition is ON, a text string of number of characters specified by
n2 is cut from the position specified by n1 in the text string currently stored
starting from the device specified by S .
The cut text string is stored starting from the device specified by D . NULL (00H) is
stored at the end of text string.
When the number of characters in the text string currently stored starting from the device
specified by S is smaller than n1 + n2 , the entire text string from n1
onwards is stored starting from the device specified by D .
The devices specified by and D may overlap.
4
S
When "0" is specified to n2 , only one character's worth of NULL is stored to D .
Instructions
Text Processing
@SMID Only one scan is executed at the rising edge of the execution conditions.
Example
Position 0
Cut position n1
bit bit
15 0
S +2 E(45H) F(46H)
n2 words
K(4BH) L(4CH)
N
K(4BH) L(4CH) U
L (00H)
S(53H) T(54H)
N
U(55H) U
L (00H)
Operation flag
Sample Program
Five characters are cut from cut leading position 1 of the text string data currently stored starting from
data memory DM0. The cut five characters are stored starting from DM100.
(Mnemonics list)
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
MEMO
Instructions
Text Processing
ASC
SRPLC
n1
S2
n2
D @ S R P L C S1 S2
n1
D
n2
Instructions
Text Processing
Operand Explanation
S1 Specifies the text string to be replaced or the leading device to which the text string is currently stored. *1 *2
S2 Specifies the text string to replace or the leading device to which the text string is currently stored. *1 *2
D Specifies the leading device to which the text string after replacement is to be stored.*1
Specifies the replacement leading position (number of bytes, within 0 to 1999).*3 *4
n1
The start character of the text string specified by S1 is taken to be "0".
n2 Specifies the replacement leading position (number of bytes, within 0 to 1999).*3 *4
Description of Operation
SRPLC When the execution condition is ON, a text string of number of characters specified by
n2 is replaced from the position specified by n1 in the text string currently stored
starting from the device specified by S1 with the text string currently stored starting
from the device specified by S2 .
The text string after the replacement is stored starting from the device specified by
D . NULL (00H) is stored at the end of text string.
When the number of characters in the text string currently stored starting from the device
specified by S1 is smaller than n1 + n2 , the entire text string from n1
onwards is replaced with the text string currently stored starting from the device
specified by S2 .
4
The devices specified by or and may overlap.
Instructions
Text Processing
S1 S2 D
@SRPLC Only one scan is executed at the rising edge of the execution conditions.
Example Position 0
I(49H) J(4AH)
S(53H) T(54H)
N
U(55H) U
L (00H)
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
Sample Program
Two characters are replaced with the text string currently stored starting from data memory DM100
from the replacement leading position 4 in the text string currently stored starting from data memory
DM0. The text string after the replacement is stored from DM200.
CR2002
(Mnemonics list)
SRPLC
DM0 DM100 DM200 LD CR2002
#4 #2 SRPLC DM0 DM100 DM200 #4 #2
Position 0
bit bit
15 0
DM4:
N
U
L (00H)
4
Instructions
Text Processing
ASC
SINS
SINS
Insert text Insert a specified text string
SINS string into a text string.
@SINS
Ladder program Input mode
Execution condition SINS
S1 S2 D S I N S S1 S2 D n
n
Operand Explanation
S1 Specifies the text string to be inserted or the leading device to which the text string is currently stored. *1 *2
S2 Specifies the text string to insert or the leading device to which the text string is currently stored. *1 *2
D Specifies the leading device to which the text string after insertion is to be stored.*1
Specifies the insertion leading position (number of bytes, within 0 to 1999).*3 *4
n
The start character of the text string specified by S1 is taken to be "0".
Description of Operation
SINS When the execution condition is ON, the text string currently stored starting from the
device specified by S1 is inserted from the position specified by n in the text
string currently stored starting from the device specified by S1 .
The text string after the insertion is stored starting from the device specified by D .
The devices specified by S1 or S2 and D may overlap.
@SINS Only one scan is executed at the rising edge of the execution conditions.
4-284 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions
Example Position 0
S(53H)
N
T(54H) 4
U(55H) U
L (00H)
Instructions
Text Processing
String must be ended with NUL(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
Sample Program
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.
CR2002
(Mnemonics list)
SINS
DM0 DM100 DM200
LD CR2002
#3 SINS DM0 DM100 DM200 #3
Position 0
Insert position:3
Text string to be searched Text string to be searched
4 DM0:
DM1:
A(41H)
C(43H)
B(42H)
X(58H)
DM100:
DM101:
1(31H)
3(33H)
N
2(32H)
U
L (00H)
N
DM3: U
L (00H)
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
MEMO
Instructions
Text Processing
ASC
SDEL
SDEL
Delete text Delete a specified part of a text
SDEL string section string.
@SDEL
Ladder program Input mode
Execution condition SDEL
S D n1 S D E L S D n1 n2
n2
n2
D n1 @ S D E L S D n1 n2
Instructions
Text Processing
Operand Explanation
S Specifies the text string to be deleted or the leading device to which the text string is currently stored. *1 *2
D Specifies the leading device to which the text string after deletion is to be stored. *1
Specifies the deletion leading position (number of bytes, within 0 to 1999).*3 *4
n1
The start character of the text string specified by S1 is taken to be "0".
n2 Specifies the number of characters (number of bytes in range 0 to 1999) to be delete.*3 *4
Description of Operation
SDEL When the execution condition is ON, a text string of number of characters specified by
n2 is deleted from the position specified by n1 in the text string currently stored
starting from the device specified by S .
The text string after the deletion is stored starting from the device specified by D .
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.
The devices specified by S and D may overlap.
4-288 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions
@SDEL Only one scan is executed at the rising edge of the execution conditions.
S +2 E(45H) F(46H) D +2
K(4BH) L(4CH)
K(4BH) L(4CH)
S(53H) T(54H)
S(53H)
N
T(54H) U(55H)
N
U
L (00H) 4
U(55H) U
L (00H)
String must be ended with NUL(00H).
Instructions
Text Processing
String must be ended with NUL(00H).
Operation flag
Sample Program
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)
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)
Instructions
Text Processing
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
MEMO
Instructions
Text Processing
STRIM
STRIM
STRIM
Deletes the tab and space at
Delete ends of
the front and end of a
text string
@STRIM
STRIM
specified text string.
Operand Explanation
S1 Specifies the target text string, or the leading device storing that text string. *1 *2
S2 Specifies the parameter, or the device storing that parameter. *3
D Specifies the leading device which stores the trimmed text string. *1
*1 For bit devices, specify the leading device of the channel.
*2 To specify a text string using constants, enclose with " " . (up to 31 1-byte characters).
1-byte characters: ASCII code (1-byte)
2-byte characters: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"ASCII Code Table" (Page A-115)
*3 When a bit device is specified, 16 continuous bits are occupied. When a channel other than the leading
channel (MR002, R1012, etc.) is specified, the 16 bits are occupied crossing to the next channel.
When a word device is specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Description of Operation
STRIM When the execution conditions are ON, the 1-byte space and tab at the end of the text
string data (with end code NULL(00H) at the end of the text string) which is stored from
the device specified with S1 is all deleted according to the details of parameter
( S2 ). The resulting text string is stored starting from the device specified with D .
Specifying the parameter
bit S2 bit
15 0
@STRIM Only one scan is executed at the rising edge of the execution conditions.
Instructions
Text Processing
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 there is no end code in S1
• When text string including end code (NULL(00H)) exceeds 2000 characters
• When bit device is specified in S1 , D but device other than channel's leading
CR2012
device is specified
• When timer or counter is indirectly specified for S1 , D
• When the indirect specification or index modify range is inappropriate
• When exceeding the D device end when the result is stored in D
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
SFIND
Search text Search a specified text string
SFIND string from a text string.
@SFIND
Ladder program Input mode
Execution condition SFIND
S1 S2 D S F I N D S1 S2 D n
n
n
S2 D @ S F I N D S1 S2 D n
Instructions
Text Processing
Operand Explanation
S1 Specifies the text string to be searched or the leading device to which the text string is currently stored. *1 *2
S2 Specifies the text string to search or the leading device to which the text string is currently stored. *1 *2
D Specifies the device to store the search result to.*3
Specifies the search leading position (number of bytes, within 0 to 1999).*3
n
The start character of the text string specified by S1 is taken to be "0".
Description of Operation
SFIND When the execution condition is ON, the text string currently stored starting from the
device specified by S2 is searched from the position specified by n in the text
string currently stored starting from the device specified by S1 .
The leading 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 .
4-294 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions
@SFIND Only one scan is executed at the rising edge of the execution conditions.
Example Position0
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 4
S(53H) T(54H)
Search range
Instructions
Text Processing
N
U(55H) U
L (00H)
Operation flag
Sample Program
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 DM200
as the text string is detected at position 4.
CR2002 (Mnemonics list)
SFIND
DM0 DM100 DM200 LD CR2002
#0 SFIND DM0 DM100 DM200 #0
Position0
Position4 Text string to be searched
DM1: C(43H) D(44H) DM101: U (00H) String must be ended with NUL(00H).
Instructions
Text Processing
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
Instructions
Text Processing
KV-1000 KV Nano
within the
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
specified text
string range
STRIM
SFINDN
SFINDN
A specified text string is
Search text
retrieved from a specified
string
@SFINDN
SFINDN text string range.
4
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
Instructions
Text Processing
Point This instruction can be used with KV-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 2)
Description of Operation
SFINDN When the execution conditions are on, the text string stored starting from the device
specified in S2 is searched for from the position specified by S3 +1 of the S3
byte text string starting with the device specified with S1 .
The leading 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
Instructions
Text Processing
Device Description
S3 Specifies the number of bytes in the text string S1 to be searched.
Specifies the search start position (number of bytes)(0 to 1999). The
S3 +1
leading charachter of the text string specified with S1 is 0.
@SFINDN Only one scan is executed at the rising edge of the execution conditions.
Position S3 +1
Operation flag
4 • When a device other than the leading device of the channel is specified when a bit device is
specified to S1 and S2
• When a timer/counter has been specified by indirect specification to S1 , S2 and
Instructions
Text Processing
D
• When the indirect specification or index modify range is inappropriate
Sample Program
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) of
the 100-byte text string stored from data memory DM0.
(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
4
Position 0
Instructions
Text Processing
Position 4
DM200 14
STRIM
SCMP SCMP
Compare
Compare text strings.
text strings
@SCMP SCMP
4
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
Instructions
Text Processing
Operand Explanation
S1 Specifies the text string to compare or the leading device to which the text string is currently stored. *1 *2
S2 Specifies the text string to compare or the leading device to which the text string is currently stored. *1 *2
Description of Operation
SCMP When the execution condition is ON, the text string currently stored starting from the device
specified by S2 is compared with the text string currently stored starting from the device
specified by S1 . Comparison is performed one byte at a time from the each of the
leading devices. 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
Operation flag CR2010 turns ON if the text strings are the same as a result of having
performed a compare up to NULL (00H).
When the nth character is different, the operation flag changes as follows:
State of Operation
Compare Result
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 Only one scan is executed at the rising edge of the execution conditions.
Operation flag
ON when nth character is different, and the ASCII code of the nth character of S1 is smaller
4
CR2009
than the ASCII code of the nth character of S2 . Otherwise, OFF
Instructions
Text Processing
ON when all of the ASCII code of S1 is the same as all of the ASCII code of S2 .
CR2010
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
This flag is ON in the following instances. Otherwise, it is 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
CR2012
• When a device other than the leading device of the channel is specified when a bit device is
specified to S and D
• When a timer/counter has been specified by indirect specification to S1 and S2
• When the indirect specification or index modify range is inappropriate
Sample Program
The text string currently stored starting from data memory DM100 is compared in order from the start
of 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.
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
Instructions
Text Processing
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
Instructions
Text Processing
DISS
DISS
Disperse text strings in byte
Disperse text string units into text strings in word
@DISS units.
DISS
Operand Explanation
S Specifies the text string to disperse or the leading device to which the text string is currently stored. *1 *2
D Specifies the leading device to store the dispersed text string to.*1
Description of Operation
DISS When the execution condition is ON, the byte unit text string currently stored starting
from the device specified by S is dispersed, and is stored in word units starting
from the device specified by D . The end code NULL(00H) is required at the end of
the text string specified by S . Up to 1999 1-byte characters can be handled as the
text string.
D 0 a(61H)
S a(61H) b(62H) D +1 0 b(62H)
S +1 c(63H) d(64H) D +2 0 c(63H)
N
S +2 e(63H) U
L
(00H) D +3 0 d(64H)
D +4 0 e(65H)
@DISS Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Text Processing
KV-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-71)
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)
DISS
UNIS
UNIS
Unit text strings in word
Unit text string units into text strings in
Operand Explanation
S Specifies the leading device to which the united text string is to be stored.*1
D Specifies the leading device to which the united text string is to be stored.*1
n Specifies the number of characters to unit in the range 0 to 1999. *2
Description of Operation
UNIS When the execution condition is ON, the word unit text string currently stored starting
from the device specified by S is stored in byte units to the device specified by
D . The number of characters to 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 Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Instructions
Text Processing
KV-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-71)
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)
DISS
RCOM
RCOM
KV-1000
S D1 R C O M S D1
Operand Explanation
S Specifies the device whose comment is to be read.
D1 Specifies the device to store the read comment to.*3 *4
D2 Specifies the notification bit device.*3 *4
*1 This instruction can be used with KV-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 2)
*2 This cannot be used when using the word device bit specification.
*3 For bit devices, specify the leading device of the channel.
*4 To specify an indirect specifying or index modification device,write to the device specified in the
operation start.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
RCOM KV-1000 When the execution condition is ON, the comment of the device specified by
S is read, and is stored starting from the device specified by 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
S According to comment of a specified device.
...
(single byte) while full-width characters
are stored by Shift JIS (double byte).
Instructions
Text Processing
D1 +15 31st character 32nd character
N
D1 +16 U
L
(00H)
KV-5500/5000/3000, KV Nano Series Use the same solution with KV-1000 when process the
rising edge of the execution condition, D2 is written into ending note. When start the
instruction OFF, when read the note ON.
KV-7500/7300 The same process is executed as with KV-1000 at the rising edge of the
execution condition. Up to 32 characters can be handled as the text string. 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 x 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-7500/7300/5500/5000/3000, KV Nano Series After reading the comment in D2 , please read
the following comments when reading a plurality of the device.
• Device comment 1 (fixed) is read for the KV-7000 Series.
@RCOM Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
4
■ KV-1000
Instructions
Text Processing
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
Instructions
Text Processing
CPSASC
CPSASC CPSASC
CIP text string
type data
CIP text string type data is
converted into text string data.
@CPSASC CPSASC conversion
4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify
MR DM EM
Instructions
Text Processing
Point This instruction can be used with KV-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 2)
Description of Operation
CPSASC When the execution conditions are ON, the CIP text string type data stored in S is
converted and stored from the device specified with D .
The CPSASC instruction is used to convert CIP text string type data.
Refer to the "EtherNet/IP Function User's Manual" for details on the CIP data types.
Example The operation of the CPSASC instruction is explained using the following type of CIP text
string type data as an example.
CIP text string type data
bit bit
15 0
S +0 5(0005H) CIP text string type data "ABCDE"
S +1 B(42H) A(41H) The size of the CIP text string type data is
specified with the first word, and the text
S +2 D(44H) C(43H)
string is stored in order of low-order byte to
S +3 E(45H) high-order byte.
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
4
Instructions
Text Processing
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.
Operation flag
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
RCPSASC
4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify
MR DM EM
Instructions
Text Processing
D2
Specifies the device storing the data size (number of bytes) of CIP text string type data stored in
D1 after conversion. *1
Point This instruction can be used with KV-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 2)
Description of Operation
RCPSASC When the execution conditions are ON, the text string data stored in S is converted
into CIP text string type data, and is stored from the device specified with D1 . After
conversion, the data size (number of bytes) of the CIP text string type data stored in
D1 is stored in the device specified with D2 .
The RCPSASC instruction is used to convert text string data into CIP text string type
data.
Refer to the "EtherNet/IP Function User’s Manual" for details on the CIP data types.
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"
4
The high-order bytes and low-order bytes
D(44H) C(43H) D1 +2
of the text string are interchanged and
stored in D1 +1 and following. E(45H) D1 +3
Instructions
Text Processing
The data size (byte unit) stored in D1
is stored in D2 . 7(0007H) D2
@RCPSASC Only one scan is executed at the rising edge of the execution conditions.
Operation flag
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+(.U)
CAL+.S
CAL+ CAL+.D
CAL+.L
CAL+.F
+
Add values of
Operand1 and
CAL+.DF Addition
Operand2
@CAL+(.U) operation
and store the result
@CAL+.S
into Operand3.
@CAL+ @CAL+.D
@CAL+.L
@CAL+.F
+
@CAL+.DF
4
C A L + S1 S2 D
+ S1 S2 D
( + S1 S2 D )
Execution condition
Instructions
Simple Operation
@ C A L + S1 S2 D
+ S1 S2 D
( @ + S1 S2 D )
Operand Explanation
S1 Specifies the addition data or the device to which the data is currently stored. *1 *2 *3
S2 Specifies the addition data or the device to which the data is currently stored. *1 *2 *3
D Specifies the device to store the operation (addition operation) result to.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is processed.
*4 When the suffix is ".F" or ".DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF".
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The CAL+.DF (@CAL+.DF) instruction can be used with KV-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 2)
Description of Operation
CAL+(.U) When 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 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"
S1 +1
12345678
S1
+
S2 +1
87654321
S2
=
D +1
99999999
D
4
Instructions
Simple Operation
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
CAL+.L When 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 + -87654321 = -75308643
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
CAL+.F When 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
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
-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 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
64-bit 64-bit 64-bit
(4 words) (4 words) (4 words)
-1.79E+308 ≤ N ≤ -2.23E-308
N = 0
4
+2.23E-308 ≤ N ≤ +1.79E+308
(number of eff. digits: approx. 16).
@CAL+. Only one scan is executed at the rising edge of the execution conditions.
Instructions
Simple Operation
Point • The CAL+ and @CAL+ instructions perform addition in binary. The BCD number must
be converted to BIN with TBIN instruction before storing.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ON when the operation results exceed the 16/32-bit (.U/.S/.D/.L), single precision floating point
CR2009 type 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
• When the suffix is "U/S/D/L"
ON when the indirect specification or index modification range is inappropriate. Otherwise,
OFF. Status does not change when not using an indirect specification or index modification.
• For suffix "F"
ON when the indirect specification or index modification range is inappropriate or the
CR2012 operation data is not within the single precision floating point type real number range.
Otherwise, OFF.
• For suffix "DF"
ON when the indirect specification or index modification range is inappropriate or the
operation data is not within the double precision floating point type real number range.
Otherwise, OFF.
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
Instructions
Simple Operation
CAL-(.U)
CAL-.S
CAL- CAL-.D
CAL-.L
–
Subtract values
of Operand1
CAL-.F
CAL-.DF Subtraction and Operand2
@CAL-(.U) operation and store the
@CAL-.S result into
@CAL- @CAL-.D
@CAL-.L
– Operand3.
@CAL-.F
@CAL-.DF
4
C A L - S1 S2 D
- S1 S2 D
( - S1 S2 D )
Execution condition
Instructions
Simple Operation
@ C A L - S1 S2 D
- S1 S2 D
( @ - S1 S2 D )
Operand Explanation
S1 Specifies the data after subtraction or the device to which the data is currently stored. *1 *2 *3
S2 Specifies the subtraction data or the device to which the data is currently stored. *1 *2 *3
D Specifies the device to store the operation (subtraction operation) result to.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is processed.
*4 When the suffix is ".F" or ".DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF".
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The CAL-.DF (@CAL-.DF) instruction can be used with KV-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 2)
Description of Operation
CAL-(.U) When execution condition is ON, subtract unsigned 16-bit BIN data in S1 from
S2 , 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 execution condition is ON, subtract signed 16-bit BIN data in S1 from S2 ,
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 execution condition is ON,subtract unsigned 32-bit BIN data in " S1 • S1 +1"
from " S2 • S2 +1", and store the result into " D • D +1".
S1 +1
99999999
S1
-
S2 +1
12345678
S2
=
D +1
87654321
D
4
Instructions
Simple Operation
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
CAL-.L When execution condition is ON,subtract signed 32-bit BIN data in " S1 • S1 +1"
from " S2 • S2 +1", and store the result into " D • D +1".
S1 +1 S1 S2 +1 S2 D +1 D
87654321 — -12345678 = 99999999
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
CAL-.F When execution condition is ON, subtract the single precision floating point type real
numbers in " S1 • S1 +1" from " 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
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
-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 execution condition is ON, subtract the double precision floating point type real
numbers in " S1 • S1 +1• S1 +2• S1 +3" from
" 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
64-bit 64-bit 64-bit
(4 words) (4 words) (4 words)
-1.79E+308 ≤ N ≤ -2.23E-308
4
N = 0
+2.23E-308 ≤ N ≤ +1.79E+308
(number of eff. digits: approx. 16).
Instructions
Simple Operation
@CAL-. Only one scan is executed at the rising edge of the execution conditions.
Point • The CAL- and @CAL- instructions perform addition in binary. The BCD number must
be converted to BIN with TBIN instruction before storing.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ON when the operation results exceed the 16/32-bit (.U/.S/.D/.L), single precision floating point
CR2009 type 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
ON when the operation result is larger than "0". Otherwise, OFF.
CR2011
No change when the suffix is F/DF.
• When the suffix is "U/S/D/L"
ON when the indirect specification or index modification range is inappropriate. Otherwise,
OFF. Status does not change when not using an indirect specification or index modification.
• For suffix "F"
ON when the indirect specification or index modification range is inappropriate or the operation
CR2012
data is not within the single precision floating point type real number range. Otherwise, OFF.
• For suffix "DF"
ON when the indirect specification or index modification range is inappropriate or the
operation data is not within the double precision floating point type real number range.
Otherwise, OFF.
Sample Program
When 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
4-324 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions
MEMO
Instructions
Simple Operation
CAL-
CAL(.U)
CAL.S
CAL
CAL.D *
CAL.L Multiply values of
CAL.F Operand1 and
CAL.DF Multiplication Operand2
@CAL(.U) operation and store the
@CAL.S result into
@CAL @CAL.D
@CAL.L
@CAL.F
* Operand3.
@CAL.DF
4
C A L * S1 S2 D
* S1 S2 D
( * S1 S2 D )
Execution condition
Instructions
Simple Operation
@ C A L * S1 S2 D
* S1 S2 D
( @ * S1 S2 D )
Operand Explanation
S1 Specifies the multiplied data, or the device storing that data. *1 *2 *3
S2 Specifies the data to be multiplied, or the device storing that data. *1 *2 *3
D Specifies the device storing the operation (multiplication) results.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is processed.
*4 When the suffix is ".F" or ".DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF".
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The CAL*.DF (@CAL*.DF) instruction can be used with KV-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 2)
Description of Operation
CAL(.U) When execution condition is ON, multiple 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 execution condition is ON, multiple 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 execution condition is ON, multiple 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
1234
S1
×
S2 +1
5678
S2
=
D +3 D +2
7006652
D +1 D
4
Instructions
Simple Operation
32-bit 32-bit 64-bit
(2 words) (2 words) (4 words)
CAL.L When execution condition is ON, multiple 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".
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.F When execution condition is ON, multiple 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
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
-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, the double precision floating point type real number
specified by [ S1 • S1 +1• S1 +2• S1 +3] and the double precision floating
point type real number specified by [ S2 • S2 +1• S2 +2• S2 +3] are
multiplied, and the result is stored to [ 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
64-bit 64-bit 64-bit
(4 words) (4 words) (4 words)
-1.79E+308 ≤ N ≤ -2.23E-308
4
N = 0
+2.23E-308 ≤ N ≤ +1.79E+308
(number of eff. digits: approx. 16).
Instructions
Simple Operation
@CAL. Only one scan is executed at the rising edge of the execution conditions.
Point • The CAL* and @CAL* instructions perform addition in binary. The BCD number must
be converted to BIN with TBIN instruction before storing.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ON when the operation results exceed the 16/32-bit (.U/.S/.D/.L), single precision floating point
CR2009 type 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
• When the suffix is "U/S/D/L"
ON when the indirect specification or index modification range is inappropriate. Otherwise,
OFF. Status does not change when not using an indirect specification or index modification.
• For suffix "F"
ON when the indirect specification or index modification range is inappropriate or the
CR2012 operation data is not within the single precision floating point type real number range.
Otherwise, OFF.
• For suffix "DF"
ON when the indirect specification or index modification range is inappropriate or the
operation data is not within the double precision floating point type real number range.
Otherwise, OFF.
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
4-328 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions
MEMO
Instructions
Simple Operation
CAL/
CAL/(.U)
CAL/.S
CAL/ CAL/.D
CAL/.L
/
Divide values of
Operand1 and
CAL/.F
CAL/.DF Division Operand2
@CAL/(.U) operation and store the
@CAL/.S result into
@CAL/ @CAL/.D
@CAL/.L
/ Operand3.
@CAL/.F
@CAL/.DF
4 S1 S2 D
C A L /
/ S1 S2 D
( / S1 S2 D
Execution condition
Instructions
Simple Operation
@ C A L / S1 S2 D
/ S1 S2 D
( @ / S1 S2 D
Operand Explanation
S1 Specifies the data after division or the device to which the data is currently stored. *1 *2 *3
S2 Specifies the division data or the device to which the data is currently stored. *1 *2 *3
D Specifies the device to store the operation (division operation) result to.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is processed.
*4 When the suffix is ".F" or ".DF", it can not be used.
*5 Z cannot be specified if the suffix is ".DF".
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 CTH and CTC cannot be used with the KV-7000 Series.
Point The CAL/.DF (@CAL/.DF) instruction can be used with KV-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 2)
Description of Operation
CAL/(.U) When execution condition is ON, divide unsigned 16-bit BIN data in S1 into S2 ,
and store the result (quotient) into D , 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 execution condition is ON, divide signed 16-bit BIN data in S1 into S2 , and
store the result (quotient) into D , 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 execution condition is ON, divide unsigned 32-bit BIN data in " S1 • S1 +1"
into " S2 • S2 +1", and store the result (quotient) into " D • D +1", remainder
into " D +2• D +3".
S1 +1
12345678
S1
÷
S2 +1
100
S2
=
D +1
123456
D
4
Instructions
Simple Operation
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 execution condition is ON, divide signed 32-bit BIN data in " S1 • S1 +1" into
" S2 • S2 +1", and store the result (quotient) into " D • D +1", remainder into
" D +2• D +3".
S1 +1 S1 S2 +1 S2 D +1 D
-12345678 ÷ 100 = -123456
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
D +3 D +2
Remainder: -78
32-bit
(2 words)
CAL/.F When execution condition is ON, divide the single precision floating point type real
numbers in " S1 • S1 +1" into " 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
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)
(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 execution condition is ON, divide the double precision floating point type real
numbers in " S1 • S1 +1• S1 +2• S1 +3" into
" 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
64-bit 64-bit 64-bit
(4 words) (4 words) (4 words)
-1.79E+308 ≤ N ≤ -2.23E-308
4
N = 0
+2.23E-308 ≤ N ≤ +1.79E+308
(number of eff. digits: approx. 16).
Instructions
Simple Operation
@CAL/. Only one scan is executed at the rising edge of the execution conditions.
Point • The CAL/ and @CAL/ instructions perform addition in binary. The BCD number must be
converted to BIN with TBIN instruction before storing.
"TBIN instruction" (Page 4-158)
• Operation can be enabled correctly even if overflow occurs.
Operation flag
ON when the operation results exceed the 16/32-bit (.U/.S/.D/.L), single precision floating point
CR2009 type 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 S2 =0 and the indirect specification or index modification range is inappropriate.
Otherwise, OFF.
• For suffix "F"
ON when S2 =0 and the indirect specification or index modification range is inappropriate.
CR2012 ON when S2 =0 and the operation data exceeds the single precision floating point type
real number range. Otherwise, OFF.
• For suffix "DF"
ON when S2 =0 and the indirect specification or index modification range is inappropriate.
ON when S2 =0 and the operation data exceeds the double precision floating point type
real number range. 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
4-332 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions
MEMO
Instructions
Simple Operation
CAL/
CAL& CAL&(.U)
CAL&.D
& Perform logical
AND operation of
Logic
the two specified
@CAL& @CAL&(.U)
@CAL&.D
& devices
4 Available Devices
*1
( ): Not supported on the KV-1000
Local
Index
Bit Devices Word Devices Const Ind Spec Modify
Device
Instructions
Simple Operation
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - *4 *5 *5
S2 - - - - *4 *5 *5
D - - - - *4 - *5 -
Operand Explanation
S1 Specifies the data to be logically ANDed or the device currently storing that data. *1 *2 *3
S2 Specifies the data to be logically ANDed or the device currently storing that data. *1 *2 *3
D Specifies the device to store logically ANDed the operation result to.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is
processed.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When execution condition is ON, the specified BIN data of S1 and Logical AND true table
S2 , is logic ANDed,and store the result into D . Device status bit
When the state of the same bit of S1 and S2 is "1", the same bit of S1 0 0 1 1
D become "1". S2 0 1 0 1
D 0 0 0 1
CAL&(.U) When execution condition is ON, calculate the logical AND of the specified unsigned 16-
bit BIN data of S1 and S2 , then store the result into D .
Example
& S1 S2 D
bit bit
15 0
S1 1111 0 0 0 0 1111 0 0 0 0
S2 0 0 0 0 0 0 0 0 11111111
bit bit
15 0
D 0 0 0 0 0 0 0 0 1111 0 0 0 0
CAL&.D When the execution condition is ON, calculate the logical AND of the specified unsigned
4
Instructions
Simple Operation
32-bit BIN data of [ S1 • S1 +1] and [ S2 • S2 +1], and store the result into
[ D • D +1].
Example
&. D S1 S2 D
S2 • S2 +1 0 0 0 0 0 0 0 0 11111111 0 0 0 0 0 0 0 0 11111111
bit bit
31 0
D • D +1 0 0 0 0 0 0 0 0 1111 0 0 0 0 0 0 0 0 0 0 0 0 1111 0 0 0 0
@CAL&. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to data memory
DM0.
CAL/
Perform logical
CAL | CAL l (.U)
CAL l .D
l
Logical
OR operation
of the two
OR
@CAL | specified
@CALl(.U)
l
@CALl.D devices.
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - *4 *5 *5
S2 - - - - *4 *5 *5
D - - - - *4 - *5 -
Operand Explanation
S1 Specifies the data to be ORed or the device currently storing that data. *1 *2 *3
S2 Specifies the data to be ORed or the device currently storing that data. **1 *2 *3
D Specifies the device to store the OR operation result to.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is
processed.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the execution is ON, calculate OR of the specified BIN data of Logical OR true table
S1 and S2 , and store the result into D . Device status bit
If any bit of S1 and S2 is "1", the state of the same bit of D S1 0 0 1 1
become"1". S2 0 1 0 1
D 0 1 1 1
CAL|(.U) When the execution condition is ON, calculate OR of the specified unsigned 16-bit BIN
data of S1 and S2 , and store the result into D .
Example
l S1 S2 D
bit bit
15 0
S1 1111 0 0 0 0 1111 0 0 0 0
bit OR bit
15 0
S2 0 0 0 0 0 0 0 0 11111111
bit bit
15 0
4
D 1111 0 0 0 0 11111111
CAL|.D When the execution condition is ON, calculate the specified unsigned 32-bit BIN data of
Instructions
Simple Operation
[ S1 • S1 +1] and [ S2 • S2 +1], and store the result into [ D • D +1].
Example
l. D S1 S2 D
bit OR bit
31 0
S2 • S2 +1 0 0 0 0 0 0 0 0 11111111 0 0 0 0 0 0 0 0 11111111
bit bit
31 0
@CAL|. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
Perform operation to the data of internal auxiliary relay MR000 to MR015 and MR100 to MR115, and
output the result into the output relay R30000 to R30015.
Perform
CAL^ CAL^(.U)
CAL^.D
^
Exclusive
Exclusive OR
operation of the
OR
@CAL^ @CAL^(.U)
@CAL^.D
^
two specified
devices.
4 Available Devices
*1
( ): Not supported on the KV-1000
Local
Index
Bit Devices Word Devices Const Ind Spec Modify
Device
Instructions
Simple Operation
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - *4 *5 *5
S2 - - - - *4 *5 *5
D - - - - *4 - *5 -
Operand Explanation
S1 Specifies the data to be XORed or the device currently storing that data. *1 *2 *3
S2 Specifies the data to be XORed or the device currently storing that data. *1 *2 *3
D Specifies the device to store the XOR operation result to.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is
processed.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
When the executive condition is ON, perform the Exclusive OR of the Exclusive OR true table
specified BIN data of S1 and S2 , and store into D . Device status bit
When the values of the same bit of S1 and S2 are different, S1 0 0 1 1
the state of the same bit of D become"1". S2 0 1 0 1
D 0 1 1 0
CAL^(.U) When the execution condition is ON, perform the Exclusive OR of the unsigned16-bit
BIN data of which is specified by S1 and S2 , and store the result into D .
Example
^ S1 S2 D
bit bit
15 0
S1 1111 0 0 0 0 1111 0 0 0 0
S2 0 0 0 0 0 0 0 0 11111111
bit bit
15 0
D 1111 0 0 0 0 0 0 0 0 1111
CAL^.D When the execution condition is ON, perform the specified Exclusive OR of unsigned 32
bitsdata in [ S1 • S1 +1]and[ S2 • S2 +1], and store the result into 4
[ D • D +1].
Instructions
Simple Operation
Example
^.D S1 S2 D
S2 · S2 +1 0 0 0 0 0 0 0 0 11111111 0 0 0 0 0 0 0 0 11111111
bit bit
31 0
@CAL^. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
The last datas of R30000 to R30015 are stored in the internal auxiliary relay MR000 to MR015, when
any changes happen, turn R500 ON.
(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~
CAL~(.U)
CAL~.D
Bit Inversion of the
Bit Inversion
specified devices.
@CAL~
@CAL~(.U)
@CAL~.D
Execution condition @ C A L ~ S D
S D (@ ~ S D )
4
(@ N O T S D )
(@ C M L S D )
Index
*1 Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *4 *5 *5
D - - - - *4 - *5 -
Operand Explanation
S Specifies the bit inversion data or the device to which the data is currently stored. *1 *2 *3
D Specifies the device to store the bit inversion result to.
*1 The range of constants that can be processed differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bitsstraddling the next channel.
*3 When specifying T, C, CTH, current value is processed. When using CTC, setting value is
processed.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Description of Operation
CAL~(.U) When the execution condition is ON, perform bit inversion of the unsigned 16-bit data
which is specified in S ("0→1" → "1→0"), and store the result into D .
Example
S D
bit bit
15 0
S 1111 0 0 0 0 1 0 1 0 1 0 1 0
bit bit
15 0
D 0 0 0 0 1111 0 1 0 1 0 1 0 1
CAL~.D When the execution condition is ON, perform the Exclusive OR of the unsigned BIN data
which is in [ S • S +1] and store the result into [ D • D +1].
Example
S D
S • S +1 1111 0 0 0 0 1111 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 1111 0 0 0 0 1111 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
@CAL~. Only one scan is executed at the rising edge of the execution conditions. 4
Operation flag
Instructions
Simple Operation
CR2009 No change in state
CR2010 ON when the operation result is "0". Otherwise, OFF
CR2011 No change in state
ON when the indirect specification and index modify range is inappropriate. Otherwise, OFF
CR2012
Does not change when indirect specification or index modify is not specified to the operand.
Sample Program
The state of input relays R000 to R003 are inverted and output to output relays R500 to R503.
(Mnemonics list)
CR2002
R000 MR000 LD CR2002
Always ON CAL~ R000 MR000
CAL& MR000 $000F R500
KV-1000 KV Nano
device to lower
KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
bits, only
specified bits.
CAL/
CAL>>(.U)
CAL>> CAL>>.S
CAL>>.D
>> Shift the bits of
the specified
CAL>>.L
Shift right device to lower
@CAL>>(.U) bits, only
@CAL>> @CAL>>.S
@CAL>>.D
>> specified bits.
@CAL>>.L
4
Execution condition
@ C A L > > D n
>> D n
( @ > > D n )
Instructions
Simple Operation
Operand Explanation
Specifies the device for storing data to be shifted.
D
The operation result is stored in devices starting from D . *1 *2
n Specifies the number of bits to shift. *2 *3 *4
*1 When specifying T, C, current value is processed. When using CTC, setting value is processed.
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bitsstraddling the next channel.
*3 When the n value is 0, the MSB status is stored in CR2009.
*4 When a device is specified for n and the n value is 17 or more (for .U/.S)/33 or more
(for .D/.L), the following action takes place.
- When the suffix is ".S" or ".L" and the value of D is negative (less than 0)
Value of D = -1, CR2009=ON, CR2010=OFF
- In all other cases,
Value of D = 0, CR2009=OFF, CR2010=ON
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The CAL>>.S (@CAL>>.S) instruction and CAL>>.L (@CAL>>.L) instruction can be used
with KV-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 2)
Description of Operation
CAL>>(.U) When the execution condition is ON, shift right(shift to the lower bits) of the unsigned
16-bit BIN data in n which is specified by D , and store the result into D .
0 is stored in the high-order n bit. The bit ( n -1) status is stored in CR2009.
bit ( n -1)
bit bit
15 0
D 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
D 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 10 0 1
Filled with 0 1
CR2009
(Carry) 4
CAL>>.S When the execution conditions are ON, the signed 16-bit BIN data specified with D
Instructions
Simple Operation
is arithmetic right shifted (shifted toward the smaller bit number) for the number of bits
specified with n . The results are stored in the device specified with D .
If " D ≥0", 0 is stored in the high-order n bit. If " D <0", 1 is stored. The bit
( n -1) status is stored in CR2009.
bit( n -1)
bit bit
15 0
D 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0
D 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0
Filled with 1 1
CR2009
(Carry)
CAL>>.D When the execution conditions are ON, the unsigned 32-bit BIN data specified with
( D • D +1) is right shifted (shifted toward the smaller bit number) for the number
of bits specified with n . The results are stored in the device specified with
( D • D +1).
0 is stored in the high-order n bit. The bit ( n -1) status is stored in CR2009.
bit( n -1)
bit bit
31 0
D · D +1 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 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
Filled with 0
1
CR2009
(Carry)
CAL>>.L When the execution conditions are ON, the signed 32-bit BIN data specified with
( D • D +1) is arithmetic right shifted (shifted toward the smaller bit number) for
the number of bits specified with n . The results are stored in the device specified
with ( D • D +1).
If "[ D • D +1]≥0", 0 is stored in the high-order n bit. If "[ D • D +1]<0",
1 is stored. The bit ( n -1) status is stored in CR2009.
bit ( n -1)
bit bit
15 0
D D +1 10010000110011110000110010101110
4 D D +1 111110010000110011110000110010101 1 1 0
Instructions
Simple Operation
@CAL>>. Only one scan is executed at the rising edge of the execution conditions.
CAL>>When the SRA instruction is executed at every scan, the bits are shifted at each
scan for the duration that the execution condition is ON. If the SRA instruction is
executed not at each scan but at the rising edge of the execution condition, use the
differential type execution instruction as follows.
Operation flag
Sample Program
The BCD data (two digits) from the digital switch entered to input relays R30008 to R30015 is stored to
data memory DM0.
(Mnemonics list)
CR2002
>> R30000 #8 LD CR2002
Always ON CAL>> R30000 #8
CAL& $00FF R30000 DM0
& $00FF R30000 DM0
MEMO
Instructions
Simple Operation
CAL/
CAL<<(.U)
CAL<< CAL<<.S
CAL<<.D
<< Specify the bit
content of the
CAL<<.L
Shift left device, then shift
@CAL<<(.U) the device to the
@CAL<< @CAL<<.S
@CAL<<.D
<< higher bit.
@CAL<<.L
4
Execution condition @ C A L < < D n
<< D n
( @ < < D n )
Instructions
Simple Operation
Operand Explanation
Specifies the device for storing data to be shifted.
D
The operation result is stored in devices starting from D . *1 *2
n Specifies the number of bits to shift. *2 *3 *4
*1 When specifying T, C, current value is processed. When using CTC, setting value is processed.
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 When the value of n is "0", the state of the LSB is stored to CR2009.
*4 When a device has been specified to n , n Values above 17 will be stored for ".U" and
values above 33 for ".D" as follows.
Value of D =0, CR2009=OFF, CR2010=ON
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point The CAL<<.S (@CAL<<.S) instruction and CAL<<.L (@CAL<<.L) instruction can be used
with KV-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 2)
Description of Operation
CAL<<(.U) When the execution condition is ON, shift left (shift to the higher bits) of the unsigned 16-
bit BIN data in n which is specified by D , and store the result into D .
0 is stored in the low-order n bit. The bit (16- n ) status is stored in CR2009.
bit (16 - n )
bit bit
15 0
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 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 conditions are ON, the signed 16-bit BIN data specified with D
is arithmetic left shifted (shifted toward the higher bit number) for the number of bits 4
specified with n . The results are stored in the device specified with D .
Instructions
Simple Operation
0 is stored in the low-order n bit. The bit (16- n ) status is stored in CR2009.
bit(16- n )
bit bit
15 0
111 0 1 0 0 0 0 0 0 11 0 0 1 D
111 0 1 0 0 0 0 0 0 11 0 0 1 0 0 0 0 0 D
Delete lower n bits
1
Filled with 0
CR2009
(Carry)
CAL<<.D When the execution conditions are ON, the signed 32-bit BIN data specified with
( D • D +1) is left shifted (shifted toward the higher bit number) for the number of
bits specified with n . The results are stored in the device specified with
( D • D +1).
0 is stored in the low-order n bit. The bit (32- n ) status is stored in CR2009.
bit(32- n )
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 conditions are ON, the signed 32-bit BIN data specified with
( D • D +1) is arithmetic left shifted (shifted toward the higher bit number) for the
number of bits specified with n . The results are stored in the device specified with
( D • D +1).
0 is stored in the low-order n bit. The bit (32- n ) status is stored in CR2009.
bit(32- n )
bit bit
31 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 D D +1
4 111 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
1
Filled with 0
CR2009
(Carry)
@CAL<<. Only one scan is executed at the rising edge of the execution conditions.
CAL<<When the SRA instruction is executed at every scan, the bits are shifted at each
scan for the duration that the execution condition is ON. If the SRA instruction is
executed not at each scan but at the rising edge of the execution condition, use the
differential type execution instruction as follows.
Operation flag
Sample Program
Set DM1to higher bit, and store the datas of the lower bits which are stored in DM0, DM1 seperately
into DM10.
(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 memory card control.
For the details on positioning instruction, cam switch instruction, frequency
counting instruction and log instruction, please see the CPU Unit User's
Manual.
HKEY
HKEY
HKEY Stores Hex key data to be read to
Hex key input
the control relay in time interval.
5 Operand
S
Explanation
Specifies the leading device of the input relays to perform reading on.*1
D Specifies the leading device of the output relays to perform timing output of reading on.*1
Instructions
Data Processing
*1 Continuous 4 bits are occupied. Operation is normal even if the device straddles channels.
Operation Description
• When the execution condition is ON, the information of the four bits specified by S are
captured in time interval (in the sequence D →" D +1"→" D +2"→+" D +3") into four
times.(8 scanning counts are required for processing.)
• The captured information is stored to control relays CR3600 to CR3615.
24 VDC 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
Corresponding key 0 1 2 3 4 5 6 7 8 9 A B C D E F
Multiple key enable/disable, and end of key reading timing change according to the state of the
special auxiliary relays.
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 is
10 ms/operation or less.
• Execution of the instruction is cancelled when the scan time exceeds 200 ms.
EXTENDED INSTRUCTIONS
• When the relay assigned to the KL Series is specified as the operand, this is set so that
the "scan time of the KV-7500/7300/5500/5000/3000/1000 PLC is greater than the KL
PLC 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
Instructions
Data Processing
Sample Program
Changing the setting value of internal counters by the BCD digital switch
3 2 1 0
10 10 10 10
BCD Digital switch
Set value:$5679
1 2 4 8
+ COM0 R000 R001 R002 R003
24 VDC 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
7-segment
(4 bits) of a specified word
device to data for 7-segment
decode display, and stores the result to
@SEG @SEG(.U)
@SEG.D
SEG the lower 8 bits of the internal
register.
EXTENDED INSTRUCTIONS
Execution condition S
SEG STA @ S E G S n
n
5 Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
Instructions
Data Processing
S - - - - *4 *5 *5
- -
n - - - - *4 *5 *5
-
Operand Explanation
S Specifies the (word) device to which the data to be decoded is currently stored.*1
n Specifies the number of digits (0 to 3 for .U, and 0 to 7 for .D).*2 *3
*1 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*2 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*3 The following values are used when the value exceeds 0 to 3 or 0 to 7 when a word device has
been specified.
.U suffix instructions: The values of the lower two bits of the specified device are used.
.D suffix instructions: The values of the lower three bits of the specified device are used.
For example, when DM01000 is specified to n and the instruction suffix is .U, and that value
is "23" (BIN: 0000 0000 0001 0111, "3" is used as the value of n as the value of the lower
two bits is "3".
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
SEG(.U) When the execution condition is ON, the n digit of the word device specified by
S is decoded to data for 7-segment display, and the result is stored to the lower
eight bits of the 16-bit internal register. The upper eight bits do not change.
DM0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
F E D C B A 9 8 7 6 5 4 3 2 1 0
16-bit internal
register 0 1 0 1 1 0 1 1
SEG.D When the execution condition is ON, the n th digit of the word device specified by
" S / S +1" is decoded to data for 7-segment display, and the result is stored to
the lower eight bits of the 16-bit internal register. The upper eight bits do not change.
EXTENDED INSTRUCTIONS
Example When " S / S +1" is DM0 · DM1, the currently stored data is $12345678, and
n is #3
$12345678
#7 #6 #5 #4 #3 #2 #1 #0
DM1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 DM0
F E D C B A 9 8 7 6 5 4 3 2 1 0
16-bit internal
register 0 1 1 0 1 1 0 1 5
Instructions
Data Processing
@SEG. Only one scan is executed at the rising edge of the execution conditions.
Value of
16-bit internal register Bit0
Specified Digit Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
$0 0 0 1 1 1 1 1 1
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 to 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
(2nd digit) (1st digit)
5 d d
Instructions
Data Processing
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
Instructions
Data Processing
BCNT
BCNT BCNT(.U)
BCNT.D
BCNT
Bit
Counts the number of bits
currently ON in internal
count
@BCNT @BCNT(.U)
@BCNT.D
BCNT
registers.
EXTENDED INSTRUCTIONS
Execution condition
LDA BCNT STA @ B C N T
- - - - - - - - - - - - - - - - - - - - -
Instructions
Data Processing
The bit length of internal registers that can be handled varies according to the instruction suffix type.
"Suffix" (Page 1-23)
Operation Description
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 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. Only one scan is executed at the rising edge of the execution conditions.
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
Instructions
Data Processing
CON
STA DM0
DCNT DCNT(.U)
DCNT.D
DCNT
Data
Detects devices of the same
value as the internal register
count in the specified range, and
@DCNT @DCNT(.U)
@DCNT.D
DCNT counts the number of devices.
EXTENDED INSTRUCTIONS
Execution condition S
LDA DCNT STA @ D C N T S n
n
S - - - - *4 - - - - -
n - - - - *4 *5 *5
-
Operand Explanation
S Specifies the leading device of the range to be detected.*1*2
n Specifies the number of data to detected or the leading device currently storing that data.*3
*1 The bit length of internal registers that can be handled varies according to the instruction suffix
type.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
DCNT(.U) When the execution condition is ON, n data stored in devices starting from S
is compared with each respective 16-bit internal register. The number of data having the
same value in 16-bit internal registers is stored to the 16-bit internal register. The number
of 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 in devices starting from S is
compared with each respective 32-bit internal register. The number of data having the
same value in 32-bit internal registers is stored to the 32-bit internal register. The number
of 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
Result 2
@DCNT. Only one scan is executed at the rising edge of the execution conditions.
5
Operation flag
Instructions
Data Processing
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF
CR2011 No change in state
ON when the following condition is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate, or when n =0.
CR2012 • When a device is specified in n and S + n exceeds the device range
No change in state when n is a constant, and index specification or index modify has not
been specified to S
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
devices to which the same value is currently stored is stored to 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 to DM100 to DM199. The number of
devices to which the same value is currently stored is stored to 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
Instructions
Data Processing
SER SER(.U)
SER.D
SER Detects devices of the same
value as the internal register in
Search
the specified range, and
@SER @SER(.U)
@SER.D
SER detects their device Nos.
EXTENDED INSTRUCTIONS
5 R (DR)
MR
LR
(B)
T
DM
C CTC CR TM
(W)
EM
FM T
(ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z
Instructions
Data Processing
S - - - - *4 - - - - -
n - - - - *4 *5 *5
-
Operand Explanation
S Specifies the leading device of the range to be detected.*1*2
n Specifies the number of data to detect or the leading device currently storing that data.*3
*1 The bit length of internal registers that can be handled varies according to the instruction suffix
type.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
SER(.U) When the execution condition is ON, n data stored in devices starting from S is
compared with each respective 16-bit internal register. The device Nos. currently stored
with same value as the value in 16-bit internal registers is stored to the 16-bit internal
register. When multiple device Nos. are detected, the smallest device No. is stored. The
device 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 in devices starting from S is
compared with each respective 32-bit internal register. The device Nos. of the lower 16
bits currently stored with same value as the value in 32-bit internal registers are stored to
the 32-bit internal register. When multiple device Nos. are detected, the smallest device
EXTENDED INSTRUCTIONS
No. is stored. The device 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
S +3 23456789 S +2 When
Detect device No. which stores
34567890 When the same value as that in 32-bit
S +5 S +4
internal register
n :
The result is stored to 32-bit
( 2 n word) S +2 ( n -3) +1 45678901 S +2 ( n -3) When internal register
5
bit 32-bit internal register bit
31 0
Result S +2
@SER. Only one scan is executed at the rising edge of the execution conditions.
Instructions
Data Processing
Point • Only device No. is stored as the result. There is no difference in DM, TM, CM and other
device types.
• When there are no matching devices, nothing is written to internal registers.
Accordingly, the value that was last stored by LDA remains in the internal register.
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 device Nos. to
which the same value is currently stored are stored to 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 to data memory DM0 is
compared with the signed 16-bit BIN data currently stored to DM100 to DM199. The device Nos. to
which the same value is currently stored are stored to 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
Instructions
Data Processing
DSE
5 R (DR)
MR
LR
(B)
T
DM
C CTC CR TM
(W)
EM
FM
(ZF)
T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
- *4
Instructions
Data Processing
S1 - - - - - - - - -
S2 - - - - *4 - - - - -
D - - - - *4 - - - - -
n - - - - *4 *5 *5
-
Operand Explanation
S1 Specifies the searched data or the leading device to which the data is currently stored. *1 *2
S2 Specifies the leading device of the range to be detected. *1 *2
D Specifies the leading device in which the search result is stored. *1 *2
n Specifies the data (1 to 65535) to be searched or the leading device in which this data is stored.*3
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 When a bit device has been specified, 16 continuous bits are occupied.
When a word device has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
DSER(.U) When the execution condition is ON, the unsigned 16-bit data specified with S1 is
the keyword to search the range n starting from S2 .
• The position of the first matched device (counted from S2 ) is stored in D .
• The number of devices matched with the keyword is stored in D +1.
• In case no matching is found, "0" is stored in" D , D +1".
bit bit S1
15 0 bit15 bit0
Position at first matching
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
-1 5678 When Result
S2 + n 16-bit
DSER.D When the execution condition is ON, the unsigned 32-bit data specified with
" S1 · S1 +1" is the keyword to search the range n starting from
" S2 · S2 +1".
• The position of the first matched device (the double words counted from
EXTENDED INSTRUCTIONS
" S2 · S2 +1") is stored in D .
• The number of devices matched with the keyword is stored in " D +1".
• In case no matching is found, "0" is stored in D ," D +1".
bit bit bit bit bit S1 +1 S1 bit
31 16 15 0 31 0
Position at first
S2 +1 12345678 S2 When 23456789
D
S2 +3 34567890 S2 +1 When
3
S2 +5 23456789 S2 +2 When
16-bit
n
…
…
(2× n word)
-3)+1 45678901 -3) Number of consistence
5
S2 +( n S2 +( n When
D +1
S2 +( n -2)+1 23456789 S2 +( n -2) When
2
-1)+1 56789012 -1) When Result
S2 +( n S2 +( n 16-bit
Instructions
Data Processing
@DSER. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
When Input Relay R00 is ON, how many devices with the value "1234" are there and which device
counted from the leading device is searched.
MAX(.U)
BIN data currently
stored to a
specified range,
MAX.S
and stores this to
internal registers.
MAX MAX.D
MAX.L
MAX
@MAX @MAX.D
@MAX.L
MAX
@MAX.F
@MAX.DF
MIN(.U)
MIN.S
MIN MIN.D
MIN.L
MIN
5 @MIN(.U)
@MIN.S
value specified range, and stores this to
internal registers.
@MIN.L
@MIN.F
@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
S Specifies the leading device of the range to be detected.*1*2
n Specifies the number of data to detect or the leading device currently storing that data.*3
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bits straddling the next channel.
*3 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
5-20 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Data Processing Instructions
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 KV-7000 Series CPU
EXTENDED INSTRUCTIONS
units that have CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version" (Page 2)
Operation Description
MAX(.U) / MIN(.U)
When the execution condition is ON, each of n data starting from S is
compared. Currently stored values are compared as unsigned 16-bit BIN data.
As a result of comparison, the maximum value (MAX.U) or the minimum value (MIN.U) is
5
stored to 16-bit internal register.
Instructions
Data Processing
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
…
S + n -1 7654 1234
MAX.S / MIN.S
When the execution condition is ON, each of n data starting from S is
compared. Currently stored values are compared as signed 16-bit BIN data.
As a result of comparison, the maximum value (MAX.S) or the minimum value (MIN.S) is
stored to 16-bit internal register.
bit bit
15 0
S 1234
MAX.S:store Max value
S +1 2345 16-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, each of n data starting from S is
compared. 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, each of n data starting from S is
Instructions
Data Processing
compared. Currently stored values are compared as signed 32-bit BIN data.
As a result of comparison, the maximum value (MAX.L) or the minimum value (MIN.L) 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, each of n data starting from S is
compared. 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.F: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, each of n data starting from S is
compared. 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) +1 -1.234567 S +4 ( n -3) MIN.DF:store Min value
S +4 ( n -2) +1 -2.345789 S +4 ( n -2) bit
63
64-bit internal register bit
0
@MAX. / MIN.
S +4 ( n -1) +1 -3.456890 S +4 ( n -1) -3.456890
5
Instructions
Data Processing
Only one scan is executed at the rising edge of the execution conditions.
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
5 CON
STA DM1001
Instructions
Data Processing
(2) Signed 16-bit BIN data max. value search/min. value search
When input relay R000 is ON, the signed 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.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 to 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 to 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".
EXTENDED INSTRUCTIONS
(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
5
memories "DM0 · DM1" to "DM198 · DM199" is compared. The maximum value is stored to "DM1000 ·
Instructions
Data Processing
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 search
When input relay R000 is ON, the double precision floating point type real number stored in data
memories "DM0 · DM1 · DM2 · DM3" to "DM396 · DM397 · DM398 · DM399" is compared. The maximum
value is stored to "DM1000 · DM1001 · DM1002 · DM1003". Also, the minimum value is stored to
"DM1004 · DM1005 · DM1006 · DM1007".
(Mnemonics list)
R000 DM0 DM1000
MAX.DF STA.DF LD R000
#100 MPS
MAX.DF DM0 #100
DM0 DM1004
CON
MIN.DF STA.DF STA.DF DM1000
#100 MPP
MIN.DF DM0 #100
CON
STA.DF DM1004
AVG(.U)
AVG.S
AVG AVG.D
AVG.L
AVG
@AVG @AVG.D
@AVG.L
AVG
@AVG.F
@AVG.DF
5
Execution condition S
AVG STA @ A V G S n
n
Instructions
Data Processing
Operand Explanation
S Specifies the leading device of the range to calculate the average value.*1*2
Specifies the number of data whose average is to be calculated or the leading device to which that
n
data is currently stored.*3
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bits straddling the next channel.
*3 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
*6 Cannot be specified when ".F" or ".DF" is selected as the suffix.
Point The AVG.F (@AVG.F) instruction and AVG.DF (@AVG.DF) instruction can be used with
KV-7000 Series CPU units that have CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version" (Page 2)
Operation Description
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 words) S + n -3 16383 Average value is stored to 16-bit internal register.
S + n -2 32767 16-bit internal register
bit15 bit0
Instructions
Data Processing
bit bit
15 0
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
EXTENDED INSTRUCTIONS
31 16 15 0
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 is calculated, and the result is
5
S
stored in the 64-bit internal register
Instructions
Data Processing
S +3 1.2345678 S
S +7 2.3456789 S +4
S +11 3.4567890 S +8
…
…
Average value is stored
(4 n word) S +4 ( n -3) +1 -1.234567 S +4 ( n -3) to 64-bit internal register
@AVG. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
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
Instructions
Data Processing
#100 AVG.S DM0 #100
CON
STA.S 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 in "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 in "DM1000 · DM1001 · DM1002 · DM1003".
(Mnemonics list)
R000 DM0 DM1000
AVG.DF STA.DF LD R000
#100 AVG.DF DM0 #100
CON
STA.DF DM1000
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-29
Data Processing Instructions
Example of application
Let's assume that the average value of travel distance data (expressed as unsigned 32-bit BIN data)
is calculated, and stored to data memories "DM1000 · DM1001", and that the travel distance data is
EXTENDED INSTRUCTIONS
currently stored to "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-122)
(Mnemonics list)
CR2008 DM0
ZRES LD CR2008
ZRES DM0 DM119
5
DM119
LDP R000
R000 WSR.D
WSR.D DM100 #10 #1
↑ DM100 #10 #1 MOV.D DM0 DM100
AVG.D DM100 #10
Instructions
Data Processing
MOV.D CON
DM0 DM100 STA.D DM1000
DM100 DM1000
AVG.D STA.D
#10
MEMO
EXTENDED INSTRUCTIONS
5
Instructions
Data Processing
WSUM(.U)
WSUM.S
WSUM WSUM.D
WSUM.L
WSUM
Calculates the total value of
WSUM.F
BIN data currently stored to
WSUM.DF
Word sum a specified range, and
@WSUM(.U) stores this to internal
EXTENDED INSTRUCTIONS
@WSUM.S
registers.
@WSUM @WSUM.D
@WSUM.L
WSUM
@WSUM.F
@WSUM.DF
5 Execution condition S
WSUM STA @ W S U M S n
n
Instructions
Data Processing
Operand Explanation
S Specifies the leading device of the range to calculate the total value.*1*2
Specifies the number of data whose total value is to be calculated or the leading device to which that
n
data is currently stored.*3
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32/64 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32/64 bits straddling the next channel.
*3 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
*6 Cannot be specified when ".F" or ".DF" is selected as the suffix.
Point The WSUM.F (@WSUM.F) instruction and WSUM.DF (@WSUM.DF) instruction can be
used with KV-7000 Series CPU units that have CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version" (Page 2)
Operation Description
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.
EXTENDED INSTRUCTIONS
bit bit
15 0
S 16
S +1 256
S +2 4096
…
…
n
High 16 bits are stored to high 16 bit and TM0 of 32-bit
( n word) S + n -3 16383 internal register
S + n -2 32767
32-bit internal register
5
16-bit internal
TM0 register
32-bit
(2 word)
WSUM.S
Instructions
Data Processing
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
S +1 -16350
S +2 -8175
…
n
High 16 bits are stored to high 16 bit and TM0 of 32-bit
( n word)
S + n -3 8175 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
temporary data memories TM0 to TM1. The result is calculated as 64-bit data.
bit bit bit bit
31 16 15 0
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
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 memories 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
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
EXTENDED INSTRUCTIONS
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 is calculated, and the result is stored in the
5
S
64-bit internal register.
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
Instructions
Data Processing
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) +1 -1.234567 S +4 ( n -3)
S +4 ( n -2) +1 -2.345789 S +4 ( n -2)
64-bit internal register
S +4 ( n -1) +1 -3.456890 S +4 ( n -1) Total
64-bit
@WSUM. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
WSUM (.U)
When input relay R000 is ON, the total value of the unsigned 16-bit BIN data currently stored to 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
Instructions
Data Processing
#100 WSUM DM0 #100
CON
STA.D 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 to 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
range, and
BSUM
Calculates the total value of the BIN data stores them to
the
register
internal
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
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S - - - - *3 - - - - - -
-
Instructions
Data Processing
Operand Explanation
S Specifies the leading device of the range to calculate the total value.*1
n Specifies the number of data (in byte units) to calculate the total value. *2
*1 When a bit device has been specified, the following continuous bits from the start of the channel
are handled.
When n is an even number: 8 x n bits
When n is an odd number: 8 x n " n +1" bits
*2 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
BSUM When the execution condition is ON, the total value of each of the lower and upper BIN
data currently stored to a specified range starting from S is calculated, and stored
to 32-bit internal register.
The upper 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 upper eight bits of the last
device are calculated.
Calculation is performed in order upper to lower bits, and when n is an odd number,
the lower eight bits of the last word data are ignored.
16-bit
(1 word)
bit bit bit bit
15 8 7 0
S BDh 21h
BDh
Higher 16 bits of 32-bit internal register are
S +1 B4h DDh 21h
also stored to TM0
B7h B0h B4h
S +2
…
TM0
…
@BSUM Only one scan is executed at the rising edge of the execution conditions.
5-36 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Data Processing Instructions
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
This flag is ON in the following instances. Otherwise, it is OFF.
• When a timer/counter is specified to S
• When a device other than the leading device of the channel is specified when a bit device is
specified to S
CR2012 • When the value of n is 0
• When the indirect specification or index modify range is inappropriate
• When a device is specified in n and S + n exceeds the device range
No change in state when n is a constant, and index specification or index modify has not
been specified to S
Instructions
Data Processing
CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
Sample Program
When input relay R000 is ON, the ASCII text string currently stored to starting from data memory DM0
is totaled in byte units, and the result is stored to "DM1000 · DM1001".
(Mnemonics list)
R000 LEN
DM0 DM100 (1) LD R000
LEN DM0 DM100
BSUM DM0 DM100
DM0 DM1000 CON
BSUM STA.D (2) 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 byte units, and the result is stored to
"DM1000 · DM1001".
CRC
CRC Calculates the CRC value of a
Calculate specified number of devices,
CRC value and stores this to internal
@CRC
CRC
registers.
EXTENDED INSTRUCTIONS
5
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - - - - - - - - - - -
Instructions
Data Processing
S2 - - - - *4 - - - - - -
n - - - - *4 *5 *5
-
Operand Explanation
S1 Specifies the operation mode.*1
S2 Specifies the leading device of the data block to calculate.*2
Specifies the number of data (1- 65535). *3
n " S1 +1" is ON: Specifies the number in 1-byte (8-bit) units.
" S1 +1" is OFF: Specifies the number in 1-word (16-bit) units.
*1 Continuous 4 bits are handled.When a relay other than the leading relay (R114, R1315,
R1014etc.) of the channel has been specified, the relay is handled straddling the next channel.
*2 When a bit device has been specified, 16 continuous bits from the start of the channel are handled.
*3 When a bit device has been specified, 16 continuous bits are handled. When a word device has
been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
CRC When the execution condition is ON, the CRC value of n data stored in devices
starting from S2 is calculated in the operation mode specified by S1 .
The action of the CRC instruction changes as shown in the following table according to
the value of operation mode S1 .
CRC Operation Method
Item
When ON When OFF
S1 +0 CRC Operation Method CRC-ITU-T(CRC-CCITT) CRC-16(CRC-ANSI)
Operation is performed in order upper 8 Operation is performed only on
bits -> lower 8 bits. the lower 8 bits. (The upper 8
n : Even n : Odd bits are ignored.)
Order of
bit bit bit bit bit bit bit bit bit bit bit bit
15 8 7 0 15 8 7 0
+1
15 8 7 0
S1
operation (1) (2) (1) (2) (1)
(3) (4) (3) (4) (2)
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.
5-38 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Data Processing Instructions
EXTENDED INSTRUCTIONS
inversion the CRC value is calculated.
* " S1 +2", " S1 +3" are normally used OFF. Set these as necessary to match the equipment to be used.
@CRC Only one scan is executed at the rising edge of the execution conditions.
Reference The following describes an example relating operation data bit order inversion in byte units.
Operation Data
Bit Order Inversion CRC-ITU-T S1 +0:ON CRC-16 S1 +0:OFF
5
bit bit bit bit
Not inverted 7 0 7 0
Instructions
Data Processing
bit bit bit bit
Inverted 7 0 7 0
Operation flag
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 all values currently
stored in the 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
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
D1 - - - *1 - - - - - -
Instructions
Data Processing
D2 - - - *1 - - - - - -
Operand Explanation
D1 Specifies the leading device of the range to be reset (stores 0).
D2 Specifies the final device of the range to be reset (stores 0).
Operation Description
ZRES When the execution condition is ON, the devices in the range specified by D1 to
D2 are reset.
When a word device has been 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
EXTENDED INSTRUCTIONS
R1003: ON ON :R1003
R1004: ON ON :R1004
Instructions
Data Processing
R1013: ON ON :R1013
@ZRES Only one scan is executed at the rising edge of the execution conditions.
Point • The current value 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
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 EXT.S
EXT.D
EXT
@EXT.D
@EXT.L
Execution condition
LDA EXT STA.D @ E X T
Available Devices
5
( ): Not supported on the KV-1000
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
Instructions
Data Processing
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
Operation Description
Extends the values of 16-bit internal registers to 32 bits. This instruction is used for addition,
subtraction, multiplication, and division arithmetic operation calculations.
"ADD instruction" (Page 4-38)
"SUB instruction" (Page 4-42)
"MUL instruction" (Page 4-46)
"DIV instruction" (Page 4-52)
"ROOT instruction" (Page 4-64)
EXT( .U) When the execution condition is ON, extends unsigned 16-bit BIN data currently stored to
16-bit internal registers to 32 bits.
Stores $0 to temporary data memory TM0 and to the upper 16 bits of the 32-bit internal
register.
1234
1234 TM0 16-bit internal register
16-bit 1234
㧔word㧕
32-bit
㧔word㧕
EXT.S When the execution condition is ON, extends signed 16-bit BIN data currently stored to
16-bit internal registers to 32 bits.
Stores $0 if the data is plus or $FFFF if the data is minus to temporary data memory TM0
and to the upper 16 bits of the 32-bit internal register.
-1234
-1234 TM0 16-bit internal register
16-bit -1234
(1 word)
32-bit
(2 word)
Extends the values of 32-bit internal registers to 64 bits. This instruction is used for addition,
subtraction, multiplication, and division arithmetic operation calculations.
"MUL instruction" (Page 4-46)
"DIV instruction" (Page 4-52)
EXTENDED INSTRUCTIONS
"ROOT instruction" (Page 4-64)
EXT(.D/.L)
EXT.D When the execution condition is ON, extends unsigned 32-bit BIN data currently stored
to 32-bit internal registers to 64 bits. Stores $0 to temporary data memories "TM0 · TM1".
TM1 TM0 32-bit internal register
12345678 12345678
5
32-bit 64-bit
(2 word) (4 word)
EXT.L When the execution condition is ON, extends signed 32-bit BIN data currently stored to
Instructions
Data Processing
32-bit internal registers to 64 bits. Stores $0 if the data is plus or $FFFFFFFF if the data is
minus to temporary data memories "TM0 · TM1".
TM1 TM0 32-bit internal register
-12345678 -12345678
32-bit 64-bit
(2 word) (4 word)
@EXT. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
Sample Program
The unsigned 16-bit BIN data currently stored to data memory DM0 is extended to unsigned 32-bit
BIN data, and the unsigned 32-bit BIN data currently stored to "DM10 · DM11" is added.
EXTENDED INSTRUCTIONS
The signed 16-bit BIN data currently stored to data memory DM0 is extended to signed 32-bit BIN
5 data, and the signed 32-bit BIN data currently stored to "DM10 · DM11" is added.
The result is stored to "DM20 · DM21".
Instructions
Data Processing
(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 to data memories "DM0 · DM1" is extended to 64-bit
unsigned BIN data, and the 64-bit unsigned BIN data is divided by the unsigned 32-bit BIN data
currently stored to "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 to data memories "DM0 · DM1" is extended to 64-bit
signed BIN data, and the 64-bit signed BIN data is divided by the signed 32-bit BIN data currently
stored to "DM10 · DM11".
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
Instructions
Data Processing
BCMP
BCMP(.U) BCMP
BCMP BCMP.S
BCMP.D Compare
BCMP.L data Compares the BIN data in
between two specified ranges.
@BCMP(.U) BCMP
blocks
@BCMP @BCMP.S
EXTENDED INSTRUCTIONS
@BCMP.D
@BCMP.L
5
n
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
S1 - - - - *4 - - - - -
S2 - - - - *4 - - - - -
D - - *4 - - - - - - -
n - - - - *4 *5 *5
-
Operand Explanation
S1 Specifies the leading device of the data block to compare.*1
S2 Specifies the leading device of the data block to compare.*1
D Specifies the leading device to which the compare result is stored. *2
n Specifies the number of data to compare.*3
*1 When a bit device has been specified to S1 and S2 , 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*2 When a bit device has been specified to D , the program will function normally even if the bit
device straddles channels.
When a word device has been specified to D , the LSB of n 16-bit word devices
becomes the store destination of the result. Bits other than the lowermost bit do not change.
*3 When a bit device has been specified to n , 16 continuous bits are occupied.
When a word device has been specified to n , one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
BCMP(.U) When the execution condition is ON, n unsigned 16-bit BIN data starting from
and unsigned 16-bit BIN data starting from are compared, and the
EXTENDED INSTRUCTIONS
S1 n S2
result is stored to the bit device 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 number of signed 16-bit BIN data starting
Instructions
Data Processing
from S1 and n number of signed 16-bit BIN data starting from S2 are
compared, and the result is stored to the bit device 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
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 each compared,
and the result is stored to the bit device 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 nnn signed 32-bit BIN data starting from S2 are each compared, and the result is
stored to the bit device 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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
5 KV-7500/7300/5500/5000/3000
CM5176.
When CR2012 is ON, detailed error information is stored into CM5150 to
Instructions
Data Processing
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
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
Instructions
Data Processing
BCMPI range.
BCMPI(.U) BCMPI
BCMPI BCMPI.S
BCMPI.D
Compare Compares specified BIN
BCMPI.L
block value data with BIN data in a
@BCMPI(.U) BCMPI data specified range.
@BCMPI @BCMPI.S
EXTENDED INSTRUCTIONS
@BCMPI.D
@BCMPI.L
Operand Explanation
S1 Specifies the leading device of the data block to compare.*1
S2 Specifies the device to compare.*1
D Specifies the leading device to which the compare result is stored. *2
n Specifies the number of data to compare.*3
*1 When a bit device has been specified to S1 and S2 , 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
*2 When a bit device has been specified to D , the program will function normally even if the bit
device straddles channels.
When a word device has been specified to D , the LSB of n 16-bit word devices
becomes the store destination of the result. Bits other than the LSB do not change.
*3 When a bit device has been specified to n , 16 continuous bits are occupied.
When a word device has been specified, one word is occupied by n .
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
BCMPI(.U) When the execution condition is ON, n unsigned 16-bit BIN data starting from
and unsigned 16-bit BIN data currently stored to the device specified by
EXTENDED INSTRUCTIONS
S1 S2
are compared, and the result is stored to the bit device starting from D .
bit
16
bit
0
When Result
S1 1234 D ON
S1 +1 5678 D +1 OFF
bit bit
16 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
Instructions
Data Processing
and signed 16-bit BIN data currently stored to the device specified by S2 are
compared, and the result is stored to the bit device starting from D .
bit
16
bit
0
When Result
S1 -1234 D ON
S1 +1 -5678 D +1 OFF
bit bit
16 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 unsigned 32-bit BIN data currently stored to the device specified by
" S2 · S2 +1" are compared, and the result is stored to the bit device 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 signed 32-bit BIN data currently stored to the device specified by " S2 · S2 +1"
are compared, and the result is stored to the bit device 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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
EXTENDED INSTRUCTIONS
CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
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
LD MR000
5
CR2010 R500
OUT R501
LD MR001
OUT R502
Instructions
Data Processing
LD MR002
MR000 R501 OUT R503
MR001 R502
MR002 R503
RND
RND
RND
D Random
Occurred random number is stored in
number
device.
@RND
RND occur
D
Operand Explanation
D Specify the device in which the occurred random number is stored.*1
*1 When a bit device has been specified, 16 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16 bits straddling the next channel.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
Operation Description
RND When the execution condition is ON, a random number occurs from the value stored in
the device specified with D .
The stored value is a random number within the range of 1 to 65535. If executed when
D =0, the value of D becomes "1".
@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-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
Sample Program
Random numbers occur in the rising edge of Input Relay R000. When nput Relay R000 is ON, the
random number is initialized.
EXTENDED INSTRUCTIONS
(Mnemonics list)
R000 RND
↑ DM0 LDP R000
RND DM0
Randum number occur Randum data LD R001
MOV #0 DM0
R001 ΜΟV
#0 DM0
Reset Randum data
Instructions
Data Processing
SORT(.U)
SORT SORT.S
SORT.D
SORT
@ SORT.D
@ SORT.L
5 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify
MR DM EM
Instructions
Data Processing
Operand Explanation
S Specifies the sort parameter. *1
D Specifies the leading address of the data tables to be sorted.*2
n Specifies the data to be sorted. (1 to 65535) *1
*1 • When a bit device is specified, 16 continuous bits are occupied. When a channel other than
the leading channel (MR002, R1012, etc.) is specified, the 16 bits are occupied crossing to
the next channel.
• When a word device is specified, one word is occupied.
• The parameter is specified with the following method.
bit bit
15
S 0
Point This instruction can be used with KV-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 2)
Operation Description
SORT(.U)/SORT.S
When the execution conditions turn ON, the items of 16 bit binary data from the
EXTENDED INSTRUCTIONS
n
device specified in D are sorted 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
Instructions
Data Processing
653 653
D + n -1 21 1398 D + n -1
SORT.D/SORT.L
When the execution conditions turn ON, the n items of 32 bit binary data from the
device specified in D are sorted according to the parameter specified with S .
D ・ D +1 12345 6665321 D ・ D +1
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. Only one scan is executed at the rising edge of the execution conditions.
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.
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-60)
Operation flag
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
Instructions
Data Processing
Operand Explanation
S Specifies the sort parameter. *1
D1 Specifies the leading address of the data tables to be sorted.*2
n Specifies the data to be sorted. (1 to 65535) *3
D2 Specifies the bit device which notifies the end of operation. *4
*1 • When a bit device is specified, 32 continuous bits are occupied. When a channel other than
the leading channel (MR002, R1012, etc.) is specified, the 32 bits are occupied crossing to
the next channel.
• When a word device is specified, 2 words is occupied.
• The parameter is specified with the following method.
Device Description
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 • Specify the leading device of the channel for the bit device.
• When a bit device is specified, n x16 bits are occupied for the SORTN.U and SORTN.S
instructions, and n x32 bits are occupied for the SORTN.D and SORTN.L instructions.
• When a word device is specified, n words are occupied for the SORTN.U and SORTN.S
EXTENDED INSTRUCTIONS
instructions, and n x2 words are occupied for the SORTN.D and SORTN.L instructions.
*3 • When a bit device is specified, 16 continuous bits are occupied. When a channel other than
the leading channel (MR002, R1012, etc.) is specified, the 16 bits are occupied crossing to
the next channel.
• When a word device is specified, one word is occupied.
*4 When a bit device is specified, one continuous bit is occupied. When a word device is specified,
the LSB is used as the notification bit device. The bits other than the LSB do not change.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-7000 Series CPU units, KV-5000/3000 Series CPU
5
units that have CPU function version 2.0 or higher and with KV Nano Series base units.
Instructions
Data Processing
"KV-5000/3000 CPU Function Version" (Page 2)
Operation Description
SORTN(.U)/SORTN.S
When the execution conditions turn ON, the n items of 16 bit binary data from the
device specified in D1 are sorted according to the parameter specified with S .
When sorting is completed, a completion notice is written in D2 .
When the execution conditions turn OFF, the SORTN instruction operation stops even if
sorting is in progress. The completion notice is not written to D2 .
D1 123 1 D1
D1 +1 15 3 D1 +1
D1 +2 84 15 D1 +2
D1 +3 3 71 D1 +3
D1 +4 1398 84 D1 +4
D1 +5 914 88 D1 +5
D1 +6 71 123 D1 +6
D1 +7 1 512 D1 +7
A comparison is made three
D1 +8 6219 914 D1 +8 times within one scan, and
the data is sorted across
D1 +9 7003 1398 D1 +9 multiple scans.
D1 +10 512 6219 D1 +10 When sorting is completed,
D2 =ON is written.
D1 +11 88 7003 D1 +11
SORTN.D/SORTN.L
When the execution conditions turn ON, the n items of 32 bit binary data from the
device specified in D are sorted according to the parameter specified with S .
When sorting is completed, a completion notice is written in D2 .
When the execution conditions turn OFF, the SORTN instruction operation stops even if
sorting is in progress. The completion notice is not written to D2 .
Scan
ON
SORTN execution
EXTENDED INSTRUCTIONS
condition
OFF
D2 : ON
Completion OFF
notice relay
Point • If executing sort with multiple scans, the SORTN instruction will be canceled when the
5
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
Instructions
Data Processing
Operation flag
Sample Program
When the internal relay MR000 turns 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 internal relay MR000 turns ON, the signed 32-bit binary data in data memory DM0 to
5
DM1999 (number of data items: 1000 = 2000 words) is sorted in descending order. 100 comparisons
Instructions
Data Processing
are made in one scan.
D - - - - *4 - - - - -
Operand Explanation
S Specifies the device which stores the data to write into the data block. *1 *2
D Specifies the leading device of the data table. *1 *2 *3
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 Becomes the same device as leading device S of the data table of the corresponding
FIFOR instruction.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
D +1 max Max. number of storage number : Max number that data block can store (designate by user).
D +2 (A)
D +n+1 (C)
Before executing this instruction, reset (store "0") the number of data (n) to be stored to D . Also,
set the maximum number of stored data items to " D +1".
As the leading device D of the data table, specify the same device as leading device S of
the data table of the corresponding FIFOR instruction.
FIFOW(.U) When the execution condition is ON, the 16-bit 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 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
…
bit
15
S bit
0
(C) : D +(n+1) (C) : D +(n+1)
(D) Blank (0) : D +(n+2) (D) : D +(n+2)
Blank (0) : D +(n+3) Blank (0) : D +(n+3) 5
FIFOW.D When the execution condition is ON, 32-bit binary data specified by " S / S +1" is
Instructions
Table Processing
stored to the end of the data block.
• The data is stored to " D +(2n+4)"/" D +(2n+5)".
• n is incremented by 1 (+1) after storage.
bit bit
31 0
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 st :
@FIFOW. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing
Sample Program
See the sample program for the FIFOR instruction.
"Sample Program" (Page 5-70)
MEMO
EXTENDED INSTRUCTIONS
5
Instructions
Table Processing
D1 - - - - *3 - - - - -
Instructions
Table Processing
D2 - - - - *3 - - - - -
Operand Explanation
D1 Specifies the leading device of the data table. *1 *2
D2 Specifies the leading device to store data that is read from the data block. *1 *2
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
Operation Description
D1 +1 max Max. number of storage data :Max number that data block can store (designate by user)。
D1 +2 A
D1 +n+1 C
As the leading device D1 of the data table, specify the same device as leading device D2 of
the data table of the corresponding FIFOR instruction.
FIFOR(.U) (1) When the execution conditions turn ON, the 16-bit data stored in D1 +2 is stored in
the device specified with 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 data currently stored to " D1 +4"/
" D1 +5" is stored to the device specified by " D2 / D2 +1".
5
Instructions
Table Processing
bit bit
31 0
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) After the data is stored, the content of the data block is pushed forward by one data,
and the number of stored data is decremented (-1).
n is then decremented (by 1) after the data is pushed.
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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing
Sample Program
Sensor for defective judgment Sensor for discharging confirm Discharge output
R001 R002 R500
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 workpieces are fed from the inspection point to the discharge point, error is output from
R501.
(Mnemonics list)
CR2008 #0 #10
DW DW LD CR2008
DM100 DM101 DW #0 DM100
R001 $0 DM0 FIFOW CON
R000
↑ 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 R500 FIFOW DM0 DM100
LDP R000
AND CR2012 5
SET R501
LDP R002
Instructions
Table Processing
MPS
FIFOR DM100 DM1
MPP
AND= DM1 $1111
SHOT #100 R500
bit bit
15 0
DM100 :
Data memory DM101 : 10 bit bit
$0000:OK
15 0
D - - - - *4 - - - - -
Operand Explanation
S Specifies the device which stores the data to be written into the data block. *1 *2
D Specifies the leading device of the data table. *1 *2 *3
*1 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 Becomes the same device as leading device S of the data table of the corresponding
LIFOR instruction.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
D +1 max Max. number of storage number : Max number that data block can store (designate by user).
Data table
D +2 A
D +n+1 C
Before executing this instruction, reset (store "0") the number of data (n) to be stored to D . Also,
set the maximum number of stored data items to" D +1".
As the leading device D of the data table, specify the same device as leading device S of
the data table of the corresponding LIFOR instruction.
5-72 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Table Processing Instructions
LIFOW(.U) When the execution condition is ON, the 16-bit 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 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 st B : D +3
…
bit
15
S bit
0
C : D +(n+1) C : D +(n+1)
D Blank (0) : D +(n+2) D : D +(n+2)
Blank (0) : D +(n+3) Blank (0) : D +(n+3) 5
LIFOW.D When the execution condition is ON, 32-bit binary data specified by " S / S +1" is
Instructions
Table Processing
stored to the end of the data block.
• The data is stored to " D +(2n+4)"/" D +(2n+5)".
• n is incremented by 1 after storage.
bit bit
31 0
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 st :
D +(2n+3) : C : D +(2n+2)
D +(2n+5) : D : D +(2n+4)
@LIFOW. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing
Sample Program
See the sample program for the LIFOR instruction.
"Sample Program" (Page 5-78)
MEMO
EXTENDED INSTRUCTIONS
5
Instructions
Table Processing
D1 - - - - *3 - - - - -
Instructions
Table Processing
D2 - - - - *3 - - - - -
Operand Explanation
D1 Specifies the leading device of the data table. *1 *2
D2 Specifies the leading device to store data that is read from the data block. *1 *2
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
Operation Description
About data table and data block
The LIFOW and LIFOR instructions LIFO (Last In First Out) process using a group of devices called a
"data table." The figure below shows the structure of a data table.
bit bit
15 0
D1 +1 max Max. number of storage number : Max number that data block can store (designate by user)
Data table
D1 +2 A
D1 +n+1 C
As the leading device D1 of the data table, specify the same device as leading device D2 of
the data table of the corresponding LIFOW instruction.
LIFOR(.U) (1) When the execution conditions turn ON, the 16-bit data stored in D1 +n+1 is
stored in the device specified with 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 data currently stored to 5
" D1 +(2n+2)"/" D1 +(2n+2)" is stored to the device specified by " D2 /
Instructions
Table Processing
D2 +1".
bit bit
31 0
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. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing
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
Instructions
Table Processing
D - - - - *4 - - - - -
n - - - - *4 *5 *5 -
Operand Explanation
S Specifies the device currently stored with the value to overwrite on the data block.*1 *2
D Specifies the leading device of the data table. *1 *2
n Specifies the position of the data block to overwrite or the device to which the position is currently stored.*3
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
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
Data table
1 st A : D +2 A : D +2
2 nd B : D +3 B : D +3
…
Data block
(store data) n th C E
…
N th D : D +N+1 D : D +N+1
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 .
S +1 S
EXTENDED INSTRUCTIONS
bit bit
31 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 +5 A
Data table
D +4 D +4
(store data)
Data block
2 nd D +7 B D +6 D +7 B D +6
…
n th D +(2n+3) C D +(2n+2) D +(2n+3) E D +(2n+2)
…
N th D +(2N+3) D D +(2N+2) D +(2N+3) D D +(2N+2)
@FWRIT. Only one scan is executed at the rising edge of the execution conditions.
5
Operation flag
Instructions
Table Processing
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 value of n is 0 or greater than number of data (N)
• When maximum number of stored data is "0"
CR2012
• When the number of data exceeds the maximum number of stored data
• When the maximum number of stored data (max) is a number that exceeds the device range
• When the indirect specification and index modify range is inappropriate
Sample Program
When input relay R000 is ON, the data in data memory DM0 is overwritten on the 2nd data
block of the FIFO/LIFO data table (leading device DM100).
(Mnemonics list)
R000 FWRIT
DM0 DM100 #2 LD R000
FWRIT DM0 DM100 #2
D - - - - *4 - - - - -
n - - - - *4 *5 *5 -
Operand Explanation
S Specifies the device currently stored with the value to insert in the data block.*1 *2
D Specifies the leading device of the data table. *1 *2
n Specifies the position of the data block to insert at or the device to which the position is currently stored.*3
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
FINS(.U) When the execution condition is ON, the 16-bit binary data specified by S is
inserted between the n th and " n th+1" data blocks in the data table specified
by D .
bit
15
S bit
0
bit
15
bit
0
bit
15
bit
0
1 st A : D +2 A : D +2
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 th+1" data blocks in the data
table specified by D .
S +1 S
EXTENDED INSTRUCTIONS
bit bit
31 0
Data table
D +4 D +4
(store data)
Data block
2 nd D +7 B D +6 D +7 B D +6
…
n th D +(2n+3) C D +(2n+2) D +(2n+3) C D +(2n+2)
…
D +(2n+5) E D +(2n+4)
…
N th D +(2N+3) D D +(2N+2)
D +(2N+5) D D +(2N+4)
@FINS. Only one scan is executed at the rising edge of the execution conditions. 5
Instructions
Table Processing
Operation flag
Sample Program
When input relay R000 is ON, the data in data memory DM0 is inserted between the 2nd and 3rd data
blocks of the FIFO/LIFO data table (leading device DM100).
(Mnemonics list)
R000 FINS
DM0 DM100 #2 LD R000
FINS DM0 DM100 #2
36841 :DM105
D - - - - *4 - - - - -
Instructions
Table Processing
n - - - - *4 *5 *5
-
Operand Explanation
D Specifies the leading device of the data table. *1 *2
n Specifies the position of the data block to delete and the device to which the position is currently stored.*3
*1 The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. MR002, R1012) of the channel has been
specified, the relay is handled in 16/32 bits straddling the next channel.
*3 When a bit device has been specified to n , 16 continuous bits are occupied. When a word
device has been specified, one word is occupied.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
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
1 st A : D +2 A : D +2
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
EXTENDED INSTRUCTIONS
Max. number of storage data D +3 max D +2 D +3 max D +2
Data table
1 st D +5 A D +4 D +5 A D +4
(store data)
Data block
2 nd D +7 B D +6 D +7 B D +6
…
n th D +(2n+1) C D +(2n) D +(2N+1) D D +(2N)
…
D +(2N+3) 0 D +(2N+2)
N th D +(2N+3) D D +(2N+2) Filled with 0
@FDEL. Only one scan is executed at the rising edge of the execution conditions.
Operation flag
5
CR2009 No change in state
Instructions
Table Processing
CR2010 No change in state
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"
CR2012
• When the number of data exceeds the maximum number of stored data
• When the maximum number of stored data (max) is a number that exceeds the device range
• When the indirect specification or index modify range is inappropriate
Sample Program
When input relay R000 is ON, the 2nd data block in the FIFO/LIFO (leading device DM100) data table
is deleted.
(Mnemonics list)
R000 FDEL
DM100 #2 LD R000
FDEL DM100 #2
WTIME
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
5
(B) (W) (ZF)
S - - - - *3 - - - - - - -
Instructions
Clock Processing
Operand Explanation
S Specifies the leading device to which the time data is stored.*1 *2
Operation Description
WTIME When the execution condition is ON, the time data seven words (112 bits) starting from
the device specified by S is written to the calendar timer.
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
@WTIME Only one scan is executed at the rising edge of the execution conditions.
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 the 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
ON when the data to be written is inappropriate as time data, when a timer/counter has been
CR2012 specified to S , D by indirect specifying, or when the indirect specifying or index modify
range is inappropriate. Otherwise, OFF
Instructions
Clock Processing
Sample Program
At the leading edge of input relay R000, the time data currently stored to data memories DM0 to DM6
is written to the calendar timer. (The time data of DM0 to DM5 is written from the access window or
touch panel.)
(Mnemonics list)
R000 DM0
↑ WTIME LDP R000
WTIME DM0
SEC
SEC
Date time ->
Converts date/time format
Seconds
data to second format data.
@SEC conversion
SEC
RSEC
RSEC
Seconds -> Converts second format
EXTENDED INSTRUCTIONS
Operand Explanation
S Specifies the leading device to which the data (SEC: date/time data / RSEC: second data) is currently stored.*1
D Specifies the leading device to which the data (SEC: second data / RSEC: date/time data) is currently stored.*1
*1 When a bit device has been specified, continuous 96 bits are handled as the date/time data and
continuous 32 bits are handled as the second data. A relay other than the leading relay (e.g.
MR002, or R1012) of the channel can be specified.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
Operation Description
SEC When the execution condition is ON, the six words (96 bits) of date/time data starting
from the device specified by S is converted to seconds, and is stored to the two
words (unsigned 32-bit BIN data) starting from the device specified by 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 the device specified by S is converted to date/time data, and is
stored to the six words (96 bits) starting from the device specified by 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
day : D +2 (1~31)
hour : D +3 (0~23)
Minute : D +4 (0~59)
second : D +5 (0~59)
@SEC/@RSEC Only one scan is executed at the rising edge of the execution conditions.
Operation flag 5
Instructions
Clock Processing
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
Turns ON when one of the following conditions is established. Otherwise, OFF.
• When the data to be converted is inappropriate (SEC: date/time data / RSEC: second data)
• When the continuous 2 words or 6 words starting from the device specified by S D
CR2012
is out of range
• When a timer/counter is specified to S , D by indirect specification
• When the indirect specifying or index modification range is inappropriate
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.
(Mnemonics list)
CR2002 SEC
CM700 DM0 LD CR2002
SEC CM700 DM0
DM0 #2592000 DM10 MPS
LDA.D ADD.D STA.D LDA.D DM0
CON
ADD.D #2592000
RSEC CON
DM10 DM100 STA.D DM10
bit bit
MPP
15 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 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
5
(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
Instructions
Clock Processing
Operation Description
AJST When the execution condition is ON, the "seconds" setting is set to "0" when the
"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.
@AJST Only one scan is executed at the rising edge of the execution conditions.
Point The AJST instruction cannot be used with the 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.
MEMO
EXTENDED INSTRUCTIONS
5
Instructions
Clock Processing
LDWK
minute/second
ranges.
ANDWK
between specified
day of week/hour/
second ranges.
day of week/hour/
minute/second
ORWK
ranges.
ORWKB Turns OFF
OR week
between specified
day of week/hour/
minute/second
WK ranges.
EXTENDED INSTRUCTIONS
5
S1 WK L D W K S1 S2
S2 WK L D W K B S1 S2
Instructions
Weekly Contact
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
S2 When WKB, installation WK Filled with
Operand Explanation
S1 Specifies the data of day of week/hour/minute/second to start at or the device to which that data is currently stored. *1*2
S2 Specifies the data of day of week/hour/minute/second to end at or the device to which that data is currently stored. *1*2
*1 When a word device is specified, continuous two words are handled, and when a bit device is
specified, continuous 32 bits are handled. When a relay other than the start relay (e.g. MR002,
R1012) of the channel has been specified, the relay is handled in16/32 bits straddling the next
channel.
*2 "Week contact instruction constant entry"
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
LDWK ANDWK ORWK
The instruction itself becomes a normally open contact. This contact turns ON from the
EXTENDED INSTRUCTIONS
day of week/hour/minute/second specified by " S1 / S1 +1" until the day of week/
hour/minute/second specified by " S2 / S2 +1".
The above instructions cannot be used with the KV N14**. During KV STUDIO
Point
conversion, a warning is displayed. During ladder program execution, the instruction does 5
not operate. The contact operates as OFF.
Weekly Contact
Instructions
Week contact instruction constant entry
To enter a constant in to S1 , S2 , please do the following. "#" cannot be used.
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
Example “month/08:30:00”
WK
“Friday/17:15:00”
EXTENDED INSTRUCTIONS
Friday
Sunday Monday Tuesday Wednesday Thursday
17:15:00
End 24:00:00
17:15:00
08:30:00
Monday 00:00:00
08:30:00
5 Start Contact ON
Contact turns on between Monday 08:30:00 to Friday 17:15:00.
Weekly Contact
Instructions
The contact turns on when the time data, hours/minutes/seconds/day of week (CM00703
to CM00706) currently stored to the calendar time " S1 / S1 +1" ≤ time data
currently set to the calendar timer ≤ " S2 / S2 +1".
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
Types of FF specification
Only the following six FF types can be specified.
S1 S2 Explanation
EXTENDED INSTRUCTIONS
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
Weekly Contact
Instructions
CR2011 No change in state
ON when the day of week/hours/minutes/seconds setting specified by S1 and S2 is
CR2012 incorrect, and when the indirect specification or index modify range is inappropriate. Otherwise,
OFF
Sample Program
Output relay R500 is continuously turned ON between Monday 8:30:00 to Friday 17:15:00.
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.
"FF/12/31" "MON/FF:FF:FF" "FF/08:30:00" R500 (Mnemonics list)
CAL WK WK LDCALB "FF/12/31" "FF/01/03"
"FF/01/03" "FRI/FF:FF:FF" "FF/17:15:00" ANDWK "MON/FF:FF:FF" "FRI/FF:FF:FF"
ANDWK "FF/08:30:00" "FF/17:15:00"
OUT R500
Output relay R500 is continuously turned ON between 8:30:00 on Monday and 17:15:00 on Friday
when start data memory DM101 to M100 ($81E · $1) and end data memory DM103 to DM102 ($110F ·
$5)
DM100 R500 (Mnemonics list)
WK LDWK DM100 DM102
DM102 OUT R500
LDCAL
ORCAL Turns ON between
specified year/
Load calendar
month/day
CAL LDCALB
ranges.
Turns OFF
between specified
year/month/day
ranges.
ANDCAL
ANDCALB Turns ON between specified year/
AND calendar
ranges.
ORCAL CAL
OR calendar
EXTENDED INSTRUCTIONS
ORCALB CAL
OR calendar bar
5
S1 CAL L D C A L S1 S2
S2 CAL L D C A L B S1 S2
Instructions
Calendar Contact
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
S2 When CALb, installation CAL Filled with
Operand Explanation
S1 Specifies the data of day of year/month/day to start at or the device to which that data is currently stored. *1*2
S2 Specifies the year/month/day to end at.*1*2
*1 When a word device is specified, continuous two words are handled, and when a bit device is
specified, continuous 32 bits are handled. When a relay other than the start relay (e.g. MR002, R1012)
of the channel has been specified, the relay is handled in16/32 bits straddling the next channel.
*2 "Calendar contact constant entry".
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
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".
EXTENDED INSTRUCTIONS
Point The above instructions cannot be used with the KV N14**. During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the instruction does
not operate. The contact operates as OFF.
5
Input
Format Year (Numeral) 00 to 99 (Numeral) $0 to $63
Month (Numeral) 1 to 12 (Numeral) $1 to $C
Instructions
Calendar Contact
Day (Numeral) 1 to 31 (Numeral) $1 to $1F
Enter year/month/day into " ". Enter a HEX representing year/month/day behind
Note
Year/month/day is separated with "/". "$".
When entering Oct 16, 2004 When entering Oct 16, 2004
Example
" 04 / 10 / 16 " $40A10
Format of S1 and S2
The year, month and day 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 Reserved Year Month Day
Setting 00 to 99 (year), FF 01 to 12 (month), FF 01 to 31 (day), FF
range*2 Enter 00H.
(100 or more invalid*1) (13 or more invalid) (32 or more invalid)
*1 00 to 99 indicates the year range 2000 to 2099.
*2 The description for year/month/day in the table is given in decimal. However, in actual fact, year/
month/day is handled in Hex.
*3 "FF specification day of year/month/day".
Example "08/02/16"
CAL
"12/10/28"
Year 2012
2007 2008 2009 2010 2011 2012 2013
October 28
End
October 28
February 16
Year 2008
February 16
Start Contact ON
Contact turns ON during February 16, 2008 and October 28, 2012.
The contact turns on when the calendar data, year/month/day (CM700 to CM702) currently
stored to the calendar time " S1 / S1 +1" ≤ calendar data currently set to 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/day. The
FF can be used in a special meaning when the year, month, and day are specified.
1. The item (day of week/hours/minutes/seconds) value can be omitted.
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 day of year/month/day setting specified by S1 and S2 is incorrect, and
CR2012
when the indirect specification or index modify range is inappropriate. Otherwise, OFF
5
Sample Program
Instructions
Calendar Contact
Output relay R500 is continuously turned ON during 2004, December 31 to 2005, January 3.
(Mnemonics list)
"10/12/31" R500
CAL LDCAL "10/12/31" "11/01/03"
"11/01/03" OUT R500
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.
(Mnemonics list)
"FF/12/31" "MON/FF:FF:FF" "FF/08:30:00" R500
CAL WK WK LDCALB "FF/12/31" "FF/01/03"
"FF/01/03" "FRI/FF:FF:FF" "FF/17:15:00" ANDWK "MON/FF:FF:FF" "FRI/FF:FF:FF"
ANDWK "FF/08:30:00" "FF/17:15:00"
OUT R500
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).
(Mnemonics list)
DM100 R500
CAL LDCAL DM100 DM102
DM102 OUT R500
ARES
Resets the currently operating alarm relay
ARES Alarm relay reset
and alarm history.
- - - - - - - - - - - - - - - - - - - - -
Operation Description
5
Resets the currently operating alarm relay and alarm history.(CR3300 to CR3415)
Alarm Instruction
Operation flag
MEMO
EXTENDED INSTRUCTIONS
5
Alarm Instruction
HSP
HSP
HSP High speed Reduces the time constant of the input
HSP relay to speed up input response.
Operand Explanation
Specifies the device No. of the relay for reducing the input time constant.*1
5
D
*1 The relay device numbers that can be specified differ according to the unit.
KV-5500/5000/3000/1000: R000 to R015
Instructions
High-speed Processing
Operation Description
When the execution condition is ON, the input time constant setting of the device specified by 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, KV-5500/5000/3000 User's
Manual 2-7Input and Output, KV-1000 User's Manual "10-3 Input Time Constant Selection
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, 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
Instructions
High-speed Processing
DI,EI
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
5
(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -
Instructions
High-speed Processing
Operation Description
DI When the execution condition is ON, execution of the interrupt program is disabled.
This instruction is used to temporarily disable interrupt.
EI When the execution condition is ON, execution of the interrupt program is enabled.
The interrupt program disabled by the DI instruction is enabled.
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
Instructions
High-speed Processing
DIC
DIC
Interrupt disabled
DIC Sets the interrupt disabled range.
range
D
EI
5 D - - *2 - - - - - - -
Operand Explanation
Instructions
High-speed Processing
*1 When a word device has been specified, the LSB is used. Bits other than the lowermost bit do
not change.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
Operation Description
DIC This instruction is used in combination with the EI instruction.
When the execution condition is ON, execution of interrupt processing is disabled
between the DIC instruction and EI instruction.
The interrupt enabled/disabled state before execution of the DIC instruction is output to
the device specified by D .
If the interrupt enabled/disabled state before execution of the DIC instruction is
"enabled, D is set, and is reset if the state is "disabled."
CR2002 D CR2002 D
DIC DIC
D D
EI EI
OFF ON
Status for interrupt forbidden Status for interrupt enabled
Input
Interrupt program
process
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when the indirect specification and index modify range is inappropriate. Otherwise, OFF
CR2012
Does not change when indirect specification or index modify is not specified to the operand.
5
Sample Program
Instructions
High-speed Processing
Interrupts are disabled during processing of operations. After execution of the DIC instruction, the
interrupt processing state is returned to the state before execution of the DIC instruction.
(Mnemonics list)
CR2002 R1000
DIC (1) LD CR2002
DIC R1000
CR2002 DM0 DM10 DM100 LD CR2002
(2) LDA DM0
LDA ADD STA
CON
ADD DM10
R1000 CON
EI (3) STA DM100
LD R1000
EI
INT,TI
RETI
RETI Indicates the end of the interrupt
Return interrupt
program.
EXTENDED INSTRUCTIONS
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 )
n2 *1 − − − − − − − − − − − − − − − ○ − − − −
Operand Explanation
n1 *1 Specifies the unit number (0 to 48).
n2 *1 Specifies the unit interrupt factor number (0 to 31).
*2
S *3 It designates the bit device used for interruption.
*3 The device number that can be designated differs depending on the model used.
KV-5500/5000/3000/1000: Only R000 to R009, CTC0 to CTC3, CR3013, and CR3113 can be
specified.
KV-N14**/KV-N24**: Only R0000 to R0003, CTC0 to CTC3, CR8415 and CR8515 can be
specified.
KV-N40**: Only R0000 to R0003, CTC0 to CTC5, CR8415, CR8515 and CR8615 can be
specified.
KV-N60**: Only R0000 to R0003, CTC0 to CTC7, CR8415, CR8515, CR8615 and CR8715 can be
specified.
KV-NC32T: R0000 to R0003, CTC0 to CTC5, CR8415, CR8515 and CR8615 can be specified.
Operation Description
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-7000 Series.
• KV-7500/7300/5500/5000/3000 Only Z11 and Z12 index registers are defaulted for Save/Enter
processing. 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 Z2) are subject to Save/Enter processing. To use a
index register used in master program also in the interrupt program, please copy the
index register to other devices using ZPUSH/ZPOP or MOV. 5
• For the conditions below, there are no interrupt conditions specified by the INT
Instructions
High-speed Processing
instruction. Therefore, no error occurs and nothing is executed. Please be aware of this
behavior.
• Using the CH count for a high speed counter that cannot be used
• Specifying a positioning output axis that cannot be used
• Using a basic input count that cannot be used
(In the situations above, with the KV Nano Series, KV STUDIO will not generate a
conversion error)
• KV-7500/7300 For the conditions below, there are no interrupt conditions specified by the
INT instruction. Therefore, a warning is generated but no error occurs and nothing is
executed. Please be aware of this behavior.
• The unit specified does not support the interrupt function.
• A non-existent interrupt factor is specified.
Operation flag
Scan
Sample Program
KV-7500/7300
EXTENDED INSTRUCTIONS
When using KV-7500, 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
Constant ON
EI
IEDGE #1 #5 #3
CR2008 IEDGE
Unit No.
KV-SIR32XT
Input No. Detection END
INT #1 #5
conditions
#1 #5 #3
ON 1 scan
at start of
KV-SIR32XT LD CR2002
operation END INC DM10
RETI
5 INT
Unit No.
#1
Interrupt factor
#5
ENDH
KV-SIR32XT R34005
Instructions
High-speed Processing
CR2002 DM10
INC
constant ON
RETI
ENDH
ENDH
MEMO
EXTENDED INSTRUCTIONS
5
Instructions
High-speed Processing
IEDGE
Input
o
n
IEDGE s
u
interrupt
s
e
Detection f
o
interrupt.
@IEDGE
r
IEDGE
conditions
i
n
t
e
write
r
r
u
p
t
EXTENDED INSTRUCTIONS
n1 − − − − − − − − − − − − − − − ○ − − − −
Instructions
High-speed Processing
n2 ○ − ○ − − − ○ ○ ○ ○ ○ − − ○ ○ ○ − ○ ○ ○
S ○ − ○ − − − ○ ○ ○ − − − − − ○ ○ − ○ ○ ○
Operand Explanation
n1 Specifies the unit number. *1
n2 Specifies the input number or the leading device storing the input number. (0 to 31)*2
S Specifies the detection conditions or the leading device storing the detection conditions. (0 to 3)*2
Operation Description
IEDGE When the execution condition is ON, sets 1 word of data specified in S 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
Instructions
High-speed Processing
@IEDGE Only one scan is executed at the rising edge of the execution conditions.
Operation flag
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
This flag is ON in the following instances. Otherwise, it is OFF.
• When the indirect specification or index modify range is inappropriate
• When the unit number specified with n1 is 49 or more
CR2012
• When the input number specified with n2 is 32 or more
• When a 1-word device cannot be secured from the device number specified with S
• When the unit specified by the unit number in n1 is not KV-SIR32XT
Sample Program
Refer to the "INT instruction" (Page 5-108)
Input process
Input process
Scan time
Output process
MEMO
EXTENDED INSTRUCTIONS
5
Instructions
High-speed Processing
CTH,CTC
CTC n
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
C n - - - - - - - - - - - - - - - - - - -
T
H S - - - - - - - - - - - - - - - - - -
C n - - - - - - - - - - - - - - - - - - -
T
C S - - - - - - - - - - - - - - - - - - -
Operand Explanation
n Specifies the counter No. as 0 to 3*1.
CTH
S Specifies the count input.
n Specifies the comparator No. as 0 to 7*1.
CTC
S Specifies the setting value of the high-speed counter within the range 0 to 4294967295.
*1 The counter numbers and the comparator numbers that can be specified differ according to the
unit.
Counter No. Comparator No.
KV-5500/5000/3000/1000 0 to 1 0 to 3
KV-N14**/KV-N24** 0 to 1 0 to 3
KV-N40** 0 to 2 0 to 5
KV-N60** 0 to 3 0 to 7
KV-NC32T 0 to 2 0 to 5
Reference KV-1000 Minus values cannot be entered to the operand S of the CTC instruction on
KV STUDIO.
To set a minus value, a program such as the one below is required.
Operation Description
CTH(.D) When the execution condition is ON, the input of the device specified by S is
EXTENDED INSTRUCTIONS
counted.
CTH.L When the execution condition is OFF, the count value is cleared.
When an external input (R010, R011) is counted, the input time constant must be
reduced.
KV-1000 PLC User's Manual "10-3 Input Time Constant Selection Function"
"HSP instruction" (Page 5-102)
CTC(.D) / CTC.L
Turns ON when the setting value specified by
high-speed counter.
S matches the current value of the
5
Instructions
High-speed Processing
Point For the KV Nano Series, when a high speed counter number that cannot be used by the
unit is specified, a warning is displayed during KV STUDIO conversion, and the
instruction does not operate when the ladder program executes.
With the high-speed counter application function, set the count method or reset method in control
relays CR and data memories DM. Read the descriptions for the respective setting item.
"KV-5500/5000/3000 Series User's Manual"2-10 High-speed counter""
"KV-1000 Series User's Manual" Chapter 5 High-speed counter""
"KV Nano Series User's Manual"4-4 High-speed counter""
High-speed counters are counters for measuring high-speed input signals that cannot be calculated
by counter instructions (C, OUT C, UDC).
High-speed counter comparators are devices for specifying the setting values of high-speed
counters, and turn ON when the setting value matches the current value. High-speed counters can
operate at high speed independent of the scan as they are processed in the hardware.
5 comparators and exclusive internal clocks for each of these high-speed counters.
High-speed counter block diagram (For the KV-5500/5000/3000/1000)
Instructions
High-speed Processing
(internal cable)
(internal cable)
EXTENDED INSTRUCTIONS
Input terminal 0 Count input 0 32 bit high speed counter 0 CTH0 input capture function
A phase External input (A phase, B phase) CTH0 Input capture trigger *1
B phase Internal timer Storage device *2
Direct timer pulse input
5
Input terminal 1 Count input 1 32 bit high speed counter 1 CTH1 input capture function
A phase External input CTH1 Input capture trigger *1
B phase Internal timer Storage device *2
Direct timer pulse input
Instructions
High-speed Processing
Control circuit 1 Output terminal 1
Enable input Comparator matching output
Preset (Z phase) input (Preset value)
Input terminal 2 Count input 2 32 bit high speed counter 2 CTH2 input capture function
A phase External input CTH2 Input capture trigger *1
B phase Internal timer Storage device *2
Direct timer pulse input
Input terminal 3 Count input 3 32 bit high speed counter 3 CTH3 input capture function
A phase External input CTH3 Input capture trigger *1
B phase Internal timer Storage device *2
Direct timer pulse input
*1 Select the input capture trigger in the CPU System Settings for KV STUDIO.
*2 The storage device differs according to the input capture trigger, not the counter number.
*3 The comparator match signal output by output terminal n (n:0 to 3) cannot be used as the direct timer pulse
for count input n (where n is the same as the output terminal).
RFSCTH
RFSCTH
RFSCTH High-speed Update the current value of High-speed
counter refresh Counter with the latest value.
Operand Explanation
n Specifies the high-speed counter No. (0 to 3)*1
5 *1 The high speed counter numbers that can be specified differ according to the unit.
KV-5500/5000/3000/1000: 0 to 1
Instructions
High-speed Processing
KV-N14**/KV-N24**: 0 to 1
KV-N40**: 0 to 2
KV-N60**: 0 to 3
KV-NC32T: 0 to 2
Operation Description
KV-5500/5000/3000/1000
When the execution condition is ON, the Control relay after change
High-speed counter
current value of High-speed Counter CTH is Overflow Direction for change
updated with the latest value. CTH0 CR2403 CR2412
Also, Control Relay CR for CTH overflow and CTH1 CR2407 CR2413
direction is updated with the latest status. KV Nano
Control relay after change
High-speed counter
Overflow Direction for change
CTH0 CR4206 CR4207
CTH1 CR4406 CR4407
CTH2 CR4606 CR4607
CTH3 CR4806 CR4807
Point For the KV Nano Series, when a high speed counter number that cannot be used by the
unit is specified, a warning is displayed during KV STUDIO conversion, and the
instruction does not operate when the ladder program executes.
Operation flag
Sample Program
The updated value of High-speed Counter 0 is used to enable status change of Output Relay R30000
and R30001.
EXTENDED INSTRUCTIONS
(Mnemonics list)
CR2002 RFSCTH
#0 LD CR2002
constant ON RFSCTH #0
LD<.D CTH0 #10000
CTH0 DR30000 OUT DR30000
< .D LD>=.D CTH0 #10000
#10000 Output 0 AND<.D CTH0 #20000
OUT DR30001
CTH0 CTH0 DR30001
>=.D < .D
#10000 #20000 Output 1
Instructions
High-speed Processing
PID
PID
PAUSE
MANUAL PID Control Performs PID control.
RES
PID
PAUSE P I D D1 D2
MANUAL Input D1
MANUAL
RES Input D2
RES
D2 - - - - - - - - - - - - - -
Operand Explanation
D1 Specifies the leading device to which the data block for PID operation is currently stored.*1
D2 Specifies the leading device to which the flag relay for PID operation is currently stored.*2
Operation Description
• 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).(MV)
• The work area is reset by RES input turning ON. PID operation is not performed while 2RES 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 PAUSE input turns OFF, PID
operation is resumed.
Upper limit for operating quantity
(MVHL)
Operating quantity (Mv)
0 Time
EXTENDED INSTRUCTIONS
・Proportion constant (KP)
measured value Set value
(PV) (SV ) ・Integral constant (TI)
・Differential constant (TD)
・Comparison constant 2 Degree of freedom coefficient (α)
PID control instruction ・Integral constant 2 Degree of freedom coefficient (β)
・Lower limit for operating quantity (MVLL)
・Upper limit for operating quantity (MVHL)
Manual operating quantity Operating quantity ・Limit for operating quantity change amplitude (ΔMVL)
(MV MAN ) (MV )
Flag relay
MANUAL ・Positive operation/negative operation
・Selected constant invert timer 5
Switch for Manual/Auto ・2 Coefficient setting for degree of freedom
Instruction
PID Control
A/D conversion D/A conversion
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
Target value filter PD arithmetic
SV SVF 㧙 EV 㧗
1+ǩǪTI S
KP 1+
1 MV
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.
Scan
ON
RES input
EXTENDED INSTRUCTIONS
OFF
ON
PAUSE input
OFF
D1 +3*1 TD 0 to 30000
constant 0.00 to 300.00"sec"
Proportional
constant 2 degree of freedom coefficient of the
D1 +4*1 2 degree of proportional constant 0 to 100
freedom 0.00 to 1.00 (default: 0.4)
coefficient
Integral constant
2 degree of freedom coefficient of the integral
*1 2 degree of
D1 +5 constant 100 to 199
freedom
1.00 to 1.99 (default: 1.35)
coefficient
Manipulated Lower limit value of manipulated variableMust
D1 +6*1 variable lower limit MV L L be a value smaller than the manipulated variable -32768 to 32766
value upper limit value (M V H L ).
Manipulated Upper limit value of manipulated variableMust
D1 +7*1 variable upper limit MV H L be a value smaller than the manipulated variable -32767 to 32767
value lower limit value (M V L L ).
Manipulated Restriction value of change width between
variable change manipulated variable this time and one cycle
D1 +8 *1
MV L 1 to 65535
width before the manipulated variable (M V ) or manual
Restriction value mode manipulated variable (M VMAN ).
D1 +9 Reserved – (cannot be used by the user) –
D1 +10 *1
Setting value SV Target value of PID control -32768 to 32767
D1 +11*1 Measured value PV Value observed from control target -32768 to 32767
Manipulated
D1 +12 MV Result of PID operation -32768 to 32767
variable
Manual mode
Manually sets the manipulate variable. (Enabled
D1 +13*2 manipulated M VMAN -32768 to 32767
only when "MANUAL input" is ON.)
variable
D1 +14
Work area – (cannot be used by the user) –
D1 +35
EXTENDED INSTRUCTIONS
*1
D2 +1 timing selection operation 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 ON, 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.
Measured value Turns ON for one scan when there is a change that results in the preset manipulated
5
D2 +5*2 change amount variable change width limit value (∆MVL) being exceeded.
exceeded
*2
Operation cycle Turns ON for one scan when the operation cycle exceeds twice the sampling cycle
D2 +6
Instruction
PID Control
exceeded (TS). Operation continues to be executed.
Data settings
Measuring value
(PV)
(2) Sampling period
PID instruction
in program
(1) period Default value, execute PID Unprocessed Execute calculation Execute calculation Unprocessed Execute calculation Execute calculation Unprocessed
(2) period Default value, execute PID Unprocessed Unprocessed Execute calculation Unprocessed Unprocessed Execute calculation Unprocessed
5
Set value(SV)
Value after converted by AD converter -2048 +2047
Proportional Band (P)
Instruction
PID Control
5(%)
Assuming that the proportional band on a temperature controller having a temperature width of 0 to
200°C is 5% (temperature width 10°C), the temperature range of the proportional band at setting value
100°C becomes 95°C to 105°C.
Manipulated variable upper limit value at 95°C (MVHL) : +32767
Manipulated variable lower limit value at 105°C (MVLL) : -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
KP =16.000
Temperature (1)
(1) Though the deviation between the
Deviation setting value (SV) and the measured
(2)
value (PV) becomes small when a
Set value large proportional constant (KP) is
set, hunting increases.
(2) Both deviation and hunting become
(3) medium-size when a medium-size
proportional constant (KP) is set.
(3) Though deviation increase when
Time
a small proportional constant
(KP) is set, hunting decreases.
* As deviation is not solved by adjustment of the proportional constant (KP), use the integral constant
(TI) to adjust deviation.
* Increase the integral constant setting when hunting occurs over a long cycle.
5-126 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
PID Control Instruction
EXTENDED INSTRUCTIONS
For this reason, hunting can be decreased even if a large proportional constant (KP) or a small integral
constant (TI) is set.
Temperature (1) Though the response to external
(1)
(1) disturbance is fast when a large
(2) differential constant (TD) is set, hunting
increases.
Set value (2) Both response to external disturbance
and hunting become medium-size when
(3) a medium-size differential constant (TD)
(2) is set.
(3) Though the response to external
Interfere disturbance is slow when a small
differential constant (TD) is set, hunting
Time
decreases.
5
* - Decrease the differential constant setting when hunting occurs over a short cycle.
Instruction
PID Control
- Set a small differential constant on control systems (e.g. pressure or flow rate) having a fast
response or control systems having vibrating elements.
Flag settings
Reference For example, in temperature control, forward action results in cooling action where the
manipulated variable is increased when the measured value rises above the setting
value. Reverse operation results heating control where the manipulated variable
increases when the measured value falls below the setting value.
Reflection timing of constants (KP, TI, TD, α, β, MVLL, MVHL, ∆MVL) " D2 +1"
When ON, reflects the parameter (KP, TI, TD, α, β, MVLL, MVHL, ∆MVL) in the operation formula at each
operation.
When OFF, the constant is reflected in the operation formula only at the falling edge of RES input.
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 input to start operation after the program is started up.)
• The PID instruction cannot be program in the initialization execution module and
interrupt programs.
• Operations are not performed while the PAUSE input is ON. In this case, operation is
resumed when PAUSE input is turned OFF.
5
Instruction
• When the integral constant (TI) is 3000.1 "sec" or more, the target value filter is
PID Control
disabled as an exception only in this case as the effect of the target value filter is too
excessive. (Set the proportional gain 2 degrees of freedom coefficient (α) = "1".)
Operation flag
Sample Program
PID control is performed one scan after the PLC has started up.
(Mnemonics list)
R000 P ID
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
5 Operand
S
Explanation
Specifies the device storing the measured value Pv.*1
Instruction
PID Control
Specifies the leading device storing the parameters (setting value Sv, PID constant, operation
D1
control flag, etc.).*2
D2 Specifies the device storing the manipulated value Mv.*1
*1 If a bit device is specified, 16 continuous bits are processed as signed 16-bit BIN data.
*2 Continuous 52 words are handled.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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 2)
Operation Description
The PIDAT instruction is an instruction complied of a PID operation and AT (automatic tuning) function.
• 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
calculated manipulated variable (MV) is operating quantity Operating quantity ( )
( )
manipulated, and the measured value Measuring quantity ( )
• The PID manipulation is temporarily stopped when the operation stop flag (bit 0 of D1 +2) turns
ON, and resumes when the flag turns OFF.
• Automatic tuning starts when the AT start/operating flag (bit 2 of D1 +2) turns ON.
By forcibly turning the manipulated value (MV) to be controlled ON and OFF and observing the
EXTENDED INSTRUCTIONS
measured value (PV), this function automatically calculates and sets the PID constants (proportional
constant (KP), integral constant (TI), differential constant (TD)) for the control target.
Automatic tuning uses the limit cycle method (forcibly fluctuates the manipulated value (MV)
between the upper limit and lower limit, observes the measured value (PV) and estimates the
characteristics of the control target).
PIDAT instruction
Parameters
・Manual manipulated value (
・Sampling cycle (
・Proportional constant (
)
)
)
5
Measured Set value
Instruction
PID Control
value ・Integral constant ( )
( )
( ) ・Differential constant ( )
・Proportional constant 2 degree of
freedom coefficient (α)
・Integral constant 2 degree of
freedom coefficient (β)
PID control instruction
・Differential constant 2 degrees of
freedom coefficient (γ)
・Manipulated variable lower limit value ( )
AT result
・Manipulated variable upper limit value ( )
Manual operating Operating is applied
quantity quantity ・Manipulated variable change width
restrictionvalue ( )
( ) ( )
・Measured value change width ( )
AT parameters
・AT adjustment parameter ( )
AT control ・AT hysteresis ( )
Manual mode flag
・AT timeout time
(bit 1 of D1 +2) ・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 value of heater ect Operating quantity
Reference The operation method used in PID control is target value filter 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 overshooting in respect to the target value tracking is
suppressed, the stability in respect to disturbance is delayed. Conversely, if the stability
in respect to disturbance is set faster, overshooting will occur, and the target value
tracking will slow down.
EXTENDED INSTRUCTIONS
With 2 degree of freedom PID control, by applying a target on the filter both the target
value trackability and the disturbance response characteristics can be improved.
<Simple PID method> <Target value filter 2 degree of
freedom PID method>
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
Point The PIDAT instruction cannot be written in an initialization module or interrupt program.
Instruction
PID Control
List of parameters
Setting
Device Item Symbol Description Range
-32768 to
S Measured value PV Stores the value observed from the control target.
32767
-32768 to
D1 +0 Setting value SV Sets the target value for PID control.
32767
-32768 to
D1 +1 Manual manipulated value MVMAN Sets the manipulated value for the manual mode.
32767
Operation stop flag (PAUSE)
Bit 0 OFF: Executes operation
ON: Stops operation
Manual mode flag (MANUAL)
Bit 1 OFF: Automatic mode
ON: Manual mode
AT start/operating flag
OFF → ON: Starts automatic tuning
Operation Bit 2 ON → OFF: Stops automatic tuning
D1 +2 control – –
ON: Automatic tuning in operation *1
flag
Bit 3 Reserved (fixed to OFF)
Constant application timing selection
Sets the timing to apply the parameter (KP, TI, TD, α,
β, , MVLL, MVHL, ∆MVL, ∆PVL and 2 degree of freedom
Bit 4
coefficient setting) onto the operation.
OFF: Only at rising edge of execution conditions
ON: At each operation
Bit 5 to 15 Reserved (fixed to OFF)
*1 The PIDAT instructions automatically turns OFF when automatic tuning is finished.
Setting
Device Item Symbol Description Range
Forward/reverse operation
Selects the reverse operation (heating operation)
Bit 0 or forward operation (cooling operation).
EXTENDED INSTRUCTIONS
OFF: Reverse operation
ON: Forward operation
2 degree of freedom coefficient setting
(Usually set this to OFF)
Sets whether to change the 2 degree of freedom
coefficient for the proportional constant,
Bit 1
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
Changes the unit for the integral constant and
5
differential constant.
Instruction
PID Control
Bit 4 OFF: Integral constant 100ms unit, differential
constant 10ms unit
ON: Both integral constant and differential
constant 1ms unit
Bump-less changeover setting
(Usually set this to OFF)
Set whether to rewrite the manual manipulated
Bit 5 value (MVMAN) and automatic manipulated value
(MV)
OFF: Rewrite enabled
Operation ON: Rewrite disabled
D1 +3 – –
setting Measured value tracking setting
(Usually set this to OFF)
Set whether to rewrite the setting value (Sv) with
Bit 6
the measured value (Pv) in manual mode.
OFF: Rewrite enabled
ON: Rewrite disabled
Bit 7 Reserved (fixed to OFF)
Manipulated value change width limit warning
setting
Bit 8 OFF: Manipulated value change width limit
warning disabled
ON: Manipulated value change width limit
warning enabled
Measured value change width warning setting
OFF: Measured value change width warning
Bit 9
disabled
ON: Measured value change width warning enabled
Bit 10 to 11 Reserved (fixed to OFF)
AT calculation control method setting
Set which control method PID parameter to be
calculated with during automatic tuning.
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
Setting
Device Item Symbol Description Range
Cycle in which PID operation is performed 1 to
D1 +4 Sampling cycle TS
Setting range: 0.001 to 60.000 [sec] (1ms unit) 60000
Constant of proportional action
EXTENDED INSTRUCTIONS
1 to
D1 +5 Proportional constant *2 KP
Setting range: 0.001 to 50.000 50000
Constant of integral action
The unit changes according to the integral/differential
constant unit setting.
0 to
D1 +6 Integral constant *2 TI • When D1 +3 bit 4 is OFF Setting range:
30001*3
0.1 to 3000.0 [sec] (100ms unit)
• When D1 +3 bit 4 is ON Setting range:
0.001 to 30.000 [sec] (1ms unit)
Constant of differential action
The unit changes according to the integral/differential
constant unit setting.
0 to
+7 Differential constant *2 TD • When D1 +3 bit 4 is OFF Setting range:
5
D1
30000*4
0.00 to 300.00 [sec] (10ms unit)
• When D1 +3 bit 4 is ON Setting range:
0.000 to 30.000 [sec] (1ms unit)
Instruction
PID Control
Proportional constant The value set here is validated when the operation
D1 +8 2 degree of freedom α setting ( D1 +3) "2 degree of freedom coefficient 0 to 100
coefficient setting" (bit 1) turns ON.
Integral constant The default value is used when OFF is set.
D1 +9 2 degree of freedom β • Proportional constant 2 degree of freedom coefficient (α) 0 to 199
coefficient Setting range: 0.00 to 1.00
Default value: 0.4
• Integral constant 2 degree of freedom coefficient (β)
Differential constant 2 Setting range: 0.00 to 1.99
D1 +10 degrees of freedom γ Default value: 1.35 0 to 200
coefficient • Differential constant 2 degree of freedom coefficient ()
Setting range: 0.00 to 2.00
Default value: 1.25
Manipulated variable -32768 to
D1 +11 MVLL Sets the lower limit of the manipulated value.
lower limit value 32766
Manipulated variable -32767 to
D1 +12 MVHL Sets the upper limit of the manipulated value.
upper limit value 32767
The value set here is validated when the operation
setting ( D1 +3) "manipulated value change width
Manipulated variable warning setting" (bit 8) turns ON.
1 to
D1 +13 change width ∆MVL The setting is invalid when the bit is OFF. Set the limit
65535
restriction value value of the changes between the previous cycle's
manipulated value or manual manipulated value and
the present manipulated value.
The value set here is validated when the operation
setting ( D1 +1) "measured value change width
warning setting" (bit 9) turns ON.
Measured value change 1 to
D1 +14 ∆PVL The setting is invalid when the bit is OFF. The change
width 65535
width of the previous cycle is measured value and the
present measured value is monitored. The measured
value is not limited.
This parameter determines whether the PID constant
resulting from automatic tuning is adjusted with
"priority on stability" or "priority on speed response".
Setting range: 0.01 to 10.00 0*5,
D1 +15 AT adjustment parameter τ
Default value: 1.00 1 to 1000
* If the value is increased, priority is placed on
stability, and if decreased, priority is placed on
speed response.
*2 When using automatic tuning, these constants are automatically set after automatic tuning.
When not using automatic tuning, set these 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".
Setting
Device Item Symbol Description Range
Set the hysteresis for SV during automatic tuning.
Setting range: 1 to 3500
Default value: 5
EXTENDED INSTRUCTIONS
* If the measured value fluctuates and prevents a 0*6,
D1 +16 AT hysteresis h
normal limit cycle from being generated, increase 1 to 3500
this value. Note that the automatic tuning
accuracy will drop if this value is increased
needlessly.
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 value exceeded
Turns ON when the manipulated value exceeds the
Bit 1 –
set manipulated value upper/lower limit range.
Turns OFF when the value returns to the range.
Instruction
PID Control
Operation
Manipulated value change width exceeded
status
D1 +18 Turns ON if a change exceeding the set manipulated –
flag
Bit 2 – value change width limit value (∆MVL) occurs.
(input)
Turns OFF when the manipulated value returns to
within the limit value.
Measured value change width exceeded
Turns ON if a change exceeding the set measured
Bit 3 –
value change width (∆PVL) occurs. Turns OFF when
the measured value returns to within the limit value.
Bit 4 to 15 – Reserved (cannot be referenced)
This is the monitor value of the setting value (SV) after
Setting value after target -32768 to
D1 +19 SVF the target value filter is passed. PID operation is
value filter (input) 32767
executed using this value as the target value.
D1 +20 This area is used by the instructions as the operation
to Work area – –
work.
D1 +51
PID operation results
When there has been an integral operation, PID
operation is executed at the rising edge of the
-32768 to
D2 Manipulated value MV execution conditions using the D2 value as the
32767
default value. The operation is executed at the rising
edge of the execution conditions using the D2
value as the manipulated value default value.
Reference The following parameters must be set before using PID control.
(Normal operation will take place even if the other parameters are set to 0. Set the values
as needed.)
EXTENDED INSTRUCTIONS
*1 Operation will take place even if the other bits are OFF (invalid). If the other bits are
turned ON (valid), store the setting value in the corresponding device.
*2 PID operation is executed using the manipulated value (MV) at the rising edge of
the execution conditions as the default manipulated value.
EXTENDED INSTRUCTIONS
S Measured value PV
D1 +0 Setting value SV
Manual manipulated At each PIDAT instruction operation cycle
D1 +1 MVMAN
value
D1 +2 Operation control flag –
Bit 0 Only at rising edge of PIDAT instruction execution condition
Differs according to the constant application timing
selection ( D1 +2: bit 4) setting.
• When D1 +2: bit 4 is
Bit 1
Operation OFF: Only at rising edge of PIDAT instruction execution
D1 +3
setting
–
condition
ON: At each PIDAT instruction operation cycle
5
Bit 4 to 6
Instruction
PID Control
Only at rising edge of PIDAT instruction execution condition
Bit 8 to 9
Bit 12 to 15 At start of automatic tuning
D1 +4 Sampling cycle TS Only at rising edge of PIDAT instruction execution condition
D1 +5 Proportional constant KP
D1 +6 Integral constant TI
D1 +7 Differential constant TD
Proportional constant
D1 +8 2 degree of freedom α
coefficient
Integral constant
D1 +9 2 degree of freedom β
Differs according to the constant application timing
coefficient
selection ( D1 +2: bit 4) setting.
Differential constant 2
• When D1 +2: bit 4 is
D1 +10 degrees of freedom γ
OFF: Only at rising edge of PIDAT instruction execution
coefficient
condition
Manipulated variable ON: At each PIDAT instruction operation cycle
D1 +11 MVLL
lower limit value
Manipulated variable
D1 +12 MVHL
upper limit value
Manipulated variable
D1 +13 change width ∆MVL
Restriction value
Measured value change
D1 +14 ∆PVL
width
D1 +15 AT adjustment parameter τ
D1 +16 AT hysteresis h At start of automatic tuning
D1 +17 AT timeout time –
Operation control flag
D1 +18 –
(input)
Setting value after target –
D1 +19 SVF
value filter (input)
D2 Manipulated value MV
* The manipulated value could fluctuate greatly if the manipulated value lower limit or upper limit is
changed while the execution conditions are ON.
ON
Execution conditions
EXTENDED INSTRUCTIONS
OFF
Sampling cycle ( )
(1)The PIDAT instruction executes the initialization process in one scan at the rising edge of the
execution conditions.
(2)While the execution conditions are ON, PID operation is executed as each sampling cycle (TS)
5 passes. When PID operation is executed, the operation complete flag ( D1 +18: bit 0) turns ON
for one scan.
Instruction
PID Control
(3)When the AT start/operating flag ( D1 +2: bit 2] turns ON, automatic tuning is executed at the
next 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 conditions.
• The parameters for which the application timing is "rising edge of PIDAT instruction execution
conditions" are read to the work area ( D1 +20 to D1 +51).
• The value set in manipulated value ( D2 ) is read in as the default manipulated value.
Setting value ( )
AT hysteresis ( )
Measured value ( )
Manipulated value ( )
EXTENDED INSTRUCTIONS
* Automatic tuning will be executed even if the AT start/operating flag is ON when the execution
conditions change from OFF to ON.
If automatic tuning does not end correctly, CR2012 will turn ON but the PIDAT instruction will continue
operation.
At this time, PID control will operate using the PID constants applied before automatic tuning was
5
started.
Instruction
PID Control
Canceling automatic tuning
To cancel automatic tuning in progress, turn the AT start/operating flag ( D1 +2: bit 2) OFF.
After automatic tuning is canceled, PID control will start using the PID constants (proportional constant
(KP), integral constant (TI), differential constant (TD)) applied before automatic tuning was started.
Time Time
Data Settings
Sets the measured value observed from the control target device.
Reference Use the RAMP instruction to change the setting value at a set inclination.
"RAMP instruction" (Page 4-144)
Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved
(0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0)
Unlike when the execution conditions turn OFF, the initialization process is not executed when
operation resumes.
This function is used to stop the operation when preparing the device, or for special control, etc.
EXTENDED INSTRUCTIONS
If automatic tuning ends abnormally, the operation flag CR2012 turns ON and the error details
information (error code) is stored in CM5157.
Constant (KP, TI, TD, α, β, γ, MVLL, MVHL, ∆MVL, ∆PVL) application timing selection
D1 +2: Bit 4
When this bit turns ON, the parameters (KP, TI, TD, α, β, γ, MVLL, MVHL, ∆MVL, ∆PVL) are applied onto
the operation formula at each sampling cycle.
5
When this bit is OFF, the parameters are applied on the operation formula only at the rising edge of the
Instruction
PID Control
execution conditions.
Operation setting D1 +3
The operation is set with the ON and OFF status of the bit position of the device specified with
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 value when the measured value is higher than the
setting value. Reverse operation is a heating operation which increases the manipulated
value 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.
Instruction
PID Control
Reference
EXTENDED INSTRUCTIONS
value is limited so that it is not larger than the value set with manipulated value change width limit
value (∆MVL). If the width exceeds the setting, manipulated value change width exceeded ( D1 +18:
bit 2) turns ON. This is valid in the automatic and manual modes.
The width is not limited during automatic tuning.
Instruction
PID Control
AT calculation control method setting D1 +3: Bit 12 to 15
Measured value
(Pv)
PIDAT instruction
in program
PIDAT executed
(1) Cycle No process Operation Operation No process Operation Operation No process
with default value
execution execution execution execution
PIDAT executed
(2) Cycle No process No process Operation No process No process Operation No process
with default value
execution execution
5(%)
Assuming that the proportional band on a temperature controller having a temperature width of 0 to
200°C is 5% (temperature width 10°C), the temperature range of the proportional band at setting value
100°C becomes 95°C to 105°C.
Manipulated variable upper limit value at 95°C (MVHL) : +32767
Manipulated variable lower limit value at 105°C (MVLL) : -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
KP =16.000
(1) Though the deviation between the
setting value (SV) and the
Temperature (1)
measured value (PV) becomes
small when a large proportional
Deviation
(2) constant (KP) is set, hunting
increases.
Set value
(2) Both deviation and hunting become
medium-size when a medium-size
(3) proportional constant (KP) is set.
(3) Though deviation increase when a
small proportional constant (KP) is
Time set, hunting decreases.
* As deviation is not solved by adjustment of the proportional constant (KP), use the integral constant
(TI) to adjust deviation.
EXTENDED INSTRUCTIONS
Temperature (1)
constant (TI) is set, hunting increases.
(2)
(2) Both startup and hunting become medium-
Set value size when a medium-size integral constant
(TI) is set.
(3) Though startup is slow when a large integral
(3)
constant (TI) is set, hunting decreases.
Time
* Increase the integral constant setting when hunting occurs over a long cycle.
Instruction
PID Control
when the measured value (PV) exceeds the setting value (SV) by action of the proportional constant
(KP) and integral constant (TI).
For this reason, hunting can be decreased even if a large proportional constant (KP) or a small integral
constant (TI) is set.
Temperature (1) Though the response to external
(1)
(1) disturbance is fast when a large
(2) differential constant (TD) is set, hunting
increases.
Set value (2) Both response to external disturbance
and hunting become medium-size when
(3) a medium-size differential constant (TD)
(2) is set.
(3) Though the response to external
Interfere disturbance is slow when a small
differential constant (TD) is set, hunting
Time
decreases.
* · 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
β is increased
Setting value
suppressed.
When γ=1/α is set, deviated differentiation takes place, and the responsiveness when the target value
changes will increase. However, the fluctuation in the manipulated value 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 on the operation formula as the default value.
This is valid in the automatic and manual modes. ON and OFF is controlled within this value's range
during automatic tuning.
EXTENDED INSTRUCTIONS
AT timeout time D1 +17
Set this if automatic tuning does not end because the measured value (PV) does not change, etc.
When the timeout 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 was started.
Instruction
PID Control
bit bit bit bit bit
15 3 2 1 0
Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved
Operation completed
PID operation is executed at the rising edge of the execution conditions using this value as the default
value.
* This value is used as the default manipulated value, so set an appropriate value.
* This value should be output to the control target regardless of the mode.
* When not using integral actions, add an offset value to this value.
Reference • When converting to a pulse output, input this value with the "TPOUT instruction".
"TPOUT instruction" (Page 4-148)
• When limiting and controlling the manipulated value, use the "LIMIT instruction" to limit
the upper/lower limits of this value.
"LIMIT instruction" (Page 4-130)
Point • If the rising cannot be detected in the execution conditions (when a constant ON is
used for execution conditions, a PIDAT instruction is programmed 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 conditions 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 integration (constant (TI) is 0 or 3000.1 (sec) or more), the effect of
the target value will be too large. The target value filter will be disabled in this case as
an exception. (The proportional constant 2 degree of freedom coefficient (α) will be 1.)
Operation flag
* KV-7500/7300/5500/5000/3000 When CR2012 is ON, the error code (detailed error information) is stored
into CM5157.
KV Nano Series When CR2012 is ON, the error code (detailed error information) is stored into CM2257.
5-148 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
PID Control Instruction
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 rang
Proportional constant 2 degree of
29
freedom coefficient out of range
Integral constant 2 degree of
30
freedom coefficient out of range
Review the parameter stored in D1 .
Differential constant 2 degree of
31
freedom coefficient out of range PID operation is stopped.
32
Manipulated value upper/lower
value out of range (Out of range
5
or upper limit ≤ lower limit)
Instruction
PID Control
Manipulated value change width
33
out of range
Manipulated valiable change
34 width restriction value out of
range
Illegal data is written in work area. Revise
35 AT status transition error the program so that illegal data is not
written in.
Operation control flag out of The D1 operation control flag value is
36
range out of range. Revise the value.
The operation cycle is more than double
37 Operation cycle exceeded the sampling cycle (TS). Review the
sampling cycle setting
AT adjustment parameter out of The AT adjustment parameter value is out
38
range of range. Revise the value.
The AT hysteresis value is out of range,
32767≤ (setting value + AT hysteresis), or
39 AT hysteresis out of range
(setting value - AT hysteresis) ≤ -32768.
Revise the value.
The AT timeout time value is out of range.
40 AT timeout time out of range
Revise the value.
AT operation control method The AT operation control method setting
41
setting out of range value is out of range. Revise the value.
Automatic tuning timed out. Check that
PID operation is the manipulated value is correctly
42 AT timeout continued. If automatic conveyed to the control target and that
tuning is in progress, it will the measured value can be observed.
stop and PID operation will
be executed The changes in the measured value are
small in respect to the manipulated value
and the automatic turning results exceed
the maximum proportional constant, so
AT proportional constant
43 operation was started with proportional
exceeded
constant = maximum value.
Take measures to increase changes in the
measured value such as by increasing the
measured value by several fold.
44 AT integral constant exceeded Automatic tuning took time and the
integral constant and differential constant
in the automatic tuning results exceed the
maximum value, so operation was started
with integral constant = maximum value
45 AT differential constant exceeded and differential constant = maximum
value.
Increase the difference in the upper/lower
limits of the manipulated value, or review
the AT hysteresis setting
Sample Program
PID operation is executed using the setting value stored in data memory DM1000 as a target. The
pulses are output from the output relay R500 at the obtained manipulated value, and PID control is
EXTENDED INSTRUCTIONS
performed. 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
Default settings for PIDAT instruction
(Mnemonics list)
CR2007 MR000
SET
OFF 1 scan
at start of
operation
Set inclination with RAMP instruction
(50 inclination per second)
MR000 +0
DW.S
DM1000
Setting value
MR000 RAMP
DM2000 #50 #0 DM1000
Target value Setting value
MR000 PIDAT
DM10100 DM1000 DM999
EXTENDED INSTRUCTIONS
ch0 Setting Manipulated
measurement value value
input value
MR000 CR2012
’PIDAT error process
Operation
execution error
Instruction
PID Control
When the execution conditions are ON, automatic tuning
starts at the rising edge of MR001. The ON/OFF status of
MR100 is used to confirm whether automatic tuning is in
progress.
DM1002.2 MR100
AT start/ In automatic
operating flag tuning
DM1002.2 MR001
RES
AT start/
AT execution
operating flag
conditions
MWRIT/MPRINT
KV-7500
MMKDIR/ MRMDIR
REALTIME
CARD
Logic Controller
MDEL/MREN
MENU ENTER
CARD SW
Read
MCOPY/MMOV
USB
LINK
Write
NS
MREAD/MREADL Storage device PC
EtherNet/IP™
5
KV-7500/7300 CPU memory)
KV-5500/5000/3000
MSTAT
KV-NC32T
Instructions
Storage Device
EXTENDED INSTRUCTIONS
MREAD Reads continuous devices from the storage device. 5-170
MFREE Reads the free space on the storage device. 5-178
MMKDIR Creates a storage device folder. 5-182
MRMDIR Deletes a storage device folder. 5-186
MDEL*1 Deletes a file on the storage device. 5-188
MPRINT*2 Writes only one line to a file on the storage device. 5-190
MREADL*2 Reads only one line of a file on the storage device. 5-194
MCOPY*2 Copies a file on the storage device. 5-200
MMOV*2 Moves a file on the storage device. 5-206
MREN*2 Renames a file on the storage device. 5-212
MFREEK*2
MSTAT*2
Reads the free space on the storage device in kilobytes.
Gets the status of a file on the storage device.
5-216
5-220
5
*1 This instruction can only be used with the KV-7500/7300/5500/5000/3000 and KV-NC32T.
Instructions
Storage Device
*2 This instruction can be used with KV-7000 Series CPU units, KV-5500/5000/3000 Series CPU
units that have CPU function version 2.0 or higher and with KV-NC32T units.
"KV-5000/3000 CPU Function Version" (Page 2)
Reference • Storage device is a generic term for a storage area. For KV-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-7500/7300/5500/5000/3000 is used, there is file register (FRSTM/FRLDM)
command other than the storage device instructions as a command term which reads
and writes to storage. The read and write format is fixed with the file register instructions.
Therefore, compared to the MWRIT and MREAD instructions, these instructions may be
capable of reading and writing at high speed when reading and writing a large number
of devices. (The only device that can be read and written is FM.)
Decimal unsigned binary values for DM1000 to DM1009 are saved to the storage device with a new
line for each word.
Folder: ABC File Name: MWRIT 1 word new line
MWRIT
"ABC\MWRIT linefeed" DM1000 #10
Folder name Save head device Amount of saved data
File name
DM500 MR001
Save format MWRIT complete
EXTENDED INSTRUCTIONS
Data from DM1010 to DM1019
Data from DM1020 to DM1029
Data from DM1030 to DM1039
Data from DM1040 to DM1049
Instructions
Storage Device
(Mnemonic list)
MR000 [4] = Decimal unsigned binary
#4
DW LD MR000
Start writing DM500 DW #4 DM500
Save format
DW #0 DM501
#0
[0] = Add mode DW $0A01 DM502
DW
MWRIT "ABC\MWRIT linefeed" DM1000 #50 DM500 MR001
DM501
Write mode
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 device values of 10 words per line
The CSV file data below is read to DM1100 to DM1149.
EXTENDED INSTRUCTIONS
5HDGIRUPDW
DW #0 DM601
#0
[0] = Standard mode MREAD "ABC\MREAD_DATA" DM1100 #50 DM600 MR101
DW
DM601
5HDGPRGH
MREAD
"ABC\MREAD_DATA" DM1100 #50
Folder name 5HDGKHDGGHYLFH $PRXQWRIUHDGGDWD
File name
DM600 MR101
5HDGIRUPDW 5HDGLQJFRPSOHWH
EXTENDED INSTRUCTIONS
Error
Description Cause How to handle
Code
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.
The specified file or directory already
4 File already exists
exists.
The file system of the memory card is in
Rename the file or directory.
5
5 File load error Check the file system of the memory card.
Instructions
Storage Device
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/write The specified read/write position indicates
7 Correctly specify the read/write position.
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
Either correct the content of the file, or
9 Format error format or out-of-range data was saved
select the correct format.
when the 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 Confirm the restrictions of the executed
11 CPU memory.
error storage device instruction.
• The file/folder that the device is attempting
to create exceeds the16th hierarchy.
The instruction was not executed due to Confirm the restrictions of the executed
1000 Other errors
the 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.
MWRIT
MWRIT
S1 S2 n M W R I T S1 S2 n
D1 D2 D1 D2
Operand Explanation
Specifies the leading device in which the file name ((drive No. +)*9 folder name + file name + terminal
S1
code NULL: 1 to 247 characters) or folder name is stored. *1 *2
S2 Specifies the leading device to save data to.*2 *3
n Specifies the number of data to save.(0 to 65535)*4
D1 Specifies the leading device to store save format-related parameters and the save state of the data.*3,*6,*7
D2 Specifies the notification bit device.*5 *6
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 When saving index register Z and digital trimmer values set in the access window, copy the data
once to a data memory DM, for example, and then set that data memory DM.
*3 For bit devices, specify the leading device of the channel.
*4 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*5 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, the lowermost bit of two continuous words is used as the notification bit device.
Bits other than the lowermost bit do not change.
*6 When a device to which indirect specifying or index modification has been specified, data is
written to the specified device at the rising edge of the execution condition.
*7 When a bit device has been specified to D1 , 96 continuous bits are occupied. When a word
device has been specified, six continuous words are occupied.
*8 EM and FM (ZF) cannot be used with the KV Nano Series.
*9 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*10 T/C cannot be specified for KV-7500/7300.
*11 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
MWRIT This instruction writes n data (16-bit/32-bit/ASCII text string) to the memory card
(memory card or CPU memory for the KV-7000 Series) starting from S2 according to
EXTENDED INSTRUCTIONS
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
S2 +2 34567
Storage
Device
…
Storage Command
S2 + n -1 56789
32-bit data
bit bit bit bit
31 16 15 0
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 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
* 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.
EXTENDED INSTRUCTIONS
Point Save format When the setting of save format D1 has been specified in BIN data, it is
stored as follows:
16-bit data
bit bit
15 0
12345 3039H
3930A05B
23456 5BA0H
32-bit data
bit bit bit bit
5
31 16 15 0
1234567890 499602D2H
D20296493538D08B
2345678901 8BD03835H
Storage Command
S1 setting
Specify the name of the file to save data to within 1 to 249 characters (including end code NULL(0H)
and folder name)
File
DM4 NULL(00H)
Point • An extension is automatically added to the end of the file name according to the save
format setting D1 .
• For KV-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 .
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
unsigned unsigned signed signed text real
saved BIN BIN HEX HEX
BIN BIN BIN BIN string number
Extension
appended .BIN .CSV
to S1
Save
BIN data Comma Separated Value
format
5
" D1 +1": Write mode settings
Storage Command
The following four write modes can be selected.
Mode Description
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
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)
bit D1 +2 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 5 6 7 8 9
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)
" D1 +3"/" D1 +4" are enabled when the write mode is ( D1 +1) and the write position
specification mode is set to 1 or 2.
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.
The position to write to can be specified in 1-byte units.
5-162 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Storage Command
Ex: 1 When the write mode " D1 +1" is "1" .... Write position specification mode (offset from
start of file)
file index position
EXTENDED INSTRUCTIONS
Setting Stored
value value
Description
" D1 +3"/ " D1 +3"
" D1 +4" /" D1 +4"
Data is overwritten from the start of the file.
Example
$0 File name: ABC (data to save) File name: ABC
$4
$0 $4
Data is overwritten at a specified position from the start of the file.
Example When $1
File name: ABC (data to save*) File name: ABC
$5 5
Storage Command
$5
$1 to $0 $1
$2
File name: ABC (data to save*) File name: ABC
$6
$6
$0 $2
* Quotes ["] are added before and after the data when 8 is specified for D1 .
Ex: 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.
File index position
Setting Stored
value Description value
" D1 +3"/ " D1 +3"/
" D1 +4" " D1 +4"
Data is added to the end of the file.
Example
File name: ABC (data to save*) File name: ABC
$0
$22222222 $22222226
($0)
Data is overwritten at a specified position from the end of the file.
Example When $1 is set
File name: ABC (data to save*) File name: ABC
$0
$22222221 $22222225
$22222222
$1 to
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
BIN
format
…Pointer position
...Corrupted data
5
" D1 +5": Number of written data
Storage Command
The number of actually written data is stored after write processing to the storage device ends.
Number Stored
Save format of Data Description value
D1 to Write " D1 +5"
n
0. 16-bit BIN
Example
1. 32-bit BIN File name: ABC (data to save)
4
2. 16-bit Hex
3. 32-bit Hex File name: ABC
4. unsigned16-bit BIN 4
5. unsigned 32-bit BIN Example File name: ABC (data to save)
6. singed 16-bit BIN Size exceeded
7. singed 32-bit BIN 2
File name: ABC
9. Floating real number
Item Description
This device turns OFF when execution of the instruction starts, and turns
Completion
D2 ON when write processing to the storage device ends. The device turns ON
notification
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 • 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 written
EXTENDED INSTRUCTIONS
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
(NUL) from S2 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"
5
• File names are automatically appended with an extension according to the save format
setting.
• Several scans are sometimes required for writing to the device. If the value of the
Storage Command
device to write to is changed during write processing to the memory card, the
concurrency of each of the written device values cannot be ensured.
Please implement exclusive control by using the completion notice D2 or CR3214
(Storage instruction executing).
• The MWRIT command can not be executed when CR3214 is ON during the execution
of storage device instructions. Therefore, the implementation of exclusive control is
necessary by using CR3214 as follows.
Example RXXXXX CR3214 MWRIT
S1 S2 n
D1 D2
Operation flag
Sample Program
Each time that R1000 turns ON, data memories DM01000 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
RES R1004
MWRIT
"ABC\DATA" DM1000 #100 (5)
DM500 R1004
Storage Command
(6) Process completion output is turned ON and completion notice device is reset.
* Writing cannot be executed if the "ABC" folder does not exist.
Create the "ABC" folder beforehand with the "MMKDIR" instruction.
"MMKDIR instruction" (page 5-182)
* Input "0: \ABC\DATA" or "ABC\DATA" for the KV-7000 Series. (If 0: \ is not input, data will be written to
the memory card.)
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.
CR2008 R1004 (Mnemonics list)
EXTENDED INSTRUCTIONS
RES (1)
1 scan ON
LD CR2008
RES R1004
R1000 R1004 CM700 DM0 LDP R1000
(2)
LDA
calendar timer (Year)
TBCD ASC STA ANB R1004
MPS
CM701 DM1 LDA CM700
(3)
LDA TBCD ASC STA CON
calendar timer (Month)
TBCD
CM702 DM2 CON
LDA TBCD ASC STA (4) ASC
CON
calendar timer (Day)
5
CM704 DM4 CON
LDA TBCD ASC STA (6) TBCD
calendar timer (Minute)
CON
$0 DM5 ASC
Storage Command
LDA STA (7) CON
STA DM1
SADD MRD
"ABC\" DM0 DM10 (8) LDA CM702
CON
#6 TBCD
DW (9) CON
DM500 ASC
#3 CON
DW (10) STA DM2
DM501 MRD
#0 LDA CM703
DW (11) CON
DM502 TBCD
MWRIT CON
DM10 DM1000 #100 (12) ASC
DM500 R1004 CON
STA DM3
R1004 R500 R1004
SET RES (13) MRD
LDA CM704
CON
(1) The completion notification device is reset to its initial state. TBCD
(2) Calendar timer (Year) 00 to 99 is converted to ASCII code CON
and stored to DM0. ASC
CON
(3) Calendar timer (Month) 01 to 12 is converted to ASCII code
STA DM4
and stored to DM1. MRD
(4) Calendar timer (Day) 01 to 31 is converted to ASCII code LDA $0
and stored to DM2. CON
(5) Calendar timer (Hour) 00 to 23 is converted to ASCII code STA DM5
and stored to DM3. MRD
(6) Calendar timer (Minute) 00 to 59 is converted to ASCII code SADD "ABC\" DM0 DM10
and stored to DM4. MRD
(7) NULL (00H) is stored to DM5 (the ASCII codes of DM1 to DW #6 DM500
MRD
DM4 are converted to character strings). DW #3 DM501
(8) The calendar timers and folder name "ABC" are united into MRD
a single text string, and stored to DM10 to make DW #0 DM502
"ABC\yymmddhhmm". (Folder name and file name are MPP
made.) MWRIT DM10 DM1000 #100 DM500 R1004
(9) DM500: Save format LD R1004
singed 16-bit BIN, CSV file SET R500
(10) DM501: Write mode CON
RES R1004
New mode
(11) DM502: Option
Insert a comma at end of data, and change number of data
digits.
(12) Start of save<folder>: ABC <folder name>: DM10
<save device>: DM1000 to DM1099 (100 devices)
<completion notification>: R1004
<error notification>: R1005
(13) Process completion output is turned ON and completion
notice device is reset.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-167
Storage Command
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 time
taken as the file name. ON is output to R500 after writing ends.
(Mnemonics list)
EXTENDED INSTRUCTIONS
5 SADD
"ABC\" DM0 DM10 (6)
MRD
LDA CM701
CON
TBCD
Storage Command
#6
DW (7) CON
DM500 ASC
#3 CON
DW (8) STA DM1
DM501 MRD
#0 LDA CM702
DW (9) CON
DM502 TBCD
MWRIT CON
DM10 DM1000 #100 (10) ASC
DM500 R1004 CON
STA DM2
R1004 R1006 #0
(11) MRD
DW
DM501
LDA $0
CON
MWRIT
DM10 DM2000 #200 (12) STA DM3
DM500 R1006
MRD
SADD "ABC\" DM0 DM10
R1006 R500 R1004
(13)
MRD
SET RES DW #6 DM500
MRD
(1) The completion notification device is reset to its initial state. DW #3 DM501
(2) Calendar timer (Year) 00 to 99 is converted to ASCII code MRD
and stored to DM0. DW #0 DM502
(3) Calendar timer (Month) 01 to 12 is converted to ASCII MPP
code and stored to DM1. MWRIT DM10 DM1000 #100 DM500 R1004
(4) Calendar timer (Day) 01 to 31 is converted to ASCII code LD R1004
and stored to DM2. ANB R1006
DW #0 DM501
(5) NULL (00H) is stored to DM3 (the ASCII codes of DM1 to
MWRIT DM10 DM2000 #200 DM500 R1006
DM2 are converted to character strings). LD R1006
(6) The calendar timers and folder name "ABC" are united into SET R500
a single text string, and stored to DM10 to make CON
"ABC\yymmdd". (Folder name and file name are made.) RES R1004
(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 device>: DM1000 to DM1099 (100 devices)
<completion notification>: R1004
<alarm notification>: R1005
(11) DM501: Write mode
Add mode
(12) Start of save<folder>: ABC <file name: DM10
<save device>: DM2000 to DM2199 (200 devices)
<completion notification>: R1006 <error notification>:
R1007
(13) Process completion output is turned ON and completion
notice device is reset.
5-168 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Storage Command
MEMO
EXTENDED INSTRUCTIONS
5
Storage Command
MREAD
car
d
memory). y).
Operand Explanation
It designates the file name( (drive No. +)*9 folder name + file name + termination code NULL:1 to
S
247 characters) saved in the memory card (CPU memory) or the leading device which stores the file name.*1 *2
D1 Specifies the leading device to which the read data is to be stored.*2
n Specifies the number of data to read.*3 *4
D2
Specifies parameters relating to format, etc. of data to read, and the leading device to store the read
state of the data.*2 *6 *7
D3 Specifies the notification bit device.*5 *6
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 For bit devices, specify the leading device of the channel.
*3 When a bit device has been specified, 16 continuous bits are occupied. When a word device
has been specified, one word is occupied.
*4 When reading ASCII text string data, specify the maximum number of characters (number of
bytes) in the text string.
*5 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*6 When a device to which indirect specifying or index modification has been specified, data is
written to the specified device at the rising edge of the execution condition.
*7 When a bit device has been specified to D2 , 96 continuous bits are occupied. When a word
device has been specified, six continuous words are occupied.
*8 EM and FM (ZF) cannot be used with the KV Nano Series.
*9 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
*10 T/C cannot be specified for KV-7500/7300.
*11 CTH and CTC cannot be used with the KV-7000 Series.
Operation Description
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 of the execution condition to devices starting
EXTENDED INSTRUCTIONS
D2
from D1 from the file specified by S .
The number of actually read 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
D1 12345
D2 to D2 +4
3930A05B07876EB2D5DD D1 +1 23456
D1 +2 34567
Storage
Storage Command
Device
…
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
…
When file 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 leading string separated by “"” when reading ASCII string, and specify a
value bigger 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 storage device to within 1 to 249 characters (including end
Storage Command
DM4 NULL(00H)
Point When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).
n setting range
Sets the number of data to read. The setting range changes according to the setting value of D2 .
* 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
Storage Command
You can select from the following three read modes.
Mode Description
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
specification mode 2 Example File name: ABC
(offset from end of file)
Read position (" D2 +3· D2 +4")
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".
After read processing from the storage device ends, counting is performed from the start of the file,
5 and the position up to the end of the newly read data is stored to the read position (" D2 +3"/
" D2 +4").
Storage Command
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.
Ex: 1 When the read mode " D2 +1" is "1"... Read position specification mode (offset from start of file)
file index position
Setting Stored
value Description value
" D2 +3"/ " D2 +3"/
" D2 +4" " D2 +4"
Data is read from the start of the file.
Example File name: ABC number of data to read File name: ABC
$0 n $4
$0 #4 $4
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 $5
$1 to $0 $1
When $1 is set
File name: ABC number of data to read File name: ABC
n $6
#4 $6
$0 $2
Ex: 2 When the read mode " D2 +1" is "2"... Read position specification mode (offset from end of file)
file index position
Setting Stored
EXTENDED INSTRUCTIONS
value value
Description
" D2 +3"/ " 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
$2222221C $22222222
$1 to
When $4 is set
File name: ABC number of data to read File name: ABC
n $0
5
#4 $22222222
$22222220 $22222222
Storage Command
Point Pay attention to the following when specifying the position to read from.
16-bit BIN 01000204 32-bit BIN BC0 0 4 E 6 1 5 B 0 7 1 5CD
TEST1.BIN TEST1.BIN
× × × × × × × ×
.CSV file
" A B C " , " 1 2
TEST1.CSV (22H) (41H) (42H) (43H) (22H) (2H) (22H) (31H) (32H)
O: Correctly read position
× × × × × × × × X: Incorrectly read position
Number
of Data Stored
Save format Description Value
D2 to Read
n
" D2 +5"
0. 16-bit BIN Example File name: ABC D1 D1 +39
1. 32-bit BIN 100 items of data
40
2. 16-bit Hex 40 items of data
3. 32-bit Hex read from file ABC
4. unsigned 16-bit BIN 40
Example File name: ABC
5. unsigned 32-bit BIN D1 D1 +29
30 items of data
6. singed 16-bit BIN 30
7. singed 32-bit BIN 30 items of data
read from file ABC
9. floating real number
Example File name: ABC D1 D1 +39
100 characters of data NULL
40
Item Description
This device turns OFF when execution of the instruction starts, and turns
EXTENDED INSTRUCTIONS
Point • When the data to read is data outside of the specified format range, an error occurs, 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 index
5 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
Storage Command
D2 D3
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
This flag is ON in the following instances. Otherwise, it is OFF.
• 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 has been specified by indirect specifying to S
CR2012 • When a device other than the leading device of the channel is specified when a bit device is
specified to S , 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 specifying or index modification range is inappropriate
Storage Command
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
Sample Program
When R1000 turns ON, the data (100 items) in the file "DATA.CSV" in folder* "ABC" on the memory card
is read, and is stored to data memories DM1000 to DM1099.
ON is output to R500 after reading ends.
MFREE
Gets the free space on the
MFREE
Get storage device
memory card (CPU memory)
For other series space in byte unit
by byte unit.
MFREE
EXTENDED INSTRUCTIONS
KV-7500/7300
5 Ladder program
Execution condition MFREE
Input mode
D1 D2 M F R E E D1 D2
Storage Command
D2 ○ − ○ − − − ○ ○ ○*4 − − − − − ○ − − ○ ○ ○
Operand Explanation
n(-*5) It designates storage which confirms the amount of free space. (0: memory card, 1: CPU memory)
D1 Specifies the leading device to store the free space to.*1 *3
D2 Specifies the notification bit device.*2 *3
*1 When a bit device has been specified, 32 continuous bits from the start of the channel are
handled.
*2 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*3 When a device to which indirect specifying or index modification has been specified, data is
written to the specified device at the rising edge of the execution condition.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 For CPU unit other than the KV-7000 series, an operand that designates the storage which
confirms the amount of free space does not exist.
*6 T/C cannot be used when using the KV-7000 Series.
Operation Description
MFREE Free space on the storage device is stored in byte units to the device specified by
" D1 / D1 +1" at the rising edge of the execution condition.
EXTENDED INSTRUCTIONS
Also, 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
32-bit BIN data
Storage
5
Scan
ON
Execution condition
OFF
Storage Command
MFREE Only 1 scan Only 1 scan
Capture process
ON
End notice ( D2 )
OFF
Item Description
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 as a byte unit and stored in data
memory [DM1000.DM1001].
Outputs ON to R500 after completion of storage.
(Mnemonics list)
CR2008 R1004
(1)
1 scan ON
RES LD CR2008
RES R1004
R1000 MFREE
(2) LD R1000
DM1000 R1004
MFREE DM1000 R1004
LD R1004
R1004 R500 R1004
SET RES (3) SET R500
CON
RES R1004
MEMO
EXTENDED INSTRUCTIONS
5
Storage Command
MMKDIR
Creating storage Makes a directory on the
y
MMKDIR card
(CP
U
Operand Explanation
5 S
Specifies the folder (1 to 247 characters, including (drive No. +)*5 folder name + end code NULL) to
create or the leading device storing the folder.*1 *2
Specifies the notification bit device.*3
Storage Command
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 When a bit device has been specified, specify the leading device of the channel.
*3 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
Point • Cannot be used with KV-N14**/N24**/N40**/N60**.
• Use half-width and full-width characters to create distinct folder names (capital letters
and lower case letters are not differentiated between).
Operation Description
MMKDIR The folder specified by S in the storage device is made at the rising edge of the
execution condition.
Also, 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"
Folder B
Scan
ON
Execution condition
OFF
EXTENDED INSTRUCTIONS
MMKDIR Only 1 scan Only 1 scan
Capture process
ON
End notice ( D )
OFF
ON
CR3214
(Storage instruction executing) OFF
Storage Command
Item Description
Completion Turns OFF when execution of the instruction starts, and turns ON when the
D folder has finished being made.
notification The device turns ON whichever way execution ends, successfully or in error.
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 device.
• The store destination when indirect specifying or index modification is specified to a notification
bit device becomes the store destination 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 to
EXTENDED INSTRUCTIONS
(3) Processing completion output is turned ON. The completion notification device is reset.
MEMO
EXTENDED INSTRUCTIONS
5
Storage Command
MRMDIR
ory
5
Operand Explanation
Specifies the folder (1 to 247 characters, including (drive No. +)*6 folder name + end code NULL) to
S
delete or the leading device storing the folder. *1 *2
Storage Command
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 For bit devices, specify the leading device of the channel.
*3 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*4 When a device to which indirect specifying or index modification has been specified, data is
written to the specified device at the rising edge of the execution condition.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
Operation Description
MRMDIR The folder specified by S in the storage device is deleted at the rising edge of the
execution condition.
The completion notice is written in 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 device ends. The device turns ON whichever way execution
ends, successfully or in error.
• D turns OFF when D +1 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
• When the text string specified by S does not contain the end code (NULL)
• ON when the text string exceeds 247characters (including end code)
CR2012 • ON when the relay specified in S is not Timer, Counter, or channel leading device
• ON when the indirect specifying or index modification range is inappropriate
Otherwise, OFF
Storage Command
Sample Program
Delete the log files in the memory card in the rising edge of Input Relay R0.
(Mnemonics list)
R000 MRMDIR
“LOG0” “MR000” LD R000
MRMDIR "LOG0" MR000
File delete Delete result
For more information, please refer to "Logging/Tracing" in the "KV-7000 Series User's Manual",
"Logging/Tracing" in the "KV-5500/5000/3000 Series User's Manual" and/or "Logging/Tracing" in the
"KV Nano Series (connector type) User's Manual".
MDEL (CPU
memory).
MDEL
MDEL Deletion of storage Delete specified files in
device files memory card (CPU memory).
5 Operand Explanation
Specifies the file to delete (1 to 249 characters, including (drive No. +)*6 folder name + file name + extension +
Storage Command
S
end code NULL) or the leading device storing the file name. Specify the extension along with the file name.*1 *2
D Specifies the leading bit device to which stored to a notification bit.*3 *4
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 For bit devices, specify the leading device of the channel.
*3 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*4 When a device to which indirect specifying or index modification has been specified, data is
written to the specified device at the rising edge of the execution condition.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
Operation Description
MDEL The folder specified by S in the storage device is deleted at the rising edge of the
execution condition.
The completion notice is written in 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 device ends. The device turns ON whichever way execution
ends, successfully or in error.
• This device turns OFF when D +1 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
• When the text string specified by S does not contain the end code (NULL)
• ON when the text string exceeds 247characters (including end code)
CR2012 • ON when the relay specified in S is not Timer, Counter, or channel leading device
• ON when the indirect specifying or index modification range is inappropriate
Otherwise, OFF
Storage Command
Sample Program
Delete the log files in the memory card in the rising edge of Input Relay R0.
(Mnemonics list)
R000 MDEL
“LOG0\LOG000.CSV” “MR000” LD R000
MDEL "LOG0\LOG000.CSV" MR000
File delete delete Result
For more information, please refer to "Logging/Tracing" in the "KV-7000 Series User’s Manual", "Logging/Tracing"
in the "KV-5500/5000/3000 Series User’s Manual" and/or "Logging/Tracing" in the "KV Nano Series
(connector type) User’s Manual".
S1 S2 D M P R I N T S1 S2 D
Specifies the text string write destination file name ((drive No. +)*4 folder name + file name + end code NUL: 1 to
S1
247 characters), or the leading device storing the file name. Specify the extension along with the file name. *1
S2 Specifies the text string data to write, or the leading device storing the text string. *1
D Specifies the notification bit device. *2
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
For bit devices, specify the leading device of the channel.
*2 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
When a device to which indirect specifying or index modification has been specified, data is
written to the specified device at the rising edge of the execution condition.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
Point • This instruction can be used with KV-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 2)
• 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-7000 series, it can be executed without the
\ (backslash).
Operation Description
MPRINT The text string in the storage device specified with S2 is written to the end of the file
specified with S1 at the rising edge of the execution conditions.
EXTENDED INSTRUCTIONS
If the file specified with S1 is not found, a new file will be created.
The completion notice is written in D , and the error notice is written in D +1 if the
process ends with an error.
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
Device
2010/06/07,18:15:58,No.12,AB1234CD
2010/06/07,19:20:05,No.13,AB1235CD
2010/06/07,20:23:11,No.14,AB1236CD + DM0
2010/06/07,18:15:58,No.12,AB1234CD
2010/06/07,19:20:05,No.13,AB1235CD
2010/06/07,20:23:11,No.14,AB1236CD
5
2010/06/07,21:31:22,No.15,AB1237CD 2010/06/07,21:31:22,No.15,AB1237CD
Storage Command
2010/06/07,22:36:01,No.16,AB1238CD
"Product information.TXT" "Product information.TXT"
before instruction is executed 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 enter
CHR(H0D)/CHR(H0A).
Point • The completion notice and error notice are written as the result of the END process
when execution of the process is completed.
• If CR3214 is ON when another storage device instruction is being executed, the
MPRINT instruction cannot be executed. The following type of exclusive control must
be executed using CR3214 in this case.
Example
RXXXXX CR3214 MPRINT
S1 S2 n
Scan
ON
Execution Condition
OFF
Write process
ON
CR3214
(Storage instruction
OFF
executing)
S1 setting
Specify the name of the file storing the data with 1 to 247 characters (including end code NUL (00H)
and folder name).
EXTENDED INSTRUCTIONS
File
Item Description
This device turns OFF when execution of the instruction starts, and turns
Completion
D ON when writing to the storage device is completed. The device turns ON
notification
whichever way execution ends, successfully or in error.
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 written
onto the end of the "Product Information.TXT" file in the storage device. R500 turns ON if a write error
EXTENDED INSTRUCTIONS
occurs.
(Mnemonics list)
MR000 MPRINT LDP MR000
"Product
Information.TXT" DM0 MR100 MPRINT "Product Information.TXT" DM0 MR100
LD MR100
AND MR101
MR100 MR101 R500 SET R500
SET
Storage Command
2010/06/07, 22:36:01, No.16, AB1238CD
+
2010/06/07, 19:20:05, No.13, AB1235CD DM1 1(31H) 0(30H)
2010/06/07, 20:23:11, No.14, AB1236CD DM2 / (3FH) 0(30H)
2010/06/07, 21:31:22, No.15, AB1237CD
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).
MREADL
card
(CPU
memory
MREADL MREADL
of storage
device
memory card (CPU memory)
is read out.
S D1 D2 D3 M R E A D L S D1 D2 D3
Operand Explanation
Specifies the text string read source file name ((drive No. +)*7 folder name + file name + end code NUL: 1 to 247
S
characters), or the leading device storing the file name. Specify the extension along with the file name.*1 *2
D1 Specifies the leading device storing the text string which was read out.*2
D2 Specifies the leading device storing the parameters related to the position and upper limit of the data to be read out.*2 *3 *4
D3 Specifies the notification bit device. *3 *5
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 For bit devices, specify the leading device of the channel.
*3 If a device with indirect specification or index modification is specified, the process will be
executed on the specified device at the rising edge of the execution conditions.
*4 If a bit device is specified for D2 , 64 continuous bits are occupied. If a word device is
specified, four continuous words are occupied.
*5 When a bit device has been specified, 4 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of four continuous words is used as the notification
bit device. Bits other than the lowermost bit do not change.
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
*8 T/C cannot be specified for KV-7500/7300.
Point • This instruction can be used with KV-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 2)
• Use half-width and full-width characters to create distinct file names (capital letters and
lower case letters are not differentiated between).
Operation Description
MREADL In the start-up of operating conditions, it will read out the data from [ D2 . D2 +1]
byte position of the file designated at and stores to the device which identifies
EXTENDED INSTRUCTIONS
S
D1 as the beginning.
If there is no line return code (CR (0DH), LF (0AH), CR+LF) in the read data, it reads out
[ D2 +2] byte and turns ON D3 +3].
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
Execution Condition
ON 5
OFF
Storage Command
MREADL Only 1 scan Only 1 scan
Read process
ON
End notice ( D3 )
OFF
Read position
( D2 ・ D2 +1)
ON
CR3214
(Storage instruction OFF
executing)
* The read process is executed regardless of the program. Thus, if an instruction is executed once in
a scan, the read process will continue even if the input conditions are OFF in the next scan.
The time for the actual read process to finish depends on the data capacity and file access
process 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
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)
TEST1.TXT
File index position $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F $10 $11 $12 $13 $14
The data from the position specified with [ D2 · D2 +1] to the line return 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]). If reading is executed
again in that state, the next data will be read out.
The position to be read out can be specified in 8-bit unit (1-byte unit).
Setting Stored
value value
EXTENDED INSTRUCTIONS
[ D2 +3• Details [ D2 +3•
D2 +4] D2 +4]
Read from the position at the start of the file.
$0
5
$1 to $0 $1
For $2
File name: ABC.TXT
Text string to read out CR(0DH) $8
Storage Command
$0 $2
Item Description
This device turns OFF when execution of the instruction starts, and turns
EXTENDED INSTRUCTIONS
Point • The notification bit device is written as the result of the END process when execution of
the process is completed.
• It may take several scans to complete reading. When the MREADL instruction is
executed, the data values read from the storage device are written in order from the
head of the device.
Do not read the data in the device range being processed by the MREADL instruction
before the completion notification device turns ON.
Some of the data may not be applied. To prevent this, use exclusive control with the
completion notification or CR3214 (Storage instruction executing).
• The MREADL instruction cannot be executed while another executing storage device
instruction CR3214 is ON. Exclusive control must be executed in the following manner
using CR3214.
Example
RXXXXX CR3214 MREADL
S D1 D2 D3
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 return position is read, and stored in data memory from DM0. R500 turns ON when a
EXTENDED INSTRUCTIONS
read error occurs.
Storage Command
MCOPY memor
y) is
copied.
Specifies the copy source file name ((drive No. +)*7 folder name + file name + end code NUL: 1 to
S1 247 characters), folder name (folder name + end code NUL: 1 to 247 characters), or the leading
device storing this information. Specify the extension along with the file name.*1 *2
Specifies the copy destination file name ((drive No. +)*7 folder name + file name + end code NUL: 1
S2 to 247 characters), folder name (folder name + end code NUL: 1 to 247 characters), or the leading
device storing this information. Specify the extension along with the file name.*1 *2
S3 Specifies parameters related to the copy format, or the device storing that information. *2 *3 *4
D Specifies the notification bit device. *3 *5
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 For bit devices, specify the leading device of the channel.
*3 If a device with indirect specification or index modification is specified, the process will be
executed on the specified device at the rising edge of the execution conditions.
*4 If a bit device is specified for D3 , 16 continuous bits are occupied. If a word device is
specified, one word is occupied.
*5 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 When KV-7500/7300, it designates the drive number with "0: \" (for CPU memory), "1: \" (for
memory card) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
*8 T/C cannot be specified for KV-7500/7300.
*9 CTH and CTC cannot be used with the KV-7000 Series.
Point • This instruction can be used with KV-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 2)
• 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.
Operation Description
MCOPY At the rising edge of the execution conditions, the file specified with S1 is copied to
following the parameters specified in .
EXTENDED INSTRUCTIONS
S2 S3
The completion notification is written in D , and an error notification is written in
[ D1 +1] if the process ends abnormally.
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 247
characters (including end code NUL (00H) and folder name).
Storage Command
DM1 C(43H) \ (5CH) DM1 Z(60H) \ (5CH)
(Example) DM2 D(44H) A(41H) DM2 T(54H) E(45H)
When S1 : DM0 and
DM3 T(54H) A(41H) DM3 S(53H) T(54H)
S2 : DM50 are specified
DM4 .(2EH) c(63H) DM4 .(2EH) c(63H)
DM5 s(73H) v(76H) DM5 s(73H) v(76H)
DM6 NULL(00H) DM6 NULL(00H)
* When copying to a different storage, you can choose to copy files and subfolders
inside the folder all together when copying by designating the folder.
Scan
ON
Execution Condition
OFF
EXTENDED INSTRUCTIONS
Copy process
ON
End notice D
OFF
ON
CR3214
(Storage instruction
OFF
executing)
* The creation process is executed regardless of the program. Thus, if an instruction is executed
once in a scan, the create process will continue even if the input conditions are OFF in the next
5 scan.
• If a folder is specified in , all files directly under the folder are copied
Storage Command
Point S1 S1
directly under the folder specified with S2 .
The sub-folders of the S1 folder are not copied.
• Files with read-only attributes are not overwritten.
• If S1 and S2 are exactly the same, the "Same file found" error will occur
regardless of the D3 value.
• If a file is specified in S1 and a folder in S2 , the file specified with S1 is
occupied into the folder specified with S2 .
• If a folder is specified in S1 and a file in S2 , the "File name error" will occur.
bit bit
15 S3 0
Item Description
This device turns OFF when the instruction execution starts, and turns ON
EXTENDED INSTRUCTIONS
Completion when copying is completed.
D
notification The device turns ON whichever way execution ends, successfully or in
error.
Error This device turns OFF when execution ends successfully, and turns ON
D +1
notification when execution ends in error.
Storage Command
condition.
• The MCOPY instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. For this reason, CR3214 must be used to
perform exclusive control as follows.
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. R500
EXTENDED INSTRUCTIONS
File name:TEST.csv
Copied file
MEMO
EXTENDED INSTRUCTIONS
5
Storage Command
MMOV
m
e
m
MMOV
Move file in A file in the memory card
o
MMOV r
y
)
Specifies the move source file name ((drive No. +)*7 folder name + file name + end code NUL: 1 to
S1 247 characters), folder name (folder name + end code NUL: 1 to 247 characters), or the leading
device storing this information. Specify the extension along with the file name. *1 *2
Specifies the move destination file name ((drive No. +)*7 folder name + file name + end code NUL: 1
S2 to 247 characters), folder name (folder name + end code NUL: 1 to 247 characters), or the leading
device storing this information. Specify the extension along with the file name. *1 *2
S3 Specifies the parameters related to the file move format, or the device storing that information. *2 *3 *4
D Specifies the notification bit device. *3 *5
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 For bit devices, specify the leading device of the channel.
*3 If a device with indirect specification or index modification is specified, the process will be
executed on the specified device at the rising edge of the execution conditions.
*4 If a bit device is specified for S3
D3 , 16 continuous bits are occupied. If a word device is
specified, one word is occupied.
*5 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 When KV-7500/7300, it designates the drive number with "0: \" (for CPU memory), "1: \" (for
memory card) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
*8 T/C cannot be specified for KV-7500/7300.
*9 CTH and CTC cannot be used with the KV-7000 Series.
Point • This instruction can be used with KV-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 2)
• 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.
Operation Description
MMOV At the rising edge of the execution conditions, 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 in D , and an error notification is written in
[ D1 +1] if the process ends abnormally.
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 to
247 characters (including end code NUL (00H) and folder name).
Storage Command
DM1 C(43H) \ (5CH) DM1 Z(60H) \ (5CH)
<MMOV execution>
When migrating to a different storage (Only KV-7500/7300 can be used)
<MMOV 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
Move process
ON
End notice D
OFF
ON
CR3214
(Storage instruction executing)
OFF
* The creation process is executed regardless of the program. Thus, if an instruction is executed
once in a scan, the create process will continue even if the input conditions are OFF in the next
5 scan.
• If a folder is specified in S1 , all files directly under the S1 folder are copied
Storage Command
Point
directly under the folder specified with S2 .
The sub-folders of the S1 folder are not moved.
• The folder specified in S1 will be deleted from S1 after moving if it does not
contain any sub folders.
• Files with read-only attributes remain read-only even after moving.
• If the folder specified with S2 is not found, the "Can't find file/folder" error will occur.
• In relation to internal processing, the storage requires free space which is more than
the file size. It triggers "Insufficient memory card capacity" error when free space is not
enough.
• If S1 and S2 are exactly the same, the "Same file found" error will occur
regardless of the S3 value.
• If a file is specified in S1 and a folder in S2 , the file specified with S1 is
occupied into the folder specified with S2 .
• If a folder is specified in S1 and a file in S2 , the "File name error" will occur.
bit bit
15 S3 0
Item Description
This device turns OFF when the instruction execution starts, and turns ON
EXTENDED INSTRUCTIONS
Completion when moving is completed.
D
notification The device turns ON whichever way execution ends, successfully or in
error.
Error This device turns OFF when execution ends successfully, and turns ON
D +1
notification when execution ends in error.
5
• The store destination when indirect specifying or index modification is specified to a
notification bit device becomes the store destination at the rising edge of the execution
condition.
Storage Command
• The MMOV instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. For this reason, CR3214 must be used to
perform exclusive control as follows.
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. R500
EXTENDED INSTRUCTIONS
File name:DATA.csv
File name:TEST.csv
Moved file
MEMO
EXTENDED INSTRUCTIONS
5
Storage Command
MREN
card (CPU
memory).
S1 S2 D M R E N S1 S2 D
S1 NUL: 1 to 247 characters), folder name (folder name + end code NUL: 1 to 247 characters), or the
leading device storing this information. Specify the extension along with the file name. *1 *2
Specifies the new file name (file name + end code NUL: 1 to 247 characters), folder name (folder name +
S2 end code NUL: 1 to 247 characters), or the leading device storing this information. To change a file name
including the extension, specify the extension along with the file name. *1 *2
D Specifies the notification bit device. *3 *4
*1 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: The language set in "Project language settings" (KV-7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*2 For bit devices, specify the leading device of the channel.
*3 If a device with indirect specification or index modification is specified, the process will be
executed on the specified device at the rising edge of the execution conditions.
*4 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*5 EM and FM (ZF) cannot be used with the KV Nano Series.
*6 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
Point • This instruction can be used with KV-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 2)
• Use half-width and full-width characters to create distinct file names (capital letters and
lower case letters are not differentiated between).
Operation Description
MREN At the rising edge of the execution conditions, the file name specified with S1 is
changed to the file name specified with .
EXTENDED INSTRUCTIONS
S2
The completion notification is written in D , and an error notification is written in
[ D1 +1] if the process ends abnormally.
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions" (Page 5-157)
Specify the folder name + file name to be renamed and the new file name in the range of
5
Example
1 to 247 characters (including end code NUL (00H) and folder name). Specify the
extension along with the file name.
Storage Command
Item S1 File name to be S2 New file name: DM50
changed: DM0
Folder name: ABC File name: DATA.csv File name: TEST.csv
<MREN execution>
Scan
ON
Execution Condition
OFF
Copy process
ON
End notice D
OFF
ON
CR3214
(Storage instruction
OFF
executing)
* The creation process is executed regardless of the program. Thus, if an instruction is executed
once in a scan, the create process will continue even if the input conditions are OFF in the next
scan.
Item Description
The device turn OFF when the instruction execution starts, and turns ON
EXTENDED INSTRUCTIONS
condition.
• The MREN instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. For this reason, CR3214 must be used to
perform exclusive control as follows.
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
renamed to "TEST.csv". R500 turns 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
LD MR100
MREN AND MR101
DM0 “TEST.csv” MR100
SET R500
Storage Command
Memory Memory card Memory Memory card
Card Card
MFREEK
(CPU
memory)
by
MFREEK
Get storage device Gets the free space on the
MFREEK For other series
free space in
kilobyte units
memory card (CPU memory)
by kilobyte unit.
MFREE
EXTENDED INSTRUCTIONS
KV-7500/7300
KV-5500/5000/3000 KV Nano
5 Ladder program
Execution condition MFREEK
Input mode
D1 D2 M F R E E K D1 D2
Storage Command
D2 ○ − ○ − − − ○ ○ ○*4 − − − − − ○ − − ○ ○ ○
Operand Explanation
n(-*5) It designates storage which confirms the amount of free space. (0: memory card, 1: CPU memory)
D1 Specifies the leading device to store the free space to.*1 *3
D2 Specifies the notification bit device.*2 *3
*1 When a bit device has been specified, 32 continuous bits from the start of the channel are
handled.
*2 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
*3 When a device to which indirect specifying or index modification has been specified, data is
written to the specified device at the rising edge of the execution condition.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 There is no operand that specifies which drive to check for CPU units other than the KV-7000
Series.
*6 T/C cannot be used when using the KV-7000 Series.
Point • This instruction can be used with KV-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 2)
• Use half-width and full-width characters to create distinct file names (capital letters and
lower case letters are not differentiated between).
Operation Description
MFREEK Free space on the storage device is stored in kilobyte units to the device specified by
" D1 / D1 +1" at the rising edge of the execution condition.
EXTENDED INSTRUCTIONS
Also, 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
Scan
ON
Execution Condition
MFREEK
OFF
Storage Command
Capture process
ON
End notice D2
OFF
Item Description
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. For this reason, CR3214 must be used to
perform exclusive control as follows.
RXXXXX CR3214 MFREEK
D1 D2
Operation flag
5 KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
Storage Command
Sample Program
When the internal relay MR000 turns ON, the free space in the memory card is stored in DM0, DM1.
R500 turns 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
Memory 32-bit BIN data
Card
MEMO
EXTENDED INSTRUCTIONS
5
Storage Command
5 Operand Explanation
Specifies the file name ((drive No. +)*7 folder name + file name + end code NUL: 1 to 247 characters) for which the status
Storage Command
S
is to be retrieved, or the leading device storing the file name. Specify the extension along with the file name. *1*2
D1 Specifies the leading device storing the retrieval results. *3
D2 Specifies the notification bit device. *4 *5
*1 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: Shift JIS code (2-byte)
*2 For bit devices, specify the leading device of the channel.
*3 If a bit device is specified, 160 continuous bits will be occupied. If a word device is specified, 10
continuous words will be occupied.
*4 If a device with indirect specification or index modification is specified, the process will be
executed on the specified device at the rising edge of the execution conditions.
*5 When a bit device has been specified, 3 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of three continuous words is used as the notification
bit device. Bits other than the lowermost bit do not change.
*6 EM and FM (ZF) cannot be used with the KV Nano Series.
*7 When KV-7500/7300, it designates the drive number with "0: \" (for memory card), "1: \" (for CPU
memory) in the beginning. If it does not designate, it will operate the targeted storage as a
memory card.
Point • This instruction can be used with KV-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 2)
• Use half-width and full-width characters to create distinct file names (capital letters and
lower case letters are not differentiated between).
Operation Description
MSTAT At the rising edge of the execution conditions, 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 in D2 , and an error notification is written in
[ D2 +1] if the process ends abnormally.
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions"
EXTENDED INSTRUCTIONS
File attribute
D1 +1 (Reserved) 5
D1 +2
File size
Storage Command
D1 +3
D1 +4 Time of final change: Year (0 to 99)
D1 +5 Time of final change: Month (1 to 12)
D1 +6 Time of final change: Date (1 to 31)
D1 +7 Time of final change: Hour (0 to 23)
D1 +8 Time of final change: Minute (0 to 59)
D1 +9 Time of final change: Second (0 to 59)
Notification bit device ( D2 : Completion notification, D2 +1: Error notification, D2 +2: Presence)
Item Description
This device turns OFF when execution of the instruction starts, and turns
Completion ON when creation of the folder is completed.
D2
notification The device 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.
This device turns ON when the file or folder is present, and turns OFF when
D2 +2 Presence
absent.
Operation flag
5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
Storage Command
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. R500 turns ON if an error occurs.
(Mnemonics list)
MR000 SMOV LDP MR000
"ABC\DATA.csv" DM0 SMOV "ABC\DATA.csv" DM0
MSTAT DM0 DM100 MR000
LD MR100
MSTAT AND MR101
DM0 DM100 MR000
SET R500
MEMO
EXTENDED INSTRUCTIONS
5
Storage Command
AWNUM
AWNUM
Display user message 1 in
AWNUM Display user message 1
access window.
Operand Explanation
Specify the value displayed as user message 1 in access window, or save the leading device of
5
S
this value. *1
*1 When a bit device has been specified to S , 16 continuous bits are occupied.
Instructions
Access Window
When a relay other than the leading relay (e.g. MR002 or R1012) of the channel has been
specified, the relay is handled in 16 bits straddling the next channel. When a word device has
been specified, one word is occupied.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
Operation Description
AWNUM When execution condition turned from OFF to ON, access window displays the specified
device value in S as user message 1.
When execution condition turned from ON to OFF, cancel the display of user message 1.
Reference For more details of user message 1 display, please 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 decline edge of
execution condition, CR2900 is reset. When execution condition is ON, the value
specified in S is always copied to CM1720, and the result is rapidly reflected to
access window.
• When execution condition is ON, if S is changed, the display content of user
message 1 is also changed.
• If operating access window, message display will be canceled even if execution
condition is ON (CR2900 is reset at this time). In such case, change execution
condition from OFF to ON in order to re-display user message 1.
• When both user message 1 and user message 2 are ON, user message 1 is displayed
on a priority.
• When multiple AWNUM commands exist in a project, the stat of access window is
based on the last AWNUM command 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.
5-224 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Access Window Instructions
Operation flag
EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when the indirect specification and index modify range is inappropriate. Otherwise, OFF
CR2012
Does not change when indirect specification or index modify is not specified to the operand.
Sample Program 5
Instructions
Access Window
When relay R1000 is ON, value 10 will be displayed in access window.
AWMSG
Display user message 2 in
AWMSG Display user message 2
access window.
Operand Explanation
Specify character string data displayed as user message 2 in access window, or save the device of
5
S
this data.*1 *2
*1 When a bit device has been specified in S , specify the leading device of the channel.
Instructions
Access Window
*2 When ASCII character strings are specified using constants, please use " ". The characters "#" and "$"
cannot be used.
In addition, please input with less than DBC case 24 characters.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
Operation Description
AWMSG When execution condition turned from OFF to ON, access window displays the specified
device value in S displayed as use message 2.
When execution condition turned from ON to OFF, cancel the display of user message 2.
Reference For more details of user message 1 display, please 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 execution condition is ON, the character string for
specifing device as starting memory in S is always copied to CM1721 to CM1737,
and the result is reflected rapidly to access window.
• When execution condition is ON, S If the text string currently stored starting from
the device specified by S is changed when display switching is ON, the display content
of user message 2 is also changed.
• If operating access window, message display will be canceled even if execution
condition is ON (CR2901 is reset at this time). In such case, change execution
condition from OFF to ON in order to re-display user message.
• When both user message 1 and user message 2 are ON, user message 1 is displayed
on a priority.
• When multiple AWMSG commands exist in a project, the stat of access window is
based on the last AWMSG command executed.
• Starts only from the character string specifying device as starting memory in S , to
24 DBC case characters (ASCII Code).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, and OFF in other cases.
• When the device range specified with S is inappropriate
• When a device other than the leading device of the channel is specified when a bit device is
CR2012
specified to S
• When a timer/counter has been specified by indirect specification to S
• When the indirect specification and index modify range is inappropriate
Instructions
Access Window
"CR/CM List" (Page A-71)
Sample Program
When relay R1000 is ON, "Emergency Stop!!" will be displayed in access window.
MSTAT
Operand Explanation
S Specifies the ID of the user message to hide. (1 to 63)*1
5 *1 When a bit device has been specified, 16 continuous bits are occupied. When a word device has
been specified, one word is occupied.
Instructions
Access Window
Operation Description
AWSHOW The user message with the ID specified in S is displayed in the access window at
the rising edge of the execution conditions.
To turn the user message OFF, operate the access window, execute the AWHIDE
instruction, or reset the applicable CR.
Reference For more details about user message display, refer to "User Messages" in the KV-7000
Series User's Manual.
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 command and AWHIDE command is executed simultaneously,
priority will be given to the command term 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
This flag is ON in the following instances. Otherwise, it is OFF.
CR2012 • When the indirect specification or index modify range is inappropriate
• When the S value is outside of the range of 1 to 63
Sample Program
When relay R000 turns ON, the ID1 user message is displayed in the access window.
5
Instructions
Access Window
(Mnemonics list)
R000 AWSHOW
#1 LD R000
AWSHOW #1
MSTAT r
mes
sag
Operand Explanation
S Specifies the ID of the user message to hide. (1 to 63)*1
5 *1 When a bit device has been specified, 16 continuous bits are occupied. When a word device has
been specified, one word is occupied.
Instructions
Access Window
Operation Description
AWHIDE The user message with the ID specified in S stops being displayed at the rising
edge of the execution conditions.
Reference For more details about user message display, refer to "User Messages" in the
KV-7000 Series User's Manual.
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 command and AWHIDE command is executed simultaneously,
priority will be given to the command term 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
Instructions
Access Window
R F S F R C
Operand Explanation
5 - -
Operation Description
counter instruction
Free operation
RFSFRC Free Run counter is updated to the newest value when execution condition is ON.
The Free Run counter devices that are updated are as follows:
KV-7500/7300 CM1030 to CM1031: 1 ms counter
CM1032 to CM1033: 10 μs counter
CM1034 to CM1035: 1 μs counter
CM1036 to CM1037: 0.1 μs counter
KV-5500/5000/3000 and KV Nano CM708 to CM709: 1 ms counter
Operation flag
Sample Program
When using KV-5500, use the latest value of the free operation counter, and change the state of output
relay R30000 and R30001.
(Mnemonics list)
CR2002 RFSFRC
LD CR2002
Always ON RFSFRC
LD<.L CM708 +10000
CM708 DR30000 OUT DR30000
< .L LD>=.L CM708 +10000
+10000 Output 0 AND<.L CM708 +20000
OUT DR30001
CM708 CM708 DR30001
>= .L < .L
+10000 +20000 Output 1
FREE RUN counter FREE RUN counter
MEMO
EXTENDED INSTRUCTIONS
5
counter instruction
Free operation
n4 D
n4 D
5 n3
n4
-
-
-
-
-
-
-
-
*4 *5 *5
*4 *5 *5
-
-
- - - - *4
Instruction
Sensor Setting
D - - - - - - -
Operand Explanation
n1 Specifies the unit number (0 to 48, "0" when specifying KV-7500, KV-5500 unit). $ cannot be used.
n2 Specifies the node address (1 to 256) or the device storing that information.*1
Specifies the slot No. or the device storing that information. Specify 0 when using devices other than
n3
a slot device, or when specifying a communication adaptor. *1
n4 Specifies the parameter number, or the device storing that information.*1
D Specifies the number of the leading device storing the results.*2*3
*1 When a bit device is specified, 16 continuous bits are handled. When a channel other than the
leading channel (MR002, R1012, etc.) is specified, the 16 bits are handled crossing to the next
channel.
*2 When a bit device has been specified, specify the leading device of the channel.
*3 The number of stored words (four words or more) changes according to the execution results.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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
that have CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Operation Description
SPRD At the rising edge of execution, the parameters specified with n4 for the node
address n2 and slot number n3 sensors connected to the n1 unit are read
out. When completed, the completion bit is set 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
starts, and turns ON when reading of the parameter is
Completion
Bit 0 completed.
bit
This device turns ON regardless of whether the instruction
ends normally or abnormally.
D If execution of the instruction fails, this device turns ON
Execution simultaneously with the completion bit.
Bit 1
failed bit This device turns OFF when execution of the instruction
starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
D +1 Completion code
The completion code is stored when reading of the
parameters is completed. (Normally 0)
5
A detailed code is stored when reading of the parameters is
Instruction
Sensor Setting
D +2 Detailed completion code
completed.
The number of array elements in the read parameter is stored.
D +3 Number of array elements 1 is stored if the parameter is not an array, and 0 is stored if
the instruction ends abnormally.
The parameter value is stored. The number of data items
D +4~ Read results
occupied differs according to the read parameter.
Point The execution will fail if an "Ethernet/IP device reserved" sensor is specified.
ON
Execution condition
OFF
ON
Failed bit
(specified with instructions) OFF
ON
Completion bit
OFF
(specified with instructions)
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 result storage destination device collection bit and failed bit 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 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
Instruction
Sensor Setting
MOV MOV DM1 EM0
DM0.0 DM0.1 MPP
DM3 DM100 RES MR000
Completion bit Execution failed bit
Array
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
D - - - - *4 - - - - - - -
Operand Explanation
n1 Specifies the unit number (0 to 48, "0" when specifying KV-7500, KV-5500 unit). $ cannot be used.
n2 Specifies the node address (1 to 256) or the device storing that information.*1
Specifies the slot No. or the device storing that information. Specify 0 when using devices other than
n3
a slot device, or when specifying a communication adaptor. *1
n4 Specifies the parameter number, or the device storing that information.*1
D Specifies the number of the leading device storing the results.*2*3
*1 When a bit device is specified, 16 continuous bits are handled. When a channel other than the
leading channel (MR002, R1012, etc.) is specified, the 16 bits are handled crossing to the next
channel.
*2 When a bit device has been specified, specify the leading device of the channel.
*3 The number of words used (4 words or more) changes according to the specified parameter.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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
that have CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Operation Description
SPWR At the rising edge of execution, the set values specified with D +4 onward are written
into the parameter specified with n4 of the node address n2 and slot No. n3
sensors connected to the n1 unit. When writing is completed, the completion bit is
set 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
Completion starts, and turns ON when reading of the parameter is
Bit 0
bit completed. This device turns ON regardless of whether the
instruction ends normally or abnormally.
If execution of the instruction fails, this device turns ON
D
Execution simultaneously with the completion bit.
Bit 1
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. (0 when normal)
The detailed completion code when parameter writing is
5
D +2 Detailed completion code
Instruction
Sensor Setting
completed is stored.
D +3 Reserved for system 0 (fixed value)
The setting value is stored. The number of data items
D +4~ Setting value
occupied differs according to the written parameter.
Point The execution will fail if an "Ethernet/IP device reserved" sensor (adaptor) is specified.
ON
Execution condition
OFF
ON
Failed bit
(specified with instructions) OFF
ON
Completion bit
OFF
(specified with instructions)
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 result storage destination device collection bit and failed bit 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
Instruction
Sensor Setting
MOV DM1 EM0
MPP
#833 DM0 RES MR000
Results storage
device
DM0.0 DM0.1 R500
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
5 n3
n4
-
-
-
-
-
-
-
-
*4 *5 *5
*4 *5 *5
-
-
*4
Instruction
Sensor Setting
D - - - - - - - - - - -
Operand Explanation
n1 Specifies the unit number (0 to 48, "0" when specifying KV-7500, KV-5500 unit). $ cannot be used.
n2 Specifies the node address (1 to 256) or the device storing that information.*1
Specifies the slot No. or the device storing that information. Specify 0 when using devices other than
n3
a slot device, or when specifying a communication adaptor. *1
n4 Specifies the parameter number, or the device storing that information.*1
D Specifies the number of the leading device storing the results.*2*3
*1 When a bit device is specified, 16 continuous bits are handled. When a channel other than the
leading channel (MR002, R1012, etc.) is specified, the 16 bits are handled crossing to the next
channel.
*2 When a bit device has been specified, specify the leading device of the channel.
*3 Up to six words are used depending on the specified service.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
*5 CTH and CTC cannot be used with the KV-7000 Series.
Point This instruction can be used with KV-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
that have CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Operation Description
SSVC At the rising edge of execution, the service specified with n4 of the node address
n2 , slot No. n3 sensor connected to the n1 unit is executed. When execution
is completed, the completion bit is set 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
starts, and turns ON when execution of the service is
Completion
Bit 0 completed.
bit
This device turns ON regardless of whether the instruction
ends normally or abnormally.
D If execution of the instruction fails, this device turns ON
Execution simultaneously with the completion bit.
Bit 1
failed bit This device turns OFF when execution of the instruction
starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
D +1 Completion code
The completion code is stored when execution of the service
is completed. (0 when normal)
5
Instruction
Sensor Setting
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)
D +4 Specifies the send data (maximum two words) according to
Send data
D +5 the service being executed.
Point The execution will fail if an "Ethernet/IP device reserved" sensor is specified.
ON
Execution condition
OFF
ON
Failed bit
(specified with instructions) OFF
ON
Completion bit
OFF
(specified with instructions)
The sensor service execution instruction is executed at the rising edge of the execution conditions.
The process continue seven if the input conditions are OFF at the net scan.
The number of sensor setting instruction executions is incremented by one when the instruction is
executed, and is decremented when execution is completed.
The result storage destination device collection bit and failed bit 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
Instruction
Sensor Setting
MPP
DM0.0 DM0.1 R500 RES MR000
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
RFSCI(.U)
RFSCI.S
RFSCI RFSCI.D
RFSCI.L
RFSCI
RFSCI
@RFSCI.D
@RFSCI.L
@RFSCI.F
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
D - - - - - *4 - - - - - - - - - - -
n - - - - - - - - - - - - - - - - - - -
Operand Explanation
D Specifies the leading device number for refreshing the cyclic communication input data. *1 *2 *3
n Specifies the number of data items to refresh.
Point This instruction can be used with KV-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
that have CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Operation Description
RFSCI(.U) When the execution conditions turn ON, the cyclic communication input data from the
unsigned 16-bit BIN data assigned to the device specified with D to the number of
data items specified with n is refreshed.
RFSCI.S When the execution conditions turn ON, the cyclic communication input data from the
signed 16-bit BIN data assigned to the device specified with D to the number of
data items specified with n is refreshed.
EXTENDED INSTRUCTIONS
CPU unit KV-EP21V
assignment device 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 conditions turn ON, the cyclic communication input data from the
unsigned 32-bit BIN data assigned to the device specified with [
number of data items specified with n is refreshed.
D · D +1] to the
5
munication Instruction
Refresh Cyclic Com-
RFSCI.L When the execution conditions turn ON, the cyclic communication input data from the
signed 32-bit BIN data assigned to the device specified with [ D · D +1] to the
number of data items specified with n is refreshed.
Refresh data in
specified range.
RFSCI.F When the execution conditions turn ON, the cyclic communication input data from the
single precision floating point type real number assigned to the device specified with
[ D · D +1] to the number of data items specified with n is refreshed.
Area 1 Connection 1
Range specified with
refresh instruction code
5 Area 2 Connection 2
munication Instruction
Refresh Cyclic Com-
• If there is a device which has not been assigned to the cyclic communication data is
found in the range specified with the operand, only the device assigned to the
connection will be refreshed.
CPU unit KV-EP21V
device Cyclic communication data
Area 1 Connection 1
Area 2 Connection 2
• Confirm that the communication status of the specified connection is normal before
executing the refresh instruction.
@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
Normal node 1 RFSCI DM100 #10
MEMO
EXTENDED INSTRUCTIONS
5
munication Instruction
Refresh Cyclic Com-
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
Operand Explanation
D Specifies the leading device number for refreshing the cyclic communication input data. *1 *2 *3
n Specifies the number of data items to refresh.
*1 Only R and B can be used when specifying a bit device.
*2 Specify the channel’s leading device when specifying a bit device.
*3 Only DM and W can be used when specifying a word device.
*4 EM and FM (ZF) cannot be used with the KV Nano Series.
Point This instruction can be used with KV-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
that have CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Operation Description
RFSCO(.U) When the execution conditions turn ON, the cyclic communication output data from the
unsigned 16-bit BIN data assigned to the device specified with D to the number of
data items specified with n is refreshed.
RFSCO.S When the execution conditions turn ON, the cyclic communication output data from the
signed 16-bit BIN data assigned to the device specified with D to the number of
data items specified with n is refreshed.
EXTENDED INSTRUCTIONS
CPU unit KV-EP21V
assignment device 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 conditions turn ON, the cyclic communication output data from the
unsigned 32-bit BIN data assigned to the device specified with [
number of data items specified with n is refreshed.
D · D +1] to the
5
munication Instruction
Refresh Cyclic Com-
RFSCO.L When the execution conditions turn ON, the cyclic communication output data from the
signed 32-bit BIN data assigned to the device specified with [ D · D +1] to the
number of data items specified with n is refreshed.
32-bit refresh
CPU unit KV-EP21V
assignment device Cyclic communication data
Refresh data in
specified range.
RFSCO.F When the execution conditions turn ON, the cyclic communication output data from the
single precision floating point type real number assigned to the device specified with
[ D · D +1] to the number of data items specified with n is refreshed.
Area 1 Connection 1
Range specified with
refresh instruction code
5 Area 2 Connection 2
munication Instruction
Refresh Cyclic Com-
• If there is a device which has not been assigned to the cyclic communication data is
found in the range specified with the operand, only the device assigned to the
connection will be refreshed.
CPU unit KV-EP21V
device Cyclic communication data
Area 1 Connection 1
Area 2 Connection 2
• Confirm that the communication status of the specified connection is normal before
executing the refresh instruction.
@RFSCO. 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)
RFSCO
DM10260.0
DM100 #10 LD DM10260.0
Normal node 1 RFSCO DM100 #10
APPENDICES
This chapter describes error code table, instruction execution time,
differences between KV-700 Series and KV 1000 Series PLC, character code
table (ASCII), control relay/control memory table and instruction index, etc.
4-38
APPENDICES
SUB.U
16-bit 16-bit
SUB.S internal register - S = internal register
4-42
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-64
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-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
Processing time (µs)
Condition
KV-7500/7300 KV-5500/5000/3000/1000 KV Nano Series
In the event of absence of
0.003 0.020 0.500
operation error
In the event of occurrence of
2.948 13.800 10.000
operation error
Processing time does not increase when "Calculation error " is " Continue (ignore)" and "Do not keep in error
log" is configured. In these cases, CR2012 operates according to the specification for each instruction.
"KV-Studio Ver.7 User's Manual "CPU system setting""
■ Direct I/O
KV-7500/7300/5500/5000/3000, KV Nano Series For direct I/O, the standards of added processing time are
shown below.
Condition KV-7500/7300 (μs) KV-5500/5000/3000 (μs) KV Nano Series (μs)
APPENDICES
Basic Instructions
APPENDICES
.DF S1 =DM, S2 = Constant 0.08047 0.730 – 3.900
AND< .U.S.D.L S1 =DM, S2 = Constant 0.01437 0.150 0.325 0.250
.F S1 =DM, S2 = Constant 0.06322 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.08047 0.980 – 3.900
AND> .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.150 0.325 0.250
.F S1 =DM, S2 = Constant 0.06322 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.08047 0.980 – 3.800
APPENDICES
INV – 0.00288 0.010 – 0.020
MEP – 0.00575 0.020 – 0.860
MEF – 0.00863 0.040 – 0.970
RFSX – n = #16 0.87423 *1 5.800 – 3.800
Execution condition is OFF 0.01150 0.030 – 0.360
RFSY – n =#16 0.87413*1 5.600 – 3.200
Execution condition is OFF 0.01150 0.030 – 0.350
Applied Instructions
APPENDICES
Execution condition is OFF 0.02011 0.070 0.225 0.100
ADRADD .S Execution condition is ON 0.03965 0.100 0.350 1.900
Execution condition is OFF 0.03448 0.100 0.300 0.240
.L Execution condition is ON 0.03965 0.120 – 1.800
Execution condition is OFF 0.03448 0.120 – 0.100
ADRSUB .S Execution condition is ON 0.04253 0.120 0.375 1.900
Execution condition is OFF 0.03735 0.120 0.350 0.240
*2 The processing time when an expansion unit for KV-5000/3000 series is used is as follows.
UREAD command For 1 word: 4.66425, For 1000 word: 285.780
UWRIT command For 1 word: 5.03217, For 1000 word: 353.823
UFILL command For 1 word: 4.97105, For 1000 word: 348.964
APPENDICES
.D Execution condition is ON 0.03161 0.160 – 1.600
Execution condition is OFF 0.03161 0.110 – 0.250
PSTA .U Execution condition is ON 0.03736 0.180 – 1.700
Execution condition is OFF 0.03736 0.130 – 0.250
.D Execution condition is ON 0.04024 0.190 – 2.000
Execution condition is OFF 0.04024 0.140 – 0.250
TMIN – Execution condition is ON 0.02299 0.130 0.250 −
APPENDICES
S = Constant, Execution 0.05461 0.060 – 0.390
condition is OFF
MUL .U.S S = Constant 0.01437 0.040 0.100 0.140
S = Constant, Execution 0.01437 0.040 0.100 0.170
condition is OFF
.D.L S = Constant 0.02874 0.110 0.275 0.170
S = Constant, Execution 0.02874 0.100 0.250 0.190
APPENDICES
SRA .U.D Execution condition is ON 0.00575 0.020 0.050 1.400
Execution condition is OFF 0.00575 0.020 0.050 0.370
SLA .U.D Execution condition is ON 0.00575 0.020 0.050 1.400
Execution condition is OFF 0.00575 0.020 0.050 0.370
ASRA .U.D Execution condition is ON 0.00575 0.020 – 1.300
Execution condition is OFF 0.00575 0.020 – 0.300
.S Execution condition is ON 0.060 –
APPENDICES
Execution condition is OFF 0.08334 0.290 0.725 1.200
TBIN .U Execution condition is ON 0.01150 0.040 0.100 3.700
Execution condition is OFF 0.01150 0.040 0.100 1.200
.D Execution condition is ON 0.02299 0.080 0.200 4.200
Execution condition is OFF 0.02299 0.080 0.200 1.200
MPX – Execution condition is ON 0.01725 0.060 0.150 0.940
Execution condition is OFF 0.01725 0.060 0.150 0.920
APPENDICES
3.800
Execution condition is OFF 0.00617 0.020 – 0.150
FTODF – Execution condition is ON 0.09799 0.680 – 3.900
Execution condition is OFF 0.00575 0.020 – 0.150
DISF – Execution condition is ON 0.94254 0.850 1.500 17.500
Execution condition is OFF 0.01150 0.040 0.125 0.310
UNIF – Execution condition is ON 0.41380 1.320 2.850 41.700
12.600
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 2.29155 10.900 – 12.700
Execution condition is OFF 0.00617 0.040 – 0.150
ACOS .F Execution condition is ON 0.91983 5.700 13.600 16.600
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 2.31926 10.900 – 16.400
Operation Processing Time Table
APPENDICES
7.400
n =#4, Execution condition is OFF 0.02012 0.070 0.200 0.260
.D n =#8 0.87071 3.980 7.875 8.100
n =#8, Execution condition is OFF 0.02012 0.070 0.200 0.260
RHASC .U Execution condition is ON 0.49715 2.630 5.125 11.300
Execution condition is OFF 0.01437 0.050 0.125 0.260
.D Execution condition is ON 0.91669 4.470 8.850 12.300
APPENDICES
S1 =DM, S2 = Constant, 0.01725 0.050 – 0.300
Execution condition is OFF
.D.L S1 =DM, S2 = Constant 0.04024 0.190 – 1.200
S1 =DM, S2 = Constant, 0.03161 0.120 – 0.300
Execution condition is OFF
.F S1 =DM, S2 = Constant 0.05748 0.240 – 2.300
S1 =DM, S2 = Constant, 0.05460 0.180 – 0.260
Execution condition is OFF
Extended Instructions
APPENDICES
n =#1000, all consistent 30.4770 166.100 – 141.200
Execution condition is OFF 0.01437 0.070 – 0.260
.D n =#1 0.29599 1.150 – 16.300
n =#1000, all consistent 31.8930 141.070 – 148.300
Execution condition is OFF 0.01437 0.070 – 0.260
MAX .U.S n =#1 0.10058 0.630 1.125 7.300
APPENDICES
Execution condition is OFF 0.01438 0.070 0.175 0.360
.D.L n =#1 0.14943 0.730 1.400 24.200
n =#1000 69.0538 180.550 575.825 804.100
Execution condition is OFF 0.01438 0.070 0.175 0.360
RND – Execution condition is ON 0.12127 0.660 – 1.800
Execution condition is OFF 0.01150 0.040 – 0.250
SORT .U.S n =#2 (sorts descending 0.41381 2.510 – 10.300
APPENDICES
Execution condition is OFF 0.01150 0.040 0.050 0.130
HSP – Execution condition is ON - 0.430 0.075 2.200
Execution condition is OFF - 0.430 0.175 2.200
DI – Execution condition is ON 0.05460 0.010 0.025 1.300
Execution condition is OFF 0.00575 0.010 0.025 0.130
EI – Execution condition is ON 0.07759 0.440 0.700 1.900
Execution condition is OFF 0.00575 0.020 0.050 0.130
APPENDICES
When automatic tuning is completed 3.08167 11.430 – 48.600
Execution condition is OFF 0.77659 2.990 – 16.400
MWRIT – Execution condition is OFF 0.42530 1.610 3.450 15.160
At the rising edge of execution condition 2.81250 4.190 10.550 39.060
MREAD – Execution condition is OFF 0.42530 1.610 3.450 15.170
At the rising edge of execution condition 2.78750 4.020 9.725 39.100
MFREE – Execution condition is OFF 0.21553 0.950 1.850 8.350
MEMO
APPENDICES
Operation Processing Time Table
The calculation methods of byte size of various instructions are described. The matching items are
added with the basic byte size in the "List".
Point The basic byte size of instruction size table and the following calculation methods
are only objects, the byte size may be inconsistent with that calculated by the
following calculation methods according to the instruction.
■ Suffix
When the suffix other than .U is added after instruction, basic byte size + 1.
■ Operand
The basic byte size indicates the byte size when device is specified in entire operands (specify constant
when only constant can be specified). When constant, character string constant, index modification
(constant), index modification (index register) and indirect specifying are specified in operand, the
following value is added into every operation.
KV-5500/ KV Nano
Type KV-7500/7300 KV-1000
5000/3000 Series
Constant (.U) +0 +0 +0 +0
Constant (.S) +0 +0 +0 +0
Constant (.D) +2 +2 +2 +2
Constant (.L) +2 +2 +2 +2
Constant (.F) +2 +2 +2 +2
Constant (.DF) +6 +6 - +6
+ (1 + 2* character string length + (1 + character string length (incl.
Character string constant
(incl. terminal code NULL)) terminal code NULL))
Index modification (constant) +5 +5 +3 +5
Index modification (index register) +1 +1 +1 +1
Indirect specifying +0 +0 +0 +0
■ Macro instructions
For every operand, the following byte size is added into basic byte size of MCALL/MSTRT.
KV-5500/5000/ KV Nano
Type KV-7500/7300 KV-1000
3000 Series
Constant +5 +5 +5 +5
Device +3 +3 +3 +3
Device + Index modification
+8 +8 +6 +8
(constant)
Device + Index modification
APPENDICES
+4 +4 +4 +4
(index register)
Indirect specifying +3 +3 +3 +3
Destination size may vary due to the configuration site of suffix of instruction and the device and
■ Suffix
• The following relationship is basically established.
.U ≒ .S ≤ .D ≒ .L ≤ .F ≤ .DF
■ Operand
• The following relationship is basically established.
Constant (.U/.S) ≒ device direct addressing ≤ constant (.D/.L/.F) ≤ constant (.DF) ≤ indirect specifying ≤
device direct addressing (or indirect specifying)+index modification
• When specifying character string constant, the character string is filled as object; the longer the
character string, the bigger the Destination size will become (For the KV-5500/5000/3000/1000).
The operand table size varies by the instruction suffix and the devices specified as the operands. (For
the KV Nano Series only)
When specifying a character string constant, the character string is filled in the operand table, so the
longer the character string, the larger the size of the operand table.
■ Suffix
• The following relationship is basically established.
.U ≒ .S ≒ .D ≒ .L ≒ .F ≦ .DF
■ Operand
• The following relationship is basically established.
Constant (.U/.S/.D/.L/.F) ≒ device direct addressing ≒ indirect specifying . constant (.DF) .i device
direct addressing (or indirect specifying) + index modification
• When specifying a character string constant, the character string is filled in the operand table, so the
longer the character string, the larger the size of the operand table.
The following execution time will vary sometimes depending upon the specifications of operand and the
operating state (e.g. execution condition).
■ KV-7500/7300
Basic byte Object size Internal working capacity
Command
size MIN MAX Word Bit
LD 4 4 64 0 0
LDB 4 4 64 0 0
APPENDICES
AND 4 4 64 0 0
ANB 4 4 64 0 0
OR 4 4 64 0 0
ORB 4 4 64 0 0
LDP 4 12 76 0 1
LDF 4 12 76 0 1
ANP 4 16 80 0 1
Instruction Size Table
ANF 4 16 80 0 1
ORP 4 16 80 0 1
ORF 4 16 80 0 1
LDPB 5 16 80 0 1
ANPB 5 20 84 0 1
ORPB 5 20 84 0 1
LDFB 5 16 80 0 1
ANFB 5 20 84 0 1
ORFB 5 20 84 0 1
BLD 7 28 68 0 0
BLDB 7 28 72 0 0
BAND 7 28 72 0 0
BANB 7 28 76 0 0
BOR 7 28 68 0 0
BORB 7 28 72 0 0
LD= 7 28 64 0 0
LD< 7 28 64 0 0
LD> 7 28 64 0 0
LD<= 7 28 64 0 0
LD>= 7 28 64 0 0
LD<> 7 28 64 0 0
AND= 7 32 68 0 0
AND< 7 32 68 0 0
AND> 7 32 68 0 0
AND<= 7 32 68 0 0
AND>= 7 32 68 0 0
AND<> 7 32 68 0 0
OR= 7 32 64 0 0
OR< 7 32 64 0 0
APPENDICES
DIFU 4 28 64 0 1
DIFD 4 40 72 0 1
ONDL 7 36 48 4 1
OFDL 7 36 48 4 1
SHOT 7 40 68 4 2
FLIK 10 44 88 4 1
ALT 4 24 32 0 1
MCR 1 4 4 0 0
CALL 3 32 32 0 0
ECALL 11 44 60 0 0
SBN 3 0 0 0 0
RET 1 16 16 0 0
1
FOR* 4 44 52 0 0
1
NEXT* 1 60 60 0 0
Instruction Size Table
BREAK 1 32 32 0 0
CJ 5 52 52 0 0
NCJ 5 52 52 0 0
GOTO 5 52 52 0 0
LABEL 5 0 0 0 0
SCJ 5 76 76 0 1
MCALL 19 56 1184 0 0
MSTRT 19 56 1184 0 0
MEND 2 16 16 0 0
FB 30 60 9988 0 0
FEND 2 16 16 0 0
FUN 26 60 10844 0 0
MDSTRT 8 16 16 0 0
MDSTOP 8 16 16 0 0
ZPUSH 6 16 52 0 0
ZPOP 6 16 52 0 0
ADRSET 8 8 60 0 0
ADRINC 5 28 64 0 0
ADRDEC 5 28 64 0 0
ADRADD 9 48 88 0 0
ADRSUB 9 52 92 0 0
FRSET 5 44 60 0 0
FRSTM 14 36 92 0 1
FRLDM 14 36 92 0 1
UPSTRT 13 52 160 0 2
UPSTOP 10 36 88 0 2
UFSUS 13 44 108 0 2
UFRSM 10 36 88 0 2
APPENDICES
TMIN 4 24 40 0 0
DW 7 8 52 0 0
BMOV 10 16 104 0 0
FMOV 10 20 84 0 0
PMOV 17 52 136 0 0
BYLMOV 17 24 144 0 0
BYBMOV 17 24 144 0 0
MPX 3 24 24 0 0
DMX 1 16 16 0 0
GRY 1 4 4 0 0
RGRY 1 4 4 0 0
DISN 11 28 92 0 0
UNIN 11 28 112 0 0
DISB 11 28 92 0 0
Instruction Size Table
UNIB 11 28 112 0 0
SWAP 1 4 4 0 0
BSWAP 8 12 64 0 0
XCH 7 20 92 0 0
DECO 8 32 60 0 0
ENCO 8 44 72 0 0
ABS 3 28 28 0 0
FLOAT 1 8 8 0 0
DFLOAT 2 20 20 0 0
INTG 1 4 4 0 0
DINTG 2 16 16 0 0
DFTOF 2 8 8 0 0
FTODF 2 8 8 0 0
DISF 10 16 92 0 0
UNIF 10 16 72 0 0
EXP 1 8 8 0 0
LOG 1 8 8 0 0
LOG10 2 8 8 0 0
RAD 1 8 8 0 0
DEG 1 8 8 0 0
SIN 1 8 8 0 0
COS 1 8 8 0 0
TAN 1 8 8 0 0
ASIN 1 8 8 0 0
ACOS 1 8 8 0 0
ATAN 1 8 8 0 0
ATAN2 1 8 8 0 0
ASC 1 8 8 0 0
APPENDICES
SRGHT 11 16 184 0 0
SLEFT 11 16 184 0 0
SMID 14 20 204 0 0
SRPLC 17 24 324 0 0
SINS 14 20 304 0 0
SDEL 14 20 204 0 0
STRIM 11 16 184 0 0
RND 5 16 52 0 0
SORT 11 28 96 0 0
SORTN 14 52 152 4 1
FIFOW 7 20 72 0 0
FIFOR 7 12 84 0 0
LIFOW 8 20 72 0 0
LIFOR 8 20 92 0 0
Instruction Size Table
FWRIT 11 28 92 0 0
FINS 11 24 84 0 0
FDEL 8 16 64 0 0
WTIME 4 8 44 0 0
SEC 7 12 72 0 0
RSEC 7 12 72 0 0
AJST 1 8 8 0 0
LDWK 8 24 60 0 0
LDWKB 8 28 64 0 0
ANDWK 8 28 64 0 0
ANDWKB 8 32 68 0 0
ORWK 8 28 60 0 0
ORWKB 8 32 64 0 0
LDCAL 8 24 60 0 0
LDCALB 8 28 64 0 0
ANDCAL 8 28 64 0 0
ANDCALB 8 32 68 0 0
ORCAL 8 28 60 0 0
ORCALB 8 32 64 0 0
ARES 1 16 16 0 0
DI 1 8 8 0 0
EI 1 8 8 0 0
DIC 5 8 20 0 0
INT 5 232 232 0 0
MCMP 14 20 100 0 0
ABSENC 14 32 132 0 1
PID 8 20 76 0 0
PIDAT 11 28 116 0 1
APPENDICES
MPRINT 11 28 272 0 1
MREADL 14 32 232 0 1
MCOPY 14 32 292 0 1
MMOV 14 32 292 0 1
MREN 11 28 272 0 1
MFREEK 11 32 80 0 1
MSTAT 11 28 192 0 1
■ KV-5500/5000/3000
Basic byte Object size Internal working capacity
Command size MIN MAX Word Bit
LD 4 4 44 0 0
LDB 4 4 44 0 0
AND 4 4 44 0 0
ANB 4 4 44 0 0
OR 4 4 44 0 0
ORB 4 4 44 0 0
LDP 4 12 52 0 1
LDF 4 12 52 0 1
APPENDICES
ANP 4 16 56 0 1
ANF 4 16 56 0 1
ORP 4 16 56 0 1
ORF 4 16 56 0 1
LDPB 5 16 56 0 1
ANPB 5 20 60 0 1
Instruction Size Table
ORPB 5 20 60 0 1
LDFB 5 16 56 0 1
ANFB 5 20 60 0 1
ORFB 5 20 60 0 1
BLD 7 28 68 0 0
BLDB 7 28 72 0 0
BAND 7 28 72 0 0
BANB 7 28 76 0 0
BOR 7 28 72 0 0
BORB 7 28 76 0 0
LD= 7 28 64 0 0
LD< 7 28 64 0 0
LD> 7 28 64 0 0
LD<= 7 28 28 0 0
LD>= 7 28 28 0 0
LD<> 7 28 28 0 0
AND= 7 32 32 0 0
AND< 7 32 32 0 0
AND> 7 32 32 0 0
AND<= 7 32 32 0 0
AND>= 7 32 32 0 0
AND<> 7 32 32 0 0
OR= 7 32 32 0 0
OR< 7 32 32 0 0
OR> 7 32 32 0 0
OR<= 7 32 32 0 0
OR>= 7 32 32 0 0
OR<> 7 32 32 0 0
OUT 4 4 4 0 0
OUB 4 4 4 0 0
A-50 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Instruction Size Table
APPENDICES
ALT 4 24 24 0 1
BOUT 7 28 28 0 0
BOUB 7 48 48 0 0
BSET 7 28 28 0 0
BRES 7 28 28 0 0
TMR 7 64 64 0 0
TMH 7 64 64 0 0
BREAK 1 24 24 0 0
CJ 5 40 40 0 0
NCJ 5 40 40 0 0
GOTO 5 40 40 0 0
LABEL 5 0 0 0 0
SCJ 5 64 64 0 1
MCALL 17 48 304 0 0
Instruction Size Table
MSTRT 17 48 304 0 0
MEND 2 8 8 0 0
MDSTRT 6 8 8 0 0
MDSTOP 6 8 8 0 0
ZPUSH 6 16 32 0 0
ZPOP 6 16 32 0 0
ADRSET 8 8 52 0 0
ADRINC 5 28 56 0 0
ADRDEC 5 28 56 0 0
ADRADD 9 48 80 0 0
ADRSUB 9 52 84 0 0
FRSET 5 36 52 0 0
FRSTM 11 28 72 0 1
FRLDM 11 28 72 0 1
UREAD 14 28 92 0 0
UWRIT 14 28 92 0 0
UFILL 14 40 100 0 0
MOV 7 8 48 0 0
LDA 4 8 24 0 0
STA 4 4 28 0 0
PLDA 8 40 68 0 0
PSTA 8 52 100 0 0
TMIN 4 24 40 0 0
DW 7 8 32 0 0
BMOV 10 24 72 0 0
FMOV 10 28 72 0 0
PMOV 17 52 116 0 0
BYLMOV 17 32 112 0 0
BYBMOV 17 32 112 0 0
A-52 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Instruction Size Table
APPENDICES
ZCMP 7 20 52 0 0
ANDA 4 12 28 0 0
ORA 4 12 28 0 0
EORA 4 12 28 0 0
ENRA 5 16 32 0 0
COM 1 8 8 0 0
NEG 1 4 4 0 0
DINTG 2 8 8 0 0
DFTOF 2 8 8 0 0
FTODF 2 8 8 0 0
DISF 10 16 64 0 0
UNIF 10 16 64 0 0
EXP 1 8 8 0 0
LOG 1 8 8 0 0
Instruction Size Table
LOG10 3 8 8 0 0
RAD 1 8 8 0 0
DEG 1 8 8 0 0
SIN 1 8 8 0 0
COS 1 8 8 0 0
TAN 1 8 8 0 0
ASIN 1 8 8 0 0
ACOS 1 8 8 0 0
ATAN 1 8 8 0 0
ASC 1 8 8 0 0
RASC 1 8 8 0 0
DASC 7 24 56 0 0
RDASC 7 20 52 0 0
HASC 11 32 76 0 0
RHASC 8 20 52 0 0
FASC 11 24 72 0 0
RFASC 8 20 52 0 0
SMOV 7 20 156 0 0
SADD 10 24 280 0 0
APPENDICES
SCMP 7 20 260 0 0
DISS 7 20 156 0 0
UNIS 10 24 72 0 0
LEN 7 20 156 0 0
RCOM 10 44 84 0 1
CAL+ 11 20 84 0 0
CAL- 11 20 84 0 0
FDEL 8 24 52 0 0
WTIME 4 16 32 0 0
SEC 7 20 52 0 0
RSEC 7 20 52 0 0
AJST 1 16 16 0 0
LDWK 8 24 60 0 0
LDWKB 8 28 64 0 0
Instruction Size Table
ANDWK 8 28 64 0 0
ANDWKB 8 32 68 0 0
ORWK 8 28 60 0 0
ORWKB 8 32 64 0 0
LDCAL 8 24 60 0 0
LDCALB 8 28 64 0 0
ANDCAL 8 28 64 0 0
ANDCALB 8 32 68 0 0
ORCAL 8 28 60 0 0
ORCALB 8 32 64 0 0
ARES 1 16 16 0 0
HSP 4 20 20 0 0
DI 1 8 8 0 0
EI 1 8 8 0 0
DIC 5 8 20 0 0
INT 4 8 40 0 0
RETI 1 212 212 0 0
CTH 7 36 36 0 0
CTC 9 0 0 0 0
RFSCTH 4 140 140 0 0
PLSX 3 28 28 0 0
PLSY 3 28 28 0 0
JOGX 1 16 16 0 0
JOGY 1 16 16 0 0
ORGX 1 16 16 0 0
ORGY 1 16 16 0 0
TCHX 1 16 16 0 0
TCHY 1 16 16 0 0
APPENDICES
FCNT 12 28 60 0 0
RCNT 12 28 60 0 0
PLSOUT 10 24 56 0 0
PID 8 20 56 0 0
PIDAT 11 28 76 0 1
LOGE 5 36 52 0 0
LOGD 5 36 52 0 0
■ KV-1000
Basic byte Object size Internal working capacity
Instruction size MIN MAX Word Bit
LD 4 4 24 0 0
LDB 4 4 24 0 0
AND 4 4 24 0 0
ANB 4 4 24 0 0
OR 4 4 24 0 0
ORB 4 4 24 0 0
LDP 4 28 48 0 1
LDF 4 28 48 0 1
ANP 4 32 52 0 1
APPENDICES
ANF 4 32 52 0 1
ORP 4 32 52 0 1
ORF 4 32 52 0 1
BLD 7 12 28 0 0
BLDB 7 12 28 0 0
BAND 7 12 28 0 0
BANB 7 12 28 0 0
Instruction Size Table
BOR 7 12 28 0 0
BORB 7 12 28 0 0
LD= 7 28 88 0 0
LD< 7 28 88 0 0
LD> 7 28 88 0 0
LD<= 7 28 88 0 0
LD>= 7 28 88 0 0
LD<> 7 28 88 0 0
AND= 7 32 92 0 0
AND< 7 32 92 0 0
AND> 7 32 92 0 0
AND<= 7 32 92 0 0
AND>= 7 32 92 0 0
AND<> 7 32 92 0 0
OR= 7 32 92 0 0
OR< 7 32 92 0 0
OR> 7 32 92 0 0
OR<= 7 32 92 0 0
OR>= 7 32 92 0 0
OR<> 7 32 92 0 0
OUT 4 4 32 0 0
OUB 4 4 32 0 0
SET 4 4 32 0 0
RES 4 4 32 0 0
KEEP 4 44 68 0 0
DIFU 4 48 80 0 1
DIFD 4 60 88 0 1
ONDL 7 44 84 2 1
OFDL 7 44 84 2 1
SHOT 7 44 84 2 2
APPENDICES
OUTC 8 36 56 0 0
ITVL 7 32 76 0 0
UDC 7 36 64 0 0
UDT 7 40 68 0 0
END 1 28 - 0 0
ENDH 1 0 0 0 0
CON 1 0 0 0 0
MPS 1 4 4 0 0
LDA 4 8 32 0 0
STA 4 4 36 0 0
TMIN 4 28 52 0 0
MOV 7 8 64 0 0
BMOV 10 24 88 0 0
FMOV 10 24 92 0 0
PMOV 17 44 152 0 0
ADD 4 8 40 0 0
Instruction Size Table
SUB 4 8 40 0 0
MUL 4 12 40 0 0
DIV 4 36 72 0 0
INC 4 24 64 0 0
DEC 4 24 64 0 0
ROOT 1 8 8 0 0
CMP 4 8 40 0 0
ZCMP 7 20 68 0 0
ANDA 4 8 36 0 0
ORA 4 8 36 0 0
EORA 4 8 36 0 0
ENRA 5 12 40 0 0
COM 1 8 8 0 0
NEG 1 4 4 0 0
SRA 4 8 32 0 0
SLA 4 8 32 0 0
RRA 4 16 32 0 0
RLA 4 20 32 0 0
RRNCA 5 16 32 0 0
RLNCA 5 8 32 0 0
WSR 10 24 92 0 0
WSL 10 24 92 0 0
BSR 11 24 88 0 0
BSL 11 24 88 0 0
TBCD 1 4 4 0 0
TBIN 1 4 4 0 0
MPX 3 24 24 0 0
DMX 1 16 16 0 0
GRY 1 4 4 0 0
RGRY 1 4 4 0 0
APPENDICES
DISF 10 20 80 0 0
UNIF 10 24 84 0 0
EXP 1 8 8 0 0
LOG 1 8 8 0 0
RAD 1 8 8 0 0
DEG 1 8 8 0 0
SIN 1 8 8 0 0
COS 1 8 8 0 0
BCMPI 14 28 112 0 0
FIFOW 7 24 64 0 0
FIFOR 7 20 60 0 0
LIFOW 8 24 64 0 0
LIFOR 8 20 60 0 0
FWRIT 11 32 92 0 0
FINS 11 32 92 0 0
FDEL 8 20 64 0 0
Instruction Size Table
WTIME 4 16 36 0 0
SEC 7 20 60 0 0
RSEC 7 24 64 0 0
AJST 1 12 12 0 0
LDWK 8 40 92 0 0
LDWKB 8 44 96 0 0
ANDWK 8 44 96 0 0
ANDWKB 8 48 100 0 0
ORWK 8 44 92 0 0
ORWKB 8 48 96 0 0
LDCAL 8 40 92 0 0
LDCALB 8 44 96 0 0
ANDCAL 8 44 96 0 0
ANDCALB 8 48 100 0 0
ORCAL 8 44 92 0 0
ORCALB 8 48 96 0 0
ARES 1 8 8 0 0
HSP 4 28 28 0 0
DI 1 4 4 0 0
EI 1 8 8 0 0
DIC 5 8 28 0 0
INT 4 12 52 0 0
RETI 1 28 28 0 0
CTH 6 44 44 0 0
CTC 8 0 0 0 0
PLSX 4 24 48 0 0
PLSY 4 24 48 0 0
JOGX 1 16 16 0 0
JOGY 1 16 16 0 0
ORGX 1 16 16 0 0
APPENDICES
FCNT 10 36 80 0 1
RCNT 10 36 76 0 1
PLSOUT 8 36 76 0 0
PID 8 28 64 0 0
LOGE 5 20 56 0 0
LOGD 5 20 56 0 0
MWRIT 17 44 252 0 1
MREAD 17 44 252 0 1
■ KV Nano Series
Object size Operand table size Internal working capacity
Instruction Basic byte
size
MIN MAX MIN MAX Word Bit
LD 4 6 16 0 20 0 0
LDB 4 6 22 0 20 0 0
AND 4 8 14 0 20 0 0
ANB 4 8 22 0 20 0 0
OR 4 8 24 0 20 0 0
ORB 4 8 24 0 20 0 0
LDP 4 12 22 12 28 0 1
LDF 4 12 22 12 28 0 1
APPENDICES
ANP 4 12 22 12 28 0 1
ANF 4 12 22 12 28 0 1
ORP 4 14 24 12 28 0 1
ORF 4 14 24 12 28 0 1
LDPB 5 10 20 12 28 0 1
ANPB 5 12 22 12 28 0 1
ORPB 5 14 24 12 28 0 1
Instruction Size Table
LDFB 5 10 20 12 28 0 1
ANFB 5 12 22 12 28 0 1
ORFB 5 14 24 12 28 0 1
BLD 7 2 2 20 44 0 0
BLDB 7 2 2 20 44 0 0
BAND 7 2 2 20 44 0 0
BANB 7 2 2 20 44 0 0
BOR 7 2 2 20 44 0 0
BORB 7 2 2 20 44 0 0
LD= 7 2 66 0 28 0 0
LD< 7 2 64 0 28 0 0
LD> 7 2 64 0 28 0 0
LD<= 7 2 64 0 28 0 0
LD>= 7 2 64 0 28 0 0
LD<> 7 2 64 0 28 0 0
AND= 7 2 66 0 28 0 0
AND< 7 2 66 0 28 0 0
AND> 7 2 66 0 28 0 0
AND<= 7 2 66 0 28 0 0
AND>= 7 2 66 0 28 0 0
AND<> 7 2 66 0 28 0 0
OR= 7 2 68 0 28 0 0
OR< 7 2 68 0 28 0 0
OR> 7 2 68 0 28 0 0
OR<= 7 2 68 0 28 0 0
OR>= 7 2 68 0 28 0 0
OR<> 7 2 68 0 28 0 0
OUT 4 6 12 0 20 0 0
OUB 4 12 16 0 20 0 0
SET 4 4 20 0 28 0 0
RES 4 4 20 0 28 0 0
KEEP 4 2 2 12 28 0 0
APPENDICES
BSET 7 4 4 28 48 0 0
BRES 7 4 4 28 48 0 0
TMR 7 2 8 8 28 0 0
TMH 7 2 8 8 28 0 0
TMS 7 2 8 8 28 0 0
TMU 8 2 8 8 28 0 0
C 10 2 2 20 48 0 0
OUTC 8 2 8 8 28 0 0
MCALL 17 30 30 16 216 0 0
MSTRT 17 30 30 16 216 0 0
MEND 2 20 20 0 0 0 0
MDSTRT 6 20 20 0 0 0 0
MDSTOP 6 20 20 0 0 0 0
ZPUSH 6 4 4 20 24 0 0
ZPOP 6 4 4 20 24 0 0
ADRSET 8 4 4 28 36 0 0
Instruction Size Table
ADRINC 5 4 4 20 24 0 0
ADRDEC 5 4 4 20 24 0 0
ADRADD 9 4 4 28 44 0 0
ADRSUB 9 4 4 28 44 0 0
UREAD 14 4 4 44 76 0 0
UWRIT 14 4 4 44 76 0 0
UFILL 14 4 4 36 72 0 0
MOV 7 4 60 0 40 0 0
LDA 4 4 42 0 24 0 0
STA 4 4 36 0 36 0 0
PLDA 8 4 4 20 44 0 0
PSTA 8 4 4 28 48 0 0
DW 7 4 44 0 28 0 0
BMOV 10 4 4 44 72 0 0
FMOV 10 4 4 36 68 0 0
PMOV 17 4 4 52 124 0 0
BYLMOV 17 4 4 60 112 0 0
BYBMOV 17 4 4 60 112 0 0
ADD 4 4 30 0 24 0 0
SUB 4 4 30 0 24 0 0
MUL 4 4 30 0 24 0 0
DIV 4 4 30 0 24 0 0
INC 4 4 8 0 44 0 0
DEC 4 4 8 0 44 0 0
ROOT 1 4 18 0 4 0 0
POW 5 4 4 12 24 0 0
CMP 4 4 32 0 24 0 0
ZCMP 7 4 4 20 44 0 0
ANDA 4 4 4 12 24 0 0
ORA 4 4 4 12 24 0 0
EORA 4 4 4 12 24 0 0
APPENDICES
RRNCA 5 4 4 12 24 0 0
RLNCA 5 4 4 12 24 0 0
WSR 10 4 4 36 68 0 0
WSL 10 4 4 36 68 0 0
BSR 11 4 4 36 68 0 0
BSL 11 4 4 36 68 0 0
LIMIT 14 4 4 36 104 0 0
BANDC 15 4 4 36 104 0 0
ASC 1 18 18 0 0 0 0
RASC 1 18 18 0 0 0 0
DASC 7 4 4 28 48 0 0
RDASC 7 4 4 28 68 0 0
HASC 11 4 4 36 68 0 0
RHASC 8 4 4 28 68 0 0
FASC 11 4 4 44 72 0 0
RFASC 8 4 4 28 68 0 0
Instruction Size Table
SMOV 7 4 4 36 68 0 0
SADD 10 4 4 52 108 0 0
SRGHT 11 4 4 44 88 0 0
SLEFT 11 4 4 44 88 0 0
SMID 14 4 4 52 108 0 0
SRPLC 17 4 4 68 148 0 0
SINS 14 4 4 60 128 0 0
SDEL 14 4 4 52 108 0 0
STRIM 11 4 4 44 88 0 0
SFIND 14 4 4 52 144 0 0
SFINDN 14 4 4 60 148 0 0
SCMP 7 4 4 36 84 0 0
DISS 7 4 4 36 68 0 0
UNIS 10 4 4 44 72 0 0
LEN 7 4 4 28 84 0 0
RCOM 10 2 2 64 88 0 1
CAL+ 11 4 4 28 84 0 0
CAL- 11 4 4 28 84 0 0
CAL* 11 4 4 28 76 0 0
CAL/ 11 4 4 28 76 0 0
CAL& 11 4 4 28 84 0 0
CAL| 11 4 4 28 84 0 0
CAL^ 11 4 4 28 84 0 0
CAL~ 8 4 4 20 64 0 0
CAL>> 8 4 4 28 64 0 0
CAL<< 8 4 4 28 64 0 0
CPMSET 11 4 4 60 112 0 0
CPMGET 14 4 4 44 72 0 0
CPSASC 8 4 4 36 52 0 0
RCPSASC 11 4 4 44 108 0 0
HKEY 7 2 2 40 40 0 0
APPENDICES
BSUM 8 4 4 28 48 0 0
CRC 11 4 4 44 72 0 0
ZRES 7 4 4 36 52 0 0
EXT 1 26 36 0 0 0 0
BCMP 14 4 4 60 96 0 0
BCMPI 14 4 4 52 92 0 0
RND 5 4 4 20 44 0 0
SORT 11 4 4 36 68 0 0
CHGTGT 11 4 4 28 64 0 0
RFSPS 8 4 4 20 44 0 0
MCMP 14 4 4 52 92 0 0
ABSENC 14 2 2 68 104 0 1
INCENC 15 2 2 76 100 0 1
FCNT 12 2 2 36 80 0 0
RCNT 12 2 2 44 84 0 0
PLSOUT 10 2 2 28 52 0 0
Instruction Size Table
PID 8 2 2 36 48 0 0
PIDAT 11 2 2 52 80 0 1
MWRIT 17 2 2 84 144 0 1
MREAD 17 2 2 84 144 0 1
MFREE 8 2 2 44 60 0 1
MMKDIR 8 2 2 44 76 0 1
MRMDIR 8 2 2 44 76 0 1
MDEL 8 2 2 44 76 0 1
MPRINT 11 2 2 60 116 0 1
MREADL 14 2 2 74 126 0 1
MCOPY 14 2 2 68 136 0 1
MMOV 14 2 2 68 136 0 1
MREN 11 2 2 60 116 0 1
MFREEK 8 2 2 44 60 0 1
MSTAT 11 2 2 60 84 0 1
LOGE 5 4 4 12 24 0 0
LOGD 5 4 4 12 24 0 0
TRGD 5 8 8 12 24 0 0
AWNUM 5 2 2 20 32 0 1
AWMSG 5 2 2 28 52 0 1
SPRD 19 2 2 68 112 0 2
SPWR 19 2 2 68 112 0 2
SSVC 19 2 2 68 112 0 2
RFSCI 8 6 6 8 12488 0 0
RFSCO 8 6 6 8 12488 0 0
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
Operation panel
CM0204, CM0205 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-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-85
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)
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-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-93
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
Hold
Attribute
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 ○
Hold
Attribute
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 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 ○
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 Detailed information, number of valid pieces of data
CM2206 ○
unit
CM2207 Detailed information, piece 01 ○
CM2208 Detailed information, piece 02 ○
: ○
CM2226 Detailed information, piece 20 ○
CM2227 to
- Reserved for the system
CM2249
Hold
Attribute
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
Hold
Attribute
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
Hold
Attribute
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
Hold
Attribute
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
Hold
Attribute
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
Hold
Attribute
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
Hold
Attribute
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 ッ ソ マ °