You are on page 1of 960

449GB

Chapter
BRIEF EXPLANATION
OF INSTRUCTIONS

Chapter
BASIC
INSTRUCTIONS

Programmable Controller Chapter


APPLIED
INSTRUCTIONS
KV-7000/5000/3000/1000 Series
Chapter ARITHMETIC
KV Nano Series OPERATION
INSTRUCTIONS
Chapter
EXTENDED
INSTRUCTIONS

Instruction Reference Manual Operation Processing Time Table

(Common instruction part)


Instruction Size Table
Instruction Index

For related instructions of CPU built-in functions and


specific instructions of extension units, please see the
corresponding “User’s Manual”.

Supported CPU units


・KV-7500
・KV-7300
・KV-5500
・KV-5000
・KV-3000
・KV-1000
・KV-N14**
・KV-N24**
・KV-N40**
・KV-N60**
・KV-NC32T
Preface
This Manual describes a variety of instructions in ladder diagram programming of "KV-7000/5000/3000/
1000 Series" and "KV Nano Series". For instructions concerning CPU built-in functions and those
exclusively used in expanded units, see User's Manual of various units.
In addition, refer to "CPU Unit User's Manual", Script Programming Manual" "KV STUDIO User's
Manual".
Keep this Manual in a safe place for later reference.
Please handover this manual to the end-users who are going to use the KV Series.

■ 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.

● KV-7000 relative manual


Designation Note
This manual describes how to connect, and maintain the KV-7000
KV-7000 Series User's Manual Series. It also describes the CPU built-in functions and how to
create ladder programs.

● KV-5500/5000/3000 relative manual


Designation Note
This manual, which describes the system configuration and
KV-5500/5000/3000 Series
specifications of the KV-5500/5000/3000 Series. It also describes
User's Manual
the CPU built-in functions and how to create ladder programs.

● KV-1000 Series relative manual


Designation Note
PLC This Manual describes specifications, integrated functions and
KV-1000 series User's Manual operating method of the KV-1000 series PLC.
PLC This manual describes the basic functions and how to use the KV-
KV-1000 series Introction Manual 1000 PLC briefly.
PLC This manual describes how to make ladder programs using the KV-
KV-1000 series Programming Manual 1000 PLC, and modules/macros and local devices.

● KV Nano Series relative manual


Designation Note
This manual, which describes the system configuration and
KV Nano Series
specifications of the KV Nano Series. It also describes the built-in
User's Manual
functions and how to create ladder programs.
Safety Precautions
■ Symbols
This document contains notices which you should observe to ensure your own personal safety, as well
as to protect the product and connected equipment. These notices are highlighted in the manual by a
warning triangle and are marked as follows according to the level of danger:

It indicates a hazardous situation which, if not avoided, will result in death or


DANGER
serious injury.

It indicates a hazardous situation which, if not avoided, could result in death or


WARNING
serious injury.

It indicates a hazardous situation which, if not avoided, could result in minor or


CAUTION
moderate injury.

It indicates a situation which, if not avoided, could result in product damage as


NOTICE
well as property damage.

Important It indicates cautions and limitations that must be followed during operation.

Point It indicates additional information on proper operation.

Reference It indicates tips for better understanding or useful information.

Page or manual providing related information

■ 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

KV-5000/3000 CPU Function Version


The CPU function version has been added to the KV-5000/3000 Series shipped after September 10,
2009. Check the serial label on the side for details on the CPU function version.
CPU function version

2 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Differences in KV-5500/5000/3000 CPU function versions

Differences according to the CPU function version are listed below.

■ Differences in CPU functions according to CPU function version


Following Following Following
Time of shipment
June 14, 2010 September 10, 2009 June 14, 2007
CPU function version Ver.2.0 Ver.1.1 Ver.1.0
KV STUDIO compatible version Ver. 6.0 or higher Ver. 5.6 or higher Ver. 4.0 or higher
KV-5500 ○ - -
Compatible
KV-5000 ○ ○ ○
CPU unit
KV-3000 ○ ○ ○
Bluetooth communication ○ ○ *1 ×
Battery-less operation ○ × ×
Initial screen display
○ × ×
(access window)
Read folder specification
○ × ×
(auto-loading function)
CPU
function SDHC card (memory card) ○ × ×
Word device bit comment
○ × ×
(KV STUDIO)
Performance monitor (KV
○ × ×
STUDIO)
Differential monitor (KV
○ × ×
STUDIO)
Double precision floating
○ × ×
point type real number
Timer/counter instruction 1 instruction added (TMU) No additions -
PID control instruction 1 instruction added (PIDAT) No additions -
3 instructions added
Data control instruction No additions -
(RAMP,TPOUT,LLFLT)
2 instructions added (BYLMOV,BYBMOV)
Move instruction No additions -
Specifications of 1 instruction expanded *2
Arithmetic/comparison
1 instruction added (POW) No additions -
instruction
Data shift instruction 2 instructions added (ASRA,ASLA) No additions -
4 instructions added
Data conversion
(ABS,BSWAP,CPMSET,CPMGET) No additions -
instruction
Specifications of 2 instructions expanded *3
Instructions
/script 5 instructions added
Floating point instruction No additions -
(LOG10,DFLOAT,DINTG,FTODF,DFTOF)
Simple operation *4
Specifications of 2 instructions expanded No additions -
instruction
5 instructions added
Text string processing (SPLIT,STRIM,SFINDN,CPSASC,
No additions -
instruction RCPSASC) *5
Specifications of 1 instruction expanded *6
Data processing
2 instructions added (SORT,SORTN) No additions -
instruction
7 instructions added
Memory card instruction (MPRINT,MREADL,MCOPY, No additions -
MMOV,MREN,MFREEK,MSTAT)
Sensor setting instruction 3 instructions added (SPRD,SPWR,SSVC) No additions -
Refresh instruction 2 instructions added (RFSCI,RFSCO) No additions -
*1 KV-3000 Ver.1.1 does not support Bluetooth communication.
*2 Constants can be specified for the PMOV operand S.
*3 Devices can be specified for the DECO/ENCO operand n.
*4 A signed integer can be specified for the shift instruction (CAL>>, CAL<<). (Arithmetic shift)
*5 Only scrip function is added for SPLIT.
*6 RCOM supports word device bit comment.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3


■ Differences in Ethernet functions according to CPU function version
Following Following Following June
Time of shipment
June 14, 2010 September 10, 2009 14, 2007
KV-5500 Ver.2.0 - -
Compatible KV-5000 Ver.2.0 Ver.1.1 Ver.1.0
unit EtherNet/IP unit KV-EP21V - -
Ethernet unit KV-LE21V KV-LE21V KV-LE20V
Simple PLC link ○ ○ ×
FTP client ○ ○ ×
BOOTP client ○ ○ ×
Ethernet
function Communication without unit
○ × ×
setting
APPE command support
○ × ×
(FTP server function)

● Restrictions for using extended input/output unit (KV-B8XTD, KV-C16XTD, KV-


C32XTD)
The following restrictions apply when connecting an extended input/output unit to the CPU function
version 1.0 CPU unit. (These restrictions do not apply to the CPU function version 1.1 or higher CPU
unit.)
• During the I/O test, 32DO is displayed on the KV-C16XTD and 64DO on the KV-C32XTD.
• During the I/O test, the details displayed for the KV-B8XTD differ according to the unit setting
information stored in the CPU unit.
When the unit information stored in the CPU unit is the same as the actual unit configuration.
32DO is displayed.
When the unit information stored in the CPU unit differs from the actual unit configuration.
16DO is displayed.
• If the unit information stored in the CPU unit differs from the actual unit configuration, the I/O test
operation will differ according to the type of unit to the right of the KV-B8XTD.
When the right unit is a special unit, or when there is no unit to the right.
The KV-B8XTD output relay is not controlled.
When the right unit is an output unit.
When the right unit's output relay turns ON, the KV-B8XTD outut relay also turns ON.
When the right unit is an input unit.
When the right unit's input relay turns ON, the KV-B8XTD output relay also turns ON.
• The input refresh prohibit setting is invalid for the KV-B8XTD, KV-C16XTD and KV-C32XTD.
If output prohibit is set, the input refresh will also be prohibited.
• If the input relay forced set assigned to the KV-B8XTD, KV-C16XTD, KV-C32XTD is canceled, the
input status will be applied after the target input relay has turned OFF for one scan.

4 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


How This Manual Is Organized

This chapter provides an explanation of devices and conventions used in instructions

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.)

This chapter explains the most basic instructions in writing a


2
Chapter 2 BASIC
INSTRUCTIONS
sequence program. These instructions are sufficient for
enabling mechanical control on the same level as that of a
3
4
general-purpose relay sequence circuit.

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.

Instruction execution time, list of special devices and


APPENDICES
instruction index.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5


Contents
Preface
Safety Precautions....................................................................................................1
How This Manual Is Organized ................................................................................5
Contents ....................................................................................................................6
How to Use Mnemonics List ................................................................................................. 14
Terminology.......................................................................................................................... 16
Symbols................................................................................................................................ 16

Chapter 1 BRIEF EXPLANATION OF INSTRUCTIONS


Types of Instruction ············································································· 1-2
Structure of Instruction········································································· 1-3
Device and Constant ············································································ 1-5
KV-7000 Series ······························································································· 1-5
KV-5500/5000/3000 Series ················································································ 1-9
KV-1000 Series ······························································································1-13
KV Nano Series ······························································································1-17
Device Notation Method ···················································································1-21
Suffix································································································ 1-23
Definition of Suffixes ························································································1-23
Data Processing················································································· 1-26
BIN Data ·······································································································1-26
Representation of Numerical Value ·····································································1-27
Relationship Between Numerical Representation ···················································1-30
Character Code ······························································································1-33
Every-scan Execution Type and Differential Execution Type ··················· 1-34
Conventions and Cautions in Operand List ··········································· 1-39
Cautions in Operand Related to Specifying Device·················································1-39
Processing of Bit Device and Word Device T, C, CTH, CTC ·····································1-39
Word Unit Processing of Bit Device·····································································1-40
Bit Device Processing of Word Device ·································································1-42
How to Specify Operand ···················································································1-43
Other Matters Needing Attention ········································································1-48

Chapter 2 BASIC INSTRUCTIONS


Contact Instructions ············································································ 2-2
LD Connected in parallel to NO contact. ············································ 2-2
LDB Connected in parallel to NC contact. ············································ 2-2
AND Connected in series to NO contact. ·············································· 2-2
ANB Connected in series to NC contact. ·············································· 2-2
OR Connected in parallel to NO contact. ············································ 2-2
ORB Connected in parallel to NC contact. ············································ 2-2
LDP Only 1 scan period is ON when rising edge (OFF->ON) of bit device
is specifed. ············································································· 2-4
LDF Only 1 scan period is ON when falling edge (ON->OFF) of bit device
is specifed. ············································································· 2-4
ANP Only 1 scan period is ON when falling edge (ON->OFF) of bit device
is specifed. ············································································· 2-4
ANF Only 1 scan period is ON when rising edge (OFF->ON) of bit device
is specifed. ············································································· 2-4
ORP Only 1 scan period is ON when rising edge (OFF->ON) of bit device
is specifed. ············································································· 2-4
ORF Only 1 scan period is ON when falling edge (ON->OFF) of bit device
is specifed. ············································································· 2-4
LDPB Only 1 scan period is OFF when rising edge of bit device is specifed. ··· 2-6
LDFB Only 1 scan period is OFF when falling edge of bit device is specifed.··· 2-6
ANPB Only 1 scan period is OFF when falling edge of bit device is specifed.··· 2-6
ANFB Only 1 scan period is OFF when rising edge of bit device is specifed. ··· 2-6
ORPB Only 1 scan period is OFF when rising edge of bit device is specifed. ··· 2-6
ORFB Only 1 scan period is OFF when falling edge of bit device is specifed.··· 2-6

6 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Bit contact instructions ········································································ 2-8
BLD Treat specified bit of word device as NO contact, and connect it to bus. ··· 2-8
BLDB Treat specified bit of word device as NC contact,
and connect it serially to circuit block. ··········································· 2-8
BAND Treat specified bit of word device as NC contact, and connect it to bus. ··· 2-8
BANB Treat specified bit of word device as NO contact,
and connect it in parallel to circuit block. ······································· 2-8
BOR Treat specified bit of word device as NO contact,
and connect it serially to circuit block. ··········································· 2-8
BORB Treat specified bit of word device as NC contact,
and connect it in parallel to circuit block. ······································· 2-8
Compare Contact Instructions ···························································· 2-12
LD= When "A=B" connect NO contact in ON to bus. ·····························2-12
LD< When "A<B" connect NO contact in ON to bus. ·····························2-12
LD> When "A>B" connect NO contact in ON to bus. ·····························2-12
LD<= When "A<B" connect NO contact in ON to bus. ·····························2-12
LD>= When "A>B" connect NO contact in ON to bus. ·····························2-12
LD<> When "A<>B" connect NO contact in ON to bus ····························2-12
AND= When "A=B" connect NO contact in ON serially to circuit block ·········2-12
AND< When "A<B" connect NO contact in ON serially to circuit block ·········2-12
AND> When "A>B" connect NO contact in ON serially to circuit block ·········2-12
AND<= When "A<=B" connect NO contact in ON serially to circuit block ·······2-12
AND>= When "A>=B" connect NO contact in ON serially to circuit block ·······2-12
AND<> When "A<>B" connect NO contact in ON serially to circuit block ·······2-12
OR= When "A=B" connect NO contact in ON in parallel to circuit block······2-12
OR< When "A<B" connect NO contact in ON in parallel to circuit block······2-12
OR> When "A>B" connect NO contact in ON in parallel to circuit block······2-12
OR<= When "A<=B" connect NO contact in ON in parallel to circuit block ····2-12
OR>= When "A>=B" connect NO contact in ON in parallel to circuit block ····2-12
OR<> When "A<>B" connect NO contact in ON in parallel to circuit block ····2-12
Output Instructions ··········································································· 2-16
OUT Output the previous state ··························································2-16
OUB The status before bar outputting ·················································2-16
SET Destination relay ON and hold it in this state ·································2-18
RES Destination relayOFF ·······························································2-18
KEEP Turns ON the device specified by the SET condition turning ON,
and holds the device in this state.Turns OFF the device specified
by the RES condition turning ON. ···············································2-20
DIFU Only 1 scan ON on the rising edge of the execution condition.··········2-22
DIFD Only 1 scan ON on falling edge of the execution condition. ··············2-22
ONDL Destination relay ON delay. ·······················································2-24
OFDL The specified bit device perfoms OFF delay operation. ···················2-24
SHOT Destination relay one shot·························································2-26
FLIK Destination relay flickers ···························································2-28
ALT Destination relay invert ·····························································2-30
Bit output instructions ······································································· 2-32
BOUT Outputs the previous state to the specified bit of the device.·············2-32
BOUB To map input state to the specified bit of word device. ····················2-32
BSET Turn the specified bit of the word device ON and holds this state ······2-34
BRES Turn the specified bit of the word device OFF ·······························2-34
Timer/Counter Instructions ································································· 2-36
TMR 100 ms, 32-bit ON delay subtraction timer ····································2-36
TMH 10 ms, 32-bit ON delay subtraction timer······································2-36
TMS 1ms, 32-bit ON delay subtraction timer ········································2-36
TMU 10μs, 32-bit ON delay subtraction timer ·······································2-40
UDT 100 ms, 32-bit up/down timer. ····················································2-42
C 32-bit up counter ·····································································2-44
OUTC 32-bit up counter ·····································································2-48
ITVL Pulse measurement/DM value measurement ································2-50
UDC 32-bit up/down counter ·····························································2-56

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 7


Connection/End Instruction ·································································2-60
END To indicate the end of the master program.···································2-60
ENDH To indicate the end of the entire program. ····································2-60
CON Indicates a series connection following an output instruction ············2-62
MPS To store the input state and operation flag. ···································2-64
MRD To read the content in memory by the MPS instruction. ···················2-64
MPP To read the content in memory by the MPS instruction,
and clear memory.···································································2-64
ANL Connects the contact block in series ···········································2-66
ORL Connects the contact block in paralleland clear memory. ·················2-66
INV To invert the previous ON/OFF state before this instruction. ·············2-68
MEP Only 1 scan period is ON on the rising edge of the previous
execution condition. ·································································2-70
MEF Only 1 scan period is ON on the falling edge of the previous
execution condition. ·································································2-70
Direct I/O instructions ·········································································2-72
RFSX To refresh the states of specified number of input relays.·················2-72
RFSY To refresh the states of the specifed number of output relays. ··········2-72

Chapter 3 APPLIED INSTRUCTIONS


Shift Instruction ·················································································· 3-2
SFT Operates the shift register ·························································· 3-2
Memory Switch Instruction ··································································· 3-4
MEMSW Memory switch setting ······························································· 3-4
Step Instructions ················································································· 3-8
STP Step instruction start ································································· 3-8
STE Step instruction end ·································································· 3-8
Stage Processing Instruction ·······························································3-12
STG Stage start ·············································································3-12
JMP Stage jump ············································································3-12
ENDS End stage ··············································································3-12
W-ON Sets the device of the No.2 operand with the device of the No.1
operand ON. ··········································································3-18
W-OFF Sets the device of the No.2 operand with the device of the No.1
operand OFF. ·········································································3-18
W-UE Sets the bit device of the No.2 operand at the rising edge of the bit
device of the No.1 operand.·······················································3-20
W-DE Sets the bit device of the No.2 operand at the falling edge of the bit
device of the No.1 operand.·······················································3-20
Flow Instruction ·················································································3-24
MC Indicates the start of the master control.·······································3-24
MCR Indicates the end of the master control range. ·······························3-24
CALL Sub-routine call·······································································3-28
SBN Sub-routine entry ····································································3-28
RET Sub-routine return ···································································3-28
ECALL To execute subroutine of specified module. ··································3-32
FOR Repeat start ···········································································3-34
NEXT Repeat block end ····································································3-34
BREAK Repeat force end ····································································3-34
CJ Performs a jump conditionally to the CJLABEL instruction ···············3-38
NCJ Performs a jump conditionally to the NCJLABEL instruction ·············3-38
GOTO Performs a jump unconditionally to the LABEL instruction. ···············3-38
LABEL Jump destination of the LABELCJ or GOTO instructions ·················3-38
SCJ Performs a jump to the LABEL instruction.(1 scan ON delay) ···········3-42
Macro Instructions ·············································································3-44
MCALL Executes the specified sub-routine type macro. ·····························3-44
MSTRT Executes the specified self-hold type macro.·································3-44
MEND Stops execution of the self-hold type macro. ·································3-44
Function Block Instructions ·································································3-48
FB Calls up function block ·····························································3-48
FEND Stops function ········································································3-48
FUN Calls up function ·····································································3-48

8 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Module Instructions ··········································································· 3-52
MDTSRT Module execution start ·····························································3-52
MDSTOP Module execution stop ·····························································3-52
Index Register Instructions ································································· 3-54
ZPUSH Index register batch purge·························································3-54
ZPOP Index register batch restore ·······················································3-54
Indirect specifying instructions ··························································· 3-58
ADRSET Stores the address of the device to be indirectly ····························3-58
ADRINC Device address incremented with 1. ············································3-60
ADRDEC Device address decremented with 1. ···········································3-60
ADRADD Address addition ·····································································3-62
ADRSUB Address subtraction ·································································3-62
File Register Instructions ··································································· 3-66
FRSET Switch the current group No. of the file register to the specified No.. ····3-66
FRSTM Save the batched file registers of the specified group to
the memory card in binary form. ·················································3-68
FRLDM Read the batch data saved in memory card into the file register of
the specified group. ·································································3-70
Unit Program Instructions ·································································· 3-72
UPSTRT Unit program start ···································································3-72
UPSTOP Unit program forced stop ··························································3-76
UFSUS Suspend flow ·········································································3-78
UFRSM Resume flow ··········································································3-78
UMALLOC Allocate buffer memory·····························································3-82
Buffer Memory Instructions ································································ 3-84
UREAD Read data of the specified buffer memory into device. ····················3-84
UWRIT Write device data with specified range into the buffer memory. ·········3-86
UFILL Write the specified 16/32-bit data in batch to the buffer memory.·······3-88
Unit type judgment instruction ···························································· 3-90
IS_□□□ Check the specified unit type ·····················································3-90

Chapter 4 ARITHMETIC OPERATION INSTRUCTIONS


Data Move Instructions ········································································ 4-2
MOV Stores 16/32/64-bit data to a specified device. ······························· 4-2
LDA Stores data to internal registers··················································· 4-6
STA Stores data in internal registers to a specified device ······················4-10
PLDA Only the specified bit counts of the data are stored in internal register.····4-14
PSTA Store the counting of specified bits in internal register into the
device. ··················································································4-16
TMIN Inputs 32-bit numerical values set by the digital trimmer to an internal
register ·················································································4-18
DW Data Move ·············································································4-20
BMOV Move source block moves to move destination ······························4-24
FMOV Move source batch switches to move destination4-26
PMOV Move continuous bit information in device to specified bit position ·····4-30
BYLMOV Switch high-order and low-order, and move data from move source
to move destination ·································································4-34
BYBMOV Switch low-order and high-order, and move data from move source to
move destination·····································································4-36
Arithmetic/Comparison Instructions ···················································· 4-38
ADD Addition operation of 16/32-bit BIN ·············································4-38
SUB Subtraction operation of 16/32-bit BIN data ··································4-42
MUL Multiplication operation of 16/32-bit BIN data ································4-46
DIV Division operation of 16/32-bit BIN data ·······································4-52
INC Add 1 from the destination device ···············································4-58
DEC Subtract 1 from the destination device ·········································4-62
ROOT Square root extraction operation·················································4-64
POW Exponentiation········································································4-66
CMP Compare data ········································································4-70
ZCMP Zone compare ········································································4-74

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 9


Arithmetic Operation Instructions ······················································· 4-78
ANDA Logical AND operation of internal register and specified data ···········4-78
ORA Logical AND operation of internal register and specified data ···········4-80
EORA Calculates the number of ON bit in internal registers ······················4-82
ENRA XOR operation of internal register and specified data ·····················4-84
COM bitwise invert ··········································································4-86
NEG Negative················································································4-88
Data Shift Instructions ······································································· 4-92
SRA Shift right in internal register ······················································4-92
SLA Shift left in internal register ························································4-96
ASRA Arithmetic right shift of internal register ········································4-98
ASLA Arithmetic left shift of internal register ········································ 4-102
RRA Rotate right in internal register ················································· 4-106
RLA Rotate left in internal register ··················································· 4-110
RRNCA Right rotate without carry in internal register ······························· 4-114
RLNCA Left rotate without carry in internal register ································· 4-118
WSR Word data to shift right ··························································· 4-122
WSL Word data to shift left ····························································· 4-124
BSR Shifts the content of the device to the larger device No. ················ 4-126
BSL Shifts the content of the device to the smaller device No. ·············· 4-128
Data control instructions ··································································· 4-130
LIMIT To perform upper/lower limit control for input data ························ 4-130
BANDC To perform dead band control for input data.······························· 4-132
ZONE To perform zone control for input data. ······································ 4-134
APR To perform approximation calculation for input data in specified line. ···· 4-136
RAMP Outputs changes in input value with specified inclination ··············· 4-144
TPOUT Pulse outputs with specified ON time and cycle ··························· 4-148
LLFLT Passes input through lead-lad filter and outputs··························· 4-152
Data Conversion Instructions ···························································· 4-156
TBCD Converts binary to BCD ·························································· 4-156
TBIN Converts BIN to binary ··························································· 4-158
MPX Encode 4-bit number to 16-bit ·················································· 4-160
DMX Encode 16-bit number to 4-bit ·················································· 4-160
GRY Converts binary to gray code ··················································· 4-162
RGRY Converts gray code to binary ··················································· 4-162
DISN Disperses word (16-bit) into nibble unit (4-bit) ····························· 4-166
UNIN Unites the nibble (4-bit) to word (16-bit) ····································· 4-168
DISB Disperses word (16-bit) into byte (4-bit)······································ 4-170
UNIB Unites the byte (8-bit) to word (16-bit)········································ 4-172
SWAP Swaps the upper and lower data ·············································· 4-174
BSWAP Switches high-order and low-order data block unit ······················· 4-176
XCH Exchange ············································································ 4-178
DECO Encode the numbers of the lower n bits of the internal register to
2n bit binay data.··································································· 4-180
ENCO Encode ON position of bit device within specified range to
a numerical number. ······························································ 4-182
ABS Absolute value······································································ 4-184
CPMSET Creates CIP message ···························································· 4-186
CPMGET Gets CIP message ································································ 4-192
Floating Point Instructions ································································ 4-196
FLOAT Converts binary to single precision floating point type real number ···· 4-196
DFLOAT Converts binary to double precision floating point type real number ··· 4-198
INTG Converts single precision floating point type real number to binary ···· 4-200
DINTG Converts double precision floating point type real number to binary ··· 4-204
DFTOF Converts double precision floating point type real number to single
precision floating point type real number ···································· 4-208
FTODF Converts single precision floating point type real number to double
precision floating point type real number ···································· 4-210
DISF Disperse mantissa/exponent of single precision floating point type
real number ········································································· 4-212
UNIF Unite mantissa and exponent to single precision floating point type
real number ········································································· 4-214
EXP Exponent operation ······························································· 4-216
LOG Natural logarithm operation ····················································· 4-216
LOG10 Constant logarithm operation ··················································· 4-220

10 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


RAD Converts degree (°) to radians ················································· 4-222
DEG Converts radians to degree (°) ················································· 4-222
SIN Calculates the sine (sin) value from the angle (radians)················· 4-226
COS Calculates the cosine (cos) value from the angle (radians)············· 4-226
TAN Calculates the tangent (tan) value from the angle (radians)············ 4-226
ASIN Calculates the angle (radians) from the sine (sin) value················· 4-230
ACOS Calculates the angle (radians) from the cosine (cos) value············· 4-230
ATAN Calculates the angle (radians) from the tangent (tan) value ············ 4-230
ATAN2 Calculates the angle (radians) from the coordinates (X, Y)············· 4-232
Text Processing Instructions ····························································· 4-234
ASC Converts binary to HEX ASCII code ·········································· 4-234
RASC Converts reverse HEX ASCII code to binary ······························· 4-236
DASC Converts binary to decimal ASCII code ······································ 4-238
RDASC Converts reverse decimal ASCII code to binary ··························· 4-242
HASC Converts numerical value (HEX) to HEX ASCII text string·············· 4-246
RHASC Converts HEX ASCII text string to numerical value (Hex) ·············· 4-250
FASC Convert single precision floating point type real number to text string ··· 4-254
RFASC Converts text string to single precision floating point ····················· 4-258
LEN Detect text string length ·························································· 4-262
SMOV Stores a text string to a specified device ···································· 4-264
SADD Unites the text strings of specified devices ································· 4-266
SRGHT Cut text string on right ···························································· 4-268
SLEFT Cut text string on left ······························································ 4-272
SMID Cuts part of a text string·························································· 4-276
SRPLC Partial replace text string ························································ 4-280
SINS Inserts a specified text string into a text string ····························· 4-284
SDEL Deletes a specified part of a text string. ····································· 4-288
STRIM Deletes ends of text string······················································· 4-292
SFIND Finds a specified text string from a text string. ····························· 4-294
SFINDN Finds specified text string within the specified text string range ······· 4-298
SCMP Compares text strings ···························································· 4-302
DISS Disperses text strings in byte units into text strings in word units. ···· 4-306
UNIS Units text strings in word units into text strings in byte units. ··········· 4-308
RCOM Reads the text string ······························································ 4-310
CPSASC Converts CIP text string data ··················································· 4-314
RCPSASC Converts CIP text string data reversely ······································ 4-316
Simple Operation Instructions ··························································· 4-318
CAL+ Add values of Operand1 and Operand2 and store the result into
Operand3. ··········································································· 4-318
CAL- Subtract values of Operand1 and Operand2 and store the result into
Operand3. ··········································································· 4-322
CAL* Multiple values of Operand1 and Operand2 and store the result into
Operand3. ··········································································· 4-326
CAL/ Divide values of Operand1 and Operand2 and store the result into
Operand3. ··········································································· 4-330
CAL& Perform logical AND operation of the two specified devices ··········· 4-334
CAL| Logic OR operation of values stored in 2 specified device·············· 4-336
CAL^ Logic XOR operation of values stored in 2 specified device············ 4-338
CAL~ Perform logical OR operation of the two specified devices. ············ 4-340
CAL>> Shift the bits of the specified device to lower bits, only specified bits.···· 4-342
CAL<< Specify the bit content of thedevice, then shift the device to
the higher bit. ······································································· 4-346

Chapter 5 EXTENDED INSTRUCTIONS


Data Processing Instructions ································································ 5-2
HKEY Hex key data input···································································· 5-2
SEG 7-segment decode···································································· 5-4
BCNT Calculates the number of ON bit in internal registers ······················· 5-8
DCNT Detects devices of the same value as the internal register
in the specified range, and counts the number of devices. ···············5-10
SER Detects devices of the same value as the internal egister
in the specified range, and detects their device Nos. ······················5-14
DSER Specifies the device of the range to be detected. ···························5-18

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 11


MAX Calculates the maximum value of BIN data currently stored to
a specified range, and stores this to internal registers. ····················5-20
MIN Calculates the minimum value of BIN data currently stored to
a specified range, and stores this to internal registers. ····················5-20
AVG Calculates the average value of BIN data currently stored to
a specified range, and stores this to internal registers. ····················5-26
WSUM Calculates the total value of BIN data currently stored to
a specified range, and stores this to internal registers. ····················5-32
BSUM Calculates the total value of the BIN data lower/upper 8 bits currently stored
to within the specified range, and stores them to the internal register······5-36
CRC Calculates the CRC value of a specified number of devices,
and stores this to internal registers··············································5-38
ZRES Zone reset ·············································································5-40
EXT Extends the data in internal registers. ··········································5-42
BCMP Compares the BIN data in two specified ranges. ····························5-46
BCMPI Compares specified BIN data with BIN data in a specified range. ······5-50
RND Occurred random number is stored in device. ·······························5-54
SORT Sorts binary data·····································································5-56
SORTN Splits and sorts binary data ·······················································5-60
Table Processing Instructions ···························································· 5-64
FIFOW FIFO Write data ······································································5-64
FIFOR FIFO Read·············································································5-68
LIFOW LIFO Write data ······································································5-72
LIFOR LIFO Read·············································································5-76
FWRIT Overwrites the data block of the data table. ··································5-80
FINS Inserts data in a data block.·······················································5-82
FDEL Deletes a data block of the data ·················································5-84
Clock Processing Instructions ···························································· 5-86
WTIME Writes the time data to the calendar timer ····································5-86
SEC Converts date/time format data to second format data. ···················5-88
RSEC Converts second format data to date/time format data. ···················5-88
AJST Adjusts the calendar timer by ±30 seconds ···································5-90
Weekly Contact Instructions ······························································· 5-92
LDWK Turns ON between specified day of week/hour/minute/second ranges ····5-92
LDWKB Turns OFF between specified day of week/hour/minute/second ranges.····5-92
ANDWK Turns OFF between specified day of week/hour/minute/second ranges.····5-92
ANDWKB Turns ON between specified day of week/hour/minute/second ranges. ···5-92
ORWK Turns ON between specified day of week/hour/minute/second ranges. ···5-92
ORWKB Turns OFF between specified day of week/hour/minute/second ranges.····5-92
Calendar Contact Instructions ···························································· 5-96
LDCAL Turns ON between specified year/month/day ranges. ·····················5-96
ANDCAL Turns OFF between specified year/month/day ranges.····················5-96
ORCAL Turns ON between specified year/month/day ranges. ·····················5-96
LDCALB Turns OFF between specified year/month/day ranges.····················5-96
ANDCALB Turns ON between specified year/month/day ranges. ·····················5-96
ORCALB Turns OFF between specified year/month/day ranges.····················5-96
Alarm Instruction ············································································· 5-100
ARES Resets the currently operating alarm relay and alarm history. ········· 5-100
High-speed Processing Instructions ··················································· 5-102
HSP Sets the input time constant to 10μs·········································· 5-102
DI Disable interrupt···································································· 5-104
EI Enable interrupt ···································································· 5-104
DIC Sets the interrupt disabled range. ············································· 5-106
INT Interrupt execute ··································································· 5-108
RETI Interrupt end ········································································ 5-108
IEDGE Sets detection conditions used for interrupt ································ 5-112
CTH 32-bit high-speed counter ······················································· 5-116
CTC High-speed comparator ·························································· 5-116
RFSCTH Update the current value of High-speed Counter with the latest value. ···· 5-120
PID Control Instruction ····································································· 5-122
PID PID Control ·········································································· 5-122
PIDAT PID control with automatic tuning·············································· 5-130

12 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Device Instructions ······························································· 5-152
MWRIT Saves device data to the memory card (CPU memory). ················ 5-158
MREAD Reads device data from memory card (CPU memory).·················· 5-170
MFREE Gets the free space on the memory card (CPU memory) by byte unit. ···· 5-178
MMKDIR Makes a directory on the memory card (CPU memory). ················ 5-182
MRMDIR Deletes the specified folder in the memory card (CPU memory). ····· 5-186
MDEL Delete specified files in memory card (CPU memory).··················· 5-188
MPRINT Writes the text string into the end of the file in the memory card
(CPU memory).····································································· 5-190
MREADL Only one line of the file in the memory card (CPU memory) is read out.···· 5-194
MCOPY A file in the memory card (CPU memory) is copied. ······················ 5-200
MMOV A file in the memory card (CPU memory) is moved.······················ 5-206
MREN Change the file name (folder name) in the memory card
(CPU memory). ······································································ 5-212
MFREEK Gets the free space on the memory card (CPU memory)
by kilobyte unit.····································································· 5-216
MSTAT Gets the status of the files in the memory card (CPU memory). ······ 5-220
Access Window Instructions ····························································· 5-224
AWNUM Display user message 1 in access window. ································ 5-224
AWMSG Display user message 2 in access window. ································ 5-226
AWSHOW Display user message in access window. ··································· 5-228
AWHIDE Hide the user message being displayed in access window. ············ 5-230
Free operation counter instruction ····················································· 5-232
RFSFRC Update the current value of free operation counter as the latest value····· 5-232
Sensor Setting Instruction ································································· 5-234
SPRD Reads sensor parameter ························································ 5-234
SPWR Writes sensor parameter························································· 5-238
SSVC Executes sensor service ························································· 5-242
Refresh Cyclic Communication Instruction ·········································· 5-246
RFSCI Refreshes cyclic communication input ······································· 5-246
RFSCO Refreshes cyclic communication output ····································· 5-250

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 13


How to Use Mnemonics List

Mnemonics Table is logged in the pages describing the ladder program.


The ladder program can be entered easily with this Mnemonics Table.

1 User's Manual can be used by Adobe Reader.

2 Copy Mnemonics Table with "Option tool".

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.

14 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


4 Single click the button "Insert(I)" to display the reference ladder diagram.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 15


Terminology

This manual uses the following terminology excluding some instances.

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."

16 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
1

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. )

Types of Instruction ............................................................... 1-2


Structure of Instruction .......................................................... 1-3
Device and Constant ............................................................. 1-5
Suffix ................................................................................... 1-23
Data Processing .................................................................. 1-26
Every-scan Execution Type and Differential Execution Type ... 1-34
Conventions and Cautions in Operand List......................... 1-39

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-1


Types of Instruction
BRIEF EXPLANATION OF
INSTRUCTIONS

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.

■ Arithmetic Operation Instructions


These instructions are for executing comparisons, arithmetical calculations, logical calculations, data
move, and text string processing. These instructions allow you to simply program complex arithmetic
calculation circuits.

■ 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".

■ Unit Special Instruction


For special instructions for extended units, please read their respective User's Manuals.

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)

1-2 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Structure of Instruction

BRIEF EXPLANATION OF
INSTRUCTIONS
Each instruction is composed of operands and operators. Their definitions are as follows:

1st operand 2nd operand 3rd operand


Instruction

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 …)

Assign values for executing Constant n (when multiple constants exist n1 n2 …)

Example
"MOV", the 16-bit data transmission instruction is shown as follows:

MOV
S D MOV S D

As shown in this figure, behind "MOV", operands are arranged in the order of "reference object" and "storage position".

Point Depending on functions, operand sequences are different for different


instructions.
For more information, please see respective instruction explanation screens.

Assign constants to a device and execute the instruction

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

■ Size of instruction word


The basic number of bytes and target size of individual instruction words vary depending on specified
suffixes or operands.

1 "Instruction Size Table" (Page A-40)

■ Processing time of instructions


Structure of Instruction

Process time of individual instructions vary depending on specified operands or execution conditions.
"Arithmetic Operation Storage" (Page A-2)

1-4 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Device and Constant

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 and Constant


KV-7000 Series

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

Device and Constant


INSTRUCTIONS

■ Word device
When start Indirect
Local Index
Number of operation specifying(*)*7
Device name Range *1 Main functions device Modify
points (Power ON,
1
Refer-
(@)*1 (:Z/:#) Store
PRG →RUN) ence
*2 Yes Yes Yes Yes
Data memory DM0 to DM65534 65535 Clear/hold
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.

1-6 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Device and Constant

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

Device and Constant


used as argument for processing.
Leading device (R) assigned to
Leading
UR UR0 to UR9 the expansion unit is processed No No Yes
R
as an argument.
Leading data memory (DM)
Unit Leading
UM UM0 to UM9 assigned to the expansion unit No No Yes
DM
is processed as an argument.
Unit number of the expansion unit
No. UV UV0 to UV9 No No No
is processed as an argument.

■ Function block argument


The arguments used in the function block only are as shown below.
Argument name/ Indirect Local Index
Argument type Description
device specifying (*) device (@) modify(:)
Device values or constants are
IN Any label No No No
used as argument for processing.
Written to the device that
OUT Any label No No No
specified the operation results.
IN-OUT Any label Devices are used as argument. No No Yes
Leading Leading relay (R) assigned to
UR UR0 to UR9 the unit is processed as an No No Yes
R argument.
Leading Leading data memory (DM)
Unit
UM UM0 to UM9 assigned to the unit is No No Yes
DM processed as an argument.
Unit number is processed as an
No. UV UV0 to UV9 No No No
argument.

■ 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

Device and Constant


INSTRUCTIONS

Local device list

The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through “CPU system setting” → “Assignment of all
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.

1-8 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
KV-5500/5000/3000 Series

Device List
1
■ Bit device

Device and Constant


When start Indirect
Local Index
*1 Number of operation specifying(*)*7
Device name Range Main functions device Modify
points (Power ON, Refer-
(@)*1 (:Z/:#) Store
PROG →RUN) ence
Device used for
R000 to R015
Input relay*9 capturing ON/OFF - Yes Yes Yes No
(R1000 to R99915*3) Total 15936
info from peripherals.
points for
Device used for
R500 to R507 input, output,
Output relay*9 outputting ON/OFF Clear/hold*4 Yes Yes Yes No
(R1000 to R99915*3) and internal
info from peripherals.
auxiliary
Devices that can be
Internal R508 to R915*2 relays.
used in CPU and Clear/hold*4 Yes Yes Yes No
auxiliary relay R1000 to R99915*3
expansion unit
Link relay B00 to B3FFF*8 16384 Clear/hold*4 No Yes Yes No
Internal Devices that can be
MR000 to MR99915 16000 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*6 Yes Yes Yes No
(contact) and up/down
counter contact
High-speed
High-speed counter
counter
CTC0 to CTC3 4 indirect specifying Clear/hold*6 No No No No
comparator
device
(contact)
Devices used for
controlling PLC
Control relay*5 CR000 to CR3915 640 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 R100 to R415, R508 to R915 are reserved for the system and cannot be used.
*3 R1000 to R99915 can be specified as extended I/O relay with Unit Monitor.
*4 Clear/Hold settings can be made in the "Power Failure Holding" option.
*5 "KV-5500/5000/3000 series User's Manual "CR/CM table""
*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 "DR" represents direct processing.
"KV-5500/5000/3000 series User's Manual "About direct processing""

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-9


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

■ Word device
When start Indirect
Local Index
Number of operation specifying(*)*7
Device name Range *1 Main functions device Modify
points (Power ON,
1
Refer-
(@)*1 (:Z/:#) Store
PROG →RUN) ence
*2 Yes Yes Yes Yes
Data memory DM0 to DM65534 65535 Clear/hold
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.

1-10 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Device and Constant

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

Device and Constant


Device values or constants are
Value V V0 to V9 No No No
used as argument for processing.
Leading device assigned to
Leading
UR UR0 to UR9 extended unit processed as No No Yes
R
argument
The leading device assigned to
Unit Leading
UM UM0 to UM9 extended unit is processed as No No Yes
DM
an argument.
Extended unit is processed as a
No. UV UV0 to UV9 No No No
constant.

■ Constant
Constant Range Main Functions
#0 to #65535 (unsigned 16-bit)
-32768 to +32767 (signed 16-bit) Used for specifying DEC constant.
DEC(#)
#0 to #4294967295 (unsigned 32-bit) * XYM Marking is represented by "K".
-2147483648 to +2147483647 (signed 32-bit)
-3.4+E38 ≤ N ≤ -1.4E-45
Single precision
N=0 Used for specifying single precision
floating point type
+1.4E-45 ≤ N ≤ +3.4E+38 floating point type real number.
real number
(Significant digit : 7 digit)
-1.79E+308 ≤ N ≤ -2.23E-308 Used for specifying double precision
Double precision
N=0 floating point type real number.
floating point type
+2.23E-308 ≤ N ≤ +1.79E+308 * Supported with CPU function
real number *
(Significant digit : 16 digit) version 2.0 and higher.
$0000 to $FFFF (16-bit) Used for specifying HEX constant.
HEX($)
$00000000 to $FFFFFFFF (32-bit) * XYM Marking is represented by "H".
Fixed text string
Example) "Type ABC", "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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-11


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

Local device list

The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through “CPU system setting” → “Assignment of all
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.

1-12 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
KV-1000 Series

Device List
1
■ Bit device

Device and Constant


Indirectly
When start Local Pointer specified (*)
*8
Device Number of
name Range*1 point Main functions operation device modify Refer-
Power (@)(@)*1 (: Z/: #) ence Source
( ON ) address
address
R000 to R015 Device used for capturing ON/
Input relay - Yes Yes Yes No
(R1000 to R59915*3) Total 9536 OFF info from peripherals.
points for input,
R500 to R507 Device used for capturing ON/
Output relay output, and Clear*4 Yes Yes Yes No
(R1000 to R59915*3) OFF info from peripherals.
internal auxiliary
R508 to R915*2 relays. Devices that can be used
Clear *4 Yes Yes Yes No
Internal auxiliary R1000 to R59915*3 in CPU and expansion unit
relay
MR000 to MR99915*5 16000 Clear Yes Yes Yes No
Devices that can be only
Internal auxiliary
used in CPU
relay LR000 to LR99915 16000 Hold Yes Yes Yes No
(Latch relay)

Timer 1ms, 10ms, 100ms down


T0 to T3999 counter/10ms contact device Clear Yes Yes Yes No
(contact) of up/down counter
Timer/Counter
4000 Devices that can be used
Counter
C0 to C3999 for up counter and up/down Hold*7 Yes Yes Yes No
(contact)
counter contact
High-speed
counter Device used for high-
CTC0 to CTC3 4 Hold*7 No No No No
comparator speed counter contact
(Contact)
Devices used for
controlling PLC function or
Control relay*6 CR000 to CR3915 640 - No No No No
capturing the status from
peripherals.

*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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-13


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

■ 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

numerical data (16-bit)


memory FM0 to FM32766*3 32767 points Hold*2 Yes Yes Yes Yes
Devices used for data
Temporary storage, simple indirect
TM0 to TM511 512 Clear Yes Yes Yes Yes
data memory specifying, and 4 arithmetic
operations (16-bit)
1ms, 10ms, 100ms down Current value :
Timer
counter, 10ms current clear*5
(Current value/ T0 to T3999 Yes Yes Yes No
value/setting value of up/ Setting value :
setting value) Timer/Counter down counter (32-bit) hold
4000
Counter
Up counter, up/down
(Current value/ C0000 to C3999 Hold*7 Yes Yes Yes No
counter (32-bit)
setting value)
High-speed counter High-speed counter
CTH0 to CTH1 2 Hold*7 No No No No
(current value) current value (32-bit)
High-speed counter
High-speed counter
comparator CTC0 to CTC3 4 Hold No No No No
setting value (32-bit)
(set value)
Devices that can be used in
Index register Z1 to Z12*6 12 Clear No No No No
index modify (16-bit)
Devices used for controlling
Control
CM0 to CM11998 11999 points PLC function or capturing the - No No No No
memory*4
status from peripherals (16-bit).

*1 The range of the global devices that can be used is restricted by number of devices that is reserved for the local
devices.
"Local device list" (Page 1-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.

KV-1000 PLC Programming Manual "3-2 Before A Macro is Used"

1-14 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Device and Constant

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)

Device and Constant


Single precision -3.4E+38 ≤ N ≤-1.4E-45
N =0 Use for specifying single precision
floating point type
+1.4E-45 ≤ N ≤+3.4E+38 floating point type real number
real number (Significant bits : 7 digit)
$0000 to $FFFF (16-bit)
HEX($) Use for specifying HEX constant
$00000000 to $FFFFFFFF (32-bit)
Fixed text string Used for specifying a fixed text
Example) "Type ABC", "Month/08 :30 :15"
("") string.

■ 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)

Local device list

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-15


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

*2 When a project is created, the device area used for global devices can be guaranteed as a whole (this
area is calculated according to the assumption that 10 modules are used and 50 macros are called).
The number of reserved devices can be changed as required.
*3 Number can be set in “ch” unit.
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

only in device editing. (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-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.

1-16 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
KV Nano Series

Device List
1
■ Bit device

Device and Constant


Index Indirect
Start of Operation Local *2
Device Number of Main Modifica Specification (*)
Range*1 Device
Name Points Function PROG  tion
Power On (@)*1
RUN (:Z/:#) Reference Storage
Devices used to
R000 to R203*4 capture ON/OFF
Input relay*3 Yes Yes Yes No
(R1000 to 59915*5) information from
Total 9600 peripherals
points for the Devices used to
R500 to R607*6 input, output, output ON/OFF Clear Clear
Output relay*3 Yes Yes Yes No
(R1000 to 59915*5) and internal information to
auxiliary relays peripherals
Devices used by
Internal
R1000 to R59915*3 the CPU and by Yes Yes Yes No
auxiliary relay
expansion units
Link relay B00 to B1FFF*8 8192 Devices that can Clear Clear No Yes Yes No
Internal only be used
MR000 to MR59915 9600 internally by the Clear Clear Yes Yes Yes No
auxiliary relay
Latch relay LR000 to LR19915 3200 CPU Hold Hold Yes Yes Yes No
Among T0 to Among T0 to
Contact device for
T9, only holds T9, only holds
the 10 μs, 1 ms, 10
the devices the devices
ms, and 100 ms
Timer (contact) T0 to T511 512 that are being that are being Yes Yes Yes No
down timers and
used by the used by the
for the 10 ms up/
UDT UDT
down timer
instruction instruction
Contact device for
Counter the up counter and Clear and
C0 to C255 256 Hold Yes Yes Yes No
(contact) the up/down hold*7
counter
High-speed
Contact device for
counter
CTC0 to CTC7*9 8*9 the high-speed Hold Hold No No No No
comparator
counters
(contact)
Devices used to
control the PLC
Control relay CR000 to CR8915 1440 functions and to Clear Clear No No No No
capture the PLC
status

*1 Because this is used as a local device, the applicable range of global devices is limited by the number
of reserved local devices. "KV Nano Series User's Manual "List of Local Devices""
*2 The devices that have "Yes" in the Storage column can be written as "* (device)." The devices that
have "Yes" in the Reference column can be specified indirectly.
"KV Nano Series User's Manual "Indirect Specification""
*3 To perform direct processing, write "DR."
*4 The range of devices that can be used varies according to the unit.
KV-N14**: R000 to R007. KV-N24**: R000 to R013. KV-N40**: R000 to R107.
KV-N60**: R000 to R203. KV-NC32T: R000 to R015
*5 You can use the Unit Editor to set R1000 to R59915 to expansion I/O relays.
The unassigned input and output relays that have numbers smaller than R1000 are reserved for the
system, so you cannot use these relays.
*6 The range of devices that can be used varies according to the unit.
KV-N14**: R500 to R505. KV-N24**: R500 to R509. KV-N40**: R500 to R515.
KV-N60**: R500 to R607. KV-NC32T: R500 to R515
*7 You can change the clear/hold setting by using "Power off holding" in the CPU system settings (this
only applies to contacts and current values).
*8 Use hexadecimal numbers to specify the device numbers.
*9 The range of devices that can be used varies according to the unit.
KV-N14**: CTC0 to CTC3 (4). KV-N24**: CTC0 to CTC3 (4). KV-N40**: CTC0 to CTC5 (6).
KV-N60**: CTC0 to CTC7 (8). KV-NC32T: CTC0 to CTC5 (6)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-17


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

■ 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

numerical data (16 bit) Clear and


Link register W0 to W3FFF*5 16384 Hold No Yes Yes Yes
hold*3
Temporary Devices that can store
TM0 to TM511 512 Clear Clear Yes Yes Yes Yes
memory numerical data (16 bit)
Among T0 to Among T0 to
Current value and set
Timer T9, only holds T9, only holds
value of the 10 μs, 1 ms,
(current value the devices the devices
T0 to T511 512 10 ms, and 100 ms down Yes Yes Yes No
and that are being that are being
timers and of the 10 ms
set value) used by the used by the
up/down timer (32 bit)
UDT instruction UDT instruction
Current value and set
Counter
value of the down counter Clear and Clear and
(current value C0 to C255 256 Yes Yes Yes No
and up/down counter hold*4 hold*4
and set value)
(32 bit)
High-speed Current value of the
CTH0 to
counter 4*6 high-speed counter Hold Hold No No No No
CTH3*6
(current value) (32 bit)
High-speed
Set value of the
counter CTC0 to
8*6 high-speed counter Hold Hold No No No No
comparator CTC7*6
(32 bit)
(set value)
Devices that are used with
Index register Z1 to Z12*7 12 Clear Clear No No No No
index modification (32 bit)
Devices used to control
the PLC functions and to
Control memory CM0 to CM8999 9000 Hold*8 Hold*8 No Yes Yes No
capture the PLC status
(16 bit)
*1 Because this is used as a local device, the applicable range of global devices is limited by the number
of reserved local devices.
"Local device list" (Page 1-8)
*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 You can change the clear/hold setting by using "Power off holding" in the CPU system settings. Up to
3072 words worth of data can be held in total over all of the devices whose values can be held when
the power turns off.
*4 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).
*5 Use hexadecimal numbers to specify the device numbers.
*6 The range of devices that can be used varies according to the unit.
KV-N14**: CTH0 and CTH1 (2), CTC0 to CTC3 (4). KV-N24**: CTH0 and CTH1 (2), CTC0 to CTC3
(4).
KV-N40**: CTH0 to CTH2 (3), CTC0 to CTC5 (6). KV-N60**: CTH0 to CTH3 (4), CTC0 to CTC7 (8).
KV-NC32T: CTH0 to CTH2 (3), CTC0 to CTC5 (6)
*7 Z11 and Z12 are reserved for the system, so you cannot use these devices.
*8 Only for devices that need to be held. For details on the target devices, see "CR/CM List" (Page
A-71).

1-18 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
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

Device and Constant


Device P P0 to P9 No No Yes
argument.
The device's value or constant
Value V V0 to V9 No No No
is received as the argument.
The leading relay (R) assigned
Leading
UR UR0 to UR9 to the expansion unit is received No No Yes
R
as the argument.
The leading data memory (DM)
Leading entry assigned to the expansion
Unit UM UM0 to UM9 No No Yes
DM unit is received as the
argument.
The unit number of the
Number UV UV0 to UV9 expansion unit is received as No No No
the argument.

"KV Nano Series User's Manual "Setting Arguments""

■ 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-19


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

Local device list

The number of local and global devices that are reserved when you create a project and the default ranges
of these devices are shown below. To change the reserved number of local devices, from the workspace,
1 open the "CPU system setting" dialog box, and then click "Entire assignment setting of local devices."
Local Device Global Device
Device and Constant

Reserved Number of Total Number of


Device Name*1 Number of Devices
Devices in the Entire Devices
and Range
Project*2
9600 (600 channels) 9600
Relay (R)*3 None
R000 to R59915 (600 channels)
1600 8000 (500 channels) 9600
Internal auxiliary relay (MR)*3
(100 channels) MR000 to MR49915 (600 channels)
320 3560 (180 channels) 3200
Latch relay (LR)*3
(20 channels) LR000 to LR17915 (200 channels)
412
Timer (T)*4 100 512
T0 to T411
206
Counter (C)*4 50 256
C0 to C205
27768
Data memory (DM) 5000 32768
DM0 to DM27767
512
Temporary data memory (TM) None 512
TM000 to TM511
*1 Link relays (B), link registers (W), high-speed counters (CTH), high-speed counter comparators
(CTC), control relays (CR), control memory entries (CM), and index registers (Z) cannot be used
as local devices.
*2 When you create a new project, ensure that the area is large enough for all the devices that can
be used as local devices. (To calculate the area, assume that 10 modules will be used and that
there will be 50 macro calls.)
You can freely change the number of reserved devices.
*3 Set the number of devices used in units of channels (ch).
*4 You have to write this as "@device number" only when you want to specify the device number as
the operand of a timer or counter instruction. (Mnemonic input example:TMR @0 #100)

• 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.

1-20 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
Device Notation Method

● Writing index modification (modification according to index registers and


according to index constants) 1

Device and Constant


• Modification according to index registers
Continuously enter :Z□ (□: numerical value 1 to 10) after device (R (DR) / MR / LR / B / T / C / DM /
EM / FM / ZF / W / TM / *DM / *EM / *FM / *ZF / *W / *TM).

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.

• The EM, FM can not be used in KV Nano series.


Point • The modification by index register towards CM is only possible for KV Nano
series.

• Modification according to index constants


Continuously enter :#□ (□: -131072 to +131072) after device (R (DR) / MR / LR / B / T / C / DM /
EM / FM / ZF / W / TM / *DM / *EM / *FM / *ZF / *W / *TM).

Example
DM0:#1 This means DM1.
R1000:#1 This means R1001.

• The EM, FM can not be used in KV Nano series.


Point • The modification by index constant towards CM is only possible for KV Nano
series.

● Writing indirect specification (*)


Enter * in front of device (DM / EM / FM / ZF / W / TM). It is to be used together with indirect designation
command.

Example *DM0 *TM100

Point The EM, FM can not be used in KV Nano series.

● Writing local devices


Enter @ in front of device (R/MR/LR/T/C/DM/EM/FM/TM).
These devices are only valid in modules and macros. You can also perform indirect specification and
index modification.

Example
@DM0 @R10000

Point The EM, FM can not be used in KV Nano series.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-21


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

● XYM marking
The designation of device by XYM notation of the list below is possible for device (R(DR)/MR/LR/DM/
EM/FM).

1 Device Name
KEYENCE
Marking
XYM Marking
Device Number during XYM
Marking
Device and Constant

X (DX) 0000 to 999F*1


Relay R (DR)
Y (DY) 0000 to 999F*1

Internal auxiliary relay MR M 00000 to 63999*1 *2

Latch relay LR L 000 to 999F*1

Data memory DM D 00000 to 65534*1

Expansion data memory EM E 00000 to 65534

File register FM F 00000 to 32767

*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”.

Point The EM, FM can not be used in KV Nano series.

1-22 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Suffix

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:

□.U □.S □.D □.L □.F □.DF


*□ is an instruction corresponding to the suffix.

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

□.U is processed as unsigned 16-bit BIN data. (0 to 65535)


□.S is processed as signed 16-bit BIN data. (-32768 to +32767)
□.D is processed as unsigned 32-bit BIN data. (0 to 4294967295)
□.L is processed as signed 32-bit BIN data. (-2147483648 to +2147483647)
□.F is processed as single precision floating point type real number. (For the KV Nano Series, it can
only be used in the range of a normal number.)

-3.4E+38 ≤ N ≤-1.4E-45
N =0
+1.4E-45 ≤ N ≤+3.4E+38
(Significant bits : 7 digit)

□.DF is processed as double precision floating point type real number.


-1.79E+308 ≤ N ≤ -2.23E-308
N=0
+2.23E-308 ≤ N ≤ +1.79E+308
(Significant bits : 16 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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-23


BRIEF EXPLANATION OF

Suffix
INSTRUCTIONS

Difference between .U and .S


□.U BIN data is processed as unsigned 16-bit data.
□.S BIN data is processed as signed 16-bit data.

1 Thus, the relationship between BIN data and corresponding DEC representation of suffix is shown
below.
Suffix

BIN BIN 1111111111111111


□ .U Unsigned DEC 65535
□ .S Signed DEC -1
For constant, please see " Data Processing" (Page 1-26).

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)

If the suffix is .S, the value of DM0 is -1.


DM0
> .S LD.S> DM0 #100
#100
Thus, if DM0<#100, the contact becomes OFF.
(-1)

Difference between .D and .L


□.D BIN data is processed as unsigned 32-bit data.
□.L BIN data is processed as signed 32-bit data.
Thus, the relationship between BIN data and corresponding DEC representation of suffix is shown
below.
BIN BIN 11111111111111111111111111111111
□.D Unsigned DEC 4294967295
□.L Signed DEC -1
"Data Processing" (Page 1-26)

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)

If the suffix is .L, the value of DM0/DM1 is -1.


DM0
> .L LD.L> DM0 #100
#100
Thus,DM1 (high bit) /DM0 (low bit)< #100, the contact becomes OFF.
(-1)

1-24 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Suffix

INSTRUCTIONS
Reference For data transfer, the execution result is the same when either .U or .S in the suffixes is
used.

LDA, STA, MOV etc.

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

Example for sending DM0/DM1 to DM10/DM11 using LDA, STA instruction.

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

32-bit internal register

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-25


Data Processing
BRIEF EXPLANATION OF
INSTRUCTIONS

There are 5 types of processable value in ladder program: BIN, DEC (unsigned/signed), HEX, BIN-
coded DEC (BCD) and float real number (single precision/double precision).
The text strings, ASCII codes/Shift-JIS codes can also be processed.

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)".

■ 16-bit BIN data


16-bit BIN data is generally processed by unit of "word". These can be represented as 0 to 65535 when
it is unsigned DEC.
(Example)

Higher bits

bit bit bit bit


15 8 7 0

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

0 + 0 +8192 + 0 + 0 +1024+512 +256 + 0 +0 +0 +16 + 0 +0 +0 +0 = 10000

■ 32-bit BIN data


32-bit data (2 words) can represent unsigned DEC data of 0 to 4294967295.

Higher bits

bit bit bit bit bit bit bit bit


31 24 23 16 15 8 7 0

Higher 16 bits Lower 16 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.

■ 64-bit BIN data


The 64-bit (4-word) data can represent the following value for a double precision floating point type real
number: -1.79E+308≤N≤-2.23E-308, N=0, +2.23E-308≤N≤+1.79E+308 (number of effective digits:
approx. 16 digits)
Higher bits

bit bit bit bit bit bit bit bit


63 48 47 32 31 16 15 0

16-bit 16-bit 16-bit 16-bit

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.

1-26 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Data Processing

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

bit bit bit bit


15 8 7 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
32768163848192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 DEC number
(Example) 0110110100110001

Reference BIN data cannot be entered as instruction operand.

■ 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-27


BRIEF EXPLANATION OF

Data Processing
INSTRUCTIONS

■ BIN coded DEC


Both BIN-coded DEC and HEX process BIN 4 bits as 1 bit. The same with DEC system, the bit is
carried if bigger than 9, thus A to F symbols are not used.

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

bit bit bit bit


15 8 7 0
0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1

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.

■ Single precision floating point type real number


The single precision floating point type real number are processed by taking 32-bit data as value with
DEC points.
The value within the following range can be used (N) .
-3.4×10 38 ≤ N ≤ -1.4×10 -45
N= 0
+1.4×10-45 ≤ N ≤ +3.4×1038

Reference • These can be entered as instruction operand.


These cannot be represneted by the exponent of "E", apart from representation with
common DEC points (e.g.: -1.2345) .
(Example) -2.743×1012 → -2.743E12
+8.9025×10-4 → +8.9025E-4
• As single precision floating point type real number are processed at a single precision of
32-bits, the effective number of digits becomes 7 digits.
• 32-bit data register saving single precision floating point type real number is
represented by IEEE standard form.
• For the KV Nano Series, it can only be used in the range of a normal number*.
* Normal number range: 0 and absolute value of 1.2x10-38 to 3.4x1038
1-28 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
BRIEF EXPLANATION OF
Data Processing

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)

• These can be entered as instruction operand.


Reference
These cannot be represneted by the exponent of "E", apart from representation with
common DEC points (e.g.: -1.2345) .
(Example) -2.743×1012 → -2.743E12
+8.9025×10-4 → +8.9025E-4
• As double precision floating point type real number are processed at a double precision
of 64-bits, the effective number of digits becomes 16 digits.
• 64-bit data register saving double precision floating point type real number is
represented by IEEE standard form.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-29


BRIEF EXPLANATION OF

Data Processing
INSTRUCTIONS

Relationship Between Numerical Representation

The correlation between BIN, DEC (unsigned/signed), HEX, BIN-coded DEC (BCD) is represented below.
1
■ 16-bit data
Data Processing

DEC HEX BIN Coded


BIN BIN
Unsigned Signed (HEX) DEC(BCD)
0 +0 0 0000 0000 0000 0000 0000 0000 0000 0000 0000
1 +1 1 0000 0000 0000 0001 0001 0000 0000 0000 0001
2 +2 2 0000 0000 0000 0010 0002 0000 0000 0000 0010
3 +3 3 0000 0000 0000 0011 0003 0000 0000 0000 0011
4 +4 4 0000 0000 0000 0100 0004 0000 0000 0000 0100
5 +5 5 0000 0000 0000 0101 0005 0000 0000 0000 0101
6 +6 6 0000 0000 0000 0110 0006 0000 0000 0000 0110
7 +7 7 0000 0000 0000 0111 0007 0000 0000 0000 0111
8 +8 8 0000 0000 0000 1000 0008 0000 0000 0000 1000
9 +9 9 0000 0000 0000 1001 0009 0000 0000 0000 1001
10 +10 A 0000 0000 0000 1010 0010 0000 0000 0001 0000
11 +11 B 0000 0000 0000 1011 0011 0000 0000 0001 0001
12 +12 C 0000 0000 0000 1100 0012 0000 0000 0001 0010
13 +13 D 0000 0000 0000 1101 0013 0000 0000 0001 0011
14 +14 E 0000 0000 0000 1110 0014 0000 0000 0001 0100
15 +15 F 0000 0000 0000 1111 0015 0000 0000 0001 0101
16 +16 10 0000 0000 0001 0000 0016 0000 0000 0001 0110

99 +99 63 0000 0000 0110 0011 0099 0000 0000 1001 1001
100 +100 64 0000 0000 0110 0100 0100 0000 0001 0000 0000

32767 +32767 7FFF 0111 1111 1111 1111 0999 0000 1001 1001 1001
32768 -32768 8000 1000 0000 0000 0000 1000 0001 0000 0000 0000

65534 -2 FFFE 1111 1111 1111 1110 9998 1001 1001 1001 1000
65535 -1 FFFF 1111 1111 1111 1111 9999 1001 1001 1001 1001

1-30 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Data Processing

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

99 +99 63 0000 0000 0000 0000 0000 0000 0110 0011


100 +100 64 0000 0000 0000 0000 0000 0000 0110 0100

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

Binary Coded DEC(BCD) BIN


00000000 0000 0000 0000 0000 0000 0000 0000 0000
00000001 0000 0000 0000 0000 0000 0000 0000 0001
00000002 0000 0000 0000 0000 0000 0000 0000 0010
00000003 0000 0000 0000 0000 0000 0000 0000 0011
00000004 0000 0000 0000 0000 0000 0000 0000 0100
00000005 0000 0000 0000 0000 0000 0000 0000 0101
00000006 0000 0000 0000 0000 0000 0000 0000 0110
00000007 0000 0000 0000 0000 0000 0000 0000 0111
00000008 0000 0000 0000 0000 0000 0000 0000 1000
00000009 0000 0000 0000 0000 0000 0000 0000 1001
00000010 0000 0000 0000 0000 0000 0000 0001 0000
00000011 0000 0000 0000 0000 0000 0000 0001 0001
00000012 0000 0000 0000 0000 0000 0000 0001 0010
00000013 0000 0000 0000 0000 0000 0000 0001 0011
00000014 0000 0000 0000 0000 0000 0000 0001 0100
00000015 0000 0000 0000 0000 0000 0000 0001 0101
00000016 0000 0000 0000 0000 0000 0000 0001 0110

00000099 0000 0000 0000 0000 0000 0000 1001 1001


00000100 0000 0000 0000 0000 0000 0001 0000 0000

00000999 0000 0000 0000 0000 0000 1001 1001 1001


00001000 1000 0000 0000 0000 0001 0000 0000 0000

99999998 1001 1001 1001 1001 1001 1001 1001 1000


99999999 1001 1001 1001 1001 1001 1001 1001 1001

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-31


BRIEF EXPLANATION OF

Data Processing
INSTRUCTIONS

■ Value change when exceeding max. or min.


When the calculated results exceed the max./min. value, the following data changes are available
according to data types.

1 ● For 16-bit data


Value change for 65535 above Value change when exceeding max. or min.
Data Processing

Unsigned DEC HEX Signed DEC HEX


3 0003 3 0003
2 0002 2 0002
1 0001 1 0001
0 0000 0 0000
65535 FFFF -1 FFFF
65534 FFFE -2 FFFE
65533 FFFD -3 FFFD
65532 FFFC -4 FFFC
… … … …
32771 8003 -32765 8003
32770 8002 -32766 8002
32769 8001 -32767 8001
32768 8000 -32768 8000
32767 7FFF 32767 7FFF
32766 7FFE 32766 7FFE
32765 7FFD 32765 7FFD
32764 7FFC 32764 7FFC

● For 32-bit data


Value change for 4294967295 above Value change when exceeding max. or min.
Unsigned DEC HEX Signed DEC HEX
3 00000003 3 00000003
2 00000002 2 00000002
1 00000001 1 00000001
0 00000000 0 00000000
4294967295 FFFFFFFF -1 FFFFFFFF
4294967294 FFFFFFFE -2 FFFFFFFE
4294967293 FFFFFFFD -3 FFFFFFFD
4294967292 FFFFFFFC -4 FFFFFFFC
… … … …
2147483651 80000003 -2147483645 80000003
2147483650 80000002 -2147483646 80000002
2147483649 80000001 -2147483647 80000001
2147483648 80000000 -2147483648 80000000
2147483647 7FFFFFFF 2147483647 7FFFFFFF
2147483646 7FFFFFFE 2147483646 7FFFFFFE
2147483645 7FFFFFFD 2147483645 7FFFFFFD
2147483644 7FFFFFFC 2147483644 7FFFFFFC
2147483643 7FFFFFFB 214748364 7FFFFFFB

Reference In the case of single precision floating point type data


Overflow: it turns into "∞( infinitely large)" when the absolute value is larger than
3.4x1038.
Underflow: it turns into "0" when the absolute value is smaller than 1.4x10-45 (for the KV
Nano Series, only in the range of a normal number, so 1.2x10-38).

0 1.4×10-45 3.4×1038
(1.4E-45) (3.4E38)

0 (display as “----“)

In the case of double precision floating point type data


Overflow: it turns into " ∞ ( infinitely large)" when the absolute value is larger than
1.79x10308.
Underflow: it turns into "0" when the absolute value is smaller than 2.23x10 -308.

0 2.23×10-308 1.79×10308
(2.23E-308) (1.79E+308)

0 (display as “----“)

1-32 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Data Processing

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

"ASCII Code Table" (Page A-115)

■ Shift JIS code


16 bits are used to represent 1 SBC case text code.

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-33


Every-scan Execution Type and Differential Execution Type
BRIEF EXPLANATION OF
INSTRUCTIONS

There are two types of instructions: "every-scan execution type and differential execution type" (pulse execution
type). For "every scanning execution type", execute this instruction for every scanning if the execution condition is
established (ON) ; for "differential execution type", execute one time at the rising edge if the execution condition is
established (ON), otherwise execute one time at the falling edge if the execution condition is unestablished (OFF).
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

● Every-scan execution type


These instructions will be executed during every scanning when the execution condition is established (ON).

Execution condition Scan


Instruction ON

Execution condition 1 scan


OFF

Instruction Unprocessed Perform Unprocessed Perform Unprocessed

● Differential execution type


These instructions will be executed during every scanning only at the rising edge or falling edge of the
execution condition.

Execution condition Scan


Instruction ON

Execution condition 1 scan


OFF

Instruction Unprocessed Unprocessed Unprocessed


Only once Only once

■ Detect the condition of execution condition's rising/falling edge


The differential execution type instructions permit to compare the previous value with current value of
execution conditions, and detect the change of state from OFF to ON as the rising edge, or the change
of state from ON to OFF as falling edge.

ON ON ON ON OFF OFF OFF ON ON ON OFF OFF OFF ON ON ON ON

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.

About initialization of previous value


When power-on or PROG → RUN, or when starting to execute module/macro instructions as well as
during RUN period,
For rising edge differential execution type instructions, the previous value will be initialized as ON; for
falling edge differential execution type instructions, the previous value will be initialized as OFF.

1-34 - 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
■ 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

Every-scan Execution Type and Differential Execution Type


scanning, or isn't executed within the continuous scanning time of [n]th sub-routine program and
[n+1]th sub-routine execution.

R000 #0
CALL

END

SBN
#0
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

Previous This time

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-35


BRIEF EXPLANATION OF

Every-scan Execution Type and Differential Execution Type


INSTRUCTIONS

When differential execution type instructions are executed over 2 times during one scanning.
Program scan

This time

1 n-1 Subroutine n n+1


Every-scan Execution Type and Differential Execution Type

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.

(2) When used between STP and STE instructions


The previous value of differential coefficient detection device (execution condition of differential coefficient
execution type instruction) is under the state when routine between STP-STE instruction program is executed.
When the number of times of execution of the program between the STP instruction and the STE instruction is
expressed by n, then the previous value of the [n+1]th instruction is in the state of the nth instruction.
Due attention shall be paid if the programs between STP and STE instructions are not executed continuously during n-th and [n+1]th.

STP
R000
Differential detection device
R001 DM0 DM1
LDA STA

STE

Program scan

Previous This time

n-1 Programs between STP n n+1


and STE
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.
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

Every-scan Execution Type and Differential Execution Type


the nth instruction.
Due attention shall be paid if the programs in stage are not executed continuously during n-th and n+1-th.
Differential detection device
R1100 R000 R1000 R500 #30 T0
STG ↑ T0 JMP
R1000
Program scan

Previous This time

n-1 Programs in stage n n+1

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-37


BRIEF EXPLANATION OF

Every-scan Execution Type and Differential Execution Type


INSTRUCTIONS

(4) When used between CJ/NCJ and LABEL instructions


The previous value of differential coefficient detection device (execution condition of differential
coefficient execution type instruction) is under the state when routine between previous CJ/NCJ to

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

continuously during [n]th and [n+1]th.

R000 CJ
#10

Differential detection device


R001 DM0 DM1
LDA STA

LABEL
#10

Program scan

Previous This time

n-1 Programs between n n+1


CJ and LABEL

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.

(5) When used between FOR and NEXT instructions


The previous value of the differential detection device (execution condition of differential execution type
instruction) is under the state when the routine between the FOR-NEXT instruction program is
executed. When the number of times of execution of the program between the FOR instruction and the
NEXT instruction is expressed by n, then the previous value of the [n+1]th instruction is in the state of
the nth instruction.
For example, when choosing the execution condition for the rising-edge, MR0, between the FOR-NEXT
instructions, it is executed in the ON condition for the starting first instance only and executed in the
OFF condition from the second instance on.

1-38 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Conventions and Cautions in Operand List

BRIEF EXPLANATION OF
INSTRUCTIONS
The section describe the conventions and cautions used in the operand list of various instructions.

Cautions in Operand Related to Specifying Device

The following describe the conventions used in the operand list and basic cautions for specifying
1

Conventions and Cautions in Operand List


device.
Available Devices ( ): Not supported on the KV-1000
Index
Cons Indirect Local Modify
Bit device Word device*1
Operand tant specifying 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 ○ ○ ○ ○ ○ ○ ○ ○ ○ − − − − − ○ − − ○ ○ ○

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.

Processing of Bit Device and Word Device T, C, CTH, CTC

When specifying device T, C, CTH, CTC in the operand, process as follows:


Word device
Bit device
Current value Setting value
T, C Contact The instructions other than STA Instruction
STA instruction
CTH - All instructions -
CTC Contact - All instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-39


BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

Word Unit Processing of Bit Device

In general (i.e. sequence instruction), the bit device is processed as 1-bit device.
1
R006 R30500
Conventions and Cautions in Operand List

1 bit between R006 and R30500 as


processed object in the case of above instruction.

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

bit DM0 bit


15 0

1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

MOV.D
R30000 DM0

R30115 R30100 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

bit DM1 bit bit DM0 bit


15 0 15 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-40 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

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

Conventions and Cautions in Operand List


301ch 300ch

1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

R30604 R30505
306ch 305ch

1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

Point • The processing speed will decline when processing the word unit by straddling
channel.
• Only when using the KV-1000 series, if the operand is set with a bit 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

16-bit internal register

R30602 R30601 R30503

? ? ? 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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-41


BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

Bit Device Processing of Word Device

In general, the word device is processed as 16-bit or 32-bit device.


1 "Bit contact instruction" and "bit output instruction" may be employed to process the word device as any bit device.
● Specify LSB
Conventions and Cautions in Operand List

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

Reference Bits other than LSB do not change.

● Specify the bit position


Specify the bit position of word device in the following operand of instruction words only when
KV-7000 series, KV-5000/3000 series or KV Nano series are used.
Destination instruction word: LD, LDB, AND, ANB, OR, ORB, LDP, ANP, ORP, LDF, ANF, ORF,
LDPB, ANPB, ORPB, LDFB, ANFB, ORFB, OUT, OUB, SET, RST, ALT, KEEP, DIFU,
DIFD

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

1-42 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

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

Conventions and Cautions in Operand List


• Specify through specifying constant
• Specify through indirect specifying (#TM)

For the each device, see "Device and Constant" (Page 1-5).

Specify global device in the operand

■ Specify device
Specify directly by circling the device with "○" in operand using .

Example) MOV instruction

Available devices ( ): Not supported on the KV-1000


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)

S ƻ  ƻ    ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ

D ƻ  ƻ    ƻ ƻ ƻ ƻ ƻ ƻ ƻ ƻ  ƻ ƻ ƻ ƻ ƻ

MOV
DM1000 DM10

■ Specify the device with indirect specifying (*)


In the device DM/EM/FM/TM specified in 2nd operand of ADRSET instruction, the device with "*DM/
*EM/*FM/*TM" 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

Available devices ( ): Not supported on the KV-1000 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 ƻ  ƻ    ƻ           ƻ ƻ ƻ

ADRSET
MR1000 EM0

ITVL
PLS

DM0
PAUSE

ˆEM0
RES

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-43


BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

■ Specify the device with index modification


Specify the index modification by circling the device with " ○ " in operand using along with
symbol (:#/ :Z).

1 Example) ITVL instruction


Conventions and Cautions in Operand List

Available devices ( ): Not supported on the KV-1000 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 device with index modification and indirect specifying


In the device DM/EM/FM/TM specified in 2nd operand of ADRSET instruction, the device with "*" 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

Available devices ( ): Not supported on the KV-1000 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 ƻ  ƻ    ƻ           ƻ ƻ ƻ

ADRSET
MR1000 EM0

ITVL
PLS

DM0
PAUSE

ˆEM0:Z1
RES

1-44 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

INSTRUCTIONS
Specify local device in the operand

■ Specify local device


Through circling with in the operand, specify the device with "○" by marking a prefix "@". 1
Example) ITVL instruction

Conventions and Cautions in Operand List


Available devices ( ): Not supported on the KV-1000 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
RES

Point DR,B,W,ZF local device (@) cannot be used.

■ Specify the local device with indirect specifying (*)


In the local device @DM/@EM/@FM/@TM specified in 2nd operand of ADRSET instruction, *@DM/
*@EM/*@FM/*@TM with "*" 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

Available devices ( ): Not supported on the KV-1000 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 ƻ  ƻ    ƻ           ƻ ƻ ƻ

ADRSET
MR1000 @EM0
ITVL
PLS
DM0
PAUSE
ˆ@EM0
RES

Point DR,B,W,ZF local device (@) cannot be used.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-45


BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

■ Specify the local device with index modification


Specify index modification by circling the device with " ○ " in the operand using , and adding a
prefix "@" (@MR, @DM) .

1 Example) ITVL instruction

Available devices ( ): Not supported on the KV-1000


Conventions and Cautions in Operand List

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

Point DR,B,W,ZF local device (@) cannot be used.

■ 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

Available devices ( ): Not supported on the KV-1000 Index


Indirect Local modify
Bit device Word device Const specifying 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)

D1        ƻ ƻ      ƻ   ƻ ƻ ƻ

D2 ƻ  ƻ    ƻ           ƻ ƻ ƻ

ADRSET
MR1000 @EM0

ITVL
PLS

DM0
PAUSE

ˆ@EM0:Z1
RES

Point DR,B,W,ZF local device (@) cannot be used.

1-46 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

INSTRUCTIONS
Specify constant in the operand

Specify directly the constant in the operand when "○" exists in the constant column.

Available devices ( ): Not supported on the KV-1000


Indirect Local
Index 1
Bit device Word device Const specifying device modify

Conventions and Cautions in Operand List


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 ƻ  ƻ    ƻ         ƻ  ƻ ƻ ƻ

MOV MOV
#1000 DM10 $10AB DM10

Specify the indirect specifying in the operand (#TM)

When " ○ " exists in the indirect specifying (#TM) column, specify in the operand by adding "#" before
TM0 to TM511.

Available devices ( ): Not supported on the KV-1000 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 ƻ  ƻ    ƻ          ƻ ƻ ƻ ƻ

+1.2345
DW.F
#TM1

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-47


BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

Other Matters Needing Attention

■ Precautions relating to the instruction size


1 During programming, pay attention to the program size (specify the total bytes), item size, operand size
(only for the KV Nano Series), and the use of the internal working area. If any item exceeds the
Conventions and Cautions in Operand List

specified size, error may occur during program conversion.


For the byte size, item size, operand size (only for the KV Nano Series), and the capacity of internal
working area for various instructions, refer to "Instruction Size Table" (Page A-40).

■ Precautions Relating to Device Assignments


When using and processing the instructions of multiple devices (BMOV, etc), the generation procedure
should not exceed the range of global device or local device.
For information about the assignment range of devices, refer to "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".
■ Instruction that cannot be used
Some instruction words cannot be used in the initialization and fixed-period modules, macro/sub-
routine and interruption programs.
"Instruction Table Cannot be Used" (Page A-116)

■ Precautions relating to processing speed


• If the suffixes include.D/.L/.F , employ even-numbered device to specify 16-bit word devices, such as
DM/EM/FM/TM, in the instruction operand of processing 32-bit data.
Otherwise, if 2 odd-numbered words are used for specifying, the processing speed will slow down. In
addition, use even-number for local device.
• When the suffix is .DF, use an even number device to specify a 16-bit word device such as DM/EM/
FM/TM in the instruction code operand which handles 64-bit data.
If four words starting from an odd number are used, the processing speed will drop. Use an even
number in the same manner for local devices.
• If this bit device is at the starting position of specified channel, the processing speed will slow down
when straddling the next channel for processing bit device.

1-48 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


BASIC INSTRUCTIONS
2
BASIC INSTRUCTIONS
This chapter explains the most basic instructions for writing a sequence
control program.
Through these instructions, same mechanical control as with the general
relay sequence circuit can be realized.

Contact Instructions .............................................................. 2-2


Bit contact instructions .......................................................... 2-8
Compare Contact Instructions............................................. 2-12
Output Instructions .............................................................. 2-16
Bit output instructions .......................................................... 2-32
Timer/Counter Instructions .................................................. 2-36
Connection/End Instruction ................................................. 2-60
Direct I/O instructions .......................................................... 2-72

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-1


Contact Instructions
LD Connected in
parallel to NO
contact.

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano LDB Connected in


parallel to NC
LD,LDB,ANDB,AND,ANB,OR,ORB contact.
AND Connected in series
to NO contact.
BASIC INSTRUCTIONS

ANB Connected in series

LD
to NC contact.
OR Connected in

Load Connected in parallel to NO contact. ORB


parallel to NO
contact.
Connected in
parallel to NC
contact.

LDB Load bar Connected in parallel to NC contact.

AND AND Connected in series to NO contact.

ANB AND bar Connected in series to NC contact.

2 OR OR Connected in parallel to NO contact.

ORB
Contact Instructions

OR bar Connected in parallel to NC contact.

Ladder program Input mode

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

Available Devices ( ): Not supported on the KV-1000 Index


*1 Indirect Local modifi
Bit device Word device Const specifying Device cation
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 *4 *3 - - - - - - - *2 *2

Operand Explanation
S Specifies the bit to be connected to the left power rail.

*1 When word device is specified in S , state of the LSB is loaded.


KV-7500/7300/5500/5000/3000, KV Nano Series Bit specifying of word device can be performed.

KV-1000 BLD/LBDB instruction can be used if state other than that of LSB is to be loaded.

*2 Can not be used when bit specifying of word device is used in S .


*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTC cannot be used with the KV-7000 Series.

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.

2-2 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Contact Instructions

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.

Instructions other than contact

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate or expansion I/O
CR2012 unit is not real-time supported unit; Otherwise OFF. It will not change when indirect specifying
or index modification is not specified for DR in the operand.

* The contact does not turn OFF when CR2012 is ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, error details is 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-3


LDP Only 1 scan
period is ON
when rising edge

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano (OFF->ON) of bit


device is
specifed.
LD,LDB,ORP,LDF,ANF,ORF
LDF Only 1 scan
period is ON
BASIC INSTRUCTIONS

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

ANP Only 1 scan period is ON when rising


specifed.
ANF Only 1 scan

AND pulse
period is ON
when rising edge

edge (OFF→ON) of bit device is specifed.


(OFF->ON) of bit
device is
specifed.
ORP Only 1 scan

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

LOAD pulse fall


specifed.

2 ANF AND pulse fall


Only 1 scan period is ON when falling
edge (ON→OFF) of bit device is specifed.

ORF
Contact Instructions

OR pulse fall

Ladder program Input mode


S L D P S P S

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 ↓.

Available Devices ( ): Not supported on the KV-1000 Index


*1 Indirect Local modifi
Bit devices Word device Const specifying Device cation
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 *4 *3 - - - - - - - *2

Operand Explanation
S Specifies the bit for detecting rising edge or falling edge.

*1 When word device is specified in S , the state of the LSB is loaded.


KV-7500/7300/5500/5000/3000, KV Nano Series Bit specifying of word device.

KV-1000 To load the status of bits other than the LSB, use the BLD or BLDB instruction.

*2 Can not be used when bit specifying of word device is used in S .


*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTC cannot be used with the KV-7000 Series.

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 .

2-4 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Contact Instructions

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

Point • Cannot be used in the interrupt program or in the initialization module.


• Attention should be paid when used in subroutines, among STP to STE instructions,
STG to JMP/ENDS instructions, and CJ (NCJ) to LABEL instructions.
"Precautions on the use of differential execution type instructions" (Page 1-35)
• Parallel connection of non-contact instructions is not allowed.

Instructions other than contact

Operation flag

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 the indirect specifying or index modification range is inappropriate
CR2012 • (KV-7500/7300/5500/5000/3000 only) When DR is specified and the expansion input/output
unit does not have real-time support
Does not change when indirect specifying, index modification, or DR was not specified in the operand.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-5


LDPB Only 1 scan
period is OFF
when rising edge

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano of bit device is


specifed.
LDPBANPB,ORPB,LDFB,ANFB,ORFB LDFB Only 1 scan
period is OFF
when falling
BASIC INSTRUCTIONS

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

AND pulse bar


period is OFF
when rising edge

edge of bit device is specifed.


of bit device is
specifed.
ORPB Only 1 scan
period is OFF
when rising edge

ORPB
of bit device is
specifed.

OR pulse bar ORFB Only 1 scan


period is OFF
when falling
edge of bit
device is
specifed.

LDFB Pulse fall bar

2 ANFB AND pulse fall bar


Only 1 scan period is OFF when falling
edge of bit device is specifed.

ORFB
Contact Instructions

OR pulse fall bar

Ladder program Input mode


S L D P B S
L D F B S

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.

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modifi
Bit device Word device*1 Const specifying Device cation
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ :#/:Z
(B) (W) (ZF)
*4 *3 - - - - - - - *2 *2
S
Operand Explanation
S Specifies the bit for detecting rising edge or falling edge.

*1 When a word device is specified in S , the state of the LSB is loaded.


A bit of word device can be specified.
*2 Can not be used when bit specifying of word device is used in S .
*3 EM and FM (ZF) cannot be used with the KV Nano Series.
*4 CTC cannot be used with the KV-7000 Series.

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 .

2-6 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Contact Instructions

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

Point • Cannot be used in the interrupt program or in the initialization module.


• Attention should be paid when used in subroutines, among STP to STE instructions,
STG to JMP/ENDS instructions, and CJ (NCJ) to LABEL instructions.
"Precautions on the use of differential execution type instructions" (Page 1-35)
• Parallel connection of non-contact instructions is not allowed.

Instructions other than contact

Operation flag

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 the indirect specifying or index modification range is inappropriate
CR2012 • (KV-7500/7300/5500/5000/3000 only) When DR is specified and the expansion input/output
unit does not have real-time support
Does not change when indirect specifying, index modification, or DR was not specified in the operand.

* 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-7


Bit contact instructions
BLD Treat
specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano bit of


word
device
BLD,BND,BOR,BLDB,BANB,BORB
as NO
contact,
BASIC INSTRUCTIONS

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

contact for transferring


as NC
contact,

BAND
and

BAND(.U) B Bit AND ON/OFF status signal of


connect
it serially
to circuit

BAND.D
block.

the specified bit of word


BAND Treat
specified
bit of

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

Bit load bar


device

B
To treat device as a
as NO

BLDB.D
contact,

2
and
connect

contact for inverting the


it in
parallel

BANB
to circuit

BANB(.U) B Bit AND bar ON/OFF status signal of BOR


block.
Treat
specified

BANB.D bit of

the specified bit of word


word
Bit contact instructions

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,

Ladder program Input mode and


connect
it in
parallel
to circuit
S B B L D S n block.

( 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

B is entered in the case of BLD,BANK or BOR


B.D is entered in the case of BLD.D,BAND.D or BOR.D
B is entered in the case of BLDB,BANB or BORB
B.D is entered in the case of BLDB.D,BANB.D or BORB.D

Available Devices ( ): Not supported on the KV-1000 Index


modifi
Bit device Word device Const Indirect Local cation
Operand specifying 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 - Ȗ - - Ȗ Ȗ Ȗ
n Ȗ - Ȗ - - - Ȗ Ȗ Ȗ*4 Ȗ Ȗ  *5 *5
  Ȗ Ȗ Ȗ *1 - Ȗ Ȗ Ȗ

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,

even if LD/LDB instruction is used, same operation is also possible.


*2 When a bit device has been specified in S , the relay of the device No. will be calculated by
the value of the device No. + n . Operation is normal even if the relay straddles channels.
*3 When a bit device has been specified in n , 16 continuous bits are occupied.
When a word device has been specified in n , one word will be 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.

2-8 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Bit contact instructions

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.

Bit contact instructions


bit S bit
15 0

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modify range is inappropriate. OFF in other cases. It
CR2012
will not change when indirect specifying or index modify is not specified in the operand.

* 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)

Point • Precautions when specifying a device in n


Normally, please specify 0 to 15 as the value of n when the suffix is .U, and 0 to 31
as the value of n when the suffix is .D.
The following values will be used when the value of n is out of the range of 0 to 15
or 0 to 31.
When the suffix is .U: The value of the lower 4 bits of n will be used.
When the suffix is .D: The value of the lower 5 bits of n will be used.
Example When the value of DM1000 is 20 (BIN: 0000 0000 0001 0100)
Since the value of lower 4 bits is "4",
CR2002 DM0
so the 4th bit of DM0 becomes the B
DM1000
specified bit.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-9


Bit contact instructions
BASIC INSTRUCTIONS

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.

DM0 R500 (mnemonics list)


B BLD DM0 #3
#3 BOR DM1 #5
OUT R500
DM1
B
#5

2-10 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Bit contact instructions

BASIC INSTRUCTIONS
MEMO

Bit contact instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-11


Compare Contact Instructions
LD= When "A=B" connec
NO contact in ON to

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano LD<


bus.
When "A<B" connec
NO contact in ON to
=,<, ,>=,<>
bus.
LD> When "A>B" connec
BASIC INSTRUCTIONS

NO contact in ON to
bus.
LD<= When "A<B" connec

= <=
NO contact in ON to
bus.

(.U) ※
LD>= When "A>B" connec

Intruction itself is used as a


NO contact in ON to
bus.

.S Contact type


LD<> When "A<>B"
connect NO contac

contact to turn ON/OFF according


in ON to bus

.D AND= When "A=B" connec

< >= ※
comparison
NO contact in ON
serially to circuit

.L to result of the BIN data


block
AND< When "A<B" connec

.F operation NO contact in ON

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

Ladder program Input mode AND<> When "A<>B"

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

*1 When a bit device is specified, continuous 16/32/64 bits will be processed.


When a relay other than the channel leading relay (e.g. MR002 or R1012) is then 16/32/64 bits
will be processed straddling next channel.
*2 When the suffix is ".F" or ".DF", it can not be used.
*3 When the suffix is ".DF", it can not 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 • 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.

2-12 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Compare Contact Instructions

BASIC INSTRUCTIONS
Operation Description

(.U) .S (16-bit BIN data compare 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.
2
=.S, <.S, >.S, <=.S, >=.S, <>.S

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.

Instruction Operation ON Operation OFF


LD= AND= OR= LD=.S AND=.S OR=.S S1 = S2 S1 S2
LD< AND< OR< LD<.S AND<.S OR<.S S1 < S2 S1 >= S2
LD> AND> OR> LD>.S AND>.S OR>.S S1 > S2 S1 <= S2
LD<= AND<= OR<= LD<=.S AND<=.S OR<=.S S1 <= S2 S1 > S2
LD>= AND>= OR>= LD>=.S AND>=.S OR>=.S S1 >= S2 S1 < S2
LD<> AND<> OR<> LD<>.S AND<>.S OR<>.S S1 S2 S1 = S2

.D .L (32-bit BIN data compare instructions)

=.D, <.D, >.D, <=.D, >=.D, <>.D


Unsigned 32-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.
=.L, <.L, >.L, <=.L, >=.L, <>.L
Unsigned 32-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.

Instruction Operation ON Operation OFF


LD=.D AND=.D OR=.D
" S1 +1• S1 "=" S2 +1• S2 " " S1 +1• S1 " " S2 +1• S2 "
LD=.L AND=.L OR=.L
LD<.D AND<.D OR<.D
" S1 +1• S1 "<" S2 +1• S2 " " S1 +1• S1 ">=" S2 +1• S2 "
LD<.L AND<.L OR<.L
LD>.D AND>.D OR>.D
" S1 +1• S1 ">" S2 +1• S2 " " S1 +1• S1 "<=" S2 +1• S2 "
LD>.L AND>.L OR>.L
LD<=.D AND<=.D OR<=.D
" S1 +1• S1 "<=" S2 +1• S2 " " S1 +1• S1 ">" S2 +1• S2 "
LD<=.L AND<=.L OR<=.L
LD>=.D AND>=.D OR>=.D
" S1 +1• S1 ">=" S2 +1• S2 " " S1 +1• S1 "<" S2 +1• S2 "
LD>=.L AND>=.L OR>=.L
LD<>.D AND<>.D OR<>.D
" S1 +1• S1 " " S2 +1• S2 " " S1 +1• S1 "=" S2 +1• S2 "
LD<>.L AND<>.L OR<>.L

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-13


Compare Contact Instructions
BASIC INSTRUCTIONS

.F (single precision floating point type real number data compare instructions)

=.F, <.F, >.F, <=.F, >=.F, <>.F


Single precision floating point type real number 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.
2 Instruction Operation ON Operation OFF
LD=.F AND=.F OR=.F " S1 +1• S1 "=" S2 +1• S2 " " S1 +1• S1 " " S2 +1• S2 "
Compare Contact
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)

=.DF, <.DF, >.DF, <=.DF, >=.DF, <>.DF


Double precision floating point type real number 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.

Instruction Operation ON Operation OFF


LD=.DF AND=.DF OR=.DF " S1 +3 to S1 "=" S2 +3 to S2 " " S1 +3 to S1 " " S2 +3 to S2 "
LD<.DF AND<.DF OR<.DF " S1 +3 to S1 "<" S2 +3 to S2 " " S1 +3 to S1 ">=" S2 +3 to S2 "
LD>.DF AND>.DF OR>.DF " S1 +3 to S1 ">" S2 +3 to S2 " " S1 +3 to S1 "<=" S2 +3 to S2 "
LD<=.DF AND<=.DF OR<=.DF " S1 +3 to S1 "<=" S2 +3 to S2 " " S1 +3 to S1 ">" S2 +3 to S2 "
LD>=.DF AND>=.DF OR>=.DF " S1 +3 to S1 ">=" S2 +3 to S2 " " S1 +3 to S1 "<" S2 +3 to S2 "
LD<>.DF AND<>.DF OR<>.DF " S1 +3 to S1 " " S2 +3 to S2 " " S1 +3 to S1 "=" S2 +3 to S2 "

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)

2-14 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Compare Contact Instructions

BASIC INSTRUCTIONS
Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
• 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.
2
CR2012 • For suffix "F/DF”

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.

"CR/CM List" (Page A-71)

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.

R000 #9999 (mnemonics list)


C0
LDB R000
R001
C #0 #9999 R001
CR2002 C0 DM0 LD CR2002
LDA STA LDA C0
CON
STA DM0
DM0 R500
LD< DM0 #1000
< (1)
OUT R500
#1000 LD= DM0 #1000
DM0 R501 OUT R501
= (2) LD> DM0 #1000
#1000 OUT R502
LD>= DM0 #1000
DM0 R502
AND<= DM0 #2000
> (3) OUT R503
#1000
DM0 DM0 R503
>= <= (4)
#1000 #2000

Comparing current value in counter C0 and constants “#1000”:


(1) Output relay R500 is ON when current value in C0 is less than constants “#1000”.
(2) Output relay R501 is ON when current value in C0 equals constants “#1000”.
(3) Output relay R502 is ON when current value in C0 is larger than constants “#1000”.
(4) Output relay R503 is ON when current value in C0 is larger than constants “#1000” but less than
“#2000”.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-15


Output Instructions
OUT Output the

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano OUB


previous state
The status before
OUT,OUBUB bar outputting
BASIC INSTRUCTIONS

OUT Out
To output to a device.
OUB Out bar

Ladder program Input mode


Execution condition D
O U T D O D
Y D

2 D
O U B D ( O B D )
Output Instructions

Available Devices ( ): Not supported on the KV-1000 Index


modifi
Bit device Word device Const Indirect Local cation
specifying 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)
D - - - *3 - - - - - - - *2 *2

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.

*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.

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

Bit device specified by OUT instruction


OFF

ON

Bit device specified by OUB instruction


OFF

2-16 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Output Instructions

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

R001 R500 R001 R500

Output Instructions
Operation flag

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
• When expansion I/O unit non-real time supported unit is specified for DR
It will not change when DR is not specified by indirect specifying and index modification.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-17


SET Destination relay ON
and hold it in this
state

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano RES Destination relayOFF

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

2 Ladder program Input mode


Execution condition D
Output Instructions

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

Available Devices ( ): Not supported on the KV-1000 Index

Bit device Word device Const Indirect Local modifi


ant specifying Device cation
Operand
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 - - - - - - - *2 *2
SET
RES D *4 *3 - - *4 - - - - *2 *2

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

SET, RES Execution Execution 2


@SET, @RES

Output Instructions
Only 1 scan

Operation flag

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 the indirect specifying or index modification range is inappropriate
CR2012 • (KV-7500/7300/5500/5000/3000 only) When DR is specified and expansion I/O unit is not
real-time supported unit
It will not change when DR is specified by indirect specifying and index modification.

* 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
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;

R000 R500 (mnemonics list)


SET
LD R000
R001 R002 LD R001
AND R002
ORL
R003 OR R003
SET R500
R004 R501 LD R004
RES OR R005
OR R006
R005 RES R501

R006

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-19


KEEP Turns ON the device
specified by the SET
condition turning ON,

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano and holds the device


in this state.Turns
OFF the device
KEEP
specified by the RES
condition turning ON.
BASIC INSTRUCTIONS

KEEP To set the specified device by turning on the

KEEP SET SET condition turning, and hold the device in


Keep
RES
this state. To reset the specified device by
turning on the RES condition.
Ladder program Input mode
SET condition KEEP
SET K E E P D
D

2
RES condition
RES
Output Instructions

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)
- *3 - - - - - - - *2 *2
D

Operand Explanation
D Specifies the device to set/reset. *1 *2

*1 When a word device has been specified in D , the LSB is set/reset.


KV-7500/7300/5500/5000/3000, KV Nano Series Bit specifying of word device can be performed.
*2 Cannot 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.

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.

Point In the sample program on the right, a dual-coil


R000 KEEP
is formed, so OUT R500 programmed later is SET
given priority. R500
R001
RES

R002 R500

Scan
10

Execution condition
1((

KEEP instruction Execution Execution

2-20 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Output Instructions

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.

R000 KEEP R000 R500


SET RES
R500
R001 R001 R500
RES SET

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when range of the indirect specifying or index modification is not proper, DR is specified, or
CR2012 expansion I/O unit is not a real-time supported unit. Otherwise OFF. It will not change when
indirect specifying or index modification is specified for DR.

* 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
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.

KEEP (mnemonics list)


R000
SET LD R000
R500 LD R001
KEEP R500
R001
RES

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-21


DIFU Only 1 scan ON
on the rising edge
of the execution

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano DIFD


condition.
Only 1 scan ON
on falling edge of
KEEPD
the execution
condition.
BASIC INSTRUCTIONS

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.

Ladder program Input mode

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

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)
- - - *3 - - - - - - - *2 *2
D

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.

*2 Cannot 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.

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

DIFU instruction Execute Execute

DIFD instruction Execute Execute

Point • Cannot be used in the interrupt program or in the initialization module.


• Attention should be paid when used among STP to STE instructions, among STG to
JMP/ENDS instructions, and among CJ (NCJ) to LABEL instruction in a sub-routine.
"Precautions on the use of differential execution type instructions" (Page 1-35)

2-22 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Output Instructions

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

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
• When the indirect specifying or index modification range is inappropriate
CR2012
• (KV-7500/7300/5500/5000/3000 only) When DR is specified and the expansion I/O unit is not
a real-time supported unit
It will not change when indirect specifying or index modification is specified for DR.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-23


ONDL Destination relay
ON delay.
OFDL The specified bit

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano device perfoms


OFF delay
operation.
DIFU,DIFD,OFDL
BASIC INSTRUCTIONS

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

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modifi
Bit device Word device Const specifying Device cation
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
n - - - - *4 *5 *5 *2 -
D - - - - *4 - - *5 *5 - - -

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

OFDL The device specified by D is operated as an OFF delay timer.


(1) When the execution condition is ON, D will also be ON.
(2) D will be OFF after n x 10 ms since the execution condition is OFF.
(3) If the execution condition is ON before n x 10 ms, D will not be OFF.

2-24 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Output Instructions

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.

* 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)

Point • Error range is ± 10 μsec + 1 scan period.


KV-7500/7300/5500/5000/3000
• Error range is ± 10 msec + 1 scan period .
KV-1000
• The ON delay and OFF delay will operate for one scan period if n is set to "0".
• Cannot be used in the 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.
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"
• Attention should be when when performing writing operation 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"

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-25


SHOT Destination relay one
shot

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SHOT
BASIC INSTRUCTIONS

SHOT SHOT One shot To specify bit device as an one shot timer.

Ladder program Input mode


Execution condition n
S H O T n D
SHOT
D

Available Devices ( ): Not supported on the KV-1000 Index


modifi
Const Indirect Local cation
2 Operand
Bit device

MR DM EM
Word device
specifying Device

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z


Output Instructions

(B) (W) (ZF)


n - - - - *4 *5 *5 *2 -
D - - - - *4 - - - - - - -

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

n × 10ms n × 10ms n × 10ms

2-26 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Output Instructions

BASIC INSTRUCTIONS
Operation flag

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.

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.

"CR/CM List" (Page A-71)

Point • KV-7500/7300/5500/5000/3000 Error range is ± 10 μsec + 1 scan period.


• KV-1000 Error range is ± 10 msec + 1 scan period.
• Will operate for one scan even if n is set to "0".
• During one scan period, operation will be normal if the execution condition is ON .
• When a device has been specified in n , the device ON time is read only on the
rising edge of the execution condition. The time since D turns OFF until next time
the execution condition turns ON cannot be changed .
• Cannot be used in the 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 in
subroutines.
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, "Precations when using timing instructions"
KV Nano Series User's Manual, "Precations when using timing 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"

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-27


FLIK Destination relay
flickers

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


FLIK
BASIC INSTRUCTIONS

FLIK FLIK The specified bit device is used as a flicker


Flicker
circuit.

Ladder program Input mode


Execution condition FLIK
n1 n2 D F L I K n1 n2 D

Available Devices ( ): Not supported on the KV-1000 Index

2
modifi
Bit device Word device *1
Const Indirect Local cation
specifying Device
Operand
MR DM EM
Output Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z


(B) (W) (ZF)
n1 - - - - *4 *5 *5 *2 -
n2 - - - - *4 *5 *5 *2 -
D - - - - *4 - - - - - - -

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
㪦㪝㪝
㪦㪥


㪦㪝㪝

㫅㪈 㬍㩷 㪈㪇㫄㫊 㫅㪉 㬍㩷 㪈㪇㫄㫊 㫅㪈 㬍㩷 㪈㪇㫄㫊 㫅㪉 㬍㩷 㪈㪇㫄㫊 㫅㪈 㬍㩷 㪈㪇㫄㫊

2-28 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Output Instructions

BASIC INSTRUCTIONS
Operation flag

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.

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.

"CR/CM List" (Page A-71)

Point • KV-7500/7300/5500/5000/3000 Error range is ±10μs + 1 scan period.


• KV-1000 Error range is ±10ms + 1 scan period .
• One scan period will be ON when n1 and n2 are set to "0".
• Cannot be used in the 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 in
subroutine.
KV-7000 Series User's Manual, "Precautions when using timing instructions"
KV-5500/5000/3000 Series User's Manual, "Precations when using timing instructions"
KV-1000 Series Programming Manual, "Precations when using timing instructions"
KV Nano Series User's Manual, "Precations when using timing instructions"
• Attention shoulde 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"

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-29


ALT Destination relay
invert

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ALT
BASIC INSTRUCTIONS

ALT ALT Alternate To invert the state of the bit device.

Ladder program Input mode


Execution condition D
ALT A L T D

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modifi
Bit device Word device Const specifying Device cation

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.

*2 EM and FM (ZF) cannot be used with the KV Nano Series.

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

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 by D indirect specifying
CR2012 • When the indirect specifying or index modification range is inappropriate
• When DR is specified or the expansion I/O unit is not a real-time supported unit
State will not change when indirect specifying or index modification is not specified for DR.

* 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)

Point • Cannot be used in the 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 in subroutines.
"Precautions on the use of differential execution type instructions" (Page 1-35)

2-30 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Output Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-31


Bit output instructions
BOUT Outputs the previous
state to the specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano BOUB


bit of the device.
To map input state to
BOUT,BOUB the specified bit of
word device.
BASIC 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

Ladder program Input mode


Execution condition D

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 )

Available Devices ( ): Not supported on the KV-1000 Index

Bit device Word device Const Indirect Local modifi


specification Device cation
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
- - - - *4 - - - - -
D
n - - - - *4 *5 *5 *3 -

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.

Point • Precautions when a device is specified in n


Normally, if suffix is .U, then the value of n is specified as 0 to 15; if the suffix is .D,
then the value of n is specified as 0 to 31.
The following values are used when the value of n is outside 0 to 15 or 0 to 31.
When the suffix is .U: The value of the lower 4 bits of the n is used.
When the suffix is .D: The values of the lower 5 bits of n is used.
Example When the value of DM1000 is 20 (BIN: 0000 0000 0001 0100), since the value
of the lower four bits is "4", the 4th bit of DM0 will be the output destination
address.
CR2002 DM0
B
DM1000

2-32 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Bit output instructions

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

For 16bit (suffix .U) 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0


2
For 32bit (suffix .U) Bit15 Bit1 Bit0

Bit output instructions


bit n

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

Bit31 Bit16 Bit15 Bit1 Bit0

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified

* 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 5th bit of data memory DM000 is turned ON.
When R000 is OFF, the 0th bit of DM0 is turned ON.

R000 DM0 (mnemonics list)


B LD R000
#5 BOUT DM0 #5
BOUB DM0 #0
DM0
B
#0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-33


BSET Turn the specified bit
of the word device
ON and holds this

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano BRES


state
Turn the specified bit
of the word device
BSET,BRESES
OFF
BASIC INSTRUCTIONS

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

Ladder program Input mode


Bit output instructions

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 )

Available Devices ( ): Not supported on the KV-1000


Index
Indirect
Bit device Word device Consta specificati Local modifi
nt Device cation
Operand on
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
- - - - *4 - - - - -
D
n - - - - *4 *5 *5 *3 -

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.

Point • Precautions when a device is specified in n


Normally, if suffix is .U, then the value of n is specified as 0 to 15; if the suffix is .D,
then the value of n is specified as 0 to 31.
The following values are used when the value of n is outside 0 to 15 or 0 to 31.
When the suffix is .U: The value of the lower 4 bits of the n is used.
When the suffix is .D: The values of the lower 5 bits of n is used.
Example When the value of DM1000 is 20 (BIN: 0000 0000 0001 0100), since the value
of the lower four bits is "4", the 4th bit of DM0 will be the output destination
address.
CR2002 DM0
BSET
DM1000

2-34 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Bit output instructions

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

For 16bit (suffix .U) 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0


2
For 32bit (suffix .U) Bit15 Bit1 Bit0

Bit output instructions


bit n
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

Bit 31 Bit16 Bit15 Bit1 Bit0

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

For 32bit (suffix .U) Bit15 Bit1 Bit0


bit n
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 0 0 0 0 0 0 0 0 0 0 0 0 0

Bit31 Bit16 Bit15 Bit1 Bit0

@ The above operation will operformed on the rising edge (OFF→ON) of the execution
condition.

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified.

* 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 5th bit of data memory DM000 is set.
When input relay R000 is ON, the 5th bit of data memory DM000 is reset.

R000 DM0 (mnemonics list)


BSET LD R000
#5 BSET DM0 #5
LD R001
R001 DM0 BRES DM0 #5
BRES
#5

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-35


Timer/Counter Instructions
TMR 100 ms, 32-bit ON
delay subtraction timer

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano TMH

TMS
10 ms, 32-bit ON delay
subtraction timer
1ms, 32-bit ON delay
TMR,TMS subtraction timer
BASIC INSTRUCTIONS

TMR T Timer 100 ms, 32-bit ON delay down timer.

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

Ladder program Input mode

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

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modifi
Bit devices Word devices 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)
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

*1 "$" cannot be used.


*2 When a bit device has been specified, 32 continuous bits will be processed.
When a relay other than the leading relay of the channel is specified (e.g. MR002 or R1012), the
relay will be processed straddling the next channel.
When a word device has been specified, continuous 2 words will be 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.

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

2-36 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified.

* 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)


- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-37
Timer/Counter Instructions
BASIC INSTRUCTIONS

Sample Program
When input relay R000 turns ON, timer T0 turns ON 3 seconds later, and output relay R500 turns ON.

R000 (mnemonics list)


#30
T0 LD R000
TMR #0 #30

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.

R000 (mnemonics list)


#50
T
H 0000 LD R000
TMH #0 #50
LD T0
T0 R500 OUT R500

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

Reading and Changing the Timer Current Value/Setting Value

(1) Reading the current value


It can be read through the LDA.P or MOV.D instruction.

Example The current value of T0 is T0 DM0


stored in data memory LDA.D STA.D

"DM0/DM1". MOV.D
T0 DM0

(2) Changing the current value


The current value can be changed by the MOV.D or DW.D instruction.

Example The current value of T0 is MOV.D


changed to 100000. #100000 T0

#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.

2-38 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

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.

The setting value of T0 is


2
Example DM0
T0
read from data memory
"DM10/ DM11". DM0 DM10

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.

(4) Changing setting value


• The setting value can be changed by the STA.D instruction.

Example The setting value of T0 is #100000 T0


changed to 100000. LDA.D STA.D

• To change the setting value by the MOV.D instruction: can be changed only when the device is
DM0
specified ( T0 ).

Example The setting value of T0 is DM0


changed to "DM10/DM11". T0
MOV.D
DM10 DM0

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.

"LDA instruction" (Page 4-6)


"STA instruction" (Page 4-10)
"MOV instruction" (Page 4-2)
"DW instruction" (Page 4-20)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-39


TMU 10μs, 32-bit ON
delay subtraction
timer

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


TMU
BASIC INSTRUCTIONS

TMU T 10μs high-speed 10μs, 32-bit ON delay type subtraction


timer timer
U

Ladder program Input mode


Execution condition S
T
U n T M U n S
n T U n S
T
T M U H n S
O U T U n S

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

*1 "$" cannot be used.


*2 When a bit device has been specified, 32 continuous bits will be processed.
When a relay other than the leading relay of the channel is specified (e.g. MR002 or R1012), the
relay will be processed straddling the next channel.
When a word device has been specified, continuous 2 words will be 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.

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

2-40 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified.

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-41


UDT 100 ms, 32-bit up/
down timer.

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


UDT
BASIC INSTRUCTIONS

7&6

UDT
72
&9 Up/down timer 10 ms, 32-bit up/down timer.
4'5

Ladder program Input mode


Up counting input UDT n
UP
U D T  n S
Down counting input S

2 Reset input
DW

RES
Timer/Counter
Instructions

T n

Available Devices ( ): Not supported on the KV-1000 Index


Bit device Word device Const Indirect Local modific
specifying Device ation
Operand
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 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.

2-42 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
(1) (2) (3) (4) (5)
㪦㪥

Up counting input
㪦㪝㪝
㪦㪥

Down counting input


㪦㪝㪝
㪦㪥
Reset 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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-43


C 32-bit up counter

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


C
BASIC INSTRUCTIONS

C C Counter 32-bit up counter

Ladder program Input mode


Execution condition S1
C n C n S1 S2
S2 ( C N T n S1 S2 )

C n

2 ( ): Not supported on the KV-1000 Index


Available Devices
Timer/Counter
Instructions

Indirect Local modific


Bit devices Word devices Const
Operand specifying Device ation
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
n - - - - - - - - - - - - - - - - - -
S1 - - - - *4 *5 *5 -
S2 - *5 *4 - - - - - - -

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

*1 "$" cannot be used.


*2 When a bit device has been specified, 32 continuous bits will be processed. When a relay other
than the leading relay of the channel (e.g. MR002 or R1012) has been specified, the relay will
beprocessed straddling the next channel.
When a word device has been specified, continuous two words will be processed.
*3 When a word device has been specified, the lowest bit will used.
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 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

2-44 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified.

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-45


Timer/Counter Instructions
BASIC INSTRUCTIONS

Reading and Changing the Counter Current Value/Setting Value

(1) Reading the current value


Curren value can be read by the LDA.D or MOV.D instruction.

2 Example The current value of


C0000 is stored in data
C0
LDA.D
DM0
STA.D

memory "DM0/ DM1".


Timer/Counter
Instructions

MOV.D
C0 DM0

(2) Changing the current value


The current value can be changed by the MOV.D or DW.D instruction.

Example The current value of C0 is MOV.D


changed to 100000. #100000 C0

#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.

(3) Reading the setting value


DM0
• When the setting value is set in the device ( C0 ): Can be read by the LDA.D or MOV.D
R001
instruction.

Example The setting value of C0 is DM0


read from data memory C0
R001
"DM10/DM11" DM0 DM10
LDA.D STA.D

OR
DM0
C0
R001
MOV.D
DM0 DM10

#100
• When the setting value is set by a constant ( C0 ): Cannot be read.
R001

2-46 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
(4) Changing the setting value
• The setting value can be changed by the STA.D instruction.

Example The setting value of C0 is #100000 C0


changed to 100000. LDA.D STA.D

• 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

Example The setting value of C0 is DM0


changed to "DM10/DM11". C0
R001
MOV.D
DM10 DM0

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.

"LDA instruction" (Page 4-6)


"STA instruction" (Page 4-10)
"MOV instruction" (Page 4-2)
"DW instruction" (Page 4-20)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-47


OUTC 32-bit up counter

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


OUTC
BASIC INSTRUCTIONS

OUTC C Out counter 32-bit up counter

Ladder program Input mode


Execution condition S
C n O U T C n S

C n

2 ( ): Not supported on the KV-1000


Available Devices Index
Timer/Counter
Instructions

Indirect Local modific


Bit device Word device Const
Operand specifying Device ation
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
n - - - - - - - - - - - - - - - - - - -
- - - - *3 *4 *4 -
S

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

*1 "$" cannot be used.


*2 When a bit device has been specified, 32 continuous bits will be processed.
When a relay other than the leading relay of the channel (e.g. MR002 or R1012) has been
specified, the relay will be processed straddling the next channel. 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 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

2-48 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified.

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-49


ITVL Pulse
measurement/DM

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano value measurement

ITVL
BASIC INSTRUCTIONS

ITVL
To measure the pulse

ITVL ITVL(.U) PLS interval, pulse width and data


Interval timer
ITVL.S
PAUSE
RES
memory values in preset
mode.

Ladder program Input mode


Pulse input ITVL
PLS I T V L D1 D2
Measure stop input D1

2 Reset input
PAUSE
D2
RES
Timer/Counter
Instructions

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modific
Bit device Word device Const
Operand specifying Device ation
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
- - - - - - - *3 - - - - - - -
D1
D2 - - - - - - - - - - - - - -

Operand Explanation
D1 Specifies the leading device of the data table.*1
D2 Specifies the leading device of the flag relay.*2

*1 Continuous 16 words are occupied.


*2 Continuous 4 bits are occupied.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.

Description of Operation

Two functions of the ITVL instruction


(1) Pulse measurement mode..... The pulse period or pulse width of PLS (pulse input) is measured.
Pulse period measurement, pulse width measurement, and measurement unit
are specified by data table (minimum increments of 10 ms).
The maximum measurement pulse width and maximum measurement pulse
period are as follows:
ITVL.U...65535sec
ITVL.S...32767sec
Measurement cannot be performed if the above pulse width is exceeded. If the
pulse width exceeds the above values, an overflow will occur, and will be
stored in the lower 16 bits of the measurement value.
(2) DM measurement mode..... The maximum/minimum values and average values* of captured measurement
values are calculated.*
Data to capture can be set by the data table.
* For the measurement values, see "Data table assignment" for the ITVL/
ITVL.S instructions.

2-50 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

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.

Data table assignment


16 continuous data memories (DM) starting from the device No. D1 is called a "data table", which is
structured as follows. Values for setting operation of the ITVL instruction are stored in first four data
memories in this data table.

D1 Mode setting ->Set mode No.(0 to 65534).


D1 +1 MAX setting value ->Set up max. value of measurement range. Default set
D1 +2 MIN setting value ->Set up min. value of measurement range.
D1 +3 Averaging times ->Setup averaging times.
D1 +4 Mesured value ->Store each measured value.
D1 +5 MAX measured value ->Store max. measured value.

D1 +6 MIN measured value ->Store min. measured value.

D1 +7 Average value ->Store average value of specified times.


D1 +8 Measuring times ->Store measuring times completed.
D1 +9 Lower bits of accumulated value ->Store lower 16 bits of accumulated value of measured value.

D1 +10 Higher bits of accumulated value ->Store higher 16 bits of accumulated value of measured value.

D1 +11
...

Work memory for system ->Work memory for calculating values above. (Use forbidden).

D1 +15

• Mode can be set through the STA(.U), DW(.U) or MOV(.U) instruction.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-51


Timer/Counter Instructions
BASIC INSTRUCTIONS

Example D1 When mode No. 10000 is set at DM0.

CR2008 #10000 DM0


LDA STA

• 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

Mode No. Measurement Unit Mode No. Measurement Unit


0 10 ms Unit 1 10 ms Unit
2 100 ms Unit 3 100 ms Unit
4 1 sec unit 5 1 sec unit
DM measurement mode

Mode No. DM No. Description


0 to 5 OFF Method of use
6 DM6 The content of DM6 is measured to calculate the average value.
7 DM7 The content of DM7 is measured to calculate the average value.
: : :
65533 DM65533 The content of DM65533 is measured to calculate the average value.
65534 DM65534 The content of DM65534 is measured to calculate the average value.

* 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.

Flag relay assignment


Four bit devices starting from the device No. D2 is called a "flag relay", which is structured as follows.

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.

2-52 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
Operation flag

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.

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.

* 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

 Example of pulse interval measurement


(mnemonics list)
CR2008 MOV
#0 DM0 Set mode as 0 (in 10ms). LD CR2008
CR2008 MOV #0 DM0
MOV
#51 DM1 Set max. value of measurement range as 510ms. LD CR2008
MOV #51 DM1
CR2008 MOV LD CR2008
#49 DM2 Set min. value of measurement range as 490ms. MOV #49 DM2
CR2008 LD CR2008
MOV
#10 DM3 Set the averaging times as 10. MOV #10 DM3
LD R000
R000 ITVL LD R001
PLS Measure pulse interval of input relay R000. LD R002
DM0
R001 ITVL DM0 R1000
PAUSE Stop measure when input relay R001 ON. LD R1000
OR R1001
R002 R1000 SHOT #30 R500
RES Reset when input relay R002 ON
R1000 #30
SHOT
R500 R1000 is ON for 1 scan when measured value is larger than 510ms.
R1001

R1001 is ON for 1 scan when measured value is less than 490ms.

Output 1 pulse for 300 ms from output relay R500 when MAX error or MIN error.

ON

Input relay R000


OFF

500ms 400ms 600ms


ON

Input relay R1000 ON


OFF

1 scan
ON

Input relay R1001 ON


OFF
1 scan
ON

Output relay R500 ON ON


OFF

300ms 300ms

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-53


Timer/Counter Instructions
BASIC INSTRUCTIONS

 Example of A/D data measurement


Output R500 will turn ON when the analog input value (valid range is 1 to 5V) stored in data memory
DM1600 exceeds +3V. When the analog input value falls below +2V, output R501 will turn ON. The
average value is stored in DM100.
(mnemonics list)
CR2008 MOV

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

CR2008 MOV LD CR2008


#1000 DM2 Set min. value of measurement range as 2V(1000). MOV #1000 DM2
CR2008 LD CR2008
MOV
#100 DM3 MOV #100 DM3
Set the averaging times as 100.
LD CR2002
CR2002 ITVL LD R001
PLS LD R002
DM0
R001 ITVL DM0 R1000
Stop measuring when input relay R001 ON.
PAUSE LD R1000
R1000 OUT R500
R002 Reset when input relay R002 ON LD R1001
RES OUT R501
R1000 R500 LD R1003
R500 ON when measured value becomes larger than 3V (2000). MOV DM7 DM100
R1001 R501
R501 ON when measured value becomes less than 2V (1000).
R1003 MOV
DM7 DM100 Store average value to DM100 every 100 measurements.

2-54 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
MEMO

Timer/Counter
Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-55


UDC 32-bit up/down
counter

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


UDC
BASIC INSTRUCTIONS

7&%

UDC
72
&9 UP/DOWN counter 32-bit up/down counter
4'5

Ladder program Input mode


Up counting input UDC n
UP
U D C n S
Down counting input S

2
DW ( C N T R n S )

Reset input
RES
Timer/Counter
Instructions

C n

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modific
Bit device Word device Const specifying Device ation
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
n - - - - - - - - - - - - - - - - - -
- - - - *3 *4 *4 -
S

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

*1 "$" cannot be used.


*2 For the KV Nano Series, the device number range is 0 to 255. When a bit device has been
specified, 32 continuous bits will be processed.
When a relay other than the leading relay of the channel (e.g. MR002 or R1012) has been
specified, the relay will be processed straddling the next channel. 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 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

2-56 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
ON

R001(up counting input)


OFF
ON

R002(Down counting input)


OFF

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
ON when the indirect specifying or index modification range is inappropriate. Otherwise, OFF.
CR2012
State will not change when indirect specifying or index modification is not specified.

* 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
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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-57


Timer/Counter Instructions
BASIC INSTRUCTIONS

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.

Instruciton Input mode Contact Input mode


Timer
5 T M R @ n S
6"
 P T n S
T I M n S

High-speed timer
5 T M H @ n S
6
* " P T H n S
T I M H n S

1ms high-speed timer


5
6
5 " P T M S @ n S "6 P
( T S n S ) L D @ T n

10ms high-speed timer T M U @ n S


5 T U @ n S
6
5 " P T M U H @ n S
O U T U @ 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

2-58 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
MEMO

Timer/Counter
Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-59


Connection/End Instruction
END To indicate the end of
the master program.
ENDH To indicate the end of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the entire program.

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.

Ladder program Input mode

E 
E N D

2
F E N D
END
Instruction
Connection/End

ENDH
E N D H ( H )

Available Devices ( ): Not supported on the KV-1000 Index

Bit devices Word devices Const Indirect Local modifi


specifying Device cation
Operand
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
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

2-60 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Connection/End Instruction

BASIC INSTRUCTIONS
Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
CR2012 No change in status
2
 Difference between the END and ENDH instructions

Instruction
Connection/End
Sequence programs are named as follows according to their function.
Master subroutine

㪜㪥㪛 End of master subroutine

㪪㪙㪥

End of master subroutine


Sequence program Programming subroutine and
㪩㪜㪫 End of subroutine
interrupt program as required.
㪠 㪥㪫
End of interrupt program

㪩㪜㪫㪠 End of interrupt program

㪜㪥㪛㪟 End of sequence program

• 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.

Reference • SBN/RET instructions : Indicate the sub-routine range.


"CALL/SBN/RET" (Page 3-28)
• INT/RETI instructions : Indicate the interrupt program range.
"INT/RETI instruction" (Page 5-108)

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-61


CON Indicates a series
connection following
an output instruction

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


_CON
BASIC INSTRUCTIONS

CON
To indicate a series connection following an
Connect
output instruction.

Ladder Input mode


a b c d
↑ ↑ ↑
CON CON CON
Available Devices ( ): Not supported on the KV-1000 Index

2 Operand
Bit device Word device
Indirect Local modifi
Constant specifying Device cation
MR DM EM
Instruction
Connection/End

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z


(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
CR2012 No change in status

2-62 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Connection/End Instruction

BASIC INSTRUCTIONS
MEMO

Instruction
Connection/End

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-63


MPS To store the input state
and operation flag.
MRD To read the content in

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano MPP


memory by the MPS
instruction.
To read the content in
MPS,MRD,MPP
memory by the MPS
instruction, and clear
BASIC INSTRUCTIONS

memory.

MPS pulse To store the input state and operation flag.

MRD Read To read the content in memory by the MPS instruction.

MPP
To read the content in memory by the MPS instruction,
Pop
and clear memory.

2 Ladder program
Instruction
Connection/End


MPS


MRD


MPP

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modifi
Bit device Word device Const specifying Device cation
Operand
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
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

2-64 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Connection/End Instruction

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

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
CR2012 No change in status

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-65


ANL Connects the contact
block in series
ORL Connects the contact

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano block in paralleland


clear memory.

ANL,OR,ORL
BASIC INSTRUCTIONS

ANL AND load To connect the contact circuit block in series.

ORL OR load To connect the contact circuit block in parallel.

Ladder program

ANL ORL
2 Block C
Instruction
Connection/End

Block A Block B Block D

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)
- - - - - - - - - - - - - - - - - - - - -

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.

ORL Connects two contact circuit blocks in parallel.


As shown in the ladder diagram above, circuit block C and circuit block D are connected
in parallel. This connection is indicated by a connection line instead of a symbol.

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
CR2012 No change in status

 About contact circuit blocks and program circuit blocks


A combination of any contact instructions that are connected is called a "contact circuit block".
Contact module

When the circuit blocks are connected to the left and right power rails, the contact circuit blocks are
called "program circuit block".
Program block

2-66 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Connection/End Instruction

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

R000 R002 R501 (mnemonics list)


LD R000
OR R001
R001 R003 LD R002
OR R003
ANL
OUT R501

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-67


INV To invert the previous
ON/OFF state before
this instruction.

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


INV
BASIC INSTRUCTIONS

INV
To invert the previous ON/OFF state before
Inverse
this instruction.

Ladder program Input mode

Ι Ν V

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modifi
2
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
Connection/End
Instruction

(B) (W) (ZF)


- - - - - - - - - - - - - - - - - - - - -

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

2-68 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Connection/End Instruction

BASIC INSTRUCTIONS
Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
CR2012 No change in status
2
Sample Program

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-69


MEP Only 1 scan period is
ON on the rising edge of
the previous execution

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano MEF


condition.
Only 1 scan period is
ON on the falling edge
MEP,MEFMEF
of the previous
execution condition.
BASIC INSTRUCTIONS

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.

Ladder program Input mode

M E P

2
Connection/End
Instruction

M E F

Available Devices ( ): Not supported on the KV-1000 Index

Bit device Word device Const Indirect Local modifi


specifying Device cation
Operand
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
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)

2-70 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Connection/End Instruction

BASIC INSTRUCTIONS
● When inverting is ○
possible

2
● When inverting is ×

Connection/End
Instruction
not possible

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
CR2012 No change in status

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-71


Direct I/O instructions
RFSX To refresh the states of
specified number of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano RFSY


input relays.
To refresh the states of
the specifed number of
RFSX,FSY output relays.
BASIC INSTRUCTIONS

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

Execution condition RFSX


D n R F S X D n

Execution condition RFSX


D n @ R F S X D n

Execution condition RFSΥ


D n R F S Υ D n

Execution condition RFSΥ


D n @ R F S Υ D n

Available Devices ( ): Not supported on the KV-1000 Index


Indirect Local modifi
Bit device Word device Const specifying Device cation
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
(B) (W) (ZF)
D - - - - - - - - - - - - - - - - -
n - - - - *3 *4 *4 -

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.

2-72 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Direct I/O instructions

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

Direct I/O instructions


RFSY Whe the execution condition is ON,starting from the device No. of D , tates of the
specified number of output relays ( n ) will be refreshed
@RFSY Only 1 scan period is ON on the rising edge of execution condition

Point Inputs and outputs for expansion units that do not support direct input/output cannot be
refreshed.

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
On in the following cases; OFF in other cases.
• When range of n starting from D exceeds the upper limit of range of devices
• When range of n starting from D exceeds the range of devices for direct input/
CR2012 output in the same unit
• When the indirect specifying or index modification range is inappropriate
• (KV-7500/7300/5500/5000/3000 only) When expansion units are assigned in the range
of n starting from D , and RFSX/RFSY instructions are not in pair
* The instruction is not executed when CR2012 is 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 R1000 is ON, 8 input relays will be refreshed from the input relay R008 of the CPU unit.

R1000 (mnemonics list)


RFSX
R008 #8 LD R1000
RFSX R008 #8

When R01000 is ON, 32 output relays will be refreshed from the R30000 assigned to the expansion
unit.

R1000 (mnemonics list)


RFSY
R30000 #32 LD R1000
RFSY R30000 #32

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 2-73


Direct I/O instructions
BASIC INSTRUCTIONS

MEMO

2
Direct I/O instructions

2-74 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


3

APPLIED INSTRUCTIONS
APPLIED INSTRUCTIONS
These instructions are for project progress, program control, and extended
ladders.
These instructions enable structured programming for basic ladders.

Shift Instruction ..................................................................... 3-2


Memory Switch Instruction .................................................... 3-4
Step Instructions ................................................................... 3-8
Stage Processing Instruction .............................................. 3-12
Flow Instruction ................................................................... 3-24
Macro Instructions ............................................................... 3-44
Function Block Instructions ................................................. 3-48
Module Instructions ............................................................. 3-52
Index Register Instructions.................................................. 3-54
Indirect specifying instructions ............................................ 3-58
File Register Instructions..................................................... 3-66
Unit Program Instructions.................................................... 3-72
Buffer Memory Instructions ................................................. 3-84
Unit type judgment instruction ............................................. 3-90

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-1


Shift Instruction
SFT Operates the shift
register

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SFT

5(6

SFT
&
Shift Operates the shift register
APPLIED INSTRUCTIONS

%.-
4'5

Ladder program Input mode


Data input SFT
D
S F T D1 D2
Clock input D1
CLK
Reset input D2
RES

3 Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Shift Instruction

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)
D1 - - - - - *2 - - - - - - - -
D2 - - - - - *2 - - - - - - - -

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) 㪦㪥

㪛㪈 㪛㪈
㪦㪝㪝

㪦㪥
㪛㪈 㪂㪈 㪛㪈 䋭㪈
㪦㪝㪝

㪦㪥
㪛㪈 㪂㪉 㪛㪈 䋭㪉
㪦㪝㪝
㪦㪥
㪛㪈 㪂㪊 㪛㪈 䋭㪊
㪦㪝㪝

㪦㪥
㪛㪉 䋭㪈 㪛㪉 㪂㪈
㪦㪝㪝
㪦㪥
㪛㪉 㪛㪉
㪦㪝㪝

3-2 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Shift Instruction

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

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 a timer/counter has been specified by indirect specifying in D1 and D2
3

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.

* The instruction is not executed when CR2012 is 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

■ Rotate shift circuit


This circuit turns outputs ON every second repeatedly. Internal auxiliary relay R1000 is set by CR2008
(ON for one scan only at start of operation), and the output relays R500 to R502 are shifted every
second by timer T1. When R1003 is ON, R1000 is set to repeat processing.
(Mnemonics list)
CR2008 R1000
SET LD CR2008
SET R1000
T1 #10
LDB T1
T1
TMR #1 #10
CR2003 SFT LD CR2003
D LD T1
R1000 LD CR2003
T1
SFT R1000 R1003
CLK
LD R1000
CR2003 R1003 OUT R500
RES LD R1001
R1000 R500 OUT R501
LD R1002
OUT R502
R1001 R501 LD R1003
SET R1000
R1002 R502

R1003 R1000
SET

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-3


Memory Switch Instruction
MEMSW Memory switch setting

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


MEMSSW

MEMSW
MEMSW
Memory switch Operates the memory switch.
APPLIED INSTRUCTIONS

Ladder program Input mode


MEMSW n
M E M S W n S
S

Available Devices ( ): Not supported on the KV-1000


Index
Local
Bit Devices Word Devices Const Ind Spec Device Modify
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)
*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

*1 Cannot be specified by "$". ("#" can be omitted.)


*2 Cannot be specified by "#".

Operation Description
This instruction is set when powering ON and when the ladder program is transferred (including
writing in the RUN mode).

Reference For KV-7500/7300/5500/5000/3000 series, it will be set in CPU setting. (Comparator


match output destination is set only in CR2505/2513. )
For KV Nano series, it will be set in CPU setting.

MEMSW 3 memory switches available: 0 to 2.


Each switch comprises 16 bits, and switch functions are set by turning these bits ON/OFF.
The content of the memory switches is set when the program is transferred to the KV-1000.
If the program does not contain the MEMSW instruction, "$0000" is set on the switch.

3-4 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Memory Switch Instruction

APPLIED INSTRUCTIONS
MEMSW0
3210 3210 3210 3210
$0103
0000 0000 0000 0000
SW1
SW2
SW3
SW4

Switch Switch type ON OFF


0 Release CPU error during power ON or PROGRAM → RUN Enable Disable
SW1 1 Read protection of host program Enable Disable
2 Reserved for system ─ ─

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

SW3 1 When power ON or PROG→RUN, DM10000 to DM19999 Clear Hold


2 When power ON or PROG→RUN, DM20000 to DM29999 Clear Hold
3 When power ON or PROG→RUN, DM30000 to DM39999 Clear Hold
0 When power ON or PROG→RUN, DM40000 to DM49999 Clear Hold

SW4 1 When power ON or PROG→RUN, DM50000 to DM59999 Clear Hold


2 When power ON or PROG→RUN, DM60000 to DM69999 Clear Hold
3 Reserved for system ─ ─

MEMSW1
MEMSW1
3210 3210 3210 3210
$0216
0000 0000 0000 0000
SW1
SW2
SW3
SW4

Switch Switch type ON OFF


0 Off-hold relay R1000 to R4915 series. Enable Disable
SW1 1 Off-hold relay R5000 to R9915 series. Enable Disable
2 Off-hold relay R10000 to R14915 series Enable Disable
3 Off-hold relay R15000 to R19915 series Enable Disable
0 Off-hold relay R20000 to R24915 series Enable Disable
SW2 1 Off-hold relay R25000 to R29915 series Enable Disable
2 Off-hold relay R30000 to R34915 series Enable Disable
3 Off-hold relay R35000 to R39915 series Enable Disable
0 Off-hold relay R40000 to R44915 series Enable Disable
SW3 1 Off-hold relay R45000 to R49915 series Enable Disable
2 Off-hold relay R50000 to R54915 series Enable Disable
3 Off-hold relay R55000 to R59915 series Enable Disable
0 Reserved for system ─ ─

SW4 1 Reserved for system ─ ─


2 Reserved for system ─ ─
3 Reserved for system ─ ─

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-5


Memory Switch Instruction
APPLIED INSTRUCTIONS

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

switch Switch type ON OFF


0 To switch comparator matching output destination R500 or R504 R504 R500
SW1 1 To switch comparator matching output destination R501 or R505 R505 R501
2 Operation at fixed scanning time (unit selectable) 500μs 1ms
3 Reserved for system ─ ─
0 When power ON or PROG→RUN, EM0 to EM19999 clear Hold
SW2 1 When power ON or PROG→RUN,EM20000 to EM39999 clear Hold
2 When power ON or PROG→RUN,EM40000 to EM59999 clear Hold
3 When power ON or PROG→RUN, EM60000 to EM56634 clear Hold
0 When power ON or PROG→RUN,FM0 to FM19999 clear Hold
SW3 1 When power ON or PROG→RUN, FM20000 to FM32766 clear Hold
2 Reserved for system ─ ─
3 Reserved for system ─ ─
0 Reserved for system ─ ─

SW4 1 Reserved for system ─ ─


2 Reserved for system ─ ─
3 Reserved for system ─ ─

* 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"

3-6 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Memory Switch Instruction

APPLIED INSTRUCTIONS
Example for memory switch setting
Specify the memory switch No. in HEX.

SW4 SW3 SW2 SW1 (Switch No.)


MEMSW1
$0269 3210 3210 3210 3210
SW1 0000 0010 0110 1 0 0 1 (Example)
SW2
SW3 0 2 6 9 (HEX)
SW4
(8) (4) (2) (1)
23 22 21 20 (HEX)
0
0
0
0
0
0
0
1
0
1
3
Off-hold relay R45000 to R49915 series.

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

Sample Program
Clear DM0 to DM9999 when powering ON.
(Mnemonics list)
MEMSW0
MEMSW #0 $100
$0100

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-7


Step Instructions

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.

Ladder program Input mode


STP
S S T P S

Program A

3 STE
S T E
Step Instructions

Program B

Available Devices ( ): Not supported on the KV-1000


Index
*1 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 *2 - - - - - - -

Operand Explanation
Specifies the device to be used as the execution condition in the program between the STP and STE
S
instructions.*1

*1 When a word device has been specified, the LSB is processed.


Bit specifying can not be used word devices.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.
*3 CTC cannot be used with the KV-7000 Series.

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

3-8 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Step Instructions

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

The STP and STE instructions can be programmed up to


STP
a nesting level of 16. R1000
In the program shown on the right, (1) (2) (3) are not
executed when R1000 is OFF, and execution starts from (4). (1)
When R1000 and R1001 both are ON, the program is
STP
executed in order (1) (2) (3) (4). R1001
When R1000 is ON and R1001 is OFF, the program is
executed in order (1) (3) (4), and execution of (2) is 1st 2nd
(2)
level level
skipped.
STE

(3)

STE

(4)

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specifying and index modify range is inappropriate. Otherwise, OFF.
CR2012
Does not change when indirect specifying or index modify is not specified to the operand.

* 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.

"CR/CM List" (Page A-71)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-9


Step Instructions
APPLIED INSTRUCTIONS

Sample Program
When input relay R000 turns ON, output relay R500 automatically turns ON for 2s, and then R501 turns
ON for 3s.

R000 R1000 R1000 (Mnemonics list)


R1001
DIFU SET LD R000
DIFU R1000
CON
STP
AND R1000
R1001
3 T0 R1001
SET R1001
STP R1001
LD T0
RES RES R1001
Step Instructions

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

3-10 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Step Instructions

APPLIED INSTRUCTIONS
MEMO

Step Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-11


Stage Processing Instruction

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.

Ladder program Input mode


Execution condition D
SET

D D '

3 STG

D '
JMP S

J
T G

M P
D

D
struction
Stage Processing In-

STG ENDS E N D S

Available Devices ( ): Not supported on the KV-1000


Index
Bit Devices Word Devices Const Ind Spec Local Modify
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)
D - - - - - - - - - - - - - - - -

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).

3-12 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Stage Processing Instruction

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.

Example CR2008 R1000


SET

R1000 R000 R1001


 STG JMP  Shift to STG R1001 when shift
condition R000 is ON.
R1001 R500 R001 R1002
R500 ON, shift to STG R1002 when
 STG JMP 
shift condition R001 is ON.
R1002 R501 R002 R1001
 STG JMP  R501 ON, shift to STG R1001 and
process repeatedly when shift condition
R002 is ON.
R1003 Shift to STG R1003 when shift condition
R003
R003 is ON
JMP

R1003 R502 R004


 STG ENDS  R502 ON, Stop when shift condition
R004 is ON.

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-13


Stage Processing Instruction
APPLIED INSTRUCTIONS

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specifying and index modify range is inappropriate. Otherwise, OFF.
CR2012
Does not change when indirect specifying or index modify is not specified to the operand.

* 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)

■ Precautions on stage instructions


Interlock
When a stage migrates, the previous and next stages turn ON simultaneously for one scan only.
Provide an interlock circuit for outputs (e.g. forward or reverse rotation of motor) that might cause a
hazard when both of these stages simultaneously turn ON.

R1000 R501 R500 R001 R1001


STG JMP

R1001 R500 R501 R002 R1002


STG JMP

Interlock
Double coils
Double coils can be used in stage instructions.

R1000 R500 R001 R1100 R1001


STG ↑ JMP
R1100
R1001 R501 R002 R1101 R1002
STG ↑ JMP
R1101
R1002 R500 R003 R1102 R1003
STG ↑ JMP
R1102

* When STG R1000 and R1002 turn ON simultaneously, output R500 of STG R1002 programmed
later is given priority.

3-14 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Stage Processing Instruction

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.

R1000 R500 R000 R1001


STG SET JMP

3
R1001 R501 R001 R1002
STG SET JMP

When there is no JMP instruction

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.

R1000 R500 R001 R501


STG

When there is no STG instruction


When JMP/ENDS instruction is not paired with STG instruction, the operation cannot be ensured due
to lack of control relays to be reset.

R000 R500 R1001


JMP

R001

R1001 R002
ENDS

Execute condition of STG instruction


Let's consider what happens when the STG instruction execution conditions (input relay R000) are
held in an ON state.
In the following ladder, R1000 is set at all times on the first rung even if R001 turns ON and the JMP
instruction is executed. Accordingly, output relay R500 does not turn OFF.
R000(Execution condition) R1000
SET

R1000 R500 R001 R1001


STG JMP

To use a differential type execute condition for the STG instruction.

R000 (Execution condition) R1000


SET

R1000 R500 R001 R1001


STG JMP

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-15


Stage Processing Instruction
APPLIED INSTRUCTIONS

JMP instruction operand


Duplicate use of STG instruction operands is not allowed, although duplicate use of JMP instruction
operands is allowed.

R1000 R500 R001 R1001


STG JMP

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

3-16 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Stage Processing Instruction

APPLIED INSTRUCTIONS
MEMO

struction
Stage Processing In-

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-17


W-ON Sets
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the
W-ONW-OFF

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

3-18 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Stage Processing Instruction

APPLIED INSTRUCTIONS
Point This instruction cannot be used in interrupt programs or in the initialization module.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.

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.

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-19


W-UE Sets
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the bit
W-UE,W-DDE
device
of the

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.

D Specifies the device to be set by the rising/falling edge of S . *1

*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

Execution condition S Execution condition


↑ OFF
ON
D S
OFF
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.

3-20 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Stage Processing Instruction

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

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 a timer/counter has been specified by indirect specification to D
CR2012
• When the indirect specification or index modify range is inappropriate.
No change in state when indirect specification and index modify are not specified.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-21


Stage Processing Instruction
APPLIED INSTRUCTIONS

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.

R000 R001 (Mnemonics list)


↑ LD R000
R1000
W-UE R001 R1000
R1000 R002 LD R1000
↑ W-UE R002 R1001

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

3-22 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Stage Processing Instruction

APPLIED INSTRUCTIONS
MEMO

struction
Stage Processing In-

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-23


Flow Instruction

MC
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Indicat
MC,CR

es the
start of

MC MC Indicates the start of the master control


Master control the
range.
APPLIED INSTRUCTIONS

master
control

MCR MCR Indicates the end of the master control


Master control reset .
range. MCR
Indicat
es the
Ladder program Input mode
end of
Execution condition MC the
M C ( I L ) master
control
range.

3
M C R ( I L C )

MCR
Flow Instruction

Available Devices ( ): Not supported on the KV-1000


Index
Local
Bit Devices Word Devices Const Ind Spec 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)
- - - - - - - - - - - - - - - - - - - - -

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

when input relay R000 is OFF.


R002
R002 R501
MCR

R003 MCR

R004 R003 R502

• The MC instruction indicates the start of the master control range.


• The MCR instruction indicates the end of the master control range.
• When the MC instruction execution condition is ON, the program between the MC and MCR
instructions is executed in the same way as the regular program (other than the MC to MCR
instructions).

3-24 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

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.

Example When combined with STP and STE instructions


When programmed before or after the
STP
MC and MCR instructions
XXXX
STE

MC

MCR

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-25


Flow Instruction
APPLIED INSTRUCTIONS

When programming the MC to MCR STP


instructions between the instructions XXXX
MC

MCR

STE

When programmed between the MC and MC

3 MCR instructions
STP
XXXX
Flow Instruction

STE

MCR

When programmed with other MC to MCR MC


instructions
MC
When programmed with other MC to MCR
instructions between the MC to MCR MCR
instructions (The MC to MCR instructions
can be nested to a nesting level of 15.) MCR

Other MC to MCR instructions are combined MC


before and after the instruction.
MCR

MC

MCR

Point These instructions cannot be used in the STP


following applications. XXXX
MC

MC STE

MCR

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

3-26 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-27


CALL Sub-
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano routin
e call
CALLBN,RET

SBN Sub-

CALL CALL Sub-routine call Executes the specified sub-routine. routin


APPLIED INSTRUCTIONS

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

Ladder program Input mode


Execution condition n
CALL C A L L n

3 END

SBN
Flow Instruction

n S B N n

RET
R E T

ENDH

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices*1 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 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.

The sub-routine is executed if CALL 000 is executed


Program(A)
during execution of the main routine program.
Main 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

3-28 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

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)

No execute the CALL instruction (input R000 = OFF)

Program (A)
R000 #0
CALL

Program (B)

To execute the CALL instruction (input R000 = ON)

SBN
Program (A)
ࡊࡠࠣ࡜ࡓ A #0
R000 #0
Subroutine
CALL
Program
RET
Program (B)
ࡊࡠࠣ࡜ࡓ B

■ About the sub-routine nesting structure

• Sub-routine instructions can be programmed down


R001 #0
to a nesting level of 16. (nesting structure) CALL
• To call a different sub-routine from inside a sub-
Program (A)
routine, the sub-routine to be called must already be
END
defined (programmed in the previous rung) for the
KV-5500/5000/3000/1000. SBN
#1

Subroutine
Program(A)
RET

SBN
#0
call

Subroutine
Program(B)
R000 #1
CALL
RET

ENDH

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-29


Flow Instruction
APPLIED INSTRUCTIONS

Point When the nested structure contains more than 17 levels, PLC host error 10 will occur, and
operation will stop.

■ About calling of sub-routines from an interrupt program


• Call sub-routines from an interrupt program.
R001 R500
• To call a sub-routine from inside an interrupt
program, the sub-routine to be called must already

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

3-30 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

APPLIED INSTRUCTIONS
MEMO

Flow Instruction

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-31


ECALL To
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano exec
ute
ECALL

subro

ECALL ECALL between module To execute subroutine of


utine
subroutine call specified module.
APPLIED INSTRUCTIONS

of
speci
Ladder program Input mode fied
modu
Execution condition ECALL le.
S n E C A L L S n

Available Devices ( ): Not supported on the KV-1000


Index
Bit Devices Word Devices Const Ind Spec Local Modify
Device
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z
3 S - -
(B)
- - - -
(W) (ZF)
- - - - - - - - - *1
- - - -
Flow Instruction

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)

3-32 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
CR2012
• When the subroutine specified by n is not in the specified module S .

* 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-33


FOR
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Repea
t start
FOR,NEXBREAK

NEXT
Repeatedly executes the instruction
Repea

FOR FOR(.U) FOR sequence between the FOR and NEXT


FOR t block
APPLIED INSTRUCTIONS

FOR.D instructions for the specified number of end


times in a single scan. BREAK
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.

Ladder program Input mode

3 FOR
S F O R S
Flow Instruction

Loop program
Execution condition BREAK
B R E A K
NEXT
N E X T

Available Devices ( ): Not supported on the KV-1000


Index
Bit Devices Word Devices Const Ind Spec Local Modify
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)
- - - - *2 *3 *3 -
S

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

Now it become triply nested


FOR
#3 3

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

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
No change in state when indirect specification and index modify are not specified.

* 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.

"CR/CM List" (Page A-71)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-35


Flow Instruction
APPLIED INSTRUCTIONS

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

KV-7000 Series User's Manual "Indirect Specification"


KV-5500/5000/3000 Series User's Manual "Indirect Specification"

When index modify was used

CR2002 +0 Z10 #0 DM101 (Mnemonics list)


LDA.S STA.S LDA STA
LD CR2002
LDA.S +0
FOR CON
#100 STA.S Z10
CON
CR2002 DM0:Z10 DM100 DM100 DM101 Z10 LDA #0
LDA ADD STA INC INC.S CON
STA DM101
DM100 BREAK FOR #100
>= LD CR2002
#1000 LDA DM0:Z10
CON
NEXT
ADD DM100
CON
STA DM100
CON
INC DM101
CON
INC.S Z10
LD>= DM100 #1000
BREAK
NEXT

3-36 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

APPLIED INSTRUCTIONS
MEMO

Flow Instruction

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-37


CJ
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Perfor
ms a
CJ,NCJTO,LABEL

jump

CJ
CJ condit
Conditional ionally
APPLIED INSTRUCTIONS

Performs a jump to the LABEL instruction. to the


branch
NCJ
NCJ CJLA
BEL
instru

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

Execution condition NCJ ction


n N C J n GOTO
Perfor
GOTO ms a
n G O T O n
jump
uncon
LABEL dition
n L A B E L n
ally to
( ): Not supported on the KV-1000 the
Available Devices
Index LABE
Local
Bit Devices Word Devices Const Ind Spec Device Modify L
Operand instru
MR DM EM ction.
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/: Z LABEL Jump
(B) (W) (ZF)
destin
*1
n - - - - - - - - - - - - - - - - - - - ation
of the
Operand Explanation LABE
n Specifies the label No.*1 LCJ or
GOTO
*1 The sub-routine No. can be specified within the range 0 to 999 ("#" can be omitted). The sub- instru
ctions
routine No. cannot be specified in $ (HEX).

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

NCJ Execute Execute

3-38 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-39


Flow Instruction
APPLIED INSTRUCTIONS

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

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

3-40 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

APPLIED INSTRUCTIONS
MEMO

Flow Instruction

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-41


SCJ
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Perfor
SCJ

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

Reference Please read CJ instruction for other Description of Operation.


"CJ instruction" (Page 3-38)

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

* 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)

3-42 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Flow Instruction

APPLIED INSTRUCTIONS
Sample Program
When CJ instruction is used, R500 will not be OFF. When SCJ instruction is used, SCJ instruction will
be OFF.

R000 (Mnemonics list)


MR000
↑ LDP R000
OR MR000
MR000 OUT MR000
LD MR000

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-43


Macro Instructions

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

3 Execution condition MCALL


Based on macro to be executed*1 M C A L L S *
*1
Argument 1 Argument 2 …*
self-
hold
type
Macro Instructions

Execution condition macro


MSTRT *1
.
Based on macro to be executed*1 M S T R T S * Argument 1 Argument 2 …*
MEND Stops
execu
Execution condition MEND tion of
M E N D
the
self-
Available Devices ( ): Not supported on the KV-1000 hold
Index
1 Local Modify type
Bit Devices Word Devices* Const Ind Spec Device macro
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 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.

Available Devices ( ): Not supported on the KV-1000


Index
1 Local
Bit Devices Word Devices* Const Ind Spec 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)
Device *4 *4 *7 *6 *4 *4
- - - - - -
Value *6 *7 *7
- - - - -
Unit *5
- - - - - - - - - - - - - - - - - - -

*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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-45


Macro Instructions
APPLIED 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

• When an MCALL/MSTRT instruction is written to step (in the STP - STE


instructions)
• When an MCALL/MSTRT instruction is written to interrupt (in the INT - RETI
instructions)
• When an MSTRT instruction is written to stage (in the STG - JMP instructions)
• MCALL and MSTRT instructions can not be used in macros.
• MCALL/MSTRT instructions cannot be used in function blocks/functions.
• Sub-routines can be used in macros, but interrupt programs can not be used.
• When performing a certain macro repeatedly in a project, the global devices used in
OUT/OUB instruction in a macro will become double coils.
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"

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.

* The macro is not executed when the argument is inappropriate.


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)

Point The state of the operation flag does not change by the MEND instruction.

3-46 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Macro Instructions

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)

4 /'0& LD R002


MEND
࡮࡮࡮࡮

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-47


ction Block Instructions

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

FUN Function call Calls the specified function.


UN
func
tion

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 FEND


F E N D

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-49


Function Block Instructions
APPLIED 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

• When an FB/FUN instruction is written to interrupt (in the INT - RETI


instructions)
• When an FB instruction is written to stage (in the STG - JMP instructions)
• FB instructions cannot be used in functions.
• FB/FUN instructions cannot be used in macros.
• FB/FUN instructions that call the function block/function itself cannot be used in that
function block/function.
• Sub-routine programs can be used in function blocks/functions, but interrupt programs
cannot be used.
• When performing a certain function block/function multiple times in a project, the global
devices used in the OUT/OUB instruction in a function block/function will become
double coils.
KV-7000 Series User's Manual

Operation flag

CR2009 The state depends on the processing result in the function block/function to execute.
CR2010 The state depends on the processing result in the function block/function to execute.
CR2011 The state depends on the processing result in the function block/function to execute.
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

* If the argument is inappropriate, the function block/function will not be executed.


KV-7500/7300 When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List" (Page A-71)

Point The state of the operation flag does not change by the FEND instruction.

3-50 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Function Block Instructions

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.

R000 (Mnemonics list)


Function block A
↑ LDP R000
#1 Input1 Output1 DM0
FB Function block A #1 DM0

Function block "function block A" stops when input relay R001 is ON.

Function block A
・・・・ 3

Instructions
Function Block
(Mnemonics list)

R001 FEND LD R001


FEND
・・・・

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)

EM0 Input1 Output1 MR000 LD R002


FUN Function B EM0 MR000

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-51


Module Instructions

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

Execution condition MDSTOP


S M D S T O P S

3 Available Devices ( ): Not supported on the KV-1000


Index
Local
Module Instructions

Bit Devices Word Devices Const Ind Spec 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)
*1
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.

3-52 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Module Instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

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.

R000 _Module1 _Module2 _Module3 R001 MDSTRT (Mnemonics list)


↑ Module1 (1) LDP R000
ANB _Module1
Execute module when ON*1 R002 MDSTRT ANB _Module2
Module2 (2) ANB _Module3
MPS
AND R001
R003 MDSTRT MDSTRT Module1
Module3 (3) MRD
AND R002
R009 MDSTOP MDSTRT Module2
Module1 MPP
AND R003
(4) MDSTRT Module3
MDSTOP LD R009
Module2
MDSTOP Module1
MDSTOP Module2
MDSTOP MDSTOP Module3
Module3

(1) Module 1 is executed when R001 is ON.


(2) Module 2 is executed when R002 is ON.
(3) Module 3 is executed when R003 is ON.
(4) Module 1 to 3 is stopped when R009 is ON.

*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".

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-53


Index Register Instructions

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

Index register ZPOP Index


index register to the regist
batch purge
@ZPUSH @ZPUSH.S
@ZPUSH.L
ZPUSH specified data block. er
batch
restor

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.

3 Ladder program Input mode


Execution condition ZPUSH
structions
Index Register In-

D Z P U S H D

Execution condition ZPUSH


D @ Z P U S H D

Execution condition ZPOP


D Z P O P D

Execution condition ZPOP


D @ Z P O P D

Available Devices ( ): Not supported on the KV-1000


Index
Local
Bit Devices Word Devices Const Ind Spec 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)
D *2
- - - - - - - - - - - - - -

Operand Explanation
D Specifies the leading device ofthe purge destination data block.*1

*1 KV-7500/7300/5500/5000/3000, KV Nano Series

(.S) : A minimum of 13 continuous words is occupied.


When nesting instructions, "number of purges x 12 words + 1" words are occupied.
(.L) : A minimum of 27 continuous words is occupied.
When nesting instructions, "number of purges x 26 words + 1" words are occupied.
KV-1000 A minimum of 13 continuous words is occupied.
When nesting instructions, "number of purges x 12 words + 1" words are occupied.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.

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

Z10 Z10 D +10


Reserved for system Reserved for system D +11
Reserved for system Reserved for system D +12

3-54 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Index Register Instructions

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

Point Not available for KV-1000 .

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 +0 Purge times bit


15
bit
0

D +1 Z1 Z1
D +2 Z2 Z2

D +10 Z10 Z10


D +11 Reserved for system Reserved for system

D +12 Reserved for system Reserved for system

Point No suffix for KV-1000 .

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 +0 Purge times bit


31
bit bit
16 15
bit
0

D +1 D +2 Z1 Z1
D +3 D +4 Z2 Z2

D +19 D +20 Z10 Z10


D +21 D +22 Reserved for system Reserved for system

D +23 D +24 Reserved for system Reserved for system

Point Not available for KV-1000 .

@ 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 DM1࡮DM2
ZPUSH
DM0

ZPUSH Reserved for system DM23࡮DM24


DM0
Z1 DM25࡮DM26
ZPOP

3 DM0

ZPOP
Reserved for system DM47࡮DM48

DM0 Z1 DM49࡮DM50
structions
Index Register In-

ZPOP
DM0 Reserved for system DM71࡮DM72

• 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

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 [ D +0] is "0". (ZPOP only)
CR2012 • When the data block range exceeds the device range.
• When relays/timers/counters have been specified by indirect specification.
• When the indirect specification and index modify range is inappropriate.

* 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)

3-56 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Index Register Instructions

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

CR2002 ZPUSH Purges the current values of index registers Z1 to


DM0
Z10 to DM0 onwards.
CR2002 +03000 +04000
Sets the values #3000 and #4000 of index
DW.S DW.S
Z1 Z2 registers Z1 and Z2 to be used in the sub-routine.
CR2002 ZPOP
DM0 Restores the values purged to DM0 onwards to
index registers Z1 to Z10.
RET
Ends the sub-routine.

ENDH

(Mnemonics list)
LD CR2008
DW #0 DM0
LD CR2008
DW.S +1000 Z1
CON
DW.S +2000 Z2
CALL #0
END
SBN #0
LD CR2002
ZPUSH DM0
LD CR2002
DW.S +3000 Z1
CON
DW.S +4000 Z2
LD CR2002
ZPOP DM0
RET
ENDH

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-57


Indirect specifying instructions

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

Set address the


specified to the specified word
@ADRSET
ADRSET devic
address. e to
be
indire
Ladder program Input mode ctly

Execution condition ADRSET


S D A D R S E T S D

Execution condition ADRSET


S D @ A D R S E T S D

3 Available Devices ( ): Not supported on the KV-1000


Index
Local
structions
Indirect specifying in-

Bit Devices Word Devices Const Ind Spec 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)
- - - - - - - *3 - - - - - -*2 - -
S
D - - - - - - - *3 - - - - - - - -

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

*1 Continuous 2 words are used.


*2 Only specifiable when using the KV Nano Series.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.

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.

Example ADRSET The address of device S is


S D stored to [ D / D +1].

MOV #12345 is stored to the address


#12345
* D (i.e. S currently stored to
[ D / D +1].

@ADRSET This instruction is executed for one scan at the rising edge of the execution condition.

3-58 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Indirect specifying instructions

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.

* 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, 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)

(1) Store the value of DM0 in [DM500/DM501].


(2) The device (i.e. value of DM0) of the address currently stored to [DM500/DM501] is stored to
DM100.

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)

(1) Store the value of DM0 in [DM500/DM501].


(2) #12345 is stored to the address (i.e. DM0) of the address currently stored to [DM500/DM501].
(3) +5 is stored to index register Z01.
(4) #56789 is stored to DM5 obtained by adding Z01 (+5) to the device (i.e. DM0) of the address
currently stored to [DM500/DM501].

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-59


ADRINC
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Devic
e
ADRINCC,ADRDEC

addre

ADRINC ADRINC
Device address
ss
incre
APPLIED INSTRUCTIONS

Increment address
incremented by 1. mente

@ADRINC ADRINC
d with
1.

ADRDEC ADRDEC ADRDEC


Devic
Device address e
Decrement address
decremented by 1.
@ADRDEC
ADRDEC addre
ss
decre
mente
Ladder program Input mode d with

3
1.
Execution condition ADRINC
D A D R I N C D
structions
Indirect specifying in-

Execution condition ADRINC


D @ A D R I N C D

Execution condition ADRDEC


D A D R D E C D

Execution condition ADRDEC


D @ A D R D E C D

Available Devices ( ): Not supported on the KV-1000


Index
Bit Devices Word Devices Const Ind Spec Local Modify
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)
- - - - - - - *2 - - - - - - - -
D

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

*1 Continuous 2 words are used.


*2 EM and FM (ZF) cannot be used with the KV Nano Series.

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.

3-60 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Indirect specifying instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification and index modify range is inappropriate.
CR2012 • When the address currently stored to the device specified by D is inappropriate.
• When the address after incrementing by the ADRINC instruction is inappropriate.
• When the address after decrementing by the ADRDEC instruction is inappropriate. 3
* The instruction is not executed when CR2012 turns ON.

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.

"CR/CM List" (Page A-71)

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)

(1) Store the value of DM0 in [DM500/DM501].


(2) The device (i.e. value of DM0) of the address currently stored to [DM500/DM501] is
stored to DM100.
(3) The address currently stored to [DM500/DM501] is incremented by 1. (DM0→DM1)
(4) The value of the device (i.e. DM1) of the address incremented by 1 is stored to DM101.

ADRDEC When input relay R000 is ON, store the value of DM20 to DM100 and the value of DM19
to DM101.
(Mnemonics list)
R000 ADRSET
DM20 DM500 (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)

(1) Store the value of DM20 in [DM500/DM501].


(2) The device (i.e. value of DM20) of the address currently stored to [DM500/DM501] is
stored to DM100.
(3) The address currently stored to [DM500/DM501] is decremented by 1. (DM20→DM19)
(4) The value of the device (i.e. DM19) of the address decremented by 1 is stored to DM101.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-61
ADRADD
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Addr
ess
ADRD,ADRSUB

addit

ADRADD ADRADD(.S) ADRADD


ADRSUB
ion
APPLIED INSTRUCTIONS

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

3 Ladder program Input mode


Execution condition ADRADD
structions
Indirect specifying in-

S D A D R A D D S D

Execution condition ADRADD


S D @ A D R A D D S D

Execution condition ADRSUB


S D A D R S U B S D

Execution condition ADRSUB


S D @ A D R S U B S D

Available Devices ( ): Not supported on the KV-1000


Index
Bit Devices Word Devices Const Ind Spec Local Modify
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 - - - - - - - *3 - -*4 -*4 - - - -
D - - - - - - - *3 - - - - - - - -

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

*1 KV-7500/7300/5500/5000/3000, KV Nano Series


(.S) Values are handled as signed 16-bit BIN data. (-32768 to 32767)
(.L) Values are handled as signed 32-bit BIN data. (-2147483648 to 2147483647)
KV-1000 Values are handled as signed 16-bit BIN data. (-32768 to 32767)

*2 Continuous 2 words are 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.

3-62 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Indirect specifying instructions

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

No suffix for KV-1000 .


3
Point

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

Point Cannot be used with KV-1000 .

ADRSUB(.S) When the execution condition is ON, the value of the device specified by S is
subtracted from the address in D .

&  & 5 &  &


#FFTGUU 㧙 8CNWGQH5 #FFTGUU8CNWGQH5

Point No suffix for KV-1000 .

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

Point Cannot be used with KV-1000 .

@ This instruction is executed for one scan at the rising edge of the execution
condition.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-63


Indirect specifying instructions
APPLIED INSTRUCTIONS

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-

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification and index modify range is inappropriate.
CR2012 • When the address in D is inappropriate.
• When the address after a value is added through the ADRADD instruction is inappropriate.
• When the address after a value is subtracted through the ADRSUB instruction is inappropriate.

* 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)

3-64 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Indirect specifying instructions

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)

(1) Store the value of DM10 in [DM500/DM501].


(2) +5 is subtracted from the address stored in [DM500/DM501].
(3) Value of the device of the address (+5 is subtracted) stored in [DM500/DM501]
(DM5) is stored in DM100.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-65


File Register Instructions

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

of the file register to the No. of


switching
@FRSET
FRSET the file
specified No..
regist
er to
the
Ladder program Input mode specifi
ed
Execution condition FRSET
F R S E T n No..
n

Execution condition FRSET


n @ F R S E T n

3 Available Devices ( ): Not supported on the KV-1000


Index
Const Ind Spec Local Modify
Instructions
File Register

Bit Devices Word Devices


Device
Operand
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTHCTC Z CM #/$ #TM * @ :#/:Z
(B) (W) (ZF)
n - - - - *2 *2 -

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• ON when n is larger than 15. (For KV-5500/5000/3000, ON when n is larger
than 3)
CR2012
• ON when the indirect specification and index modify range is inappropriate.
Otherwise OFF

* The instruction is not executed when CR2012 turns ON.


When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List" (Page A-71)

3-66 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


File Register Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-67


FRSTM Save
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the
FRSTMM
batch
ed file
For the KV-7000 Series
regist
FRSTM The file register within the ers of
APPLIED INSTRUCTIONS

designated bank will be the

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

Ladder program Input mode


Execution condition FRSTM
n S D F R S T M n S D

Available Devices ( ): Not supported on the KV-1000


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(-*3) ○ − ○ − − − ○ ○ ○ ○ ○ ○*5 ○*5 ○ ○ ○ − ○ ○ ○

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. 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.

3-68 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


File Register Instructions

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• ON when the value saved in n is larger than "15" ("3" for KV-5500/5000/3000)
• ON when the value saved in S is larger than "999"
CR2012
• ON when the indirect specification or index modify range is inappropriate.
Otherwise, OFF

* 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.

"CR/CM List" (Page A-71)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-69


FRLDM Read
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the
batch
FRLDM

For the KV-7000 Series data


saved
FRLDM
Read the batch data saved in in
APPLIED INSTRUCTIONS

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

Available Devices ( ): Not supported on the KV-1000


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(-*3) ○ − ○ − − − ○ ○ ○ ○ ○ ○*5 ○*5 ○ ○ ○ − ○ ○ ○

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.

3-70 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


File Register Instructions

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• ON when the value saved in n is larger than "15" ("3" for KV-5500/5000/3000)
• ON when the value saved in S is larger than "999"
CR2012
• ON when the indirect specification or index modify range is inappropriate.
Otherwise, OFF.

* The contact turns OFF when CR2012 is ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.

"CR/CM List" (Page A-71)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-71


it Program Instructions

UPSTRT Unit
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano pro
UPSTRT

gra

UPSTRT UPSTRT Start the specified unit m


Unit program start
program. star
APPLIED INSTRUCTIONS

Ladder program Input mode


Execution condition UPSTRT
n1 S D1 D2 U P S T R T n1 S D1 D2

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.

3-72 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
S —: Request details device

Request details device Description


S Program number Specifies the unit program number to start.
S +1 Slot number If the 0 bit of S +3 is ON, specifies the slot number to use.
Specifies the parameters of the unit program to start.
S +2 Parameter
For flow: specifies the first block number to be executed.
Slot specification ON: The slot specified by S +1 is used.
S +3 0 bit
3
method OFF: An assignable empty slot is automatically used.

D2 —: Execution result storage destination 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)

Unit program instruction status Executing Executing

Number of unit program


instructions being executed
+1 -1 +1 -1

Completion code 0 when successful At failure


(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

Number of unit program instructions that can be executed


simultaneously
Up to 16 unit program instructions (UPSTRT/UPSTOP/UFSUS/UFRSM/UMALLOC) can be executed
simultaneously.
If you attempt to execute more than 16, the instruction will not be executed and will go into standby.
When some of the unit program instructions being executed are complete, and the number being
executed becomes 15 or less, the instructions in standby will be executed automatically. If multiple

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

Unit program instruction In standby Starts at this scan

Number of unit program 16 15 16


instructions being executed
1 unit program instruction was
Cannot be started as completed during the previous scan.
16 unit program instructions
are being executed.

* The number of unit program instruction executions is the total number of UPSTRT/UPSTOP/UFSUS/
UFRSM/UMALLOC instructions being executed.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
This flag is ON in any of the following instances. Otherwise it is OFF.
• When the unit number specified with n1 is 0 or 49 or more
• When the unit with the unit number specified by n1 is not connected
• When the unit with the unit number specified by n1 is not a KV-7000 Series high-
performance expansion unit (X-Unit)
CR2012
• When a 4-word device cannot be allocated from the device specified with S
• When a 2-word device cannot be allocated from the device specified with D2
• When a bit device other than the timer, counter or leading one of the channel is specified in
S , D1 or D2
• When the indirect specification or index modification range is inappropriate

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List" (Page A-71)

3-74 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Unit Program Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-75


UPSTOP Unit
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano pro
UPSTOP

gra
Force the unit program m

UPSTOP UPSTOP Unit program forc


being executed in the
forced stop
APPLIED INSTRUCTIONS

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)

3-76 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
D1 —: Execution result storage destination device

Execution result device Description


Turns OFF when executing the instruction, turns ON when
0 bit Completion bit complete. Turns on regardless of whether the instruction ends
D1 normally or abnormally.
Execution failed If execution of the instruction fails, turns ON simultaneously with the
1 bit
bit completion bit. Turns OFF when executing the instruction.
The completion code is stored when the instruction is complete.
0: Started normally. 3
1: The specified unit program does not exist.

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
This flag is ON in any of the following instances. Otherwise it is OFF.
• When the unit number specified with n1 is 0 or 49 or more
• When the unit with the unit number specified by n1 is not connected
• When the unit with the unit number specified by n1 is not a KV-7000 Series high-
performance expansion unit (X-Unit)
CR2012
• When a 16-bit device cannot be allocated when a bit device was specified in n1 and
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

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List" (Page A-71)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-77


UFSUS
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Sus
UFSUS UFRSM

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

Ladder program Input mode


Execution condition UFSUS
n1 n2 n3 D1 U F S U S n1 n2 n3 D1

Execution condition UFRSM

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)

3-78 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Unit Program Instructions

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.

n3 : Request details device

Request details device Description


ON: Blocks being executed are forcefully stopped, and flow is
Suspension suspended.
n3 0 bit
method OFF: Flow is suspended when the blocks being executed are
completed.

D1 —: Execution result storage destination device

Execution result device Description


Turns OFF when executing the instruction, turns ON when
Completion
0 bit complete. Turns ON regardless of whether the instruction ends
bit
D1 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.
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.

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-79


Unit Program Instructions
APPLIED INSTRUCTIONS

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
This flag is ON in any of the following instances. Otherwise it is OFF.
• When the unit number specified with n1 is 0 or 49 or more
• When the unit with the unit number specified by n1 is not connected

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

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List" (Page A-71)

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

3-80 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
MEMO

Unit Program
Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-81


UMALLOC
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Allo
UMALLOC

cat
Allocate an area of the e

UMALLOC UMALLOC Allocate buffer buff


unit buffer memory that
memory
APPLIED INSTRUCTIONS

er
can be used freely. me
mor
Ladder program Input mode y

Execution condition UMALLOC


n1 n2 D1 D2 U M A L L O C n1 n2 D1 D2

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 .

Reference • The area is automatically allocated.


• Values can be freely read from/written to the allocated area.
• When the unit's operation enabled relay turns OFF, the allocated area is deallocated.

3-82 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
D1 : Result storage destination device

Result storage destination device Description


Turns OFF when executing the instruction, turns ON when
0 bit Completion bit complete. Turns ON regardless of whether the instruction ends
D1 normally or abnormally.
Execution failed If memory cannot be allocated, turns ON simultaneously with the
1 bit
bit completion bit. Turns OFF when executing the instruction.

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
This flag is ON in any of the following instances. Otherwise it is OFF.
• When the unit number specified with n1 is 0 or 49 or more
• When the unit with the unit number specified by n1 is not connected
• When the unit with the unit number specified by n1 is not a KV-7000 Series high-
performance expansion unit (X-Unit)
CR2012
• When a 16-bit device cannot be allocated when a bit device was specified in n1 and
n2
• When a bit device other than the timer, counter or the leading one of the channel is specified
in D1 or D2
• When the indirect specification or index modification range is inappropriate

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List" (Page A-71)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-83


Buffer Memory Instructions

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

Ladder program Input mode


Execution condition UREAD
3 n1 n2 D n3
(
U R E
F R O M
A D

n1
n1
n2
n2
D n3
D
)
n3
Buffer Memory In-
structions

Execution condition UREAD


@ U R E A D n1 n2 D n3
n1 n2 D n3
( @ F R O M n1 n2 D n3 )

Available Devices ( ): Not supported on the KV-1000


Index
Bit Devices Word Devices Const Ind Spec Local Modify
Device
Operand
MR DM EM T C
R (DR) LR T C CTC CR TM FM *3 *3 CTHCTC Z CM #/$ #TM * @ :#/:Z
(B) (W) (ZF)
n1 - - - - *5 *6 *6 -
n2 - - - - *5 *6 *6 -
*5 *4 *4
D - - - - - - - - -
n3 - - - - *5 *6 *6 -

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.

3-84 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Buffer Memory Instructions

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 .

Buffer Memory In-


structions
@UREAD.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate (for the KV-7000 Series,
when indirect specification is used to specify a device other than the leading device of the
channel)
• When the specified unit No. in n1 exceeds 49.
CR2012 • When the range of the specified buffer memory address in n2 and n3 exceeds
32768 (60000 for the KV-7000 Series).
• When the specified device range in D and n3 exceeds the upper limit.
• When there is no buffer memory in the n1 specified unit with unit No..
• When the unit of unit number designated at n1 is not connected during the use of
KV-7000 series.

* The instruction is not executed when CR2012 turns ON.


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
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.

R30000 UREAD.L (Mnemonics list)


#1 #0 DM0 #2 LD R30000
UREAD.L #1 #0 DM0 #2

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-85


U
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
UWR

UWRIT(.U)
UWRIT.S
UWRIT
UWRIT
APPLIED INSTRUCTIONS

UWRIT.D Write device


UWRIT.L Write data with
UWRIT.F
buffer specified range
@UWRIT(.U)
@UWRIT.S
memory into the buffer

@UWRIT
UWRIT
@UWRIT.D memory.
@UWRIT.L
@UWRIT.F

Ladder program Input mode


Execution condition UWRIT
3 n1 n2 S n3
(
U W R
T O
I

n1
T

n2
n1
S
n2
n3 )
S n3
Buffer Memory In-
structions

Execution condition UWRIT


@ U W R I T n1 n2 S n3
n1 n2 S n3
(@ T O n1 n2 S n3 )

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM T C
R (DR) LR T C CTC CR TM FM *3 *3 CTHCTC Z CM #/$ #TM * @ :#/:Z
(B) (W) (ZF)
n1 - - - - *4 *5 *5 -
n2 - - - - *4 *5 *5 -
S - - - - *4 *6 *6 - - - -
n3 - - - - *4 *5 *5 -

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state 3
ON when one of the following conditions is established. Otherwise, OFF

Buffer Memory In-


structions
• When the indirect specification or index modify range is inappropriate (for the KV-7000 Series,
when indirect specification is used to specify a device other than the leading device of the
channel)
• When the specified unit No. in n1 exceeds 49.
CR2012 • When the range of the specified buffer memory address in n2 and n3 exceeds
32768 (60000 for the KV-7000 Series).
• When the specified device range in S and n3 exceeds the upper limit.
• When there is no buffer memory in the n1 specified unit with unit No..
• When the unit of unit number designated at n1 is not connected during the use of
KV-7000 series.
* The instruction is not executed when CR2012 turns ON.
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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-87


U
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
UFILL

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

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM T C
R (DR) LR T C CTC CR TM FM *3 *3 CTHCTC Z CM #/$ #TM * @ :#/:Z
(B) (W) (ZF)
n1 - - - - *4 *5 *5 -
n2 - - - - *4 *5 *5 -
S - - - - *4 *6 *6 - - - -
n3 - - - - *4 *5 *5 -

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.

3-88 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Buffer Memory Instructions

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.

Buffer Memory In-


structions
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate (for the KV-7000 Series,
when indirect specification is used to specify a device other than the leading device of the
channel)
• When the n1 specified unit No. exceeds 49.
CR2012 • When the range of the specified buffer memory address in n2 and n3 exceeds
32768 (60000 for the KV-7000 Series).
• When there is no buffer memory in the n1 specified unit with unit No..
• When the unit of unit number designated at n1 is not connected during the use of
KV-7000 series.
* The instruction is not executed when CR2012 turns ON.
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
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.

R000 (Mnemonics list)


UFILL
#0 #1000 #0 #16 LD R000
UFILL #0 #1000 #0 #16

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-89


ion

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


IS_□□□

You can check the


IS_□□□
IS_□□□
Unit type judgment
specified unit type.
APPLIED INSTRUCTIONS

Ladder program Input mode


Execution condition IS_□□□
n1 D I S _ □ □ □ n1 D

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

*1 When a bit device is specified, 16 continuous bits are occupied.


When a relay other than the first relay of the channel (MR002, R1012, etc.) is specified, 16 bits
straddling the next channel are occupied.
When a word device is specified, 1 word is occupied.
*2 When a word device is specified, the LSB is used as the notification bit device. Nothing except
the LSB is changed.

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.

Instruction and unit type


Replace "IS_" in the instruction with "KV-" to find the corresponding unit type.
Example)
(Instruction) (Unit type)
IS_XH16ML → KV-XH16ML

3-90 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Unit type judgment instruction

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
This flag is ON in any of the following instances. Otherwise it is OFF.
CR2012 • When the unit number specified with n1 is 49 or more
• When the indirect specification or index modification range is inappropriate

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List" (Page A-71)
3

Unit type judgment


instruction
Sample Program
Checks if the unit connected to unit No.1 is KV-XH16ML on the first scan of the function block, and
stores the result in MR000.
(Mnemonics list)
@CR2008 IS_XH16ML
#1 MR000 LD @CR2008
IS_XH16ML #1 MR000

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3-91


Unit type judgment instruction
APPLIED INSTRUCTIONS

MEMO

3
Unit type judgment
instruction

3-92 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
4
ARITHMETIC OPERATION
INSTRUCTIONS
These instructions are for executing comparisons, arithmetical calculations,
logical calculations, data transfer, and text string processing.
These instructions allow you to program the complex arithmetic calculation
circuits simply.

Data Move Instructions.......................................................... 4-2


Arithmetic/Comparison Instructions .................................... 4-38
Arithmetic Operation Instructions ........................................ 4-78
Data Shift Instructions ......................................................... 4-92
Data control instructions.................................................... 4-130
Data Conversion Instructions ............................................ 4-156
Floating Point Instructions ................................................. 4-196
Text Processing Instructions.............................................. 4-234
Simple Operation Instructions ........................................... 4-318

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-1


Data Move Instructions
MOV Stores 16/32/64-
bit data to a

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
specified device.

MOV

MOV(.U)
MOV.S

MOV MOV.D MOV


MOV.L
MOV.F
MOV.DF Stores 16/32/64-bit data to a
Move
@MOV(.U) specified device.
@MOV.S

@MOV @MOV.D MOV


@MOV.L
@MOV.F
@MOV.DF

Ladder program Input mode


Execution condition MOV

4 S D M O V S D

Execution condition
Data Move Instructions

MOV
S D @ M O V S D

Available Devices ( ): Not supported on the KV-1000


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 - - - - *6 *4 *4 *4*7 *4*7 *5

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 .

4-2 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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

DM98: 0 S : 12345 DM98: 0

DM99: 0 DM99: 0

DM100: 0 Transfer D : DM100: 12345

DM101: 0 DM101: 0

DM102: 0 DM102: 0

4
16-bit
(1 word)

Data Move Instructions


When the device is specified to S MOV
DM99 DM101

Data memory status before executing instruction Data memory status before executing instruction

DM98: 0 DM98: 0

DM99: 12345 : S DM99: 12345

DM100: 0 DM100: 0

DM101: 0 Transfer D : DM101: 12345

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].

Example When the constant is specified to S


MOV.D
#12345678 DM14

Data memory status before executing instruction Data memory status after executing instruction
Higher bit Lower bit Higher bit Lower bit

DM11: 0 :DM10 S DM11: 0 :DM10


DM13: 0 :DM12 : #12345678 DM13: 0 :DM12
DM15: 0 :DM14 Transfer DM15: 12345678 :DM14 : [ D / D +1]
DM17: 0 :DM16 DM17: 0 :DM16
DM19: 0 :DM18 DM19: 0 :DM18
32-bit
(2 words)

MOV.D
When the device is specified to S
DM12 DM16

Data memory status before executing instruction Data memory status after executing instruction

Higher bit Lower bit Higher bit Lower bit

DM11: 0 :DM10 DM11: 0 :DM10


DM13: 12345678 :DM12 : [ S / S +1] DM13: 12345678 :DM12
DM15: 0 :DM14 DM15: 0 :DM14
DM17: 0 :DM16 Transfer DM17: 12345678 :DM16 : [ D / D +1]

DM19: 0 :DM18 DM19: 0 :DM18


32-bit
(2 words)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-3


ARITHMETIC OPERATION INSTRUCTIONS

Data Move Instructions

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 .

Example When the constant is specified to S


MOV.F
+1.234 DM14

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

DM17: 0 :DM16 DM17: 0 :DM16


DM19: 0 :DM18 DM19: 0 :DM18

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

DM19: 0 :DM18 DM19: 0 :DM18

32-bit (2 words)

Point Operation cannot be performed when indirect specifying in D is used to specify T


and C.

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

DM17: 0 :DM14 DM17: 0 :DM14

DM21: 0 :DM18 Transfer DM21: +1.23456789 :DM18 : D

DM25: 0 :DM22 DM25: 0 :DM22

DM29: 0 :DM26 DM29: 0 :DM26

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

DM17: +1.23456789 :DM14 S DM17: +1.23456789 :DM14

DM21: 0 :DM18 DM21: 0 :DM18

DM25: 0 :DM22 Transfer DM25: +1.23456789 :DM22 : D

DM29: 0 :DM26 DM29: 0 :DM26

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.

4-4 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

Operation flag

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.

* 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) 4

Data Move Instructions


Sample Program
When input relay R000 is ON, the content of DM0 is moved to DM100.
(Mnemonics list)
R000 MOV
LD R000
DM0 DM100
MOV DM0 DM100

Example for specifying bit device in operand


The states of internal auxiliary relays R1000 to R1015 are stored to DM0.
R1015 R1000 (Mnemonics list)
CR2002 MOV 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Internal auxiliary relay
LD CR2002
R1000 DM0
MOV R1000 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.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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-5


LDA Stores data to
internal

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano registers


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode


Execution condition S

4 LDA STA L D A S

Execution condition S
Data Move Instructions

LDA STA @ L D A S

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *3 *3 *3*6 *3*6 *4

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)

4-6 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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.

S +1 S 32-bit internal register

12345678 → 12345678
32-bit
(2 words)
32-bit
(2 words) 4

Data Move Instructions


LDA.L When the execution condition is ON, signed 32-bit BIN data specified by [ S /
S +1] is stored to the 32-bit internal register.

S +1 S 32-bit internal register

-12345678 → -12345678
32-bit 32-bit
(2 words) (2 words)

LDA.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.

Example When the constant is specified to S

32-bit internal register


S : +1.234 +1.234
32-bit

When the device No. is specified to S

S +1 S 32-bit internal register


+1.234 +1.234
32-bit
32-bit
(2 words)

LDA.DF When the execution condition is ON, double precision floating point type real number
stored in device specified by S is stored to the 64-bit internal register.

Example When the constant is specified to S


64-bit internal register

S : +1.23456789 +1.23456789
64-bit

When the device No. is specified to S

S +3 S +2 S +1 S 64-bit internal register

+1.23456789 +1.23456789
64-bit
64-bit
(4 words)

@LDA. 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-7


ARITHMETIC OPERATION INSTRUCTIONS

Data Move Instructions

Operation flag

CR2009 No change in state


CR2010 ON when the value read from the device specified to the operand is 0. Otherwise, OFF.
CR2011 No change in state
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.

* 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.

4 "CR/CM List" (Page A-71)


Data Move Instructions

Sample Program
See the sample program for the STA instruction.
"Sample Program" (Page 4-12)

4-8 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

MEMO

Data Move Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-9


STA Stores data in
internal registers to

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
a specified device

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

Ladder program Input mode


Execution condition D

4 LDA STA S T A D

D
Data Move Instructions

Execution condition
LDA STA @ S T A D

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *3 *3 - *3*6 *4
-

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 .

16-bit internal register D


1234 → 1234
16-bit 16-bit
(1 word) (1 word)

4-10 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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 .

16-bit internal register D


-1234 → -1234
16-bit 16-bit
(1 word) (1 word)

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

Data Move Instructions


internal register is stored to the device specified by [ D / D +1].

32-bit internal register D +1 D


-12345678 → -12345678
32-bit 32-bit
(2 words) (2 words)

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].

32-bit internal register D +1 D


+1.234 → +1.234
32-bit
32-bit
(2 word)

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].

64-bit internal register D +3 D +2 D +1 D


+1.23456789 → +1.23456789
64-bit
64-bit
(4 word)

@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

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.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-11


ARITHMETIC OPERATION INSTRUCTIONS

Data Move Instructions

Sample Program

Changing setting values of the timer


When input relay R000 is ON, the setting value of timer T0 is set to #100.
When input relay R000 is OFF, the setting value of timer T0 is changed to the value currently stored to
DM0.
(Mnemonics list)
R000 #100 T0
LDA STA LD R000
LDA #100
CON
4 R000 DM0
LDA
T0
STA
STA T0
LDB R000
LDA DM0
Data Move Instructions

CON
STA T0

To change the current value of timers/counters, use the MOV instruction.

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.

Moving current value of counter to DM


When input relay R000 is ON, the current value of counter C0 is stored to DM0.
When input relay R001 is ON, the current value of counter C0 is stored to DM100.
(Mnemonics list)
R000 C0 DM0
LDA STA LD R000
LDA C0
R001 MOV CON
C0 DM100 STA DM0
LD R001
MOV C0 DM100

Example for specifying bit device in the operand


The states of input relays R000 to R015 are stored to DM0.
R015 R000 (Mnemonics list)
CR2002 R000 DM0 111 0 1 0 1 0 1 0 1 0 1 0 1 0 Input relay
LD CR2002
LDA STA
LDA R000
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

The state of DM0 is output to output relays R500 to R515.


(Mnemonics list)
CR2002 DM0 R500 111 0 1 0 1 0 1 0 1 0 1 0 1 0 DM0
LDA STA LD CR2002
LDA LDA DM0
CON
111 0 1 0 1 0 1 0 1 0 1 0 1 0
16-bit internal register
STA R500

R515
STA R500

111 0 1 0 1 0 1 0 1 0 1 0 1 0 Output relay

4-12 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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

Data Move Instructions


LDA STA LD CR2002
LDA LDA DM0
111 0 1 0 1 0 1 0 1 0 1 0 1 0
16-bit internal register CON
STA R503
6ch 5ch
R602

→ STA R503

? ? ? 0 1 0 1 0 1 0 1 0 1 0 1 0 Output relay

No data is stored in R600 to R602.


No status change for R600 to R602
before and after executing instruction.

In case of KV-7500/7300/5500/5000/3000 and KV Nano Series, straddle channel storage


is performed.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-13


PLDA Only the
specified bit

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
counts of the
data are stored
in internal
PLDA
register.

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.

Ladder program Input mode


Execution condition S
PLDA STA P L D A S n
n

Execution condition S
PLDA STA @ P L D A S n
n

4 Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
Data Move Instructions

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.

S 16-bit internal register


MSB LSB

0 0 0 1111 0 1 0 1 0 1 0 1 0 0000000101010101

When the device specified with S is a word device or constant


When the execution condition is ON, the counting of the specified n low bits in the
unsigned 16-bit BIN data in S is stored in internal register. For the unspecified high
bits side, 0 is stored.

S 16-bit internal register


MSB LSB MSB LSB

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

PLDA.D When the device specified with S is a bit device


When the execution condition is ON, the counting of the specified n low bits in the
unsigned 16-bit BIN data in [ S / S +1] is stored in Internal Register. For the
unspecified high bits side, 0 is stored.
S 32-bit internal register
MSB LSB

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

When the device specified with S is a word device or constant


When the execution condition is ON, the counting of the specified
unsigned 16-bit BIN data in [ S / S
n low bits in the
+1] is stored to 32-bit internal register. For the
4
unspecified high bits side, 0 is stored.

Data Move Instructions


S +1 S 32-bit internal register
MSB LSB

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

CR2009 No change in state


CR2010 ON when the value read from the device specified to the operand is 0. Otherwise, OFF.
CR2011 No change in state
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.

* 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-15


PSTA Store the
counting of
specified bits in

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
internal register
into the device.

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

4 Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
Data Move Instructions

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.

16-bit internal register


D
MSB LSB

0000000101010101 0001111 010101010

When the device specified with D is a word 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.
16-bit internal register D
MSB LSB MSB LSB

0000000101010101 00001111 01010101

4-16 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

PSTA.D 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 32-
bit BIN data stored in internal register is specified for D , with the leading device
being the lowest bit.

32-bit internal register


D
MSB LSB

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

When the device specified with D is a word device


When the execution condition is ON, the bit counting of
bit BIN data stored in internal register is specified for [ D
n
/
low bits in unsigned 32-
D +1], with the leading
4
device being the lowest bit.

Data Move Instructions


32-bit internal register D +1 D
MSB LSB

00000001010101010101010101010101 000111 01010101010101010101010101

@PSTA. Only one scan is executed at the rising edge of the execution conditions.

Operation flag

CR2009 No change in status


CR2010 No change in status
CR2011 No change in status
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.

* 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-17


TMIN Inputs 32-bit
numerical

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
values set by the
digital trimmer to
an internal
TMIN
register

TMIN TMIN
Trimmer
Inputs numerical values set by the
digital trimmer in the access
@TMIN TMIN window to an internal register.

Ladder program Input mode


Execution condition n
TMIN STA.D T M I N n

Execution condition n
TMIN STA.D @ T M I N n

Available Devices ( ): Not supported on the KV-1000


Index

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

(B) (W) (ZF)


n  -  - - -   *3   *4 *4   *2
-   

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."

·Set value of timer or counter


·Relay ch No.
TMIN 32-bit internal register STA.D
·Data Memory
·Temporary data memory

Value for digital trimmer Numeric data within


of Access Window is 0 to Input the range of 0 to Transfer Transfer destination device
4294967295 4294967295

4-18 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

Reference Each of the upper limit can be set to digital trimmers.


KV-7500/7300/5500/5000/3000 For KV-5000/3000, click "CPU system setting" -> "Digital trigger
upper limit setting" from Workspace of KV-STUDIO to select the required option.
KV-1000 To enable preset upper limit, you must set using the MEMSW instruction.
"MEMSW instruction" (Page 3-4)
Upper Limit Store Destination
Trimmer No.
Upper Lower
0 CM1701 CM1700
1 CM1703 CM1702
2 CM1705 CM1704

4
3 CM1707 CM1706
4 CM1709 CM1708
5 CM1711 CM1710

Data Move Instructions


6 CM1713 CM1712
7 CM1715 CM1714

@TMIN Only one scan is executed at the rising edge of the execution conditions.

Operation flag

CR2009 No change in state


CR2010 ON when the value captured from the digital trimmer 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.

* 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.
"CR/CM List" (Page A-71)

Sample Program

Input numeric value of trimmer (Mnemonics list)


0 to 32-bit internal register. LD CR2002
TMIN #0
Transfer value in 32-bit internal CON
register to setting value of timer STA.D T0
CR2002 #0 T0 T0. LD R000
TMIN STA.D TMR #0 #65535
CON
AND T0
R000 #65535 T0 R500 OUT R500
T0

Output R500 ON when current


value of T0 change to #0.

T0 functions delay ON timer when


R000 is ON.
Disable for setting value (#65535)
of T0.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-19


DW Data Move

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode

Execution condition S

4 DW
D
D W S D

S
Data Move Instructions

Execution condition
DW @ D W S D
D

Available Devices ( ): Not supported on the KV-1000


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 - - - - - - - - - - - - - - -  - - - -
D  -  - - -   *6 *4 
*4 *4*7 *4*7 *5  -    

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)

4-20 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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

Data Move Instructions


16-bit
(1 word)

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-21


ARITHMETIC OPERATION INSTRUCTIONS

Data Move Instructions

Operation flag

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.

* 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.

4 "CR/CM List" (Page A-71)


Data Move Instructions

Sample Program
When input relay R000 turns ON, #100 is stored to data memory DM0.

#100 (Mnemonics list)


R000
DW LDP R000
DM0 DW #100 DM0

4-22 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

MEMO

Data Move Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-23


BMOV Move source
block moves to
move destination

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

DW

BMOV BMOV(.U) BMOV


BMOV.D Moves 16/32-bit data
Block
in blocks to the
move
@BMOV specified device
@BMOV(.U) BMOV
@BMOV.D

Ladder program Input mode


Execution condition BMOV
S D n B M O V S D n

Execution condition BMOV


S D n @ B M O V S D n

Available Devices ( ): Not supported on the KV-1000

4
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
Data Move Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S - - - - *5
- - - - -
D - - - - *5 - - - - -
n - - - - *5 *6 *6
-

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

Example S :DM100, BMOV


D :EM104. DM100 EM104 #5
n :For #5
Transfer source device Transfer destination device
DM100: 1 1 :EM104
DM101: 3 3 :EM105
DM102: 7 7 :EM106
DM103: 15 15 :EM107
DM104: 31 31 :EM108
16-bit 16-bit
(1word) (1word)

4-24 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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]

Example S :DM100 BMOV.D


D :EM5 DM100 EM5 #3
n :For #3
Transfer source device
Higher bit Lower bit
Transfer destination device
Higher bit Lower bit
4

Data Move Instructions


DM101: 0001 2345 :DM100 EM6: 0001 2345 :EM5
DM103: 0012 3456 :DM102 EM8: 0012 3456 :EM7
DM105: 0123 4567 :DM104 EM10: 0123 4567 :EM9
32-bit(2 words ) 32-bit(2 words )

@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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• ON when one of the following conditions is established. Otherwise, OFF.
- When the indirect specification or index modification range is inappropriate.
- When device is specified for n , and move source or move destination device range
CR2012 is exceeded.
- When n =0
• Status does not change when n is a constant, and the indirect specification or index
modification is not used.

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-25


FMOV Move source
batch switches

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
to move
destination

DW

FMOV(.U)
FMOV.S

FMOV FMOV.D FMOV


FMOV.L
FMOV.F
FMOV.DF Batch moves 16/32/64-
Fill
bit data to specified
@FMOV(.U) move
device.
@FMOV.S

@FMOV @FMOV.D FMOV


@FMOV.L
@FMOV.F
@FMOV.DF

Ladder program Input mode

Execution condition FMOV

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

Available Devices ( ): Not supported on the KV-1000


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)
*6 *4 *4 *4*7 *4*7 *5
S - - -
D - - - - *6 *4 *4 - - - - -
n - - - - *6 *7 *7 *5
-

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

Example S :DM100 FMOV


4
:EM104 DM100 EM104 #5

Data Move Instructions


D
n :For #5

Transfer destination device


123 :EM104
Transfer source 123 :EM105

DM100: 123 123 :EM106


16-bit
(1 word) 123 :EM107
123 :EM108
16-bit
(1 word)

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]

Example S :DM100 FMOV.D


D :EM104 DM100 EM104 #5
n :For #5
Transfer destination device
Higher bit Lower bit

EM105: 12345678 :EM104


Transfer source device
Higher bit Lower bit EM107: 12345678 :EM106
DM101: 12345678 :DM100 EM109: 12345678 :EM108
32-bit(2 words)
EM111: 12345678 :EM110
EM113: 12345678 :EM112
32-bit(2 words)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-27


ARITHMETIC OPERATION INSTRUCTIONS

Data Move Instructions

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

S +1 S DM203: +1.234 :DM202

DM101: +1.234 :DM100 DM205: +1.234 :DM204

4 32-bit
(2 words)
DM207: +1.234 :DM206

DM209: +1.234 :DM208


Data Move Instructions

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 .

Example S : DM100 FMOV.DF


DM100 DM200 #5
D : DM200
n : For #5
D +3 D +2 D +1 D
DM203: +1.23456789 :DM200

S +3 S +2 S +1 S DM207: +1.23456789 :DM204

DM103: +1.23456789 :DM100 DM211: +1.23456789 :DM208


64-bit DM215: +1.23456789 :DM212
(4 words)
DM219: +1.23456789 :DM216
64-bit
(4 words)

@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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• ON when one of the following conditions is established. Otherwise, OFF.
- When the indirect specification or index modification range is inappropriate
- When device is specified for n , and move destination device range is exceeded.
CR2012
- When n =0
• Status does not change when n is a constant, and the indirect specification or
index modification is not used.
* 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)

4-28 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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

Data Move Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-29


PMOV Move

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.

Ladder program Input mode


Execution condition PMOV
S n1 D P M O V S n1 D
n2 n3 n2 n3

Execution condition PMOV

4
S n1 D @ P M O V S n1 D
n2 n3 n2 n3
Data Move Instructions

Available Devices ( ): Not supported on the KV-1000


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 - - - - *7 *8 *8 *6
-
n1 - - - - *7 *8 *8 -
D - - - - *7 - - - - -
n2 - - - - *7 *8 *8
-
n3 - - - - *7 *8 *8 -

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.

4-30 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

*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.

Data Move Instructions


*6 A constant can be specified for S only 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)
*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.

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

Before execution After execution


DM100 0101 0101 0101 0101 0101 0101 0101 0101 (no change in state)
DM200 1111 0000 1111 0000 1111 0001 0101 0100

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-31


ARITHMETIC OPERATION INSTRUCTIONS

Data Move Instructions

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

bit bit bit bit

4
31 16 15 0

[ D / D +1]
Data Move Instructions

n2

Execution
Example condition PMOV.D
DM100 #4 DM200

#2 #8

Before execution After execution


DM100 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 (no change in state)
DM200 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0001 0101 0100

@PMOV. 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
.U suffix: ON when n3 = 0 or 16 <+ n1 + n3 or 16<+ n2 + n3 , Otherwise, OFF.
.D suffix: ON when n3 =0 or 32 <+ n1 + n3 or 32<+ n2 + n3 , Otherwise, OFF.
CR2012 ON when the indirect specification and index modify range is inappropriate. Otherwise, OFF.
No change in state when all of n1 , n2 and n3 are constants, and index
specification or index modify has not been specified for both S and D .

* 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)

4-32 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Move Instructions

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

Data Move Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-33


BYLMOV Switch high-order
and low-order,

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
and move data
from move source
to move
BYLMOV
destination

BYLMOV Random continuous byte


BYLMOV Byte
sequence
information in the device is
sent to a specified byte
BYLMOV move position in a specified device
@BYLMOV (L->H) in order from the low-order
byte.

Ladder program Input mode


Execution condition BYLMOV
S n1 D B Y L M O V S n1 D
n2 n3 n2 n3

Execution condition BYLMOV


S n1 D @ B Y L M O V S n1 D

4
n2 n3 n2 n3

Available Devices ( ): Not supported on the KV-1000


Index
Data Move Instructions

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.

Example The following operation takes place when n1 = 3, n2 = 0, and n3 = 6.


Move start position n1
Move source data Data to move
Position 0
bit bit
15 0

S A(41H) B(42H) S +1 C(43H) D(44H)


S +1 C(43H) D(44H) S +2 E(45H) 1(31H)
S +2 E(45H) 1(31H) Number of S +3 2(32H) 3(33H)
S +3 2(32H) 3(33H) move bytes n3 S +4 F(46H) G(47H)

4
S +4 F(46H) G(47H)
7(37H) S(53H)
T(54H) 8(38H)

Data Move Instructions


Transferred data
bit bit
15 0

D 1(31H) C(43H)
D +1 3(33H) E(45H)
D +2 G(47H) 2(32H)
D +3

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the following conditions are specified. Otherwise, OFF.
• When specified device is not within range
• When specified device is not within indirect specification or index modification range
CR2012
• When a bit device other than a timer, counter or channel head is specified for S or
D
• When n3 is 0

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-35


BYBMOV Switch low-order
and high-order,

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
and move data
from move source
to move
BYLMO
destination

Random continuous byte


BYBMOV
BYBMOV

Byte information in the device is


sequence sent to a specified byte
move position in a specified device
@BYBMOV
BYBMOV

(H->L) in order from the high-order


byte.

Ladder program Input mode


Execution condition BYBMOV
S n1 D B Y B M O V S n1 D
n2 n3 n2 n3

Execution condition BYBMOV


S n1 D @ B Y B M O V S n1 D

4
n2 n3 n2 n3

Available Devices ( ): Not supported on the KV-1000


Index
Data Move Instructions

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.

Example The following operation takes place when n1 = 3, n2 = 0, and n3 = 6.


Position 0
Move source data Move start position n1 Data to move
bit bit
15 0

S A(41H) B(42H) S +1 C(43H) D(44H)


S +1 C(43H) D(44H) S +2 E(45H) 1(31H)
S +2 E(45H) 1(31H) Number of S +3 2(32H) 3(33H)
S +3 2(32H) 3(33H) move bytes n3 S +4 F(46H) G(47H)
S +4 F(46H) G(47H)
7(37H) S(53H) 4
T(54H) 8(38H)

Data Move Instructions


Transferred data
bit bit
15 0

D D(44H) E(45H)
D +1 1(31H) 2(32H)
D +2 3(33H) F(46H)
D +3

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the following conditions are specified. Otherwise, OFF.
• When specified device is not within range
• When specified device is not within indirect specification or index modification range
CR2012
• When a bit device other than a timer, counter or channel head is specified for S or
D
• When n3 is 0

* 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 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-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-37


Arithmetic/Comparison Instructions
ADD Addition

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

Ladder program Input mode

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.

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *3 *3 *3*6 *3*6 *4

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.

16-bit internal register S 16-bit internal register

1234 + 4321 = 5555


16-bit 16-bit 16-bit
(1 word)

An overflow occurs if the operation result is greater than 65535.


4-38 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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

1234 + -4321 = -3087


16-bit 16-bit 16-bit
(1 word)

An overflow occurs if the operation result is greater than +32767.


If operation result is less than -32768, underflow will occur.

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

12345678 + 87654321 = 99999999


32-bit 32-bit 32-bit
(2 words)

An overflow occurs if the operation result is greater than 4294967295.

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

12345678 + -87654321 = -75308643


32-bit 32-bit 32-bit
(2 words)

An overflow occurs if the operation result is greater than +2147483647.


If operation result is less than -2147483648, underflow will occur.

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.

32-bit internal register S +1 S 32-bit internal register


Single precision floating Single precision floating Single precision floating
point type real number point type real number point type real number
32-bit 32-bit 32-bit
(2 words)

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.

64-bit internal register S +3 S +2 S +1 S 64-bit internal register


Double precision floating Double precision floating Double precision floating
point type real number point type real number point type real number
64-bit 64-bit 64-bit
(4 words)

@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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-39


ARITHMETIC OPERATION INSTRUCTIONS

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.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-41


SUB Subtraction operation
of 16/32-bit BIN data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode

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.

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *3 *3 *3*6 *3*6 *4

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.

16-bit internal register S 16-bit internal register

5555 4321 = 1234


16-bit 16-bit 16-bit
(1 word)

An underflow occurs if the operation result is less than 0.


4-42 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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.

16-bit internal register S 16-bit internal register

5555 -4321 = 9876


16-bit 16-bit 16-bit
(1 word)

An overflow occurs if the operation result is greater than +32767.


If operation result is less than -32768, underflow will occur.

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

99999999 12345678 = 87654321


32-bit 32-bit 32-bit
(2 words)

An underflow occurs if the operation result is less than 0.

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

87654321 -12345678 = 99999999


32-bit 32-bit 32-bit
(2 words)

An overflow occurs if the operation result is greater than +2147483647.


If operation result is less than -2147483648, underflow will occur.

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.

32-bit internal register S +1 S 32-bit internal register


Single precision floating Single precision floating Single precision floating
point type real number point type real number point type real number
32-bit 32-bit 32-bit
(2 words)

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.

64-bit internal register S +3 S +2 S +1 S 64-bit internal register


Double precision floating Double precision floating Double precision floating
point type real number point type real number point type real number
64-bit 64-bit 64-bit
(4 words)

@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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-43


ARITHMETIC OPERATION INSTRUCTIONS

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.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-45


MUL Multiplication
operation of 16/

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano 32-bit BIN data


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode

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.

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *3 *3 *3*6 *3*6 *4

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

16-bit 16-bit 56088


(1 word)
32-bit

An overflow occurs if the operation result is greater than 65535.


4-46 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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

16-bit 16-bit -15129


(1 word)
32-bit

An overflow occurs if the operation result is greater than +32767.


If operation result is less than -32768, underflow will occur.

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).

32-bit internal register S +1 S TM1 TM0 32-bit internal register

1234 5678 = 7006652


+

32-bit 32-bit 64-bit


(2 words)

An overflow occurs if the operation result is greater than 4294967295.

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).

32-bit internal register S +1 S TM1 TM0 32-bit internal register

-1234 5678 = -7006652


+

32-bit 32-bit 64-bit


(2 words)

An overflow occurs if the operation result is greater than +2147483647.


If operation result is less than -2147483648, underflow will occur.

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.

32-bit internal register S +1 S 32-bit internal register


Single precision floating Single precision floating Single precision floating
point type real number point type real number point type real number
32-bit 32-bit 32-bit
(2 words)

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.

64-bit internal register S +3 S +2 S +1 S 64-bit internal register


Double precision floating Double precision floating Double precision floating
point type real number point type real number point type real number
64-bit 64-bit 64-bit
(4 words)

@MUL. 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-47


ARITHMETIC OPERATION INSTRUCTIONS

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

- 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
the operand.
• For suffix "F”
CR2012 - ON when the indirect specification or index modification range is inappropriate or the
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.

* 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)

4-48 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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.

When the operation result is 0 to 65535


(Mnemonics list)
R000 DM0 DM1 DM10

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

When the operation result is 0 to 4294967295

R000 DM0 DM1 DM10 (Mnemonics list)


LDA MUL STA.D LD R000
R000 DM0 #100 DM10 LDA DM0
LDA MUL STA.D CON
MUL DM1
CON
STA.D DM10
LDB R000
LDA DM0
CON
MUL #100
CON
STA.D 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-49


ARITHMETIC OPERATION INSTRUCTIONS

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.

When the operation result is -32768 to 32767


(Mnemonics list)
R000 DM0 DM1 DM10
LDA.S MUL.S STA.S LD R000
R000 DM0 -100 DM10 LDA.S DM0
CON
LDA.S MUL.S STA.S
MUL.S DM1
4 CON
STA.S DM10
LDB R000
LDA.S DM0
Instructions
Arithmetic/Comparison

CON
MUL.S -100
CON
STA.S DM10

When the operation result is -2147483648 to 2147483647

R000 DM0 DM1 DM10 (Mnemonics list)


LDA.S MUL.S STA.L LD R000
R000 DM0 –100 DM10 LDA.S DM0
LDA.S MUL.S STA.L CON
MUL.S DM1
CON
STA.L DM10
LDB R000
LDA.S DM0
CON
MUL.S -100
CON
STA.L 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

4-50 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

MEMO

Instructions
Arithmetic/Comparison

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-51


DIV Division operation
of 16/32-bit BIN

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano data


ARITHMETIC OPERATION INSTRUCTIONS

ADD

DIV(.U)
DIV.S

DIV DIV.D
DIV.L
DIV

Divides the value of the internal


DIV.F
DIV.DF register by the value specified by
Divide
@DIV(.U) the operand, and stores the result
@DIV.S again to the internal register.

@DIV @DIV.D
@DIV.L
DIV

@DIV.F
@DIV.DF

Ladder program Input mode

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 )*

*For KV-1000 CPU unit, description can be omitted.

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *3 *3 *3*6 *3*6 *4

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

TM0 16-bit internal register S 123 TM1

12345 ÷ 100 = TM0 116-bit internal register Remainder: 45


32-bit 16-bit 123 16-bits
(2 words) (1 word) (1 word)
32-bits

4-52 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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

TM0 16-bit internal register S –123 TM1

–12345 ÷ 100 = TM0 16-bit internal register Remainder: –45


32-bit 16-bit –123 16-bit
(2 words) (1 word) (1 word)
32-bit

Overflow will occur for the operation of -2147483648÷(-1).

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)

Overflow will occur for the operation of -9223372036854775808/ (-1).

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.

32-bit internal register S +1 S 32-bit internal register


Single precision floating Single precision floating Single precision floating
point type real number point type real number point type real number
32-bit 32-bit 32-bit
(2 words)

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.

64-bit internal register S +3 S +2 S +1 S 64-bit internal register


Double precision floating Double precision floating Double precision floating
point type real number point type real number point type real number
64-bit 64-bit 64-bit
(4 words)

@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

- ON when the indirect specification or index modification range is inappropriate.


Otherwise, OFF.
• 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.

* 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, #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

4-54 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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

 Precautions when using DIV.U DIV.S


The DIV.U and DIV.S instructions execute the calculation "32-bit data/16-bit data".
When the calculation "16-bit data/16-bit data" is performed, Highter bit Lower bit
temporary data memory TM000 to which the upper 16 bits of 32-bit
the 32-bit data is stored must be set to "0". TM0 internal register ÷ S
32-bit 16-bit
(1 word)

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

 Precautions when using DIV.D DIV.L


The DIV.D and DIV.L instructions execute the calculation "64-bit data / 32-bit data".
When the calculation "32-bit data / 32-bit data"
is performed, temporary data memory TM0/TM1
to which the upper 32 bits of the 64-bit data is TM1 TM0 32-bit internal register ÷ S +1 S
64-bit 32-bit
stored must be set to "0". (2 words)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-55


ARITHMETIC OPERATION INSTRUCTIONS

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

4  When performing multiplication and division operations continuously


Instructions
Arithmetic/Comparison

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

When the value of DM0 is #10

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.

4-56 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

MEMO

Instructions
Arithmetic/Comparison

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-57


INC Add 1 from the
destination device

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

ADD

INC(.U)

INC INC.S
INC.D
INC

INC.L Increment Increments the device specified


memory by the operand by 1.
@INC(.U)

@INC @INC.S
@INC.D
INC

@INC.L

Ladder program Input mode


Execution condition D
INC I N C D ( + + D )

Execution condition D

4
INC @ I N C D ( @ + + D )

Available Devices ( ): Not supported on the KV-1000


Instructions
Arithmetic/Comparison

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.)

4-58 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

@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

"LDP instruction" (Page 2-4)


"DIFU instruction" (Page 2-22)

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.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-59


ARITHMETIC OPERATION INSTRUCTIONS

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

4-60 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

MEMO

Instructions
Arithmetic/Comparison

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-61


DEC Subtract 1 from
the destination

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
device

ADD

DEC(.U)

DEC DEC.S
DEC.D
DEC

DEC.L Decrement Decrements the device specified


@DEC(.U)
memory by the operand by 1.

@DEC @DEC.S
@DEC.D
DEC

@DEC.L

Ladder program Input mode


Execution condition D
DEC D E C D ( - - D )

Execution condition D

4
DEC @ D E C D ( @ - - D )

Available Devices ( ): Not supported on the KV-1000


Instructions
Arithmetic/Comparison

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.)

4-62 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

@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.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-63


ROOT Square root
extraction

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
operation

ADD

ROOT(.U)
ROOT.S

ROOT ROOT.D
ROOT.L
ROOT

Calculates the square root of the


ROOT.F
Square
ROOT.DF content of the internal registers,
root
@ROOT(.U) and stores the result to the
extraction
@ROOT.S internal register.

@ROOT @ROOT.D
@ROOT.L
ROOT

@ROOT.F
@ROOT.DF

Ladder program Input mode


Execution condition

4 LDA ROOT STA R O O T ( S Q R T )

Execution condition
Instructions
Arithmetic/Comparison

LDA ROOT STA @ R O O T ( @ S Q R T )

Available Devices ( ): Not supported on the KV-1000


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)
- - - - - - - - - - - - - - - - - - - - -
The range of numerical values that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)

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.

Highter bit Lower bit

TM0 internal register = 16-bit internal register


32-bit 16-bit

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.

4-64 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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

TM1 TM0 32-bit internal register = 32-bit internal register


64-bit 32-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.

32-bit internal register 32-bit internal register 4


Single precision floating point type real number 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.

64-bit internal register 64-bit internal register


Double precision floating point type real number Double precision floating point type real number
64-bit 64-bit

@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

CR2009 No change in state


CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state
CR2012 ON when the operated value is negative, only when the suffix is "S/L/F/DF”. Otherwise, OFF.

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-65


POW Exponentiation

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode


Execution condition S

4 LDA POW STA P O W S

Execution condition S
Instructions
Arithmetic/Comparison

LDA POW STA @ P O W S

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *1 *1 *1*6 *1*6 *2
-

Operand Explanation
S Specifies exponential data, or the device storing the exponentiated data.*3 *4

*1 When the suffix is .F or .DF, T/C/CTH/CTC cannot be specified for S .


*2 When the suffix is .DF, Z cannot be specified for S .
*3 The range of constants that can be handled differs according to the instruction suffix.
"Suffix" (Page 1-23)
*4 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.
*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
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

16-bit 16-bit 20736


(1 word)
32-bit

An overflow occurs if the operation results are greater than 65535.


4-66 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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

16-bit 16-bit -13824


(1 word)
32-bit

An overflow occurs if the operation results are greater than +32767.


An underflow occurs if the operation results are less than -32768.

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)

An overflow occurs if the operation results are greater than 4294967295.

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)

An overflow occurs if the operation results are greater than +2147483647.


An underflow occurs if the operation results are less than -2147483648.

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

32-bit 32-bit 32-bit


(2 words)

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

64-bit 64-bit 64-bit


(4 words)

@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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-67


ARITHMETIC OPERATION INSTRUCTIONS

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

ON when the one of the following conditions is established. Otherwise, OFF.


• When the indirect specification or index modification range is inappropriate
• When the value for S or the internal register exceeds the range for the single precision
floating point real number (.F) or double precision floating point real number (.DF)
• When the internal register value is less than 0 and S is not an integer

* 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
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

4-68 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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].

R000 DM0 DM2 DM10 (Mnemonics list)


LDA.S POW.S STA.L LD R000
R000 DM0 #10 DM10 LDA.S DM0
LDA.S POW.S STA.L CON
POW.S DM2
CON
STA.L DM10
LDB R000
LDA.S DM0
CON
POW.S #10
CON
STA.L DM10

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-69


CMP Compare data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode


Execution condition S Operation flag

4 LDA CMP C M P S

Execution condition S Operation flag


Instructions
Arithmetic/Comparison

LDA CMP @ C M P S

Available Devices ( ): Not supported on the KV-1000


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 - - - - *5 *3 *3 *3*6 *3*6 *4

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)

4-70 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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.

Compare Result State of Operation


Flag
Value of 32-bit internal register is less than specified value
CR2009 -> ON
32-bit internal register < [ S / S +1]
Value of 32-bit internal register is equal to specified value
CR2010 -> ON
32-bit internal register = [ S / S +1]
Value of 32-bit internal register is greater than specified value
CR2011 -> ON
32-bit internal register > [ S / S +1]

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-71


ARITHMETIC OPERATION INSTRUCTIONS

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.

* 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)

4-72 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

Sample Program
#1000 is compared with the value currently stored to DM0.

CR2002 DM0 #1000 CR2009 R500 (Mnemonics list)


LDA CMP DM0<1000 LD CR2002
LDA DM0
CR2010 R501 CON
DM0=1000 CMP #1000
CON
MPS
CR2011 R502 AND CR2009
DM0>1000 OUT R500
MRD
AND CR2010
OUT R501
MPP
4
AND CR2011

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-73


ZCMP Zone compare

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

ADD

ZCMP(.U)
ZCMP.S

ZCMP ZCMP.D
ZCMP.L
ZCMP

Compares the value


ZCMP.F
ZCMP.DF currently stored to the
Zone compare
@ZCMP(.U) internal register with the
@ZCMP.S specified range.

@ZCMP @ZCMP.D
@ZCMP.L
ZCMP

@ZCMP.F
@ZCMP.DF

Ladder program Input mode


Execution condition S1 Operation flag

4 LDA ZCMP
S2
Z C M P S1 S2

Execution condition S1 Operation flag


Instructions
Arithmetic/Comparison

LDA ZCMP @ Z C M P S1 S2
S2

Available Devices ( ): Not supported on the KV-1000


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)
S1 - - - - *6 *4 *4 *4*7 *4*7 *5

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)

4-74 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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.

Compare Result (when [ / S1 +1]<[ S2 / S2 +1]) State of Operation


S1
Flag
Value of 32-bit internal register is less than specified range
CR2009 -> ON
32-bit internal register < [ S1 / S1 +1]<[ S2 / S2 +1]
Value of 32-bit internal register is within specified range
CR2010 -> ON
[ S1 / S1 +1] ≤ 32-bit internal register ≤[ S2 / S2 +1]
Value of 32-bit internal register is greater than specified range
CR2011 -> ON
[ S1 / S1 +1]<[ S2 / S2 +1] < 32-bit internal register

* [ S2 / S2 +1] <[ S1 / S1 +1], swap each of the settings for [ S1 / S1 +1]


and [ S2 / S2 +1] in the above table.

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.

Compare Result (when [ S1 / S1 +1] <[ S2 / S2 +1]) State of Operation


Flag
Value of 32-bit internal register is less than specified range
CR2009 -> ON
32-bit internal register < [ S1 / S1 +1]< [ S2 / S2 +1]
Value of 32-bit internal register is within specified range
CR2010 -> ON
[ S1 / S1 +1] ≤ 32-bit internal register ≤ [ S2 / S2 +1]
Value of 32-bit internal register is greater that specified range
CR2011 -> ON
[ S1 / S1 +1] < [ S2 / S2 +1] <32-bit internal register

* [ S2 / S2 +1]<[ S1 / S1 +1], swap each of the settings for [ S1 / S1 +1]


and [ S2 / S2 +1] in the above table.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-75


ARITHMETIC OPERATION INSTRUCTIONS

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.

Compare Result (when [ S1 / S1 +1/ S1 +2/ S1 +3] < State of Operation


[ S2 / S2 +1/ S2 +2/ S2 +3]) Flag
Value of 64-bit internal register is less than specified range
64-bit internal register < [ S1 / S1 +1/ S1 +2/ S1 +3] CR2009 -> ON
< [ S2 / S2 +1/ S2 +2/ S2 +3]
Value of 64-bit internal register is within specified range
[ S1 / S1 +1/ S1 +2/ S1 +3] ≤ 64-bit internal register CR2010 -> ON
4 ≤ [ S2 / S2 +1/ S2 +2/ S2 +3]
Value of 64-bit internal register is greater that specified range
Instructions
Arithmetic/Comparison

[ S1 / S1 +1/ S1 +2/ S1 +3] CR2011 -> ON


< [ S2 / S2 +1/ S2 +2/ S2 +3] <64-bit internal register

* When [ S2 / S2 +1/ S2 +2/ S2 +3] < [ S1 / S1 +1/ S1 +2/ S1 +3],


read [ S1 / S1 +1/ S1 +2/ S1 +3] in the above table as [ S2 / S2 +1/
S2 +2/ S2 +3] and vice versa.

@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.

* 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)

4-76 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic/Comparison Instructions

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.

CR2002 DM0 #1000 CR2011 R500 (Mnemonics list)


LDA ZCMP 1000<2000<DM0 LD CR2002
#2000 LDA DM0
CR2010 R501 CON
ZCMP #1000 #2000

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

1. 1000 < 2000 < DM0


2. 1000 ≤ DM0 ≤ 2000
3. DM0 < 1000 < 2000

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-77


Arithmetic Operation Instructions
ANDA Logical AND
operation of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
internal register
and specified
ADD data

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.

Ladder program Input mode


Execution condition S
LDA ANDA STA A N D A S

Execution condition S
LDA ANDA STA @ A N D A S

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify

MR DM EM
Instructions
Arithmetic Operation

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 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.

Example DM0 $00FF DM0


LDA ANDA STA

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

4-78 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic Operation Instructions

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.

Example DM0 $00FF00FF DM0


LDA.D ANDA.D STA.D

bit bit bit bit


31 16 15 0
DM0
16-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 LDA.D
bit
31
AND bit
0
$00FF00FF
S / S +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ANDA.D
Higher 16 bits Lower 16 bits
bit bit
31 0

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

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.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-79


ORA Logical AND
operation of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
internal register
and specified
data
ADD

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.

Ladder program Input mode


Execution condition S
LDA ORA STA O R A S

Execution condition S
LDA ORA STA @ O R A S

Available Devices ( ): Not supported on the KV-1000

4 Bit Devices Word Devices Const Ind Spec


Device
Index
Local Modify
Operand
MR DM EM
Instructions
Arithmetic Operation

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 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.

Example DM0 $00FF DM0


LDA ORA STA

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

4-80 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic Operation Instructions

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.

Example DM0 $00FF00FF DM0


LDA.D ORA.D STA.D

bit bit bit bit


31 16 15 0
DM0
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 LDA.D
bit
31
OR bit
0
$00FF00FF
S • S +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ORA.D
Higher 16 bits Lower 16 bits
bit bit
31 0

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

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.

* 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
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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-81


EORA Calculates the
number of ON
bit in internal

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
registers

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.

Ladder program Input mode


Execution condition S
LDA EORA STA E O R A S
( X O R A S , X O R S )
Execution condition S
LDA EORA STA @ E O R A S
( @ X O R A S ,@ X O R S )

4
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.

Example DM0 $00FF DM0


LDA EORA STA

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.

4-82 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic Operation Instructions

Example DM0 $00FF00FF DM0


LDA.D EORA.D STA.D

bit bit bit bit


31 16 15 0
DM0
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 LDA.D
bit
31
XOR bit
0
$00FF00FF
S / S +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 EORA.D
Higher 16 bits Lower 16 bits
bit bit
31 0
DM0
32-bit internal register 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 STA.D

@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.

* 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 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

$00AA 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 Data Memory DM0


bit bit
15 0

$0011 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 16-bit internal register


-> when CR2010 is OFF.
when 00000, CR2010 ON.

Consistent when CR2010 is ON


Consistent judgement between value of DM0 and output relay R30000 to R30007
Inconsistent when CR2010 is OFF

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-83


ENRA XOR
operation of
internal

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
register and
specified
data
ADD

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.

Ladder program Input mode


Execution condition S
LDA ENRA STA E N R A S
( X N O R A S )
Execution condition S
LDA ENRA STA @ E N R A S
( @ X N O R A S )

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.

Example DM0 $00FF DM0


LDA ENRA STA

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

4-84 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic Operation Instructions

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.

Example DM0 $00FF00FF DM0


LDA.D ENRA.D STA.D

bit bit bit bit


31 16 15 0
DM0
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 LDA.D
bit
31
XNOR bit
0
$00FF00FF
S / S +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ENRA.D
Higher 16 bits Lower 16 bits
bit bit
31 0

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

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.

* 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
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

$AAAA 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Data Memory DM0


bit bit
15 0

$0001 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 16-bit internal register


-> when CR2010 is OFF.
when 00000, CR2010 ON.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-85


COM bitwise invert

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

ADD

COM COM(.U)
COM.D
COM
Inverts each of the bits in
Complement
internal registers.
@COM @COM(.U)
@COM.D
COM

Ladder program Input mode


Execution condition
LDA COM STA C O M

Execution condition
LDA COM STA @ C O M

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify

MR DM EM
Instructions
Arithmetic Operation

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -

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

16-bit internal register 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 0


bit bit
15 0

16-bit internal register 0 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1

COM.D When the execution condition is ON, each of the bits in 32-bit internal registers is
inverted ("0 -> 1", "1 -> 0").

bit bit bit bit


Example 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 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0


bit bit
31 0

32-bit internal register 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

@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.

LDA COM STA

LDA COM STA

4-86 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic Operation Instructions

Operation flag

CR2009 No change in state


CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state
CR2012 No change in state

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

"ANDA" (Page 4-78)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-87


NEG Negative

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode


Execution condition

4 LDA NEG STA N E G

Execution condition
Instructions
Arithmetic Operation

LDA NEG STA @ N E G

Available Devices ( ): Not supported on the KV-1000


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)
- - - - - - - - - - - - - - - - - - - - -

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

16-bit internal register 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 1 ←Before executing


#12345
bit bit
15 0

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 1

bit bit
15 0

16-bit internal register 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 ←After executing


#-12345

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).

4-88 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic Operation Instructions

bit bit bit bit


Example 31 16 15 0

32-bit internal register 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 ←Before


#12345678 executing
bit bit bit bit
31 16 15 0

10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0

bit bit
31 0

32-bit internal register 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 1 1 0 0 1 0 ←After


#-12345678 executing

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.

LDA NEG STA

LDA NEG STA

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-89


ARITHMETIC OPERATION INSTRUCTIONS

Arithmetic Operation Instructions

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

4-90 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Arithmetic Operation Instructions

MEMO

Instructions
Arithmetic Operation

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-91


Data Shift Instructions
SRA Shift right in
internal

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
register

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.

Ladder program Input mode


Execution condition n
LDA SRA STA S R A n

Execution condition n
LDA SRA STA @ S R A n

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
*4 *5 *5
n - - - - -
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 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

16-bit 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

Higher n bit Delete

Filled with 0
1
CR2009
(Carry)

4-92 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

32-bit internal register 1 1 1 0 10 0 0 0 0 0 1 1 0 0 1 1 11 0 10 0 0 0 0 0 1 1 0 0 1

32-bit internal register 0 0 0 0 01 1 1 0 1 0 0 0 0 0 0 1 10 0 11 1 1 0 1 0 0 0 0 0 0 1 10 0 1

4
Higher n bit Delete

Filled with 0 1

Data Shift Instructions


CR2009
(Carry)

@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.

LDA SRA STA

LDA SRA STA

Operation flag

CR2009 ON when a carry is stored after the operation. Otherwise, OFF.


CR2010 ON when the operation result is "0". 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.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-93


ARITHMETIC OPERATION INSTRUCTIONS

Data Shift Instructions

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

4-94 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

MEMO

Data Shift Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-95


SLA Shift left in internal
register

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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.

Ladder program Input mode


Execution condition n
LDA SLA STA S L A n

Execution condition n
LDA SLA STA @ S L A n

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
n *4 *5 *5
- - - - -

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 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 16-bit internal register

1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 16-bit internal register

Delete Lower n bit

1
Filled with 0
CR2009
(Carry)

4-96 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

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 32-bit internal register

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 32-bit internal register

4
Delete n
Lower bit

1 Filled with 0

Data Shift Instructions


CR2009
(Carry)

@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.

LDA SLA STA

LDA SLA STA

Operation flag

CR2009 ON when a carry is stored after the operation. Otherwise, OFF.


CR2010 ON when the operation result is "0". 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.

* 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
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-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-97


ASRA Arithmetic right
shift of internal

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

Ladder program Input mode


Execution condition n
LDA ASRA STA A S R A n

Execution condition n

4 LDA ASRA STA @ A S R A n

Available Devices ( ): Not supported on the KV-1000


Data Shift Instructions

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

is 17 or more (.U/.S) / 33 or more (.D/.L).


- When the suffix is ".S” or ".L” and the internal register value is negative (less than 0),
Internal register value = -1, CR2009=ON, CR2010=OFF
- In all other cases,
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)

4-98 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

Execute ASRA.U instruction with n=5

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

Data Shift Instructions


High-order n bit Delete

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

Execute ASRA.S instruction with n=4

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-99


ARITHMETIC OPERATION INSTRUCTIONS

Data Shift Instructions

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

High-order n bit Delete

1
Data Shift Instructions

Sign value is stored


Greater than 0 : 0 CR2009
Less than 0: 1 (carry)

@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

CR2009 ON when a carry is stored after the operation. 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.

* 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)

4-100 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

Data Shift Instructions


R30008
R30115 R30000

0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 R30000 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-101


ASLA Arithmetic
left shift of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano internal


ARITHMETIC OPERATION INSTRUCTIONS
register

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

Ladder program Input mode


Execution condition n
LDA ASLA STA A S L A n

Execution condition n
LDA ASLA STA @ A S L A n

4 Available Devices ( ): Not supported on the KV-1000


Index
Data Shift Instructions

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.

4-102 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

Execute ASLA.U instruction with n=5

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

Delete Low-order n bit

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.

Data Shift Instructions


0 is stored in the low-order n bit. The bit (32- n ) status is stored in CR2009. The
results are stored in the 32-bit internal register.

bit bit (32- n ) bit


31 0
32-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
internal register
3894011929

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

Delete Low-order n bit

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

CR2009 ON when a carry is stored after the operation. 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

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-103


ARITHMETIC OPERATION INSTRUCTIONS

Data Shift Instructions

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

4-104 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

MEMO

Data Shift Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-105


RRA Rotate right in
internal
register

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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.

Ladder program Input mode


Execution condition n
LDA RRA STA R R A n

Execution condition n
LDA RRA STA @ R R A n

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
n *4 *5 *5
- - - - -

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

0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 16-bit internal register


Status of flag varies
with previous operation (1-bit cycle)
results.

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

0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 16-bit internal register

(Carry)

4-106 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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)

Data Shift Instructions


bit bit
CR2009 31 0

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.

LDA SLA STA

LDA SLA STA

Operation flag

CR2009 ON when a carry is stored after the operation. Otherwise, OFF.


CR2010 ON when the operation result is "0". 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.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-107


ARITHMETIC OPERATION INSTRUCTIONS

Data Shift Instructions

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.

CR2002 #0 R30000 (Mnemonics list)


DW LDA 1 LD CR2002
DM0 DW #0 DM0
FOR CON
#16 2 LDA R30000
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RRA #1
RRA INC 3 CON
4 NEXT
AND CR2009
INC DM0
NEXT
Data Shift Instructions

1. Store input relay R30000 to R30015 to 16-bit internal register.


2. Perform FOR-NEXT instruction for 16 times.
3. First shift right to content (including carry flag CR2009) in 16-bit internal register and then add 1 to
DM0 when CR2009 is ON.

4-108 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

MEMO

Data Shift Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-109


RLA Rotate left in
internal
register

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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.

Ladder program Input mode


Execution condition n
LDA RLA STA R L A n

Execution condition n
LDA RLA STA @ R L A n

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
*4 *5 *5
n - - - - -

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

1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 16-bit internal register


Status of flag varies
with previous operat
(1-bit cycle) ion results.

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

0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 16-bit internal register


(Carry)

4-110 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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)

n cycle (Rotate n bits)

Data Shift Instructions


bit bit
31 0 CR2009

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.

LDA RLA STA

LDA RLA STA

Operation flag

CR2009 ON when a carry is stored after the operation. Otherwise, OFF.


CR2010 ON when the operation result is "0". 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.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-111


ARITHMETIC OPERATION INSTRUCTIONS

Data Shift Instructions

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

(1) Store input relay R30000 to R30015 to 16-bit internal register.


(2) Perform FOR-NEXT instruction for 16 times.
(3) First shift left to content (including carry flag CR2009) in 16-bit internal register and then add 1 to
DM0 when CR2009 is ON.

4-112 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

MEMO

Data Shift Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-113


RRNCA Right rotate
without carry in

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano internal register


ARITHMETIC OPERATION INSTRUCTIONS

RLA

Rotates the bit content of


RRNCA RRNCA(.U)
RRNCA.D
RRNCA
Right rotate A
internal registers towards
the smaller bit No. by the
without carry
@RRNCA @RRNCA(.U)
@RRNCA.D
RRNCA
specified number of bits
without including a carry

Ladder program Input mode


Execution condition n
LDA RRNCA STA R R N C A n

Execution condition n
LDA RRNCA STA @ R R N C A n

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
n *3 *4 *4
- - - - -

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

1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 16-bit internal register


(1-bit cycle)

0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0

n cycle (Rotate n bits)


bit bit
15 0

1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 16-bit internal register

CR2009(Carry) 1

4-114 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

n cycle (Rotate n bits)

Data Shift Instructions


bit bit
31 0
32-bit internal register
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
CR2009(Carry) 1

@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.

LDA RRNCA STA

LDA RRNCA STA

Operation flag

CR2009 ON when a carry is stored after the operation. 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.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-115


ARITHMETIC OPERATION INSTRUCTIONS

Data Shift Instructions

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

(1) Store input relay R30000 to R30015 to 16-bit internal register.


(2) Perform FOR-NEXT instruction for 16 times.
(3) First shift right to content (including carry flag CR2009) in 16-bit internal register and then add 1 to
DM0 when CR2009 is ON.

4-116 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

MEMO

Data Shift Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-117


RLNCA Left rotate without
carry in internal
register

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

RLA

Rotates the bit content of


RLNCA RLNCA(.U)
RLNCA.D
RLNCA
Left rotate A
internal registers towards
the larger bit No. by the
without carry
@RLNCA @RLNCA(.U)
@RLNCA.D
RLNCA
specified number of bits
without including a carry.

Ladder program Input mode


Execution condition n
LDA RLNCA STA R L N C A n

Execution condition n
LDA RLNCA STA @ R L N C A n

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
*3 *4 *4
n - - - - -

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 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 16-bit internal register

1-bit cycle

1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1

n cycle (Rotate n bits)

bit bit
15 0

0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 16-bit internal register

CR2009(Carry) 0

4-118 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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 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 32-bit internal register

(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

n cycle (Rotate n bits)

Data Shift Instructions


bit bit
31 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 32-bit internal register

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.

LDA RLNCA STA

LDA RLNCA STA

Operation flag

CR2009 ON when a carry is stored after the operation. 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.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-119


ARITHMETIC OPERATION INSTRUCTIONS

Data Shift Instructions

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

(1) Store input relay R30000 to R30015 to 16-bit internal register.


(2) Perform FOR-NEXT instruction for 16 times.
(3) First shift left to content (excluding carry flag CR2009) in 16-bit internal register and then add 1 to
DM0 when CR2009 is ON.

4-120 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

MEMO

Data Shift Instructions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-121


WSR Word data to
shift right

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

RLA

WSR WSR(.U) WSR


WSR.D Shifts the word
Word shift
device towards the
right
@WSR @WSR(.U) larger device No.
WSR
@WSR.D

Ladder program Input mode


Execution condition WSR
D n1 n2 W S R D n1 n2

Execution condition WSR


D n1 n2 @ W S R D n1 n2

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
*3
D - - - - - - - - - -
*3 *4 *4
n1 - - - - -
n2 - - - - *3 *4 *4
-

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

4-122 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

Data Shift Instructions


@WSR. Only one scan is executed at the rising edge of the execution conditions.

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.

Before execution After execution


Higher 16 Bits Lower 16 Bits Higher 16 Bits Lower 16 Bits
Shift source data $0001 $0002 $0000 $0000
Shift destination data $0003 $0004 $0000 $0002

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when any of the following conditions are established. Otherwise, OFF.
• When the indirect specifying or index modification range is inappropriate
• When n1 =0
CR2012
• When the shifted result exceeds the device range
Does not change when n1 and n2 are constants and indirect specifying or index
modify is not specified.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-123


WSL Word data to
shift left

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

RLA

WSL WSL(.U) WSL


Shifts the word
WSL.D Word shift device to towards
left the smaller device
@WSL @WSL(.U) WSL
@WSL.D
No.

Ladder program Input mode


Execution condition WSL
D n1 n2 W S L D n1 n2

Execution condition WSL


D n1 n2 @ W S L D n1 n2

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
*3
D - - - - - - - - - -
*3 *4 *4
n1 - - - - -
n2 - - - - *3 *4 *4
-

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 ].

Before executing After executing

D - n2 1000
( D +1) - n2 2000
n2
...

D 1000
D +1 2000
8000
( D + n1 -1) - n2 9000
...

n1
0
0
Delete
8000 0
D + n1 -1 9000 0

4-124 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

Data Shift Instructions


@WSL. Only one scan is executed at the rising edge of the execution conditions.

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.

Before execution After execution


Higher 16 Bits Lower 16 Bits Higher 16 Bits Lower 16 Bits
Shift source data $0001 $0002 $0000 $0000
Shift destination data $0003 $0004 $0000 $0002

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when any of the following conditions are established. Otherwise, OFF.
• When the indirect specifying or index modification range is inappropriate
• When n1 =0
CR2012
• When the shifted result exceeds the device range
Does not change when n1 and n2 are constants and indirect specifying or index modify
is not specified.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-125


BSR Shifts the
content of
the device

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
to the larger
device No.

RLA

BSR BSR(.U) BSR


BSR.D Shifts the bit device
Bit shift right to the larger device

@BSR @BSR(.U) No.


BSR
@BSR.D

Ladder program Input mode


Execution condition BSR
D n1 n2 B S R D n1 n2

Execution condition BSR


D n1 n2 @ B S R D n1 n2

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
*3
D - - - - - - - - - - - - -
*3 *4 *4
n1 - - - -
*3 *4 *4
n2 - - - -

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

100 101 102 103 104 105 106 107


MR100 to Before executing 1 1 0 1 1 0 1 1

100 101 102 103 104 105 106 107


MR100 to After executing 1 0 0 0 0 1 0 1

“0” is filled in

4-126 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

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 result of having performed a shift has exceeded the device range
4
• When n1 is 0

Data Shift Instructions


• When the indirect specification or index modify range is inappropriate
CR2012
• When a timer/counter has been specified by indirect specification to D or [ D /
D +1]
Does not change when n1 and n2 are constants and indirect specifying or index modify
is not specified.

* 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
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.

R000 (Mnemonics list)


BSR
MR000 #8 #8 LDP R000
BSR MR000 #8 #8

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-127


BSL Shifts the
content of the
device to the

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
smaller device
No.
RLA

BSL BSL(.U) BSL


BSL.D Shifts the bit device
Bit shift left to the smaller device

@BSL @BSL(.U) No.


BSL
@BSL.D

Ladder program Input mode


Execution condition BSL
D n1 n2 B S L D n1 n2

Execution condition BSL


D n1 n2 @ B S L D n1 n2

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Data Shift Instructions

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
D *3
- - - - - - - - - - - - -
n1 *3 *4 *4
- - - -
n2 *3 *4 *4
- - - -

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

105 106 107 108 109 110 111 112


MR105 to Before executing 1 0 1 1 0 1 1 0

105 106 107 108 109 110 111 112


MR105 to After executing 1 0 1 0 0 0 1 0

Filled with 0

4-128 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Shift Instructions

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

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 result of having performed a shift has exceeded the device range
4
• When n1 is 0

Data Shift Instructions


• When the indirect specification or index modify range is inappropriate
CR2012
• When a timer/counter has been specified by indirect specification to D or [ D /
D +1]
Does not change when n1 and n2 are constants and indirect specifying or index modify
is not specified.

* 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
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.

R000 (Mnemonics list)


BSL
MR10008 #8 #8 LDP R000
BSL MR10008 #8 #8

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-129


Data control instructions
LIMIT To perform upper/
lower limit control

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
for input data

LIMIT

LIMIT(.U)

LIMIT LIMIT.S LIMIT


LIMIT.D To perform
LIMIT.L Upper/lower upper/lower
limit control limit control for
@LIMIT(.U)
input data
@LIMIT @LIMIT.S LIMIT
@LIMIT.D
@LIMIT.L

Ladder program Input mode


Execution condition LIMIT
S1 S2 S3 D L I M I T S1 S2 S3 D

Execution condition
4
LIMIT
S1 S2 S3 D @ L I M I T S1 S2 S3 D
instructions
Data control

Available Devices ( ): Not supported on the KV-1000


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)
S1 *5 *6 *6
- - - - -
S2 *5 *6 *6
- - - - -
S3 *5 *6 *6
- - - - -
D *5
- - - - - - - - -

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

4-130 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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 .

Condition Value stored in D

S1 (Lower limit) > S3 (Input value) S1 (Lower limit)

S2 (Upper limit) < S3 (Input value) S2 (Upper limit)

S1 (Lower limit) ≤ S3 (Input value) ≤ S2 (Upper limit) S3 (Input value)


4
LIMIT.D When the execution is ON, [ S1 / S1 +1] (upper limit), [ S2 / S2 +1] (lower limit)

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].

Condition Value stored in [ D / D +1]


[ S1 • S1 +1] > [ S3 • S3 +1] [ S1 • S1 +1]
(Lower limit) (Input value) (Lower limit)
[ S2 • S2 +1] > [ S3 • S3 +1] [ S2 • S2 +1]
(Upper limit) (Input value) (Upper limit)
[ S1 • S1 +1] ≤ [ S3 • S3 +1] ≤ [ S2 • S2 +1] [ S3 • S3 +1]
(Lower limit) (Input value) (Upper limit) (Input value)

@LIMIT. 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
• ON when S2 < S1 ([ S2 / S2 +1]<[ S1 / S1 +1])
CR2012 • ON when the indirect specifying and index modification range are inappropriate
Otherwise, OFF

* 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 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 (Mnemonics list)


R000
#500 #3500 DM10000 DM0 LD R000
Analog data amplitude LIMIT #500 #3500 DM10000 DM0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-131


BANDC To perform dead
band control for

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano input data.


ARITHMETIC OPERATION INSTRUCTIONS

LIMIT

BANDC BANDC(.S) BANDC


To perform
BANDC.L Dead
dead band
band
control for
@BANDC control
@BANDC(.S) BANDC
@BANDC.L
input data.

Ladder program Input mode


Execution condition BANDC
S1 S2 S3 D B A N D C S1 S2 S3 D

Execution conditiont BANDC


S1 S2 S3 D @ B A N D C S1 S2 S3 D

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

Lower limit Upper limit

4-132 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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 .

Condition Value stored in D

S1 (Lower limit) > S3 (Input value) S3 (Input value) - S1 (Lower limit)

S2 (Upper limit) < S3 (Input value) S3 (Input value) S2 (Upper limit)

S1 (Lower limit) ≤ S3 (Input value) ≤ S2 (Upper limit) 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
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].

Condition Value stored in [ D / D +1]


[ S1 / S1 +1] > [ S3 / S3 +1] [ S3 / S3 +1] (Input value)
(Lower limit) (Input value) - [ S1 / S1 +1] (Lower limit)
[ S2 / S2 +1] > [ S3 / S3 +1] [ S3 / S3 +1] (Input value)
(Upper limit) (Input value) - [ S2 / S2 +1] (Upper limit)
[ S1 / S1 +1] ≤ [ S3 / S3 +1] ≤ [ S2 / S2 +1]
0
(Lower limit) (Input value) (Upper limit)

* 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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• ON when S2 < S1 ([ S2 / S2 +1]<[ S1 / S1 +1])
CR2012 • ON when the indirect specifying and index modification range are inappropriate
Otherwise, OFF

* 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 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

R000 BANDC.S (Mnemonics list)


+1000 +2000 DM10000 DM0 LD R000
Analog data amplitude BANDC.S +1000 +2000 DM10000 DM0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-133


ZONE To perform zone
control for input

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
data.

LIMIT

ZONE ZONE(.S) ZONE


ZONE.L To perform
Zone
zone control for
control
@ZONE input data.
@ZONE(.S) ZONE
@ZONE.L

Ladder program Input mode


Execution condition ZONE
S1 S2 S3 D Z O N E S1 S2 S3 D

Execution condition ZONE


S1 S2 S3 D @ Z O N E S1 S2 S3 D

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

4-134 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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 S3 (Input value) - S1 (negative offset)

S3 (Input value) = 0 0

S3 (Input value) > 0 S3 (Input value) + S2 (positive offset)

* 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].

Condition Value stored in [ D / D +1]


[ S1 / S1 +1] > [ S3 / S3 +1] [ S3 / S3 +1] (Input value)
(Negative offset) (Input value) +[ S1 / S1 +1] (Negative offset)
[ S2 / S2 +1] > [ S3 / S3 +1]
0
(Positive offset) (Input value)
[ S1 / S1 +1] ≤ [ S3 / S3 +1] ≤ [ S2 / S2 +1] [ S3 / S3 +1] (Input value)
(Negative offset) (Input value) (Positive offset) +[ S2 / S2 +1] (Positive offset)

* 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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the index specifying and index modification range are inappropriate. Otherwise, OFF.
CR2012
No change when index specifying or index modification is not specified for the operand.

* 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 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.

R000 ZONE.S (Mnemonics list)


-1000 +500 DM10000 DM0 LD R000
Analog data amplitude ZONE.S -1000 +500 DM10000 DM0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-135


APR To perform
approximation

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano calculation for


ARITHMETIC OPERATION INSTRUCTIONS
input data in
specified line.
LIMIT

APR(.U)
APR.S

APR APR.D APR


APR.L To perform
APR.F
Linear approximation
APR.DF
approximation calculation for
@APR(.U) (Scaling) input data in
@APR.S
specified line.
@APR @APR.D APR
@APR.L
@APR.F
@APR.DF

Ladder program Input mode


Execution condition APR

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

Available Devices ( ): Not supported on the KV-1000


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)
*7 *5 *5 *5*8 *5*8 *6
S1 - - - - -
*7 *5 *5
S2 - - - - - - - - -
*7 *8 *8
n - - - - -
D *7 *5 *5
- - - - - - - - -

Operand Explanation
S1 Specifies the input value of linear approximation or the leading device for storing the value. *1 *2 *4

S2 Specifies the leading device for storing linear data list. *2 *4


n Specifies the number of linear data logs or the leading device for storing the value. *3 *4
D Specifies the device for storing the result of approximation operation. *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)

4-136 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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

logs starting from S2 .


When the linear approximation calculation is performed, find in which range of linear
data list S1 (input value) is located, and the linear approximation is performed at
previous and next two points. The calculation result is stored in D (approximate
result).
Y Foldline data form 4
(X2,Y2) (X3,Y3)

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.

When S1 (input value) < X0,Y0 is stored in D (approximate result).


When S1 (input value) > Xn,Yn is stored in D (approximate result).
When S1 (input value) = Xk,Yk is stored in D (approximate result). (k=0 to n)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-137


ARITHMETIC OPERATION INSTRUCTIONS

Data control instructions

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.

When [ S1 / S1 +1] (input value) < X0,Y0 is stored in [ D / D +1]


(approximate result).
When [ S1 / S1 +1] (input value) > Xn,Yn is stored in [ D / D +1]
(approximate result).
When [ S1 / S1 +1] (input value) = Xk,Yk is stored in [ D / D +1]
(approximate result). (k=0 to n)

4-138 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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.

When [ S1 / S1 +1] (input value) < X0,Y0 is stored in [ D / D +1]


(approximate result).
When [ S1 / S1 +1] (input value) > Xn,Yn is stored in [ D / D +1]
(approximate result).
When [ S1 / S1 +1] (input value) = Xk,Yk is stored in [ D / D +1]
(approximate result). (k=0 to n)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-139


ARITHMETIC OPERATION INSTRUCTIONS

Data control instructions

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).

Y Foldline data form


(X2,Y2) (X3,Y3)

4 YP [ S2 / S2 +1/
Index
0
X
0
Y
5.2
S2 +2 / S2 +3 ] 1 3.3 6.8
instructions
Data control

(X1,Y1) Table start 2 5.7 13.9


(X0,Y0) 3 7.9 13.9 n
(X4,Y4) (X5,Y5)
4 9.9 2.1

X 5 12.2 2.1
XP (X6,Y6) Number of 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.

When [ S1 / S1 +1/ S1 +2/ S1 +3] (input value) < X0,Y0 is stored in [ D /


D +1/ D +2/ D +3] (approximate result).
When [ S1 / S1 +1/ S1 +2/ S1 +3] (input value) > Xn,Yn is stored in [ D /
D +1/ D +2/ D +3] (approximate result).
When [ S1 / S1 +1/ S1 +2/ S1 +3] (input value) = Xk,Yk is stored in [ D /
D +1/ D +2/ D +3] (approximate result). (k=0 to n)

@APR. Only one scan is executed at the rising edge of the execution conditions.

4-140 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
APR(.U) • ON when n <2, or n >32767.
APR.S • ON when the range of specified data list is inappropriate
APR.D • ON when the indirect specifying and index modification range is inappropriate
APR.L Otherwise, OFF
APR.F • 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 the values are outside the range of single precision floating point is
4
inputted

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

* No change in output when CR2012 is 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

● To use in an approximation calculation


When rising edge of relay R000 is inputted, 7 data lists X Y
Index
starting from DM0 are used, and the approximate result DM0 0 0 10
of DM10000 is stored in DM1000. Table start 1 8 13
2 14 20
3 20 20 7
4 23 6
5 26 6
Number of records
6 28 0

R000 APR (Mnemonics list)


DM10000 DM0 #7 DM1000
LDP R000
Input value Tabel start Result after ar
ithmetic operation APR DM10000 DM0 #7 DM1000

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-141


ARITHMETIC OPERATION INSTRUCTIONS

Data control instructions

● To use as a scaling function


With the rising of input relay R000, the value of the KV Nano Series analog volume (CM1630) is scaled
(0 to 255  -1000 to +1000) using the two devices worth of data list from DM0, and it is stored in
DM100.

Index X Y
Table start DM0 0 0 -1000 DM1 2
DM2 1 255 1000 DM3

Number of records

4
instructions
Data control

CR2008 +0 -1000 +255 +1000


DW.S DW.S DW.S DW.S
DM0 DM1 DM2 DM3
ON for 1 scan Tabel start
at operation start

R000 APR.S
CM1630 DM0 #2 DM100
Volume0 Tabel start Result after ar
ithmetic operation

4-142 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

MEMO

instructions
Data control

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-143


RAMP Outputs changes
in input value with
specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
inclination

LIMIT

Changes in the input value


RAMP
RAMP Ramp
are output at the specified
signal
inclination.

Ladder program Input mode


Execution condition RAMP
S1 S2 S3 D R A M P S1 S2 S3 D

Available Devices ( ): Not supported on the KV-1000


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)
*4 *5 *5
- - - - -
4
S1
S2 *4 *5 *5
- - - - -
S3 *4 *5 *5
- - - - -
instructions
Data control

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)

4-144 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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

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.
CR2012 • When S3 > 2 is specified
• When the indirect specification or index modification range is inappropriate

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-145


ARITHMETIC OPERATION INSTRUCTIONS

Data control instructions

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

4-146 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-147


TPOUT Pulse outputs
with specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
ON time and
cycle

LIMIT

Time A pulse is output to the bit


TPOUT
TPOUT
proportional device at a specified ON time
output and cycle.

Ladder program Input mode

Execution condition TPOUT


S1 S2 D T P O U T S1 S2 D

Available Devices ( ): Not supported on the KV-1000


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)
4
(W) (ZF)
S1 *3 *4 *4
- - - - -
*3 *4 *4
S2 - - - - -
instructions
Data control

*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)

4-148 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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

S1 : 0.5 , S2 : 1.5 S1 : 0.7 , S2 : 1.2

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)

Point • An error within ±10μs+1 scan time will occur.


• If 0 is specified for S1 , the output relay will not turn ON/OFF for even one scan.
• If writing is attempted during RUN, the cycle ( S2 ) will be initialized, and the ON
time ( S1 ) will be counted after the write during RUN ends.
• This instruction cannot be used during 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

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 S2 < S1 is specified
CR2012
• When S2 = 0 is specified
• When the indirect specification or index modification range is inappropriate

* D turns OFF if S2 < S1 or S2 = 0.


If CR2012 turns ON under any other condition, the instruction will not be 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.
"CR/CM List" (Page A-71)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-149


ARITHMETIC OPERATION INSTRUCTIONS

Data control instructions

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

DM100 0 100 500 1000 800

R500

100ms 100ms 500ms 500ms 800ms

One second (1000ms)

4-150 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

MEMO

instructions
Data control

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-151


LLFLT Passes input
through lead-

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
lad filter and
outputs

LIMIT

LLFLT
LLFLT Lead-lag Passes input through lead-lag filter
filter and then outputs.

Ladder program Input mode


Execution condition LLFLT
S D1 D2 L L F L T S D1 D2

Available Devices ( ): Not supported on the KV-1000


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)
S *4 *5 *5
- - - - -
4 D1 - - - - *4

*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)

4-152 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

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.

X : S input value Input value


Y : D2 output value
T1 : ( D1 +1 ) delay time
When T2>T1
T2 : ( D1 +2 ) lead time

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"

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-153


ARITHMETIC OPERATION INSTRUCTIONS

Data control instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the interval for executing the instruction exceeds double the sampling cycle (Ts)
(operation cycle exceeded)
CR2012 • When D1 = 0 is specified
• When D1 ≥ 60001 is specified
• When the indirect specification or index modification range is inappropriate

4 • When a timer/counter has been specified by indirect specification to D1 or


* The instruction is executed even when the operation cycle is exceeded. If CR2012 turns ON in any
D2
instructions
Data control

other case, 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.
"CR/CM List" (Page A-71)

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

4-154 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data control instructions

MEMO

instructions
Data control

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-155


Data Conversion Instructions
TBCD Converts
binary to BCD

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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.

Ladder program Input mode


Execution condition
LDA TBCD STA T B C D

Execution condition
LDA TBCD STA @ T B C D

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the BIN data currently stored in the internal register is outside of the range. Otherwise,
CR2012
OFF

* 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) 4

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-157


TBIN Converts BIN
to binary

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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.

Ladder program Input mode


Execution condition
LDA TBIN STA T B I N

Execution condition
LDA TBIN STA @ T B I N

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify
MR DM EM
Instructions
Data Conversion

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -

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.

4-158 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the BCD data currently stored in the internal register is outside of the range.
CR2012
Otherwise, OFF

* 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) 4

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-159


MPX Encode 4-bit number
to 16-bit

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
MX Encode 16-bit
number to 4-bit

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.

Ladder program Input mode


Execution condition n
LDA MPX STA M P X n
Execution condition n
LDA MPX STA @ M P X n

4 Execution condition
LDA DMX STA D M X

Execution condition
Instructions
Data Conversion

LDA DMX STA @ D M X

Available Devices ( ): Not supported on the KV-1000


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)
MPX n - - - - - - - - - - - - - - -  - - - -
DMX - - - - - - - - - - - - - - - - - - - -

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

16-bit internal register 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1

7 n (Since bit (#1) is “0111”

7 in DEC), bit7 of 16-bit


F E D C B A 9 8 7 6 5 1 3 2 1 0

16-bit internal register 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 internal register is set ON (filled with 1).

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

16-bit internal register 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0

The highest bit is bit7 in ON devices, so “7”


(0111 in BIN) is stored in 16-bit internal
16-bit internal register register.
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1

4-160 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

@ 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
ON when the value of the data (internal register) to be operated on is "0". Otherwise, OFF
CR2012
No change in the MPX instruction.

* 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. 4
"CR/CM List" (Page A-71)

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

When sensor "8" is ON, the BIN display indicates "8".

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-161


GRY Converts binary
to gray code

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano RGRY Converts gray


ARITHMETIC OPERATION INSTRUCTIONS
code to binary

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.

Ladder program Input mode


Execution condition

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

Available Devices ( ): Not supported on the KV-1000


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
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.

4-162 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

Gray code table

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-163


ARITHMETIC OPERATION INSTRUCTIONS

Data Conversion Instructions

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

4-164 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

MEMO

Instructions
Data Conversion

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-165


DISN Disperses
word (16-bit)

KV-1000 KV Nano
into nibble

KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
unit (4-bit)

ADD

DISN DISN(.U) DISN


To disperse data into nibble
DISN.D Disperse unit (in 4-bits) and store
nibble each of them to word
@DISN @DISN(.U) DISN
@DISN.D
devices.

KV-7500/7300 KV-5500/5000/3000 KV Nano

Ladder program Input mode


Execution condition DISN
S D n D I S N S D n

Execution condition DISN


S D n @ D I S N S D n

4 KV-1000

Ladder program Input mode


Instructions
Data Conversion

Execution condition DISN


S D D I S N S D

Execution condition DISN


S D @ D I S N S D

Available Devices ( ): Not supported on the KV-1000


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)
S  -  - - -    *3    *4  *4   - -   
D  -  - - -    *3   - - -  - -   
n  -  - - -    *3    *4  *4    -   

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

Filled with 0 in higher 12 bits.

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

Filled with 0 in higher 12 bits.

KV-7500/7300/5500/5000/3000, KV Nano Series When performing above operation, bits stored


after n splitting can be used.

@DISN. 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
ON when the index specifying and index modification range are inappropriate. Otherwise, OFF.
CR2012
No change when index specifying or index modification is not specified for the operand.

* 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

■ KV-7500/7300/5500/5000/3000, KV Nano Series


When input R000 is ON, the 4-bit BCD data (lower 2 bits) currently stored in data memory DM0 is
dispersed in nibble unit. The result is stored in two words starting from DM10.
(Mnemonics list)
R000 DISN
DM0 DM10 #2 LD R000
DISN DM0 DM10 #2

■ 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-167


UNIN Unites the
nibble (4-bit) to

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
word (16-bit)

ADD

UNIN UNIN(.U) UNIN


UNIN.D To unite lower 4-bits of word
Unite nibble devices to 16-bit (32-bit) BIN

@UNIN data.
@UNIN(.U) UNIN
@UNIN.D

KV-7500 KV-7300 KV-5500 KV-5000 KV-3000 KV Nano

Ladder program Input mode


Execution condition UNIN
S D n U N I N S D n

Execution condition UNIN


S D n @ U N I N S D n

4 KV-1000

Ladder program Input mode


Instructions
Data Conversion

Execution condition UNIN


S D U N I N S D

Execution condition UNIN


S D @ U N I N S D

Available Devices ( ): Not supported on the KV-1000


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)
S  -  - - -    *3   - - -  - -   
D  -  - - -    *3   - - -  - -   
n  -  - - -    *3
   *4
 *4
   -   

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

bit bit bit bit


15 8 7 0

D : 4 3 2 1

KV-7500/7300/5500/5000/3000, KV Nano Series The operation is performed as stated above.


However, the number of digits to be united and
stored can be specified using n . Unspecified
digits are stored as 0.
4-168 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

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

bit bit bit bit bit bit bit bit


31 24 23 16 15 8 7 0

D +1 : 8 7 6 5 4 3 2 1 : D

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the index specifying and index modification range are inappropriate. Otherwise, OFF.
CR2012
No change when index specifying or index modification is not specified for the operand.

* 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

■ KV-7500/7300/5500/5000/3000, KV Nano Series


When input relay R000 is ON, the BCD data currently stored in the lower 4-bits of data memories DM0
to DM1 are united. The result is stored in DM10.
(Mnemonics list)
R000 UNIN
DM0 DM10 #2 LD R000
UNIN DM0 DM10 #2

■ 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-169


DISB Disperses word
(16-bit) into

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano byte (4-bit)


ARITHMETIC OPERATION INSTRUCTIONS

ADD

DISB DISB(.U) DISB


DISB.D To disperse data into byte
Disperse
units (8-bit units) and store
byte
@DISB them to word devices.
@DISB(.U) DISB
@DISB.D

KV-7500 KV-7300 KV-5500 KV-5000 KV-3000 KV Nano

Ladder program Input mode


Execution condition DISB
S D n D I S B S D n

Execution condition DISB


S D n @ D I S B S D n

4 KV-1000

Ladder program Input mode


Instructions
Data Conversion

Execution condition DISB


S D D I S B S D

Execution condition DISB


S D @ D I S B S D

Available Devices ( ): Not supported on the KV-1000


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)
S  -  - - -    *3    *4  *4   - -   
D  -  - - -    *3   - - -  - -   
n  -  - - -    *3    *4  *4    -   

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

bit bit bit bit


15 8 7 0

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.

Point "0" is stored to the upper 24-bits when stored in timers/counters.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the index specifying and index modification range are inappropriate. Otherwise, OFF
CR2012
No change when index specifying or index modification is not specified to the operand.

* 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

■ KV-7500/7300/5500/5000/3000 and KV Nano Series


The data captured from input relays R30000 to R30007 is dispersed into byte units, and stored in data
memories DM10.
(Mnemonics list)
R000 DISB
R30000 DM10 #1 LD R000
DISB R30000 DM10 #1

■ 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-171


UNIB Unites the byte (8-
bit) to word (16-bit)

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

ADD

UNIB UNIB(.U) UNIB


UNIB.D To unite the lower 8-bits of
Unite byte word devices to 16-digit (32-

@UNIB bit) BIN data.


@UNIB(.U) UNIB
@UNIB.D

KV-7500/7300 KV-5500/5000/3000 KV Nano

Ladder program Input mode


Execution condition UNIB
S D n U N I B S D n

Execution condition UNIB


S D n @ U N I B S D n

4 KV-1000

Ladder program Input mode


Instructions
Data Conversion

Execution condition UNIB


S D U N I B S D

Execution condition UNIB


S D @ U N I B S D

Available Devices ( ): Not supported on the KV-1000


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)
S  -  - - -    *3   - - -  - -   
D  -  - - -    *3   - - -  - -   
n  -  - - -    *3    *4  *4    -   

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

bit bit bit bit


15 8 7 0

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.

4-172 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

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

stored after splitted by n can be united.

@UNIB. 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
ON when the index specifying and index modification range are inappropriate. Otherwise, OFF
CR2012
No change when index specifying or index modification is not specified to the operand.

* 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

■ KV-7500/7300/5500/5000/3000, KV Nano Series


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)
R000 UNIB
R30000 DM10 #2 LD R000
UNIB R30000 DM10 #2

■ 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-173


SWAP Swaps the
upper and

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano lower data


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode


Execution condition
LDA SWAP STA S W A P

Execution condition
LDA SWAP STA @ S W A P

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
- - - - - - - - - - - - - - - - - - - - -

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.

Example When $1234 is stored in 16-bit internal registe


bit bit bit bit
15 8 7 0

Before executing 1 2 3 4 ←16-bit internal register:$1234

After executing 3 4 1 2 ←16-bit internal register:$3412

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.

Example When $12345678 is stored in 32-bit internal register


bit bit bit bit bit bit bit bit
31 24 23 16 15 8 7 0

Before executing 1 2 3 4 5 6 7 8 ←32-bit internal register:$12345678

After executing 5 6 7 8 1 2 3 4 ←32-bit internal register:$56781234

@SWAP. 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
CR2012 No change in state

4-174 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-175


BSWAP Switches high-
order and low-
order data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
block unit

BSWAP

BSWAP
BSWAP
The high-order byte and low-order
Block swap byte of data in a specified range
@BSWAP are swapped.
BSWAP

Ladder program Input mode


Execution condition BSWAP
D n B S W A P D n

Execution condition BSWAP


D n @ B S W A P D n

Available Devices ( ): Not supported on the KV-1000


Index
Local
Bit Devices Word Devices Const Ind Spec
4
Modify
Operand Device
MR DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
Instructions
Data Conversion

(B) (W) (ZF)


D  -  - - -    *2 - - - - -  - -   
n  -  - - -    *2    *3  *3    -   

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

*1 If a bit device is specified, 16 continuous bits are processed.


When a channel other than the leading channel (MR002, R1012, etc.) is specified, the bits are
processed crossing to 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.

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.

4-176 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established, OFF in all other cases
• When n is 0
CR2012 • When D + n -1 exceeds the device range
• When a timer/counter is specified to D by indirect specification
• When the indirect specification or index modification range is inappropriate

* 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. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-177


XCH Exchange

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

XCH

XCH XCH(.U) XCH


XCH.D To exchange content
Exchange
of two devices.
@XCH @XCH(.U) XCH
@XCH.D

Ladder program Input mode


Execution condition XCH
D1 D2 X C H D1 D2

Execution condition @XCH


D1 D2 @ X C H D1 D2

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
D1  -  - - -    *2   - - -  -    
D2  -  - - -    *2
  - - -  -    
Operand Explanation
D1 Specifies the device for storing the data to be exchanged. *1
D2 Specifies the device for store the exchanged data. *1

*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.

Example When $1234 is stored in D1 and $ABCD is stored in D2


Before executing After executing
bit
15
D1 bit
0
bit
15
D1 bit
0

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.

4-178 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the index specifying and index modification range are inappropriate. Otherwise, OFF.
CR2012
No change when index specifying or index modification is not specified for the operand.

* 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) 4

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

"FOR, NEXT" (Page 3-34)


"KV-7000 Series User's Manual "index specifying""
"KV-5500/5000/3000 Series User's Manual "index specifying""
"KV Nano Series User's Manual "index specifying""

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-179


DECO Encode the
numbers of the
lower n bits of the

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
internal register
to 2n bit binay
XCH data.

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)

Ladder program Input mode


Execution condition D
LDA DECO D E C O D n
n

Execution condition D
LDA DECO @ D E C O D n
n

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices Word Devices Const Ind Spec
Local Modify
Device
MR DM EM
Instructions
Data Conversion

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
D  -    -    *4 - - - - -  - -   
n  *3
-  *3 - - -  *3  *3  *4  *3  *3  *3*5  *3*5  *3  *3  -  *3  *3
 *3

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

internal register 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 n 3 bits

5 Since bit3 is “101”


(5 in DEC), MR105 is
set ON (filled with 1).
107 106 105 104 103 102 101 100 Others OFF (Filled with 0).
MR100 to MR107 0 0 1 0 0 0 0 0

@DECO Only one scan is executed at the rising edge of the execution conditions.

4-180 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• When n ≥9
• When the continuous 2 n number of devices starting from the device specified by
D goes out of range
CR2012 • When the indirect specification or index modification range is inappropriate
ON in the above cases. Otherwise, OFF.
The status does not change if n is a constant, and an indirect specification or index
modification is not set for D .

* The instruction is not executed when CR2012 turns ON.


4

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-181


ENCO Encode ON
position of bit

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
device within
specified range
to a numerical
XCH
number.

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.

Ladder program Input mode


Execution condition S
ENCO STA E N C O S n
n

Execution condition S
ENCO STA @ E N C O S n
n

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices Word Devices Const Ind Spec
Local Modify
Device
MR DM EM
Instructions
Data Conversion

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -    -    *4 - - - - -  - -   
n  *3 -  *3 - - -  *3  *3  *4  *3  *3  *3*5  *3*5  *3  *3  -  *3  *3  *3

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.

Example When S is MR100, and n is #8


omitted

107 106 105 104 103 102 101 100


MR100 to MR107 1 0 1 0 1 0 0 0
7 6 5 4 3 2 1 0

Min. device No. is MR103 in ON


devices, so “3” is stored in 16-bit
internal register

16-bit internal register 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1

@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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When n ≥ 257
• When n =0
CR2012
• When the devices specified by S and n are out of range
• When not even one n bit device from S is not ON
• When the indirect specification or index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON. 4


KV-7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-183


ABS Absolute
value

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Ladder program Input mode


Execution condition
LDA ABS STA A B S

Execution condition

4
LDA ABS STA @ A B S

Available Devices ( ): Not supported on the KV-1000


Instructions
Data Conversion

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

16-bit internal register 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 Before execution

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

16-bit internal register 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 1 After execution


#12345

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.

4-184 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

bit bit bit bit


31 16 15 0

32-bit internal 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 Before


register execution

bit bit bit bit


31 16 15 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

bit bit bit bit


31 16 15 0

32-bit internal 0 1 0 0 1 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 After


register execution
#1234567890

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.

When internal register value < 0


32-bit internal register 32-bit internal register

Single precision floating point type real number - 1 × Single precision floating point type real number
32-bit 32-bit

ABS.DF When the execution conditions turn ON, if the double precision floating point type real
number stored in the 64-bit internal register is less than 0, the sign is reversed and the
value is stored in the internal register.
This is not executed if the value stored in the internal register is greater than 0.

When internal register value < 0


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

@ABS. 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
For suffix "S/L":
ON when the following condition is established. Otherwise, OFF.
• When internal register value is -32768(.S)/-2147483648(.L)
CR2012 For suffix "F/DF":
ON when the following condition is established. Otherwise, OFF.
• When internal register value exceeds range of single precision/double precision floating
point type real number

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-185


CPMSET Creates CIP
message

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

CPMSET

CPMSET CPMSET
CIP message Creates the data sent with
creation CIP messaging.
@CPMSET CPMSET

Ladder program Input mode


Execution condition CPMSET
S1 S2 D C P M S E T S1 S2 D

Execution condition CPMSET


S1 S2 D @ C P M S E T S1 S2 D

4 Bit Devices
Available Devices

Word Devices
( ): Not supported on the KV-1000

Const Ind Spec


Local
Index
Modify
Operand Device
Instructions
Data Conversion

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

*1 When specifying a bit device, specify the head of the channel.


*2 If a bit device is specified, 16 continuous bits are processed. When a channel other than the
leading channel (MR002, R1012, etc.) is specified, the bits are processed crossing to 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 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.

4-186 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

bit bit
15 0
S2
Data type Data size (byte unit)

High-order 4 bits Low-order 12 bits

High-order 4 bits Low-order 12 bits


0: Other than text 1 to 4095 (001H to FFFH): Specifies data size
string
0 to 1999 (000H to 7CFH): Specifies number of characters to convert into CIP text
string type data. If 0 is specified, characters up to NULL(00H) are converted.
1: Text string
If the specified number of characters contains NULL(00H), 00H is added to the

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 1) The leading 2-byte numeric data is stored.


After storing 0 in D +0, 0002H (2-bytes other than text string) is
specified in S2 , and the CPMSET instruction is executed. When
D +0 is 0, the numeric data is stored in D +1 and following, and the
stored data size (byte unit) is added to D +0.
Data storage start position: 0
Specifies 2-byte numeric data bit bit
15 0
S2 0002H
0(0000H) D +0
bit bit
15 0 D +1
S1 +0 22H 11H

Add data size


bit bit
15 0
2(0→2) D +0
22H 11H D +1

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-187


ARITHMETIC OPERATION INSTRUCTIONS

Data Conversion Instructions

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

S2 0004H 22H 11H D +1


bit bit
15 0 5(0005H) D +2
S1 +0 44H 33H
B(42H) A(41H) D +4
S1 +1 66H 55H
D(44H) C(43H) D +5
E(45H) D +6
D +7
4-byte numeric data is added to the
D CIP message. Add data size
bit bit
15 0
13(9→13) D +0
22H 11H D +1
5(0005H) D +2
B(42H) A(41H) D +4
D(44H) C(43H) D +5
33H E(45H) D +6
55H 44H D +7
66H D +8

4-188 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

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

① A(41H) Low-order bytes


S1 +2 D +2
of character size
① A(41H) High-order bytes

Instructions
Data Conversion
S1 +3 ② B(42H) of character size D +3

S1 +4 ③ C(43H) ③ C(43H) ② B(42H) D +4

S1 +5 00H 00H 00H D +5

S1 +6

S1 +7 00H 00H D +11

@CPMSET 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
ON when one of the following conditions is established. Otherwise, OFF.
• When device other than the channel's leading device is specified as the bit device in
S1 , D
• When the S2 high-order 4 bits is 1 (text string), and the S1 text string length is 0 or is
2000 or higher
• When the S2 high-order 4 bits is 1 (text string), and S1 does not have an end
character
• When the S2 high-order 4 bits is 1 (text string), and the low-order 12 bits of S2 is 2000
CR2012 or more
• When the S2 high-order 4 bits is 0 (not text string), and the low-order 12 bits of S2 is 0
• When the S2 high-order 4 bits is 2 or more
• When the data size after addition exceeds 65535
• When the indirect specification or index modification range is inappropriate
• When the text string length specified by the lower 12 bits of S2 exceeds the device end of
the S1 device
• When the data after additions exceeds the D device end
• When timer or counter is indirectly specified for S1 , D

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-189


ARITHMETIC OPERATION INSTRUCTIONS

Data Conversion Instructions

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

4-190 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

MEMO

Instructions
Data Conversion

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-191


CPMGET Gets CIP message

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

CPMSET

The text string data


CPMGET CPMGET
CIP message
and numeric data
are retrieved from
retrieval
@CPMGET CPMGET the data received
with CIP messaging.

Ladder program Input mode


Execution condition CPMGET
S1 S2 D1 D2 C P M G E T S1 S2 D1 D2

Execution condition CPMGET


S1 S2 D1 D2 @ C P M G E T S1 S2 D1 D2

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Data Conversion

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
   -   
D1  -  - - -    *3   - - -  - -   
D2  -  - - -    *3 - - - - -  - -   

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

D2 Specifies the leading device for storing the retrieved data. *1

*1 When specifying a bit device, specify the head of the channel.


*2 If a bit device is specified, 16 continuous bits are processed.
When a channel other than the leading channel (MR002, R1012, etc.) is specified, the bits are
processed crossing to 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 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.

4-192 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

bit bit
15 0
S2
Data type Data size (byte unit)

High-order 4 bits Low-order 12 bits

High-order 4 bits Low-order 12 bits


0: Other than text 1 to 4095 (001H to FFFH): Specifies data size
string
0 to 1999 (000H to 7CFH): Specifies number of characters.
When 0 is specified or if a value larger than the number of characters in the CIP text
string type data is specified, the data up to the number of characters in the CIP text
1: Text string
string type data is stored.
If a value smaller than the number of characters in the CIP text string type data is
4
specified, the data up to the specified number of characters is stored.

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 1) Read the numeric data of the leading two bytes.


Specify 0 (offset position 0) in D1 and 0002H (two bytes other than text
string) in S2 and execute the CPMGET instruction.
Specifies 2-byte numeric data Offset position: Specify 0
S2 0002H D1 0
Offset position: 0
bit bit
15 0
S1 +0 13(000DH)
S1 +1 22H 11H
S1 +2 5(0005H) Retrieve data
S1 +3 B(42H) A(41H)
S1 +4 D(44H) C(43H)
D2 22H 11H
S1 +5 33H E(45H)
S1 +6 55H 44H
D1 2(0+2)
S1 +7 66H
Add data size to D1

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-193


ARITHMETIC OPERATION INSTRUCTIONS

Data Conversion Instructions

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.

Offset position: 0 Specify text string Offset position: Specify 2


S2 1000H D1 2
bit bit
15 0
S1 +0 13(000DH)

4 S1
S1
+1
+2
22H
5(0005H)
11H
Instructions
Data Conversion

S1 +3 B(42H) A(41H) Retrieve data


S1 +4 D(44H) C(43H) bit bit
15 0 D1 9(2+7)
S1 +5 33H E(45H) D2 +0 A(41H) B(42H)
S1 +6 55H 44H D2 +1 C(43H) D(44H) Add data size to D1
S1 +7 66H D2 +2 E(45H) NUL(00H)

Add NULL(00H) to end, interchange high-order bytes and


low-order bytes of text string having data size, and then store.

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)

S1 +7 66H Retrieve data Add data size to D1


bit bit
15 0
D2 +0 44H 33H
D2 +1 66H 55H

@CPMGET Only one scan is executed at the rising edge of the execution conditions.

4-194 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Data Conversion Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When a bit device other than the channel's leading device is specified in S1 , D
• When the high-order 4 bits of S2 are 1 (text string) and the low-order 12 bits are 0, and a
text string length contained in S1 specifies a text string longer than 2000
• When the high-order 4 bits of S2 are 1 (text string), and the low-order 12 bits of S2 are
2000 or more

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

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-195


Floating Point Instructions
FLOAT Converts binary to

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
single precision
floating point type
real number
FLOAT

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

Ladder program Input mode


Execution condition
LDA FLOAT STA.F F L O A T

Execution condition

4 LDA FLOAT STA.F @ F L O A T

Available Devices ( ): Not supported on the KV-1000


Instructions
Floating Point

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.

Before executing After executing


bit
31
32-bit internal register bit
0
bit
31
32-bit internal register bit
0

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state
4

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-197


DFLOAT Converts binary
to double
precision

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
floating point
type real
number
DFLOAT

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

Ladder program Input mode


Execution condition
LDA DFLOAT STA.DF D F L O A T

Execution condition

4 LDA DFLOAT STA.DF @ D F L O A T


Instructions
Floating Point

Available Devices ( ): Not supported on the KV-1000


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
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

4-198 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-199


INTG Converts single
precision floating
point type real

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
number to binary

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

Ladder program Input mode


Execution condition
LDA.F INTG STA I N T G

Execution condition

4 LDA.F INTG STA @ I N T G

Available Devices ( ): Not supported on the KV-1000


Instructions
Floating Point

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

4-200 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON if the data to be converted exceeds the single precision floating point type real number
CR2012
range or if the converted data is not within the 16/32 bit binary range. Otherwise, OFF.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-201


ARITHMETIC OPERATION INSTRUCTIONS

Floating Point Instructions

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

4-202 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

MEMO

Instructions
Floating Point

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-203


DINTG Converts double
precision floating
point type real

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
number to binary

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

Ladder program Input mode


Execution condition
LDA.DF DINTG STA D I N T G

Execution condition

4 LDA.DF DINTG STA @ D I N T G

Available Devices
Instructions
Floating Point

( ): Not supported on the KV-1000


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)
• 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

4-204 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON if the data to be converted exceeds the double precision floating point type real number
CR2012
range or if the converted data is not within the 16/32 bit binary range. Otherwise, OFF.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-205


ARITHMETIC OPERATION INSTRUCTIONS

Floating Point Instructions

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

4-206 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

MEMO

Instructions
Floating Point

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-207


DFTOF Converts double
precision floating
point type real

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
number to single
precision floating
DFLOA point type real
number

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.

Ladder program Input mode


Execution condition
LDA.DF DFTOF STA.F D F T O F

Execution condition
LDA.DF DFTOF STA.F @ D F T O F

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices Word Devices Const Ind Spec
Local Modify
Device
MR DM EM
Instructions
Floating Point

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
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.

4-208 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is ON. Otherwise, OFF.
• When data to be converted exceeds the double precision floating point type real number
CR2012 range
• When the converted value exceeds the single precision floating point type real number
range

* 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. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-209


FTODF Converts single
precision
floating point

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
type real number
to double
DFL precision
floating point
type real number

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.

Ladder program Input mode


Execution condition
LDA.F FTODF STA.DF F T O D F

Execution condition
LDA.F FTODF STA.DF @ F T O D F

Available Devices ( ): Not supported on the KV-1000

4
Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Operand Device
MR DM EM
Instructions
Floating Point

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
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.

4-210 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON if the data to be converted exceeds the single precision floating point type real number
CR2012
range. Otherwise, OFF.

* 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) 4

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-211


DISF Disperse
mantissa/exponent

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
of single precision
floating point type
real number
DISF

To disperse a single
DISF
DISF
Disperse F precision floating point
(Disperse mantissa/ type real number into a
exponent of single mantissa and exponent,

@DISF precision floating point and store them in


DISF
type real number) specified devices
separately.

Ladder program Input mode


Execution condition DISF
S D1 D2 D I S F S D1 D2

Execution condition DISF


S D1 D2 @ D I S F S D1 D2

4 Available Devices ( ): Not supported on the KV-1000


Local
Index
Bit Devices Word Devices Const Ind Spec Modify
Instructions
Floating Point

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

Single precision floating point type real number Separate 32-bit


(2 words)
32-bit
(2 words) D2
Exponent: Signed 16-bit BIN data
-1.234×10-3 Seperating example
16-bit
(1 word)

Mantissa Exponent

Mantissa part -1234000 (Signed 32-bit BIN data)


-1.234 × 10-3 Separate

Exponent part -9 (Signed 16-bit BIN data)


(Single precision floating point typereal number)

4-212 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

@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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the dispersed data is outside the floating real number range, or when the indirect
CR2012
specification or index modify range is inappropriate. Otherwise, OFF

* The instruction is not executed when CR2012 turns ON.


4

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-213


UNIF Unite mantissa and
exponent to single

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
precision floating
point type real
number
DISF

Unite F To unite the specified


UNIF
UNIF
(unit mantissa and mantissa and exponent,
exponent to single and store the united single
precision floating precision floating point type
@UNIF
UNIF
point type real real number to a specified
number) device.

Ladder program Input mode


Execution condition UNIF
S1 S2 D U N I F S1 S2 D

Execution condition UNIF


S1 S2 D @ U N I F S1 S2 D

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)

Mantissa part -1234 (Signed 32-bit BIN data)


Example of unite Unite -1.234 X 10-3
Exponent part -6 (Signed 16-bit BIN data) (Single precision floating point type real number)
4-214 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

@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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the result is outside the floating real number range, or when the indirect specification
4
CR2012
or index modify range is inappropriate. Otherwise, OFF

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-215


EXP Exponent
operation
LOG Natural logarithm

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
operation

DISF

The exponential function using


EXP EXP(.F)
EXP.DF
EXP
Exponent
the (single precision/double
precision) floating point type
arithmetic
real number stored in the
@EXP @EXP(.F)
@EXP.DF
EXP
operation
internal register as an exponent
is obtained
The natural logarithm of the
LOG LOG(.F)
LOG.DF
LOG
Logarithmic (single precision/double
arithmetic precision) floating point type

@LOG @LOG(.F)
@LOG.DF
LOG
operation real number stored in the
internal register is obtained.

Ladder program Input mode

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

Available Devices ( ): Not supported on the KV-1000


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 • 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

32-bit internal register 32-bit internal register

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.

4-216 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

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.

64-bit internal register 64-bit internal register

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.

32-bit internal register 32-bit internal register

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

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-217


ARITHMETIC OPERATION INSTRUCTIONS

Floating Point Instructions

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

4-218 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

MEMO

Instructions
Floating Point

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-219


LOG10 Constant
logarithm

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
operation

LOG10

The common logarithm of the


LOG10 LOG10(.F)
LOG10.DF
LOG10
single precision floating point
type real number stored in the
LOG10 32-bit internal register or the

@LOG10 @LOG10(.F)
@LOG10.DF
LOG10
double precision floating point
type real number stored in the
64-bit register is obtained.

Ladder program Input mode


Execution condition
LDA.F LOG10 STA.F L O G 1 0

Execution condition
LDA.F LOG10 STA.F @ L O G 1 0

4 Available Devices ( ): Not supported on the KV-1000


Index
Local
Bit Devices Word Devices Const Ind Spec Modify
Instructions
Floating Point

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.

4-220 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the following condition is established. Otherwise, OFF.
CR2012 • When the value stored in the internal register is 0 or negative, or exceeds the single precision
floating point type real number or double precision floating point type real number range

* 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)
4

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-221


RAD Converts degree
(°) to radians
DEG Converts radians

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
to degree (°)

DISF

The angle (°) unit of the (single


RAD RAD(.F)
RAD.DF
RAD
precision/double precision) floating
Radian point type real number currently

@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 (°).

Ladder program Input mode


Execution condition

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

Available Devices ( ): Not supported on the KV-1000


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 • 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

4-222 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

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.

Reference (°) and radian (rad) are calculated as follows:

π 180
1° = ≒ 0.01745(rad), 1(rad) = ≒ 57.23°
180 π

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• RAD(.F)/DEG(.F): When value to be operated on is not with the range of the single precision
CR2012 floating point type real number
• RAD.DF/DEG.DF: When value to be operated on is not with the range of the double precision
floating point type real number

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-223


ARITHMETIC OPERATION INSTRUCTIONS

Floating Point Instructions

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

4-224 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

MEMO

Instructions
Floating Point

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-225


SIN Calculates the sine
(sin) value from the
angle (radians)

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
COS Calculates the
cosine (cos) value
from the angle
DISF
(radians)
TAN Calculates the
tangent (tan) value

Obtains the sine (sin) value of


from the angle

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

Ladder program Input mode


Execution condition
LDA.F SIN STA.F S I N

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

Available Devices ( ): Not supported on the KV-1000


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 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

"Data Processing" (Page 1-26)

4-226 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

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.

SIN 32-bit internal register 32-bit internal register

COS ( Single precision floating point type real number ) Single precision floating point type real number

TAN
4
32-bit 32-bit

SIN.DF / COS.DF / TAN.DF

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.

SIN 64-bit internal register 64-bit internal register

COS ( Double precision floating point type real number ) Double precision floating point type real number

TAN 64-bit 64-bit

@ Only one scan is executed at the rising edge of the execution conditions.

Reference Angle ( °) and radian (rad) are calculated as follows:

π 180
1° = ≒ 0.01745(rad), 1(rad)= ≒ 57.23°
180 π

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When the value to be operated exceeds the single precision floating point type real number
range which can be handled by the SIN(.F) instruction, COS(.F) instruction or TAN(.F)
CR2012 instruction
• When the value to be operated exceeds the double precision floating point type real number
range which can be handled by the SIN.DF instruction, COS.DF instruction or TAN.DF
instruction

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-227


ARITHMETIC OPERATION INSTRUCTIONS

Floating Point Instructions

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

4 LDA.F TAN STA.F STA.F DM10


MRD
LDA.F DM0
CON
Instructions
Floating Point

COS
CON
STA.F DM20
MPP
LDA.F DM0
CON
TAN
CON
STA.F DM30

4-228 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

MEMO

Instructions
Floating Point

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-229


ASIN Calculates
the angle

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

ASIN(.F) ASIN To calculate the angle (radians)


ATAN Calculates
the angle
(radians)

ASIN.DF from sine (sin) of the floating


from
tangent (tan)
the

Arc sine
value

real number currently stored in


@ASIN @ASIN(.F)
@ASIN.DF
ASIN 32-bit internal register.

To calculate the angle


ACOS ACOS(.F)
ACOS.DF
ACOS
(radians) from cosine (cos) of
Arc cosine the floating real number

@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

Ladder program Input mode


Execution condition
LDA.F ASIN STA.F A S I N

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

Available Devices ( ): Not supported on the KV-1000


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 • 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

4-230 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

ASIN.DF / ACOS.DF / ATAN.DF


When the execution condition is ON, the angle (radians) is calculated from the sine (sin)
value, cosine (cos) value and tangent (tan) value of the double precision floating point
type real number currently stored in the 64-bit internal register. The operation result is
stored in the 64-bit internal register as a double precision floating point type real number.

A S I N -1 64-bit internal register 64-bit internal register


-
ACOS 1 ( Double precision floating point typereal number ) Double precision floating point typereal number
-
ATAN 64-bit 64-bit

@ Only one scan is executed at the rising edge of the execution conditions.

Reference Angle (°) and radian (rad) are calculated as follows:

1° =
π
≒ 0.01745(rad), 1(rad)=
180
≒ 57.23°
4
180 π

Instructions
Floating Point
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• For ASIN, ACOS, when the value to be operated exceeds the range of -1.0 to 1.0
• When the suffix is .F and the value to be operated on exceeds the single precision floating
point type real number range
CR2012 • When the suffix is .DF and the value to be operated on exceeds the range of a double
precision floating point type real number
* The range of floating point type real numbers differs by unit. For details, refer to the user's
manual for the unit.

* 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 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

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
g
l
ATAN2 e

(
r
a

ATAN2
d

ATAN2(.F) ATAN2 Calculate the angle (radians)


i
a
n

ATAN2.DF Arc from the coordinates (X, Y) of


s
)
f
r

tangent 2 the (single/double precision)


o
m

@ATAN2 @ATAN2(.F) t

floating point type real number.


h
ATAN2 e

@ATAN2.DF c
o
o
r
d
i
n
a

Ladder program Input mode t


e
s
(

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.

S2 +1 S2 S1 +1 S1 32-bit internal register


Single precision floating point typereal number , Single precision floating point typereal number Single precision floating point typereal number

32-bit 32-bit 32-bit

4-232 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Floating Point Instructions

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.

S2 +3 S2 +2 S2 +1 S2 S1 +3 S1 +2 S1 +1 S1 64-bit internal register


Double precision floating point typereal number , Double precision floating point typereal number Double precision floating point typereal number
64-bit 64-bit 64-bit

@ 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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the suffix is .F and the value to be operated on exceeds the single precision floating
CR2012
point type real number range
• When the suffix is .DF and the value to be operated on exceeds the range of a double
precision floating point type real number

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300 When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List" (Page A-71)

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

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
HEX ASCII
code

ASC

ASC ASC(.U) ASC HEX ASCII


code
Convert BIN data in internal
registers to HEX ASCII character
@ASC @ASC(.U) ASC conversion code.

Ladder program Input mode


Execution condition
LDA ASC STA A S C

Execution condition
LDA ASC STA @ A S C

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
4 Operand

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

Before conversion 1 0 1 0 0 1 0 1 :16-bit internal register


0 0 A 5

3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

After conversion 0 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 :16-bit internal register


4 1 3 5

@ASC(.U) 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
CR2012 No change in state

4-234 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-235


RASC Converts reverse
HEX ASCII code

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano to binary


ARITHMETIC OPERATION INSTRUCTIONS

ASC

RASC RASC(.U) RASC HEX ASCII


code reverse
Convert HEX ASCII code text code
in internal registers to binary data.
@RASC @RASC(.U) RASC conversion

Ladder program Input mode


Execution condition
LDA RASC STA R A S C

Execution condition
LDA RASC STA @ R A S C

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
4 Operand
MR DM EM
Device

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


Instructions
Text Processing

(B) (W) (ZF)


- - - - - - - - - - - - - - - - - - - - -

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

0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 :16-bit internal register


After conversion
0 0 6 C

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when there are ASCII character codes that cannot be handled. Otherwise, OFF
CR2012
"ASCII Code Table" (Page A-115)

* 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)

4-236 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-237


DASC Converts
binary to
decimal ASCII

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
code

ASC

DASC(.U)

DASC DASC.S DASC


DASC.D
DASC.L Decimal ASCII Convert numerical
code values to a decimal
@DASC(.U) conversion ASCII text string
@DASC @DASC.S DASC
@DASC.D
@DASC.L

Ladder program Input mode


Execution condition DASC
S D D A S C S D
( D S T R S D )
Execution condition DASC

4 S D @ D A S C
( @ D S T R S
S
D )
D

Available Devices ( ): Not supported on the KV-1000


Instructions
Text Processing

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

Unsigned 16-bit BIN data D ten thousand thousand

16-bit D +1: hundred ten Ended with


“00H”.
N
D +2: one U
L
(00H)

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.

4-238 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

bit
15
S bit
0
bit
15
bit
0

Signed 16-bit BIN data D Sign ten thousand

16-bit D +1: thousand hundred

D +2: ten one


N
D +3: U
L
(00H)

Ended with “00H”. No change before and


after executing instruction.

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

Unsigned 32-bit BIN data D billion hundred million


32-bit D +1: ten million million

Instructions
Text Processing
D +2: hundred thousand ten thousand

D +3: thousand hundred

D +4: ten one


N
D +5: U
L
(00H)

Ended with “00H”. No change before and


after executing instruction.

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

Signed 32-bit BIN data D Sign billion

32-bit D +1: hundred million ten million

D +2: million hundred thousand

D +3: ten thousand thousand

D +4: hundred ten


D +5: one N
U (00H)
L

Ended with “00H”.

@DASC. 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
ON when one of the following conditions is established. Otherwise, OFF
• When a device other than the leading device of the channel is specified when a bit device is
specified to D
CR2012 • When a timer/counter has been specified by indirect specification to D
• When the indirect specification or index modify range is inappropriate
• When the start is within the device range but the end is out of range. (The number of words
below are required according to the suffix. .U: 3, .S: 4, .D/.L: 6)

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-239


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

About zero suppression


"Zero suppression" is a function for omitting "0" (zeros) not required in the upper digits.

Example The unsigned 16-bit binary data currently stored to data memory DM0 is converted 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)

With zero suppression


DM10: 1(31H) 2(32H)
CR2814: ON
N
DM11: 3(33H) U
L
(00H)

DM12:

No change before and after


executing instruction.

About omission of + sign


The + symbol can be omitted when signed data is converted to ASCII text string.

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:

No change before and after


executing instruction.

4-240 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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)

DM12: 3(33H) 4(34H)


N
DM13: U
L
(00H)

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

#1234 DM10: 1(31H) 2(32H)

DM11: 3(33H) 4(34H)


N
DM12: U
L
(00H)

Point To prevent erroneous operation, set CR2814 and CR2815 before executing the
instructions.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-241


RDASC Converts
reverse decimal

KV-1000 KV Nano
ASCII code to

KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS
binary

ASC

RDASC(.U)

RDASC RDASC.S RDASC


RDASC.D
RDASC.L Decimal ASCII Convert decimal
code reverse ASCII text string to
@RDASC(.U) conversion numerical values
@RDASC @RDASC.S RDASC
@RDASC.D
@RDASC.L

Ladder program Input mode


Execution condition RDASC
S D R D A S C S D
( D V A L S D )
Execution condition RDASC

4 S D @ R D A S C
( @ D V A L S
S
D )
D

Available Devices ( ): Not supported on the KV-1000


Instructions
Text Processing

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

*1 For bit devices, specify the leading device of the channel.


"ASCII Code Table" (Page A-115)
*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.

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

S ten thousand thousand Unsigned 16-bit BIN data

S +1: hundred ten


N
S +2: one U
L
(00H)
String must be ended with NUL(00H).

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

S Sign ten thousand Signed 16-bit BIN data

S +1: thousand hundred

S +2: ten one


N
S +3: U
L
(00H) String must be ended with NUL(00H).

4-242 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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 billion hundred million Unsigned 32-bit BIN data

S +1: ten million million

S +2: hundred thousand ten thousand

S +3: thousand hundred

S +4: ten one

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

S Sign billion Signed 32-bit BIN data

S +1: hundred million ten million


S +2: million hundred thousand

S +3: ten thousand thousand

S +4: hundred ten


N
S +5: one U
L
(00H)
String must be ended with NUL(00H).

@RDASC.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
ON when one of the following conditions is established. Otherwise, OFF
• When there is an invalid character in S
• When converted values are outside the 16-/32-bit unsigned (or signed) binary range
• 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 or index modify range is inappropriate
• When the end of S is not NULL (00H)

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-243


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

Example of converting zero-suppressed data


"Zero suppression" is a function for omitting "0" (zeros) not required in the upper digits.
Data that is already zero-suppressed is converted correctly.

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 of converting sign-omitted data


ASCII text strings without a sign are handled as data with +(2BH) omitted.

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

DM0: 1(31H) 2(32H) bit DM10 bit


15 0

DM1: 3(33H) 4(34H) +12345


N
DM2: 5(35H) U
L
(00H)

4-244 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

DM0: 1(31H) 2(32H)


DM11 DM10
DM1: 3(33H) 4(34H) 1234567890

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

DM0: -(20H) 1(31H)


DM11 DM10
DM1: 2(32H) 3(33H) -1234567890

DM2: 4(34H) 5(35H)

DM3: 6(36H) 7(37H)

DM4: 8(38H) 9(39H)


N
DM5: 0(30H) U
L
(00H)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-245


HASC Converts
numerical value

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
(HEX) to HEX
ASCII text string

ASC

HASC HASC(.U) HASC


HASC.D HEX ASCII Convert numerical
code values (HEX) to HEX

@HASC @HASC(.U) conversion ASCII text string.


HASC
@HASC.D

Ladder program Input mode


Execution condition HASC
S D n H A S C S D n
( H S T R S D n )
Execution condition HASC
S S
D D
n @ H A S C S D n
( @ H S T R S D n )

Available Devices ( ): Not supported on the KV-1000

4
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *5   *6 *6   *3    
D  -  - - -   *5 - - - - -  -    
n  -  - - -   *5   *6 *6    -   

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)

4-246 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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 2(32H) C(43H) D +1 1(31H) 2(32H)


D +2 D(44H) E(45H) D +2 C(43H) D(44H)
N
D +3 0(30H) U
L
(00H) D +3 E(45H) 0(30H)
N
n=0 D +4 U
L
(00H)

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

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 a device other than the leading device of the channel is specified when a bit device is
specified to D
• When a timer/counter has been specified by indirect specification to D
CR2012
• When 5 or more is specified to n in the case of .U suffix instructions and 9 or more is
specified in the case of .D suffix instructions
• When the indirect specification or index modify range is inappropriate
• When the end is out of range.

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-247


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

0 0 1 A DM10: 0(30H) 1(31H)

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

$00123ABC DM10: 1(31H) 2(32H)

DM11: 3(33H) A(41H)

DM12: B(42H) C(43H)


N
DM13: U
L (00H)

4-248 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-249


RHASC Converts HEX
ASCII text string to
numerical value

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
(Hex)

ASC

RHASC RHASC(.U) RHASC


Convert HEX ASCII
RHASC.D HEX ASCII
text string to
code reverse
numerical values
@RHASC conversion
@RHASC(.U) RHASC
@RHASC.D
(HEX)

Ladder program Input mode


Execution condition RHASC
S D R H A S C S D
( H V A L S D )
Execution condition RHASC
S D @ R H A S C S D
( @ H V A L S D )

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

*1 For bit devices, specify the leading device of the channel.


"ASCII Code Table" (Page A-115)
*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.

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 .

4-250 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

Example HEX ASCII string Unsigned 16-bit BIN data


bit
15

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".

Example HEX ASCII string Unsigned 32-bit BIN data


bit bit
15 0

S 1(31H) 2(32H)

S +1 A(41H) B(42H) D +1 D

S +2 C(43H) D(44H) 1 2 A B C D 1 4

S +3 1(31H) 4(34H)
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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-251


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When there is an invalid character in S
• When the value after conversion is outside the 16/32-bit unsigned binary data range
CR2012 • When a device other than the leading device of the channel is specified when a bit device is
specified to S
• When a timer/counter has been specified by indirect specification to S

4 • When the indirect specification or index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


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 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)

4-252 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-253


FASC Convert single
precision

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
floating point
type real
number to text
ASC
string

Single
FASC
FASC
precision
Convert single precision floating point
floating point
type real numbers to text strings.
@FASC text string
FASC
conversion

Ladder program Input mode


Execution condition FASC
S1 S2 D F A S C S1 S2 D

Execution condition FASC


S1 S
S2 D @ F A S C S1 S2 D

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices
DM EM
Word Devices Const Ind Spec
Local Modify
Device
MR
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S1  -  - - -   *5   - - -  -    
S2  -  - - -   *5 - - - -       
D  -  - - -   *5 - - - - -  -    

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.

4-254 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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.

Example When specified by the following parameter content


S1 : 0 (decimal point format) S2 S2 +1: +12.3 (single precision floating point type real number)
S1 +1 : 7 (total number of digits) CR2815 : OFF (+ sign not omitted)
S1 +2 : 2 (number of digits decimal point) CR2814 : OFF (zerosare not suppressed)
bit
15
“+012.30” bit
0 4
D +(31H) 0(30H)

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-255


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the parameter value is out of range
• When the indirect specification or index modify range is inappropriate
• When a single precision floating point type real number out of the range has been specified
• When the number of digits of the text string to store has exceeded the total number of digits
• When a device other than the leading device of the channel is specified when a bit device is

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

satisfy the following conditions


Decimal point format display Exponent format display
number of digits past decimal point = 0 1 ≤ total number of digits ≤ 24 5 ≤ total number of digits ≤ 24
0 < number of digits past Number of digits past decimal point Number of digits past decimal point
+2 ≤ total number of digits +6 ≤ total number of digits
decimal point ≤ 7 3 ≤ total number of digits ≤ 24 7 ≤ total number of digits ≤ 24

* 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)

4-256 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

1. Zero suppression: OFF (Without Zero suppression)


+ sign omitted: ON (omitted)

2. Decimal place, 10 digits, 5 digits below decimal point

3. After storing +1.23456 as string to DM1000


Store string: 0001.23456

4. Zero suppression: ON (omitted)


+ sign omitted: OFF (Without Zero suppression)

5. Exponent mode, 15 digits, 5 digits below decimal place

6. After storing -1.23456E-10 as string to DM2000


Store string: -1.23456E-10

To prevent erroneous operation, set CR2814 and CR2815 before executing the instructions.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-257


RFASC Converts text
string to single

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

Ladder program Input mode


Execution condition RFASC
S D R F A S C S D

Execution condition RFASC


S D @ R F A S C S D

Available Devices ( ): Not supported on the KV-1000


4 Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify
Operand
DM EM
Instructions
Text Processing

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

*1 For bit devices, specify the leading device of the channel.


*2 When a bit device has been specified, 32 continuous bits are occupied. When a relay other than
the leading relay (e.g. MR002, or R1012) of the channel has been specified, 32 bits are
occupied straddling the next channel.
When a word device has been specified, two continuous words are occupied.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.

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".

Example For single precision floating point


text string “+012.30”
bit bit
15 0

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)

For single precision floating point


text string “+1.23E+01”
bit bit
15 0

S +(2BH) 1(31H)

S +1 .(2EH) 2(32H) D +1 D

S +2 3(33H) E(45H) +12.3

S +3 +(2BH) 0(30H) Single precision floating point type real number


N
S +4 1(31H) U
L (00H)

4-258 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

@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

Numerical value: 0 to 9, approx. seven


effective digits . (2 EH) position is not specified.

+ E +
_
-
Sign Value Sign Value

Sign: +, - or no sign is allowed

Numerical value: 0 to 9, approx. seven


effective digits . (2 EH) position is not specified.

Sign: +, - or no sign is allowed

Numerical value: 0 to 9, one or two effective digits

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the length of a text string is 0
• When the format of the text string is incorrect
• When the numerical value after conversion exceeds the single precision floating point type
real number range
CR2012
• When a device other than the leading device of the channel is specified when a bit device is
specified to S
• When a timer/counter is specified to S by indirect specification
• When the indirect specification or index modify range is inappropriate
• When the length of the text string specified by S exceeds 24

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-259


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

4-260 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-261


LEN Detect text string

KV-1000 KV Nano
length

KV-7500/7300 KV-5500/5000/3000
ARITHMETIC OPERATION INSTRUCTIONS

ASC

LEN
LEN

Detect text string Count the number of characters


length in text strings.
@LEN
LEN

Ladder program Input mode


Execution condition LEN
S D L E N S D

Execution condition LEN


S D @ L E N S D

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices
DM EM
Word Devices Const Ind Spec
Local Modify
Device
MR
C CTC CR TM FM T
Instructions
Text Processing

R (DR) LR T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *4 - - - - -  *2    
D  -  - - -   *4   - - -  -    

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.

4-262 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When there is no 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 by indirect specification
• When a timer/counter has been specified by indirect specification to S
• When the indirect specification or index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


4

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

DM0 1(31H) 2(32H) DM100

DM1 A(41H) B(42H) 4


N
DM2 U
L (00H)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-263


SMOV Stores a text
string to a
specified device

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

ASC

SMOV
SMOV

Move text
Store a text string to a specified device.
string
@SMOV
SMOV

Ladder program Input mode


Execution condition SMOV
S D S M O V S D

Execution condition SMOV


S D @ S M O V S D

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices
DM EM
Word Devices Const Ind Spec
Local Modify
Device
MR
C CTC CR TM FM T
Instructions
Text Processing

R (DR) LR T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *3 - - - - -  *2    
D  -  - - -   *3 - - - - -  -    

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

*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 EM and FM (ZF) cannot be used with the KV Nano Series.

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)

: G(47H) H(48H) D +1 : C(43H) D(44H)


N
I(49H) J(4AH) D +2 : E(45H) U
L
(00H)

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.

4-264 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the text string specified by S does not contain the end code (NULL (00H))
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When a device other than the leading device of the channel is specified when a bit device is
CR2012
specified to S and D
• When a timer/counter has been specified by indirect specification to S and D
• When the indirect specification or index modify range is inappropriate
• When exceeding the D device end when the text string S is stored in D 4
* The instruction is not executed when CR2012 turns ON.

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 bit bit


15 0 15 0

DM0 1(31H) 2(32H) DM100 1(31H) 2(32H)

DM1 A(41H) B(42H) DM101 A(41H) B(42H)


N N
DM2 U
L (00H) DM102 U
L (00H)

Text string "12AB" is stored to DM100 onwards.


(Mnemonics list)
CR2002 SMOV
“12AB” DM100 LD CR2002
SMOV "12AB" DM100

bit bit
15 0

DM100 1(31H) 2(32H)

“12AB” DM101 A(41H) B(42H)


N
DM102 U
L (00H)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-265


SADD Unites the text
strings of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
specified
devices

ASC

SADD
SADD

Add text Unite the text strings of specified


string devices.
@SADD
SADD

Ladder program Input mode


Execution condition
SADD
S1 S2 D S A D D S1 S2 D

Execution condition SADD


S1 S2 D @ S A D D S1 S2 D

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify

MR DM EM
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S1  -  - - -   *3 - - - - -  *2    
S2  -  - - -   *3 - - - - -  *2    
D  -  - - -   *3 - - - - -  -    

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

*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 EM and FM (ZF) cannot be used with the KV Nano Series.

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)

4-266 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

@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

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 text string specified by S1 and S2 does not contain the end code (NULL (00H))
• When the text string after the union including the end code (NULL (00H)) exceeds 2000 4
characters

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

* 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
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)

DM1 : C(43H) D(44H) DM200 : A(41H) B(42H)


N
DM2 : U
L
(00H) DM201 : C(43H) D(44H)

+ DM202 : 0(30H) 1(31H)

DM100 : 0(30H) 1(31H) DM203 : 2(32H) 3(33H)


N
DM101 : 2(32H) 3(33H) DM204 : 4(34H) U (00H)
L
N
DM102 : 4(34H) U
L
(00H)

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

DM200 : A(41H) B(42H)


“ABCD”
+ DM201 : C(43H) D(44H)

DM100 : 0(30H) 1(31H) DM202 : 0(30H) 1(31H)

DM101 : 2(32H) 3(33H) DM203 : 2(32H) 3(33H)


N N
DM102 : 4(34H) U
L
(00H) DM204 : 4(34H) U
L
(00H)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-267


SRGHT Cut text string on
right

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify

MR DM EM
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *5 - - - - -  *2    
D  -  - - -   *5 - - - - -  -    
n  -  - - -   *5   *6 *6   *4 -   

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

*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)
*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 Constants cannot be specified by a "$".
*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
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 .

4-268 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

bit bit
Example 15 0

S A(41H) B(42H)

S +1 C(43H) D(44H)

S +2 E(45H) F(46H)

K(4BH) L(4CH) D K(4BH) L(4CH)

M(4DH) N(4EH) D +1 M(4DH) N(4EH)

S(53H) T(54H) S(53H) T(54H)

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

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 text string specified by S does not contain the end code (NULL (00H))
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When the text string to be stored to D onwards exceeds the device range
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 S and D
• When the indirect specification or index modify range is inappropriate.
• When n is specified as 2000 or more

* The instruction is not executed when CR2012 turns ON.


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, error details are stored in CM2250 to CM2276
"CR/CM List" (Page A-71)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-269


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

DM0: A(41H) B(42H)


bit bit
15 0
DM1: C(43H) D(44H)
DM100: H(48H) I (31H)

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

DM100: I (49H) J(4AH)

“A B C D E F G H I J K L M” DM101: K(4BH) L(4CH)


N
Five DM102: M(4DH) U (00H)
characters L

4-270 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-271


SLEFT Cut text string on
left

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Execution condition SLEFT


S S
D D
n @ S L E F T S D n

Available Devices ( ): Not supported on the KV-1000

4
Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *5 - - - - -  *2    
D  -  - - -   *5 - - - - -  -    
n  -  - - -   *5   *6 *6   *4 -   

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

*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)
*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 "$" cannot 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.

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 .

4-272 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

bit bit
Example 15 0

S A(41H) B(42H) D A(41H) B(42H)


S +1 C(43H) D(44H) D +1 C(43H) D(44H)
S +2 E(45H) F(46H) n
N
K(4BH) U
L (00H)

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

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 text string specified by S does not contain the end code (NULL (00H))
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When the text string to be stored to D onwards exceeds the device range
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 S and D
• When the indirect specification or index modify range is inappropriate
• When n is specified as 2000 or more

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-273


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

DM0 : A(41H) B(42H) DM100 : A(41H) B(42H)

DM1 : C(43H) D(44H) DM101 : C(43H) D(44H)


N

4
DM2 : E(45H) F(46H) DM102 : U
L (00H)

DM3 : G(47H) H(48H)

DM4 : I (49H) J(4AH)


Instructions
Text Processing

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

DM100: A(41H) B(42H)

“A B C D E F G H I J K L M” DM101: C(43H) D(44H)


N
5 words DM102: E(45H) U
L (00H)

4-274 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-275


SMID Cuts part of a
text string

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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

Execution condition SMID


4 S D n1 @ S M I D S D n1 n2
n2
Instructions
Text Processing

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *5 - - - - -  *2    
D  -  - - -   *5 - - - - -  -    
n1  -  - - -   *5   *6 *6   *4 -   
n2  -  - - -   *5   *6 *6   *4 -   

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

*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)
*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 "$" cannot 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.

4-276 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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 A(41H) B(42H) D C(43H) D(44H)

S +1 C(43H) D(44H) D +1 E(45H) F(46H)

S +2 E(45H) F(46H)
n2 words
K(4BH) L(4CH)
N
K(4BH) L(4CH) U
L (00H)

M(4DH) N(4EH) String must be ended with NUL(00H).

S(53H) T(54H)
N
U(55H) U
L (00H)

String must be ended with NUL(00H).

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the text string specified by S does not contain the end code (NULL (00H))
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When (length of S text string) ≤ n1 .
• When the text string to be stored to D onwards exceeds the device range
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 S and D
• When the indirect specification or index modify range is inappropriate
• When n1 or n2 is specified as 2000 or more

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-277


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

bit bit bit bit


15 0 15 0

DM0: A(41H) B(42H) DM100: B(42H) C(43H)

4 DM1: C(43H) D(44H) DM101: D(44H)


N
E(45H)

DM2: E(45H) F(46H) DM102: F(46H) U


L (00H)
Instructions
Text Processing

DM3: G(47H) H(48H)

DM4: I (49H) J(4AH)


N
DM5: K(4BH) U
L (00H)

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

DM100: C(43H) D(44H)

“A B C D E F G H I J K L M” DM101: E(45H) F(46H)


N
4 words DM102: U
L (00H)

4-278 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-279


SRPLC Partial replace
text string

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

ASC

SRPLC

SRPLC Replace text


string Replace part of a text string.
SRPLC section
@SRPLC
Ladder program Input mode
Execution condition SRPLC
S1 S2 D S R P L C S1 S2 D
n1 n2 n1 n2
Execution condition
SRPLC
4 S1

n1
S2

n2
D @ S R P L C S1 S2
n1
D
n2
Instructions
Text Processing

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *5 - - - - -  *2    
S2  -  - - -   *5 - - - - -  *2    
D  -  - - -   *5 - - - - -  -    
n1  -  - - -   *5   *6 *6    *4
-   
n2  -  - - -   *5   *6 *6   *4 -   

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

*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)
*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 "$" cannot 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.

4-280 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

Destination string Replace position n1 Text string to be replaced


bit bit
15 0

S1 A(41H) B(42H) S2 X(58H) Y(59H)


N
S1 +1 C(43H) D(44H) S2 +1 Z(5AH) U
L (00H)

S1 +2 E(45H) F(46H) n2 words String must be ended with NUL(00H).


G(47H) H(48H)

I(49H) J(4AH)

S(53H) T(54H)
N
U(55H) U
L (00H)

String must be ended with NUL(00H).

When n1 =4 and n2 =2, the replaced text string is as follows.

D A(41H) B(42H)

D +1 C(43H) D(44H)

D +2 X(58H) Y(59H) E and F are replaced with X, Y, and Z

D +3 Z(5AH) G(47H)

D +4 H(48H) I(49H)

T(54H) U(55H)
N
U
L (00H)

String must be ended with NUL(00H).

Reference • Operation is the same as the SINS instruction when n2 = 0.


• Operation is the same as the SADD instruction when n1 = (length of S1 text
string) and n2 = 0.
• Operation is the same as the SDEL operation when S2 does not contain a text
string (NULL only).
• Operation is the same as the SMOV operation when n2 = 0 and S2 does not
contain a text string (NULL only).

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-281


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the text string specified by S1 and S2 does not contain the end code (NULL
(00H))
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When (length of S1 text string) < n1
• When the length of the text string after the replacement exceeds 2000 characters including
CR2012
4 NULL characters
• When a device other than the leading device of the channel is specified when a bit device is
specified to S1 , S2 and D
Instructions
Text Processing

• 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

* 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
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

Destination string Replace position:4 Text string to be replaced

DM0: A(41H) B(42H) DM100: 1(31H) 2(32H)


N
DM1: C(43H) D(44H) DM101: U
L (00H)

DM2: E(45H) F(46H) String must be ended with NUL(00H).


N
DM3: U
L (00H)

String must be ended with NUL(00H).

Text string to be replaced

DM200: A(41H) B(42H)

DM201: C(43H) D(44H)

DM202: 1(31H) 2(32H)


N
DM203: U
L (00H)

String must be ended with NUL(00H).

4-282 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

Character D (replacement leading position 3, number of characters 1) in text string (ABCDEF) is


replaced with a text string (XYZ). The text string (ABCXYZEF) after replacement is stored from DM0.
(Mnemonics list)
CR2002 SMID
“ABCDEF” “XYZ” DM0 LD CR2002
#3 #1 SRPLC "ABCDEF" "XYZ" DM0 #3 #1

bit bit
15 0

DM0: A(41H) B(42H)

“A B C X Y Z E F” DM1: C(43H) X(58H)

DM2: Y(59H) Z(5AH)

DM3: E(45H) F(46H)

DM4:
N
U
L (00H)
4

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-283


SINS Inserts a
specified text

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano string into a


ARITHMETIC OPERATION INSTRUCTIONS
text string

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

Execution condition SINS


4 S1 S2 D @ S I N S S1 S2 D n
n
Instructions
Text Processing

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *5 - - - - -  *2    
S2  -  - - -   *5 - - - - -  *2    
D  -  - - -   *5 - - - - -  -    
n  -  - - -    *5    *6 
*6   *4 -   

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".

*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)
*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 "$" cannot 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.

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

Text string to be searched Insert position n


Text string to be searched
bit bit
15 0

S1 A(41H) B(42H) S2 G(47H) H(48H)

S1 +1 C(43H) D(44H) S2 +1 I (49H) J(4AH)


N
S1 +2 E(45H) F(46H) S2 +1 U
L (00H)

S1 +3 K(4BH) L(4CH) String must be ended with NUL(00H).


S1 +4 M(4DH) N(4EH)

S(53H)
N
T(54H) 4
U(55H) U
L (00H)

Instructions
Text Processing
String must be ended with NUL(00H).

When n = 6, the text string after insertion is as follows.

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)

String must be ended with NUL(00H).

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the text string specified by S1 and S2 does not contain the end code (NULL (00H))
• When the text string that includes the end code (NULL (00H)) specified by S1 and
S2 exceeds 2000 characters
• When (length of S1 text string) < n .
CR2012 • When the length of the text string after the insertion exceeds 2000 characters including (NULL (00H))
• When a device other than the leading device of the channel is specified when a bit device is
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 the end of the text string to store in D is out of range

* 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)
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-285
ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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)

DM2: Y(59H) Z(5AH) String must be ended with NUL(00H).


Instructions
Text Processing

N
DM3: U
L (00H)

String must be ended with NUL(00H).

Text string to be searched

DM200: A(41H) B(42H)

DM201: C(43H) 1(31H)

DM202: 2(32H) 3(33H)

DM202: X(58H) Y(59H)


N
DM203: Z(5AH) U
L (00H)

String must be ended with NUL(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

DM0: A(41H) B(42H)

“A B C X Y D Z E F” DM1: C(43H) X(58H)

DM2: Y(59H) Z(5AH)

DM3: D(44H) E(45H)


N
DM4: F(46H) U
L (00H)

4-286 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-287


SDEL Deletes a
specified part

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano of a text string.


ARITHMETIC OPERATION INSTRUCTIONS

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

Execution condition SDEL


4 S

n2
D n1 @ S D E L S D n1 n2
Instructions
Text Processing

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *5 - - - - -  *2    
D  -  - - -   *5 - - - - -  -    
n1  -  - - -   *5   *6 *6   *4 -   
n2  -  - - -   *5    *6  *6
  *4 -   

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

*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)
*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 "$" cannot 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.

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.

Example Position 0 n1 =2, n2 =2


Delete start position n1
bit bit
15 0

S A(41H) B(42H) D A(41H) B(42H)

S +1 C(43H) D(44H) n2 words D +1 E(45H) F(46H)

S +2 E(45H) F(46H) D +2

K(4BH) L(4CH)

K(4BH) L(4CH)

S(53H) T(54H)

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

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 text string specified by S does not contain the end code (NULL (00H))
• When the text string that includes the end code (NULL (00H)) specified by S exceeds
2000 characters
• When (length of S text string)< n1 .
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 S and D
• When the indirect specification or index modify range is inappropriate
• When the end of the text string to store in D is out of range

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-289


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

DM2: E(45H) F(46H) DM102: J(4AH) K(4BH)


N
DM3: G(47H) H(48H) DM103: U
L (00H)

DM4: I(49H) J(4AH)


N
DM5: K(4BH) U
L (00H)

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

DM0: A(41H) B(42H)

“A B C D E F G H I G K L M” DM1: G(47H) H(48H)


Delete DM2: I(49H) J(4AH)

DM3: K(4BH) L(4CH)


N
DM4: M(4DH) U
L (00H)

4-290 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-291


STRIM Deletes ends
of text string

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

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.

Ladder program Input mode


Execution condition STRIM
S1 S2 D S T R I M S1 S2 D

Execution condition STRIM


S1 S2 D @ S T R I M S1 S2 D

Available Devices ( ): Not supported on the KV-1000


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
Text Processing

(B) (W) (ZF)


S1  -  - - -   *4 - - - - -      
S2  -  - - -   *4   *5 *5       
D  -  - - -   *4 - - - - -  -    

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

Deletes all 1-byte spaces and tabs


at the head of the S1 text string.
Deletes all 1-byte spaces and tabs
at the end of the S1 text string.
Reserved for system

4-292 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

@STRIM Only one scan is executed at the rising edge of the execution conditions.

Example When "3" is specified for parameter S2 and instruction is executed

S1 HT(09H) SP(20H) D K(4BH) e(65H)


S1 +1 SP(20H) K(4BH) D +1 y(79H) e(65H)
S1 +2 e(65H) y(79H) D +2 n(6EH) c(63H)
S1 +3 e(65H) n(6EH) D +3 e(65H) NULL(00H)
c(63H) e(65H)
SP(20H) SP(20H)
HT(09H) NULL(00H)
4
Operation flag

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

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-293


SFIND Finds a
specified text

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
string from a text
string.

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

Execution condition SFIND


4 S1

n
S2 D @ S F I N D S1 S2 D n
Instructions
Text Processing

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *5 - - - - -  *2    
S2  -  - - -   *5 - - - - -  *2    
D  -  - - -   *5   - - -  - -   
n  -  - - -   *5   *6 *6   *4 -   

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".

*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)
*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 "$" cannot 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.

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 A(41H) B(42H) S2 C(43H) D(44H)


N
S1 +1 C(43H) D(44H) omitted S2 +1 E(45H) U
L (00H)

S1 +2 E(45H) F(46H) String must be ended with NUL(00H).


S1 +3 G(47H) H(48H)

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)

String must be ended with NUL(00H).

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the 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
• (Length of S1 text string) < n +(length of S2 text string) (Length of text strings
CR2012
do not include end code (NULL (00H).)
• 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 and S2
• When the indirect specification or index modify range is inappropriate

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-295


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

4 DM0: A(41H) B(42H) DM100:


N
X(58H) Y(59H)

DM1: C(43H) D(44H) DM101: U (00H) String must be ended with NUL(00H).
Instructions
Text Processing

DM2: X(58H) Y(59H)


As n =0, so search from start position, n is 4 , first time inspecting XY.
DM3: E(45H) F(46H)
"4" is stored to DM200.
DM4: G(47H) H(48H)

DM5: I(49H) J(4AH) DM200: 4


N
DM6: K(4BH) U
L (00H)

String must be ended with NUL(00H).

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

4-296 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-297


SFINDN Finds specified
text string

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.

Ladder program Input mode


Execution condition SFINDN
S1 S2 S3 D S F I N D N S1 S2 S3 D

Execution condition SFINDN


S1 S2 S3 D @ S F I N D N S1 S2 S3 D

Available Devices ( ): Not supported on the KV-1000


Index

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

(B) (W) (ZF)


S1  -  - - -   *5 - - - - -      
S2  -  - - -   *5 - - - - -      
S3  -  - - -   *5   - - -  - -   
D  -  - - -   *5   - - -  - -   
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
S3 Specifies the leading device in which the parameter is stored. *3
D Specifies the device to store the search result to.*1 *4

*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, 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 has been specified, two continuous words are occupied.
*4 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.
*5 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.
"KV-5000/3000 CPU Function Version" (Page 2)

4-298 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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.

Example When instruction is executed with following parameter details


S3 : 18
S3 +1 : 4
Position 0

Position S3 +1

Text string to be searched


S1 A(41H) B(42H) S2 K(4BH) e(65H)
Omitted
S1 +1 NUL(00H) K(4BH) S2 +1 y(79H) NUL(00H)
S1 +2 e(65H) y(79H)
String must be ended with NUL(00H).
S1 +3 a(61H) b(62H)
S1 +4 c(63H) 1(31H) Search target text string
S1 +5 K(4BH) e(65H)
S1 +6 y(79H) NUL(00H) Search range
S1 +7 d(64H) Z(60H)
S1 +8 2(32H) K(4BH) When S3 =18 and S3 +1=4, the position
e(65H) y(79H) where the text string "Key" is detected after
position 4 is position 10.
NUL(00H) 3(33H)
A(41H) b(62H) D 10
c(63H) N(4EH)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-299


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the parameter value is out of range
• When S2 does not have end code
• When S3 ≥2000 or S3 =0
• When S3 < ([ S3 +1]+ S2 text string length)
CR2012 • When S3 >( S1 text string length)

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

* 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)

4-300 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

Text string to be searched


DM0 A(41H) B(42H) DM100 a(61H) b(62H)
Omitted
DM1 NUL(00H) K(4BH) DM101 c(63H) NUL(00H)
DM2 e(65H) y(79H)
String must be ended with NUL(00H).
DM3 a(61H) b(62H)
DM4 c(63H) 1(31H)
Search target text string: 18 bytes
DM5 K(4BH) e(65H)
DM6 y(79H) NUL(00H) Search range

DM7 d(64H) Z(60H)


DM8 2(32H) K(4BH) When S3 =18 and S4 =4, the position where the text
DM9 e(65H) y(79H) string "abc" is detected after position 4 is position 6.
DM10 NUL(00H) 3(33H)
DM200 6
DM11 A(41H) b(62H)
DM12 c(63H) N(4EH)
Text string to be searched
DM100 d(64H) Z(60H)
DM101 NUL(00H) NUL(00H)

String must be ended with NUL(00H).

When S3 =18 and S4 =4, the position where the text


string "dz" is detected after position 4 is position 14.

DM200 14

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-301


SCMP Compares text
strings

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

STRIM

SCMP SCMP
Compare
Compare text strings.
text strings
@SCMP SCMP

Ladder program Input mode


Execution condition S1 calculation flag
SCMP S C M P S1 S2
S2

Execution condition S1 calculation flag


SCMP @ S C M P S1 S2
S2

Available Devices ( ): Not supported on the KV-1000


Index

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

(B) (W) (ZF)


S1  -  - - -   *3 - - - - -  *2    
S2  -  - - -   *3 - - - - -  *2    

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

*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 EM and FM (ZF) cannot be used with the KV Nano Series.

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

S1 A(41H) B(42H) S2 A(41H) B(42H)

S1 +1 C(43H) D(44H) S2 +1 C(43H) D(44H)

S1 +2 E(45H) F(46H) S2 +2 E(45H) F(46H)

S1 +3 G(47H) H(48H) S2 +3 G(47H) H(48H)

S1 +4 I(49H) J(4AH) S2 +4 I(49H) J(4AH)

S1 +5 K(4BH) L(4CH) S2 +5 K(4BH) L(4CH) Continue comparing until


N N end character found (NUL(00H)).
S1 +6 M(4DH) U
L
(00H) S2 +6 N(4EH) U
L
(00H)

Operation flag CR2010 turns ON if the text strings are the same as a result of having
performed a compare up to NULL (00H).

Compare Result State of Operation


Flag
When (all characters of S1 ) = (all characters of S2 ) CR2010 ->ON

4-302 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-303


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

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

4-304 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-305


DISS Disperses text
strings in byte
units into text

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
strings in
word units.
DISS

DISS
DISS
Disperse text strings in byte
Disperse text string units into text strings in word

@DISS units.
DISS

Ladder program Input mode


Execution condition DISS
S D D I S S S D

Execution condition DISS


S D @ D I S S S D

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices
DM EM
Word Devices Const Ind Spec
Local Modify
Device
MR
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
Instructions
Text Processing

(B) (W) (ZF)


S  -  - - -   *3 - - - - -  *2    
D  -  - - -   *3 - - - - -  -    

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

*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 EM and FM (ZF) cannot be used with the KV Nano Series.

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)

Higher bytes filled with 0


automatically.

@DISS Only one scan is executed at the rising edge of the execution conditions.

4-306 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the text string specified by S does not contain the end code (NULL(00H))
• When the text string including the end code (NULL(00H)) exceeds 2000 characters
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 S and D
• When the indirect specification or index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


4

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

bit bit bit bit


15 0 15 0

DM0 1(31H) 2(32H) DM100 0 1(31H)

DM1 A(41H) B(42H) DM101 0 2(32H)


N
DM2 U
L (00H) DM102 0 A(41H)

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)

“12AB” DM101 0 2(32H)

DM102 0 A(41H)

DM103 0 B(42H)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-307


UNIS Units text strings in
word units into text
strings in byte

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
units.

DISS

UNIS
UNIS
Unit text strings in word
Unit text string units into text strings in

@UNIS byte units.


UNIS

Ladder program Input mode


Execution condition UNIS
S D n U N I S S D n

Execution condition UNIS


S D n @ U N I S S D n

Available Devices ( ): Not supported on the KV-1000


Index
4 Operand
Bit Devices Word Devices Const Ind Spec
Local Modify
Device
MR DM EM
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *4 - - - - -  -    
D  -  - - -   *4 - - - - -  -    
n  -  - - -   *4   *5 *5   *3 -   

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

*1 For bit devices, specify the leading device of the 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 "$" 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.

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)

S +2 c(63H) D +1 c(63H) d(64H)

n : :

S + n -3 x(78H) D +( n /2)-1 x(78H) y(79H)


N
S + n -2 y(79H) D +( n /2)-1 z(7AH) U
L
(00H)

S + n -1 z(7AH) D +( n /2)-1

* Please calculate after rounding


up when producing remainder in n /2 operation.
Omit high bit.

@UNIS Only one scan is executed at the rising edge of the execution conditions.

4-308 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF
• When the value of n is "2000" or more
• When a device other than the leading device of the channel is specified when a bit device is
CR2012 specified to S and D
• When a timer/counter has been specified by indirect specification to S and D
• When the indirect specification or index modify range is inappropriate
• When the united text string length cannot be stored in the region starting with

* The instruction is not executed when CR2012 turns ON.


D
4

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

bit bit bit bit


15 0 15 0

DM100 1(31H) DM100 1(31H) 2(32H)

DM101 2(32H) DM101 3(33H) A(41H)

DM102 3(33H) DM102 B(42H) C(43H)


N
DM103 A(41H) DM103 U
L (00H)

DM102 B(42H)

DM103 C(43H)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-309


RCOM Reads the text
string

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

DISS

RCOM
RCOM

Read the comment of the


Read comment
device.
@RCOM
RCOM

KV-7500/7300 KV-5500/5000/3000 KV Nano


RCO

Ladder program Input mode


Execution condition RCOM
S D1 D2 R C O M S D1 D2

KV-1000

4 Ladder program Input mode


Execution condition RCOM
Instructions
Text Processing

S D1 R C O M S D1

Execution condition RCOM


S D1 @ R C O M S D1

Available Devices ( ): Not supported on the KV-1000


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  -    *6  *1 *5   *6 *6 - *1 - - *2  *2
D1  -  - - -   *1  *5 - - - - - *1
- -   
D2  -  - - -  *1 *5 - - - - - *1 - -   

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.

4-310 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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.

••• D1 1st character 2nd character

D1 +1 3rd character 4th character

Single-byte character, max. 32 D1 +2 5th character 6th character

Half-width characters are stored by ASCII


4

...
(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

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 a device other than the leading device of the channel is specified when a bit device is
specified to D1 and D2
CR2012
• When a timer/counter has been specified by indirect specification to D1 and D2
• When the indirect specification or index modify range is inappropriate
• KV-1000 When executing a write in the Run mode
* 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-311


ARITHMETIC OPERATION INSTRUCTIONS

Text Processing Instructions

Sample Program

■ KV-7500/7300/5500/5000/3000, KV Nano Series


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)
R000 RCOM
R000 DM100 MR000 LDP R000
RCOM R000 DM100 MR000
ΜR000 RCOM LDP MR000
DΜ0 DM200 MR001 RCOM DM0 DM200 MR001

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

DM100 : S(8B4EH) DM200 : Q(45H) u(46H)

DM101 : T(93AEH) DM201 : a(45H) n(90

DM102 : A(BDH) R(B2H) DM202 : B7H) t(8E

DM103 : T(AFH) I(CIH) DM203 : 59H) i(90


N N
DM104 : U
L
(00H) DM204 : 94H) U
L
(00H)

4-312 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

MEMO

Instructions
Text Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-313


CPSASC Converts CIP
text string data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

CPSASC

CPSASC CPSASC
CIP text string
type data
CIP text string type data is
converted into text string data.
@CPSASC CPSASC conversion

Ladder program Input mode


Execution condition CPSASC
S D C P S A S C S D

Execution condition CPSASC


S D @ C P S A S C S D

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify

MR DM EM
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *2 - - - - -  - -   
D  -  - - -   *2 - - - - -  -    
Operand Explanation
S Specifies the leading number of the device storing the CIP text string type data.*1
D Specifies the leading device for storing the converted data.*1

*1 When specifying a bit device, specify the head of the channel.


*2 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.
"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.

4-314 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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

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 bit device is specified in S , D but device other than channel's leading device
is specified
• When the text string to store in D goes out of range
CR2012
• When a timer/counter is specified in S or D by indirect specification
• When data size specified with leading word of S is 0 or 2000 or more
• When the CIP text string type data specified by S is out of the device range
• When the indirect specification or index modification range is inappropriate

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-315


RCPSASC Converts CIP text
string data reversely

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS

RCPSASC

RCPSASC RCPSASC CIP text string


type data
Converts text string
data into CIP text
reverse
@RCPSASC RCPSASC
conversion
string type data.

Ladder program Input mode


Execution condition RCPSASC
S D1 D2 R C P S A S C S D1 D2

Execution condition RCPSASC


S D1 D2 @ R C P S A S C S D1 D2

Available Devices ( ): Not supported on the KV-1000

4 Operand
Bit Devices Word Devices Const Ind Spec
Local
Device
Index
Modify

MR DM EM
Instructions
Text Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *2 - - - - -      
D1  -  - - -   *2 - - - - -  - -   
D2  -  - - -   *2   - - -  - -   
Operand Explanation
S Specifies the leading number of the device storing the text string data.*1
D1 Specifies the leading device for storing the converted CIP text string type data. *1

D2
Specifies the device storing the data size (number of bytes) of CIP text string type data stored in
D1 after conversion. *1

*1 When specifying a bit device, specify the head of the channel.


*2 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.
"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.

4-316 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Text Processing Instructions

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"

The data size (byte unit) of the text string 5(0005H) D1 +0


up to NULL(00H) is stored in D1 +0. B(42H) A(41H) D1 +1

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

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 a device other than the channel's leading device is specified when specifying the bit
device for S , D1 or D2
• When the S text string exceeds 2000 characters, including the NULL (00H)
CR2012 • When the text string to store in D1 goes out of range
• When a timer/counter is specified in S or D1 by indirect specification
• When there is no NULL(00H) at the end of the text string stored in S
• When the length of the text string stored in S is 0
• When the indirect specification or index modification range is inappropriate

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-317


Simple Operation Instructions
CAL+ Add values of
Operand1

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
and
Operand2
and store the
CAL+
result into
Operand3.

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

Ladder program Input mode


Execution condition

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 )

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
S2  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
D  -  - - -    *6  *4  *4 -  *4*7  *5  -    

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)

An overflow occurs if the operation result is greater than 65535.


4-318 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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)

An overflow occurs if the operation result is greater than +32767.


An underflow occurs if the operation result is smaller than -32768.

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)

An overflow occurs if the operation result is greater than 4294967295.

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)

An overflow occurs if the operation result is greater than +2147483647.


An underflow occurs if the operation result is smaller than -2147483648.

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)

The range of single precision floating point type real numbers is

-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.)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-319


ARITHMETIC OPERATION INSTRUCTIONS

Simple Operation Instructions

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)

The range of double precision floating point type real numbers is

-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.

* 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, 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

4-320 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

MEMO

Instructions
Simple Operation

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-321


CAL- Subtract
values of
Operand1 and

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
Operand2 and
store the result
CAL- into
Operand3.

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

Ladder program Input mode


Execution condition

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 )

Available Devices ( ): Not supported on the KV-1000


Index
Local
Bit Devices Word Devices *1 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)
S1  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
S2  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
D  -  - - -    *6  *4  *4 -  *4*7  *5  -    

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)

An underflow occurs if the operation result is smaller than 0.


4-322 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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)

An overflow occurs if the operation result is greater than +32767.


An underflow occurs if the operation result is smaller than -32768.

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)

An underflow occurs if the operation result is smaller than 0.

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)

An overflow occurs if the operation result is greater than +2147483647.


An underflow occurs if the operation result is smaller than -2147483648.

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)

The range of single precision floating point type real numbers is

-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.)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-323


ARITHMETIC OPERATION INSTRUCTIONS

Simple Operation Instructions

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)

The range of double precision floating point type real numbers is

-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.

* 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, 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-325


CAL* Multiple values
of Operand1 and
Operand2 and

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
store the result
into Operand3.

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

Ladder program Input mode


Execution condition

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 )

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
S2  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
D  -  - - -    *6  *4  *4 -  *4*7  *5  -    

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)

An overflow occurs if the operation result is greater than 65535.


4-326 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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)

An overflow occurs if the operation result is greater than +32767.


An underflow occurs if the operation result is smaller than -32768.

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)

An overflow occurs if the operation result is greater than 4294967295.

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)

An overflow occurs if the operation result is greater than +2147483647.


An underflow occurs if the operation result is smaller than -2147483648.

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)

The range of single precision floating point type real numbers is

-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.)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-327


ARITHMETIC OPERATION INSTRUCTIONS

Simple Operation Instructions

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)

The range of double precision floating point type real numbers is

-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.

* 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, 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-329


CAL/ Divide values of
Operand1 and
Operand2 and

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
store the result
into Operand3.

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

Ladder program Input mode


Execution condition

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

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
S2  -  - - -    *6  *4  *4  *4*7  *4*7  *5      
D  -  - - -    *6  *4  *4 -  *4*7  *5  -    

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)

4-330 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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)

An overflow occurs if the operation result is +32768.

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)

An overflow occurs if the operation result is +2147483648.

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)

The range of single precision floating point type real numbers is

-3.4E+38 ≤ N ≤ -1.4E-45 (KV Nano Series: −1.2E−38)


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.)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-331


ARITHMETIC OPERATION INSTRUCTIONS

Simple Operation Instructions

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)

The range of double precision floating point type real numbers is

-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.

* 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 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-333


CAL& Perform logical
AND operation of
the two specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
devices

CAL/

CAL& CAL&(.U)
CAL&.D
& Perform logical
AND operation of
Logic
the two specified
@CAL& @CAL&(.U)
@CAL&.D
& devices

Ladder program Input mode


Execution condition C A L & S1 S2 D
& S1 S2 D ( & S1 S2 D )
( W A N D S1 S2 D )
Execution condition @ C A L & S1 S2 D
& S1 S2 D ( @ & S1 S2 D )
( @ W A N D S1 S2 D )

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

4-334 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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

bit AND bit


15 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

bit bit bit bit


31 16 15 0

S1 • S1 +1 1111 0 0 0 0 1111 0 0 0 0 1111 0 0 0 0 1111 0 0 0 0

bit AND 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

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

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.

* 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
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to data memory
DM0.

CR2002 (Mnemonics list)


& R000 $00FF DM0 LD CR2002
Always ON CAL& R000 $00FF DM0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-335


CAL| Logic OR
operation of
values stored in

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
2 specified
device

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.

Ladder program Input mode


Execution condition C A L * S1 S2 D
l S1 S2 D ( l S1 S2 D )
( W O R S1 S2 D )
Execution condition @ C A L * S1 S2 D
l S1 S2 D ( @ l S1 S2 D )
( @ W O R S1 S2 D )

4 Available Devices ( ): Not supported on the KV-1000


Local
Index
Bit Devices Word Devices *1 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 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

4-336 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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 bit bit bit


31 16 15 0

S1 • S1 +1 1111 0 0 0 0 1111 0 0 0 0 1111 0 0 0 0 1111 0 0 0 0

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

D • D +1 1111 0 0 0 0 11111111 1111 0 0 0 0 11111111

@CAL|. Only one scan is executed at the rising edge of the execution conditions.

Operation flag

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.

* 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
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.

CR2002 (Mnemonics list)


l MR000 MR100 R30000 LD CR2002
Always ON CAL| MR000 MR100 R30000

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-337


CAL^ Logic XOR
operation of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano values stored in


ARITHMETIC OPERATION INSTRUCTIONS
2 specified
device
CAL/

Perform
CAL^ CAL^(.U)
CAL^.D
^
Exclusive
Exclusive OR
operation of the
OR
@CAL^ @CAL^(.U)
@CAL^.D
^
two specified
devices.

Ladder program Input mode


Execution condition C A L ^ S1 S2 D
^ S1 S2 D ( ^ S1 S2 D )
( W X O R S1 S2 D )
Execution condition @ C A L ^ S1 S2 D
^ S1 S2 D ( @ ^ S1 S2 D )
( @ W X O R S1 S2 D )

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 .

4-338 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

Example
^ S1 S2 D

bit bit
15 0

S1 1111 0 0 0 0 1111 0 0 0 0

bit XOR bit


15 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

bit bit bit bit


31 16 15 0

S1 · S1 +1 1111 0 0 0 0 1111 0 0 0 0 1111 0 0 0 0 1111 0 0 0 0

bit XOR 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

D · D +1 1111 0 0 0 0 11111111 1111 0 0 0 0 11111111

@CAL^. Only one scan is executed at the rising edge of the execution conditions.

Operation flag

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.

* 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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-339


CAL~ Perform logical
OR operation of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the two


ARITHMETIC OPERATION INSTRUCTIONS
specified
devices.
CAL/

CAL~
CAL~(.U)
CAL~.D
Bit Inversion of the
Bit Inversion
specified devices.
@CAL~
@CAL~(.U)
@CAL~.D

Ladder program Input mode


Execution condition C A L ~ S D
S D ( ~ S D )
( N O T S D )
( C M L S D )

Execution condition @ C A L ~ S D
S D (@ ~ S D )

4
(@ N O T S D )
(@ C M L S D )

Available Devices ( ): Not supported on the KV-1000


Instructions
Simple Operation

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

4-340 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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

bit bit bit bit


31 16 15 0

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.

* 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
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

& MR000 $000F R500

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-341


CAL>> Shift the bits of
the specified

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

Ladder program Input mode


Execution condition
C A L > > D n
>> D n
( > > D n )

4
Execution condition
@ C A L > > D n
>> D n
( @ > > D n )
Instructions
Simple Operation

Available Devices ( ): Not supported on the KV-1000


Index
Word Devices *1 Local
Bit 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)
D  -  - - -    *5   -  *6   -    
n  -  - - -    *5    *6  *6    -   

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 .

4-342 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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

higher n bits Delete

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

lower n bits Delete

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

higher n bits Delete

Filled with 0
1
CR2009
(Carry)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-343


ARITHMETIC OPERATION INSTRUCTIONS

Simple Operation Instructions

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

higher n bits Delete

Sign value is stored 1


0 or more: 0
Less than 0: 1 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

CR2009 ON when a carry is stored after the operation. 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.

* 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
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

4-344 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

MEMO

Instructions
Simple Operation

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-345


CAL<< Specify the bit
content of
thedevice, then

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ARITHMETIC OPERATION INSTRUCTIONS
shift the device to
the higher bit.

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

Ladder program Input mode


Execution condition C A L < < D n
<< D n
( < < D n )

4
Execution condition @ C A L < < D n
<< D n
( @ < < D n )
Instructions
Simple Operation

Available Devices ( ): Not supported on the KV-1000


Index
Word Devices *1 Local
Bit 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)
*5 *6
D
*5 *6 *6
n

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.

4-346 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


ARITHMETIC OPERATION INSTRUCTIONS
Simple Operation Instructions

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

Delete Lower n bit

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

Delete lower n bits

1 Filled with 0
CR2009
(Carry)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 4-347


ARITHMETIC OPERATION INSTRUCTIONS

Simple Operation Instructions

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

Delete lower n bits


D D +1
Instructions
Simple Operation

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

CR2009 ON when a carry is stored after the operation. 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.

* 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
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

l DM0 DM1 DM10

4-348 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


5

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.

Data Processing Instructions ................................................ 5-2


Table Processing Instructions.............................................. 5-64
Clock Processing Instructions ............................................. 5-86
Weekly Contact Instructions................................................ 5-92
Calendar Contact Instructions ............................................. 5-96
Alarm Instruction ............................................................... 5-100
High-speed Processing Instructions.................................. 5-102
PID Control Instruction ...................................................... 5-122
Storage Device Instructions .............................................. 5-152
Access Window Instructions.............................................. 5-224
Free operation counter instruction..................................... 5-232
Sensor Setting Instruction ................................................. 5-234
Refresh Cyclic Communication Instruction........................ 5-246

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-1


Data Processing Instructions
HKEY Hex key data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano input

HKEY

HKEY
HKEY Stores Hex key data to be read to
Hex key input
the control relay in time interval.

Ladder program Input mode


Execution condition HKEY H K E Y S D
S
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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  -  - - -  - - - - - - - - - - - - -
D  -  - - -  - - - - - - - - - - - - -

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.

(1)When press several keys at the same time fobidden


COM0 R000 R001 R002 R003

24 VDC KV-5500/5000/3000/1000
COM1 R500 R501 R502 R503

0 1 2 3

4 5 6 7 (2)When press several keys at the same time allowed


(install diode)
8 9 A B

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.

Relay No. CR3514 (read-write) CR3515 (read-only)


Description Entry of multiple keys is disabled when ON. ON when reading of keys ends.

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.

5-2 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
5
CR2012 No change in state

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

Diode Connect digital switch and


KV-5500/5000/3000/1000
as shown in the graph.
(Please remember
installing diode)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-3


decode

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SEG

Decodes the number of 1 digit


SEG SEG(.U)
SEG.D
SEG

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

Ladder program Input mode


Execution condition S
SEG STA S E G S n
n

Execution condition S
SEG STA @ S E G S n
n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec

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.

Example When S is DM0, the currently stored data is $1234, and n is #2


#3 #2 #1 #0

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

5-4 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

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
No change in state when indirect specification and index modify are not specified

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-5


Data Processing Instructions

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

5-6 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Data Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-7


BCNT Calculates the
number of ON bit

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano in


registers
internal

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

Ladder program Input mode


Execution condition
LDA BCNT STA B C N T

Execution condition
LDA BCNT STA @ B C N T

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM FM
(W) (ZF)
T C CTH CTC Z CM #/$ #TM * @ : #/ : Z

- - - - - - - - - - - - - - - - - - - - -
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.

Example When #10313 (BIN: 10100001001001) is currently stored to 16-bit internal


register
bit bit
15 0
16-bit internal
0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1
register

(1) (2) (3) (4) (5)

Store 5 due to 5 bist ON

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.

Example When 675877264 (BIN: 101000010010010001000110010000) is currently


stored to 32-bit internal register
bit bit bit bit
31 16 15 0
32-bit internal
0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 0
register

(1) (2) (3) (4) (5) (6) (7) (8) (9)

Store 9 due to 9 bits ON

32-bit internal
register #9

@BCNT. Only one scan is executed at the rising edge of the execution conditions.

5-8 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

Operation flag

CR2009 No change in state


CR2010 ON when the result is "0". Otherwise, OFF

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-9


DCNT Detects devices
of the same

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano value as


internal register
in the specified
the

DCNT range, and


counts the
number of
devices.

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

Ladder program Input mode


Execution condition S
LDA DCNT STA D C N T S n
n

Execution condition S
LDA DCNT STA @ D C N T S n
n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
5 R (DR)
MR
LR T
DM EM
C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
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 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

S 1234 When 1234


Count number of devicec which store the
S +1 2345 When same value as that in 16-bit internal
register.The result is stored to 16-bit
S +2 3456 When
internal register
n

( n word) S + n -3 1234 When

4567 16-bit intemal register


S + n -2 When
bit15 bit0

S + n -1 5678 When Result 2

5-10 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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 +1 12345678 S Compare 12345678

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

S +2 ( n -2) +1 45678901 S +2 ( n -2) Compare

S +2 ( n -1) +1 56789012 S +2 ( n -1) Compare bit


31
32-bit internal register bit
0

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

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-11


Data Processing Instructions

Sample Program

(1) Unsigned 16-bit BIN data count


EXTENDED INSTRUCTIONS

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

5 (2) Signed 16-bit BIN data count


When input relay R000 is ON, the signed 16-bit BIN data currently stored to data memory DM0 is
Instructions
Data Processing

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

(3) Unsigned 32-bit BIN data count


When input relay R000 is ON, the unsigned 32-bit BIN data currently stored to data memories "DM0 ·
DM1" is compared with the unsigned 32-bit BIN data currently stored to DM100 to DM299. The
number of devices to which the same value is currently stored is stored to "DM10 · M11".
(Mnemonics list)
R000 DM0 DM100 DM10
LDA.D DCNT.D STA.D LD R000
#100 LDA.D DM0
CON
DCNT.D DM100 #100
CON
STA.D DM10

(4) Signed 32-bit BIN data count


When input relay R000 is ON, the signed 32-bit BIN data currently stored to data memories "DM0 ·
DM1" is compared with the signed 32-bit BIN data currently stored to DM100 to DM299. The number
of devices to which the same value is currently stored is stored to "DM10 · M11".
(Mnemonics list)
R000 DM0 DM100 DM10
LDA.L DCNT.D STA.D LD R000
#100 LDA.L DM0
CON
DCNT.D DM100 #100
CON
STA.D DM10

5-12 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Data Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-13


SER Detects devices
of the same value
as the internal

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano egister


specified
in the
range,
SER and detects their
device Nos.

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

Ladder program Input mode


Execution condition S CR2010
LDA SER STA S E R S n
n

Execution condition S CR2010


LDA SER STA @ S E R S n
n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device

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

Detect device No. which stores


S 1234 When 3456
the same value as that in 16-bit
S +1 2345 When
internal register
S +2 3456 When The result is stored to 16-bit
internal register
n

( n word) S + n -3 1234 When

3456 16-bit internal register


S + n -2 When
bit15 bit0

S + n -1 5678 When KV-1000 Result S +2

bit 32-bit internal register bit


31 0

KV-7500/7300/5500/5000/3000 and KV Nano Result S +2

5-14 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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 +1 12345678 S When 23456789

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

S +2 ( n -2) +1 23456789 S +2 ( n -2) When

S +2 ( n -1) +1 56789012 S +2 ( n -1) When

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

CR2009 No change in state


CR2010 ON when the search target is found in the specified range. 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

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-15


Data Processing Instructions

Sample Program

(1) Unsigned 16-bit BIN data search


EXTENDED INSTRUCTIONS

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

5 (2) Signed 16-bit BIN data search


Instructions
Data Processing

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

(3) Unsigned 32-bit BIN data search


When input relay R000 is ON, the unsigned 32-bit BIN data currently stored to data memories "DM0 ·
DM1" is compared with the unsigned 32-bit BIN data currently stored to DM100 to DM299. The device
Nos. to which the same value is currently stored are stored to "DM10 · DM11".
(Mnemonics list)
R000 DM0 DM100 CR2010 DM10
LDA.D SER.D STA.D LD R000
#100 LDA.D DM0
CON
SER.D DM100 #100
CON
AND CR2010
STA.D DM10

(4) Signed 32-bit BIN data search


When input relay R000 is ON, the signed 32-bit BIN data currently stored to data memories "DM0 ·
DM1" is compared with the signed 32-bit BIN data currently stored to DM100 to DM299. The device
Nos. to which the same value is currently stored are stored to "DM10 · DM11".
(Mnemonics list)
R000 DM0 DM100 CR2010 DM10
LDA.L SER.D STA.D LD R000
#100 LDA.L DM0
CON
SER.D DM100 #100
CON
AND CR2010
STA.D DM10

5-16 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Data Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-17


DSER Specifies the
device of the
range to be

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano detected.

DSE

DSER DSER(.U) DSER


Specifies the
DSER.D device of the
Search
range to be
@DSER @DSER(.U) DSER
@DSER.D
detected.
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition DSER
S1 S2 D n D S E R S1 S2 D n

Execution condition DSER


S1 S2 D n @ D S E R S1 S2 D n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device

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

5-18 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

CR2009 No change in state


CR2010 ON when the search target is found in the specified range. Otherwise, OFF
CR2011 No change in state
• This is ON When the search range is beyond the device range.
CR2012 • ON when the indirect specification and index modify range is inappropriate
Otherwise, OFF

* The instruction is not executed when CR2012 turns ON.


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
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.

DSER (Mnemonics list)


R000
#1234 DM0 DM1000 #1000 LD R000
search start Leading search destination Leading search result DSER #1234 DM0 DM1000 #1000

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-19


MAX Calculates the
maximum value of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano BIN data currently


stored
specified
to a
range,
MAX,MMIN and stores this to
internal registers.
MIN Calculates the
minimum value of

MAX(.U)
BIN data currently
stored to a
specified range,

MAX.S
and stores this to
internal registers.

MAX MAX.D
MAX.L
MAX

Calculates the maximum value of


MAX.F
MAX.DF Search max. BIN data currently stored to a
@MAX(.U) value specified range, and stores this to
EXTENDED INSTRUCTIONS

@MAX.S internal registers.

@MAX @MAX.D
@MAX.L
MAX

@MAX.F
@MAX.DF
MIN(.U)
MIN.S

MIN MIN.D
MIN.L
MIN

Calculates the minimum value of


MIN.F
MIN.DF Search min. BIN data currently stored to a

5 @MIN(.U)
@MIN.S
value specified range, and stores this to
internal registers.

@MIN @MIN.D MIN


Instructions
Data Processing

@MIN.L
@MIN.F
@MIN.DF

Ladder program Input mode


Execution condition S
MAX STA M A X S n
n

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

Available Devices ( ): Not supported on the KV-1000


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 *6 *6 - - -  - -   
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 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

*6 Cannot be specified when ".F" or ".DF" is selected as the suffix.

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

( n word) S + n -3 9876 MIN(.U): store Min. value


S + n -2 8765 16-bit internal register
bit15 bit0

S + n -1 7654 1234

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

( n word) S + n -3 -1234 MIN.S:store Min value


S + n -2 -2345 16-bit internal register
bit15 bit0

S + n -1 -3456 -3456

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-21


Data Processing Instructions

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

stored to 32-bit internal register.


bit bit bit bit
31 16 15 0

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

S +2 ( n -1) +1 76543210 S +2 ( n -1) 12345678

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

S +2 ( n -1) +1 -34567990 S +2 ( n -1) -34567990

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

S +2 ( n -1) +1 -3.456 S +2 ( n -1) -3.456

5-22 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

S +11 3.4567890 S +8 3.4567890


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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the following condition is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate
• When the suffix is .F and the calculated value is outside of the single precision floating point
type real number range
• When the suffix is .DF and the calculated value is outside of the double precision floating point
CR2012
type real number range
• When n =0
• 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

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-23


Data Processing Instructions

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

5-24 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

(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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-25


AVG Calculates the
average value of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano BIN data currently


stored
specified
to
range,
a

AVG and stores this to


internal registers.

AVG(.U)
AVG.S

AVG AVG.D
AVG.L
AVG

Calculates the average value of


AVG.F
AVG.DF BIN data currently stored to a
Average
@AVG(.U) specified range, and stores this to
EXTENDED INSTRUCTIONS

@AVG.S internal registers.

@AVG @AVG.D
@AVG.L
AVG

@AVG.F
@AVG.DF

Ladder program Input mode


Execution condition S
AVG STA A V G S n
n

5
Execution condition S
AVG STA @ A V G S n
n
Instructions
Data Processing

Available Devices ( ): Not supported on the KV-1000


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 *6 *6 - - -  - -   
n  -  - - -   *4   *5 *5
   -   

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)

5-26 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

S + n -1 65535 Averaging Average value

AVG.S When the execution condition is ON, the average value of


starting from S is calculated and stored to 16-bit internal register.
n signed 16-bit BIN data
5

Instructions
Data Processing
bit bit
15 0

S -32700

S +1 -16350

S +2 -8175
n

( n Word) S + n -3 8175 Average value is stored to 16-bit internal register


S + n -2 16350 16-bit internal register
bit15 bit0

S + n -1 32700 Averaging Average value

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


n Average value is stored


( 2 n word) S +2 ( n -3) +1 78901234 S +2 ( n -3) to 32-bit internal register

S +2 ( n -2) +1 89012345 S +2 ( n -2) bit


31
32-bit internal register bit
0

S +2 ( n -1) +1 90123456 S +2 ( n -1) Averaging Average value

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

Average value is stored


(2 n word) S +2 ( n -3) +1 78901234 S +2 ( n -3) to 32-bit internal register

S +2 ( n -2) +1 89012345 S +2 ( n -2) bit


31
32-bit internal register bit
0

S +2 ( n -1) +1 90123456 S +2 ( n -1) Averaging Average value

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-27


Data Processing Instructions

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

S +2 ( n -2) +1 -2.345 S +2 ( n -2) bit


31
32-bit internal register bit
0

S +2 ( n -1) +1 -3.456 S +2 ( n -1) Averaging Average value

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

bit bit bit bit bit bit bit bit


63 48 47 32 31 16 15 0

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

S +4 ( n -2) +1 -2.345789 S +4 ( n -2) bit


63
64-bit internal register bit
0

S +4 ( n -1) +1 -3.456890 S +4 ( n -1) Averaging Average value

@AVG. 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 any of the following instances. Otherwise it is OFF.
• When the indirect specification or index modification range is inappropriate
• When the suffix is .F and the device value specified with S and n is outside of the
single precision floating point type real number range
• When the suffix is .DF and the device value specified with S and n is outside of the
double precision floating point type real number range
• When the suffix is .F and the total during calculation is outside of the single precision floating
CR2012
point type real number range
• When the suffix is .DF and the total during calculation is outside of the double precision
floating point type real number range
• When n =0
• When a 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 in S .

* The instruction is not executed when CR2012 turns ON.


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)

5-28 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

Sample Program

(1) Unsigned 16-bit BIN data average value calculation

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

(2) Signed 16-bit BIN data average value calculation


When input relay R000 is ON, the average 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.

R000 DM0 DM1000


(Mnemonics list) 5
AVG.S STA.S LD R000

Instructions
Data Processing
#100 AVG.S DM0 #100
CON
STA.S DM1000

(3) Unsigned 32-bit BIN data average value calculation


When input relay R000 is ON, the average value of the unsigned 32-bit BIN data currently stored to data
memories "DM0 · DM1" to "DM198 · DM199" is calculated, and the result is stored to "DM1000 · DM1001".
(Mnemonics list)
R000 DM0 DM1000
AVG.D STA.D LD R000
#100 AVG.D DM0 #100
CON
STA.D DM1000

(4) Signed 32-bit BIN data average value calculation


When input relay R000 is ON, the average value of the signed 32-bit BIN data currently stored to data
memories "DM0 · DM1" to "DM198 · DM199" is calculated, and the result is stored to "DM1000 · DM1001".
(Mnemonics list)
R000 DM0 DM1000
AVG.L STA.L LD R000
#100 AVG.L DM0 #100
CON
STA.L 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

5-30 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Data Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-31


WSUM Calculates the
total value of BIN

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano data


stored
currently
to
specified range,
a

WSUM and stores this to


internal registers.

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

Ladder program Input mode


Execution condition S
WSUM STA W S U M S n
n

5 Execution condition S
WSUM STA @ W S U M S n
n
Instructions
Data Processing

Available Devices ( ): Not supported on the KV-1000


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 *6 *6 - - -  - -   
n  -  - - -   *4   *5 *5    -   

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)

5-32 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

S + n -1 65535 Total Higher Lower

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

S + n -1 32700 Total Higher Lower


16-bit internal
TM0 register
32-bit
(2 word)

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

S +2 ( n -1) +1 90123456 S +2 ( n -1) Total TM1 TM0 32-bit internal register

64-bit

WSUM.L When the execution condition is ON, the total value of n signed 32-bit BIN data
starting from S is calculated, and the result is stored to 32-bit internal register and
temporary data 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

S + 2 ( n -1) +1 90123456 S + 2 ( n -1) Total TM1 TM0 32-bit internal register

64-bit

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-33


Data Processing Instructions

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

CR2009 No change in state


CR2010 ON when the total is "0". Otherwise, OFF
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 suffix is .F and the device value specified with S and n is outside of the
single precision floating point type real number range
• When the suffix is .DF and the device value specified with S and n is outside of the
double precision floating point type real number range
• When the suffix is .F and the total during calculation is outside of the single precision floating
CR2012
point type real number range
• When the suffix is .DF and the total during calculation is outside of the double precision
floating point type real number range
• When n =0
• When a 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

* The instruction is not executed when CR2012 turns ON.


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)

5-34 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

Sample Program
WSUM (.U)
When input relay R000 is ON, the total value of the unsigned 16-bit BIN data currently stored 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

When the operation result is 0 to 4294967295

R000 DM0 DM1000


(Mnemonics list) 5
WSUM STA.D LD R000

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

When the operation result is -2147483648 to 2147483647


(Mnemonics list)
R000 DM0 DM1000
WSUM.S STA.L LD R000
#100 WSUM.S DM0 #100
CON
STA.L 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-35


BSUM Calculates the
total value of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the BIN data


lower/upper 8
bits currently
BSU stored to
within the
specified

BSUM
range, and

BSUM
Calculates the total value of the BIN data stores them to
the
register
internal

lower/upper 8 bits currently stored to within


Byte sum
the specified range, and stores them to the
@BSUM BSUM
internal register.

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition S
BSUM STA B S U M S n
n

Execution condition S
BSUM STA @ B S U M S n
n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM

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

n  -  - *3   *4 *4    -   

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

S + n ÷2 -3 4Eh 43h 45h


Overwrite
4Bh
S + n ÷2 -2 59h 45h 45h
+ Higher Lower

S + n ÷2 -1 4Bh 45h Total 32-bit internal register

@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

CR2009 No change in state


CR2010 ON when the total is "0" (all numerical values are "0"). Otherwise, OFF

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

* The instruction is not executed when CR2012 turns ON. 5


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to

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".

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-37


CRC Calculates the
CRC value of a
specified number

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano of devices, and


stores this to
CRC internal registers

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

Ladder program Input mode


Execution condition CRC
LDA S1 S2 n C R C S1 S2 n

Execution condition CRC


LDA S1 S2 n @ C R C S1 S2 n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device

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)

(n) -1 (n) (n) (n)

The value set to 16-bit internal register is The CRC default is fixed at
S1 +2 CRC default
used as the CRC default. 0x0000.
5-38 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Data Processing Instructions

CRC Operation Method


Item
When ON When OFF
Operation data The bit alignment (order) of data to be The bit position is not inverted.
S1 +3 bit order operated on is inverted in byte units, and

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

" S1 +3":OFF Operating order Operating order

Instructions
Data Processing
bit bit bit bit
Inverted 7 0 7 0

" S1 +3":ON Operating order Operating order

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, OFF
• When the indirect specification or index modify range is inappropriate
• When a word device or timer/counter has been specified to S1
• When a device other than the leading device of the channel is specified when a timer/counter
CR2012
or a bit device is specified to S2 by indirect specification
• When the value of n is "0"
• When either S1 +0 to S1 +3 is out of the device range
• When S2 is out of the device range because of the n specification

* The instruction is not executed when CR2012 turns ON.


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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-39


ZRES Zone reset

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


ZRE

ZRES ZRES
Zone reset
Resets all values currently
stored in the specified range.
@ZRES ZRES

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition D1
ZRES Z R E S D1 D2
D2

Execution condition D1
ZRES @ Z R E S D1 D2
D2

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM

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).

*1 EM and FM (ZF) cannot be used with the KV Nano Series.

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

5-40 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

When a bit device has been specified


D1 :R1005, D2 :R1011

R1002: ON ON :R1002

EXTENDED INSTRUCTIONS
R1003: ON ON :R1003
R1004: ON ON :R1004

D1 R1005: ON OFF :R1005


R1006: ON OFF :R1006
R1007: ON OFF :R1007
R1008: ON Reset OFF :R1008
R1009: ON OFF :R1009
R1010: ON OFF :R1010
D2 R1011:
R1012:
ON
ON
OFF
ON
:R1011
:R1012
5

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification range or index modify range is inappropriate, or when the
CR2012 types of devices specified to D1 and D2 are different. Otherwise, OFF
No change in state when indirect specification and index modify are not specified

* The instruction is not executed when CR2012 turns ON.


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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-41


EXT Extends the
data in internal
registers.

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


EXT

EXT(.U)

EXT EXT.S
EXT.D
EXT

EXT.L Extends the data in internal


Extend data
registers.
@EXT(.U)

@EXT @EXT.S EXT


EXTENDED INSTRUCTIONS

@EXT.D
@EXT.L

Ladder program Input mode


Execution condition
LDA EXT STA.D E X T

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)

32-bit internal register


16-bit internal
Higher Lower
register
16-bit internal
EXT(.U/.S) TM0 register

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)

5-42 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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)

Higher bits Lower bits

32-bit internal register TM1 TM0 32-bit internal register

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-43


Data Processing Instructions

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 result is stored to "DM20 · DM21".

CR2002 DM0 DM10 DM20 (Mnemonics list)


LDA EXT ADD.D STA.D LD CR2002
LDA DM0
CON
EXT
CON
ADD.D DM10
CON
STA.D DM20

The signed 16-bit BIN data currently stored 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

5-44 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Data Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-45


BCMP Compares the
BIN data in two
specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano ranges.

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

Interrupt program Input mode

Execution condition BCMP


S1 S2 D B C M P S1 S2 D n
n

Execution condition BCMP


S1 S2 D @ B C M P S1 S2 D n

5
n

Available Devices ( ): Not supported on the KV-1000


Index
Instructions
Data Processing

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.

5-46 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

S1 +5 10002000 S1 +4 S2 +5 30004000 S2 +4 D +2 OFF


n

( 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

S1 +5 10002000 S1 +4 S2 +5 30004000 S2 +4 D +2 OFF


n

( 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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-47


Data Processing Instructions

Operation flag

CR2009 No change in state


CR2010 ON when all data matched. Otherwise, OFF
EXTENDED INSTRUCTIONS

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 n =0
CR2012 • When one or more of S1 , S2 , or D exceeds the device range because of the
n specification
• No change in state when n is a constant, and index specification or index modify has not
been specified to S1 , S2 and D

* The instruction is not executed when CR2012 turns ON.

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

5-48 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Data Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-49


BCMPI Compares
specified BIN

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano data with BIN


data
specified
in a

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

Ladder program Input mode


Execution condition BCMPI
S1 S2 D B C M P I S1 S2 D n
n

Execution condition BCMPI


S1 S2 D @ B C M P I S1 S2 D n
n

5 Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Instructions
Data Processing

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   *5 *5
   -   
D  -    -   *4 - - - - -  - -   
n  -  - - -   *4   *5 *5
   -   

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.

5-50 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-51


Data Processing Instructions

@BCMPI. Only one scan is executed at the rising edge of the execution conditions.

Operation flag
EXTENDED INSTRUCTIONS

CR2009 No change in state


CR2010 ON when all data matched. Otherwise, OFF
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 n =0
CR2012 • When one or more of S1 , S2 , or D exceeds the device range because of the
n specification
• No change in state when n is a constant, and index specification or index modify has not
been specified to S1 , S2 and D

5 * The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to
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)

5-52 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-53


RND Occurred
random number
is stored in

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano device.

RND

RND
RND
D Random
Occurred random number is stored in
number
device.
@RND
RND occur
D

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition RND


D R N D D

Execution condition RND


D @ R N D D

Available Devices ( ): Not supported on the KV-1000


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
5 D  -
(B)
 - -
(W) (ZF)
-   *2   - - - - - -   
Instructions
Data Processing

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

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.

* 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)

5-54 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-55


SORT Sorts binary
data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SORT

SORT(.U)

SORT SORT.S
SORT.D
SORT

The binary data of


SORT.L Binary
devices in a specified
data sort
@ SORT(.U) range is sorted.
@SORT @ SORT.S SORT
EXTENDED INSTRUCTIONS

@ SORT.D
@ SORT.L

Ladder program Input mode


Execution condition SORT
S D n S O R T S D n

Execution condition SORT


S D n @ S O R T S D n

Available Devices ( ): Not supported on the KV-1000

5 Operand
Bit Devices Word Devices Const Ind Spec
Device
Index
Local Modify

MR DM EM
Instructions
Data Processing

R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z


(B) (W) (ZF)
S  -  - - -   *3   *4 *4
   -   
D  -  - - -    *3 - - - - -  - -   
n  -  - - -   *3   *4 *4
   -   

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

The sorting method is specified


with the ON/OFF status of the LSB.

Reserved for system (recognized as 0)

LSB of S is ON: Sorts in descending order.


LSB of S is OFF: Sorts in ascending order.
*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 SORT.U and SORT.S
instructions, and n x32 bits are occupied for the SORT.D and SORT.L instructions.
• When a word device is specified, n words are occupied for the SORT.U and SORT.S
instructions, and n x2 words are occupied for the SORT.D and SORT.L instructions.
*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)

5-56 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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 .

Example When S =1 After SORT


instruction execution
Before SORT (sorted in
bit bit bit bit
31
instruction execution 0 31 descending order) 0

D ・ D +1 12345 6665321 D ・ D +1

D +2・ D +3 2165 619987 D +2・ D +3


D +4・ D +5 8004 78261 D +4・ D +5

31 12345
619987 8004
6665321 2165
D +2(n-1)
・ D +2(n-1)+1 78261 31 D +2(n-1)・ D +2(n-1)+1

@SORT. 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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-57


Data Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


Turns ON when one of the following conditions is established. Otherwise, OFF.
• When n =0
CR2012 • When the device range is inappropriate
• When the indirect specification or index modification range is inappropriate
• When a timer/counter is specified to D by indirect specification

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to
CM5176.
5 KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
"CR/CM List" (Page A-71)
Instructions
Data Processing

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

5-58 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Data Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-59


SORTN Splits and
sorts binary
data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SORTNN

SORTN(.U) Binary data The binary data of


SORTN SORTN.S
SORTN.D
SORTN
partition
sort
devices in a specified
range is sorted.
SORTN.L

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition SORTN


S D1 n D2 S O R T N S D1 n D2

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *5   - - -  - -   
D1  -  - - -   *5 - - - - -  - -   
5 n  -  - - -   *5   *6 *6    -   
D2  -  - - -   *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

The sorting method is specified


with the ON/OFF status of the LSB.

Reserved for system (recognized as 0)

LSB of S is ON: Sorts in descending order.


LSB of S is OFF: Sorts in ascending order.

5-60 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

*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 .

Example When S =0, S +1=3, n =12


Before SORTN After SORTN instruction execution
instruction execution (sorted in ascending order)
bit bit bit bit
15 0 15 0

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 .

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-61


Data Processing Instructions

Scan

ON
SORTN execution
EXTENDED INSTRUCTIONS

condition
OFF

SORTN instruction execution execution

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

conditions OFF once before turning them ON again.


• Do not change the values of the data table being sorted, S , S +1 or D1
during the sorting process. Sorting may not finish even when the completion notice
relay D2 turns ON.

Operation flag

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 n =0
CR2012 • When the device range is inappropriate
• When the indirect specification or index modification range is inappropriate
• When a timer/counter device is specified to D by indirect specification

* The instruction is not executed when CR2012 turns ON.


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)

5-62 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Data Processing Instructions

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.

#1 #100 MR000 (Mnemonics list)


R000 MR100
DW DW LDP R000
DM5000 DM5001 OR MR000
MR000 ANB MR100
DW #1 DM5000
CON
DW #100 DM5001
CON
MR000 SORTN.L OUT MR000
DM5000 DM0 #1000 MR100 LD MR000
SORTN.L DM5000 DM0 #1000 MR100

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-63


Table Processing Instructions
FIFOW FIFO Write
data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


FIFOW

FIFOW FIFOW(.U) FIFOW


FIFOW.D Write Stores data to FIFO data
FIFO table.
@FIFOW @FIFOW(.U) FIFOW
@FIFOW.D
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition FIFOW
S D F I F O W S D

Execution condition FIFOW


S D @ F I F O W S D

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM FM T
(W) (ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z

S  -  - - -   *4   *5 *5   - -   


Instructions
Table Processing

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

About data table and data block


The FIFOW and FIFOR instructions FIFO (First 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

D n Number of data : data that write to data block.


Data table

D +1 max Max. number of storage number : Max number that data block can store (designate by user).

D +2 (A)

D +3 (B) Data block : store data processed by FIFO.


(A) is the data stored at first while (C) is the last .
:

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.

5-64 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

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

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
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 S +1 S bit D +(2n+3) : (C) : D +(2n+2)


31 0

(D) D +(2n+5) : Blank (0) : D +(2n+4)

D +(2n+7) : Blank (0) : D +(2n+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)

D +(2n+7) : Blank (0) : D +(2n+6)

@FIFOW. 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 - 5-65


Table Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


ON when one of the following conditions is established. Otherwise, OFF
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data is a number that causes the data table to exceed
the device range
• When the indirect specification or index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to

5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing

"CR/CM List" (Page A-71)

Sample Program
See the sample program for the FIFOR instruction.
"Sample Program" (Page 5-70)

5-66 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Table Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-67


FIFOR FIFO Read

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


FIFOR

FIFOR FIFOR(.U) FIFOR


FIFOR.D Reads data from FIFO
Read
(First In First Out) data
FIFO
@FIFOR @FIFOR(.U) table.
FIFOR
@FIFOR.D
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition FIFOR
D1 D2 F I F O R D1 D2

Execution condition FIFOR


D1 D2 @ F I F O R D1 D2

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM FM T
(W) (ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z

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 FIFOW and FIFOR instructions FIFO (First 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

Number of data : data that write to data block


D1 n
Data table

D1 +1 max Max. number of storage data :Max number that data block can store (designate by user)。

D1 +2 A

B Data block : Data block: store data processed by FIFO


D1 +3
A is the data stored at first while C is the last .

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.

5-68 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

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 D D1 +n+1 Blank (0) Filled with 0

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)

D1 +(2n+3) : Blank (0) : D1 +(2n+2)

Filled with 0

@FIFOR. 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 - 5-69


Table Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


ON when one of the following conditions is established. Otherwise, OFF
• When there is no data in the data table
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data is a number that causes the data table to exceed
the device range
• When the indirect specification and index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to

5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing

"CR/CM List" (Page A-71)

Sample Program

Detection technics Discharging technics

Sensor for defective judgment Sensor for discharging confirm Discharge output
R001 R002 R500

Input relay R000 : Timing input


Input relay R001 : Defective judgment input
ON->OK
OFF-> defective products
Input relay R002 : Discharge confirm input
Output relay R500 : Discharge output
Timing sensor
R000
defective product box

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.

5-70 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

(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

OK: $0000 Data list DM102 : FIFOR DM1

Defective products: $1111 DM103 : $1111:Defective products

bit bit DM105 : Single pulse


15 0
timer output R500
DM0 FIFOW DM106 :

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-71


LIFOW LIFO Write
data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


LIFOW

LIFOW LIFOW(.U) LIFOW


LIFOW.D Stores the data to LIFO
Write
(Last In First Out) data
LIFO
@LIFOW @LIFOW(.U) table.
LIFOW
@LIFOW.D
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition LIFOW
S D L I F O W S D

Execution condition LIFOW


S D @ L I F O W S D

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM FM T
(W) (ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z

S  -  - - -   *4   *5 *5   - -   


Instructions
Table Processing

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

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

D n Number of data : data that write to data block.

D +1 max Max. number of storage number : Max number that data block can store (designate by user).
Data table

D +2 A

D +3 B Data block : store data processed by FIFO.


A is the data stored at first while C is the last .
:

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 S +1 S bit D +(2n+3) : C : D +(2n+2)


31 0

D D +(2n+5) : Blank (0) : D +(2n+4)

D +(2n+7) : Blank (0) : D +(2n+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)

D +(2n+7) : Blank (0) : D +(2n+6)

@LIFOW. 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 - 5-73


Table Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


ON when one of the following conditions is established. Otherwise, OFF
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data is a number that causes the data table to exceed
the device range
• When the indirect specification or index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to

5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing

"CR/CM List" (Page A-71)

Sample Program
See the sample program for the LIFOR instruction.
"Sample Program" (Page 5-78)

5-74 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Table Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-75


LIFOR LIFO Read

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


LIFOR

LIFOR LIFOR(.U) LIFOR


LIFOR.D Reads data from LIFO
Read
(Last In First Out) data
LIFO
@LIFOR @LIFOR(.U) table.
LIFOR
@LIFOR.D
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition LIFOR
D1 D2 L I F O R D1 D2

Execution condition LIFOR


D1 D2 @ L I F O R D1 D2

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM FM T
(W) (ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z

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 n Number of data : data that write to data block

D1 +1 max Max. number of storage number : Max number that data block can store (designate by user)
Data table

D1 +2 A

D1 +3 B Data block : store data processed by FIFO


A is the data stored at first while C is the last

D1 +n+1 C

As the leading device D1 of the data table, specify the same device as leading device D2 of
the data table of the corresponding LIFOW instruction.

5-76 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

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

D1 +n+1 D D1 +n+1 Blank (0) D

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+1) : C : D1 +(2n) bit


31
D2 +1 D2 bit
0

D1 +(2n+3) : D : D1 +(2n+2)

(2) n is then decremented (by 1) after the data is stored.


bit bit
31 0

D1 +1 : n-1 : D1

D1 +3 max : D1 +2

D1 +5 : A : D1 +4

D1 +7 : B : D1 +6

D1 +(2n+1) : C : D1 +(2n) bit


31
D2 +1 D2 bit
0

D1 +(2n+3) : Blank (0) : D1 +(2n+2) D

Filled with 0

@LIFOR. 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 - 5-77


Table Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


ON when one of the following conditions is established. Otherwise, OFF
• When there is no data in the data table
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data is a number that causes the data table to exceed
the device range
• When the indirect specification and index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to

5 CM5176.
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.
Instructions
Table Processing

"CR/CM List" (Page A-71)

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

bit bit bit bit bit bit


15 0 15 0 15 0

DM100 : 3 DM100 : 4 DM100 : 3


DM101 : 5 DM101 : 5 DM101 : 5

DM102 : 1532 DM102 : 1532 DM102 : 1532


DM103 : 365 R000: ON DM103 : 365 R001: ON DM103 : 365
DM104 : -253 DM104 : -253 DM104 : -253
DM105 : 0 DM105 : 77 DM105 : 0

DM106 : 0 DM106 : 0 DM106 : 0

bit bit bit bit


15 0 15 0

DM0 : 77 DM1 : 77

5-78 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Table Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-79


FWRIT Overwrites the
data block of the
data table.

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


FWRIT

FWRIT FWRIT(.U) FWRIT


FWRIT.D Overwrite Overwrites the data
data table block of the data table.
@FWRIT @FWRIT(.U) FWRIT
@FWRIT.D
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition FWRIT
S D n F W R I T S D n

Execution condition FWRIT


S D n @ F W R I T S D n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM
(W)
FM T
(ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z

S  -  - - -   *4   *5 *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

5-80 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

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

bit bit bit bit


31 0 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

* The instruction is not executed when CR2012 turns ON.


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
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

bit bit bit bit


15 0 15 0

Number of data 3 :DM100 3 :DM100


Max number of storage data 4 :DM101 4 :DM101

DM0 1 st 134 :DM102 134 :DM102

9862 2 nd 4578 :DM103 9862 :DM103


3 rd 36841 :DM104 36841 :DM104
4 th 0 :DM105 0 :DM105

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-81


FINS Inserts data in a data
block.

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


FINS

FINS FINS(.U) FINS


FINS.D Insert in Inserts data in a data
data table block.
@FINS @FINS(.U) FINS
@FINS.D
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition FINS
S D n F I N S S D n

Execution condition FINS


S D n @ F I N S S D n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM
(W)
FM T
(ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z

S  -  - - -   *4   *5 *5   - -   


Instructions
Table Processing

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

E Number of data N : D N+1 : 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 C

E

N th D : D +N+1

D : D +(N+1)+1

5-82 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

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

bit bit bit bit


31 0 31 0

Number of data D +1 N D D +1 N+1 D


Max. number of storage number 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) 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

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 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

* The instruction is not executed when CR2012 turns ON.


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
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

bit bit bit bit


15 0 15 0

Number of data 3 :DM100 4 :DM100


Max number of storage number 4 :DM101 4 :DM101
1 st 134 :DM102 134 :DM102

DM0 2 nd 4578 :DM103 4578 :DM103

9862 3 rd 36841 :DM104 9862 :DM104

36841 :DM105

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-83


FDEL Deletes a data
block of the
data

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


FDEL

FDEL FDEL(.U) FDEL


FDEL.D Delete
Deletes a data block from
from
the data table.
@FDEL @FDEL(.U) data table
FDEL
@FDEL.D
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition FDEL
D n F D E L D n

Execution condition FDEL


D n @ F D E L D n

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM
(W)
FM T
(ZF)
C CTH CTC Z CM #/$ #TM * @ : #/ : Z

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

Number of data N :D N−1 :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 D : D +N

0 : D +N+1
N th D : D +N+1 Filled with 0.

5-84 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Table Processing Instructions

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

Number of data D +1 N D D +1 N−1 D

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

* The instruction is not executed when CR2012 turns ON.


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
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

bit bit bit bit


15 0 15 0

Number of data 3 :DM100 2 :DM100


Max. number of storage data 4 :DM101 4 :DM101
1 st 134 :DM102 134 :DM102
2 nd 4578 :DM103 36841 :DM103
3 rd 36841 :DM104 0 :DM104
4 th 0 :DM105 0 :DM105

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-85


Clock Processing Instructions
WTIME Writes the time
data to the

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano calendar timer

WTIME

WTIME WTIME
Write time
Writes the time data to the
calendar timer.
@WTIME WTIME

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition S
WTIME W T I M E S

Execution condition S
WTIME @ W T I M E S

Available Devices ( ): Not supported on the KV-1000


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

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

*1 Both unsigned data and signed data can be set.


*2 When a bit device has been specified, 112 continuous bits are handled. A relay other than the
leading relay (e.g. MR002, or R1012) of the channel can be specified.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.

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 year 0~99 Year indicates last 2 digits of solar calendar 2000

S +1 : month 1~12

S +2 : day 1~31

S +3 : hour 0~23 Data are all expressed as 16-bit BIN format

S +4 minute 0~59

S +5 : second 0~59 week:0:(sunday) 1:(monday) 2:(tuesday) 3:(wednesday)


S +6 : week 0~6 4:(Thursday) 5:(Firday) 6:(Saturday)

@WTIME 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.

5-86 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Clock Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

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

* The instruction is not executed when CR2012 turns ON.


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)
5

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-87


SEC Converts date/
time format
data to second

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano RSEC


format data.
Converts
SEC,RC second format
data to date/
time format
data.

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

Date/time data to date/time format

@RSEC conversion data.


RSEC

Ladder program Input mode


Execution condition SEC
S D S E C S D

Execution condition SEC


S D @ S E C S D

5 Execution condition RSEC


R S E C S D
S D
Instructions
Clock Processing

Execution condition RSEC


S D @ R S E C S D

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *2 - - - - -  - -   
D  -  - - -   *2 - - - - -  - -   

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 year 0~99 second convirsion second

S +1 : month 1~12 2 word(32-bit)

S +2 : day 1~31 Unsigned 32-bit BIN data


S +3 : hour 0~23

S +4 : Minute 0~59

S +5 : second 0~59

5-88 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Clock Processing Instructions

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

second second conversion year : D (0~99)


2 word(32-bit) month : D +1 (1~12)

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

* The instruction is not executed when CR2012 turns ON.


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
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

CM703 : 10 10 After 30 days DM103 : 10 10

CM704 : 10 10 DM104 : 10 10

CM705 : 10 10 DM105 : 10 10

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-89


AJST Adjusts the
calendar
timer by ±30

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano seconds

AJST

AJST AJST
Adjust
Adjusts the calendar timer by
±30 seconds.
@AJST AJST

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition
AJST A J S T

Execution condition
AJST @ A J S T

Available Devices ( ): Not supported on the KV-1000


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

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

Sample Program
The calendar timer is adjusted by ±30 seconds at the leading edge of input relay R000.

R000 (Mnemonics list)


AJST LDP R000
AJST
Before executing After executing
12:59:15 →12:59:00
12:59:30 →13:00:00

5-90 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Clock Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
Clock Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-91


Weekly Contact Instructions
LDWK Turns ON
between specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano day of week/hour/


minute/second
LDWK,ANWKB ranges
LDWKB Turns OFF
between specified
day of week/hour/

LDWK
minute/second
ranges.

WK Load week ANDWK Turns OFF


between specified
day of week/hour/
minute/second
ranges.

Turns ON between specified ANDWKB Turns ON

ANDWK
between specified
day of week/hour/

WK AND week day of week/hour/minute/ ORWK


minute/second
ranges.
Turns ON
between specified

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

LDWKB WK Load week bar


Turns OFF between specified
ANDWKB WK AND week bar day of week/hour/minute/
second ranges.
ORWKB WK
OR week bar

Ladder program Input mode

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

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *3   *4 *4   *2 -   
S2  -  - - -   *3   *4 *4   *2 -   

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.

5-92 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Weekly Contact Instructions

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".

LDWKB ANDWKB ORWKB


The instruction itself becomes a normally closed contact. This contact turns OFF from
the day of week/hour/minute/second specified by " S1 / S1 +1" until the day of
week/ hours/minutes/seconds 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.

Enter character string Enter HEX


“Week/HH: MM: SS" $ (HH) (MM) (SS) (Week)

Input Day (Chinese) Sunday to Saturday


Form of (Numeral) 0 to 6 (Numeral) $0 to $6
at week (English) sun to sat
HH (Numeral) 0 to 23 (Numeral) $0 to $17
MM (Numeral) 0 to 59 (Numeral) $0 to $3B
SS (Numeral) 0 to 59 (Numeral) $0 to $3B
Enter weekday/hour/minute/second in " ".
When HEX is used to represent weekday/hour behind
Note Weekday and time is separated with "/".
$
Hour/minute/second is separated with ":".
When entering Monday 08: 30: 15 When entering Monday 08: 30: 15
“Monday / 08 : 30 : 15 " $81E0F01
Example
"ν / 08 : 30 : 15 " When HEX is used, weekday value is the last to be
“Month / 08 : 30 : 15 " entered, which should be paid heightened attention.

 Format of S1 and S2
The day of the week and time can be set according to the following format.

Operand 1 S1 +1 S1

Operand 2 S2 +1 S2
Data
configuration bit31 to bit24 bit23 to bit16 bit15 to bit8 bit7 to bit0

Content Hrs Mins Secs Day of week


0 to 23 (hrs), FF*2 0 to 59 (mins), FF*2 0 to 59 (secs), FF*2 0 (Sunday) to 6 (Saturday),
Setting range*1 (24 hours or more (60 hours or more (60 hours or more FF*2
invalid) invalid) invalid) (7 or more invalid)

*1 The description for day of week/hours/minutes/seconds in the table is given in decimal.


However, in actual fact, week/hours/minutes/seconds is handled in Hex.
*2 "n FF specification day of week/hours/minutes/seconds"

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-93


Weekly Contact Instructions

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".

 Operation at start/end day of the week time

Start/end day of the week time setting Operation


[ S1 · S1 +1]<[ S2 · S2 +1] The time from the start up to the end day of the week time turns ON.
[ S1 · S1 +1]=[ S2 · S2 +1] Only the start day of the week time turns ON.
From the start day of the week time until the end day of the week
[ S1 · S1 +1]>[ S2 · S2 +1]
time turns ON across two weeks.

Example 1. Start: Monday 08:30:00 End: Wednesday 07:30:00 ON between Monday 08:30:00 and Wednesday 07:30:00.
Example 2. Start: Sunday 10:00:00 End: Sunday 10:00:00 ON at Sunday 10:00:00 only (for approx. 1 second)
Example 3. Start: Saturday 08:15:00 End: Monday 08:30:00 ON between Saturday 08:15:00 to Monday 08:30:00

 FF specification day of week/hours/minutes/seconds


FF can be used in a special meaning when the day of the week, hours, minutes, and seconds are
specified.
1.The item (day of week/hours/minutes/seconds) value can be omitted.

Example ON between Monday 11pm to Thursday 5pm Monday/23:FF:FF to Thursday/17:FF:FF


( = Monday/23:00:00 to Thursday/17:59:59)
ON between Monday and Friday Monday/FF:FF:FF to Friday/FF:FF:FF
( = Monday/00:00:00 to Friday/23:59:59)
* The start hour/minute/second specified by FF is regarded as 00:00:00 as the
minimum time, and as 23:59:59 as the maximum time.

2.The item (day of week/hours/minutes/seconds) value is not taken into consideration.

Example ON every day between 08:30 to 17:15 FF/08:30:00 to FF/17:15:00


ON every hour between 10 to 15 minutes FF/FF:10:00 to FF/FF:15:00

5-94 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Weekly Contact Instructions

 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.

* Specify the same FF type to S1 and S2 .

Operation flag

CR2009 No change in state


5
CR2010 No change in state

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

* The contact turns OFF when CR2012 is ON.


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
Output relay R500 is continuously turned ON between Monday 8:30:00 to Friday 17:15:00.

"MON/08:30:00" R500 (Mnemonics list)


WK LDWK "MON/08:30:00" "FRI/17:15:00"
"FRI/17:15:00" OUT R500

Output relay R500 is turned ON between 8:30:00 to 17:15:00 on Monday to Friday.


"MON/FF:FF:FF" "FF/08:30:00" R500 (Mnemonics list)
WK WK LDWK "MON/FF:FF:FF" "FRI/FF:FF:FF"
"FRI/FF:FF:FF" "FF/17:15:00" ANDWK "FF/08:30:00" "FF/17:15:00"
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.
"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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-95


Calendar Contact Instructions
LDCAL Turns ON between
specified year/

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano ANDCAL


month/day
ranges.
Turns OFF
LDCAL,ANDCAL,ORCAL,LDCALB,ANDCALB,ORCALB
between specified
year/month/day
ranges.

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/

Turns ON between specified


month/day

AND calendar
ranges.

CAL ORCALB Turns OFF


between specified

year/month/day ranges. year/month/day


ranges.

ORCAL CAL
OR calendar
EXTENDED INSTRUCTIONS

LDCALB CAL Load calendar bar

ANDCALB CAL AND calendar bar Turns OFF between specified


year/month/day ranges.

ORCALB CAL
OR calendar bar

Ladder program Input mode

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

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *3   *4 *4   *2 -   
S2  -  - - -   *3   *4 *4   *2 -   

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".

5-96 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Calendar Contact Instructions

LDCALB ANDCALB ORCALB


The instruction itself becomes a normally closed contact. This contact turns OFF from
the year/month/day specified by " S1 / S1 +1" until the year/month/day specified by
" S2 / S2 +1".

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.

Calendar contact constant entry


To enter a constant into S1 , S2 , please do as follows. "#" cannot be used.
Enter character string Enter HEX
"YY / MM / DD " $ (YY) (MM) (DD)

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".

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-97


Calendar Contact Instructions

 Operation at start/end year/month/day

Start/end year/month/day setting Operation


[ S1 · S1 +1] < [ S2 · S2 +1] The time from the start up to the end year/month/day turns ON.
EXTENDED INSTRUCTIONS

[ 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

5 program will not function correctly.

■ FF specification day of year/month/day


Instructions
Calendar Contact

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.

Example ON during 2012 January to 2014 February 12/01/FF to 14/02/FF


(=12/01/01 to 14/02/29)
ON during 2012 12/ FF/FF to 12/FF/FF
(=12/01/01 to 12/12/31)
ON until 2012, February 16 FF/FF/FF to 12/02/16
(=00/01/01 to 12/02/16)
ON from 2010, March 14 and onwards 10/03/14 to FF/FF/FF
(=10/03/14 to 99/12/31)
* The start year/month/day specified by FF is regarded as 00/01/01 as the minimum,
and as 99/12/31 as the maximum.

2. The item (year/month/day) value is not taken into consideration.

Example ON on the 20th of every month FF/FF/20 to FF/FF/20


May 3 to May 5 every year FF/05/03 to FF/05/05
December 31 to January 3 every year FF/12/31 to FF/01/03

 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.

5-98 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Calendar Contact Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

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

* The contact turns OFF when CR2012 is ON.


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)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-99


Alarm Instruction
ARES Resets the

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano currently


operating
alarm relay
ARES and alarm
history.

ARES
Resets the currently operating alarm relay
ARES Alarm relay reset
and alarm history.

Ladder program Input mode


Execution condition
ARES A R E S
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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)

- - - - - - - - - - - - - - - - - - - - -

Operation Description
5
Resets the currently operating alarm relay and alarm history.(CR3300 to CR3415)
Alarm Instruction

"5-8 Access Window" in the KV-7000 Series User's Manual


"2-1 Access Window" in the KV-5500/5000/3000 Series User's Manual
"2-8 Monitor Alarm" in the KV-1000 Series User's Manual
"5-1 Access Window" in the KV Nano Series Base Unit (terminal block type) Series User's Manual
"5-13 Alarm" in the KV Nano Series Base Unit (connector type) User's Manual

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

5-100 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Alarm Instruction

MEMO

EXTENDED INSTRUCTIONS
5

Alarm Instruction

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-101


High-speed Processing Instructions
HSP Sets the
input time

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano constant


10μs
to

HSP

HSP
HSP High speed Reduces the time constant of the input
HSP relay to speed up input response.

Ladder program Input mode


Execution condition HSP
D H S P D
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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  - - - - - - - - - - - - - - - - - - -

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

KV-N14**: R000 to R007


KV-N24**: R000 to R013
KV-N40**/KV-N60**: R000 to R107
KV-NC32T: R000 to R015

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

5-102 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
High-speed Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-103


DI Disable
interrupt

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano EI Enable interrupt

DI,EI

DI
Disable
DI Disables execution of interrupt programs.
interrupt

EI
Enable
EI Enables execution of interrupt programs.
interrupt

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition
EI E I

Execution condition
DI D I

Available Devices ( ): Not supported on the KV-1000


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

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.

• Only KV-7500/7300/5500/5000/3000 is applicable for period module specifying.


• Once the EI instruction is executed, interrupts up to execution of the DI instruction are enabled.
• Interrupts are disabled at all times when operation is started.
• Interrupts up to a nesting level of 16 can be stored if they occur during execution of the DI
instruction (interrupts are disabled).
When the EI instruction is executed, interrupts stored to memory are executed.
• KV-7500/7300/5500/5000/3000, KV Nano Series To start the interrupt program, it should be in the EI (enable
interrupt) mode. To execute another interrupt in the execution of this interrupt, a priority higher than
that of the currently executed interrupt should be set up. To set up priority, click "CPU system
settings" -> "Fixed period execution and user interrupt setting". Up to 3 levels can be handled.
• KV-1000 When the interrupt program is started, the DI (disable interrupt) mode is processed. To
perform another interrupt in the execution of an interrupt, up to 16 levels can be handled by
executing the EI instruction in the interrupt program.
"What Is "Interrupt Processing?"" (Page 5-114)

5-104 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-105


DIC Sets the
interrupt
disabled

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano range.

DIC

DIC
Interrupt disabled
DIC Sets the interrupt disabled range.
range

Ladder program Input mode


Execution condition D
DIC D I C D
EXTENDED INSTRUCTIONS

Interrupt forbidden range

D
EI

Available Devices ( ): Not supported on the KV-1000


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)

5 D  -    -   *2 - - - - -  - -   

Operand Explanation
Instructions
High-speed Processing

D Specifies the bit device to output interrupt enabled/disabled state. *1

*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."

Status for interrupt forbidden Status for interrupt enabled

CR2002 D CR2002 D
DIC DIC

Forbid constant Forbid constant

D D
EI EI

OFF ON
Status for interrupt forbidden Status for interrupt enabled

Interrupt factor occur

Output Input Output Input


Interrupt forbidden range
process process process process

Input
Interrupt program
process

5-106 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

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.

* The instruction is not executed when CR2012 turns ON.


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)

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

(1) Interrupt process forbidden


(2) DM0+DM10 -> DM100
(3) Interrupt forbidden allowed

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-107


NT Interrupt execute
RETI Interrupt end

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano NT/RETI

INT,TI

The interrupt program is executed


INT
INT
Interrupt up to RETI at the rising edge or
falling edge of the operand.

RETI
RETI Indicates the end of the interrupt
Return interrupt
program.
EXTENDED INSTRUCTIONS

KV-7500/7300

Ladder program Input mode


INT
n1 n2 I N T n1 n2
( I n1 n2 )

Interrupt program

RETI
R E T I
( I R E T )

5 KV-5500/5000/3000 KV-1000 KV Nano

Ladder program Input mode


Instructions
High-speed Processing

INT
S I N T S
( I S )

Interrupt program

RETI
R E T I
( I R E T )

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
DM EM
R (DR) LR T C CTC CR TM FM T C CTH CTC Z CM #/$ #TM * @ : #/ : Z
(B) (W) (ZF)
n1 *1 − − − − − − − − − − − − − − − ○ − − − −

n2 *1 − − − − − − − − − − − − − − − ○ − − − −

S *2 ○*3 − − − − ○*3 ○*3 − − − − − − − − − − − −

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.

*1 The configuration is necessary only when KV-7500/7300 is used.

*2 The configuration is necessary only when KV-5500/5000/3000/1000, KV Nano series is used.

*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.

5-108 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

Instruction execution timing


INT, RETI These instructions are executed at the rising edge or falling edge of the operand.

Scan

Interrupt factor occur Interrupt factor occur


Interrupt condition

INT, RETI → ←Execution → ←Execution

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-109


High-speed Processing Instructions

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

KV-5500/5000/3000 KV-1000 KV Nano

When R000 is input, interrupt is executed and R500 turns ON.


(Mnemonics list)
CR2002
EI LD CR2002
END EI
END
INT INT R000
R000 LD CR2002
CR2002 R500 SET R500
SET RETI
RETI ENDH

ENDH

5-110 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
High-speed Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-111


IEDGESets detection

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano c


o
n
d
IEDGE it
i

IEDGE
Input
o
n

IEDGE s
u

interrupt
s
e

Sets detection conditions used for


d

Detection f
o

interrupt.
@IEDGE
r

IEDGE
conditions
i
n
t
e

write
r
r
u
p
t
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition IEDGE
n1 n2 S I E D G E n1 n2 S

Execution condition IEDGE


n1 n2 S @ I E D G E n1 n2 S

Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Operand Device
MR DM EM
5 R (DR) LR
(B)
T C CTC CR TM FM
(W) (ZF)
T C CTH CTC Z CM #/$ #TM * @ : #/ : Z

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

*1 For bit devices, specify the leading device of the 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.

5-112 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

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

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300 When CR2012 is ON, detailed error information is stored into CM5150 to CM5176.

Sample Program
Refer to the "INT instruction" (Page 5-108)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-113


High-speed Processing Instructions

What Is "Interrupt Processing?"


Normally, on a PLC, execution of a ladder sequence program proceeds by repeatedly executing input
processing, execution of the main routine program, and output processing. Accordingly, signals
EXTENDED INSTRUCTIONS

shorter than the scan time cannot be input.


If the interrupt processing function is used, processing can be executed at the moment that an
interrupt occurs independently of the scan time.
When an interrupt occurs, program execution is temporarily suspended at that moment in time,
interrupt program corresponding to the interrupt factor is executed. When execution of the interrupt
program ends, processing of the suspended program is resumed.
KV-7000 User's Manual "4-5 Interrupt"
For details on scan time, KV-5500/5000/3000 Series User's Manual 3-5 Interrupt
KV-1000 User's Manual "Chapter 4 INTERRUPT."
5 KV Nano Series User's Manual "4-7 INTERRUPT."
Instructions
High-speed Processing

Input process

Input process
Scan time

Occur for interrupt condition


Operate program Operation interrupt
program

Return the next


instruction of interrupt

Output process

5-114 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Instructions
High-speed Processing

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-115


CTH 32-bit high-
speed counter
CTC High-speed

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano comparator

CTH,CTC

Executes operation of input


CTH CTH(.D) CTH 32-bit high-
CTH.L speed counter response frequency, max.
100 kHz 32-bit (unsigned 0 to
High-speed 4294967295, signed -
CTC CTC(.D)
CTC.L
CTC counter
comparator
2147483648 to 2147483647)
increment/decrement counter.
EXTENDED INSTRUCTIONS

Ladder program Input mode


CR2002 HSP
S
Execution condition CTH n C T H n S
S
S
CTC n C T C n S

CTC n

5 Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
Instructions
High-speed Processing

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.

Example The current value of CTC0 is set to -1000.


SET instruction CTC0 is set to "Use signed".
CR2008 CM1608 #1 −1000
CM01608 bit7: ON
BSET CTC DW.L
Scan ON once CTC instruction Other than "0" is set to CTC0.
#7 CTC 0
DW.L instruction Minus value is set.

5-116 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

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""

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-117


High-speed Processing Instructions

Outline of High-speed Counters

 High-speed counters, high-speed counter comparators


EXTENDED INSTRUCTIONS

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.

 Confirmation of high-speed counters, high-speed counter comparators


The KV-5500/5000/3000/1000 Series is provided with two high-speed counters, and high-speed

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

Enable input R008


Preset (Z phase)input R014

Count input 32 bit high speed CTH0 input capture function


A phase R010 counter 0
External input CM1610, CM1611(INT R000)
(B phase R012) R010 CTH0 CM1612, CM1613(INT R001)
(R012)
KV-5500/5000/3000 CR2505
Internal timer Control circuit KV-1000 MEMSW 2 (bit0)
CR2100(1.0μs) OFF R500
CR2101(10.0μs) ON R504
CR2102(100.0μs) CTH0 SV (comparator matching output)
Hi-speed counter comparator Interrupt function
Direct timer pulse input CTC0
R501 INT CTC0
CTC1 INT CTC1

(internal cable)
(internal cable)

Count input 32 bit high speed CTH1 input capture function


counter 1
Direct timer pulse input CM1614, CM1615(INT R002)
R500 CTH1 CM1616, CM1617(INT R003)
KV-5500/5000/3000 CR2513
KV-1000 MEMSW 2 (bit1)
Internal timer
Control circuit OFF R501
CR2200(1.0μs)
ON R505
CR2201(10.0μs)
(comparator matching output)
CR2202(100.0μs)
CTH1 SV
External input Hi-speed counter comparator Interrupt function
A phase R011
R011 CTC2
(B phase R013) (R013) INT CTC2
CTC3 INT CTC3

Enable input R009


Preset (Z phase)input R015

5-118 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

High-speed counter block diagram (For the KV Nano)


A phase can be used by itself without using B phase.
* The relay numbers that can be used by each function differ according to the unit.
"KV Nano Series User's Manual "High-Speed Counter Device Numbers Categorized by Function""

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

Control circuit 0 Output terminal 0


Enable input Comparator matching output
Preset (Z phase) input (Preset value)

CTH0 SV Interrupt function 0


Hi-speed counter comparator Interrupt trigger

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)

CTH1 SV Interrupt function 1


Hi-speed counter comparator Interrupt trigger

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

Control circuit 2 Output terminal 2


Enable input Comparator matching output
Preset (Z phase) input (Preset value)

CTH2 SV Interrupt function 2


Hi-speed counter comparator Interrupt trigger

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

Control circuit 3 Output terminal 3


Enable input Comparator matching output
Preset (Z phase) input (Preset value)

CTH3 SV Interrupt function 3


Hi-speed counter comparator Interrupt trigger

Direct timer pulse *3

*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).

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-119


RFSCTH Update the
current value of
High-speed

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Counter with the


latest value.

RFSCTH

RFSCTH
RFSCTH High-speed Update the current value of High-speed
counter refresh Counter with the latest value.

Ladder program Input mode


Execution condition RFSCTH
n R F S C T H n
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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)
n - - - - - - - - - - - - - - -  - - - -

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

5-120 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


High-speed Processing Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-121


PID Control Instruction
PID PID Control

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


PID

PID

PID
PAUSE
MANUAL PID Control Performs PID control.
RES

Ladder program Input mode


PAUSE Input
EXTENDED INSTRUCTIONS

PID
PAUSE P I D D1 D2
MANUAL Input D1
MANUAL
RES Input D2
RES

Available Devices ( ): Not supported on the KV-1000


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
5 (B) (W) (ZF)
*3
D1 - - - - - - -   - - - - -  - -   
Instruction
PID Control

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

*1 Continuous 36 words are handled.


*2 Continuous 8 bits are handled.
*3 EM and FM (ZF) cannot be used with the KV Nano Series.

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)

Measuring quantity (Pv)


Rate of change for operating quantity
(slope of operating quantity)

Set value (Sv)

0 Time

Lower limit for operating quantity


(MVLL)

5-122 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

 PID control diagram

PID control instruction Data list


・Sampling period (Ts)

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

Control object machine


of heater ect
Measured value Operating quantity

Reference • The operation method used in PID control is target value filter 2 degree of freedom PID
method.
Target value filter 2 degree of freedom PID block diagram
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.

<simple PID method> <target value filter 2 degree


of freedom PID method>

When appearance of When stability with respect to Overshoot can be prevented


overshoot is prevented, external disturbance is set and stability with respect to
stability with respect to faster, overshoot appears and external disturbance can be
external disturbance slows the reaction with respect to speeded up.
down. the target value slows down.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-123


PID Control Instruction

Executed when both PAUSE and RES inputs are OFF.

Scan
ON

RES input
EXTENDED INSTRUCTIONS

OFF
ON

PAUSE input
OFF

PID Execute Execute Execute

Device Item Symbol Description Setting Range


Cycle in which PID operation is performed
D1 +0*1 Sampling cycle TS 1 to 6000
0.01 to 60.00"sec"
Proportional Constant of proportional action
D1 +1*1 KP 1 to 50000
constant 0.001 to 50.000

5 D1 +2*1 Integral constant TI


Constant of integral action 0.1 to 3000.0"sec"
(3000.1 "sec" or more is processed as "infinity".)
1 to 30000

Differential Constant of differential action


Instruction
PID Control

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

*1 Set by the user


*2 Set by the user manually. The result of PID operation is automatically set.

5-124 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

Device Item Description


*1
Forward/reverse ON sets forward action, and OFF sets reverse action.
D2 +0 action
When ON, reflects the parameter in (KP, TI, TD, α, β, MVLL, MVHL, ∆MVL) the
Constant reflection operation formula at each operation. When OFF, the constant is reflected in the

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 +3 Reserved (cannot be used by the user)

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.

D2 +7 Reserved (cannot be used by the user)

*1 Set by the user


*2 The PID instruction is stored as the result of execution.

Data settings

 Sampling cycle (TS) " D1 +0"


The "sampling cycle" (TS) refers to the cycle (sec) in which the measured value (PV) for performing PID
operation is captured.
The relationship between the sampling cycle (TS) and the scan time is as follows.
Scan once Scan once Scan once Scan once Scan once Scan once Scan once

Measuring value
(PV)
(2) Sampling period

(1) 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

(1) Sampling period(TS)

(2) Sampling period(TS)

Setting value Advantages Disadvantages


The life of contacts is reduced when
When smaller than the ON/OFF is performed in small increments,
relays with contacts are used for
sampling cycle reducing the incidence of hunting.
turning a heater, for example, ON/OFF.
The life of contacts is not relatively reduced even if
When a large sampling cycle
relays with contacts are used for turning a heater, Hunting increases.
is set
for example, ON/OFF.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-125


PID Control Instruction

 Proportional constant (KP) " D1 +1"


The relationship between the measured value (PV), proportional band (P), manipulated variable upper
limit value (MVHL), and manipulated variable lower limit value (MVLL) is as follows.
EXTENDED INSTRUCTIONS

Upper limit for operating quantity (MVHL)


32767
Proportion constant (KP)
(scope)

Upper limit for operating quantity (MVHL)


-32768

0°C 95°C 100°C 105°C 200°C


Set value(PV)

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.

 Integral constant (TI) " D1 +2"


The integral constant is used to decrease the deviation between the measured value (PV) and the
setting value (SV) that occurs by action of the proportional constant (KP).
Temperature (1) (1) Though startup is quick when a
small integral constant (TI) is set,
(2)
hunting increases.
Set value (2) Both startup and hunting become
medium-size when a medium-size
integral constant (TI) is set.
(3) (3) Though startup is slow when a large
integral constant (TI) is set, hunting
decreases.
Time

* 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

 Differential constant (TD) " D1 +3"


The suppression effect can be made to function to reduce hunting and increase the response speed
when the measured value (PV) exceeds the setting value (SV) by action of the proportional constant
(KP) and integral constant (TI).

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.

 Proportional constant 2 degree of freedom coefficient (α) " D1 +4"


(*Normally, there is no need to change the default value (0.4).)
When a coefficient other than "0" is set, 2 degrees of freedom are applied to P items. Increasing this
value reduces the effect of the target value filter. (Though trackability when the target value is changed
functions when this value is increased, setting too small a value causes overshoot.)
* The preset value is enabled only when the 2 degree of freedom coefficient setting is ON. When this
setting is OFF, the default 0.4 is used for the operation formula.

 Integral constant 2 degree of freedom coefficient (β) " D1 +5"


(*Normally, there is no need to change the default value (1.35))
When a coefficient other than "1" is set, 2 degrees of freedom are applied to I items. Increasing the
value increases the effect of the target value filter (to suppress overshoot when the target value is
changed).
* The preset value is enabled only when the 2 degree of freedom coefficient setting is ON. When this
setting is OFF, the default 1.35 is used for the operation formula.

 Manipulated variable lower limit value (MVLL) " D1 +6"


Sets the lower limit value of the manipulated variable (MV). Be sure to set the manipulated variable
limits so that the following condition is satisfied: manipulated variable upper limit value (MVHL) >
manipulated variable lower limit value (MVLL)

 Manipulated variable upper limit value (MVHL) " D1 +7"


Sets the upper limit value of the manipulated variable (MV). Be sure to set the manipulated variable
limits so that the following condition is satisfied: manipulated variable upper limit value (MVHL) >
manipulated variable lower limit value (MVLL)

 Manipulated variable change width limit value (∆MVL) " D1 +8"


The change width (absolute value) between the manipulated variables of the previous cycle and this
cycle is restricted to not exceed this value.
This value is applied on manipulated variables (MV) calculated by operation and the manual mode
manipulated variable (MVMAN).
When the change width exceeds this value, manipulated variable change exceeded turns ON.

 Setting value (SV) " D1 +10"


Sets the target value of the measured value (PV) fed back from the control target.
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-127
PID Control Instruction

 Measured value (PV) " D1 +11"


Sets the measured value (MV) fed back from the target device controlled by the manipulated variable
(PV).
EXTENDED INSTRUCTIONS

 Manipulated variable (MV) " D1 +12"


A manipulated value obtained by applying the manipulated variable change width limit value (∆MVL)
to the manipulated variable calculated as a result of PID operation in the automatic mode is stored,
and in the manual operation mode, a manipulated value obtained by applying the manipulated
variable change width limit value to the value set to the manual mode manipulated variable (MV) is
stored. (This is to avoid sudden changes in the manipulated variable regardless of manual operation/
automatic operation mode.)
* We recommend outputting this value to control target devices regardless of automatic/manual
operation mode.
* Note, however, that the manipulated variable is reset to "0" when RES input is ON. To avoid sudden
5 changes, make sure that the manipulated variable is "0" in the manual mode before turning RES
input ON.
Instruction
PID Control

 Manual manipulated variable (MVMAN) " D1 +13"


This is set by the user in the manual operation mode. (This is required for balance-less and bump-less
switching.)
This can be switched only in the manual mode. In the automatic operation mode, the same value as
the manipulated variable (MV) is stored at execution of the operation.

 Work area " D1 +14" to " D1 +35"


(cannot be used by the user)
Do not write a value as this is used by the PID instruction.

Flag settings

 Forward/reverse action " D2 +0"


ON becomes forward when ON, and reverse when OFF. This flag setting is reflected in the operation
formula only at the falling edge of RES input.

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.

 Setting of 2 degrees of freedom coefficient (α,β) " D2 +2"


When ON, the user settings of proportional constant 2 degrees of freedom coefficient (α) and integral
constant 2 degrees of freedom coefficient (β) are reflected.
When OFF, the default value is reflected.
This setting is reflected at the falling edge of the RES input when the constant reflection timing
selection is OFF.
Otherwise, this setting can be switched at all times.

 Operation completed " D2 +4"


Turns ON for one scan at each operation of the sampling cycle (TS)
5-128 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
PID Control Instruction

 Manipulated variable change exceeded " D2 +5"


Turns ON for one scan when there is a change that results in the preset manipulated variable change
width limit value (∆MVL) being exceeded.

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

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 a bit device, and timer/counter has been specified when D1 is indirectly specified
• When a word device, and timer/counter has been specified when D2 is indirectly
CR2012
specified
• When the value of the setting data and I/O data specified by D1 exceeds the allowed
specified range

* The instruction is not executed when CR2012 turns ON.


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
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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-129


PIDAT PID control with
automatic
tuning

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


PIDs

PIDAT
PIDAT PID control with
Performs PID control.
automatic tuning

Ladder program Input mode


Execution condition PIDAT
S D1 D2 P I D A T S D1 D2
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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   *4 *4   - -   
D1  -  - - - -  *3 - - - - -  - -   
D2  -  - - -   *3 - - - - -  - -   

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 ( )

(PV) is read at the next cycle (TS). This Rate of change


for operating

operation is repeated, and the


quantity
(slope of
operating quantity)
manipulated variable (MV) is controlled
until the measured value (PV) = setting
Set value ( )
value (SV).(MV)
• The parameters such as the PID
constants are retrieved at the rising
edge of the PIDAT instruction execution 0 Time
condition, and the PID operation is Lower limit for
operating quantity
executing using the present ( )

manipulated value (MV) as the default


value.
• When the manual mode flag (bit 1 of D1 +2) turns ON, the manipulated value (MV) is switched to
manual manipulated value (MVMAN) without a bump.
5-130 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
PID Control Instruction

• 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 concept diagram

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+μ

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-131


PID Control Instruction

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.

5-132 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-133


PID Control Instruction

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".

5-134 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

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.

*6 When "0" is set, the default value "5" is used.


*7 When "0" is set, the default value "1440 (24 hours)" is used.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-135


PID Control Instruction

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

PID control without automatic tuning


• Measured value (PV) (S)
• Setting value (SV) ( D1 +0)
• Operation setting flag ( D1 +3): Forward/reverse operation (bit 0) *1
• Sampling cycle (TS) ( D1 +4)
• Proportional constant (KP) ( D1 +5)
• Integral constant (TI) ( D1 +6)
• Differential constant (TD) ( D1 +7)
• Manipulated value lower limit (MVLL) ( D1 +11)
5 • Manipulated value upper limit (MVHL) ( D1 +12)
• Manipulated value (MV) ( D2 ) *2
Instruction
PID Control

*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.

PID control with automatic tuning


• Measured value (PV) (S)
• Setting value (SV) ( D1 +0)
• Operation control flag ( D1 +2): AT start/operating flag (bit 2) *1
• Operation setting flag ( D1 +3): Forward/reverse operation (bit 0) *1
AT calculation control method setting (bit 12 to 15) *2
• Sampling cycle (TS) ( D1 +4)
• Manipulated value lower limit (MVLL) ( D1 +11)
• Manipulated value upper limit (MVHL) ( D1 +12)
• Manipulated value (MV) ( D2 ) *2
*1 The flag turns ON when automatic tuning starts, and automatically turns OFF when
automatic tuning is completed. Operation will take place even if the other bits are
OFF.
*2 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.
*3 PID operation is executed using the manipulated value (MV) at the rising edge of
the execution conditions as the default manipulated value.

5-136 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

 Parameter application timing


The parameters are applied at the following timing.

Device Item Symbol Application timing

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-137


PID Control Instruction

 Initialization and instruction execution timing


Scan

ON
Execution conditions
EXTENDED INSTRUCTIONS

OFF

Sampling cycle ( )

(1) (2) (3)


Details of
Initialization process PID operation execution Automatic tuning execution PID operation execution PID operation execution
PIDAT instruction operation
Operation complete ON
( D1 +18: 0 bit) OFF

AT start/operating flag ON (3)


( D1 +2: 2 bit) OFF (4)

(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.

 Automatic tuning (AT)


The PID constants (proportional (KP), integral (TI) and differential constant (TD)) can be automatically
calculated by using automatic tuning.
Automatic tuning uses the limit cycle method (forcibly fluctuates the manipulated value between the
upper limit and lower limit, observes the measured value and estimates the characteristics of the
control target).
ON
Execution condition
OFF
AT start/operating flag ON
ON by user OFF by PIDAT instruction
( D1 +2: 2 bit) OFF
Details of PIDAT In automatic tuning PID control
instruction operation

Setting value ( )

AT hysteresis ( )

Calculates PID constants (proportional


( ), integral ( ), differential
Observation period constant ( )).

Measured value ( )

Manipulated value ( )

ON ON when automatic tuning fails


CR2012
OFF

5-138 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

 Starting automatic tuning


When the execution conditions turn ON, if the operation control flag AT start/operating flag ( D1 +2:
bit 2) is turned ON, automatic turning will start at the next sampling cycle.

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.

 At completion of automatic tuning


When automatic tuning is completed, the PIDAT instruction turns the AT start/operating flag ( D1 +2:
bit 2) OFF.
At the same time, each parameter of the PID constant (proportional constant (KP), integral constant
(TI), differential constant (TD)) is set, and PID control starts with those PID constants.

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.

 Adjusting the automatic tuning


The values calculated with automatic tuning can be finely adjusted with the AT adjustment parameter
( D1 +15).
If this value is increased, the PID constants will be calculated with priority on stability, and if
decreased, will be calculated with priority on responsiveness.
PID control with priority on stability PID control with priority on responsiveness
Overshooting in respect to the changes Tracking of changes and disturbance in
and disturbance in the target value will the target value will speed up, but
decrease, but tracking will slow down. overshooting will occur.
Target value/measured value Target value/measured value

Time Time

 Obtaining more accurate automatic tuning results


• Automatic tuning calculates the PID constants based on the upper and lower limit values of the
manipulated value. If the PIDAT instruction is manipulated value is restricted with a LIMIT instruction,
etc., the PID constants cannot be calculated accurately. To correctly calculated the PID constants,
change the upper and lower limit values of the manipulated value to the value restricted with the
LIMIT instruction before automatic tuning starts, and return the values when automatic tuning is
finished.
• If the difference between the set value and measured value is small when starting automatic tuning,
a normal limit cycle will not be generated, and the PID constants may not be calculated accurately.
The PID constant can be calculated more accurately by changing the setting value to increase the
difference between the setting value and measured value before starting.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-139


PID Control Instruction

Data Settings

 Measured value (PV) S


EXTENDED INSTRUCTIONS

Sets the measured value observed from the control target device.

 Setting value (SV) D1 +0


Sets the target value for tracking the measured value (PV).

Reference Use the RAMP instruction to change the setting value at a set inclination.
"RAMP instruction" (Page 4-144)

 Manual manipulated value (MVMAN) D1 +1


5 Set the manipulated value for the manual mode. During the manual mode, the manual manipulated
value (MVMAN) is stored in the manipulated value (MV) ( D2 ).
Instruction
PID Control

 Operation control flag D1 +2


The PIDAT instruction operation is controlled at each sampling cycle by turning the bit position of the
device specified with D1 +2 ON and OFF.
bit bit bit bit bit
15 4 2 1 0

Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved

(0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0)

Operation pause flag (PAUSE)

Manual mode flag (MANUAL)

Automatic tuning start/operating flag

Constant application timing selection

 Operation pause flag (PAUSE) D1 +2: Bit 0


The operation (PID operation, automatic tuning, warning function) is temporarily stopped when ON.
Operation resumes when OFF.

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.

 Manual mode flag (MANUAL) D1 +2: Bit 1


The mode changes to the manual mode when ON, and the automatic mode when OFF.
During the manual mode, the value obtained by applying the manipulated value change limit value
(∆MVL) onto the manual manipulated value (MVMAX) ( D1 +1) is stored in the manipulated value
(MV)( D2 ) instead of the PID operation results.
When changing between the automatic and manual modes, a process takes place so that the
manipulated value does not change suddenly. (Bump-less switching, measured value tracking)

5-140 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

 Automatic tuning start/operating flag D1 +2: Bit 2


Automatic tuning starts at the change (rising edge) of OFF to ON.
This flag automatically turns OFF when automatic tuning is finished.
Automatic tuning stops when the flag changes from ON to OFF (falling edge).

EXTENDED INSTRUCTIONS
If automatic tuning ends abnormally, the operation flag CR2012 turns ON and the error details
information (error code) is stored in CM5157.

"Automatic tuning (AT)" (Page 5-138)

 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

Reserved Reserved Reserved Reserved Reserved

(0) (0) (0) (0) (0)

Forward/reverse operation

2 degree of freedom coefficient setting

Integral/differential constant unit setting

Bump-less switching setting

Measured value tracking setting

Manipulated value change width limit alarm setting

Measured value change width warning setting

AT calculation control method setting

 Forward/reverse operation D1 +3: Bit 0


Reverse operation takes place when OFF, and forward operation when ON.

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-141


PID Control Instruction

 2 degree of freedom coefficient (α, β, γ) setting D1 +3: Bit 1


When ON, proportional constant 2 degree of freedom coefficient (α), integral constant 2 degree of
freedom coefficient (β) and differential constant 2 degree of freedom coefficient (γ) setting values (+8
to 10) are applied.
EXTENDED INSTRUCTIONS

When OFF, the default value is applied.

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.

 Integral/differential constant unit setting D1 +3: Bit 4


This setting switches the integral constant (TI) and differential constant (TD) unit.
OFF:Integral constant 100ms unit, differential constant 10ms unit
5 ON: Both integral constant and differential constant 1ms unit

Set this to ON if the control target response is fast, and OFF if it is slow.
Instruction
PID Control

Reference

 Bump-less switching setting D1 +3: Bit 5


This is normally set to OFF and does not need to be changed to ON.
"Bump-less switching" is a process which prevents the manipulated value from changing suddenly
when switching between automatic and manual. This is accomplished in the automatic mode by
rewriting the manual manipulated value (MVMAN) with the manipulated value (MV), and in the manual
mode by rewriting the manipulated value (MV) with the manual manipulated value (MVMAN).
When this bit is turned ON, the process to rewrite the manual manipulated value with the manipulated
value is disabled.

 Measured value tracking setting D1 +3: Bit 6


This is normally set to OFF and does not need to be changed to ON.
"Measured value tracking" is a process which prevents sudden changes in the manipulated value by
eliminating the difference in setting value and measured value when switching to the automatic mode.
This is accomplished by in the manual mode by rewriting the setting value (SV) with the measured
value (PV).
During the manual mode, the measured value (PV) is written to the setting value (SV).
When this bit is turned ON, the process to rewrite the measured value with the setting value is
disabled.

5-142 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

 Manipulated value change width limit alarm setting D1 +3: Bit 8


When this bit is ON, "manipulated value change width limit warning" is enabled and when OFF,
"manipulated value change width limit warning" is disabled.
When set to ON, the change width (absolute value) of the previous cycle and current manipulated

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.

 Measured value change width warning setting D1 +3: Bit 9


When this bit is ON, "measured value change width warning" is enabled, and when OFF, "measured
value change width warning" is disabled.
When set to ON, if the change width (absolute value) of the previous cycle and current measured
value exceeds the value set with measured value change width (∆PVL), the measured value change
width exceeded ( D1 +18: bit 3) output turns ON.
5

Instruction
PID Control
 AT calculation control method setting D1 +3: Bit 12 to 15

Which control method PID parameter to use for Bit


Setting details
calculation during automatic tuning is set with a bit 15 14 13 12
pattern. OFF OFF OFF OFF PID control
OFF OFF OFF ON PI control
OFF OFF ON OFF P control

 Sampling cycle (TS) D1 +4


The sampling cycle (TS) refers to the cycle for retrieving the measured value (PV) for PID operation.
The relation of the sampling cycle (TS) and scan time is shown below.
1 scan 1 scan 1 scan 1 scan 1 scan 1 scan 1 scan

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

(1) Sampling cycle( )

(2) Sampling cycle( )

Setting value Merits Demerits


The life of contacts is reduced when
ON/OFF is performed in small increments,
When sampling cycle is short relays with contacts are used for
reducing the incidence of hunting.
turning a heater ON and OFF, etc.
The contact life is not reduced relatively even
When sampling cycle is long when a relay with contact is used for turning a Hunting increases.
heater ON and OFF, etc.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-143


PID Control Instruction

 Proportional constant (KP) " D1 +5"


The relationship between the measured value (PV), proportional band (P), manipulated variable upper
limit value (MVHL), and manipulated variable lower limit value (MVLL) is as follows.
EXTENDED INSTRUCTIONS

Upper limit for operating


quantity (MVHL)
32767
Proportion constant (KP)
(scope)

Upper limit for operating


quantity (MVHL)
−32768

0͠ 95͠ 100͠ 105͠ 200͠


Set value(PV)

5 Value after converted by AD converter −2048


Set value(SV)
+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
(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.

5-144 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

 Integral constant (TI) " D1 +6"


The integral constant is used to decrease the deviation between the measured value (PV) and the
setting value (SV) that occurs by action of the proportional constant (KP).
(1) Though startup is quick when a small integral

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.

 Differential constant (TD) " D1 +7" 5


The suppression effect can be made to function to reduce hunting and increase the response speed

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.

 Proportional constant 2 degree of freedom coefficient (α) D1 +8, Integral


constant 2 degree of freedom coefficient (β) D1 +9
• The characteristics of the target value filter can be adjusted.
• Overshooting can be suppressed by setting a smaller α value and larger β value, but the target
value tracking will be more gradual.
• When α=1 or β=0, the target value filter will be disabled, and the setting value after target value filter
(SVF) will be the setting value (SV).
* The set value is valid only when the 2 degree of freedom coefficient setting ( D1 +3: bit 1) is ON.
If set to OFF, α=0.4 and β=1.35 will be applied on the operation formula as the default value.

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

Setting value after target


value filter
α

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-145


PID Control Instruction

 Differential constant 2 degrees of freedom coefficient (γ) D1 +10


Normally, this is set in the range of 0 to 1/α.
When 0 is set, measured value differentiation takes place, and the effect of the differential item is
disabled when the target value is changed. Thus, fluctuations in the manipulated value can be
EXTENDED INSTRUCTIONS

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.

 Manipulated variable lower limit value (MVLL) " D1 +11"


Sets the lower limit value of the manipulated variable (MV). Be sure to set the manipulated variable
limits so that the following condition is satisfied: manipulated variable upper limit value (MVHL) >

5 manipulated variable lower limit value (MVLL)


Manipulated value exceeded ( D1 +18:bit 1) turns ON when the manipulated value is less than this
value.
Instruction
PID Control

This is valid in the automatic and manual modes. ON and OFF is controlled within this value's range
during automatic tuning.

 Manipulated variable upper limit value (MVHL) " D1 +12"


Sets the upper limit value of the manipulated variable (MV). Be sure to set the manipulated variable
limits so that the following condition is satisfied: manipulated variable upper limit value (MVHL) >
manipulated variable lower limit value (MVLL)
Manipulated value exceeded ( D1 +18:bit 1) turns ON when the manipulated value is higher than
this value.
This is valid in the automatic and manual modes. ON and OFF is controlled within this value's range
during automatic tuning.

 Manipulated variable change width limit value (∆MVL) " D1 +13"


The change width (absolute value) between the manipulated variables of the previous cycle and this
cycle is restricted to not exceed this value.
This value is applied on manipulated variables (MV) calculated by operation and the manual mode
manipulated variable (MVMAN).
When the change width exceeds this value, manipulated variable change exceeded turns ON.
Manipulated value change width exceeded ( D1 +18: bit 2) turns ON for one scan while the change
width exceeds this value.
* The set value is valid only when the manipulated value change width alarm setting ( D1 +3: bit 8) is ON.

 Measured value change width (∆PVL) D1 +14


The change width (absolute value) of the pervious cycle and current measured value is monitored (the
measured value is not limited).
If the change width exceeds this value, measured value change width exceeded ( D1 +18: bit 3)
turns ON. Even if the measured value change width exceeded turns ON, PID operation is executed
following the measured values.
* The set value is valid only when the measured value change width warning setting ( D1 +3: bit 9) is ON.

 AT adjustment parameter (τ) D1 +15


This parameter determines whether the PID constant resulting from automatic tuning is adjusted with
"priority on stability" or "priority on speed response".
If the value is increased, priority is placed on stability, and if decreased, priority is placed on speed
response.

5-146 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

 AT hysteresis (h) D1 +16


Set the hysteresis for the setting value (SV) during automatic tuning.
If the measured value (PV) fluctuates and prevents a normal limit cycle from being generated, increase
this value. Note that the automatic tuning accuracy will drop if this value is increased needlessly.

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.

 Operation status flag (input) D1 +18


The operation of the PIDAT instruction is confirmed with the bit position ON and OFF status of the
device specified with D1 +18.
5

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

Manipulated value exceeded

Manipulated value change width exceeded

Measured value change width exceeded

 Operation completed D1 +18: Bit 0


This turns ON for one scan when the operation is executed.

 Manipulated value exceeded D1 +18: Bit 1


This turns ON when the manipulated value exceeds the set manipulated value upper limit value (MVHL)
and lower limit range (MVLL). This turns OFF when the value returns to the range.

 Manipulated value change width exceeded D1 +18: Bit 2


This turns ON if a change exceeding the set manipulated value change width limit value (∆MVL)
occurs. This turns OFF when the manipulated value returns to within the limit value.

 Measured value change width exceeded D1 +18: Bit 3


This turns ON if a change exceeding the set measured value change width (∆PVL) occurs. This turns
OFF when the measured value returns to within the limit value.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-147


PID Control Instruction

 Setting value after target value filter (input) (SVF) D1 +19


This is the monitor value of the setting value (SV) after the target value filter is passed. PID operation is
executed using this value as the target value. Use this as reference when adjusting the target value
filter (proportional, integral, differential 2 degree of freedom coefficient).
EXTENDED INSTRUCTIONS

 Work area D1 +20 to D1 +51


(cannot be used)
This area is used by the PIDAT instruction so a value must not be written in.

 Manipulated value (MV) D2

The manipulated amount on the control target is stored.


Automatic mode: ................... Value calculated with PID operation
Manual mode: ........................ Value obtained by applying manipulated value change width limit
5 value (∆MVL) onto manual manipulated value
Automatic tuning: ................... Output value for ON/OFF control (manipulated value upper/lower limit)
Instruction
PID Control

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

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 a timer/counter has been specified when D1 is indirectly specified
• When a timer/counter has been specified when D2 is indirectly specified
CR2012
• When the value of the setting data and I/O data specified by D1 exceeds the allowed
specified range
• When automatic tuning ends abnormally.

* 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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-149


PID Control Instruction

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)

Inclination setting Output R500


(RAMP instruction)
Control of
heater, etc.

5 Pulse output (TPOUT instruction)


Instruction
PID Control

Time KV-5500/5000/3000
Default settings for PIDAT instruction
(Mnemonics list)

CR2008 ;* Box script line is excluded.


DM1000 = 500 ’Setting value LDP CR2007
DM1001 = 0 ’Manual manipulated value SET MR000
ON 1 scan DM1002 = 0 ’Operation control flag LDP MR000
at start of DM1003 = 0 ’Operation setting DW.S +0 DM1000
operation LD MR000
DM1004 = 1000 ’Sampling cycle
RAMP DM2000 #50 #0 DM1000
DM1005 = 1 ’Proportional constant*
LD MR000
’DM1006 = ’Integral constant*
PIDAT DM10100 DM1000 DM999
’DM1007 = ’Differential constant* LD MR000
DM1008 = 0 ’Proportional constant 2 degree of freedom coefficient TPOUT DM999 DM1012 R500
DM1009 = 0 ’Integral constant 2 degree of freedom coefficient LD MR000
DM1010 = 0 ’Differential constant 2 degrees of freedom coefficient ANP MR001
DM1011 = 0 ’Manipulated variable lower limit value SET DM1002.2
DM1012 = DM1004 ’Manipulated variable upper limit value LD DM1002.2
DM1013 = 0 ’Manipulated variable change width Restriction value OUT MR100
DM1014 = 0 ’Measured value change width LDF DM1002.2
DM1015 = 0 ’AT adjustment parameter RES MR001
DM1016 = 0 ’AT hysteresis
DM1017 = 0 ’AT timeout time
’ * When automatic tuning is completed,
’ the parameters are set automatically.

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

5-150 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


PID Control Instruction

Execution of PID operation

MR000 PIDAT
DM10100 DM1000 DM999

EXTENDED INSTRUCTIONS
ch0 Setting Manipulated
measurement value value
input value
MR000 CR2012
’PIDAT error process
Operation
execution error

Manipulated value is converted to pulse output with TPOUT instruction


The PIDAT instruction manipulated value is input in the ON time, and
the upper limit of the PIDAT instruction's manipulated value is used for
the cycle.
The lower limit of the PIDAT instruction's manipulated value is set to 0.
MR000 TPOUT
DM999 DM1012 R500
5

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.

MR000 MR001 DM1002.2


SET
AT execution
AT start/
conditions
operating
flag

DM1002.2 MR100

AT start/ In automatic
operating flag tuning

DM1002.2 MR001
RES
AT start/
AT execution
operating flag
conditions

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-151


Storage Device Instructions

Storage Device Instructions

Storage Device Instructions Overview


When the storage device instructions is used, values such as R and DM can be written to storage
(memory card or CPU memory) and values stored in storage can be readout with the ladder program.
EXTENDED INSTRUCTIONS

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™

(memory card or (Microsoft Excel etc.)


MFREE/MFREEK

5
KV-7500/7300 CPU memory)
KV-5500/5000/3000
MSTAT
KV-NC32T
Instructions
Storage Device

 What the storage device instructions can do


 Read and write data (MREAD/MWRIT instructions)
These instructions can read and write the values of R, DM, and other devices. They are also capable
of reading and writing continuous data.
 Read and write data with a non-uniform data type line by line (MREADL/MPRINT
instructions)
These instructions can read and write data with a non-uniform data type such as "serial number +
unsigned decimal data". If the text string read with the MREADL instruction is combined with the SPRIT
function, data can be easily split by "," and stored in devices.
 Create and delete folders on the storage device (memory card or CPU memory)
(MMKDIR/MRMDIR instructions)
These instructions can create folders to use for backups, create folders by date, and delete
unnecessary folders.
 Delete the files on the storage device (memory card or CPU memory) (MDEL instruction)
This instruction can delete files saved on the storage device (memory card or CPU memory) that are
no longer necessary from a ladder program.
 Rename files on the storage device (memory card or CPU memory) (MREN instruction)
This instruction can change both the file name and the extension, so you can freely change the
extension to ".txt" and ".log".
 Copy and move files (MCOPY/MMOV instructions)
These instructions can save copies of files used to change the setup as backup data and store
operation aggregate data in a separate folder.
 Check storage device (memory card or CPU memory) free space (MFREE/MFREEK
instructions)
These instructions can check the free space on the storage device (memory card or CPU memory)
and generate an alarm in advance when the space has increased. The MFREEK instruction can check
the free space in kilobytes to offer support for large capacity memory cards.
 Check storage device (memory card or CPU memory) file status (MSTAT instruction)
This instruction can check the status of a file on the storage device (memory card or CPU memory) (Is
the file read-only? What is the file size? When was the last modified time?). By checking the file before
deleting it, this instruction can provide a failsafe device against accidentally deleting the most recent file.

5-152 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Device Instructions

Storage Device Instruction List


Name Description Reference
MWRIT Saves the data for continuous devices to the memory card. 5-158

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.)

List of CPU Units/Base Units That can be Used


KV-5500/5000/3000 KV Nano Series
KV-7500/ KV-N14**
Name CPU function CPU function KV-1000
7300 KV-N24**
version 2.0 or version less KV-NC32T KV-N40**
higher than 2.0 KV-N60**
MWRIT      —
MREAD      —
MFREE      —
MMKDIR      —
MRMDIR      —
MDEL    —  —
MPRINT   — —  —
MREADL   — —  —
MCOPY   — —  —
MMOV   — —  —
MREN   — —  —
MFREEK   — —  —
MSTAT   — —  —

Reference Storage device instructions cannot be used with KV-N14**/N24**/N40**/N60**. If storage


device instructions are used, when the storage device instruction is executed while
operating, a memory card not inserted error (error code 1) is stored in CM2390, the error
codes for storage device instructions device.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-153


Storage Device Instructions

Storage device instruction usage example

■ When saving unsigned binary values, 1 word per line


EXTENDED INSTRUCTIONS

The following files are created.

Data from DM1000


Data from DM1001
Data from DM1002
Data from DM1003
Data from DM1004
Data from DM1005
Data from DM1006
Data from DM1007
Data from DM1008
5 Data from DM1009
MWRIT instruction settings
Instructions
Storage Device

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

<Reference ladder program>


(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 $0101 DM502
DW
MWRIT "ABC\MWRIT linefeed" DM1000 #10 DM500 MR001
DM501
Write mode

[01] =1 word per line, [01] = Insert new line


$0101
DW
DM502
Optional

MWRIT
"ABC\MWRIT linefeed" DM1000 #10
Folder name Save head device Amount of saved data
File name

DM500 MR001
Save format MWRIT complete

5-154 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Device Instructions

■ When saving unsigned binary values, 10 words per line


The following files are created.

Data from DM1000 to DM1009

EXTENDED INSTRUCTIONS
Data from DM1010 to DM1019
Data from DM1020 to DM1029
Data from DM1030 to DM1039
Data from DM1040 to DM1049

MWRIT instruction settings


Decimal unsigned binary values for DM1000 to DM1049 are saved to the storage device with a new
line every 10 words.
Folder: ABC File Name: MWRIT new line

<Reference ladder program>


5

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

[0A] =10 words per line, [01] = Insert new line


$0A01
DW
DM502
Optional

MWRIT
"ABC\MWRIT linefeed" DM1000 #50
Folder name Save head device Amount of saved data
File name

DM500 MR001
Save format MWRIT
instruction executed

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-155


Storage Device Instructions

■ 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

MREAD instruction settings


Folder: ABC File Name: MREAD_DATA

<Reference ladder program>

5 MR100 [4] = Decimal unsigned binary


#4
DW
(Mnemonic list)
LD MR100
Start reading DM600 DW #4 DM600
Instructions
Storage Device

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

5-156 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Device Instructions

List of Error Codes for Storage Device Instructions


The following list summarizes the error codes that are stored to CM2390 when storage device
instructions are used, and how to remedy these error codes.

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-157


MWRIT Saves device
data to the
memory card

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano (CPU


memory).

MWRIT

MWRIT Saves device data to the


MWRIT
Storage device
memory card (CPU
write
memory).

Ladder program Input mode


Execution condition
EXTENDED INSTRUCTIONS

MWRIT
S1 S2 n M W R I T S1 S2 n
D1 D2 D1 D2

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *8 - - - - -  *1    
5 S2
n


-
-


-
-
-
-
-  
-  
*8 *10 *10 - -
*8   *11 *11
-
 


- -
-






Storage Command

D1  -  - - -   *8 *10 *10 - - -  - -   


D2  -  - - -   *8 - - - - -  - -   

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.

Point • Cannot be used with KV-N14**/N24**/N40**/N60**.


• 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.

5-158 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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"

Example 16-bit data


bit bit
15 0

S2 12345 Parameter When file S1 .BIN


D1 to D1 +4
S2 +1 23456 3930A05B0787···6EB2D5DD

5
S2 +2 34567
Storage
Device

When file S1 .CSV


S2 + n -2 45678
12345, 23456, 34567,···, 45678, 56789

Storage Command
S2 + n -1 56789

32-bit data
bit bit bit bit
31 16 15 0

S2 +1 0012345678 S1 Parameter When file S1 .BIN


D1 to D1 +4 4EBC610015CD5B07D2029649···
S2 +3 0123456789 S1 +2
···3538D08B146A0ACE
S2 +5 1234567890 S1 +4 Storage
Device

When file S1 .CSV


S2 +2 ( n - 2)+1 2345678901 S2 +2 ( n - 2) 12345678, 123456789, 1234567890,··· ···,
S2 +2 ( n - 1)+1 3456789012 S2 +2 ( n - 1) 2345678901, 3456789012

ASCII text string


Number of character Number of character

S2 1 A (41H) B (42H) 2 Parameter


D1 to D1 +4
S2 +1 3 C (43H) 1 (31H) 4
When file S1 .CSV
S2 +2 5 2 (32H) 3 (33H) 6
Storage
Device "ABC123...abc...2"

n -3 a (61H) b (62H) n -2
n -1 c (63H) 1 (31H) n

1999 2 (32H ) NULL (00H)

* 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

MWRIT Only 1 scan Only 1 scan

Read process

ON
End notice ( D2 )
OFF

Read position ( D1 ) +3,+4

Number of read data ( D1 +5)


ON
CR3214
(Storage instruction executing) OFF

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-159


Storage Command

* 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)

S1 “file name" "folder\file name"

Storage Storage device Storage Storage device


Device Device
Example of
folder structure
File Folder

File

When a folder is not specified, the


Note Prepare a folder beforehand.
data is saved to the root folder.
File name: DATA Folder name: ABC File name: DATA

DM0 D(44H) A(41H) DM0 A(41H) B(42H)

DM1 T(54H) A(41H) DM1 C(43H) \ (5CH)


(Example)
When DM0 has
DM2 NULL(00H) DM2 D(44H) A(41H)
been specified
DM3 T(54H) A(41H)

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 .

D1 setting 0, 2, 4, 6 (16 bits) 1, 3, 5, 7, 9 (32 bits) 8(ASCII)


value
Setting Range 0 to 65535 0 to 32767 0 to 1999
5-160 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Storage Command

D1 : Save format setting


Data is saved in the following format.

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

Write position (" D1 +3 · D1 +4")

Holds the content of the current file, and overwrites and saves data to a position in
the file specified by the write position ( D1 +4) from the end of the file. An error
occurs if the file does not exist.
2:Write position
Example
specification mode 2
File name: ABC (data to save) File name: ABC
(offset from end of file)

Write position (" D1 +3 · D1 +4")


Deletes the content of the file and writes data. A new file is made if the file does
not exist.
Overwrite
3: New mode Example
File name: ABC (data to save) File name: ABC

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-161


Storage Command

" D1 +2": Option settings


Set line feed specification and fixed digit specification of the data to save.
EXTENDED INSTRUCTIONS

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 32-bit 16-bit 32-bit ASCII Floating real


16-bit 32-bit
Storage Command

Details saved unsigned unsigned


Hex Hex signed BIN signed BIN Text string number
BIN BIN
Number of digits 4 8 5 10 6 11 - 13

Reserved ("0" is set.)

KV-7500/7300/5500/5000/3000, KV Nano Series


0 : Line feed (for CSV file export, line feeding (not including the
file end) is performed.)
1 255 Line feeding at the specified comma.
* D1 Line feeding cannot effected when 0, 1, or 8 is specified.
*When KV-1000, 0 is set.

" D1 +3", " D1 +4": Write position (file index) setting


file index ............................................. Position separated in 1-byte units from the start of the stored file
16-bit BIN data
TEST1.BIN 0 1 0 0 0C 0 0 7 B 0 0 D2 0 4 3 9 3 0 A 0 5 B 0 7 8 7 6 EB 2 D 5 DDF F F F

16-bit data
TEST1.CSV 1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
(31H) (2CH) (31H) (32H) (2CH) (31H) (32H) (33H) (2CH) (31H) (32H) (33H) (34H) (2CH) (31H) (32H) (33H) (34H) (35H) (2CH)

ASCII
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)

file index position $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F $10 $11 $12 $13 $14

" 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 .

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-163


Storage Command

Point Pay attention to the following when specifying the position to write to.
When specifying the pointer in the data

Data type Inserted data Before writing After writing


EXTENDED INSTRUCTIONS

BIN
format

CSV a b c " A B C D E F G H " A " a b c " , H


format (61H) (62H) (63H) (22H) (41H) (42H) (43H) (44H) (45H) (46H) (47H) (48H) (22H) (41H) (22H) (61H) (62H) (63H) (22H) (2CH) (48H)

…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

Example File name: ABC S2 S2 +39


Free space (for 100 characters) NULL
Text string data of 40 characters + NULL 40
File name: ABC
40 characters
8. ASCII text string 40
Example File name: ABC S2 S2 +39
Free space (for 30 characters) NULL
Text string data of 40 characters + NULL Size exceeded 30
File name: ABC
30 characters 10

Notification bit device ( D2 :completion notification, " D2 +1": error notification)

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.

5-164 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

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 text string specified by S1 does not contain the end code (NULL)
• When the text string specified by S1 exceeds 247 characters (including NULL)
• When a timer/counter has been specified by indirect specifying to S1
CR2012 • When a device other than the leading device of the channel is specified when a bit device is
specified to S1 , S2 and D1
• 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

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-165


Storage Command

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

CR2008 R1004 (Mnemonics list)


(1)
RES LD CR2008
1 scan ON
RES R1004
R1000 R1004 #6 LDP R1000
DW (2) ANB R1004
DM500 DW #6 DM500
#0 DW #0 DM501
DW (3) DW #0 DM502
DM501 MWRIT "ABC\DATA" DM1000 #100 DM500 R1004
#0 LD R1004
DW (4) SET R500
DM502 CON

5
RES R1004
MWRIT
"ABC\DATA" DM1000 #100 (5)
DM500 R1004
Storage Command

R1004 R500 R1004


SET RES (6)

(1) The completion notification device is reset to its initial state.

(2) DM500 : Save format


singed 16-bit BIN, CSV file

(3) DM501: Write mode


Add mode

(4) DM502: Option


Insert a comma at end of data, and change number of data digits.

(5) Start of save <folder>: ABC <file name>: DATA


<save device>: DM1000 to DM1099 (100 devices)
<completion notification>: R1004 <error notification>: R1005

(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 extension (.csv) is added automatically

DM1000 to DM1099 are stored laterally.


As the new line option is not being used, when R1000 is
turned ON 2 times or more, the data is added laterally.

5-166 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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)

CM703 DM3 STA DM0


LDA TBCD ASC STA (5) MRD
calendar timer (Hour)
LDA CM701

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

CR2008 R1004 R1006


RES RES (1)
1 scan ON
LD CR2008
RES R1004
R1000 R1004 CM700 DM0 CON
(2)
LDA TBCD ASC STA RES R1006
calendar timer (Year)
LDP R1000
CM701 DM1 ANB R1004
LDA TBCD ASC STA (3) MPS
calendar timer (Month)
LDA CM700
CM702 DM2 CON
LDA TBCD ASC STA (4) TBCD
calendar timer (Day)
CON
$0 DM3 ASC
LDA STA (5) CON
STA DM0

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-169


MREAD
Rea
ds

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano devi


ce
dat
PIDs
a
fro
m
me

Reads device data from


mor
MREAD y

MREAD
car
d

Storage readout memory card (CPU


(CP
U
me
mor

memory). y).

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition MREAD


S D1 n M R E A D S D1 n
D2 D3 D2 D3

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *8 - - - - -  *1    
5 D1
n


-
-


-
-
-
-
-   *10 *10 -
-   *8   *11 *11
- -


 
- -
-






Storage Command

D2  -  - - -   *8 *10 *10 - - -  - -   


D3  -  - - -   *8 - - - - -  - -   

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.

Point • Cannot be used with KV-N14**/N24**/N40**/N60**.


• Use half-width and full-width characters to create distinct file names (capital letters and
lower case letters are not differentiated between).
5-170 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Storage Command

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"

Example 16-bit data


bit bit
15 0

When file S .BIN Parameter

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 .BIN Parameter D1 +1 0012345678 D1


4EBC610015CD5B07D2029649··· D2 to D2 +4
D1 +3 0123456789 D1 +2
···3538D08B146A0ACE
D1 +5 1234567890 D1 +4
Storage
Device


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)

ASCII text string*


Parameter
D2 to D2 +4 Number of character Number of character
When file S .CSV
D1 1 A(41H) B(42H) 2
Storage "ABC" , "123", , "abcz"
Device D1 +1 3 C(43H) NULL(00H) 4

* 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

MREAD Only 1 scan Only 1 scan

Read process

ON
End notice ( D3 )
OFF

Read position ( D2 ) +3, +4

Number of read data ( D2 +5)


ON
CR3214
(Storage instruction executing) OFF

* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is
OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/access
processing time.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-171


Storage Command

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

code NULL(00H) and folder name).

S “file name" "folder name\file name"

Storage Storage device Storage Storage device


Device Device
Example of
folder File Folder
structure
File

File name: DATA Folder name: ABC File name: DATA

DM0 D(44H) A(41H) DM0 A(41H) B(42H)

(Example) DM1 T(54H) A(41H) DM1 C(43H) \ (5CH)


When DM0
has been DM2 NULL(00H) DM2 D(44H) A(41H)
specified
DM3 T(54H) A(41H)

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 .

D2 setting 0, 2, 4, 6 (16 bits) 1, 3, 5, 7, 9 (32 bits) 8(ASCII)


value
n setting
0 to 65535 0 to 32767 0 to 1999*
range

* When reading an ASCII text string, specify a value larger than the maximum number of characters
in the text string enclosed with (").

5-172 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

D2 :Read format setting


Sets the read format of the file. (Set the format of the file saved on storage device.)

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")

" D2 +2": Reserved for system


Sets "0".

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-173


Storage Command

" D2 +3", " D2 +4": Read position (file index) setting


file index.......................Position separated in 1-byte units from the start of the stored file
EXTENDED INSTRUCTIONS

16-bit BIN data


TEST1.BIN 0 1 0 0 0C 0 0 7 B 0 0 D2 0 4 3 9 3 0 A 0 5 B 0 7 8 7 6 EB 2 D 5 DDF F F F

16-bit data
TEST1.CSV 1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
(31H) (2CH) (31H) (32H) (2CH) (31H) (32H) (33H) (2CH) (31H) (32H) (33H) (34H) (2CH) (31H) (32H) (33H) (34H) (35H) (2CH)

ASCII
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)

file index position $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F $10 $11 $12 $13 $14

" 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

5-174 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

D2 +5: Number of read data


The number of data actually read from the storage device are stored after read processing is
completed.

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

40 characters of data + NULL read


8. ASCII text string 40
Example File name: ABC D1 D1 +29
30 characters of data NULL
30

30 characters of data + NULL read

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-175


Storage Command

Notification bit device ( D3 :completion notification, D3 +1: error notification)

Item Description
This device turns OFF when execution of the instruction starts, and turns
EXTENDED INSTRUCTIONS

Completion ON when read processing to the memory card ends.


D3
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
D3 +1
notification when execution ends in error.

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

line feed at the end of the data is skipped.)


• During a CSV file read, reading of empty fields (e.g. sections with continuous commas
",") is skipped, and device data is not stored. The data to be read next is stored to the
next device (not skipped devices). During this operation, skipped data is counted as the
number of data.
• The result of END processing after execution of the instruction is completed is written for
the read position, number of read data, completion notification, and error notification.
• When a text string contains two continuous double quotation marks ("), the double
quotation marks are read as a single character.
• Individual double quotation marks in a text string (including before and after the text
string) are ignored.
Example " 1 2 " " A B " " 3 4 5 " 1 2 " A B " 3 4 5 (NULL)
• File names are automatically appended with an extension according to the read format
setting.
• Several scans are sometimes required for reading to the device. During execution of
the MREAD instruction, data values read from the memory card are written in order to
the start of the specified device.
For this reason, do not read data in a range of devices that have been processed by the
MREAD instruction before the completion notification bit device turns ON.
The portion of data in some cases may not be reflected. In order to prevent this, please
implement exclusive control by using the completion notice D3 or CR3214 (Storage
instruction executing).
• When CR3214 is ON during the execution of storage device instructions, MREAD
command can not be executed. Therefore, it is necessary to implement exclusive
control by using CR3214 as follows.

RXXXXX CR3214 MREAD


S D1 n

D2 D3

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).
5-176 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Storage Command

Operation flag

CR2009 No change in state


CR2010 No change in state

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

* The instruction is not executed when CR2012 turns ON. 5


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to CM5176.

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.

CR2008 R1004 (Mnemonics list)


RES (1)
LD CR2008
1 scan ON
RES R1004
R1000 R1004 #6 LD R1000
DW (2) ANB R1004
DM500 DW #6 DM500
#0 DW #0 DM501
DW (3) DW #0 DM502
DM501 MREAD "ABC\DATA" DM1000 #100 DM500 R1004
#0 LD R1004
DW (4) SET R500
DM502 CON
RES R1004
MREAD
"ABC\DATA" DM1000 #100 (5)
DM500 R1004
R1004 R500 R1004
SET RES (6)

(1) The completion notification device is reset to its initial state.


(2) DM500: Read format
signed 16-bit BIN, CSV file
(3) DM501: Read mode
Regular mode
(4) DM502: Reserved for system
Set to "0"
(5) Start of read <folder>: ABC <file name>: DATA
<number of read data>: 100 <save device>: DM1000 onwards
<completion notification>: R1004 <error notification>: R1005
(6) Process completion output is turned ON and completion notice device is reset.
* Input "0: \ABC\" or "1: \ABC\" for the KV-7000 Series. (If 0: \ is not input, data will be written to the
memory card.)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-177


MFREE Gets the
free
space on

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the


memory
card
MFREE
(CPU
memory)
by byte

For the KV-7000 Series


unit.

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

Ladder program Input mode


Execution condition MFREE
n D1 D2 M F R E E n D1 D2

KV-5500/5000/3000 KV-1000 KV Nano

5 Ladder program
Execution condition MFREE
Input mode

D1 D2 M F R E E D1 D2
Storage Command

Available Devices ( ): Not supported on the KV-1000


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)
n(-*5) ○ − ○ − − − ○ ○ ○ ○ ○ − − ○ ○ ○ − ○ ○ ○

D1 ○ − ○ − − − ○ ○ ○*4 ○*6 ○*6 − − − ○ − − ○ ○ ○

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.

Point Cannot be used with KV-N14**/N24**/N40**/N60**.

5-178 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

Remaining capacity write ( D1・ D1 + 1 )


ON
CR3214
(Storage instruction executing) OFF

Notification bit device ( D2 : completion notification, " D2 +1": error notification)

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-179


Storage Command

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


This flag is ON in the following instances. Otherwise, it is OFF.
• When a non-channel leading relay is specified in D1 .
CR2012 • When the indirect specifying or index modification range is inappropriate
Does not change when indirect specifying or index modification is not specified to the
operand.

* The instruction is not executed when CR2012 turns ON.


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.
5 "CR/CM List" (Page A-71)
Storage Command

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

(1) Resets the completion notification device to its initial state.


(2) Acquisition of free space <save device>: DM1000·DM1001
<completion notification>: R1004 <error notification>: R1005
(3) Process completion output is turned ON and completion notice device is reset.

5-180 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

MEMO

EXTENDED INSTRUCTIONS
5

Storage Command

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-181


MMKDIR
Mak
es a

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano dire


ctor
MFREE y on
the
me
mor

MMKDIR
Creating storage Makes a directory on the
y

MMKDIR card
(CP
U

folder memory card (CPU memory).


me
mor
y).

Ladder program Input mode


Execution condition MMKDIR
S D M M K D I R S D
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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 - - - - -  *1    
D  -  - - -   *4 - - - - -  - -   

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"

Example S "Folder A" "Folder A\Folder B"

Storage Storage device Storage Storage device


Device Device
Example of
Folder A Folder A
folder structure

Folder B

When a folder already exists,


nothing happens, processing ends Prepare a new folder (folder A) in advance. It
Note
successfully, and the completion cannot be prepared together with folder B.
notification relay turns ON.

5-182 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

* Directory creation processing is executed regardless of program. Accordingly, if the instruction is


being executed once at a certain scan, execution of directory creation processing is continued
even if the input condition is OFF at the next scan.

Notification bit device ( D : completion notification, D +1: error notification) 5

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

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 text string specified by S does not contain the end code (NULL)
• When the text string specified by S exceeds 247 characters (including NULL)
CR2012 • When a timer/counter is specified to S by indirect specifying
• When a device other than the leading device of the channel is specified when a bit device is
specified to S
• When the indirect specifying and index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-183


Storage Command

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

R500 after processing is completed.


(Mnemonics list)
CR2008 R1004
RES (1) LD CR2008
1 scan ON RES R1004
R1000 R1004 LD R1000
MMKDIR ANB R1004
DM1000 R1004 (2)
MMKDIR DM1000 R1004
LD R1004
R1004 R500 R1004 SET R500
SET RES (3) CON
RES R1004

5 (1) The completion notification device is reset to its initial state.


(2) The folder is made.
Storage Command

(3) Processing completion output is turned ON. The completion notification device is reset.

5-184 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

MEMO

EXTENDED INSTRUCTIONS
5

Storage Command

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-185


MRMDIR
Delet
es

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the


speci
fied
MRMDIR
folder
in the
mem

MRMDIR
ory

MRMDIR Storage device Deletes the specified folder in the card


(CPU
mem

folder is deleted memory card (CPU memory).


ory).

Ladder program Input mode


Execution condition MRMDIR
S D M R M D I R S D
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *5 - - - - -  *1    
D  -  - - -   *5 - - - - -  - -   

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

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.

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
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"

When the folder specified by S doesn't exist


" D +1" turns to ON, and 3 (the file or folder doesn't exist) is stored in CM2390.

When the folder specified by S contains files or folders


All the files or folders contained in this folder are cleared, then the specified folder is cleared.

5-186 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

Operation flag

CR2009 No change in state


CR2010 No change in state

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

* The instruction is not executed when CR2012 turns ON.


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)
5

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".

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-187


MDEL Delete
specified

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano files


memory
card
in

MDEL (CPU
memory).

MDEL
MDEL Deletion of storage Delete specified files in
device files memory card (CPU memory).

Ladder program Input mode


Execution condition MDEL
S D M D E L S D
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *5 - - - - -  *1    
D  -  - - -   *5 - - - - -  - -   

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.

Point • Cannot be used with KV-N14**/N24**/N40**/N60**.


• Use half-width and full-width characters to create distinct file names (capital letters and
lower case letters are not differentiated between).

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"

When the folder specified by S doesn't exist


" D +1" turns to ON, and 3 (the file or folder doesn't exist) is stored in CM2390.

5-188 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

Operation flag

CR2009 No change in state


CR2010 No change in state

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

* The instruction is not executed when CR2012 turns ON.


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)
5

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".

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-189


MPRINT Writes
the text
string

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano into


end
the
of
the file in
MPRINT
the
memory
card

Writes the text string into the end


(CPU me
mory).

MPRINT MPRINT Storage device


of the file in the memory card
text string write
(CPU memory).

Ladder program Input mode


Execution condition MPRINT
EXTENDED INSTRUCTIONS

S1 S2 D M P R I N T S1 S2 D

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *3 - - - - -  *1    
S2  -  - - -   *3 - - - - -  *1    
D  -  - - -   *3 - - - - -  - -   
5 Operand Explanation
Storage Command

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).

5-190 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

When the text string "2010/06/07,22:36:01,No.15,AB123BCD" is stored in 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 + 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

• This instruction cannot be used in interrupt programs or in the initialization module.

Scan
ON

Execution Condition
OFF

MPRINT Only 1 scan Only 1 scan

Write process

ON
CR3214
(Storage instruction
OFF
executing)

* Directory creation processing is executed regardless of program. Accordingly, if the instruction is


being executed once at a certain scan, execution of directory creation processing is continued
even if the input condition is OFF at the next scan.
The time for the actual read process to finish depends on the data capacity and file access process time.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-191


Storage Command

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

S1 "File name" "Folder name\file name"

Storage Storage device Storage Storage device


Device Device
Example of
File
folder structure Folder

File

If a folder is not specified, the data


Point Create the folder beforehand.
will be stored in the root folder.
5 File name:DATA.TXT Folder name: ABC File name: DATA.TXT

DM0 D(44H) A(41H) DM0 A(41H) B(42H)


Storage Command

DM1 T(54H) A(41H) DM1 C(43H) \ (5CH)

(Example) DM2 .(2EH) T(54H) DM2 D(44H) A(41H)


When DM0 is
specified
DM3 X(58H) T(54H) DM3 T(54H) A(41H)
DM4 NUL(00H) DM4 .(2EH) T(54H)
DM5 X(58H) T(54H)
DM6 NUL(00H)

Notification bit device ( D : completion notification, D +1: error notification)

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

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 there is no end code (NUL (00H)) in the text string specified with S1 or S2
• When the text string (including end code) specified with S1 exceeds 247 characters
CR2012
• When the text string (including end code) specified with S2 exceeds 2000 characters
• When a timer counter or relay other than the channel's leading relay is specified for S1 or S2
• When the indirect specification or index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON.


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)

5-192 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

Text string stored in data memory from DM0


5
Memory
Card

Storage Command
2010/06/07, 22:36:01, No.16, AB1238CD

2010/06/07, 18:15:58, No.12, AB1234CD DM0 2(32H) 0(30H)


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

"Product information.TXT" before instruction is executed


DM15 3(33H) 8(38H)
DM16 c(43H) D(44H)
DM17 NUL(00H) NUL(00H)

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
2010/06/07, 21:31:22, No.15, AB1237CD
2010/06/07, 22:36:01, No.16, AB1238CD

"Product information.TXT" after instruction is executed

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).

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-193


MREADL Only
one line
of the

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano file


the
memory
in

MREADL
card
(CPU
memory

Read one line Only one line of the file in the


) is read
out.

MREADL MREADL
of storage
device
memory card (CPU memory)
is read out.

Ladder program Input mode


Execution condition MREADL
EXTENDED INSTRUCTIONS

S D1 D2 D3 M R E A D L S D1 D2 D3

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *6 - - - - -  *1    
D1  -  - - -   *6 - - - - -  -    
D2  -  - - -   *6 *8 *8 - - -  - -   
5 D3  -  - - -   *6 - - - - -  - -   
Storage Command

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).

5-194 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-195


Storage Command

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

S "File name" "Folder name\file name"

Storage Storage device Storage Storage device


Device Device
Example of
File Folder
folder structure

File

File name:DATA.TXT Folder:ABC File name:DATA.TXT

5 DM0 D(44H) A(41H) DM0 A(41H) B(42H)


DM1 T(54H) A(41H) DM1 C(43H) \ (5CH)
Storage Command

(Example) DM2 .(2EH) T(54H) DM2 D(44H) A(41H)


When DM0 is
specified
DM3 X(58H) T(54H) DM3 T(54H) A(41H)
DM4 NUL(00H) DM4 .(2EH) T(54H)
DM5 X(58H) T(54H)
DM6 NUL(00H)

D2 , D2 +1: Read position (file index) setting


File index ...................Position limited in one byte unit from leading data of stored file

1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
(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).

5-196 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

Ex: 1 File index position

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 Example File name: ABC.TXT


$8
Text string to read out CR(0DH)

$0

Read from specified position counted from start of file.


Example For $1
File name: ABC.TXT
Text string to read out CR(0DH) $8

5
$1 to $0 $1
For $2
File name: ABC.TXT
Text string to read out CR(0DH) $8

Storage Command
$0 $2

D2 +2: Read upper limit bytes setting


Set the upper limit bytes of the data to read out.

Setting range: 1 to 1999

• If 0 is set, the setting will be handled as 1999.


• If a line return code (CR (0DH), LF (0AH), CR+LF) appears before the set number of upper limit
bytes is reached, the reading will end at that point.

D2 +3: Reserved for system


Set 0.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-197


Storage Command

Notification bit device ( D3 to D3 +3)

Item Description
This device turns OFF when execution of the instruction starts, and turns
EXTENDED INSTRUCTIONS

Completion ON when reading from the memory card is completed.


D3
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
D3 +1
notification when execution ends in error.
After one line is read in, the system judges whether the file end has been
File end
D3 +2 reached. This device turns ON if the file end is reached, and turns OFF if
notification
the file end is not reached.
No line return This device turns ON if there is no line return code within the read upper
D3 +3 code limit bytes, and turns OFF if there is a line return code.
5 notification
Storage Command

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

Operation flag

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 there is no end code (NUL (00H)) in the text string specified with S
• When the text string (including end code) specified with S exceeds 247 characters
• When [ D2 +2] value is 2000 or higher
CR2012 • When a timer counter or relay other than the channel's leading relay is specified for S
• When a timer counter or relay other than the channel's leading relay is specified for D1 or
D2
• When the D1 +[ D2 +2] is not within the device range
• When the indirect specification or index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON.


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)

5-198 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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.

MR000 #10 #1999 #0 (Mnemonics list)


DW.D DW DW LDP MR000
DM200 DM202 DM203 DW.D #10 DM200
MR000 MREADL CON
“DATA.csv” DM0 DM200 MR100 DW #1999 DM202
CON
DW #0 DM203
MR100 MR101 R500
LDP MR000
SET MREADL "DATA.csv" DM0 DM200 MR100
LD MR100
AND MR101
SET R500
5

Storage Command

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-199


MCOPY A file in
the

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano memor


y
(CPU
card

MCOPY memor
y) is
copied.

MCOPY MCOPY Copy file in storage A file in the memory card


device (CPU memory) is copied.

Ladder program Input mode


Execution condition MCOPY
S1 S2 S3 D M C O P Y S1 S2 S3 D
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *6 - - - - -  *1    
S2  -  - - -   *6 - - - - -  *1    
S3  -  - - -   *6 *8 *8 *9 *9    -   
D  -  - - -   *6 - - - - -  - -   
5 Operand Explanation
Storage Command

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.

5-200 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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).

Item S1 Copy source: DM0 S2 Copy destination:

Folder name: ABC File name: DATA.csv


DM50
Folder name: XYZ File name: TEST.csv 5
DM0 A(41H) B(42H) DM0 X(58H) Y(59H)

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)

Memory Memory card Memory Memory card


Card Card

Folder name: ABC Folder name: ABC

File name: DATA.csv File name: DATA.csv

Folder name: XYZ Folder name: XYZ

File name: TEST.csv


<MCOPY execution>
When copying to a different storage (Only KV-7500/7300 can be used)

Memory Memory card CPU memory


Card

Folder name: ABC Folder name: XYZ

File name: DATA.csv File name: TEST.csv

Folder name: ABC

File name: DATA.csv


<MCOPY execution>

* 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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-201


Storage Command

Scan
ON

Execution Condition
OFF
EXTENDED INSTRUCTIONS

MCOPY Only 1 scan Only 1 scan

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.

S3 : Copy format setting


Settings related to copying are specified.

bit bit
15 S3 0

0: If a file with the same name is found at the copy


destination, the file is overwritten and saved.
1: If a file with the same name is found at the copy
destination, the process ends with an error
without overwriting the file.
0: The subfolder is not the copy target.
1: The subfolder is the copy target.
* The bit 1 configuration is only valid when
copying over storage (memory card ⇔ CPU
memory).

Reserved for system

5-202 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

Notification bit device ( D :Completion notification, D +1:Error notification)

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.

Point • It may take several scans for the copying to finish.


• 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
5

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

Operation flag

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 there is no end code (NUL (00H)) in the text string specified with S1 or S2
• When the text string (including end code) specified with S1 or S2 exceeds 247
CR2012 characters
• When a timer counter or relay other than the channel's leading relay is specified for S1 or
S2
• When the indirect specification or index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-203


Storage Command

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

turns ON if an error occurs.


(Mnemonics list)
MR000 SMOV LDP MR000
"ABC\DATA.csv" DM0 SMOV "ABC\DATA.csv" DM0
SMOV "XYZ\TEST.csv" DM100
MCOPY DM0 DM100 #0 MR100
SMOV LD MR100
"XYZ\TEST.csv" DM100 AND MR101
SET R500
MCOPY
DM0 DM100 #0 MR100

5 MR100 MR101 R500


SET
Storage Command

Memory card (files can also


Memory Memory card Memory
Card Card be moved to CPU memory)

Folder name:ABC Folder name:ABC

File name:DATA.csv File name:DATA.csv

Folder name:XYZ Folder name:XYZ

File name:TEST.csv

Copied file

5-204 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

MEMO

EXTENDED INSTRUCTIONS
5

Storage Command

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-205


MMOVA file in the memory card
(
C

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano P


U

MMOV
m
e
m

MMOV
Move file in A file in the memory card
o

MMOV r
y
)

storage device (CPU memory) is moved. i


s
m
o
v
e
d
.

Ladder program Input mode


Execution condition MMOV
S1 S2 S3 D M M O V S1 S2 S3 D
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *6 - - - - -  *1    
S2  -  - - -   *6 - - - - -  *1    
S3  -  - - -   *6 *8 *8 *9 *9    -   
D  -  - - -   *6 - - - - -  - -   
5 Operand Explanation
Storage Command

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.

5-206 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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).

Item S1 Copy source: DM0 S2 Copy destination:

Folder name: ABC File name: DATA.csv


DM50
Folder name: XYZ File name: TEST.csv 5
DM0 A(41H) B(42H) DM0 X(58H) Y(59H)

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)

Memory Memory card Memory Memory card


Card Card

Folder name: ABC Folder name: ABC

File name: DATA.csv

Folder name: XYZ Folder name: XYZ

File name: TEST.csv

<MMOV execution>
When migrating to a different storage (Only KV-7500/7300 can be used)

Memory Memory card Memory Memory card


Card Card

Folder name: ABC Folder name: XYZ

File name: DATA.csv

Folder name: XYZ


CPU memory

Folder name: ABC

File name: DATA.csv

Folder name: DEF

<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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-207


Storage Command

Scan
ON

Execution Condition
OFF
EXTENDED INSTRUCTIONS

MMOV Only 1 scan Only 1 scan

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.

S3 : Move format setting


Settings related to file move are specified.

bit bit
15 S3 0

0: If a file with the same name is found at the move


destination, the file is overwritten and saved.
1: If a file with the same name is found at the move
destination, the process ends with an error witho
overwriting the file.

0: The subfolder is not a migration target.


1: The subfolder is a migration target.
* The bit 1 configuration is only valid when
migrating over storage (memory card ⇔ CPU
memory).

Reserved for system

5-208 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

Notification bit device ( D :Completion notification, D +1:Error notification)

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.

Point • It may take several scans for the moving to finish.


• The result of END processing after execution of the instruction is completed is written
for the notification bit device.

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

Operation flag

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 there is no end code (NUL (00H)) in the text string specified with S1 or S2
• When the text string (including end code) specified with S1 or S2 exceeds 247
CR2012 characters
• When a timer counter or relay other than the channel's leading relay is specified for S1 or
S2
• When the indirect specification or index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON.


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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-209


Storage Command

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

turns ON if an error occurs.


(Mnemonics list)
MR000 SMOV LDP MR000
"ABC\DATA.csv" DM0 SMOV "ABC\DATA.csv" DM0
SMOV "XYZ\TEST.csv" DM100
MMOV DM0 DM100 #0 MR100
SMOV LD MR100
"XYZ\TEST.csv" DM100 AND MR101
SET R500
MMOV
DM0 DM100 #0 MR100

5 MR100 MR101 R500


SET
Storage Command

Memory Memory card Memory Memory card (files can also


Card Card be moved to CPU memory)

Folder name:ABC Folder name:ABC

File name:DATA.csv

Folder name:XYZ Folder name:XYZ

File name:TEST.csv

Moved file

5-210 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

MEMO

EXTENDED INSTRUCTIONS
5

Storage Command

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-211


MREN Change the
file name
(folder

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano name)


the
memory
in

MREN
card (CPU
memory).

Change the file name (folder


MREN
MREN Rename file in
name) in the memory card
storage device
(CPU memory).

Ladder program Input mode


Execution condition MREN
EXTENDED INSTRUCTIONS

S1 S2 D M R E N S1 S2 D

Available Devices ( ): Not supported on the KV-1000


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)
S1  -  - - -   *5 - - - - -  *1    
S2  -  - - -   *5 - - - - -  *1    
D  -  - - -   *5 - - - - -  - -   
5 Operand Explanation
Specifies the name of the file to be renamed ((drive No. +)*6 folder name + file name + end code
Storage Command

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).

5-212 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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)

If a folder name is specified in S1 , the S1 folder name will be changed to the


S2 folder name.

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

DM0 A(41H) B(42H) DM50 T(54H) E(45H)


DM1 C(43H) \ (5CH) DM51 S(53H) T(54H)
(Example) DM2 D(44H) A(41H) DM52 .(2EH) c(63H)
When S1 : DM0 and DM3 T(54H) A(41H) DM53 s(73H) v(76H)
S2 : DM50 are specified
DM4 .(2EH) c(63H) DM54 NULL(00H)

DM5 s(73H) v(76H)


DM6 NULL(00H)

Memory Memory card Memory Memory card


Card Card

Folder name: ABC Folder name: ABC

File name: DATA.csv File name: TEST.csv

<MREN execution>

Scan
ON

Execution Condition
OFF

MREN Only 1 scan Only 1 scan

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-213


Storage Command

Notification bit device ( D :Completion notification, D +1:Error notification)

Item Description
The device turn OFF when the instruction execution starts, and turns ON
EXTENDED INSTRUCTIONS

Completion when change 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.

Point • It may take several scans for the changes to finish.


• The result of END processing after execution of the instruction is completed is written
for the notification bit device.

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
Storage Command

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• If another file of the same name is already in the folder, it will not be overwritten. Error
code 4 (file already exists) will be written in CM2390.

Operation flag

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 there is no end code (NUL (00H)) in the text string specified with S1 or S2
• When the text string (including end code) specified with S1 or S2 exceeds 247
CR2012 characters
• When a timer counter or relay other than the channel's leading relay is specified for S1 or
S2
• When the indirect specification or index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON.


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)

5-214 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

MR100 MR101 R500


SET

Storage Command
Memory Memory card Memory Memory card
Card Card

Folder name: ABC Folder name: ABC

File name: DATA.csv File name: TEST.csv

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-215


MFREEK Gets the
free
space

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano on


memory
card
the

MFREEK
(CPU
memory)
by

For the KV-7000 Series


kilobyte
unit.

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

Ladder program Input mode


Execution condition MFREEK
n D1 D2 M F R E E K n D1 D2

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

Available Devices ( ): Not supported on the KV-1000


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)
n(-*5) ○ − ○ − − − ○ ○ ○ ○ ○ − − ○ ○ ○ − ○ ○ ○

D1 ○ − ○ − − − ○ ○ ○*4 ○*6 ○*6 − − − ○ − − ○ ○ ○

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).

5-216 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

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

Only 1 scan Only 1 scan


5

Storage Command
Capture process

ON

End notice D2
OFF

Remaining capacity write ( D1・D1 + 1 )


ON
CR3214
(Storage instruction executing) OFF

Notification bit device ( D2 : completion notification, " D2 +1": error notification)

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

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-217


Storage Command

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


This flag is ON in the following instances. Otherwise, it is OFF.
• When a non-channel leading relay is specified in D1 .
CR2012 • When the indirect specifying or index modification range is inappropriate
Does not change when indirect specifying or index modification is not specified to the
operand.

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to
CM5176.

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

5-218 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

MEMO

EXTENDED INSTRUCTIONS
5

Storage Command

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-219


MSTAT Gets the
status of
the files in

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the


memory
card (CPU
MSTAT
memory).

Get status of Gets the status of the files in


MSTAT MSTAT
storage device
files
the memory card (CPU
memory).
Ladder program Input mode
Execution condition MSTAT
S D1 D2 M S T A T S1 D1 D2
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *6 - - - - -  *1 -   
D1  -  - - -   *6 - - - - -   -   
D2  -  - - -   *6 - - - - -  - -   

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"

5-220 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

File status storage ( D1 to D1 +9)

Device storing Details of retrieval


retrieval results

EXTENDED INSTRUCTIONS
File attribute

Bit position Details


0 ON when read-only file
1 ON when hidden file
D1 2 ON when system file
3 ON when disk drive volume label
4 ON when directory
5 ON when archive
6 to15 (Reserved: fixed to 0)

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.

Point • It may take several scans to complete the retrieval process.


• The notification bit device is written as the result of the END process when execution of
the process is completed.
• When an indirect specification or index modification is specified for the notification bit
device, the storage destination is the storage destination current at the rising edge of
the execution conditions.
• The MSTAT instruction cannot be executed if CR3214 is ON when the storage device
instruction is being executed. The following type of exclusive control must be executed
using CR3214 in this case.
Example
RXXXXX CR3214 MSTAT
S D1 D2

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-7000 series, it can be executed without the
\ (backslash).

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-221


Storage Command

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


Turns ON when one of the following conditions is established. Otherwise, OFF.
• When there is no end code (NUL (00H)) in the text string specified with S
• When the text string (including end code) specified with S exceeds 247 characters
CR2012
• When a timer counter or relay other than the channel's leading relay is specified for S
• When a relay other than the channel's leading relay is specified for D1
• When the indirect specification or index modification range is inappropriate

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to

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

MR100 MR101 R500


SET

DM100 File attribute


DM101 (Reserved)
DM102
File size
DM103
File status
DM104 Time of final change: Year (0 to 99)
Memory
Card DM105 Time of final change: Month (1 to 12)
DM106 Time of final change: Date (1 to 31)
DM107 Time of final change: Hour (0 to 23)
DM108 Time of final change: Minute (0 to 59)
DM109 Time of final change: Second (0 to 59)

5-222 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Storage Command

MEMO

EXTENDED INSTRUCTIONS
5

Storage Command

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-223


Access Window Instructions
AWNUM Display user
message 1 in

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano access window.

AWNUM

AWNUM
Display user message 1 in
AWNUM Display user message 1
access window.

Ladder program Input mode


Execution condition S
AWNUM A W N U M S
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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  -  - - -   *2        -   -

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

CR2009 No change in state


CR2010 No change in state

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.

* The instruction is not executed when CR2012 turns ON.


KV-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 5

Instructions
Access Window
When relay R1000 is ON, value 10 will be displayed in access window.

#10 (Mnemonics list)


R1000
AWNUM LD R1000
AWNUM #10

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-225


AWMSG Display user
message 2 in
access window.

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


AWMSG

AWMSG
Display user message 2 in
AWMSG Display user message 2
access window.

Ladder program Input mode


Execution condition S
AWMSG A W M S G S
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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 - - - - -  *2    

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.

5-226 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Access Window Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

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

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300/5500/5000/3000 When CR2012 is ON, detailed error information is stored into CM5150 to
CM5176. 5
KV Nano Series When CR2012 is ON, detailed error information is stored into CM2250 to CM2276.

Instructions
Access Window
"CR/CM List" (Page A-71)

Sample Program
When relay R1000 is ON, "Emergency Stop!!" will be displayed in access window.

"Emergency Stop!!" (Mnemonics list)


R1000
AWMSG LD R1000
AWMSG "Emergency Stop!!"

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-227


AWSHOW Display

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano user


message
in access
window.

MSTAT

Display user message in


AWSHOW AWSHOW Display user message
access window.

Ladder program Input mode


Execution condition AWSHOW
S A W S H O W S
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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 ○ − ○ − − − ○ ○ ○ ○ ○ − − ○ ○ ○ − ○ ○ −

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.

5-228 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Access Window Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

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

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300 When CR2012 is ON, detailed error information is stored into CM5150 to CM5176.

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-229


AWHIDE

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Hid


e
the
use

MSTAT r
mes
sag

Hide the user message being


AWHIDE
e
bei

AWHIDE Hide user message ng

displayed in access window.


dis
play
ed
in
acc
ess
win
dow
.

Ladder program Input mode


Execution condition AWHIDE
S A W H I D E S
EXTENDED INSTRUCTIONS

Available Devices ( ): Not supported on the KV-1000


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 ○ − ○ − − − ○ ○ ○ ○ ○ − − ○ ○ ○ − ○ ○ −

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

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.
CR2012 • When the indirect specification or index modify range is inappropriate
• When the S value is outside of the range of 1 to 63

* The instruction is not executed when CR2012 turns ON.


KV-7500/7300 When CR2012 is ON, detailed error information is stored into CM5150 to CM5176.

5-230 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Access Window Instructions

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-231


Free operation counter instruction
RFSFRC Update the
current value of

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano free operation


counter as the
latest value
RFSFRC

Update the current value of


RFSFRC
RFSFRC Free operation counter
free operation counter as the
refreshing
latest value.

Ladder program Input mode


Execution condition RFSFRC
EXTENDED INSTRUCTIONS

R F S F R C

Available Devices ( ): Not supported on the KV-1000


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)
- - - - - - - - - - - - - - - - - - - - -

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

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

5-232 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Free operation counter instruction

MEMO

EXTENDED INSTRUCTIONS
5

counter instruction
Free operation

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-233


Sensor Setting Instruction
SPRD Reads sensor
parameter

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SPRD

SPRD SPRD Sensor Reads the parameters for the


parameter read specified parameter.

Ladder program Input mode


Execution condition SPRD
n1 n2 n3 S P R D n1 n2 n3
EXTENDED INSTRUCTIONS

n4 D
n4 D

Available Devices ( ): Not supported on the KV-1000


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)
n1 - - - - - - - - - - - - - - -  - - - -
n2  -  - - -   *4   *5 *5    -   

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.

5-234 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Sensor Setting Instruction

D ~: Result storage destination device

Result storage destination device Details


This device turns OFF when execution of the instruction

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)

Number of sensor setting Number of


executions
instruction executions (unit)
(CM1650)
Completion code 0 when successful At failure
(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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-235


Sensor Setting Instruction

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

SPRD Start execution at this scan

Number of sensor setting 16 16


instruction executions (unit)
(CM1650) One sensor setting instruction is

5 Cannot start because 16


sensor setting instructions
have been executed.
completed at previous scan
Sensor Setting
Instruction

Operation flag

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 unit number specified with n1 is 49 or more
• When unit for which the unit number specified with n1 is not KV-7500, KV-XLE02,
KV-EP21V, KV-5500 or KV-NC1EP
• When a 4-word device cannot be secured from the device specified with D
CR2012
• If a device other than the channel's leading device is specified when a bit device is specified
with D
• When the indirect specification or index modification range is inappropriate
• When the unit of the unit number designated at n1 is not connected when KV-7000 series
is used.

* The instruction is not executed when CR2012 turns ON.


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)

5-236 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Sensor Setting Instruction

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.

<KV STUDIO> SPRD input

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-237


SP
W

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SPWR

Sensor
SPWR SPWR Writes the specified sensor
parameter
parameters.
write

Ladder program Input mode


Execution condition SPWR
n1 n2 n3
EXTENDED INSTRUCTIONS

n1 n2 n3 S P W R
n4 D
n4 D

Available Devices ( ): Not supported on the KV-1000


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)
n1 - - - - - - - - - - - - - - -  - - - -
n2  -  - - -   *4   *5 *5    -   
5 n3  -  - - -   *4   *5 *5    -   
n4  -  - - -   *4   *5 *5    -   
Instruction
Sensor Setting

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.

5-238 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Sensor Setting Instruction

D ~: Result storage destination device

Result storage destination device Details


This device turns OFF when execution of the instruction

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)

Number of sensor setting Number of


executions
instruction executions (unit)
(CM1650)
Completion code 0 when successful At failure
(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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-239


Sensor Setting Instruction

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

SPWR Start execution at this scan

Number of sensor setting 16 16


instruction executions (unit)
(CM1650) One sensor setting instruction is

5 Cannot start because 16


sensor setting instructions
have been executed.
completed at previous scan
Sensor Setting
Instruction

Operation flag

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 unit number specified with n1 is 49 or more
• When unit for which the unit number specified with n1 is not KV-7500, KV-XLE02,
KV-EP21V, KV-5500 or KV-NC1EP
• When a 4-word device cannot be secured from the device specified with D
CR2012
• If a device other than the channel's leading device is specified when a bit device is specified
with D
• When the indirect specification or index modification range is inappropriate
• When the unit of the unit number designated at n1 is not connected when KV-7000 series
is used.

* The instruction is not executed when CR2012 turns ON.


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)

5-240 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Sensor Setting Instruction

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

Completion bit Execution failed bit

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.

<KV STUDIO> SPWR input

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-241


SS

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


SSVC

SSVC SSVC Sensor service


Executes the sensor service.
execution

Ladder program Input mode


Execution condition SSVC
n1 n2 n3 S S V C n1 n2 n3
EXTENDED INSTRUCTIONS

n4 D
n4 D

Available Devices ( ): Not supported on the KV-1000


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)
n1 - - - - - - - - - - - - - - -  - - - -
n2  -  - - -   *4   *5 *5    -   

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.

5-242 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Sensor Setting Instruction

D ~: Result storage destination device

Result storage destination device Details


This device turns OFF when execution of the instruction

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)

Number of sensor setting Number of


executions
instruction executions (unit)
(CM1650)
Completion code 0 when successful At failure
(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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-243


Sensor Setting Instruction

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

SSVC Start execution at this scan

Number of sensor setting 16 16


instruction executions (unit)
(CM1650) One sensor setting instruction is

5 Cannot start because 16


sensor setting instructions
have been executed.
completed at previous scan
Sensor Setting
Instruction

Operation flag

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 unit number specified with n1 is 49 or more
• When unit for which the unit number specified with n1 is not KV-7500, KV-XLE02,
KV-EP21V, KV-5500 or KV-NC1EP
• When a 4-word device cannot be secured from the device specified with D
CR2012
• If a device other than the channel's leading device is specified when a bit device is specified
with D
• When the indirect specification or index modification range is inappropriate
• When the unit of the unit number designated at n1 is not connected when KV-7000 series
is used.

* The instruction is not executed when CR2012 turns ON.


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)

5-244 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Sensor Setting Instruction

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

Completion bit Execution failed bit

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.

<KV STUDIO> SSVC input

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-245


Refresh Cyclic Communication Instruction
RFSCI Refreshes
cyclic

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano communicatio


n input

RFSCI

RFSCI(.U)
RFSCI.S
RFSCI RFSCI.D
RFSCI.L
RFSCI

Refresh cyclic Refreshes the cyclic


RFSCI.F
communication communication input
@RFSCI(.U) input data.
@RFSCI.S
@RFSCI
EXTENDED INSTRUCTIONS

RFSCI
@RFSCI.D
@RFSCI.L
@RFSCI.F

Ladder program Input mode


Execution condition RFSCI
D n R F S C I D n

Execution condition RFSCI


D n @ R F S C I D n

5 Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
Bit Devices Word Devices Const Ind Spec
munication Instruction
Refresh Cyclic Com-

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.

*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
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.

5-246 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Refresh Cyclic Communication Instruction

Example Execution condition


RFSCI
DM102 #3

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.

Example Execution condition


RFSCI.D
DM102 #3

CPU unit KV-EP21V


assignment device Cyclic communication data
DM101 DM100 Leading word+1 Leading word
DM103 DM102 Leading word+3 Leading word+2
DM105 DM104 Leading word+5 Leading word+4
DM107 DM106 Leading word+7 Leading word+6
DM109 DM108 Leading word+9 Leading word+8
DM111 DM110 Leading word+11 Leading word+10

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-247


Refresh Cyclic Communication Instruction

Point • Synchronization in connection units is not guaranteed. However, the synchronization of


the two-word data starting with an even number assigned from a 4-fold offset position
starting from the head of the cyclic communication data is guaranteed.
EXTENDED INSTRUCTIONS

• Only the device assigned to the connection is refreshed.


• Even if multiple KV-EP21V or cyclic communication data for multiple connections is
found in the range specified with the operand, all cyclic communication data which has
been specified is refreshed.
CPU unit KV-EP21V
device Cyclic communication data

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

Range specified with


Unassigned area
refresh instruction code

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

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

5-248 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Refresh Cyclic Communication Instruction

MEMO

EXTENDED INSTRUCTIONS
5

munication Instruction
Refresh Cyclic Com-

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-249


RF
S

KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano


RFSCO

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

Ladder program Input mode


Execution condition RFSCO
D n R F S C O D n

Execution condition RFSCO


D n @ R F S C O D n

5 Available Devices ( ): Not supported on the KV-1000


Index
Local Modify
munication Instruction
Refresh Cyclic Com-

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  -  - - - -  *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.
*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.

5-250 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Refresh Cyclic Communication Instruction

Example Execution condition


RFSCO
DM102 #3

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.

Example Execution condition


RFSCO.D
DM102 #3

32-bit refresh
CPU unit KV-EP21V
assignment device Cyclic communication data

DM101 DM100 Leading word+1 Leading word


DM103 DM102 Leading word+3 Leading word+2
DM105 DM104 Leading word+5 Leading word+4
DM107 DM106 Leading word+7 Leading word+6
DM109 DM108 Leading word+9 Leading word+8
DM111 DM110 Leading word+11 Leading word+10

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5-251


Refresh Cyclic Communication Instruction

Point • Synchronization in connection units is not guaranteed. However, the synchronization of


the two-word data starting with an even number assigned from a 4-fold offset position
starting from the head of the cyclic communication data is guaranteed.
EXTENDED INSTRUCTIONS

• Only the device assigned to the connection is refreshed.


• Even if multiple KV-EP21V or cyclic communication data for multiple connections is
found in the range specified with the operand, all cyclic communication data which has
been specified is refreshed.
CPU unit KV-EP21V
device Cyclic communication data

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

Range specified with


refresh instruction code Unassigned area

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

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state

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

5-252 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


APPENDICES

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.

Arithmetic Operation Storage....................................... A-2


Operation Processing Time Table................................ A-9
Instruction Size Table................................................. A-40
CR/CM List ................................................................ A-71
Character Code Table.............................................. A-115
Instruction Table Cannot be Used............................ A-116
Index ........................................................................ A-118
Instruction Index ...................................................... A-120

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-1


Arithmetic Operation Storage
This section describes the manner in which data is stored in the internal registers and in temporary data
memory (TM) by executing the four arithmetic operators (ADD, SUB, MIL, DIV) and by executing the
square root (ROOT instruction).

Internal registers/temporary data memory storage state list


Storage state list Reference
Instruction
Count before the operation Count after the operation page
ADD.U
16-bit 16-bit
ADD.S internal register + S = internal register

4-38
APPENDICES

ADD.D 32-bit internal register 32-bit internal register


+ S+1 S =
ADD.L Upper Lower Upper Lower Upper Lower

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

32-bit internal register


* High 16 bits are
MUL.U 16-bit Upper Lower stored to high and
internal register x S =
TM000 of 32-bit
MUL.S TM000
16-bit
internal register
internal register
Upper Lower 4-46

MUL.D 32-bit internal register x 32-bit internal register


S+1 S = TM001 TM000
MUL.L Upper Lower Upper Lower Upper Lower

32-bit internal register


16-bit Upper Lower Remainder
DIV.U TM000 internal register ÷ S = TM001
16-bit
TM000
DIV.S Upper Lower internal register
Upper Lower
* High 16 bits are stored to high and TM000 of
32-bit internal register 4-52

TM001 TM000 32-bit internal register


DIV.D Upper Lower
TM001 TM000 32-bit internal register ÷ S+1 S =
DIV.L TM003 TM002
Upper Lower Upper Lower Remainder
Upper Lower

ROOT.U 16-bit 16-bit


TM000 internal register = internal register
ROOT.S Upper Lower

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

64-bit internal register 64-bit internal register


ROOT.DF
Single precision floating point type real number Double precision floating point type real number

A-2 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Arithmetic Operation Storage

Arithmetic operation examples

■ Add (ADD)
(1) Unsigned 16-bit BIN data + unsigned 16-bit BIN data = unsigned 16-bit BIN data
DM00000 + DM00001 = DM00010

CR2002 DM00000 DM00001 DM00010


LDA ADD STA

(2) Signed 16-bit BIN data + signed 16-bit BIN data = signed 16-bit BIN data

APPENDICES
DM00000 + DM00001 = DM00010

CR2002 DM00000 DM00001 DM00010


LDA.S ADD.S STA.S

(3) Unsigned 16-bit BIN data + unsigned 32-bit BIN data = unsigned 32-bit BIN data
DM00000 + [DM00002·DM00003] = [DM00010·DM00011]

Arithmetic Operation Storage


CR2002 DM00000 DM00002 DM00010
LDA EXT ADD.D STA.D

(4) Signed 16-bit BIN data + signed 32-bit BIN data = signed 32-bit BIN data
DM00000 + [DM00002·DM00003] = [DM00010·DM00011]

CR2002 DM00000 DM00002 DM00010


LDA.S EXT.S ADD.L STA.L

(5) Unsigned 32-bit BIN data + unsigned 32-bit BIN data = unsigned 32-bit BIN data
[DM00000·DM00001] + [DM00002·DM00003] = [DM00010·DM00011]

CR2002 DM00000 DM00002 DM00010


LDA.D ADD.D STA.D

(6) Signed 32-bit BIN data + signed 32-bit BIN data = signed 32-bit BIN data
[DM00000·DM00001] + [DM00002·DM00003] = [DM00010·DM00011]

CR2002 DM00000 DM00002 DM00010


LDA.L ADD.L STA.L

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-3


Arithmetic Operation Storage

■ Subtract (SUB)
(1) Unsigned 16-bit BIN data - unsigned 32-bit BIN data = unsigned 32-bit BIN data
DM00000 - DM00001 = DM00010

CR2002 DM00000 DM00001 DM00010


LDA SUB STA

(2) Signed 16-bit BIN data - signed 32-bit BIN data = signed 16-bit BIN data
DM00000 - DM00001 = DM00010

CR2002 DM00000 DM00001 DM00010


APPENDICES

LDA.S SUB.S STA.S

(3) Unsigned 32-bit BIN data - unsigned 32-bit BIN data = unsigned 32-bit BIN data
[DM00000·DM00001] - DM00002 = [DM00010·DM00011]

CR2002 DM00002 DM00002


LDA EXT STA.D
Arithmetic Operation Storage

DM00000 DM00002 DM00010


LDA.D SUB.D STA.D

(4) Signed 32-bit BIN data - signed 16-bit BIN data = signed 32-bit BIN data
[DM00000·DM00001] - DM00002 = [DM00010·DM00011]

CR2002 DM00002 DM00002


LDA.S EXT.S STA.L

DM00000 DM00002 DM00010


LDA.L SUB.L STA.L

(5) Unsigned 32-bit BIN data - unsigned 32-bit BIN data = unsigned 32-bit BIN data
[DM00000·DM00001] - [DM00002·DM00003] = [DM00010·DM00011]

CR2002 DM00000 DM00002 DM00010


LDA.D SUB.D STA.D

(6) Signed 32-bit BIN data - signed 32-bit BIN data = signed 32-bit BIN data
[DM00000·DM00001] - [DM00002·DM00003] = [DM00010·DM00011]

CR2002 DM00000 DM00002 DM00010


LDA.L SUB.L STA.L

A-4 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Arithmetic Operation Storage

■ Multiply (MUL)
(1) Unsigned 16-bit BIN data x unsigned 16-bit BIN data = unsigned 32-bit BIN data
DM00000 × DM00001 = [DM00010·DM00011]

CR2002 DM00000 DM00001 DM00010


LDA MUL STA.D

(2) Signed 16-bit BIN data x signed 16-bit BIN data = signed 32-bit BIN data
DM00000 × DM00001 = [DM00010·DM00011]

CR2002 DM00000 DM00001 DM00010

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]

CR2002 DM00000 DM00002 DM00010


LDA EXT MUL.D STA.D

Arithmetic Operation Storage


TM000 DM00012
LDA.D STA.D

(4) Signed 16-bit BIN data x signed 32-bit BIN data = signed 64-bit BIN data
DM00000 × [DM00002·DM00003] = [DM00010·DM00011·DM00012·DM00013]

CR2002 DM00000 DM00002 DM00010


LDA.S EXT.S MUL.L STA.L

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]

CR2002 DM00000 DM00002 DM00010


LDA.D MUL.D STA.D

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]

CR2002 DM00000 DM00002 DM00010


LDA.L MUL.L STA.L

TM000 DM00012
LDA.L STA.L

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-5


Arithmetic Operation Storage

■ 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

CR2002 DM00000 DM00001 DM00010


LDA EXT DIV STA

TM001 DM00020
LDA STA

(2) Signed 16-bit BIN data ÷ signed 16-bit BIN data = signed 16-bit BIN data
APPENDICES

Remainder: signed 16-bit BIN data


DM00000 ÷ DM00001 = DM00010 ··· DM00020

CR2002 DM00000 DM00001 DM00010


LDA.S EXT.S DIV.S STA.S

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

CR2002 DM00001 TM000 DM00000 DM00002 DM00010


LDA STA LDA DIV STA.D

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

CR2002 DM00001 TM000 DM00000 DM00002 DM00010


LDA.S STA.S LDA.S DIV.S STA.L

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]

CR2002 DM00000 DM00002 DM00010


LDA.D EXT.D DIV.D STA.D

TM002 DM00020
LDA.D STA.D

A-6 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Arithmetic Operation Storage

(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]

CR2002 DM00000 DM00002 DM00010


LDA.L EXT.L DIV.L STA.L

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]

CR2002 DM00000 DM00002 DM00004 DM00010


LDA.D MUL.D DIV.D STA.D

TM000 DM00012 TM002 DM00020

Arithmetic Operation Storage


LDA.D STA.D LDA.D STA.D

(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]

CR2002 DM00000 DM00002 DM00004 DM00010


LDA.L MUL.L DIV.L STA.L

TM000 DM00012 TM002 DM00020


LDA.L STA.L LDA.L STA.L

■ Square root (ROOT)


(1) Square root of unsigned 16-bit BIN data
DM00000 = DM00010

CR2002 DM00000 DM00010


LDA EXT ROOT STA

(2) Square root of signed 16-bit BIN data


DM00000 = DM00010

CR2002 DM00000 DM00010


LDA.S EXT.S ROOT.S STA.S

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-7


Arithmetic Operation Storage

(3) Square root of unsigned 32-bit BIN data


[DM00000·DM00001] = [DM00010·DM00011]

CR2002 DM00000 DM00010


LDA.D EXT.D ROOT.D STA.D

(4) Square root of signed 32-bit BIN data


[DM00000·DM00001] = [DM00010·DM00011]

CR2002 DM00000 DM00010


LDA.L EXT.L ROOT.L STA.L
APPENDICES

(5) Square root of floating point type real number data


[DM00000·DM00001] = [DM00010·DM00011]

CR2002 DM00000 DM00010


LDA.F ROOT.F STA.F
Arithmetic Operation Storage

(6) Square root of double precision floating point type real number data
[DM00000·DM00001·DM00002·DM00003] = [DM00010·DM00011·DM00012·DM00013]

CR2002 DM00000 DM00010


LDA.DF ROOT.DF STA.DF

A-8 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table
Processing time table of instructions.

Design of Processing Time

• When the measurement condition is not specified, n is set as a constant, and S / D is


set as DM (word data) or R (bit data).
Reference When the following devices other than DM are specified in S , the processing time is
increased by 0.050 to (µs).
Destination device
KV-1000 R, MR
KV-5500/5000/3000 R, MR, LR, B, VB, TM

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 Processing Time Table


• Sometimes, variation may occur due to specifying contents of operant or operating state (execution condition).

■ Differential execution type(@)


Differential execution is enabled except some instruction words, and (@) is added at the start point of
instruction. Under such circumstance, following time should be added to the processing time.
KV-7500/7300 (µs) KV-5500/5000/3000 (µs) KV-1000 (µs) KV Nano Series (µs)
0.018 0.050 0.175 0.350

■ Index modification/ indirect specifying


When index modification or indirect specifying is used in operand, the standards of added processing
time are shown below.
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
(µs) (µs) (µs) Series (µs)
Index Source 0.006 0.010 0.025 0.350
modification Destination 0.006 0.010 0.025 0.550
Indirect Source 0.016 0.080 to 0.100 0.175 0.900
specifying Destination 0.016 0.120 to 0.140 0.250 to 0.300 1.300

■ 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""

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-9


Operation Processing Time Table

■ Specify word device bit


KV-7500/7300/5500/5000/3000, KV Nano Series When word device bit is specified, the standards of added
processing time are shown below.
Condition KV-7500/7300 (μs) KV-5500/5000/3000 (μs) KV Nano Series (μs)
Source/Destination 0.006 0.010 to 0.020 0.050

■ 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

Source 0.734 5.400 0.600


Destination 0.682 4.700 0.600

Basic Instructions

Processing time (µs)


Operation Processing Time Table

Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV-1000 KV Nano


7300 5000/3000 Series
LD/LDB - 0.00096 0.010 0.025 0.050
AND/ANB – 0.00096 0.010 0.025 0.065
OR/ORB – 0.00096 0.010 0.025 0.065
LDP/LDF – 0.00863 0.030 0.225 0.620
ANP/ANF – 0.00863 0.040 0.250 0.580
ORP/ORF – 0.00863 0.040 0.250 0.680
LDPB/LDFB – 0.00891 0.040 – 0.620
ANPB/ANFB – 0.00911 0.050 – 0.580
ORPB/ORFB – 0.00911 0.050 – 0.670
BLD/BLDB .U.D 0.00863 0.080 0.150 1.400
BAND/BANB .U.D 0.00863 0.080 0.150 1.300
BOR/BORB .U.D 0.00863 0.080 0.150 1.300
LD= .U.S.D.L S1 =DM, S2 = Constant 0.01413 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.05772 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.08070 0.740 – 4.100
LD< .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.120 0.300 0.300
.F S1 =DM, S2 = Constant 0.05772 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.08047 0.980 – 4.100
LD> .U.S.D.L S1 =DM, S2 = Constant 0.01413 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.05772 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.08047 0.980 – 3.800
LD<= .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.05772 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.08047 0.980 – 4.100

A-10 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
LD>= .U.S.D.L S1 =DM, S2 = Constant 0.01413 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.06346 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.08047 0.980 – 4.000
LD<> .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.06322 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.08047 0.740 – 4.100
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

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

Operation Processing Time Table


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.400
.DF S1 =DM, S2 = Constant 0.08047 0.980 – 3.800
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
AND<> .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.150 0.325 0.160
.F S1 =DM, S2 = Constant 0.06322 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.08047 0.740 – 3.800
OR= .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.06035 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.07759 0.740 – 3.900
OR< .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.06035 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.07759 0.980 – 3.900
OR> .U.S.D.L S1 =DM, S2 = Constant 0.01437 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.06035 0.520 0.850 2.500
.DF S1 =DM, S2 = Constant 0.07759 0.980 – 3.800
OR<= .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.06035 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.07759 0.980 – 3.900
OR>= .U.S.D.L S1 =DM, S2 = Constant 0.01437 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.06035 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.07759 0.980 – 3.800
OR<> .U.S.D.L S1 =DM, S2 = Constant 0.01150 0.150 0.325 0.140
.F S1 =DM, S2 = Constant 0.06035 0.520 0.850 2.300
.DF S1 =DM, S2 = Constant 0.07759 0.730 – 3.900
OUT/OUB – 0.00288 0.010 0.025 0.050

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-11


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
SET/RES – Execution condition is ON 0.00288 0.010 0.025 0.070
Execution condition is OFF 0.00288 0.010 0.025 0.070
KEEP – 0.02041 0.080 0.200 2.800
DIFU – Execution condition is ON 0.01725 0.070 0.350 3.200
Execution condition is OFF 0.01725 0.070 0.350 3.000
DIFD – Execution condition is ON 0.02328 0.100 0.425 3.200
Execution condition is OFF 0.02328 0.100 0.425 3.000
ONDL – Execution condition is ON 0.08909 0.840 1.650 4.800
APPENDICES

Execution condition is OFF 0.07472 0.670 1.250 4.000


OFDL – Execution condition is ON 0.08909 0.830 1.725 4.900
Execution condition is OFF 0.09483 0.720 1.275 2.900
SHOT – Execution condition is ON 0.14944 0.860 2.225 6.900
Execution condition is OFF 0.13794 0.840 1.900 6.400
FLIK – Execution condition is ON 0.16524 0.800 2.000 5.500
Execution condition is OFF 0.11783 0.810 1.550 7.100
Operation Processing Time Table

ALT – Execution condition is ON 0.06380 0.530 1.125 3.500


Execution condition is OFF 0.06380 0.460 1.050 3.200
BOUT .U.D 0.00863 0.080 0.150 1.700
BOUB .U.D 0.01437 0.130 0.275 1.700
BSET .U.D Execution condition is ON 0.01150 0.080 0.150 1.700
Execution condition is OFF 0.00863 0.030 0.100 0.250
BRES .U.D Execution condition is ON 0.01150 0.080 0.150 1.700
Execution condition is OFF 0.00863 0.030 0.100 0.250
TMR – S = Constant 0.04480 0.350 1.175 0.720
S = Constant, Execution 0.04480 0.150 1.550 0.730
condition is OFF
TMH – S = Constant 0.04480 0.350 1.175 0.720
S = Constant, Execution 0.04480 0.150 1.550 0.730
condition is OFF
TMS – S = Constant 0.04480 0.360 1.175 0.720
S = Constant, Execution 0.04480 0.160 1.550 0.730
condition is OFF
TMU – S = Constant 0.04480 0.780 – 0.720
S = Constant, Execution 0.04480 0.680 – 0.730
condition is OFF
C – S = Constant 0.05033 0.320 1.900 0.620
S = Constant, Execution 0.05033 0.170 1.525 0.640
condition is OFF
OUTC – S = Constant 0.03567 0.270 1.900 0.480
S = Constant, Execution 0.03567 0.120 1.875 0.490
condition is OFF
ITVL – S = Constant 0.22990 1.670 3.325 20.400
UDC – S = Constant 0.11438 1.110 2.750 3.700
UDT – S = Constant 0.13449 1.110 2.650 5.000

A-12 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
END – 0.00000 0.000 0.000 0.000
ENDH – 0.00000 0.000 0.000 0.000
CON – 0.00000 0.000 0.000 0.000
MPS – 0.00288 0.010 0.025 0.070
MRD – 0.00288 0.010 0.025 0.070
MPP – 0.00288 0.010 0.025 0.080
ANL – 0.00288 0.010 0.025 0.090
ORL – 0.00288 0.010 0.025 0.100

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

Operation Processing Time Table


*1 When the target is an expansion unit for KV-5000/3000 series, RFSX command: 3.75034, RFSY
command: 3.18901

Applied Instructions

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
SFT – 1ch 0.54053 2.020 6.100 22.600
1ch, clock input is OFF 0.08621 0.400 0.750 12.500
100ch 41.5064 146.020 446.100 354.600
100ch, clock input is OFF 0.08621 0.400 0.750 12.400
MEMSW – - – 0.000 −
STP to STE At the time of non-execution 0.05202 0.290 0.425 1.100
STP – 0.04598 0.110 0.225 1.200
STE – 0.00000 0.000 0.000 0.000
STG to JMP – At the time of non-execution 0.04598 0.320 0.625 0.630
STG to ENDS – At the time of non-execution 0.04598 0.320 0.600 0.740
STG – 0.03621 1.740 3.525 0.690
JMP – 0.04713 0.170 0.375 0.570
ENDS – 0.04196 0.150 0.400 0.500
W-ON – Execution condition is ON 0.02357 0.170 0.500 1.700
Execution condition is OFF 0.02357 0.170 0.450 1.700
W-OFF – Execution condition is ON 0.02357 0.180 0.525 1.700
Execution condition is OFF 0.02357 0.180 0.475 1.700
W-UE – Execution condition is ON 0.08047 0.640 1.400 3.100
Execution condition is OFF 0.08047 0.640 1.350 2.500

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-13


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/
KV-1000 KV Nano
7300 5000/3000 Series
W-DE – Execution condition is ON 0.08047 0.640 1.400 3.000
Execution condition is OFF 0.08047 0.640 1.350 2.500
MC – 0.00863 0.030 0.025 0.380
MCR – 0.00288 0.010 0.025 0.190
CALL – At the time of non-execution 0.02300 0.050 0.075 0.440
At the time of execution 0.14993 0.550 1.100 1.400
SBN – 0.00000 0.000 0.000 0.000
RET – 0.10870 0.550 1.100 0.900
APPENDICES

ECALL – At the time of non-execution 0.02874 0.090 – 0.240


At the time of execution 0.28671 1.830 – 7.600
1
FOR to .U.D S =#1 0.14976* 1.770 2.875 3.900
NEXT S =#1000 43.2115*
1
352.000 700.000 260.500
BREAK – Execution condition is ON 0.25001 0.520 0.750 3.600
Execution condition is OFF 0.02298 0.060 0.075 0.480
CJ – At the time of non-execution 0.03736 0.090 0.175 0.230
Operation Processing Time Table

At the time of execution (branch) 0.08047 0.500 0.725 0.780


NCJ – At the time of non-execution 0.04311 0.120 0.175 0.240
At the time of execution (branch) 0.08621 0.530 0.725 0.780
GOTO – 0.08621 0.520 0.750 0.780
LABEL – 0.00000 0.000 0.000 0.000
SCJ – At the time of non-execution 0.06035 0.190 – 0.750
At the time of execution 0.10337 0.600 – 1.400
MCALL – Argument 0: At the time of execution 1.16962 1.420 5.920 13.200
Argument 10: At the time of 1.80133 2.230 7.520 15.500
execution (device 5, value 5)
MSTRT – Argument 0: At the time of execution 1.18400 1.450 6.160 14.300
Argument 10: At the time of 1.81568 2.080 7.840 16.600
execution (device 5, value 5)
MEND – 0.01589 0.020 0.075 0.200
FB – Argument 0: At the time of execution 1.20979
Argument 10: At the time of 1.59235
execution (IN5, IN-OUT 5)
FEND – 0.00920
FUN – Argument 0: At the time of execution 0.96380
Argument 10: At the time of 1.29890
execution (IN5, IN-OUT 5)
MDSTRT – 0.01150 0.020 0.075 1.500
MDSTOP – 0.01150 0.020 0.075 1.500
ZPUSH .S Execution condition is ON 0.20402 1.120 1.675 6.300
Execution condition is OFF 0.01150 0.100 0.225 0.380
.L Execution condition is ON 0.23853 1.240 – 7.000
Execution condition is OFF 0.01150 0.100 – 0.390
ZPOP .S Execution condition is ON 0.23505 1.540 2.125 8.800
Execution condition is OFF 0.01150 0.040 0.225 0.390
.L Execution condition is ON 0.30397 2.080 – 9.700
Execution condition is OFF 0.01150 0.040 – 0.390
A-14 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/
KV-1000 KV Nano
7300 5000/3000 Series
ADRSET – Other than TC 0.00575 0.020 0.050 1.400
Other than TC, Execution 0.00575 0.020 0.050 0.090
condition is OFF
TC 0.01437 0.050 0.150 1.400
TC, Execution condition is OFF 0.01437 0.050 0.150 0.130
ADRINC – Execution condition is ON 0.02873 0.090 0.225 1.400
Execution condition is OFF 0.02011 0.070 0.225 0.100
ADRDEC – Execution condition is ON 0.02873 0.090 0.225 1.700

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

Operation Processing Time Table


.L Execution condition is ON 0.04253 0.130 – 1.800
Execution condition is OFF 0.03735 0.130 – 0.100
FRSET – Execution condition is ON 2.57988 10.400 – –
Execution condition is OFF 0.03162 0.090 – –
FRSTM – At the rising edge of execution condition 1.87500 1.030 – –
Execution condition is OFF 0.17817 0.850 – –
FRLDM – At the rising edge of execution condition 1.87500 1.030 – –
Execution condition is OFF 0.17817 0.850 – –
UPSTRT – At the rising edge of execution condition 8.42467 – – –
Execution condition is OFF 0.43754 – – –
UPSTOP – At the rising edge of execution condition 7.44842 – – –
Execution condition is OFF 0.26440 – – –
UFSUS – At the rising edge of execution condition 7.47027 – – –
Execution condition is OFF 0.26725 – – –
UFRSM – At the rising edge of execution condition 7.44829 – – –
Execution condition is OFF 0.26440 – – –
UMALLOC – At the rising edge of execution condition 8.03900 – – –
Execution condition is OFF 0.21552 – – –
2
UREAD .U.S.D.L.F 1 word (expansion unit) 1.17700* 7.000 – 52.000
2
1000 words (expansion unit) 39.1441* 332.000 – 499.000
1 word (CPU Ethernet/FL-net) 4.01300 19.100 – –
1000 words (CPU Ethernet/FL-net) 114.612 400.000 – –
At the time of non-execution 0.02013 0.070 – 0.290
2
UWRIT .U.S.D.L.F 1 word (expansion unit) 1.19855* 7.800 – 42.000
2
1000 words (expansion unit) 41.9009* 383.000 – 420.000
1 word (CPU Ethernet/FL-net) 3.99146 21.380 – –
1000 words (CPU Ethernet/FL-net) 125.631 400.000 – –
At the time of non-execution 0.02013 0.070 – 0.290

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-15


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/
KV-1000 KV Nano
7300 5000/3000 Series
UFILL .U.S.D.L.F 1 word (expansion unit) 2 7.300 – 31.000
1.15509*
1000 words (expansion unit) 36.2723 *2 375.000 – 424.000
1 word (CPU Ethernet/FL-net) 2.35605 17.750 – –
1000 words (CPU Ethernet/FL-net) 68.0976 116.380 – –
At the time of non-execution 0.01725 0.090 – 0.290
*1 For CPU function version 2.1 or earlier, the processing time is shown below.
When FOR to NEXT command S = #1: 0.30750
When FOR to NEXT command S = #1000: 106.525
APPENDICES

*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

Arithmetic Operation Instructions


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
MOV .U.S Execution condition is ON 0.01150 0.090 0.150 0.170
Execution condition is OFF 0.00575 0.020 0.075 0.180
.D.L.F Execution condition is ON 0.01150 0.090 0.150 0.270
Execution condition is OFF 0.00575 0.020 0.075 0.270
.DF Execution condition is ON 0.04598 0.290 – 1.400
Execution condition is OFF 0.04023 0.170 – 0.250
LDA .U.S DM is specified 0.01150 0.090 0.150 0.140
DM is specified, Execution 0.00575 0.020 0.075 0.290
condition is OFF
Constant is specified 0.00575 0.020 0.050 0.150
Constant is specified, Execution 0.00575 0.020 0.050 0.150
condition is OFF
.D.L DM is specified 0.01150 0.090 0.150 0.160
DM is specified, Execution 0.00575 0.020 0.075 0.290
condition is OFF
Constant is specified 0.00575 0.020 0.050 0.160
Constant is specified, Execution 0.00575 0.020 0.050 0.150
condition is OFF
.F DM is specified 0.01437 0.100 0.175 0.160
DM is specified, Execution 0.00863 0.030 0.100 0.200
condition is OFF
Constant is specified 0.00863 0.040 0.100 0.260
Constant is specified, Execution 0.00863 0.020 0.050 0.240
condition is OFF
.DF DM is specified 0.02874 0.280 – 1.200
DM is specified, Execution 0.02587 0.130 – 0.210
condition is OFF
Constant is specified 0.02874 0.180 – 1.000
Constant is specified, Execution 0.02874 0.130 – 0.250
condition is OFF

A-16 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
STA .U.S Execution condition is ON 0.00288 0.010 0.025 0.110
Execution condition is OFF 0.00288 0.010 0.025 0.120
.D.L.F Execution condition is ON 0.00288 0.010 0.025 0.030
Execution condition is OFF 0.00288 0.010 0.025 0.130
.DF Execution condition is ON 0.04311 0.250 – 0.770
Execution condition is OFF 0.03736 0.180 – 0.390
PLDA .U Execution condition is ON 0.02874 0.150 – 1.600
Execution condition is OFF 0.02874 0.100 – 0.250

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 −

Operation Processing Time Table


Execution condition is OFF 0.01725 0.060 0.175 −
DW .U.S Execution condition is ON 0.00575 0.020 0.050 0.130
Execution condition is OFF 0.00575 0.020 0.050 0.130
.D.L.F Execution condition is ON 0.00575 0.030 0.075 0.180
Execution condition is OFF 0.00575 0.030 0.075 0.140
.DF Execution condition is ON 0.04886 0.190 – 1.100
Execution condition is OFF 0.04311 0.170 – 0.270
BMOV .U n =#1 0.16955 0.980 2.025 10.200
n =#1, Execution condition is 0.01150 0.060 0.150 0.250
OFF
n =#1000 30.6903 81.420 184.7 89.200
n =#1000, Execution 0.01150 0.060 0.150 0.250
condition is OFF
.D n =#1 0.16955 0.980 2.025 10.500
n =#1, Execution condition is 0.01150 0.060 0.150 0.250
OFF
n =#1000 32.1313 133.960 275.900 169.700
n =#1000, Execution 0.01150 0.060 0.150 0.250
condition is OFF

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-17


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
FMOV .U n =#1 0.12755 0.760 1.350 9.600
n =#1, Execution condition is 0.01437 0.060 0.150 0.250
OFF
n =#1000 4.18475 33.070 53.100 128.700
n =#1000, Execution 0.01437 0.060 0.150 0.250
condition is OFF
.D n =#1 0.11782 0.760 1.350 9.600
n =#1, Execution condition is 0.01150 0.060 0.150 0.250
OFF
n =#1000 7.61275 65.810 105.800 247.900
APPENDICES

n =#1000, Execution 0.01150 0.060 0.150 0.250


condition is OFF
.DF n =#1 0.11208 0.780 – 8.400
n =#1, Execution condition is 0.01725 0.090 – 0.250
OFF
n =#1000 12.2840 117.90 – 176.200
n =#1000, Execution 0.01725 0.090 – 0.250
condition is OFF
Operation Processing Time Table

PMOV .U Execution condition is ON 0.14943 0.810 1.525 0.250


Execution condition is OFF 0.02874 0.100 0.275 0.250
.D Execution condition is ON 0.14082 0.780 1.500 0.250
Execution condition is OFF 0.02587 0.090 0.250 0.250
BYLMOV – n =#1 0.53737 2.690 – 15.100
n =#1, Execution condition is 0.01725 0.080 – 0.260
OFF
n =#1000 15.6383 42.890 – 124.500
n =#1000, Execution 0.01725 0.080 – 0.260
condition is OFF
BYBMOV – n =#1 0.53738 2.690 – 12.300
n =#1, Execution condition is 0.01725 0.080 – 0.260
OFF
n =#1000 15.6380 42.890 – 75.400
n =#1000, Execution 0.01725 0.080 – 0.260
condition is OFF
ADD .U.S S = Constant 0.00575 0.020 0.050 0.130
S = Constant, Execution 0.00575 0.020 0.050 0.170
condition is OFF
.D.L S = Constant 0.00575 0.020 0.050 0.090
S = Constant, Execution 0.00575 0.020 0.050 0.170
condition is OFF
.F S = Constant 0.03161 0.110 0.275 2.000
S = Constant, Execution 0.03161 0.110 0.275 0.290
condition is OFF
.DF S = Constant 0.05748 2.100 – 2.600
S = Constant, Execution 0.05461 0.050 – 0.390
condition is OFF

A-18 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
SUB .U.S S = Constant 0.00575 0.020 0.050 0.150
S = Constant, Execution 0.00575 0.020 0.050 0.170
condition is OFF
.D.L S = Constant 0.00575 0.040 0.100 0.130
S = Constant, Execution 0.00575 0.040 0.100 0.200
condition is OFF
.F S = Constant 0.03162 0.110 0.275 2.000
S = Constant, Execution 0.03162 0.110 0.275 0.290
condition is OFF
.DF S = Constant 0.05748 2.020 – 2.700

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

Operation Processing Time Table


condition is OFF
.F S = Constant 0.04311 0.130 0.325 2.000
S = Constant, Execution 0.04311 0.130 0.325 0.290
condition is OFF
.DF S = Constant 0.07185 1.570 – 2.600
S = Constant, Execution 0.06897 0.050 – 0.390
condition is OFF
DIV .U.S S = Constant 0.07185 0.170 0.450 0.500
S = Constant, Execution 0.07185 0.170 0.450 0.190
condition is OFF
.D S = Constant 0.08334 0.320 0.825 4.100
S = Constant, Execution 0.08047 0.320 0.825 0.200
condition is OFF
.L S = Constant 0.08334 0.480 1.225 4.600
S = Constant, Execution 0.08047 0.320 0.825 0.200
condition is OFF
.F S = Constant 0.10633 0.370 0.925 2.000
S = Constant, Execution 0.10633 0.370 0.925 0.290
condition is OFF
.DF S = Constant 0.13506 2.860 – 2.800
S = Constant, Execution 0.13219 0.050 – 0.390
condition is OFF
INC .U.S.D.L Execution condition is ON 0.02587 0.130 0.250 0.380
Execution condition is OFF 0.01725 0.060 0.200 0.190
DEC .U.S.D.L Execution condition is ON 0.02587 0.130 0.250 0.290
Execution condition is OFF 0.01725 0.060 0.200 0.090

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-19


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
ROOT .U.S Execution condition is ON 0.78736 2.830 6.700 4.300
Execution condition is OFF 0.00575 0.020 0.050 0.140
.D Execution condition is ON 1.52300 5.210 12.650 11.100
Execution condition is OFF 0.00575 0.020 0.050 0.150
.L Execution condition is ON 1.52875 5.230 12.680 11.400
Execution condition is OFF 0.00575 0.020 0.050 0.150
.F Execution condition is ON 0.76150 3.250 7.725 4.900
Execution condition is OFF 0.00575 0.020 0.050 0.130
APPENDICES

.DF Execution condition is ON 1.17530 8.100 – 5.200


Execution condition is OFF 0.00288 0.030 – 0.150
POW .U Execution condition is ON 0.16380 1.370 – 7.000
Execution condition is OFF 0.00575 0.020 – 0.400
.S Execution condition is ON 0.18391 1.520 – 7.000
Execution condition is OFF 0.00575 0.020 – 0.400
.D Execution condition is ON 0.20690 2.010 – 10.500
Operation Processing Time Table

Execution condition is OFF 0.00575 0.020 – 0.400


.L Execution condition is ON 0.26725 2.220 – 13.100
Execution condition is OFF 0.00575 0.020 – 0.400
.F Execution condition is ON 6.52648 9.500 – 43.200
Execution condition is OFF 0.00575 0.050 – 0.380
.DF Execution condition is ON 7.65938 15.500 – 44.200
Execution condition is OFF 0.01202 0.070 – 0.080
CMP .U.S.D.L Execution condition is ON 0.01150 0.020 0.050 0.220
Execution condition is OFF 0.00575 0.020 0.050 0.210
.F Execution condition is ON 0.02300 0.070 0.150 2.700
Execution condition is OFF 0.01725 0.070 0.175 0.380
.DF Execution condition is ON 0.04045 0.800 – 3.600
Execution condition is OFF 0.03476 0.050 – 0.080
ZCMP .U.S.D.L Execution condition is ON 0.07759 0.630 1.075 1.700
Execution condition is OFF 0.01437 0.050 0.175 0.240
.F Execution condition is ON 0.10633 0.730 1.525 6.500
Execution condition is OFF 0.01437 0.050 0.175 0.260
.DF Execution condition is ON 0.15518 1.450 – 8.700
Execution condition is OFF 0.03242 0.110 – 0.350
ANDA .U.D S = Constant 0.00575 0.020 0.050 0.960
S = Constant, Execution 0.00575 0.020 0.050 0.090
condition is OFF
ORA .U.D S = Constant 0.00575 0.020 0.050 1.000
S = Constant, Execution 0.00575 0.020 0.050 0.090
condition is OFF
EORA .U.D S = Constant 0.00575 0.020 0.050 0.960
S = Constant, Execution 0.00575 0.020 0.050 0.090
condition is OFF

A-20 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
ENRA .U.D S = Constant 0.00863 0.030 0.075 1.000
S = Constant, Execution 0.00863 0.030 0.075 0.090
condition is OFF
COM .U.D Execution condition is ON 0.00575 0.020 0.050 0.140
Execution condition is OFF 0.00575 0.020 0.050 0.140
NEG .U.S.D.L.F Execution condition is ON 0.00288 0.010 0.025 0.130
Execution condition is OFF 0.00288 0.010 0.025 0.130
.DF Execution condition is ON 0.02012 0.180 – 0.130
Execution condition is OFF 0.01437 0.110 – 0.140

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 –

Operation Processing Time Table


0.01725 1.400
Execution condition is OFF 0.01725 0.060 – 0.370
.L Execution condition is ON 0.02012 0.070 – 1.300
Execution condition is OFF 0.02012 0.070 – 0.300
ASLA .U.S.D.L Execution condition is ON 0.00575 0.020 – 0.300
Execution condition is OFF 0.00575 0.020 – 0.300
RRA .U.D Execution condition is ON 0.01150 0.040 0.100 3.000
Execution condition is OFF 0.01150 0.040 0.100 0.300
RLA .U.D Execution condition is ON 0.01150 0.040 0.100 3.200
Execution condition is OFF 0.01150 0.040 0.100 0.300
RRNCA .U.D Execution condition is ON 0.01150 0.040 0.100 1.900
Execution condition is OFF 0.01150 0.040 0.100 0.280
RLNCA .U.D Execution condition is ON 0.00575 0.020 0.050 1.900
Execution condition is OFF 0.00575 0.020 0.050 0.280
WSR .U n1 =#1, n2 =#1 0.20978 1.180 2.175 16.900
n1 =#1000, n2 =#1000 34.7778 114.560 263.525 187.600
Execution condition is OFF 0.01150 0.060 0.150 0.450
.D n1 =#1, n2 =#1 0.19828 1.140 2.075 16.900
n1 =#1000, n2 =#1000 39.7345 202.450 377.850 365.400
Execution condition is OFF 0.01150 0.060 0.150 0.460

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-21


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
WSL .U n1 =#1, n2 =#1 0.18105 1.080 1.950 17.500
n1 =#1000, n2 =#1000 34.8398 118.170 263.300 188.200
Execution condition is OFF 0.01150 0.060 0.150 0.450
.D n1 =#1, n2 =#1 0.18105 1.090 1.950 17.500
n1 =#1000, n2 =#1000 39.7140 202.560 376.275 365.900
Execution condition is OFF 0.01150 0.060 0.150 0.460
BSR .U.D n1 =#1, n2 =#1 0.14656 0.980 1.675 13.900
n1 =#1000, n2 =#1000 12.8910 54.740 173.300 229.200
0.01150 0.060 0.150
APPENDICES

Execution condition is OFF 0.480


BSL .U.D n1 =#1, n2 =#1 0.13220 0.940 1.600 14.800
n1 =#1000, n2 =#1000 13.6335 54.710 173.225 215.200
Execution condition is OFF 0.01150 0.060 0.150 0.480
LIMIT .U.S.D.L Execution condition is ON 0.10920 0.720 – 2.100
Execution condition is OFF 0.02012 0.070 – 0.260
BANDC .S Execution condition is ON 0.10920 0.860 – 1.900
Operation Processing Time Table

Execution condition is OFF 0.02012 0.070 – 0.260


.L Execution condition is ON 0.10920 0.720 – 2.100
Execution condition is OFF 0.02012 0.070 – 0.260
ZONE .S Execution condition is ON 0.12070 0.770 – 2.300
Execution condition is OFF 0.02012 0.070 – 0.250
.L Execution condition is ON 0.11782 0.770 – 2.100
Execution condition is OFF 0.02012 0.070 – 0.250
APR .U.S MIN search 0.23277 1.190 – 13.500
MAX search 1.20000 4.790 – 31.700
Execution condition is OFF 0.01439 0.070 – 0.260
.D MIN search 0.23278 1.220 – 14.800
MAX search 1.16034 4.170 – 42.500
Execution condition is OFF 0.01437 0.070 – 0.270
.L MIN search 0.23276 1.240 – 14.600
MAX search 1.18175 4.260 – 42.300
Execution condition is OFF 0.01437 0.070 – 0.270
.F MIN search 0.24138 2.530 – 18.400
MAX search 1.79950 6.730 – 49.200
Execution condition is OFF 0.01437 0.070 – 0.310
.DF MIN search 0.32128 – – –
MAX search 2.45300 – – –
Execution condition is OFF 0.02241 – – –
RAMP – Execution condition is ON 0.39371 1.970 – 16.000
Execution condition is OFF 0.11783 0.780 – 6.300

A-22 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
TPOUT – Execution condition is ON 0.16358 1.050 – 8.900
Execution condition is OFF 0.10633 0.770 – 7.100
LLFLT – During execution of operation 0.30475 2.320 – 21.500
During standby for operation 0.29025 1.510 – 11.600
Execution condition is OFF 0.23564 1.270 – 9.200
TBCD .U Execution condition is ON 0.03736 0.130 0.325 4.500
Execution condition is OFF 0.03736 0.130 0.325 1.200
.D Execution condition is ON 0.08334 0.290 0.725 5.300

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

Operation Processing Time Table


DMX – Execution condition is ON 0.01437 0.050 0.100 1.600
Execution condition is OFF 0.01150 0.050 0.100 1.200
GRY .U.D Execution condition is ON 0.00288 0.010 0.025 5.000
Execution condition is OFF 0.00288 0.010 0.025 1.200
RGRY .U.D Execution condition is ON 0.00288 0.010 0.025 5.700
Execution condition is OFF 0.00288 0.010 0.025 1.200
DISN .U Execution condition is ON 0.12644 0.840 1.575 8.400
Execution condition is OFF 0.01725 0.060 0.150 0.250
.D Execution condition is ON 0.12645 1.120 2.175 9.300
Execution condition is OFF 0.01725 0.060 0.150 0.250
UNIN .U Execution condition is ON 0.16956 0.920 1.650 11.000
Execution condition is OFF 0.01725 0.060 0.125 0.250
.D Execution condition is ON 0.18968 1.310 2.350 11.500
Execution condition is OFF 0.01725 0.060 0.125 0.250
DISB .U Execution condition is ON 0.12645 0.700 1.275 8.000
Execution condition is OFF 0.01725 0.060 0.150 0.250
.D Execution condition is ON 0.12645 0.840 1.575 8.400
Execution condition is OFF 0.01725 0.060 0.150 0.250
UNIB .U Execution condition is ON 0.14656 0.740 1.300 10.700
Execution condition is OFF 0.01725 0.060 0.125 0.250
.D Execution condition is ON 0.16668 0.950 1.650 11.000
Execution condition is OFF 0.01725 0.060 0.125 0.250
SWAP .U.D Execution condition is ON 0.00288 0.010 0.025 0.050
Execution condition is OFF 0.00288 0.010 0.025 0.020

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-23


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
BSWAP – n =#1 0.18679 0.840 – 7.100
n =#1, Execution condition is 0.00863 0.050 – 0.260
OFF
n =#1000 33.2005 125.690 – 77.100
n =#1000, Execution 0.00863 0.050 – 0.260
condition is OFF
XCH .U.D Execution condition is ON 0.10058 0.600 1.050 0.940
Execution condition is OFF 0.01437 0.050 0.125 0.250
DECO – n =#1 0.10920 0.580 1.125 14.000
APPENDICES

n =#8 0.38507 1.500 3.825 16.300


Execution condition is OFF 0.01437 0.050 0.125 0.370
ENCO – n =#1 0.10058 0.590 1.050 12.000
n =#256 0.47990 2.240 5.175 14.800
Execution condition is OFF 0.01437 0.050 0.125 0.260
ABS .S Execution condition is ON 0.01725 0.070 – 0.960
Execution condition is OFF 0.02587 0.080 – 0.140
Operation Processing Time Table

.L Execution condition is ON 0.01725 0.080 – 0.910


Execution condition is OFF 0.02874 0.090 – 0.150
.F Execution condition is ON 0.01150 0.040 – 2.400
Execution condition is OFF 0.01150 0.040 – 0.130
.DF Execution condition is ON 0.04866 0.270 – 2.700
Execution condition is OFF 0.04598 0.210 – 0.140
FLOAT .U.S Execution condition is ON 0.01725 0.060 0.150 1.900
Execution condition is OFF 0.01725 0.060 0.150 0.140
.D.L Execution condition is ON 0.01437 0.050 0.125 1.900
Execution condition is OFF 0.01437 0.050 0.125 0.130
DFLOAT .U Execution condition is ON 0.02299 0.660 – 4.300
Execution condition is OFF 0.02299 0.020 – 0.140
.S Execution condition is ON 0.02299 0.710 – 4.100
Execution condition is OFF 0.02299 0.020 – 0.140
.D Execution condition is ON 0.02012 0.740 – 4.500
Execution condition is OFF 0.02012 0.020 – 0.130
.L Execution condition is ON 0.02012 0.800 – 4.300
Execution condition is OFF 0.02012 0.020 – 0.130
INTG .U.S.D.L Execution condition is ON 0.01437 0.080 0.200 2.100
Execution condition is OFF 0.01437 0.080 0.200 0.130

A-24 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
DINTG .U Execution condition is ON 0.02592 0.750 – 3.600
Execution condition is OFF 0.02026 0.020 – 0.150
.S Execution condition is ON 0.02593 0.790 – 3.600
Execution condition is OFF 0.02025 0.020 – 0.150
.D Execution condition is ON 0.02592 0.730 – 3.900
Execution condition is OFF 0.02025 0.020 – 0.150
.L Execution condition is ON 0.02592 0.780 – 3.600
Execution condition is OFF 0.02026 0.020 – 0.150
DFTOF – Execution condition is ON 0.17845 0.960 –

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

Operation Processing Time Table


Execution condition is OFF 0.01150 0.040 0.150 0.270
EXP .F Execution condition is ON 1.05490 3.750 9.200 11.700
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 2.06639 9.500 – 13.900
Execution condition is OFF 0.00617 0.040 – 0.150
LOG .F Execution condition is ON 0.49742 1.910 4.500 13.900
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 2.33075 11.700 – 16.600
Execution condition is OFF 0.00617 0.040 – 0.150
LOG10 .F Execution condition is ON 0.59225 2.240 – 13.500
Execution condition is OFF 0.00575 0.020 – 0.130
.DF Execution condition is ON 2.45144 11.900 – 15.900
Execution condition is OFF 0.00617 0.040 – 0.150
RAD .F Execution condition is ON 0.16983 0.830 1.675 2.900
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 0.11237 1.560 – 4.400
Execution condition is OFF 0.00617 0.020 – 0.150
DEG .F Execution condition is ON 0.16983 0.830 1.675 3.000
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 0.11237 1.560 – 4.300
Execution condition is OFF 0.00617 0.020 – 0.150
SIN .F Execution condition is ON 0.86523 3.330 7.925 10.700
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 1.30489 10.600 – 12.800
Execution condition is OFF 0.00617 0.040 – 0.150

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-25


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
COS .F Execution condition is ON 0.89684 3.320 7.900 10.700
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 1.27616 10.800 – 12.700
Execution condition is OFF 0.00617 0.040 – 0.150
TAN .F Execution condition is ON 1.43995 5.160 12.500 12.300
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 1.75317 12.500 – 14.500
Execution condition is OFF 0.00617 0.040 – 0.150
ASIN .F Execution condition is ON 0.89397 5.770 13.775
APPENDICES

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

Execution condition is OFF 0.00617 0.040 – 0.150


ATAN .F Execution condition is ON 1.58363 6.340 15.450 16.100
Execution condition is OFF 0.00575 0.020 0.050 0.130
.DF Execution condition is ON 3.43133 11.800 – 16.500
Execution condition is OFF 0.00617 0.040 – 0.150
ATAN2 .F Execution condition is ON 1.97701 – – –
Execution condition is OFF 0.02874 – – –
.DF Execution condition is ON 3.81610 – – –
Execution condition is OFF 0.05629 – – –
ASC – Execution condition is ON 0.08363 0.520 0.900 1.500
Execution condition is OFF 0.00575 0.020 0.050 1.200
RASC – Execution condition is ON 0.04914 0.590 1.075 2.200
Execution condition is OFF 0.00575 0.020 0.050 1.200
DASC .U Execution condition is ON 0.64944 3.100 6.325 9.800
Execution condition is OFF 0.01725 0.060 0.175 0.260
.S Execution condition is ON 0.68968 3.260 6.500 12.500
Execution condition is OFF 0.01724 0.060 0.175 0.260
.D Execution condition is ON 1.14083 5.260 11.075 10.900
Execution condition is OFF 0.01725 0.060 0.175 0.260
.L Execution condition is ON 1.14370 5.210 10.875 13.400
Execution condition is OFF 0.01724 0.060 0.175 0.260

A-26 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
RDASC .U Execution condition is ON 0.62643 2.960 6.100 12.400
Execution condition is OFF 0.01437 0.050 0.125 0.260
.S Execution condition is ON 0.64658 3.170 6.400 13.900
Execution condition is OFF 0.01437 0.050 0.125 0.260
.D Execution condition is ON 1.13219 5.380 10.700 13.600
Execution condition is OFF 0.01437 0.050 0.125 0.260
.L Execution condition is ON 1.15804 5.590 11.025 15.000
Execution condition is OFF 0.01438 0.050 0.125 0.260
HASC .U n =#4 0.56610 2.710 5.050

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

Operation Processing Time Table


Execution condition is OFF 0.01437 0.050 0.125 0.260
FASC – Execution condition is ON 9.61721 72.980 94.000 48.200
Execution condition is OFF 0.01150 0.040 0.125 0.260
RFASC – Execution condition is ON 8.92050 37.450 64.800 67.700
Execution condition is OFF 0.00862 0.050 0.125 0.270
LEN – 1 character 0.16381 0.950 1.800 6.000
1999 characters 28.7898 136.970 304.575 137.700
Execution condition is OFF 0.00863 0.050 0.125 0.260
SMOV – Send 1 character 0.54317 2.230 3.950 12.100
Send 1999 characters 112.560 218.860 490.475 258.900
Execution condition is OFF 0.00863 0.050 0.125 0.260
SADD – 1 character+1 character 0.50863 3.440 6.800 16.300
999 characters +1000 characters 61.6856 253.800 548.325 263.000
Execution condition is OFF 0.01150 0.060 0.150 0.260
SRGHT – Extract 1 character from 2 characters 0.60625 2.370 4.600 14.100
Extract 1998 characters from 1999 characters 115.966 310.440 661.100 260.600
Execution condition is OFF 0.01150 0.060 0.150 0.260
SLEFT – Extract 1 character from 2 characters 0.32755 2.280 4.375 14.500
Extract 1998 characters from 1999 characters 28.9415 219.080 490.450 261.000
Execution condition is OFF 0.01150 0.060 0.150 0.260
SMID – Extract 1 character starting from 0.61500 2.460 4.825 13.500
2nd character in 3 characters
Extract 1997 characters starting from 108.741 310.450 661.250 260.000
2nd character in 1999 characters
Execution condition is OFF 0.01437 0.070 0.175 0.260

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-27


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
SRPLC – Replace 2nd character in 2 characters 0.91580 4.780 9.075 17.500
Replace 1997 characters starting 137.538 529.580 1115.075 529.700
from 2nd character in 1999 characters
Execution condition is OFF 0.01725 0.080 0.200 0.260
SINS – Insert 1 character after 1st character 0.79097 4.110 8.250 18.800
in 2 characters
Insert 999 character after 1st 60.2375 312.580 660.150 265.200
character in 1000 characters
Execution condition is OFF 0.01438 0.070 0.175 0.260
SDEL – Delete 1st character in 2 characters 0.54016 2.810 5.425 14.200
APPENDICES

Delete 1 character starting from 61.5110 265.430 578.525 260.900


1000th character in 1999 characters
Execution condition is OFF 0.01437 0.070 0.175 0.260
STRIM – Delete 1st character in 2 characters 0.71260 3.650 – 14.900
Removes each 500 characters from 162.010 669.850 – 445.200
both ends of the 1999 characters.
Execution condition is OFF 0.01150 0.060 – 0.260
Operation Processing Time Table

SFIND – Search 1 character in 2 characters 0.55461 2.800 5.400 25.800


Search 1000 characters in 1999 72.0282 621.500 820.275 452.000
characters
Execution condition is OFF 0.01437 0.070 0.175 0.260
SFINDN – Search 1 character in 2 characters 0.62640 2.680 – 30.600
Search 1000 characters in 1999 43.3283 916.890 – 328.400
characters
Execution condition is OFF 0.01437 0.070 – 0.260
SCMP – Compare 1 character 0.29313 1.530 3.175 11.200
Compare 1999 characters 96.2133 443.500 983.475 358.100
Execution condition is OFF 0.00863 0.050 0.125 0.260
DISS – Divide 1 character 0.31035 1.590 3.175 12.200
Divide 1999 characters 73.4815 303.220 680.600 316.100
Execution condition is OFF 0.00863 0.050 0.125 0.260
UNIS – n =#1 0.22990 1.170 2.275 10.500
n =#1999 97.8354 340.830 1126.150 146.800
Execution condition is OFF 0.01150 0.060 0.150 0.250
RCOM – Execution condition is ON 0.02500 9.700 46.800 13.500
Execution condition is OFF 0.02874 0.150 0.125 3.300
CAL+ .U.S.D.L S1 =DM, S2 = Constant 0.02013 0.110 – 0.960
S1 =DM, S2 = Constant, 0.01150 0.040 – 0.300
Execution condition is OFF
.F S1 =DM, S2 = Constant 0.04311 0.180 – 2.300
S1 =DM, S2 = Constant, 0.04023 0.130 – 0.260
Execution condition is OFF
.DF S1 =DM, S2 = Constant 0.05748 2.350 – 3.400
S1 =DM, S2 = Constant, 0.05748 0.100 – 0.260
Execution condition is OFF

A-28 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
CAL– .U.S.D.L S1 =DM, S2 = Constant 0.02013 0.110 – 0.990
S1 =DM, S2 = Constant, 0.01150 0.040 – 0.300
Execution condition is OFF
.F S1 =DM, S2 = Constant 0.04311 0.180 – 2.300
S1 =DM, S2 = Constant, 0.04023 0.130 – 0.260
Execution condition is OFF
.DF S1 =DM, S2 = Constant 0.05748 2.370 – 3.500
S1 =DM, S2 = Constant, 0.05748 0.110 – 0.260
Execution condition is OFF
CALж .U.S S1 =DM, S2 = Constant 0.02587 0.120 – 0.970

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

Operation Processing Time Table


.DF S1 =DM, S2 = Constant 0.07759 1.820 – 3.400
S1 =DM, S2 = Constant, 0.07185 0.100 – 3.400
Execution condition is OFF
CAL/ .U.S S1 =DM, S2 = Constant 0.05460 0.250 – 1.500
S1 =DM, S2 = Constant, 0.04886 0.190 – 0.310
Execution condition is OFF
.D.L S1 =DM, S2 = Constant 0.05173 0.390 – 1.600
S1 =DM, S2 = Constant, 0.04598 0.330 – 0.310
Execution condition is OFF
.F S1 =DM, S2 = Constant 0.12070 0.490 – 2.400
S1 =DM, S2 = Constant, 0.11782 0.430 – 0.260
Execution condition is OFF
.DF S1 =DM, S2 = Constant 0.14081 3.130 – 3.700
S1 =DM, S2 = Constant, 0.13506 0.100 – 0.260
Execution condition is OFF
CAL& .U.D S1 =DM, S2 = Constant 0.02013 0.110 – 1.700
S1 =DM, S2 = Constant, 0.01150 0.040 – 0.250
Execution condition is OFF
CAL| .U.D S1 =DM, S2 = Constant 0.02013 0.110 – 1.600
S1 =DM, S2 = Constant, 0.01150 0.040 – 0.250
Execution condition is OFF
CAL^ .U.D S1 =DM, S2 = Constant 0.02013 0.110 – 1.700
S1 =DM, S2 = Constant, 0.01150 0.040 – 0.250
Execution condition is OFF
CAL~ .U.D Execution condition is ON 0.02587 0.110 – 1.400
Execution condition is OFF 0.02012 0.040 – 0.250

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-29


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
CAL>> .U.D Execution condition is ON 0.06323 0.110 – 1.900
Execution condition is OFF 0.02012 0.040 – 0.380
.S Execution condition is ON 0.07185 0.150 – 1.900
Execution condition is OFF 0.02012 0.080 – 0.380
.L Execution condition is ON 0.07185 0.160 – 1.700
Execution condition is OFF 0.01725 0.090 – 0.240
CAL<< .U.S.D.L Execution condition is ON 0.06323 0.110 – 1.900
Execution condition is OFF 0.02012 0.040 – 0.380
APPENDICES

CPMSET – S2 =2-byte binary 0.27061 3.000 – 19.900


S2 =1999-byte text string 121.900 345.290 – 471.900
Execution condition is OFF 0.01150 0.060 – 0.380
CPMGET – S2 =2-byte binary 0.52588 2.960 – 19.600
S2 =1999-byte text string 85.8802 208.420 – 350.500
Execution condition is OFF 0.01437 0.070 – 0.390
CPSASC – 1 character 0.44542 1.830 – 10.500
Operation Processing Time Table

1999 characters 33.4624 126.730 – 110.500


Execution condition is OFF 0.00863 0.050 – 0.260
RCPSASC – 1 character 0.42241 1.980 – 12.000
1999 characters 62.0663 262.900 – 233.700
Execution condition is OFF 0.01150 0.060 – 0.260

Extended Instructions

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
HKEY – Execution condition is ON 0.12913 0.430 1.025 3.900
Execution condition is OFF 0.06955 0.380 0.825 3.600
SEG .U Execution condition is ON 0.07472 0.610 1.000 2.200
Execution condition is OFF 0.01437 0.050 0.150 0.110
.D Execution condition is ON 0.07472 0.610 1.000 2.400
Execution condition is OFF 0.01437 0.050 0.150 0.110
BCNT .U Execution condition is ON 0.00575 0.020 0.050 1.700
Execution condition is OFF 0.00575 0.020 0.050 0.100
.D Execution condition is ON 0.01150 0.040 0.100 2.200
Execution condition is OFF 0.01150 0.040 0.100 0.100
DCNT .U n =#1 0.10058 0.640 1.125 10.800
n =#1000 41.7280 125.490 300.800 101.000
Execution condition is OFF 0.00863 0.050 0.125 0.250
.D n =#1 0.10058 0.640 1.125 10.600
n =#1000 43.1660 150.490 325.800 114.700
Execution condition is OFF 0.00863 0.050 0.125 0.250

A-30 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
SER .U n =#1 0.10058 0.790 1.125 14.400
n =#1000, searching object: 33.1140 125.640 275.825 83.600
terminal
Execution condition is OFF 0.00863 0.050 0.125 0.370
.D n =#1 0.10058 0.790 1.125 14.500
n =#1000, searching object: 34.5500 150.640 300.825 88.000
terminal
Execution condition is OFF 0.00863 0.050 0.125 0.300
DSER .U n =#1 0.29312 1.150 – 16.400

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

Operation Processing Time Table


n =#1000 41.7195 125.480 300.800 90.500
Execution condition is OFF 0.00863 0.050 0.125 0.250
.D.L n =#1 0.10058 0.630 1.125 14.500
n =#1000 43.1470 150.480 325.8 401.500
Execution condition is OFF 0.00863 0.050 0.125 0.250
.F n =#1 0.13276 – – –
n =#1000 64.7943 – – –
Execution condition is OFF 0.01150 – – –
.DF n =#1 0.15863 – – –
n =#1000 73.3985 – – –
Execution condition is OFF 0.01150 – – –
MIN .U.S n =#1 0.10058 0.630 1.125 7.300
n =#1000 41.7250 125.480 300.800 90.500
Execution condition is OFF 0.00863 0.050 0.125 0.250
.D.L n =#1 0.10058 0.630 1.125 13.900
n =#1000 43.1560 150.480 325.800 400.800
Execution condition is OFF 0.00863 0.050 0.125 0.250
.F n =#1 0.13276 – – –
n =#1000 66.1623 – – –
Execution condition is OFF 0.01150 – – –
.DF n =#1 0.15863 – – –
n =#1000 74.8005 – – –
Execution condition is OFF 0.01150 – – –

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-31


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
AVG .U.S n =#1 0.11783 0.720 1.325 12.700
n =#1000 27.4230 95.690 251.250 61.300
Execution condition is OFF 0.00863 0.050 0.125 0.250
.D n =#1 0.15230 0.840 1.625 19.300
n =#1000 34.6480 130.870 326.700 406.200
Execution condition is OFF 0.00863 0.050 0.125 0.250
.L n =#1 0.16092 0.870 1.700 20.900
n =#1000 43.2698 160.870 401.700 444.000
APPENDICES

Execution condition is OFF 0.00863 0.050 0.125 0.250


.F n =#1 0.22185 – – –
n =#1000 51.8993 – – –
Execution condition is OFF 0.01150 – – –
.DF n =#1 0.25058 – – –
n =#1000 60.5433 – – –
Execution condition is OFF 0.01150 – – –
Operation Processing Time Table

WSUM .U.S n =#1 0.09484 0.640 1.125 4.300


n =#1000 27.3653 95.530 250.850 53.000
Execution condition is OFF 0.00863 0.050 0.125 0.250
.D n =#1 0.11495 0.700 1.275 12.900
n =#1000 34.5648 130.570 325.950 399.700
Execution condition is OFF 0.00863 0.050 0.125 0.250
.L n =#1 0.12357 0.730 1.350 12.900
n =#1000 43.1850 160.570 400.950 436.100
Execution condition is OFF 0.00863 0.050 0.125 0.250
.F n =#1 0.11840 – – –
n =#1000 51.7955 – – –
Execution condition is OFF 0.01150 – – –
.DF n =#1 0.13851 – – –
n =#1000 60.4308 – – –
Execution condition is OFF 0.01150 – – –
BSUM .U n =#1 0.09196 0.630 1.250 8.200
n =#1000 20.8940 73.010 188.300 56.700
Execution condition is OFF 0.00863 0.050 0.125 0.250
CRC – n =#1 0.34830 1.740 3.275 14.900
n =#1000 92.4413 196.520 452.800 197.000
Execution condition is OFF 0.01150 0.060 0.150 0.260
ZRES – Number of device: 2 0.14081 1.020 1.775 8.900
Number of device: 1000 0.86498 33.010 48.925 11.900
Execution condition is OFF 0.00863 0.050 0.125 0.250
EXT .U Execution condition is ON 0.01150 0.040 0.100 0.270
Execution condition is OFF 0.01150 0.040 0.100 0.140
.D Execution condition is ON 0.01437 0.050 0.125 0.270
Execution condition is OFF 0.01437 0.050 0.125 0.140

A-32 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
BCMP .U n =#1 0.18105 0.890 1.725 26.400
n =#1000 74.8233 200.640 651.025 1678.700
Execution condition is OFF 0.01437 0.070 0.175 0.360
.D n =#1 0.18104 0.890 1.725 27.100
n =#1000 77.6978 250.640 701.025 1799.700
Execution condition is OFF 0.01437 0.070 0.175 0.360
BCMPI .U.S n =#1 0.15231 0.740 1.425 24.200
n =#1000 67.6203 155.560 550.850 752.200

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

Operation Processing Time Table


order data into ascending order)
n =#1000 (sorts descending 747.690 3227.050 – 1689.900
order data into ascending order)
Execution condition is OFF 0.02012 0.060 – 0.210
.D.L n =#2 (sorts descending 0.41382 2.560 – 10.500
order data into ascending order)
n =#1000 (sorts descending 663.893 3497.150 – 1763.200
order data into ascending order)
Execution condition is OFF 0.02012 0.060 – 0.260
SORTN .U.S n =#2, number of 0.77500 3.290 – 23.000
comparisons=1 (sorts descending
order data into ascending order)
n =#1000, number of 88.1250 557.700 – 247.900
comparisons=1000 (sorts descending
order data into ascending order)
Execution condition is OFF 0.11782 0.850 – 8.300
.D.L n =#2, number of 0.71250 3.340 – 23.400
comparisons=1 (sorts descending
order data into ascending order)
n =#1000, number of 89.8750 593.400 – 259.000
comparisons=1000 (sorts descending
order data into ascending order)
Execution condition is OFF 0.11782 0.850 – 8.500
FIFOW .U.D N (table length) =1 0.26438 1.100 2.175 13.500
N (table length) =1000 0.26438 1.140 2.200 16.000
Execution condition is OFF 0.01437 0.050 0.150 0.300

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-33


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
FIFOR .U N (table length) =1 0.28161 1.280 2.425 20.600
N (table length) =1000 30.8243 81.750 210.175 94.200
Execution condition is OFF 0.00863 0.050 0.125 0.390
.D N (table length) =1 0.28162 1.330 2.475 23.300
N (table length) =1000 32.2690 133.900 235.225 169.500
Execution condition is OFF 0.00863 0.050 0.125 0.300
LIFOW .U.D N (table length) =1 0.26438 1.100 2.175 13.500
N (table length) =1000 0.26439 1.140 2.200 15.900
APPENDICES

Execution condition is OFF 0.01437 0.050 0.150 0.300


LIFOR .U.D N (table length) =1 0.28737 1.080 1.925 14.300
N (table length) =1000 0.28625 1.130 1.975 14.400
Execution condition is OFF 0.01437 0.050 0.125 0.390
FWRIT .U N (table length) =1 0.24772 1.070 2.100 13.200
Execution condition is OFF 0.02012 0.070 0.200 0.390
.D N (table length) =1 0.23852 1.110 2.100 15.100
Operation Processing Time Table

Execution condition is OFF 0.01725 0.060 0.175 0.300


FINS .U N (table length) =1 0.21840 1.200 2.600 19.500
N (table length) =1000, insert 47.6200 126.200 327.650 86.300
position: start
Execution condition is OFF 0.01438 0.070 0.200 0.390
.D N (table length) =1 0.20978 1.240 2.600 21.900
N (table length) =1000, insert 49.0418 151.240 352.650 110.700
position: start
Execution condition is OFF 0.01150 0.060 0.175 0.300
FDEL .U N (table length) =1 0.20231 1.090 2.350 19.900
N (table length) =1000, delete 50.4705 126.020 327.175 93.300
position: start
Execution condition is OFF 0.00863 0.050 0.125 0.390
.D N (table length) =1 0.20116 1.140 2.400 22.300
N (table length) =1000, delete 51.9020 151.020 352.175 168.500
position: start
Execution condition is OFF 0.00863 0.050 0.125 0.300
WTIME – Execution condition is ON 10.3202 19.000 22.700 19.200
Execution condition is OFF 0.00575 0.020 0.050 0.250
SEC – Execution condition is ON 0.32471 12.400 16.925 16.100
Execution condition is OFF 0.00863 0.050 0.125 0.260
RSEC – Execution condition is ON 0.36496 15.180 22.225 16.300
Execution condition is OFF 0.00863 0.050 0.125 0.260
AJST – Execution condition is ON 10.9180 17.341 21.050 26.900
Execution condition is OFF 0.00575 0.040 0.075 0.090
LDWK – 0.39369 1.900 4.250 14.400
LDWKB – 0.39656 1.910 4.275 14.500
ANDWK – 0.39655 1.910 4.225 14.200
ANDWKB – 0.39943 1.920 4.250 14.200
ORWK – 0.39656 1.810 4.125 14.300

A-34 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
ORWKB – 0.39943 1.820 4.150 14.400
LDCAL – 0.35633 1.760 3.900 15.000
LDCALB – 0.35633 1.770 3.925 15.100
ANDCAL – 0.35920 1.770 3.875 14.600
ANDCALB – 0.35633 1.780 3.900 14.800
ORCAL – 0.35920 1.670 3.775 14.800
ORCALB – 0.35633 1.680 3.800 15.000
ARES – Execution condition is ON 0.04943 11.690 21.200 12.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

Operation Processing Time Table


DIC – Execution condition is ON 0.10633 0.550 0.775 3.100
Execution condition is OFF 0.00575 0.020 0.050 0.250
INT – 0.00000 0.000 0.000 0.000
RETI – 0.00000 0.000 0.000 0.000
CTH – Execution condition is ON - 1.160 1.750 3.700
Execution condition is OFF - 1.110 1.900 4.000
CTC – - 0.000 0.000 0.000
RFSCTH – Execution condition is ON - 0.540 – 2.500
Execution condition is OFF - 0.170 – 0.950
PLSX – Execution condition is ON - 9.550 12.875 −
Execution condition is OFF - 0.070 0.150 −
PLSY – Execution condition is ON - 9.550 12.875 −
Execution condition is OFF - 0.070 0.150 −
PSTRT − Execution condition is ON - − − 16.400
Execution condition is OFF - − − 0.100
JOGX – - 9.460 15.600 −
JOGY – - 9.460 15.600 −
JOG − - − − 10.900
ORGX – Execution condition is ON - 7.845 13.575 −
Execution condition is OFF - 0.040 0.100 −
ORGY – Execution condition is ON - 7.845 13.575 −
Execution condition is OFF - 0.040 0.100 −
ORG − Execution condition is ON - − − 5.000
Execution condition is OFF - − − 0.100
TCHX – Execution condition is ON - 9.717 10.425 −
Execution condition is OFF - 0.040 0.100 −
TCHY – Execution condition is ON - 9.717 10.425 −
Execution condition is OFF - 0.040 0.100 −

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-35


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
TCH − Execution condition is ON - − − 6.800
Execution condition is OFF - − − 0.100
HOMEX – Execution condition is ON - 9.794 12.375 –
Execution condition is OFF - 0.040 0.100 –
HOMEY – Execution condition is ON - 9.794 12.375 –
Execution condition is OFF - 0.040 0.100 –
HOME − Execution condition is ON - − − 17.900
Execution condition is OFF - − − 0.100
APPENDICES

CHGSPX – Execution condition is ON - 0.780 1.050 –


Execution condition is OFF - 0.040 0.125 –
CHGSPY – Execution condition is ON - 0.780 1.050 –
Execution condition is OFF - 0.040 0.125 –
CHGSP – Execution condition is ON - − − 9.700
Execution condition is OFF - − − 0.100
CHGTGT – Execution condition is ON - − − 9.600
Operation Processing Time Table

Execution condition is OFF - − − 0.100


RFSPSX – Execution condition is ON - 10.180 – –
Execution condition is OFF - 0.040 – –
RFSPSY – Execution condition is ON - 10.180 – –
Execution condition is OFF - 0.040 – –
RFSPS – Execution condition is ON - − − 3.700
Execution condition is OFF - − − 0.100
FCNT – Execution condition is ON - 0.760 1.475 4.700
Execution condition is OFF - 0.590 1.400 4.400
RCNT – Execution condition is ON - 1.260 1.950 10.700
Execution condition is OFF - 1.010 1.875 6.100
PLSOUT – Execution condition is ON - 0.670 1.025 4.500
Execution condition is OFF - 0.540 0.950 3.900
MCMP – n =#1 0.43105 2.020 3.900 21.100
n =#32 3.37331 12.170 28.975 28.100
Execution condition is OFF 0.01437 0.070 0.200 0.310
INCENC – n =#1 - 4.140 8.825 41.700
n =#1, Execution condition is OFF - 4.140 8.825 8.800
n =#32 - 19.370 52.075 71.800
n =#32, Execution condition is OFF - 19.370 52.075 8.800
ABSENC – n =#1 0.59487 3.820 8.575 43.000
n =#1, Execution condition is OFF 0.12645 3.820 8.575 7.800
n =#32 0.59483 19.050 51.825 73.100
n =#32, Execution condition is OFF 0.12643 19.060 51.825 7.800
LOGE – Execution condition is ON 0.01438 0.050 0.125 1.800
Execution condition is OFF 0.01438 0.050 0.125 0.370
LOGD – Execution condition is ON 0.01438 0.050 0.125 1.800
Execution condition is OFF 0.01438 0.050 0.125 0.370

A-36 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
TRGD – Execution condition is ON 0.14943 10.380 – 5.000
Execution condition is OFF 0.02012 0.060 – 1.800
PID – When RES input is ON→OFF 1.46508 5.070 13.100 50.300
When PAUSE input is ON 0.41382 1.980 4.700 24.600
During operation 0.41382 1.980 13.625 51.100
PIDAT – During standby 1.04590 5.380 – 21.200
During operation 2.73436 10.560 – 55.300
During automatic tuning 1.44119 6.680 – 29.000

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

Operation Processing Time Table


At the rising edge of execution condition 1.87500 1.070 2.625 17.940
MMKDIR – Execution condition is OFF 0.23850 1.060 2.125 12.510
At the rising edge of execution condition 2.23750 2.200 5.925 26.070
MRMDIR – Execution condition is OFF 0.23850 1.060 – 12.510
At the rising edge of execution condition 2.23750 1.940 – 25.920
MDEL – Execution condition is OFF 0.23850 1.060 – 12.620
At the rising edge of execution condition 2.33750 1.940 – 26.140
MPRINT – 1 character, Execution condition is OFF 0.33623 1.740 – 14.870
1 character, At the rising edge of 2.72500 2.850 – 28.300
execution condition
1999 characters, Execution 29.0556 136.410 – 147.230
condition is OFF
1999 characters, At the rising 31.1500 138.870 – 160.580
edge of execution condition
MREADL – Execution condition is OFF 0.44830 1.900 – 22.390
At the rising edge of execution condition 2.51250 3.060 – 36.140
MCOPY – Execution condition is OFF 0.30461 1.310 – 15.590
At the rising edge of execution condition 2.66250 3.630 – 31.240
MMOV – Execution condition is OFF 0.30461 1.310 – 15.470
At the rising edge of execution condition 2.70000 3.630 – 31.230
MREN – Execution condition is OFF 0.29888 1.630 – 14.250
At the rising edge of execution condition 2.58750 3.650 – 29.560
MFREEK – Execution condition is OFF 0.21553 0.990 – 8.600
At the rising edge of execution condition 1.88750 1.120 – 18.150
MSTAT – Execution condition is OFF 0.32184 1.510 – 14.490
At the rising edge of execution condition 2.32500 2.570 – 27.860
AWNUM – At the rising edge of execution condition - 0.560 1.100 5.400
Execution condition is OFF - 0.490 1.225 5.100

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-37


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
7300 5000/3000 KV-1000 Series
AWMSG – 1 character, At the rising edge of - 0.900 1.950 9.900
execution condition
24 characters, At the rising edge of - 2.810 6.625 11.800
execution condition
Execution condition is OFF - 0.860 1.725 6.600
AWSHOW – Execution condition is OFF 0.08318 – – –
At the rising edge of execution condition 0.07184 – – –
AWHIDE – Execution condition is OFF 0.08325 – – –
At the rising edge of execution condition 0.07184 – – –
APPENDICES

SPRD – Execution condition is ON 7.08838 2.260 – 23.780


Execution condition is OFF 0.29507 1.300 – 8.400
SPWR – Execution condition is ON 7.08086 2.260 – 24.050
Execution condition is OFF 0.30053 1.300 – 8.660
SSVC – Execution condition is ON 7.11596 2.260 – 23.790
Execution condition is OFF 0.30115 1.300 – 8.410
Operation Processing Time Table

RFSFRC – Execution condition is ON 0.04598 0.070 – 0.600


Execution condition is OFF 0.04598 0.050 – 0.240
RFSCI .U.S.D.L.F 1 word (expansion unit) 3.56646 5.400 – 27.760
1 word (CPU Ethernet/IP) 3.98146 12.900 – –
Execution condition is OFF 0.02013 0.020 – 0.020
RFSCO .U.S.D.L.F 1 word (expansion unit) 3.63398 5.400 – 27.810
1 word (CPU Ethernet/IP) 4.01771 13.000 – –
Execution condition is OFF 0.02013 0.020 – 0.020

A-38 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Operation Processing Time Table

MEMO

APPENDICES
Operation Processing Time Table

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-39


Instruction Size Table
The calculation standards of number of basic byte, destination size, and operand table size are shown below.
● Number of basic byte :
This can be calculated after the device is specified (no index modification) in operands. However, a
constant should be specified in the operation for which only the constant can be specified.
● Destination size (MIN) :
This can be calculated after following specifyings are performed in operands.
• Constant
• Device (no index modification)
● Destination size (MAX):
This can be calculated after following specifyings are performed in operands.
• Indirect specifying+ Index modification (amendment through index register)
• Character string constant (31 characters)
APPENDICES

• Direct I/O(DR) *only instruction words can be specified by DR in KV-7500/7300/5500/5000/3000 and


KV Nano Series
● Operand table size (MIN) (KV Nano Series only) :
This can be calculated after following specifyings are performed in operands.
• Constant
• Device (no index modification)

● Operand table size (MAX) (KV Nano Series only) :


Instruction Size Table

• Device (amendment through index register)


• Character string constant (31 characters)

Calculation Method of Byte Size

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

A-40 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

■ Differential execution type instruction (@)


Instruction with @, basic byte size + 1.

■ 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

About Destination Size

Destination size may vary due to the configuration site of suffix of instruction and the device and

Instruction Size Table


instruction specified in operand.

■ 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).

Operand Table Size (For the KV Nano Series)

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.

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-41


Instruction Size Table

Instruction Size 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

A-42 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Command size MIN MAX Word Bit
OR> 7 32 64 0 0
OR<= 7 32 64 0 0
OR>= 7 32 64 0 0
OR<> 7 32 64 0 0
OUT 4 4 24 0 0
OUB 4 4 24 0 0
SET 4 4 24 0 0
RES 4 4 24 0 0
KEEP 4 32 52 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

Instruction Size Table


BOUT 6 12 96 0 0
BOUB 6 32 124 0 0
BSET 6 12 96 0 0
BRES 6 12 96 0 0
TMR 7 64 80 0 0
TMH 7 64 80 0 0
TMS 7 64 80 0 0
TMU 8 64 80 0 0
C 10 72 100 0 0
OUTC 8 48 64 0 0
ITVL 7 24 80 0 0
UDC 7 24 48 0 0
UDT 7 32 56 0 0
END 1 20 20 0 0
ENDH 1 0 0 0 0
CON 1 0 0 0 0
MPS 1 4 4 0 0
MRD 1 4 4 0 0
MPP 1 4 4 0 0
ANL 1 4 4 0 0
ORL 1 4 4 0 0
INV 2 4 4 0 0
MEP 2 8 8 0 1
MEF 2 16 16 0 1
RFSX 8 12 36 0 0
RFSY 8 12 36 0 0
SFT 7 24 60 0 1
STP 4 64 68 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-43


Instruction Size Table

Basic byte Object size Internal working capacity


Command size MIN MAX Word Bit
STE 1 0 0 0 0
STG 4 84 84 0 1
JMP 4 60 60 0 0
ENDS 1 52 52 0 0
W-ON 7 40 64 0 0
W-OFF 7 44 68 0 0
W-UE 7 28 52 0 1
W-DE 7 28 52 0 1
MC 8 12 12 0 0
APPENDICES

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

A-44 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Command size MIN MAX Word Bit
UMALLOC 13 40 128 0 2
UREAD 14 24 108 0 0
UWRIT 14 24 108 0 0
UFILL 14 20 104 0 0
MOV 7 8 68 0 0
LDA 4 8 24 0 0
STA 4 4 48 0 0
PLDA 8 40 68 0 0
PSTA 8 52 120 0 0

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

Instruction Size Table


ADD 4 12 28 0 0
SUB 4 12 28 0 0
MUL 4 16 32 0 0
DIV 4 44 60 0 0
INC 4 24 72 0 0
DEC 4 24 72 0 0
ROOT 1 8 8 0 0
POW 5 8 24 0 0
CMP 4 8 24 0 0
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
SRA 4 8 24 0 0
SLA 4 8 24 0 0
ASRA 5 8 24 0 0
ASLA 5 8 24 0 0
RRA 4 8 24 0 0
RLA 4 8 24 0 0
RRNCA 5 8 24 0 0
RLNCA 5 8 24 0 0
WSR 10 16 84 0 0
WSL 10 16 84 0 0
BSR 11 16 60 0 0
BSL 11 16 60 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-45


Instruction Size Table

Basic byte Object size Internal working capacity


Command size MIN MAX Word Bit
LIMIT 14 28 112 0 0
BANDC 15 28 112 0 0
ZONE 15 28 112 0 0
APR 14 20 288 0 0
RAMP 14 52 136 8 1
TPOUT 11 40 84 4 1
LLFLT 11 60 148 12 1
TBCD 1 4 4 0 0
TBIN 1 4 4 0 0
APPENDICES

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

A-46 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Command size MIN MAX Word Bit
RASC 1 8 8 0 0
DASC 7 24 76 0 0
RDASC 7 20 92 0 0
HASC 11 32 96 0 0
RHASC 8 20 92 0 0
FASC 11 16 104 0 0
RFASC 8 12 72 0 0
SMOV 7 12 164 0 0
SADD 10 16 284 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

Instruction Size Table


SFIND 14 20 304 0 0
SFINDN 14 20 324 0 0
SCMP 7 12 244 0 0
DISS 7 12 164 0 0
UNIS 10 16 104 0 0
LEN 7 12 164 0 0
RCOM 10 36 96 0 1
CAL+ 11 20 100 0 0
CAL- 11 20 100 0 0
CALж 11 20 104 0 0
CAL/ 11 44 176 0 0
CAL& 11 20 100 0 0
CAL│ 11 20 100 0 0
CAL^ 11 20 100 0 0
CAL~ 8 28 80 0 0
CAL>> 8 28 80 0 0
CAL<< 8 28 80 0 0
CPMSET 11 16 104 0 0
CPMGET 14 20 144 0 0
CPSASC 8 12 84 0 0
RCPSASC 11 16 204 0 0
HKEY 7 324 324 0 0
SEG 8 20 52 0 0
BCNT 1 8 8 0 0
DCNT 7 12 64 0 0
SER 7 12 64 0 0
DSER 14 20 124 0 0
MAX 7 12 112 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-47


Instruction Size Table

Basic byte Object size Internal working capacity


Command size MIN MAX Word Bit
MIN 7 12 112 0 0
AVG 7 12 112 0 0
WSUM 8 12 112 0 0
BSUM 8 12 64 0 0
CRC 11 16 76 0 0
ZRES 7 12 36 0 0
EXT 1 16 16 0 0
BCMP 14 20 120 0 0
BCMPI 14 20 100 0 0
APPENDICES

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

A-48 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Command size MIN MAX Word Bit
LOGE 5 32 48 0 0
LOGD 5 32 48 0 0
TRGD 5 128 140 0 0
MWRIT 17 36 252 0 1
MREAD 17 36 252 0 1
MFREE 11 32 80 0 1
MMKDIR 8 24 152 0 1
MRMDIR 8 24 152 0 1
MDEL 8 24 152 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

Instruction Size Table


AWSHOW 5 20 36 0 1
AWHIDE 5 20 36 0 1
SPRD 16 64 144 0 2
SPWR 16 64 144 0 2
SSVC 16 64 144 0 2
RFSFRC 2 64 64 0 0
RFSCI 8 0 28 0 0
RFSCO 8 0 28 0 0
*1 For CPU function version 2.1 or earlier, the object size is shown below.
FOR basic byte size: 3. Object size MIN: 0. MAX: 0. Internal work usage word: 0. Bit: 0.
NEXT basic byte size: 1. Object size MIN: 48. MAX: 48. Internal work usage word: 0. Bit: 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-49


Instruction Size Table

■ 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

Basic byte Object size Internal working capacity


Command
size MIN MAX Word Bit
SET 4 4 4 0 0
RES 4 4 4 0 0
KEEP 4 32 32 0 0
DIFU 4 28 28 0 1
DIFD 4 40 40 0 1
ONDL 7 36 36 4 1
OFDL 7 36 36 4 1
SHOT 7 36 36 4 2
FLIK 10 44 44 4 1

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

Instruction Size Table


TMS 7 68 68 0 0
TMU 8 24 40 0 0
C 10 72 72 0 0
OUTC 8 48 48 0 0
ITVL 7 24 24 0 0
UDC 7 24 24 0 0
UDT 7 28 28 0 0
END 1 12 12 0 0
ENDH 1 0 0 0 0
CON 1 0 0 0 0
MPS 1 4 4 0 0
MRD 1 4 4 0 0
MPP 1 4 4 0 0
ANL 1 4 4 0 0
ORL 1 4 4 0 0
INV 2 4 4 0 0
MEP 2 8 8 0 1
MEF 2 16 16 0 1
RFSX 8 60 60 0 0
RFSY 8 12 40 0 0
SFT 7 24 56 0 1
STP 4 52 52 0 0
STE 1 0 0 0 0
STG 4 88 88 0 1
JMP 4 60 60 0 0
ENDS 1 52 52 0 0
W-ON 7 40 64 0 0
W-OFF 7 44 68 0 0
W-UE 7 28 52 0 1
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-51
Instruction Size Table

Basic byte Object size Internal working capacity


Command
size MIN MAX Word Bit
W-DE 7 28 52 0 1
MC 8 12 12 0 0
MCR 1 4 4 0 0
CALL 3 24 24 0 0
ECALL 8 40 40 0 0
SBN 3 0 0 0 0
RET 1 16 16 0 0
FOR 4 52 60 0 0
NEXT 1 40 40 0 0
APPENDICES

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

Basic byte Object size Internal working capacity


Command
size MIN MAX Word Bit
ADD 4 12 28 0 0
SUB 4 12 28 0 0
MUL 4 16 32 0 0
DIV 4 44 60 0 0
INC 4 24 52 0 0
DEC 4 24 52 0 0
ROOT 1 8 8 0 0
POW 5 8 24 0 0
CMP 4 8 24 0 0

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

Instruction Size Table


SRA 4 8 24 0 0
SLA 4 8 24 0 0
ASRA 5 8 24 0 0
ASLA 5 8 24 0 0
RRA 4 8 24 0 0
RLA 4 8 24 0 0
RRNCA 5 8 24 0 0
RLNCA 5 8 24 0 0
WSR 10 24 72 0 0
WSL 10 24 72 0 0
BSR 11 24 68 0 0
BSL 11 24 68 0 0
LIMIT 14 28 92 0 0
BANDC 15 28 92 0 0
ZONE 15 28 92 0 0
APR 14 28 92 0 0
RAMP 14 52 116 8 1
TPOUT 11 40 84 4 1
LLFLT 11 60 108 12 1
TBCD 1 4 4 0 0
TBIN 1 4 4 0 0
MPX 3 24 24 0 0
DMX 1 20 20 0 0
GRY 1 4 4 0 0
RGRY 1 4 4 0 0
DISN 11 28 72 0 0
UNIN 11 28 72 0 0
DISB 11 28 72 0 0
UNIB 11 28 72 0 0
- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-53
Instruction Size Table

Basic byte Object size Internal working capacity


Command
size MIN MAX Word Bit
SWAP 1 4 4 0 0
BSWAP 8 20 52 0 0
XCH 7 20 52 0 0
DECO 7 20 32 0 0
ENCO 8 20 32 0 0
ABS 3 28 28 0 0
FLOAT 1 8 8 0 0
DFLOAT 2 8 8 0 0
INTG 1 12 12 0 0
APPENDICES

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

A-54 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Command
size MIN MAX Word Bit
SRGHT 11 24 176 0 0
SLEFT 11 24 176 0 0
SMID 14 28 196 0 0
SRPLC 17 32 320 0 0
SINS 14 28 300 0 0
SDEL 14 28 196 0 0
STRIM 11 24 176 0 0
SFIND 14 28 300 0 0
SFINDN 14 28 300 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

Instruction Size Table


CALж 11 20 84 0 0
CAL/ 11 52 96 0 0
CAL& 11 20 84 0 0
CAL│ 11 20 84 0 0
CAL^ 11 20 84 0 0
CAL~ 8 16 64 0 0
CAL>> 8 16 80 0 0
CAL<< 8 16 80 0 0
CPMSET 11 24 72 0 0
CPMGET 14 28 92 0 0
CPSASC 8 20 52 0 0
RCPSASC 11 24 176 0 0
HKEY 7 316 316 0 0
SEG 8 20 52 0 0
BCNT 1 8 8 0 0
DCNT 7 20 52 0 0
SER 7 20 52 0 0
DSER 14 28 92 0 0
MAX 7 20 52 0 0
MIN 7 20 52 0 0
AVG 7 20 52 0 0
WSUM 8 20 52 0 0
BSUM 8 20 52 0 0
CRC 11 24 68 0 0
ZRES 7 20 44 0 0
EXT 1 16 16 0 0
BCMP 14 28 88 0 0
BCMPI 14 28 88 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-55


Instruction Size Table

Basic byte Object size Internal working capacity


Command
size MIN MAX Word Bit
RND 5 16 32 0 0
SORT 11 24 72 0 0
SORTN 14 44 100 4 1
FIFOW 7 20 52 0 0
FIFOR 7 20 52 0 0
LIFOW 8 20 52 0 0
LIFOR 8 20 52 0 0
FWRIT 11 28 72 0 0
FINS 11 32 72 0 0
APPENDICES

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

A-56 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Command
size MIN MAX Word Bit
HOMEX 2 16 16 0 0
HOMEY 2 16 16 0 0
CHGSPX 5 16 32 0 0
CHGSPY 5 16 32 0 0
RFSPSX 2 16 16 0 0
RFSPSY 2 16 16 0 0
MCMP 14 28 88 0 0
ABSENC 14 40 100 0 1
INCENC 15 44 88 0 1

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

Instruction Size Table


TRGD 5 44 60 0 0
MWRIT 17 36 216 0 1
MREAD 17 36 216 0 1
MFREE 8 24 52 0 1
MMKDIR 8 24 156 0 1
MRMDIR 8 24 156 0 1
MDEL 8 24 156 0 1
MPRINT 11 28 280 0 1
MREADL 14 32 196 0 1
MCOPY 14 32 300 0 1
MMOV 14 32 300 0 1
MREN 11 28 280 0 1
MFREEK 8 24 52 0 1
MSTAT 11 24 176 0 1
AWNUM 5 20 36 0 1
AWMSG 5 20 140 0 1
SPRD 19 64 124 0 2
SPWR 19 64 124 0 2
SSVC 19 64 124 0 2
RFSFRC 2 20 20 0 0
RFSCI 8 8 8 0 0
RFSCO 8 8 8 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-57


Instruction Size Table

■ 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

A-58 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Instruction
size MIN MAX Word Bit
FLIK 10 52 116 2 1
ALT 4 24 40 0 1
BOUT 7 12 88 0 0
BOUB 7 32 112 0 0
BSET 7 12 80 0 0
BRES 7 12 80 0 0
TMR 7 32 52 0 0
TMH 7 32 52 0 0
TMS 7 32 52 0 0
C 10 52 76 0 0

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

Instruction Size Table


MRD 1 4 4 0 0
MPP 1 4 4 0 0
ANL 1 4 4 0 0
ORL 1 4 4 0 0
SFT 7 32 72 0 1
MEMSW 6 0 0 0 0
STP 4 36 52 0 0
STE 1 0 0 0 0
STG 4 104 104 0 1
JMP 4 68 68 0 0
ENDS 1 64 64 0 0
W-ON 7 52 84 0 0
W-OFF 7 56 88 0 0
W-UE 7 36 68 0 1
W-DE 7 36 68 0 1
MC 1 4 4 0 0
MCR 1 4 4 0 0
CALL 3 12 12 0 0
SBN 3 0 0 0 0
RET 1 16 16 0 0
FOR 4 32 52 0 0
NEXT 1 24 24 0 0
BREAK 1 12 12 0 0
CJ 5 28 28 0 0
NCJ 5 28 28 0 0
GOTO 5 24 24 0 0
LABEL 5 0 0 0 0
MCALL 21 48 452 0 0
MSTRT 21 48 452 0 0
MEND 2 12 12 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-59


Instruction Size Table

Basic byte Object size Internal working capacity


Instruction
size MIN MAX Word Bit
MDSTRT 10 12 12 0 0
MDSTOP 10 12 12 0 0
ZPUSH 5 16 36 0 0
ZPOP 5 16 36 0 0
ADRSET 8 8 60 0 0
ADRINC 5 28 68 0 0
ADRDEC 5 28 68 0 0
ADRADD 8 56 100 0 0
ADRSUB 8 60 104 0 0
DW 7 8 44 0 0
APPENDICES

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

A-60 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Instruction
size MIN MAX Word Bit
DISN 7 24 64 0 0
UNIN 7 20 60 0 0
DISB 7 24 64 0 0
UNIB 7 20 60 0 0
SWAP 1 4 4 0 0
XCH 7 20 60 0 0
DECO 7 20 36 0 0
ENCO 7 20 36 0 0
FLOAT 1 8 8 0 0
INTG 1 12 12 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

Instruction Size Table


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 28 68 0 0
RDASC 7 20 60 0 0
HASC 11 32 96 0 0
RHASC 8 20 60 0 0
FASC 11 28 88 0 0
RFASC 8 20 60 0 0
SMOV 7 20 168 0 0
SADD 10 24 300 0 0
SRGHT 11 24 196 0 0
SLEFT 11 24 196 0 0
SMID 14 28 224 0 0
SRPLC 17 32 356 0 0
SINS 14 28 328 0 0
SDEL 14 28 224 0 0
SFIND 14 28 328 0 0
SCMP 7 20 276 0 0
DISS 7 20 168 0 0
UNIS 10 24 88 0 0
LEN 7 20 168 0 0
RCOM 7 20 60 0 0
HKEY 7 408 408 0 0
SEG 8 24 68 0 0
BCNT 1 8 8 0 0
DCNT 7 20 64 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-61


Instruction Size Table

Basic byte Object size Internal working capacity


Instruction
size MIN MAX Word Bit
SER 7 20 64 0 0
MAX 7 20 64 0 0
MIN 7 20 64 0 0
AVG 7 20 64 0 0
WSUM 8 20 64 0 0
BSUM 8 20 64 0 0
CRC 11 20 60 0 0
ZRES 7 16 52 0 0
EXT 1 16 20 0 0
BCMP 14 28 108 0 0
APPENDICES

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

A-62 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Basic byte Object size Internal working capacity


Instruction
size MIN MAX Word Bit
ORGY 1 16 16 0 0
TCHX 1 16 16 0 0
TCHY 1 16 16 0 0
HOMEX 2 16 16 0 0
HOMEY 2 16 16 0 0
CHGSPX 5 16 40 0 0
CHGSPY 5 16 40 0 0
MCMP 14 28 112 0 0
ABSENC 14 52 128 0 1
INCENC 15 52 108 0 1

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

Instruction Size Table


MFREE 8 32 68 0 1
MMKDIR 8 32 176 0 1
AWNUM 5 28 52 0 1
AWMSG 5 28 156 0 1

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-63


Instruction Size Table

■ 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

A-64 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Object size Operand table size Internal working capacity


Instruction Basic byte
size
MIN MAX MIN MAX Word Bit
DIFU 4 2 2 20 36 0 1
DIFD 4 2 2 20 36 0 1
ONDL 7 2 2 40 60 4 1
OFDL 7 2 2 40 60 4 1
SHOT 7 2 2 48 68 4 2
FLIK 10 2 2 48 80 4 1
ALT 4 2 2 28 48 0 1
BOUT 7 2 2 28 48 0 0
BOUB 7 2 2 28 48 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

Instruction Size Table


ITVL 7 2 2 36 40 0 0
UDC 7 2 8 8 28 0 0
UDT 7 2 8 8 28 0 0
END 1 16 16 0 0 0 0
ENDH 1 0 0 0 0 0 0
CON 1 0 0 0 0 0 0
MPS 1 8 8 0 0 0 0
MRD 1 10 10 0 0 0 0
MPP 1 10 10 0 0 0 0
ANL 1 6 6 0 0 0 0
ORL 1 8 8 0 0 0 0
INV 2 2 2 0 0 0 0
MEP 2 8 8 12 12 0 1
MEF 2 8 8 12 12 0 1
RFSX 8 4 4 28 48 0 0
RFSY 8 4 4 28 48 0 0
SFT 7 2 2 44 60 0 1
STP 4 26 28 8 28 0 0
STE 1 0 0 0 0 0 0
STG 4 90 90 0 0 0 1
JMP 4 60 60 0 0 0 0
ENDS 1 50 50 0 0 0 0
W-ON 7 2 2 40 64 0 0
W-OFF 7 2 2 40 64 0 0
W-UE 7 2 2 48 72 0 1
W-DE 7 2 2 48 72 0 1
MC 8 36 36 0 0 0 0
MCR 1 22 22 0 0 0 0
CALL 3 50 50 8 8 0 0
ECALL 8 36 36 12 24 0 0
SBN 3 54 54 0 0 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-65


Instruction Size Table

Object size Operand table size Internal working capacity


Instruction Basic byte
size
MIN MAX MIN MAX Word Bit
RET 1 56 56 0 0 0 0
FOR 4 18 18 20 32 0 0
NEXT 1 30 30 8 8 0 0
BREAK 1 34 34 8 8 0 0
CJ 5 34 34 8 8 0 0
NCJ 5 38 38 8 8 0 0
GOTO 5 34 34 8 8 0 0
LABEL 5 0 0 0 0 0 0
SCJ 5 80 80 8 8 0 1
APPENDICES

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

A-66 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Object size Operand table size Internal working capacity


Instruction Basic byte
size
MIN MAX MIN MAX Word Bit
ENRA 5 4 4 12 24 0 0
COM 1 14 20 0 0 0 0
NEG 1 6 18 0 0 0 0
SRA 4 4 4 12 24 0 0
SLA 4 4 4 12 24 0 0
ASRA 5 4 4 12 24 0 0
ASLA 5 4 4 12 24 0 0
RRA 4 4 4 12 24 0 0
RLA 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

Instruction Size Table


ZONE 15 4 4 36 104 0 0
APR 14 4 4 44 108 0 0
RAMP 14 2 2 60 120 8 1
TPOUT 11 2 2 48 80 4 1
LLFLT 11 2 2 64 92 12 1
TBCD 1 14 14 0 0 0 0
TBIN 1 14 14 0 0 0 0
MPX 3 18 18 0 0 0 0
DMX 1 14 14 0 0 0 0
GRY 1 14 14 0 0 0 0
RGRY 1 14 14 0 0 0 0
DISN 11 4 4 36 68 0 0
UNIN 11 4 4 36 88 0 0
DISB 11 4 4 36 68 0 0
UNIB 11 4 4 36 88 0 0
SWAP 1 6 6 0 0 0 0
BSWAP 8 4 4 28 48 0 0
XCH 7 4 4 32 80 0 0
DECO 7 4 4 28 48 0 0
ENCO 8 4 4 28 48 0 0
ABS 3 18 18 0 0 0 0
FLOAT 1 18 18 0 0 0 0
DFLOAT 2 18 18 0 0 0 0
INTG 1 4 4 4 4 0 0
DINTG 2 4 4 4 4 0 0
DFTOF 2 4 4 4 4 0 0
FTODF 2 4 4 4 4 0 0
DISF 10 4 4 28 104 0 0
UNIF 10 4 4 28 84 0 0
EXP 1 4 4 4 4 0 0
LOG 1 4 4 4 4 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-67


Instruction Size Table

Object size Operand table size Internal working capacity


Instruction Basic byte
size
MIN MAX MIN MAX Word Bit
LOG10 3 4 4 4 4 0 0
RAD 1 4 4 4 4 0 0
DEG 1 4 4 4 4 0 0
SIN 1 4 4 4 4 0 0
COS 1 4 4 4 4 0 0
TAN 1 4 4 4 4 0 0
ASIN 1 4 4 4 4 0 0
ACOS 1 4 4 4 4 0 0
ATAN 1 4 4 4 4 0 0
APPENDICES

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

A-68 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Size Table

Object size Operand table size Internal working capacity


Instruction Basic byte
size
MIN MAX MIN MAX Word Bit
SEG 8 4 4 20 44 0 0
BCNT 1 4 4 4 4 0 0
DCNT 7 4 4 28 48 0 0
SER 7 4 4 28 48 0 0
DSER 14 4 4 52 92 0 0
MAX 7 4 4 28 48 0 0
MIN 7 4 4 28 48 0 0
AVG 7 4 4 28 48 0 0
WSUM 8 4 4 28 48 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

Instruction Size Table


SORTN 14 2 2 72 108 4 1
FIFOW 7 4 4 28 48 0 0
FIFOR 7 4 4 28 68 0 0
LIFOW 8 4 4 28 48 0 0
LIFOR 8 4 4 28 68 0 0
FWRIT 11 4 4 36 68 0 0
FINS 11 4 4 36 68 0 0
FDEL 8 4 4 28 48 0 0
WTIME 4 4 4 20 28 0 0
SEC 7 4 4 36 52 0 0
RSEC 7 4 4 36 52 0 0
AJST 1 4 4 4 4 0 0
LDWK 8 2 2 20 44 0 0
LDWKB 8 2 2 20 44 0 0
ANDWK 8 2 2 20 44 0 0
ANDWKB 8 2 2 20 44 0 0
ORWK 8 2 2 20 44 0 0
ORWKB 8 2 2 20 44 0 0
LDCAL 8 2 2 20 44 0 0
LDCALB 8 2 2 20 44 0 0
ANDCAL 8 2 2 20 44 0 0
ANDCALB 8 2 2 20 44 0 0
ORCAL 8 2 2 20 44 0 0
ORCALB 8 2 2 20 44 0 0
ARES 1 18 18 0 0 0 0
HSP 4 2 2 20 20 0 0
DI 1 18 18 0 0 0 0
EI 1 18 18 0 0 0 0
DIC 5 4 12 16 28 0 0
INT 4 50 50 4 4 0 0
RETI 1 4 4 0 0 0 0

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-69


Instruction Size Table

Object size Operand table size Internal working capacity


Instruction Basic byte
size
MIN MAX MIN MAX Word Bit
CTH 7 24 24 0 0 0 0
CTC 9 0 0 0 0 0 0
RFSCTH 4 24 24 0 0 0 0
PSTRT 11 4 4 28 64 0 0
JOG 8 2 2 20 44 0 0
ORG 8 4 4 20 44 0 0
TCH 11 4 4 28 64 0 0
HOME 8 4 4 20 44 0 0
CHGSP 11 4 4 28 64 0 0
APPENDICES

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

A-70 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

Control Relays CR (For KV-7500/7300)

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-71


CR/CM List

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

CR3203 R CPU memory save error


CR3204 to
- Reserved for the system
CR3206
Instruction RAM mode operation
The RAM mode activation of file register instructions, storage device instructions towards the
CR3207
CPU memory.
(ON: enable, OFF: disable)
CR3208 to
- Reserved for the system
CR3209
CR/CM List

CR3210 R Arbitrary logging/trace operation


CR3211 to - Reserved for the system
CR3213
CR3214 R Storage instruction executing
CR3215 - Reserved for the system
CR3300 to
Alarm relay
CR3415
CR3500 R Alarm operation relay (ON: one of CR3300 to CR3415 is turned ON)
Record an entry in the log when an alarm relay switches from ON to OFF (ON: record, OFF: do
CR3501
not record)
CR3502 The alarm relay log is cleared when this switches from OFF to ON
CR3503 to
- Reserved for the system
CR3512
CR3513 R Logging internal buffer overflow
CR3514 HKEY instruction - Disables multiple keys
CR3515 R HKEY instruction - Scan completion
CR3600 to
R HKEY information storage area
CR3615
CR3700 to
- Reserved for the system
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-PRG 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 (Set this relay in the ladder program)
CR3910 to
- Reserved for the system
CR4000
CR4001 to
R Expansion unit status (expansion units 1 - 48)
CR4300
CR4301 to
- Reserved for the system
CR4315
CR4400 R AW up key being pressed
CR4401 R AW down key being pressed
CR4402 R AW left key being pressed
A-72 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
CR/CM List

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-73


CR/CM List

Control Memory CM (For KV-7500/7300)

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

CM0702 R Read from RTC (day)


CM0703 R Read from RTC (hour)
CM0704 R Read from RTC (minute)
CM0705 R Read from RTC (second)
CM0706 R Read from RTC (day of the week)
CM0707 to
- Reserved for the system
CM709
CM0710 R File register current bank number
CM0711 - Reserved for the system
CR/CM List

CM0712 R Computing error detailed information*


CM0713 to
- Reserved for the system
CM0899
CM900 R CPU function version
CM901 to
- Reserved for the system
CM906
CM907 R Project Version
CM908 to
- Reserved for the system
CM999
CM1000 and
R Scan time measuring value (1 μs) (32-bit)
CM1001
CM1002 and
R END processing time measured value (1 μs unit) (32-bit)
CM1003
CM1004 and
R Minimum fixed scanning time (1 μs unit) (32-bit)
CM1005
CM1006 and
R Maximum fixed scanning time (1 μs unit) (32-bit)
CM1007
CM1008 and
Fixed scanning time run set value (1 μs unit) (32-bit)
CM1009
CM1010 and
END processing time set value (1 μs unit) (32-bit)
CM1011
CM1012 and
R Scanning time when setting is exceeded (1 μs unit) (32-bit)
CM1013
CM1014 and
R END processing time exceeds value (1 μs unit) (32-bit)
CM1015
CM1016 to
- Reserved for the system
CM1029
CM1030 and
R 32-bit 1 ms Free Run counter
CM1031
CM1032 and
R 32-bit 10 μs Free Run counter
CM1033
CM1034 and
R 32-bit 1 μs Free Run counter
CM1035
CM1036 and
R 32-bit 0.1 μs Free Run counter
CM1037
CM1038 to
- Reserved for the system
CM1499
CM1500 to
R Log/trace (ID0 to ID9) File Save Counter
CM1509

A-74 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-75


CR/CM List

Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold

CM1789 - Reserved for the system


CM1790 Automatic loading folder number (request)
CM1791 R Automatic loading complete code
CM1792 R Automatic loading folder number (complete)
CM1793 - Reserved for the system
CM1794 Run load folder number (request)
CM1795 R Run load complete code
CM1796 R Run load folder number (complete)
CM1797 to
- Reserved for the system
CM1868
CM1869 R Number of connected expansion units
APPENDICES

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).

A-76 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

■Detailed Information of the Error-For KV-7500/7300


• Error number 128 (calculation error)
Detailed Information,
Description
Piece n
Error details
0 (Not used.)
1 Incorrect indirect specification.
2 The indirectly specified target is T/C.
3 Incorrect simple indirect specification.
4 Outside of operand range.
5 Floating-point real number overflow.
6 Incorrect device specification.
7 The ROOT instruction operand is negative.
8 No bits turned ON with the ENCO instruction.
9 Floating-point real number format error.

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-77


CR/CM List

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

Detailed Information, Piece n Description


Detailed information, piece 1
The number of units as specified in the unit setup information
(CM5107)
Detailed information, piece 2
The number of units that are actually connected
(CM5108)
Detailed information, pieces 3 to 20
Fixed to 00H
(CM5109 to CM5126)
• Error number 127 (Auto loading failure error)
CR/CM List

Detailed Information, Piece n Description


Detailed information, piece 1
(CM5157) Detailed content of the error

Detailed information, pieces 2 to 20


Fixed to 00H
(CM5158 to CM5176)
• Error number 129 (Unit error)
Detailed Information, Piece n Description
Detailed information, piece 1
Unit number
(CM5157)
Detailed information, piece 2
Error number of each unit
(CM5158)
Detailed information, pieces 3 to 20
Fixed to 00H
(CM5159 to CM5176)
• Error numbers other than those listed above
Detailed Information, Piece n Description
Detailed information, pieces 1 to 20 Fixed to 00H

* Only CPU unit that supports Bluetooth communication is valid.


A-78 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
CR/CM List

Control Relays CR (For KV-5500/5000/3000)

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

CR0000 Logging/trace execution (ON: enable, OFF: disable)


CR0001 R Logging/trace operation
CR0002 R Logging/trace file write end
CR0003 R Logging buffer 50% alarm

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-79


CR/CM List

Attributes
Device No. R: Read only. Function
Blank: R/W

Comparator match output to R500/R504 is disabled (ON: enable,


CR2108
OFF: disable)
Operation when Comparator match output to R500/R504 is set as OFF (ON:
CR2109
high-speed enable, OFF: disable)
counter Comparator match output to R500/R504 is set as ON (ON:
CR2110
comparator enable, OFF: disable)
CTC1 is ON Invert ON/OFFstate of comparator match output to R500/R504 whenever
CR2111
in ON state. (ON: enable, OFF: disable)
CR2112 Auto reset of CTH0 (ON: enable, OFF: disable)
Option of 1-phase
APPENDICES

1Override 2Override 4Override 2-phase


counting input no direction With direction
CR2113 to CR2115 methods of CR2113 OFF ON OFF ON OFF ON

high-speed CR2114 OFF OFF ON ON OFF OFF


CR2115 OFF OFF OFF OFF ON ON
counter CTH0
CR2200 R CTH1 special internal clock (1µs)
CR2201 R CTH1 special internal clock (10µs)
CR2202 R CTH1 special internal clock (100µs)
CR2203 Auto reset of CTH1 (ON: enable, OFF: disable)
CR/CM List

Comparator match output to R501/R505 is disabled (ON: enable,


CR2204
Operation when OFF: disable)
high-speed Comparator match output to R501/R505 is set as OFF (ON:
CR2205
counter enable, OFF: disable)
comparator Comparator match output to R501/R505 is set as ON (ON:
CR2206
CTC2 is ON enable, OFF: disable)
Invert ON/OFFstate of comparator match output to R501/R505
CR2207
whenever in ON state (ON: enable, OFF: disable)
Comparator match output to R501/R505 is disabled (ON: enable,
CR2208
OFF: disable)
Operation when Comparator match output to R501/R505 is set as OFF (ON:
CR2209
high-speed enable, OFF: disable)
counter Comparator match output to R501/R505 is set as ON (ON:
CR2210
comparator enable, OFF: disable)
CTC3 is ON Invert ON/OFFstate of comparator match output to R501/R505
CR2211
whenever in ON state (ON: enable, OFF: disable)
CR2212 Auto reset of CTH1 (ON: enable, OFF: disable)
Option of 1-phase
1Override 2Override 4Override 2-phase
counting input no direction With direction
CR2213 to CR2215 methods of CR2213 OFF ON OFF ON OFF ON

high-speed CR2214 OFF OFF ON ON OFF OFF


CR2215 OFF OFF OFF OFF ON ON
counter CTH1
CR2300 External output disable (ON: enable, OFF: disable)
CR2301 External input refresh disable (ON: enable, OFF: disable)
CR2302 External output is disabled during interruption (ON: enable, OFF: disable)
CR2303 Fixed scanning time operation (ON: enable, OFF: disable)
In case scanning time setting (fixed scanning time operation .END processing time
CR2304 R
setting) overflow, only 1-time scanning is ON
Set input time constant of all inputs of CPU unit (ON: set→CM1620, OFF: setting
CR2305
disable [10ms])
CR2306 R ON when back-up battery is abnormal

A-80 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

Attributes
Device No. R: Read only. Function
Blank: R/W

CR2307 Clearing of maximum/minimum value of scanning time


CR2308 END processing time setting (ON: enable OFF: disable)
CR2309 to CR2312 - Reserved for the system
VT sensor application screen forced changeover (Change: ON, disable change:
CR2313
OFF)
CR2314 - Reserved for the system
In battery-less operation (during normal operation: OFF, during battery-less
CR2315 R
operation: ON)

Not used Rise Decline Level


CTH0 external
CR2400, CR2401 CR2400 OFF ON OFF ON

APPENDICES
signal preset CR2401 OFF OFF ON ON

CR2402 Option of CTH0 counting method (ON: ring, OFF: linear)


CR2403 Detect CTH0 overflow/underflow (ON: detected OFF: undetected)

Not used Rise Decline Level


CTH1 external
CR2404, CR2405 CR2404 OFF ON OFF ON
signal preset CR2405 OFF OFF ON ON

CR2406 Option of CTH1 counting method (ON: ring, OFF: linear)

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)

Single-phase Single-phase 2-phase


Input source 2-phase
without direction with direction 1-multiple
CR2501, CR2502
Frequency setting CR2501 OFF ON OFF ON

counter CR2502 OFF OFF ON ON

CR2503 Hz/rpm switching (ON: rpm


Use the function for updating the operation speed once (ON:
CR2504
available, OFF: not available)
CR2505 CTH0 comparator match output relay switching (ON: R504, OFF: R500)
CR2506 Specified frequency pulse output (CTH0) (ON: enable, OFF: disable)
CR2507 Specify frequency pulse output (CTH0) error
CR2508 Start operation (ON: enable, OFF: disable)

Single-phase Single-phase 2-phase


Input source 2-phase
without direction with direction 1-multiple
CR2509, CR2510
Frequency setting CR2509 OFF ON OFF ON

counter (CTH1) CR2510 OFF OFF ON ON

CR2511 Hz/rpm switching (ON: rpm, OFF: Hz)


Use the function for updating the operation speed once (ON:
CR2512
available, OFF: not available)
CR2513 CTH1 comparator match output relay switching (ON: R505, OFF: R501)
CR2514 Specified frequency pulse output (CTH1) (ON: enable, OFF: disable)
CR2515 Specify frequency pulse output (CTH1) error

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-81


CR/CM List

Attributes
Device No. R: Read only. Function
Blank: R/W

1-phase w/o Single-phase 2phase 1


2-phase
direction with direction override
CR2600,CR2601 INT R000 interrupt polarity
CR2600 OFF ON OFF ON
CR2601 OFF OFF ON ON

CR2602,CR2603 INT R001 interrupt polarity (identical with CR2600, CR2601)


CR2604,CR2605 INT R002 interrupt polarity (identical with CR2600, CR2601)
CR2606,CR2607 INT R003 interrupt polarity (identical with CR2600, CR2601)
CR2608,CR2609 INT R004 interrupt polarity (identical with CR2600, CR2601)
CR2610,CR2611 INT R005 interrupt polarity (identical with CR2600, CR2601)
CR2612,CR2613 INT R006 interrupt polarity (identical with CR2600, CR2601)
APPENDICES

CR2614,CR2615 INT R007 interrupt polarity (identical with CR2600, CR2601)


CR2700,CR2701 INT R008 interrupt polarity (identical with CR2600, CR2601)
CR2702,CR2703 INT R009 interrupt polarity (identical with CR2600, CR2601)
CR2704 to CR2715 - Reserved for the system
CR2800 Send BREAKsignal (sending during ON)
CR2801 R 1 scanning ON when receiving file data
CR2802 R Scan data load
Serial
CR2803 R 1 scanning ON in the event of occurrence of text data receiving error
CR/CM List

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 -

A-82 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

Attributes
Device No. R: Read only. Function
Blank: R/W

CR3100 Limit switch CW input


CR3101 Limit switch CCW input
CR3102 Origin sensor input
CR3103 Stop sensor input
CR3104 R In the course of zero suppression
CR3105 R Origin suppression end
CR3106 Positioning end relay
CR3107 CPU positioning Error/clearing error
CR3108 function axis Y Warning/clearing warning
CR3109 Pulse output/emergency stop

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-83


CR/CM List

Attributes
Device No. R: Read only. Function
Blank: R/W

CR3700 F1 customized switch 1


CR3701 F2 customized switch 2
CR3702 F3 customized switch 3
CR3703 F4 customized switch 4
CR3704 LED1 customized indicator 1
CR3705 LED2 customized indicator 2
CR3706 LED3 customized indicator 3
CR3707 LED4 customized indicator 4
CR3708 Operator panel Green backlit lamp (highlighted during ON)
CR3709 KV-D30 Red backlit lamp (highlighted during ON)
APPENDICES

CR3710 System information display languag e(ON: Japanese, OFF: English)


CR3711 Buzzer ON
CR3712 Screen display setting (ON: positive display, OFF: reverse display)
CR3713 Warning interruption permit (ON: enable, OFF: disable)
CR3714 Page switching (rise switching to the page of CM0401, forced OFF)
CR3715 "↑""↓" Page switching is disabled (ON: enable OFF: disable)
CR3800 External output 0 is also in ON state in the case of ON state
CR3801 External output 1 is also in ON state in the case of ON state
CR/CM List

CR3802 to CR3815 - Reserved for the system


CR3900 OFF→ON, severe error log is cleared
CR3901 OFF→ON, slight error log is cleared
CR3902 R Severe error log represents maximum number
CR3903 R Slight error log represents maximum number
CR3904 R RUN/PRG switching state (ON: RUN side OFF: PROG side)
CR3905 R In the event of occurrence of severe error
CR3906 R In the event of occurrence of slight error
CR3907 OFF→ON, power ON log is cleared
CR3908 OFF→ON, power OFF log is cleared
CR3909 Current error is cleared (Only SET/RES instruction)
CR3910 to CR3915 - Reserved for the system

A-84 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

Control Memory CM (For KV-5500/5000/3000)

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

CM0000, CM0001 Set up 1st line display device


CM0002, CM0003 Operation panel Set up 2nd line display device
CM0004, CM0005 KV-D30 Set up 3rd line display device
CM0006, CM0007 - 0 Page Set up 4th line display device
CM0008, CM0009 Reserved for system

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

CM0730 to CM1479 - Reserved for system


CM1480, CM1481 R Frequency Frequency measuring result(Hz or rpm)
CM1482 counter function 1Number of placed pulse
CM1483 (CTH0) Scan times
CM1484, CM1485 Specify frequency Setup frequency (Hz)
pulse output
CM1486 function. Duty ratio (0 to 100%)
CM1487 to CM1489 - Reserved for system
CM1490, CM1491 R Frequency Frequency measuring result (Hz or rpm)
CM1492 counter function Number of pulses per rotation
APPENDICES

CM1493 (CTH1) Scan times


CM1494, CM1495 Specify frequency Setup frequency (Hz)
pulse output
CM1496 function. Duty ratio (0 to 100%)
CM1497 to CM1593 - Reserved for system
CM1594 CTH0 change direction detection constant
CM1595 CTH01 change direction detection constant
CM1596, CM1597 Lower limit of CTH0 ring counter
CR/CM List

CM1598, CM1599 Lower limit of CTH1 ring counter


CM1600, CM1601 CTH0 ring counter upper limit
CM1602, CM1603 CTH1 ring counter upper limit
CM1604, CM1605 CTH0 preset value
CM1606, CM1607 CTH1 preset value
CM1608 CTH0 start, reset, polarity set up
CM1609 CTH0 start, reset, polarity set up
CM1610, CM1611 R INT R00000 Input capture (high bit, low bit) when occurred
CM1612, CM1613 R INT R00001 Input capture (high bit, low bit) when occurred
CM1614, CM1615 R INT R00002 Input capture (high bit, low bit) when occurred
CM1616, CM1617 R INT R00003 Input capture (high bit, low bit) when occurred
CM1618, CM1619 - Reserved for system
CM1620 Setup constant when inputting
CM1621 to CM1649 - Reserved for system
CM1650 R Executed number of sensor setting command
CM1651 to CM1659 R Reserved for system
CM1660 to CM1669 R Log/trace Ring Buffer free space (ID0 to ID10)
CM1670 to CM1679 - Reserved for system
CM1680 to CM1689 R Log/trace File Save Counter (ID0 to ID10)
CM1690 to CM1699 - Reserved for system
CM1700, CM1701 Digital trimmer 0 upper limit
CM1702, CM1703 Digital trimmer 1 upper limit
CM1704, CM1705 Digital trimmer 2 upper limit
CM1706, CM1707 Digital trimmer 3 upper limit
CM1708, CM1709 Digital trimmer 4 upper limit
CM1710, CM1711 Digital trimmer 5 upper limit
CM1712, CM1713 Digital trimmer 6 upper limit
CM1714, CM1715 Digital trimmer 7 upper limit
CM1716 to CM1719 Reserved for system
CM1720 user message 1
CM1721 to CM1737 Access user message 2 (up to 24 characters + end character (00 H))
CM1738 Window Setting Inhibited Operation
CM1739 - Reserved for system

A-86 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-87


CR/CM List

Attributes
Device No. R: Read only. Function
Blank: R/W

CM2000 I/O setting


CM2001 Start sensor
CM2002, CM2003 Comparator 0
CM2004, CM2005 Comparator 1
CM2006 Origin return: starting speed
CM2007 Zero return: acceleration/deceleration time
CM2008, CM2009 Origin return: running speed
CM2010 JOG operation: starting speed
CM2011 CPU JOG operation: acceleration/deceleration time
CM2012, CM2013 Positioning JOG operation: running speed
APPENDICES

CM2014, CM2015 function Current value change setting value


CM2016, CM2017 X axis Operation speed change setting value
CM2018 Set up the origin return detail
CM2019 Operation in progress point No.(M code)
CM2020, CM2021 R Current position
CM2022, CM2023 R Current speed
CM2024 Error code
CM2025 Specify point No.
CR/CM List

CM2026, CM2027 Resting position coordinate setpoint


CM2028, CM2029 Comparator 2
CM2030 I/O setting
CM2031 Start sensor
CM2032, CM2033 Comparator 0
CM2034, CM2035 Comparator 1
CM2036 Origin return: starting speed
CM2037 Zero return: acceleration/deceleration time
CM2038, CM2039 Origin return: running speed
CM2040 JOG operation: starting speed
CM2041 CPU JOG operation: acceleration/deceleration time
CM2042, CM2043 Positioning JOG operation: running speed
CM2044, CM2045 function Current value change setting value
CM2046, CM2047 Y axis Operation speed change setting value
CM2048 Set up the origin return detail
CM2049 Operation in progress point No.(M code)
CM2050, CM2051 R Current position
CM2052, CM2053 R Current speed
CM2054 Error code
CM2055 Specify point No.
CM2056, CM2057 Resting position coordinate setpoint
CM2058, CM2059 Comparator 2
CM2060, CM2061 Target value/amount of movement
CM2062 Startup speed
CPU
CM2063 Positioning Acceleration/deceleration time
CM2064, CM2065 function Operation speed
CM2066 Point parameter Operation mode
CM2067 0 Specified pulse number for stop sensor
CM2068, CM2069 Reserved for system
CM2070 to CM2379 Point parameter 1 to 31 (The same with CM2060 to CM2069)
CM2380 to CM2389 - Reserved for system
CM2390 R Error code used for memory card instruction

A-88 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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:

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-89


CR/CM List

■Detailed Information of the Error-For KV-5500/5000/3000


• When No.128 (calculation error)
Detailed information n Description
Detailed information 1 Details of error
0 (not used)
1 Improper indirect specification
2 The indirectly specified target is T/C
3 Improper simple indirect specifying
4 Beyond operand range
5 Floating real number overflow
6 Improper device specifying
7 ROOT operand is negative
APPENDICES

8 No ENCO instruction ON bit


9 Floating-point real number error
10 Trigonometric function operand error
11 data cannot be converted
12 Improper table specifying
13 Time comparison instruction operand error
14 Cam switch operand error
15 Frequency counter instruction operand error
16 0 division operation
CR/CM List

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)

A-90 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

• No.50,53,55,56,58,59 (unit ID related errors)


Detailed information n Description
Unit No. (according to occurrence state of error, when unit No. Cannot be
Detailed information 1
designated, it will not be saved.)
Detailed information 2 to 20 00H fixed

• When No.54 (error related with number of units)


Detailed information n Description
Detailed information 1 Number of units on unit setting information
Detailed information 2 Actually connected number of units
Detailed information 3 to 20 00H fixed

APPENDICES
• When No.127 (auto loading failure error)

Detailed information n Description


Details of error
Detailed information 1
For details, refer to "Errors during load/save execution".
Detailed information 2 to 20 00H fixed

• When No.129 (unit 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

• In case of error numbers other than above


Detailed information n Description
Detailed information 1 to 20 00H fixed

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-91


CR/CM List

Control Relays CR (For KV Nano series)

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

CR0003 R Logging buffer less than 50% warning


CR0004 R Logging buffer overflow
CR0005 R Data to be written in RUN mode during logging present
CR0006,
- Reserved for the system
CR0007 Logging or tracing function (ID0)
CR0008 R Logging or tracing error
CR0009 R Logging or tracing insufficient memory card capacity 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,
- Reserved for the system
CR0015
CR0100 to
Logging or tracing function (ID1 to ID9) (The same as CR0000 to CR0015)
CR0915
CR1000 to
Real-time chart monitor (ID10) (The same as CR0000 to CR0015)
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
CR2100
CR2101 R Indicates the presence of extension unit 1 (ON: connected, OFF: not connected)
CR2102 R Indicates the presence of extension unit 2 (ON: connected, OFF: not connected)
CR2103 to
- Reserved for the system
CR2200
CR2201 R Indicates the presence of expansion unit 1 (ON: connected, OFF: not connected)
CR2202 R Indicates the presence of expansion unit 2 (ON: connected, OFF: not connected)
CR2203 R Indicates the presence of expansion unit 3 (ON: connected, OFF: not connected)
CR2204 R Indicates the presence of expansion unit 4 (ON: connected, OFF: not connected)
CR2205 R Indicates the presence of expansion unit 5 (ON: connected, OFF: not connected)
CR2206 R Indicates the presence of expansion unit 6 (ON: connected, OFF: not connected)
CR2207 R Indicates the presence of expansion unit 7 (ON: connected, OFF: not connected)
CR2208 R Indicates the presence of expansion unit 8 (ON: connected, OFF: not connected)

A-92 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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

INT1 interrupt polarity

CR2602, Rising Edge Falling Edge Both Rising and Falling Edges
CR2603 CR2602 OFF ON OFF ON
CR2603 OFF OFF ON ON

INT2 interrupt polarity

CR2604, Rising Edge Falling Edge Both Rising and Falling Edges
CR2605 CR2604 OFF ON OFF ON
CR2605 OFF OFF ON ON

INT3 interrupt polarity

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

A-94 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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

CR4210 CTH0 count mode selection (ON: ring, OFF: linear)


CR4211 CTH0 preset disabled (ON: execute, OFF: do not execute)
CR4212 CTH0 internal enable relay (ON: counting enabled, OFF: counting disabled)
CR4213 to
- Reserved for the system
CR4302

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

CR4400 R CTH1 dedicated internal clock (50 ns)


CR4401 R CTH1 dedicated internal clock (1 μs)
CR4402 R CTH1 dedicated internal clock (10 μs)
CR4403 R CTH1 dedicated internal clock (100 μs)
CR4404 - Reserved for the system
CR4405 R Indicates the presence of CTH1 (ON: present, OFF: not present)
CR4406 Detects overflows and underflows of CTH1 (ON: detected, OFF: not detected)
CR4407 R Indicates the change direction of CTH1 (ON: down counting, OFF: up counting)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-95


CR/CM List

Attribute
CR R: Read only Function
Blank: Read/write
CTH1 external signal preset

CR4408, Not Used Rising Edge Falling Edge Level


CR4409 CR4408 OFF ON OFF ON
CR4409 OFF OFF ON ON

CR4410 CTH1 count mode selection (ON: ring, OFF: linear)


CR4411 CTH1 preset disabled (ON: execute, OFF: do not execute)
CR4412 CTH1 internal enable relay (ON: counting enabled, OFF: counting disabled)
CR4413 to
- Reserved for the system
CR4502
Automatic reset of CTH1 (ON: execute, OFF: do not
CR4503
APPENDICES

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

OFF: do not execute)


Comparator matching output disabled when comparator
CR4508
CTC3 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4509 comparator CTC3 is turned ON (ON: execute, OFF: do
not execute)
Action when high-speed counter Comparator matching output turned ON when comparator
CR4510
comparator CTC3 is turned ON CTC3 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4511 time that comparator CTC3 is turned ON (ON: execute,
OFF: do not execute)
Automatic reset of CTH1 (ON: execute, OFF: do not
CR4512
execute)
CTH1 count input mode selection
Single Phase
1x 2x 4x 2-Pulse
CR4513 to W/O Direction W/ Direction
CR4515 CR4513 OFF ON OFF ON OFF ON
CR4514 OFF OFF ON ON OFF OFF
CR4515 OFF OFF OFF OFF ON ON
CR4600 R CTH2 dedicated internal clock (50 ns)
CR4601 R CTH2 dedicated internal clock (1 μs)
CR4602 R CTH2 dedicated internal clock (10 μs)
CR4603 R CTH2 dedicated internal clock (100 μs)
CR4604 - Reserved for the system
CR4605 R Indicates the presence of CTH2 (ON: present, OFF: not present)
CR4606 Detects overflows and underflows of CTH2 (ON: detected, OFF: not detected)
CR4607 R Indicates the change direction of CTH2 (ON: down counting, OFF: up counting)
CTH2 external signal preset

CR4608, Not Used Rising Edge Falling Edge Level


CR4609 CR4608 OFF ON OFF ON
CR4609 OFF OFF ON ON

CR4610 CTH2 count mode selection (ON: ring, OFF: linear)


CR4611 CTH2 preset disabled (ON: execute, OFF: do not execute)
CR4612 CTH2 internal enable relay (ON: counting enabled, OFF: counting disabled)
CR4613 to
- Reserved for the system
CR4702

A-96 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


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

CR4800 R CTH3 dedicated internal clock (50 ns)


CR4801 R CTH3 dedicated internal clock (1 μs)
CR4802 R CTH3 dedicated internal clock (10 μs)
CR4803 R CTH3 dedicated internal clock (100 μs)
CR4804 - Reserved for the system
CR4805 R Indicates the presence of CTH3 (ON: present, OFF: not present)
CR4806 Detects overflows and underflows of CTH3 (ON: detected, OFF: not detected)
CR4807 R Indicates the change direction of CTH3 (ON: down counting, OFF: up counting)
CTH3 external signal preset

CR4808, Not Used Rising Edge Falling Edge Level


CR4809 CR4808 OFF ON OFF ON
CR4809 OFF OFF ON ON

CR4810 CTH3 count mode selection (ON: ring, OFF: linear)


CR4811 CTH3 preset disabled (ON: execute, OFF: do not execute)
CR4812 CTH3 internal enable relay (ON: counting enabled, OFF: counting disabled)
CR4813 to
- Reserved for the system
CR4902
Automatic reset of CTH3 (ON: execute, OFF: do not
CR4903
execute)
Comparator matching output disabled when comparator
CR4904
CTC6 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4905 Action when high-speed counter comparator CTC6 is turned ON (ON: execute, OFF: do
comparator CTC6 is turned ON not execute)
Comparator matching output turned ON when comparator
CR4906
CTC6 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4907 time that comparator CTC6 is turned ON (ON: execute,
OFF: do not execute)

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-97


CR/CM List

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

CTH0 input source setting


Single Phase Double
CR5401, W/O W/ Phase 2-Pulse
CR5402 Direction Direction 1x
CR5401 OFF ON OFF ON
Frequency counter (CTH0)
CR5402 OFF OFF ON ON

CR5403 Switches between Hz and rpm (ON: rpm, OFF: Hz)


Function in which one rotation is performed to update the
CR5404
rotation speed (ON: use, OFF: do not use)
Input source switching function (ON: use, OFF: do not
CR5405
use)
CR5406,
- Reserved for the system
CR5407
CR5408 Specified frequency pulse output (CTH0; ON: execute, OFF: do not execute)
CR5409 Specified frequency pulse output (CTH0) error
CR5410 to
- Reserved for the system
CR5415
CR5500 Start operation (ON: execute, OFF: do not execute)
CTH1 input source setting
Single Phase Double
CR5501, W/O W/ Phase 2-Pulse
CR5502 Direction Direction 1x
CR5501 OFF ON OFF ON
Frequency counter (CH1)
CR5502 OFF OFF ON ON

CR5503 Switches between Hz and rpm (ON: rpm, OFF: Hz)


Function in which one rotation is performed to update the
CR5504
rotation speed (ON: use, OFF: do not use)
Input source switching function (ON: use, OFF: do not
CR5505
use)
CR5506,
- Reserved for the system
CR5507
CR5508 Specified frequency pulse output (CTH1; ON: execute, OFF: do not execute)
CR5509 Specified frequency pulse output (CTH1) error
CR5510 to
- Reserved for the system
CR5515

A-98 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


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

CR5603 Switches between Hz and rpm (ON: rpm, OFF: Hz)


Function in which one rotation is performed to update the
CR5604
rotation speed (ON: use, OFF: do not use)
Input source switching function (ON: use, OFF: do not

APPENDICES
CR5605
use)
CR5606,
- Reserved for the system
CR5607
CR5608 Specified frequency pulse output (CTH2; ON: execute, OFF: do not execute)

CR/CM List

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-99


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

Function in which one rotation is performed to update the


CR5704
rotation speed (ON: use, OFF: do not use)
Input source switching function (ON: use, OFF: do not
CR5705
use)
CR5706,
- Reserved for the system
CR5707
CR5708 Specified frequency pulse output (CTH3; ON: execute, OFF: do not execute)
CR5709 Specified frequency pulse output (CTH3) error
CR5710 to
- Reserved for the system
CR/CM List

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

A-100 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-101


CR/CM List

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

CR8701 R Positioning complete relay


CR8702 R Error
CR8703 R Warning
CR8704 R Origin returning operation in progress
CR8705 R CPU positioning function, axis 4 Origin returning operation complete
CR8706 to
R Reserved for the system
CR8713
Indicates the presence of axis 4 (ON: present, OFF: not
CR8714 R
present)
CR/CM List

CR8715 R Comparator 2 matching relay


CR8800 to
- Reserved for the system
CR8915

A-102 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

Control Memory Entries CM (For KV Nano series)

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-103


CR/CM List

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

CM0728 END processing time set value (in units of 10 μs)


END processing time (in units of 10 μs) when the scan time setting (the fixed
CM0729 R
scan time operation and END processing time settings) is exceeded
CM0730 to
- Reserved for the system
CM1599
CM1600,
R Input capture when INT0 occurs
CM1601
CM1602,
R Input capture when INT1 occurs
CM1603
CM1604,
R Input capture when INT2 occurs
CR/CM List

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 ○

A-104 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-105


CR/CM List

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

CM2393 Memory card check error times ○


CM2394 Memory card timeout occurrence times ○
CM2395 - Reset delay time during memory card errors ○
CM2396 to
- Reserved for the system
CM2399
CM2400 to Number of interrupts (INT0 to INT3, CTC0 to CTC7, and positioning axis 1 to
CM2415 axis 4)
CM2416 to
- Reserved for the system
CM4799
CM4800 Constant when rotation direction is detected ○
CM4801 Enable, clear, and sign setting ○
CM4802,
Ring counter lower limit ○
CM4803
High-speed counter
CM4804,
function (CTH0) Ring counter upper limit ○
CM4805
CM4806,
Preset input ○
CM4807
CM4808,
- Reserved for the system
CM4809
CM4810 Constant when rotation direction is detected ○
CM4811 Enable, clear, and sign setting ○
CM4812,
Ring counter lower limit ○
CM4813
High-speed counter
CM4814,
function (CTH1) Ring counter upper limit ○
CM4815
CM4816,
Preset input ○
CM4817
CM4818,
- Reserved for the system
CM4819
CM4820 Constant when rotation direction is detected ○
CM4821 Enable, clear, and sign setting ○
CM4822,
High-speed counter Ring counter lower limit ○
CM4823
function (CTH2)
CM4824,
Ring counter upper limit ○
CM4825
CM4826,
Preset input ○
CM4827

A-106 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-107


CR/CM List

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

CM8007 Reserved for the system Set


CM8008 Travel after stop sensor input Set
CM8009 - Reserved for the system
CM8010 to CPU positioning function, Point parameters 2 to 20
Set
CM8199 axis 1 (the same as CM8000 to CM8009)
CM8200,
Target value or travel Set
CM8201
CM8202 Acceleration rate Set
CM8203 Deceleration rate Set
CR/CM List

CM8204, CPU positioning function,


axis 2
Operation frequency Set
CM8205
CM8206 Point parameter 1 Operation mode Set
CM8207 Reserved for the system Set
CM8208 Travel after stop sensor input Set
CM8209 - Reserved for the system
CM8210 to CPU positioning function, Point parameters 2 to 20
Set
CM8399 axis 2 (the same as CM8200 to CM8209)
CM8400,
Target value or travel Set
CM8401
CM8402 Acceleration rate Set
CM8403 Deceleration rate Set
CM8404, CPU positioning function,
axis 3
Operation frequency Set
CM8405
CM8406 Point parameter 1 Operation mode Set
CM8407 Reserved for the system Set
CM8408 Travel after stop sensor input Set
CM8409 - Reserved for the system
CM8410 to CPU positioning function, Point parameters 2 to 20
Set
CM8599 axis 3 (the same as CM8400 to CM8409)
CM8600,
Target value or travel Set
CM8601
CM8602 Acceleration rate Set
CM8603 Deceleration rate Set
CM8604, CPU positioning function,
axis 4
Operation frequency Set
CM8605
CM8606 Point parameter 1 Operation mode Set
CM8607 Reserved for the system Set
CM8608 Travel after stop sensor input Set
CM8609 - Reserved for the system
CM8610 to CPU positioning function, Point parameters 2 to 20
Set
CM8799 axis 4 (the same as CM8600 to CM8609)

A-108 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-109


CR/CM List

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

CM8851 Origin returning operation: deceleration rate


CM8852,
Origin returning operation: operation frequency
CM8853
CM8854 Origin returning operation: detailed settings
CM8855 JOG operation: starting frequency
CM8856 JOG operation: acceleration rate
CM8857 CPU positioning function, JOG operation: deceleration rate
axis 2
CM8858,
JOG operation: operation frequency
CR/CM List

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

A-110 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

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

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-111


CR/CM List

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

CM8931 Origin returning operation: deceleration rate


CM8932,
Origin returning operation: operation frequency
CM8933
CM8934 Origin returning operation: detailed settings
CM8935 JOG operation: starting frequency
CM8936 JOG operation: acceleration rate
CM8937 CPU positioning function, JOG operation: deceleration rate
axis 4
CM8938,
JOG operation: operation frequency
CR/CM List

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

A-112 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


CR/CM List

■Detailed Information of the Error-For Nano series


• Error number 128 (calculation error)
Detailed Information, Piece n Explanation
Detailed information, piece 1 Error details
0 (Not used.)
1 Incorrect indirect specification.
2 The indirectly specified target is T/C.
3 Incorrect simple indirect specification.
4 Outside of operand range.
5 Floating-point real number overflow.
6 Incorrect device specification.
7 The ROOT instruction operand is negative.
8 No bits turned ON with the ENCO instruction.
9 Floating-point real number format error.

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")

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-113


CR/CM List

• 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

• Error number 54 (number of units error)


Detailed Information, Piece n Explanation
Detailed information, piece 1 The number of units as specified in the unit setup information
Detailed information, piece 2 The number of units that are actually connected
Detailed information, pieces 3 to 20 Fixed to 00H

• Error number 60 (number of expansion I/O points error)


APPENDICES

Detailed Information, Piece n Explanation


Detailed information, piece 1 Upper limit of the number of base unit expansion I/O points
Detailed information, piece 2 Actually connected number of expansion I/O points
Detailed information, pieces 3 to 20 Fixed to 00H

• Error number 61 (assigned device overlap error)


Detailed Information, Piece n Explanation
CR/CM List

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

• Error number 127 (automatic loading failure error)


Detailed Information, Piece n Explanation
Details of error
Detailed information, piece 1
For details, refer to "Errors during load/save execution".
Detailed information, pieces 2 to 20 00H Fixed

• Error number 129 (unit error)


Expansion Information, Piece n Explanation
Expansion information, piece 1 Unit number
Expansion information, piece 2 Error number of each unit
Detailed information, pieces 3 to 20 Fixed to 00H

• Error numbers other than those listed above


Expansion Information, Piece n Explanation
Detailed information, pieces 1 to 20 Fixed to 00H

A-114 - KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Character Code Table

ASCII Code Table

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 ァ キ ヌ ラ

Character Code Table


E T
L B

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 ッ ソ マ °

- KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-115


Instruction Table Cannot be Used
It describes the command terms that cannot be used within the initialization module, funct

You might also like