0% found this document useful (0 votes)
2K views956 pages

KVS Ladder Instruction

Uploaded by

murkxp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views956 pages

KVS Ladder Instruction

Uploaded by

murkxp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 956

909GB

Chapter
BRIEF EXPLANATION
OF INSTRUCTIONS

Chapter
BASIC
INSTRUCTIONS

Programmable Controller Chapter


APPLIED
INSTRUCTIONS
KV-8000/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 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-8000
・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-8000/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-8000/7000/5000/3000/1000 Series
This Manual describes a variety of instructions in ladder diagram
and KV Nano Series
programming.
Instruction Reference Manual
KV-8000/7000/5000/3000/1000 Series
This Manual describes script programming and available operators,
and KV Nano Series
control statements and functions.
Script Programming Manual
KV STUDIO User's Manual This manual describes how to operate "KV STUDIO".
KV-5500/5000/3000/1000 Series This manual describes the system macros available for the KV-
System Macro Manual 5500/5000/3000/1000 Series.

● KV-8000 relative manual


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

● KV-7000 relative manual


Designation Note
This manual describes how to connect, and maintain the KV-7000 Series. It
KV-7000 Series User's Manual
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-8000/7500/7300/5500/5000/3000/1000 and the KV Nano Series
are operating normally in terms of functionality and performance when
operating KV STUDIO.
• Verify that this device is operating normally in terms of functionality and
performance before the start of work and when operating the device.
• Provide a safety circuit that bypasses PLC to enable failsafe operation of the
entire system in the event that the PLC fails.
WARNING
• Output circuit or internal circuit malfunctions sometimes prevent control from
being performed normally. Be sure to provide a safety circuit in control systems
where circuit malfunction may lead to fire or other serious accidents.
• Do not use this product for the purpose to protect a human body or a part of
human body.
• This product is not intended for use as explosion-proof product. Do not use this
product in a hazardous location and/or potentially explosive atmosphere.

When this product is used with methods other than what is mentioned in this
CAUTION
instruction manual, the protection provided by the product may be ruined.

• Proceed with care when modifying the KV-1000/700 Series, or when using it in a
manner that falls outside of the ranges indicated in its specifications, since
KEYENCE is unable to guarantee device functionality or performance in such
situations.
NOTICE
• Use this product in combination with other devices only after careful
consideration, since the product may fail to satisfy its functionality and
performance capabilities as a result of the conditions and environment in which
it is used.

909GB
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1
KV-8000 CPU Function Version

The functions of the KV-8000 Series differ depending on the CPU function version.
The CPU function version can be checked using "Tools" → "Check CPU Function Version" → "PLC" in
the KV STUDIO menu (* KV STUDIO Ver.10.0 or later is required).
The CPU function version can be updated using "Tools" → "Check CPU Function Version" → "PLC" →
"Update System Program" in the KV STUDIO menu. (* KV STUDIO Ver.10.0 or later is required.)

■ Differences in CPU function depending on CPU function version


Release 2020/04 2019/04
CPU function version 2.0 1.0
KV STUDIO compatible version Ver.11.0 or later Ver.10.0 or later
Variable 〇 ―
CPU
Structure 〇 ―
function
Function block 〇(Compatible with EN/ENO, instances) 〇
Function block instructions 2 instructions added(FBCALL,FBSTRT) Not added
Instructions Data Move Instructions 1 instructions added (BBMOV) ―

Script Data Processing Instructions 1 instructions added (BBCMP) ―
Size Acquisition Instructions 3 instructions added (ACNT,WSIZE,BSIZE) ―

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


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"->"Functional version validation" ->"PLC" in the
KV STUDIO menu (* KV STUDIO Ver. 8 or later is required).
The CPU function version can be updated using "Tools"->"Functional version validation" -> "Update
system program" 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 Dec 2018 July 2017 Jun 2016 Dec 2015 Jun 2015 Mar 2015
CPU function version 2.3 2.2 2.1 2.0 1.1 1.0
KV STUDIO compatible version Ver.9.45 or later 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/XL202 Yes No
expansion
KV-XH16ML/XH04ML Yes No
unit
KV-XH16EC Yes No
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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 3


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"->"Functional version validation" ->"PLC" in the
KV STUDIO menu (* KV STUDIO Ver. 7 or later is required).
The CPU version can be updated using "Tools"->"Functional version validation" -> "Update system
program" 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

4 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 5


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

6 - KV-8000/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
2
Chapter
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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 7


Contents
Safety Precautions....................................................................................................1
How This Manual Is Organized ................................................................................7
Contents ....................................................................................................................8
How to Use Mnemonics List .................................................................................................16
Terminology..........................................................................................................................18
Symbols................................................................................................................................18

Chapter 1 BRIEF EXPLANATION OF INSTRUCTIONS


KV-8000 Series ······························································································· 1-4
KV-7000 Series ······························································································· 1-8
KV-5500/5000/3000 Series ···············································································1-12
KV-1000 Series ······························································································1-16
KV Nano Series ······························································································1-20
Device Notation Method ···················································································1-24
Definition of Suffixes ························································································1-28
BIN Data ·······································································································1-31
Representation of Numerical Value ·····································································1-32
Relationship Between Numerical Representation ···················································1-35
Character Code ······························································································1-38
Operand Specification Method ···········································································1-44
Processing of bit data and word data by operand ···················································1-46
Processing of T, C, CTH, CTC ···········································································1-46
Word Unit Processing of Bit Data········································································1-47
Bit Data Processing of Word Data·······································································1-49
Out-of-range access of operands········································································1-50
Other Matters Needing Attention ········································································1-51

Chapter 2 BASIC INSTRUCTIONS


Contact Instructions ····························································································2-2
LD Load·············································································································· 2-2
LDB Load bar ······································································································· 2-2
AND AND ·············································································································· 2-2
ANB AND bar········································································································ 2-2
OR OR ················································································································ 2-2
ORB OR bar ·········································································································· 2-2
LDP Load pulse ···································································································· 2-4
LDF LOAD pulse fall····························································································· 2-4
ANP AND pulse ···································································································· 2-4
ANF AND pulse fall······························································································· 2-4
ORP OR pulse······································································································· 2-4
ORF OR pulse fall ································································································· 2-4
LDPB Pulse bar ······································································································ 2-6
LDFB Pulse fall bar ································································································· 2-6
ANPB AND pulse bar ······························································································ 2-6
ANFB AND pulse fall bar························································································· 2-6
ORPB OR pulse bar ································································································ 2-6
ORFB OR pulse fall bar··························································································· 2-6
Bit Contact Instructions ······················································································2-8
BLD Bit load·········································································································· 2-8
BLDB Bit load bar ··································································································· 2-8
BAND Bit AND········································································································· 2-8
BANB Bit AND bar··································································································· 2-8
BOR Bit OR ··········································································································· 2-8
BORB Bit OR bar····································································································· 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

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


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 Out ·············································································································· 2-16
OUB Out bar········································································································ 2-16
SET Set ON ········································································································ 2-18
RES Reset ·········································································································· 2-18
KEEP Keep ··········································································································· 2-20
DIFU Differential up 1ON ····················································································· 2-22
DIFD Differential down ························································································· 2-22
ONDL ON delay····································································································· 2-26
OFDL OFF delay ··································································································· 2-26
SHOT One shot ····································································································· 2-28
FLIK Flicker ········································································································· 2-30
ALT Alternate ····································································································· 2-32
Bit Output Instructions ······················································································2-34
BOUT Bit out ········································································································· 2-34
BOUB Bit out bar ··································································································· 2-34
BSET Set ·············································································································· 2-36
BRES Reset ·········································································································· 2-36
Timer/Counter Instructions ···············································································2-38
TMR Timer ·········································································································· 2-38
TMH 10ms high-speed timer ··············································································· 2-38
TMS 1ms high-speed timer ················································································· 2-38
TMU 32-bit 10μs ON delay down timer ······························································· 2-42
UDT Up/down timer ···························································································· 2-44
C Counter ······································································································· 2-46
OUTC Out counter ································································································· 2-50
ITVL Interval timer ······························································································· 2-52
UDC UP/DOWN counter ····················································································· 2-58
Connection/End Instructions ············································································2-62
END End ············································································································· 2-62
ENDH End High ····································································································· 2-62
CON Connect ······································································································ 2-64
MPS Pulse··········································································································· 2-66
MRD Read ··········································································································· 2-66
MPP Pop ············································································································· 2-66
ANL AND load ···································································································· 2-68
ORL OR load ······································································································ 2-68
INV ON/OFF status inversion ············································································ 2-70
MEP MEP ············································································································ 2-72
MEF MEF ············································································································ 2-72
Direct I/O Instructions ·······················································································2-74
RFSX Input refresh ······························································································· 2-74
RFSY Output refresh····························································································· 2-74

Chapter 3 APPLIED INSTRUCTIONS


Shift Instructions ·································································································3-2
SFT Shift ·············································································································· 3-2
Memory Switch Instruction ·················································································3-4
MEMSW Memory switch······························································································ 3-4

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


Step Instructions ································································································· 3-8
STP Step···············································································································3-8
STE Step end········································································································3-8
Stage Processing Instructions ········································································ 3-12
STG Start stage···································································································3-12
JMP Jump stage ·································································································3-12
ENDS End stage····································································································3-12
W-ON Wait ON ······································································································3-18
W-OFF Wait OFF·····································································································3-18
W-UE Wait rising edge ··························································································3-20
W-DE Wait falling edge ·························································································3-20
Flow Instructions ······························································································ 3-22
MC Master control ·····························································································3-22
MCR Master control reset ····················································································3-22
CALL Sub-routine call ···························································································3-26
SBN Sub-routine entry ························································································3-26
RET Sub-routine return ·······················································································3-26
ECALL between module subroutine call ·································································3-30
FOR FOR ············································································································3-32
NEXT NEXT ··········································································································3-32
BREAK Break···········································································································3-32
CJ Conditional branch ······················································································3-36
NCJ Conditional branch ······················································································3-36
GOTO Unconditional branch ··················································································3-36
LABEL Label ···········································································································3-36
SCJ Conditional branch ······················································································3-40
Macro Instructions ···························································································· 3-42
MCALL Macro call····································································································3-42
MSTRT Macro start ··································································································3-42
MEND Macro end ···································································································3-42
MEMO Function Block Instructions ································································· 3-46
FB Function block call ······················································································3-46
FEND Function block end······················································································3-46
FUN Function call································································································3-46
FBCALL Function block call ······················································································3-50
FBSTRT Function block start·····················································································3-50
Module Instructions ·························································································· 3-54
MDSTRT Module execution start················································································3-54
MDSTOP Module execution stop ················································································3-54
Index Register Instructions ·············································································· 3-56
ZPUSH Index register batch purge ··········································································3-56
ZPOP Index register batch restore ········································································3-56
Indirect Specification Instructions ·································································· 3-60
ADRSET Gets the address of the target to be indirectly specified ·····························3-60
ADRINC Increment address ······················································································3-62
ADRDEC Decrement address·····················································································3-62
ADRADD Address addition ·························································································3-64
ADRSUB Address subtraction ····················································································3-64
File Register Instructions ················································································· 3-68
FRSET File register bank switching·········································································3-68
FRSTM File register all saving ·················································································3-70
FRLDM Batch read file register ················································································3-72
Unit Program Instructions ················································································· 3-74
UPSTRT Unit program start ·······················································································3-74
UPSTOP Unit program forced stop ············································································3-78
UFSUS Suspend flow ······························································································3-80
UFRSM Resume flow ·······························································································3-80
UMALLOC Allocate buffer memory ···············································································3-84
Buffer Memory Instructions ············································································· 3-86
UREAD Read buffer memory instruction ··································································3-86
UWRIT Write buffer memory ···················································································3-88
UFILL Buffer memory batch write ··········································································3-90

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


Size Acquisition Instructions ·············································································3-92
ACNT Get the number of array elements in the specified dimension ··················· 3-92
WSIZE Get the word size occupied by the specified variable································· 3-94
BSIZE Get the bit size occupied by the specified variable····································· 3-96
Unit Type Judgment Instruction ········································································3-98
IS_ □□□ Unit type judgment······················································································ 3-98

Chapter 4 ARITHMETIC OPERATION INSTRUCTIONS


Data Move Instructions ·······················································································4-2
MOV Data move ···································································································· 4-2
LDA Load·············································································································· 4-6
STA Storage ······································································································· 4-10
PLDA Partial load·································································································· 4-14
PSTA Partial store ································································································ 4-16
TMIN Trimmer capacitor value storage ································································ 4-18
DW Data move ·································································································· 4-20
BMOV Block move from move source to move destination ··································· 4-24
FMOV Batch move from move source to move destination··································· 4-26
PMOV Move continuous bit information to the 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
BBMOV Moves the bit data in blocks to the reference destination··························· 4-38
Arithmetic/Comparison Instructions ································································4-40
ADD 16/32-bit binary data addition ····································································· 4-40
SUB 16/32-bit binary data subtraction ································································ 4-44
MUL 16/32-bit binary data multiplication ····························································· 4-48
DIV 16/32-bit binary data division ······································································ 4-54
INC Increment the target value by 1 ·································································· 4-60
DEC Decrement the target value by 1 ································································ 4-64
ROOT Square root operation ················································································· 4-66
POW Exponentiation ···························································································· 4-68
CMP Data comparison ························································································ 4-72
ZCMP Range comparison ····················································································· 4-76
Logical Operation Instructions ·········································································4-80
ANDA Logical "AND" operation of internal register and specified data. ················ 4-80
ORA Logical "OR" operation of internal register and specified data. ·················· 4-82
EORA Logical "Exclusive OR" operation of internal register and specified data. ··· 4-84
ENRA Logical "Exclusive NOR" operation of internal register and specified data.··· 4-86
COM Bit inversion ································································································ 4-88
NEG Sign inversion ····························································································· 4-90
Shift Instructions ·······························································································4-94
SRA Right shift of internal register ······································································ 4-94
SLA Left shift of internal register ········································································ 4-98
ASRA Arithmetic right shift of internal register ···················································· 4-100
ASLA Arithmetic left shift of internal register ······················································ 4-104
RRA Right rotate of internal register ································································· 4-108
RLA Left rotate of internal register···································································· 4-112
RRNCA No-carry right rotation of internal register ················································· 4-116
RLNCA No-carry left rotation of internal register ··················································· 4-120
WSR Word data right shift ················································································· 4-124
WSL Word data left shift···················································································· 4-126
BSR Shift the device content to larger device No. ············································ 4-128
BSL Shift the device content to smaller device No.·········································· 4-130
Data Control Instructions ················································································4-132
LIMIT Upper/lower limit control for input data ····················································· 4-132
BANDC Dead band control for input data ······························································ 4-134
ZONE Zone control for input data········································································ 4-136
APR Perform approximation calculation for input data in specified line.··········· 4-138
RAMP Changes in the input value are output at the specified inclination.··········· 4-146
TPOUT Pulse output with specified ON time and cycle········································· 4-150
LLFLT Passes input through lead-lag filter and then outputs. ····························· 4-154

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


Data Conversion Instructions ·········································································4-158
TBCD Binary → BCD conversion ········································································ 4-158
TBIN BCD → Binary conversion ········································································ 4-160
MPX 4 bits → 16 bits decode ············································································ 4-162
DMX 16 bits → 4 bits encode ············································································ 4-162
GRY Binary → Gray code conversion ······························································· 4-164
RGRY Gray code → Binary conversion ······························································· 4-164
DISN Word (16 bits) → Nibble (4 bits) dispersion ·············································· 4-168
UNIN Nibble (4 bits) → Word (16 bits) unification ·············································· 4-170
DISB Word (16 bits) → Byte (8 bits) dispersion ················································· 4-172
UNIB Byte (8 bits) → Word (16 bits) unification ················································· 4-174
SWAP Swap the high-order / low-order data ······················································· 4-176
BSWAP Block swap of high-order and low-order data ··········································· 4-178
XCH Exchange·································································································· 4-180
DECO To decode the numbers of the low-order n bits of the internal register
to 2n bit BIN data······················································································ 4-182
ENCO Encode the ON position of bit data after the specified range to a value··· 4-184
ABS Absolute value ·························································································· 4-186
CPMSET CIP message creation ·············································································· 4-188
CPMGET CIP message retrieval ·············································································· 4-194
Floating Point Instructions ·············································································4-198
FLOAT Binary → Single precision floating point type real number conversion····· 4-198
DFLOAT Binary → Double precision floating point type real number conversion ··· 4-200
INTG Single precision floating point type real number → Binary conversion····· 4-202
DINTG Double precision floating point type real number → Binary conversion ··· 4-206
DFTOF Double-precision floating point type real number → Single-precision
floating point type real number conversion ··············································· 4-210
FTODF Single-precision floating point type real number → Double-precision
floating point type real number conversion ··············································· 4-212
DISF Single-precision floating point type real number → Mantissa and
exponent separation ················································································· 4-214
UNIF Mantissa and exponent → Single-precision floating point type real
number combination ················································································· 4-216
EXP Exponent arithmetic operation·································································· 4-218
LOG Logarithmic arithmetic operation ······························································ 4-218
LOG10 Common logarithm operation ··································································· 4-222
RAD Angle (°) → Radian (rad) conversion························································ 4-224
DEG Radian (rad) → Angle (°) conversion························································ 4-224
SIN Calculate the sine (sin) value from the angle in radians (rad) ·················· 4-228
COS Calculate the cosine (cos) value from the angle in radians (rad) ············· 4-228
TAN Calculate the tangent (tan) value from the angle in radians (rad) ············ 4-228
ASIN Calculates the angle in radians (rad) from sine (sin) value ······················ 4-232
ACOS Calculates the angle in radians (rad) from cosine (cos) value·················· 4-232
ATAN Calculates the angle in radians (rad) from tangent (tan) value················· 4-232
ATAN2 Calculates the angle in radians (rad) from the coordinates (X, Y) ············ 4-234
Text Processing Instructions ··········································································4-236
ASC Binary → HEX ASCII conversion······························································ 4-236
RASC HEX ASCII → Binary conversion······························································ 4-238
DASC Binary → Decimal ASCII conversion ························································ 4-240
RDASC Decimal ASCII → Binary conversion ························································ 4-244
HASC Convert numerical values (HEX) to a HEX ASCII text string ···················· 4-248
RHASC Convert HEX ASCII text string to numerical values (HEX) ······················· 4-252
FASC Convert single precision floating point type real numbers to text strings·· 4-256
RFASC Convert text strings to single precision floating point type real numbers·· 4-260
LEN Detect text string length············································································ 4-264
SMOV Move text string ························································································ 4-266
SADD Unite text string························································································· 4-268
SRGHT Cut the specified number of characters from the right of the text string. ·· 4-270
SLEFT Cut the specified number of characters from the left of the text string ····· 4-274
SMID Cut part of a text string ············································································· 4-278
SRPLC Replace part of a text string······································································ 4-282
SINS Insert a specified text string into a text string ··········································· 4-286
SDEL Delete a specified part of a text string ······················································ 4-290
STRIM Delete ends of text string·········································································· 4-294
SFIND Search a specified text string from a text string········································ 4-296

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


SFINDN Search a specified text string from a specified text string range. ············· 4-300
SCMP Compare text strings ················································································ 4-304
DISS Text string (in bytes) → Text string (in words) dispersion························· 4-308
UNIS Text string (in words) → Text string (in bytes) unification························· 4-310
RCOM Read comment ························································································· 4-312
CPSASC CIP text string type data conversion ························································· 4-316
RCPSASC CIP text string type data reverse conversion ············································ 4-318
Simple Operation Instructions ········································································4-320
CAL+ Add values of Operand 1 and Operand 2 and store the result into
Operand 3································································································· 4-320
CAL- Subtract the value of Operand 2 from the value of Operand 1, and
store the result into Operand 3 ································································· 4-324
CAL* Multiply values of Operand 1 and Operand 2 and store the result into
Operand 3································································································· 4-328
CAL/ Divide the value of Operand 1 by the value of Operand 2 and store the
result into Operand 3 ················································································ 4-332
CAL& Perform logical "AND" operation of 2 values ············································ 4-336
CAL | Perform logical "OR" operation of 2 values ·············································· 4-338
CAL^ Perform logical "Exclusive OR" operation of 2 values. ····························· 4-340
CAL~ Invert all bits of the specified data ···························································· 4-342
CAL>> Shift the bit content of the specified data to the smaller bit No. by the
specified number of bits············································································ 4-344
CAL<< Shift the bit content of the specified data to the larger bit No. by the
specified number of bits············································································ 4-348

Chapter 5 EXTENDED INSTRUCTIONS


Data Processing Instructions ·············································································5-2
HKEY Hex key input ································································································ 5-2
SEG Decoding for 7-segment display ··································································· 5-4
BCNT Count the number of bits currently ON in the internal register ····················· 5-8
DCNT Count the number of data with the same value as the internal register
in the data block ························································································· 5-10
SER Search the device No. for the data with the same value as the internal
register in the data block ············································································ 5-14
DSER Search for data within the specified range. ················································ 5-18
MAX Search maximum value in the data block ··················································· 5-20
MIN Search minimum value in the data block ···················································· 5-20
AVG Average calculation in a data block ···························································· 5-26
WSUM Calculate the total value of BIN data in a specified range ·························· 5-32
BSUM Total of the BIN data (8 bits) within a specified range → Internal
register········································································································ 5-36
CRC Calculate the CRC value, and store the result to the internal register.······· 5-38
ZRES Specified range reset·················································································· 5-40
EXT 16-bit internal register → 32-bit internal register extension ························ 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
BBCMP Continuous bit data comparison ································································· 5-54
RND Random number occur ··············································································· 5-56
SORT Binary data sort ·························································································· 5-58
SORTN Binary data partition sort············································································· 5-62
Table Processing Instructions ··········································································5-66
FIFOW FIFO data write ··························································································· 5-66
FIFOR FIFO data read ··························································································· 5-70
LIFOW LIFO data write ··························································································· 5-74
LIFOR LIFO data read ··························································································· 5-78
FWRIT Overwrites the data block of the data table ················································ 5-82
FINS Inserts data in a data block········································································· 5-84
FDEL Delete data from a data block····································································· 5-86
Clock Processing Instructions ·········································································5-88
WTIME Writes the time data to the calendar timer ·················································· 5-88
SEC Converts date/time format data to second format data ······························ 5-90
RSEC Converts second format data to date/time format data ······························ 5-90
AJST Adjusts the calendar timer by ±30 seconds.··············································· 5-92

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


Weekly Contact Instructions ·············································································5-94
LDWK Turns ON in the specified day of week / hour / minute / second range ······ 5-94
LDWKB Turns OFF in the specified day of week / hour / minute / second range ···· 5-94
ANDWK Turns ON in the specified day of week / hour / minute / second range ······ 5-94
ANDWKB Turns OFF in the specified day of week / hour / minute / second range ···· 5-94
ORWK Turns ON in the specified day of week / hour / minute / second range ······ 5-94
ORWKB Turns OFF in the specified day of week / hour / minute / second range ···· 5-94
Calendar Contact Instructions ··········································································5-98
LDCAL Turns ON in the specified year / month / day range ··································· 5-98
LDCALB Turns OFF in the specified year / month / day range ································· 5-98
ANDCAL Turns ON in the specified year / month / day range ··································· 5-98
ANDCALB Turns OFF in the specified year / month / day range ································· 5-98
ORCAL Turns ON in the specified year / month / day range ··································· 5-98
ORCALB Turns OFF in the specified year / month / day range ································· 5-98
Alarm Instruction ·····························································································5-102
ARES Resets the currently operating alarm relay and alarm history ·················· 5-102
High-speed Processing Instruction ·······························································5-104
HSP Set input time constant to 10μs ································································ 5-104
DI Disable interrupt ······················································································· 5-106
EI Enable interrupt ························································································ 5-106
DIC Interrupt disabled range setting ································································ 5-108
INT Interrupt execution···················································································· 5-110
RETI Interrupt end ····························································································· 5-110
IEDGE Sets detection conditions used for interrupt. ············································ 5-114
PID Control Instructions ··················································································5-118
PID PID Control ······························································································· 5-118
PIDAT PID control with automatic tuning ····························································· 5-126
Storage Device Instructions ···········································································5-148
MWRIT Memory card write ···················································································· 5-156
MREAD Reads data from memory card (CPU memory) ········································ 5-168
MFREE Gets the free space in the memory card (CPU memory) in bytes. ··········· 5-176
MMKDIR Creates a folder in the memory card (CPU memory). ······························ 5-180
MRMDIR Deletes the specified folder in the memory card (CPU memory).············· 5-184
MDEL Deletes the specified file in the memory card (CPU memory) ·················· 5-186
MPRINT Writes a text sting into a file in the memory card (CPU memory). ············ 5-188
MREADL Only one line of the file in the memory card (CPU memory)is read out···· 5-192
MCOPY A file in the memory card (CPU memory) is copied.································· 5-198
MMOV A file in the memory card (CPU memory) is moved.································· 5-204
MREN Change the file name in the memory card (CPU memory).······················ 5-210
MFREEK Gets the free space in the memory card (CPU memory) in kilobytes······· 5-214
MSTAT Gets the status of the files in the memory card (CPU memory). ·············· 5-218
Access Window Instructions ··········································································5-222
AWNUM Display user message 1 in access window ·············································· 5-222
AWMSG Display user message 2 in access window ·············································· 5-224
AWSHOW Display user message in access window ················································· 5-226
AWHIDE Hide the user message being displayed in access window······················ 5-228
Free Operation Counter Instruction ·······························································5-230
RFSFRC Update the current value of free operation counter as the latest value ···· 5-230
Sensor Setting Instruction ··············································································5-232
SPRD Sensor parameter read············································································· 5-232
SPWR Sensor parameter write ············································································ 5-236
SSVC Sensor service execution ········································································· 5-240
Cyclic Communication Refresh Instruction ··················································5-244
RFSCI Refresh cyclic communication input ························································· 5-244
RFSCO Refresh cyclic communication output ······················································· 5-248

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


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-14
Arithmetic Operation Instructions ······································································· A-18
Extended Instructions······················································································ A-33
CR/CM List ························································································ A-43
Control Relays CR (For KV-8000)······································································ A-43
Control Memory CM (For KV-8000)···································································· A-47
Control Relays CR (For KV-7500/7300) ······························································ A-53
Control Memory CM (For KV-7500/7300) ···························································· A-56
Control Relays CR (For KV-5500/5000/3000)······················································· A-61
Control Memory CM (For KV-5500/5000/3000)····················································· A-67
Control Relays CR (For KV Nano series)····························································· A-74
Control Memory Entries CM (For KV Nano series) ················································ A-85
Character Code Table ········································································· A-97
ASCII Code Table ·························································································· A-97
Instruction Table Cannot be Used ························································ A-98
Index ······························································································ A-100
Instruction Index ·············································································· A-102

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


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.

16 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 17


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-8000/7500/7300/5500/ Programmable Controller KV-5500/5000/3000/1000 Series unit made by
5000/3000/1000》 Keyence Corporation
KV-8000/7000/5000/3000/ The generic term for expansion units that can be connected to the KV-8000/
1000 Series 7000/5000/3000/1000 CPU unit.
CPU unit KV-8000/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-8000 Series expansion unit Expansion special units other than CPU units that can be used with the KV-
8000 Series.
KV-8000/7000 Series Expansion I/O units and expansion special units other than CPU units that
expansion unit can be used with the KV-8000/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."

18 - KV-8000/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-4
Suffix ..............................................................................................1-28
Data Processing ............................................................................1-31
Every-scan Execution Type and Differential Execution Type ...1-39
Conventions and Cautions in Operand List ...............................1-44

- KV-8000/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-8000/7500/7300/5500/5000/
3000/1000 and KV Nano Series programs are classified into the following categories.

■ Basic Instructions
1 This chapter explains the most basic instructions in writing a sequence program.
Types of Instruction

These instructions are sufficient for enabling mechanical control on the same level as that of a general-
purpose relay sequence circuit.

■ Applied Instructions
These instructions are for project progress, program control, and extended ladders. These instructions
enable structured programming for basic ladders.

■ 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 User's Manual of the CPU unit
used.

■ 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 8)
• Search instruction words with the Arabic numeral sequence index "Instruction
Index" (Page A-102)

1-2 - KV-8000/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 (There may be more than 6 operands or no operands).
In this manual, operands and operators are represented as follows:

■ Instruction Code
Depending on operations, individual instructions have different names. These are called "instruction
operator", or simply called "instruction". For example, instructions for 16-bit data transfer are
represented as "MOV", whereas instructions for comparison of 2 16-bit data are represented as "LD=".
In addition, process data can be differentiated by adding "suffix" at the end of instruction words.
"Suffix" (Page 1-28)
"Data Processing" (Page 1-31)

■ Operand Code
The reference objects for instruction execution and storage of instruction execution result data are all specified with operands.
For operands, different queuing sequences are assigned to different functions which accordingly have different representations.
Main function Name Conventions used in this manual
Assign a reference object before Source S (when multiple constants exist S1 S2 …)
functions are executed.

Assign a storage area for function Destination D (when multiple constants exist D1 D2 …)
execution results

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.
Specify a device, variable or constant for each operand and then execute the instruction.

Example
Transfer constant "0" to device "DM0".

MOV
#0 DM0

For details on devices, variables and constants, please see "Device and Constant" (Page 1-4) and
"Variable" (Page 1-26).
The devices or constants used in an instruction operand vary depending on instruction words.

■ Processing time of instructions


Process time of individual instructions vary depending on specified operands or execution conditions.
"Operation Processing Time Table" (Page A-9)

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


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 User's Manual of the CPU unit used.
1
KV-8000 Series
Device and Constant

Device List

■ Bit device
When start Indirect
Local Index
*1 Number of operation specifying(*)*6
Device name Range Main functions device Modify
points (Power ON, Refer-
(@)*1 (:Z/:#) Store
PRG →RUN) ence
Device used for
Input relay*8 R000 to R199915*2 capturing ON/OFF - Yes Yes Yes No
Total 32000 info from peripherals.
points for
Device used for
input, output,
Output relay*8 R000 to R199915*2 sending ON/OFF Clear/hold*3 Yes Yes Yes No
and internal
info to peripherals
auxiliary
relays. Devices that can be
Internal
R000 to R199915*2 used in CPU and Clear/hold*3 Yes Yes Yes No
auxiliary relay
expansion unit
Link relay B00 to B7FFF*7 32768 Clear/hold*3 No Yes Yes No
Internal Devices that can be
MR000 to MR399915 64000 Clear Yes Yes Yes No
auxiliary relay only used in CPU
Latch relay LR000 to LR99915 16000 Hold Yes Yes Yes No
10μs, 1ms, 10ms,
100ms down
Timer (contact) T0 to T3999 4000 counter, 10ms Clear Yes Yes Yes No
contact device of
up/down counter
Devices that can be
Counter used for up counter
C0 to C3999 4000 Clear/hold*5 Yes Yes Yes No
(contact) and up/down
counter contact
Devices used for
controlling PLC
Control relay*4 CR000 to CR7915 1280 function or capturing Hold No No No No
the status from
peripherals.
*1 Since they are used for local device, their reserved number is limited by the usable range of global devices.
"Local device list" (Page 1-11)
*2 R000 to R199915 can be specified as extended I/O relay with Unit Monitor.
*3 Clear/Hold settings can be made in the "Power Failure Holding" option.
*4 "KV-8000 series User's Manual "CR/CM table""
*5 Hold/Clear setups can be made in the "Power Failure Holding" option. (only for contacts and current values)
*6 "Store" is a device that can be described as "*(device)". "Lookup" is a device that can be indirectly specified.
"KV-8000 series User's Manual "Indirect specifying""
*7 Specify all device No. in HEX.
*8 "DR" represents direct processing.
"KV-8000 series User's Manual "About direct processing""

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


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 No
524288 numerical data
ZF0 to ZF524287
File register (16-bit) Clear/hold*2 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 Z23*5 23 used in index Clear No No No No
modify (32-bit)
Devices used for
controlling PLC
Control
CM0 to CM7599 7600 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-11)
*2 Clear/Hold settings can be made in the "Power Failure Holding" option.
*3 "KV-8000 series User's Manual "CR/CM table""
*4 Up/down timers (UDT) hold the current value.
*5 Z11 to Z23 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-8000 series User's Manual "Indirect specifying""
*8 Specify all device No. in HEX.
*9 Bank switching can not be available for local devices.

■ 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 Device / variable are used as argument. No No Yes
Device / variable or constants are
Value V V0 to V9 No No No
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.

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


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

■ 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(:)
1 IN
Device / variable values or
Any variable / label constants are used as argument No No No
for processing.
Device and Constant

Written to the device / variable


OUT Any variable / label that specified the operation No No No
results.
Device / variable are used as
IN-OUT Any variable / label No No Yes*1
argument.
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.

*1Arguments that specify arrays or structures cannot use index modification.

■ Constant
Constant Range Main Functions
#0 to #65535 (unsigned 16-bit)
-32768 to +32767 (signed 16-bit) Used for specifying DEC constant.
DEC(#)
#0 to #4294967295 (unsigned 32-bit) * XYM Marking is represented by "K".
-2147483648 to +2147483647 (signed 32-bit)
-3.4E+38 ≤ N ≤ -1.4E-45
Single precision
N=0 Used for specifying single precision
floating point type
+1.4E-45 ≤ N ≤ +3.4E+38 floating point type real number.
real number
(Significant digit : 7 digit)
-1.79E+308 ≤ N ≤ -2.23E-308
Double precision
N=0 Used for specifying double precision
floating point type
+2.23E-308 ≤ N ≤ +1.79E+308 floating point type real number.
real number
(Significant digit : 16 digit)
$0000 to $FFFF (16-bit) Used for specifying HEX constant.
HEX($)
$00000000 to $FFFFFFFF (32-bit) * XYM Marking is represented by "H".
Fixed text string ("") Example) "Type ABC", "MON/08:30:15" Used for specifying fixed text string.

■ Internal register
Number When start operation
Device name Range Main functions
of points (Power ON, PROG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)

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


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
Local device list

The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through "CPU system setting" → "Assignment of all
local devices setting" on the "Workspace". 1
Local device Global device Total
Device name*1

Device and Constant


Reserved devices in the whole project*2 Counts/range number
32000 points (2000 CH) 32000 points
Relay (R) *3 None
R000 to R199915 (2000 CH)
32000 points (2000 CH) 64000 points
Internal auxiliary relay (MR)*3 32000 points (2000 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 processed as global devices or global variables.
- Devices assigned to expansion units
- The device / variable referenced by such peripherals as touch panel
- Common device / variable in the whole project
- Device / variable for inter-module data transmission
• Where possible, local devices should be coded from 0 and use consecutive numbers.
• Since R and DM are assigned to the expansion unit, as a global device, there
must be an area to be used. When using local devices, please use MR or EM first.
• If local devices or global devices are used outside the specified range, then an
conversion error will occur.
• For the KV-8000/7000 Series, when an index modification or indirect
specification is used to specify outside of the usable range of local devices or
global devices, an operation error will occur.
• When various instructions using the leading device as the operands and index
modification or indirect specifying are used, the range of the local devices and
global devices that can be used should not be exceeded.
• When the index modification, indirect reference or array element is dynamically
specified using devices or variables in the KV-8000 series, a calculation error
may occur or an unintended area may be referenced once an area beyond the
range of devices or work area is accessed.
• When the index modification, indirect reference or array element isdynamically specified
using devices or variables, the range of devices or work area should not be exceeded.

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


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

KV-7000 Series

Device List
1
■ Bit device
Device and Constant

When start Indirect


Local Index
Number of operation specifying(*)*6
Device name Range *1 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 Yes Yes Yes No
MR000 to MR399915 64000 Clear
auxiliary relay only used in CPU
Latch relay LR000 to LR99915 16000 Hold Yes Yes Yes No
10μs, 1ms, 10ms,
100ms down
Timer (contact) T0 to T3999 4000 counter, 10ms Clear Yes Yes Yes No
contact device of
up/down counter
Devices that can be
Counter used for up counter
C0 to C3999 4000 Clear/hold*5 Yes Yes Yes No
(contact) and up/down
counter contact
Devices used for
controlling PLC
Control relay*4 CR000 to CR7915 1280 function or capturing Hold No No No No
the status from
peripherals.
*1 Since they are used for local device, their reserved number is limited by the usable range of global devices.
"Local device list" (Page 1-11)
*2 R000 to R199915 can be specified as extended I/O relay with Unit Monitor.
*3 Clear/Hold settings can be made in the "Power Failure Holding" option.
*4 "KV-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.

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


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

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


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(:)
1 Device P P0 to P9 Devices are used as argument. No No Yes
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", "MON/08:30:15" Used for specifying fixed text string.

■ Internal register
Number When start operation
Device name Range Main functions
of points (Power ON, PROG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)
1-10 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
Local device list

The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through“CPU system setting”→“Assignment of
all local devices setting”on the “Workspace”. 1
Local device Global device

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 (2000 CH) 64000 points
Internal auxiliary relay (MR)*3 32000 points (2000 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.

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


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
Number of operation specifying(*)*7
Device name Range *1 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-11)
*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""

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


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

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


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", "MON/08:30:15" Used for specifying fixed text string.
("")

■ Internal register
When start
Number of operation
Device name Range Main functions
points (Power ON,
PROG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)

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


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
Local device list

The number of local devices/global devices and their settings when a project is created are shown as
follows. Number of reserved devices can be changed through“CPU system setting”→“Assignment of
all local devices setting”on the “Workspace”. 1
Local device Global device

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.

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


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

KV-1000 Series

Device List
1
■ Bit device
Device and Constant

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

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-11)
*2 R100 to R415 are reserved for the system and cannot be used.
*3 R1000 to R59915 can be specified as extended I/O relay with Unit Monitor.
*4 The MEMSW instruction can be used to specifying clear/hold.
*5 MR94000 to MR99915 is reserved for the system and cannot be used.
*6 "CR/CM List" (Page A-43)
*7 The MEMSW instruction can be used to specify hold/clear. (only for contacts and current values)
*8 "Store" is a device that can be described as "* (device)". "Lookup" is a device that can be indirectly specified.

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


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
■ Word device
When start Indirectly
Device Number of Local Pointer specified (*)*8
Range*1 Main functions operation device modify
name point Power (@)(@)*1 (: Z/: #) Refer- Store
1
( ON ) ence
Data memory DM0 to DM65534 65535 Hold*2 Yes Yes Yes Yes
Device for storing
Expansion data EM0 to EM65534*3 65535 Hold*2 Yes Yes Yes Yes
numerical data (16-bit)

Device and Constant


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-11)
*2 The MEMSW instruction can be used to specifying clear/hold.
*3 EM64535 to EM65534,FM31767 to FM32766 is reserved for the system and cannot be used.
*4 "CR/CM List" (Page A-43)
*5 Up/down timers (UDT) hold the current value.
*6 Z11 and Z12 are reserved for the system and cannot be used.
*7 The MEMSW instruction can be used to specify hold/clear. (only for contacts and current values)
*8 "Store" is a device that can be described as "* (device)". "Lookup" is a device that can be indirectly specified.

Reference The macro argument devices that can only be used in a macro are listed as follows:
Indirect
Local Pointer
speci-
Attribute Sign Range Description device modify
fying
(@) (:)
(*)
Device P P0 to P9 Devices are used as argument No No Yes
Device values or constants are used as
Value V V0 to V9 No No No
argument for processing.
Leading UR0 to Leading device assigned to extended unit
UR No No Yes
relay UR9 processed as argument
Unit
Leading UM0 to The leading device assigned to extended
UM No No Yes
DM UM9 unit is processed as an argument.

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

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


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

■ Constant
Constant Range Main functions
#0 to #65535 (unsigned 16-bit)

1 DEC(#)
-32768 to +32767 (signed 16-bit)
#0 to #4294967295 (unsigned 32-bit)
Use for specifying DEC constant

-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", "MON/08 :30 :15"
("") string.

■ Internal register
When start
Number of
Device name Range Main functions operation
point Power ON
( PROG → RUN )
Device for temporary data storage
Internal register - 1 point Clear
(16-bit/32-bit)

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 Total number
Reserved devices in the whole project*2 Counts/range
9600 points (600 CH) 9600 points
Relay (R) *3 None.
R000 to R59915 (600 CH)
Internal auxiliary 7200 points (450 CH) 16000 points
8000 (500 CH)
relay (MR)*3 MR000 to MR44915 (1000 CH)*4
8000 points (500 CH) 16000 points
Latch relay (LR)*3 8000 (500 CH)
LR000 to LR49915 (1000 CH)
Timer (T) *5
1500 Timer/Counter 1000
Timer/Counter
T0 to T999
Counter (C) *5 1500 4000
C0 to C999
40535
Data memory (DM) 25000 65535
DM0 to DM40534
Expansion data 19535
45000 65535*4
memory (EM) EM0 to EM19534
Expansion data 11767
20000 32767*4
memory (FM) FM0 to FM11766
Temporary data 512
None. 512
memory (TM) TM0 to TM511

*1 High-speed counters (CTH), high-speed counter comparator (CTC), control relays (CR), control
memories (CM), and index registers (Z) cannot be used as a device.

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


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.
*4 This number includes the workspace used for script devices. 1
*5 Operands used as timer and counter instructions can be described as @+ (device code number)

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.

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


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)

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


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
Points Power On

Clear and
PROG 
RUN
(@)*1
(:Z/:#) Reference Storage
1
Data Memory DM0 to DM32767 32768 Hold Yes Yes Yes Yes
Devices that can store hold*3

Device 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-11)
*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-43).

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


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

1 Attribute Symbol Range Description Specification Device


(*) (@)
Modification
(:)
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)
Reference
When you select
-32768 to +32767 (signed 16 bit)
Decimal (#) XYM marking mode,
#0 to #4294967295 (unsigned 32 bit)
this is displayed as
-2147483648 to +2147483647 (signed 32 bit)
"K."
-3.4E + 38 ≤ N ≤ -1.2E - 38
Single precision
N=0 Used to specify single precision
floating-point real
+1.2E - 38 ≤ N ≤ +3.4E + 38 floating-point constants.
number
(Approximately 7 significant digits)
-1.79E + 308 ≤ N ≤ -2.23E - 308
Double precision
N=0 Used to specify double precision
floating-point real
2.23E - 308 ≤ N ≤ 1.79E + 308 floating-point constants.
number
(Approximately 16 significant digits)
Used to specify hexadecimal
constants.
$0000 to $FFFF (16 bit) Reference
When you select
Hexadecimal ($)
$00000000 to $FFFFFFFF (32 bit) XYM marking mode,
this is displayed as
"H."
Fixed character Used to specify fixed character
Examples) "Model number ABC," "MON/08:30:15"
string (" ") strings.

■ Internal registers
Start of
Operation
Number of
Device Name Range Main Function (Power On,
Points
PROG 
RUN)
A device used to temporarily store data
Internal register - 1 Clear
(16 bit, 32 bit, 64 bit)

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


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
Local device list

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

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.

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


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

Device Notation Method

● Writing index modification (modification according to index registers and


1 according to index constants)
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 :#□ (□: -524287~+524287) 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.

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


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

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

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.

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


BRIEF EXPLANATION OF

Device and Constant


INSTRUCTIONS

Variable

Variable is an element with the data type and name defined that can be used when programming. KV
STUDIO allows you to use devices or variables for programming.
1 Unlike devices, variables can be programmed with names defined by KV STUDIO, and the defined
variables are automatically assigned to the work area of the CPU unit. Therefore, it is not necessary to
manage the functions assigned to the devices in the device map like devices. In addition, since the VT5
Device and Constant

series and Soft-VT also support variable programming, it is not necessary to change the device number
on the touch panel display in combination with the device number on the PLC side.

Point • Variables can be used only with KV STUDIO Ver11.0 or later, and the compatible
model is only KV-8000 Ver.2.0 or later.
• Variables can be used on the touch panel display only with VT STUDIO Ver.8.0 or
later, and the compatible model is only the VT5 series.

List of variables and data types

When using variables, it is necessary to define the data type in advance. The CPU unit automatically
assigns the required data size to the work area according to the defined data type*1.

The size of work area and specifications of variables that can be used with KV-8000 are as follows.

Item Content
Bit (VB) 64000 points
Word (VM) 589824 words
Work area size
Timer (T) 4000 points
Counter (C) 4000 points
Definable number 100000
Variable specifications
Maximum length of variable name 128 characters
*1 It is also possible to manually assign to the device of the CPU unit instead of the work area. For
details, refer to "KV-8000 Series User's Manual".

The data types and data sizes of variables that can be used with KV-8000 are as follows.
Data type Data size
Type name Description (In bits)
BOOL Bit 1
UINT 1-word unsigned integer 16
INT 1-word signed integer 16
UDINT 2-word unsigned integer 32
DINT 2-word signed integer 32
REAL Single-precision floating point type 32
LREAL Double-precision floating point type 64
(Number of characters + 1) × 8 rounded up to
STRING String
an integral multiple of 16
TIMER Timer ―
COUNTER Counter ―
Array ― Set the data size of the data type×Array size
Structure ― By definition*1
Function block Function block By definition*1

*1 Structures and function blocks are data types used by setting multiple data types. Therefore, the
data size is determined by the settings. For details, refer to "KV-8000 Series User's Manual".

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


BRIEF EXPLANATION OF
Device and Constant

INSTRUCTIONS
MEMO

Device and Constant

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


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-8000/
7000 Series CPU units, KV-5000/3000 Series CPU units that have CPU function
version 2.0 or higher and KV Nano Series base units.
"KV-5000/3000 CPU Function Version" (Page 4)

□.U is omitted in KV STUDIO. In addition, the instructions without suffix are processed as unsigned 16-
bit BIN data.
According to the suffixes, the corresponding instructions process BIN data with DEC.
Thus, the execution result of instructions may differ if the suffixes are different, even if the same BIN
data.

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


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.
Thus, the relationship between BIN data and corresponding DEC representation of suffix is shown
below.
1

Suffix
BIN BIN When the value of 1111111111111111
□ .U Unsigned DEC 65535
□ .S Signed DEC -1
For constant, please see " Data Processing" (Page 1-31).

Example
When 16-bit BIN (1111111111111111) data stored in DM0 is compared with constant #100
If the suffix is .U, the value of DM0 is 65535.
DM0
> .U LD.U> DM0 #100
#100
Thus, if DM0>#100, the contact becomes ON.
(65535)

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 When the value of 11111111111111111111111111111111
□.D Unsigned DEC 4294967295
□.L Signed DEC -1
"Data Processing" (Page 1-31)

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)

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


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.

1 The instructions are executed independently of the DEC value of BIN data.
The suffix is only related to data length (16/32-bit) .
Suffix

Example
Example for sending DM0 to DM10 using MOV instruction.

MOV.U
DM0 DM10
MOV.S
DM0 DM10

DM0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

DM10 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

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

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


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.

BIN Data 1

Data Processing
These are processed through BIN system in data in KV-8000/7500/7300/5500/5000/3000/1000 PLC and
KV Nano Series.
A 1-bit BIN is processed by unit of "bit". A bit has two states: "0 (OFF) " and "1(ON)".

■ 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

Area for continuous 2 words is used when processing 32-bit data. Lower 16-bit data is processed in
low-bit device, and higher 16-bit data processed in high-bit device.

■ 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

Area for continuous 4 words is used when processing 64-bit data. The low-order 16 bits of data is
handled with four words in order from the word device having the smallest number.

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


BRIEF EXPLANATION OF

Data Processing
INSTRUCTIONS

Representation of Numerical Value

■ BIN
1 Only "0" and "1" are used to represent BIN data in "KV-8000/7500/7300", "KV-5500/5000/3000/1000"
and "KV Nano Series". Every bit is carried if it's larger than 1.
Data Processing

The highest

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-8000/7500/7300", "KV-5500/5000/3000/1000" and "KV Nano Series" are represented
by DEC system.

● Unsigned
For 16-bit data, the range of processable value is 0 to +65535; for 32-bit data the range of processable
value is 0 to 4294967295.

● Signed
The positive or negative value is judged through highest bit. (0:positive; 1:negative)
For 16-bit data, the range of processable value is -32768 to +32767; for 32-bit data is -2147483648 to
+2147483647.

Reference These can be entered as instruction operand. The starting position of value is marked with
"#" or symbol.
(Example) #1000, +12, -25489

■ HEX
BIN data in "KV-8000/7500/7300", "KV-5500/5000/3000/1000" and "KV Nano Series" are represented
by HEX system.
The HEX data can process 4 bits BIN as 1 bit. The value that can be represented by 1 bit is DEC 0 to
15, thus, the values bigger than 9 are represented by A, B, C, D, E, F, or carried if bigger than F.
For 16-bit data, the range of processable value is $0000 to $FFFF; for 32-bit data the range of
processable value is $00000000 to $FFFFFFFF .

Reference These can be entered as instruction operand. The starting position of value is marked with "$".
(Example) $00FF

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


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.
For 16-bit data, the range of processable value is 0000 to 9999; for 32-bit data the range of processable
value is 00000000 to 99999999.
1

Data Processing
Example

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-8000/7500/7300", "KV-5500/
5000/3000/1000" PLC and "KV Nano Series". When reading from external device, convert into BIN data
using TBIN instruction; when outputting to external device (digital display, etc), convert into BCD using
TBCD instruction.

Reference To input BIN coded DEC value BCD) in the instruction operand, add a prefix "$" into the
value as HEX input.

■ 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
-45
+1.4×10 ≤ 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
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-33
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.

1 The value within the following range can be used (N) .


-1.79×10 308 ≤ N ≤ -2.23×10 -308
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-8000/
7000 Series CPU units, KV-5000/3000 Series CPU units that have CPU function
version 2.0 or higher and KV Nano Series base units.
"KV-5000/3000 CPU Function Version" (Page 4)

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

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


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

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


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 1
2
+1
+2
1
2
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0001
0010
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

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


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.
● For 16-bit data 1
Value change for 65535 above Value change when exceeding max. or min.

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

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

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


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.
1 The following text codes can be processed in KV STUDIO.
Data Processing

■ ASCII code
8 bits are used to represent 1 DBC case text code.
(Example) A···$41 1···$31

"ASCII Code Table" (Page A-97)

■ 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" "MON/08:30:15"

■ Other languages
On the KV-8000/7000 Series, character codes in the language set in "Other settings" - "Project
language settings" in "CPU system setting" can be used.

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


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).
The instructions with prefix "@" are executed as differential execution type instructions. 1
*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.

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


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 execution condition of differential execution type instruction is under the state
1 when previous sub-routine is executed.
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
Execution condition of differential
execution type instruction
R001 DM0 DM1
LDA STA

RET

ENDH

When [n]th and [n+1]th differential execution type instructions aren't executed continuously
Program scan

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 execution
condition of differential execution type instruction is the same.

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


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

n-1 Subroutine n n+1


1

Every-scan Execution Type and Differential Execution Type


ON
R000
OFF

ON
R001 OFF ON ON
OFF

When the execution condition of differential execution type instruction of [n-1]th, [n]th and [n+1]th has
the following states,
n-1-th : OFF
n-th : ON
n+1-th : ON
If the previous value of the nth instruction (state of R001 of the (n-1)th instruction) is OFF, when the current value
(state of R001 of the nth instruction) is ON, a rising edge will be detected. Thus, @LDA, @STA are executed.
If the previous value of the (n+1)th instruction (state of R001 of the nth instruction) is ON and the current
value (state of R001 of the (n+1)th instruction) is also ON, a rising edge will not be detected when no
change occurs. Thus, @LDA, @STA are not executed.

(2) When used between STP and STE instructions


The previous value of 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
Execution condition of differential execution type instruction
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 execution
condition of differential execution type instruction is the same.
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-41
BRIEF EXPLANATION OF

Every-scan Execution Type and Differential Execution Type


INSTRUCTIONS

(3) When used between STG and JMP/ENDS instructions


The previous value of the execution condition of differential execution type 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

1 executed during the next scan after the control stage is finished when the execution condition is OFF). When
number of times of execution of the program in the control stage (including 1 scan after the control stage is
finished) is set to n, the previous value of the [n+1]th instruction will be in the state of the nth instruction.
Every-scan Execution Type and Differential Execution Type

Due attention shall be paid if the programs in stage are not executed continuously during n-th and n+1-th.
Execution condition of differential execution type instruction
R1100 R000 R1000 R500 #30 T0
STG ↑ T0 JMP
R1000
Program scan

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 execution
condition of differential execution type instruction is the same.

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


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 execution condition of differential execution type instruction is under the state
when routine between previous CJ/NCJ to LABEL instruction program is executed. When the program
execution times between CJ/NCJ and LABEL instructions are set as n, the [n+1]th previous value is
under [n]th state.
1
Due attention shall be paid if the programs between CJ/NCJ and LABEL instructions are not executed

Every-scan Execution Type and Differential Execution Type


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

R000 CJ
#10
Execution condition of differential
execution type instruction
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 execution
condition of differential execution type instruction is the same.

(5) When used between FOR and NEXT instructions


The previous value of the 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.

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


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.

Operand Specification Method


1
Conventions and Cautions in Operand List

This section explains how to read the operand table and how to specify operands.

Example) ITVL instruction

Operand Description Occupied size


*1
D1 Specify the leading device of the data table. 16 bits×16

D2 Specify the leading device of the flag bit.*2 4 bits

*1 Only word data can be specified.


*2 Only bit data can be specified.

The instruction operand is specified as bit data or word data. Bit data and word data are generic names
for the following devices and variables.
Bit data..............Bit devices, bit specification of word data and BOOL type variables
Word data .........Word devices, word specification of bit data and UINT / INT / UDINT / DINT / REAL /
LREAL / STRING type variables

The operand can be specified as bit data or word data, but if there are restrictions that only one of them
can be specified or a specific device cannot be specified, a note should be provided below the operand
table.

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


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

INSTRUCTIONS
Device specified for operand

This section describes the devices that can be specified for the instruction operand. The devices
supported by each CPU unit are as follows. A specific device may not be specified depending on the
instructions, so that a note should be provided below the operand table. 1
KV-5500
KV-7500

Conventions and Cautions in Operand List


Device KV-8000 KV-5000 KV-1000 KV Nano
KV-7300
KV-3000
R Yes Yes Yes Yes Yes R
DR Yes Yes Yes ― Yes DR
MR Yes Yes Yes Yes Yes MR
LR Yes Yes Yes Yes Yes LR
Bit Device B Yes Yes Yes Yes Yes B
T(Contact) Yes Yes Yes Yes Yes T(Contact)
C(Contact) Yes Yes Yes Yes Yes C(Contact)
CTC ― ― Yes Yes Yes CTC
CR Yes Yes Yes Yes Yes CR
DM Yes Yes Yes Yes Yes DM
TM Yes Yes Yes Yes Yes TM
W Yes Yes Yes ― Yes W
EM Yes Yes Yes Yes ― EM
FM Yes Yes Yes Yes ― FM
ZF Yes Yes Yes ― ― ZF
Word T(Current value / T(Current value /
Yes Yes Yes Yes Yes
Device Set value) Set value)
C(Current value / C(Current value /
Yes Yes Yes Yes Yes
Set value) Set value)
CTH ― ― Yes Yes Yes CTH
CTC ― ― Yes Yes Yes CTC
Z Yes Yes Yes Yes Yes Z
CM Yes Yes Yes Yes Yes CM

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


BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

Variable / label specified for operand

The instruction operand can also be specified as a variable. Please specify a variable / label of the data
type that can be specified for each operand.
1 Example) ITVL instruction

Operand Description Occupied size


Conventions and Cautions in Operand List

*1
D1 Specify the leading device of the data table. 16 bits×16

D2 Specify the leading device of the flag bit.*2 4 bits

*1 Only word data can be specified.


*2 Only bit data can be specified.

D1 occupies 16×16 bits, so an array of UINT or INT or a structure type variable / label with data size
of 16 bits can be specified.
D2 occupies 4 bits, so a BOOL array or structure type variable can be specified.

A conversion error will occur if a variable / label with the data size smaller than the occupied size of the
operand is specified. However, no conversion error occurs for variables assigned to global devices.

Point Variables are supported only by KV-8000 with CPU function version 2.0 or later. For
other models, use labels instead of variables.

Processing of bit data and word data by operand

The processing of bit data and word data differs depending on the operand as follows.

· If bit data is specified in the operand for specifying of common word data, but this
bit data isn't specified from the starting point of the channel, straddle to the next
Bit data channel for processing.
S
But, there are also instructions only specifying the leading point of the channel.
· The numbers of occupied size may differ depending upon the instructions.
D
· If word data is specified in the operand for specifying of common bit data, process only
Word data the lowest valid bit. Bits other than LSB do not change.
· The numbers of occupied size may differ depending upon the instructions.
· Notwithstanding the suffix, occupy the continuous 16-bit, even if staddling the channel.
· The value is processed as 16-bit unsigned BIN data.
Bit data
· If T, C, CTH and CTC are already specified, the lower 16-bit value is used, but
n
higher 16-bit value is neglected.
· Notwithstanding the suffix, 1 word is occupied.
Word data
· The value is processed as unsigned 16-bit BIN data.

Processing of T, C, CTH, CTC

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


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

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


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

INSTRUCTIONS
Word Unit Processing of Bit Data

Generally (for sequence control program instructions), the size of bit data processed is 1 bit.
1
R006 R30500

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 data can be grouped into 16-bit or 32-bit for processing.
If a bit data is specified to an instruction operand for processing by word unit, process the bit data by
unit of word starting from the specifying bit data.

Point When BOOL type variables are processed in 16 bits or 32 bits with calculation
instructions, they should be defined as arrays.

Example

MOV
R30000 DM0

R30015 R30000

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

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

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


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 data by
word unit by straddling the next channel.

MOV

1
R30003 DM30505

R30102 R30003
Conventions and Cautions in Operand List

301ch 300ch

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

R30604 R30505
306ch 305ch

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

Point • The processing speed will decline when processing the word unit by straddling
channel.
• Only when using the KV-1000 series, if the operand is set with a bit data using
the STA instruction, bits cross over channels cannot be sent across the
channels.

R30003 R30503
< LDA > < STA >

R30102 R30003

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

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-8000/7000 Series, only the bit data at the starting position of the
channel can be specified for some instruction operands.

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


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

INSTRUCTIONS
Bit Data Processing of Word Data

Generally, the size of word data processed is 16 bits or 32 bits.


"Bit contact instruction" and "bit output instruction" may be employed to process the word device as any bit data. 1
● Specify LSB

Conventions and Cautions in Operand List


If a word data is generally specified to the instruction operand for processing bit data, process only the
lowest significant bit (LSB) of specified word data as bit data.

Example
When the value of DM1000 is #46563($B5E3)

DM1000 EM1001

DM1000˙#46563($B5E3)

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

Lowest bit
1: Contact ON
0: Contact OFF

When the contact is ON in the aforementioned example, the lowest significant bit (LSB) of
EM1001 is changed to "1".
EM1001=#14($E)

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

EM1001=#15($F)

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

Reference Bits other than LSB do not change.

● Specify the bit position


Specify the bit position of word data in the following operand of instruction words only when
KV-8000/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

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


BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

Out-of-range access of operands

When using array / structure type variables with KV-8000 of CPU function version 2.0 or later, check if
1 the occupied size of each operand of the instruction exceeds the device or variable area.
Conventions and Cautions in Operand List

1. When a local variable or a global variable assigned to the work area is specified
Check if the occupied size of the operand exceeds the size assigned as a variable.
Example)When the array variable Array_A of INT[5] is written as "BMOV DM0 Array_A[0] EM0"
When the value stored in EM0 is 6 or more, the first and second operands of BMOV occupy 6
words, but since Array_A has only 5 words, a calculation error will occur and the instruction cannot
be executed.

2. When a global variable assigned to a global device is specified


Check if the end occupied by the operand exceeds the area of the global device.
Example)When the array variable Array_A of INT[5] assigned to DM65000 is written as "BMOV DM0
Array_A[0] EM0"
No calculation error occurs even if the value stored in EM0 is 6 or more. For example, when 6 is
stored in EM0, 6 words from DM0 to DM5 are transferred in blocks to 6 words from DM65000 to
DM65005.
However, since the range of DM is DM0~DM65534, and the end of the second operand will exceed
the range of DM if the value of EM0 is 530 or more, a calculation error will occur and the instruction
cannot be executed.

3. When a device / variable is specified for the subscript of an array type variable
Check if the subscript value exceeds the number of elements in the array.
Example)When Array_A with 10 elements is written as Array_A[DM0]
When the value stored in DM0 is 10 or more, it exceeds the number of elements 10, so a
calculation error will occur and the instruction cannot be executed. However, if an array / structure
type variable assigned to the global device is used and the range accessed by the operand is within
the range of the global device, no calculation error will occur.
For example, when written as "BMOV EM0 Array_A[DM0] #5", but DM0 is 6 or more, no calculation
error will occur if the end of Array_A is within the range of the global device.

Point Out-of-range access of operands is checked under any of the following conditions.
• When an operand with variable occupied size is specified as variable
• When a value other than a constant is specified for the array subscript

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


BRIEF EXPLANATION OF
Conventions and Cautions in Operand List

INSTRUCTIONS
Other Matters Needing Attention

■ Precautions relating to the instruction size


During programming, pay attention to the program size (specify the total bytes), item size, operand size
1
(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.

■ Precautions when "Number of characters" is indicated as the occupied size of the operand
When "Number of characters" is indicated as the occupied size of the operand table, the number of
bytes up to NULL is processed as the number of characters. For example, if a string of 10 single-byte
characters such as ASCII code is specified, the number of characters will be "10". If a string of 10
double-byte characters such as Shift-JIS is specified, the number of characters will be "20".

■ 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 User's Manual of the CPU unit used.

■ Precautions on variable assignment


The range of the device or work area should not be exceeded during programming when using
variables in a program. Note the following points depending on the type of variable used.

● When using local variables or global variables assigned to the work area
The instruction processing area should not exceed the specified variable area when programming.
Otherwise, a conversion error or calculation error will occur.

● When using global variables assigned to devices


The range of the assigned device should not be exceeded during programming. If an instruction that
processes continuous devices such as BMOV is used, a conversion error or calculation error will occur
when the range of the device is exceeded.
For the device assignment range, refer to the User's Manual of the CPU unit used.

■ Precautions on label assignment


When the compatible model is KV-1000, it is necessary to assign labels to devices such as DM. In
addition, array type labels cannot be used.

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

■ 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.
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - 1-51
BRIEF EXPLANATION OF

Conventions and Cautions in Operand List


INSTRUCTIONS

1
Conventions and Cautions in Operand List

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


BASIC INSTRUCTIONS
2
BASIC INSTRUCTIONS
This chapter explains the most basic instructions in writing a sequence
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-34
Timer/Counter Instructions .................................................. 2-38
Connection/End Instructions ............................................... 2-62
Direct I/O Instructions.......................................................... 2-74

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-1


Contact Instructions
LDLoad
LDBLoad bar

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


ANBAND bar
OROR
,AND,ANB,OR,ORB ORBOR bar
BASIC INSTRUCTIONS

LD Load Connected in parallel to NO 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

L D S A S
S X S
X I C S
B S
L D B S
L D I S
L D N O T S
A N I S
A N D N O T S
X I O S

A N D S A S
S X S
X I C S
L D S

A N B S B S
L D I S
L D N O T S
A N I S
A N D N O T S
L D B N O T S
X I O S
O R S
O R B S O R I S
S **For B, “1” is filled in . O R N O T S

Operation Explanation Occupied size


S Specifies the bit to be connected to the left power rail.*1*2 1-bit

*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in S , the state of the LSB is loaded.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
KV-1000 BLD/BLDB instruction can be used if state other than that of LSB is to be loaded.

Description of Operation
LD S is connected to the power rail as a NO contact.
ON/OFF state of S is transferred to the instructions after LD.
LDB S is connected to the power rail as a NC contact.
The inverted ON/OFF state of S is transferred to the instructions after LDB.
AND S is connected in series to the circuit block as a NO contact.
ANB S is connected in series to the circuit block as a NC contact.
OR S is connected in parallel to the circuit block as a NO contact.
ORB S is connected in parallel to the circuit block as a NC contact.

2-2 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Contact Instructions

BASIC INSTRUCTIONS
Scan
ON
S
OFF

LD instruction ON
AND instruction
OR instruction OFF
ON
LDB instruction
ANB instruction
ORB instruction OFF
2
Reference There is no restriction to the number of contacts that can be connected in parallel or in

Contact Instructions
series.

Point Parallel connection that includes a intruction other than contact instruction is not
allowed.

Instructions other than contact

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, DR is specified
and the expansion I/O unit does not support direct input / output, or an access outside the
operand range occurs; Otherwise OFF. It will not change when indirect specification, index
CR2012
modification or DR is not specified in the operand, and the access outside the operand range is
not checked.
"Out-of-range access of operands", page 1-50

* The contact turns OFF when CR2012 is ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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
DMO ANB R001
OUT R500

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-3


LDPLoad pulse
LDFLOAD pulse fall
ANPAND pulse
ANFAND pulse fall

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano ORPOR pulse


ORFOR pulse fall

LDP,ANP,ORP,LDF,ANF,ORF
BASIC INSTRUCTIONS

LDP Load pulse

ANP AND pulse


Only 1 scan is ON at rising edge (OFF→
ON) of the specified bit.

ORP OR pulse

LDF LOAD pulse fall

2 ANF AND pulse fall


Only 1 scan is ON at falling edge (ON→
OFF) of the specified bit.

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
F S
L D F S

O R P S P S
L D P S
O R F S
S F S
when P in fill ↑; L D F S

when F in fill ↓.

Operation Explanation Occupied size


S Specifies the bit for detecting rising edge or falling edge.*1*2 1-bit

*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with DR.
*2 When word data is specified in S , the state of the LSB is loaded.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
KV-1000 BLD/BLDB instruction can be used if state other than that of LSB is to be loaded.

Description of Operation
LDP, ANP, ORP Only 1 scan is ON when rising edge of S is detected.

Instruction Operation
Connected to the left power rail as NC contact. This contact turns ON only for
LDP
1 scan when the rising edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANP
ON only for 1 scan when the rising edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns ON only for 1
ORP
scan when the rising edge of S is detected.

LDF, ANF, ORF Only 1 scan is ON when falling edge of S is detected.

Instruction Operation
Connected to the left power rail as NC contact. This contact turns ON only for
LDF
1 scan when the falling edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANF
ON only for 1 scan when the falling edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns ON only for 1
ORF
scan when the falling edge of S is detected.
2-4 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Contact Instructions

BASIC INSTRUCTIONS
Scan
ON
S
OFF

LDP instruction ON
ANP instruction
ORP instruction OFF
ON
LDF instruction
ANF instruction
ORF instruction OFF
2
• This instruction cannot be used in interrupt programs or in the initialization

Contact Instructions
Point
module.
• Attention should be paid when used in subroutines, among STP to STE
instructions, STG to JMP/ENDS instructions, CJ (NCJ) to LABEL instructions
and FOR to NEXT instructions.
"Precautions on the use of differential execution type instructions", page 1-40
• Parallel connection that includes a intruction other than contact instruction is
not allowed.

Instructions other than contact

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate
• (KV-8000/7500/7300/5500/5000/3000 only) When DR is specified and the expansion I/O unit
does not support direct input / output
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification, index modification or DR is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The contact turns OFF when CR2012 is ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-5


LDPBPulse bar
LDFBPulse fall
bar
ANPBAND pulse

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


ANFBAND pulse
fall bar
ORPBOR pulse
LDPB,ANPB,ORPB,LDFB,ANFB,ORFB bar
ORFBOR pulse
fall bar
BASIC INSTRUCTIONS

LDPB Pulse bar

ANPB AND pulse bar


Only 1 scan is OFF at rising edge (OFF→
ON) of the specified bit.

ORPB OR pulse bar

LDFB Pulse fall bar

2 ANFB AND pulse fall bar


Only 1 scan is OFF at falling edge (ON→
OFF) of the specified bit.

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.

Operation Explanation Occupied size


S Specifies the bit for detecting rising edge or falling edge.*1*2 1-bit

*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in S , the state of the LSB is loaded.
A bit of word data can be specified.

Description of Operation
LDPB, ANPB, ORPB Only 1 scan is OFF when rising edge of S is detected.

Instruc
Operation
tion
Connected to the left power rail as NC contact. This contact turns OFF only
LDPB
for 1 scan when the rising edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANPB
OFF only for 1 scan when the rising edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns OFF only for
ORPB
1 scan when the rising edge of S is detected.

LDFB, ANFB, ORFB Only 1 scan is OFF when falling edge of S is detected.

Instruc
Operation
tion
Connected to the left power rail as NC contact. This contact turns OFF only
LDFB
for 1 scan when the falling edge of S is detected.
Connected in series to the circuit block as a NC contact. This contact turns
ANFB
OFF only for 1 scan when the falling edge of S is detected.
Connected in parallel to the circuit block NC. This contact turns OFF only for
ORFB
1 scan when the falling edge of S is detected.

2-6 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Contact Instructions

BASIC INSTRUCTIONS
Scan
ON
S
OFF

LDPB instruction ON
ANPB instruction
ORPB instruction OFF
ON
LDFB instruction
ANFB instruction
ORFB instruction OFF
2
• This instruction cannot be used in interrupt programs or in the initialization

Contact Instructions
Point
module.
• Attention should be paid when used in subroutines, among STP to STE
instructions, STG to JMP/ENDS instructions, CJ (NCJ) to LABEL instructions
and FOR to NEXT instructions.
"Precautions on the use of differential execution type instructions", page 1-40
• Parallel connection that includes a intruction other than contact instruction is
not allowed.

Instructions other than contact

Operation flag
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate
• (KV-8000/7500/7300/5500/5000/3000 only) When DR is specified and the expansion I/O unit
does not support direct input / output
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification, index modification or DR is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The contact turns OFF when CR2012 is ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Timer 0 will be reset when rising edge of R000 is detected.
Counter 0 will be reset when rising edge of R001 is detected.
(Mnemonics list)
R000 #100
T0 LDPB R000
TMR #0 #100
R001 #2 LDFB R001
C0 C #0 #2 R002
R002

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-7


Bit Contact
Instructions
BLDBit load

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


bar
BANDBit AND
BANBBit
load

AND
BLD,BAND,BOR,BLDB,BANB,BORB bar
BORBit OR
BORBBit OR bar
BASIC INSTRUCTIONS

BLD(.U)
BLD BLD.D B Bit load
Operate as a contact for
BAND(.U)
BAND
transferring ON/OFF
BAND.D B Bit AND
information of the
specified bit of word data.
BOR(.U)
BOR BOR.D B
Bit OR

2 BLDB(.U)
BLDB BLDB.D B Bit load bar
Operate as a contact for
Bit Contact Instructions

BANB(.U) inverting and transferring


BANB BANB.D B Bit AND bar the ON/OFF information
of the specified bit of word
BORB(.U) data.
BORB BORB.D B
Bit OR bar

Ladder program Input mode


S B B L D S n
( 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

Operation Explanation Occupied size


Specifies a value other than the constant for reading the bit .U 16 bits
S
status.*1 .D 32 bits
Specifies the position of the bit of S (0 to 15 for .U; 0 to 31 for
n 16 bits
.D).

*1 When bit data is specified in S , the status of the S + n bit is read.


Operation is normal even if the relay straddles channels.

2-8 - KV-8000/7000/5000/3000/1000 Series/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 becomes a normally open contact. This contact transfers the ON/
OFF status of the n bit of S to the subsequent instructions.
BLDB(.U), BLDB.D, BANB(.U), BANB.D, BORB(.U), BORB.D
The instruction itself becomes a normally closed contact. This contact transfers inverted 2
ON/OFF status of the n bit of S to the subsequent instructions.

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

bit n bit 1

ON
bit S of n
OFF

ON
BLD instruction
OFF

ON
BLDB instruction
OFF

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF. It will not change when indirect specification
CR2012 or index modification is not specified in the operand, and the access outside the operand range
is not checked.
"Out-of-range access of operands", page 1-50

* The contact turns OFF when CR2012 is ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Point • Precautions when a constant is not specified 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 low-order 4 bits of n will be used.
When the suffix is D: The value of the low-order 5 bits of n will be used.
Example When the value of DM1000 is 0 (BIN: 0000 0000 0001 0100)
Since the value of low-order 4 CR2002 DM0
bits is 4,the 4th bit of DM0 B
DM1000
becomes the specified bit.

- KV-8000/7000/5000/3000/1000 Series/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
R500will be OFF.

2 DM0
B
DM1
B
R500 (Mnemonics list)
BLD DM0 #0
#0 #1 BAND DM1 #1
Bit Contact Instructions

OUT R500

Only when both the 3rd bit of data memory DM0 and the 5th bit of data memory DM1 both are ON, will
the output relay R500 be ON. Only when both the 3rd bit of data memory DM0 and the 5th bit of data
memory DM1 are OFF, will the output relay R500 be OFF.

DM0 R500 (Mnemonics list)


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

2-10 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Bit Contact Instructions

BASIC INSTRUCTIONS
MEMO

Bit Contact Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-11


Compare Contact
Instructions
LD=When "A=B" connect NO

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano contact in ON to bus


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

NO contact in ON to bus
LD<>When "A<>B" connect
NO contact in ON to bus

= <=
AND=When "A=B" connect
NO contact in ON serially to

□(.U) circuit block


AND<When "A<B" connect
NO contact in ON serially to
circuit block

□.S ※
Instruction itself is used as a
AND>When "A>B" connect
NO contact in ON serially to
circuit block

Contact type
AND<=When "A<=B" connect
NO contact in ON serially to

□.D contact to turn ON/OFF according


circuit block
AND>=When "A>=B" connect

< >=
NO contact in ON serially to

comparison
circuit block
AND<>When "A<>B" connect

□.L to result of the BIN data


NO contact in ON serially to
circuit block
OR=When "A=B" connect NO
contact in ON in parallel to

operation
circuit block

□.F OR<When "A<B" connect NO

comparison operation.
contact in ON in parallel to
circuit block
OR>When "A>B" connect NO

□.DF
contact in ON in parallel to
circuit block

> <>
OR<=When "A<B" connect
※ NO contact in ON in parallel
to circuit block
OR>=When "A>B" connect
NO contact in ON in parallel
to circuit block
OR<>When "A<>B" connect
NO contact in ON in parallel
to circuit block

Ladder program Input mode


2 S1

L D ※ S1 S2
( ※ S1 S2 )
Compare Contact Instructions

S2

S1 A N D ※ S1 S2
※ ( ※ S1 S2 )
S2
O R ※ S1 S2

S1 Please fill ※ = , < , > ,


※ <> , <= , >=
S2
Operation Explanation Occupied size
.U .S 16 bits
S1 Specifies the data to compare or the storage location for that data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
S2 Specifies the data to compare or the storage location for that data. .D .L .F 32 bits
.DF 64 bits

Point When comparing array or structure type variables, only the occupied size of the
operand from the start of the variables is compared, even if the contact type
comparison operation instruction is used. The BBCMP instruction is used to
compare all elements or members of an array or structure.
"BBCMP Instruction"(page 5-54)

2-12 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Compare Contact Instructions

BASIC INSTRUCTIONS
Description of Operation

□(.U) □.S (16-bit BIN data compare instructions)

=, <, >, <=, >=, <>

2
Unsigned 16-bit BIN data specified by S1 / S2 are compared. This instruction itself
is used asa contact to turn ON/OFF according to the result of comparison operation.
=.S, <.S, >.S, <=.S, >=.S, <>.S

Compare Contact Instructions


Signed 16-bit BIN data specified by S1 / S2 are compared. This instruction itself is
used asa contact to turn ON/OFF according to the result of comparison operation.

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 specified by S1 / S2 are compared. This instruction itself
is used asa contact to turn ON/OFF according to the result of comparison operation.
=.L, <.L, >.L, <=.L, >=.L, <>.L
Signed 32-bit BIN data specified by S1 / S2 are compared. This instruction itself is
used asa contact to turn ON/OFF according to the result of comparison operation.

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-8000/7000/5000/3000/1000 Series/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 specified by S1 / S2 are
compared. This instruction itself is used asa contact to turn ON/OFF according to the
result of comparison 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-40

□.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 specified by S1 / S2 are
compared. This instruction itself is used asa contact to turn ON/OFF according to the
result of comparison operation.

Instruction Operation ON Operation OFF


LD=.DF AND=.DF OR=.DF =[ S2 +3∼ S2 ][ S1 +3∼ S1 ]
[ S1 +3∼ S1 ] ≠[ S2 +3∼ S2 ]
LD<.DF AND<.DF OR<.DF [ S1 +3∼ S1 ]<
[ S2 +3∼ S2 ][ S1 +3∼ S1 ]
≧[ S2 +3∼ S2 ]
LD>.DF AND>.DF OR>.DF [ S1 +3∼ S1 ]
>[
S2 +3∼ S2 ][ S1 +3∼ S1 ]
≦[ S2 +3∼ S2 ]
LD<=.DF AND<=.DF OR<=.DF [ S1 +3∼ S1 ]
≦[ S2 +3∼ S2 ][ S1 +3∼ S1 ]
>[ S2 +3∼ S2 ]
LD>=.DF AND>=.DF OR>=.DF [ S1 +3∼ S1 ]
≧[ S2 +3∼ S2 ][ S1 +3∼ S1 ]<
[ S2 +3∼ S2 ]
LD<>.DF AND<>.DF OR<>.DF [ S1 +3∼ S1 ]
≠[ S2 +3∼ S2 ][ S1 +3∼ S1 ]
=[ S2 +3∼ 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-40

2-14 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Compare Contact Instructions

BASIC INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• For suffix "U/S/D/L"
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF. It will not change when indirect
2
specification or index modification is not used, and the access outside the operand range is

Compare Contact Instructions


not checked.
CR2012
• For suffix "F/DF"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the single precision or double precision floating point type real number
range, and an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The contact turns OFF when CR2012 is ON. When OR=, OR<, OR>, OR<=, OR>=, or OR<>, the
instruction is not executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Current value of counter C0000 is compared with constant #01000. Output relays R00500 to
R00503are turned ON/OFF according to the comparison result.
(Mnemonics list)
R000 #9999
C0 LDB R000
R001 C #0 #9999 R001
LD CR2002
CR2002 C0 DM0
LDA C0
LDA STA
CON
STA DM0
DM0 R500 LD< DM0 #1000
< ① OUT R500
#1000 LD= DM0 #1000
OUT R501
DM0 R501 LD> DM0 #1000
= ② OUT R502
#1000 LD>= DM0 #1000
DM0 R502 AND<= DM0 #2000
> ③ OUT R503
#1000
DM0 DM0 R503
>= <= ④
#1000 #2000

Comparing current value in counter C0 and constant "#1000":


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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-15


Output Instructions
OUT Out
OUB Out
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano bar

OUT,OUB
BASIC INSTRUCTIONS

OUT Out
Outputs ON/OFF status.
OUB Out bar

Ladder program Input mode


Execution condition D
O U T D O D

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

Operation Explanation Occupied size


D Specifies the output target.*1*2 1-bit

*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , it is output to LSB.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.
KV-1000 To output to other bits, use the BOUT/BOUB instructions.

Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.

Description of Operation
OUT Outputs the ON/OFF state before the instruction to D .
OUB Inverts the ON/OFF state before the instruction and outputs to D .

Scan
ON

Execution condition
OFF

ON

Bit device specified


OFF
by OUT instruction
ON

Bit device specified


OFF
by OUB instruction

2-16 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Output Instructions

BASIC INSTRUCTIONS
Point Double coil
When multiple OUT and OUB instructions are used on the same output relay, the
last programmed instruction in program is output first.
When R001 is OFF, R0500 will not be ON even if R000 turns ON.
R000 R500 R000 R500

2
SET

R001 R500 R001 R500

Output 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 timer/counter is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
• When DR is specified and the expansion I/O unit does not support direct input / output
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification, index modification or DR is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
If input relay R000 turns ON, then output relay R500 turns ON. If input relay R000 turns OFF, then
R500turns OFF.
If input relay R001 turns OFF, then output relay R501 turns ON. If input relay R001 turns ON, then
R501turns OFF.

R000 R500 (Mnemonics list)


LD R000
OUT R500
R001 R501 LD R001
OUB R501

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-17


SETSet ON
RESReset

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


SET,RES
BASIC INSTRUCTIONS

SET SET
Set Turns the bit ON and remains in this state.
@SET SET

RES RES
Reset Turns the bit OFF.
@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

Operation Explanation Occupied size


D Specifies the reference destination to be turned ON/OFF.*1*2 1-bit

*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , the LSB is turned ON/OFF.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.

Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.

Description of Operation
SET When the execution condition is ON, D is turned ON. Once turned ON, the bit
remains in ON state even if the execution condition is OFF (The ON bit is turned OFF with
the RES instruction, etc.). When the execution condition is OFF, no processing is
executed.
* The current values of timers (TMR, TMH, TMS, TMU) and up/down counters (UDC)
change to "0".
The current values of counters (C, OUTC) and up/down timers (UDT) change to setting
values.
RES When the execution condition is ON, D is turned OFF.
* The current values of timers (TMR, TMH, TMS, TMU) becomes the same value as the
setting value.
The current values of counters (C, OUTC), up/down counters (UDC), up/down timers
(UDT), and high-speed counters (CTH) change to "0".
@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).

2-18 - KV-8000/7000/5000/3000/1000 Series/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

2
Execution condition
OFF

SET, RES Execution Execution

Output Instructions
@SET, @RES Only 1 scan

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
• (KV-8000/7500/7300/5500/5000/3000 only) When DR is specified and the expansion I/O unit
does not support direct input / output
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification, index modification or DR is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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;

R500 (Mnemonics list)


R000
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-19


KEEPKeep

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


KEEP
BASIC INSTRUCTIONS

KEEP
The bit is turned ON and remains in this state
KEEP SET
RES
Keep when the SET condition turns ON. The bit is
turned OFF when the RES condition turns on.

Ladder program Input mode


SET condition KEEP
SET K E E P D
D

2 RES condition
RES
Output Instructions

Operation Explanation Occupied size


D Specifies the reference destination to be set / reset.*1*2 1-bit

*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , the LSB is set/reset.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.

Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.

Description of Operation
D will be ON when the SET condition is ON and the RES condition is OFF.
D will be OFF when the SET condition is OFF and the RES condition is OFF.
D will be OFF when both the SET condition and the RES condition are ON (The RES condition is
given priority).
The state of D is kept when both the SET condition and the RES condition are OFF.

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


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

R002 R500

Scan
ON

Execution
OFF
condition
KEEP instruction Execution Execution

2-20 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Output Instructions

BASIC INSTRUCTIONS
■Difference between the SET/RES instruction and the KEEP instruction
Basically, the SET/RES instructions and the KEEP instruction execute the same operation.
• As the SET and RES instructions can be used independently, the order of these two instructions can
be swapped in the program. There is also the advantage that a program can be inserted between the
SET and RES instructions.
• Fewer program steps can be used with the KEEP instruction, so the number of programmed steps
can be reduced when the KEEP instruction is used many times in a program.
2
• In the following example, when both input relays R000 and R001 are ON, output R500 will turn OFF

Output Instructions
through the KEEP instruction. For the SET and RES instructions, the SET instruction hereafter is
enabled, and output R500 turns ON.

R000 KEEP R000 R500


SET RES
R500
R001 R001 R500
RES SET

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, DR is specified
and the expansion I/O unit does not support direct input / output, or an access outside the
operand range occurs; Otherwise OFF. It will not change when indirect specification, index
CR2012
modification or DR is not specified in the operand, and the access outside the operand range is
not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-21


DIFUDifferential up 1ON
DIFDDifferential down

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


DIFU,DIFD
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
D
F D
Output Instructions

Operation Explanation Occupied size


D Specifies the target to be turned ON only for 1 scan.*1*2 1-bit

*1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
*2 When word data is specified in D , the LSB is set/reset.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.

Description of Operation
DIFU D is turned ON only for 1 scan at the rising edge of the execution condition.
Duplicate use of the operand with other DIFU instructions is not allowed.
DIFD D is turned ON only for 1 scan at the falling edge of the execution condition.
Duplicate use of the operand with other DIFD instructions is not allowed.

scan
ON

execution instraction
OFF

DIFU instruction Execute Execute

DIFD instruction Execute Execute

Point • This instruction cannot be used in interrupt programs or in the initialization


module.
• Attention should be paid when used among the STP to STE instructions, among
the STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL
instructions in subroutine.
"Precautions on the use of differential execution type instructions", page 1-40

2-22 - KV-8000/7000/5000/3000/1000 Series/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 writing DIFD instruction as (a), since R1000 is ON during
(a) DIFD input R000 OFF scanning, R000 and R1000 cannot be ON at the
same time. Output R500 is not ON in this case.
R000 R1000
DIFD

(b)
R1000 R500 When programming as (b) or (c), R500 will be ON during R000 OFF
s caning.
2

Output Instructions
R000 R1000 R1000 R500
(c) DIFU
Even if programming DIFU instruction as (d), input R1000 and R500
R000 R1000 R1000 R500 are ON while input R000 is ON.
(d) DIFU

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-23


ONDLON delay
OFDLOFF delay

Output Instructions
BASIC 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.
2 • When a timer/counter is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
• (KV-8000/7500/7300/5500/5000/3000 only) When DR is specified and the expansion I/O unit
Output Instructions

CR2012 does not support direct input / output


• When an access outside the operand range occurs
It will not change when indirect specification, index modification or DR is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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

2-24 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Output Instructions

BASIC INSTRUCTIONS
MEMO

Output Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-25


SHOTOne shot

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


ONDL,OFDL
BASIC INSTRUCTIONS

ONDL
The specified bit operates as an ON delay
ONDL ON delay
timer.

OFDL
The specified bit operates as an ON delay
OFDL OFF delay
timer.

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

Operation Explanation Occupied size


Specifies the setting value (0 to 65535) of the ON delay/OFF delay
n or the reference source of the setting value. The delay unit is 10 16 bits
ms.
D Specifies the target to perform ON delay / OFF delay operation.*1 1-bit

*1 When word data is specified in D , the LSB performs ON delay / OFF delay operation.
Bit specification of word data cannot be used.

Point • When outputting to an input relay, state of the input terminal is overridden at the
next scan.
• When D is used by OUT and other instructions, it operates as a double coil.

Description of Operation
ONDL D operates as an ON delay timer.
(1) When the execution condition is ON, D is turned ON after n ×10ms.
(2) When the execution condition is OFF, D will also be OFF.
(3) If the execution condition is OFF before n X10ms, then D does not turn ON.

ON

Execution condition
OFF
ON

D
OFF

n × 10ms n × 10ms
OFDL D operates as an ON delay timer.
(1) When the execution condition is ON, D will also be ON.
(2) D will be OFF after n X10ms since the execution condition is OFF.
(3) If the execution condition is ON before n ×10ms, then D does not turn OFF.

ON

Execution condition
OFF

ON
D
OFF

n × 10ms n × 10ms

2-26 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Output Instructions

BASIC 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 timer/counter is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
2
CR2012 • When an access outside the operand range occurs

Output Instructions
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

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


• KV-1000 Error range is ± 10 μsec + 1 scan period.
• The ON delay and OFF delay will operate for one scan period if n is set to
"0".
• This instruction cannot be used in interrupt programs or in the initialization
module.
• Attention should be paid when used among the STP to STE instructions, among
the STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL
instructions in subroutine.
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
• Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.

Sample Program
(1)When input relay R000 turns ON for three seconds or more, output relay R500 will also turn ON.
When R000 turns OFF, R500 will also turn OFF.
(2)When input relay R001 turns ON, output relay R501 will also turn ON. R501 will turn OFF after the
time set at data memory DM0 has elapsed since R001 turns OFF.
(Mnemonics list)
R000 #300
ONDL LD R000
R500 ONDL #300 R500
R001 LD R001
DM0 OFDL DM0 R501
OFDL
R501

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-27


FLIKFlicker

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


SHOT
BASIC INSTRUCTIONS

SHOT
The specified bit operates as a one-shot
SHOT One shot
timer

Ladder program Input mode


Execution condition n
S H O T n D
SHOT
D
Operation Explanation Occupied size
Specifies the setting value of the one-shot timer (0 to 65535) or the
2 n
reference source of the setting value. The delay unit is 10 ms.
Specifies the target to perform one-shot operation.*1
16 bits

1-bit
D
Output Instructions

*1 When word data is specified in D , the LSB performs one-shot operation.


Bit specification of word data cannot be used.

Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.

Description of Operation
SHOT D is turned ON at the rising edge of the execution condition. D turns OFF after
n X10ms.
The rising edge of the execution condition is ignored when D is ON.
ON

Execution condition
OFF

ON

D
OFF

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

2-28 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Output Instructions

BASIC 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 timer/counter is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
2
CR2012 • When an access outside the operand range occurs

Output Instructions
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

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


• KV-1000 Error range is ± 10 μsec + 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 n is not specified as a constant, the ON time is read only at the rising
edge of the execution condition. The time since D turns OFF until next time
the execution condition turns ON cannot be changed.
• This instruction cannot be used in interrupt programs or in the initialization
module.
• Attention should be paid when used among the STP to STE instructions, among
the STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL
instructions in subroutine.
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
• Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.

Sample Program
(1)Output relay R500 turns ON for 0.2 seconds at the rising edge of input relay R000. R500 will stay ON
for 0.2 s from start of the rising edge of R000 even if R000 turns OFF.
(2)When input relay R001 turns ON, output relay R501 will also turn ON. R501 will turn OFF when the
value set at data memory DM000 has elapsed after R001 turns ON.
(Mnemonics list)
R000 #20
SHOT LD R000
R500 SHOT #20 R500
R001 LD R001
DM0 SHOT DM0 R501
SHOT
R501

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-29


ALTAlternate

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


FLIK
BASIC INSTRUCTIONS

FLIK FLIK
Flicker The specified bit is used as a flicker circuit.

Ladder program Input mode


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

Operation Explanation Occupied size

2
Specifies the setting value (0 to 65535) when D turns ON or
n1 16 bits
the reference source of the setting value. The delay unit is 10 ms.
Specifies the setting value (0 to 65535) when D turns OFF or
16 bits
Output Instructions

n2
the reference source of the setting value. The delay unit is 10 ms.
D Specifies the target to perform the flicker circuit operation.*1 1-bit

*1 When word data is specified in D , the LSB operates as a flicker circuit.


Bit specification of word data cannot be used.

Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.

Description of Operation
FLIK (1) D is repeatedly turned ON/OFF while the execution condition is ON. Operation will
start from the ON state.
The ON time is n1 X10ms, and the OFF time is n2 X10ms.
(2)While D is ON, if the execution condition is OFF, D will turn OFF.

(DAY) (MONTH)

ON
Execution condition
OFF
ON

D
OFF

n1 × 10ms n2 × 10ms n1 × 10ms n2 × 10ms n1 × 10ms

2-30 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Output Instructions

BASIC 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 timer/counter is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
2
CR2012 • When an access outside the operand range occurs

Output Instructions
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

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


• KV-1000 Error range is ± 10 μsec + 1 scan period.
• Will operate for one scan even if n1 and n2 are set to "0".
• This instruction cannot be used in interrupt programs or in the initialization
module.
• Attention should be paid when used among the STP to STE instructions, among
the STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL
instructions in subroutine.
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
• Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-31


KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
ALT
BASIC INSTRUCTIONS

ALT ALT Alternate To invert the ON/OFF state.

Ladder program Input mode


Execution condition D
ALT A L T D

Operation Explanation Occupied size


D Specifies the target whose state is to be inverted.*1*2 1-bit

2 *1 Fast refresh can be achieved without being affected by the scan time when specifying a relay with
DR.
Output Instructions

*2 When word data is specified in S , the state of the LSB will be inverted.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series Bit specification of word data can be performed.

Point When outputting to an input relay, state of the input terminal is overridden at the
next scan.

Description of Operation
The state of D is inverted at the rising edge of the execution condition.
ON
Execution
condition OFF
ON

D
OFF

Operation flag

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 is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
• When DR is specified and the expansion I/O unit does not support direct input / output
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification, index modification or DR is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Point • This instruction cannot be used in interrupt programs or in the initialization


module.
• Attention should be paid when used in subroutines, among STP to STE
instructions, STG to JMP/ENDS instructions and CJ (NCJ) to LABEL
instructions.
"Precautions on the use of differential execution type instructions", page 1-40

2-32 - KV-8000/7000/5000/3000/1000 Series/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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-33


Bit Output
Instructions
BOUTBit out

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano BOUBBit out bar

BOUT,BOUB
BASIC INSTRUCTIONS

BOUT(.U)
BOUT BOUT.D B Bit out
Reflects the input status to
the specified bit of the word
BOUB(.U)
BOUB
data.
BOUB.D B Bit out bar

Ladder program Input mode

2
Execution condition D
B B O U T D n
n ( B O D n )
Bit Output Instructions

D
B B O U B D n
n ( B O B D n )

Operation Explanation Occupied size


.U 16 bits
D Specifies the target to map the input status.*1
.D 32 bits
Specifies the bit of D for mapping. (0 to 15 when suffix is .U; 0
n 16 bits
to 31 when suffix is .D).

*1 When bit data is specified in S , the status of the S + n bit is read.


Operation is normal even if the relay straddles channels.

Point • Precautions when a constant is not specified 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 low-order 4 bits of n will be used.
When the suffix is D: The value of the low-order 5 bits of n will be 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-34 - KV-8000/7000/5000/3000/1000 Series/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 th 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 bit
16 15
D bit
0

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

Bit31 Bit16 Bit15 Bit1 Bit0

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the 5th bit of data memory DM000 is turned ON.
When R000 is OFF, the 0th bit of DM0 is turned ON.
(Mnemonics list)
R000 DM0
B LD R000
#5 BOUT DM0 #5
BOUB DM0 #0
DM0
B
#0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-35


BSETSet
BRESReset

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


BSET,BRES
BASIC INSTRUCTIONS

BSET(.U)
BSET BSET.D BSET
To turn the specified bit of the
Set word data ON and hold this
@BSET(.U)
@BSET
state.
@BSET.D BSET

BRES(.U)
BRES BRES.D BRES
To turn the specified bit of the
2 @BRES(.U)
Reset
word data OFF.
@BRES @BRES.D BRES
Bit Output Instructions

Ladder program Input mode


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 )

Operation Explanation Occupied size


.U 16 bits
D Specifies the target to be set or reset (including bit).*1
.D 32 bits
Specifies the bit of D for mapping. (0 to 15 when suffix is .U; 0
n 16 bits
to 31 when suffix is .D).

*1 When bit data is specified in S , the status of the S + n bit is read.


Operation is normal even if the relay straddles channels.

Point • Precautions when a constant is not specified 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 low-order 4 bits of n will be used.
When the suffix is D: The value of the low-order 5 bits of n will be 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

Description of Operation
BSET When the execution condition is ON, the n th bit of D is turned ON, and held in
this state.

2-36 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Bit Output Instructions

BASIC INSTRUCTIONS
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

For 32bit (suffix .U) Bit15 Bit1 Bit0


bit n
bit
31
D +1 bit bit
16 15
D bit
0

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

BRES
Bit31 Bit16

When the execution condition is ON, the


Bit15

n th bit of D
Bit1 Bit0

is turned OFF.
2

Bit Output Instructions


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

bit15 bit1 bit0


For 32bit (suffix .U)
bit n
bit
31
D +1 bit bit
16 15
D bit
0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

bit31 bit16 bit15 bit1 bit0

@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the 5th bit of data memory DM000 is set.
When input relay R001 is ON, the 5th bit of data memory DM0 is reset.
(Mnemonics list)
R000 DM0
BSET LD R000
#5 BSET DM0 #5
LD R001
BRES DM0 #5
R001 DM0
BRES
#5

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-37


Timer/Counter
nstructions
TMRTimer
TMH10ms high-

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano peed timer


TMS1ms high-speed
mer
TMR,TMH,TMS
BASIC INSTRUCTIONS

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

TMH
10ms high-speed
T
10 ms, 32-bit ON delay down timer.
H
timer

TMS
1ms high-speed
T
1 ms, 32-bit ON delay down timer.
S
timer

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

Operation Explanation Occupied size


n Specifies the timer number (0 to 3999).*1 16 bits
Specifies the setting value of the timer. Can be set within the range
S 32 bits
of 0 to 4294967295.

*1 Only constants and variables / labels specified as TIMER (timer) type can be specified.

Point The No. n of the timer cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series TMR, TMH, TMS, UDT, TMU
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT

2-38 - KV-8000/7000/5000/3000/1000 Series/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).

2
When the current value becomes "#0", the timer T n turns ON.
When the execution condition is OFF, the timer T n turns OFF, and the current value is reset.

Timer/Counter Instructions
Scan
ON

Execution condition
OFF
Value set in S

Current value

#0

Timer  T n ON
T
H n
T
S n

Point • The error range of the TMR instruction is ± (100 ms + 1 scan period).
• The error range of the TMH instruction is ± (10 ms + 1 scan period).
• The error range of the TMS instruction is ± (1ms + 1 scan period).
• When S is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", timer T n will be ON while the execution
condition is ON.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-39


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
H0 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 0 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-40 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
(3) Reading the setting value
DM0
• When the setting value is not set as a constant ( T0 ): Can be read by the LDA.D or MOV.D

instruction.

Example The setting value of T0 is


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

Timer/Counter Instructions
DM0 DM10
LDA.D STA.D

OR
DM0
T0
MOV.D
DM0 DM10

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

(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 a constant is not
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, then 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-41


TMU32-bit 10μs
ON delay down
timer

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


TMU
BASIC INSTRUCTIONS

TMU
10μs high-speed
T
10μs, 32-bit ON delay down timer.
U
timer

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 Operation

Explanation
Specifies the timer number (0 to 3999).*1
Occupied size
16 bits
Specifies the setting value of the timer. Can be set within the range
Timer/Counter Instructions

S 32 bits
of 0 to 4294967295.

*1 Only constants and variables / labels specified as TIMER (timer) type can be specified.

Point • The TMU instruction can be used with KV-8000/7000 Series CPU units, KV-5000/
3000Series CPU units that have CPU function version 2.0 or higher and with KV
Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4
• The No. n of the timer cannot be same as with No. of the following
instructions.
TMR, TMH, TMS, UDT, TMU

Description of Operation
When the execution condition is ON, the timer specified by n is started. The value specified by
S (setting value) becomes the current value when the timer is started. The current value will
decrement (-1) every 10 μs.
When the current value becomes "#0", the timer T n turns ON.
When the execution condition is OFF, the timer T n turns OFF, and the current value is reset.
Scan
ON

Execution condition
OFF
Value set in S

Current value

#0

T
Timer U n ON

Point • The error range of the TMU instruction is "± 10 μs + 1 scan period".
• When S is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", timer T n will be ON while the execution
condition is ON.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.

2-42 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access

CR2012
outside the operand range occurs; Otherwise OFF.
It will not change when indirect specification or index modification is not specified, and the
2
access outside the operand range is not checked.

Timer/Counter Instructions
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 turns ON, timer T0 turns ON 70μs later, and output relay R500 turns ON.
(Mnemonics list)
R000 #7
T
U 0 LD R000
TMU #0 #7
LD T0
T0 R500 OUT R500

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-43


UDTUp/down timer

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


UDT
BASIC INSTRUCTIONS

UDT

UDT
UP
DW Up/down timer 10 ms, 32-bit up/down timer.
RES

Ladder program Input mode


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

2
DW
Reset input
RES
Timer/Counter Instructions

T n

Operation Explanation Occupied size


n Specifies the timer number (0 to 3999).*1 16 bits
Specifies the setting value of the timer. Can be set within the range
S 32 bits
of 0 to 4924967295. Unit is 10 ms

*1 Only constants and variables / labels specified as TIMER (timer) type can be specified.

Point The No. n of the timer cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series TMR, TMH, TMS, TMU, UDT
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT

Description of Operation
The current value of the timer specified by S is incremented by 1 every 10 ms when up input is ON.
The current value of the timer specified by S is decremented by 1 every 10 ms when down input is
ON.
The current value is kept when up and down inputs both turn ON or OFF.
Reset is performed while reset input is ON.
(1) T n turns ON when the current value is the same as the setting value while up input is ON.
(2) T n turns OFF when the up input is OFF.
(3) T n turns ON when the current value becomes "0" while the down input is ON.
(4) T n turns OFF when the down input is OFF.
(5) The current value is reset to "0" when the reset input is ON.
(1) (2) (3) (4) (5)
ON

Up counting input
OFF
ON

Down counting input


OFF
ON
Reset input
OFF

Set value

Current value
0

Timer UDT n ON ON ON ON

2-44 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
Point • The error range of the UDT instruction is (± 10 μs + 1 scan period or less)
• When S is not specified as a constant, the setting value is updated at every
scan during operation.
• If "0" is set in the setting value, the timer UDT n is normal ON, when both up
input and down input are ON.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit 2
used.

Timer/Counter Instructions
• This instruction cannot be used in interrupt programs or in the initialization
module.

Reference The current value of the up/down counter is kept when operation is stopped or when the
power is turned OFF.
* When using the KV Nano Series, the value is cleared when the power is turned OFF if
a number other than 0 to 9 is specified for the timer number.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-45


CCounter

KV-8000 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 Operation Explanation Occupied size


Timer/Counter Instructions

n Specifies the counter number (0 to 3999).*1 16 bits


Specifies the setting value of the counter. Can be set within the
S1 32 bits
range of 0 to 4924967295.
S2 Specifies the target to be used for input counting.*2 1 bit

*1 Only constants and variables / labels specified as COUNTER (timer) type can be specified.
*2 When word data is specified, the LSB of the device is used for input counting.
Bit specification of word data cannot be used.

Point The No. n of the counter cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series C, OUTC, UDC
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT

Description of Operation
When the execution condition is ON, "1" is added to the current value of n at the rising edge of
S2 . When the setting value specified by S1 is equal to the current value, counter C n will
turn ON. When the execution condition is OFF, counter C n will turn OFF, and the current value will
be reset to "0". The execution condition is used as reset input.
ON
R000 ←reset input #12 Count input S2
C0 OFF

R001 ON
Execution condition
OFF
C0
S1
S1
11
8 9 10
7
6
4 5
2 3
Current value 1

ON
C n

2-46 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
Point • The response speed of the counter instruction depends on the scan time.
Refer to "The maximal counting speed of counters" in the User's Manual of the
CPU unit used.
• When S1 is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", counter C
execution condition is ON.
n will be ON while the
2
• Attention should be when performing writing operation in the RUN mode.

Timer/Counter Instructions
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.

Reference The current value of counter C is kept in the PROG mode or when the power is turned
OFF.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series The current value can be cleared when the
power is turned OFF in CPU system setting.
KV-1000 The current value can also be cleared when the power is turned OFF through
setting the memory switching instruction (MEMSW).
"MEMSW instruction", page 3-4

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-47


Timer/Counter Instructions
BASIC INSTRUCTIONS

Reading and Changing the Counter Current Value/Setting Value

(1) Reading the current value


It can be read through the LDA.P 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, 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.

(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 instruction.
R001

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-48 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
(4) Changing 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.
2
LDA.D STA.D

Timer/Counter Instructions
To change the setting value by the MOV.D instruction: DM0
The setting value can be changed only when the device is specifed ( C0 ) .
R001

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, then 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-49


OUTCOut counter

KV-8000 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 Operation Explanation Occupied size


Timer/Counter Instructions

n Specifies the counter number (0 to 3999).*1 16 bits


Specifies the setting value of the counter. Can be set within the
S 32 bits
range of 0 to 4924967295.

*1 Only constants and variables / labels specified as COUNTER (timer) type can be specified.

Point The No. n of the counter cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series C, OUTC, UDC
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT

Description of Operation
The current value of the counter specified in n is incremented by 1 at the rising edge of the
execution condition.
When the setting value specified by S is equal to the current value, counter C n will turn ON.
The RES instruction is used to reset counters.
ON
R000 #12 Execution condition

C0 R000 OFF

S
12
11
C0 9 10
8
7
6
4 5
2 3
Current value 1
R001 C0
RES ON
C n ON
OFF

ON

Reset
OFF

Point • The response speed of the counter instruction depends on the scan time.
Refer to "The maximal counting speed of counters" in the User's Manual of the
CPU unit used.
• When the setting value is set to "0", counter C n turns ON.
• Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.

2-50 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
Reference The current value of counter C is kept in the PROG mode or when the power is turned
OFF.
KV-8000/7500/7300/5500/5000/3000 The current value can be cleared when the power is
turned OFF in CPU system setting.
KV-1000 The current value can also be cleared when the power is turned OFF through
setting the memory switching instruction (MEMSW).
"MEMSW instruction", page 3-4 2

Timer/Counter Instructions
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-51


ITVLInterval timer

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


ITVL
BASIC INSTRUCTIONS

ITVL(.U) ITVL To measure the pulse


ITVL
PLS
ITVL.S PAUSE Interval timer interval, pulse length and
RES input value in set 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

Operation Explanation Occupied size


D1 Specifies the start of the data table.*1 16 bits ×16
D2 Specifies the start of the flag relay.*2 1 bit ×4

*1 Only word data can be specified.


*2 Only bit data can be specified.

Description of Operation

Two functions of the ITVL instruction


(1) Pulse measurement The pulse period or pulse width of PLS (pulse input) is measured.
mode........ 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 low-order 16 bits of the measurement value.
(2) DM measurement The maximum/minimum values and average values of captured measurement
mode........ 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-52 - KV-8000/7000/5000/3000/1000 Series/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 during PLS
(pulse input) ON scanning. Please use CR2002 in PLS
(pulse input) in order to load at each scan. 2
PAUSE (measurement pause Measurement is paused when ON.

Timer/Counter Instructions
input)...
RES (reset input)................... When RES turns ON, the content of the data table is initialized.
The measurement values, average values, measurement times and
accumulated values will become "0".
The max. measurement value becomes "65535" when suffix is .U; and
becomes"32767" when suffix is .S.
The min. measurement value becomes "0" when suffix is .U; and becomes"-
32768" when suffix is .S.

ITVL(.U) Pulse measurement and DM measurement are processed by unsigned 16-bit BIN data.
Setting values, measurement values, and average values are processed as unsigned16-
bit data (0 to 65535).
Accumulated values are processed as unsigned 32-bit data.

ITVL.S Pulse measurement and DM measurement are processed by signed 16-bit BIN data.
Setting values, measurement values, and average values are processed as signed 16-bit
data (-32768 to 32767).
Accumulated values are processed as signed 32-bit data.

Data table assignment


16 continuous word data starting with 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-53


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 low-order 16 bits.
• When the averaging times is reached, the measurement count accumulated value will
Timer/Counter Instructions

become "0".

Mode setting
Pulse measurement mode

Pulse period measurement Pulse width 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 1sec Unit 5 1sec Unit
DM measurement mode

Mode No. DM No. Content


0 to 5 None 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
isup to DM32767.

Flag relay assignment


Four continuous bit data starting with 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.


Average value
D2 +3 measurement completed ->Only 1 scan ON after measurement completed of average count specifying.

Point • Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used.
• This instruction cannot be used in interrupt programs or in the initialization
module.

2-54 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC 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 bit data or timer/counter is specified in D1 by indirect specification
• When word data or timer/counter is specified in D2 by indirect specification
2
• When the indirect specification or index modification range is inappropriate

Timer/Counter Instructions
CR2012
• When an access outside the operand range occurs
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program

■Example of pulse interval measurement


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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-55


Timer/Counter Instructions
BASIC INSTRUCTIONS

ON

Input relay R000


OFF

500ms 400ms 600ms


ON

Input relay R1000 ON


OFF

1 scan
ON

Input relay R1001

2
ON
OFF
1 scan
ON

Output relay R500 ON ON


Timer/Counter Instructions

OFF

300ms 300ms

■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
memoryDM1600 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
#1600 DM0 Measure contents in DM1600. LD CR2008
MOV #1600 DM0
CR2008 MOV LD CR2008
#2000 DM1 Set max. value of measurement range as 3V(2000). MOV #2000 DM1
CR2008 LD CR2008
MOV
#1000 DM2 Set min. value of measurement range as 2V(1000). MOV #1000 DM2
LD CR2008
CR2008 MOV MOV #100 DM3
#100 DM3 Set the averaging times as 100. LD CR2002
CR2002 ITVL LD R001
PLS LD R002
Stop measuring when input relay R001 ON. ITVL DM0 R1000
DM0
R001 LD R1000
PAUSE
Reset when input relay R002 ON OUT R500
R1000
R002 LD R1001
RES OUT R501
R500 ON when measured value becomes larger than 3V (2000). LD R1003
R1000 R500 MOV DM7 DM100
R501 ON when measured value becomes less than 2V (1000).
R1001 R501

Store average value to DM100 every 100 measurements.


R1003 MOV
DM7 DM100

2-56 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
MEMO

Timer/Counter Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-57


UDCUP/DOWN counter

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


UDC
BASIC INSTRUCTIONS

UDC

UDC
UP
DW UP/DOWN counter 32-bit up/down counter
RES

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

Operation Explanation Occupied size


n Specifies the counter number (0 to 3999).*1 16 bits
Specifies the setting value of the counter. Can be set within the
S 32 bits
range of 0 to 4924967295.

*1 Only constants and variables / labels specified as COUNTER (timer) type can be specified.

Point The No. n of the counter cannot be same as with No. of the following
instructions.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series C, OUTC, UDC
KV-1000 TMR, TMH, TMS, C, OUTC, UDC, UDT

Description of Operation
Current value of the counter is incremented by 1 (+1) on the rising edge of the input.
Current value of the counter is decremented by 1 (-1) on the falling edge of the input.
Counter UDC n turns ON when current value incremented/decremented by 1.
The current value is reset to 0 when reset input turns ON.

R001 UDC 0
UP

R002 #9
DW

R003
RES

C0

ON

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 6 7 6 7 8 7 6
4 5 6 5 4
Current value 2 3 2 3 3 2
0 1 0 1 0 1 0
Contact C0 O Bit increase O
Bit decrease
O
Bit decrease
N N N

2-58 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
Point • When S is not specified as a constant, the setting value is updated at every
scan during operation.
• When the setting value is set to "0", counter UDC n is always ON when up
input or down input turns ON. When it is OFF, the reset input will be ON.
• Attention should be when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit
used. 2
• This instruction cannot be used in interrupt programs or in the initialization

Timer/Counter Instructions
module.

Reference The current value of up/down counter is kept in the PROG mode or when the power is
turned OFF.
KV-8000/7500/7300/5500/5000/3000, KV Nano Series The current value can be cleared when the
power is turned OFF in CPU system setting.
KV-1000 The current value can also be cleared when the power is turned OFF through
setting the memory switching instruction (MEMSW).
"MEMSW instruction", page 3-4

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The number of coming-in vehicles is counted by inpuput relay R000. Park
R000 R001
The number of going-out vehicles is counted by input relay R001.
When count is full (10 vehicles), C0 turns ON to turn output relay
R00500 ON. Entrance Exit
The count is reset by input relay R002.
→ →

R000 UDC 0
(Mnemonics list)
UP
LD R000
#9
R001 LD R001
DW
LD R002
R002
RES
UDC #0 #9
LD C0
C0 R500 OUT R500

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-59


Timer/Counter Instructions
BASIC INSTRUCTIONS

How to Input When Using Local Devices


When local devices are used in the operands of non-timer instructions, input format of "@DM0"
(example) can be used. However, when local devices are used in the operands of timer instructions
(except for interval timer), the input format is different from that for other instructions, and input can be

2
performed as follows. The input method for contacts is the same as that of the instructions other than
timer instruction.
Timer/Counter Instructions

Instruciton Input mode Contact Input mode


Timer T M R @ n S
S T @ n S

T@ n T I M @ n S
O U T T @ n S

T M H @ n S
High-speed timer
T H @ n S
S
T T I M H @ n S
H @ n
O U T H @ n S

1ms high-speed timer T M S @ n S


S T S @ n S
T
S @ n T I M H H @ n S
O U T S @ n S @T n
L D @ T n
10ms high-speed timer T M U @ n S
S T U @ n S
T
U @ n T M U H @ n S
O U T U @ n S

Up/down Timer

UDT@ n
UP
S n S
U D T @
DW

RES

Counter
S1 C @ n S1 S2
C@ n ( C N T n S1 S2 )
S2

Output counter
S n
O U T C @ S
C@ n @C n
L D @ C n
Up/down counter
UDC@ n
UP
S U D C @ n S
DW ( C N T R n S )

RES

2-60 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Timer/Counter Instructions

BASIC INSTRUCTIONS
MEMO

Timer/Counter Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-61


Instructions
Connection/End
ENDHEnd
ENDEnd High

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


END,ENDH
BASIC INSTRUCTIONS

END END
End To indicate the end of the master program.

ENDH ENDH
End High To indicate the end of the entire program.

Ladder program Input mode

E N D ( E )

2 END
Connection/End Instructions

ENDH
E N D H ( H )

Description of Operation
END The END instruction are the instructions of the final program segment of common master
program.
When the END instruction is executed, the master program is completed by PLC, and the
common master program will be executed again from the program segment 0 after END
processing. The final end of program is indicated by ENDH instruction.
For details on macro modules, see User's Manual of the CPU unit used.

ENDH The ENDH instruction indicates the end of the whole program (there is no program above
this position).
When a sequence control program or an interrupt program is not written, the END
instruction and the ENDH instruction will be written continuously.

Master
program

END

ENDH

2-62 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Connection/End Instructions

BASIC INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state
2
■Difference between the END and ENDH instructions

Connection/End Instructions
Sequence programs are named as follows according to their function.

Master subroutine

END End of master subroutine

SBN

End of master subroutine


Sequence program Programming subroutine and
RET End of subroutine
interrupt program as required.
INT
End of interrupt program

RETI End of interrupt program

ENDH 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 instruction", page 3-26
• INT/RETI instructions : Indicate the interrupt program range.
"INT/RETI instruction", page 5-110

For details on macro modules, see User's Manual of the CPU unit used.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-63


CONConnect

KV-8000 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 mo
a b c d
↑ ↑ ↑
CON CON CON

2 Description of Operation
Connection/End Instructions

This instruction is used to connect instructions after the output instruction when a program is written in
an extended ladder program.

* If an instruction is written after the output instruction when creating a ladder diagram with KV
STUDIO, it will be inserted automatically during conversion.
* Scan time is not influenced.

For details on extended ladders, see User's Manual of the CPU unit used.

Operation flag

CR2009 No change in state


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

2-64 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Connection/End Instructions

BASIC INSTRUCTIONS
MEMO

Connection/End Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-65


MPSPulse
MRDRead
MPPPop
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
MPS,MRD,MPP
BASIC INSTRUCTIONS

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
Connection/End Instructions


MPS


MRD


MPP

Description of Operation
MPS Stores the ON/OFF state and operation flag state up to that instruction, and executes the
instruction from the next step. If this instruction is executed two or more times in a circuit
block, then ON/OFF state at that moment will be stored in the execution sequence. (up
to8 states can be stored.)

MRD Reads the stored ON/OFF state and operation flag by the MPS instruction, and executes
the instructions from the program segment using the content read. The ON/OFF state and
operation flag state stored in memory will be held.
The MRD instruction can be used continuously. (In this case, the same content is read.)

R000 R500 LD R000


MPS ・・・・・・・・ Log ON/OFF status in (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
AND R005 in (1) and clear MPS.
OUT R505

2-66 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Connection/End Instructions

BASIC INSTRUCTIONS
MPP Reads the stored ON/OFF state and operation flag by the MPS instruction, and executes
the instructions from the program segment using the content read. When two or more
MPS instructions are executed (two or more ON/OFF states and operation flag states are
stored), the stored ON/OFF states and operation flag states are read in sequence by the
MPS instruction. Then the ON/OFF states and operation flag states read by the MPP
instruction are cleared from memory.
R000 R001 R002 R003 R004 R005 R006 R007 R008 R500 LD R000
. . . . Store ON/OFF status in (1)
2
MPS

Connection/End Instructions


① ② ③ ④ ⑤ ⑥ ⑦ ⑧ R009 R501 AND R001
MPS . . . . Store ON/OFF status in (2)

...
R010 R502
AND R006
MPS . . . . Store ON/OFF status in (7)
R011 R503
AND R007
MPS . . . . Store ON/OFF status in (8)
R012 R504 AND R008
OUT R500
R013 R505
MPP . . . . Read ON/OFF status in (8).
R014 R506 AND R009
OUT R501
MPP . . . . Read ON/OFF status in (7).
R015 R507
AND R010
OUT R502
R100 R508

...
MPP . . . . Read ON/OFF status in (2).
AND R015
OUT R507
MPP . . . . Read ON/OFF status in (1).
AND R100
OUT R508

Point Please use the MPS instruction and MPP instruction in pair.
If number of MPS instructions is different from that of MPP instructions, then a conversion
error will occur when the program is edited through KV STUDIO, and the program cannot
be executed

Operation flag

CR2009 No change in state


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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-67


ANLAND load
ORLOR load

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


ANL,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

2
ANL ORL
Block C
Connection/End Instructions

Block A Block B Block D

Description of Operation
ANL Connects two contact circuit blocks in series.
As shown in the ladder diagram above, circuit block A and circuit block B are connectedin
series. This connection is indicated by a connection line instead of a symbol.

ORL Connects two contact circuit blocks in parallel.


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

Operation flag

CR2009 No change in state


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

■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
arecalled "program circuit block".
Program block

2-68 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Connection/End Instructions

BASIC INSTRUCTIONS
Sample Program
Output relay R501 turns ON when one of the following conditions (1), (2), (3) or (4) is satisfied.
(1)Both input relay R000 and R002 turn ON.
(2)Both input relay R000 and R003 turn ON.

2
(3)Both input relay R001 and R002 turn ON.
(4)Both input relay R001 and R003 turn ON.
(Mnemonics list)

Connection/End Instructions
R000 R002 R501
LD R000
AND R002
R000 R003 LD R000
AND R003
ORL
LD R001
R001 R002 AND R002
ORL
LD R001
R001 R003 AND R003
ORL
OUT R501

The operation of the above program is the same as that of the following program.

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-69


INVON/OFF status
inversion

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


INV
BASIC INSTRUCTIONS

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

Ladder program Input mod

Ι Ν V

Description of Operation
2 INV Inverts the previous ON/OFF state before this instruction.
Connection/End Instructions

Scan

ON
Before INV
instruction OFF

ON
After INV
instruction
OFF

Point • The "previous ON/OFF state" only refers to the circuit elements connected by ANL/
ORL.
p

R1002

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-70 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Connection/End Instructions

BASIC INSTRUCTIONS
Operation flag

CR2009 No change in state


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

Connection/End Instructions
When R000 or DM0.3 is ON and DR001 is OFF, "10" will be stored in DM0. Otherwise, "20" will be
stored in DM0.
(Mnemonics list)
R000 DR001 MOV
#10 DMO LD R000
OR DM0.3
ANB DR001
MOV #10 DM0
INV
DMO.3 MOV MOV #20 DM0
#20 DMO

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-71


MEPMEP
MEFMEF

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


MEP,MEF
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 mod

M E P

2
Connection/End Instructions

M E F

Description of Operation
MEP Only 1 scan period is ON on the rising edge of the execution condition before this
instruction.
MEF Only 1 scan period is ON on the falling edge of the execution condition before this
instruction.

Scan

ON
Before MEP/MEF
instruction
OFF
ON
Before MEP
instruction
OFF
ON
Before MEF
instruction OFF

Point • This instruction cannot be used in interrupt programs or in the initialization module.
• Attention should be paid when used among the STP to STE instructions, among the
STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL instructions in
subroutine.
"Precautions on the use of differential execution type instructions", page 1-40
• The "previous ON/OFF state" only refers to the circuit elements connected by ANL/
ORL.

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 directly. Attention should also be paid
when used in OR circuit.
Since the instruction is the same as the INV instruction, please read the content about
INV instruction together.
"INV instruction", page 2-70

2-72 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Connection/End Instructions

BASIC INSTRUCTIONS
●When inverting is
possible


2
●When inverting is
×

Connection/End Instructions
not possible

Operation flag

CR2009 No change in state


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

Sample Program
Only 1 scan will be performed on the rising edge of the execution condition with R000, R001 and R002
combined (OFF->ON), and R500 will be ON.
(Mnemonics list)
R000 R002 R500
LD R000
ORB R001
AND R002
MEP
OUT R500
R001

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-73


Direct I/O Instructions
RFSXInput refresh
RFSYOutput refresh
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
RFSX,RFSY
BASIC INSTRUCTIONS

RFSX
RFSX
To refresh the states of the
Input refresh
specified number of input relays.
@RFSX
RFSX

RFSY
RFSY
To refresh the states of the
Output refresh
specified number of output relays.
@RFSY
RFSY

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Υ


S n R F S Υ S n

Execution condition RFSΥ


S n @ R F S Υ S n

Operation Explanation Occupied size


D Specifies the start for refreshing the input state.*1 1 bit x n
S Specifies the start for refreshing the output state.*1 1 bit x n
Specifies the number of bits for refreshing the rising edge or input /
n 16 bits
output state. (1 to 256 bits)

*1 Only R or global variables / labels assigned to R can be specified.

Reference When only 1 point is refreshed ( n =1), DR (direct input / output relay) can be used
instead of the RFSX/RFSY instruction.

2-74 - KV-8000/7000/5000/3000/1000 Series/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, states of the number of input relays specified by

2
n starting from D will be refreshed.
@RFSX This instruction is executed for one scan at the rising edge of the execution condition.

Direct I/O Instructions


RFSY When the execution condition is ON, states of the number of output relays specified by
n starting from S will be refreshed.
@RFSY This instruction is executed for one scan at the rising edge of the execution condition.

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

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
On in the following cases; OFF in other cases.
• When range of n starting from D or S exceeds the upper limit of range of
devices
• When range of n starting from D or S exceeds the range of devices for direct
input/output in the same unit
CR2012
• When the indirect specification or index modification range is inappropriate
• (KV-8000/7500/7300/5500/5000/3000 only) When expansion units assigned in the range of
n starting from D or S do not support the RFSX/RFSY instruction
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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
output unit.

R1000 (Mnemonics list)


RFSY
R30000 #32 LD R1000
RFSY R30000 #32

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 2-75


Direct I/O Instructions
BASIC INSTRUCTIONS

MEMO

2
Direct I/O Instructions

2-76 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


3

APPLIED INSTRUCTIONS
APPLIED INSTRUCTIONS
These instructions are for work progress, program control, and extended
ladders.
These instructions allow you to structurally script basic ladders.

Shift Instructions................................................................. 3-2


Memory Switch Instruction ................................................ 3-4
Step Instructions ................................................................. 3-8
Stage Processing Instructions......................................... 3-12
Flow Instructions............................................................... 3-22
Macro Instructions ............................................................ 3-42
Function Block Instructions............................................. 3-46
Module Instructions .......................................................... 3-54
Index Register Instructions .............................................. 3-56
Indirect Specification Instructions .................................. 3-60
File Register Instructions ................................................. 3-68
Unit Program Instructions ................................................ 3-74
Buffer Memory Instructions ............................................. 3-86
Unit Type Judgment Instruction ...................................... 3-98

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-1


ift Instructions
FT Shift

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


SFT

SFT

SFT
D
Shift Operates the shift register
APPLIED INSTRUCTIONS

CLK
RES

Ladder program Input mode


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

3 Operation Explanation Occupied size


D1 Specifies the start bit.*1*2 1 bit × ( D2 - D1 +1)
Shift Instructions

D2 Specifies the end bit.*1*2 1 bit × ( D2 - D1 +1)


*1 CR/CM cannot be specified.
*2 When word data is specified, the LSB is shifted. Bits other than LSB do not change.Bit specifying
can not be used for word devices.
Bit specification of word data cannot be used.

Description of Operation
The data input ON/OFF state is read at the rising edge of the clock input.
That state is shifted from D1 to the bit specified by D2 in sync with the clock pulse.
When reset input is ON, all bits from D1 to D2 turn OFF.
Only bits within the range of D1 to D2 are shifted. Other bits are not shifted.
ON

Data input
OFF
ON

Clock input
OFF

ON
Reset input
OFF

ON

D1 D1
OFF

ON
D1 +1 D1 −1
OFF

ON
D1 +2 D1 −2
OFF
ON
D1 +3 D1 −3
OFF

ON
D2 −1 D2 +1
OFF
ON
D2 D2
OFF

Point • Duplicate use of D1 and D2 between 2 or more SFT instructions is not


allowed.
• This instruction cannot be used in interrupt programs or in the initialization
module.

3-2 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift 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 a timer/counter has been specified by indirect specification in D1 or D2
• When different types of targets are specified by indirect specification in D1 or D2
• When the indirect specification or index modification range is inappropriate
CR2012
• When an access outside the operand range occurs 3
It will not change when indirect specification or index modification is not specified, and the

Shift Instructions
access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program

■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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-3


emory Switch Instruction
MSW M e m o r y

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

MEMSW

MEMSW
MEMSW
Memory switch Operates the memory switch.
APPLIED INSTRUCTIONS

Ladder program Input mode


MEMSW n
M E M S W n S
S

Operation Explanation Occupied size


n Specifies the memory switch No. (0 to 2).*1 —
Sets the memory switch ($0000 to $FFFF).*2 —
3
S

*1 Only constants can be specified. Cannot be specified by "$". ("#" can be omitted)
*2 Only constants can be specified. Cannot be specified by "#".
Memory Switch Instruction

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

Reference For KV-8000/7500/7300/5500/5000/3000 series, it will be set in CPU system 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.

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 ─ ─
Clear current value (or CTH) and contacts (or CTC)
3 of counter and high-speed counter when powering Enable Disable
ON or PROG→RUN
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 ─ ─

3-4 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Memory Switch Instruction

APPLIED INSTRUCTIONS
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
3
Off-hold relay R10000 to R14915 series
Off-hold relay R15000 to R19915 series
Enable
Enable
Disable
Disable
3
0 Enable Disable

Memory Switch Instruction


Off-hold relay R20000 to R24915 series

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

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.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-5


Memory Switch Instruction
APPLIED INSTRUCTIONS

MEMSW2
MEMSW2
3210 3210 3210 3210
$0 0 0 3
0000 0000 0000 0000
SW1
SW2
SW3
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

3
2 Operation at fixed scanning time (unit selectable) 500μs 1ms
3 Reserved for system ─ ─
0 When power ON or PROG→RUN, EM0 to EM19999 clear Hold
Memory Switch Instruction

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-8000/7000/5000/3000/1000 Series/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 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 (Example)
SW2
SW3 0 2 6 9 (HEX)
SW4
(8) (4) (2) (1)
23 22 21 20 (HEX)
0 0 0 0 0
Off-hold relay
3
0 0 0 1 1

Memory Switch Instruction


R45000 to R49915 series.
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
Off-hold relay R25000 to R29915,
0 1 0 1 5
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
KVSTUDIO, "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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-7


ep Instructions
TP Step
TE Step end

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


STP,STE

STP STP Executes the instructions up to STE


Step
when the specified bit is ON.
APPLIED INSTRUCTIONS

This instruction is used in pairs with the


STE

STE
STP instruction, and indicates end of the
Step end
program to be executed by step
operation.

Ladder program Input mode


STP
S S T P S

3 Program A
STE
S T E
Step Instructions

Program B

Operation Explanation Occupied size


Specifies the execution condition for the program between the STP
S 1 bit
and STE instructions.* 1

*1 When word data is specified, the LSB is processed.


Bit specification of word data cannot be used.

Description of Operation
When S is ON, the program (program A) between the STP and STE instructions is executed.
When S is OFF, the program between the STP and STE instructions is not executed, and
execution jumps to the next program (program B) after the STE instruction.

Example When input R000 is ON, output R500 turns ON/OFF interlocked to input R001 ON/OFF.
When input R000 is OFF, output R500 does not turn ON even if input R001 is ON.
When R000 turns OFF with both R001 and R500 are ON, R500 holds ON even if
inputR001 turns OFF.
R000 R1000

STP
R1000
This program is
R001 R500
← not executed when
R1000 is OFF.
STE

Point • The instruction sequence between the STP and STE instructions that have not
been executed do not affect the scan time.
• Attention is required when programming differential execution type instructions,
timer or macro instructions between the STP and STE instructions.
"Precautions on the use of differential execution type instructions", page 1-40
"Macro Instructions", page 3-42
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.

3-8 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Step Instructions

APPLIED INSTRUCTIONS
About nesting structure
The STP and STE instructions can be programmed up to
STP
a nesting level of 16. R1000
In the program shown on the right, (1) (2) (3) are not
executed when R1000 is OFF, and execution starts from (4). ①
When R1000 and R1001 both are ON, the program is
STP
executed in order (1) (2) (3) (4).
3
R1001
When R1000 is ON and R1001 is OFF, the program is
1st 2nd
executed in order (1) (3) (4), and execution of (2) is level level ②

Step Instructions
skipped.
STE

STE

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* When CR2012 has turned ON, the program sequence between the STP and STE instructions is not
executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/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.
(Mnemonics list)
R000 R1000 R1000 R1001
DIFU SET LD R000
DIFU R1000
CON
STP AND R1000

3 T0
R1001 SET R1001
STP R1001
LD T0
R1001
RES R1001
Step Instructions

RES
LDB T0
OUT R500
T0 R500 LD R1001
TMR #0 #20
LD T0
R1001 #20 SET R1002
T0 STE
STP R1002
LD T1
T0 R1002 RES R1002
SET LDB T1
OUT R501
LD R1002
STE
TMR #1 #30
STE

STP
R1002

T1 R1002
RES

T1 R501

R1002 #30
T1

STE

3-10 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Step Instructions

APPLIED INSTRUCTIONS
MEMO

Step Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-11


age Processing Instructions
G Start stage
P Jump stage
DS End stage

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


STG,JMP,ENDS

STG STG Start stage Executes the instruction in the stage.


APPLIED INSTRUCTIONS

JMP
Turns the bit of the current executing stage OFF,
JMP Jump stage
and jumps to the specified stage.

ENDS ENDS End stage Turns the bit of the current executing stage OFF.

Ladder program Input mode


Execution condition D
SET

D D '

3 STG

D '
JMP S T G

J M P
D

D
STG ENDS
Stage Processing Instructions

E N D S

Operation Explanation Occupied size


D Specifies the stage No.*1 1 bit

*1 Only bit data can be specified.

Description of Operation
STG When D is ON, the |STG| will operate as ON contact.
When D is OFF, it will jump to the start of next block.
When D is turned from ON to OFF, the |STG| will operate as OFF contact.
• Be sure to start the STG instruction from the power rail.
• Duplicate programming of STG instruction operands is not allowed.
• The D of initial STG shall be set in differential condition.
• OR connection of STG instructions are not allowed.
• Multiple STG instructions cannot be configured in the same block.
• At least 1 JMP/ENDS instruction must be configured in the block identical with STG.
JMP When the previous status is ON, the stage relay operating currently will be reset and
D ' will be set.
• Please configure in the block configured with STG instruction.
ENDS When the previous state is ON, the currently executing stage ends.
• Please configure in the block configured with STG instruction.

"About contact circuit blocks and program circuit blocks", page 2-68

3-12 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Stage Processing Instructions

APPLIED INSTRUCTIONS
■STG instructions
"Stage instructions" are suited to successively processing (sequential processing) in keeping with
specific processes.
The entire program is divided up into smaller processes, and the program is executed one process at a
time.
Flow chart

Power ON

3
Ladder program
Start switch R1000
No
Start switch ON? ↑ SET

Stage Processing Instructions


Yes
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
STG JMP R500 ON, shift to STG R1002
when 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.
R003 R1003
Shift to STG R1003 when shift
JMP
condition R003 is ON
R1003 R502 R004
STG ENDS R502 ON, Stop when shift
condition R004 is ON.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-13


Stage Processing Instructions
APPLIED INSTRUCTIONS

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-40
"Macro Instructions", page 3-42

3 Refer to "Precautions when using timing instructions" in the User's Manual of


the CPU unit used.
• The STG instruction cannot be used in sub-routines.
Stage Processing Instructions

• When D of the STG instruction turns from ON to OFF, the coils in the same
block turns OFF and the states of the SHOT and OFDL instructions are held since
the STG instruction operates as an OFF contact.
• When the block is only programmed with JMP/ENDS instructions and without STG
instruction, the operation cannot be ensured due to uncertain relay reset by JMP/
ENDS.
• When a box script is used based on the STG instruction, it will always be executed
regardless of the state of the STG instruction.

Reference To turn all stage instructions OFF such as in an emergency stop, use the ZRES or SFT
instruction.
Reset input R1000 Leading relay of st
ZRES
R1004 End relay of stage

CR2003 SFT
D
R1000 Leading relay of st
CR2003
CLK
Reset input R1004 End relay of stage
RES

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

3-14 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Stage Processing Instructions

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

R1000 R501 R500 R001 R1001


STG JMP

R1001
STG
R500 R501 R002 R1002
JMP
3

Stage Processing Instructions


Interlock
Double coil
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.

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

R1001 R501 R001 R1002


STG SET JMP

When there is no JMP instruction


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 dueto
lack of control relays to be reset.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-15


Stage Processing Instructions
APPLIED INSTRUCTIONS

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) areheld
3 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
Stage Processing Instructions

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

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

R1000 R501 R002 R1002


STG JMP

3-16 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Stage Processing Instructions

APPLIED INSTRUCTIONS
Sample Program
Output relay R500 turns ON by the start switch of input relay R000.
Then, when R001 turns ON as a conditional branch, R501 turns ON for 1s. When R002 turns ON, R502
turns ON for 2s. When each of these processes ends, program execution returns to the conditional
branch, and execution is repeated.
(Mnemonics list)
R000 R1100 R1100 R1000

3
DIFU SET LD R000
DIFU R1100
R1000 CON
R500 R001 R1001
AND R1100
STG JMP

Stage Processing Instructions


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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-17


ON
OFF Wait OFF
Wait ON

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


W-ON,W-OFF

W-ON ON Wait ON Sets the No.2 operand with the No.1 operand ON.
APPLIED INSTRUCTIONS

W-OFF OFF Wait OFF Sets the No.2 operand with the No.1 operand OFF.

Ladder program Input mode


Execution condition S
ON W - O N S D
D (W O N S D )

Execution condition S

3 OFF W - O F F S D
(W O F F S D )
D
Operation Explanation Occupied size
Stage Processing Instructions

S Specifies the bit data whose ON/OFF state is to be detected.*1 1 bit


D Specifies the bit data to be set by the ON/OFF state of S .*1 1 bit

*1 When word data is specified, the LSB is processed. Bits other than LSB do not change.Bit
specifying can not be used for word devices.

Description of Operation
W-ON (1)When the execution condition is ON, D is set if S is ON.
(2) D holds ON until the execution condition turns OFF even if S turns OFF.
(3)When the execution condition turns OFF, D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(1) (2) (3) (4)' (5)'
ON
Execution condition S Execution
condition OFF
ON ON
D S
OFF
ON

D
OFF

W-OFF (1)When the execution condition is ON, D is set if S is OFF.


(2) D holds ON until the execution condition turns OFF even if S turns ON.
(3)When the execution condition turns OFF, D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(1) (2) (3) (1)' (3)'
ON
Execution condition S Execution condition
OFF
OFF ON
D S
OFF
ON

D
OFF

Point This instruction cannot be used in interrupt programs or in the initialization


module.

3-18 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Stage Processing 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 a timer/counter is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
3
CR2012
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.

Stage Processing Instructions


"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 turns ON 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-19


UE Wait rising
ge
DE W a i t
lling edge

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


W-UE,W-DE

W-UE
Sets the No.2 operand at the rising edge of the No.1
↑ Wait rising edge
operand.
APPLIED INSTRUCTIONS

W-DE
Sets the No.2 operand at the falling edge of the No.1
↓ Wait falling edge
operand.

Ladder program Input mode


Execution condition S W - U E S D
↑ W U E S D
D W U S D

Execution condition S W - D E S D

3 ↓
D
W D E
W D S
S
D
D

Operation Explanation Occupied size


Stage Processing Instructions

S Specifies the bit data whose rising edge or falling edge is detected.*1 1 bit
D Specifies the bit data to be set at the rising/falling edge of S .*1 1 bit

*1 When word data is specified, the LSB is processed. Bits other than LSB do not change.Bit
specifying can not be used for word devices.

Description of Operation
W-UE (1)When the execution condition is ON, D is set at the rising edge of S .
(2) D holds ON until the execution condition turns OFF even if S turns OFF.
(3)When the execution condition turns OFF, D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(4)When the execution condition is ON, D does not turn ON unless the rising edge is
detected even if S is ON.
(1) (2) (3) (4)
ON
Execution condition S Execution condition
OFF
↑ ON
D S
OFF
ON

D
OFF

W-DE (1)When the execution condition is ON, D is set at the falling edge of S .
(2) D holds ON until the execution condition turns OFF even if S turns ON.
(3)When the execution condition turns OFF, D turns OFF.
• Duplicate use of the No.2 operand D is not allowed.
(4)When the execution condition is ON, D does not turn ON unless the falling edge is
detected even if S is OFF.
(1) (2) (3) (4)
ON
Execution condition S Execution condition
↓ OFF
ON
D S
OFF
ON
D
OFF

Point • This instruction cannot be used in interrupt programs or in the initialization module.
• Attention should be paid when used in subroutines, among STP to STE instructions,
STG to JMP/ENDS instructions and CJ/NCJ/GOTO to LABEL instructions.
"Precautions on the use of differential execution type instructions", page 1-40

3-20 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Stage Processing 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 a timer/counter is specified in D by indirect specification
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
3
CR2012
It will not change when indirect specification or index modification is not specified, and the
access outside the operand range is not checked.

Stage Processing Instructions


"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When the input relay is ON, and the order in which input relays R001 to R003 turn ON is R001→R002
→R003, output relay R500 turns ON.

R000 R001 (Mnemonics list)


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

LD R1002
R1002 OUT R500

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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-21


ow Instructions
M a s t e r
ntrol
R M a s t e r

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano ntrol reset

MC,MCR

MC MC Indicates the start of the master control


Master control
range.
APPLIED INSTRUCTIONS

MCR MCR Indicates the end of the master control


Master control reset
range.

Ladder program Input mode


Execution condition MC
M C ( I L )

3
M C R ( I L C )

MCR
Flow Instructions

Description of Operation
Master routine is used to install contacts on the left power rail, and to switch between program blocks
through ON/OFF. The schematic diagram of the circuit is as follows.
Display ladder software Conceptual diagram

R000 MC MC

R000
R001
R001 R500 This part will be OF

when input relay


R002
R002 R501
R000 is OFF.
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-22 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
• When the MC instruction execution condition is OFF, the instructions between the MC to MCR
instructions are executed with the execution condition OFF.
The following instructions are exceptions.

Instrucition State
OUB OFF
OFDL instruction
Reset
SHOT instruction
C instruction/CTH instruction/HSP State held

3
instruction
CJ/NCJ/GOTO instructions No branch
MCALL instruction During execution of macros, instructions in the macro are executed only for one scan

Flow Instructions
MSTRT instruction with the execution condition OFF, and then execution stops at the next scan. This
instruction is not executed when the macro stops.

• KV-8000/7500/7300/5500/5000/3000, KV Nano Series During monitoring, the display content will be as follows
when the execution condition of MC instruction is OFF.

R000 MC

R001 R500

R002 R501

MCR

R003 R502

• Output relay R500 between the MC and MCR instructions and output relay R500 outside of the MC to
MCR instructions becomes a double coil as follows. For this reason, the output relay programmed
later is given priority.
R003 R500

R001 MC

R002 R500
←Preference
MCR

• Use the MC and MCR instructions in the following combinations: other MC to MCR instructions, STP
to STE instructions, STG to JMP/ENDS instructions, CJ/NCJ/GOTO to LABEL instructions, and FOR
to NEXT instructions.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-23


Flow Instructions
APPLIED INSTRUCTIONS

Example When combined with STP and STE instructions


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

MC

MCR

3 When programming the MC to MCR STP


instructions between the instructions XXXX
Flow Instructions

MC

MCR

STE

When programmed between the MC and MC


MCR instructions
STP
XXXX
STE

MCR

When programmed with other MC


MC to MCR instructions
MC
When programmed with other MC to MCR
instructions between the MC to MCR MCR

instructions (The MC to MCR instructions MCR


can be nested to a nesting level of 15.)

Other MC to MCR instructions are combined MC


before and after the instruction.
MCR

MC

MCR

Point These instructions cannot be used STP


XXXX
in the following applications.
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-24 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
Sample Program
When input relay R000 and internal auxiliary relay R1000 are both ON, output relay R500 turns ON/
OFF by R001 ON/OFF. (When R001 turns ON, R500 turns ON, and when R001 turns OFF, R500 turns
OFF.)
When either (or both) R000 and R1000 turn OFF, R500 stays OFF (does not turn ON) regardless of the
state of R001.

3
(Mnemonics list)
R000 R1000 MC
LD R000
AND R1000
MC

Flow Instructions
R001 R500
LD R001
OUT R500
MCR
MCR

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-25


CALL
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano Sub
CALL,SBN,RET

CALL
rou
CALL Sub-routine call Executes the specified sub-routine. tin
APPLIED INSTRUCTIONS

SBN SBN
Sub-routine entry Indicates the start of the sub-routine.
SBN
cal
l

RET RET
Sub-routine return Ends the sub-routine. Sub
-
rou
tin
Ladder program Input mode e
Execution condition n ent
CALL C A L L n ry

3
END

SBN
Flow Instructions

n S B N n

RET
R E T

ENDH

Operation Explanation Occupied size


n Specifies the sub-routine No. (0 to 99).*1 —

*1 Only constants and variables / labels set as constants can be specified.

Description of Operation
CALL When the execution condition is ON, the specified sub-routine in n will be executed
during each scan.
SBN Indicates the start of the sub-routine. Specify the sub-routine No. in n .
Duplicate entry of the sub-routine No. for the SBN instruction is not allowed. (Duplicate
entry of sub-routine Nos. by the CALL instruction is allowed.)
Programming these instructions between the END and ENDH instructions.
RET Indicates end of the sub-routine.

The sub-routine is executed if CALL 000 is executed Program A


Main routine

#0
during execution of the main routine program. CALL
When execution of the sub-routine ends, program Program B
END
execution returns to program (B) following the CALL 000
instruction, and the main routine program is executed SBN
#0
until the END instruction is programmed.
Subroutine

Subroutine
Program
RET

SBN
#1

3-26 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
Point • When a sub-routine is executed, the scan time increases by the sub-routine
execution time.
• The following instructions are not allowed in sub-routines:
INT, RETI, STG, JMP, ENDS, MEMSW
• Caution is required when using differential execution type instructions, timer
instructions, and macro instructions in sub-routines.
"Precautions on the use of differential execution type instructions", page 1-40
"Macro Instructions", page 3-42
Refer to "Precautions when using timing instructions" in the User's Manual of 3
the CPU unit used.

Flow Instructions
No execute the CALL instruction (input R000 = OFF)

Program A
R000 #0
CALL

Program B

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 subroutine, Program A


the sub-routine to be called must already be END
defined (programmed in the previous rung) for the
SBN
KV-5500/5000/3000/1000. #1

Subroutine
Program A
RET

SBN call
#0

Subroutine
Program B
R000 #1
CALL
RET

ENDH

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-27


Flow Instructions
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

3
• To call a sub-routine from inside an interrupt Program
program, the sub-routine to be called must already END
be defined (programmed in the previous rung) for
Flow Instructions

SBN
the KV-5500/5000/3000/1000. #1

Subroutine
Program
RET

INT call
R000

Interrupt
program
R002 #1
CALL
RETI

ENDH

Operation flag

CR2009 No change in state


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

3-28 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
MEMO

Flow Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-29


ALL subroutine call
dule between

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


ECALL

ECALL ECALL between module To execute subroutine


Sub-routine call ofspecified module.
APPLIED INSTRUCTIONS

Ladder program Input mode


Execution condition ECALL
S n E C A L L S n

Operation Explanation Occupied size


S Specifies the module name.*1 —
n Specifies the sub-routine No. (0 to 99) 16 bits

*1 Enter the module name directly (" " can be omitted). (" "can be omitted) Up to 24 half-width
3 alphanumerics, and12 full-width alphanumerics (24 for the KV-8000/7000 Series) can be
specified.
Flow Instructions

Reference Since module name list will be displayed at time of entering, you can simply make
selection to enter.

Description of Operation
ECALL When the execution condition is ON, the sub-routine specified in n of the module
specified in S will be executed. All types of modules (Fixed cycle, Initialization, Every
scan, Standby, Inter-unit synchronization, etc.) can be specified for S , but macros
cannot be specified.

Reference • When subroutine of the self-module, CALL instruction can also be used.
• When a local device / variable is used in the subroutine called by the ECALL instruction,
the program will be executed with the local device / variable of the module on the called
side instead of the calling side.
• For other Description of Operation, please read CALL instruction.
"CALL instruction" (page 3-26)

Point • When a sub-routine is executed, the scan time increases by the sub-routine
execution time.
• The following instructions are not allowed in sub-routines:
INT, RETI, STG, JMP, ENDS, MEMSW
• Caution is required when using differential execution type instructions, timer
instructions, and macro instructions in sub-routines.
"Precautions on the use of differential execution type instructions", page 1-40
"Macro Instructions", page 3-42
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.

3-30 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
On in the following cases; OFF in other cases.
• When the subroutine specified by n is not in the module specified by S
CR2012
• When an access outside the operand range occurs

3
"Out-of-range access of operands", page 1-50

* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to


CM5176.

Flow Instructions
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Execute sub-routine of "Module 1" when R000 is ON.

R000 ECALL (Mnemonics list)


モジュール1”
“Module 1” #1 LD R000
ECALL "Module1" #1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-31


R FOR
XT NEXT
EAK Break
R?NEXT

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


FOR,NEXT,BREAK

Repeatedly executes the instruction


FOR(.U)
FOR FOR sequence between the FOR and NEXT
FOR
APPLIED INSTRUCTIONS

FOR.D
instructions for the specified number of
times in a single scan.

NEXT
NEXT
NEXT Indicates the end of the repeat range.

BREAK
BREAK Ends execution of the FOR to NEXT
Break
instructions forcedly.

Ladder program Input mode

3
FOR
S F O R S

Loop program
Flow Instructions

Execution condition BREAK


B R E A K
NEXT
N E X T

Operation Explanation Occupied size


Specifies the number of loops that the program inside the FOR to
NEXT instructions is repeated. .U 16 bits
S
FOR (.U) can be specified within the range 0 to 65535, and .D 32 bits
FOR.D can be specified within the range 0 to4294967295.

Description of Operation
FOR(.U) • The program between the FOR and NEXT instructions is executed repeatedly within 1
scan for the number of loops specified by S .
• The FOR instruction is executed forcedly. To disable execution, specify "0" to S .
FOR.D • The program between the FOR and NEXT instructions is executed repeatedly within 1
scan for the number of loops specified by [ S / S +1].
• The FOR instruction is executed forcedly. To disable execution of programs between
the FOR and NEXT instructions, specify "0" to [ S / S +1].
NEXT • Execution of this instruction is started from the instruction in the step following the
NEXT instruction after the program is executed for the specified number of times.
BREAK • This instruction is used for forcibly ending repeated execution between the FOR and
NEXT instructions when the execution condition is ON.
• Be sure to program the BREAK instruction between the FOR and NEXT instructions.
• Up to 16 BREAK instructions can be used between a single FOR to NEXT instruction
program section. If the FOR to NEXT instructions are nested, up to 16 BREAK
instructions can be used in the entire nested structure.

3-32 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

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

1 nested
3 nested

Flow Instructions

NEXT

NEXT

NEXT

• "Nest 1" is executed for 5 times, and jumps to program (4).


For this reason, program (1) is executed 5 times.
• While "Nest 1" is executed once, "Nest 2" is executed 4 times.
This means that program (2) is executed a total of (5 x 4=) 20 times.
• While "Nest 2" is executed once, "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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified, and the access
outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* When CR2012 has turned ON, the program sequence between the FOR and NEXT instructions is
not executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-33


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

3
DM0 TM10 LD CR2002
ADRSET DM0 TM10
#0 DM100 #0 DM101 LDA #0
LDA STA LDA STA CON
Flow Instructions

STA DM100
FOR CON
#100 LDA #0
CON
CR2002 STA DM101
*TM10 DM100 DM100 DM101
FOR #100
LDA ADD STA INC
LD CR2002
MPS
ADRINC LDA #TM10
TM10
CON
ADD DM100
DM100 BREAK CON
>= STA DM100
#1000
CON
NEXT INC DM101
MPP
ADRINC TM10
LD>= DM100 #1000
BREAK
NEXT

For details on indirect specification, refer to "Indirect Specification" in the User's Manual of the CPU unit
used.

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-34 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
MEMO

Flow Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-35


anch Conditional
J
anch Conditional
TO
conditional
BEL branch Label

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


CJ,NCJ,GOTO,LABEL

CJ CJ
APPLIED INSTRUCTIONS

Conditional branch Performs a jump to the LABEL instruction.

NCJ NCJ

GOTO GOTO Unconditional Performs a jump unconditionally to the


branch LABEL instruction.

LABEL LABEL Sets the jump destination of the CJ or


Label
GOTO instructions.

Ladder program Input mode

3 Execution condition CJ
n C J n
Flow Instructions

Execution condition NCJ


n N C J n

GOTO
n G O T O n

LABEL
n L A B E L n

Operation Explanation Occupied size


n Specifies the label No. (0 to 999)*1 —

*1 Only constants and variables / labels set as constants can be specified.

Description of Operation
CJ When the execution condition is ON, program execution jumps to the line with the LABEL
instruction specified by n .
NCJ When the execution condition is OFF, program execution jumps to the line with the LABEL
instruction specified by n .
GOTO Program execution jumps unconditionally to the line with the LABEL instruction specified
by n .
LABEL Specifies the jump destination of the CJ, NCJ or GOTO instructions.

Scan

ON

Execution condition
OFF

CJ Execute Execute

NCJ Execute Execute

3-36 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
Example When the execution condition is ON, program execution jumps to LABEL instruction
#010specified by the CJ instruction, the program jumps to (1), (2), and the program is
executed.
When the execution condition is OFF, program execution jumps to LABEL
instruction#020specified by the GOTO instruction, and program (2) is executed.
Flowchart
Execution condition CJ
#10

3
OFF
Execution condition
GOTO
#20 ON

Flow Instructions
LABEL LABEL #10
#10

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-40
"Macro Instructions", page 3-42
Refer to "Precautions when using timing instructions" in the User's Manual of
the CPU unit used.
• 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-37
Flow 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
3 When input relay R000 turns ON, output relay R500 automatically turns ON for 2s, and then R501 turns
Flow Instructions

ON for 3s.
(Mnemonics list)
R000 R1000 R1000 R1001
DIFU SET LD R000
DIFU R1000
CON
R1001 T0 R500
AND R1000
SET R1001
LD R1001
R1001 #20 ANB T0
T0 OUT R500
LD R1001
TMR #0 #20
T0 CJ LD T0
#1 CJ #1
GOTO #2
GOTO LABEL #1
#2 LDB T1
OUT R501
LD R1001
LABEL TMR #1 #30
#1 LD T1
RES R1001
T1 R501 LABEL #2

R1001 #30
T1

T1 R1001
RES

LABEL
#2

3-38 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

APPLIED INSTRUCTIONS
MEMO

Flow Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-39


J Conditional
anch

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


SCJ

SCJ
SCJ Performs a jump to the LABEL instruction.
Conditional branch
(With 1 scan ON delay)
APPLIED INSTRUCTIONS

Ladder program Input mode


Execution condition SCJ
n S C J n

Operation Explanation Occupied size


n Specifies the label No. (0 to 999)*1 —

*1 Only constants and variables / labels set as constants can be specified.

3 Description of Operation
Flow Instructions

SCJ When the execution condition is switched from OFF to ON, it will be transferred to the line
with the LABEL instruction specified by n during ON period from the next scan.
Scan

ON
Execution
OFF
condition 1 scan 1 scan
ON
SCJ Execution
condition OFF

Reference Please read CJ instruction for other Description of Operation.


"CJ instruction" (page 3-36)

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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

3-40 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Flow Instructions

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 MR000 (Mnemonics list)


↑ LDP R000
OR MR000
MR000 OUT MR000
LD MR000

MR000 #20
TMR #0 #20
LD T0
SCJ #1
3
T0
LDB T0

Flow Instructions
T0 OUT R500
SCJ
LABEL #1
#1

T0 R500

LABEL
#1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-41


acro Instructions
ALL Macro call
TRT Macro start
ND Macro end

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


MCALL,MSTRT,MEND

Executes the specified


MCALL MCALL
Macro call subroutine macro.
APPLIED INSTRUCTIONS

(Programming with in module)


Executes the specified self
MSTRT MSTRT
Macro start hold macro. (Programming
with in module)
Stops execution of the self
MEND MEND
Macro end hold macro. (Programming
with in self-hold macro)

Ladder program Input mode

3 Execution condition MCALL


Based on macro to be executed*1 M C A L L S〔
*1*2
Argument1 Argument2
…〕
Macro Instructions

Execution condition MSTRT *1*2


Based on macro to be executed*1*2 M S T R T S〔 Argument1 Argument2
…〕

Execution condition MEND


M E N D

Operation Explanation Occupied size


S Specifies the subroutine No.*3*4 —

*1 The number of operands other than the macro name and the data that can be specified differ as
follows depending on the argument settings set in the macro to be executed.
•P : Devices, variables and labels can be specified. Constants cannot be specified.
•V : Devices, variables, labels and constants can be specified.
• Unit : Only constants can be specified.
*2 Handling of T, C, TIMER type variables and COUNTER type variables differs depending on the
instruction used in the macro.
Example) For the MOV instruction, the current value is handled. For details, refer to the operation
description of the respective instruction.
*3 "", # and $ cannot be used. Directly enter the name of the macro set in KV STUDIO.
Up to 12 half-width alphanumerics and 6 full-width alphanumerics can be specified.
However, up to 12 full-width alphanumerics can also be specified in the KV-8000/7000 series.
*4 When an ID No. is used, the format becomes "(macro name)_(ID No.)". Example) Batch
transmit_2
For details on ID No., see the User's Manual of the CPU unit used.

3-42 - KV-8000/7000/5000/3000/1000 Series/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 is executed at every scan when the
execution condition is ON.
Execution of the specified macro is started from scans where the execution condition
3

Macro Instructions
changes from OFF to ON.
Once execution is started, the macro continues to be executed even if the execution
condition is OFF.

MEND Self-hold type macros with a MEND instruction written to them stop when the execution
condition is ON.

The OFF process when stopped differs according to the CPU unit. Refer to the instruction manual for
each CPU unit for details.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-43


Macro Instructions
APPLIED INSTRUCTIONS

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.

3 • 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)
Macro Instructions

• When T/C/CTH has been specified to an operand whose MCALL/MSTRT instruction


attribute is a value, the following values are handed over to the macro:
T/C : Current value (32-bit data)
CTH : Current value (32-bit data)
CTC : Setting value (32-bit data)
• In the following cases the macro being executed stops when each module stops or
when the execution condition for each set of instructions turns OFF.
• When an MCALL/MSTRT instruction is written to the module
• When an MCALL/MSTRT instruction is written to master control (in the MC –
MCR instructions)
• When an MCALL instruction is written to stage (in the STG - JMP instructions)
• In the following cases the macro being executed is canceled when the execution
condition for each set of instructions turns OFF.
The macro execution resumes when each set of instructions is executed.
The previous state of differential execution type instructions in macros is not
initialized at this time.
(If it is written in the initialization module only, 1 scan is executed when operation
starts.)
• When an MCALL/MSTRT instruction is written to sub-routine (in the SBN –
RET instructions)
• When an MCALL/MSTRT instruction is written to conditional branch (in the
CJ/NCJ - LABEL 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 /
global variables used in OUT/OUB instruction in a macro will become double coil.
Refer to "Macro" in the User's Manual of the CPU unit used.

3-44 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Macro Instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 The state depends on the processing result in the macro to execute.
CR2010 The state depends on the processing result in the macro to execute.
CR2011 The state depends on the processing result in the macro to execute.
ON when the indirect specification or index modification range is inappropriate, the unit specified
by UR/UV/UM while using the KV-8000/7000 series is not connected, or an access outside the
operand range occurs. Otherwise it is OFF.
CR2012
It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked. 3
"Out-of-range access of operands", page 1-50

Macro Instructions
* The macro is not executed when the argument is inappropriate.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Point The state of the operation flag does not change by the MEND instruction.

Sample Program
The sub-routine macro (macro A) is executed with EM0 as argument 1 and #10 as argument 2 when
input relay R000 is ON.

R000 MCALL マクロ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.

R001 MSTRT マクロB (Mnemonics list)


↑ #1 #10 LDP R001
MSTRT Macro B #1 #10

When input relay R002 is ON, execution of self-hold macro "Macro B" is stopped.
・・・・

マクロB
(Mnemonics list)

R002 MEND LD R002


MEND
・・・・

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-45


ction Block Instructions
Func tion
k call
Func tion
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano k end
Function call

FB,FEND,FUN

FB
Function block
Calls the specified function block.
call
APPLIED INSTRUCTIONS

FEND FEND Function block Stops execution of the function block.


end (Written in the function block)

FUN Function call Calls the specified function.

Ladder program Input mode


Execution condition S *1*2

3 〔 …〕
F B S Argument 1 Argument 2
Input1 Output1
InOut1 InOut1
UnitNo
Function Block Instructions

Execution condition FEND


F E N D

Execution condition S *1*2

Input1 Output1
F U N 〔
S Argument 1 Argument 2 …〕
InOut1 InOut1
UnitNo

Operation Explanation Occupied size


S Specifies the function block/function name.*3 —

*1 The number of operands other than the function block / function name and the data that can be specified
differ as follows depending on the argument settings set in the function block / function to be executed.
• IN : Devices, variables, labels and constants can be specified.
• OUT : Devices, variables and labels can be specified. Constants cannot be specified.
• IN-OUT : Devices, variables and labels can be specified. Constants cannot be specified.
• Unit : Devices, variables, labels and constants can be specified.
*2 Handling of T, C, TIMER type variables and COUNTER type variables specified for the IN-OUT
argument differs depending on the instruction used in the function block / function.
Example) For the MOV instruction, the current value is handled. For details, refer to the operation
description of the respective instruction.
*3 "", # and $ cannot be used. Directly enter the name of the function block/function set in KV
STUDIO. Up to 64 characters can be entered regardless of full-width or half-width.

Point The FB instruction, FEND instruction and FUN instruction can be used with the KV-8000
series CPU units and KV-7000 Series CPU units with CPU function version 2.0 or later.
"KV-8000 CPU Function Version", page 2
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
FB The function block specified by S starts up when the execution condition is ON.
Execution of the specified function block is started from the scan where the execution
condition changes from OFF to ON.
Once execution starts, the function block continues to be executed even if the execution
condition is OFF.

FEND Function blocks with a FEND instruction written to them stop when the execution
condition is ON.
FUN The function specified by S is executed when the execution condition is ON.

3-46 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Function Block Instructions

APPLIED INSTRUCTIONS
The OFF process when stopped differs according to the program settings. Refer to the instruction
manual for the CPU unit for details.

Point • Writing in RUN mode is not possible if the number or sequence of calls of the FB
instruction is changed.
• Function block stops in the following cases.
• When the read source program stops
• When a FEND instruction is executed in a function block
• If the FBCALL/FBSTRT/FB instruction execution condition stays ON, the FEND
instruction is ignored.
• The FEND instruction cannot be written in the module or function. 3
• The FEND instruction cannot be used to stop other function blocks.

Function Block Instructions


• 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 FBCALL/FBSTRT/FB/FUN instruction is written to a module/function block
• When an FBCALL/FBSTRT/FB/FUN instruction is written to master control
(between the MC~MCR instructions)
• When an FUN instruction is written to stage (in the STG - JMP instructions)

• In the following cases the function block/function being executed is canceled when FBSTRT
the execution condition for each set of instructions turns OFF. The function block
execution resumes when each set of instructions is executed. The previous state of
differential execution type instructions in function blocks is not initialized at this
time. (If it is written in the initialization module only, 1 scan is executed when
operation starts.)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to sub-routine
(between the SBN~RET instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to conditional branch
(between the CJ/NCJ~LABEL instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to step (between the
STP~STE instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to interrupt (between
the INT~RETI instructions)
• When an FBCALL/FBSTRT/FB instruction is written to stage (between the
STG~JMP instructions)
• FB instructions cannot be used in functions.
• FB/FUN instructions cannot be used in macros.
• FBCALL/FBSTRT/FB/FUN instructions that call the function block/function itself
cannot be used in that function block/function.
• Sub-routine programs can be used in function blocks/functions, but interrupt
program scan not be used.
• When performing a certain function block/function multiple times in a project, the
global devices / global variables / global labels used for the OUT/OUB instruction in a
function block/function will become double coil.
"KV-7000 Series User's Manual"
"KV-8000 Series User's Manual"

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-47


Function Block Instructions
APPLIED INSTRUCTIONS

Operation flag

CR2009 The state depends on the processing result in the function block/function to execute.
CR2010 The state depends on the processing result in the function block/function to execute.
CR2011 The state depends on the processing result in the function block/function to execute.
ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the unit specified in the "Unit" argument type is not connected
• When the unit specified in the "Unit" argument type and the unit specified in the argument
3
CR2012
settings differ
• When an access outside the operand range occurs
Function Block Instructions

"Out-of-range access of operands", page 1-50

* If the argument is inappropriate, the function block/function will not be executed.


KV-8000/7500/7300 When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List", page A-43

Point The state of the operation flag cannot be changed by the FEND instruction.

Sample Program
Function block "Function block A" execution starts with variable 1 (unit number) as #1 and variable 2 as
DM0 at the rising edge of input relay R000.

R000 Function block A


(Mnemonics list)
↑ 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
・・・・

(Mnemonics list)

R001 FEND LD R001


FEND
・・・・

Function "Function B" is executed with variable 1 as EM0 and variable 2 as MR000 when input relay
R002 is on.

R002 Function B
(Mnemonics list)

EM0 Input1 Output1 MR000 LD R002


FUN Function B EM0 MR000

3-48 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Function Block Instructions

APPLIED INSTRUCTIONS
MEMO

Function Block Instructions


FBSTRT

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-49


tion BlockInstructions
LL Func tion
k call
RT Func tion
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano k start

FBCALL,FBSTRTL

FBCALL
Function block
Calls the specified function block.
call
APPLIED INSTRUCTIONS

FBSTRT
Function block
Calls the specified function block.
start

Ladder program Input mode


S2
Execution condition S1 ※1

EN
Input1
EN0
InOut1
F B C A L L S1 S2 〔 Argument 1 Argument 2
…〕
InOut1 Output1
UnitNo

3 Execution condition
S2
S1 ※1

EN EN0 F B S T R T S1 S2 〔 Argument 1 Argument 2


…〕
Function Block Instructions

Input1 InOut1
InOut1 Output1
UnitNo

Operation Explanation Occupied size


S1 Specifies the function block name.*2 —
S2 Specifies the instance name.*2 —

*1 The number (0 to 64) and attributes of arguments from the No.3 operand onwards differ
depending on the argument settings set to the function block to be executed.
*2 Only constants can be specified. Directly enter the function block name (Up to 64 characters
regardless of half-width or full-width) or instance name (Up to 128 characters regardless of half-
width or full-width).

Point The FBCALL instruction and FBSTRT instruction can be used with KV-8000 series
CPU units with CPU function version 2.0 or later.
"KV-8000 CPU Function Version", page 2

Description of Operation
FBCALL When the execution condition is ON, the instances of the function blocks specified by
S1 and S2 are executed by the arguments specified by the third and subsequent
operands.
Execution of the specified function block is started from the scan where the execution
condition changes from OFF to ON.
Once started, the execution of the function block continues while the execution condition
is ON.
When the execution condition turns OFF, the execution of the function block stops.

FBSTRT When the execution condition is ON, the instances of the function blocks specified by
S1 and S2 are executed by the arguments specified by the third and subsequent
operands.
Execution of the specified function block is started from the scan where the execution
condition changes from OFF to ON.
Once execution starts, the function block continues to be executed even if the execution
condition is OFF.
When the function block is stopped, the FEND instruction is executed in the function block.

3-50 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Function Block Instructions

APPLIED INSTRUCTIONS
The OFF process when stopped differs according to the program settings. For details, refer to the CPU
Unit User's Manual.

Point • Functions cannot be specified with the FBCALL/FBSTRT/FB instructions. The


FUN instruction should be used to execute a function.
• Writing during RUN cannot be performed when any of the following conditions is met.
• When an instance (variable) is added or deleted
• When the argument settings of the function block are changed
• Function block stops in the following cases.
• When the call source program stops
• When an FEND instruction is executed in a function block (when called 3
with the FBSTRT instruction)

Function Block Instructions


• When the execution condition of the FBCALL instruction is turned OFF
(when called with the FBSTRT/FB instruction)
• If the FBCALL/FBSTRT/FB instruction execution condition stays ON, the FEND
instruction is ignored.
• 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)
• In the following cases, the function block being executed stops when each
module/function block stops or when the execution condition for each set of
instructions turns OFF.
• When an FBCALL/FBSTRT/FB instruction is written to a module/function block
• When an FBCALL/FBSTRT/FB instruction is written to master control
FUN
(between the MC~MCR instructions)

• In the following cases, the function block being executed is canceled when the
execution condition for each set of instructions turns OFF. The function block
execution resumes when each set of instructions is executed. The previous state
of differential execution type instructions in function blocks is not initialized at
this time. (If it is written in the initialization module only, 1 scan is executed when
operation starts.)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to sub-routine
(between the SBN~RET instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to conditional
branch (between the CJ/NCJ~LABEL instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to step (between
the STP~STE instructions)
• When an FBCALL/FBSTRT/FB/FUN instruction is written to interrupt
(between the INT~RETI instructions)
• When an FBCALL/FBSTRT/FB instruction is written to stage (between the
STG~JMP instructions)
• FBCALL/FBSTRT/FB instructions cannot be used in functions.
• FBCALL/FBSTRT/FB/FUN instructions cannot be used in macros.
• FBCALL/FBSTRT/FB/FUN instructions that call the function block itself cannot
be used in that function block.
• Sub-routines can be used in function blocks, but interrupt programs cannot be
used.
• When performing a certain function block multiple times in a project, the global
devices / global variables / global labels used for the OUT/OUB instruction in a
function block will become double coil.
"KV-8000 Series User's Manual"

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-51


Function Block Instructions
APPLIED INSTRUCTIONS

Operation flag

CR2009 The state depends on the processing result in the function block to execute.
CR2010 The state depends on the processing result in the function block to execute.
CR2011 The state depends on the processing result in the function block to execute.
ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the unit specified in the "Unit" argument type is not connected
• When the unit specified in the "Unit" argument type and the unit specified in the argument
3
CR2012
settings differ
• When an access outside the operand range occurs
Function Block Instructions

"Out-of-range access of operands", page 1-50

* If the argument is inappropriate, the function block will not be executed.


KV-8000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List", page A-43

Point The state of the operation flag cannot be changed by the FEND instruction.

Sample Program
The instance named "Instance A" of the function block "Function Block A" is executed with argument
1(unit number) as #1 and argument 2 as DM0 at the rising edge of input relay R000.

Instance A (Mnemonics list)


R000 Function Block Instructions A
LDP R000
↑ EN EN0 FBSTRT Function Block A Instance A #1 DM0
#1 Input1 Output1 DM0

"Instance A" of "Function Block A" stops when input relay R001 is ON.
(Mnemonics list)

R001 FEND LD R001


FEND

The instance named "Instance B" of the function block "Function Block B" is executed with argument 1
as EM0 and argument 2 as MR000 when input relay R002 is ON. Execution stops when input relay
R002 turns OFF.

Instance B (Mnemonics list)


R002 Function Block B LD R002
EN EN0 FBCALL Function Block B Instance B EM0 MR000
EM0 Input1 Output1 MR000

3-52 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Function Block Instructions

APPLIED INSTRUCTIONS
MEMO

Function Block Instructions


FUN

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-53


odule Instructions
STRT M o d u l e
ecution start
STOP M o d u l e

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano ecution stop

MDSTRT,MDSTOP

MDSTRT
MDSTRT Starts execution of the
Module execution start
specified module.
APPLIED INSTRUCTIONS

MDSTOP
MDSTOP Stops execution of the
Module execution stop
specified module.

Ladder program Input mode


Execution condition MDSTRT
S M D S T R T S

Execution condition MDSTOP


S M D S T O P S

3 Operation Explanation Occupied size


S Specifies the module name.*1 —
Module Instructions

*1 Use of " ", # , $ is not allowed. Directly enter the name of the module set on KV STUDIO.
The number of characters that can be entered is as follows.
• KV-8000、KV-7000 (CPU function version 2.0 or later)
Up to 64 characters regardless of half-width or full-width
• KV-7000 (CPU function version lower than 2.0)
Up to 24 characters regardless of half-width or full-width
• KV-5500/5000/3000/1000, KV Nano Series
Up to 24 half-width alphanumerics, or up to 12 full-width alphanumerics

Description of Operation
MDSTRT When the execution condition is ON, the module specified by S is started.
The specified module starts operating from the next scan.
Nothing happens on modules that are already started up.
MDSTOP When the execution condition is ON, the module specified by S is started.
Nothing happens on modules that are already stopped.
This instruction can also stop the self-module.
The OFF process when stopped differs according to the CPU unit. Refer to the instruction manual for
each CPU unit for details.

Point • The initial state of differential execution type instructions at start of module execution is
ON when the rising edge is detected, and OFF when the falling edge is detected.
Differentiation is never detected immediately when execution is started.
• When the MDSTRT and MDSTOP instructions have been executed multiple times in
the same scan on the same module, execution follows the module instruction that was
last executed.
• Do not stop all modules. All programs will not be executed when all modules have
stopped. So, restore this state by one of the following methods. (Execution cannot be
restored unless program execution is temporarily stopped.)
◆ Turn the CPU unit OFF then back ON again.

◆ Switch the RUN-PROG selector switch on the CPU unit to PROG then back

to RUN again.
◆ Turn the RUN mode of the program OFF then back ON again in KV STUDIO.

• Execution of the initialization module cannot be started or stopped.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
CR2012 No change in state
3-54 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Module Instructions

APPLIED INSTRUCTIONS
Sample Program
When the rising edge of input relay R000 is detected, the module currently selected by mode switching
(R001 to R003) is executed, and execution of all modules is stopped when input relay R009 turns ON.
During execution of one of the modules, execution of other modules cannot be started.

R000 _Module1 _Module2 _Module3 R001 MDSTRT (Mnemonics list)


↑ Module1 ① LDP R000
ANB _Module1
Execute module when ON*1 R002 MDSTRT
Module2 ②
ANB _Module2
ANB _Module3
MPS
3
AND R001

Module Instructions
R003 MDSTRT MDSTRT Module1
Module3 ③ MRD
AND R002
R009 MDSTOP MDSTRT Module2
Module1 MPP
AND R003
④ MDSTRT Module3
MDSTOP LD R009
Module2 MDSTOP Module1
MDSTOP Module2
MDSTOP MDSTOP Module3
Module3

(1) "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 "Modules" in the User's Manual of the CPU unit
used.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-55


dex Register Instructions
USH I n d e x
gister batch purge
OP I n d e x

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano gister batch restore

ZPUSH,ZPOP

ZPUSH.S
ZPUSH ZPUSH.L
ZPUSH
APPLIED INSTRUCTIONS

Index Purges the value of the


register batch index register to the
@ZPUSH.S purge specified data block.
@ZPUSH @ZPUSH.L
ZPUSH

ZPOP.S
ZPOP ZPOP.L
ZPOP
Index Reads the value of the
register batch index register from the
@ZPOP.S restore specified data block.

3 @ZPOP @ZPOP.L
ZPOP
Index Register Instructions

Ladder program Input mode


Execution condition ZPUSH
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

Operation Explanation Occupied size


Specifies the start of the purge destination data .S 16 bits × (number of purges × 12 + 1)
D
block.*1 .L 16 bits × (number of purges × 24 + 1)

*1 Only word data can be specified.

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 Reserved
for system for system D +11
Reserved Reserved
for system for system D +12

Point No suffix for KV-1000 .

3-56 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Index Register Instructions

APPLIED INSTRUCTIONS
ZPUSH.L When the execution condition is ON, the values of the Z1 to Z10 index registers are stored
to the data block specified by D . After the instruction is executed, the value of
[ D +0] is incremented by 1.
bit bit bit bit
31 16 15 0

bit
31
bit bit
16 15
bit
0
Purge times D +0

Z1 Z1 D +2 D +1

Z2 Z2 D +4 D +3


Z10 Z10 D +20 D +19 3
Reserved for system Reserved for system D +22 D +21

Index Register Instructions


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


Reserved Reserved
D +11 for system for system

Reserved Reserved
D +12 for system 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
"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 .

@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).

Reference • The ZPUSH and ZPOP instructions are programmed nested. When nesting these
instructions, specify the same start.
• KV-8000/7500/7300/5500/5000/3000, KV Nano Series It will become .L when inputting without suffix
specifying.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-57
Index Register Instructions
APPLIED INSTRUCTIONS

• For .L
bit bit bit bit
31 16 15 0
ZPUSH
DM0 3 DM0

Z1 DM1・DM2
ZPUSH
DM0

ZPUSH Reserved for system DM23・DM24


DM0
Z1 DM25・DM26
ZPOP

3 DM0

ZPOP
Reserved for system DM47・DM48

DM0 Z1 DM49・DM50
Index Register Instructions

ZPOP
DM0 Reserved for system DM71・DM72

• For (.S)
bit bit
15 0
ZPUSH
DM0 3 DM0

Z1 DM1
ZPUSH
DM0


Reserved for
ZPUSH system DM12
DM0
Z1 DM13
ZPOP

DM0 …
Reserved for
system DM24
ZPOP
DM0 Z1 DM25

ZPOP
Reserved for
DM0 system DM36

Point • [ D +0] should be set to "0" before executing the first ZPUSH instruction. This
is not necessary from the second ZPUSH instruction onwards.
• The ZPUSH and ZPOP instructions are used in pairs.
• Do not write to the range of D occupied by the ZPUSH instruction with other
instructions.

Operation flag

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) = 0 (ZPOP only)
• When the data block range exceeds the device / work area range.
CR2012 • When relays/timers/counters have been specified by indirect specification.
• When the indirect specification and index modify range is inappropriate.
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

3-58 - KV-8000/7000/5000/3000/1000 Series/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
+02000
DW.S
Sets the values of index registers
Z1 and Z2 to
3
Z1 Z2

Index Register Instructions


#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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-59


direct Specification Instructions
RSET Gets the
dress of the target to be indirectly
ecified

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


ADRSET

ADRSET ADRSET
Stores the address of the
APPLIED INSTRUCTIONS

Set address
target to be indirectly specified
@ADRSET ADRSET

Ladder program Input mode


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 Operation Explanation Occupied size


S Specifies the target to be indirectly specified.*1 *3
Indirect Specification Instructions

Specifies the storage location for the address specified 32 bits


D
by S .*2*4

*1 CR/CM cannot be specified.


*2 Only word data can be specified.
*3 The data size of the specified devices, variables or labels is occupied.
*4 CM cannot be specified.

Description of Operation
ADRSET When the execution condition is ON, the address of S is stored in [ D / D +1]
since indirect specification of S is performed. (The value to store is not the value of
S )
When "* D " is specified to the operand by an instruction (MOV, INC, ADD) that can be
indirectly specified after the ADRSET instruction, this means that S has been specified.
The "address" of S and not the value of
D +1 D
S is stored to [ D ・ D +1]
S Sのアドレス
Address of ※
S*

* 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


S D is stored to[ D ・ D +1]

MOV #12345 is stored to the addr


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

Operation cannot be assured when the following operation is not followed. (Some device /
variable values may be corrupted to prevent ladders from operating normally).
• Before using * D , be sure to set the address to D by the ADRSET instruction.
NOTICE • Never generate or manipulate addresses by any means other than the ADRSET,
ADRINC, ADRADD, ADRDEC, and ADRSUB instructions.
• However, execution is possible when the address is copied (the contents of the address
do not change) with the MOV instruction, etc.

Point When an element number or member is specified in an array variable or structure


type variable, a conversion error will occur.
3-60 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Indirect Specification Instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50 3
* The instruction is not executed when CR2012 turns ON.

Indirect Specification Instructions


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, store the value of DM0 in DM100.
(Mnemonics list)
R000 ADRSET
DM0 DM500 ① LD R000
ADRSET DM0 DM500
MOV *DM500 DM100
MOV
*DM500 DM100 ②

(1) Store the value of DM0 in [DM500/DM501].


(2) The reference destination (i.e. value of DM0) of the address currently stored in [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 ① LD R000
ADRSET DM0 DM500
MOV #12345 *DM500
MOV MOV.S +5 Z1
#12345 *DM500 ② MOV #56789 *DM500:Z1

MOV.S
+5 Z1 ③

MOV
#56789 *DM500 : Z1 ④

(1) Store the value of DM0 in [DM500/DM501].


(2) #12345 is stored to the reference destination (i.e. DM0) of the address currently stored in [DM500/
DM501].
(3) +5 is stored to index register Z1.
(4) #56789 is stored to DM5 obtained by adding Z1 (+5) to the reference destination (i.e. DM0) of the
address currently stored in [DM500/DM501].

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-61


RINC Increment
dress
RDEC Decrement
dress

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


ADRINC,ADRDEC

ADRINC ADRINC

Increment address
Address incremented by
APPLIED INSTRUCTIONS

1.
@ADRINC ADRINC

ADRDEC ADRDEC

Decrement address
Address decremented by
1.
@ADRDEC ADRDEC

Ladder program Input mode

3 Execution condition ADRINC


D A D R I N C D
Indirect Specification Instructions

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

Operation Explanation Occupied size


ADRINC: Specifies the storage source for the address to be
32 bits
incremented.*1*2
D
ADRDEC: Specifies the storage source for the address to be
32 bits
decremented.*1*2

*1 Only word data can be specified.


*2 CM cannot be specified.

Description of Operation
ADRINC When the execution condition is ON, the address currently stored in D is
incremented by 1.

D +1 D D +1 D
Address Address+1

ADRDEC When the execution condition is ON, the address currently stored in D is
decremented by 1.

D +1 D D +1 D
Address Address−1

@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).

Operation cannot be assured when the following operation is not followed. (Some device /
variable values may be corrupted to prevent normal operation).
NOTICE
• Never generate or manipulate addresses by any means other than the
ADRSET,ADRINC, ADRADD, ADRDEC, and ADRSUB instructions.

3-62 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Indirect Specification 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 specifying or index modification range is inappropriate
• When the address currently stored in D is inappropriate.
• When the address after incrementing by the ADRINC instruction is inappropriate.
3
CR2012
• When the address after decrementing by the ADRDEC instruction is inappropriate.
• When an access outside the operand range occurs

Indirect Specification Instructions


"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
ADRINC When input relay R000 is ON, store the value of DM0 to DM100 and the value of DM1 toDM101.
(Mnemonics list)
R000 ADRSET
DM0 DM500 ① LD R000
ADRSET DM0 DM500
MOV MOV *DM500 DM100
② ADRINC DM500
*DM500 DM100
MOV *DM500 DM101
ADRINC
DM500 ③

MOV
*DM500 DM101 ④

(1) Store the value of DM0 in [DM500/DM501].


(2) The reference destination (i.e. value of DM0) of the address currently stored in [DM500/
DM501] is stored to DM100.
(3) The address currently stored in [DM500/DM501] is incremented by 1. (DM0→DM1)
(4) The reference destination (i.e. value of 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 ① LD R000
ADRSET DM20 DM500
MOV MOV *DM500 DM100
② ADRDEC DM500
*DM500 DM100
MOV *DM500 DM101
ADRDEC
DM500 ③

MOV
*DM500 DM101 ④

(1) Store the value of DM20 in [DM500/DM501].


(2) The reference destination (i.e. value of DM20) of the address currently stored in [DM500/
DM501] is stored to DM100.
(3) The address currently stored in [DM500/DM501] is decremented by 1 (DM20→DM19).
(4) The reference destination (i.e. value of DM19) of the address decremented by 1 is stored to
DM101.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-63


RADD Address
dition
RSUB Address
btraction

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


ADRADD,ADRSUB

ADRADD(.S)
ADRADD ADRADD.L ADRADD
APPLIED INSTRUCTIONS

Address
Add the address.
@ADRADD(.S)
addition
@ADRADD @ADRADD.L ADRADD

ADRSUB ADRSUB(.S)
ADRSUB.L
ADRSUB

Address
Subtract the address.
@ADRSUB(.S)
subtraction

3 @ADRSUB @ADRSUB.L ADRSUB


Indirect Specification Instructions

Ladder program Input mode


Execution condition ADRADD
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

Operation Explanation Occupied size


ADRADD: Specifies the value to add or the location to store that
value. .S 16 bits
S .L 32 bits
ADRSUB: Specifies the value to subtract or the location to store
that value.
ADRADD: Specifies the location where the address to be added is
stored.*1*2
D 32 bits
ADRSUB: Specifies the location where the address to be
subtracted is stored.*1*2

*1 Only word data can be specified.


*2 CM cannot be specified

3-64 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Indirect Specification Instructions

APPLIED INSTRUCTIONS
Description of Operation
ADRADD(.S) When the execution condition is ON, the address currently stored in D is added
to the value of S .

D +1 D S D +1 D
Address + Value of S Address+Value of S

No suffix for KV-1000 .


3
Point

Indirect Specification Instructions


ADRADD.L When the execution condition is ON, the address currently stored in D is added
to the value of [ S / S +1].

Address + Signed 32-bit BIN data Addres + Value of S

Point Not available for KV-1000 .

ADRSUB(.S) When the execution condition is ON, the value of S is subtracted from the
address stored in D .

D +1 D S D +1 D
Address − Value of S Addres + Value of S

Point No suffix for KV-1000 .

ADRSUB.L When the execution condition is ON, the value of [ S / S +1] is subtracted
from the address stored in D .

D +1 D S +1 S D +1 D
Address − Signed 32-bit BIN data Addres + Value of S

Point Not available for KV-1000 .

@□□□ The above operation will be performed only for 1 scan at the rising edge of execution
condition (OFF→ON).

Operation cannot be assured when the following operation is not followed. (Some device /
variable values may be corrupted to prevent normal operation).
NOTICE
• No other methods other than using the ADRSET/ADRINC/ADRADD/ADRDEC/
ADRSUB instructions are allowed to generate and operate addresses.

Point For the ADRSUB instruction, if the value of S is -32768, then the reference
destination D is -32768.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-65


Indirect Specification 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 specifying or index modification range is inappropriate
• When the address currently stored in D is inappropriate.
• When the address after a value is added through the ADRADD instruction is inappropriate.
3 CR2012 • When the address after a value is subtracted through the ADRSUB instruction is
inappropriate.
Indirect Specification Instructions

• When an access outside the operand range occurs


"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
ADRADD When input relay R000 is ON, store the value of DM0 in DM100.
(Mnemonics list)
R000 ADRSET
DM0 DM500 ① LD R000
ADRSET DM0 DM500
ADRADD +5 DM500
ADRADD MOV *DM500 DM100
+5 DM500 ②

MOV
*DM500 DM100 ③

(1) Store the value of DM0 in [DM500/DM501].


(2) 5 is added to the address stored in [DM500/DM501].
(3) The reference destination (i.e. value of DM5) of the address (5 is added) stored in [DM500/
DM501] is stored in DM100.

ADRSUB When input relay R000 is ON, store the value of DM0 in DM100.
(Mnemonics list)
R000 ADRSET
DM10 DM500 ① LD R000
ADRSET DM10 DM500
ADRSUB +5 DM500
ADRSUB MOV *DM500 DM100
+5 DM500 ②

MOV
*DM500 DM100 ③

(1) Store the value of DM10 in [DM500/DM501].


(2) 5 is subtracted from the address stored in [DM500/DM501].
(3) The reference destination (i.e. value of DM5) of the address (5 is subtracted) stored in
[DM500/DM501] is stored in DM100.

3-66 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Indirect Specification Instructions

APPLIED INSTRUCTIONS
MEMO

Indirect Specification Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-67


e Register Instructions
SET F i l e
gister bank switching

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


FRSET

FRSET FRSET
File register groups
Switch the current bank No.
of the file register to the
APPLIED INSTRUCTIONS

witching
@FRSET FRSET specified No.

Ladder program Input mode


Execution condition FRSET
n F R S E T n

Execution condition FRSET


n @ F R S E T n

3 Operation Explanation Occupied size


Specifies the current bank No. after switching or its storage location.
n 16 bits
File Register Instructions

(0 to 15 for the KV-8000/7000 Series, 0 to 3 for KV-5500/5000/3000)

Description of Operation
FRSET When the execution condition is ON, switch the current bank No. of the file register to the
specified No. of n .
@FRSET This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
• ON when n >15. (For KV-5500/5000/3000, ON when n >3)
• ON when the indirect specification and index modify range is inappropriate.
CR2012 • ON when an access outside the operand range occurs.
Otherwise OFF
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON at the rising edge, switch the current group of file register to Group 1.

R000 (Mnemonics list)


FRSET
#1 LDP R000
FRSET #1

3-68 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


File Register Instructions

APPLIED INSTRUCTIONS
MEMO

File Register Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-69


STM F i l e
gister all saving

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


FRSTM

For KV-8000 / 7000 series


FRSTM The file register within the
APPLIED INSTRUCTIONS

designated bank will be


FRSTM
File register all
saved at once to the memory
For KV-5000 / 3000 series saving
card (CPU memory) in binary
FRSTM
format.

KV-8000/7500/KV-7300

Ladder program Input mode


Execution condition FRSTM

3
n1 n2 S D F R S T M n1 n2 S D
File Register Instructions

KV-5500/5000/3000

Ladder program Input mode


Execution condition FRSTM
n S D F R S T M n S D

Operation Explanation Occupied size


Specifies the drive No. or its storage location (0: Memory card, 1: CPU
n1 16 bits
memory).*1
n2 Specifies the bank No. or its storage location (0 to 15).*2 16 bits
S Specifies the file No. to save the data or its storage location (0 to 999). 16 bits
D Specifies the start address for notification bit data.*3 1 bit x2

*1 For KV-5500/5000/3000, it is not necessary to specify the drive No.


*2 For KV-5500/5000/3000, the bank No. range is 0~3.
*3 When bit data is specified in D , 2 continuous bits are occupied. When word data is specified,
the LSB of 2 continuous words is occupied. Bits other than the LSB remain unchanged.

Description of Operation
FRSTM At the rising edge of execution condition, it will save all file registers of the bank No.
n2 in batch to the storage (memory card for KV-5000/3000 series) specified by n1
in binary format (the file will always be overwritten).
File No. S is specified with number.
The created file is named as \FR\FR (file No. is 3-digit).FRU*.
*The file extension for KV-5500/5000/3000 is FRB.
Create a new folder if there is no "FR" folder.

Example When 10 is stored in S , /FR/FR010.FRU (or FR010.FRB) will be created.

The end notification is written in D , and the error notification of abnormal end is
written in [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions", page 5-154

Point The command will not be executed when the storage device instructions in
execution relay (CR3214) is ON. Please implement exclusive control using CR3214.

3-70 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


File Register Instructions

APPLIED INSTRUCTIONS
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"
• ON when the indirect specification or index modify range is inappropriate.
CR2012
• ON when an access outside the operand range occurs
Otherwise OFF 3
"Out-of-range access of operands", page 1-50

File Register Instructions


* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON at the rising edge, store the file register of Group 0 into the memory card
with the file No. 10.
(Mnemonics list)
KV-8000/7500/7300
LDP R000
R000 CR3214 FRSTM ANB CR3214
#0 #0 #10 MR000 FRSTM #0 #0 #10 MR000

(Mnemonics list)
KV-5500/5000/3000
LDP R000
ANB CR3214
R000 CR3214 FRSTM FRSTM #0 #10 MR000
#0 #10 MR000

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-71


LDM Batch read
le register

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


FRLDM

For KV-8000 / 7000 series


FRLDM
Read the batch data saved in
APPLIED INSTRUCTIONS

FRLDM
Batch read file memory card (CPU memory)
For KV-5000 / 3000 series register into the file register of the
FRLDM specified group.

KV-8000/7500/7300

Ladder program Input mode


Execution condition FRLDM

3
n1 n2 S D F R L D M n1 n2 S D
File Register Instructions

KV-5500/5000/3000

Ladder program Input mode


Execution condition FRLDM
n S D F R L D M n S D

Operation Explanation Occupied size


Specifies the drive No. or its storage location (0: Memory card, 1: CPU
n1 16 bits
memory).*1
n2 Specifies the bank No. or its storage location (0 to 15).*2 16 bits
S Specifies the file No. to read data or its storage location (0 to 999). 16 bits
D Specifies the start address for notification bit data.*3 1 bit x2

*1 For KV-5500/5000/3000, it is not necessary to specify the drive No.


*2 For KV-5500/5000/3000, the bank No. range is 0~3.
*3 When bit data is specified in D , 2 continuous bits are occupied. When word data is specified,
the LSB of 2 continuous words is occupied. Bits other than the LSB remain unchanged.

Description of Operation
FRLDM It will read the data saved in the storage (memory card for KV-5000/3000 series) specified
by n1 to the file register of the bank No. n2 in batch (according to the FRSTM
instruction or the "File Register Settings" of KV STUDIO) at the rising edge of the
execution condition. (The file will always be overwritten).
File No. S is specified with number.
The read file is named as \FR\FR (file No. is 3-digit).FRU*.
*The file extension for KV-5500/5000/3000 is FRB.

Example When 10 is stored in S , /FR/FR010.FRU (or FR010.FR) will be read


out.

The end notification is written in D , and the error notification of abnormal end is
written in [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions", page 5-154

Point The command will not be executed when the storage device instructions in
execution relay (CR3214) is ON. Please implement exclusive control using CR3214.
3-72 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
File Register Instructions

APPLIED INSTRUCTIONS
Operation flag

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"
• ON when the indirect specification or index modify range is inappropriate.
CR2012
• ON when an access outside the operand range occurs
Otherwise OFF 3
"Out-of-range access of operands", page 1-50

File Register Instructions


* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON at the rising edge, read the data of file No. 10 in the memory card into the
file register of Group 0.
(Mnemonics list)
KV-8000/7500/7300
LDP R000
R000 CR3214 ANB CR3214
FRLDM
FRLDM #0 #0 #10 MR000
#0 #0 #10 MR000

(Mnemonics list)
KV-5500/5000/3000
LDP R000
R000 CR3214 FRLDM ANB CR3214
#0 #10 MR000 FRLDM #0 #10 MR000

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-73


nit Program Instructions
STRT U n i t
ogram start

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


UPSTRT

UPSTRT UPSTRT Start the specified unit


Unit program start
program.
APPLIED INSTRUCTIONS

Ladder program Input mode


Execution condition UPSTRT
n1 S D1 D2 U P S T R T n1 S D1 D2

Operation Explanation Occupied size


Specifies the unit number or its storage location. Cannot be specified by
n1 16 bits
"$". (1 to 48)
Specifies the start in which the details of the unit program to be executed
16 bits x4
3
S
are stored.
D1 Specifies the storage location for the started slot number. 16 bits
Specifies the start to store the results. 16 bits x2
Unit Program Instructions

D2

Point • The UPSTRT instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UPSTRT instruction can be used with the KV-8000 series CPU units and KV-
7000Series CPU units that have CPU function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
At the rising edge of the execution condition, the unit program specified by S in the No. n1 unit
starts according to the parameters specified by S +2.
If the 0 bit of S +3 is OFF, an assignable empty slot is automatically used.
If the 0 bit of S +3 is ON, the slot specified by S +1 is used.
When the instruction is complete, the used slot number is stored in D1 , and the execution results
are stored in D2 and D2 +1.

S ~: Request details

Request details Content


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
ON : The slot specified by S +1 is used.
S +3 0 bits Specification
OFF : An assignable empty slot is automatically used.
method

3-74 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
D2 ~: Execution result storage destination
Execution result storage destination Content
Turns OFF when executing the instruction, turns ON when
Completion
0 bits complete. Turns ON regardless of whether the instruction ends
bit
D2 normally or abnormally.
Execution If memory cannot be allocated, turns ON simultaneously with the
1 bit
failed bit completion bit. Turns OFF when executing the instruction

3
The completion code is stored when the instruction is complete.
0 : Started normally.
1 : The specified unit program does not exist.

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.
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 in the unit.
1000 : The specified unit does not exist.
1001 : The specified unit is incorrect.

ON
Execution condition
OFF

ON
Execution failed bit
OFF
(specified in the instruction)
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 completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.
When the instruction is executed, 1 is added to the number of unit program instructions being executed,
and is subtracted when execution is complete.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-75


Unit Program Instructions
APPLIED INSTRUCTIONS

Number of unit program instructions that can be executed simultaneously


If 16 unit program instructions (UPSTRT/UPSTOP/UFSUS/UFRSM/UMALLOC) have been executed, other
unit program instructions will not be executed even when the execution condition is turned ON again.
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
instructions are in standby, they will be executed in the order in which they were put into standby.

3 Instructions that are put into standby will be executed when there are 15 or fewer instructions being
executed, regardless of whether the execution condition turns OFF during standby.
Unit Program Instructions

Unit program instructions are executed between the rising edge of the execution condition and when
the completion bit turns ON. If the execution condition turns OFF part way through, they will be counted
as instructions being executed until the completion bit turns ON. If the execution condition turns ON, the
completion bit will always turn ON at some point.
After the completion bit turns ON, even if the execution condition turns ON continuously, the instruction
will not be counted as an instruction being executed.

Scan

ON
Execution condition
OFF

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
ON when one of the following conditions is established. Otherwise, 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-8000/7000 Series
high performance expansion unit (X-Unit)
• When 4 words cannot be allocated from S
CR2012
• When 2 words cannot be allocated from D2
• When bit data other than the timer, counter or start of the channel is specified in S ,
D1 or D2
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List", page A-43
3-76 - KV-8000/7000/5000/3000/1000 Series/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 An assignable slot number is automatically stored in DM10. If the unit
program fails to start, a completion code is stored in DM12.
(Mnemonics list)
MR000 MOV
#0 DM0 LD MR000
Program number MOV #0 DM0

MOV
#2 DM2
MOV #2 DM2
RES DM3.0
UPSTRT #1 DM0 DM10 DM11
3
LDP DM11.0

Unit Program Instructions


Start block number
MPS
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 Execution failed bit Start slot number
bit

DM11.1 MOV
DM12 DM21
Execution failed bit Completion code

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-77


STOP U n i t
ogram forced stop

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


UPSTOP

Force the unit program


UPSTOP UPSTOP Unit program
being executed in the
forced stop
APPLIED INSTRUCTIONS

specified slot to stop.

Ladder program Input mode


Execution condition UPSTOP
n1 n2 D U P S T O P n1 n2 D

Operation Explanation Occupied size


Specifies the unit number or its storage location. Cannot be specified by
n1 16 bits
"$". (1 to 48)

3 n2
D
Specifies the storage location for the slot number to stop forcefully.
Specifies the start to store the results.
16 bits
16 bits x2
Unit Program Instructions

Point • The UPSTOP instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UPSTOP instruction can be used with the KV-8000 series CPU units and KV-
7000Series CPU units that have CPU function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
At the rising edge of the execution condition, the unit program being executed in the slot specified by
n2 in the No. n1 unit is stopped forcefully, and the slot becomes empty.
When the instruction is complete, the execution results are stored in D and D +1.

Point There is a limit to the number of unit program instructions including UPSTOP instructions
that can be executed simultaneously.
"Number of unit program instructions that can be executed simultaneously", page 3-76

3-78 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
D ~: Execution result storage destination

Execution result Content


Turns OFF when executing the instruction, turns ON when
Completion
0 bits complete. Turns ON regardless of whether the instruction ends
bit
normally or abnormally.
D
Execution
If memory cannot be allocated, turns ON simultaneously with the
1 bit failed
completion bit. Turns OFF when executing the instruction
bit
The completion code is stored when the instruction is complete. 3
0 : Started normally.

Unit Program Instructions


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.
D +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 in the unit.
1000 : The specified unit does not exist.
1001 : The specified unit is incorrect.

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 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-8000/7000 Series
high performance expansion unit (X-Unit)
CR2012
• When a 16-bit area cannot be allocated when bit data was specified in n1 and n2
• When bit data other than the timer, counter or start of the channel is specified in D
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List", page A-43

Sample Program
MR000 is turned ON, and the flow being executed in the number 0 slot on the KV-XH16ML connectedto
unit No.
(Mnemonics list)
MR000 UPSTOP
#1 #0 DM0 LD MR000
KV-XH16ML UPSTOP #1 #0 DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-79


SUS Suspend
ow
RSM Resume flow

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


UFSUS UFRSM

Suspend the flow being


UFSUS UFSUS
Suspend flow executed in the specified
APPLIED INSTRUCTIONS

slot.

UFRSM UFRSM
Resume flow Resume a suspended flow.

Ladder program Input mode


Execution condition UFSUS
n1 n2 n3 D U F S U S n1 n2 n3 D

Execution condition UFRSM

3 n1 n2 D U F R S M n1 n2 D

Operation Explanation Occupied size


Unit Program Instructions

Specifies the unit number or its storage location. Cannot be specified by


n1 16 bits
"$". (1 to 48)
n2 Specifies the storage location for the slot number to suspend / resume. 16 bits
n3 Specifies the storage location for the suspend method. 16 bits
D Specifies the start to store the results. 16 bits x2

Point • The UFSUS instruction/UFRSM instruction can be used on KV STUDIO Ver. 9.0 or
later only.
• The UFSUS instruction/UFRSM instruction can be used with the KV-8000 series CPU
units and KV-7000 Series CPU units that have CPU function version 2.0 or later only.
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
UFSUS At the rising edge of the execution condition, the flow being executed in the slot specified
by n2 in the No. n1 unit is suspended according to the method specified in n3 .
When the instruction is complete, the execution results are stored in D and D +1.

UFRSM At the rising edge of the execution condition, the suspended flow in the slot specified by
n2 in the No. n1 unit is resumed.
When the instruction is complete, the execution results are stored in D and D +1.

n3 : Request details

Request details Content


ON : Blocks being executed are forcefully stopped, and flow is
Suspension suspended.
n3 0 bits
method OFF : Flow is suspended when the blocks being executed are
completed.

3-80 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
D ~: Execution result storage destination

Execution result Content


Turns OFF when executing the instruction, turns ON when
Completion
0 bits complete. Turns ON regardless of whether the instruction ends
bit
normally or abnormally.
D
Execution
If memory cannot be allocated, turns ON simultaneously with the
1 bit failed
completion bit. Turns OFF when executing the instruction
bit
The completion code is stored when the instruction is complete. 3
0 : Started normally.

Unit Program Instructions


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.
D +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 in the unit.
1000 : The specified unit does not exist.
1001 : The specified unit is incorrect.

Point There is a limit to the number of unit program instructions including UFSUS/UFRSM
instructions that can be executed simultaneously.
"Number of unit program instructions that can be executed simultaneously", page 3-76

Operation flag

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 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-8000/7000 Series
high performance expansion unit (X-Unit)
CR2012
• When a 16-bit area cannot be allocated when bit data was specified in n1 and n2
• When bit data other than the timer, counter or start of the channel is specified in D
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-81


Unit Program Instructions
APPLIED INSTRUCTIONS

Sample Program
MR000 is turned ON, and the flow being executed in the number 0 slot on the KV-XH16ML connectedto
unit No. 1 is suspended. MR001 is turned ON and the suspended flow is resumed.
(Mnemonics list)
MR000 UFSUS
#1 #0 #1 DM0 LD MR000
KV-XH16ML UFSUS #1 #0 #1 DM0
LD MR001
MR001 UFRSM UFRSM #1 #0 DM10

3 #1
KV-XH16ML
#0 DM10
Unit Program Instructions

3-82 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Unit Program Instructions

APPLIED INSTRUCTIONS
MEMO

Unit Program Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-83


ALLOC Allocate
ffer memory

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


UMALLOC

Allocate an area of the

UMALLOC UMALLOC Allocate buffer unit buffer memory


APPLIED INSTRUCTIONS

memory that can be used


freely.

Ladder program Input mode


Execution condition UMALLOC
n1 n2 D1 D2 U M A L L O C n1 n2 D1 D2

Operation Explanation Occupied size


Specifies the unit number or the reference destination in which it is stored.
n1 16 bits

3
Cannot be specified by "$". (1 to 48)
Specifies the reference destination in which the number of words to
n2 16 bits
allocate is stored.
Unit Program Instructions

D1 Specifies the result storage location. 16 bits


D2 Specifies the storage location for the start address of the allocated area. 16 bits

Point • The UMALLOC instruction can be used on KV STUDIO Ver. 9.0 or later only.
• The UMALLOC instruction can be used with the KV-8000 series CPU units and KV-
7000 Series CPU units that have CPU function version 2.0 or later only.
"KV-8000 CPU Function Version", page 2
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
At the rising edge of the execution condition, an area of the number of words specified by n2 from
the buffer memory of the No. n1 unit is allocated. The start address of the allocated area is stored in
D2 and the execution results are stored in D1 .
If allocation fails, #0 is stored in D2 .

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 deal located.

D1 : Result storage destination

Result storage destination Content


Turns OFF when executing the instruction, turns ON when
0 bits 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
instructions that can be executed simultaneously.
"Number of unit program instructions that can be executed simultaneously", page 3-76

3-84 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Unit Program 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 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
• When the unit with the unit number specified by n1 is not a KV-8000/7000 Series
high performance expansion unit (X-Unit)
CR2012 • When a 16-bit area cannot be allocated when bit data was specified in n1 and n2

Unit Program Instructions


• When bit data other than the timer, counter or start of the channel is specified in D1
and D2
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List", page A-43

Sample Program
MR000 is turned ON, and 1000 words of the buffer memory of the KV-XH16ML connected to unit No.
1is allocated.
(Mnemonics list)
MR000 UMALLOC
#1 #1000 DM0 DM1 LD MR000
KV-XH16ML UMALLOC #1 #1000 DM0 DM1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-85


ffer Memory Instructions
EAD Read buffer
mory instruction

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


UREAD

UREAD(.U)
UREAD.S
APPLIED INSTRUCTIONS

UREAD UREAD.D UREAD


UREAD.L
UREAD.F Read Read data of the
buffer specified buffer
@UREAD(.U) memory memory.
@UREAD.S

@UREAD @UREAD.D UREAD


@UREAD.L
@UREAD.F

3 Ladder program Input mode


Execution condition UREAD
Buffer Memory Instructions

U R E A D n1 n2 D n3
n1 n2 D n3
( F R O M n1 n2 D n3 )

Execution condition UREAD


@ U R E A D n1 n2 D n3
n1 n2 D n3
( @ F R O M n1 n2 D n3 )

Operation Explanation Occupied size


Specifies the unit number or its storage location. Cannot be
n1 16 bits
specified by "$". (0 to 48)
Specify the leading address No. of the buffer memory reading
n2 16 bits
data. (0 to 59999)*1
.U .S 16 bits× n3
D Specifies the start to store the read data.
.D .L .F 32 bits× n3
n3 Specify the number of data to read. (1 to 60000)*1 16 bits

*1 For KV-5500/5000/3000 and KV Nano series, specify a value within the range of 0 to 32767 for
n2 and 1 to 32768 for n3 .

Description of Operation
Read the data in buffer memory of expansion special unit into the storage location.
For the contents in buffer memory, refer to User's Manual of corresponding units.

UREAD(.U) When the execution condition is ON, n3 words of data are read from the address
UREAD.S specified by n2 of the buffer memory in No. n1 expansion unit, and are stored
staring from D .
UREAD.D When the execution condition is ON, n3 ×2 words of data are read from the address
UREAD.L specified by n2 of the buffer memory in No. n1 expansion unit, and are stored
UREAD.F staring from D .
@UREAD.□ This instruction is executed for one scan at the rising edge of the execution condition.

3-86 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Buffer Memory Instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
On in the following cases; OFF in other cases.
• When the indirect specification or index modify range is inappropriate (for the KV-8000/
7000Series, when indirect specification is used to specify a device other than the leading
device of the channel)
• When the unit number specified with n1 is 49 or more 3
• When the range of the buffer memory address specified in n2 and n3 exceeds 60000
CR2012

Buffer Memory Instructions


(32768 for the KV-5500/5000/3000 and KV Nano Series)
• When the range specified in D and n3 exceeds the upper limit
• When there is no buffer memory in the unit with unit No. specified in n1
• When the unit specified by n1 is not connected during the use of KV-8000/7000 series
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

"CR/CM List", page A-43

Sample Program
It will read out the data of input capture at the start-up of IN000, input capture of fall time ofKV-SIR32XT
connected to unit No.1 to DM0 to DM1, DM2 to DM3.
(Mnemonics list)
5 85($'/
  '02 
LD R30000
UREAD.L #1 #0 DM0 #2

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-87


RIT W r i t e
ffer memory

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


UWRIT

UWRIT(.U)
UWRIT.S
APPLIED INSTRUCTIONS

UWRIT UWRIT.D UWRIT


UWRIT.L
UWRIT.F Write Write data into
buffer the specified
@UWRIT(.U)
memory buffer memory
@UWRIT.S

@UWRIT @UWRIT.D UWRIT


@UWRIT.L
@UWRIT.F

3 Ladder program Input mode


Execution condition UWRIT
Buffer Memory Instructions

U W R I T n1 n2 S n3
n1 n2 S n3
( T O n1 n2 S n3 )

Execution condition UWRIT


@ U W R I T n1 n2 S n3
n1 n2 S n3
(@ T O n1 n2 S n3 )

Operation Explanation Occupied size


Specifies the unit number or the reference destination in which it
n1 16 bits
is stored. Cannot be specified by "$". (0 to 48)
Specify the leading address number of the buffer memory writing
n2 16 bits
data. (0 to 59999)*1
.U .S 16 bits× n3
S Specifies the writing data or the start to store it.
.D .L .F 32 bits× n3
n3 Specify the number of data to be written. (1 to 60000)*1 16 bits

*1 For KV-5500/5000/3000 and KV Nano series, specify a value within the range of 0 to 32767 for
n2 and 1 to 32768 for n3 .

Description of Operation
Write data into the specified buffer memory area of expansion special unit.
For the contents in buffer memory, refer to User's Manual of corresponding units.

UWRIT(.U) When the execution condition is ON, n3 words of data starting from S are
UWRIT.S written into the buffer memory area starting from the address specified by n2 in
No. n1 expansion unit.
UWRIT.D When the execution condition is ON, n3 ×2 words of data starting from S are
UWRIT.L written into the buffer memory area starting from the address specified by n2 in
UWRIT.F No. n1 expansion unit.
@UWRIT.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point If a constant is specified in S , write the specified value into all spaces. (same
operation with UFILL instruction)
"UFILL instruction", page 3-90

3-88 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Buffer Memory Instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
On in the following cases; OFF in other cases.
• When the indirect specification or index modify range is inappropriate (for the KV-8000/
7000Series, when indirect specification is used to specify a device other than the leading
device of the channel)
• When the unit number specified with n1 is 49 or more 3
• When the range of the buffer memory address specified in n2 and n3 exceeds 60000
CR2012

Buffer Memory Instructions


(32768 for the KV-5500/5000/3000 and KV Nano Series)
• When the range specified in S and n3 exceeds the upper limit
• When there is no buffer memory in the unit with unit No. specified in n1
• When the unit specified by n1 is not connected during the use of KV-8000/7000 series
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

"CR/CM List", page A-43

Sample Program
DM0 to DM1 will be written to the cycle of PWM0 of KV-SIR32XT connected to unit No.1.
(Mnemonics list)
5 8:5,7'
  '02 
LD R30000
UWRIT.D #1 #258 DM0 #1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-89


ILL B u f f e r
mory batch write

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


UFILL

UFILL(.U)
UFILL.S
APPLIED INSTRUCTIONS

UFILL UFILL.D UFILL


UFILL.L
UFILL.F Write the same
Buffer memory
data in batch to
@UFILL(.U) batch write
the specified
@UFILL.S

@UFILL @UFILL.D UFILL buffer memory.


@UFILL.L
@UFILL.F

3 Ladder program Input mode


Execution condition UFILL
Buffer Memory Instructions

U F I L L n1 n2 S n3
n1 n2 S n3

Execution condition UFILL


@ U F I L L n1 n2 S n3
n1 n2 S n3

Operation Explanation Occupied size


Specifies the unit number or its storage location. Cannot be specified by
n1 16 bits
"$". (0 to 48)
Specify the leading address number of the buffer memory writing data.
n2 16 bits
(0 to 59999)*1
.U .S 16 bits
S Specifies the writing data or its storage location.
.D .L .F 32 bits
n3 Specify the number of data to be written. (1 to 60000)*1 16 bits

*1 For KV-5500/5000/3000 and KV Nano series, specify a value within the range of 0 to 32767 for
n2 and 1 to 32768 for n3 .

Description of Operation
Same 16/32-bit data are written in batch in the buffer memory area of the expansion special unit.
For the contents in buffer memory, refer to User's Manual of corresponding units.

UFILL(.U) When the execution condition is ON, 16-bit BIN data specified by S is written into
UFILL.S the area of n3 words from the address specified by n2 of the buffer memory in
the No. n1 expansion unit.
UFILL.D When the execution condition is ON, 32-bit BIN data specified by S is written into
UFILL.L the area of n3 ×2 words from the address specified by n2 of the buffer memory in
UFILL.F the No. n1 expansion unit.
@UFILL.□ This instruction is executed for one scan at the rising edge of the execution condition.

3-90 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Buffer Memory Instructions

APPLIED INSTRUCTIONS
Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
On in the following cases; OFF in other cases.
• When the indirect specification or index modify range is inappropriate (for the KV-8000/
7000Series, when indirect specification is used to specify a device other than the leading
device of the channel)
• When the unit number specified with n1 is 49 or more 3
CR2012 • When the range of the buffer memory address specified in n2 and n3 exceeds 60000

Buffer Memory Instructions


(32768 for the KV-5500/5000/3000 and KV Nano Series)
• When there is no buffer memory in the unit with unit No. specified in n1
• When the unit specified by n1 is not connected during the use of KV-8000/7000 series
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to
CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-91


ze Acquisition Instructions
NT Get the
mber of array elements in the
ecified dimension

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


ACNT

Get the number


ACNT
Get the number of array elements in
ACNT
of array
APPLIED INSTRUCTIONS

the specified dimension.


elements

Ladder program Input mode


Execution condition ACNT
S n D A C N T S n D

Operation Explanation Occupied area


S Specifies an entire array.*1*2 ―

3 n
Specifies the number of dimensions (1 to 8) to get the number 16 bits
of elements.
D Specifies the result storage location. 32 bits
Size Acquisition Instructions

*1 Only array type variable name can be specified in S . Variables other than arrays or elements
other than variables cannot be specified.
*2 Variable-length array of FB argument cannot be specified.

Point The ACNT instruction can be used only with KV-8000 with CPU function version 2.0
or later.

Description of Operation
ACNT When the execution condition is ON, the number of elements in the No. n dimension
of the array specified by S is stored in [ D / D +1].

Example When S =Array_A (2-dimensional array of 5×4) and n =2


Array_A
Number of

[0,0] [0,1] [0,2] [0,3]

[1,0] [1,1] [1,2] [1,3] D +1 D

Number [2,0] [2,1] [2,2] [2,3] 4

[3,0] [3,1] [3,2] [3,3]

[4,0] [4,1] [4,2] [4,3]

Point The ACNT instruction obtains the number of elements instead of the word size. For
example, when UDINT (2-word unsigned integer) is specified as 4 dimensions, 4 is
stored in [ D / D +1]. Word size 8 is not stored.

3-92 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Size Acquisition 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 n is not specified as a constant or n is 0 or a number of dimensions that does
not exist
• When indirect reference or index modification is inappropriate
CR2012
No change if all of the following conditions are met.
n
3
• is specified as a constant

Size Acquisition Instructions


• When indirect specification or index modification is not used for D , and the access outside
the operand range is not checked

Sample Program
At the rising edge of input relay R000, the number of elements in the second dimension of 5×4 two-
dimensional array Array_A is stored in DM0. Then, 0 is stored in Array_A[4,0],
Array_A[4,1]…Array_A[4,3].

Array_A [0,0] [0,1] [0,2] [0,3]

[1,0] [1,1] [1,2] [1,3]

[4,0] [4,1] [4,2] [4,3] "0" is stored

CR2002 MOV. D ;(Mnemonics list)


#0 duAryLen
Always ON LD CR2002
MOV.D #0 duAryLen
R000 ACNT
Array_A #2 duAryLen
LDP R000
ACNT Array_A #2 duAryLen
MOV.D #0 idx
MOV. D FOR.D duAryLen
#0 idx LD CR2002
MOV #0 Array_A[#4,idx]
FOR. D INC.D idx
duAryLen NEXT

CR2002 MOV. D
#0 Array_A[#4, idx]
Always ON

idx
INC. D

NEXT

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-93


IZE Get the
rd size occupied by the specified
riable

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


WSIZE

WSIZE WSIZE Get the word size occupied by the


Get word size
APPLIED INSTRUCTIONS

specified variable.

Ladder program Input mode


Execution condition WSIZE
S D W S I Z E S D

Operation Explanation Occupied area


S Specifies a variable.*1*2 ―

3 *1
D Specifies the result storage location.

Only variables can be specified in S . Devices cannot be specified.


32 bits
Size Acquisition Instructions

*2 Variable-length array and variable-length string of FB argument cannot be specified.

Point The WSIZE instruction can be used only with KV-8000 with CPU function version
2.0 or later.

Description of Operation
WSIZE When the execution condition is ON, the word size occupied by S is stored in [ D /
D +1].

Example S = When the following structure type variables are specified

Member name Data type


D +1 D
member1 UINT
member2 STRING[20] 14

member3 REAL

→ The number of words in STRING[20] is 11 obtained after (20+1)/2


is rounded up, so 1 + 11 + 2 = 14.

Point • The WSIZE instruction obtains the word size. For example, when an array type
variable or structure type variable with 4 UDINT type data (2-word unsigned
integer) is specified, 8 is stored in [ D / D +1] as 2 words × 4 = 8 words. The
number of elements or the number of members is not stored.
• D stores the word size including the offset. For details on the offset, refer to
the User's Manual of the CPU unit used.

Operation flag

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 indirect reference or index modification is inappropriate
CR2012 No change if all of the following conditions are met.
• Indirect specification or index modification is not used for the operand
• No device or variable is used as the array subscript

3-94 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Size Acquisition Instructions

APPLIED INSTRUCTIONS
Sample Program
The word size occupied by the variable "Products_A" is calculated at the rising edge of input relay
MR000 and stored in DM0. Then, 0 is stored in the area occupied by "Products_A".

MR000 WSIZE ;(Mnemonics list)


Products_A DM0
LDP MR000
WSIZE Products_A DM0
FMOV
FMOV #0 Products_A DM0

3
#0 Products_A DM0

Point The above reference program can be used only when the word size of the variable is

Size Acquisition Instructions


65535 or less.
When the word size of the variable is larger than 65535, 0 should be stored using
the recipe load function.
For details on the recipe load / save function, refer to the User's Manual of the CPU
unit used.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-95


IZE Get the bit
ze occupied by the specified variable

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


BSIZE

BSIZE
BSIZE Get the bit size occupied by the
Get bit size
APPLIED INSTRUCTIONS

specified variable.

Ladder program Input mode


Execution condition BSIZE
S D B S I Z E S D

Operation Explanation Occupied area


S Specifies a variable.*1*2 ―

3 *1
D Specifies the result storage location.

Only variables can be specified in S . Devices cannot be specified.


32 bits
Size Acquisition Instructions

*2 Variable-length array and variable-length string of FB argument cannot be specified.

Point The BSIZE instruction can be used only with KV-8000 with CPU function version 2.0
or later.

Description of Operation
BSIZE When the execution condition is ON, the bit size occupied by S is stored in [ D /
D +1].

Example When an INT type array variable is specified in S

D +1 D

[0] [1] [2] [3] … [18] [19] 320

Number of elements 20

→ The number of elements is 20 for the INT type (16 bits), so 16 bits × 20 = 320 bits

[ D / D +1] stores the bit size including the offset. For details on the offset,
Point
refer to the User's Manual of the CPU unit used.

Operation flag

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 indirect reference or index modification is inappropriate
CR2012 No change if all of the following conditions are met.
• Indirect specification or index modification is not used for the operand
• No device or variable is used as the array subscript

3-96 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Size Acquisition Instructions

APPLIED INSTRUCTIONS
Sample Program
The bit size occupied by the array type variable "ResultBits" is calculated at the rising edge of input
relay MR000 and stored in DM0. The end number of the array is stored in the UDINT type variable du
Size Of Bit, and all bits of "ResultBits" are reset.

MR000 BSIZE ;(Mnemonics list)


ResultBits DM0
LDP MR000

3
BSIZE ResultBits DM0
― .L DM0 +1 duSizeOfBit
CAL-.L DM0 +1 duSizeOfBit
ZRES ResultBits[#0] ResultBits[duSizeOfBit]

Size Acquisition Instructions


ResultBits[#0]
ZRES
ResultBits[duSizeOfBit]

Point • When a device such as DM is specified as array subscript, it will be processed as


a 1-word unsigned integer, so only arrays with up to 65535 bits can be
processed. When the number of array elements is larger than 65535, UDINT type
variable will be used as the subscript as shown in the sample program.
• The BSIZE and BBCMP instructions are used together to compare structures.
"BBCMP instruction", page 5-54
• The BSIZE and BBMOV instructions are used together to transfer the entire
structure to another structure.
"BBMOV instruction", page 4-38

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 3-97


nit Type Judgment Instruction
_□□□ Unit type
dgment

KV-8000 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_□□□
n D I S _ □ □ □ n D

Operation Explanation Occupied size


Specifies the unit number or its storage location. Cannot be specified by
n 16 bits
"$". (0 to 48)
D Specifies the bit to store the result notification. 1 bit
3 Point • The unit type judgment instruction can be used in KV STUDIO Ver. 9.1 or later
only.
Unit Type Judgment Instruction

• The unit type judgment instruction can be used with the KV-8000 series CPU unit
sand KV-7000 Series CPU units that have CPU function version 2.1 or later only.
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
The unit type of the No. n unit is checked at the rising edge of the execution condition, and D
turns ON if it matches the unit type corresponding to the instruction. D turns OFF if there is no
match or if it is not connected.

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

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 unit number specified with n is 49 or more
CR2012 • When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* When CR2012 is ON, error details are stored in CM5150 to CM5176.


"CR/CM List", page A-43

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.

@CR2008 (Mnemonics list)


IS_XH16ML
#1 MR000 LD @CR2008
IS_XH16ML #1 MR000

3-98 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


4

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

Data Move Instructions....................................................... 4-2


Arithmetic/Comparison Instructions ............................... 4-40
Logical Operation Instructions ........................................ 4-80
Shift Instructions............................................................... 4-94
Data Control Instructions ............................................... 4-132
Data Conversion Instructions ........................................ 4-158
Floating Point Instructions ............................................. 4-198
Text Processing Instructions ......................................... 4-236
Simple Operation Instructions ....................................... 4-320

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-1


ata Move Instructions
OV Data move

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


MOV

MOV(.U)
MOV.S
MOV.D
MOV
MOV
MOV.L
MOV.F
ARITHMETIC OPERATION

MOV.DF
Data move Stores 16/32/64-bit data.
@MOV(.U)
@MOV.S
INSTRUCTIONS

@MOV.D
@MOV
MOV
@MOV.L
@MOV.F
@MOV.DF

4
Ladder program Input mode
Execution condition MOV
S D M O V S D
Data Move Instructions

Execution condition MOV


S D @ M O V S D

Operand Explanation Occupied size


.U .S 16 bits
S Specifies the move source data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
D Specifies the data storage location. .D .L .F 32 bits
.DF 64 bits

Description of Operation
MOV(.U) When the execution condition is ON, 16-bit unsigned BIN data currently stored in S is
stored to D .

4-2 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

MOV.S When the execution condition is ON, 16-bit signed BIN data currently stored in S is
stored to D .

ARITHMETIC OPERATION
Example MOV
#12345 DM100
When the constant is specified to S

INSTRUCTIONS
Data memory status before executing instruction Data memory status after executing instruction

DM98: 0 S : 12345 DM98: 0

DM99: 0 DM99: 0

DM100: 0 Transfer D : DM100: 12345

DM101: 0 DM101: 0

DM102:
16-bit
(1 word)
0 DM102: 0
4

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, 32-bit unsigned BIN data currently stored in [ S /
S +1] is stored to [ D / D +1].

MOV.L When the execution condition is ON, 32-bit signed BIN data currently stored in [ S /
S +1] is stored to [ D / D +1].

Example MOV.D
When the constant is specified to S #12345678 DM14

Data memory status before executing instruc Data memory status after executing instruction
Higher bit Lower bit Higher bit Lower bit
DM11: 0 :DM10 S DM11: 0 :DM10
DM13: 0 :DM12 : #12345678 DM13: 0 :DM12
DM15: 0 :DM14 Transfer DM15: 12345678 :DM14 : [ D ・ D +1]
DM17: 0 :DM16 DM17: 0 :DM16
DM19: 0 :DM18 DM19: 0 :DM18
32-bit
(2 words)

When the device is specified to S MOV.D


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-3


Data Move Instructions

MOV.F When the execution condition is ON, single precision floating point type real number
specified by S is stored to D .
ARITHMETIC OPERATION

Example MOV.F
When the constant is specified to S
+1.234 DM14
INSTRUCTIONS

Data memory status before executing instruction Data memory status after executing instruction
DM11: 0 :DM10 S :1.234 DM11: 0 :DM10

DM13: 0 :DM12 DM13: 0 :DM12

DM15: :DM14 Transfer DM15: :DM14 : D


0 +1.234
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 normally when T or C is indirectly specified in


D .

MOV.DF When the execution condition is ON, double precision floating point type real number
specified by S is stored to D .

Example When the constant is specified to S MOV.DF


+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: :DM18 転 送 DM21: :DM18 : D


0 +1.23456789
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 after 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 normally when T or C is indirectly specified in


D .

@MOV.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-4 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Data Move Instructions


"CR/CM List", page A-43

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 data in operand


The states of internal auxiliary relays R1000 to R1015 are stored to DM0.
R1015 R1000 (Mnemonics list)
CR2002 MOV 1110101010101010 内部補助リレー
Internal auxiliary relay
LD CR2002
R1000 DM0
MOV R1000 DM0
MOV

1110101010101010 DM0

Reference When the bit data specified by the No.1 operand straddles channels, the states of the 16
bits straddling the channels is stored to DM0.
1ch 0ch
→ (Mnemonics list)
R102 → R003
CR2002 MOV 1110101010101010 Input relay LD CR2002
R003 DM0 MOV R003 DM0
MOV

1110101010101010 DM0

Reference When the bit data specified by the No.2 operand straddles channels, the data is stored to
the 16 bits straddling the channels.
(Mnemonics list)
CR2002 MOV 1110101010101010 DM0
DM0 R1005 LD CR2002
R1104
11ch 10ch

→ MOV
R1005
MOV DM0 R1005
1110101010101010 Internal auxiliary relay

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-5


LDA Load

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


LDA

LDA(.U)
LDA.S
LDA.D
LDA LDA.L
LDA.F
LDA
ARITHMETIC OPERATION

LDA.DF
Load A Stores data to internal registers.
@LDA(.U)
@LDA.S
INSTRUCTIONS

@LDA.D
@LDA @LDA.L
@LDA.F
LDA

@LDA.DF

4
Ladder program Input mode
Execution condition S
LDA STA L D A S
Data Move Instructions

Execution condition S
LDA STA @ L D A S

Operand Explanation Occupied size


.U .S 16 bits
S Specifies the data to be written to internal registers. .D .L .F 32 bits
.DF 64 bits

Description of Operation
LDA(.U) When the execution condition is ON, 16-bit unsigned BIN data specified by S is
stored to the 16-bit internal register.
S 16-bit internal registe
1234 → 1234
16-bit 16-bit
(1 word) (1 word)

LDA.S When the execution condition is ON, 16-bit signed BIN data specified by S is stored
to the 16-bit internal register.
S 16-bit internal registe
−1234 → −1234
16-bit 16-bit
(1 word) (1 word)

LDA.D When the execution condition is ON, 32-bit unsigned BIN data specified by [ S /
S +1] is stored to the 32-bit internal register.
S +1 S 32-bit internal register
12345678 → 12345678
32-bit 32-bit
(2 words) (2 words)

4-6 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

LDA.L When the execution condition is ON, 32-bit signed BIN data specified by [ S /
S +1] is stored to the 32-bit internal register.

ARITHMETIC OPERATION
S +1 S 32-bit internal register
−12345678 → −12345678
32-bit 32-bit

INSTRUCTIONS
(2 words) (2 words)

LDA.F When the execution condition is ON, single precision floating point type real number
specified by S is stored to the 32-bit internal register.

Example When the constant is specified to S

S : +1.234
32-bit internal register

+1.234
4

Data Move Instructions


32-bit

When a value other than constant 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
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 a value other than constant 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.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-7


Data Move Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


ON when the value read from the reference source specified to the operand is 0, and OFF
CR2010
otherwise.
INSTRUCTIONS

CR2011 No change in state


ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

4 * The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
Data Move Instructions

KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
See the sample program for the STA instruction.
"STA instruction sample program", page 4-12

4-8 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Data Move Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-9


STA Storage

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


STA

STA(.U)
STA.S
STA.D
STA STA.L
STA.F
STA
ARITHMETIC OPERATION

STA.DF
Read data from internal registers
Store A and store it to the specified
@STA(.U) reference destination.
@STA.S
INSTRUCTIONS

@STA.D
@STA @STA.L
@STA.F
STA

@STA.DF

4
Ladder program Input mode
Execution condition D
LDA STA S T A D
Data Move Instructions

Execution condition D
LDA STA @ S T A D

Operand Explanation Occupied size


.U .S 16 bits
D Specifies the storage location for the data of internal registers. .D .L .F 32 bits
.DF 64 bits

Description of Operation
STA(.U) When the execution condition is ON, 16-bit unsigned BIN data currently stored in the 16-
bit internal register is stored to D .

16-bit internal register D


1234 → 1234
16-bit 16-bit
(1 word) (1 word)

STA.S When the execution condition is ON, 16-bit signed BIN data currently stored in the 16-bit
internal register is stored to D .

16-bit internal register D


−1234 → −1234
16-bit 16-bit
(1 word) (1 word)

STA.D When the execution condition is ON, 32-bit unsigned BIN data currently stored in the 32-
bit internal register is stored to [ D / D +1].
32-bit internal register D +1 D
12345678 → 12345678
32-bit 32-bit
(2 words) (2 words)

4-10 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

STA.L When the execution condition is ON, 32-bit signed BIN data currently stored in the 32-bit
internal register is stored to [ D / D +1].

ARITHMETIC OPERATION
32-bit internal register D +1 D
−12345678 → −12345678
32-bit 32-bit

INSTRUCTIONS
(2 words) (2 words)

STA.F When the execution condition is ON, single precision floating point type real number
currently stored in the internal register is stored to [ D / D +1].

32-bit internal register D +1 D


+1.234 → +1.234
32-bit
32-bit
(2 word) 4
STA.DF When the execution condition is ON, double precision floating point type real number

Data Move Instructions


currently stored in the internal register is stored to [ 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.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point Operation cannot be performed normally when T or C is indirectly specified in


D .

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-11


Data Move Instructions

STA instr

Sample Program
ARITHMETIC OPERATION

Changing setting values of the timer


When input relay R000 is ON, the setting value of timer T0 is set to #100.
INSTRUCTIONS

When input relay R000 is OFF, the setting value of timer T0 is changed to the value currently stored
toDM0.
(Mnemonics list)
R000 #100 T0
LDA STA LD R000
LDA #100

4
CON
R000 DM0 T0 STA T0
LDA STA LDB R000
LDA DM0
Data Move Instructions

CON
STA T0

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 data in operand


The states of input relays R000 to R015 are stored to DM0.
R015 R000 (Mnemonics list)
CR2002 R000 DM0 1110101010101010 Input relay
LD CR2002
LDA STA
LDA R000
LDA
CON
1110101010101010
0 16-bit
internal register
STA DM0

STA

1110101010101010 DM0

The state of DM0 is output to output relays R500 to R515.


(Mnemonics list)
CR2002 DM0 R500 1110101010101010 DM0
LDA STA LD CR2002
LDA LDA DM0
CON
0 16-bit
1110101010101010 internal register STA R500

R515
STA R500

1110101010101010 Output relay

4-12 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Reference When the bit data specified by the LDA operand straddles channels, the states of the 16
bits straddling channels are stored to the internal register

ARITHMETIC OPERATION
1ch 0ch
→ (Mnemonics list)
R102 → R003
CR2002 R003 DM0 1110101010101010 Input relay LD CR2002
LDA STA LDA R003

INSTRUCTIONS
LDA
CON
1110101010101010
16-bit
internal register
STA DM0
STA

1110101010101010 DM0

Reference KV-1000 When the bit data specified by the STA operand straddles channels, the data is
stored to bits straddling channels.
(Mnemonics list)
4
CR2002 DM0 R503 1110101010101010 DM0

Data Move Instructions


LDA STA LD CR2002
LDA LDA DM0
1110101010101010
16-bit CON
internal register
STA R503
6ch 5ch
R602

→ STA R503

? ? ? 0101010101010 Output relay

No data is stored in R600 to R602.


No status change for R600 to R602
before and after executing instruction.

In KV-8000/7500/7300/5500/5000/3000 and KV Nano Series, straddle channel storage is


performed.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-13


DA
rtial load

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


PLDA

PLDA(.U)
PLDA PLDA.D PSTA
Only the specified bits of
Partial load the data are stored in
@PLDA(.U) internal register.
@PLDA
ARITHMETIC OPERATION

@PLDA.D PSTA

Ladder program Input mode


INSTRUCTIONS

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 Operand Explanation Occupied size


.U 16 bits
S Specifies the data to be written to internal registers.
.D 32 bits
Data Move Instructions

Specifies the number of bits to be partially loaded in S (0 to


n 16 bits
16 for .U, and 0 to 32 for .D).

Description of Operation
PLDA(.U) S For bit data
When the execution condition is ON, the n bits from S are stored to the 16-bit
internal register. For the unspecified high bits side, 0 is stored.

S 16-bit internal register


bit bit
15 0

0001111010101010 0000000101010101

S For word data or constant


When the execution condition is ON, the n LSBs of the 16-bit unsigned BIN data in
S are stored in the internal register. For the unspecified high bits side, 0 is stored.

bit S bit bit 16-bit internal register bit


15 0 15 0

0000111101010101 0000000101010101

4-14 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

PLDA.D S For bit data


When the execution condition is ON, the n bits from [ S / S +1] are stored to

ARITHMETIC OPERATION
the 32-bit internal register. For the unspecified high bits side, 0 is stored.
S 32-bit internal register
bit bit
31 0

INSTRUCTIONS
00011110101010101010101010101010 00000001010101010101010101010101

S For word data or constant


When the execution condition is ON, the n LSBs of the 16-bit unsigned BIN data in
[ S / S + 1] are stored in the 32-bit internal register. For the unspecified high bits
side, 0 is stored.
4

Data Move Instructions


S +1 S bit 32-bit internal register bit
31 0

00011101010101010101010101010101 00000001010101010101010101010101

@PLDA.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

CR2009 No change in state


CR2010 ON when the value read from the specified destination is 0. Otherwise, OFF.
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs. Otherwise, OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 DMO
PLDA STA LD CR2002
#8 PLDA R000 #8
常時ON CON
STA DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-15


PSTAPartial store

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


PSTA

PSTA(.U)
PSTA PSTA.D PSTA
Read the specified number
of bits from the internal
Partial store register and store it in the
@PSTA(.U) specified reference
@PSTA
ARITHMETIC OPERATION

@PSTA.D PSTA destination.

Ladder program Input mode


INSTRUCTIONS

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 Operand Explanation Occupied size


.U 16 bits
D Specifies the storage location for the data of internal registers.
.D 32 bits
Data Move Instructions

Specifies the number of bits to be partially stored in D (0 to


n 16 bits
16 for .U, and 0 to 32 for .D).

Description of Operation
PSTA(.U) D For bit data
When the execution condition is ON, the number of bits specified by n from the LSB
of the 16-bit unsigned BIN data stored in the 16-bit internal register is stored starting with
D .

16-bit internal register


D
bit bit
15 0

0000000101010101 0001111010101010

D For word data


When the execution condition is ON, the number of bits specified by n from the LSB
of the 16-bit unsigned BIN data stored in the 16-bit internal register is stored starting with
the LSB of D . The unspecified bits are not written.
bit 16-bit internal register bit bit D bit
15 0 15 0

0000000101010101 0000111101010101

4-16 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

PSTA.D D For bit data


When the execution condition is ON, the number of bits specified by n from the LSB

ARITHMETIC OPERATION
of the 32-bit unsigned BIN data stored in the 32-bit internal register is stored starting with
D .
D

INSTRUCTIONS
bit 32-bit internal register bit
31 0

00000001010101010101010101010101 00011110101010101010101010101010

D For word data


When the execution condition is ON, the number of bits specified by n from the LSB
of the 32-bit unsigned BIN data stored in the 32-bit internal register is stored starting with
4
the LSB of [ / +1]. The unspecified bits are not written.

Data Move Instructions


D D

bit 32-bit internal register bit D +1 D


31 0

00000001010101010101010101010101 00011101010101010101010101010101

@PSTA.□ 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 the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs. Otherwise, OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 DMO
LDA PSTA LD CR2002
#8 LDA R000
Always ON CON
PSTA DM0 #8

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-17


TMINTrimmer capacitor
value storage

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


TMIN

TMIN TMIN
Trimmer capacitor value
Inputs numerical values set by the
digital trimmer capacitor in the
storage access window to an internal
@TMIN TMIN
register.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition n
TMIN STA.D
INSTRUCTIONS

T M I N n

Execution condition n
TMIN STA.D @ T M I N n

Operand Explanation Occupied size


Specifies the digital trimmer No. (0 to 7).*1 16 bits
4

*1 The value of the low-order 3 bits will be used.


Data Move Instructions

Description of Operation
TMIN When the execution condition is ON, the value of the digital trimmer is stored to the 32-bit
internal register.
For details on the functions and how to operate the digital trimmer in the access window,
see "Access Window" in the User's Manual of the CPU unit used.

·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
4294967295 4294967295 device

Reference Each of the upper limit can be set to digital trimmers.


KV-8000/7500/7300/5500/5000/3000 Open "CPU System Setting" -> "Digital Trigger Upper Limit
Setting" from the 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
3 CM1707 CM1706
4 CM1709 CM1708
5 CM1711 CM1710
6 CM1713 CM1712
7 CM1715 CM1714

@TMIN This instruction is executed for one scan at the rising edge of the execution condition.

4-18 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the value captured from the digital trimmer is "0". Otherwise, OFF.
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
"CR/CM List", page A-43

Data Move Instructions


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 T0. STA.D T0
CR2002 #0 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-19


DWData move

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


DW

DW(.U)
DW.S
DW.D
DW DW.L
DW.F
DW
ARITHMETIC OPERATION

DW.DF
Write data Store the constants to the reference
@DW(.U) memory destination.
@DW.S
INSTRUCTIONS

@DW.D
@DW @DW.L
@DW.F
DW

@DW.DF

4
Ladder program Input mode
Execution condition S
DW D W S D
Data Move Instructions

Execution condition S
DW @ D W S D
D
Operand Explanation Occupied size
S Specifies the constant to store.*1 —
.U .S 16 bits
D Specifies the storage location for the constant. .D .L .F 32 bits
.D 64 bits

*1 Only constants and variables / labels set as constants can be specified.

4-20 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Description of Operation

ARITHMETIC OPERATION
DW(.U) When the execution condition is ON, 16-bit unsigned BIN data specified by S is
stored to D .

INSTRUCTIONS
S D
1234 1234
16-bit
(1 word)

DW.S When the execution condition is ON, 16-bit signed BIN data specified by S is stored
to D .

S D 4
−1234 −1234

Data Move Instructions


16-bit
(1 word)

DW.D When the execution condition is ON, the 32-bit unsigned BIN data specified by S is
stored to [ D / D +1].

S D +1 D
12345678 12345678
32-bit
(2 words)

DW.L When the execution condition is ON, 32-bit signed BIN data specified by S is stored
to [ D / D +1].

S D +1 D
−12345678 −12345678
32-bit
(2 words)

DW.F When the execution condition is ON, single precision floating point type real number
specified by S is stored to [ D / D +1].

S D +1 D

+1.2345 +1.2345
32-bit
(2 words)

DW.DF When the execution condition is ON, double precision floating point type real number
specified by S is stored to [ D / D +1/ D +2/ D +3].

S D +3 D +2 D +1 D
+1.23456789 +1.23456789
64-bit (4 words)

@DW.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-21


Data Move Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

ON when the indirect specification or index modification range is inappropriate, or an access


outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


4 KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Data Move Instructions

"CR/CM List", page A-43

Sample Program
When input relay R000 turns ON, #100 is stored to data memory DM0.
(Mnemonics list)
R000 #100
DW LDP R000
DM0 DW #100 DM0

4-22 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Data Move Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-23


BMOVBlock move from move
source to move
destination

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


BMOV

BMOV(.U)
BMOV
BMOV
BMOV.D
Moves 16/32-bit data
Block
in blocks to the
@BMOV(.U) move
reference destination.
@BMOV
BMOV
ARITHMETIC OPERATION

@BMOV.D

Ladder program Input mode


INSTRUCTIONS

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

4 Operand Explanation Occupied size


.U 16 bits× n
S Specifies the start of the move source data block.
.D 32 bits× n
Data Move Instructions

.U 16 bits× n
D Specifies the start of the move destination data block.
.D 32 bits× n
Specifies the number of data items to move (1 to 65535: 16-bit
n 16 bits
unsigned BIN)

Description of Operation
BMOV(.U) When the execution condition is ON, the content of n words starting from S is
moved in a block to n words starting from D .
S Transfer D
S +1 Transfer D +1

S +2 Transfer D +2
...

...

...

S + n -2 Transfer D + n -2

S + n -1 Transfer D + n -1

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

BMOV.D When the execution condition is ON, the content of n ×2 words starting from [ S /
S +1] is moved in a block to n ×2 words starting from [ D / D +1].

ARITHMETIC OPERATION
[ S ・ S +1] Transfer [ D ・ D +1]
[ S +2・ S +3] Transfer [ D +2・ D +3]

...
...

...
[ S ・
+2(n−2) S +2(n−2)+1] Transfer [ D ・
+2(n−2) D +2(n−2)+1]
[ S ・
+2(n−1) S +2(n−1)+1] Transfer [ D ・
+2(n−1) D +2(n−1)+1]

INSTRUCTIONS
Example S :DM100 BMOV.D
D :EM5 DM100 EM5 #3
n :For #3

4
Transfer source device Transfer destination device
Higher bit Lower bit Higher bit Lower bit

DM101: 0001 2345 :DM100 EM6: 0001 2345 :EM5


DM103: 0012 3456 :DM102 EM8: 0012 3456 :EM7

Data Move Instructions


DM105: 0123 4567 :DM104 EM10: 0123 4567 :EM9
16-bit 16-bit
(1word) (1word)

@BMOV.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • Data blocks at the move source and move destination will be moved successfully evenif
they are partially duplicated.
• Specifying an excessively large value for n will considerably lengthen the scan
time.

Operation flag

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 a value other than the constant is specified for n , and move source or
move destination exceeds the device or work area range
CR2012 - When n =0
- When an access outside the operand range occurs
• It will not change when n is a constant, indirect specification or index modification
is not used, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-25


FMOVBatch
source movedestination
to move from move

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


FMOV

FMOV(.U)
FMOV.S
FMOV.D
FMOV
FMOV
FMOV.L
FMOV.F
ARITHMETIC OPERATION

FMOV.DF
Moves 16/32/64-bit
Batch
data to the reference
@FMOV(.U) move
destination in batch.
@FMOV.S
INSTRUCTIONS

@FMOV.D
@FMOV
FMOV
@FMOV.L
@FMOV.F
@FMOV.DF

Ladder program Input mode

4 Execution condition FMOV


S D n F M O V S D n
Data Move Instructions

Execution condition FMOV


S D n @ F M O V S D n

Operand Explanation Occupied size


.U .S 16 bits
S Specifies the move source data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits× n
D Specifies the start of the move destination data block. .D .L .F 32 bits× n
.DF 64 bits× n
Specifies the number of data items to move (0 to 65535: 16-bit
n 16 bits
unsigned BIN)

Description of Operation
FMOV(.U) When the execution condition is ON, 16-bit unsigned BIN data currently stored in S
is stored to n words starting from D .

4-26 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

FMOV.S When the execution condition is ON, 16-bit signed BIN data currently stored in S is
stored to n words starting from D .

ARITHMETIC OPERATION
D
D +1

D +2

INSTRUCTIONS
...
S
D + n -3

D + n -2

D + n -1

Example S
D
:DM100
:EM104
FMOV
DM100 EM104 #5 4
n :For #5

Data Move Instructions


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, 32-bit unsigned BIN data currently stored in [ S /
S +1] is moved to n ×2 words starting from [ D / D +1].

FMOV.L When the execution condition is ON, 32-bit signed BIN data currently stored in [ S /
S +1] is moved to n ×2 words starting from [ D / D +1].
[ D ・ D +1]

[ D +2・ D +3]

[ D +4・ D +5]
...

[ S ・ S +1]

[ D +2(n−3)・ D +2(n−3)+1]

[ D +2(n−2)・ D +2(n−2)+1]

[ D +2(n−1)・ D +2(n−1)+1]

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-27


Data Move Instructions

FMOV.F When the execution condition is ON, single precision floating point type real number
stored in S is moved to n ×2 words starting from D .
ARITHMETIC OPERATION

Example FMOV.F
S : DM100
DM100 DM200 #5
D : DM200
INSTRUCTIONS

n : For #5
D +1 D
DM201: +1.234 :DM200

S +1 S DM203: +1.234 :DM202

DM101: +1.234 :DM100 DM205: +1.234 :DM204

4
32-bit DM207: +1.234 :DM206
(2 words)
DM209: +1.234 :DM208
32-bit
Data Move Instructions

(2 words)

FMOV.DF When the execution condition is ON, double precision floating point type real number
stored in S is moved to n ×4 words starting from D .

Example FMOV.DF
S : DM100
DM100 DM200 #5
D : DM200
n : For #5
D +3 D +2 D +1 D
DM203: +1.23456789 :DM200

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.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point Specifying an excessively large value for n will considerably lengthen the scan time.

Operation flag

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 a value other than the constant is specified for n , and move destination
exceeds the device or work area range
CR2012 - When n =0
- When an access outside the operand range occurs
• It will not change when n is a constant, indirect specification or index modification
is not used, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-28 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Sample Program

ARITHMETIC OPERATION
When input relay R000 turns ON, "0" is stored to data memories DM0 to DM99.
(Mnemonics list)
R000 FMOV
#0 DM0 #100 LD R000

INSTRUCTIONS
FMOV #0 DM0 #100

Data Move Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-29


PMOVMove continuous bit
information to the
specified bit position

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


PMOV

PMOV(.U) PMOV

PMOV PMOV.D
Partial
Moves any continuous bit
information to the specified
PMOV move bit position of the reference
@PMOV(.U)
@PMOV
ARITHMETIC OPERATION

@PMOV.D destination.
INSTRUCTIONS

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

Operand Explanation Occupied size


Data Move Instructions

.U 16 bits
S Specifies the move source data.
.D 32 bits
Specifies the bit position of the move source.
When the suffix is .U, 0 to 15 is specified as the value of n1 ; when
the suffix is .D, 0 to 31 is specified as the value of n1 .
For constants
When suffix is .U: The value is the LSB when "0" and the MSB
when "15".
n1 When suffix is .D: The value is the LSB when "0" and the MSB 16 bits
when "31".
For non-constants
The following values will be used when the value of n1 is
out of the range of 0 to 15 or 0 to 31.
When the suffix is .U: The value of the low-order 4 bits is used.
When the suffix is .D: The value of the low-order 5 bits is used.
.U 16 bits
D Specifies the move destination.
.D 32 bits
Specifies the bit position of the move destination.
When the suffix is .U, 0 to 15 is specified as the value of n2 ; when
the suffix is .D, 0 to 31 is specified as the value of n2 .
For constants
When suffix is .U: The value is the LSB when "0" and the MSB
when "15".
n2 When suffix is .D: The value is the LSB when "0" and the MSB 16 bits
when "31".
For non-constants
The following values will be used when the value of n2 is
out of the range of 0 to 15 or 0 to 31.
When the suffix is .U: The value of the low-order 4 bits is used.
When the suffix is .D: The value of the low-order 5 bits is used.
Specifies the number of bits to move.
n3 When suffix is .U: A number within the range 1 to 16 can be specified. 16 bits
When suffix is .D: A number within the range 1 to 32 can be specified.

4-30 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Description of Operation

ARITHMETIC OPERATION
PMOV(.U) When the execution condition is ON, n3 bits from the n1 th bit of S are moved
to the ( n2 + n3 -1)th bit from the n2 th bit of D . Original values are saved for
bits of sections where bits are not moved to.

INSTRUCTIONS
n3
bit bit
15 0

n1

bit
15
bit
0
4
D

Data Move Instructions


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

PMOV.D When the execution condition is ON, n3 bits from the n1 th bit of [ S / S +1]
are moved to the ( n2 + n3 -1)th bit from the n2 th bit of [ D / D +1].
Original values are saved for bits of sections where bits are not moved to.
n3
bit bit bit bit
31 16 15 0

[ S ・ S +1]

n1

bit bit bit bit


31 16 15 0

[ D ・ D +1]

n2

Example Execution 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.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-31


Data Move Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

When suffix is .U ON when n3 =0 or 16< n1 + n3 or 16< n2 + n3 .


Otherwise it is OFF.
When suffix is .D ON when n3 =0 or 32< n1 + n3 or 32< n2 + n3 .
Otherwise it is OFF.
ON when the indirect specification or index modification range is inappropriate, or an access
CR2012
outside the operand range occurs; Otherwise OFF.

4 It will not change when all of n1 , n2 and n3 are constants, and indirect specification
or index modification is not specified for S and D , and the access outside the operand
range is not checked.
Data Move Instructions

"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-32 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Sample Program

ARITHMETIC OPERATION
When input relay R000 is ON, 8 bits from the 4th bit of DM100 are moved to the 9th bit from the 2nd bit
of DM200.
(Mnemonics list)

INSTRUCTIONS
R000 PMOV
DM100 #4 DM200 LD R000
PMOV DM100 #4 DM200 #2 #8
#2 #8

Data Move Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-33


BYLMOVSwitch
and low-order, high-order
and move
data destination
move from move source to

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


BYLMOV

BYLMOV
BYLMOV Moves any continuous byte
Byte
information to the specified
sequence
byte position of the reference
move
@BYLMOV
BYLMOV destination in order from the
(L→H)
ARITHMETIC OPERATION

low-order byte.

Ladder program Input mode


INSTRUCTIONS

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

Operand Explanation Occupied size


Specifies the start of the move source byte sequence.*1 8 bits×( n1 + n3 +1)
Data Move Instructions

S
Specifies the byte position of the move source (starting from the
n1 low-order byte of S ). 16 bits
Specifiable range is 0 to 65535.
Specifies the start of the move destination (byte sequence storage
D 8 bits×( n1 + n3 +1)
location).*1
Specifies the byte position of the move destination (starting from
n2 the low-order byte of D ). 16 bits
Specifiable range is 0 to 65535.
Specifies the number of bytes to move.
n3 16 bits
Specifiable range is 1 to 65535.

*1 When specifying bit data, specify the start of the channel.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
BYLMOV When the execution condition is ON, n3 bytes from the n1 th byte of S

(counting from the low-order byte) are moved to the ( n2 + n3 - 1)th byte from the
n2 th byte of D (counting from the low-order byte). The original values are saved
in the bytes where data is not moved.

@BYLMOV Only one scan is executed at the rising edge of the execution conditions.

4-34 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Example The following operation takes place when n1 =3, n2 =0 and n3 =6.

ARITHMETIC OPERATION
Move start position n1
Move source data Data to move
Position 0
bit bit
15 0

INSTRUCTIONS
S A(41H) B(42H) S +1 C(43H) D(44H)
S +1 C(43H) D(44H) S +2 E(45H) 1(31H)
S +2 E(45H) 1(31H) Number of S +3 2(32H) 3(33H)
S +3 2(32H) 3(33H) move bytes n3 S +4 F(46H) G(47H)
S +4 F(46H) G(47H)

4
7(37H) S(53H)
T(54H) 8(38H)

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 one of the following conditions is established. Otherwise, OFF
• When the specified operand is out of range
• When specified device is not within indirect specification or index modification range
• When bit data other than the timer, counter or start of the channel is specified for S or
CR2012
D
• When n3 is 0
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 turns ON, data in the 4th byte to 8th byte counting from the low-order byte
ofDM100 is moved to the 2nd byte and following counting from the low-order byte.
(Mnemonics list)
R000 BYLMOV
DM100 #4 DM200 LD R000
BYLMOV DM100 #4 DM200 #2 #8
#2 #8

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-35


BYBMOVSwitch low-order
and high-order, and move
data from move source to
move destination

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


BYBMOV

Moves any continuous byte


BYBMOV
BYBMOV
Byte
information to the specified
sequence
byte position of the reference
move
@BYBMOV
BYBMOV
destination in order from the
(H→L)
ARITHMETIC OPERATION

high-order byte.

Ladder program Input mode


INSTRUCTIONS

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
n2 n3 n2 n3

4 Operand Explanation Occupied size


S Specifies the start of the move source byte sequence.*1 8 bits×( n1 + n3 +1)
Data Move Instructions

Specifies the byte position of the move source (starting from the
n1 high-order byte of S ). 16 bits
Specifiable range is 0 to 65535.
Specifies the start of the move destination (byte sequence storage
D 8 bits×( n1 + n3 +1)
location).* 1
Specifies the byte position of the move destination (starting from
n2 the high-order byte of D ). 16 bits
Specifiable range is 0 to 65535.
Specifies the number of bytes to move.
n3 16 bits
Specifiable range is 1 to 65535.

*1 When specifying bit data, specify the start of the channel.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
BYBMOV When the execution condition is ON, n3 bytes from the n1 th byte of S

(counting from the high-order byte) are moved to the ( n2 + n3 - 1)th byte from the
n2 th byte of D (counting from the high-order byte). The original values are saved
in the bytes where data is not moved.

4-36 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

@BYBMOV This instruction is executed for one scan at the rising edge of the execution condition.

The following operation takes place when n1 =3, n2 =0 and n3 =6.

ARITHMETIC OPERATION
Example

Position 0
Move start
Move source data position n1 Data to move

INSTRUCTIONS
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 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 one of the following conditions is established. Otherwise, OFF
• When the specified operand is out of range
• When specified device is not within indirect specification or index modification range
• When bit data other than the timer, counter or start of the channel is specified for S or
CR2012
D
• When n3 is 0
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 turns ON, data in the 4th byte to 8th byte counting from the high-order byte
ofDM100 is moved to the 2nd byte and following counting from the high-order byte.
(Mnemonics list)
R000 BYBMOV
DM100 #4 DM200 LD R000
BYBMOV DM100 #4 DM200 #2 #8
#2 #8

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-37


BBMOV Moves the bit data
in blocks to the
reference destination

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


BBMOV

BBMOV
BBMOV

Bit Moves the bit data in blocks


block move to the reference destination.
@BBMOV
BBMOV
ARITHMETIC OPERATION
INSTRUCTIONS

Ladder program Input mode


Execution condition BBMOV
S D n B B M O V S D n

Execution condition BBMOV


S D n @ B B M O V S D n

4 Operand Explanation
n
Occupied area
S Specifies the start of the move source data block. bits
Data Move Instructions

D Specifies the start of the move source data block. n bits


Specifies the number of data items to move. 32 bits
n
(1 to 4294967295: unsigned 32-bit BIN)

Point The BBMOV instruction can be used only with KV-8000 with CPU function version
2.0 or later.

Description of Operation
BBMOV When the execution condition is ON, the content of [ n / n +1] bits starting from
S is moved in a block to n bits starting from D .

Example S =DM10
S =EM10.5
n =10

DM10
bit15 bit0

EM10
bit15 bit0

Operation flag

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 a value other than the constant is specified for n , and move source or move
destination exceeds the device or work area range
CR2012
• When n =0
• When an access outside the operand range occurs
It will not change when n is a constant, indirect specification or index modification is not
used, and the access outside the operand range is not checked.

4-38 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Move Instructions

Sample Program

ARITHMETIC OPERATION
Move the contents of Axis1 to Axis2.

MR000 BSIZE ;(Mnemonics list)


Axis1 SizeOfBit

INSTRUCTIONS
LDP MR000
BSIZE Axis1 SizeOfBit
BBMOV
Axis1 Axis2 SizeOfBit
BBMOV Axis1 Axis2 SizeOfBit

Data Move Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-39


Arithmetic/Comparison
Instructions
ADD 16/32-bit binary data
addition

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


ADD

ADD(.U)
ADD.S
ADD.D
ADD ADD.L
ADD.F
ADD
Adds the value specified by the
ARITHMETIC OPERATION

ADD.DF
operand to the value of the
Add internal register, and stores the
@ADD(.U) result again to the internal
@ADD.S
INSTRUCTIONS

register.
@ADD.D
@ADD @ADD.L
@ADD.F
ADD

@ADD.DF

4
Ladder program Input mode
Execution condition S

LDA ADD STA A D D S ( + S )
Arithmetic/Comparison Instructions

Execution condition S
LDA ADD STA @ A D D S ( @ + S )※
*For KV-1000 CPU unit, description
can be omitted.
Operand Explanation Occupied size
.U .S 16 bits
S Specifies the addition data. .D .L .F 32 bits
.DF 64 bits

Description of Operation
ADD(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S and
the unsigned data of the 16-bit internal register are added, and the result is stored to 16-bit
internal register again.

16-bit internal register S 16-bit internal regist

1234 + 4321 = 5555


16-bit 16-bit 16-bit
(1 word)

An overflow occurs if the operation result is greater than 65535.


ADD.S When the execution condition is ON, the 16-bit signed BIN data specified by S and
the signed data of the 16-bit internal register are added, and the result is stored to 16-bit
internal register again.

16-bit internal register S 16-bit internal regist

1234 + −4321 = −3087


16-bit 16-bit 16-bit
(1 word)

An overflow occurs if the operation result is greater than +32767.


An underflow occurs if the operation result is smaller than -32768.

4-40 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

ADD.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /
S +1] and the unsigned data of the 32-bit internal register are added, and the result is

ARITHMETIC OPERATION
stored to 32-bit internal register again.

32-bit internal register S +1 S 32-bit internal register

1234 5678 + 8765 4321 = 9999 9999

INSTRUCTIONS
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, the 32-bit signed BIN data specified by [ S /
S +1] and the signed data of the 32-bit internal register are added, and the result is
stored to 32-bit internal register again.

32-bit internal register S +1 S 32-bit internal register


4

Arithmetic/Comparison Instructions
1234 5678 + −8765 4321 = −7530 8643
32-bit 32ビット 32-bit
(2ワード)

An overflow occurs if the operation result is greater than +2147483647.


An underflow occurs if the operation result is smaller than -2147483648.

ADD.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.

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)

ADD.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.

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)

@ADD.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The ADD and @ADD instructions perform operation in BIN. When values stored
to internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-41


Arithmetic/Comparison Instructions

Operation flag
ARITHMETIC OPERATION

ON if the operation results exceed 16/32 bits (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Otherwise,
OFF.
INSTRUCTIONS

CR2010 ON when the operation result is "0". Otherwise, OFF.


CR2011 No change in state
• For suffix "U/S/D/L"
- ON when the indirect specification or index modification range is inappropriate, or an
access outside the operand range occurs; Otherwise OFF.
- It will not change when indirect specification or index modification is not specified in the

4 operand, and the access outside the operand range is not checked.
• For suffix "F"
- ON when the indirect specification or index modification range is inappropriate, the
CR2012
Arithmetic/Comparison Instructions

operation data is not within the single precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
- ON when the indirect specification or index modification range is inappropriate, the
operation data is not within the double precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-42 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Sample Program

ARITHMETIC OPERATION
Each time that input relay R000 turns ON, the constant 100 is added to DM0, and the result is stored
toDM100.
(Mnemonics list)

INSTRUCTIONS
R000 DM0 #100 DM100
LDA ADD STA LDP R000
LDA DM0
CON
ADD #100
CON
STA DM100

Each time input relay R000 turns ON, the constant -100 is added to DM0, and the result is stored to
DM110.
4

Arithmetic/Comparison Instructions
(Mnemonics list)
R001 DM100 −100 DM110
LDA.S ADD.S STA.S LDP R001
LDA.S DM100
CON
ADD.S -100
CON
STA.S DM110

Each time input relay R002 turns ON, the constant 100000 is added to [DM200/DM201],
and the result is stored to [DM210/DM211].
(Mnemonics list)
R002 DM200 #100000 DM210
LDA.D ADD.D STA.D LDP R002
LDA.D DM200
CON
ADD.D #100000
CON
STA.D DM210

Each time that input relay R003 turns ON, the constant -100000 is added to [DM300/DM301], and the
result is stored to [DM310/DM311].
(Mnemonics list)
R003 DM300 −100000 DM310
LDA.L ADD.L STA.L LDP R003
LDA.L DM300
CON
ADD.L -100000
CON
STA.L DM310

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-43


SUB 16/
32-bit binary data subtraction

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


SUB

SUB(.U)
SUB.S
SUB.D
SUB SUB.L
SUB.F
SUB
Subtracts the value specified by
ARITHMETIC OPERATION

SUB.DF
the operand from the value of the
Subtract internal register, and stores the
@SUB(.U) result again to the internal
@SUB.S
INSTRUCTIONS

register.
@SUB.D
@SUB @SUB.L
@SUB.F
SUB

@SUB.DF

4
Ladder program Input mode
Execution condition S

LDA SUB STA S U B S ( − S )
Arithmetic/Comparison Instructions

Execution condition S
LDA SUB STA @ S U B S ( @ − S )※
*For KV-1000 CPU unit, description
can be omitted.
Operand Explanation Occupied size
.U .S 16 bits
S Specifies the subtraction data. .D .L .F 32 bits
.DF 64 bits

Description of Operation
SUB(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S is
subtracted from the unsigned data of the 16-bit internal register, and the result is stored to
16-bit internal register again.

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 smaller than 0.


SUB.S When the execution condition is ON, the 16-bit signed 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.


An underflow occurs if the operation result is smaller than -32768.

4-44 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

SUB.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /
S +1] is subtracted from the unsigned data of the 32-bit internal register, and the

ARITHMETIC OPERATION
result is stored to 32-bit internal register again.

32-bit internal register S +1 S 32-bit internal register

99999999 12345678 = 87654321

INSTRUCTIONS
32-bit 32-bit 32-bit
(2 words)

An underflow occurs if the operation result is smaller than 0.

SUB.L When the execution condition is ON, the 32-bit signed BIN data specified by [ S /
S +1] is subtracted from the signed data of the 32-bit internal register, and the result
is stored to 32-bit internal register again.

32-bit internal register S +1 S 32-bit internal register


4

Arithmetic/Comparison Instructions
87654321 −12345678 = 99999999
32-bit 32-bit 32-bit
(2 words)

An overflow occurs if the operation result is greater than +2147483647.


An underflow occurs if the operation result is smaller than -2147483648.

SUB.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.

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)

SUB.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.

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)

@SUB.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The SUB and @SUB instructions perform operation in BIN. When values stored
to internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-45


Arithmetic/Comparison Instructions

Operation flag
ARITHMETIC OPERATION

ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Other wise
,OFF.
INSTRUCTIONS

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, or an
access outside the operand range occurs; Otherwise OFF.
- It will not change when indirect specification or index modification is not specified in the

4 operand, and the access outside the operand range is not checked.
• For suffix "F"
- ON when the indirect specification or index modification range is inappropriate, the
CR2012
Arithmetic/Comparison Instructions

operation data is not within the single precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
- ON when the indirect specification or index modification range is inappropriate, the
operation data is not within the double precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-46 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Sample Program

ARITHMETIC OPERATION
Each time that input relay R000 turns ON, 100 is subtracted from DM0, and the result is stored toDM10.
(Mnemonics list)
R000 DM0 #100 DM10
LDP R000

INSTRUCTIONS
LDA SUB STA
LDA DM0
CON
SUB #100
CON
STA DM10

Each time that input relay R001 turns ON, 100 is subtracted from DM100, and the result is stored
toDM110.
(Mnemonics list)
4
R001 DM100 −100 DM110

Arithmetic/Comparison Instructions
LDA.S SUB.S STA.S LDP R001
LDA.S DM100
CON
SUB.S -100
CON
STA.S DM110

Each time that input relay R002 turns ON, the constant 100000 is subtracted from [DM200/
DM201],and the result is stored to [DM210/DM211].
(Mnemonics list)
R002 DM200 #100000 DM210
LDA.D SUB.D STA.D LDP R002
LDA.D DM200
CON
SUB.D #100000
CON
STA.D DM210

Each time that input relay R003 turns ON, the constant -100000 is subtracted from [DM300/
DM301],and the result is stored to [DM310/DM311].
(Mnemonics list)
R003 DM300 −100000 DM310
LDA.L SUB.L STA.L LDP R003
LDA.L DM300
CON
SUB.L -100000
CON
STA.L DM310

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-47


MUL 16/32-bit binary data
multiplication

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


MUL

MUL(.U)
MUL.S
MUL.D
MUL MUL.L
MUL.F
MUL
Multiplies the value specified by
ARITHMETIC OPERATION

MUL.DF
the operand with the value of the
Multiply internal register, and stores the
@MUL(.U) result again to the internal
@MUL.S
INSTRUCTIONS

register.
@MUL.D
@MUL @MUL.L
@MUL.F
MUL

@MUL.DF

4 Ladder program
Execution condition S
Input mode


LDA MUL STA M U L S ( * S )
Arithmetic/Comparison Instructions

Execution condition S
LDA MUL STA @ M U L S ( @ * S )※
*For KV-1000 CPU unit, description
can be omitted.
Operand Explanation Occupied size
.U .S 16 bits
S Specifies the multiplication data. .D .L .F 32 bits
.DF 64 bits

4-48 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Description of Operation

ARITHMETIC OPERATION
MUL(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S and
the unsigned data of the 16-bit internal register are multiplied, and the result is stored to 32-
bit internal register.

INSTRUCTIONS
The operation result is also divided and stored into TM0 (high-order 16 bits) and 16-bit
internal register (low-order 16 bits).
32-bit internal register

16-bit internal register S 56088


123 × 456 = TM0 16-bit internal register

16-bit 16-bit
(1 word)
56088
32-bit
4

Arithmetic/Comparison Instructions
MUL.S When the execution condition is ON, the 16-bit signed BIN data specified by S and the
signed data of the 16-bit internal register are multiplied, and the result is stored to 32-bit
internal register. The operation result is also divided and stored into TM0 (high-order 16
bits) and 16-bit internal register (low-order 16 bits).
32-bit internal register

16-bit internal register S −15129


−123 × 123 = TM0 TM0 16-bit internal register

16-bit 16-bit −15129


(1 word)
32-bit

MUL.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /
S +1] and the unsigned data of the 32-bit internal register are multiplied, and the
result is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register (low-order 32
bits).

32-bit internal register S +1 S TM1 TM0 32-bit internal register

1234 5678 = 7006652


+

32-bit 32-bit 64-bit


(2 words)

MUL.L When the execution condition is ON, the 32-bit signed BIN data specified by [ S /
S +1] and the signed data of the 32-bit internal register are multiplied, and the result
is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register.

32-bit internal register S +1 S TM1 TM0 32-bit internal register

−1234 5678 = −7006652


+

32-bit 32-bit 64-bit


(2 words)

MUL.F When the execution condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.

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)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-49


Arithmetic/Comparison Instructions

MUL.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
ARITHMETIC OPERATION

type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.

64-bit internal register S +3 S +2 S +1 S 64-bit internal register


INSTRUCTIONS

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)

@MUL.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The MUL and @MUL instructions perform operation in BIN. When values stored
4 to internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
Arithmetic/Comparison Instructions

• Operation can be enabled correctly even if overflow occurs.

Operation flag

ON if the operation results exceed 16/32 bits (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Otherwise,
OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state
• For suffix "U/S/D/L"
- ON when the indirect specification or index modification range is inappropriate, or an
access outside the operand range occurs; Otherwise OFF.
- It will not change when indirect specification or index modification is not specified in the
operand, and the access outside the operand range is not checked.
• For suffix "F"
- ON when the indirect specification or index modification range is inappropriate, the
CR2012
operation data is not within the single precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
- ON when the indirect specification or index modification range is inappropriate, the
operation data is not within the double precision floating point type real number range, and
an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-50 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Sample Program

ARITHMETIC OPERATION
MUL.U
When input relay R000 is ON, the 16-bit unsigned BIN data currently stored in DM0 is multiplied with
the 16-bit unsigned BIN data currently stored in DM1. The result is stored to DM10.

INSTRUCTIONS
When R000 is OFF, the constant 100 is multiplied with DM0. The result is stored to DM10.
The result is stored to [DM10/DM11] when it exceeds the 16-bit range.

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

Arithmetic/Comparison Instructions
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-51


Arithmetic/Comparison Instructions

MUL.S
When input relay R000 is ON, the 16-bit signed BIN data currently stored in DM0 is multiplied with the
ARITHMETIC OPERATION

16-bit signed BIN data currently stored in DM1. The result is stored to DM10.
When R000 is OFF, the constant -100 is multiplied with DM0. The result is stored to DM10. The result is
stored to [DM10/DM11] when it exceeds the 16-bit range.
INSTRUCTIONS

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

4
MUL.S DM1
CON
STA.S DM10
LDB R000
Arithmetic/Comparison Instructions

LDA.S DM0
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-52 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Arithmetic/Comparison Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-53


DIV 16/32-bit binary data
division

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


DIV

DIV(.U)
DIV.S
DIV.D
DIV DIV.L
DIV.F
DIV
ARITHMETIC OPERATION

DIV.DF Divides the value of the internal


register by the value specified by
Divide
@DIV(.U) the operand, and stores the result
@DIV.S again to the internal register.
INSTRUCTIONS

@DIV.D
@DIV @DIV.L
@DIV.F
DIV

@DIV.DF

4 Ladder program
Execution condition S
Input mode

LDA DIV STA D I V S ( / S )※


Arithmetic/Comparison Instructions

Execution condition S
LDA DIV STA @ D I V S ( @ / S )※

*For KV-1000 CPU unit, description


can be omitted.
Operand Explanation Occupied size
.U .S 16 bits
S Specifies the division data. .D .L .F 32 bits
.DF 64 bits

Description of Operation
DIV(.U) When the execution condition is ON, the 32-bit unsigned BIN data stored in TM0 and the
16-bit internal register are divided by the 16-bit unsigned BIN data specified by S ,
and the result (quotient) is stored to the 32-bit internal register and the remainder is
stored to TM1.
The operation result (quotient) is also divided and stored into TM0 (high-order 16 bits)
and 16-bit internal register (low-order 16 bits).
32-bit internal register

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

DIV.S When the execution condition is ON, the 32-bit signed BIN data stored in TM0 and the 16-
bit internal register are divided by the 16-bit signed BIN data specified by S , and the
result (quotient) is stored to the 32-bit internal register and the remainder is stored to
TM1.
The operation result (quotient) is also divided and stored into TM0 (high-order 16 bits)
and 16-bit internal register (low-order 16 bits).
32-bit internal register

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

4-54 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

DIV.D When the execution condition is ON, the 64-bit unsigned BIN data stored in TM0, TM1
and the 32-bit internal register are divided by the 32-bit unsigned BIN data specified by

ARITHMETIC OPERATION
[ S / S +1], and the result (quotient) is stored to 64-bit unsigned BIN data (TM0,
TM1 and 32-bit internal register), and the remainder is stored to TM2 and TM3.
TM1 TM0 32-bit internal register S +1 S TM1 TM0 32-bit internal register

INSTRUCTIONS
12345678 ÷ 100 = 123456
64-bit 32-bit 64-bit
(2 word) TM3 TM2
Remainder: 78
32-bit
(2 word)

DIV.L When the execution condition is ON, the 64-bit signed BIN data stored in TM0, TM1 and
the 32-bit internal register are divided by the 32-bit signed BIN data specified by [
S +1], and the result (quotient) is stored to 64-bit signed BIN data (TM0, TM1 and 32-
S /
4

Arithmetic/Comparison Instructions
bit internal register), and the remainder is stored to TM2 and TM3.
TM1 TM0 32-bit internal register S +1 S TM1 TM0 32-bit internal register

−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 single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are operated, and the result is stored in the 32-bit internal
register.

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)

DIV.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.

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)

@DIV.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The DIV and @DIV instructions perform operation in BIN. When values stored to
internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-55


Arithmetic/Comparison Instructions

Operation flag
ARITHMETIC OPERATION

ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Other wise,
OFF.
INSTRUCTIONS

CR2010 ON when the operation result is "0". Otherwise, OFF.


CR2011 No change in state
• For suffix "U/S/D/L"
- ON when S =0, the indirect specification or index modification range is
inappropriate, and an access outside the operand range occurs; Otherwise OFF.
• For suffix "F"

4 - ON when S =0, the indirect specification or index modification range is


inappropriate, an access outside the operand range occurs, and the operation data is
CR2012
not within the single precision floating point type real number range; Otherwise OFF.
Arithmetic/Comparison Instructions

• For suffix "DF"


- ON when S =0, the indirect specification or index modification range is
inappropriate, an access outside the operand range occurs, and the operation data is
not within the double precision floating point type real number range; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-56 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Sample Program

ARITHMETIC OPERATION
When input relay R000 is ON, #10000 is divided by the unsigned 16-bit BIN data currently stored
toDM0. The result is stored to DM10, and the remainder is stored to DM20.
(Mnemonics list)

INSTRUCTIONS
R000 #10000 DM0 DM10
LDA EXT DIV STA LD R000
MPS
TM1 DM20
LDA STA LDA #10000
CON
EXT
CON
DIV DM0

4
CON
STA DM10
MPP
LDA TM1

Arithmetic/Comparison Instructions
CON
STA DM20

When input relay R001 is ON, the 32-bit signed BIN data currently stored in DM100/DM101 is divided
by the 16-bit signed BIN data currently stored in DM0. The result is stored to DM10/DM11, and the
remainder is stored to DM20.
(Mnemonics list)
R001 DM101 TM0
LDA.S STA.S LD R001
MPS
DM100 DM0 DM10
LDA.S DM101
LDA.S DIV.S STA.L
CON
TM1 DM20 STA.S TM0
LDA.S STA.S MRD
LDA.S DM100
CON
DIV.S DM0
CON
STA.L DM10
MPP
LDA.S TM1
CON
STA.S DM20

■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 16-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
toDM1. The result (quotient) is stored to DM20.

(Mnemonics list)
CR2002 DM0 DM1 DM20
LDA EXT DIV STA LD CR2002
LDA DM0
CON
EXT
CON
DIV DM1
CON
STA DM20

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-57


Arithmetic/Comparison Instructions

■Precautions when using DIV.D DIV.L


ARITHMETIC OPERATION

The DIV.D and DIV.L instructions execute the calculation "64-bit data / 32-bit data".
During calculation of 32-bit data ÷ 32-bit data,
it is necessary to set the temporary data TM1 TM0 32-bit internal register ÷ S +1 S
INSTRUCTIONS

64-bit 32-bit
memoryTM0 and TM1 that store the high- (2 words)

order 32-bit data of 64-bit data to 0 using the


EXT instruction.
"EXT instruction", page 5-44

4 Example 32-bit BIN data currently stored to DM0/DM1 is divided by the 32-bit BIN data currently
stored to [DM10/DM11].
The result (quotient) is stored to [DM20/DM21].
Arithmetic/Comparison Instructions

(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.D EXT.D DIV.D STA.D LD CR2002
LDA.D DM0
CON
EXT.D
CON
DIV.D DM10
CON
STA.D DM20

■When performing multiplication and division operations continuously


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 0to
10000, and stored to DM1.

(Mnemonics list)
CR2002 DM0 #10000 #4000 DM1
LDA MUL DIV STA LD CR2002
LDA DM0
CON
MUL #10000
CON
DIV #4000
CON
STA DM1

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-58 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Arithmetic/Comparison Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-59


INC Increment the target value by 1

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


INC

INC(.U)
INC.S
INC INC.D
INC.L
INC

Increments the specified target


ARITHMETIC OPERATION

Increment
@INC(.U) value by 1.
@INC.S
@INC @INC.D
@INC.L
INC
INSTRUCTIONS

Ladder program Input mode


Execution condition D
INC I N C D ( + + D )

4 Execution condition D
INC @ I N C D ( @ + + D )
Arithmetic/Comparison Instructions

Operand Explanation Occupied size


.U .S 16 bits
D Specifies the target to increment by 1.
.D .L 32 bits

Description of Operation
INC(.U) When the execution condition is ON, the 16-bit unsigned BIN data of D is
incremented by 1, and the result is stored to D .
An overflow occurs if the operation result is greater than 65535.
(When the count before the operation is 65535, the count becomes 0, and an overflow
occurs.)

INC.S When the execution condition is ON, the 16-bit signed BIN data of D is incremented
by 1, and the result is stored to D .
An overflow occurs if the operation result is greater than +32767.
(When the count before the operation is +32767, the count becomes -32768, and an
overflow occurs.)

INC.D When the execution condition is ON, the 32-bit unsigned BIN data of [ D / D +1] is
incremented by 1, and the result is stored to [ D / D +1].
An overflow occurs if the operation result is greater than 4294967295.
(When the count before the operation is 4294967295, the count becomes 0, and an
overflow occurs.)

INC.L When the execution condition is ON, the 32-bit signed BIN data of [ D / D +1] is
incremented by 1, and the result is stored to [ D / D +1].
An overflow occurs if the operation result is greater than +2147483647.
(When the count before the operation is +2147483647, the count becomes -2147483648,
and an overflow occurs.)

@INC.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The INC and @INC instructions perform operation in BIN. When values stored to
internal register are BCD, convert these values to BIN by the TBIN instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

4-60 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Reference When the INC instruction is executed at every scan, the bits are incremented at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge

ARITHMETIC OPERATION
of the execution condition, use the differential type instruction as follows.
16-bit data

INSTRUCTIONS
DM0
INC
DM0
INC
R1000 R1000 DM0
DIFU INC

32-bit data
DM0
INC.D
4

Arithmetic/Comparison Instructions
DM0
INC.D
R1000 R1000 DM0
DIFU INC.D

"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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-61


Arithmetic/Comparison Instructions

Sample Program
ARITHMETIC OPERATION

The total of input relays R000 to R003 is counted, and the result is stored to DM0.
(Mnemonics list)
R000 DM0
LDP R000
INSTRUCTIONS

INC
INC DM0
LDP R001
R001 DM0
INC DM0
INC LDP R002
INC DM0
R002 DM0 LDP R003
INC INC DM0

4 R003 DM0
INC
Arithmetic/Comparison Instructions

4-62 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Arithmetic/Comparison Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-63


DEC Decrement the target
value by 1

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


DEC

DEC(.U)
DEC.S
DEC DEC.D
DEC.L
DEC

Decrements the specified target


ARITHMETIC OPERATION

Decrement
@DEC(.U) value by 1.
@DEC.S
@DEC @DEC.D
@DEC.L
DEC
INSTRUCTIONS

Ladder program Input mode


Execution condition D
DEC D E C D (− − D )

4 Execution condition D
DEC @ D E C D ( @ − − D )
Arithmetic/Comparison Instructions

Operand Explanation Occupied size


.U .S 16 bits
D Specifies the target to decrement by 1.
.D .L 32 bits

Description of Operation
DEC(.U) When the execution condition is ON, the 16-bit unsigned BIN data of D is
decremented by 1, and the result is stored to D .
An underflow occurs if the operation result is smaller than 0.
(When the count before the operation is 0, the count becomes 65535, and anoverflow
occurs.)

DEC.S When the execution condition is ON, the 16-bit signed BIN data of D is decremented
by 1, and the result is stored to D .
An underflow occurs if the operation result is smaller than -32768.
(When the count before the operation is -32768, the count becomes+32767, and an
underflow occurs.)

DEC.D When the execution condition is ON, the 32-bit unsigned BIN data of [ D / D +1] is
decremented by 1, and the result is stored to [ D / D +1].
An underflow occurs if the operation result is smaller than 0.
(When the count before the operation is 0, the count becomes 4294967295, and an
overflow occurs.)

DEC.L When the execution condition is ON, the 32-bit signed BIN data of [ D / D +1] is
decremented by 1, and the result is stored to [ D / D +1].
An underflow occurs if the operation result is smaller than -2147483648.
(When the count before the operation is -2147483648, the count becomes +2147483647,
and an overflow occurs.)

@DEC.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The DEC and @DEC instructions perform decrementing in BIN. When values
stored to internal register are BCD, convert these values to BIN by the TBIN
instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.
4-64 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Arithmetic/Comparison Instructions

Reference When the DEC instruction is executed at every scan, the bits are decremented at each
scan when the execution condition is ON. If it is executed not at each scan but at the rising

ARITHMETIC OPERATION
edge of the execution condition, use the differential type instruction as follows.
16-bit data

INSTRUCTIONS
DM0
DEC
DM0
DEC
R1000 R1000 DM0
DIFU DEC

32-bit data
DM0
DEC.D
4

Arithmetic/Comparison Instructions
DM0
DEC.D
R1000 R1000 DM0
DIFU DEC.D

Operation flag

CR2009 ON when the operation result exceeds the 16/32-bit range. Otherwise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The value of DM0 is decremented by 1 at each respective rising edge of input relays R000, R001
andR002.
(Mnemonics list)
R000 DM0
DEC LDP R000
DEC DM0
LDP R001
R001 DM0 DEC DM0
DEC LDP R002
DEC DM0
R002 DM0
DEC

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-65


ROOT Square root operation

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


ROOT

ROOT(.U)
ROOT.S
ROOT.D
ROOT ROOT.L
ROOT.F
ROOT
ARITHMETIC OPERATION

ROOT.DF Calculates the square root of the


Square
content of the internal registers,
root
@ROOT(.U) and stores the result to the
extraction
@ROOT.S internal register.
INSTRUCTIONS

@ROOT.D
@ROOT @ROOT.L
@ROOT.F
ROOT

@ROOT.DF

4
Ladder program Input mode
Execution condition
LDA ROOT STA R O O T ( S Q R T )
Arithmetic/Comparison Instructions

Execution condition
LDA ROOT STA @ R O O T ( @ S Q R T )

Description of Operation
ROOT(.U) When the execution condition is ON, the square root of the unsigned 32-bit BIN data
currently stored to temporary data memory TM0 and 16-bit internal register is calculated,
and the result is stored again to the 16-bit internal register.
The decimal point and below in the calculation result are discarded.

ROOT.S When the execution condition is ON, the square root of the signed 32-bit BIN data
currently stored to temporary data memory TM0 and 16-bit internal register is calculated,
and the result is stored again to the 16-bit internal register.
The decimal point and below in the calculation result are discarded.

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

4-66 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

ROOT.F When the execution conditions is ON, the square root of the single precision floating point
type real number stored in the 32-bit internal register is calculated.

ARITHMETIC OPERATION
The operation result is stored to the 32-bit internal register as a single precision floating
point type real number.

32-bit internal register 32-bit internal register

INSTRUCTIONS
Single precision floating point type real number Single precision floating point type real number
32-bit 32-bit

ROOT.DF When the execution conditions is ON, the square root of the double precision floating
point type real number stored in the 64-bit internal register is calculated.
The operation result is stored to the 64-bit internal register as a double precision floating
point type real number.
4
64-bit internal register 64-bit internal register

Arithmetic/Comparison Instructions
Double precision floating point type real number Double precision floating point type real number
64-bit 64-bit

@ROOT.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The ROOT and @ROOT instructions perform the square root calculation in BIN.
When values stored to internal register are BCD, convert these values to BIN by
the TBIN instruction.
"TBIN instruction", page 4-160

Operation flag

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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the square root of the unsigned 16-bit BIN data currently stored to DM0is
calculated, and the result is stored to DM10.
(Mnemonics list)
R000 DM0 DM10
LDA EXT ROOT STA LD R000
LDA DM0
CON
EXT
CON
ROOT
CON
STA DM10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-67


POW
Exponentiation

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


POW

POW(.U)
POW.S
POW.D
POW POW.L
POW.F
POW
The internal register value is
ARITHMETIC OPERATION

POW.DF
exponentiated with the value
Exponenti
specified in the operand, and the
@POW(.U) ation
results are stored in the internal
@POW.S
INSTRUCTIONS

register again.
@POW.D
@POW @POW.L
@POW.F
POW

@POW.DF

4
Ladder program Input mode
Execution condition S
LDA POW STA P O W S
Arithmetic/Comparison Instructions

Execution condition S
LDA POW STA @ P O W S

Operand Explanation Occupied size


.U .S 16 bits
S Specifies the exponential data. .D .L .F 32 bits
.DF 64 bits

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000 Series
CPU units that have CPU function version 2.0 or higher and with KV Nano Series base
units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
POW(.U) When the execution condition is ON, the 16-bit unsigned BIN data specified by S and
the unsigned data of the 16-bit internal register are exponentiated, and the result is stored
to 32-bit internal register.
The operation result is also divided and stored into TM0 (high-order 16 bits) and 16-bit
internal register (low-order 16 bits).
32-bit internal register

16-bit internal register S 20736


12 4 TMO 16-bit internal register

16-bit 16-bit 20736


(1 word)
32-bit

An overflow occurs if the operation results are greater than 65535.


POW.S When the execution condition is ON, the 16-bit signed BIN data specified by S and
the signed data of the 16-bit internal register are exponentiated, and the result is stored to
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 TMO 16-bit internal register

16-bit 16-bit -13824


(1 word)
32-bit

An overflow occurs if the operation results are greater than +32767.


4-68 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Arithmetic/Comparison Instructions

An underflow occurs if the operation results are less than -32768.

POW.D When the execution condition is ON, the 32-bit unsigned BIN data specified by [ S /

ARITHMETIC OPERATION
S +1] and the unsigned data of the 32-bit internal register are exponentiated, and the
result is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register (low-order 32
bits).

INSTRUCTIONS
32-bit internal register S +1 S TM1 TM0 32-bit internal register

123 4 228886641
32-bit 32-bit 64-bit
(2 words)

An overflow occurs if the operation results are greater than 4294967295.

POW.L When the execution condition is ON, the 32-bit signed BIN data specified by [ S / 4
S +1] and the signed data of the 32-bit internal register are exponentiated, and the

Arithmetic/Comparison Instructions
result is stored to TM0, TM1 (high-order 32 bits) and 32-bit internal register (low-order 32
bits).

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 condition is ON, the single precision floating point type real number
specified by [ S / S +1] and the single precision floating point type real number of
the 32-bit internal register are exponentiated, and the result is stored in the 32-bit internal
register.

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 condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
type real number of the 64-bit internal register are exponentiated, and the result is stored
in the 64-bit internal register.

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 D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r

64-bit 64-bit 64-bit


(4 words)

@POW.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The POW and @POW instructions perform decrementing in BIN. When values
stored to internal register are BCD, convert these values to BIN by the TBIN
instruction.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-69


Arithmetic/Comparison Instructions

Operation flag
ARITHMETIC OPERATION

ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009 real number (.F) or double precision floating point type real number (.DF) range. Otherwise,
OFF.
INSTRUCTIONS

CR2010 ON when the operation result is "0". Otherwise, OFF.


CR2011 No change in state
For suffix "U/S/D/L":
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modify range is inappropriate
• When a value less than 0 is specified for S

4 • When the operation results exceed the unsigned 32-bit (.U), signed 32-bit (.S), unsigned 64-
bit (.D) or signed 64-bit (.L) range
• When an access outside the operand range occurs
Arithmetic/Comparison Instructions

For suffix "F/DF":


CR2012
ON when 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 type real number (.F) or double precision floating point type real
number (.DF)
• When the internal register value is less than 0 and S is not an integer
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
POW.U
When the input relay R000 is ON, the unsigned 16-bit BIN data stored in the data memory DM0 andthe
unsigned 16-bit BIN data stored in DM2 are exponentiated, and the operation results are stored
in[DM10.DM11].
When R000 is OFF, DM0 is exponentiated with the constant 10, and the operation results are stored
in[DM10.DM11].
(Mnemonics list)
R000 DM0 DM2 DM10
LDA POW STA.D LD R000
R000 DM0 #10 DM10 LDA DM0
CON
LDA POW STA.D
POW DM2
CON
STA.D DM10
LDB R000
LDA DM0
CON
POW #10
CON
STA.D DM10

4-70 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

or
(Mnemonics list)
R000 DM0 DM2 DM10

ARITHMETIC OPERATION
LDA POW STA LD R000
MPS
TM0 DM11
LDA DM0
LDA STA CON
POW DM2

INSTRUCTIONS
R000 DM0 #10 DM10
LDA POW STA CON
STA DM10
TM0 DM11
MPP
LDA STA LDA TM0
CON
STA DM11
LDB R000
MPS
LDA DM0
CON
POW #10
4
CON

Arithmetic/Comparison Instructions
STA DM10
MPP
LDA TM0
CON
STA DM11

POW.S
When the input relay R000 is ON, the signed 16-bit BIN data stored in the data memory DM0 and the
signed 16-bit BIN data stored in DM2 are exponentiated, and the operation results are stored in [DM10/
DM11].
When R000 is OFF, DM0 is exponentiated with the constant 10, and the operation results are stored
in[DM10.DM11].

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-71


CMP Data
comparison

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


CMP

CMP(.U)
CMP.S
CMP.D
CMP CMP.L
CMP.F
CMP
ARITHMETIC OPERATION

CMP.DF
Compares the value currently stored
Data
to the internal register with the
@CMP(.U) comparison
specified BIN data.
@CMP.S
INSTRUCTIONS

@CMP.D
@CMP @CMP.L
@CMP.F
CMP

@CMP.DF

4
Ladder program Input mode
Execution condition S Operation flag
LDA CMP C M P S
Arithmetic/Comparison Instructions

Execution condition S Operation flag


LDA CMP @ C M P S

Operand Explanation Occupied size


.U .S 16 bits
S Specifies the value to compare with the internal register. .D .L .F 32 bits
.DF 64 bits

4-72 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Description of Operation

ARITHMETIC OPERATION
CMP(.U) The sizes of the unsigned 16-bit BIN data currently stored in the 16-bit internal register
and the unsigned 16-bit BIN data currently stored in S are compared. The operation
flag changes as shown in the table below according to the compare result.

INSTRUCTIONS
CMP.S The sizes of the signed 16-bit BIN data currently stored in the 16-bit internal register and
the signed 16-bit BIN data currently stored in S are compared. The operation flag
changes as shown in the table below according to the compare result.

State of Operation
Compare Result
4
Flag
Value of 16-bit internal register is less than S
CR2009→ON
Value of 16-bit internal register < S

Arithmetic/Comparison Instructions
Value of 16-bit internal register is equal to S
CR2010→ON
Value of 16-bit internal register = S
Value of 16-bit internal register is greater than S
CR2011→ON
Value of 16-bit internal register > S

CMP.D When the execution condition is ON, the sizes of the unsigned 32-bit BIN data currently
stored in the 32-bit internal register and the unsigned 32-bit BIN data currently stored in
[ S / S +1] are compared. The operation flag changes as shown in the table below
according to the compare result.

CMP.L The sizes of the signed 32-bit BIN data currently stored in the 32-bit internal register and
the signed 32-bit BIN data currently stored in [ S / S +1] are compared. The
operation flag changes as shown in the table below according to the compare result.

State of Operation
Compare Result
Flag
Value of 32-bit internal register is less than [ S / S +1]
CR2009→ON
Value of 32-bit internal register < [ S / S +1]
Value of 32-bit internal register is equal to [ S / S +1]
CR2010→ON
Value of 32-bit internal register = [ S / S +1]
Value of 32-bit internal register is greater than [ S / S +1]
CR2011→ON
Value of 32-bit internal register > [ S / S +1]

CMP.F When the execution condition is ON, compare the single precision floating point type real
number stored in 32-bit internal register and the specified size of [ S / S +1]. The
operation flag changes as follows according to the compare result.

State of Operation
Compare Result
Flag
Value of 32-bit internal register is less than specified value
CR2009→ON
Value of 32-bit internal register < [ S / S +1]
Value of 32-bit internal register is equal to specified value
CR2010→ON
Value of 32-bit internal register = [ S / S +1]
Value of 32-bit internal register is greater than specified value
CR2011→ON
Value of 32-bit internal register > [ S / S +1]

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-73


Arithmetic/Comparison Instructions

CMP.DF When the execution condition is ON, the double precision floating point type real number
specified by [ S / S +1/ S +2/ S +3] and the double precision floating point
ARITHMETIC OPERATION

type real number of the 64-bit internal register are operated, and the result is stored in the
64-bit internal register.

State of Operation
INSTRUCTIONS

Compare Result Flag


Value of 64-bit internal register is less than specified value
CR2009→ON
Value of 64-bit internal register < [ S / S +1/ S +2/ S +3]
Value of 64-bit internal register is equal to specified value
CR2010→ON
Value of 64-bit internal register = [ S / S +1/ S +2/ S +3]
Value of 64-bit internal register is greater than specified value

4
CR2011→ON
Value of 64-bit internal register > [ S / S +1/ S +2/ S +3]

@CMP.□ This instruction is executed for one scan at the rising edge of the execution condition.
Arithmetic/Comparison Instructions

Reference If a single precision floating point type real number is input as a constant in an operand to
be compared, the number of effective digits which can be input is seven, so the
comparison may not match the actual operation results. In this case, a comparison can be
made by comparing the operation results as an integer in the ladder program.

Operation flag

ON when the value of the internal register is less than the value stored to the specified operand.
CR2009
Otherwise, OFF.
ON when the value of the internal register is the same as the value stored to the specified
CR2010
operand. Otherwise, OFF.
ON when the value of the internal register is greater than the value stored to the specified
CR2011
operand. Otherwise, OFF.
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the comparison data is outside the single precision floating point type real number
range (only when the suffix is "F")
• When the comparison data is outside the double precision floating point type real number
CR2012 range (only when the suffix is "DF")
• When an access outside the operand range occurs
It will not change when the suffix is ".U/.S/.D/.L" and the indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-74 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Sample Program

ARITHMETIC OPERATION
#1000 is compared with the value currently stored to DM0.

CR2002 DM0 #1000 CR2009 R500 (Mnemonics list)


LDA CMP ① LD CR2002

INSTRUCTIONS
LDA DM0
CR2010 R501 CON
② CMP #1000
CON
MPS
CR2011 R502 AND CR2009
③ OUT R500
MRD
AND CR2010
OUT R501
MPP
4
AND CR2011

Arithmetic/Comparison Instructions
OUT R502

(1) DM0<1000: Output relay R500 turns ON when the value is less than #1000.
(2) DM0=1000: Output relay R501 turns ON when the value is equal to #1000.
(3) DM0>1000: Output relay R502 turns ON when the value is greater than #1000.
a b
Reference As shown in LDA CMP , assuming that the internal register is a and the operand is
b, then,
CR2009 CR2010 CR2011
a<b a=b a>b
CR2009 CR2010 CR2011
a≧b a≠b a≦b
.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-75


ZCMP
Range comparison

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


ZCMP

ZCMP(.U)
ZCMP.S
ZCMP.D
ZCMP ZCMP.L
ZCMP.F
ZCMP
ARITHMETIC OPERATION

ZCMP.DF Compares the value


Range currently stored to the
@ZCMP(.U) comparison internal register with the
@ZCMP.S specified range.
INSTRUCTIONS

@ZCMP.D
@ZCMP @ZCMP.L
@ZCMP.F
ZCMP

@ZCMP.DF

4
Ladder program Input mode
Execution condition S1 Operation flag
LDA ZCMP Z C M P S1 S2
Arithmetic/Comparison Instructions

S2

Execution condition S1 Operation flag


LDA ZCMP @ Z C M P S1 S2
S2

Operand Explanation Occupied size


.U .S 16 bits
Specifies the value for determining the range to compare with the
S1 .D .L .F 32 bits
internal register.
.DF 64 bits
.U .S 16 bits
Specifies the value for determining the range to compare with the
S2 .D .L .F 32 bits
internal register.
.DF 64 bits

4-76 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Description of Operation

ARITHMETIC OPERATION
ZCMP(.U) When the execution condition is ON, the sizes of the range specified by S1 , S2 ,
and the unsigned 16-bit BIN data currently stored in the internal register are compared.
The operation flag changes as follows according to the compare result.

INSTRUCTIONS
ZCMP.S When the execution condition is ON, the sizes of the range specified by S1 , S2 ,
and the signed 16-bit BIN data currently stored in the internal register are compared. The
operation flag changes as follows according to the compare result.
State of Operation
Compare Result (when S1 < S2 ) Flag
Value of 16-bit internal register is less than specified range
Value of 16-bit internal register < S1 < S2
CR2009→ON 4
Value of 16-bit internal register is within specified range

Arithmetic/Comparison Instructions
CR2010→ON
S1 ≦ Value of 16-bit internal register ≦ S2
Value of 16-bit internal register is greater than specified range
CR2011→ON
S1 < S2 < Value of 16-bit internal register

* When S2 < S1 , swap S1 and S2 in the above table.

ZCMP.D When the execution condition is ON, the sizes of the range specified by [ S1 / S1 +
1], [ S2 / S2 + 1], and the unsigned 32-bit BIN data currently stored in the 32-bit
internal register are compared.
The operation flag changes as shown in the table below according to the compare result.

ZCMP.L When the execution condition is ON, the sizes of the range specified by [ S1 / S1 +
1], [ S2 / S2 + 1], and the signed 32-bit BIN data currently stored in the 32-bit
internal register are compared.
The operation flag changes as follows according to the compare result.
State of
Compare Result (when [ S1 / S1 +1] < [ S2 / S2 +1]) Operation Flag
Value of 32-bit internal register is less than specified range
CR2009→ON
Value of 32-bit internal register < [ S1 / S1 +1] < [ S2 / S2 +1]
Value of 32-bit internal register is within specified range
CR2010→ON
[ S1 / S1 +1] ≦ Value of 32-bit internal register ≦ [ S2 / S2 +1]
Value of 32-bit internal register is greater than specified range
CR2011→ON
[ S1 / S1 +1] < [ S2 / S2 +1] < Value of 32-bit internal register

* When [ S2 / S2 +1] < [ S1 / S1 +1], swap [ 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.
State of
Compare Result (when [ S1 / S1 +1] < [ S2 / S2 +1]) Operation Flag
Value of 32-bit internal register is less than specified range
CR2009→ON
Value of 32-bit internal register < [ S1 / S1 +1] < [ S2 / S2 +1]
Value of 32-bit internal register is within specified range
CR2010→ON
[ S1 / S1 +1] ≦ Value of 32-bit internal register ≦ [ S2 / S2 +1]
Value of 32-bit internal register is greater than specified range
CR2011→ON
[ S1 / S1 +1] < [ S2 / S2 +1] < Value of 32-bit internal register

* When [ S2 / S2 +1] < [ S1 / S1 +1], swap [ S1 / S1 +1] and [ S2 /


S2 +1] in the above table.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-77


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
ARITHMETIC OPERATION

precision floating point type real number stored in 64-bit internal register.
The operation flag changes as follows according to the compare result.

Compare Result (when [ S1 / S1 +1/ S1 +2/ S1 +3] < State of


INSTRUCTIONS

[ S2 / S2 +1/ S2 +2/ S2 +3]) Operation Flag


Value of 64-bit internal register is less than specified range
Value of 64-bit internal register < [ S1 / S1 +1/ S1 +2/
CR2009→ON
S1 +3] <
[ S2 / S2 +1/ S2 +2/ S2 +3]
Value of 64-bit internal register is within specified range
4 [ S1 / S1 +1/ S1 +2/ S1 +3]≦ Value of 64-bit internal register

CR2010→ON
Arithmetic/Comparison Instructions

[ S2 / S2 +1/ S2 +2/ S2 +3]


Value of 64-bit internal register is greater than specified range
[ S1 / S1 +1/ S1 +2/ S1 +3] <
CR2011→ON
[ S2 / S2 +1/ S2 +2/ S2 +3] < Value of 64-bit internal
register

* When [ S2 / S2 +1/ S2 +2/ S2 +3] < [ S1 / S1 +1/ S1 +2/ S1 +3],


swap [ S1 / S1 +1/ S1 +2/ S1 +3] and [ S2 / S2 +1/ S2 +2/ S2 +3]
in the above table.

@ZCMP.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

ON when the value of the internal register is less than the value specified by the
CR2009
operand.Otherwise, OFF.
ON when the value of the internal register is within the range specified by the specified operand.
CR2010 Otherwise, OFF.
*Including min. and max. boundary values.
ON when the value of the internal register is greater than the range specified by the specified
CR2011
operand. Otherwise, OFF.
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the comparison data is outside the single precision floating point type real number
range (only when the suffix is "F")
• When the comparison data is outside the double precision floating point type real number
CR2012 range (only when the suffix is "DF")
• When an access outside the operand range occurs
It will not change when the suffix is ".U/.S/.D/.L" and the indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-78 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Arithmetic/Comparison Instructions

Sample Program

ARITHMETIC OPERATION
When the value currently stored to data memory DM0 is greater than #2000, output relay R500 turns
ON.
When the value currently stored to DM0 is between #1000 to #2000, R501 turns ON.

INSTRUCTIONS
When the value currently stored to DM0 is less than #1000, R502 turns OFF.

CR2002 DM0 #1000 CR2011 R500 (Mnemonics list)


LDA ZCMP ① LD CR2002
#2000 LDA DM0
CR2010 R501 CON
② ZCMP #1000 #2000

CR2009 R502
CON
MPS
AND CR2011
4
③ OUT R500

Arithmetic/Comparison Instructions
MRD
AND CR2010
OUT R501
MPP
AND CR2009
OUT R502

① 1000<2000<DM0
② 1000≦DM0≦2000
③ DM0<1000<2000

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-79


Logical Operation
nstructions
ANDALogical "AND"
operation of internal

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano register and specified


data.

ANDA

ANDA(.U)
ANDA ANDA.D ANDA Calculates the logical
"AND" of values in internal
AND A
@ANDA(.U) registers and values
@ANDA specified by operands.
ARITHMETIC OPERATION

@ANDA.D ANDA

Ladder program Input mode


INSTRUCTIONS

Execution condition S
LDA ANDA STA A N D A S

Execution condition S
LDA ANDA STA @ A N D A S

4
Operand Explanation Occupied size
.U 16 bits
S Specifies the data to perform the logical "AND" operation.
.D 32 bits
Logical Operation Instructions

Description of Operation

When the execution condition is ON, the logical AND of the BIN data Logical AND truth table
specified by S and the content of the internal register is calcu- Internal register 0 0 1 1
lated, and the result is stored to the internal register. The result of this S 0 1 0 1
operation is "1" only when both the internal register and bits in BIN
Internal register (result) 0 0 0 1
data specified by S are "1".

ANDA(.U) The logical "AND" of the 16-bit BIN data specified by S and the content of the 16-bit
internal register is calculated, and the result is stored to the 16-bit internal register.

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 0000000011111111 ANDA
bit bit
15 0
DM0
16-bit internal register 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 STA

ANDA.D The logical "AND" of the 32-bit BIN data specified by [ S / S +1] and the content of
the 32-bit internal register is calculated, and the result is stored to the 32-bit internal
register.

Example DM0 $00FF00FF DM0


LDA.D ANDA.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
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
DM0
32-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.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-80 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Logical Operation Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Logical Operation Instructions


"CR/CM List", page A-43

Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
(Mnemonics list)
CR2002 R000 $00FF DM0
LDA ANDA STA LD CR2002
LDA R000
CON
ANDA $FF
CON
STA DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-81


ORA
Logical "OR" operation of
internal register and specified
data.

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


ORA

ORA(.U)
ORA ORA.D ORA Calculates the logical "OR"
of values in internal registers
OR A
@ORA(.U) and values specified by
@ORA operands.
ARITHMETIC OPERATION

@ORA.D ORA

Ladder program Input mode


INSTRUCTIONS

Execution condition S
LDA ORA STA O R A S

Execution condition S
LDA ORA STA @ O R A S

4
Operand Explanation Occupied size
.U 16 bits
S Specifies the data to perform the logical "OR" operation.
.D 32 bits
Logical Operation Instructions

Description of Operation

When the execution condition is ON, the logical OR of the BIN data specified by Logical OR truth table
S and the content of the internal register is calculated, and the result is Internal register 0 0 1 1
stored to the internal register.
The result of this operation is "1" only when either or both the internal register S 0 1 0 1
and bits in the BIN data specified by S are "1". Internal register (result) 0 1 1 1

ORA(.U) The logical "OR" of the 16-bit BIN data specified by S and the content of the 16-bit
internal register is calculated, and the result is stored to the 16-bit internal register.

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 0000000011111111 ORA
bit bit
15 0
DM0
16-bit internal register 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 STA

ORA.D The logical "OR" of the 32-bit BIN data specified by [ S / S +1] and the content of
the 32-bit internal register is calculated, and the result is stored to the 32-bit internal
register.

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
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.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-82 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Logical Operation Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Logical Operation Instructions


"CR/CM List", page A-43

Sample Program
The current value of counter C0 is output at 2-digit BCD to output relays R500 to R507.
Note, however, that changing of the states of R508 to R515 must be prevented.
(Mnemonics list)
R000 #99
C0 ① LDB R000
R001 C #0 #99 R001
CR2002 R500 $FF00 DM0 LD CR2002
LDA ANDA STA ② LDA R500
CON
ANDA $FF00
CR2002 C0 $00FF DM0 R500 CON
LDA TBCD ANDA ORA STA ③ STA DM0
LD CR2002
LDA C0
CON
(1) Set counter C0. TBCD
CON
(2) Store R508 to R515 of output relay to DM0. ANDA $FF
(3) Perform BCD conversion to the current value of C0, and save CON
ORA DM0
the data of low-order 2 bits of BCD to 16-bit internal register. CON
Perform OR operation (logical "OR") for 16-bit internal register STA R500
and DM0, and then output to R500 to R515.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-83


EORALogical "Exclusive
operation of OR"
internal
register
data. and specified

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


EORA

EORA(.U)
EORA EORA.D EORA
Exclusive OR
Calculates the logical
"Exclusive OR" of values in
@EORA(.U) operation internal registers and values
@EORA specified by operands.
ARITHMETIC OPERATION

@EORA.D EORA

Ladder program Input mode


INSTRUCTIONS

Execution condition S
LDA EORA STA E O R A S
( X O R A S 、X O R S )
Execution condition S
LDA EORA STA @ E O R A S
( @ X O R A S 、@ X O R S )

4 Operand Explanation

Specifies the data to perform the logical "Exclusive OR" operation.


.U 16 bits
Occupied size

S
.D 32 bits
Logical Operation Instructions

Description of Operation
When the execution condition is ON, the logical exclusive OR of the BIN data
Logical XOR truth table
specified by S and the content of the internal register is calculated, and the
Internal register 0 0 1 1
result is stored to the internal register.
S 0 1 0 1
The result of this operation is "1" only when the internal register and bits in the BIN
data specified by S are different. Internal register (result) 0 1 1 0

EORA(.U) The logical "Exclusive OR" of the 16-bit BIN data specified by S and the content of
the 16-bit internal register is calculated, and the result is stored to the 16-bit internal
register.

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 0000000011111111 EORA
bit bit
15 0
DM0
16-bit internal register 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 STA

EORA.D The logical "Exclusive OR" of the 32-bit BIN data specified by [ S / S +1] and the
content of the 32-bit internal register is calculated, and the result is stored to the 32-bit
internal register.

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.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-84 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Logical Operation Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Logical Operation Instructions


"CR/CM List", page A-43

Sample Program
When the setting value currently stored in DM0 matches the ON/OFF state of input relays R30000 to
R30007, output relay R500 is turned ON.

CR2008 $00AA DM0 (Mnemonics list)


LDA STA LD CR2008
LDA $AA
CR2002 R30000 $00FF DM0 CR2010 R500 CON
LDA ANDA EORA STA DM0
LD CR2002
LDA R30000
bit bit CON
15 0
ANDA $FF
$BBBB 1011101110111011 Input relay CON
R30000 to R30015 EORA DM0
bit ANDA bit
15 0 CON
0000000011111111 AND CR2010
$00FF Operand
OUT R500
bit bit
15 0

$00BB 0000000010111011 16-bit internal register


bit EORA bit
15 0

$00AA 0000000010101010 Data Memory DM0


bit bit
15 0

$0011 0000000000010001 16-bit internal register 


→ when CR2010 is OF
when 00000, CR20
ON.

Consistent when CR2010 is ON Consistent judgement between v


of DM0 and output relay
Inconsistent when CR2010 is OFF R30000 to R30007

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-85


E N R A L o g i c a l
"Exclusive NOR"
operation of
internal register

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano and specified data.

ENRA

ENRA(.U)
ENRA ENRA.D ENRA
Exclusive
Calculates the logical
"Exclusive NOR" of values
NOR in internal registers and
@ENRA(.U) operation values specified by
@ENRA
ARITHMETIC OPERATION

@ENRA.D ENRA operands.

Ladder program Input mode


INSTRUCTIONS

Execution condition S
LDA ENRA STA E N R A S
( X N O R A S )
Execution condition S
LDA ENRA STA @ E N R A S
( @ X N O R A S )

4 Operand

S
Explanation

Specifies the data to perform the logical "Exclusive NOR" operation.


Occupied size
.U 16 bits
.D 32 bits
Logical Operation Instructions

Description of Operation
When the execution condition is ON, the logical "Exclusive Logical XNOR truth table
NOR" of the BIN data specified by S and the content of Internal register 0 0 1 1
the internal register is calculated, and the result is stored to S 0 1 0 1
the internal register. The result of the logical "Exclusive NOR" Internal register (result) 1 0 0 1
is "1" when the internal register and bits in the BIN data
specified by S are the same.

ENRA(.U) The logical "Exclusive NOR" of the 16-bit BIN data specified by S and the content of
the 16-bit internal register is calculated, and the result is stored to the 16-bit internal
register.

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 0000000011111111 ENRA
bit bit
15 0
DM0
16-bit internal register 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 STA

ENRA.D The logical "Exclusive NOR" of the 32-bit BIN data specified by [ S / S +1] and the
content of the 32-bit internal register is calculated, and the result is stored to the 32-bit
internal register.

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
上位16ビット 下位16ビット
bit bit
31 0
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.□ This instruction is executed for one scan at the rising edge of the execution condition.
4-86 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Logical Operation Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Logical Operation Instructions


"CR/CM List", page A-43

Sample Program
If even one bit of the setting values currently stored in DM0 matches the ON/OFF state of input relays
R30000 to R30015, output relay R500 is turned ON.
(Mnemonics list)
CR2002 R30000 DM0 CR2010 R500
LDA ENRA LD CR2002
LDA R30000
CON
ENRA DM0
bit bit CON
15 0
ANB CR2010
$5554 0101010101010100 Input relay R30000 to R30015 OUT R500
bit ENRA bit
15 0

$AAAA 1010101010101010 Data Memory DM0


bit bit
15 0

$0001 0000000000000001 16-bit internal register


→ when CR2010 is OFF.

when 00000, CR2010 ON.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-87


COM
Bit inversion

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


COM

COM(.U)
COM COM.D COM
Inverts each of the bits in
Bit inversion
@COM(.U) internal registers.
@COM
ARITHMETIC OPERATION

@COM.D COM

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA COM STA C O M

Execution condition
LDA COM STA @ C O M

4 Description of Operation
Logical Operation Instructions

COM(.U) When the execution condition is ON, each of the bits in 16-bit internal registers is inverted
("0→1", "1→0").

bit bit
Example 15 0

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 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.□ This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the COM instruction is executed at every scan, the bits are inverted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction (@COM) as follows.

DM**** DM****
LDA COM STA

DM**** DM****
LDA COM STA

4-88 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Logical Operation Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF.
CR2011 No change in state

INSTRUCTIONS
CR2012 No change in state

Sample Program
The state of input relays R00 to R003 are inverted and output to R500 to R503.

ΜR000 R000
LDA COM
$000F
ANDA
R500
STA
(Mnemonics list)
LD MR000
4
LDA R000

Logical Operation Instructions


CON
COM
CON
ANDA $F
CON
STA R500

"ANDA instruction", page 4-80

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-89


NEG
Sign inversion

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


NEG

NEG(.U)
NEG.S
NEG.D
NEG NEG.L
NEG.F
NEG
ARITHMETIC OPERATION

NEG.DF
Inverts the sign (2's
Sign inversion
@NEG(.U) complement).
@NEG.S
INSTRUCTIONS

@NEG.D
@NEG @NEG.L
@NEG.F
NEG

@NEG.DF

4
Ladder program Input mode
Execution condition
LDA NEG STA N E G
Logical Operation Instructions

Execution condition
LDA NEG STA @ N E G

Description of Operation
When the execution condition is ON, the plus/minus sign of the data currently stored in internal
registers is inverted (2's complement is calculated), and the result is stored to internal registers.

NEG(.U) / NEG.S
When the execution condition is ON, the plus/minus sign of the 16-bit data currently
stored in 16-bit internal registers is inverted (2's complement is calculated).

bit bit
Example 15 0

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

10000000000000000

0011000000111001

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

4-90 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Logical Operation Instructions

NEG.D / NEG.L
When the execution condition is ON, the plus/minus sign of the 32-bit data currently

ARITHMETIC OPERATION
stored in 32-bit internal registers is inverted (2's complement is calculated).

bit bit bit bit


Example 31 16 15 0

INSTRUCTIONS
32-bit internal register 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 ←Before
executing
#12345678
bit bit bit bit
31 16 15 0

10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0000000010111110 0110000101001110

bit bit
31 0

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

#-12345678
←After
executing 4

Logical Operation Instructions


NEG.F When execution condition is ON, single precision floating point type real number stored in
32-bit internal register will be negated.
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

NEG.DF When execution condition is ON, double precision floating point type real number stored
in 64-bit internal register will be negated.
64-bit internal register 64-bit internal register
Double precision floating point type real number −1× Double precision floating point type real number
64-bit 64-bit

@NEG.□ This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the NEG instruction is executed at every scan, the sign is inverted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction (@NEG) as follows.

DM**** DM****
LDA NEG STA

DM**** DM****
LDA NEG STA

Operation flag

CR2009 No change in state


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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-91


Logical Operation Instructions

Sample Program
ARITHMETIC OPERATION

When input relay R000 is ON, the difference between the signed 16-bit BIN data currently stored in
DM0 and DM1 is calculated, and the absolute value is stored to DM2.
(Mnemonics list)
INSTRUCTIONS

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

4
MPP
AND<.S DM0 DM1
LDA.S DM2
CON
Logical Operation Instructions

NEG.S
CON
STA.S DM2

4-92 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Logical Operation Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Logical Operation Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-93


Shift Instructions
SRA Right
shift of internal register

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


11 SRA

SRA(.U)
SRA SRA.D SRA Shifts the bit content of
internal registers to the
Shift right
@SRA(.U) smaller bit No. by the specified
@SRA number of bits.
ARITHMETIC OPERATION

@SRA.D SRA

Ladder program Input mode


INSTRUCTIONS

Execution condition n
LDA SRA STA S R A n

Execution condition n
LDA SRA STA @ S R A n

4 Operand Explanation
Specifies the number of bits to shift.*1*2
Occupied size

n SRA.U can be specified within the range 0 to 16, and SRA.D can be 16 bits
Shift Instructions

specified within the range 0 to 32.

*1 When the n value is 0, the MSB status is stored in CR2009.


*2 When n is not specified as a constant, operation is as follows when the value of n is 17
or more (.U) / 33 or more (.D).
Value of internal register=0, CR2009=OFF, CR2010=ON

Description of Operation
SRA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
The result is stored to the 16-bit internal register.
bit ( n -1)
bit bit
15 0
16-bit
internal 1110100000011001
register

16-bit
internal 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 10 0 1
register
Higher n bit Delete

Filled with 0 1
CR2009
(Carry)

SRA.D When the execution condition is ON, the state of the 32-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
The result is stored to the 32-bit internal register.

4-94 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

bit ( n -1)
bit bit
31 0
32-bit
1 1 1 0 10 0 0 0 0 0 1 1 0 0 1 1 11 0 10 0 0 0 0 0 1 1 0 0 1

ARITHMETIC OPERATION
internal
register

INSTRUCTIONS
32-bit
internal
0 0 0 0 01 1 1 0 1 0 0 0 0 0 0 1 10 0 11 1 1 0 1 0 0 0 0 0 0 1 10 0 1
register
Higher n bit Delete

Filled with 0
1
CR2009
(Carry)

This instruction is executed for one scan at the rising edge of the execution condition.
4
@SRA.□

Reference When the SRA instruction is executed at every scan, the bits are shifted at each scan

Shift Instructions
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.

DM**** DM****
LDA SRA STA

DM**** DM****
LDA SRA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-95


Shift Instructions

Sample Program
ARITHMETIC OPERATION

The BCD data (2 digits) from the digital switch entered to input relays R30008 to R30015 is stored
toDM0.
(Mnemonics list)
INSTRUCTIONS

MR000 R30000 #8 DM0


LDA SRA STA LD MR000
LDA R30000
CON
Digital switch
SRA #8
CON
STA DM0
2 4
4 R30015 R30000
Shift Instructions

00100100 R30000∼R30015

LDA

00100100 Internal register

SRA

0000000000100100 Internal register

STA

0000000000100100 DM0

4-96 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Shift Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-97


SLA Left
shift of internal register

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


SLA

SLA(.U)
SLA SLA.D SLA Shifts the bit content of
internal registers to the larger
Shift left
@SLA(.U) bit No. by the specified
@SLA number of bits.
ARITHMETIC OPERATION

@SLA.D SLA

Ladder program Input mode


INSTRUCTIONS

Execution condition n
LDA SLA STA S L A n

Execution condition n
LDA SLA STA @ S L A n

4
Operand Explanation Occupied size
Specifies the number of bits to shift.*1*2
n SRA.U can be specified within the range 0 to 16, and SRA.D can be 16 bits
Shift Instructions

specified within the range 0 to 32.

*1 When the n value is 0, the MSB status is stored in CR2009.


*2 When n is not specified as a constant, operation is as follows when the value of n is 17
or more (.U) / 33 or more (.D).
Value of internal register=0, CR2009=OFF, CR2010=ON

Description of Operation
SLA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted left
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
The result is stored to the 16-bit internal register.
bit (16− n )
bit bit
15 0
16-bit
1110100000011001 internal
register

16-bit
1 11 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 internal
register
Delete Lower n bit

1
Filled with 0
CR2009
(Carry)

SLA.D When the execution condition is ON, the state of the 32-bit internal register is shifted left
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
The result is stored to the 32-bit internal register.

4-98 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

bit (32− n )
bit bit
31 0
32-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 internal

ARITHMETIC OPERATION
register

INSTRUCTIONS
32-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 internal
register
Delete Lower n bit

1 Filled with 0
CR2009
(Carry)

This instruction is executed for one scan at the rising edge of the execution condition.
4
@SLA.□

Reference When the ASLA instruction is executed at every scan, the bits are shifted at each scan

Shift Instructions
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.

DM**** DM****
LDA SLA STA

DM**** DM****
LDA SLA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The 2-digit BCD data currently stored to each of DM0 and DM1 are stored to DM10 as 4-digit BCDdata
with the DM1 as the higher 2 digits.
(Mnemonics list)
CR2002 DM1 #8 DM0 DM10
LDA SLA ORA STA LD CR2002
LDA DM1
CON
DM0 SLA #8
34 DM10 CON
ORA DM0
DM1 1234 CON
12 STA DM10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-99


ASRAArithmetic
of right shift
internal register

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


ASRA

ASRA(.U)
ASRA.S
ASRA ASRA.D
ASRA.L
ASRA
Shifts the bit content of
Arithmetic right internal registers to the
ARITHMETIC OPERATION

@ASRA(.U) shift smaller bit No. by the


@ASRA.S specified number of bits.
@ASRA @ASRA.D
@ASRA.L
ASRA
INSTRUCTIONS

Ladder program Input mode


Execution condition n
LDA ASRA STA A S R A n

4 Execution condition
LDA
n
ASRA STA @ A S R A n
Shift Instructions

Operand Explanation Occupied size


Specifies the number of bits to shift.*1
n ASRA.U, ASRA.S can be specified within the range 0 to 16, and 16 bits
ASRA.D, ASRA.L can be specified within the range 0 to 32.

*1 • When the n value is 0, the MSB status is stored in CR2009.


• When n is not specified as a constant, 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,
Value of internal register=0, CR2009=OFF, CR2010=ON

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

4-100 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

Description of Operation

ARITHMETIC OPERATION
ASRA(.U) When the execution condition is ON, the state of the 16-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.

INSTRUCTIONS
The result is stored to the 16-bit internal register.

bit
( n −1) bit
bit
15 0
16-bit Internal register before execution: 59417
internal 1110100000011001
register

4
Execute ASRA.U instruction with n=5

16-bit
internal
000001110100000011 00 1
Internal register after execution: 1856
register

Shift Instructions
High-order n bit Delete

1
0 is stored
CR2009
(carry)

ASRA.S When the execution condition is ON, the state of the 16-bit internal register is shifted right
by n bits (towards the low-order bit).
If "value stored in internal register ≧0", 0 is stored in the high-order n bits. If "value
stored in internal register <0", 1 is stored. The bit ( n -1) status is stored in CR2009.
The result is stored to the 16-bit internal register.

bit
( n −1)
bit bit
15 0
Internal register before execution: -1000
16-bit
internal 1111110000011000
register
Execute ASRA.S instruction with n=4

16-bit
internal
111111111100000110 00
Internal register after execution: -63
register
High-order n bit Delete

1
Sign value is stored
Greater than 0 : 0 CR2009
Less than 0: 1 (carry)

ASRA.D When the execution condition is ON, the state of the 32-bit internal register is shifted right
by n bits (towards the low-order bit).
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
The result is stored to the 32-bit internal register.
bit( n −1)
bit bit
31 0
32-bit 3894011929
11101000000110011110100000011001
internal
register

n=5
32-bit
internal 0000011101000000110011110100000011 00 1
121687872
register
High-order n bit Delete

1
0 is stored
CR2009
(carry)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-101


Shift Instructions

ASRA.L When the execution condition is ON, the state of the 32-bit internal register is shifted right
by n bits (towards the low-order bit).
ARITHMETIC OPERATION

If "value stored in internal register ≧0", 0 is stored in the high-order n bits. If "value
stored in internal register <0", 1 is stored. The bit ( n -1) status is stored in CR2009.
The result is stored to the 32-bit internal register.
INSTRUCTIONS

bit( n −1)
bit bit
31 0

32-bit 100100001100111100001100101 CR2009


0(キャリー)
1110 −1865478994
internal
register

n=4

32-bit

4
internal 11111001000011001111000011001010 1 1 1 0 −116592438
register
High-order n bit Delete
Shift Instructions

1
Sign value is stored
Greater than 0 : 0 CR2009
Less than 0: 1 (carry)

@ASRA.□ This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the ASLA instruction is executed at every scan, the bits are shifted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM DM
LDA ASRA STA

DM DM
LDA ASRA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-102 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

Sample Program

ARITHMETIC OPERATION
The BCD data (6 digits worth) from the digital switch input into the input relay -R30008 to R30115 is
stored in the data memory DM0, DM1.
(Mnemonics list)

INSTRUCTIONS
CR2002 R30000 #8 DM0
LDA.D ASRA.D STA.D LD CR2002
LDA.D R30000
CON
ASRA.D #8
CON
STA.D DM0

4
Digital switch

1 2 3 4 5 6

Shift Instructions
R30008
R30115 R30000

0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 R30000∼R30115
LDA.D
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 Internal register
ASRA.D
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 Internal register
STA.D
0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-103


ASLA
Arithmetic left shift of
internal register

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


ASLA

ASLA(.U)
ASLA.S
ASLA ASLA.D
ASLA.L
ASLA
Shifts the bit content of
Arithmetic left internal registers to the larger
ARITHMETIC OPERATION

@ASLA(.U) shift bit No. by the specified


@ASLA.S number of bits.
@ASLA @ASLA.D
@ASLA.L
ASLA
INSTRUCTIONS

Ladder program Input mode


Execution condition n
LDA ASLA STA A S L A n

4 Execution condition
LDA
n
ASLA STA @ A S L A n
Shift Instructions

Operand Explanation Occupied size


Specifies the number of bits to shift.*1
n ASLA.U and ASLA.S can be specified within the range 0 to 16, and 16 bits
ASLA.D and ASLA.L can be specified within the range 0 to 32.

*1 • When the n value is 0, the MSB status is stored in CR2009.


• When n is not specified as a constant, 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,
Value of internal register=0, CR2009=OFF, CR2010=ON

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
ASLA(.U) / ASLA.S
When the execution condition is ON, the state of the 16-bit internal register is shifted left
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
The result is stored to the 16-bit internal register.
(16− n )
bit
bit bit
15 0
16-bit Internal register before
1110100000011001 internal execution: 59417
register

Execute ASLA.U instruction with n=5

16-bit
11 10 10000001100100000 Internal register after execution: 800
internal
register
Delete Low-order n bit

1 0 is stored
CR2009
(carry)

4-104 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

ASLA.D / ASLA.L
When the execution condition is ON, the state of the 32-bit internal register is shifted left

ARITHMETIC OPERATION
by n bits (towards the high-order bit).
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
The result is stored to the 32-bit internal register.

INSTRUCTIONS
(32− n )
bit
bit bit
31 0
32-bit
11101000000110011110100000011001 3894011929
internal
register

n=5

4
32-bit
1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 internal 54330144
register
Delete Low-order n bit

Shift Instructions
1
0 is stored
CR2009
(carry)

@ASLA.□ This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the ASLA instruction is executed at every scan, the bits are shifted at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.
DM DM
LDA ASLA STA

DM DM
LDA ASLA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-105


Shift Instructions

Sample Program
ARITHMETIC OPERATION

The 6-digit BCD data stored in data memory DM0, DM1 is merged with the 2-digit BCD data stored
inDM2, and is stored as 8-digit BCD data in DM10, DM11.
(Mnemonics list)
INSTRUCTIONS

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

4
STA.D DM10

DM0, DM1
DM10, DM11
123456
Shift Instructions

DM2 12345678
78

4-106 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Shift Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-107


RRA
Right rotate of internal register

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


RRA

RRA(.U)
RRA RRA.D RRA Rotates the bit content of
internal registers towards the
Right rotate
@RRA(.U) smaller bit No. by the specified
@RRA number of bits.
ARITHMETIC OPERATION

@RRA.D RRA

Ladder program Input mode


INSTRUCTIONS

Execution condition n
LDA RRA STA R R A n

Execution condition n
LDA RRA STA @ R R A n

4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RRA.U can be specified within the range 0 to 16, and RRA.D can be 16 bits
Shift Instructions

specified within the range 0 to 32.

*1 When the value of n is "0", the state of CR2009 does not change.
*2 When n is not specified as a constant, operation is as follows when the value of n is 17
or more (.U) / 33 or more (.D).
When suffix is .U: the remainder value obtained by dividing the value of n by 17 is taken as
the number of bits to rotate.
When suffix is .D: the remainder value obtained by dividing the value of n by 33 is taken as
the number of bits to rotate.

Description of Operation
RRA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated right by n bits (towards the low-order bit). The state of the carry flag
(CR2009) is entered to the MSB.
(The following bit manipulation is repeated for n times.)
bit bit
CR2009 15 0

0 1111000000001111 16-bit internal regist


Status of flag varies
with previous operation
results.
(1-bit cycle)

CR2009

1 0111100000000111
(Carry)
n cycle (Rotate n bits)

bit bit
CR2009 15 0

0 1111011110000000 16-bit internal regist


(Carry)

4-108 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

RRA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated right by n bits (towards the low-order bit). The state of the carry flag

ARITHMETIC OPERATION
(CR2009) is entered to the MSB.
(The following bit manipulation is repeated for n times.)
32-bit internal register

INSTRUCTIONS
bit bit bit bit
CR2009 31 16 15 0

0 1111000000001111 0000000000001111
Status of flag varies
with previous operation
results.
(1-bit cycle)

CR2009

1
(Carry)
0111100000000111 1000000000000111
4
n cycle (Rotate n bits)

Shift Instructions
bit bit
CR2009 31 0

0 1111011110000000 0111100000000000
(Carry)
32-bit internal register

@RRA.□ This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the RRA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.

DM**** DM****
LDA SLA STA

DM**** DM****
LDA SLA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-109


Shift Instructions

Sample Program
ARITHMETIC OPERATION

Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS

CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
② LDA R30000
#16
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RRA #1

4
RRA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions

(1) Store input relay R30000 to R30015 to 16-bit internal register.


(2) Perform FOR~NEXT instruction for 16 times.
(3) Shift the content (including carry flag CR2009) in 16-bit internal register right,
and then add 1 to DM0 when CR2009 is ON.

4-110 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Shift Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-111


RLA
Left rotate of internal register

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


RLA

RLA(.U)
RLA RLA.D RLA Rotates the bit content of
internal registers towards the
Left rotate
@RLA(.U) larger bit No. by the specified
@RLA number of bits.
ARITHMETIC OPERATION

@RLA.D RLA

Ladder program Input mode


INSTRUCTIONS

Execution condition n
LDA RLA STA R L A n

Execution condition n
LDA RLA STA @ R L A n

4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RLA.U can be specified within the range 0 to 16, and RLA.D can be 16 bits
Shift Instructions

specified within the range 0 to 32.

*1 When the value of n is "0", the state of CR2009 does not change.
*2 When n is not specified as a constant, operation is as follows when the value of n is 17
or more (.U) / 33 or more (.D).
When suffix is .U: the remainder value obtained by dividing the value of n by 17 is taken as
the number of bits to rotate.
When suffix is .D: the remainder value obtained by dividing the value of n by 33 is taken as
the number of bits to rotate.

Description of Operation
RLA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated left by n bits (towards the high-order bit). The state of the carry flag
(CR2009) is entered to the LSB.
(The following bit manipulation is repeated for n times.)
bit bit
15 0 CR2009

1111000000001111 0 16-bit internal regist


Status of flag varies
with previous operat
(1-bit cycle) ion results.

CR2009

1110000000011110 1
(Carry)

n cycle (Rotate n bits)

bit bit
15 0 CR2009

0000000111101111 0 16-bit internal regist


(Carry)

4-112 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

RLA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated left by n bits (towards the high-order bit). The state of the carry flag

ARITHMETIC OPERATION
(CR2009) is entered to the LSB.
(The following bit manipulation is repeated for n times.)
32-bit internal register

INSTRUCTIONS
bit bit bit bit
31 16 15 0 CR2009

1111000000001111 0000000000001111 0
Status of flag varies with
(1-bit cycle) previous operation results.

CR2009

1110000000011110 0000000000011110 1
(Carry) 4
n cycle(Rotate n bits)

Shift Instructions
bit bit
31 0 CR2009

0000000111100000 0000000111101111 0
(Carry)
32-bit internal register

@RLA.□ This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the RLA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.

DM**** DM****
LDA RLA STA

DM**** DM****
LDA RLA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-113


Shift Instructions

Sample Program
ARITHMETIC OPERATION

Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS

CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
LDA R30000
#16 ②
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RLA #1

4
RLA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions

(1) Store input relay R30000 to R30015 to 16-bit internal register.


(2) Perform FOR~NEXT instruction for 16 times.
(3) Shift the content (including carry flag CR2009) in 16-bit internal register left, and then add 1 to
DM0 when CR2009 is ON.

4-114 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Shift Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-115


RRNCA right rotation of internal
carry N o-
register

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


RRNCA

RRNCA(.U)
RRNCA RRNCA.D RRNCA
No-carry right
Rotates the bit content of
internal registers towards
the smaller bit No. by the
@RRNCA(.U) rotation
specified number of bits
@RRNCA
ARITHMETIC OPERATION

@RRNCA.D RRNCA without a carry.

Ladder program Input mode


INSTRUCTIONS

Execution condition n
LDA RRNCA STA R R N C A n

Execution condition n
LDA RRNCA STA @ R R N C A n

4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RRNCA.U can be specified within the range 0 to 15, and RRNCA.D 16 bits
Shift Instructions

can be specified within the range 0 to 31.

*1 When n is not specified as a constant, 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.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.

Description of Operation
RRNCA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated right by n bits (towards the low-order bit).
The state of the LSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)
bit bit
15 0

111100001111 0000 16-bit internal regist

(1-bit cycle)

0111100001111000

n cycle (Rotate n bits)

bit bit
15 0

1000011110000111 16-bit internal regist

CR2009(Carry) 1

4-116 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

RRNCA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated right by n bits (towards the low-order bit).

ARITHMETIC OPERATION
The state of the LSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)

INSTRUCTIONS
bit bit bit bit
31 16 15 0

111100001111 0000111100001111 0000 32-bit internal regist

(1-bit cycle)

4
01111000011110000111100001111000

n cycle (Rotate n bits)

Shift Instructions
bit bit
31 0

10000111100001111000011110000111 32-bit internal regist

CR2009(Carry) 1

@RRNCA.□This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the RRNCA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.

DM**** DM****
LDA RRNCA STA

DM**** DM****
LDA RRNCA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-117


Shift Instructions

Sample Program
ARITHMETIC OPERATION

Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS

CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
LDA R30000
#16 ②
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RRNCA #1

4
RRNCA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions

(1) Store input relay R30000 to R30015 to 16-bit internal register.


(2) Perform FOR~NEXT instruction for 16 times.
(3) Shift the content (excluding carry flag CR2009) in 16-bit internal register right, and then add 1 to
DM0 when CR2009 is ON.

4-118 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Shift Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-119


RLNCA N o -
carry left rotation of internal
register

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


RLNCA

RLNCA(.U)
RLNCA RLNCA.D RLNCA
No-carry left
Rotates the bit content of
internal registers towards
the larger bit No. by the
@RLNCA(.U) rotation
specified number of bits
@RLNCA
ARITHMETIC OPERATION

@RLNCA.D RLNCA without a carry.

Ladder program Input mode


INSTRUCTIONS

Execution condition n
LDA RLNCA STA R L N C A n

Execution condition n
LDA RLNCA STA @ R L N C A n

4
Operand Explanation Occupied size
Specifies the number of bits to rotate.*1*2
n RLNCA.U can be specified within the range 0 to 15, and RLNCA.D 16 bits
Shift Instructions

can be specified within the range 0 to 31.

*1 When n is not specified as a constant, 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.
*2 EM and FM (ZF) cannot be used with the KV Nano Series.

Description of Operation
RLNCA(.U) When the execution condition is ON, the bit content of the 16-bit internal register is
rotated left by n bits (towards the high-order bit).
The state of the MSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)
bit bit
15 0

111100001111 0000 16-bit internal regist

1-bit cycle

1110000111100001

n cycle (Rotate n bits)

bit bit
15 0

0001111000011110 16-bit internal regist

CR2009(Carry) 0

4-120 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

RLNCA.D When the execution condition is ON, the bit content of the 32-bit internal register is
rotated left by n bits (towards the high-order bit).

ARITHMETIC OPERATION
The state of the MSB as a result of having performed a rotate is entered to the carry
flag(CR2009).
(The following bit manipulation is repeated for n times.)

INSTRUCTIONS
bit bit bit bit
31 16 15 0

1 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 regist

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

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 regist

CR2009(Carry) 0

@RLNCA.□This instruction is executed for one scan at the rising edge of the execution condition.

Reference When the RLNCA instruction is executed at every scan, the bits are rotated at each scan
when the execution condition is ON. If it is executed not at each scan but at the rising edge
of the execution condition, use the differential type instruction as follows.

DM**** DM****
LDA RLNCA STA

DM**** DM****
LDA RLNCA STA

Operation flag

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-121


Shift Instructions

Sample Program
ARITHMETIC OPERATION

Of the error sensors connected to input relays R30000 to R30015, the number of sensors that are
currently outputting an error is stored to DM0.
(Mnemonics list)
INSTRUCTIONS

CR2002 #0 R30000
DW LDA ① LD CR2002
DM0 DW #0 DM0
CON
FOR
LDA R30000
#16 ②
FOR #16
LD CR2002
CR2002 #1 CR2009 DM0 RLNCA #1

4
RLNCA INC ③ CON
AND CR2009
INC DM0
NEXT NEXT
Shift Instructions

(1) Store input relay R30000 to R30015 to 16-bit internal register.


(2) Perform FOR~NEXT instruction for 16 times.
(3) Shift the content (excluding carry flag CR2009) in 16-bit internal register left, and then add 1 to
DM0 when CR2009 is ON.

4-122 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Shift Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-123


WSR
Word data right shift

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


WSR

WSR(.U)
WSR WSR.D
WSR

Word data
Shifts the word data
towards the larger
@WSR(.U) right shift device No. (larger
@WSR WSR
array subscript).
ARITHMETIC OPERATION

@WSR.D

Ladder program Input mode


INSTRUCTIONS

Execution condition WSR


D n1 n2 W S R D n1 n2

Execution condition WSR


D n1 n2 @ W S R D n1 n2

Operand Explanation Occupied size


4 D Specifies the word data to be shifted.*1
.U 16 bits x ( n1 + n2 )
.D 32 bits x ( n1 + n2 )
Shift Instructions

n1 Specifies the number of data to be shifted. 16 bits


n2 Specifies the number of times devices are to be shifted. 16 bits

*1 CR cannot be specified.

Description of Operation
WSR(.U) When the execution condition is ON, n1 16-bit data starting from D are shifted
towards larger device No. (larger array subscript) by n2 .
"0" is stored to n2 data starting from D .
Before executing After executing

D 1000 0
D +1 2000 0
Filled with 0
0
0
...

n1
D + n2 1000
( D +1)+ n2 2000
8000
D + n1 −1 9000
...

n2
8000
( D + n1 −1)+ n2 9000

WSR.D When the execution condition is ON, n1 32-bit data starting from [ D / D +1]
are shifted towards larger device No. (larger array subscript) by n2 .
"0" is stored to n2 data starting from D .
Before executing After executing

D +1 100000 D 0
D +3 200000 D +2 0
Filled with 0
0
0
...

n1
( D +1)+2 n2 100000 D +2 n2
( D +3)+2 n2 200000 ( D +2)+2 n2

800000
D +2( n1 −1)+1 900000 D +2( n1 −1)
...

n2
800000
( D +2( n1 −1)+1)+2 n2 900000 ( D +2( n1 −1)+2 n2

@WSR.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-124 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

Point When a timer/counter (32-bit) has been specified to D by a .U suffix instruction,


"0" is stored to the high-order 16 bits of the shift destination data, and the value of

ARITHMETIC OPERATION
the low-order 16 bits of the shift source data is stored to the low-order 16 bits of the
shift destination data.
"0" is stored to both the high-order and low-order bits of the shift source data.

INSTRUCTIONS
Before execution After execution
Higher 16 Bits Lower 16 Bits Higher 16 Bits Lower 16 Bits
Shift source data $0001 $0002 $0000 $0000
Shift destination data $0003 $0004 $0000 $0002

Operation flag 4

Shift Instructions
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When n1 =0
• When the shifted result exceeds the device / work area range
CR2012 • When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Each time input relay R000 turns ON, the content of DM0 to DM99 is shifted by 1 word towards the
larger device No. (larger array subscript).
(Mnemonics list)
R000 WSR
DM0 #100 #1 LDP R000
WSR DM0 #100 #1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-125


WSLWord data left shift

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


WSL

WSL(.U)
WSL
WSL
WSL.D Shifts the word data
Word data left towards the smaller
@WSL(.U) shift device No. (smaller
@WSL
WSL
array subscript).
ARITHMETIC OPERATION

@WSL.D

Ladder program Input mode


INSTRUCTIONS

Execution condition WSL


D n1 n2 W S L D n1 n2

Execution condition WSL


D n1 n2 @ W S L D n1 n2

Operand Explanation Occupied size


4 D Specifies the word data to be shifted.*1
.U 16 bits x ( n1 + n2 )
.D 32 bits x ( n1 + n2 )
Shift Instructions

n1 Specifies the number of data to be shifted. 16 bits


n2 Specifies the number of times devices are to be shifted. 16 bits

*1 CR cannot be specified.

Description of Operation
WSL(.U) When the execution condition is ON, n1 16-bit data starting from D are shifted
towards smaller device No. (smaller array subscript) by n2 .
"0" is stored to n2 data starting from D + n1 - n2 .
Before executing After executing

D − n2 1000
D ( +1)−
n2 2000
n2
...

D 1000
D +1 2000
8000
( D + n1 −1)−+n2 9000
...

n1
0
0
Filled with 0
8000 0
D + n1 −1 9000 0

WSL.D When the execution condition is ON, n1 32-bit data starting from [ D / D +1]
are shifted towards smaller device No. (smaller array subscript) by n2 .
"0" is stored to n2 data starting from D + n1 - n2 .
Before executing After executing

( D +1)−2 n2 100000 D −2 n2
( D +3)−2 n2 200000 ( D +2)−2 n2
n2
...

D +1 100000 D

D +3 200000 D +2
800000
( D +2( n1 −1)+1)−2 n2 900000 ( D +2( n1 −1)−2 n2
...

n1
0
0
Filled with 0
800000 0
D +2( n1 −1)+1 900000 D +2( n1 −1) 0

@WSL.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-126 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

Point When a timer/counter (32-bit) has been specified to D by a .U suffix instruction,


"0" is stored to the high-order 16 bits of the shift destination data, and the value of

ARITHMETIC OPERATION
the low-order 16 bits of the shift source data is stored to the low-order 16 bits of the
shift destination data.
"0" is stored to both the high-order and low-order bits of the shift source data.

INSTRUCTIONS
Before execution After execution
Higher 16 Bits Lower 16 Bits Higher 16 Bits Lower 16 Bits
Shift source data $0001 $0002 $0000 $0000
Shift destination data $0003 $0004 $0000 $0002

Operation flag 4

Shift Instructions
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When n1 =0
• When the shifted result exceeds the device / work area range
CR2012 • When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index
modification is not specified in the operand, and the access outside the operand range is not
checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Each time input relay R000 turns ON, the content of DM1000 to DM1099 is shifted by 1 word towards
the smaller device No. (smaller array subscript).
(Mnemonics list)
R000 WSL
DM1000 #100 #1 LDP R000
WSL DM1000 #100 #1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-127


BSRShift
td e vhi c ee
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano ctoo nlarger
tent
BSR
dNo.
evice

BSR(.U)
BSR
BSR
BSR.D Shifts the bit data
Bit data right towards the larger
@BSR(.U) shift device No. (larger
@BSR
BSR
array subscript).
ARITHMETIC OPERATION

@BSR.D

Ladder program Input mode


INSTRUCTIONS

Execution condition BSR


D n1 n2 B S R D n1 n2

Execution condition BSR


D n1 n2 @ B S R D n1 n2

Operand Explanation Occupied size


4 D Specifies the bit data to be shifted.*1*2 1 bit x ( n1 + n2 )
n1 Specifies the number of bits to shift. 16 bits
Shift Instructions

n2 Specifies the number of times devices are to be shifted. 16 bits

*1 CR/CM cannot be specified.


*2 When bit data is specified, the program will function normally even if the bit data straddles
channels.
When word data is specified, the LSB of n1 word data is shifted. Bits other than LSB do not
change.Bit specifying can not be used for word devices.

Description of Operation
BSR(.U) When the execution condition is ON, the state of n1 data starting from D is
shifted towards larger device No. (larger array subscript) by the number of times specified
by n2 .
n2 data starting from D are turned OFF (0 is stored).

Example BSR
MR101 #3 #4

100 101 102 103 104 105 106 107


MR100∼ Before 1 1 0 1 1 0 1 1
executing

100 101 102 103 104 105 106 107


MR100∼ After 1 0 0 0 0 1 0 1
executing

“0”is filled in

BSR.D When the execution condition is ON, the state of n1 data starting from [ D /
D +1] is shifted towards larger device No. (larger array subscript) by the number of
times specified by n2 .
n2 data starting from D are turned OFF (0 is stored).

@BSR.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-128 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the shifted result exceeds the device / work area range
• When n1 is 0
• When the indirect specification or index modification range is inappropriate
• When a timer/counter has been specified by indirect specification in D or [ D /
CR2012 D +1]
• When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index 4
modification is not specified in the operand, and the access outside the operand range is not

Shift Instructions
checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Each time input relay R000 turns ON, the content of internal auxiliary relays MR000 to MR007 is shifted
towards the larger device No. (larger array subscript) by 8 bits at a time.
(Mnemonics list)
R000 BSR
MR000 #8 #8 LDP R000
BSR MR000 #8 #8

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-129


BSLShift to
content the device
smaller
device No.

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


BSL

BSL(.U)
BSL
BSL
BSL.D Shifts the bit data
Bit data left towards the smaller
@BSL(.U) shift device No. (smaller
@BSL
BSL
array subscript).
ARITHMETIC OPERATION

@BSL.D

Ladder program Input mode


INSTRUCTIONS

Execution condition BSL


D n1 n2 B S L D n1 n2

Execution condition BSL


D n1 n2 @ B S L D n1 n2

Operand Explanation Occupied size


4 D Specifies the bit data to be shifted.*1*2 1 bit x ( n1 + n2 )
n1 Specifies the number of bits to shift. 16 bits
Shift Instructions

n2 Specifies the number of times devices are to be shifted. 16 bits

*1 CR/CM cannot be specified.


*2 When bit data is specified, the program will function normally even if the bit data straddles
channels.
When word data is specified, the LSB of n1 word data is shifted. Bits other than LSB do not
change.Bit specifying can not be used for word devices.

Description of Operation
BSL.U When the execution condition is ON, the state of n1 data starting from D is
shifted towards smaller device No. (smaller array subscript) by the number of times
specified by n2 .
n2 data starting from D + n1 - n2 are turned OFF (0 is stored).

Example BSL
MR109 #2 #3

105 106 107 108 109 110 111 112


Before
MR105∼ executing 1 0 1 1 0 1 1 0

105 106 107 108 109 110 111 112


After
MR105∼ executing 1 0 1 0 0 0 1 0

Filled with 0

BSL.D When the execution condition is ON, the state of n1 data starting from [ D /
D +1] is shifted towards smaller device No. (smaller array subscript) by the number of
times specified by n2 .
n2 data starting from D + n1 - n2 are turned OFF (0 is stored).

@BSL.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-130 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Shift Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the shifted result exceeds the device / work area range
• When n1 is 0
• When the indirect specification or index modification range is inappropriate
• When a timer/counter has been specified by indirect specification in D or [ D /
CR2012 D +1]
• When an access outside the operand range occurs
It will not change when n1 or n2 is a constant and indirect specification or index 4
modification is not specified in the operand, and the access outside the operand range is not

Shift Instructions
checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Each time input relay R000 turns ON, the content of internal auxiliary relays MR10008 to MR10015 is
shifted towards the smaller device No. (smaller array subscript) by 8 bits at a time.
(Mnemonics list)
R000 BSL
MR10008 #8 #8 LDP R000
BSL MR10008 #8 #8

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-131


Data Control Instructions
LIMIT Upper/
lower limit control for input data

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


LIMIT

LIMIT(.U)
LIMIT.S
LIMIT
LIMIT
LIMIT.D
LIMIT.L Perform upper /
Upper/lower
lower limit
ARITHMETIC OPERATION

limit
@LIMIT(.U) control for input
control
@LIMIT.S data.
@LIMIT
LIMIT
@LIMIT.D
@LIMIT.L
INSTRUCTIONS

Ladder program Input mode


Execution condition LIMIT
S1 S2 S3 D L I M I T S1 S2 S3 D

4 Execution condition LIMIT


S1 S2 S3 D @ L I M I T S1 S2 S3 D
Data Control Instructions

Operand Explanation Occupied size


.U .S 16 bits
S1 Specifies the lower limit (MIN output limit value).
.D .L 32 bits
.U .S 16 bits
S2 Specifies the upper limit (MAX output limit value).
.D .L 32 bits
.U .S 16 bits
S3 Specifies input value of upper/lower limit control.
.D .L 32 bits
Specifies the storage location for output value of upper / lower limit .U .S 16 bits
D
control. .D .L 32 bits

Description of Operation
When the execution condition is ON, the upper/lower limit control is performed in upper limit and
lower limit for the input value, and the result is stored as output value.
Output value Output value

Upper limit
Input value
Input value

Lower limit

LIMIT(.U) When the execution condition is ON, S1 (upper limit), S2 (lower limit) and S3
(input value) are used as unsigned 16-bit BIN data to perform upper/lower limit control,
and the result is stored in D .

LIMIT.S When the execution condition is ON, S1 (upper limit), S2 (lower limit) and S3
(input value) are used as signed 16-bit BIN data to perform upper/lower limit control, and
the result is stored in D .

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-132 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

LIMIT.D When the execution condition is ON, [ S1 / S1 +1] (upper limit), [ S2 / S2 +1]
(lower limit)

ARITHMETIC OPERATION
and [ S3 / S3 +1] (input value) are used as unsigned 32-bit BIN data to perform
upper/lower limit control, and the result is stored in [ D / D +1].

LIMIT.L When the execution condition is ON, [ S1 / S1 +1] (upper limit), [ S2 / S2 +1]

INSTRUCTIONS
(lower limit)
and [ S3 / S3 +1] (input value) are used as signed 32-bit BIN data to perform upper/
lower limit control, and the result is stored in [ D / D +1].

Condition Value stored in[ D ・ D +1]


[ S1 ・ S1 +1]>[ S3 ・ S3 +1]
(Lower limit) (Input value)
[ S1 ・ S1 +1]
(Lower limit)
4

Data Control Instructions


[ 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.□ 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 S2 < S1 ([ S2 / S2 +1] < [ S1 / S1 +1]).
• ON when the indirect specification or index modification range is inappropriate.
CR2012 • ON when an access outside the operand range occurs
Otherwise, OFF
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R00 is ON, the values
(upper limit: 3500, lower limit: 500) used for performing limit control for analog data stored in DM10000
are stored in DM0.
(Mnemonics list)
R000 LIMIT
#500 #3500 DM10000 DM0 LD R000
Analog data amplitude LIMIT #500 #3500 DM10000 DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-133


BANDCDead
for band
input data control

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


BANDC

BANDC(.S)
BANDC
BANDC
BANDC.L Performs
Dead
dead band
band
@BANDC(.S) control for
control
@BANDC
BANDC
input data.
ARITHMETIC OPERATION

@BANDC.L

Ladder program Input mode


INSTRUCTIONS

Execution condition BANDC


S1 S2 S3 D B A N D C S1 S2 S3 D

Execution condition BANDC


S1 S2 S3 D @ B A N D C S1 S2 S3 D

4 Operand Explanation
.S 16 bits
Occupied size

S1 Specifies the lower limit of dead band (no output space).


.L 32 bits
Data Control Instructions

.S 16 bits
S2 Specifies the upper limit of dead band (no output space).
.L 32 bits
.S 16 bits
S3 Specifies the input value of dead band control.
.L 32 bits
.S 16 bits
D Specifies the storage location for output value of dead band control.
.L 32 bits

Description of Operation
When the execution condition is ON, the dead band control is performed in upper limit and lower
limit for the input value, and the result is stored as output value.
Output value Output value
input value

input value

Lower limit Upper limit

BANDC(.S) When the execution condition is ON, S1 (lower limit), S2 (upper limit) and S3
(input value) are used as signed 16-bit BIN data to perform dead band control, and the
result is stored in D .

Condition Value stored in D


S3 (Input value) - S1
S1 (Lower limit) > S3 (Input value)
(Lower limit)
S3 (Input value) - S2
S2 (Upper limit) < S3 (Input value)
(Upper limit)
S1 (Lower limit) ≦ S3 (Input value) ≦ S2
0
(Upper limit)

* In D , the value is stored within the rang of signed 16-bit BIN data.
• D ≦-32768→ D =-32768
• D ≧+32767→ D =+32767

4-134 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

BANDC.L When the execution condition is ON, [ S1 / S1 +1] (lower limit), [ S2 / S2 +1]
(upper limit)

ARITHMETIC OPERATION
and [ S3 / S3 +1] (input value) are used as signed 32-bit BIN data to perform dead
band control, and the result is stored in [ D / D +1].

Condition Value stored in[ D ・ D +1]

INSTRUCTIONS
[ S1 ・ S1 +1]>[ S3 ・ S3 +1] [ S3 ・ S3 +1] (Input value)
(Lower limit) (Input value) −[ S1 ・ S1 +1] (Lower limit)
[ S2 ・ S2 +1]>[ S3 ・ S3 +1] [ S3 ・ S3 +1] (Input value)
(Upper limit) (Input value) −[ S2 ・ S2 +1] (Upper limit)
[ S1 ・ S1 +1]≦[ S3 ・ S3 +1]≦[ S2 ・ S2 +1]
0
(Lower limit)

* In [ D / D
(Input value) (Upper limit)

+1], the value is stored within the rang of signed 32-bit BIN data.
4

Data Control Instructions


• [ D / D +1]≦-2147483648→[ D / D +1]=-2147483648
• [ D / D +1]≧+2147483647→[ D / D +1]=+2147483647

@BANDC.□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 S2 < S1 ([ S2 / S2 +1] < [ S1 / S1 +1]).
• ON when the indirect specification or index modification range is inappropriate.
CR2012 • ON when an access outside the operand range occurs
Otherwise, OFF
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the values (upper limit: 2000, lower limit: 1000) used for performing dead
band control for analog data stored in DM10000 are stored in DM0.
(Mnemonics list)
R000 BANDC.S
+1000 +2000 DM10000 DM0 LD R000
Analog data amplitude BANDC.S +1000 +2000 DM10000 DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-135


ZONEZone control for
input data

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


ZONE

ZONE(.S)
ZONE
ZONE
ZONE.L
Performs zone
Zone
control for input
@ZONE(.S) control
data.
@ZONE
ZONE
ARITHMETIC OPERATION

@ZONE.L

Ladder program Input mode


INSTRUCTIONS

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 Operand Explanation
.S 16 bits
Occupied size

S1 Specifies the negative offset to be added to input value.


.L 32 bits
Data Control Instructions

.S 16 bits
S2 Specifies the positive offset to be added to input value.
.L 32 bits
.S 16 bits
S3 Specifies the input value of zone control.
.L 32 bits
.S 16 bits
D Specifies the storage location for output value of zone control.
.L 32 bits

Description of Operation
When the execution condition is ON, the zone control is performed in negative offset and positive
offset for the input value, and the result is stored as output value.
Output value Output value

Positive offset
input value
input value

Negative offset

ZONE(.S) When the execution condition is ON, S1 (negative offset), S2 (positive offset) and
S3 (input value) are used as signed 16-bit BIN data to perform zone control, and the
result is stored in D .

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-136 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

ZONE.L When the execution condition is ON, [ S1 / S1 +1] (negative offset), [ S2 /


S2 +1] (positive offset) and [ S3 / S3 +1] (input value) are used as signed 32-bit

ARITHMETIC OPERATION
BIN data to perform zone control, and the result is stored in [ D / D +1].

Condition Value stored in [ D / D +1]


[ S3 / S3 +1] (Input value)

INSTRUCTIONS
[ S3 / S3 +1] (Input value) <0
+ [ S1 / S1 +1] (Negative offset)
[ S3 / S3 +1] (Input value) =0 0
[ S3 / S3 +1] (Input value)
[ S3 / S3 +1] (Input value) >0
+ [ S2 / S2 +1] (Positive offset)

* In [ D / D +1], the value is stored within the rang of signed 32-bit BIN data.
• [
• [
D
D
/
/
D
D
+1]≦-2147483648→[
+1]≧+2147483647→[
D
D /
/ D
D
+1]=-2147483648
+1]=+2147483647
4

Data Control Instructions


@ZONE.□ 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 the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R00 is ON, the values
(negative: -1000, positive: +500) used for performing zone control for analog data stored in DM10000
are stored in DM0.
(Mnemonics list)
R000 ZONE.S
-1000 +500 DM10000 DM0 LD R000
Analog data amplitude ZONE.S -1000 +500 DM10000 DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-137


APR
Perform approximation
calculation
specified for input data in
line.

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


APR

APR(.U)
APR.S
APR.D
APR
APR
APR.L
APR.F To perform
ARITHMETIC OPERATION

APR.DF
approximation
Linear
calculation for
@APR(.U) approximation
input data in
@APR.S
INSTRUCTIONS

specified line.
@APR.D
@APR
APR
@APR.L
@APR.F
@APR.DF

4
Ladder program Input mode
Execution condition APR
S1 S2 n D A P R S1 S2 n D
Data Control Instructions

Execution condition APR


S1 S2 n D @ A P R S1 S2 n D

Operand Explanation Occupied size


.U .S 16 bits
S1 Specifies the input value of linear approximation. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits×2 n
S2 Specifies the start of the linear data table. .D .L .F 32 bits×2 n
.DF 64 bits×2 n
n Specifies the number of linear data logs. 16 bits
.U .S 16 bits
Specifies the start of the storage location for the result of
D .D .L .F 32 bits
approximation operation.
.DF 64 bits

Point The APR.DF (@APR.DF) instruction can be used with the KV-8000 series CPU units
and KV-7000 Series CPU units that have CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3

4-138 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

Description of Operation

ARITHMETIC OPERATION
APR(.U) / APR.S
When the execution condition is ON, the approximation calculation is performed for the
"input value" of linear approximation stored in S1 according to "linear data table" of

INSTRUCTIONS
n logs starting from S2 .
The linear approximation calculation searches in which range of linear data table S1
(input value) is located, and the linear approximation is performed at previous and next
two points. The calculation result is stored in D (approximate result).

4
Y Foldline data form
(X2,Y2) (X3,Y3)
Index X Y

Data Control Instructions


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
6 28 0 of records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
Please store data of X in ascending order

The X value in linear data table is set in ascending order.


(X0<X1<…<Xk<…<Xn)
The linear data table is stored from S2 (table start) in 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 table. In addition, 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~n)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-139


Data Control Instructions

APR.D / APR.L
When the execution condition is ON, the approximation calculation is performed for the
ARITHMETIC OPERATION

"input value" of linear approximation stored in [ S1 / S1 +1] according to "linear data


table" of n logs starting from [ S2 / S2 +1].
The linear approximation calculation searches in which range of linear data table [ S1 /
INSTRUCTIONS

S1 +1] (input value) is located, and the linear approximation is performed at previous
and next two points.
The calculation result is stored in [ D / D +1] (approximate result).
Y Foldline data form
(X2,Y2) (X3,Y3)

4 YP [ S2 ・ S2 +1 ]
Index
0
X
0
Y
10
Table start 1 8 13
Data Control Instructions

(X1,Y1)
2 14 20
(X0,Y0) 3 20 20 n
(X4,Y4) (X5,Y5)
4 23 6

X 5 26 6
XP (X6,Y6) Number of
6 28 0 records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
The linear data table is stored from [ S2 / S2 +1] (table start) in the order of (X0,Y0),
(X1,Y1)…(Xn-1,Yn-1), (Xn,Yn).
The X value in linear data table is set in ascending order.
(X0<X1<…<Xk<…<Xn)

Index X Y
[ S2 ・ S2 +1 ] 0 S2・S2 +1 S2 +2・S2 +3
Table start 1 S2 +4・S2 +5 S2 +6・S2 +7
2 S2 +8・S2 +9 S2 +10・S2 +11
3 S2 +12・S2 +13 S2 +14・S2 +15
4 S2 +16・S2 +17 S2 +18・S2 +19
5 S2 +20・S2 +21 S2 +22・S2 +23
6 S2 +24・S2 +25 S2 +26・S2 +27
(*n=7)

In n (logs), store the logs of linear data table. In addition, n is set to 2 or more.

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 (k=0 ~n) is stored in [ D / D +1]
(approximate result).

4-140 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

APR.F When the execution condition is ON, the approximation calculation (single precision
floating point type) is performed for the "input value" of linear approximation stored in

ARITHMETIC OPERATION
[ S1 / S1 +1] according to "linear data table" of n logs starting from [ S2 /
S2 +1].
The linear approximation calculation searches in which range of linear data table [ S1 /

INSTRUCTIONS
S1 +1] (input value) is located, and the linear approximation is performed at previous
and next two points.
The calculation result is stored in [ D / D +1] (approximate result).
Y Foldline data form
(X2,Y2) (X3,Y3)

YP [ S2 ・ S2 +1 ]
Index
0
X
0
Y
5.2
4
Table start 1 3.3 6.8

Data Control Instructions


(X1,Y1)
2 5.7 13.9
(X0,Y0) 3 7.9 13.9 n
(X4,Y4) (X5,Y5)
4 9.9 2.1

X 5 12.2 2.1
XP (X6,Y6) Number of
6 15.5 0 records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
The linear data table is stored from [ S2 / S2 +1] (table start) in the order of (X0,Y0),
(X1,Y1)…(Xn-1,Yn-1), (Xn,Yn).

The X value in linear data table is set in ascending order.


(X0<X1<…<Xk<…<Xn)

Index X Y
[ S2 ・ S2 +1 ] 0 S2・S2 +1 S2 +2・S2 +3
Table start 1 S2 +4・S2 +5 S2 +6・S2 +7
2 S2 +8・S2 +9 S2 +10・S2 +11
3 S2 +12・S2 +13 S2 +14・S2 +15
4 S2 +16・S2 +17 S2 +18・S2 +19
5 S2 +20・S2 +21 S2 +22・S2 +23
6 S2 +24・S2 +25 S2 +26・S2 +27
(*n=7)

In n (logs), store the logs of linear data table. In addition, n is set to 2 or more.

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 (k=0 ~n) is stored in [ D / D +1]
(approximate result).

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-141


Data Control Instructions

APR.DF When the execution condition is ON, the approximation calculation (double precision
floating point type) is performed for the "input value" of linear approximation stored in
ARITHMETIC OPERATION

[ S1 / S1 +1/ S1 +2/ S1 +3] according to "linear data table" of n logs


starting from [ S2 / S2 +1/ S2 +2/ S2 +3].
The linear approximation calculation searches in which range of linear data table [ S1 /
INSTRUCTIONS

S1 +1/ S1 +2/ S1 +3] (input value) is located, and the linear approximation is
performed at previous and next two points.
The calculation result is stored in [ D / D +1/ D +2/ D +3] (approximate
result).
Y Foldline data form

4 (X2,Y2) (X3,Y3)
Index X Y
YP [
Data Control Instructions

S2 ・ S2 +1・ 0 0 5.2
S2 +2・ S2 +3 ] 1 3.3 6.8
(X1,Y1) Table start 2 5.7 13.9
(X0,Y0) 3 7.9 13.9 n
(X4,Y4) (X5,Y5)
4 9.9 2.1

X 5 12.2 2.1
XP (X6,Y6) Number of
6 15.5 0 records
Y2−Y1
YP = (XP−X1)+Y1 (*n=7)
X2−X1
The linear data table is stored from [ S2 / S2 +1/ S2 +2/ S2 +3] (table start) in
the order of (X0,Y0), (X1,Y1)…(Xn-1,Yn-1), (Xn,Yn).
The X value in linear data table is set in ascending order.
(X0<X1<…<Xk<…<Xn)

Index X Y
[ S2 ・ S2 +1・ 0 S2・S2 +1・S2 +2・S2 +3 S2 +4・S2 +5・S2 +6・S2 +7
S2 +2・ S2 +3] 1 S2 +8・S2 +9・S2 +10・S2 +11 S2 +12・S2 +13・S2 +14・S2 +15
Table start 2 S2 +16・S2 +17・S2 +18・S2 +19 S2 +20・S2 +21・S2 +22・S2 +23
3 S2 +24・S2 +25・S2 +26・S2 +27 S2 +28・S2 +29・S2 +30・S2 +31
4 S2 +32・S2 +33・S2 +34・S2 +35 S2 +36・S2 +37・S2 +38・S2 +39
5 S2 +40・S2 +41・S2 +42・S2 +43 S2 +44・S2 +45・S2 +46・S2 +47
6 S2 +48・S2 +49・S2 +50・S2 +51 S2 +52・S2 +53・S2 +54・S2 +55
(*n=7)

In n (logs), store the logs of linear data table. In addition, n is set to 2 or more.

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 (k=0~n) is stored in


[ D / D +1/ D +2/ D +3] (approximate result).

@APR.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-142 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
APR(.U) • ON when n <2 or n >32767.
APR.S • ON when the range of specified data table is inappropriate.
APR.D • ON when the indirect specification or index modification range is inappropriate.
APR.L • ON when an access outside the operand range occurs.
Otherwise, OFF
APR.F • ON when n <2 or n >32767.


ON when the range of specified data table is inappropriate.
ON when the indirect specification or index modification range is inappropriate. 4
• ON when the values are outside the range of single precision floating point is

Data Control Instructions


inputted
• ON when the result is outside the single precision floating point real number
CR2012 • ON when an access outside the operand range occurs.
Otherwise, OFF
APR.DF • ON when n <2 or n >32767.
• ON when the range of specified data table is inappropriate.
• ON when the indirect specification or index modification range is inappropriate.
• 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.
• ON when an access outside the operand range occurs.
Otherwise, OFF
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

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 DMO 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
6 28 0 of records

R000 APR (Mnemonics list)


DM10000 DM0 #7 DM1000 LDP R000
Input value Tabel start
Result after ar APR DM10000 DM0 #7 DM1000
ithmetic operation

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-143


Data Control Instructions

● To use as a scaling function


  At the rising edge of input relay R000, the value of the analog potentiometer (CM1630) of KV Nano
ARITHMETIC OPERATION

Series is scaled (0 to 255 → -1000 to +1000) using the two data tables from DM0 and stored in DM100.

Index X Y
Table start DM0 0 0 -1000 DM1 2
INSTRUCTIONS

DM2 1 255 1000 DM3

Number of records

4 CR2008 +0
DW.S
-1000
DW.S
+255
DW.S
+1000
DW.S
DM0 DM1 DM2 DM3
Data Control Instructions

ON for 1 scan
at operation start Tabel start

R000 APR.S
CM1630 DM0 #2 DM100
Volume0 Tabel start Result after ar
ithmetic operation

4-144 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Data Control Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-145


RAMPChanges in the inpu
value are output at th
specified inclination.

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


RAMP

Changes in the input value


RAMP RAMP Ramp
are output at the specified
signal
inclination.
ARITHMETIC OPERATION

Ladder program Input mode

Execution condition RAMP


S1 S2 S3 D R A M P S1 S2 S3 D
INSTRUCTIONS

Operand Explanation Occupied size


S1 Specifies the input value. 16 bits
S2 Specifies the change rate per time unit ( S3 ). 16 bits
S3 Specifies the time unit (0: second unit, 1: minute unit, 2: hour unit). 16 bits
D Specifies the storage location for the output value. 16 bits

4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
Data Control Instructions

"KV-5000/3000 CPU Function Version", (page 4)

4-146 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

Description of Operation

ARITHMETIC OPERATION
RAMP When the execution condition is ON, the D (output value) value is approached to the
specified inclination ( S2 (change rate) / S3 (time unit)) until the value matches
S1 (input value).

INSTRUCTIONS
When the output value is overwritten by an instruction other than the RAMP instruction,
the output approaches the input value at the specified inclination.
ON
Execution
condition OFF

Value

S1
(input
value) 4

Data Control Instructions


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

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 S3 >2 is specified
CR2012 • When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-147


Data Control Instructions

Sample Program
ARITHMETIC OPERATION

(1)When the internal relay MRO turns ON, the output value stored in data memory DM100 is changed
from +200 to +1000 at a rate of 50 per second.
(Mnemonics list)
INSTRUCTIONS

MR000 +200
DW.S LDP MR000
DM100 DW.S +200 DM100
MR000 LD MR000
RAMP RAMP +1000 #50 #0 DM100
+1000 #50 #0 DM100

4 ON

MR0
Data Control Instructions

OFF

DM100

1000

250
200

Time

1seconds

16 seconds

4-148 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

(2)When the internal relay MRO turns ON, the output value stored in data memory DM100 is changed
to the target value set in data memory DM200. When the output value increases, it changes at a rate

ARITHMETIC OPERATION
of 50 per second, and when the output value decreases, it changes at a rate of 100 per second.
(Mnemonics list)
MR000 +0
DW.S LDP MR000

INSTRUCTIONS
DM100 DW.S +0 DM100
MR000 DM200 LD MR000
RAMP MPS
>=.S DM200 #50 #0 DM100 AND>=.S DM200 DM100
DM100 RAMP DM200 #50 #0 DM100
MPP
DM200 RAMP AND<.S DM200 DM100
<.S DM200 #100 #0 DM100 RAMP DM200 #100 #0 DM100

4
DM100

ON

Data Control Instructions


MR0
OFF

0 300 100

DM200

DM100

300

100

Time

6 seconds 2 seconds

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-149


T
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
TPOUT

Time
TPOUT TPOUT Turns the bit ON/OFF at a
proportional
specified ON time and cycle.
output
ARITHMETIC OPERATION

Ladder program Input mode

Execution condition TPOUT


S1 S2 D T P O U T S1 S2 D
INSTRUCTIONS

Operand Explanation Occupied size


Specifies the time to keep D ON.
S1 16 bits
The specifiable range is 0 to 65535(ms).
Specifies the cycle to turn D ON/OFF.
S2 16 bits
The specifiable range is 1 to 65535(ms).

4 D Specifies the bit data to turn ON/OFF. *1


1 bit

*1 When bit data is specified, 1 bit is occupied. When word data is specified, the LSB of 1 word is
Data Control Instructions

used as an output relay. Bits other than LSB do not change.Bit specifying can not be used for
word devices.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", (page 4)

4-150 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

Description of Operation

ARITHMETIC OPERATION
TPOUT While the execution condition is ON, D is turned ON for S1 ms at the control
cycle specified with S2 ms.

INSTRUCTIONS
Execution ON
condition OFF

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

Data Control Instructions


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

Point • An error within ±10μs+1 scan time will occur.


• If 0 is specified for S1 , it 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 in interrupt programs or in the initialization module.
• Attention should be paid when used among the STP to STE instructions, among the
STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL instructions in
subroutine.
Refer to "Precautions when using timing instructions" in the User's Manual of the CPU
unit used.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit used.

Operation flag

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
• When S2 =0
CR2012
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* D turns OFF when S2 < S1 or S2 =0.


If CR2012 turns ON under any other condition, the instruction will not be executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-151


Data Control Instructions

Sample Program
ARITHMETIC OPERATION

While the internal relay MR0 is ON, the output relay R500 turns ON and performs pulse output at a1
second (1000ms) cycle for the ON time stored in data memory DM100.
(Mnemonics list)
INSTRUCTIONS

MR000 TPOUT LD MR000


DM100 #1000 R500 TPOUT DM100 #1000 R500

ON
MR0

4
OFF
Data Control Instructions

DM100 0 100 500 1000 800

R500

100ms 100ms 500ms 500ms 800ms

One second(1000ms)

4-152 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Data Control Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-153


L
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
LLFLT

LLFLT LLFLT Lead-lag Passes input through lead-lag filter


filter and then outputs.

Ladder program Input mode


ARITHMETIC OPERATION

Execution condition LLFLT


S D1 D2 L L F L T S D1 D2
INSTRUCTIONS

Operand Explanation Occupied size


S Specifies the filter input value. 16 bits
D1 Specifies the parameter.*1 16 bits x2
D2 Specifies the storage location for the filter output value. 16 bits

*1 When specifying bit data, specify the start of the channel.

4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Data Control Instructions

Series base units.


"KV-5000/3000 CPU Function Version", (page 4)

4-154 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

Description of Operation

ARITHMETIC OPERATION
LLFLT Description of Parameters

Parameter Explanation
Specifies the cycle time for executing the instruction. (1

INSTRUCTIONS
D1 Sampling period (TS) to 60000m)
Specify a value smaller than the lag time and lead time.
Specifies the time constant for the lag element. (0 to
D1 +
Lag time (T1) 65535ms)
1
Lag is disabled if 0 is specified.
Specifies the time constant for the lead element. (0 to
D1 +2 Lead time (T2) 65535ms)
Lead is disabled if 0 is specified.
4

Data Control Instructions


When the execution condition is 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 condition.

X : S input value
Y : D2 output value
T1:( D1 +1 )delay time input value
T2:( D1 +2 )lead time

When the following values are established,


the output value is calculated with the following formula. When T2>T1

1+ T2 s
Y (s) = X (s)
1+ T1 s output value
When T2<T1

Time

Reference When used in combination with the PIDAT instruction, this can be used to eliminate the
noise elements of the measured value or when using together with the feed forward
control.
“PIDAT Instruction”, (page 5-126)

Point • If writing is attempted during RUN, the sampling cycle ( D1 +1) is initialized, and the
output value ( D2 ) is initialized with the input value ( S ).
• This instruction cannot be used in interrupt programs or in the initialization module.
• Attention should be paid when used among the STP to STE instructions, among the
STG to JMP/ENDS instructions, and among the CJ (NCJ) to LABEL instructions in
subroutine.
Refer to "Precautions when using timing instructions" in the User's Manual of the CPU
unit used.
• Attention should be when when performing writing operation in the RUN mode.
Refer to "About Writing in the RUN Mode" in the User's Manual of the CPU unit used.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-155


Data Control Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

ON when one of the following conditions is established. Otherwise, OFF.


• When the interval for executing the instruction exceeds double the sampling cycle (TS)
(operation cycle exceeded)
• When D1 =0
CR2012 • When D1 ≧60001
• When the indirect specification or index modification range is inappropriate

4 •

When a timer/counter has been specified by indirect specification in D1 or
When an access outside the operand range occurs
D2

"Out-of-range access of operands", page 1-50


Data Control Instructions

* The instruction is executed even when the operation cycle is exceeded. If CR2012 turns ON in any
other case, the instruction is not executed.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
While the internal relay MR0 is ON, a lead-lag filter having 1 second(1000ms) sampling cycle, 5second
(5000ms) lag time, and 0 lead time (disabled) is applied on the input value stored in data memory
DM200. The resulting output value is stored in data memory DM100.
(Mnemonics list)
MR000 #1000 #5000 #0
DW DW DW LD MR000
DM500 DM501 DM502 DW #1000 DM500
CON
MR000 LLFLT DW #5000 DM501
DM200 DM500 DM100 CON
DW #0 DM502
LD MR000
LLFLT DM200 DM500 DM100

4-156 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Control Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Data Control Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-157


Data Conversion Instructions
TBCD
Binary → BCD conversion

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


TBCD

TBCD(.U)
TBCD TBCD.D TBCD
Binary → Converts BIN data stored in
BCD internal registers to BCD
@TBCD(.U) data.
@TBCD
conversion
ARITHMETIC OPERATION

@TBCD.D TBCD

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA TBCD STA T B C D

Execution condition
LDA TBCD STA @ T B C D

4 Description of Operation
Data Conversion Instructions

TBCD(.U) When the execution condition is ON, the 16-bit BIN data currently stored in the 16-bit
internal register is converted to 4-bit BCD data, and the result is stored in the 16-bit
internal register.
When the operation result exceeds the 4-bit BCD data range of 0 to 9999, operation flag
CR2012 turns ON. At this time, the value of the 16-bit internal register is not changed
before or after execution of the instruction.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

internal register 0000010011010010

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 0001001000110100

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 0000000010111100 0110000101001110

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 0001001000110100 0101011001111000

1 2 3 4 5 6 7 8

This instruction is executed for one scan at the rising edge of the execution condition.

4-158 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when the BIN data currently stored in the internal register is outside of the range. Otherwise,
CR2012
OFF

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43 4

Data Conversion Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-159


TBIN
BCD → Binary conversion

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


TBIN

TBIN(.U)
TBIN TBIN.D TBIN
BCD → Converts BCD data stored in
Binary internal registers to BIN
@TBIN(.U) data.
@TBIN
conversion
ARITHMETIC OPERATION

@TBIN.D TBIN

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA TBIN STA T B I N

Execution condition
LDA TBIN STA @ T B I N

4 Description of Operation
Data Conversion Instructions

TBIN(.U) When the execution condition is ON, the 4-bit BCD data currently stored in the 16-bit
internal register is converted to 16-bit BIN data, and the result is stored in the 16-bit
internal register.
When the 4-bit BCD data is outside of the range (0 to 9999), operation flag CR2012 turns
ON. At this time, the 16-bit internal register is not changed before or after execution of the
instruction.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

internal register 0001001000110100

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 0000010011010010

1234

TBIN.D When the execution condition is ON, the 8-bit BCD data currently stored in the 32-bit
internal register is converted to 32-bit BIN data, and the result is stored in the 32-bit
internal register.
When the 8-bit BCD data is outside of the range (0 to 99999999), operation flag CR2012
turns ON. At this time, the 32-bit internal register is not changed before or after execution
of the instruction.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

internal register 0001001000110100 0101011001111000

1 2 3 4 5 6 7 8

BIN conversion

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

internal register 0000000010111100 0110000101001110

12345678

@TBIN.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-160 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when the BCD data currently stored in the internal register is outside of the range.Otherwise,
CR2012
OFF

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43 4

Data Conversion Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-161


MPX 4
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano b
MPX,DMX

MPX
t
MPX s
4 bits → 16 bits To decode number of 1-digit (4-bit) in

internal register to 16-bit BIN data.
@MPX
decode
MPX
1
ARITHMETIC OPERATION

DMX DMX
16 bits → 4 bits
To encode bit position of the MSB
whose 16-bit BIN data in the internal
b
i

@DMX
encode t
DMX register is "1" to a 4-bit value. s
INSTRUCTIONS

Ladder program Input mode


Execution condition n
LDA MPX STA M P X n
Execution condition n
n

4
LDA MPX STA @ M P X
Execution condition
LDA DMX STA D M X
Execution condition
Data Conversion Instructions

LDA DMX STA @ D M X

Operand Explanation Occupied size


n Specifies the number of digits to multiplex.*1 —

*1 Only constants and variables / labels set as constants can be specified.

Description of Operation
MPX When the execution condition is ON, the n th digit of the 16-bit internal register is
digitized. The bit indicated by that value is turned ON ("1" is stored).

Example When the data currently stored in the 16-bit internal register is $71 and
n is #1.
n bit (#1)

#3 #2 #1 #0
16-bit
internal 0000000001110001
register

7 n (Since bit (#1) is “0111”


7 in DEC), bit7 of 16-bit
16-bit F E D C B A 9 8 7 6 5 1 3 2 1 0

internal 0000000010000000 internal register is set ON


register
(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

16-bit F E D C B A 9 8 7 6 5 4 3 2 1 0

internal 0000000010001010
register
The highest bit is bit7 in ON devices, so “7”

16-bit (0111 in BIN) is stored in 16-bit internal


internal 0000000000000111
register.
register

@□□□ This instruction is executed for one scan at the rising edge of the execution condition.

4-162 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when the value of the data (internal register) to be operated on is "0". Otherwise, OFF
CR2012
No change in the MPX instruction.

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43 4

Data Conversion Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-163


GRYBinary → Gray code
conversion
RGRYGray code → Binary
conversion

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


GRY,RGRY

GRY(.U)
GRY GRY.D GRY
Gray code
To convert the values
currently stored in
@GRY(.U) conversion internal registers to Gray
@GRY code.
ARITHMETIC OPERATION

@GRY.D GRY

RGRY(.U)
RGRY RGRY.D RGRY To convert the Gray code
INSTRUCTIONS

Gray code reverse currently stored in


@RGRY(.U) conversion internal registers to BIN
@RGRY @RGRY.D RGRY data.

Ladder program Input mode

4 Execution condition
LDA GRY STA G R Y
Data Conversion Instructions

Execution condition
LDA GRY STA @ G R Y

Execution condition
LDA RGRY STA R G R Y

Execution condition
LDA RGRY STA @ R G R Y

Description of Operation
GRY(.U) When the execution condition is ON, the 16-bit BIN data currently stored in the 16-bit
internal register is converted to gray code.

GRY.D When the execution condition is ON, the 32-bit BIN data currently stored in the 32-bit
internal register is converted to gray code.

RGRY(.U) When the execution condition is ON, the gray code currently stored in the 16-bit internal
register is converted to 16-bit BIN data.

RGRY.D When the execution condition is ON, the gray code currently stored in the 32-bit internal
register is converted to 32-bit BIN data.

@□□□ This instruction is executed for one scan at the rising edge of the execution condition.

4-164 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Gray code table

bit
Decimal

ARITHMETIC OPERATION
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

INSTRUCTIONS
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
4 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
5 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
6 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
7 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
8
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
1
4

Data Conversion Instructions


10 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-165


Data Conversion Instructions

Sample Program
ARITHMETIC OPERATION

The unsigned 16-bit BIN data currently stored in data memory DM0 is converted to Gray code. The
result is stored to DM10. The result is stored to DM10.
(Mnemonics list)
INSTRUCTIONS

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 to DM0.
Data Conversion Instructions

(Mnemonics list)
CR2002 R000 $00FF DM0
LDA ANDA RGRY STA LD CR2002
LDA R000
CON
ANDA $FF
CON
RGRY
CON
STA DM0

When converting remainder gray codes, the relationship between A: resolution, n: input bit count andm:
remainder gray setting value is as follows.
m = (2n–A)/ 2 (n is a value that satisfies the relation 2n-1< A ≦2n)
When the resolution is 360, n = 9 (input mask bit 9 bits (H01FF)), m = 76
Remainder Gray codes of resolution 360 loaded by input relays R30000 to R30008 are converted to 16-
bit unsigned BIN data.
The result is stored to DM0.
(Mnemonics list)
CR2002 R30000 $01FF #76 DM0
LDA ANDA RGRY SUB STA LD CR2002
常時ON LDA R30000
CON
ANDA $01FF
CON
RGRY
CON
SUB #76
CON
STA DM0

4-166 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Data Conversion Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-167


DISNWord (16 bits) →
Nibble (4 bits) dispersion

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


DISN

DISN(.U)
DISN
DISN
DISN.D To disperse data into nibbles
Disperse (in 4 bits) and store each of
@DISN(.U) nibble them to the reference
@DISN
DISN
destination.
ARITHMETIC OPERATION

@DISN.D

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


INSTRUCTIONS

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
Data Conversion Instructions

Ladder program Input mode


Execution condition DISN
S D D I S N S D

Execution condition DISN


S D @ D I S N S D

Operand Explanation Occupied size


.U 16 bits
S Specifies the data to be dispersed.
.D 32 bits
.U 16 bits x 4
D Specifies the storage location for the dispersed data.
.D 16bits x 8
n Specifies the number of dispersed data. (.U: 0 to 4, .D: 0 to 8)。* 1 16 bits

*1 When n is 0, the instruction is not executed.

Description of Operation
DISN(.U) KV-1000 When the execution condition is ON, the content of S (16 bits) is dispersed
to 4 digits bit wise (4 bits), and is stored in D to D +3. "0" is stored in the
high-order bits from Bit 4.
bit bit bit bit
15 8 7 0

1 2 3 4 : S
bit bit bit bit
15 8 7 0

0 0 0 4 : D
0 0 0 3 : D +1
0 0 0 2 : D +2
0 0 0 1 : D +3

Filled with 0 in higher 12 bits.

KV-8000/7500/7300/5500/5000/3000,
KV-5500/5000/3000, KV Nano Series
KV Nano Series When performing above operation, the bits
stored after dispersed by n can be used.

4-168 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

DISN.D KV-1000 When the execution condition is ON, the content of S (32 bits) is dispersed
to 4 digits bit wise (4 bits), and is stored in D to D +7. "0" is stored in the

ARITHMETIC OPERATION
high-order bits from Bit 4.
bit bit bit bit bit bit bit bit
31 24 23 16 15 8 7 0

S +1 1 2 3 4 5 6 7 8 : S

INSTRUCTIONS
bit bit bit bit
15 8 7 0

0 0 0 8 : D
0 0 0 7 : D +1
0 0 0 6 : D +2
0 0 0 5 : D +3
0 0 0 4 : D +4

0 0 0 3 : D +5
0

0
0

0
0

0
2

1


D
D
+6

+7
4

Data Conversion Instructions


Filled with 0 in higher 12 bits.

KV-8000/7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits


stored after dispersed by n can be used.

@DISN.□ 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 the indirect specification or index modification range is inappropriate, or an access outside
the operand range occurs; Otherwise OFF. It will not change when indirect specification or index
CR2012
modification is not specified in the operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program

■ KV-8000/7500/7300/5500/5000/3000 and KV Nano Series


When input R000 is ON, the low-order 2 bits of 4-bit BCD data currently stored in data memory DM0 is
dispersed in nibbles. 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 relay R000 is ON, the 4-bit BCD data currently stored in data memory DM0 is dispersed bit
wise in nibbles. The result is stored in 4 words starting from DM10.
(Mnemonics list)
R000 DISN
DM0 DM10 LD R000
DISN DM0 DM10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-169


UNINNibble (16
Word (4 bits)bits)

unification

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


UNIN

UNIN(.U)
UNIN
UNIN
UNIN.D To unite low-order 4 bits of
data stored in the reference
Unite nibble
@UNIN(.U) source to 16-bit (32-bit) BIN
@UNIN
UNIN
data.
ARITHMETIC OPERATION

@UNIN.D

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


INSTRUCTIONS

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
Data Conversion Instructions

Ladder program Input mode


Execution condition UNIN
S D U N I N S D

Execution condition UNIN


S D @ U N I N S D

Operand Explanation Occupied size


.U 16 bits x 4
S Specifies the start of the data to be united.
.D 16bits x 8
.U 16 bits
D Specifies the storage location for the united data.
.D 32 bits
n Specify the number of united data. (.U: 0 to 4, .D: 0 to 8)。* 1 16 bits

*1 When n is 0, the instruction is not executed.

Description of Operation
UNIN(.U) KV-1000 When the execution condition is ON, the low-order 4 bits of S to S +3
are united into 16-bit BIN data, and are stored in D .
bit bit bit
15 4 0

S : 1

S +1 : 2

S +2 : 3

S +3 : 4

bit bit bit bit


15 8 7 0

D : 4 3 2 1

KV-8000/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-170 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

UNIN.D KV-1000 When the execution condition is ON, the low-order 4 bits of S to S +7
are united into 32-bit BIN data, and are stored in D .

ARITHMETIC OPERATION
bit bit bit bit bit
15 8 7 4 0

S : 1

S +1 : 2

INSTRUCTIONS
S +2 : 3

S +3 : 4

S +4 : 5

S +5 : 6

S +6 : 7

S +7 : 8

4
bit bit bit bit bit bit bit bit
31 24 23 16 15 8 7 0

D +1: 8 7 6 5 4 3 2 1 : D

KV-8000/7500/7300/5500/5000/3000, KV Nano Series The operation is performed as stated above.

Data Conversion Instructions


However, the number of digits to be united and
stored can be specified using n .

@UNIN.□ 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 the indirect specification or index modification range is inappropriate, or an access outside
the operand range occurs; Otherwise OFF. It will not change when indirect specification or index
CR2012
modification is not specified in the operand, and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program

■ KV-8000/7500/7300/5500/5000/3000 and KV Nano Series


When input relay R000 is ON, the BCD data currently stored in the low-order 4 bits of data memories
DM0 to DM1 are united. The result is stored to 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 low-order 4 bits of data memories
DM0 to DM3 are united. The result is stored to DM10.
(Mnemonics list)
R000 UNIN
DM0 DM10 LD R000
UNIN DM0 DM10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-171


DISBWord (16 bits) →
Byte (8 bits)
dispersion

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


DISB

DISB(.U)
DISB
DISB
DISB.D To disperse data into bytes
Disperse (in 8 bits) and store each of
@DISB(.U) byte them to the reference
@DISB
DISB
destination.
ARITHMETIC OPERATION

@DISB.D
INSTRUCTIONS

KV-8000 KV-7500/7300 KV-5500/5000/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
Data Conversion Instructions

Ladder program Input mode


Execution condition DISB
S D D I S B S D

Execution condition DISB


S D @ D I S B S D

Operand Explanation Occupied size


.U 16 bits
S Specifies the data to be dispersed.
.D 32 bits
.U 16 bits x 2
D Specifies the start to store the dispersed data.
.D 16bits x 4
n Specifies the number of dispersed data. (.U: 0 to 2, .D: 0 to 4)。* 1 16 bits

*1 When n is 0, the instruction is not executed.

Description of Operation
DISB(.U) KV-1000 When the execution condition is ON, the content of S (16 bits) is dispersed
to 2 digits bit wise (8 bits), and is stored in D to D +1. "0" is stored in the
high-order bits from Bit 8.
bit bit bit bit
15 8 7 0

S : 1 2 3 4

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-8000/7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits
stored after dispersed by n can be used.

4-172 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

DISB.D KV-1000 When the execution condition is ON, the content of S (32 bits) is dispersed
to 4 digits bit wise (8 bits), and is stored in D to D +3. "0" is stored in the

ARITHMETIC OPERATION
high-order bits from Bit 8.
bit bit bit bit bit bit bit bit
15 8 7 0 15 8 7 0

S +1: 1 2 3 4 5 6 7 8 : S

INSTRUCTIONS
bit bit bit bit
15 8 7 0

D : 0 0 7 8

D +1 : 0 0 5 6

D +2 : 0 0 3 4

D +3 : 0 0 1 2

Filled with 0
in higher bytes (8-bits). 4
KV-8000/7500/7300/5500/5000/3000, KV Nano Series When performing above operation, the bits

Data Conversion Instructions


stored after dispersed by n can be used.

@DISB.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point "0" is stored to the high-order 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 indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program

■ KV-8000/7500/7300/5500/5000/3000 and KV Nano Series


The data captured from input relays R30000 to R30007 is dispersed into bytes, and stored in data
memory DM10.
(Mnemonics list)
R000 DISB
R30000 DM10 #1 LD R000
DISB R30000 DM10 #1

■ KV-1000
The data loaded from input relays R30000 to R30015 are dispersed into bytes, and stored in data
memories DM10 and DM11.
(Mnemonics list)
CR2002 DISB
R30000 DM10 LD CR2002
DISB R30000 DM10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-173


UNIBByte
(16 bits)(8unification
bits) → Word

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


UNIB

UNIB(.U)
UNIB
UNIB
UNIB.D To unite low-order 8 bits of
data stored in the reference
Unite byte
@UNIB(.U) source to 16-bit (32-bit) BIN
@UNIB
UNIB
data.
ARITHMETIC OPERATION

@UNIB.D
INSTRUCTIONS

KV-8000 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


@ U N I B S D n

4
S D n

KV-1000
Data Conversion Instructions

Ladder program Input mode


Execution condition UNIB
S D U N I B S D

Execution condition UNIB


S D @ U N I B S D

Operand Explanation Occupied size


.U 16 bits x 2
S Specifies the start to store the united data.
.D 16bits x 4
.U 16 bits
D Specifies the storage location for the united data.
.D 32 bits
n Specify the number of united data. (.U: 0 to 2, .D: 0 to 8)。* 1 16 bits

*1 When n is 0, the instruction is not executed.

Description of Operation
UNIB(.U) KV-1000 When the execution condition is ON, the low-order 8 bits of S to S +1
are united into 16-bit BIN data, and are stored in D .
bit bit bit bit
15 8 7 0

S : 3 4

S +1 : 1 2

bit bit bit bit


15 8 7 0

D : 1 2 3 4

KV-8000/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 .

4-174 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

UNIB.D KV-1000 When the execution condition is ON, the low-order 8 bits of S to S +3
are united into 32-bit BIN data, and are stored in D .

ARITHMETIC OPERATION
bit bit bit bit
15 8 7 0

S : 7 8

S +1 : 5 6

INSTRUCTIONS
S +2 : 3 4

S +3 : 1 2

bit bit bit bit bit bit bit bit


31 24 23 16 15 8 7 0

D
KV-8000/7500/7300/5500/5000/3000, KV Nano Series
+1: 1 2 3 4 5 6 7 8

The operation is performed as stated above.


: D
4
However, the number of digits to be united

Data Conversion Instructions


and stored can be specified using n .

@UNIB.□ 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 the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program

■ KV-8000/7500/7300/5500/5000/3000 and KV Nano Series


The 2-bit BCD data captured by input relays R30000 to R30007 are connected, and stored in data
memory 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 (low-order 2 bits after uniting) and
R30100 to R30107 (high-order 2 bits after uniting) are united, and stored in data memory DM10.
(Mnemonics list)
CR2002 UNIB
R30000 DM10 LD CR2002
UNIB R30000 DM10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-175


SWAPSwap the high-order /
low-order data

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


SWAP

SWAP(.U)
SWAP SWAP.D SWAP
To swap the high-order / low-
Swap order data of the internal
@SWAP(.U) register.
@SWAP
ARITHMETIC OPERATION

@SWAP.D SWAP

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA SWAP STA S W A P

Execution condition
LDA SWAP STA @ S W A P

4 Description of Operation
Data Conversion Instructions

SWAP(.U) When the execution condition is ON, the values of the high-order byte (high-order 8 bits)
and low-order byte (low-order 8 bits) of the 16-bit data currently stored in 16-bit internal
register are swapped, and stored in 16-bit internal register.

Example When $1234 is stored in 16-bit internal register


bit bit bit bit
15 8 7 0

Before 1 2 3 4 ←16-bit internal register:$1234


executing

After
3 4 1 2 ←16-bit internal register:$3412
executing

SWAP.D When the execution condition is ON, the values of the high-order word (high-order 16 bits)
and low-order word (low-order 16 bits) of the 32-bit data currently stored in 32-bit internal
register are swapped, and stored in 32-bit internal register.

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
1 2 3 4 5 6 7 8 ←32-bit internal register:$12345678
executing

After
executing 5 6 7 8 1 2 3 4 ←32-bit internal register:$56781234

@SWAP.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

CR2009 No change in state


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

4-176 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Sample Program

ARITHMETIC OPERATION
When input relay R000 is ON, the high-order and low-order bytes of data memory DM0 are swapped,
and stored in DM10.
(Mnemonics list)

INSTRUCTIONS
R000 DM0 DM10
LDA SWAP STA LD R000
LDA DM0
CON
SWAP
CON
STA DM10

Data Conversion Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-177


BSWAPBlock
order swap of high-
and low-order data

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


BSWAP

BSWAP BSWAP
Block
Swaps the high-order byte and low-
order byte of data in a specified
swap
@BSWAP BSWAP range.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition BSWAP
n D n
INSTRUCTIONS

D B S W A P

Execution condition BSWAP


D n @ B S W A P D n

Operand Explanation Occupied size


Specifies the start of the data block in which the high-order byte and
16 bit x n

4
D
low-order byte are swapped.
n Specifies the range of data to be swapped. 16 bits
Data Conversion Instructions

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
BSWAP When the execution condition is ON, the high-order byte (high-order 8 bits) and low-order
byte (low-order 8 bits) of n data starting from D are swapped.
high-order 8 bits low-order 8 bits high-order 8 bits low-order 8 bits

D 12 34 34 12 D
D +1 56 78 78 56 D +1
D +2 9A BC BC 9A D +2
D +3 DE FG FG DE D +3

D + n −2 ST UV UV ST D + n −2
D + n −1 WX YZ YZ WX D + n −1

@BSWAP This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

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 n is 0
• When D + n -1 exceeds the device / work area range
CR2012 • When a timer/counter is specified in D by indirect specification
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-178 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Sample Program

ARITHMETIC OPERATION
When the input relay R000 is ON, the high-order bytes and low-order bytes of data memory DM0
toDM99 are swapped.
(Mnemonics list)

INSTRUCTIONS
R000 BSWAP LD R000
DM0 #100 BSWAP DM0 #100

Data Conversion Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-179


XCHExchange

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


XCH

XCH(.U)
XCH
XCH
XCH.D
To exchange data of
Exchange two reference
@XCH(.U) destinations.
@XCH
XCH
ARITHMETIC OPERATION

@XCH.D

Ladder program Input mode


INSTRUCTIONS

Execution condition XCH


D1 D2 X C H D1 D2

Execution condition @XCH


D1 D2 @ X C H D1 D2

4
Operand Explanation Occupied size
.U 16 bits
D1 Specifies the data to be exchanged.
.D 32 bits
Data Conversion Instructions

.U 16 bits
D2 Specifies the data to be exchanged.
.D 32 bits

Description of Operation
XCH(.U) When the execution condition is ON, the 16-bit data currently stored in D1 and D2
are exchanged.

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 32-bit data currently stored in [ D1 / D1 +1]
and [ D2 / D2 +1] are exchanged.

Example When the execution condition is ON, the 32-bit data currently stored in
[ D1 / D1 +1] and [ D2 / D2 +1] are exchanged.
Before executing After executing
bit
31
D1 +1 D1 bit
0
bit
31
D1 +1 D1 bit
0

0 1 2 3 4 5 6 7 8 9 A B C D E F

bit
31
D2 +1 D2 bit
0
bit
31
D2 +1 D2 bit
0

8 9 A B C D E F 0 1 2 3 4 5 6 7

@XCH.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-180 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF. It will not change when indirect specification
CR2012 or index modification is not specified in the operand, and the access outside the operand range is
not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Data Conversion Instructions


"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the unsigned 16-bit BIN data currently stored in data memories DM0
toDM9 is exchanged in order of the smallest value starting from DM0. When the exchange is
completed, the program sequence between the FOR and NEXT instructions ends.
(Mnemonics list)
FOR
#9 FOR #9
LD R000
R000 #0 TM10 #1 TM11 R1000 LDA #0
LDA STA LDA STA RES CON
STA TM10
CON
FOR LDA #1
#9 CON
STA TM11
CON
#TM10 XCH
RES R1000
> #TM10 #TM11
FOR #9
#TM11
LD> #TM10 #TM11
R1000 XCH #TM10 #TM11
SET SET R1000
CR2002 TM10 TM11 LD CR2002
INC INC INC TM10
CON
INC TM11
NEXT
NEXT
LDB R1000
BREAK
R1000 BREAK NEXT

NEXT

"FOR/NEXT", page 3-32


Refer to "index specifying" in the User's Manual of the CPU unit used.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-181


DECOTo
numbers decode
of the
the low-
order n bits
internal of the
register to
2n bit BIN data

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


DECO

DECO DECO
8-bit decode
To decode the numbers of the low-order
n bits of the internal register
@DECO DECO to 2n bit BIN data (n=1 to 8)。
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition D
LDA DECO D E C O D n
INSTRUCTIONS

Execution condition D
LDA DECO @ D E C O D n
n
Operand Explanation Occupied size

4 D Specifies the start to store the decode result.*1 1 bit × 2^ n


n Specifies the number of bits (up to 8 bits) to decode.*2 16 bits

*1 When word data is specified, the LSB of continuous 2n word data becomes the storage location
Data Conversion Instructions

for the decode result (Other bits than the LSB do not change).
*2 Devices other than DM/EM/ZF can be used only with KV-8000/7000 Series CPU unit, KV-5000/
3000 Series CPU unit with CPU function version 2.0 or later, and KV Nano Series base units.

Description of Operation
DECO When the execution condition is ON, the low-order n bits of the internal register are
decoded. (From here on, the decoded DEC value is set to "K".)
In the continuous 2n bits starting from D , the (K + Start No.) bit is turned ON ("1" is
stored). Others are turned OFF ("0" is stored).

Example When the data currently stored in the internal register is #5, D is
MR100, and n is #3

internal register 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 n 3 bits

Since bit3 is“101”


5
(5 in DEC), MR105 is
set ON (filled with 1).
107 106 105 104 103 102 101 100
Others OFF (Filled with 0).
MR100∼MR107 0 0 1 0 0 0 0 0

@DECO This instruction is executed for one scan at the rising edge of the execution condition.

4-182 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
• When n ≧9
• When the continuous 2 n bit data starting from D exceeds the device / work area
range
• When the indirect specification or index modification range is inappropriate
CR2012 • When an access outside the operand range occurs
ON in the above cases. Otherwise, OFF.
It will not change when n is a constant and indirect specification or index modification is not
specified for D , and the access outside the operand range is not checked. 4
"Out-of-range access of operands", page 1-50

Data Conversion Instructions


* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When BIN digital switch one bit is connected to input relays R30000 to R30003, and lamps 0 to 15 are
connected to each of output relays R30500 to R30515.
The worker lights the lamp matched to the setting of the BIN digital switch.
When the digital switch is set to "8", output relay R30508 turns ON, and lamp "8" lights.
(Mnemonics list)
CR2002 R30000 R30500
LDA DECO LD CR2002
#4 LDA R30000
CON
DECO R30500 #4

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-183


ENCOEncode the ON
position of bit data
after the specified
range to a value

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


ENCO

ENCO ENCO
8-bit encode
To encode "1" (ON) positions in the
specified continuous n bit data to an 8-bit
@ENCO ENCO value.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition S
ENCO STA E N C O S n
INSTRUCTIONS

Execution condition S
ENCO STA @ E N C O S n
n
Operand Explanation Occupied size

4 S

Specifies the start to store the encode target.*1
Specifies the number of bits (1 to 256) to encode.*2
1 bit×
16 bits

*1 When word data is specified, the LSB of continuous word data becomes the storage
Data Conversion Instructions

location for the decode result (Other bits than the LSB do not change).
*2 Devices other than DM/EM/ZF can be used only with KV-8000/7000 Series CPU unit, KV-5000/
3000 Series CPU unit with CPU function version 2.0 or later, and KV Nano Series base units.

Description of Operation
ENCO When the execution condition is ON, the positions of bits turned ON (set to 1) in the
continuous n bits starting from S are stored as BIN data in the 16-bit internal
register.
When multiple bits in n bits are ON ("1"), the LSB is valid.
The value of 0 to ( n -1) is stored in the 16-bit internal register.

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

4-184 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

ON in the following cases. Otherwise, OFF.


• When n ≧257
• When n =0

ARITHMETIC OPERATION
• When the data specified by S and n exceed the device / work area range
CR2012
• When n bits from S are not ON
• When the indirect specification or index modification range is inappropriate

INSTRUCTIONS
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

4
"CR/CM List", page A-43

Sample Program

Data Conversion Instructions


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.
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-185


ABSAbsolute value

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


ABS

ABS(.S)
ABS.L
ABS ABS.F
ABS.DF
ABS

Absolute
ARITHMETIC OPERATION

Retrieves the absolute value.


@ABS(.S) value
@ABS.L
@ABS @ABS.F
@ABS.DF
ABS
INSTRUCTIONS

Ladder program Input mode


Execution condition
LDA ABS STA A B S

4 Execution condition
LDA ABS STA @ A B S
Data Conversion Instructions

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
ABS(.S) When the execution conditions turn ON, if the data stored in the 16-bit internal register is
less than 0, the sign is reversed (two's complement operation), and the value is stored in
the internal register.
This is not executed if the value stored in the internal register is greater than 0.
bit bit
15 0

16-bit internal register 1100111111000111 Befo


exec
#ー12345
bit bit
15 0

10000000000000000

1100111111000111

bit bit
15 0

16-bit internal register 0011000000111001 Afte


exec
#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.
bit bit bit bit
31 16 15 0

16-bit 10110110011010011111110100101110 Before


internal register execution
#ー1234567890
bit bit bit bit
31 16 15 0

100000000000000000000000000000000

10110110011010011111110100101110

bit bit bit bit


31 16 15 0

32-bit 01001001100101100000001011010010 After


internal register execution
#1234567890

4-186 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

ABS.F When the execution condition is ON, if the single precision floating point type real number
stored in the 32-bit internal register is less than 0, the sign is reversed and the value is

ARITHMETIC OPERATION
stored in the internal register.
This is not executed if the value stored in the internal register is greater than 0.

When internal register value < 0

INSTRUCTIONS
32-bit internal register 32-bit internal register

Single precision floating point type real number -1 × Single precision floating point type real number

32-bit 32-bit

ABS.DF When the execution conditions turn ON, if the double precision floating point type real
number stored in the 64-bit internal register is less than 0, the sign is reversed and the
value is stored in the internal register. 4
This is not executed if the value stored in the internal register is greater than 0.

Data Conversion Instructions


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.□ 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
For suffix "S/L":
ON when one of the following conditions is established. Otherwise, OFF.
• When the internal register value is -32768 (.S)/-2147483648 (.L)
CR2012 For suffix "F/DF":
ON when one of the following conditions 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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-187


CPMSETCIP message
creation

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


CPMSET

CPMSET CPMSET
CIP message Creates the data sent with
creation CIP messaging.
@CPMSET CPMSET
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition CPMSET
INSTRUCTIONS

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

Operand Explanation Occupied size

4 S1 Specifies the start of the transmit data to be added.*1


Number of CIP
characters*2
S2 Specifies the type or size (in bytes) of the transmit data to be added. 16 bits
Data Conversion Instructions

Specifies the start of the transmit data of the CIP data type to be Number of CIP
D
created.*1 characters*2

*1 When specifying bit data, specify the start of the channel.


*2 The occupied size is determined by the content of the stored data.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
CPMSET When the execution condition is ON, the data stored in S1 is added to the area
following the data size (in bytes) stored in D + 0 in the data type specified with the
high-order 4 bits of S2 and the data size (in bytes) specified with the low-order 12 bits
of S2 .
The data size of D +0 is updated after the data is added.
When the data is added for the first time, 0 is stored in D +0 before the instruction is
executed.
The CPMSET instruction is used to create the CIP data type text string data and numeric
data.
For details on the CIP data types, refer to "EtherNet/IP Function User's Manual".
bit bit
15 0
S2
Data type Data size (byte unit)

High-order 4 bits Low-order 12 bits

High-order 4 bits Low-order 12 bits


0: Other than text string 1 to 4095 (001H to FFFH): Specifies data size
0 to 1999 (000H to 7CFH): Specifies number of characters to convert into CIP text
string type data.
1: Text string If 0 is specified, characters up to NULL(00H) are converted.
If the specified number of characters contains NULL(00H), 00H is added to the data
following NULL(00H).
2 or more: Reserved -
for system
4-188 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Data Conversion Instructions

Example The operation of the CPMSET instruction is explained using creation of the following type
of CIP data type send data as an example.

ARITHMETIC OPERATION
Send data to be created
bit bit
15 0

INSTRUCTIONS
13(000DH) Data size (byte unit)
22H 11H 2-byte numeric data 2211H
5(0005H) CIP text string type data "ABCDE"
The CIP text string type data specifies
B(42H) A(41H)
the data size with the leading word,
D(44H) C(43H) and stores the text string in the order

4
of low-order byte to high-order byte.
33H E(45H)
55H 44H 4-byte numeric data 66554433H

Data Conversion Instructions


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 the string) is specified in
S2 ,and the CPMSET instruction is executed. When D +0 is 0, the numeric

data is stored following D + 1, and the stored data size (in bytes) is added to
D +0.
Data storage start position: 0
Specifies 2-byte numeric data bit bit
15 0
S2 0002H
0(0000H) D +0
bit bit
15 0 D +1
S1 +0 22H 11H

Add data size


bit bit
15 0
2(0→2) D +0
22H 11H D +1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-189


Data Conversion Instructions

Example 2) Convert the text string "ABCDE" into CIP text string type data, and add it. In
this example, the data is added after the Example 1) 2-byte numeric data.
ARITHMETIC OPERATION

Specify 1000H (text string)* in S2 , and execute CPMSET instruction. Convert the
text string specified after S1 into CIP text string type data, and add to the end of
the CIP message specified in D created in Example 1). The added data size (in
INSTRUCTIONS

bytes)
is added to D +0.
*If 0 is specified for the low-order 12 bits of S2 , the text string up to NULL (00H)
is converted.

4
CIP message created in Example 1)
bit bit
15 0
2(0002H) D +0
Specifies text string
Data Conversion Instructions

bit bit 22H 11H D +1


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
data size 22H 11H D
Text string up to NULL(00H) is +1
converted into CIP text string type 5(0005H) D +2
data and added. B(42H) A(41H) D +4
D(44H) C(43H) D +5
E(45H) D +6
D +7

Example 3) The 4-byte numeric data is stored. In this example, the data is added after the
Example 2) text string data.
0004H (4 bytes other than text string) is specified in S2 , and the CPMSET
instruction is executed.
The numeric data is added after the CIP message specified in D created in
Example 2). The added data size (in bytes) is added to D +0.
bit bit
15 0
Specifies 4-byte numeric data 9 D +0

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-190 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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

ARITHMETIC OPERATION
of bytes is stored. 00H is added to the characters following NULL(00H). The
specified number of characters is added to D +0.

INSTRUCTIONS
Specifies number of characters
00H is stored after
S2 16(0010H) NULL(00H)
High-order Low-order
bit bytes bytes bit bit bit
15 0 Low-order bytes 15 0
S1 +0 ① A(41H) ② B(42H)
Low-order bytes Data size (byte unit) D +0
of character size 3⇒21

4
High-order bytes
S1 +1 ③ C(43H) NUL(00H) of character size
D +1
Low-order bytes
S1 +2 ① A(41H) of character size
D +2
High-order bytes

Data Conversion Instructions


S1 +3 ② B(42H) ① A(41H)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 a bit other than the start of the channel is specified when bit data is specified for S1
and D
• When the high-order 4 bits of S2 is 1 (text string), and the text string length of S1 is 0 or
is 2000 or more
• When the high-order 4 bits of S2 is 1 (text string), and S1 does not have an end
character
• When the high-order 4 bits of S2 is 1 (text string), and the low-order 12 bits of S2 is
2000 or more
• When the high-order 4 bits of S2 is 0 (not text string), and the low-order 12 bits of S2 is
CR2012 0
• When the high-order 4 bits of S2 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 low-order 12 bits of S2 exceeds the device
/ work area range of S1
• When the added data D exceeds the device / work area range
• When a timer/counter has been specified by indirect specification in S1 or D
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-191


Data Conversion Instructions

Sample Program
ARITHMETIC OPERATION

When the input relay MR000 turns ON, the data is converted into CIP data in the order of unsigned 16-
bit BIN data (1234), text string (ABCD: 4 bytes), and unsigned 32-bit BIN data (1234567890), and is
stored in DM1 and following. The total data is stored in DM0.
INSTRUCTIONS

(Mnemonics list)
MR000 MOV
#1234 @DM0 LDP MR000
MOV #1234 @DM0
CPMSET @DM0 #2 DM0
CPMSET SMOV "ABCD" @DM0
CPMSET @DM0 $1000 DM0

4
@DM0 #2 DM0 MOV.D #1234567890 @DM0
CPMSET @DM0 #4 DM0
SMOV
Data Conversion Instructions

“ABCD” @DM0

CPMSET
@DM0 $1000 DM0

MOV.D
#1234567890 @DM0

CPMSET
@DM0 #4 DM0

4-192 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Data Conversion Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-193


CPMGETCIP
retrieval message

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


CPMGET

The text string data


CPMGET CPMGET
CIP message
and numeric data
are retrieved from
retrieval
@CPMGET CPMGET the data received
with CIP messaging.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition CPMGET
INSTRUCTIONS

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

Operand Explanation Occupied size

4 S1 Specifies the start of data received in CIP data type.*1


Number of CIP
characters*2
S2 Specifies the type or size (in bytes) of data to be retrieved. 16 bits
Data Conversion Instructions

Specifies the byte offset position from the start of the received data
D1 16 bits
that specifies the retrieve position.
Number of CIP
D2 Specifies the storage location for the retrieved data.*1
characters*2

*1 When specifying bit data, specify the start of the channel.


*2 The occupied size is determined by the content of the stored data.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
CPMGET When the execution condition is ON, the data following the byte offset position specified in
D1 of the data stored after S1 is stored in D2 with the data type specified by
the high-order 4 bits of S2 and the data size (in bytes) specified by the low-order 12
bits of S2 . After storing the data, the byte offset position of D1 is updated.
When retrieving from the start of the received data, the instruction is executed after storing
0 in D1 . The byte offset position is updated, so continuous data can be retrieved.
The CPMGET instruction is used to read the numeric value or text string of the CIP data
type received with CIP messaging, etc.
For details on the CIP data types, refer to "EtherNet/IP Function User's Manual".
bit bit
15 0
S2
Data type Data size (byte unit)

High-order 4 bits Low-order 12 bits

High-order 4 bits Low-order 12 bits


0: Other than text string 1 to 4095 (001H to FFFH): Specifies data size
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
specified, the data up to the specified number of characters is stored.
2 or more: Reserved -
for system
4-194 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Data Conversion Instructions

Example The usage of the CPMGET instruction is explained using the following received data as
an example.

ARITHMETIC OPERATION
Received data
bit bit
15 0

INSTRUCTIONS
S1 +0 13(000DH) Data size (byte unit)
S1 +1 22H 11H 2-byte numeric data 2211H
S1 +2 5(0005H) CIP text string type data "ABCDE"
S1 +3 B(42H) A(41H) The CIP text string type data specifies
S1 +4 D(44H) C(43H)
the data size with the leading word,
and stores the text string in the order
S1 +5 33H E(45H) of low-order byte to high-order byte.
S1 +6
S1 +7
55H 44H
66H 4-byte numeric data 66554433H
4

Data Conversion Instructions


Example 1) Read the numeric data of the first two bytes.
Specify 0 (offset position 0) in D1 and 0002H (two bytes other than text string) in
S2 , and execute the PMGET 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-195


Data Conversion Instructions

Example 2) Read the CIP text string type data following the offset position 2.
Specify 2 (offset position 2) in D1 and 1000H (text string) in S2 , and execute
ARITHMETIC OPERATION

the CPMGET instruction.


If 0 is specified for the low-order 12 bits of S2 , the text string with the data size
specified by the offset position is read.
INSTRUCTIONS

Offset position: 0 Specify text string Offset position: Specify 2


S2 1000H D1 2
bit bit
15 0
S1 +0 13(000DH)

4
S1 +1 22H 11H
S1 +2 5(0005H)
S1 +3 B(42H) A(41H) Retrieve data
Data Conversion Instructions

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 byte


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 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-196 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Conversion Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When a bit other than the start of the channel is specified when bit data is specified for S1
and D
• When the high-order 4 bits of S2 are 1 (text string) and the low-order 12 bits are 0, and a
text string with the length of 2000 or more contained in S1 is specified
• When the high-order 4 bits of S2 is 1 (text string), and the low-order 12 bits of S2 is
2000 or more
• When the high-order 4 bits of S2 is 0 (not text string), and the low-order 12 bits of S2 is 4
CR2012 0

Data Conversion Instructions


• When the high-order 4 bits of S2 is 2 or more
• When D1 before execution is larger than the data size specified in S1 +0
• When D1 after execution exceeds the data size specified in S1 +0
• When the indirect specification or index modification range is inappropriate
• When the data stored in D2 exceeds the device / work area range after execution
• When a timer/counter has been specified by indirect specification in S1 or D2
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-197


Floating Point Instructions
FLOATBinary → Singl
precision floating poin
type real number conversion

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


FLOAT

FLOAT(.U)
FLOAT.S Binary →
FLOAT FLOAT.D
FLOAT.L
FLOAT
Single
To convert data of internal
precision
registers to single
ARITHMETIC OPERATION

floating point
@FLOAT(.U) precision floating point
type real
@FLOAT.S type real number.
@FLOAT @FLOAT.D
@FLOAT.L
FLOAT
number
conversion
INSTRUCTIONS

Ladder program Input mode


Execution condition
LDA FLOAT STA.F F L O A T

4 Execution condition
LDA FLOAT STA.F @ F L O A T
Floating Point Instructions

Description of Operation
FLOAT(.U) When the execution condition is ON, the unsigned 16-bit BIN data currently stored in
the16-bit internal register is converted to a single precision floating point type real
number, and the result is stored in the 32-bit internal register.
Before executing After executing
16-bit internal registerbit
bit bit 32-bit internal register bit
15 0 31 0

Unsigned 16-bit BIN data Single precision floating point type real number

16-bit 32-bit

FLOAT.S When the execution condition is ON, the signed 16-bit BIN data currently stored in the 16-
bit internal register is converted to a single precision floating point type real number, and
the result is stored in the 32-bit internal register.
Before executing After executing
16-bit internal registerbit
bit bit 32-bit internal register bit
15 0 31 0

Signed 16-bit BIN data 32-bit internal register

16-bit 32-bit

FLOAT.D When the execution condition is ON, the unsigned 32-bit BIN data currently stored in the
32-bit internal register is converted to a single precision floating point type real number,
and the result is stored in the 32-bit internal register.
Before executing After executing
bit 32-bit internal register bit bit 32-bit internal register bit
31 0 31 0

Unsigned 32-bit BIN data Single precision floating point type real number

32-bit 32-bit

FLOAT.L When the execution condition is ON, the signed 32-bit BIN data currently stored in the32-
bit internal register is converted to a single precision floating point type real number, and
the result is stored in the 32-bit internal register.
Before executing After executing
bit 32-bit internal register bit bit 32-bit internal register bit
31 0 31 0

Signed 32-bit BIN data Single precision floating point type real number

32-bit 32-bit

@FLOAT.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-198 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

Point The precision of single precision floating point type point real numbers is 32-bit,
the significant digit is 24-bit.

ARITHMETIC OPERATION
When the integer value exceeds the range of -16777216 to 16777215 (24-bit BIN),
the25th bit afterward is rounded.

INSTRUCTIONS
Operation flag

CR2009 No change in state


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

Floating Point Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-199


DFLOATBinary precision
Double →
floating point number
real type
conversion

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


DFLOAT

DFLOAT(.U)
DFLOAT.S Binary →
DFLOAT DFLOAT.D
DFLOAT.L
DFLOAT
Double
To convert data of
precision
internal registers to
ARITHMETIC OPERATION

floating point
@DFLOAT(.U) double precision floating
type real
@DFLOAT.S point type real number.
@DFLOAT @DFLOAT.D
@DFLOAT.L
DFLOAT
number
conversion
INSTRUCTIONS

Ladder program Input mode


Execution condition
LDA DFLOAT STA.DF D F L O A T

4 Execution condition
LDA DFLOAT STA.DF @ D F L O A T
Floating Point Instructions

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
DFLOAT(.U) When the execution condition is ON, the unsigned 16-bit BIN data currently stored in
the16-bit internal register is converted to a double precision floating point type real
number, and the result is stored in the 64-bit internal register.
Before executing After executing
16-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit
15 0 63 48 47 32 31 16 15 0

Unsigned
16-bit BIN data
Double precision floating point type real number

16-bit 64-bit

DFLOAT.S When the execution condition is ON, the signed 16-bit BIN data currently stored in the16-
bit internal register is converted to a double precision floating point type real number, and
the result is stored in the 64-bit internal register.
Before executing After executing
16-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit
15 0 63 48 47 32 31 16 15 0

Signed
16-bit BIN data
Double precision floating point type real number

16-bit 64-bit

DFLOAT.D When the execution condition is ON, the unsigned 32-bit BIN data currently stored in the
32-bit internal register is converted to a double precision floating point type real number,
and the result is stored in the 64-bit internal register.
Before executing After executing
32-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
32 16 15 0 63 48 47 32 31 16 15 0

Unsigned 32-bit BIN data Double precision floating point type real number

32-bit 64-bit

4-200 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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

ARITHMETIC OPERATION
the result is stored in the 64-bit internal register.
Before executing After executing
32-bit internal register 64-bit internal register
bit bit bit bit

INSTRUCTIONS
bit bit bit bit bit bit bit bit
32 16 15 0 63 48 47 32 31 16 15 0

Signed 32-bit BIN data Double precision floating point type real number

32-bit 64-bit

@DFLOAT.□This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag 4

Floating Point Instructions


CR2009 No change in state
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-201


INTGSingle precision
floating point type real
number → Binary
conversion

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


INTG

INTG(.U)
INTG.S Single
INTG INTG.D
INTG.L
INTG precision
floating point
The single precision floating
point type data in the internal
type real
ARITHMETIC OPERATION

@INTG(.U) register is converted to binary


number →
@INTG.S data.
@INTG @INTG.D
@INTG.L
INTG
Binary
conversion
INSTRUCTIONS

Ladder program Input mode


Execution condition
LDA.F INTG STA I N T G

4 Execution condition
LDA.F INTG STA @ I N T G
Floating Point Instructions

Point • The range of the single precision floating point type real number is shown below.

−3.4E+38≦N≦−1.4E−45
N=0
1.4E−45≦N≦3.4E+38
(Number of effective
digits: approx. 7)
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)
• The range of the double precision floating point type real number is shown
below.
−1.79E+308 ≦ N ≦-2.23E−308
N=0
2.23E−308 ≦ N ≦ 1.79E+308
(Number of effective digits: approx. 16)

Description of Operation
INTG(.U) When the execution condition is ON, the single precision floating point type real number
currently stored in the 32-bit internal register is converted to unsigned 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the single precision floating point type real number are discarded
before conversion.
Before executing After executing
bit 32-bit internal register bit bit 16-bit internal register bit
31 0 15 0

Single precision floating point type real number Unsigned 16-bit BIN data

32-bit 16-bit

INTG.S When the execution condition is ON, the single precision floating point type real number
currently stored in the 32-bit internal register is converted to signed 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the single precision floating point type real number are discarded
before conversion.
Before executing After executing
bit 32-bit internal register bit bit 16-bit internal register bit
31 0 15 0

Single precision floating point type real number Signed 16-bit BIN data

32ビット 16-bit

4-202 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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.

ARITHMETIC OPERATION
The operation result is stored in the 32-bit internal register. There will be errors in stored
value as decimal part of the single precision floating point type real number are discarded
before conversion.

INSTRUCTIONS
Before executing After executing
bit 32-bit internal register bit bit 32-bit internal register bit
31 0 31 0

Single precision floating point type real number Unsigned 32-bit BIN data

32-bit 32-bit

INTG.L When the execution condition is ON, the single precision floating point type real number
currently stored in the 32-bit internal register is converted to signed 32-bit BIN data.
The operation result is stored in the 32-bit internal register. There will be errors in stored
4

Floating Point Instructions


value as decimal part of the single precision floating point type real number are discarded
before conversion.
Before executing After executing
bit 32-bit internal register bit bit 32-bit internal register bit
31 0 31 0

Single precision floating point type real number Signed 32-bit BIN data

32-bit 32-bit

@INTG.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-203


Floating Point Instructions

Sample Program
ARITHMETIC OPERATION

The single precision floating point type point real numbers currently stored in data memories "DM0/
DM1" are converted respectively and stored as follows.
Unsigned 16-bit BIN data is stored in DM10.
INSTRUCTIONS

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.F INTG STA
MPS
LDA.F DM0
DM0 DM20
CON
LDA.F INTG.S STA.S INTG
Floating Point Instructions

CON
DM0 DM30 STA DM10
MRD
LDA.F INTG.D STA.D
LDA.F DM0
CON
DM0 DM40 INTG.S
LDA.F INTG.L STA.L CON
STA.S DM20
MRD
LDA.F DM0
CON
INTG.D
CON
STA.D DM30
MPP
LDA.F DM0
CON
INTG.L
CON
STA.L DM40

4-204 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-205


DINTGDouble precision
floating point type real
number → Binary conversion

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


DINTG

DINTG(.U)
DINTG.S Double
DINTG DINTG.D
DINTG.L
DINTG
precision
floating point
The double precision floating
point type data in the internal
type real
ARITHMETIC OPERATION

@DINTG(.U) register is converted to binary


number →
@DINTG.S data.
@DINTG @DINTG.D
@DINTG.L
DINTG
Binary
conversion
INSTRUCTIONS

Ladder program Input mode


Execution condition
LDA.DF DINTG STA D I N T G

4 Execution condition
LDA.DF DINTG STA @ D I N T G
Floating Point Instructions

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
• Refer to “INTG Instructions”for details on the range of the double precision
floating point type real number.

Description of Operation
DINTG(.U) When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to unsigned 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the double precision floating point type real number are
discarded before conversion.
Before executing After executing
64-bit internal register 16-bit internal registe
bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 15 0

Unsigned
Double precision floating point type real number 16-bit BIN data

64-bit 16-bit

DINTG.S When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to signed 16-bit BIN data.
The operation result is stored in the 16-bit internal register. There will be errors in stored
value as decimal part of the double precision floating point type real number are
discarded before conversion.
Before executing After executing
64-bit internal register 16-bit internal registe
bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 15 0

Unsigned
Double precision floating point type real number 16-bit BIN data

64-bit 16-bit

4-206 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

DINTG.D When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to unsigned 32-bit BIN data.

ARITHMETIC OPERATION
The operation result is stored in the 32-bit internal register. There will be errors in stored
value as decimal part of the double precision floating point type real number are
discarded before conversion.

INSTRUCTIONS
Before executing After executing
64-bit internal register 32-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 32 16 15 0

Double precision floating point type real number Unsigned 32-bit BIN data

4
64-bit 32-bit

DINTG.L When the execution condition is ON, the double precision floating point type real number
currently stored in the 64-bit internal register is converted to signed 32-bit BIN data.

Floating Point Instructions


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.□ 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 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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-207


Floating Point Instructions

Sample Program
ARITHMETIC OPERATION

The double precision floating point type point real numbers currently stored in data memories "DM0/
DM1/DM2/DM3" are converted respectively and stored as follows.
Unsigned 16-bit BIN data is stored in DM10.
INSTRUCTIONS

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
Floating Point Instructions

DM0 DM20
CON
LDA.DF DINTG.S STA.S
STA DM10
MRD
LDA.DF DM0
DM0 DM30 CON
DINTG.S
LDA.DF DINTG.D STA.D CON
STA.S DM20
MRD
DM0 DM40 LDA.DF DM0
CON
LDA.DF DINTG.L STA.L DINTG.D
CON
STA.D DM30
MPP
LDA.DF DM0
CON
DINTG.L
CON
STA.L DM40

4-208 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-209


D F T O F D o upoint
floating b l e - p rtype
e c i sreal
ion
number → point
floating Single-precision
type real
number conversion

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


DFTOF

DFTOF
Double-precision
DFTOF DFTOF The double precision floating
floating point type
point type data in the internal
real number →
register is converted into a
@DFTOF
Single-precision
@DFTOF DFTOF single precision floating point
floating point type
ARITHMETIC OPERATION

type real number.


real number

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA.DF DFTOF STA.F D F T O F

Execution condition
LDA.DF DFTOF STA.F @ D F T O F

4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Floating Point Instructions

Series base units.


"KV-5000/3000 CPU Function Version", page 4

Description of Operation
DFTOF When the execution conditions are ON, the double precision floating point type data
stored in the 64-bit internal register is converted into a single precision floating point type
real number, and the results are stored in the 32-bit internal register.
Before executing After executing
64-bit internal register 32-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0 32 16 15 0

Single precision floating


Double precision floating point type real number
point

64-bit 32-bit

@DFTOF This instruction is executed for one scan at the rising edge of the execution condition.

Point The precision of the single precision floating point type real number stored in the
32-bit internal register after the instruction is executed will be lower than before the
execution, so an error will occur.

Operation flag

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 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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-210 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

Sample Program

ARITHMETIC OPERATION
The double precision floating point type real number stored in the data memory [DM0/DM1/DM2/
DM3]is converted into a single precision floating point type real number, and stored in [DM10/DM11].
(Mnemonics list)

INSTRUCTIONS
CR2002 DM0 DM10
LDA.DF DFTOF STA.F LD CR2002
LDA.DF DM0
CON
DFTOF
CON
STA.F DM10

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-211


FTODFSingle-precision
floating point type
real number → Double-
precision floating

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano point type real number


conversion

FTODF

FTODF
Single-precision
FTODF FTODF The single precision floating
floating point type
point type data in the internal
real number →
register is converted into a
@FTODF
Double-precision
@FTODF FTODF double precision floating
floating point type
ARITHMETIC OPERATION

point type real number.


real number

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA.F FTODF STA.DF F T O D F

Execution condition
LDA.F FTODF STA.DF @ F T O D F

4 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
Floating Point Instructions

"KV-5000/3000 CPU Function Version", page 4

Description of Operation
FTODF When the execution conditions are ON, the single precision floating point type data stored
in the 32-bit internal register is converted into a double precision floating point type real
number, and the results are stored in the 64-bit internal register.
Before executing After executing
32-bit internal register 64-bit internal register
bit bit bit bit bit bit bit bit bit bit bit bit
32 16 15 0 63 48 47 32 31 16 15 0

Single precision floating


D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r
point type real number

32-bit 64-bit

@FTODF 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 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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The 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

4-212 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-213


DISFSingle-precision
floating point type
real
Mantissa number →
and exponent
separation

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


DISF

To disperse a single
DISF Single-precision
DISF
precision floating point
floating point type real
type real number into a
number → Mantissa
mantissa and exponent,
@DISF DISF and exponent
and store them in the
ARITHMETIC OPERATION

separation
reference destination.

Ladder program Input mode


INSTRUCTIONS

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

Operand Explanation Occupied size


4 S Specifies the data to be dispersed. 32 bits
D1 Specifies the storage location for the mantissa. 32 bits
Floating Point Instructions

D2 Specifies the storage location for the exponent. 16 bits

Point Refer to "INTG instruction", page 4-202 for details on the range of the double
precision floating point type real number.

Description of Operation
DISF When the execution condition is ON, the mantissa of the single precision floating point
type real number currently stored in [ S / S +1] is stored in [ D1 / D1 +1], and
the exponent is stored in D2 . The mantissa part is calculated as seven digits.
D1 +1 D1
S +1 S Mantissa: Signed 32-bit BIN data

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)

@DISF This instruction is executed for one scan at the rising edge of the execution condition.

Point When the single precision floating point type real number (BIN) is converted to mantissa
part (DEC) and exponent part (DEC), error occurs sometimes in DISF instruction.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the dispersed data is outside the floating point range, or the indirect specification or index
CR2012 modification range is inappropriate, and an access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-214 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

Sample Program

ARITHMETIC OPERATION
When input relay R000 is ON, the single precision floating point type real number currently stored in
data memories "DM0/DM1" is dispersed, and the mantissa is stored in "DM10/DM11" and the exponent
is stored in DM12.

INSTRUCTIONS
(Mnemonics list)
R000 DISF
DM0 DM10 DM12 LD R000
DISF DM0 DM10 DM12

DM11 DM10
Mantissa: −5678900

DM1 DM0 32-bit


(2 words) 4
−5.6789E10 Separate

Floating Point Instructions


DM12
Exponent: +4
16-bits
(1 word)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-215


UNIFMantissa and
exponent → Single-
precision floating point
type real number

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

UNIF

Single-precision To unite the specified


UNIF
UNIF
floating point type mantissa and exponent,
real number → and store the united single
Mantissa and precision floating point type
@UNIF UNIF
exponent real number to the
ARITHMETIC OPERATION

combination reference destination.

Ladder program Input mode


INSTRUCTIONS

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

Operand Explanation Occupied size


4 S1 Specifies the mantissa. 32 bits
S2 Specifies the exponent. 16 bits
Floating Point Instructions

Specifies the storage location for the single precision floating point
D 32 bits
type real number formed by uniting S1 and S2 .

Point Refer to "INTG instruction", page 4-202 for details on the range of the double
precision floating point type real number.

Description of Operation
UNIF When the execution condition is ON, the single precision floating point type real number
united by signed 32-bit BIN data stored in [ S1 / S1 +1] as mantissa and signed 16-
bit BIN data stored in S2 as exponent is stored in [ D / D +1].
S1 +1 S1
Mantissa: Signed 32-bit BIN data
D +1 D
32-bit
(2 word) Unite Floating real number

S2 32-bit
(2 words)
Mantissa: Signed 16-bit BIN data

16-bit
(1 word)

Mantissa part -1234 (Signed 32-bit BIN data)


Example
of unite Unite −1.234 × 10−3
Exponent part -6 (Signed 16-bit BIN data) (Single precision floating point
type real number)

@UNIF This instruction is executed for one scan at the rising edge of the execution condition.

Point • Operation cannot be performed normally when T or C is indirectly specified in


D .
• When mantissa part (DEC) and exponent part (DEC) are converted to single
precision floating point type real number (BIN) using the UNIF instruction, an
error occurs sometimes.

4-216 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when the result is outside the floating point range, or the indirect specification or index
modification range is inappropriate, and an access outside the operand range occurs; Otherwise
CR2012
OFF.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.

4
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Floating Point Instructions


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
32-bit
(2 words)
DM11 DM10
+9.87654E10

DM2 32-bit
(2 words)
指数部: +5
16-bit
(1 word)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-217


EXPExponent
operation arithmetic
L O G L o g operation
arithmetic a r i t h m i c

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


EXP,LOG

EXP(.F) The exponential function using


EXP EXP.DF EXP
Exponent
the (single precision/double
precision) floating point type
arithmetic
@EXP(.F) real number stored in the
operation
@EXP internal register as an exponent
ARITHMETIC OPERATION

@EXP.DF EXP
is obtained.
LOG(.F)
LOG LOG.DF LOG
The natural logarithm of the
INSTRUCTIONS

Logarithmic (single precision/double


arithmetic precision) floating point type
@LOG(.F) operation real number stored in the
@LOG @LOG.DF LOG internal register is obtained.

Ladder program Input mode

4 Execution condition
LDA.F EXP STA.F E X P
Floating Point Instructions

Execution condition
LDA.F EXP STA.F @ E X P

Execution condition
LDA.F LOG STA.F L O G

Execution condition
LDA.F LOG STA.F @ L O G

Point Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.

Description of Operation
EXP(.F) When the execution condition is ON, the exponent function value is calculated taking the
single precision floating point type real number currently stored in 32-bit internal register
as the exponent. The operation result is stored to the 32-bit internal register as a single
precision floating point type real number.
The operation is performed taking e=2.718282.
32-bit internal register 32-bit internal register

e Single precision floating point type real number

32-bit
Single precision floating point type real number

32-bit

Reference For common logarithm operation, EXP.DF will be executed after storing the
value obtained by splitting exponent by 0.434294 in 32-bit internal register.

4-218 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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

ARITHMETIC OPERATION
as the exponent. The operation result is stored to the 64-bit internal register as a double
precision floating point type real number.
The operation is performed taking e = 2.718281828459045.

INSTRUCTIONS
64-bit internal register 64-bit internal register

e Double precision floating point type real number

64-bit
Double precision floating point type real number

64-bit

Reference For common logarithm operation, EXP.DF will be executed after storing the
value obtained by splitting exponent by 0.434294481903252 in 64-bit
internal register. 4
LOG(.F) When the execution conditions are ON, the common logarithm of the single precision

Floating Point Instructions


floating point type real number stored in the 32-bit internal register is obtained. The
operation result is stored to the 32-bit internal register as a single precision floating point
type real number.
32-bit internal register 32-bit internal register
Single precision floating point type real number Single precision floating point type real number

Loge 32-bit 32-bit

LOG.DF When the execution conditions are ON, the common logarithm of the double precision
floating point type real number stored in the 64-bit internal register is obtained. The
operation result is stored to the 64-bit internal register as a double precision floating point
type real number.
64-bit internal register 64-bit internal register
D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r

Log e 64-bit 64-bit

@□□□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

EXP.(F): ON when the operation results are not within the range of the single precision floating
point type real number. Otherwise, OFF.
CR2009 EXP.DF: ON when the operation results are not within the range of the double precision floating
point type real number. Otherwise, OFF.
LOG does not change.
CR2010 No change in state
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• EXP(.F): When value to be operated on exceeds the single precision floating point type real
number range
• EXP.DF: When value to be operated on exceeds the double precision floating point type real
CR2012 number range
• LOG(.F): When value to be operated on is 0 or negative, or exceeds the single precision
floating point type real number range
• LOG.DF: When value to be operated on is 0 or negative, or exceeds the double precision
floating point type real number range

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-219
Floating Point Instructions

Sample Program
ARITHMETIC OPERATION

When the input relay R000 is ON, ex is calculated taking the single precision floating point type real
number currently stored in data memories DM0/DM1 as the exponent. The results are stored in [DM10/
DM11].
INSTRUCTIONS

(Mnemonics list)
R000 DM0 DM10
LDA.F EXP STA.F LD R000
LDA.F DM0
CON
EXP
CON
STA.F DM10

4 When input relay R000 is ON, the logarithm of the single precision floating type real number stored in
data memories "DM0/DM1" is calculated. The results are stored in [DM10/DM11].
Floating Point Instructions

(Mnemonics list)
R000 DM0 DM10
LDA.F LOG STA.F LD R000
LDA.F DM0
CON
LOG
CON
STA.F DM10

4-220 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-221


LOG10Common logarithm
operation

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


LOG10

LOG10(.F) The common logarithm of the


LOG10 LOG10.DF LOG10 single precision floating point
type real number stored in the
Common 32-bit internal register or the
logarithm double precision floating point
ARITHMETIC OPERATION

@LOG10(.F)
@LOG10 @LOG10.DF LOG10 type real number stored in the
64-bit internal register is
obtained.
INSTRUCTIONS

Ladder program Input mode


Execution condition
LDA.F LOG10 STA.F L O G 1 0

Execution condition

4
LDA.F LOG10 STA.F @ L O G 1 0

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Floating Point Instructions

Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4
• Refer to “INTG Instructions” for details on the single precision floating
point type real number and double precision floating point type real number
range.

Description of Operation
LOG10(.F) When the execution conditions are ON, the common logarithm of the single precision
floating point type real number stored in the 32-bit internal register is obtained. The
operation result is stored to the 32-bit internal register as a single precision floating point
type real number.
32-bit internal register 32-bit internal register

Log10 Single precision floating point type real number Single precision floating point type real number

32-bit 32-bit

LOG10.DF When the execution conditions are ON, the common logarithm of the double precision
floating point type real number stored in the 64-bit internal register is obtained. The
operation result is stored to the 64-bit internal register as a double precision floating point
type real number.
64-bit internal register 64-bit internal register

Log10 D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r Double precision floating point type real number

64-bit 64-bit

@LOG10.□ 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 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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-222 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

Sample Program

ARITHMETIC OPERATION
When the relay R000 is ON, the common logarithm of the floating point type real number stored in data
memory [DM0/DM1] is obtained. The results are stored in [DM10/DM11].
(Mnemonics list)

INSTRUCTIONS
R000 DM0 DM10
LDA.F LOG10 STA.F LD R000
LDA.F DM0
CON
LOG10
CON
STA.F DM10

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-223


RADAngle
(rad) (°) → Radia
conversion
DEGRadian
(°) (rad) → Angl
conversion

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


RAD,DEG

RAD(.F)
RAD RAD.DF RAD
The angle (°) unit of the (single
precision/double precision) floating
Radian point type real number currently
@RAD(.F) stored in the internal register is
@RAD
ARITHMETIC OPERATION

@RAD.DF RAD converted to radians.

DEG(.F)
DEG DEG.DF DEG
The angle (radians) unit of the
INSTRUCTIONS

(single precision/double precision)


Degree floating point type real number
@DEG(.F) currently stored in the internal
@DEG @DEG.DF DEG register is converted to degrees (°).

Ladder program Input mode

4 Execution condition
LDA.F RAD STA.F R A D
Floating Point Instructions

Execution condition
LDA.F RAD STA.F @ R A D

Execution condition
LDA.F DEG STA.F D E G

Execution condition
LDA.F DEG STA.F @ D E G

Point Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.

Description of Operation
RAD(.F) When the execution condition is ON, the angle (°) unit of the single precision floating point
type real number currently stored in the 32-bit internal register is converted to radians.
The operation result is stored to the 32-bit internal register as a single precision floating
point type real number.
32-bit internal register 32-bit internal register
Single precision floating point type real number Single precision floating point type real number
rad
32-bit 32-bit

RAD.DF When the execution condition is ON, the angle (°) unit of the double precision floating
point type real number currently stored in the 64-bit internal register is converted to
radians.
The operation result is stored to the 64-bit internal register as a double precision floating
point type real number.
64-bit internal register 64-bit internal register
D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r D o u bl e p r e c i s i o n f l o a t i n g p o i n t t y p e r e a l n u m b e r
rad
64-bit 64-bit

4-224 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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

ARITHMETIC OPERATION
to degrees (°). The operation result is stored to the 32-bit internal register as a single
precision floating point type real number.
32-bit internal register 32-bit internal register

INSTRUCTIONS
Single precision floating point type real number
rad Single precision floating point type real number

32-bit 32-bit

DEG.DF When the execution condition is ON, the angle (radians) unit of the double precision
floating point type real number currently stored in the 64-bit internal register is converted
to degrees (°). The operation result is stored to the 64-bit internal register as a double
precision floating point type real number. 4
64-bit internal register 64-bit internal register

Floating Point Instructions


Double precision floating point type real number
rad Double precision floating point type real number

64-bit 64-bit

@□□□ This instruction is executed for one scan at the rising edge of the execution condition.

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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-225


Floating Point Instructions

Sample Program
ARITHMETIC OPERATION

When input relay R000 is ON, the angle (°) unit of the single precision floating point type real number
currently stored in data memories "DM0/DM1" is converted to radians.
The result is stored in "DM10/DM11" as a single precision floating point type real number.
INSTRUCTIONS

(Mnemonics list)
R000 DM0 DM10
LDA.F RAD STA.F LD R000
LDA.F DM0
CON
RAD
CON
STA.F DM10

4 When input relay R000 is ON, the angle (radians) unit of the single precision floating point type real
number currently stored in data memories "DM0/DM1" is converted to degrees (°).
Floating Point Instructions

The result is stored in "DM10/DM11" as a single precision floating point type real number.
(Mnemonics list)
R000 DM0 DM10
LDA.F DEG STA.F LD R000
LDA.F DM0
CON
DEG
CON
STA.F DM10

4-226 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-227


SINCalculate the sine (sin)
value from the angle in
radians (rad)
COSCalculate the cosine

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano (cos) value from the angle
in radians (rad)
TANCalculate the tangent
(tan) value from the angle
SIN,COS,TAN in radians (rad)

SIN(.F) Obtains the sine (sin) value of


SIN SIN.DF SIN the angle (in radians) of the
(single precision/double
Sine
@SIN(.F) precision) floating point type real
@SIN number stored in the internal
ARITHMETIC OPERATION

@SIN.DF SIN
register.
COS(.F) Obtains the cosine (cos) value of
COS COS.DF COS the angle (in radians) of the
INSTRUCTIONS

(single precision/double
Cosine
@COS(.F) precision) floating point type real
@COS @COS.DF COS number stored in the internal
register.
TAN(.F) Obtains the tangent (tan) value

4 TAN TAN.DF TAN of the angle (in radians) of the


(single precision/double
Tangent
@TAN(.F) precision) floating point type real
@TAN number stored in the internal
Floating Point Instructions

@TAN.DF TAN
register.

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

Point • The range of the single precision floating point type real number which can be
handled with the SIN(.F), COS(.F) and TAN(.F) instructions is as follows:
−1.7E+7≦N≦−1.4E−45
N=0
1.4E−45≦N≦1.7E+7
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)
(effective number of digits: approx. 7 digits)

• The range of the double precision floating point type real number which can be
handled with the SIN.DF, COS.DF and TAN.DF instructions is as follows:
9.01E+15 ≦ N ≦ 2.23E308
N=0
+2.23E308 ≦ N ≦ +9.01E+15
(effective number of digits:
approx. 16)

ȧ 3ȧ
• With TAN, ideally TAN( )=+∞、TAN( )=ー∞ but due to the operation,
2 2
ȧ 3ȧ
2 and 2 are rounded values, so a value range which exceeds either
ȧ 3ȧ
TAN ( )or TAN ( )cannot be handled.

"Data Processing", page 1-31

4-228 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

Description of Operation

ARITHMETIC OPERATION
SIN(.F) / COS(.F) / TAN(.F)
When the execution condition is ON, the sine (sin), cosine (cos) and tangent (tan) value of
the angle (radians) of the single precision floating point type real number currently stored

INSTRUCTIONS
in the 32-bit internal register is calculated. The operation result is stored to the 32-bit
internal register as a single precision floating point type real number.

SIN 32-bit internal register 32-bit internal register

COS Single precision floating point type real number Single precision floating point type real number

4
32-bit 32-bit
TAN
SIN.DF / COS.DF / TAN.DF

Floating Point Instructions


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

64-bit 64-bit
TAN
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.

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.
• 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
CR2012 TAN(.F)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.DFinstruction

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-229


Floating Point Instructions

Sample Program
ARITHMETIC OPERATION

When input relay R000 is ON, the sine (sin) value of the angle of the single precision floating point type
real number currently stored in data memories "DM0/DM1" is stored in "DM10/DM11", the cosine (cos)
value is stored in "DM20/DM21", and the tangent (tan) value is stored in "DM30/DM31".
INSTRUCTIONS

(Mnemonics list)
R000 DM0 DM10
LDA.F SIN STA.F LD R000
MPS
DM0 DM20 LDA.F DM0
LDA.F COS STA.F CON
SIN
DM0 DM30 CON

4 LDA.F TAN STA.F STA.F DM10


MRD
LDA.F DM0
CON
Floating Point Instructions

COS
CON
STA.F DM20
MPP
LDA.F DM0
CON
TAN
CON
STA.F DM30

4-230 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Floating Point Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-231


ASINCalculates
angle in the
radians
(rad) from sine (sin)
value
ACOSCalculates the
angle from
(rad) in radians
cosine

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


(cos) value
ATANCalculates
angle in the
radians
(rad) from tangent
(tan) value

ASIN,ACOS,ATAN

ASIN(.F)
ASIN ASIN.DF ASIN
To calculate the angle (radians)
from sine (sin) of the (single
Arc sine precision/double precision) floating
@ASIN(.F) point type real number currently
@ASIN
ARITHMETIC OPERATION

@ASIN.DF ASIN stored in internal register.

ACOS(.F)
ACOS ACOS.DF ACOS
To calculate the angle (radians)
INSTRUCTIONS

from cosine (cos) of the (single


Arc cosine precision/double precision) floating
@ACOS(.F) point type real number currently
@ACOS @ACOS.DF ACOS stored in internal register.

ATAN(.F)

4 ATAN ATAN.DF ATAN


Arc
To calculate the angle (radians)
from tangent (tan) of the (single
precision/double precision) floating
@ATAN(.F) tangent
point type real number currently
@ATAN
Floating Point Instructions

@ATAN.DF ATAN stored in internal register.

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

Point Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.

Description of Operation
ASIN(.F) / ACOS(.F) / ATAN(.F)
When the execution condition is ON, the angle (radians) is calculated from the sine (sin)
value, cosine (cos) value and tangent (tan) value of the single precision floating point type
real number currently stored in the 32-bit internal register. The operation result is stored
to the 32-bit internal register as a single precision floating point type real number.

ASIN 32-bit internal register 32-bit internal register

ACOS Single precision floating point typereal number Single precision floating point typereal number

32-bit 32-bit
ATAN
ASIN.DF / ACOS.DF / ATAN.DF
When the execution condition is ON, the angle (radians) is calculated from the sine (sin)
value, cosine (cos) value and tangent (tan) value of the double precision floating point
type real number currently stored in the 64-bit internal register. The operation result is
stored to the 64-bit internal register as a double precision floating point type real number.

4-232 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

ASIN 64-bit internal register 64-bit internal register

ACOS Double precision floating point typereal number Double precision floating point typereal number

ARITHMETIC OPERATION
64-bit 64-bit
ATAN
@□□□ This instruction is executed for one scan at the rising edge of the execution condition.

INSTRUCTIONS
Reference (°) and radian (rad) are calculated as follows:
Ǹ 180
1°= ≒ 0.01745(rad), 1(rad)= ≒ 57.23°
180 Ǹ

Operation flag
4
CR2009 No change in state

Floating Point Instructions


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-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-233


ATAN2Calculates
angle in the
radians
(rad) from
coordinates (X, Y)the

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


ASIN,ACOS,ATAN

ATAN2(.F)
ATAN2 ATAN2.DF ATAN2
Arc
Calculate the angle (radians)
from the coordinates (X, Y) of
@ATAN2(.F) tangent 2 the (single/double precision)
@ATAN2 floating point type real number.
ARITHMETIC OPERATION

@ATAN2.DF ATAN2

Ladder program Input mode


INSTRUCTIONS

Execution condition S1
ATAN2 STA.F A T A N 2 S1 S2
S2
Execution condition S1
ATAN2 STA.F @ A T A N 2 S1 S2
S2

Operand Explanation Occupied size

4 S1
Specifies the Y coordinate of the target point, or the start in which it is .F
stored. .DF
32 bits
64 bits
Specifies the X coordinate of the target point, or the start in which it is .F 32 bits
Floating Point Instructions

S2
stored. .DF 64 bits

Point • Refer to "INTG instruction", page 4-202 for details on the single precision
floating point type real number and double precision floating point type real
number range.
• The ATAN2 instruction can be used only with the KV-8000 series CPU units and
KV-7000 Series CPU units with CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
ATAN2(.F)
When the execution condition is ON, the angle (radians) of the X axis relative to the single
precision floating point type real number is calculated from the Y coordinate of the single
precision floating point type real number specified with [ S1 / S1 +1] and the X
coordinate of the single precision floating point type real number specified with [ S2 /
S2 +1]. The operation result is stored in the 32-bit internal register.

S2 +1 S2 S1 +1 S1 32-bit internal register


Single precision floating point typereal Single precision floating point typereal Single precision floating point typereal
number , number number

32-bit 32-bit 32-bit

ATAN2.DF
When the execution condition is ON, the angle (radians) of the X axis relative to the
double precision floating point type real number is calculated from the Y coordinate of the
double precision floating point type real number specified with [ S1 / S1 +1/ S1 +2/
S1 +3] and the X coordinate of the double precision floating point type real number
specified with [ S2 / S2 +1/ S2 +2/ S2 +3]. The operation result is stored in the
64-bit internal register.

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

@□□□ This instruction is executed for one scan at the rising edge of the execution condition.

4-234 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Floating Point Instructions

Reference The ATAN instruction uses the TAN value to calculate the angle of -π/2(rad) < θ < π/
2(rad), while the ATAN2 instruction uses coordinates (S2, S1) to calculate the angle of -

ARITHMETIC OPERATION
π(rad)< θ ≦ π(rad).
Y

INSTRUCTIONS
S1

θ
S2 X
ȧ 180
1°= ≒ 0.01745(rad)、 1(rad)= ≒ 57.23°です。
ȧ
4
180

When S1=0 and S2≧0, θ=0°=0(rad).


When S1=0 and S2<0, θ=180°=π(rad).

Floating Point Instructions


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
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
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300 When CR2012 is ON, error details are stored in CM5150 to CM5176.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the angle (radians) on the X axis is calculated from the single precision
floating point type real number Y coordinate stored in "DM0/DM1" and the single precision floating point
type real number X coordinate stored in "DM2/DM3", and is stored in "DM10/DM11".
(Mnemonics list)
R000 DM0 DM10
ATAN2 STA.F LD R000
DM2 ATAN2 DM0 DM2
CON
STA.F DM10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-235


Text Processing
Instructions
ASCBinary → HEX ASCII
conversion

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


ASC

ASC ASC(.U)
ASC
HEX ASCII Convert BIN data in internal
code registers to HEX ASCII character

@ASC @ASC(.U)
ASC
conversion code
ARITHMETIC OPERATION

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA ASC STA A S C

Execution condition
LDA ASC STA @ A S C

4 Description of Operation
ASC(.U) When the execution condition is ON, the binary data of the lower 8 bits currently stored to
Text Processing Instructions

16-bit internal registers is converted to ASCII character codes annotated in HEX, and the
result is stored to 16-bit internal register.
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Before 1 0 1 0 0 1 0 1 :16-bit internal register


conversion
0 0 A 5

3 2 1 0 3 2 1 0 3 2 1 0 3 • 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

After 0 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 :16-bit internal register


conversion
4 1 3 5

@ASC(.U) 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
CR2012 No change in state

4-236 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
The data currently stored to the lower 8 bits of data memory DM0 is converted to HEX ASCII character
code. The result is stored to DM10.
(Mnemonics list)

INSTRUCTIONS
R000 DM0 DM10
LDA ASC STA LD R000
LDA DM0
CON
ASC
DM0 DM10 CON
conversion
0 0 F 7 4 6 3 7 STA DM10

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-237


RASCHEXconversion
Binary ASCII →

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


RASC

RASC RASC(.U)
RASC HEX ASCII Convert HEX ASCII character
code reverse code in internal registers to

@RASC @RASC(.U)
RASC
conversion binary data.
ARITHMETIC OPERATION

Ladder program Input mode


INSTRUCTIONS

Execution condition
LDA RASC STA R A S C

Execution condition
LDA RASC STA @ R A S C

4 Description of Operation
RASC(.U) When the execution condition is ON, the HEX ASCII character code currently stored to
Text Processing Instructions

the internal register is converted and stored to the lower eight bits of the 16-bit internal
register as binary data. "0" is stored to the upper 8 bits.
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Before 0 0 1 1 0 1 1 0 0 1 0 0 0 0 1 1 :16-bit internal register


conversion
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

After 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 :16-bit internal register


conversion
0 0 6 C

The HEX ASCII character codes are converted only when both the high-order 8 bits and
low-order 8 bits of the internal register before conversion are 0 to 9 (30H to 39H) or A to F
(41H to 46H), and the high-order 8 bits are 0 (00H), and the low-order 8 bits are 0 to 9
(30H to 39H) or A to F (41H to 46H).
When either of the upper 8 bits or lower 8 bits is outside of this range, HEX ASCII
character codes are not converted. The operation flag CR2012 turns ON at this time.

@RASC(.U) This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

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

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-238 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
The HEX ASCII character code currently stored to data memory DM0 is converted to binary data. The
result is stored to DM10.
(Mnemonics list)

INSTRUCTIONS
R000 DM0 DM10
LDA RASC STA LD R000
LDA DM0
CON
DM0 DM10 RASC
CON
4 6 3 7 0 0 F 7 STA DM10
conversion

0 0 3 7 0 0 0 7
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-239


DASCBinary → Decimal
ASCII conversion

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


DASC

DASC(.U)
DASC.S
DASC
DASC
DASC.D
DASC.L
Decimal ASCII Convert numerical
ARITHMETIC OPERATION

code values to a decimal


@DASC(.U) conversion ASCII text string.
@DASC.S
@DASC
DASC
@DASC.D
@DASC.L
INSTRUCTIONS

Ladder program Input mode


Execution condition DASC
S D D A S C S D
( D S T R S D )

4 Execution condition DASC


S D @ D A S C S D
( @ D S T R S D )
Text Processing Instructions

Operand Explanation Occupied size


Specifies the numerical value to convert to decimal ASCII text string .U .S 16 bits
S
or its storage location. .D .L 32 bits
8 bits × (number of
D Specifies the start to store the converted ASCII character code.* 1
characters + 1)

*1 When specifying bit data, specify the start of the channel.

Description of Operation
DASC(.U) When the execution condition is ON, the unsigned 16-bit binary data specified by S
is converted to decimal ASCII text string, and is stored as follows starting from D .
End code NULL (00H) is stored at the end of text string.
bit
15
S bit
0
bit
15
bit
0

Unsigned 16-bit BIN data D ten thousand thousand

+1: hundred ten Ended with


16-bit D
“00H”.
N
D +2: one U
L
(00H)

DASC.S When the execution condition is ON, the signed 16-bit binary data specified by S is
converted to decimal ASCII text string, and is stored as follows starting from D . End
code NULL (00H) is stored at the end of text string.
bit
15
S bit
0
bit
15
bit
0

Signed 16-bit BIN data D Sign ten thousand

16-bit D +1: thousand hundred

D +2: 十 一
N
D +3: U
L
(00H)

Ended with No change before and


“00H”. after executing instruction.

4-240 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

DASC.D When the execution condition is ON, the unsigned 32-bit binary data specified by S
is converted to decimal ASCII text string, and is stored as follows starting from D .

ARITHMETIC OPERATION
End code NULL (00H) is stored at the end of text string.
bit
31
S +1 bit
16
bit
15
S bit
0
bit
15
bit
0

hundred
Unsigned 32-bit BIN data D billion million

INSTRUCTIONS
32-bit D +1: ten million million
hundred
D +2: thousand ten thousand

D +3: thousand hundred

D +4: ten one


N
D +5: U
L
(00H)

Ended with
“00H”.
No change before and
after executing instruction.
4
DASC.L When the execution condition is ON, the signed 32-bit binary data specified by S is

Text Processing Instructions


converted to decimal ASCII text string, and is stored as follows starting from D . End
code NULL (00H) is stored at the end of text string.
bit
31
S +1 bit
16
bit
15
S bit
0
bit
15
bit
0

hundred
Unsigned 32-bit BIN data D billion million

32-bit D +1: ten million million


hundred
D +2: thousand ten thousand

D +3: thousand hundred

D +4: ten one


N
D +5: 一 U
L
(00H)

No change before and


after executing instruction.

@DASC.□ 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 a bit other than the start of the channel is specified when bit data is specified for D
• When a timer/counter is specified in D by indirect specification
• When the indirect specification and index modify range is inappropriate
CR2012
• When the start is within the device / work area 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)
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-241


Text Processing Instructions

About zero suppression


ARITHMETIC OPERATION

"Zero suppression" is a function for omitting "0" (zeros) not required in the upper digits.

Example The unsigned 16-bit binary data currently stored to data memory DM0 is converted toan
INSTRUCTIONS

ASCII text string, and the result is stored to DM10.

R000 DASC
DM0 DM10

bit
15
DM0 bit
0
bit
15
bit
0

4
Without zero suppression
00123 DM10: 0(30H) 0(30H)
CR2814:OFF
16ビット DM11: 1(31H) 2(32H)
Text Processing Instructions

N
DM12: 3(33H) U
L
(00H)

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ビット 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-242 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
The signed 16-bit binary data currently stored to data memory DM0 is converted to decimal ASCII
code, and the result is stored to DM10 onwards.
(Mnemonics list)

INSTRUCTIONS
CR2002 CR2814 CR2815
RES RES LD CR2002
MPS
RES CR2814
DASC.S
CON
DM0 DM10 RES CR2815
MPP
DASC.S DM0 DM10

bit
15
DM0

−01234
bit
0
bit
15

−(2DH) 0(30H)
bit
0 4
DM10:

Text Processing Instructions


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'somitted) data is stored to DM10 onwards. (The data is stored with the + sign omitted.)
(Mnemonics list)
CR2002 CR2814 CR2815
SET SET LD CR2002
MPS
SET CR2814
DASC
CON
#1234 DM10 SET CR2815
MPP
DASC #1234 DM10

bit bit
15 0

#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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-243


RDASCDecimal
→ ASCII
Binary conversion

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


RDASC

RDASC(.U)
RDASC.S
RDASC
RDASC
RDASC.D
RDASC.L
Decimal ASCII Convert decimal
ARITHMETIC OPERATION

code reverse ASCII text string to


@RDASC(.U) conversion numerical values
@RDASC.S
@RDASC
RDASC
@RDASC.D
@RDASC.L
INSTRUCTIONS

Ladder program Input mode


Execution condition RDASC
S D R D A S C S D
( D V A L S D )

4 Execution condition RDASC


S D @ R D A S C S D
( @ D V A L S D )
Text Processing Instructions

Operand Explanation Occupied size


Specifies the storage location for the decimal ASCII text string to be 8 bits × (number of
S
converted to BIN data.* 1 characters + 1)
.U .S 16 bits
D Specifies the storage location for the converted BIN data.
.D .L 32 bits

*1 When specifying bit data, specify the start of the channel.

Description of Operation
RDASC(.U) When the execution condition is ON, the decimal ASCII text string (NULL (00H) is
required at the end of the text string) starting from S is converted to unsigned 16-bit
binary data, and is stored to D .
bit
15
S bit
0
bit
15
D bit
0

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 (NULL (00H) is
required at the end of the text string) starting from S is converted to signed 16-bit
binary data, and is stored to D .
bit
15
S bit
0
bit
15
D bit
0

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

RDASC.D When the execution condition is ON, the decimal ASCII text string (NULL (00H) is
required at the end of the text string) starting from S is converted to unsigned 32-bit
binary data, and is stored to [ D / D +1].
bit
15
S bit
0
bit
31
D +1 bit
16
bit
15
D bit
0

hundred
S billion million
Signed 32-bit BIN data

S +1: ten million million


hundred
S +2: thousand ten thousand

S +3: thousand hundred

S +4: ten one


N
S +5: U
L
(00H) String must be ended with NUL(00H).

4-244 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

RDASC.L When the execution condition is ON, the decimal ASCII text string (NULL (00H) is
required at the end of the text string) starting from S is converted to signed 32-bit

ARITHMETIC OPERATION
binary data, and is stored to [ D / D +1].
bit
15
bit
0
bit
31
D +1 bit
16
bit
15
D bit
0

S Sign billion Signed 32-bit BIN data

INSTRUCTIONS
hundred
S +1: million ten million

million hundred
S +2: thousand

S +3: ten thousand thousand


S +4: hundred ten
N

4
S +5: one U (00H)
L String must be ended with NUL(00H).

@RDASC.□ This instruction is executed for one scan at the rising edge of the execution condition.

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 (or signed) binary range
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 • When a timer/counter is specified in S by indirect specification
• When the indirect specification and index modify range is inappropriate
• When the end of S is not NULL (00H)
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-245


Text Processing Instructions

Example of converting zero-suppressed data


ARITHMETIC OPERATION

"Zero suppression" is a function for omitting "0" (zeros) not required in the upper digits.
Data that is already zero-suppressed is converted correctly.
INSTRUCTIONS

Example The ASCII text string currently stored to data memory DM0 is converted to unsigned 16-
bit binary data. The result is stored to DM100.

CR2002 RDASC
DM0 DM100
bit bit
15 0

4 DM0:

DM1:
1(31H)

3(33H)
2(32H)

0(30H)
bit
15
DM100
1230
bit
0

N
Text Processing Instructions

DM2: U
L
(00H)

Example 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-246 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
When input relay R000 is ON, the ASCII text string currently stored to data memory DM0 is converted
to 32-bit unsigned binary data. The results are stored in [DM10/DM11].
(Mnemonics list)

INSTRUCTIONS
R000 RDASC.D
DM0 DM10 LD R000
RDASC.D DM0 DM10

bit bit
15 0

DM0: 1(31H) 2(32H)


DM11 DM10
DM1: 3(33H) 4(34H)

4
1234567890

DM2: 5(35H) 6(36H)

DM3: 7(37H) 8(38H)

Text Processing Instructions


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 results are stored in [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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-247


HASCConvert numerical
values (HEX) to a HEX
ASCII text string

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


HASC

HASC(.U)
HASC
HASC
HASC.D
HEX ASCII Convert numerical
code values (HEX) to HEX
@HASC(.U) conversion ASCII text string.
@HASC
HASC
ARITHMETIC OPERATION

@HASC.D

Ladder program Input mode


INSTRUCTIONS

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 )

4
Operand Explanation Occupied size
Specifies the storage location for the numerical value (HEX) to .U 16 bits
S
convert to a HEX ASCII text string. .D 32 bits
Text Processing Instructions

Specifies the storage location for the converted ASCII character 8 bits × (number of
D
code.*1 characters + 1)
Specifies the number of digits of the numerical value (HEX) to be
n 16 bits
stored within the range of 0 to 8. (0 to 4 for .U, 0 to 8 for .D)

*1 When specifying bit data, specify the start of the channel.

Description of Operation
HASC(.U) When the execution condition is ON, the numerical values of 1 to n digits are
converted to HEX ASCII text string from the low-order side of the unsigned 16-bit binary
data specified by S , and are stored starting from D . End code NULL (00H) is
stored at the end of text string.
When n =0, zeros are suppressed.

Example Bit (n) 4 3 2 1


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-248 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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 low-order side of the unsigned 32-bit binary

ARITHMETIC OPERATION
data specified by [ S / S +1], and are stored starting from D . End code NULL
(00H) is stored at the end of text string.
When n =0, zeros are suppressed.

INSTRUCTIONS
Example digit (n) 8 7 6 5 4 3 2 1
Unsigned 32-bit BIN data S +1・ S 0 0 1 2 C D E 0

n=1 n=2
N
HEX ASCII string D 0(30H) U
L
(00H) D E(45H) 0(30H)

4
N
D +1 U
L
(00H)

n=7 n=8

Text Processing Instructions


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.□ 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 a bit other than the start of the channel is specified when bit data is specified for D
• When a timer/counter is specified in D by indirect specification
• When 5 or more is specified to n in the case of .U suffix instructions and 9 or more is
CR2012
specified in the case of .D suffix instructions
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-249


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

The unsigned 16-bit binary data currently stored to data memory DM0 is converted to HEX ASCII code,
and the result is stored to DM10 onwards.
(Mnemonics list)
INSTRUCTIONS

CR2002 HASC
DM0 DM10 #3 LD CR2002
HASC DM0 DM10 #3

DM0 bit
15
bit
0

0 0 1 A DM10: 0(30H) 1(31H)

4 DM11: A(41H)
N
U
L (00H)
Text Processing Instructions

Unsigned 32-bit data $00123ABC is converted to HEX ASCII code, and the zero-suppressed
(0'somitted) data is stored to DM10 onwards.

(Mnemonics list)
CR2002 HASC.D
$00123ABC DM10 #0 LD CR2002
HASC.D $123ABC DM10 #0

bit bit
15 0

$00123ABC DM10: 1(31H) 2(32H)

DM11: 3(33H) A(41H)

DM12: B(42H) C(43H)


N
DM13: U
L (00H)

4-250 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-251


RHASCConvert
text string toHEX ASCII
numerical
values (HEX)

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


RHASC

RHASC(.U)
RHASC
RHASC
RHASC.D Convert HEX ASCII
HEX ASCII
text string to
code reverse
@RHASC(.U) numerical values
conversion
@RHASC
RHASC
(HEX).
ARITHMETIC OPERATION

@RHASC.D

Ladder program Input mode


INSTRUCTIONS

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 Operand Explanation
Specifies the HEX ASCII text string to convert to numerical values
Occupied size
8 bits × (number of
S
(HEX).* 1 characters + 1)
Text Processing Instructions

Specifies the storage location for the converted numerical value .U 16 bits
D
(HEX). .D 32 bits

*1 When specifying bit data, specify the start of the channel.

Description of Operation
RHASC(.U) When the execution condition is ON, the HEX ASCII text string (NULL (00H) is required at
the end of the text string) starting from S is converted to unsigned 16-bit binary data,
and is stored to D .

Example HEX ASCII string Unsigned 16-bit BIN data


bit bit
15 0

S 1(31H) 2(32H) D

S +1 C(43H) D(44H) 1 2 C D
N
S +2 U
L (00H)

bit bit
15 0
D
S 1(31H) 2(32H)
N
0 1 2 C
S +1 C(43H) U
L (00H)

bit bit
15 0
D
S 1(31H) 2(32H)
N
0 0 1 2
S +1 U
L (00H)

bit
15
bit
0
D
N
S 1(31H) U
L (00H) 0 0 0 1

bit
15
bit
0
D
N
S U
L (00H) 0 0 0 0

4-252 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

RHASC.D When the execution condition is ON, the HEX ASCII text string (NULL (00H) is required at
the end of the text string) starting from S is converted to unsigned 32-bit binary data,

ARITHMETIC OPERATION
and is stored to [ D / D +1].

Example HEX ASCII string Unsigned 32-bit BIN data

INSTRUCTIONS
bit bit
15 0

S 1(31H) 2(32H)

S +1 A(41H) B(42H) D +1 D

S +2 C(43H) D(44H) 1 2 A B C D 1 4

S +3 1(31H) 4(34H)

4
N
S +4 U
L (00H)

bit bit
15 0

Text Processing Instructions


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.□This instruction is executed for one scan at the rising edge of the execution condition.

Point Use uppercase A to F (41H to 46H) in HEX ASCII text strings. Lowercase characters
are not supported. Lowercase characters are not supported.

Operation flag

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
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012
• When a timer/counter is specified in S by indirect specification
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-253


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

The HEX ASCII text string (end code NULL (00H) is required at the end of the text string) starting from
data memory DM0 is converted to unsigned 16-bit binary data is stored to DM10.
(Mnemonics list)
INSTRUCTIONS

CR2002 RHASC
DM0 DM10 LD CR2002
RHASC DM0 DM10

bit bit
15 0
DM10
DM0 0(30H) 1(31H)
0 0 1 A

4
N
DM1 A(41H) U
L (00H)
Text Processing Instructions

4-254 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-255


FASCConvert single
precision floating
point type real
numbers to text

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

FASC

Single-
FASC
FASC
precision
floating point
Convert single precision floating point
type real
type real numbers to text strings.
@FASC FASC number →
ARITHMETIC OPERATION

String
conversion
INSTRUCTIONS

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

4 Operand Explanation Occupied size


S1 Specifies the reference source to store the parameters. 16 bits x2
Text Processing Instructions

Specifies the reference source that stores the single precision floating
S2 32 bits
point real number to be converted to a text string.
8 bits × (number of
D Specifies the start to store the converted text string.* 1
characters + 1)

*1 When specifying bit data, specify the start of the channel.

Description of Operation
FASC Description of Parameters

Parameter Explanation
S1 Display format 0: Decimal point format1: Exponent format
specification
S1 +1 Total number Total number of digits of stored text (1 to 24)
of digits
S1 +2 Number of Number of digits past decimal point of stored text (0 to 7)
digits

* The "number of digits" includes sign, decimal point and symbol E for exponent format in
addition to the numerical value.

Parameter Explanation
CR2814 Zero suppress Unwanted zeros in the stored text are omitted.
(Zeros past the decimal point are not omitted.)
CR2815 + sign The + sign of the stored text is omitted.
omission

When the execution condition is ON, the single precision floating point type real number
specified by S2 is converted to HEX ASCII text string, and is stored starting from
D according to the contents of the parameters ( S1 to S1 +2).
End code NULL (00H) is stored at the end of text string.

@FASC This instruction is executed for one scan at the rising edge of the execution condition.

4-256 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Example When specified by the following parameter content

ARITHMETIC OPERATION
S1 : 0 (decimal point format) S2 ・ S2 +1: +12.3 (single precision floating point type real num
S1 +1 : 7 (total number of digits) CR2815 : OFF (+ sign not omitted)
S1 +2 : 2 (number of digits decimal point) CR2814 : OFF (zerosare not suppressed)

INSTRUCTIONS
bit
15
“+012.30” bit
0

D +(31H) 0(30H)
S2 +1 S2
D +1 1(31H) 2(32H)
+12.3
D +2 . (2EH) 3(33H)
Single precision floating point type real number N
D +3 0(30H) U
L (00H)

When S2 is 23.45 4
Total number Number of Text string to be stored to D
+ sign

Text Processing Instructions


of digits digits Zero suppress
omission
S1 +1 S1 +2 CR2814 Decimal point format Exponent format
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.
(CR2012turns ON.)

S2 When the digits past the decimal point of the value / S2 +1 is fewer than the
number of digits specified by number of digits past the decimal point ( S1 +2), the low-
order digits are packed with "0".
S2 When the digits past the decimal point of the value / S2 +1 is greater than the
number of digits specified by number of digits past the decimal point ( S1 +2), the
following digit is rounded to the nearest whole number.
When the number of digits past the decimal point ( S1 +2) is zero, the decimal point "."
is not output.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-257


Text Processing Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

ON when one of the following conditions is established. Otherwise, OFF.


• When the parameter value is out of range
• When the indirect specification and 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 bit other than the start of the channel is specified when bit data is specified for D

4 CR2012
• When a timer/counter is specified in D by indirect specification
• When the total number of digits and the number of digits past the decimal point does not
satisfy the following conditions
Text Processing Instructions

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
Number of digits past decimal point Number of digits past decimal point
0 < number of digits past +2 ≤ total number of digits +6 ≤ total number of digits
decimal point ≤ 7 3 ≤ total number of digits ≤ 24 7 ≤ total number of digits ≤ 24

• When an access outside the operand range occurs


"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-258 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
When input relay R000 is ON, single precision floating point type real number +1.23456 is convertedto
text string and stored to data memory [DM1000 and onwards], and-1.23456E-10 is converted totext
string and stored to data memory "DM2000 onwards".

INSTRUCTIONS
(Mnemonics list)
R000 CR2814 CR2815
RES SET ① LD R000
MPS
#0 #10 #5 RES CR2814
② CON

4
DW DW DW
SET CR2815
DM0 DM1 DM2
MRD
FASC DW #0 DM0
DM0 +1.23456 DM1000 ③ CON

Text Processing Instructions


DW #10 DM1
CON
CR2814 CR2815
DW #5 DM2
SET RES ④
MRD
FASC DM0 +1.23456 DM1000
#1 #15 #5 MRD
DW DW DW ⑤ SET CR2814
DM100 DM101 DM102 CON
RES CR2815
FASC MRD
DM100 −1.23456E−10 DM2000 ⑥
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

(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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-259


RFASCConvertto
strings text
single
precision
type floating point
real numbers

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


RFASC

RFASC
RFASC
String → Single
Convert text strings to single
precision floating
precision floating point type
point type real
@RFASC real numbers.
RFASC
number
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition RFASC
INSTRUCTIONS

S D R F A S C S D

Execution condition RFASC


S D @ R F A S C S D

Operand Explanation Occupied size

4 S Specifies the single precision floating point text string.* 1


8 bits × (number of
characters + 1)
Specifies the storage location for the single precision floating point
Text Processing Instructions

D 32 bits
type real number.

*1 When specifying bit data, specify the start of the channel.

Description of Operation
RFASC When the execution condition is ON, the text string from S up to NULL (00H) is
interpreted as the text string of a single precision floating point type real number, and is
converted to a single precision floating point type real number. The resulting numerical
value is stored to [ D / D +1].

Example 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-260 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

@RFASC This instruction is executed for one scan at the rising edge of the execution condition.

Operation cannot be performed normally when the timer or counter (T or C) is

ARITHMETIC OPERATION
Point
indirectly specified in D .
The format of the text string must satisfy the following conditions.

INSTRUCTIONS
• Only the following characters can be used in text strings: +(2BH), -(2DH), E(45H), .(2EH),
0(30H) to 9(39H).
• 0(30H) to 9 (39H) is required to either the left or right of the decimal point.(2EH).
• The text string must conform to the following format:
+

Sign Value
4
Sign: +, - or no sign is allowed

Text Processing Instructions


Numerical value: 0 to 9, approx. seven
effective digits . (2 EH) position is not specified.

+ +
E㧙

Sign Value Sign 8CNWG

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 typereal
number range
CR2012 • When a bit other than the start of the channel is specified when bit data is specified for S
• When a timer/counter is specified in S by indirect specification
• When the indirect specification or index modify range is inappropriate
• When the length of the text string specified by S exceeds 24
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-261


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

When input relay R000 is ON, the text string of the single precision floating point type real number
currently stored to data memory [DM01000 onwards] is converted to the numerical value of the single
precision floating point type real number and stored to [DM01000/DM01001].
INSTRUCTIONS

(Mnemonics list)
R000 RFASC
DM0 DM1000 LD R000
RFASC DM0 DM1000

4
Text Processing Instructions

4-262 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-263


LENDetect text string
length

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


LEN

LEN
LEN
Detect text string Count the number of charactersin
length text strings.
@LEN LEN
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition LEN
INSTRUCTIONS

S D L E N S D

Execution condition LEN


S D @ L E N S D

Operand Explanation Occupied size


Specifies the text string whose number of characters is to be counted 8 bits × (number of
4 S
or its storage location.* 1*2
Specifies the storage location for the counted number of characters.
characters + 1)
16 bit
D
Text Processing Instructions

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"CR/CM List", page A-43

Description of Operation
LEN When the execution condition is ON, the number of characters in the text string (NULL
(00H) is required at the end of the text string) currently stored starting from S is
counted. The number of characters is stored in binary data to D . Up to 1999 1-byte
characters can be handled as the text string.

S a(61H) b(62H) D 26
16-BIT
S +1 c(63H) d(64H) (1 word)

S +2 e(65H) f(66H)

w(77H) x(78H)
y(79H) z(7AH)
N
U (00H)
L

@LEN This instruction is executed for one scan at the rising edge of the execution condition.

Point 2-byte characters (shift JIS, etc.) are counted as two characters.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state

4-264 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

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

ARITHMETIC OPERATION
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 by indirect specification
• When a timer/counter is specified in S by indirect specification

INSTRUCTIONS
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
4

Text Processing Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-265


SMOVMove text string

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


SMOV

SMOV
SMOV
Move text
Store a text string.
string
@SMOV SMOV
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition SMOV
INSTRUCTIONS

S D S M O V S D

Execution condition SMOV


S D @ S M O V S D

Operand Explanation Occupied size


8 bits × (number of
4
* 1*2
S Specifies the text string to move or its storage location.
characters + 1)
8 bits × (number of
D Specifies the move destination of the text string.* 1
characters + 1)
Text Processing Instructions

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"CR/CM List", page A-43

Description of Operation
SMOV When the execution condition is ON, the text string data (NULL (00H) is required at the
end of the text string) currently stored starting from S is stored starting from D .
End code NULL (00H) is stored at the end of text string. Up to 1999 1-byte characters can
be handled as the text string.

S D
String data Transfer String data

Example

S : A(41H) B(42H)

S +1 : C(43H) D(44H)

N
S +2 : E(45H) U
L
(00H) D : A(41H) B(42H)

: 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 This instruction is executed for one scan at the rising edge of the execution condition.

Point • 2-byte characters (shift JIS, etc.) are counted as two characters.
• Program operation is normal even if the areas of S and D are overlapping.

4-266 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S
and D
CR2012 • When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When D exceeds the device / work area range when the text string of S is stored in 4
D

Text Processing Instructions


• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-267


SADDUnite text string

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


SADD

SADD
SADD
Unite text
Unite the text strings.
string
@SADD SADD
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition SADD
INSTRUCTIONS

S1 S2 D S A D D S1 S2 D

Execution condition SADD


S1 S2 D @ S A D D S1 S2 D

Operand Explanation Occupied size


8 bits × (number of
4
* 1*2
S1 Specifies the text string to unite forward or its storage location.
characters + 1)
8 bits × (number of
S2 Specifies the text string to unite backward or its storage location.* 1*2
characters + 1)
Text Processing Instructions

8 bits × (number of
D Specifies the storage location for the united text string. 1
characters + 1)

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"ASCII Code Table", page A-97

Description of Operation
SADD When the execution condition is ON, the text string currently stored starting from S1 is
united with the text string currently stored starting from S2 .
The result of the union is stored starting from D . End codeNULL (00H) is stored at
the end of text string.
The end code NULL (00H) is required at the end of the text string specified by S1 /
S2 . Up to 1999 1-byte characters can be handled asthe text string.

S1 A(41H) B(42H)
N
S1 +1 C(43H) U (00H)
L D A(41H) B(42H)

D +1 C(43H) D(44H)

D +2 E(45H) F(46H)
N
S2 D(44H) E(45H) D +3 G(47H) U
L
(00H)

S2 +1 F(46H) G(47H)
N
S2 +2 U
L
(00H)

@SADD This instruction is executed for one scan at the rising edge of the execution condition.

Point • 2-byte characters (shift JIS, etc.) are counted as two characters.
• Program operation is normal even if the areas of S1 , S2 and D are
overlapping.

4-268 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text strings specified by S1 and S2 do not contain the end code "NULL
(00H)"
• When the text string after the union including the end code (NULL (00H)) exceeds
2000characters
• When a bit other than the start of the channel is specified when bit data is specified for S1 ,

CR2012
S2 and D
• When a timer/counter has been specified by indirect specification in S1 , S2 and 4
D

Text Processing Instructions


• When the indirect specification and index modify range is inappropriate
• When D exceeds the device / work area range when the united text string is stored in
D
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

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


DM101: 2(32H) 3(33H) DM204: 4(34H)
N
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-269


SRGHTCut ofthe characters
number specified
from string.
text the right of the

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


SRGHT

SRGHT
SRGHT
Cut the specified number of
Cut text
characters from the right edge (end)
string on right
@SRGHT SRGHT of the text string.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition SRGHT
INSTRUCTIONS

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

Operand Explanation Occupied size


8 bits × (number of
4
* 1*2
S Specifies the text string of the cut source or its storage location.
characters + 1)
8 bits × (number of
D Specifies the storage location for the cut text string. 1
characters + 1)
Text Processing Instructions

Specifies the number of characters (number of bytes in range 0 to


n 16 bits
1999) to be cut.

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)

Description of Operation
SRGHT When the execution condition is ON, a text string with number of characters specified by
n is cut from the right edge (end) of the text string currently stored starting from
S , and the result is stored starting from D . End code NULL (00H) is stored at the
end of text string.
When the number of characters in the text string currently stored starting from S is
less than n , the entire text string is stored starting from D .
S and D may overlap.
When "0" is specified to n , only one character's worth of NULL is stored to D .

bit bit
Example 15 0

S A(41H) B(42H)

S +1 C(43H) D(44H)

S +2 E(45H) F(46H)

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)


N N
U(55H) U
L (00H) U(55H) U
L (00H)

String must be ended String must be ended


with NULL(00H). with NULL(00H).

@SRGHT This instruction is executed for one scan at the rising edge of the execution condition.

4-270 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When the text string stored after D exceeds the device / work area range
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 and D
• When a timer/counter is specified in S and D by indirect specification
• When the indirect specification and index modify range is inappropriate 4
• When n is specified as 2000 or more

Text Processing Instructions


• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-271


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

Four characters are cut from the right edge (end) of the text string data currently stored starting from
data memory DM0, and the result is stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS

CR2002 SRGHT
DM0 DM100 #4 LD CR2002
SRGHT DM0 DM100 #4
bit bit
15 0

DM0: A(41H) B(42H)


bit bit
15 0
DM1: C(43H) D(44H)
DM100: H(48H) I (49H)

4
DM2: E(45H) F(46H)
DM101: J(4AH) K(4BH)
DM3: G(47H) H(48H) N
DM102: U
L (00H)
DM4: I (49H) J(4AH)
Text Processing Instructions

N
DM5: K(4BH) U
L (00H)

Five characters are cut from the right edge (end) of the entered text string data, and the result isstored
starting from DM100.
(Mnemonics list)
CR2002 SRGHT
“ABCDEFGHIJKLM” DM100 #5 LD CR2002
SRGHT "ABCDEFGHIJKLM" DM100 #5
bit bit
15 0

DM100: I (49H) J(4AH)

“ABCDEFGHI
JKLM” DM101: K(4BH) L(4CH)
Five N
DM102: M(4DH) U
L (00H)
characters

4-272 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-273


SLEFTCut the specified
number of characters
from the left of the
text string

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


SLEFT

SLEFT SLEFT
Cut text
Cut the specified number of
characters from the left edge (start)
string on left
@SLEFT SLEFT of the text string.
ARITHMETIC OPERATION

Ladder program Input mode


Execution conditio SLEFT
INSTRUCTIONS

S D n S L E F T S D n

Execution conditio SLEFT


S S
D D
n @ S L E F T S D n

Operand Explanation Occupied size


8 bits × (number of
4 S Specifies the text string of the cut source or its storage location.* 1*2
characters + 1)
8 bits × (number of
D Specifies the storage location for the cut text string. 1
Text Processing Instructions

characters + 1)
Specifies the number of characters (number of bytes in range 0 to
n 16 bits
1999) to be cut.

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)

Description of Operation
SLEFT When the execution condition is ON, a text string with number of characters specified by
n is cut from the left edge (start) of the text string currently stored starting from
S , and the result is stored starting from D . End code NULL (00H) is stored at the
end of text string.
When the number of characters in the text string currently stored starting from S is
less than n , the entire text string is stored starting from D .
S and D may overlap.
When "0" is specified to n , only one character's worth of NULL is stored to D .

bit bit
Example 15 0

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
M(4DH) N(4EH) with NUL(00H).

S(53H) T(54H)
N
U(55H) U
L (00H)

String must be ended


with NUL(00H).

@SLEFT This instruction is executed for one scan at the rising edge of the execution condition.

4-274 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When the text string stored after D exceeds the device / work area range
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 and D
• When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate 4
• When n is specified as 2000 or more

Text Processing Instructions


• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-275


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

Four characters are cut from the left edge (start) of the text string data currently stored starting from
data memory DM0, and the result is stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS

CR2002 SLEFT
DM0 DM100 #4 LD CR2002
SLEFT DM0 DM100 #4
bit bit bit bit
15 0 15 0

DM0: A(41H) B(42H) DM100: A(41H) B(42H)

DM1: C(43H) D(44H) DM101: C(43H) D(44H)

4
N
DM2: E(45H) F(46H) DM102: U
L (00H)

DM3: G(47H) H(48H)

DM4: I (49H) J(4AH)


Text Processing Instructions

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)

“ABCDEFGHI
JKLM” DM101: C(43H) D(44H)
N
5 words DM102: E(45H) U
L (00H)

4-276 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-277


SMIDCut part of a text
string

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


SMID

SMID

SMID
Cut text string Cut part of a text string.
ARITHMETIC OPERATION

SMID

@SMID
INSTRUCTIONS

Ladder program Input mode


Execution condition SMID
S D n1 S M I D S D n1 n2
n2

Execution condition SMID

4 S

n2
D n1 @ S M I D S D n1 n2
Text Processing Instructions

Operand Explanation Occupied size


* 1*2 8 bits × (number of
S Specifies the text string of the cut source or its storage location.
characters + 1)
8 bits × (number of
D Specifies the storage location for the cut text string. 1
characters + 1)
Specifies the position to start cutting (number of bytes).* 3
n1 The start character of the text string specified by S is taken to be 16 bits
"0".
Specifies the number of characters (number of bytes in range 0 to
n2 16 bits
1999) to be cut.* 3

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 Timer / timer type label / TIMER type variable and counter / counter type label / COUNTER type
variable cannot be specified.

Description of Operation
SMID When the execution condition is ON, a text string with number of characters specified by
n2 is cut from the position specified by n1 in the text string currently stored
starting from S .
The cut text string is stored starting from D . End codeNULL (00H) is stored at the
end of text string.
When the number of characters in the text string currently stored starting from S is
less than n1 + n2 , the entire text string from n1 onwards is stored starting from
D .
S and D may overlap.
When "0" is specified to n2 , only one character's worth of NULL is stored to D .

@SMID This instruction is executed for one scan at the rising edge of the execution condition.

4-278 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Example Position 0

ARITHMETIC OPERATION
Cut position n1
bit bit
15 0

S A(41H) B(42H) D C(43H) D(44H)

INSTRUCTIONS
S +1 C(43H) D(44H) D +1 E(45H) F(46H)

S +2 E(45H) F(46H)
n2 words
K(4BH) L(4CH)
N
K(4BH) L(4CH) U
L (00H)

M(4DH) N(4EH) String must be ended


with NUL(00H).
4
S(53H) T(54H)

Text Processing Instructions


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 stored after D exceeds the device / work area range
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012
and D
• When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When n1 or n2 is specified as 2000 or more
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-279


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

Five characters are cut from cut leading position 1 of the text string data currently stored starting
fromdata memory DM0. The cut five characters are stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS

CR2002 SMID
DM0 DM100 #1 LD CR2002
SMID DM0 DM100 #1 #5
#5

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) E(45H)


N
DM2: E(45H) F(46H) DM102: F(46H) U
L (00H)
Text Processing Instructions

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)

“ABCDEFGHI
JKLM” DM101: E(45H) F(46H)
N
4 words DM102: U
L (00H)

4-280 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-281


SRPLCReplace part of a
text string

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


SRPLC

SRPLC

SRPLC
Replace text
Replace part of a text string.
string section
ARITHMETIC OPERATION

SRPLC

@SRPLC
INSTRUCTIONS

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
Text Processing Instructions

Operand Explanation Occupied size


* 1*2 8 bits × (number of
S1 Specifies the text string to be replaced or its storage location.
characters + 1)
8 bits × (number of
S2 Specifies the text string to replace or its storage location.* 1*2
characters + 1)
8 bits × (number of
D Specifies the storage location for the text string after replacement.* 1
characters + 1)
Specifies the replacement leading position (number of bytes)
n1 The start character of the text string specified by S1 is taken to be 16 bits
"0".
Specifies the replacement leading position (number of bytes, within 0
n2 16 bits
to 1999).

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)

Description of Operation
SRPLC When the execution condition is ON, a text string with number of characters specified by
n2 is replaced from the position specified by n1 in the text string currently stored
starting from S1 with the text string currently stored starting from S2 .
The text string after the replacement is stored starting from D . End code NULL (00H)
is stored at the end of text string.
When the number of characters in the text string currently stored starting from S1 is
less than n1 + n2 , the entire text string from n1 onwards is stored starting from
S2 .
S1 or S2 and D may overlap.

@SRPLC This instruction is executed for one scan at the rising edge of the execution condition.

4-282 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Example Position 0

ARITHMETIC OPERATION
Destination string Replace position n1 Text string to be
bit
15
bit
0
replaced

S1 A(41H) B(42H) S2 X(58H) Y(59H)


N

INSTRUCTIONS
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


G(47H) H(48H) with NUL(00H).

I(49H) J(4AH)

S(53H) T(54H)

U(55H)
N
U
L (00H)
4
String must be ended

Text Processing Instructions


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 instruction when S2 does not contain a text
string (NULL only).
• Operation is the same as the SMOV instruction when n2 =0 and S2 does not
contain a text string (NULL only).

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-283


Text Processing Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

ON when one of the following conditions is established. Otherwise, OFF


• When 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 the

4 CR2012
end code (NULL)
• When a bit other than the start of the channel is specified when bit data is specified for S1 ,
S2 and D
Text Processing Instructions

• When a timer/counter has been specified by indirect specification in S1 , S2 and


D
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-284 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
Two characters are replaced with the text string currently stored starting from data memory DM100from
the replacement leading position 4 in the text string currently stored starting from data memoryDM0.
The text string after the replacement is stored from DM200.

INSTRUCTIONS
(Mnemonics list)
CR2002 SRPLC
DM0 DM100 DM200 LD CR2002
#4 #2 SRPLC DM0 DM100 DM200 #4 #2

Position 0

Destination string Text string to be replaced

4
Replace position:4

DM0: A(41H) B(42H) DM100: 1(31H) 2(32H)


N
DM1: C(43H) D(44H) DM101: U
L (00H)

Text Processing Instructions


DM2: E(45H) F(46H) String must be ended
DM3:
N
U with NUL(00H).
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).

Character D (replacement start position 3, number of characters 1) in text string (ABCDEF) is replaced
with a text string (XYZ). The text string (ABCXYZEF) after replacement is stored from DM0.
(Mnemonics list)
CR2002 SMID
“ABCDEF” “XYZ” DM0 LD CR2002
#3 #1 SRPLC "ABCDEF" "XYZ" DM0 #3 #1

bit bit
15 0

DM0: A(41H) B(42H)

“ABCXYZEF” DM1: C(43H) X(58H)

DM2: Y(59H) Z(5AH)

DM3: E(45H) F(46H)


N
DM4: U
L (00H)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-285


SINSInsert
text string ainto
specified
a text
string

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


SINS

SINS

SINS
Insert text Insert a specified text string
string into a text string.
ARITHMETIC OPERATION

SINS

@SINS
INSTRUCTIONS

Ladder program Input mode


Execution condition SINS
S1 S2 D S I N S S1 S2 D n
n

Execution condition SINS

4 S1

n
S2 D @ S I N S S1 S2 D n
Text Processing Instructions

Operand Explanation Occupied size


* 1*2 8 bits × (number of
S1 Specifies the text string to be inserted or its storage location.
characters + 1)
8 bits × (number of
S2 Specifies the text string to insert or its storage location.* 1*2
characters + 1)
8 bits × (number of
D Specifies the storage location for the text string after insertion.* 1
characters + 1)
Specifies the insertion leading position (number of bytes).
n The start character of the text string specified by S1 is taken to be 16 bits
"0".

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)

Description of Operation
SINS When the execution condition is ON, the text string currently stored starting from S2 is
inserted from the position specified by n in the text string currently stored starting
from S1 .
The text string after the insertion is stored starting from D .
S1 or S2 and D may overlap.

@SINS This instruction is executed for one scan at the rising edge of the execution condition.

4-286 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Example Text string to be


Insert position n Text string to be

ARITHMETIC OPERATION
searched
bit bit searched
15 0

S1 A(41H) B(42H) S2 G(47H) H(48H)

S1 +1 C(43H) D(44H) S2 +1 I (49H) J(4AH)

INSTRUCTIONS
N
S1 +2 E(45H) F(46H) S2 +1 U
L (00H)

S1 +3 K(4BH) L(4CH) String must be ended


S1 +4 M(4DH) N(4EH) with NUL(00H).

4
S(53H) T(54H)
N
U(55H) U
L (00H)

Text Processing Instructions


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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-287


Text Processing Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

ON when one of the following conditions is established. Otherwise, OFF.


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

4
• When the length of the text string after the insertion exceeds 2000 characters including the
end code (NULL (00H))
CR2012
• When a bit other than the start of the channel is specified when bit data is specified for
Text Processing Instructions

S1 , S2 and D
• When a timer/counter has been specified by indirect specification in S1 , S2 and
D
• When the indirect specification and index modify range is inappropriate
• When the end of the text string stored in D is outside the device / work area range
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-288 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
The text string currently stored starting from data memory DM100 is inserted starting from insertion leading
position 3 of the text string currently stored starting from data memory DM0. The text string after the insertion
is stored from DM200.

INSTRUCTIONS
(Mnemonics list)
CR2002 SINS
DM0 DM100 DM200 LD CR2002
#3 SINS DM0 DM100 DM200 #3

Text string to Position 0


be searched Insert position:3

4
Text string to be searched

DM0: A(41H) B(42H) DM100: 1(31H) 2(32H)


N
DM1: C(43H) X(58H) DM101: 3(33H) U

Text Processing Instructions


L (00H)

DM2: Y(59H) Z(5AH) String must be ended


DM3:
N
U with NUL(00H).
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)

“ABCXYDZEF” DM1: C(43H) X(58H)

DM2: Y(59H) Z(5AH)

DM3: D(44H) E(45H)


N
DM4: F(46H) U
L (00H)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-289


SDELDelete a specified part
of a text string

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


SDEL

SDEL

SDEL
Delete text Delete a specified part of a
string section textstring.
ARITHMETIC OPERATION

SDEL

@SDEL
INSTRUCTIONS

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
Text Processing Instructions

Operand Explanation Occupied size


* 1*2 8 bits × (number of
S Specifies the text string to be deleted or its storage location.
characters + 1)
8 bits × (number of
D Specifies the storage location for the text string after deletion.* 1*2
characters + 1)
Specifies the deletion leading position (number of bytes).
n1 The start character of the text string specified by S is taken to be 16 bits
"0".
Specifies the number of characters (number of bytes in range 0 to
n2 16 bits
1999) to be delete.

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)

Description of Operation
SDEL When the execution condition is ON, a text string with number of characters specified by
n2 is cut from the position specified by n1 in the text string currently stored
starting from S .
The text string after the deletion is stored starting from D . End code NULL (00H) is
stored at the end of text string.
When the total of n1 and n2 exceeds the text string length, n1 to the end of
the text string (NULL (00H)) is deleted.
S and D may overlap.

@SDEL This instruction is executed for one scan at the rising edge of the execution condition.

4-290 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Example Position 0 n1 =2, n2 =2

ARITHMETIC OPERATION
Delete start position n1
bit bit
15 0

S A(41H) B(42H) D A(41H) B(42H)

INSTRUCTIONS
S +1 C(43H) D(44H) n2 words D +1 E(45H) F(46H)

S +2 E(45H) F(46H) D +2

K(4BH) L(4CH)

K(4BH) L(4CH)

S(53H) T(54H)
N
S(53H) T(54H) U(55H) U (00H)

4
L
N
U(55H) U
L (00H) String must be ended
with NUL (00H) .
String must be ended

Text Processing Instructions


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
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012
and D
• When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When the end of the text string stored in D is outside the device / work area range
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-291


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

Five characters are deleted from deletion leading position 1 of the text string data currently stored
starting from data memory DM0. The text string after deletion is stored starting from DM100.
(Mnemonics list)
INSTRUCTIONS

CR2002 SDEL
DM0 DM100 #1 LD CR2002
SDEL DM0 DM100 #1 #5
#5

4 DM0:

DM1:
A(41H)

C(43H)
B(42H)

D(44H)
DM100:

DM101:
A(41H)

H(48H)
G(47H)

I(49H)
Text Processing Instructions

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)

“ABCDEFGHI
JKLM” DM1: G(47H) H(48H)

Delete DM2: I(49H) J(4AH)

DM3: K(4BH) L(4CH)


N
DM4: M(4DH) U
L (00H)

4-292 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-293


STRIMDelete
text string ends of

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


STRIM

STRIM STRIM
Delete ends of
Deletes the tab and space at
the front and end of a
text string
@STRIM STRIM
specified text string.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition STRIM
S1 S2 D S1 S2 D
INSTRUCTIONS

S T R I M

Execution condition STRIM


S1 S2 D @ S T R I M S1 S2 D

Operand Explanation Occupied size


8 bits × (number of
Specifies the target text string or its storage location.* 1*2
4
S1
characters + 1)
S2 Specifies the parameter or its storage location. 16 bits
8 bits × (number of
Specifies the storage location for the text string after deletion.* 1
Text Processing Instructions

D
characters + 1)

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"ASCII Code Table", page A-97

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000 Series CPU
units that have CPU function version 2.0 or higher and with KV Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
STRIM When the execution condition is ON, the 1-byte space and tab at the end of the text string
data (The end code NULL (00H) is required at the end of the text string) stored starting
from S1 is all deleted according to the details of parameter ( S2 ), and the resulting
text string is stored starting from D .
Specifying the parameter
bit S2 bit
15 0

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

@STRIM This instruction is executed for one scan at the rising edge of the execution condition.

Example When "3" is specified for parameter S2 and the instruction is executed

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-294 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When S1 does not contain the end code
• When text string including end code (NULL(00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S1
and D
CR2012
• When a timer/counter has been specified by indirect specification in S1 or D
• When the indirect specification and index modify range is inappropriate
• When D exceeds the device / work area range when the result is stored in D 4
• When an access outside the operand range occurs

Text Processing Instructions


"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-295


SFINDSearch a
specified text string
from a text string

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


SFIND

SFIND

SFIND
Search text Search a specified text string
string from a text string.
ARITHMETIC OPERATION

SFIND

@SFIND
INSTRUCTIONS

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
Text Processing Instructions

Operand Explanation Occupied size


* 1*2 8 bits × (number of
S1 Specifies the text string to be searched or its storage location.
characters + 1)
8 bits × (number of
S2 Specifies the text string to search or its storage location.* 1*2
characters + 1)
D Specifies the storage location for the search result. 16 bits
Specifies the search leading position (number of bytes, within 0 to 1999).
n 16 bits
The start character of the text string specified by S1 is taken to be "0".

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)

Description of Operation
SFIND When the execution condition is ON, the text string currently stored starting from S2 is inserted
from the position specified by n in the text string currently stored starting from S1 .
The start position (number of bytes) of the text string specified by S2 from the first found
position onwards specified by n in the text string specified by S1 is stored to D .
When the text string specified by S2 is not found, or the length of the S2 text string
is 0, $FFFF is stored to D .

@SFIND This instruction is executed for one scan at the rising edge of the execution condition.

Example Position 0
Position n
Destination text string
to be searched Text string to be searched

S1 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

S(53H) T(54H)
Search range
N
U(55H) U
L (00H)

String must be ended with NUL(00H).

4-296 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S1 and S2 does not contain the end code "NULL
(00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When (length of S1 text string) < n + (length of S2 text string) (Length of text
string does not include the end code "NULL (00H)")
CR2012
• When a bit other than the start of the channel is specified when bit data is specified for S1
and S2 4
• When a timer/counter has been specified by indirect specification in S1 or S2

Text Processing Instructions


• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-297


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

The text string currently stored starting from data memory DM100 is searched starting from the start
(position 0) of the text string currently stored starting from data memory DM0. "4" is stored to DM200as
the text string is detected at position 4.
INSTRUCTIONS

(Mnemonics list)
CR2002 SFIND
DM0 DM100 DM200 LD CR2002
SFIND DM0 DM100 DM200 #0
#0

Position 0

4
Position 4 Text string to be searched

DM0: A(41H) B(42H) DM100: X(58H) Y(59H)


N
Text Processing Instructions

DM1: C(43H) D(44H) DM101: U


L (00H) String must be ended with NUL(00H).

DM2: X(58H) Y(59H)

DM3: E(45H) F(46H) As n =0, so search from start position, n is 4 , first time inspecting XY.

DM4: G(47H) H(48H) "4" is stored to DM200.

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-298 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-299


SFINDNSearch
text string a from
specified
a
specified
range. text string

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


SFINDN

SFINDN
SFINDN
Search a specified text
Search text
string from a specified
string
@SFINDN
SFINDN text string range.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition SFINDN
INSTRUCTIONS

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

Operand Explanation Occupied size


8 bits × (number of
4 S1 Specifies the text string to be searched or its storage location.* 1*2
characters + 1)
8 bits × (number of
S2 Specifies the text string to search or its storage location.* 1*2
characters + 1)
Text Processing Instructions

S3 Specifies the storage location for the parameter. 16 bits x2


D Specifies the storage location for the search result. 16 bits

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"ASCII Code Table", page A-97

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

4-300 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Description of Operation

ARITHMETIC OPERATION
SFINDN When the execution condition is ON, the text string currently stored starting from S2 is
searched from the position specified by S3 +1 in the text string of S3 bytes
currently stored starting from S1 .

INSTRUCTIONS
The start position (number of bytes) of the text string specified by S2 from the first
found position onwards specified by S3 +1 in the text string specified by S1 is
stored to D .
When the text string specified by S2 is not found, or the length of the S2 text string
is 0, $FFFF is stored to D .

Description of Parameters 4

Text Processing Instructions


Parameter Content
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)
S3 +1
The start character of the text string specified by S1 is taken to be "0".

@SFINDN This instruction is executed for one scan at the rising edge of the execution condition.

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
S1 +3 a(61H) b(62H) (00H).
S1 +4 c(63H) 1(31H) Search target text string
S1 +5 K(4BH) e(65H)
Search range
S1 +6 y(79H) NUL(00H)
S1 +7 d(64H) Z(60H) When S3 =18 S3 and +1=4, the position
S1 +8 2(32H) K(4BH) where the text string "Key" is detected after
position 4 is position 10.
e(65H) y(79H)
NUL(00H) 3(33H)
A(41H) b(62H) D 10
c(63H) N(4EH)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-301


Text Processing Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

ON when one of the following conditions is established. Otherwise, OFF.


• When the parameter value is out of range
• When S2 does not contain the end code
• When S3 ≧2000 or S3 =0
• When S3 < ([ S3 +1] + S2 text string length)
• When S3 > ( S1 text string length)

4 CR2012 • When a bit other than the start of the channel is specified when bit data is specified for S1
and S2
• When a timer/counter has been specified by indirect specification in S1 , S2 and
Text Processing Instructions

D
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

4-302 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Sample Program

ARITHMETIC OPERATION
The text string stored from data memory DM100 is searched from for from the 5th byte (position 4)head
of the 100-byte text string stored starting from data memory DM0 to the 5th byte (position 4) ofthe 100-
byte text string stored from data memory DM0.

INSTRUCTIONS
(Mnemonics list)
CR2002 #18 #4
DW DW LD CR2002
DM300 DM301 DW #18 DM300
CR2002 CON
SFINDN DW #4 DM301
DM0 DM100 DM300 DM200 LD CR2002
SFINDN DM0 DM100 DM300 DM200

Text Processing Instructions


Position 0

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
DM3 a(61H) b(62H) (00H).
DM4 c(63H) 1(31H)
Search target text string: 18 bytes
DM5 K(4BH) e(65H)
Search range
DM6 y(79H) NUL(00H)
DM7 d(64H) Z(60H)
When S3 =18 and S4 =4, the position
DM8 2(32H) K(4BH) where the text string "abc" is detected after
DM9 e(65H) y(79H) 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-303


SCMPCompare text
strings

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


SCMP

SCMP SCMP
Compare
Compare text strings.
text strings
@SCMP SCMP
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition S1 calculation flag
INSTRUCTIONS

SCMP S C M P S1 S2
S2

Execution condition S1 calculation flag


SCMP @ S C M P S1 S2
S2
Operand Explanation Occupied size
8 bits × (number of
4
* 1*2
S1 Specifies the text string to compare or its storage location.
characters + 1)
8 bits × (number of
S2 Specifies the text string to compare or its storage location.* 1*2
Text Processing Instructions

characters + 1)

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"ASCII Code Table", page A-97

Description of Operation
SCMP When the execution condition is ON, the text string currently stored starting from S1 is
compared with the text string currently stored starting from S2 . Comparison is
performed one byte at a time from each of the starts. The end code NULL (00H) is
required at the end of the text string specified by S1 and S2 . Up to 1999 1-byte
characters can be handled as the text string.
Compared
Compared

S1 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


• • end character found
S1 +6 M(4DH) •

(00H) S2 +6 N(4EH) •

(00H) (NUL(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

When the nth character is different, the operation flag changes as follows:
Compare Result State of Operation Flag
When (ASCII code of nth character of S1 ) < (ASCII code of nth
CR2009→ON
character of S2 )
When (ASCII code of nth character of S1 ) > (ASCII code of nth
CR2011→ON
character of S2 )

@SCMP This instruction is executed for one scan at the rising edge of the execution condition.
4-304 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
ON when nth character is different, and the ASCII code of the nth character of S1 is smaller
CR2009
than the ASCII code of the nth character of S2 . Otherwise, OFF.
ON when all of the ASCII code of S1 is the same as all of the ASCII code of
CR2010

INSTRUCTIONS
S2 .Otherwise, OFF.
ON when nth character is different, and the ASCII code of the nth character of S1 is greater
CR2011
than the ASCII code of the nth character of S2 . Otherwise, OFF.
ON in the following cases. Otherwise, OFF.
• When the text strings specified by S1 and S2 do not contain the end code "NULL
(00H)"

CR2012
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S1 4
and S2

Text Processing Instructions


• When a timer/counter has been specified by indirect specification in S1 or S2
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-305


Text Processing Instructions

Sample Program
ARITHMETIC OPERATION

The text string currently stored starting from data memory DM100 is compared in order from the startof
the text string currently stored starting from data memory DM0.
When all characters match as a result of the comparison, output relay R500 turns ON.
INSTRUCTIONS

When even one character does not match, output relay R501 turns ON.
(Mnemonics list)
CR2002 DM0 CR2010 R500
SCMP LD CR2002
DM100 SCMP DM0 DM100
CON
CR2009 R501
MPS

4 CR2011
AND CR2010
OUT R500
MPP
LD CR2009
Text Processing Instructions

OR CR2011
ANL
OUT R501

The text string currently stored starting from DM100 is compared in order from text string "12AB".
When all characters match as a result of the comparison, output relay R500 turns ON.
When even one character does not match, output relay R501 turns ON.
(Mnemonics list)
CR2002 “12AB” CR2010 R500
SCMP LD CR2002
DM100 SCMP "12AB" DM100
CON
CR2009 R501
MPS
AND CR2010
OUT R500
CR2011 MPP
LD CR2009
OR CR2011
ANL
OUT R501

4-306 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-307


DISSText→ string
bytes) (in
Text string
(in words) dispersion

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


DISS

DISS
DISS
Disperse text strings in bytes
Disperse text string
into text strings in words.
@DISS DISS
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition DISS
INSTRUCTIONS

S D D I S S S D

Execution condition DISS


S D @ D I S S S D

Operand Explanation Occupied size


8 bits × (number of
4
* 1*2
S Specifies the text string to be dispersed or its storage location.
characters + 1)
16 bits × Number of
D Specifies the storage location for the dispersed text string.* 1
characters
Text Processing Instructions

*1 When specifying bit data, specify the start 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:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
"ASCII Code Table", page A-97

Description of Operation
DISS When the execution condition is ON, the text string in bytes currently stored starting from
S is dispersed, and is stored in words starting from D . The end code NULL
(00H) is required at the end of S . Up to 1999 1-byte characters can be handled asthe
text string.

D 0 a(61H)
S a(61H) b(62H) D +1 0 b(62H)
S +1 c(63H) d(64H) D +2 0 c(63H)
N
S +2 e(63H) U
L
(00H) D +3 0 d(64H)

D +4 0 e(65H)

Higher bytes filled with 0


automatically.

@DISS This instruction is executed for one scan at the rising edge of the execution condition.

4-308 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S does not contain the end code "NULL (00H)"
• When the text string including the end code (NULL (00H)) exceeds 2000 characters
• When a bit other than the start of the channel is specified when bit data is specified for S
CR2012 and D
• When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs 4
"Out-of-range access of operands", page 1-50

Text Processing Instructions


* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-309


UNISText string (in
words) → Text string (in
bytes) unification

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


UNIS

UNIS
UNIS
Unite text strings in words
Unite text string
into text strings in bytes.
@UNIS UNIS
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition UNIS
INSTRUCTIONS

S D n U N I S S D n

Execution condition UNIS


S D n @ U N I S S D n

Operand Explanation Occupied size


Specifies the text string to be united. 16 bits × n

4
S
1 8 bits × (number of
D Specifies the storage location for the united text string.
characters + 1)
Text Processing Instructions

n Specifies the number of characters to unit in the range 0 to 1999. 16 bits

*1 When specifying bit data, specify the start of the channel.

Description of Operation
UNIS When the execution condition is ON, the text string in words currently stored starting from
S is stored in bytes to D . The number of characters to unite is specified by
n .

S a(61H)
S +1 b(62H) D a(61H) b(62H)

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 This instruction is executed for one scan at the rising edge of the execution condition.

4-310 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When the value of n is 2000 or more
• When a bit other than the start of the channel is specified when bit data is specified for S
and D
CR2012 • When a timer/counter has been specified by indirect specification in S or D
• When the indirect specification and index modify range is inappropriate
• When the united text string length cannot be stored in the area starting with D
• When an access outside the operand range occurs 4
"Out-of-range access of operands", page 1-50

Text Processing Instructions


* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-311


RCOMRead comment

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


RCOM

RCOM
RCOM
Read the comment of the
Read comment
device.
@RCOM
RCOM
ARITHMETIC OPERATION

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

Ladder program Input mode


INSTRUCTIONS

Execution condition RCOM


S D1 D2 R C O M S D1 D2

KV-1000

Ladder program Input mode

4 Execution condition RCOM


S D1 R C O M S D1
Text Processing Instructions

Execution condition RCOM


S D1 @ R C O M S D1

Operand Explanation Occupied size


1 bit for bits
S Specifies the device whose comment is to be read.* 1
16 bits for words
8 bits × (number of
D1 Specifies the storage location for the read comment.* 2*3
characters + 1)
D2 Specifies the notification bit.* 2*3*4 1 bit

*1 When the CPU unit is KV-1000, DM and EM cannot be specified.


*2 When specifying bit data, specify the start of the channel.
*3 When a device / variable to perform indirect specification or index modification has been
specified, writing to the specified device / variable is performed at the start of the operation.
*4 It cannot be used when using bit specification of word data.

4-312 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Description of Operation

ARITHMETIC OPERATION
RCOM KV-1000 When the execution condition is ON, the device comment of S is read, and is
stored starting from D1 . End code NULL (00H) is stored at the end of text string.
Up to 32 1-byte characters can be handled as the text string.

INSTRUCTIONS
S comment

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

...
(single byte) while full-width characters
are stored by Shift JIS (double byte).

D1 +15 31th character 32th character

Text Processing Instructions


N
D1 +16 U
L
(00H)

KV-5500/5000/3000, KV Nano Series The same processing as KV-1000 is performed at the rising
edge of the execution condition. The end notification is written into D2 , which is OFF
when the instruction execution starts and ON when the comment read ends.
KV-8000/7500/7300 The same processing is performed as KV-1000 at the rising edge of the
execution condition. Up to 32 characters can be processed. If all of the characters are
half-width characters, 33 bytes (32 bytes + NULL) are occupied, and if all of the
characters are full-width characters, 65 bytes (2×32 bytes + NULL) are occupied. When
stored, the character codes follow the project language settings. If a character that does
not exist in the project language configuration is used inside the device comment, the
device comment will be read out by replacing it with "_".

Point • The local device comment is read when both the local device comment and the global
device comment exit.
• KV-8000/7500/7300/5500/5000/3000, KV Nano Series After reading the comment with D2 ,
please read the following comments when reading multiple device comments.
• Device comment 1 (fixed) is read for the KV-8000/7000 Series.
• Variable / label comments cannot be read.

@RCOM This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-313


Text Processing Instructions

Operation flag
ARITHMETIC OPERATION

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
INSTRUCTIONS

ON when one of the following conditions is established. Otherwise, OFF.


• D1 When a bit other than the start of the channel is specified when bit data is specified for
D2
• D1 When a timer/counter is specified in D2 by indirect specification
CR2012
• When the indirect specification and index modify range is inappropriate
• KV-1000 When executing a write in the Run mode

4 • When an access outside the operand range occurs


"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


Text Processing Instructions

KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program

■ KV-8000/7500/7300/5500/5000/3000 and 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

■ KV-1000
The device comment "STARTING" of input relay R000 is stored to DM100, and the device
comment"Quantity" of data memory DM0 is stored to DM200.
(Mnemonics list)
CR2002 RCOM
R000 DM100 LD CR2002
RCOM R000 DM100
RCOM DM0 DM200
RCOM
DM0 DM200

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-314 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Text Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-315


CPSASCCIP text string
type data conversion

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


CPSASC

CPSASC CPSASC
CIP text string
type data
CIP text string type data is
converted into text string data.
@CPSASC CPSASC conversion
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition CPSASC
INSTRUCTIONS

S D C P S A S C S D

Execution condition CPSASC


S D @ C P S A S C S D

Operand Explanation Occupied size

4 S Specifies the CIP text string type data.* 1


Number of CIP
characters*2
8 bits × (number of
Specifies the storage location for the converted data.* 1
Text Processing Instructions

D
characters + 1)

*1 When specifying bit data, specify the start of the channel.


*2 The occupied size is determined by the content of the stored data.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
CPSASC When the execution condition is ON, the CIP text string type data stored in S is
converted and stored starting from D .
The CPSASC instruction is used to convert CIP text string type data.
For details on the CIP data type, refer to "EtherNet/IP Function User's Manual".

Example The operation of the CPSASC instruction is explained using the following type of CIP text
string type data as an example.

CIP text string type data


bit bit
15 0
S +0 5(0005H) CIP text string type data "ABCDE"
The size of the CIP text string type data is
S +1 B(42H) A(41H)
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
bit bit
15 0
S +0 5(0005H) A(41H) B(42H) D +0
S +1 B(42H) A(41H) C(43H) D(44H) D +1
S +2 D(44H) C(43H) E(45H) NULL(00H) D +1
S +3 E(45H)
Add NULL (00H) to end, interchange
high-order bytes and low-order bytes of
text string having data size, and then store.

@CPSASC Only one scan is executed at the rising edge of the execution conditions.
4-316 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When a bit other than the start of the channel is specified when bit data is specified for S
and D
• When the text string stored in D is outside the device / work area range
• When a timer/counter has been specified by indirect specification in S or D
CR2012 • When data size specified with start word of S is 0 or 2000 or more
• When the CIP text string type data specified by
range
S is outside the device / work area
4
• When the indirect specification or index modification range is inappropriate

Text Processing Instructions


• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-317


RCPSASC
CIP text string type data
reverse conversion

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


RCPSASC

RCPSASC RCPSASC CIP text string


type data
Converts text string
data into CIP text
reverse
@RCPSASC RCPSASC
conversion
string type data.
ARITHMETIC OPERATION

Ladder program Input mode


Execution condition RCPSASC
INSTRUCTIONS

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

Operand Explanation Occupied size

4 S Specifies the text string data.*1


8 bits × (number of
characters + 1)
Specifies the storage location for the converted CIP text string type Number of CIP
Text Processing Instructions

D1
data.*1 characters*2
Specifies the storage location for the data size (number of bytes) of
D2 16 bits
CIP text string type data stored in D1 after conversion.

*1 When specifying bit data, specify the start of the channel.


*2 The occupied size is determined by the content of the stored data.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
RCPSASC When the execution condition is ON, the text string data stored in S is converted into
CIP text string type data, and is stored starting from D1 .After conversion, the data size
(number of bytes) of the CIP text string type data stored in D1 is stored in D2 .
The RCPSASC instruction is used to convert text string data into CIP text string type data.
For details on the CIP data type, refer to "EtherNet/IP Function User's Manual".

Example The operation of the RCPSASC instruction is explained using the following type of CIP
text string type data as an example.
Text string "ABCDE"
bit bit
15 0
S +0 A(41H) B(42H)
S +1 C(43H) D(44H)
S +2 E(45H) NULL(00H) CIP text string type data "ABCDE"

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
The high-order bytes and low-order bytes
of the text string are interchanged and D(44H) C(43H) D1 +2
stored in D1 +1 and following. E(45H) D1 +3

The data size (byte unit) stored in D1
7(0007H) D2
is stored in D2 .

@RCPSASC Only one scan is executed at the rising edge of the execution conditions.

4-318 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Text Processing Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state

INSTRUCTIONS
ON when one of the following conditions is established. Otherwise, OFF.
• When a bit other than the start of the channel is specified when bit data is specified for
S , D1 and D2
• When the S text string exceeds 2000 characters, including the NULL (00H)
• When the text string stored in D1 is outside the device / work area range
CR2012 • When a timer/counter has been specified by indirect specification in S or D1


When there is no NULL (00H) at the end of the text string stored in S
When the length of the text string stored in S is 0 4
• When the indirect specification or index modification range is inappropriate

Text Processing Instructions


• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-319


Simple Operation Instructions
CAL+
Add values of Operand 1 and
Operand 2 and store the result

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano into Operand 3

CAL+

CAL+(.U)
CAL+.S
CAL+.D
CAL+ CAL+.L
CAL+.F
+
Add values
ARITHMETIC OPERATION

+.DF
ofOperand1
Add andOperand2and
@CAL+(.U) store the result into
@CAL+.S
INSTRUCTIONS

Operand3.
@CAL+.D
@CAL+ @CAL+.L
@CAL+.F
+

@CAL+.DF

4
Ladder program Input mode
Execution condition
C A L + S1 S2 D
+ S1 S2 D
Simple Operation Instructions

( + S1 S2 D )

Execution condition @ C A L + S1 S2 D
+ S1 S2 D
( @ + S1 S2 D )

Operand Explanation Occupied size


.U .S 16 bits
S1 Specifies the addition data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
S2 Specifies the addition data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
D Specifies the storage location for the operation (addition) result. .D .L .F 32 bits
.DF 64 bits

Description of Operation
CAL+(.U) When the execution condition is ON, add unsigned 16-bit BIN data in S1 and S2 ,
and store the result into D .
S1 S2 D
1234 + 4321 = 5555
16-bit 16-bit 16-bit
(1 word) (1 word) (1 word)

An overflow occurs if the operation result is greater than 65535.

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.

4-320 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL+.D When the execution condition is ON, add unsigned 32-bit BIN data in [ S1 / S1 +1]
and [ S2 / S2 +1], and store the result into [ D / D +1].

ARITHMETIC OPERATION
S1 +1 S1 S2 +1 S2 D +1 D
12345678 + 87654321 = 99999999
32-bit 32-bit 32-bit

INSTRUCTIONS
(2 words) (2 words) (2 words)

An overflow occurs if the operation result is greater than 4294967295.

CAL+.L When the execution condition is ON, add signed 32-bit BIN data in [ S1 / S1 +1] and
[ S2 / S2 +1], and store the result into [ D / D +1].

S1 +1 S1 S2 +1 S2 D +1 D
12345678
32-bit
+ −87654321
32-bit
= −75308643
32-bit
4
(2 words) (2 words) (2 words)

Simple Operation Instructions


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 the execution condition is ON, add the single precision floating point type real
numbers in [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into [ D /
D +1].

S1 +1 S1 S2 +1 S2 D +1 D
Single precision floating
point type real number + Single precision floating
point type real number = Single precision floating
point type real number

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

CAL+.DF When the execution condition is ON, add the double precision floating point type real
numbers in [ S1 / S1 +1/ S1 +2/ S1 +3] and [ S2 / S2 +1/ S2 +2/
S2 +3], and store the result into [ D / D +1/ D +2/ D +3].

S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number + Double precision floating point
type real number = Double precision floating point
type real number

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
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).
.

@CAL+.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The CAL+ and @CAL+ instructions perform operation in binary. The BCD number
must be converted to BIN with TBIN instruction before storing.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-321


Simple Operation Instructions

Operation flag
ARITHMETIC OPERATION

ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009
real number (.F) or double precision floating point type real number (.DF) range. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
INSTRUCTIONS

CR2011 No change in state


• For suffix "U/S/D/L"
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
It will not change when indirect specification or index modification is not used, and the access
outside the operand range is not checked.

4 CR2012
• For suffix "F"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the single precision floating point type real number range, and an access
Simple Operation Instructions

outside the operand range occurs; Otherwise OFF.


• For suffix "DF"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the double precision floating point type real number range, and an access
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 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-322 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Simple Operation Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-323


CAL-Subtract
Operand 2 fromthe
the value of
value of
Operandinto
result 1, Operand
and store3 the

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


CAL-

CAL-(.U)
CAL-.S
CAL-.D
CAL- CAL-.L
CAL-.F

Subtract the value
ARITHMETIC OPERATION

CAL-.DF of Operand 2 from


the value of
Subtract
@CAL-(.U) Operand 1, and
@CAL-.S store the result
INSTRUCTIONS

@CAL-.D into Operand 3.


@CAL- @CAL-.L
@CAL-.F

@CAL-.DF

4
Ladder program Input mode
Execution condition
C A L − S1 S2 D
− S1 S2 D
Simple Operation Instructions

(− S1 S2 D )

Execution condition @ C A L − S1 S2 D
− S1 S2 D
( @ − S1 S2 D )

Operand Explanation Occupied size


.U .S 16 bits
S1 Specifies the subtraction data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
S2 Specifies the subtraction data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
D Specifies the storage location for the operation (subtraction) result. .D .L .F 32 bits
.DF 64 bits

Description of Operation
CAL-(.U) When the execution condition is ON, subtract unsigned 16-bit BIN data in S2 from
S1 , and store the result into D .

S1 S2 D
5555 − 4321 = 1234
16-bit 16-bit 16-bit
(1 word) (1 word) (1 word)

An underflow occurs if the operation result is smaller than 0.

CAL-.S When the execution condition is ON, subtract signed 16-bit BIN data in S2 from
S1 , and store the result into D .

S1 S2 D
5555 − −4321 = 9876
16-bit 16-bit 16-bit
(1 word) (1 word) (1 word)

An overflow occurs if the operation result is greater than +32767.


An underflow occurs if the operation result is smaller than -32768.

4-324 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL-.D When the execution condition is ON, subtract unsigned 32-bit BIN data in [ S2 /
S2 +1] from [ S1 / S1 +1], and store the result into [ D / D +1].

ARITHMETIC OPERATION
S1 +1 S1 S2 +1 S2 D +1 D
99999999 − 12345678 = 87654321
32-bit 32-bit 32-bit

INSTRUCTIONS
(2 words) (2 words) (2 words)

An underflow occurs if the operation result is smaller than 0.

CAL-.L When the execution condition is ON, subtract signed 32-bit BIN data in [ S2 / S2 +1]
from [ S1 / S1 +1], and store the result into [ D / D +1].

S1 +1 S1 S2 +1 S2 D +1 D
87654321
32-bit
− −12345678
32-bit
= 99999999
32-bit
4
(2 words) (2 words) (2 words)

Simple Operation Instructions


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 the execution condition is ON, subtract the single precision floating point type real
number in [ S2 / S2 +1] from [ S1 / S1 +1], and store the result into [ D /
D +1].
S1 +1 S1 S2 +1 S2 D +1 D
Single precision floating point
type real number − Single precision floating point
type real number = Single precision floating point
type real number

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

CAL-.DF When the execution condition is ON, subtract the double precision floating point type real
number in [ S2 / S2 +1/ S2 +2/ S2 +3] from [ S1 / S1 +1/ S1 +2/
S1 +3], and store the result into [ D / D +1/ D +2/ D +3].

S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number − Double precision floating point
type real number = Double precision floating point
type real number

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
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).)

@CAL-.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The CAL- and @CAL- instructions perform operation in binary. The BCD number
mustbe converted to BIN with TBIN instruction before storing.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-325


Simple Operation Instructions

Operation flag
ARITHMETIC OPERATION

ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009
real number (.F) or double precision floating point type real number (.DF) range. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
INSTRUCTIONS

ON when the operation result is larger than "0". Otherwise, OFF.


CR2011
No change when the suffix is "F/DF".
• For suffix "U/S/D/L"
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
It will not change when indirect specification or index modification is not used, and the access

4 outside the operand range is not checked.


• For suffix "F"
ON when the indirect specification or index modification range is inappropriate, the operation
CR2012
Simple Operation Instructions

data is not within the single precision floating point type real number range, and an access
outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the double precision floating point type real number range, and an access
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Each time input relay R000 is ON, subtract unsigned 16-bit BIN data stored in DM2 from DM0, and
store the result into DM4.
(Mnemonics list)
R000
− DM0 DM2 DM4 LDP R000
CAL- DM0 DM2 DM4

4-326 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Simple Operation Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-327


CAL*Multiply values of
Operand 1 and Operand 2
and store the result into
Operand 3

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


CAL*

CAL*(.U)
CAL*.S
CAL*.D
CAL* CAL*.L
CAL*.F

Multiply values of
ARITHMETIC OPERATION

CAL*.DF
Operand 1 and
Multiply Operand 2 and
@CAL*(.U) store the result
@CAL*.S
INSTRUCTIONS

into Operand 3.
@CAL*.D
@CAL* @CAL*.L
@CAL*.F

@CAL*.DF

4
Ladder program Input mode
Execution condition
C A L * S1 S2 D
* S1 S2 D
Simple Operation Instructions

(* S1 S2 D )

Execution condition @ C A L * S1 S2 D
* S1 S2 D
( @ * S1 S2 D )

Operand Explanation Occupied size


.U .S 16 bits
S1 Specifies the multiplication data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
S2 Specifies the multiplication data. .D .L .F 32 bits
.DF 64 bits
.U .S .F 32 bits
D Specifies the storage location for the operation (multiplication) result.
.D .L .DF 64 bits

Description of Operation
CAL*(.U) When the execution condition is ON, multiply unsigned 16-bit BIN data in S1 and
S2 , and store the result into [ D / D +1].

S1 S2 D +1 D
5555 × 456 = 2533080
16-bit 16-bit 32-bit
(1 word) (1 word) (2 words)

CAL*.S When the execution condition is ON, multiply signed 16-bit BIN data in S1 and S2 ,
and store the result into [ D / D +1].

S1 S2 D +1 D
−123 × 123 = −15129
16-bit 16-bit 32-bit
(1 word) (1 word) (2 words)

CAL*.D When the execution condition is ON, multiply unsigned 32-bit BIN data in [ S1 /
S1 +1] and [ S2 / S2 +1], and store the result into [ D / D +1/ D +2/
D +3].

S1 +1 S1 S2 +1 S2 D +3 D +2 D +1 D
1234 × 5678 = 7006652
32-bit 32-bit 64-bit
(2 words) (2 words) (4 words)

4-328 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL*.L When the execution condition is ON, multiply signed 32-bit BIN data in [ S1 / S1 +1]
and [ S2 / S2 +1], and store the result into [ D / D +1/ D +2/ D +3].

ARITHMETIC OPERATION
S1 +1 S1 S2 +1 S2 D +3 D +2 D +1 D
−1234 × 5678 = −7006652
32-bit 32-bit 64-bit

INSTRUCTIONS
(2 words) (2 words) (4 words)

CAL*.F When the execution condition is ON, multiply the single precision floating point type real
numbers in [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into [ D /
D +1].

S1 +1 S1 S2 +1 S2 D +1 D
× =
4
Single precision floating point Single precision floating point Single precision floating point
type real number type real number type real number

32-bit 32-bit 32-bit


(2 words) (2 words) (2 words)

The range of single precision floating point type real numbers is

Simple Operation Instructions


−3.4E+38≦N≦−1.4E−45
N=0
1.4E−45≦N≦3.4E+38
(number of eff. digits: approx. 7).
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38
cannot be used.)

CAL*.DF When the execution condition is ON, multiply the double precision floating point type real
numbers in [ S1 / S1 +1/ S1 +2/ S1 +3] and [ S2 / S2 +1/ S2 +2/
S2 +3], and store the result into [ D / D +1/ D +2/ D +3].

S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number × Double precision floating point
type real number = Double precision floating point
type real number

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
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).

@CAL*.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point • The CAL* and @CAL* instructions perform operation in binary. The BCD number
mustbe converted to BIN with TBIN instruction before storing.
"TBIN instruction", page 4-160
• Operation can be enabled correctly even if overflow occurs.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-329


Simple Operation Instructions

Operation flag
ARITHMETIC OPERATION

ON if the operation results exceed the 16/32 bit (.U/.S/.D/.L), single precision floating point type
CR2009
real number (.F) or double precision floating point type real number (.DF) range. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.
INSTRUCTIONS

CR2011 No change in state


• For suffix "U/S/D/L"
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
It will not change when indirect specification or index modification is not used, and the access
outside the operand range is not checked.

4 CR2012
• For suffix "F"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the single precision floating point type real number range, and an access
Simple Operation Instructions

outside the operand range occurs; Otherwise OFF.


• For suffix "DF"
ON when the indirect specification or index modification range is inappropriate, the operation
data is not within the double precision floating point type real number range, and an access
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 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-330 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Simple Operation Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-331


CAL/Divide
of Operand the
1 byvalue
the
valuestore
and of the
Operand 2
result
into Operand 3

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


CAL/

CAL/(.U)
CAL/.S
CAL/.D
CAL/ CAL/.L
CAL/.F
/
Divide the value of
ARITHMETIC OPERATION

CAL/.DF Operand 1 by the


value of Operand
Divide
@CAL/(.U) 2 and store the
@CAL/.S result into
INSTRUCTIONS

@CAL/.D Operand 3.
@CAL/ @CAL/.L
@CAL/.F
/

@CAL/.DF

4
Ladder program Input mode
Execution condition
C A L / S1 S2 D
/ S1 S2 D
Simple Operation Instructions

( / S1 S2 D )

Execution condition @ C A L / S1 S2 D
/ S1 S2 D
( @ / S1 S2 D )

Operand Explanation Occupied size


.U .S 16 bits
S1 Specifies the division data. .D .L .F 32 bits
.DF 64 bits
.U .S 16 bits
S2 Specifies the division data. .D .L .F 32 bits
.DF 64 bits
.U .S .F 32 bits
D Specifies the storage location for the operation (division) result.
.D .L .DF 64 bits

Description of Operation
CAL/(.U) When the execution condition is ON, divide unsigned 16-bit BIN data in S1 by S2 ,
and store the result (quotient) into D and the remainder into D +1.

S1 S2 D D +1
12345 ÷ 100 = 123 Remainder: 45
16-bit 16-bit 16-bit 16-bit
(1 word) (1 word) (1 word) (1 word)

CAL/.S When the execution condition is ON, divide signed 16-bit BIN data in S1 by S2 ,
and store the result (quotient) into D and the remainder into D +1.

S1 S2 D D +1
−12345 ÷ 100 = −123 Remainder: −45
16-bit 16-bit 16-bit 16-bit
(1 word) (1 word) (1 word) (1 word)

An overflow occurs if the operation result is +32768.

4-332 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL/.D When the execution condition is ON, divide unsigned 32-bit BIN data in [ S1 / S1 +1]
by [ S2 / S2 +1], and store the result (quotient) into [ D / D +1] and the

ARITHMETIC OPERATION
remainder into [ D +2/ D +3].
S1 +1 S1 S2 +1 S2 D +1 D
12345678 ÷ 100 = 123456

INSTRUCTIONS
32-bit 32-bit 32-bit
(2 words) (2 words) (2 words)

D +3 D +2
Remainder: 78
32-bit
(2 words)

CAL/.L When the execution condition is ON, divide signed 32-bit BIN data in [ S1 / S1 +1] by
[ S2 / S2 +1], and store the result (quotient) into [
into [ D +2/ D +3].
D / D +1] and the remainder
4

Simple Operation Instructions


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 the execution condition is ON, divide the single precision floating point type real
number in [ S1 / S1 +1] by [ S2 / S2 +1], and store the quotient into [ D /
D +1].

S1 +1 S1 S2 +1 S2 D +1 D
Single precision floating point
type real number ÷ Single precision floating point
type real number = Single precision floating point
type real number

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

.
CAL/.DF When the execution condition is ON, divide the double precision floating point type real
number in [ S1 / S1 +1/ S1 +2/ S1 +3] by [ S2 / S2 +1/ S2 +2/ S2 +3],
and store the quotient into [ D / D +1/ D +2/ D +3].

S1 +3 S1 +2 S1 +1 S1 S2 +3 S2 +2 S2 +1 S2 D +3 D +2 D +1 D
Double precision floating point
type real number ÷ Double precision floating point
type real number = Double precision floating point
type real number

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
+2.23E−308 ≦ N ≦ +1.79E+308
(number of eff. digits: approx. 16).

@CAL/.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-333


Simple Operation Instructions

Point • The CAL/ and @CAL/ instructions perform operation in binary. The BCD number
must be converted to BIN with TBIN instruction before storing.
ARITHMETIC OPERATION

"TBIN instruction", page 4-160


• Operation can be enabled correctly even if overflow occurs.
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. Other wise, OFF.
CR2010 ON when the operation result is "0". Otherwise, OFF.

4 CR2011 No change in state


• For suffix "U/S/D/L"
ON when S2 =0, the indirect specification or index modification range is inappropriate,
Simple Operation Instructions

and an access outside the operand range occurs; Otherwise OFF.


• For suffix "F"
ON when S2 =0, the indirect specification or index modification range is inappropriate, the
operation data is not within the single precision floating point type real number range, and an
CR2012
access outside the operand range occurs; Otherwise OFF.
• For suffix "DF"
ON when S2 =0, the indirect specification or index modification range is inappropriate, the
operation data is not within the double precision floating point type real number range, and an
access outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When 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-334 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Simple Operation Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-335


CAL&Perform logical "AND"
operation of 2 values

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


CAL&

CAL&(.U)
CAL& CAL&.D &
Logic
Perform logical
"AND" operation
for the values of
@CAL&(.U) AND
Operand 1 and
@CAL&
ARITHMETIC OPERATION

@CAL&.D &
Operand 2.

Ladder program Input mode


INSTRUCTIONS

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 )

4
( @ W A N D S1 S2 D )
Operand Explanation Occupied size
.U 16 bits
Specifies the data to perform the logical "AND" operation.
Simple Operation Instructions

S1
.D 32 bits
.U 16 bits
S2 Specifies the data to perform the logical "AND" operation.
.D 32 bits
Specifies the storage location for the result of the logical "AND" .U 16 bits
D
operation. .D 32 bits

Description of Operation

When execution condition is ON, the specified BIN data of S1 and S2 , Logical AND true table

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
S2 0 1 0 1
D become "1".

D 0 0 0 1

CAL&(.U) When the execution condition is ON, perform logical "AND" for the 16-bit unsigned BIN
data specified by S1 and S2 , and store the result into D .

Example
& S1 S2 D

bit bit
15 0

S1 1111000011110000

bit AND bit


15 0

S2 0000000011111111

bit bit
15 0

D 0000000011110000

4-336 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL&.D When the execution condition is ON, perform logical "AND" for the 32-bit unsigned BIN
data specified by [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into

ARITHMETIC OPERATION
[ D / D +1].

Example

INSTRUCTIONS
&. D S1 S2 D

bit bit bit bit


31 16 15 0

S1 ・ S1 +1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

bit AND bit


31 0

S2 ・ S2 +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

4
bit bit
31 0

D ・ D +1 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

Simple Operation Instructions


@CAL&.□ This instruction is executed for one scan at the rising edge of the execution condition.

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The values of the 2-digit BCD digital switch (input relays R000 to R007) are stored to DM0.
CR2002 (Mnemonics list)
& R000 $00FF DM0
LD CR2002
Always ON
CAL& R000 $00FF DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-337


CAL | Perform
"OR" operation logical
of 2
values

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


CAL|

CAL|(.U) Perform logical


CAL| CAL|.D |
Logical
"OR" operation
for the values
@CAL|(.U)
OR of Operand 1
@CAL| and Operand
ARITHMETIC OPERATION

@CAL|.D |
2.

Ladder program Input mode


INSTRUCTIONS

Execution condition C A L | S1 S2 D
| S1 S2 D (| S1 S2 D )
(W O R S1 S2 D )

Execution condition @ C A L | S1 S2 D
| S1 S2 D ( @ | S1 S2 D )

4
( @ W O R S1 S2 D )
Operand Explanation Occupied size
.U 16 bits
Specifies the data to perform the logical "OR" operation.
Simple Operation Instructions

S1
.D 32 bits
.U 16 bits
S2 Specifies the data to perform the logical "OR" operation.
.D 32 bits
Specifies the storage location for the result of the logical "OR" .U 16 bits
D
operation. .D 32 bits

Description of Operation

Logical OR true table


When the execution is ON, calculate OR of the specified BIN data
of S1 and S2 , and store the result into D . Device status bit
If any bit of S1 and S2 is "1", the state of the same bit of D S1 0 0 1 1
become"1".
S2 0 1 0 1

D 0 1 1 1

CAL|(.U) When the execution condition is ON, perform logical "OR" for the 16-bit unsigned BIN
data specified by S1 and S2 , and store the result into D .

Example
| S1 S2 D

bit bit
15 0

S1 1111000011110000

bit OR bit
15 0

S2 0000000011111111

bit bit
15 0

D 1111000011111111

4-338 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL|.D When the execution condition is ON, perform logical "OR" for the 32-bit unsigned BIN
data specified by [ S1 / S1 +1] and [ S2 / S2 +1], and store the result into

ARITHMETIC OPERATION
[ D / D +1].

Example

INSTRUCTIONS
|. D S1 S2 D

bit bit bit bit


31 16 15 0

S1 ・ S1 +1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

bit OR bit
31 0

S2 ・ S2 +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

4
bit bit
31 0

D ・ D +1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1

Simple Operation Instructions


@CAL|.□ This instruction is executed for one scan at the rising edge of the execution condition.

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Perform the logical "OR" operation for the data of internal auxiliary relay MR000 to MR015 and MR100
to MR115, and output the result into the output relay R30000 to R30015.

(Mnemonics list)
CR2002
| MR000 MR100 R30000 LD CR2002
Always ON CAL| MR000 MR100 R30000

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-339


CAL^Perform logical
"Exclusive OR" operation
of 2 values.

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


CAL^

CAL^(.U) Perform logical


CAL^ CAL^.D ^
Logical
"Exclusive OR"
operation for the
exclusive
@CAL^(.U) values of
OR
@CAL^ Operand 1 and
ARITHMETIC OPERATION

@CAL^.D ^
Operand 2.

Ladder program Input mode


INSTRUCTIONS

Execution condition C A L ^ S1 S2 D
^ S1 S2 D ( ^ S1 S2 D )
(W X O R S1 S2 D )

Execution condition @ C A L ^ S1 S2 D
^ S1 S2 D ( @ ^ S1 S2 D )

4
( @ W X O R S1 S2 D )
Operand Explanation Occupied size
.U 16 bits
Specifies the data to perform the logical "Exclusive OR" operation.
Simple Operation Instructions

S1
.D 32 bits
.U 16 bits
S2 Specifies the data to perform the logical "Exclusive OR" operation.
.D 32 bits
Specifies the storage location for the result of the logical "Exclusive .U 16 bits
D
OR" operation. .D 32 bits

Description of Operation

When the executive condition is ON, perform the Exclusive OR of the Exclusive OR true table

specified BIN data S1 of S2 and , and store into D . Device status bit

When the values of the same bit of S1 and S2 are different, S1 0 0 1 1


S2 0 1 0 1
the state of the same bit of D become"1".
D 0 1 1 0

CAL^(.U) When the execution condition is ON, perform logical "Exclusive OR" for the 16-bit
unsigned BIN data specified by S1 and S2 , and store the result into D .

Example
^ S1 S2 D

bit bit
15 0

S1 1111000011110000

bit XOR bit


15 0

S2 0000000011111111

bit bit
15 0

D 1111000000001111

4-340 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL^.D When the execution condition is ON, perform logical "Exclusive OR" for the 32-bit
unsigned BIN data specified by [ S1 / S1 +1] and [ S2 / S2 +1], and store the

ARITHMETIC OPERATION
result into [ D / D +1].

Example

INSTRUCTIONS
^.D S1 S2 D

bit bit bit bit


31 16 15 0

S1 ・ S1 +1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

bit XOR bit


31 0

S2 ・ S2 +1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

4
bit bit
31 0

D ・ D +1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1

Simple Operation Instructions


@CAL^.□ This instruction is executed for one scan at the rising edge of the execution condition.

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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The last data of R30000 to R30015 is stored in the internal auxiliary relay MR000 to MR015 in advance,
and R500 is turend ON when any changes occur.
(Mnemonics list)
CR2002
^ R30000 MR000 DM0 LD CR2002
Always ON CAL^ R30000 MR000 DM0
MPS
CR2010 #100 ANB CR2010
SHOT SHOT #100 R500
R500 MPP
the operation result is zero
MOV R30000 MR000
MOV
R30000 MR000

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-341


CAL~Invert
the alldata
specified bits of

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


CAL~

~
CAL (.U)
~
CAL CAL~.D ~
Bit inversion
Invert all bits of
@CAL~(.U) the specified data.

@CAL~ ~.D
ARITHMETIC OPERATION

@CAL ~

Ladder program Input mode


INSTRUCTIONS

Execution condition C A L ~ S D

~ S D ( ~
(N O T
S
S
D )
D )
(C M L S D )

Execution condition @ C A L ~ S D

~
4
S D (@ ~ S D )
(@ N O T S D )
(@ C M L S D )
Simple Operation Instructions

Operand Explanation Occupied size


.U 16 bits
S Specifies the bit inversion data.
.D 32 bits
.U 16 bits
D Specifies the storage location for the bit inversion result.
.D 32 bits

Description of Operation
CAL~(.U) When the execution condition is ON, invert all bits of the unsigned 16-bit BIN data
specified in S ("0→1", "1→0"), and store the result into D .

Example
~ S D

bit bit
15 0

S 1111000010101010

bit bit
15 0

D 0000111101010101

CAL~.D When the execution condition is ON, invert all bits of the unsigned 32-bit BIN data
specified in [ S / S +1] ("0→1", "1→0"), and store the result into [ D / D +1].

Example
~.D S D

bit bit bit bit


31 16 15 0

S ・ S +1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

bit bit
31 0

D ・ D +1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

@CAL~.□ This instruction is executed for one scan at the rising edge of the execution condition.

4-342 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

Operation flag

ARITHMETIC OPERATION
CR2009 No change in state
CR2010 ON when the operation result is "0". Otherwise, OFF.
CR2011 No change in state

INSTRUCTIONS
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176. 4
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Simple Operation Instructions


"CR/CM List", page A-43

Sample Program
The state of input relays R00 to R003 are inverted and output to R500 to R503.
(Mnemonics list)
CR2002

Always ON
~ R000 MR000 LD CR2002
CAL~ R000 MR000
CAL& MR000 $000F R500

& MR000 $000F R500

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-343


CAL>>Shift the bit
content of the
specified data to the
smaller bit No. by the

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


bits
number of

CAL>>

CAL>>(.U)
CAL>>.S
CAL>> CAL>>.D
CAL>>.L
>> Shift the bit
content of the
specified data to
ARITHMETIC OPERATION

Shift right
@CAL>>(.U) the smaller bit No.
@CAL>>.S by the specified
@CAL>> @CAL>>.D
@CAL>>.L
>> number of bits.
INSTRUCTIONS

Ladder program Ladder program


Execution condition
C A L > > D n
>> D n
( > > D n )

4 Execution condition
>> D n
@ C A L > > D n
( @ > > D n )
Simple Operation Instructions

Operand Explanation Occupied size


Specifies the data to be shifted. .U .S 16 bits
D
The operation result is stored starting from D . .D .L 32 bits
n Specifies the number of bits to shift. 16 bits

Point The CAL>>.S (@CAL>>.S) instruction and CAL>>.L (@CAL>>.L) instruction can be usedwith
KV-8000/7000 Series CPU units, KV-5000/3000 Series CPU units that have CPUfunction
version 2.0 or higher and with KV Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
CAL>>(.U) When the execution condition is ON, shift the unsigned 16-bit BIN data specified by
D right (shift to the smaller bit No.) by the number of bits specified by n , and
store the result into D .
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
bit
( n −1)
bit bit
15 0

D 1110100000011001

D 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 10 0 1

n
higher   bits Delete

Filled with 0 1
CR2009
(Carry)

4-344 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL>>.S When the execution condition is ON, shift the signed 16-bit BIN data specified by D
right (shift to the smaller bit No.) by the number of bits specified by n , and store the

ARITHMETIC OPERATION
result into D .
0 is stored in the high-order n bit when " D ≧0", and 1 is stored when " D <
0". The bit ( n -1) status is stored in CR2009.

INSTRUCTIONS
bit
( n −1)
bit bit
15 0

D 1111110000011000

D 11111111110000011000

lower n bits Delete 4


1

Simple Operation Instructions


Filled with 1
CR2009
(Carry)

CAL>>.D When the execution condition is ON, shift the unsigned 32-bit BIN data specified by
[ D / D +1] right (shift to the smaller bit No.) by the number of bits specified by
n , and store the result into [ D / D +1].
"0" is stored to the high-order n bits. The bit ( n -1) status is stored in CR2009.
( n −1)
bit
bit bit
31 0

D ・ D +1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1

D ・ D +1 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1

higher n bits Delete

Filled with 0
1
CR2009
(Carry)

CAL>>.L When the execution condition is ON, shift the signed 16-bit BIN data specified by [ D /
D +1] right (shift to the smaller bit No.) by the number of bits specified by n , and
store the result into [ D / D +1].
0 is stored in the high-order n bit when "[ D / D +1]≧0", and 1 is stored when
"[ D / D +1]<0". The bit ( n -1) status is stored in CR2009.
( n −1)
bit
bit bit
15 0

D D +1 10010000110011110000110010101110

D D +1 11111001000011001111000011001010 1 1 1 0

higher n bits Delete

Sign value is stored 1


0 or more: 0
Less than 0: 1 CR2009
(Carry)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-345


Simple Operation Instructions

@CAL>>.□ This instruction is executed for one scan at the rising edge of the execution condition.
CAL>>When the SRA instruction is executed at every scan, the bits are shifted at
ARITHMETIC OPERATION

eachscan for the duration that the execution condition is ON. If the SRA instruction
isexecuted not at each scan but at the rising edge of the execution condition, use
thedifferential type execution instruction as follows.
INSTRUCTIONS

Operation flag

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
4 ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
Simple Operation Instructions

CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The BCD data (2 digits) from the digital switch entered to input relays R30008 to R30015 is stored
toDM0.
(Mnemonics list)
CR2002
>> R30000 #8 LD CR2002
Always ON CAL>> R30000 #8
CAL& $00FF R30000 DM0
& $00FF R30000 DM0

4-346 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

MEMO

ARITHMETIC OPERATION
INSTRUCTIONS
4

Simple Operation Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-347


CAL<<Shift ofthe the
content bit
specified
larger bitdata to the
No. by the
specified number of
bits

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


CAL<<

CAL<<(.U)
CAL<<.S
CAL<< CAL<<.D
CAL<<.L
<< Shift the bit
content of the
specified data to
ARITHMETIC OPERATION

Shift left
@CAL<<(.U) the larger bit No.
@CAL<<.S by the specified
@CAL<< @CAL<<.D
@CAL<<.L
<< number of bits.
INSTRUCTIONS

Ladder program Input mode


Execution condition
C A L < < D n
<< D n
( < < D n )

4 Execution condition
<< D n
@ C A L < < D n
( @ < < D n )
Simple Operation Instructions

Operand Explanation Occupied size


Specifies the data to be shifted. .U .S 16 bits
D
The operation result is stored starting from D . .D .L 32 bits
n Specifies the number of bits to shift. 16 bits

Point The CAL<<.S (@CAL<<.S) instruction and CAL<<.L (@CAL<<.L) instruction can be
usedwith KV-8000/7000 Series CPU units, KV-5000/3000 Series CPU units that have
CPUfunction version 2.0 or higher and with KV Nano Series base units.
"KV-5000/3000 CPU Function Version", page 4

Description of Operation
CAL<<(.U) When the execution condition is ON, shift the unsigned 16-bit BIN data specified by
D left (shift to the larger bit No.) by the number of bits specified by n , and store
the result into D .
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
bit (16− n )
bit bit
15 0

1110100000011001 D

1 11 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 D

Delete Lower n bit

1
Filled with 0
CR2009
(Carry)

4-348 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Simple Operation Instructions

CAL<<.S When the execution condition is ON, shift the signed 16-bit BIN data specified by D
left (shift to the larger bit No.) by the number of bits specified by n , and store the

ARITHMETIC OPERATION
result into D .
"0" is stored to the low-order n bits. The bit (16- n ) status is stored in CR2009.
(16− n
bit )

INSTRUCTIONS
bit bit
15 0

1110100000011001 D

111010000001100100000 D
Delete

1
lower n bits
4
Filled with 0

Simple Operation Instructions


CR2009
(Carry)

CAL<<.D When the execution condition is ON, shift the unsigned 32-bit BIN data specified by
[ D / D +1] left (shift to the larger bit No.) by the number of bits specified by n ,
and store the result into [ D / D +1].
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
(32− n
bit )
bit bit
31 0

1 1 1 0 10 0 0 0 0 0 1 1 0 0 1 1 11 0 10 0 0 0 0 0 1 1 0 0 1 D ・ D +1

1 11 0 10 0 0 0 00 1 1 0 0 1 1 1 1 0 1 0 00 0 00 1 1 0 0 1 0 0 0 0 0 D ・ D +1

Delete lower n bits

1 Filled with 0
CR2009
(Carry)

CAL<<.L When the execution condition is ON, shift the signed 32-bit BIN data specified by [ D /
D +1] left (shift to the larger bit No.) by the number of bits specified by n , and
store the result into [ D / D +1].
"0" is stored to the low-order n bits. The bit (32- n ) status is stored in CR2009.
(32− n
bit )
bit bit
31 0

11101000000110011110100000011001 D D +1

1 1 1 0 100000011001111010000001100100000 D D +1

Delete lower n bits

1
Filled with 0
CR2009
(Carry)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 4-349


Simple Operation Instructions

@CAL<<.□ This instruction is executed for one scan at the rising edge of the execution condition.
CAL<<When the SRA instruction is executed at every scan, the bits are shifted at
ARITHMETIC OPERATION

eachscan for the duration that the execution condition is ON. If it is executed not at each
scan but at the rising edge of the execution condition, use the differential type instruction.
INSTRUCTIONS

Operation flag

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 or index modification range is inappropriate, or an access
4 outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
Simple Operation Instructions

"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The data stored in the low-order 8 bits of data memory DM0 and DM1 is stored in DM10 with DM1 as
the high-order bit.
(Mnemonics list)
CR2002
<< DM1 #8 LD CR2002
Always ON CAL<< DM1 #8
CAL| DM0 DM1 DM10

| DM0 DM1 DM10

4-350 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


5

EXTENDED INSTRUCTIONS
EXTENDED
INSTRUCTIONS
These instructions are for data processing, clock processing, high-speed
processing, and positioning processing, and memory card control.
For information about other instructions for CPU built-in features, see User's
Manual of the CPU unit used.

Data Processing Instructions............................................. 5-2


Table Processing Instructions ......................................... 5-66
Clock Processing Instructions......................................... 5-88
Weekly Contact Instructions ............................................ 5-94
Calendar Contact Instructions ......................................... 5-98
Alarm Instruction............................................................. 5-102
High-speed Processing Instruction............................... 5-104
PID Control Instructions ................................................. 5-118
Storage Device Instructions........................................... 5-148
Access Window Instructions ......................................... 5-222
Free Operation Counter Instruction .............................. 5-230
Sensor Setting Instruction ............................................. 5-232
Cyclic Communication Refresh Instruction.................. 5-244

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-1


Data Processing
Instructions
HKEYHex key input

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


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

Operand Explanation Occupied size


S Specifies the start of the input bit to be read.* 1 1 bit x4
D Specifies the start of the output bit to output the read timing.* 1 1 bit x4

*1 Only bit data can be specified.

Description of Operation

5
• When the execution condition is ON, the information of the four bits specified by S

is captured in time interval (in the sequence D → D +1→ D +2→ D +3) into four times.
(8 scanning counts are required for processing.)
Data Processing Instructions

• 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

DC24V 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
0
Corresponding key 1 2 3 4 5 6 7 8 9 A B C D E F

Multiple key enable/disable, and end of key reading timing change according to the state of the special
auxiliary relays.

Relay No. CR3514 (read-write) CR3515 (read-only)


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

Point • At least approx 80 ms is required to process this instruction even when the scan
time is10 ms/operation or less.
• Execution of the instruction is cancelled when the scan time exceeds 200 ms.
• When the assigned relay is specified in the KLseries PLC, make sure that "the
scan time of the KV-8000/7500/7300/5500/5000/3000/1000PLC is greater than the
KL communication cycle time". The CPU scan time can be set as a fixed scan time.
• Only HKEY instruction can be used in a program.
• This instruction cannot be used in interrupt programs or in the initialization module.

5-2 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

EXTENDED INSTRUCTIONS
CR2011 No change in state
CR2012 No change in state

Sample Program
Changing the setting value of internal counters by the BCD digital switch

3 2 1 0

5
10 10 10 10
BCD Digital switch
Set value: $5679

Data Processing Instructions


Diode Connect digital switch
and
KV-5500/5000/3000/
1000 as shown in the
graph.
(Please remember
1 2 4 8 installing diode)
+ COM0 R000 R001 R002 R003

DC24V KV-5500/5000/3000/1000
− COM1 R500 R501 R502 R503

When input relay R004 is ON, the 16 inputs of the BCD digital switch are read, and control relay C3515
turns ON, the setting value of C0 is changed to the value (5679) specified by the digital switch.
(Mnemonics list)
R004 HKEY
R000 LD R004
R500 HKEY R000 R500
LD CR3515
CR3515 CR3600 C0
LDA CR3600
LDA TBIN STA
CON
TBIN
END CON
STA C0

ENDH

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-3


SEGDecoding
segment displayfor 7-

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


SEG

SEG(.U) Decodes the number of 1 digit


SEG SEG.D SEG
Decoding for
(4 bits) of a specified word
device to data for 7-segment
7-segment
@SEG(.U) display, and stores the result to
display
@SEG @SEG.D SEG the low-order 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
Operand Explanation Occupied size
.U 16 bits
S Specifies the (word) data that stores the data to be decoded.
.D 32 bits
5 n Specifies the number of digits (0 to 3 for .U, and 0 to 7 for .D).* 1 16 bits

*1 The following values are used when the value exceeds 0 to 3 or 0 to 7 when a value other than a
Data Processing Instructions

constant has been specified.


For .U: The value of the low-order 2 bits is used.
For .D: The value of the low-order 3 bits is used.
For example, when DM1000 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 low-order 2 bits is
"3".

Description of Operation
SEG(.U) When the execution condition is ON, the n th digit of S is decoded to data for 7-
segment display, and the result is stored to the low-order 8 bits of the 16-bit internal
register. The high-order 8 bits do not change.

Example When S is DM0, the currently stored data is $1234, and n is #2


#3 #2 #1 #0

DM0 0001001000110100

F E D C B A 9 8 7 6 5 4 3 2 1 0
16-bit internal
register 01011011

SEG.D When the execution condition is ON, the n th digit of [ S / S +1] is decoded to
data for 7-segment display, and the result is stored to the low-order 8 bits of the 16-bit
internal register. The high-order 8 bits do not change.

5-4 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Example When [ S / S +1] is DM0/DM1, the currently stored data is $12345678, and n
is #3
$12345678

EXTENDED INSTRUCTIONS
#7 #6 #5 #4 #3 #2 #1 #0

DM1 0001001000110100 0101011001111000 DM0

F E D C B A 9 8 7 6 5 4 3 2 1 0
16-bit internal
register 01101101

@SEG.□ This instruction is executed for one scan at the rising edge of the execution condition.

Value of
Specified Digit
16-bit internal register Bit0
5
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0

Data Processing Instructions


$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 or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-5


Data Processing Instructions

Sample Program
When input relay R000 is ON, the data ($24) stored in DM0 is output to the 7-segment display from
output relays R30000 to R30015.
EXTENDED INSTRUCTIONS

(Mnemonics list)
R000 $24 DM0 #8 DM0 R30000
DW SEG RLNCA SEG STA LD R000
DM0 #1 #0 DW $24 DM0
CON
a a SEG DM0 #1
CON
f b f b RLNCA #8
CON
g g SEG DM0 #0
CON
7-segment 7-segment
STA R30000
e c display e c display

5
(2nd digit) (1st digit)
d d
Data Processing Instructions

a b c d e f g a b c d e f g

KV-B16TA
R30000
R30001
R30002
R30003
R30004
R30005
R30006
R30007
COM0

R30008
R30009
R30010
R30011
R30012
R30013
R30014
R30015
COM1

5-6 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-7


BCNTCount the number of bits
currently ON in the internal
register

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


BCNT

BCNT(.U)
BCNT BCNT.D BCNT
Bit
Count the number of bits
currently ON in the internal
@BCNT(.U) count
register.
@BCNT @BCNT.D BCNT
EXTENDED INSTRUCTIONS

Ladder program Input mode


Execution condition
LDA BCNT STA B C N T

Execution condition
LDA BCNT STA @ B C N T

Description of Operation
5 BCNT(.U) When the execution condition is ON, the bits in 16-bit internal register that are currently
ON are detected, and the number of ON bits is stored to16-bit internal register as 16-bit
Data Processing Instructions

BIN data.

Example When #10313 (BIN: 10100001001001) is currently stored to 16-bit internal


register
bit b
15 0
16-bit internal
0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1
register

① ② ③ ④ ⑤

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

① ② ③ ④ ⑤ ⑥ ⑦⑧ ⑨

Store 9 due to 9 bits ON

32-bit internal
register #9

@BCNT.□ This instruction is executed for one scan at the rising edge of the execution condition.

5-8 - KV-8000/7000/5000/3000/1000 Series/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

Data Processing Instructions


CON
STA DM0

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-9


DCNTCount
data the same
with the number of
value
as the
in the data
internal
blockregister

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


DCNT

DCNT(.U)
DCNT DCNT.D DCNT
Data
Detect the data with the same
value as the internal register
@DCNT(.U) count in the specified range, and
@DCNT @DCNT.D DCNT count its number.
EXTENDED INSTRUCTIONS

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

Operand Explanation Occupied size


.U 16 bits x n
Specifies the start of the range to be detected.
5
S
.D 32 bits x n
n Specifies the number of data to be detected or its storage location. 16 bits
Data Processing Instructions

Description of Operation
DCNT(.U) When the execution condition is ON, n data stored starting from S is compared
with the 16-bit internal register respectively. The number of data having thesame value in
16-bit internal registers is stored to the 16-bit internal register. The numberof data is
stored in unsigned 16-bit BIN data.
bit bit 16-bit internal register
15 0 bit15 bit0

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

DCNT.D When the execution condition is ON, n data stored starting from S is compared
with the 32-bit internal register respectively. The number of data having thesame value in
32-bit internal registers is stored to the 32-bit internal register. The numberof data is
stored in unsigned 32-bit BIN data.

EXTENDED INSTRUCTIONS
bit bit bit bit bit 32-bit internal register bit
31 16 15 0 31 0

S +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

Compare 2

@DCNT.□ This instruction is executed for one scan at the rising edge of the execution condition.
5
Operation flag

Data Processing Instructions


CR2009 No change in state
CR2010 ON when the result is "0". Otherwise, OFF
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 or n =0
• When a value other than the constant is specified for n , and S + n exceeds
the device or work area range
CR2012
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/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 data
storing the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 DM10
LDA DCNT STA LD R000
#100 LDA DM0
CON
DCNT DM100 #100
CON
STA DM10

5 (2) Signed 16-bit BIN data count


When input relay R000 is ON, the signed 16-bit BIN data currently stored in data memory DM0 is
Data Processing Instructions

compared with the signed 16-bit BIN data currently stored in DM100 to DM199. The number of data
storing the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 DM10
LDA.S DCNT STA LD R000
#100 LDA.S DM0
CON
DCNT DM100 #100
CON
STA DM10

(3) Unsigned 32-bit BIN data count


When input relay R000 is ON, the 32-bit unsigned BIN data currently stored in [DM0/DM1] is compared
with the 32-bit unsigned BIN data currently stored in DM100 to DM299. The number of data storing the
same value is stored in [DM10/DM11].
(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 in data memory [DM0/DM1] is
compared with the signed 32-bit BIN data currently stored in DM100 to DM299. The number of data
storing the same value is stored in [DM10/DM11].
(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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-13


SERSearch the device
No. for the data with
the same value as the
internal register in

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano the data block

SER

SER(.U)
SER SER.D SER Detects devices of the same
value as the internal register in
Search
@SER(.U) the specified range, and
@SER @SER.D SER detects their device No.
EXTENDED INSTRUCTIONS

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

Operand Explanation Occupied size


.U 16 bits x n
S Specifies the start of the range to be detected.

5
.D 32 bits x n
n Specifies the number of data to be detected or its storage location. 16 bits
Data Processing Instructions

Description of Operation
SER(.U) When the execution condition is ON, n data stored starting from S is compared
with the 16-bit internal register respectively. The data No. storing the same value as the
16-bit internal register is stored to the 16/32-bit internal register. When multiple data
numbers are detected, the smallest data No. is stored. The data No. is stored in unsigned
16/32-bit BIN data.
bit bit 16-bit internal register
15 0 bit15 bit0

S 1234 When 3456 Detect device No. which stores


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-8000/7500/7300/5500/5000/3000、KV Nano Result S +2

5-14 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

SER.D When the execution condition is ON, n data stored starting from S is compared
with the 32-bit internal register respectively. The data No. for the low-order 16 bits of the
data number storing the same value as the 32-bit internal register is stored in the 32-bit
internal register. When multiple data numbers are detected, the smallest data No. is

EXTENDED INSTRUCTIONS
stored. The data No. is stored in unsigned 32-bit BIN data.
bit bit bit bit bit 32-bit internal register bit
31 16 15 0 31 0

S +1 12345678 S When 23456789

S +3 23456789 S +2 When Detect device No. which stores


the same value as that in 32-bit
S +5 34567890 S +4 When
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.□ This instruction is executed for one scan at the rising edge of the execution condition.

Data Processing Instructions


Point • Only data No. is stored as the result. There is no difference in data types such as
DM, TM and CM.
• When there is no matching data, nothing is written to the internal register.
Therefore, the value 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 one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate or n =0
• When a value other than the constant is specified for n , and S + n exceeds
the device / work area range
CR2012
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/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 data No. storing
the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 CR2010 DM10
LDA SER STA LD R000
#100 LDA DM0
CON
SER DM100 #100
CON
AND CR2010
STA DM10

5 (2) Signed 16-bit BIN data search


Data Processing Instructions

When input relay R000 is ON, the signed 16-bit BIN data currently stored in data memory DM0 is
compared with the signed 16-bit BIN data currently stored in DM100 to DM199. The data No. storing
the same value is stored in DM10.
(Mnemonics list)
R000 DM0 DM100 CR2010 DM10
LDA.S SER STA LD R000
#100 LDA.S DM0
CON
SER DM100 #100
CON
AND CR2010
STA DM10

(3) Unsigned 32-bit BIN data search


When input relay R000 is ON, the 32-bit unsigned BIN data currently stored in [DM0/DM1] is compared
with the 32-bit unsigned BIN data currently stored in DM100 to DM299. The data No. storing the same
value is stored in [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 in data memory [DM0/DM1] is
compared with the signed 32-bit BIN data currently stored in DM100 to DM299. The data No. storing
the same value is stored in [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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-17


DSERSearch
within for data
the specified
range.

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


DSER

DSER(.U)
DSER
DSER
DSER.D Search for
data within
Search
@DSER(.U) the specified
@DSER
DSER
@DSER.D range.
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

Operand Explanation Occupied size


.U 16 bits
S1 Specifies the data to be searched or its storage location.
5 S2 Specifies the start of the range to be searched.
.D 32 bits
.U 16 bits x n
.D 32 bits x n
Data Processing Instructions

D Specifies the start to store the search result. 16 bits x2


Specifies the number of data to be searched (1 to 65535) or its
n 16 bits
storage location.

Description of Operation
DSER(.U) When the execution condition is ON, the unsigned 16-bit BIN data specified by S1 is
the keyword to search the range of n words starting from S2 .
• The position of the first matched data (counted from S2 ) is stored in D .
• The number of data matched with the keyword is stored in D +1.
• In case no matching is found, "0" is stored in D and D +1.
bit bit S1
15 0 bit15 bit0
Position at first
S2 1234 When 3456

S2 +1 2345 When
3
S2 +2 3456 When
16-bit
n

( n word)
S2 + n −3 1234 When Number of consistence
D +1
S2 + n −2 3456 When
2
5678 When Result
S2 + n −1 16-bit

DSER.D When the execution condition is ON, the unsigned 32-bit BIN data specified by [ S1 /
S1 +1] is the keyword to search the range of n words starting from [ S2 /
S2 +1].
• The position of the first matched data (counted from [ S2 / S2 +1]) is stored in
D .
• The number of data matched with the keyword is stored in [ D +1].
• In case no matching is found, "0" is stored in D and [ D +1].

5-18 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

bit bit bit bit bit S1 +1 S1 bit


31 16 15 0 31 0
Position at first
S2 +1 12345678 S2 When 23456789

S2 +3 34567890 S2 +1 When
3
S2 +5 23456789 S2 +2 When
16-bit

EXTENDED INSTRUCTIONS
n


(2× n word)
S2 +
( n −3)+1 45678901 S2 +
( n −3) When Number of consistence
D +1
S2 +
( n −2)+1 23456789 S2 +
( n −2) When
2
56789012 Result
S2 +
( n −1)+1 S2 +
( n −1) When
16-bit

@DSER.□ Only one scan is executed at the rising edge of the execution conditions.

Operation flag

CR2009 No change in state


CR2010 ON when the search target is found in the specified range. Otherwise, OFF 5
CR2011 No change in state

Data Processing Instructions


• ON when the search range is outside the device / work area range.
• ON when the indirect specification and index modify range is inappropriate.
CR2012 • When an access outside the operand range occurs
Otherwise, OFF
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the number of data with the value "1234" from DM0 to DM999 and their
No. counted from the start are searched.
(Mnemonics list)
R000 DSER
#1234 DM0 DM1000 #1000 LD R000
search start Leading search destination Leading search result DSER #1234 DM0 DM1000 #1000

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-19


MAXSearch maximum
value in the data
block
MINSearch minimum

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano value in


block
the data

MAX,MIN

MAX(.U)
MAX.S
MAX.D
MAX MAX.L
MAX.F
MAX

MAX.DF Calculates the maximum value of


Search BIN data currently stored in a
EXTENDED INSTRUCTIONS

@MAX(.U) max.value specified range, and stores it to


@MAX.S the internal register.
@MAX.D
@MAX @MAX.L
@MAX.F
MAX

@MAX.DF

MIN(.U)
MIN.S
MIN.D
MIN MIN.L MIN

5 MIN.F
MIN.DF Calculates the minimum value of
Search BIN data currently stored in a
min.value specified range, and stores it to
Data Processing Instructions

@MIN(.U)
@MIN.S the internal register.
@MIN.D
@MIN @MIN.L
@MIN.F
MIN

@MIN.DF

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
Operand Explanation Occupied size
.U .S 16 bits x n
S Specifies the start of the range to be detected. .D .L .F 32 bits x n
.DF 64 bits x n
Specifies the number of data to be detected or its storage
n 16 bits
location.

Point The MAX.F (@MAX.F) instruction, MAX.DF (@MAX.DF) instruction, MIN.F (@MIN.F)
instruction and MIN.DF (@MIN.DF) instruction can be used with the KV-8000 series
CPU units and KV-7000 series CPU units with CPU function version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3

5-20 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Description of Operation
MAX(.U) / MIN(.U)
When the execution condition is ON, data starting from is compared

EXTENDED INSTRUCTIONS
n S
respectively. Currently stored values are compared as unsigned 16-bit BIN data. As a
result of comparison, the maximum value (MAX.D) or the minimum value (MIN.D) is
stored to 16-bit internal register.
bit bit
15 0

S 1234
MAX(.U): store Max. value
S +1 2345 16-bit internal register
bit15 bit0

S +2 3456 9876
n

5
( n word) S + n −3 9876 MIN(.U): store Min. value
S + n −2 8765 16-bit internal register
bit15 bit0

S + n −1 7654 1234

Data Processing Instructions


MAX.S / MIN.S
When the execution condition is ON, n data starting from S is compared
respectively. Currently stored values are compared as signed 16-bit BIN data. As a result
of comparison, the maximum value (MAX.D) or the minimum value (MIN.D) is stored to
16-bit internal register.
bit bit
15 0

S 1234
MAX.L:store Max value
S +1 2345 32-bit internal register
bit15 bit0

S +2 3456 3456
n

( n word) S + n −3 −1234 MIN.L:store Min value


S + n −2 −2345 32-bit internal register
bit15 bit0

S + n −1 −3456 −3456

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-21


Data Processing Instructions

MAX.D / MIN.D
When the execution condition is ON, n data starting from S is compared
respectively. Currently stored values are compared as unsigned 32-bit BIN data. As a
result of comparison, the maximum value (MAX.D) or the minimum value (MIN.D) is
EXTENDED INSTRUCTIONS

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, n data starting from S is compared
Data Processing Instructions

respectively. Currently stored values are compared as signed 32-bit BIN data. As a result
of comparison, the maximum value (MAX.D) or the minimum value (MIN.D) is stored to
32-bit internal register.
bit bit bit bit
31 16 15 0

S +1 12345678 S
MAX.L:store Max value
S +3 23456789 S +2 bit
31
32-bit internal register bit
0

S +5 34567890 S +4 34567890

n
(2 n word) S +2( n −3)+1 −12345678 S +2( n −3) MIN.L:store Min value
S +2( n −2)+1 −23456789 S +2( n −2) bit
31
32-bit internal register bit
0

S +2( n −1)+1 −34567990 S +2( n −1) −34567990

MAX.F / MIN.F
When the execution condition is ON, n data starting from S is compared
respectively. Stored values are compared as single precision floating point type real
numbers. As a result of comparison, the maximum value (MAX.F) or the minimum value
(MIN.F) is stored to 32-bit internal register.
bit bit bit bit
31 16 15 0

S +1 1.234 S
MAX.L:store Max value
S +3 2.345 S +2 bit
31
32-bit internal register bit
0

S +5 3.456 S +4 3.456

n
( 2 n word) S +2( n −3)+1 −1.234 S +2( n −3) MIN.F:store Min value
S +2( n −2)+1 −2.345 S +2( n −2) bit
31
32-bit internal register bit
0

S +2( n −1)+1 −3.456 S +2( n −1) −3.456

5-22 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MAX.DF / MIN.DF
When the execution condition is ON, n data starting from S is compared
respectively. Stored values are compared as double precision floating point type real
numbers.

EXTENDED INSTRUCTIONS
As a result of comparison, the maximum value (MAX.DF) or the minimum value
(MIN.DF)is stored to 64-bit internal register.
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0

S +3 1.2345678 S
MAX.DF:store Max value
S +7 2.3456789 S +4 bit
63
64-bit internal register bit
0

S +11 3.4567890 S +8 3.4567890


n
( 4 n word) S +4 ( n −3)+3 −1.234567 S +4 ( n −3) MIN.DF:store Min value
S +4 ( n −2)+3 −2.345789 S +4 ( n −2) bit 64-bit internal register bit

5
63 0

S +4 ( n −1)+3 −3.456890 S +4 ( n −1) −3.456890

@MAX.□ / MIN.□

Data Processing Instructions


This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the suffix is .F and the value to be operated on exceeds the single precision floating 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
CR2012 • When n =0
• When a value other than the constant is specified for n , and S + n exceeds the
device or work area range
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/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
CON
STA DM1001
5 (2) Signed 16-bit BIN data max. value search/min. value search
Data Processing Instructions

When input relay R000 is ON, the signed 16-bit BIN data currently stored in data memories DM0 to DM99
is compared. The maximum value is stored to DM1000. Also, the minimum value is stored to DM1001.
(Mnemonics list)
R000 DM0 DM1000
MAX.S STA.S LD R000
#100 MPS
MAX.S DM0 #100
DM0 DM1001
CON
MIN.S STA.S STA.S DM1000
#100 MPP
MIN.S DM0 #100
CON
STA.S DM1001

(3) Unsigned 32-bit BIN data max. value search/min. value search
When input relay R000 is ON, the unsigned 32-bit BIN data currently stored in data memories [DM0/
DM1] to [DM198·DM199] is compared. The maximum value is stored to [DM1000·DM1001]. Also, the
minimum value is stored to [DM1002/DM1003].
(Mnemonics list)
R000 DM0 DM1000
MAX.D STA.D LD R000
#100 MPS
MAX.D DM0 #100
DM0 DM1002
CON
MIN.D STA.D STA.D DM1000
#100 MPP
MIN.D DM0 #100
CON
STA.D DM1002

(4) Signed 32-bit BIN data max. value search/min. value search
When input relay R000 is ON, the signed 32-bit BIN data currently stored in data memories [DM0/DM1]
to [DM198·DM199] is compared. The maximum value is stored to [DM1000·DM1001]. Also, the
minimum value is stored to [DM1002/DM1003].
(Mnemonics list)
R000 DM0 DM1000
MAX.L STA.L LD R000
#100 MPS
MAX.L DM0 #100
DM0 DM1002
CON
MIN.L STA.L STA.L DM1000
#100 MPP
MIN.L DM0 #100
CON
STA.L DM1002

5-24 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

(5) Single precision floating point type real number max. value search/min. value
search
When input relay R000 is ON, the single precision floating point type real number stored in data

EXTENDED INSTRUCTIONS
memories [DM0/DM1] to [DM198·DM199] is compared. The maximum value is stored to
[DM1000·DM1001]. Also, the minimum value is stored to [DM1002/DM1003].
(Mnemonics list)
R000 DM0 DM1000
MAX.F STA.F LD R000
#100 MPS
MAX.F DM0 #100
DM0 DM1002
CON
MIN.F STA.F STA.F DM1000
#100 MPP
MIN.F DM0 #100
CON
STA.F DM1002

(6) Double precision floating point type real number max. value search/min. value
5

Data Processing Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-25


AVGAverage
in calculation
a data block

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


AVG

AVG(.U)
AVG.S
AVG.D
AVG AVG.L
AVG.F
AVG

AVG.DF Calculates the average value of


Average BIN data currently stored in a
EXTENDED INSTRUCTIONS

@AVG(.U) calculation specified range, and stores it to


@AVG.S the internal register.
@AVG.D
@AVG @AVG.L
@AVG.F
AVG

@AVG.DF

Ladder program Input mode


Execution condition S
AVG STA A V G S n

5 Execution condition S
n

AVG STA @ A V G S n
Data Processing Instructions

Operand Explanation Occupied size


.U .S 16 bits x n
S Specifies the start of the range to calculate the average value. .D .L .F 32 bits x n
.DF 64 bits x n
Specifies the number of data to be averaged or its storage
n 16 bits
location.

Point The AVG.F (@AVG.F) instruction and AVG.DF (@AVG.DF) instruction can be used
with the KV-8000 series CPU units and KV-7000 Series CPU units with CPU function
version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3

5-26 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Description of Operation
AVG(.U) When the execution condition is ON, the average value of n unsigned 16-bit BIN
data starting from is calculated and stored to 16-bit internal register.

EXTENDED INSTRUCTIONS
S
bit bit
15 0

S 16

S +1 256

S +2 4096
n …


( n word) S + n −3 16383 Average value is stored to 16-bit internal register.

S + n −2 32767 16-bit internal register


• •• • • • •••

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

Data Processing Instructions


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-8000/7000/5000/3000/1000 Series/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
31 16 15 0
EXTENDED INSTRUCTIONS

S +1 1.234 S
S +3 2.345 S +2
S +5 3.456 S +4
n


Average value is stored
( 2 n Word) S +2( n -3)+1 −1.234 S +2( n -3) to 32-bit internal register

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 S is calculated, and the result is stored in the

5 64-bit internal register.


bit
63
bit bit
48 47
bit bit
32 31
bit bit
16 15
bit
0

S +3 1.2345678 S
Data Processing Instructions

S +7 2.3456789 S +4
S +11 3.4567890 S +8
n


Average value is stored
( 4 n word) S +4( n -3)+1 −1.234567 S +4( n -3) to 64-bit internal register

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.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag
CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the suffix is .F and the values specified by S and n are outside the single
precision floating point type real number range
• When the suffix is .DF and the values specified by S and n are outside the double
precision floating point type real number range
• When the suffix is .F and the total during calculation is outside of the single precision floating
point type real number range
CR2012 • When the suffix is .DF and the total during calculation is outside of the double precision floating
point type real number range
• When n =0
• When a value other than the constant is specified for n , and S + n exceeds the
device or work area range
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-28 - KV-8000/7000/5000/3000/1000 Series/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 in 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

Data Processing Instructions


#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 in data
memories [DM0·M1] 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 to
[DM1000·DM1001].
(Mnemonics list)
R000 DM0 DM1000
AVG.F STA.F LD R000
#100 AVG.F DM0 #100
CON
STA.F DM1000

(6) Double precision floating point type real number average value calculation
When input relay R000 is ON, the average value of the double precision floating point type real
numbers stored in data memories [DM0/DM1·DM2·DM3] to [DM396·DM397·DM398·DM399] is
calculated, and the result is stored to [DM1000·DM1001·DM1002·DM1003].
(Mnemonics list)
R000 DM0 DM1000
AVG.DF STA.DF LD R000
#100 AVG.DF DM0 #100
CON
STA.DF DM1000

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-29


Data Processing Instructions

Example of application
The average value of travel distance data (expressed as unsigned 32-bit BIN data) is calculated, and
stored to data memories [DM1000/DM1001].
EXTENDED INSTRUCTIONS

The travel distance data is currently stored in [DM0/DM1]. The latest ten data are stored to [DM100/
DM101] to [DM118/DM119].
At the rising edge of input relay R000, the travel distance data is stored to data memories, and the
latest ten data are updated. The correct value will not be calculated unless the average value is
measured for ten times or more from the start of measurement.
"WSR Instruction", page 4-124

(Mnemonics list)
CR2008 DM0
ZRES LD CR2008

5
DM119 ZRES DM0 DM119
LDP R000
R000 WSR.D
WSR.D DM100 #10 #1
↑ DM100 #10 #1 MOV.D DM0 DM100
Data Processing Instructions

AVG.D DM100 #10


MOV.D CON
DM0 DM100 STA.D DM1000

DM100 DM1000
AVG.D STA.D
#10

5-30 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-31


WSUMCalculate the
total value of BIN
data in a specified
range

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


WSUM

WSUM(.U)
WSUM.S
WSUM.D
WSUM WSUM.L
WSUM.F
WSUM
Calculates the total value of
WSUM.DF
BIN data currently stored in
Word total
a specified range, and
EXTENDED INSTRUCTIONS

@WSUM(.U) calculation
stores it to the internal
@WSUM.S
register.
@WSUM.D
@WSUM @WSUM.L
@WSUM.F
WSUM

@WSUM.DF

Ladder program Input mode


Execution condition S
WSUM STA W S U M S n

5 Execution condition
n

S
S n
Data Processing Instructions

WSUM STA @ W S U M
n

Operand Explanation Occupied size


.U .S 16 bits x n
S Specifies the start of the range to calculate the total value. .D .L .F 32 bits x n
.DF 64 bits x n
Specifies the number of data to calculate the total value or its
n 16 bits
storage location.

Point The WSUM.F (@WSUM.F) instruction and WSUM.DF (@WSUM.DF) instruction can
beused with the KV-8000 series CPU units and KV-7000 Series CPU units that have
CPUfunction version 2.0 or later.
"KV-7500/7300 Series CPU Function Version", page 3

Description of Operation
WSUM(.U) When the execution condition is ON, the total value of n unsigned 16-bit BIN data
starting from S is calculated, and the result is stored to 32-bit internal register.
bit bit
15 0

S 16

S +1 256

S +2 4096
n

High 16 bits are stored to high 16 bit and


( n word) S + n −3 16383 TM0 of 32-bit internal register

S + n −2 32767
32-bit internal register

S + n −1 65535 Total Higher Lower


16-bit internal
TM0 register
32-bit
(2 word)

5-32 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

WSUM.S When the execution condition is ON, the total value of n signed 16-bit BIN data
starting from S is calculated, and the result is stored to 32-bit internal register.
bit bit
15 0

S -32700

EXTENDED INSTRUCTIONS
S +1 -16350

S +2 -8175
n


High 16 bits are stored to high 16 bit and
( n word)
S + n −3 8175 TM0 of 32-bit internal register

S + n −2 16350
32-bit internal register

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
5

Data Processing Instructions


temporary data memory TM0/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 memory TM0/TM1. The result is calculated as 64-bit data.
bit bit bit bit
31 16 15 0

S +1 -90123456 S
S +3 -89012345 S +2
S +5 -78901234 S +4


n
(2 n word) S +2( n -3)+1 78901234 S +2( n -3)
S +2( n -2)+1 89012345 S +2( n -2) Higher Lower

S +2( n -1)+1 90123456 S +2( n -1) Total TM1 TM0 32-bit internal register

64-bit

WSUM.F When the execution condition is ON, the total value of n single precision floating
point type real numbers starting from S is calculated, and the result is stored in the
32-bit internal register.
bit bit bit bit
31 16 15 0

S +1 1.234 S
S +3 2.345 S +2
S +5 3.456 S +4


n
( 2 n word) S +2( n -3)+1 −1.234 S +2( n -3)
S +2( n -2)+1 −2.345 S +2( n -2)
−3.456 32-bit internal register
S +2( n -1)+1 S +2( n -1) Total
32-bit

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-33


Data Processing Instructions

WSUM.DF When the execution condition is ON, the total value of n double precision floating
point type real numbers starting from S is calculated, and the result is stored in the
64-bit internal register.
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
EXTENDED INSTRUCTIONS

S +3 1.2345678 S
S +7 2.3456789 S +4
S +11 3.4567890 S +8



n
( 4 n word) S +4( n -3)+3 −1.234567 S +4( n -3)
S +4( n -2)+3 −2.345789 S +4( n -2)
64-bit internal register
S +4( n -1)+3 −3.456890 S +4( n -1) Total
64-bit

@WSUM.□ This instruction is executed for one scan at the rising edge of the execution condition.

5 Operation flag
CR2009 No change in state
Data Processing Instructions

CR2010 ON when the total is "0". Otherwise, OFF


CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When the suffix is .F and the values specified by S and n are outside the single
precision floating point type real number range
• When the suffix is .DF and the values specified by S and n are outside the double
precision floating point type real number range
• When the suffix is .F and the total during calculation is outside of the single precision floating
point type real number range
CR2012 • When the suffix is .DF and the total during calculation is outside of the double precision floating
point type real number range
• When n =0
• When a value other than the constant is specified for n , and S + n exceeds the
device or work area range
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-34 - KV-8000/7000/5000/3000/1000 Series/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 in data

EXTENDED INSTRUCTIONS
memories DM0 to DM99 is calculated, and the result is stored to DM1000.
The result is stored to "DM1000 · DM1001" when it exceeds the 16-bit range.
When the operation result is 0 to 65535
(Mnemonics list)
R000 DM0 DM1000
WSUM STA LD R000
#100 WSUM DM0 #100
CON
STA DM1000

When the operation result is 0 to 4294967295

R000 DM0 DM1000


(Mnemonics list) 5
WSUM STA.D LD R000

Data Processing Instructions


#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 in data
memories DM0 to DM99 is calculated, and the result is stored to DM1000.
The result is stored to "DM1000 · DM1001" when it exceeds the 16-bit range.
When the operation result is -32768 to 32767
(Mnemonics list)
R000 DM0 DM1000
WSUM.S STA.S LD R000
#100 WSUM.S DM0 #100
CON
STA.S DM1000

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-35


BSUMTotal
data of the
(8 bits) BIN
within
a specified
Internal range →
register

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


BSUM

BSUM BSUM
Byte total
Calculates the total value of high-order/low-
order 8 bits of the BIN data currently stored
calculation within a specified range, and stores it to the
@BSUM BSUM
internal register.

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

Operand Explanation Occupied size


S Specifies the start of the range to calculate the total value. 16 bits × ( n +1)/2
Specifies the number of data (in byte units) to calculate the total
n 16 bits
value.

5
Description of Operation
Data Processing Instructions

BSUM When the execution condition is ON, the total value of high-order and lower-order 8 bits of
the BIN data currently stored in a specified range starting from S is calculated, and
stored to 32-bit internal register.
The high-order 16 bits of the 32-bit internal register are also stored to temporary data
memory TM0. When n is an odd number, up to the high-order 8 bits of the last data
are calculated.
Calculation is performed from high-order to low-order bits. When n is an odd
number, the low-order 8 bits of the last word data are ignored.
16-bit
(1 word)
bit bit bit bit
15 8 7 0

S BDh 21h
BDh
S +1 B4h DDh Higher 16 bits of 32-bit internal register
21h
are also stored to TM0
S +2 B7h B0h B4h

・ TM0


S + n ÷2−3 4Eh 43h 45h
Overwrite
4Bh
S + n ÷2−2 59h 45h 45h
+ Higher Lower

S + n ÷2−1 4Bh 45h Total 32-bit internal register

@BSUM This instruction is executed for one scan at the rising edge of the execution condition.

5-36 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Operation flag

CR2009 No change in state


CR2010 ON when the total is "0" (All values are 0). Otherwise, OFF.

EXTENDED INSTRUCTIONS
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When a timer/counter is specified in S
• When a bit other than the start of the channel is specified when bit data is specified for S
• When the value of n is 0
• When the indirect specification or index modification range is inappropriate
CR2012 • When a value other than the constant is specified for n , and S + n exceeds
the device or work area range
• When an access outside the operand range occurs
It will not change when n is a constant and indirect specification or index modification is not
specified for S , and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
5

Data Processing Instructions


* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the ASCII text string currently stored starting from data memory DM0 is
totaled in bytes, and the result is stored to [DM1000·DM1001].
(Mnemonics list)
R000 LEN
DM0 DM100 ① LD R000
LEN DM0 DM100
BSUM DM0 DM100
DM0 DM1000 CON
BSUM STA.D ② STA.D DM1000
DM100

(1) The number of characters in the text string currently stored starting from DM0 is counted, and the number
of characters is stored to DM100.
(2) The value currently stored starting from DM0 is totaled in bytes, and the result is stored to [DM1000/
DM1001].

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-37


CRCCalculate the CRC
value,and store the
result to the internal
register.

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


CRC

CRC
CRC Calculates the CRC value of a
Calculate specified number of devices /
CRC value variables, and stores it to the
@CRC
CRC
internal register.

Ladder program Input mode


EXTENDED INSTRUCTIONS

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

Operand Explanation Occupied size


S1 Specifies the operation mode.* 1 1 bit ×4
8 bits × (number of
S2 Specifies the start of the data block to calculate.* 2

5
characters + 1)
Specifies the number of data (1- 65535).
n S1 +1 is ON: Specifies the number in 1-byte (8-bit) unit. 16 bits
Data Processing Instructions

S1 +1 is OFF: Specifies the number in 1-word (16-bit) unit.

*1 Only bit devices can be specified.


*2 When specifying bit data, specify the start of the channel.

Description of Operation
CRC When the execution condition is ON, the CRC value of n data starting from S2 is
calculated in the operation mode specified by S1 .

The operation of the CRC instruction changes as shown in the following table depending
on the value of operation mode S1 .

CRC Operation Method


Item
When ON When OFF
CRC Operation
S1 +0 CRC-ITU-T(CRC-CCITT) CRC-16(CRC-ANSI)
Method
Operation is performed in order upper 8bits Operation is performed only on
-> lower 8 bits. the lower 8 bits.
n : Even n : Odd (The upper 8bits are ignored.)
Order of
bit bit bit bit bit bit bit bit bit bit bit bit
15 8 7 0 15 8 7 0 15 8 7 0

S1 +1
operation 1 2 1 2 1
3 4 3 4 2

n −1 n n n

The value set to 16-bit internal register is The CRC default is fixed at
S1 +2 CRC default
used as the CRC default. 0x0000.
Operation data The bit alignment (order) of data to be The bit position is not inverted.
S1 +3 bit order operated on is inverted in byte units, and
inversion the CRC value is calculated.

* S1 + 2 and S1 + 3 are normally used in OFF state. Set these as necessary to match the
equipment to be used.

5-38 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

@CRC This instruction is executed for one scan at the rising edge of the execution condition.

Reference The following describes an example relating operation data bit order inversion in byte
units.

EXTENDED INSTRUCTIONS
Operation data
bit order CRC-ITU-T  S1 +0: ON CRC-16  S1 +0: OFF
inversion
bit bit bit bit
Not inverted 7 0 7 0

S1 +3: OFF Operating order Operating order

bit bit bit bit


Inverted 7 0 7 0

S1 +3: ON Operating order Operating order

Operation flag
5
CR2009 No change in state

Data Processing Instructions


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 word data or timer/counter is specified in S1 .
• When a bit other than the start of the channel is specified when a timer/counter or bit data is
specified for S2 by indirect specification
CR2012
• When the value of n is 0
• When any of S1 +0 to S1 +3 is outside the device / work area range
• When S2 is outside the device / work area range according to the n specification
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-39


ZRESSpecified
reset range

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


ZRES

ZRES ZRES
Zone reset
Resets (stores 0) all values
stored in a 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

Operand Explanation Occupied size*2


Specifies the start of the range to be reset (0 1 bit × ( D2 - D1 +1) for bits
D1
is stored).* 1 16 bits × ( D2 - D1 +1) for words
Specifies the end of the range to be reset (0 1 bit × ( D2 - D1 +1) for bits

5
D2
is stored).* 1 16 bits × ( D2 - D1 +1) for words

*1 CR cannot be specified.
Data Processing Instructions

*2 The ZRES instruction occupies the zone between D1 and D2 .

Description of Operation
ZRES When the execution condition is ON, D1 to D2 are reset (0 is stored).
When word data is specified
bit bit bit bit
15 0 15 0

D1 2048 Reset 0

D1 +1 4096 Reset 0

D1 +2 8192 Reset 0
: :

D2 −2 16384 Reset 0

D2 −1 32767 Reset 0

D2 65535 Reset 0

When bit data is specified


D1 : R1005, D2 : R1011

R1002: ON ON :R1002
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: ON OFF :R1011
R1012: ON ON :R1012
R1013: ON ON :R1013

@ZRES This instruction is executed for one scan at the rising edge of the execution condition.

5-40 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Point • The current values of timers (TMR, TMH, TMS, TMU) becomes the same value as
the setting value.
• The current value of counters (C, OUTC), up-down counters (UDC), and up-down

EXTENDED INSTRUCTIONS
timers (UDT) becomes "0".

Operation flag

CR2009 No change in state


CR2010 No change in state
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, the types of data
specified in D1 and D2 are different, or an access outside the operand range occurs;
Otherwise OFF.
CR2012
It will not change when indirect specification or index modification is not specified, and the access
outside the operand range is not checked.
5
"Out-of-range access of operands", page 1-50

Data Processing Instructions


* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When input relay R000 turns ON, "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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-41


EXT16-bit internal
register → 32-bit
internal register
extension

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


EXT

EXT(.U)
EXT.S
EXT EXT.D
EXT.L
EXT

Extends the data in internal


Extend data
@EXT(.U) registers.
@EXT.S
@EXT
EXTENDED INSTRUCTIONS

@EXT.D EXT
@EXT.L

Ladder program Input mode


Execution condition
LDA EXT STA.D E X T

Execution condition
LDA EXT STA.D @ E X T

5
Description of Operation
Data Processing Instructions

The values of 16-bit internal registers are extended to 32 bits. This instruction is used for addition,
subtraction, multiplication, and division arithmetic operation calculations.
"ADD Instruction", page 4-40
"SUB Instruction", page 4-44
"MUL Instruction", page 4-48
"DIV Instruction", page 4-54
"ROOT Instruction", page 4-66

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, the unsigned 16-bit BIN data currently stored in 16-
bit internal register is extended to 32 bits.
$0 is stored to the high-order 16 bits and temporary data memory TM0 of the 32-bit
internal register.

1234
1234 TM0 16-bit internal register

16-bit 1234
(1 word)
32-bit
(2 word)

EXT.S When the execution condition is ON, the signed 16-bit BIN data currently stored in 16-bit
internal register is extended to 32 bits.
$0 is stored to the high-order 16 bits and temporary data memory TM0 of 32-bit internal
register if the data is positive, and $FFFF is stored if the data is negative.

−1234
−1234 TM0 16-bit internal register

16-bit −1234
(1 word)
32-bit
(2 word)

5-42 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

The values of 32-bit internal registers are extended to 64 bits. This instruction is used for addition,
subtraction, multiplication, and division arithmetic operation calculations.
"MUL Instruction", page 4-48
"DIV Instruction", page 4-54

EXTENDED INSTRUCTIONS
"ROOT Instruction", page 4-66

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, the unsigned 32-bit BIN data currently stored in 32-
bit internal register is extended to 64 bits. $0 is stored to temporary data memories
[TM0·TM1].
TM1 TM0 32-bit internal register

12345678
32-bit
(2 word)
12345678
64-bit
(4 word)
5

Data Processing Instructions


EXT.L When the execution condition is ON, the signed 32-bit BIN data currently stored in 32-bit
internal register is extended to 64 bits. $0 is stored to temporary data memories
[TM0·TM1] if the data is positive, and $FFFFFFFF is stored if the data is negative.
TM1 TM0 32-bit internal register

−12345678 −12345678
32-bit 64-bit
(2 word) (4 word)

@EXT.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag

CR2009 No change in state


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

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-43


Data Processing Instructions

"

Sample Program
The unsigned 16-bit BIN data currently stored in data memory DM0 is extended to unsigned 32-bit BIN
data, and the unsigned 32-bit BIN data currently stored in [DM10/DM11] is added. The result is stored
EXTENDED INSTRUCTIONS

to [DM20/DM21].
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA EXT ADD.D STA.D LD CR2002
LDA DM0
CON
EXT
CON
ADD.D DM10
CON
STA.D DM20

The signed 16-bit BIN data currently stored in data memory DM0 is extended to signed 32-bit BIN data,
5 and the signed 32-bit BIN data currently stored in [DM10/DM11] is added. The result is stored to
[DM20/DM21].
Data Processing Instructions

(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.S EXT.S ADD.L STA.L LD CR2002
LDA.S DM0
CON
EXT.S
CON
ADD.L DM10
CON
STA.L DM20

The unsigned 32-bit BIN data currently stored in data memories [DM0/DM1] is extended to 64-bit
unsigned BIN data, and divided by the unsigned 32-bit BIN data currently stored in [DM10/DM11]. The
quotient is stored to [DM20/DM21] and the remainder is stored to [DM22/DM23].
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.D EXT.D DIV.D STA.D LD CR2002
MPS
TM2 DM22 LDA.D DM0
LDA.D STA.D CON
EXT.D
CON
DIV.D DM10
CON
STA.D DM20
MPP
LDA.D TM2
CON
STA.D DM22

The signed 32-bit BIN data currently stored in data memory [DM0/DM1] is extended to 64-bit data, and
the signed 32-bit BIN data currently stored in [DM10/DM11] is added. The quotient is stored to [DM20/
DM21] and the remainder is stored to [DM22/DM23].
(Mnemonics list)
CR2002 DM0 DM10 DM20
LDA.L EXT.L DIV.L STA.L LD CR2002
MPS
TM2 DM22 LDA.L DM0
LDA.L STA.L CON
EXT.L
CON
DIV.L DM10
CON
STA.L DM20
MPP
LDA.L TM2
CON
STA.L DM22

5-44 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-45


BCMPCompares
in the ranges.
two specified BIN data

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


BCMP

BCMP(.U)
BCMP
BCMP.S
BCMP BCMP.D
BCMP.L Compare
data Compares the BIN data in
@BCMP(.U) between two specified ranges.
@BCMP.S BCMP blocks
@BCMP
EXTENDED INSTRUCTIONS

@BCMP.D
@BCMP.L

Interrupt program Input mode

Execution condition BCMP


S1 S2 D B C M P S1 S2 D n
n

Execution condition BCMP


S1 S2

5
D @ B C M P S1 S2 D n
n

Operand Explanation Occupied size


Data Processing Instructions

.U .S 16 bits x n
S1 Specifies the start of the data block to compare.
.D .L 32 bits x n
.U .S 16 bits x n
S2 Specifies the start of the data block to compare.
.D .L 32 bits x n
D Specifies the start to store the comparison result.* 1 n bits
n Specifies the number of data to compare. 16 bits

*1 When bit data is specified, n continuous bits are occupied. When word data is specified, the
LSB of continuous n words becomes the result storage location. Bits other than LSB do not
change.

5-46 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Description of Operation
BCMP(.U) When the execution condition is ON, n unsigned 16-bit BIN data starting from S1
and unsigned 16-bit BIN data starting from are compared, and the result is

EXTENDED INSTRUCTIONS
n S2
stored to the bit data starting from D .
bit
15
bit
0
When bit
15
bit
0
Result
S1 1234 S2 1234 D ON

S1 +1 5678 S2 +1 5678 D +1 ON

S1 +2 0 S2 +2 1000 D +2 OFF
n


( n word)
S1 + n −2 4567 S2 + n −2 5678 D + n −2 OFF
S1 + n −1 7890 S2 + n −1 7890 D + n −1 ON
CR2010 : OFF
5
BCMP.S When the execution condition is ON, n signed 16-bit BIN data starting from S1

Data Processing Instructions


and n signed 16-bit BIN data starting from S2 are compared, and the result is
stored to the bit data starting from D .
bit
15
bit
0
When bit
15
bit
0
Result
S1 −1234 S2 −1234 D ON

S1 +1 5678 S2 +1 5678 D +1 ON

S1 +2 0 S2 +2 1000 D +2 OFF
n


( n word)
S1 + n −2 4567 S2 + n −2 5678 D + n −2 OFF
S1 + n −1 −7890 S2 + n −1 −7890 D + n −1 ON
CR2010 : OFF

BCMP.D When the execution condition is ON, n unsigned 32-bit BIN data starting from S1
and n unsigned 32-bit BIN data starting from S2 are compared, and the result is
stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When bit
31
bit bit
16 15
bit
0
Result
S1 +1 12345678 S1 S2 +1 12345678 S2 D ON

S1 +3 56780123 S1 +2 S2 +3 56780123 S2 +2 D +1 ON

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 n signed 32-bit BIN data starting from S2 are compared, and the result is
stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When bit
31
bit bit
16 15
bit
0
Result
S1 +1 −12345678 S1 S2 +1 −12345678 S2 D ON

S1 +3 −56780123 S1 +2 S2 +3 −56780123 S2 +2 D +1 ON

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.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/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


ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When n =0
• When one or more of S1 , S2 and D exceeds the device / work area range
CR2012 because of the n specification
• When an access outside the operand range occurs
When n is a constant, and indirect specification or index modification has not been specified
to S1 , S2 and D
"Out-of-range access of operands", page 1-50

5 * The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
Data Processing Instructions

KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
The value currently stored to data memories DM0 to DM2 and the value currently stored to data
memories DM100 to DM102 are each compared.
When all three match, output relay R500 turns ON.
When DM0 and DM100 match, output relay R501 turns ON.
When DM1 and DM101 match, output relay R502 turns ON.
When DM2 and DM102 match, output relay R503 turns ON.
(Mnemonics list)
CR2002 BCMP
DM0 DM100 MR000 LD CR2002
BCMP DM0 DM100 MR000 #3
#3 LD CR2010
OUT R500
CR2010 R500 LD MR000
OUT R501
LD MR001
OUT R502
LD MR002
MR000 R501 OUT R503

MR001 R502

MR002 R503

5-48 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-49


BCMPICompares specified BIN
data with BIN data in a
specified range

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


BCMPI

BCMPI(.U)
BCMPI
BCMPI.S
BCMPI BCMPI.D
BCMPI.L
Compare Compares specified BIN
block value data with BIN data in a
@BCMPI(.U) data specified range.
BCMPI
@BCMPI.S
@BCMPI
EXTENDED INSTRUCTIONS

@BCMPI.D
@BCMPI.L

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

5 n

Operand Explanation Occupied size


Data Processing Instructions

.U .S 16 bits x n
S1 Specifies the start of the data block to compare.
.D .L 32 bits x n
.U .S 16 bits
S2 Specifies the value to compare.
.D .L 32 bits
D Specifies the start to store the comparison result.* 1 n bits
n Specifies the number of data to compare. 16 bits

*1 When bit data is specified, n continuous bits are occupied. When word data is specified, the
LSB of continuous n words becomes the result storage location. Bits other than LSB do not
change.

5-50 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Description of Operation
BCMPI(.U) When the execution condition is ON, n unsigned 16-bit BIN data starting from S1
and the unsigned 16-bit BIN data stored in are compared, and the result is stored

EXTENDED INSTRUCTIONS
S2
to the bit data starting from D .
bit
15
bit
0
When Result
S1 1234 D ON

S1 +1 5678 D +1 OFF
bit bit
15 0

S1 +2 0 D +2 OFF
n S2 1234


( n )word
S1 + n −2 1234 D + n −2 ON
S1 + n −1 7890 D + n −1 OFF
CR2010 : OFF
5
BCMPI.S When the execution condition is ON, n signed 16-bit BIN data starting from S1

Data Processing Instructions


and the signed 16-bit BIN data stored in S2 are compared, and the result is stored to
the bit data starting from D .
bit
15
bit
0
When Result
S1 −1234 D ON

S1 +1 −5678 D +1 OFF
bit bit
15 0

S1 +2 0 D +2 OFF
n S2 −1234

( n )word …
S1 + n −2 −1234 D + n −2 ON
S1 + n −1 7890 D + n −1 OFF
CR2010 : OFF

BCMPI.D When the execution condition is ON, n unsigned 32-bit BIN data starting from S1
and the unsigned 32-bit BIN data stored in [ S2 / S2 +1] are compared, and the result
is stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When Result
S1 +1 12345678 S1 D ON

S1 +3 56780123 S1 +2 D +1 OFF
bit bit bit bit
31 16 15 0

S1 +5 10002000 S1 +4 D +2 OFF
n S2 +1 12345678 S2

(2 n word)
S1 +2( n −2)+1 12345678 S1 +2( n −2) D + n −2 ON
S1 +2( n −1)+1 78903456 S1 +2( n −1) D + n −1 OFF
CR2010 : OFF

BCMPI.L When the execution condition is ON, n signed 32-bit BIN data starting from S1
and the signed 32-bit BIN data stored in [ S2 / S2 +1] are compared, and the result is
stored to the bit data starting from D .
bit
31
bit bit
16 15
bit
0
When Result
S1 +1 −12345678 S1 D ON

S1 +3 −56780123 S1 +2 D +1 OFF
bit bit bit bit
31 16 15 0

S1 +5 10002000 S1 +4 D +2 OFF
n S2 +1 −12345678 S2

(2 n word)
S1 +2( n −2)+1 45670123 S1 +2( n −2) D + n −2 OFF
S1 +2( n −1)+1 78903456 S1 +2( n −1) D + n −1 OFF
CR2010 : OFF

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-51


Data Processing Instructions

@BCMPI.□ This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag
EXTENDED INSTRUCTIONS

CR2009 No change in state


CR2010 ON when all data matched. Otherwise, OFF
CR2011 No change in state
ON in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When n =0
• When one or more of S1 , S2 and D exceeds the device / work area range
CR2012 because of the n specification
• When an access outside the operand range occurs
When n is a constant, and indirect specification or index modification has not been specified

5 to S1 , S2 and D
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


Data Processing Instructions

KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-52 - KV-8000/7000/5000/3000/1000 Series/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

5
CR2010 R500 LD MR000
OUT R501
LD MR001
OUT R502

Data Processing Instructions


LD MR002
MR000 R501 OUT R503

MR001 R502

MR002 R503

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-53


BBCMPContinuous
data comparison bit

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


BBCMP

BBCMP BBCMP
Continuous bit Compares 2 continuous bit
data comparison data.
@BBCMP BBCMP

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition BBCMP


S1 S2 n D B B C M P S1 S2 n D

Execution condition BBCMP


S1 S2 n D @ B B C M P S1 S2 n D

Operand Explanation Occupied size


S1 Specifies the start of the bit data to compare. 1 bit × n
S2 Specifies the start of the bit data to compare. 1 bit × n
n Specifies the number of data to compare. 32 bits

5
D Specifies the start of the storage location for comparison results.*1 1 bit

*1 When word data is specified in D , only the LSB is updated.


Data Processing Instructions

Point The BBCMP instruction can be used only with KV-8000 with CPU function version
2.0 or later.

Description of Operation
BBCMP When the execution condition is ON, the content of n bits starting from S1 is
compared with the content of n bits starting from S2 . If all bits of n match,
D is turned ON.
Even if only one bit is different, D is turned OFF.

n bits

+0 +1 +2 … + n -2 + n -1
D turns ON as all bit
S1 ON OFF OFF … ON OFF data matches.
S2 ON OFF OFF … ON OFF

S1 ON OFF OFF … ON OFF Since the start + 2 bits


do not match,
S2 ON OFF ON … ON OFF
D is turned OFF.
@BBCMP 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 in the following cases. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
• When n =0
• When one or more of S1 , S2 and D exceeds the device / work area range
CR2012 because of the n specification
• When an access outside the operand range occurs
When n is a constant, and indirect specification or index modification has not been specified
for S1 , S2 and D
"Out-of-range access of operands", page 1-50
5-54 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Data Processing Instructions

Sample Program
The contents of two structure type variables Axis1 and Axis2 are compared. If all members match,
MR100 is turned ON; otherwise MR101 is turned OFF (Axis1 and Axis2 are the same structure type

EXTENDED INSTRUCTIONS
variable).
(Mnemonics list)
R000 BSIZE
↑ Axis1 SizeOfBit_A LDP MR000
BSIZE Axis1 SizeOfBit_A
MPS
BSIZE BSIZE Axis2 SizeOfBit_B
Axis2 SizeOfBit_B MPP
AND= SizeOfBit_A SizeOfBit_B
BBCMP Axis1 Axis2 SizeOfBit_A CmpResult
SizeOfBit_A BBCMP MPS
= Axis1 Axis2 SizeOfBit_A CmpResult AND CmpResult

5
SizeOfBit_B OUT MR100
MPP
CmpResult MR100 ANB CmpResult
OUT MR101

Data Processing Instructions


CmpResult MR101

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-55


RNDRandom
occur number

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


RND

RND
RND
D Random
number Generate a random number.

@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

Operand Explanation Occupied size


D Specifies the storage location for the generated random number. 16 bits

Description of Operation
5 RND When the execution condition is ON, a random number is generated from the value stored
Data Processing Instructions

in D , and the result is stored in 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 or index modification range is inappropriate, or an access
outside the operand range occurs. Otherwise, OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked
"Out-of-range access of operands", page 1-50

* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-56 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Sample Program
Random numbers occur at the rising edge of Input Relay R000. When Input Relay R001 is ON, the
random number is initialized.

EXTENDED INSTRUCTIONS
(Mnemonics list)
R000 RND
↑ DM0 LDP R000
RND DM0
Random number generation Random number LD R001
MOV #0 DM0
R001 ΜΟV
#0 DM0
Reset Random number

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-57


SORTBinary data sort

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


SORT

SORT(.U)
SORT.S
SORT SORT.D
SORT.L
SORT

Binary The data in a specified


@ SORT(.U) data sort range is sorted.
@ SORT.S
@SORT
EXTENDED INSTRUCTIONS

SORT
@ 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

5 Operand
S
Explanation
Specifies the sort parameter.*1
Occupied size
16 bits
.U .S 16 bits x
Data Processing Instructions


D Specifies the start of the data table to be sorted.
.D .L 32 bits x n
n Specifies the data to be sorted. (1 to 65535) 16 bits

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

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5000/3000 CPU Function Version", page 4

5-58 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Description of Operation
SORT(.U)/SORT.S
When the execution condition is ON, 16-bit BIN data from are sorted

EXTENDED INSTRUCTIONS
n D
according to the parameter specified with S .

Example When S =0
After SORT instruction execution
Before SORT instruction execution (sorted in ascending order)
bit bit bit bit
15 0 15 0

D 123 3 D
D +1 15 15 D +1
D +2 84 21 D +2
3
1398
84
123
5

Data Processing Instructions


653 653
D + n -1 21 1398 D + n -1

SORT.D/SORT.L
When the execution condition is ON, n 32-bit BIN data from D are sorted
according to the parameter specified with S .

After SORT
Example When S =1 instruction execution
Before SORT (sorted in
bit bit bit bit
31 instruction execution 0 31 descending order) 0

D ・ D +1 12345 6665321 D ・ D +1
D +2・ D +3 2165 619987 D +2・ D +3
D +4・ D +5 8004 78261 D +4・ D +5

31 12345
619987 8004
6665321 2165
D +2(n-1)・ D +2(n-1)+1 78261 31 D +2(n-1)・ D +2(n-1)+1

@SORT.□ This instruction is executed for one scan at the rising edge of the execution condition.

Point The SORT instruction sorts all data when the instruction is execution. Therefore, if
a large value is specified in n , the scan time may increase significantly.
If the effect onto the scan time needs to be adjusted, divide the data to be sorted
into several scans using the SORTN instruction.
"SORTN Instruction", page 5-62

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-59


Data 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 n =0
• When the specified range is inappropriate
CR2012 • When the indirect specification and index modify range is inappropriate
• When a timer/counter is specified in D by indirect specification
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.

5 KV-8000/7500/7300/5500/5000/3000

KV Nano Series
When CR2012 is ON, error details are stored in CM5150 to CM5176.
When CR2012 is ON, error details are stored in CM2250 to CM2276.
Data Processing Instructions

"CR/CM List", page A-43

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-60 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Data Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-61


SORTNBinary
partition sort data

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


SORTN

SORTN(.U)
SORTN.S Binary data
SORTN SORTN The data in a specified
SORTN.D partition
range is sorted.
SORTN.L sort

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition SORTN


S D1 n D2 S O R T N S D1 n D2

Operand Explanation Occupied size


S Specifies the sort parameter.*1 16 bits x2
.U .S 16 bits x n
D1 Specifies the start of the data table to be sorted.
.D .L 32 bits x n
n Specifies the data to be sorted. (1 to 65535) 16 bits
D2 Specifies the bit data to notify the operation completion.*2 1 bit

5 Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Data Processing Instructions

Series base units.


"KV-5000/3000 CPU Function Version", page 4

*1 The parameter is specified with the following method.

Devices Content
S Sorting method Specifies the sorting method with the LSB of S .
Number of Specifies the number of comparisons to be made in one
S +1 comparison scan.
times If 0 is specified, the comparison is executed as 1.

bit bit
15 S 0

The sorting method is specified with the ON/OFF


status of the LSB.
Reserved for system (recognized as 0)

S is ON: Sorts in descending order.


S is OFF: Sorts in ascending order.

*2 When bit data is specified, 1 continuous bit is occupied. When word data is specified, the LSB is
used as the notification bit data. Bits other than LSB do not change.

5-62 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Description of Operation
SORTN(.U)/SORTN.S
When the execution condition is ON, 16-bit BIN data from are sorted

EXTENDED INSTRUCTIONS
n D1
according to the parameter specified with S . When sorting is completed, an end
notification is written in D2 .
When the execution conditions turn OFF, the SORTN instruction operation stops even if
sorting is in progress. The end notification is not written to D2 at this time.

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
D1 +1
123
15
1
3
D1
D1 +1
5
84 15

Data Processing Instructions


D1 +2 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
A comparison is made three
D1 +7 1 512 D1 +7 times within one scan, and
D1 +8 6219 914 D1 +8 the data is sorted across
multiple scans.
D1 +9 7003 1398 D1 +9 When sorting is completed,
D1 +10 512 6219 D1 +10 D2 =ON is written.
D1 +11 88 7003 D1 +11

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-63


Data Processing Instructions

SORTN.D/SORTN.L
When the execution condition is ON, n 32-bit BIN data from D are sorted
according to the parameter specified with S . When sorting is completed, an end
notification is written in D2 .
EXTENDED INSTRUCTIONS

When the execution conditions turn OFF, the SORTN instruction operation stops even if
sorting is in progress. The end notification is not written to D2 at this time.

Scan

ON
SORTN execution
condition OFF

5
SORTN instruction execution execution

ON
Data Processing Instructions

D2 :
Completion OFF
notice relay

Point • If executing sort with multiple scans, the SORTN instruction will be canceled
when the execution conditions turn OFF. In this case, even if the execution
conditions are turned ON again, sorting will start from be beginning.
• When starting the next sort in succession after one sorting process, turn the
execution conditions OFF once before turning them ON again.
• Do not change the values of the data table being sorted, S , S +1 or
D1 during the sorting process. Sorting may not finish even when the
completion notification relay D2 turns ON.

Operation flag

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 n =0
• When the specified range is inappropriate
CR2012 • When the indirect specification and index modify range is inappropriate
• When a timer/counter is specified in D by indirect specification
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-64 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Data Processing Instructions

Sample Program
When the internal relay MR000 is ON, the unsigned 16-bit binary data in data memory DM0 to DM999
(1000 words) is sorted in ascending order. 20 comparisons are made in one scan.

EXTENDED INSTRUCTIONS
#0 #20 MR100 (Mnemonics list)
MR000 MR200
DW DW LDP MR000
DM2000 DM2001 OR MR100
MR100 ANB MR200
DW #0 DM2000
CON
DW #20 DM2001
CON
MR100 SORTN OUT MR100
DM2000 DM0 #1000 MR200 LD MR100
SORTN DM2000 DM0 #1000 MR200

When the input relay R000 turns ON, the signed 32-bit binary data in data memory DM0 to DM1999 5
(number of data items: 1000 = 2000 words) is sorted in descending order. 100 comparisons are made

Data Processing Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-65


Table Processing
Instructions
FIFOWFIFO data write

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


FIFOW

FIFOW(.U)
FIFOW FIFOW.D
FIFOW

Write Stores data to FIFO data


@FIFOW(.U) FIFO table.
@FIFOW
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

Operand Explanation Occupied size


.U 16 bits
S Specifies the data to write into the data block.
.D 32 bits

5 D Specifies the start of the data table.*2


.U 16 bits × (N + 2)*1
.D 32 bits × (N + 2)*1
Table Processing Instructions

*1 N is D +1 (Maximum number of stored data).


*2 Becomes the same device as the start device S of the data table of the corresponding
FIFOR instruction.

Description of Operation

About data table and data block


The FIFOW and FIFOR instructions perform FIFO (First In First Out) process using a set of data called
a "data table." The figure below shows the structure of a data table.
bit bit
15 0

Number of data : data that write to data block.


D n
Max. number of storage number : Max number that data block can store
D +1 max
(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) stored in D . Also, set the
maximum number of data items to " D +1".
As the start D of the data table, specify the same target as the start S of the data table of the
corresponding FIFOR instruction.

5-66 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

FIFOW(.U) When the execution condition is ON, 16-bit binary data specified by S is stored to the
end of the data block.
• The data is stored to D +(n+2).
• n is incremented by 1 (+1) after storage.

EXTENDED INSTRUCTIONS
bit bit bit bit
15 0 15 0

n D n+1 D
max : D +1 max : D +1
A : D +2 A : D +2

n B : D +3 n+1 B : D +3


bit
15
S bit
0
C : D +(n+1) C : D +(n+1)

D Blank : D +(n+2) D : D +(n+2)

Blank : D +(n+3) Blank : D +(n+3)


5
FIFOW.D When the execution condition is ON, 32-bit binary data specified by [ S / S +1] is

Table Processing Instructions


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 : D +(2n+4)

D +(2n+7) : Blank : 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 :

D +(2n+3) : C : D +(2n+2)

D +(2n+5) : D : D +(2n+4)

D +(2n+7) : Blank : D +(2n+6)

@FIFOW.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-67


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
• When the maximum number of stored data is such that the data table exceeds the device /
CR2012
work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions

"CR/CM List", page A-43

Sample Program
See the sample program for the FIFOR instruction.
"Sample Program", page 5-72

5-68 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Table Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-69


FIFORFIFO data read

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


FIFOR

FIFOR(.U)
FIFOR FIFOR.D
FIFOR

Read
Reads data from FIFO
(First In First Out) data
@FIFOR(.U) FIFO
table.
@FIFOR
FIFOR
@FIFOR.D
EXTENDED INSTRUCTIONS

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

Operand Explanation Occupied size


.U 16 bits × (N + 2)*1
D1 Specifies the start of the data table.
.D 32 bits × (N + 2)*1

5 D2
Specifies the storage location for the data read from the data .U 16 bits
block. .D 32 bits
Table Processing Instructions

*1 N is D1 +1 (Maximum number of stored data).

Description of Operation

About data table and data block


The FIFOW and FIFOR instructions perform FIFO (First In First Out) process using a set of data called
a "data table." The figure below shows the structure of a data table.
bit bit
15 0

D1 n Number of data:data that write to data block


Max. number of storage data:Max number that data block can store (designate by user)。
D1 +1 max
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 start D1 of the data table, specify the same target as the start D2 of the data table of the
corresponding FIFOR instruction.

5-70 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

FIFOR(.U) (1)When the execution condition is ON, the 16-bit binary data stored in D1 +2 is stored
to D2 .
(2) The contents of the data block after the data is stored are shifted up.
 n is decremented by one (-1) after the data is shifted.

EXTENDED INSTRUCTIONS
bit bit bit bit
15 0 15 0

D1 n D1 n-1

D1 +1 max bit
15
D2 bit
0
D1 +1 max bit
15
D2 bit
0

D1 +2 A D1 +2 B A

D1 +3 B D1 +3 C


D1 +4 C
: D1 +n E

D1 +n 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 binary data stored in [ D1 +4/
D1 +5] is stored to [ D2 / D2 +1].
5

Table Processing Instructions


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) The contents of the data block after the data is stored are shifted up.
n is decremented by one (-1) after the data is shifted.
bit bit
31 0

D1 +1 : n-1 : D1

D1 +3 max : D1 +2 bit
31
D2 +1 D2 bit
0

D1 +5 : B : D1 +4 A

D1 +7 : C : D1 +6

D1 +(2n+1) : E : D1 +(2n)

D1 +(2n+3) : Blank (0) : D1 +(2n+2)

Filled with 0

@FIFOR.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-71


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
• When the maximum number of stored data is such that the data table exceeds the device /
CR2012
work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions

"CR/CM List", page A-43

Sample Program
Detection Discharging
technics technics

Sensor for Sensor for Discharge output


defective discharging R500
judgment confirm
R001 R002 Input relay R000 : Timing input
Input relay R001 : Defective
judgment input
ON->OK
OFF-> defective products
Input relay R002 : Discharge confirm input
Timing sensor Output relay R500 : Discharge output
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 work pieces are fed from the inspection point to the discharge point, error is output
fromR501.

5-72 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

(Mnemonics list)
CR2008 #0 #10
DW DW LD CR2008
DM100 DM101 DW #0 DM100
CON
R000 R001 $0 DM0 FIFOW
DW #10 DM101
↑ LDA STA DM0 DM100

EXTENDED INSTRUCTIONS
LDP R000
MPS
R001 $1111 DM0 FIFOW AND R001
LDA STA DM0 DM100 LDA $0
CON
STA DM0
R000 CR2012 R501 CON
↑ SET FIFOW DM0 DM100
MPP
R002 FIFOR ANB R001
↑ DM100 DM1 LDA $1111
CON
DM1 #100 STA DM0
= SHOT CON
$1111 FIFOW DM0 DM100
5
R500
LDP R000
AND CR2012
SET R501
LDP R002

Table Processing Instructions


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 $1111:Defective products
DM103 :
products: $1111
:

bit bit DM105 : Single pulse


15 0
timer output R500
DM0 FIFOW DM106 :

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-73


LIFOWLIFO data write

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


LIFOW

LIFOW(.U)
LIFOW LIFOW.D
LIFOW

Write
Stores the data to LIFO
(Last In First Out) data
@LIFOW(.U) LIFO
table.
@LIFOW
LIFOW
@LIFOW.D
EXTENDED INSTRUCTIONS

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

Operand Explanation Occupied size


.U 16 bits
S Specifies the data to write into the data block.
.D 32 bits

5 D Specifies the start of the data table.* 2


.U 16 bits × (N + 2)*1
.D 32 bits × (N + 2)*1
Table Processing Instructions

*1 N is D +1 (Maximum number of stored data).


*2 Becomes the same device as the start device S of the data table of the corresponding
FIFOR instruction.

Description of Operation

About data table and data block


The LIFOW and LIFOR instructions perform LIFO Last In First Out) process using a set of data called a
"data table." The figure below shows the structure of a data table.
bit bit
15 0

Number of data : data that write to data block.


D n
Max. number of storage number : Max number that data block can store (designate by user).
D +1 max
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) stored in D . Also, set the
maximum number of data items to " D +1".
As the start D of the data table, specify the same target as the start S of the data table of the
corresponding FIFOR instruction.

5-74 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

LIFOW(.U) When the execution condition is ON, 16-bit binary data specified by S is stored to the
end of the data block.
• The data is stored to D +(n+2).
• n is incremented by 1 (+1) after storage.

EXTENDED INSTRUCTIONS
bit bit bit bit
15 0 15 0

n D n+1 D
max : D +1 max : D +1
A : D +2 A : D +2

n B : D +3 n+1 B : D +3


bit
15
S bit
0
C : D +(n+1) C : D +(n+1)

D Blank : D +(n+2) D : D +(n+2)

Blank : D +(n+3) Blank : D +(n+3)


5
LIFOW.D When the execution condition is ON, 32-bit binary data specified by [ S / S +1] is

Table Processing Instructions


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 : D +(2n+4)

D +(2n+7) : Blank : 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 :

D +(2n+3) : C : D +(2n+2)

D +(2n+5) : D : D +(2n+4)

D +(2n+7) : Blank : D +(2n+6)

@LIFOW.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-75


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
• When the maximum number of stored data is such that the data table exceeds the device /
CR2012
work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions

Sample Program
See the sample program for the LIFOR instruction.
"Sample Program", page 5-80

5-76 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Table Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-77


LIFORLIFOdata read

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


LIFOR

LIFOR(.U)
LIFOR LIFOR.D
LIFOR

Read
Reads data from LIFO
(Last In First Out) data
@LIFOR(.U) LIFO table.
@LIFOR
LIFOR
@LIFOR.D
EXTENDED INSTRUCTIONS

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

Operand Explanation Occupied size


.U 16 bits × (N + 2)*1
D1 Specifies the start of the data table.
.D 32 bits × (N + 2)*1

5 D2
Specifies the storage location for the data read from the data .U 16 bits
block. .D 32 bits
Table Processing Instructions

*1 N is D1 +1 (Maximum number of stored data).

Description of Operation
About data table and data block
The LIFOW and LIFOR instructions perform LIFO (Last In First Out) process using a set of data called
a "data table." The figure below shows the structure of a data table.
bit bit
15 0

Number of data : data that write to data block


D1 n
Max. number of storage number :
D1 +1 max
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 start D1 of the data table, specify the same target as the start D2 of the data table of the
corresponding LIFOW instruction.

5-78 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

LIFOR(.U) (1)When the execution condition is ON, the 16-bit binary data stored in D1 +n+1 is
stored to D2 .
(2)After the data is stored, n is decremented by one (-1).
bit bit bit bit

EXTENDED INSTRUCTIONS
15 0 15 0

D1 n D1 n-1

D1 +1 max D1 +1 max

D1 +2 A D1 +2 A

D1 +3 B D1 +3 B


:

D1 +n C bit
15
D2 bit
0
D1 +n C bit
15
D2 bit
0

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 binary data stored in [ D1 +(2n+2)/
D1 +(2n+3)] is stored to [ D2 / D2 +1].
5

Table Processing Instructions


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)After the data is stored, n is decremented by one (-1).


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.□ This instruction is executed for one scan at the rising edge of the execution condition.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-79


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
• When the maximum number of stored data is such that the data table exceeds the device /
CR2012
work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Table Processing Instructions

"CR/CM List", page A-43

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-80 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Table Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Table Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-81


FWRITOverwrites the data
block of the data table

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


FWRIT

FWRIT(.U)
FWRIT FWRIT.D
FWRIT

Overwrite Overwrites the data


@FWRIT(.U) data table block of the data table.
@FWRIT
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

Operand Explanation Occupied size


.U 16 bits
S Specifies the value to overwrite the data block.
.D 32 bits

5 D Specifies the start of the data table.


.U 16 bits × (N + 2)*1
.D 32 bits × (N + 2)*1
Specifies the position of the data block to be overwritten. 16 bits
Table Processing Instructions

*1 N is D +1 (Maximum number of stored data).

Description of Operation
FWRIT(.U) When the execution condition is ON, the 16-bit binary data specified by S is
overwritten to the n th data block in the data table for the 16-bit binary data specified
by D .
bit
15
S bit
0
bit
15
bit
0
bit
15
bit
0

E Number of data N : D N : D
Max number of storage data max : D +1 max : D +1
1 st A : D +2 A : D +2
Data table

2 nd B : D +3 B : D +3

Data block
(store data) n th C E

N th D : D +N+1 D : D +N+1

FWRIT.D When the execution condition is ON, the 32-bit binary data specified by [ S / S +1]
is overwritten to the n th data block in the data table for the 32-bit binary data
specified by D .
bit
31
S +1 S bit
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 +4 D +5 A D +4
Data table

2 nd D +7 B D +6 D +7 B D +6
(store data)
Data block

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.□ This instruction is executed for one scan at the rising edge of the execution condition.

5-82 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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 the value of n is "0" or greater than number of data (N)
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data exceeds the device / work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Table Processing Instructions


"CR/CM List", page A-43

Sample Program
When input relay R000 is turned ON, the data of data memory DM0 is overwritten to the second data
block in the FIFO/LIFO data table.

(Mnemonics list)
R000 FWRIT
DM0 DM100 #2 LD R000
FWRIT DM0 DM100 #2

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-83


FINSInserts data in a data
block

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


FINS

FINS(.U)
FINS FINS.D
FINS

Insert Inserts data in a data


@FINS(.U) data table block.
@FINS
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

Operand Explanation Occupied size


.U 16 bits
S Specifies the value to insert in the data block.
.D 32 bits

5 D Specifies the start of the data table.


.U 16 bits × (N + 2)*1
.D 32 bits × (N + 2)*1
Specifies the position of the data block to insert in. 16 bits
Table Processing Instructions

*1 N is D +1 (Maximum number of stored data).

Description of Operation
FINS(.U) When the execution condition is ON, the 16-bit binary data specified by S is inserted
between the n th and ( n +1)th data blocks in the data table specified by D .
bit
15
S bit
0
bit
15
bit
0
bit
15
bit
0

E Number of data N : D N+1 : D


Max. number of storage data max : D +1 max : D +1
1 st A : D +2 A : D +2
Data table

2 nd B : D +3 B : D +3

Data block
(store data) n th C C

E

N th D : D +N+1

D : D +(N+1)+1

FINS.D When the execution condition is ON, the 32-bit binary data specified by [ S / S +1]
is inserted between the n th and ( n +1)th data blocks in the data table specified
by D .
bit
31
S +1 S bit
0

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 +4 D +5 A D +4
Data table

2 nd D +7 B D +6 D +7 B D +6
(store data)
Data block

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.□ This instruction is executed for one scan at the rising edge of the execution condition.

5-84 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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 the value of n is greater than number of data (N)
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data exceeds the device / work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

5
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Table Processing Instructions


"CR/CM List", page A-43

Sample Program
When input relay R000 is turned ON, the data of data memory DM0 is inserted between the second
and third data blocks in the FIFO/LIFO data table.

(Mnemonics list)
R000 FINS
DM0 DM100 #2 LD R000
FINS DM0 DM100 #2

bit bit bit bit


15 0 15 0

Number of data 3 :DM100 4 :DM100


Max number of storage number 4 :DM101 4 :DM10
1 st 134 :DM102 134 :DM102

DM0 2 nd 4578 :DM103 4578 :DM103

9862 3 rd 36841 :DM104 9862 :DM104

36841 :DM105

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-85


FDELDelete data from a
data block

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


FDEL

FDEL(.U)
FDEL FDEL.D
FDEL
Delete
Deletes a data block from
from data
@FDEL(.U) the data table.
table
@FDEL
FDEL
@FDEL.D
EXTENDED INSTRUCTIONS

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

Operand Explanation Occupied size


.U 16 bits × (N + 2)*1
D Specifies the start of the data table.
.D 32 bits × (N + 2)*1

5 n Specifies the position of the data block to delete. 16 bits

*1 N is D +1 (Maximum number of stored data).


Table Processing Instructions

Description of Operation
FDEL(.U) When the execution condition is ON, the n th data block in the data table for 16-bit
binary data specified by D is deleted.
bit bit bit bit
15 0 15 0

Number of data N : D N−1 : D


Max. number of storage data max : D +1 max : D +1
1 st A : D +2 A : D +2
Data table

2 nd B : D +3 B : D +3

Data block
(store data) n th C D : D +N

0 : D +N+1
N th D : D +N+1 Filled with 0.

FDEL.D When the execution condition is ON, the n th data block in the data table for 32-bit
binary data specified by [ D / D +1] is deleted.
bit bit bit bit
31 0 31 0

Number of data D +1 N D D +1 N−1 D


Max. number of storage dat D +3 max D +2 D +3 max D +2
1 st D +5 A D +4 D +5 A D +4
Data table

2 nd D +7 B D +6 D +7 B D +6
(store data)
Data block

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.□ This instruction is executed for one scan at the rising edge of the execution condition.

5-86 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


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 the value of n is "0" or greater than number of data (N)
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
CR2012
• When the maximum number of stored data exceeds the device / work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

5
* The contact turns OFF when CR2012 is ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

Table Processing Instructions


"CR/CM List", page A-43

Sample Program
When input relay R000 is ON, the second data block in the FIFO/LIFO data table is deleted.
(Mnemonics list)
R000 FDEL
DM100 #2 LD R000
FDEL DM100 #2

bit bit bit bit


15 0 15 0

Number of data 3 :DM100 2 :DM100


Max. number of 4 :DM101 4 :DM101
storage data
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-87


Clock Processing
Instructions
WTIMEWrites the time
data to the calendar
timer

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


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

Operand Explanation Occupied size


S Specifies the start to store the time data. 16 bits x2

Description of Operation
5 WTIME When the execution condition is ON, the time data 7 words (112 bits) starting from S
is written to the calendar timer.
Clock Processing Instructions

The calendar timer's time data is stored to control memories CM700 to CM706.
The following shows the format of the time data.
bit bit
15 0

S 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 This instruction is executed for one scan at the rising edge of the execution condition.

Point • The time data cannot be written directly to control memories CM700 to CM706. If
time data is written directly, the time will be overwritten by the system, and
written values will be invalidated.
• When the WTIME instruction is used, specify the time data in the correct format
(year/month/day/hour/minute/second).
The day of the week is not checked for the year, month, day, hour, minutes, and
seconds settings.
• The WTIME instruction cannot be used with KV-N14 □□ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate.

5-88 - KV-8000/7000/5000/3000/1000 Series/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
When the data to be written is inappropriate as time data, a timer / counter is specified indirectly
to S , the indirect specification or index modification range is inappropriate, and an access
CR2012
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

5
"CR/CM List", page A-43

Sample Program

Clock Processing Instructions


At the rising edge of input relay R000, the time data currently stored in 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-89


SECConverts date/time
format data to second
format data
RSECConverts second format

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano data to date/time format


data

SEC,RSEC

SEC
SEC
Date time →
Converts date/time format
Seconds
data to second format data.
@SEC
SEC conversion

RSEC RSEC
Converts second format
EXTENDED INSTRUCTIONS

Seconds → Date/
data to date/time format
time conversion
@RSEC RSEC data.

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


S D R S E C S D
Clock Processing Instructions

Execution condition RSEC


S D @ R S E C S D

Operation Explanation Occupied size


Specifies the start of the stored data (SEC: date/time data / RSEC: SEC: 16 bits×6
S
second data). RSEC: 32 bits
Specifies the start of the stored data (SEC: second data / RSEC: SEC: 32 bits
D
date/time data). RSEC: 16 bits×6

Description of Operation
SEC When the execution condition is ON, the six words (96 bits) of date/time data starting from
S is converted to seconds, and is stored to the two words (unsigned 32-bit BIN data)
starting from D .
Data is converted referenced to "year 2000, January 1st, 0:0:0.

bit
15
bit
0
bit
31
D +1 bit bit
16 15
D bit
0

S 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-90 - KV-8000/7000/5000/3000/1000 Series/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 S is converted to date/time data, and is stored to the six words (96
bits) starting from D .
Data is converted referenced to "year 2000, January 1st, 0:0:0.

EXTENDED INSTRUCTIONS
bit
31
S +1 bit bit
16 15
S bit
0
bit
15
bit
0

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 This instruction is executed for one scan at the rising edge of the execution condition.

Operation flag 5

Clock Processing Instructions


CR2009 No change in state
CR2010 No change in state
CR2011 No change in state
ON when one of the following conditions is established. Otherwise, OFF.
• When the data to be converted is inappropriate (SEC: date/time data / RSEC: second data)
• When the continuous 2 words or 6 words specified by S and D are out of range
CR2012 • When a timer/counter is specified in S and D by indirect specification
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
Output the expiry date from the date of production. Let's assume that the expiry date is 30
days(2592000 seconds) from the date of production.
The result is stored to DM100 and subsequent memories.

CR2002
(Mnemonics list)
SEC
CM700 DM0 LD CR2002
SEC CM700 DM0
DM0 #2592000 DM10 MPS
LDA.D ADD.D STA.D LDA.D DM0
CON
RSEC ADD.D #2592000
DM10 DM100 CON
STA.D DM10
MPP
bit
15
bit
0
RSEC DM10 DM100
CM700 : 10 10 DM100 : 11 11
CM701 : 12 12 DM101 : 01 01

CM702 : 20 20 DM102 : 19 19

CM703 : 10 10 After 30 days DM103 : 10 10

CM704 : 10 10 DM104 : 10 10

CM705 : 10 10 DM105 : 10 10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-91


AJST
Adjusts the calendar timer by
±30 seconds.

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


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

Description of Operation
AJST When the execution condition is ON, the "seconds" setting is set to "0" when the

5
"seconds"setting of the current time of the built-in calendar time is 0 to 29. When the
"seconds"setting is 30 to 59 seconds, the "minutes" setting is rounded up and is set to "0".
The calendar timer's time data is stored to control memories CM700 to CM706.
Clock Processing Instructions

@AJST This instruction is executed for one scan at the rising edge of the execution condition.

Point The AJST instruction cannot be used with KV-N14 □ □ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate.

Operation flag

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.
(Mnemonics list)
R000
AJST LDP R000
AJST

Before executing After executing


12:59:15 →12:59:00
12:59:30 →13:00:00

5-92 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Clock Processing Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Clock Processing Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-93


Weekly Contact Instructions
LDWK
Turns ON in the specified day
of week / hour / minute /

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano second range


LDWKB
Turns OFF in the specified day
of week / hour / minute /
LDWK,ANDWK,ORWK,LDWKB,ANDWKB,ORWKB second range
ANDWK
Turns ON in the specified day
of week / hour / minute /

LDWK
second range
ANDWKB
Turns OFF in the specified day
of week / hour / minute /

Load week
second range
ORWK
WK Turns ON in the specified day
of week / hour / minute /
second range
ORWKB
Turns OFF in the specified day

Turns ON in the specified day


of week / hour / minute /

ANDWK
second range

WK AND week of week / hour / minute /


second range.
ORWK WK
OR week
EXTENDED INSTRUCTIONS

LDWKB WK Load week bar


Turns OFF in the specified day
ANDWKB WK AND week bar of week / hour / minute /
second range.
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
Weekly Contact Instructions

S1 WK A N D W K S1 S2

S2 WK A N D W K B S1 S2

WK O R W K S1 S2
S1
When WK, installation WK WK O R W K B S1 S2
fill Filled with
S2   When WKB, installation WK

Operand Explanation Occupied size


S1 Specifies the data of day of week/hour/minute/second to start at. 32 bits
S2 Specifies the data of day of week/hour/minute/second to end at. 32 bits

Description of Operation
LDWK ANDWK ORWK
The instruction itself becomes a normally open contact. This contact turns ON from the
day of week/hour/minute/second specified by [ S1 / S1 +1] until the day of week/
hour/minute/second specified by [ S2 / S2 +1].

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/
hour/minute/second specified by [ S2 / S2 +1].

Point The above instructions cannot be used with KV-N14 □ □ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate. The contact operates as OFF.

5-94 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Weekly Contact Instructions

Week contact instruction constant entry


The method to enter a constant into S1 and S2 is as follows. # cannot be used.

EXTENDED INSTRUCTIONS
Enter character string Enter HEX
“Week/HH: MM: SS" $ (HH) (MM) (SS) (Week)
(Chinese) Sunday to Saturday
Input Form at

Day
of (Numeral) 0 to 6 (Numeral) $0 to $6
week (English) sun to sat

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

5
Weekday and time is separated with "/".
Note $
Hour/minute/second is separated with ":".

When entering Monday 08: 30: 15 When entering Monday 08: 30: 15

Weekly Contact Instructions


“MON / 08 : 30 : 15 " $81E0F01
Example
" 1 / 08: 30 :15 " *When HEX is used, weekday value is the last to be
entered, which should be paid heightened attention.
" mon / 08: 30 :15 "

■Format of S1 and S2
The day of the week and time can be set according to the following format.
Operand 1 S1 +1 S1
Operand 2 S2 +1 S2
Data configuration bit31 to bit24 bit23 to bit16 bit15 to bit8 bit7 to bit0
Content Hour Minute Second Day of week
0 to 59 (Second), 0 (Sunday) to 6
Setting 0 to 23 (Hour), FF*2 0 to 59 (Minute), FF*2
FF*2 (Saturday), FF*2
range*1 (24 or more invalid) (60 or more invalid)
(60 or more invalid) (7 or more invalid)

*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 「FF specification for day of week/hours/minutes/seconds」

Example WK
“FRI/17:15:00”

Friday Sunday Monday Tuesday Wednesday Thursday


17:15:00
24:00:00
End

17:15:00

08:30:00

Monday 00:00:00
08:30:00
Start Contact ON
Contact turns on between
Monday 08:30:00 to Friday 17:15:00.
The contact turns ON when the time data, hours/minutes/seconds/day of week (CM703 to
CM706) currently stored in the calendar timer is [ S1 / S1 +1] ≦ time data currently
stored in the calendar timer ≦ [ S2 / S2 +1].
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-95
Weekly Contact Instructions

■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
EXTENDED INSTRUCTIONS

ON.
[ S1 / S1 +1]=[ S2 / S2 +1] Only the start day of the week time turns ON.
[ S1 / S1 +1]>[ S2 / S2 +1] From the start day of the week time until the end day of the week
time turns ON across two weeks.

Example 1. Start: Monday 08:30:00 End: Wednesday 07:30:00 ON between Monday 08:30:00 and Wednesday 07:30:00.
Example 2. Start: Sunday 10:00:00 End: Sunday 10:00:00 ON at Sunday 10:00:00 only (for approx. 1 second)
Example 3. Start: Saturday 08:15:00 End: Monday 08:30:00 ON between Saturday 08:15:00 to Monday 08:30:00

■FF specification for day of week/hours/minutes/seconds

5 FF can be used in a special meaning when the day of the week, hours, minutes, and seconds are
specified.
Weekly Contact Instructions

1. The item (day of week/hours/minutes/seconds) value can be omitted.

Example ON between Monday 11pm to Thursday 5pm MON/23:FF:FF to THU/17:FF:FF

( = MON/23:00:00 to THU/17:59:59)

ON between Monday and Friday MON/FF:FF:FF to FRI/FF:FF:FF

( = MON/00:00:00 to FRI/23:59:59)
The start hour/minute/second specified by FF is regarded as 00:00:00 as the
minimum time, and as 23:59:59 as the maximum time.

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/1


ON every hour between 10 to 15 minutes FF/FF:10:00 to FF/F

■Types of FF specification
Only the following six FF types can be specified.

S1 S2 Explanation
FF/□:□:□ FF/□:□:□ Specifies the day of the week by FF.
FF/FF:□:□ FF/FF:□:□ Specifies the day of the week and hour by FF.
FF/FF:FF:□ FF/FF:FF:□ Specifies the day of the week, hour and minute by FF.
□/□:□:FF □/□:□:FF Specifies seconds by FF.
□/□:FF:FF □/□:FF:FF Specifies minutes and seconds by FF.
□/FF:FF:FF □/FF:FF:FF Specifies hour, minute and seconds by FF.

* Specify the same FF type to S1 and S2 .

5-96 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Weekly 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 week/hours/minutes/seconds setting specified by S1 and S2 is
incorrect, the indirect specification or index modification range is inappropriate, and an access
CR2012
outside the operand range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The contact turns OFF when CR2012 is ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

5
"CR/CM List", page A-43

Sample Program

Weekly Contact Instructions


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 for
start data memory DM101/DM100 ($81E/$1) and end data memory DM103/DM102 ($110F/$5).
DM100 R500 (Mnemonics list)
WK LDWK DM100 DM102
DM102 OUT R500

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-97


Calendar Contact Instructions
LDCALTurns ON in the
specified year / month / day
range

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano LDCALBTurns OFF in


specified year / month / day
range
the

ANDCALTurns ON in the
LDCAL,ANDCAL,ORCAL,LDCALB,ANDCALB,ORCALB specified year / month / day
range
ANDCALBTurns OFF in the
specified year / month / day

LDCAL
range
ORCALTurns ON in the
specified year / month / day
range

Load calendar
ORCALBTurns OFF in the
specified year / month / day
CAL range

ANDCAL CAL AND calendar Turns ON in the specified


year / month / day range.

ORCAL CAL
OR calendar
EXTENDED INSTRUCTIONS

LDCALB CAL Load calendar bar

ANDCALB CAL AND calendar bar Turns OFF in the specified


year / month / day range.

ORCALB CAL
AND calendar bar

Ladder program Input mode

CAL S1 S2

5
S1 L D C A L

S2 CAL L D C A L B S1 S2
Calendar Contact Instructions

S1 CAL A N D C A L S1 S2

S2 CAL A N D C A L B S1 S2

CAL O R C A L S1 S2
S1
 When CAL, installation CAL CAL O R C A L B S1 S2
fill Filled with
S2 When CALb, installation CAL

Operand Explanation Occupied size


S1 Specifies the data of year/month/day to start at. 32 bits
S2 Specifies the year/month/day to end at. 32 bits

Description of Operation
LDCAL ANDCAL ORCAL
The instruction itself becomes a normally open contact. This contact turns ON from the
year/month/day specified by [ S1 / S1 +1] until the year/month/day specified by
[ S2 / S2 +1].
LDCALB ANDCALB ORCALB
The instruction itself becomes a normally closed contact. This contact turns OFF from the
year/month/day specified by [ S1 / S1 +1] until the year/month/day specified by
[ S2 / S2 +1].

Point The above instructions cannot be used with KV-N14 □ □ . During KV STUDIO
conversion, a warning is displayed. During ladder program execution, the
instruction does not operate. The contact operates as OFF.

5-98 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Calendar Contact Instructions

Calendar contact instruction constant entry


The method to enter a constant into S1 and S2 is as follows. # cannot be used.

EXTENDED INSTRUCTIONS
Enter character string Enter HEX
"YY / MM / DD " $ (YY) (MM) (DD)
Input Format

Year (Numeral) 00 to 99 (Numeral) $0 to $63


Month (Numeral) 1 to 12 (Numeral) $1 to $C
Day (Numeral) 1 to 31 (Numeral) $1 to $1F
Enter year/month/day into " ".
Note Year/month/day is separated with "/". Enter a HEX representing year/month/day behind "$".

When entering Oct 16, 2004 When entering Oct 16, 2004
Example
" 04 / 10 / 16 " $40A10

■Format of S1 and S2 5

Calendar Contact Instructions


The year, month and day can be set according to the following format.

Operand 1 S1 +1 S1
Operand 2 S2 +1 S2
Data
bit31 to bit24 bit23 to bit16 bit15 to bit8 bit7 to bit0
configuration
Content Reserved Year Month Day
00 to 99 (year), FF
Setting 01 to 12 (month), FF 01 to 31 (day), FF
- (Enter 00H) (100 or more invalid*1
range*2 (13 or more invalid) (32 or more invalid)
)

*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 for year/month/day」

Example "08/02/16"
CAL
"12/10/28"

Year 2012
October 28 2007 2008 2009 2010 2011 2012 2013
End

October 28

February 16

Year 2008
February 16
Start Contact ON
Contact turns ON during February 16, 2008 and October 2
The contact turns ON when the calendar data, year/month/day (CM700 to CM702)
currently stored in the calendar timer is
[ S1 / S1 +1] ≦ calendar data currently stored in the calendar timer ≦
[ S2 / S2 +1].

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-99


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/

5 day. The program will not function correctly.

■FF specification for year/month/day


Calendar Contact Instructions

FF can be used in a special meaning when the year, month, and day are specified.
1. The item (year/month/day) value can be omitted.

Example
ON during 2012 January to 2014 February 12/01/FF to 14/02/FF
(=12/01/01 to 14/02/29)
ON during 2012 12/ FF/FF to 12/FF/FF
(=12/01/01 to 12/12/31)
ON until 2012, February 16 FF/FF/FF to 12/02/16
(=00/01/01 to 12/02/16)
ON from 2010, March 14 and onwards 10/03/14 to FF/FF/FF
(=10/03/14 to 99/12/31)

* 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∼FF/FF/20


May 3 to May 5 every year FF/05/03∼FF/05/05
December 31 to January 3 every year FF/12/31∼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-100 - KV-8000/7000/5000/3000/1000 Series/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 year/month/day setting specified by S1 and S2 is incorrect, the indirect
specification or index modification range is inappropriate, and an access outside the operand
CR2012
range occurs; Otherwise OFF.
"Out-of-range access of operands", page 1-50

* The contact turns OFF when CR2012 is ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.

5
"CR/CM List", page A-43

Sample Program

Calendar Contact Instructions


Output relay R500 is continuously turned ON during 2004, December 31 to 2005, January 3.

"10/12/31" R500 (Mnemonics list)


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.

"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 during 2010, December 31 to 2011, January 3 when start
data memory DM101/DM100 ($A/$C1F) and end data memory DM103/M102 ($B/$103).

DM100 R500 (Mnemonics list)


CAL LDCAL DM100 DM102
DM102 OUT R500

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-101


Alarm Instruction
ARESResets the currently
operating alarm relay and
alarm history

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


ARES

ARES
Resets the currently operating alarm relay
ARES Alarm reset
and alarm history.

Ladder program Input mode


Execution condition
ARES A R E S
EXTENDED INSTRUCTIONS

Description of Operation
Resets the currently operating alarm relay and alarm history. (CR3300 to CR3415)
For details on alarm relay and alarm history specification, refer to User's Manual of the CPU unit used.

Operation flag

CR2009 No change in state


5 CR2010 No change in state
CR2011 No change in state
Alarm Instruction

CR2012 No change in state

5-102 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Alarm Instruction

MEMO

EXTENDED INSTRUCTIONS
5

Alarm Instruction

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-103


High-speed Processing
Instruction
HSPSet input time constant
to 10µs

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


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

Operand Explanation Occupied size


D Specifies the No. of the relay for reducing the input time constant.*1 1 bit

*1 The devices that can be specified differ depending on the unit.


KV-5500/5000/3000/1000: R000 to R015
KV-N14□□: R000 to R007
KV-N24□□: R000 to R013
KV-N40□□/KV-N60□□: R000 to R107
5 KV-NC32T: R000 to R015
High-speed Processing Instruction

Description of Operation
When the execution condition is ON, the input time constant of D is set to 10μs.
Be sure to set this instruction when using the INT and CTH instructions.

Point • When an input time constant setting using control relay CR2305 and an input time
constant using the HSP instruction are programmed together, the HSP instruction is
given priority.
• When the HSP instruction execution condition is OFF, the input time constant is
specified by CR2305.
• If a relay that the HSP instruction cannot use is specified, no error occurs and the
instruction is not executed.
(In the situation above, the KV Nano Series and KV STUDIO will not generate a
conversion error)

• For details on how to change the input time constant of the CPU unit, refer to "KV-5500/5000/
3000 Series User's Manual" "2-7 Input and Output", "KV-1000 User's Manual" "10-3 Input Time
Constant Switching Function" or "KV Nano Series User's Manual" "4-10 Input and Output".
• The input time constant of the Expansion Input Unit is set using the KV STUDIO's Unit Editor. For
details on how to change the input time constant, refer to "KV STUDIO User's Manual" "Chapter
3 UNIT EDITOR".

Operation flag
The operation flag does not change.

Sample Program
The input time constant of input relay R000 is set to 10μs.
(Mnemonics list)
CR2002 HSP
R000 LD CR2002
HSP R000

5-104 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


High-speed Processing Instruction

MEMO

EXTENDED INSTRUCTIONS
5

High-speed Processing Instruction

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-105


DIDisable interrupt
EIEnable interrupt

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


DI,EI

DI
Disable
DI Disables execution of interrupt programs.
interrupt

EI
Enable
EI Enables execution of interrupt programs.
interrupt

Ladder program Input mo


EXTENDED INSTRUCTIONS

Execution condition
EI E I

Execution condition
DI D I

Description of Operation
DI When the execution condition is ON, execution of the interrupt program is disabled.

5
This instruction is used to temporarily disable interrupt.

EI When the execution condition is ON, execution of the interrupt program is enabled.
High-speed Processing Instruction

The interrupt program disabled by the DI instruction is enabled.

• Only KV-8000/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 DIinstruction
(interrupts are disabled).
When the EI instruction is executed, interrupts stored to memory are executed.
• KV-8000/7500/7300/5500/5000/3000 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. Toper
form 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-116

5-106 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


High-speed Processing Instruction

Operation flag
The operation flag does not change.

EXTENDED INSTRUCTIONS
Sample Program
When input relay R000 is ON, execution of the interrupt program is disabled.
When input relay R000 is OFF, execution of the interrupt program is enabled.
(Mnemonics list)
R000
DI LD R000
DI
R000 LDB R000
EI
EI

High-speed Processing Instruction

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-107


DIC
Interrupt disabled range
setting

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


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

Operand Explanation Occupied size


D Specifies the bit data to output interrupt enabled/disabled state. 1 bit

Description of Operation

5 DIC This instruction is used in combination with the EI instruction.


When the execution condition is ON, execution of interrupt processing is disabledbetween
High-speed Processing Instruction

the DIC instruction and EI instruction.


The interrupt enabled/disabled state before execution of the DIC instruction is output to
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 process process
process process Interrupt forbidden range

Input Interrupt program


process

5-108 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


High-speed Processing Instruction

Operation flag

CR2009 No change in state


CR2010 No change in state

EXTENDED INSTRUCTIONS
CR2011 No change in state
ON when the indirect specification or index modification range is inappropriate, or an access
outside the operand range occurs; Otherwise OFF.
CR2012 It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43 5

High-speed Processing Instruction


Sample Program
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 ① LD CR2002
DIC R1000
CR2002 DM0 DM10 DM100 LD CR2002
② LDA DM0
LDA ADD STA
CON
ADD DM10
R1000 CON
EI ③ STA DM100
LD R1000
EI

(1) Interrupt process disabled


(2) DM0+DM10→DM100
(3) Interrupt process enabled

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-109


INTInterrupt execution
RETIInterrupt end
INT/RETI

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


INT,RETI

The interrupt program is executed up to


INT
INT Interrupt
RETI at the rising edge or falling edge of
execution
the operand.

RETI
RETI Indicates the end of the interrupt
Interrupt end
program.
EXTENDED INSTRUCTIONS

KV-8000 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


High-speed Processing Instruction

INT
S I N T S
( I S )

Interrupt program

RETI
R E T I
( I R E T )

Operand Explanation Occupied size


n1 *1 Specifies the unit number (0 to 48). ー
n2 *1 Specifies the unit interrupt factor number (0 to 31). ー
*2*3 Specifies the bit used for interruption. 1 bit
S

*1 Only constants and variables / labels set as constants can be specified.


*2 Constants can be specified.
*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-110 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


High-speed Processing Instruction

Description of Operation
INT Specifies the start of the interrupt program.
RETI Specifies the end of the interrupt program.

EXTENDED INSTRUCTIONS
Point • Internal registers, index registers, operation flags, R000 to R015*, TM0 to TM3 are
automatically purged at the start of the interrupt program, and each of these purged
values are restored when execution of the interrupt program ends.
* R000 to R015 are not purged for the KV-8000/7000 Series.
• KV-8000/7500/7300/5500/5000/3000 The index register is saved / restored only by default
after Z11. You can set Z1 to Z10 to Save/Enter processing by clicking "CPU system
settings" → "Fixed period execution module and user interrupt setting".
• KV-1000 All the index registers (Z1 to Z12) are subject to Save/Enter processing. To use
an index register used in master program also in the interrupt program, please copy the 5
index register to other data using ZPUSH/ZPOP or MOV instruction.

High-speed Processing Instruction


• For the conditions below, there are no interrupt conditions specified by the INT
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-8000/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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-111


High-speed Processing Instruction

Sample Program

KV-8000/7500/7300
EXTENDED INSTRUCTIONS

When using KV-8000/7500/7300, interrupt is executed at both the rising edge and falling edge of the
unit number 1 input (IN005), and the DM10 value is counted up.
(Mnemonics list)
CR2002 LD CR2002
EI EI
Constant ON
LD CR2008
CR2008 IEDGE KV-SIR32XT Detection
IEDGE #1 #5 #3
Unit No. Input No.
#1 #5 conditions #3 END
ON 1 scan INT #1 #5
KV-SIR32XT
at start of
operation END LD CR2002
INC DM10
RETI

5 INT
Unit No.
#1
KV-SIR32XT
Interrupt factor

R34005
#5
ENDH

DM10
High-speed Processing Instruction

CR2002
INC
constant ON

RETI

ENDH

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

When R000 is input, interrupt is executed and R500 turns ON.


(Mnemonics list)
CR2002 LD CR2002
EI EI
END END
INT R000
INT LD CR2002
R000 SET R500
CR2002 R500 RETI
SET ENDH
RETI

ENDH

5-112 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


High-speed Processing Instruction

MEMO

EXTENDED INSTRUCTIONS
5

High-speed Processing Instruction

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-113


IEDGE
KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano S
IEDGE

IEDGE IEDGE Input t

interrupt s
Sets detection conditions used for d
detection
interrupt.
@IEDGE
e
IEDGE
conditions t
write e
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

Operation Explanation Occupied size


n1 Specifies the unit number (0 to 48).*1 16 bits
n2 Specifies the input number or the start to store it. (0 to 31)*2 16 bits
Specifies the detection condition or the start to store it. (0 to 3)*2 16 bits
5
S

*1 Only constants can be specified for KV-7500/7300 with CPU function version lower than 2.1.
*2 When specifying bit data, specify the start of the channel.
High-speed Processing Instruction

5-114 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


High-speed Processing Instruction

Description of Operation
IEDGE When the execution condition is ON, 1 word of data specified in S is set as the
interrupt detection condition of the n2 factor of the n1 unit.

EXTENDED INSTRUCTIONS
The detection conditions are as follows according to the value of S .

S Detection condition
0 to 1 Rising edge
2 Falling edge
3 Both rising and falling
edges

Point • When 4 to 65535 is specified in S , no calculation error occurs, but the detection
conditions will not be changed.
• When this instruction is complete, the above detection condition setting is changed.
5

High-speed Processing Instruction


@IEDGE 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 in the following cases. Otherwise, OFF.
• When the indirect specifying or index modification range is inappropriate
• When the unit number specified with n1 is 49 or more
• When the input number specified with n2 is 32 or more
CR2012
• When a continuous 16-bit area cannot be secured from S
• When the unit specified by the unit number in n1 is not KV-SIR32XT
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300 When CR2012 is ON, error details are stored in CM5150 to CM5176.

Sample Program
Refer to the "INT instruction" (Page 5-110)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-115


High-speed Processing Instruction

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 shorter
EXTENDED INSTRUCTIONS

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.
For the interrupt processing, refer to "Interrupt processing" in the User's Manual of the CPU unit used.

5 Input process
High-speed Processing Instruction

Input process
Occur for
Scan time

interrupt condition
Operate Operation
program interrupt
program

Return the next


instruction of interrupt

Output process

5-116 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


High-speed Processing Instruction

MEMO

EXTENDED INSTRUCTIONS
5

High-speed Processing Instruction

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-117


PID Control Instructions
PIDPID Control

KV-8000 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 PID
EXTENDED INSTRUCTIONS

PAUSE P I D D1 D2
MANUAL Input D1
MANUAL
RES Input D2
RES

Operand Explanation Occupied size


D1 Specifies the start to store the data block for PID operation.*1 16 bits x2
D2 Specifies the start to store the flag relay for PID operation.*2 1 bit x2

*1 Only word data can be specified.

5 *2 Only bit devices can be specified.


PID Control Instructions

Description of Operation
• The manipulated variable (MV) (PID operation by KP: proportional constant, KI: integral constant, and
KD: differential constant) is calculated from the deviation between the setting value (SV) and the
measured value (PV) read by the specified sampling cycle (TS).

• The target object to measured by the calculated manipulated variable (MV) is manipulated, and the
measured value (PV) is read at the next cycle (TS). This operation is repeated, and the manipulated
variable (MV) is controlled until the measured value (PV) = setting value (SV).
• The work area is reset by RES input turning ON. PID operation is not performed while RES input is
ON.
Operation is started when the state of the RES input changes from ON to OFF.
• When MANUAL input turns ON, the mode changes to the manual operation mode, and when it turns
OFF, the mode changes to the automatic operation mode.
• While PAUSE input is ON, PID operation is discontinued, and when it turns OFF, PID operation is
resumed.

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-118 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

■PID control diagram

PID control instruction Data list


・Sampling period (Ts)

EXTENDED INSTRUCTIONS
・Proportion constant (K P )
measured ・Integral constant (T I )
value Set value
・Differential constant (T D )
(PV ) (SV )
・Comparison constant 2 Degree of freedom
coefficient (α)
・Integral constant 2 Degree of freedom
PID control instruction coefficient (β)
・Lower limit for operating quantity (M VLL )
・Upper limit for operating quantity (M VHL )
・Limit for operating quantity change amplitude
Manual operating Operating
quantity (ΔM VL )
quantity
(MV MAN ) (MV )
Flag relay

5
࡮Positive operation/negative operation
MANUAL ࡮Selected constant invert timer
࡮2 Coefficient setting for degree of freedom

Switch for Manual/Auto

PID Control Instructions


A/D conversion D/A conversion

Control object
machine
Measured of heater ect Operating
value quantity

Reference • The operation method used in PID control is target value filter 2 degree of freedom PID
method.
Target value filter 2 degree of freedom PID block diagram

Target value filter PD arithmetic

SV 1+αβTI S SVF − EV 1

MV
KP 1+
1+βTI S + TI S −
(D)
KPTDS
1+μTDS
PV

• Operation is as follows by the target value filter 2 degree of freedom PID method.
<simple PID method> <target value filter 2 degree
of freedom PID method>

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-119


PID Control Instructions

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


D1 +0 *1 Sampling cycle TS Cycle in which PID operation is performed
0.01 to 60.00[sec] 1 to 6000
D1 +1 *1 Proportional constant KP Constant of proportional action
0.001 to 50.000 1 to 50000
Constant of integral action 0.1 to 3000.0[sec]
*1 Integral constant
D1 +2 TI 1 to 30000
(3000.1 "sec" or more is processed as "infinity".)

5 D1 +3 *1 Differential constant
Proportional constant
TD Constant of differential action

2 degree of freedom coefficient of the


0.00 to 300.00[sec] 0 to 30000

D1 +4 *1 2 degree of freedom Ș proportional constant 0 to 100


PID Control Instructions

coefficient 0.00 to 1.00 (default: 0.4)


Integral constant 2 degree of freedom coefficient of the integral
D1 +5 *1 2 degree of freedom ș constant 100 to 199
coefficient 1.00 to 1.99 (default: 1.35)
Lower limit value of manipulated variable Must
Manipulated variable
D1 +6 *1 M VLL be a value smaller than the manipulated variable −32768 to 32766
lower limit value upper limit value (MVHL).
Upper limit value of manipulated variable Must
Manipulated variable
D1 +7 *1 M VHL be a value smaller than the manipulated variable −32767 to 32767
upper limit value lower limit value (MVLL ).
Manipulated variable Restriction value of change width between manipulated variable
D1 +8 *1 change width ǼM VL this time and one cycle before the manipulated variable (MV ) 1 to 65535
Restriction value or manual mode manipulated variable (MVMAN).

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
D1 +12 Manipulated variable MV Result of PID operation −32768 to 32767
Manual mode Manually sets the manipulate variable. (Enabled
D1 +13 *2 manipulated variable M VMAN only when "MANUAL input" is ON.) −32768 to 32767

D1 +14

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-120 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

Parameter Item Content


Forward/reverse ON for forward operation, and OFF for reverse operation.
D2 +0*1 operation
When ON, the parameters (KP, TI, TD, α, β, MVLL, MVHL, ΔMVL) are reflected to the

EXTENDED INSTRUCTIONS
Constant reflection operation formula at each operation. When OFF, they are reflected in the operation
D2 +1*1
timing selection formula only at the falling edge of RES input.
This setting is valid at all times, and can be switched during operation.
When ON, the user setting of the 2 degree of freedom coefficient α and β is reflected.
When OFF, the default value is used.
2 degree of freedom
D2 +2*1 • When the constant reflection timing selection is ON, this can be switched at all times.
coefficient setting
• When the constant reflection timing selection is OFF, this is switched at the falling
edge of the RES input.

D2 +3 Reserved (cannot be used by the user)

D2 +4 *2 Operation completed This turns ON for one scan when the operation is executed.

D2 +5*2
Measured value change Turns ON for one scan when there is a change that results in the preset manipulated
amount exceeded variable change limit value (ΔMVL) being exceeded.
5
Operation cycle Turns ON for one scan when the operation cycle exceeds twice the sampling cycle

PID Control Instructions


D2 +6*2
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 operation.

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

①period Default value, execute PID Unprocessed Execute calculation Execute calculation Unprocessed Execute calculation Execute calculation Unprocessed

②period Default value, execute PID Unprocessed Unprocessed Execute calculation Unprocessed Unprocessed Execute calculation Unprocessed

(1) Sampling period(T S )

(2) Sampling period(T S )

Setting value Advantages Disadvantages


The life of contacts is reduced when
When a small sampling cycle ON/OFF operation can be performed finely,
relays with contacts are used for turning
is set reducing the incidence of hunting.
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-121


PID Control Instructions

●Proportional constant (KP) D1 +1


The relationship between the measured value (PV), proportional band (P), manipulated variable upper
limit (MVHL), and manipulated variable lower limit (MVLL) is as follows.
Upper limit for
EXTENDED INSTRUCTIONS

operating quantity
(MVHL)
Proportion
32767
constant
(KP)
Upper limit for (scope)
operating quantity
(MVLL)
−32768

0℃ 95℃ 100℃ 105℃ 200℃


Set value
(PV)

5
Set value(S V )
Value after converted by −2048 +2047
AD converter Proportional
Band (P)
PID Control Instructions

5(%)

When a temperature controller with temperature range of 0 to 200℃ is used and the proportional band
is set to 5% (temperature range 10℃), the temperature range of the proportional band at setting value
100℃ becomes 95℃ to 105℃.
Manipulated variable upper limit value at 95°C (M VHL ) : +32767
Manipulated variable lower limit value at 105°C (M VLL ) : -32768
Value obtained by converting 95°C on an A/D converter : -2048
Value obtained by converting 105°C on an A/D converter : +2047

Assuming the above, the proportional band becomes


[+32767-(-32768)]÷[+2047-(-2048)] ≒16.000
KP =16.000 

Temperature ① (1) Though the deviation between the setting


value (SV) and the measured value (PV)
Deviation becomes small when a large proportional
② constant (KP) is set, hunting increases.
(2) Both deviation and hunting become
Set value medium-size when a medium-size
proportional constant (KP) is set.
(3) Though deviation increase when a small
proportional constant (KP) is set, hunting
③ decreases.

Time

* 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) generated by operation of the proportional constant (KP).
(1) Though startup is quick when a
Temperature ①
small integral constant (TI) is set,
hunting increases.

(2) Both startup and hunting become
medium-size when a medium-size
Set value integral constant (TI) is set.
(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-122 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
PID Control Instructions

●Differential constant (TD) D1 +3


When the measured value (PV) exceeds the setting value (SV) by operation of the proportional constant (KP) and
integral constant (TI), the suppression force can be applied to reduce hunting and increase the response speed.
Therefore, hunting can be reduced even if the proportional constant (KP) is increased or the integral

EXTENDED INSTRUCTIONS
constant (TI) is decreased.
Temperature (1) Though the response to external
① disturbance is fast when a large

② differential constant (TD) is set, hunting
increases.
Set value (2) Both response to external disturbance
and hunting become medium-size when
③ a medium-size differential constant (TD)
② is set.
(3) Though the response to external
Interfere disturbance is slow when a small
differential constant (TD) is set, hunting

5
Time decreases.

* - Decrease the differential constant setting when hunting occurs over a short cycle.

PID Control Instructions


- 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 (to increase the track ability when changing the target
value, but overshoot occurs if the value is too small).
* 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 this value
increases the effect of the target value filter (to suppress overshoot when changing the target value).
* 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 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 manipulated variable upper limit value (MVHL) > manipulated variable lower limit value (MVLL)

●Manipulated variable change limit value (ΔMVL) D1 +8


The change (absolute value) between the manipulated variables of the previous cycle and this cycle is
restricted without exceeding this value.
This value is applied to manipulated variables (MV) calculated by operation and the manual mode
manipulated variable (MVMAN).
When the change 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-123


PID Control Instructions

●Measured value (PV) D1 +11


Sets the measured value (PV) fed back from the target equipment controlled by the manipulated
variable (MV).
EXTENDED INSTRUCTIONS

●Manipulated variable (MV) D1 +12


In the automatic mode, the manipulated variable calculated from the PID operation result is stored; in the
manual mode, the manipulated variable obtained by applying the manipulated variable change limit value
(ΔMVL) to the value set in the manual mode manipulated variable (MV) is stored. (This is to avoid sudden
changes in the manipulated variable regardless of the manual operation / automatic operation mode).
* It is recommended to output this value to the device to be controlled regardless of the automatic
operation / manual operation mode.
* However, the manipulated variable is reset to "0" when RES input is ON. To avoid sudden changes,
make sure that the manipulated variable is "0" in the manual mode before turning RES input ON.

5 ●Manual manipulated variable (MVMAN) D1 +13


PID Control Instructions

This is set by the user in the manual operation mode. (This is required for balance-less and bump-less
switching.)
It can be rewritten only in the manual mode. In the automatic operation mode, the same value as the
manipulated variable (MV) is stored at execution of the operation.

●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 operation  D2 +0
ON for forward operation and OFF for reverse operation. This is reflected in the operation formula only
at the falling edge of RES input.

Reference For example, when controlling temperature, forward operation is a cooling operation which
increases the manipulated variable when the measured value is higher than the setting
value. Reverse operation is a heating operation which increases the manipulated variable
when the measured value is lower than the setting value.

●Reflection timing of constants (KP, TI, TD, α, β, MVLL, MVHL, ΔMVL) D2 +1


When ON, the parameters (KP, TI, TD, α, β, MVLL, MVHL, ΔMVL) are reflected to the operation formula at
each operation.
When OFF, they are 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-124 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
PID Control Instructions

●Manipulated variable change exceeded  D2 +5


Turns ON for one scan when there is a change that results in the preset manipulated variable change
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 signal to start operation after the program is started
up.)
• The PID instruction cannot be written in the initialization execution module and
interrupt program.
• Operations are not performed while the PAUSE input is ON. In this case,
5

PID Control Instructions


operation is resumed when PAUSE input is turned OFF.
• When the integral constant (TI) is 3000.1[sec] or more, the target value filter is
disabled as an exception only in this case as the effect of the target value filter is
excessive (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 data and timer/counter have been specified when D1 is indirectly specified
• When a word data and timer/counter have been specified when D2 is indirectly specified
CR2012 • When the value of the setting data and I/O data specified by D1 exceeds the specifiable
range
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
PID control is performed after one scan at the rising edge of PLC.
(Mnemonics list)
R000 PID
PAUSE LD R000
R001 DM0 LD R001
LD CR2008
MANUAL
PID DM0 R10000
CR2008 R10000
RES

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-125


PIDATPID control with
automatic tuning

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


PIDAT

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

Operand Explanation Occupied size


S Specifies the storage location for the measured value Pv. 16 bits
Specifies the storage location for the parameters (setting value Sv,
D1 16 bits x2
PID constant, operation control flag, etc.).
D2 Specifies the storage location for the manipulated variable Mv. 16 bits

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or later and KV Nano Series base
units.

5 "KV-5000/3000 CPU Function Version", page 4


PID Control Instructions

Description of Operation
The PIDAT instruction is an instruction that adds the AT (automatic tuning) function to the PID operation.

• The manipulated variable (MV) (PID operation by KP: proportional constant, KI: integral constant, and
KD: differential constant) is calculated from the deviation between the setting value (SV) and the
measured value (PV) read by the specified sampling cycle (TS).
• The target object to measured by the Upper limit for
operating quantity
calculated manipulated variable (MV) is ( ) Operating quantity ( Mv)

manipulated, and the measured value (PV) Measuring quantity (Pv )

is read at the next cycle (TS). This Rate of change


for operating
quantity
operation is repeated, and the manipulated (slope of
operating quantity)
variable (MV) is controlled until the
measured value (PV) = setting value (SV). Set value ( )

• The parameters such as the PID


constants are loaded at the rising edge
of the PIDATinstruction execution 0 Time

condition, and the PID operation is Lower limit for


operating quantity
( )
executed using the present manipulated
variable (MV) as the default value.
• When the manual mode flag (bit 1 of D1 +2) turns ON, the manipulated variable (MV) is switched
to manual manipulated variable (MVMAN) without a bump.
• The PID operation is paused when the operation pause 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 variable (MV) to be controlled ON and OFF and observing the
measured value (PV), this function automatically calculates and sets the proper 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 variable (MV)
between the upper limit and lower limit, observes the measured value (PV) and estimates the
characteristics of the control target).

5-126 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

■PIDAT instruction concept diagram

PIDAT instruction
Parameters
・ Manual manipulated value( )

EXTENDED INSTRUCTIONS
・Sampling cycle( )
Measured ・Proportional constant( )
Set value ・Integral constant( )
value
( )
( ) ・Differential constant( )
・Proportional constant 2 degree of freedom coefficient(α)
・Integral constant 2 degree of freedom coefficien(β)
・Differential constant 2 degrees of freedom coefficient(γ)
PID control instruction ・Manipulated variable lower limit value( )
・Manipulated variable upper limit value( )
・Manipulated variable change width restrictionvalue( )
AT result
Manual Operating ・Measured value change width( )
is applied
operating quantity AT parameters
quantity

5
( ) ・AT adjustment parameter( )
( )
・AT hysteresis( )
・AT timeout time
・AT calculation control method

PID Control Instructions


AT control

Manual mode flag


(bit 1 of D1 +2)

OFF

ON

AT start/operating flag
(bit 2 of D1 +2)

A/D D/A
conversion conversion

Control object
machine
Measured of heater ect Operating
value
quantity

Reference The operation method used in PID control is target value filter full 2 degree of freedom PID method.

Setting value
Target value filter after target Proportional + integral element Operating
Set value value filter quantity
1+αβ + +
1
1+
1+β ー +

αγ
Incomplete
Measured differential element
value +

ー 1+μ

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-127


PID Control Instructions

With simple PID control, if overshoot relative to the target value tracking is suppressed, the
stability against disturbance slows down. Conversely, if the stability against disturbance is
sped up, overshoot will occur, and the target value tracking will slow down.
With 2 degree of freedom PID control, both the target value track ability and the
EXTENDED INSTRUCTIONS

disturbance response characteristics can be improved by filtering the target value.


<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 The PIDAT instruction cannot be written in the initialization execution module and
Point
PID Control Instructions

interrupt program.

■List of parameters

Parameter Item Symb Content Setting


ol 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
Manual manipulated Sets the manipulated variable for the manual -32768 to
D1 +1 MVMAN
variable mode. 32767
Operation pause flag (PAUSE)
Bit 0 OFF : Executes operation
ON : Pauses operation
Manual mode flag (MANUAL)
Bit 1 OFF : Automatic mode
ON : Manual mode
AT start/operating flag
OFF→ON: Starts automatic tuning
Bit 2
Operation ON→OFF: Stops automatic tuning
D1 +2 control - ON : Automatic tuning in operation*1 -
flag Bit 3 Reserved (fixed to OFF)
Constant reflection timing selection
Sets the timing to reflect the parameters (KP, TI, TD,
α, β, γ, MVLL, MVHL, ΔMVL, ΔPVL and 2 degree of
Bit 4 freedom coefficient setting) to the operation
formula.
OFF : Only at the rising edge of execution condition
ON : At each operation
Bit 5 to 15 Reserved (fixed to OFF)

*1 The PIDAT instruction automatically turns OFF when automatic tuning is finished.

5-128 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

Parameter Item Symbol Content Setting


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 to OFF.)
Sets whether to change the 2 degree of freedom
Bit 1 coefficient for the proportional constant, differential
constant and integral constant from the default value.
OFF : Use default value
ON : Apply the D1+8 to 10 value
Bit 2, 3 Reserved (fixed to OFF)
Integral/differential constant unit setting 5
Changes the unit for the integral constant and

PID Control Instructions


differential constant.
Bit 4 OFF : Integral constant in 100ms, differential
constant in 10ms
ON : Both integral constant and differential
constant in 1ms
Bump-less changeover setting
(Usually set to OFF.)
Sets whether to rewrite the manual manipulated
Bit 5 variable (MVMAN) and automatic manipulated
variable (MV).
Operation OFF : Rewrite enabled
D1 +3 ― ―
setting ON : Rewrite disabled
Measured value tracking setting
(Usually set to OFF.)
Sets 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 variable change limit alarm setting
OFF : Manipulated variable change limit alarm
Bit 8 disabled
ON : Manipulated variable change limit alarm
enabled
Measured value change alarm setting
Bit 9 OFF : Measured value change alarm disabled
ON : Measured value change alarm enabled
Bit 10 to 11 Reserved (fixed to OFF)
AT calculation control method setting
Sets which control method PID parameters 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-129


PID Control Instructions

Parameter Item Symb Content Setting


ol range
PID operation cycle 1 to
D1 +4 Sampling cycle TS Setting range: 0.001 to 60.000 [sec] (in 1ms) 60000
EXTENDED INSTRUCTIONS

Constant of proportional operation 1 to


D1 +5 Proportional constant*2 KP Setting range: 0.001 to 50.000 50000
Constant of integral operation
The unit changes with the integral/differential
constant unit setting. 0 to
D1 +6 Integral constant*2 TI • When bit 4 of D1 +3 is OFF
Setting range: 0.1 to 3000.0 [sec] (in 100ms) 30001*3
• When bit 4 of D1 +3 is ON
Setting range: 0.001 to 30.000 [sec] (in 1ms)
Constant of differential operation
The unit changes with the integral/differential
constant unit setting. 0 to
5 D1 +7 Differential constant*2 TD • When bit 4 of D1 +3 is OFF
Setting range: 0.00 to 300.00 [sec] (in 10ms)
• When bit 4 of D1 +3 is ON
30000*4

Setting range: 0.000 to 30.000 [sec] (in 1ms)


PID Control Instructions

The value set here is valid when the operation


Proportional constant 2 setting ( D1 +3) "2 degree of freedom coefficient
D1 +8 degree of freedom α setting" (bit 1) turns ON. 0 to 100
coefficient The default value is used when OFF is set.
• Proportional constant 2 degree of freedom
coefficient (α)
Integral constant 2 Setting range: 0.00 to 1.00
D1 +9 degree of freedom β Default value: 0.4 0 to 199
coefficient • Integral constant 2 degree of freedom coefficient
(β)
Setting range: 0.00 to 1.99
Default value: 1.35
Differential constant 2 • Differential constant 2 degree of freedom
D1 +10 degree of freedom γ coefficient (γ) 0 to 200
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 variable.
lower limit value 32766
Manipulated variable -32767 to
D1 +12 MVHL Sets the upper limit of the manipulated variable.
upper limit value 32767
The value set here is valid when the operation setting
( D1 +3) "Manipulated variable change alarm setting" (bit
Manipulated variable 8) turns ON. The value is invalid when the setting is OFF. 1 to
D1 +13 ΔMVL
change limit value Set the limit value of the changes between the manipulated 65535
variable or manual manipulated variable of the previous cycle
and the present manipulated variable.
The value set here is valid when the operation setting
( D1 +3) "Measured value change alarm setting" (bit 9)
turns ON. The value is invalid when the setting is OFF. 1 to
D1 +14 Measured value change ΔPVL
The change between the measured value of the previous 65535
cycle and the present measured value is monitored. The
measured value is not limited.
This parameter determines whether the PID
constant during automatic tuning is adjusted with
"Priority on stability" or "Priority on response". 0*5,
AT adjustment
D1 +15 τ Setting range: 0.01 to 10.00
parameter 1 to 1000
Default value: 1.00
* If the value is increased, priority is placed on stability,
and if decreased, priority is placed on response.

*2 When using automatic tuning, these constants are automatically set after automatic tuning. When
not using automatic tuning, set them manually.
*3 If "0" or a value larger than "30001" is set, the integral operation will be disabled.
*4 If "0" is set, the differential operation will be disabled.
*5 If "0" is set, operation will take place with the default value "1.00".
5-130 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
PID Control Instructions

Parameter Item Symb Content Setting


ol 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, 1 to 3500
increase this value. However, the automatic
tuning accuracy will drop if this value is set too
large.
Set the timeout time for automatic tuning.
0*7,
D1 +17 AT timeout time ― Setting range: 1 to 1440 minutes (24 hours)
1 to 1440
Default value: 1440
Operation completed
Bit 0 ― Turns ON when the operation is executed, and
turns OFF when not executed. 5
Manipulated variable exceeded

PID Control Instructions


Turns ON when the manipulated variable exceeds
Bit 1 ― the set manipulated variable upper/lower limit
range. Turns OFF when the value returns to the
Operatio range.
n status Manipulated variable change exceeded
D1 +18 ―
flag Turns ON if a change exceeding the set
(input) Bit 2 ― manipulated variable change limit value (ΔMVL)
occurs. Turns OFF when the manipulated variable
returns within the limit values.
Measured value change exceeded
Turns ON if a change exceeding the set measured
Bit 3 ―
value change (ΔPVL) occurs. Turns OFF when the
measured value returns within the limit values.
Bit 4 to 15 ― Reserved (cannot be referenced)
This is the monitor value of the setting value (SV)
Setting value after target -32768 to
D1 +19 SVF after the target value filter is passed. PID operation
value filter (input) 32767
is executed using this value as the target value.
D1 +20
to Work area ― This area is used by the instructions for operation. ―
D1 +51
PID operation result
With an integral operation, PID operation is
executed at the rising edge of the execution
-32768
D2 Manipulated variable MV condition using the D2 value as the default
to 32767
value. The operation is executed at the rising edge
of the execution condition using the D2 value
as the manipulated variable 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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-131


PID Control Instructions

Reference The following parameters must be set before PID control.


(Normal operation will take place even if 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)

5
• Manipulated variable lower limit (MVLL) ( D1 +11)
• Manipulated variable upper limit (MVHL) ( D1 +12)
• Manipulated variable (MV) ( D2 )*2
PID Control Instructions

*1 Operation will take place even if other bits are OFF (invalid). If other bits are turned
ON (valid), store the setting value in the corresponding parameter.
*2 PID operation is executed using the manipulated variable (MV) value at the rising
edge of the execution condition as the manipulated variable default value.

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)*2,
AT calculation control method setting (bit 12 to 15)*2
• Sampling cycle (TS) ( D1 +4)
• Manipulated variable lower limit (MVLL) ( D1 +11)
• Manipulated variable upper limit (MVHL) ( D1 +12)
• Manipulated variable (MV) ( D2 )*3
*1 The flag turns ON when automatic tuning starts, and automatically turns OFF when
automatic tuning is completed. Operation will take place even if other bits are OFF.
*2 Operation will take place even if other bits are OFF (invalid). If other bits are turned
ON (valid), store the setting value in the corresponding parameter.
*3 PID operation is executed using the manipulated variable (MV) value at the rising
edge of the execution condition as the manipulated variable default value.

5-132 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

●Parameter reflection timing


The parameters are reflected at the following timing.

Symb
Parameter Item Reflection timing
ol

EXTENDED INSTRUCTIONS
S Measured value PV
D1 +0 Setting value SV
Manual manipulated At each PIDAT instruction operation cycle
D1 +1 MVMAN
variable
D1 +2 Operation control flag ―
Only at the rising edge of PIDAT instruction execution
Bit 0
condition
Differs depending on the constant reflection timing selection
( D1 +2: bit 4) setting.

5
• D1 +2: When bit 4 is
Operatio Bit 1
D1 +3 ― OFF : Only at the rising edge of PIDAT instruction
n setting
execution condition

PID Control Instructions


ON : At each PIDAT instruction operation cycle
Bit 4 to 6 Only at the rising edge of PIDAT instruction execution
Bit 8 to 9 condition
Bit 12 to 15 At start of automatic tuning
Sampling cycle Only at the rising edge of PIDAT instruction execution
D1 +4 TS
condition
D1 +5 Proportional constant KP
D1 +6 Integral constant TI
D1 +7 Differential constant TD
Proportional constant 2
D1 +8 degree of freedom α
coefficient
Integral constant 2
Differs depending on the constant reflection timing selection
D1 +9 degree of freedom β
( D1 +2: bit 4) setting.
coefficient
• D1 +2: When bit 4 is
Differential constant 2
OFF : Only at the rising edge of PIDAT instruction
D1 +10 degree of freedom γ
execution condition
coefficient
ON : At each PIDAT instruction operation cycle
Manipulated variable
D1 +11 MVLL
lower limit value*
Manipulated variable
D1 +12 MVHL
upper limit value*
Manipulated variable
D1 +13 ΔMVL
change limit value
D1 +14 Measured value change ΔPVL
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 variable MV

* The manipulated variable could fluctuate greatly if the manipulated variable lower limit or upper limit
is changed while the execution condition is ON.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-133


PID Control Instructions

■Initialization and instruction execution timing


Scan

ON
Execution conditions
EXTENDED INSTRUCTIONS

OFF

Sampling cycle( )


Details of
①Initialization process ②PID operation execution Automatic tuning execution PID operation execution PID operation execution
PIDAT instruction operation
ON
Operation complete
( D1 +18:0bit)OFF
AT start/operating flag ON ③

D1 +2: 2 bit)OFF ④

(1)The PIDAT instruction executes the initialization process in one scan at the rising edge of the
execution condition.
(2)While the execution condition is ON, PID operation is executed as each sampling cycle (TS) passes.
5 When PID operation is executed, the operation completed flag ( D1 +18: bit 0) turns ON for one scan.
(3)When the AT start/operating flag ( D1 +2: bit 2) turns ON, automatic tuning is executed at the next
PID Control Instructions

sampling cycle.
(4)When automatic tuning is finished, the AT start/operating flag automatically turns OFF.

●Initialization process
The PIDAT instruction executes the initialization process in one scan at the rising edge of the execution
condition.
• The parameters for which the reflection timing is "rising edge of PIDATinstruction execution
condition" are read to the work area ( D1 +20 to D1 +51).
• The value set in manipulated variable ( D2 ) is read in as the manipulated variable default value.

■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 variable 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
( D1 +2:2 bit ) OFF ON by user OFF by PIDAT instruction

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-134 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

●Starting automatic tuning


When the execution condition is ON, if the AT start/operating flag ( D1 +2: bit 2) of the operation
control flag is turned from OFF to ON, automatic turning will start at the next sampling cycle.
* Automatic tuning will be executed even if the AT start/operating flag is ON when the execution

EXTENDED INSTRUCTIONS
condition is turned 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 constants (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 normally, 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 is started.
5

PID Control Instructions


●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 is started.

●Adjusting the automatic tuning result


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,
they will be calculated with priority on response.
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 variable.
If the PIDAT instruction manipulated variable is limited with LIMIT instruction, etc., the PID constants
cannot be calculated accurately.
To correctly calculate the PID constants, change the upper and lower limit values of the manipulated
variable to the values limited with the LIMIT instruction before automatic tuning starts, and return the
values when automatic tuning is finished.
• If the difference between the setting value and measured value is small when starting automatic tuning,
a normal limit cycle may not be generated, and the PID constants may not be calculated accurately.
The PID constants can be calculated more accurately by changing the setting value to increase the
difference between the setting value and measured value before starting.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-135
PID Control Instructions

Data settings

■Measured value (PV) S


EXTENDED INSTRUCTIONS

Sets the measured value observed from the control target equipment.

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

■Manual manipulated variable (MVMAN) +1


5
D1

Sets the manipulated variable for the manual mode. During the manual mode, the manual manipulated
variable (MVMAN) is stored in the manipulated variable (MV) ( D2 ).
PID Control Instructions

■Operation control flag D1 +2


The PIDAT instruction operation is controlled at each sampling cycle by turning the bit position of
D1 +2 ON and OFF.
bit bit bit bit bit
15 4 2 1 0

ReserReserReserReserReserReserReserReserReserReserReser Reser
ved ved ved ved ved ved ved ved ved ved ved ved

(0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0)

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, alarm function) is paused when ON, and resumes
when OFF.

Unlike when the execution condition is OFF, the initialization process is not executed when operation
resumes.
This function can be used to stop the operation when preparing the equipment, or for special control,
etc.

●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 variable change limit value
(ΔMVL) to the manual manipulated variable (MVMAX) ( D1 +1) is stored in the manipulated variable
(MV)( D2 ) instead of the PID operation results.
When changing between the automatic and manual modes, a process takes place so that the
manipulated variable does not change suddenly. (Bump-less switching, measured value tracking)

5-136 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

●AT 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 at the change (falling edge) of ON to OFF.

EXTENDED INSTRUCTIONS
If automatic tuning ends abnormally, the operation flag CR2012 turns ON and the error details (error
code) are stored in CM5157.

"Automatic tuning (AT)", page 5-134

●Constant (KP, TI, TD, α, β, γ, MVLL, MVHL, ΔMVL, ΔPVL) reflection timing selection
D1 +2: Bit 4
When this bit turns ON, the parameters (KP, TI, TD, α, β, γ, MVLL, MVHL, ΔMVL, ΔPVL) are reflected to the
operation formula at each sampling cycle.
5
When this bit is OFF, the parameters are reflected to the operation formula only at the rising edge of the

PID Control Instructions


execution condition.

■Operation setting D1 +3
The operation is set with the ON and OFF status of the bit position of D1 +3.
bit bit bit bit bit bit bit bit bit bit bit
15 14 13 12 9 8 6 5 4 1 0

Reserv Reserv Reserv Reserv Reserv


ed ed ed ed ed

(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

Measured value change width warning set

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 variable when the measured value is higher than the setting
value. Reverse operation is a heating operation which increases the manipulated variable
when the measured value is lower than the setting value.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-137


PID Control Instructions

●2 degree of freedom coefficient (α, β, γ) setting D1 +3: Bit 1


When ON, the setting values (D1+8 to 10) of proportional constant 2 degree of freedom coefficient (α),
integral constant 2 degree of freedom coefficient (β) and differential constant 2 degree of freedom
coefficient (γ) are reflected.
EXTENDED INSTRUCTIONS

When OFF, the default value is reflected.

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 in 100ms, differential constant in 10ms
5 ON : Both integral constant and differential constant in 1ms

Set this to ON if the control target response is fast, and OFF if it is slow.
PID Control Instructions

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 variable from changing suddenly
when switching between automatic and manual. This is accomplished in the automatic mode by
rewriting the manual manipulated variable (MVMAN) with the manipulated variable (MV), and in the
manual mode by rewriting the manipulated variable (MV) with the manual manipulated variable (MVMAN).
When this bit is turned ON, the process to rewrite the manual manipulated variable with the
manipulated variable 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 variable by
reducing the deviation between the setting value and measured value when switching to the automatic
mode. This is accomplished 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.

●Manipulated variable change limit alarm setting D1 +3: Bit 8


"Manipulated variable change limit alarm enabled" when ON, and "Manipulated variable change limit
alarm disabled" when OFF.
When set to ON, the change (absolute value) of the previous cycle and current manipulated variable is
limited so that it is not larger than the value set with manipulated variable change limit value (ΔMVL). If
the change exceeds the setting, manipulated variable change exceeded ( D1 +18: bit 2) turns ON.
This is valid in the automatic and manual modes. The change is not limited during automatic tuning.

5-138 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

●Measured value change alarm setting D1 +3: Bit 9


"Measured value change alarm enabled" when ON, and "Measured value change alarm disabled"
when OFF.
When set to ON, if the change (absolute value) of the previous cycle and current measured value

EXTENDED INSTRUCTIONS
exceeds the value set with measured value change (ΔPVL), the measured value change exceeded
( D1 +18: bit 3) output turns ON.

●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 15 14 13 12
bit pattern. OFF OFF OFF OFF PID control
OFF OFF OFF ON PI control
OFF OFF ON OFF P control 5

PID Control Instructions


■Sampling cycle (TS) D1 +4
The "sampling cycle" (TS) refers to the cycle in which the measured value (PV) for performing PID
operation is loaded.
The relationship between the sampling cycle (TS) and the scan time is as follows.

1 scan 1 scan 1 scan 1 scan 1 scan 1 scan 1 scan

Measured value(PV)

PIDAT instruction
in program
Operation Operation Operation
Operation
①Cycle PIDAT executed  No process     execution
     execution
   No process    
execution
     No process
with default value execution
②Cycle PIDAT executed No process     No process    Operation Operation
   No process   No process       No process
with default value execution execution

①Sampling cycle ( )

②Sampling cycle ( )

Setting value Advantages Disadvantages


The life of contacts is reduced when
When a small sampling cycle ON/OFF operation can be performed finely,
relays with contacts are used for turning
is set reducing the incidence of hunting.
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-139


PID Control Instructions

■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(  )
32767
Proportion constant
( )
(scope)
Upper limit for
operating
quantity(  )
ー32768

0℃ 95℃ 100℃ 105℃ 200℃

5
Set value( )
Set value
( )
Value after converted by AD converter ー2048 +2047
Proportional Band
PID Control Instructions

( )
5(%)

When a temperature controller with temperature range of 0 to 200℃ is used and the proportional band
is set to 5% (temperature range 10℃), the temperature range of the proportional band at setting value
100℃ becomes 95℃ to 105℃.
Manipulated variable lower limit value at 105°C (M VLL ) : -32768
Value obtained by converting 95°C on an A/D converter : -2048
Value obtained by converting 105°C on an A/D converter : +2047
Assuming the above, the proportional band becomes
[+32767−
(−32768)]
÷[+2047−
(−2048)]
≒ 16.000
=16.000 

Temperature (1) Though the deviation between the



setting value (S V ) and the
Deviation measured value (P V ) becomes
② small when a large proportional
constant (K P ) is set, hunting
Set value increases.

(2) Both deviation and hunting become


medium-size when a medium-size
③ proportional constant (K P ) is set.

(3) Though deviation increase when a


Time small proportional constant (K P ) is
set, hunting decreases.

* As deviation is not solved by adjustment of the proportional constant (KP), use the integral constant
(TI) to adjust deviation.

5-140 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

■Integral constant (TI) D1 +6


The integral constant is used to decrease the deviation between the measured value (PV) and the
setting value (SV) generated by operation of the proportional constant (KP).

EXTENDED INSTRUCTIONS
Temperature (1) Though startup is quick when a small integral
① constant (T I ) is set, hunting increases.
② (2) Both startup and hunting become medium-
size when a medium-size integral constant
Set value (T I ) is set.
(3) Though startup is slow when a large integral
constant (T I ) is set, hunting decreases.

Time

* Increase the integral constant setting when hunting occurs over a long cycle.

■Differential constant (TD) D1 +7 5


When the measured value (PV) exceeds the setting value (SV) by operation of the proportional constant (KP) and

PID Control Instructions


integral constant (TI), the suppression force can be applied to reduce hunting and increase the response speed.
Therefore, hunting can be reduced even if the proportional constant (KP) is increased or the integral
constant (TI) is decreased.
Temperature
large differential constant (T D ) is set, hunting increases.


② (2) Both response to external disturbance and hunting become

medium-size when a medium-size differential constant (T D ) is


Set value
set.

③ (3) Though the response to external disturbance is slow when a


② small differential constant (T D ) is set, hunting decreases.

Interfere

Time

※· Decrease the differential constant setting when hunting occurs over a short cycle.
· Set a small differential constant on control systems (e.g. pressure or flow rate) having a fast response
or control systems having vibrating elements.

■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.
• Overshoot can be suppressed by setting a smaller α value and larger β value, but the target value
tracking will slow down.
• 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 to 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
Setting value β is increased

Setting value after target


value filter

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-141


PID Control Instructions

■Differential constant 2 degrees of freedom coefficient (γ) D1 +10


Normally, this is set in the range of 0 to 1/α.
When 0 is set, the measured value differential takes place, and the effect of the differential item is disabled
when the target value is changed. Thus, fluctuations in the manipulated variable can be suppressed.
EXTENDED INSTRUCTIONS

When γ=1/α is set, the deviation differential takes place, and the response when the target value
changes can be improved. However, the fluctuation in the manipulated variable will increase.
* The set value is valid only when the 2 degree of freedom coefficient setting ( D1 +3: bit 1) is ON. If
set to OFF, 1.25 will be applied in the operation formula as the default value.

■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 manipulated variable upper limit value (MVHL) > manipulated variable lower limit value (MVLL)

5 Manipulated variable exceeded ( D1 +18: bit 1) turns ON when the manipulated variable is less than
this value.
This is valid in the automatic and manual modes. ON and OFF is controlled within this value range
PID Control Instructions

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 manipulated variable upper limit value (MVHL) > manipulated variable lower limit value (MVLL)
Manipulated variable exceeded ( D1 +18: bit 1) turns ON when the manipulated variable is more than
this value.
This is valid in the automatic and manual modes. ON and OFF is controlled within this value range
during automatic tuning.

■Manipulated variable change limit value (ΔMVL) D1 +13


The change (absolute value) between the manipulated variables of the previous cycle and this cycle is
restricted without exceeding this value.
This value is applied to manipulated variables (MV) calculated by operation and the manual mode
manipulated variable (MVMAN).
When the change exceeds this value, manipulated variable change exceeded ( D1 +18: bit 2) turns
ON for one scan.
* The set value is valid only when the manipulated variable change limit alarm setting ( D1 +3: bit 8)
is ON.

■Measured value change (ΔPVL) D1 +14


The change (absolute value) of the previous cycle and current measured value is monitored (the
measured value is not limited).
If the change exceeds this value, measured value change exceeded ( D1 +18: bit 3) turns ON.
Even if the measured value change exceeded turns ON, PID operation is executed following the
measured values.
* The set value is valid only when the measured value change alarm setting ( D1 +3: bit 9) is ON.

■AT adjustment parameter (τ) D1 +15


This parameter determines whether the PID constant during automatic tuning is adjusted with "Priority
on stability" or "Priority on response".
If the value is increased, priority is placed on stability, and if decreased, priority is placed on response.
5-142 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
PID Control Instructions

■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. However, the automatic tuning accuracy will drop if this value is set too large.

EXTENDED INSTRUCTIONS
■AT time out time D1 +17
Set this if automatic tuning does not end because the measured value (PV) does not change, etc.
When the time out time elapses, the AT start/operating flag ( D1 +2: bit 2) turns OFF, and the PID
control is started with the PID constants applied before automatic tuning is started.

■Operation status flag (input) D1 +18

5
The operation of the PIDAT instruction is confirmed with the bit position ON and OFF status of
D1 +18.

PID Control Instructions


bit bit bit bit bit
15 3 2 1 0

Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv Reserv
ed ed ed ed ed ed ed ed ed ed ed ed

Operation completed

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 variable exceeded D1 +18: Bit 1


Turns ON when the manipulated variable exceeds the set manipulated variable upper limit value (MVHL)
and lower limit value (MVLL). Turns OFF when the value returns to the range.

●Manipulated variable change exceeded D1 +18: Bit 2


Turns ON if a change exceeding the set manipulated variable change limit value (ΔMVL) occurs. Turns
OFF when the manipulated variable returns within the limit values.

●Measured value change exceeded D1 +18: Bit 3


Turns ON if a change exceeding the set measured value change (ΔPVL) occurs. Turns OFF when the
measured value returns within the limit values.

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

■Work area D1 +20 to D1 +51


(cannot be used)
Do not write a value as this is used by the PIDAT instruction.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-143
PID Control Instructions

■Manipulated variable (MV) D2

The manipulated variable for the control target is stored.


Automatic mode...................... Value calculated with PID operation
Manual mode .......................... Value obtained by applying manipulated variable change limit value
EXTENDED INSTRUCTIONS

(ΔMVL) to manual manipulated variable


Automatic tuning ..................... Output value for ON/OFF control (manipulated variable upper/lower
limit)

PID operation is executed at the rising edge of the execution condition using this value as the
manipulated variable default value.

* This value is used as the manipulated variable default value, so set an appropriate value.
* It is recommended to output this value to the control target regardless of the mode.
* When not using integral operation, add an offset value to this value.
5 Reference • When converting to a pulse output, input this value with the "TPOUT instruction".
"TPOUT instruction", page 4-150
PID Control Instructions

• When limit control is performed for the manipulated variable, use the "LIMIT instruction"
to limit the upper/lower limits of this value.
"LIMIT instruction", page 4-132

Point • If the rising edge cannot be detected in the execution condition (when a constant
ON is used for the execution condition, or a PIDAT instruction is wirtten in FOR
to NEXT and so on), clear the work area to zero once before executing the
instruction. The initialization process will be executed.
• Parameter ( D1 ) cannot be shared by multiple PIDAT instructions.
• Turn the execution condition OFF before adding a PIDAT instruction with write
during RUN. The initialization process will not be executed.
• This function cannot be used in an interrupt program or initialization module.
• When there is no integral (constant (TI) is 0 or 3000.1 (sec) or more), the target
value filter is disabled as an exception only in this case as the effect of the target
value filter is excessive. (Proportional constant 2 degree of freedom coefficient
(α) = 1.)

Operation flag

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
• When the value of the setting data and I/O data specified by D1 exceeds the specifiable
CR2012 range
• When automatic tuning ends abnormally
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, the following error codes (error details) are
stored in CM5157.
KV Nano Series When CR2012 is ON, the following error codes (error details) are stored in CM2257.

5-144 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

●Error codes
Value
Details of error Operation during error Countermeasures
(decimal)
0 Normal operation ― ―

EXTENDED INSTRUCTIONS
24 Operation setting out of range
25 Sampling cycle out of range
26 Proportional constant out of range
27 Integral constant out of range
28 Differential constant out of range
Proportional constant 2 degree of
29
freedom coefficient out of range
Integral constant 2 degree of
30
freedom coefficient out of range
Correct the parameter stored in D1 .
Differential constant 2 degree of
31 PID operation is stopped.
freedom coefficient out of range

32
Manipulated variable upper/lower
limit value out of range
(Out of range or upper limit ≦ lower
5
limit)

PID Control Instructions


Manipulated variable change limit
33
value out of range
Measured value change out of
34
range
Illegal data is written in the work area.
35 AT status transition error Correct the program so that illegal data is not
written in.
The D1 operation control flag value is
36 Operation control flag out of range
out of range. Correct the value.
The operation cycle is more than twice the
37 Operation cycle exceeded sampling cycle (TS). Correct the sampling
cycle setting.
AT adjustment parameter out of The AT adjustment parameter value is out of
38
range range. Correct the value.
The AT hysteresis value is out of range,
39 AT hysteresis out of range 32767≦ (setting value + AT hysteresis), or
(setting value - AT hysteresis) ≦-32768.
Correct the value.
The AT time out time value is out of range.
40 AT time out time out of range
Correct the value.
AT calculation control method The AT calculation control method setting
41
setting out of range value is out of range. Correct the value.
Automatic tuning timed out. Check that the
PID operation continues. manipulated variable is correctly transferred
42 AT time out If automatic tuning is in to the control target and the measured value
progress, it will stop and PID can be observed.
operation will be executed.
The changes in the measured value are
small in respect to the manipulated variable,
and the automatic turning results exceed the
maximum proportional constant, so
43 AT proportional constant exceeded operation is started with proportional
constant = maximum value.
Increase changes in the measured value
such as by increasing the measured value by
several fold.
44 AT integral constant exceeded Automatic tuning is time-consuming and the
integral constant and differential constant in
the automatic tuning results exceed the
maximum value, so PID operation is started
with integral constant = maximum value and
45 AT differential constant exceeded differential constant = maximum value.
Increase the difference in the upper/lower
limits of the manipulated variable, or correct
the AT hysteresis setting.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-145


PID Control Instructions

Sample Program
PID operation is executed using the setting value stored in data memory DM1000 as a target, and PID
control is performed after the pulses are output from the output relay R500 at the obtained manipulated
EXTENDED INSTRUCTIONS

variable. The PID control parameters (proportional constant, integral constant, differential constant) are
automatically tuned and set. A gradual change is obtained by providing an inclination to the setting
value.

PID operation
Settin value (PIDAT instruction)

Inclination setting Output R500


(RAMP instruction)
Control of
heater, etc

5 Pulse output (TPOUT instruction)


PID Control Instructions

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
DM1002 = 0 ’Operation control flag
ON 1 scan DM1003 = 0 ’Operation setting LDP MR000
at start of DM1004 = 1000 ’Sampling cycle DW.S +0 DM1000
operation DM1005 = 1 ’Proportional constant * LD MR000
’DM1006 = ’Integral constant *
’DM1007 = ’Differential constant * RAMP DM2000 #50 #0 DM1000
DM1008 = 0 ’Proportional constant 2 degree of freedom coefficient LD MR000
DM1009 = 0 ’Integral constant 2 degree of freedom coefficient PIDAT DM10100 DM1000 DM999
DM1010 = 0 ’Differential constant 2 degrees of freedom coefficient
DM1011 = 0 ’Manipulated variable lower limit value LD MR000
DM1012 = DM1004 ’Manipulated variable upper limit value TPOUT DM999 DM1012 R500
DM1013 = 0 ’Manipulated variable change width Restriction value LD MR000
DM1014 = 0 ’Measured value change width
DM1015 = 0 ’AT adjustment parameter ANP MR001
DM1016 = 0 ’AT hysteresis SET DM1002.2
DM1017 = 0 ’AT timeout time LD DM1002.2
OUT MR100
LDF DM1002.2
RES MR001

’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-146 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


PID Control Instructions

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

PID Control Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-147


Storage Device Instructions

Storage Device Instructions

Storage Device Instructions Overview


When the storage device instructions are 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

MMKDIR/ MRMDIR

MDEL/MREN
Read
MCOPY/MMOV

Write
MREAD/MREADL Storage device PC
(memory card or (Microsoft Excel etc.)

5
MFREE/MFREEK CPU memory)
KV-8000
KV-7500/7300 MSTAT
KV-5500/5000/3000
Storage Device Instructions

KV-NC32T

■What the storage device instructions can do


●Read and write data (MREAD/MWRIT instructions)
These instructions can read and write the values of devices, variables, labels, etc., and can read and
write 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 in the storage device (memory card or CPU memory)
(MMKDIR/MRMDIR instructions)
These instructions can create folders to use for backups, create folders by date, and delete
unnecessary folders.

●Delete the files in the storage device (memory card or CPU memory) (MDEL
instruction)
This instruction can delete files saved on the storage device (memory card or CPU memory) that are no
longer necessary from a ladder program.

●Rename files in the storage device (memory card or CPU memory) (MREN
instruction)
This instruction can change both the file name and the extension, so you can freely change the
extension to ".txt" and ".log".

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

5-148 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

●Check the free space of storage device (memory card or CPU memory) (MFREE/
MFREEK instructions)
These instructions can check the free space on the storage device (memory card or CPU memory) and

EXTENDED INSTRUCTIONS
generate an alarm in advance when the space has increased. The MFREEK instruction can check the
free space in kilobytes to offer support for large capacity memory cards.

●Check the status of files in storage device (memory card or CPU memory)
(MSTAT instruction)
This instruction can check the status of a file on the storage device (memory card or CPU memory) (Is
the file read-only? What is the file size? When was the last modified time?). By checking the file before
deleting it, this instruction can provide a fail safe device against accidentally deleting the most recent
file.
5
Storage Device Instruction List

Storage Device Instructions


Name Explanation Reference
MWRIT Writes continuous device / variable data to the memory card. 5-156
MREAD Reads continuous data from the storage device. 5-168
MFREE Reads the free space on the storage device. 5-176
MMKDIR Creates a storage device folder. 5-180
MRMDIR Deletes a storage device folder. 5-184
MDEL*1 Deletes a file on the storage device. 5-186
MPRINT*2 Writes only one line to a file on the storage device. 5-188
MREADL*2 Reads only one line of a file on the storage device. 5-192
MCOPY*2 Copies a file on the storage device. 5-198
MMOV*2 Moves a file on the storage device. 5-204
MREN*2 Renames a file on the storage device. 5-210
MFREEK*2 Reads the free space on the storage device in kilobytes. 5-214
MSTAT*2 Gets the status of a file on the storage device. 5-218

*1 This instruction can only be used with the KV-8000/7500/7300/5500/5000/3000 and KV-NC32T.
*2 This instruction can only be used with KV-8000/7000 Series CPU units, KV-5500/5000/3000
Series with CPU function version 2.0 or later and KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4

Reference • Storage device is a generic term for a storage area. For KV-8000/7500/7300 it refers to
memory cards or CPU memory. For KV-5500/5000/3000/1000 and KV Nano Series it
refers to memory cards.
• When KV-8000/7500/7300/5500/5000/3000 is used, there is file register (FRSTM/
FRLDM) instructions other than the storage device instructions as a instruction
statement which reads and writes to the storage device. The read and write format is
fixed with the file register instructions. Therefore, compared with the MWRIT and
MREAD instructions, these instructions may be able to read and write at high speed
when reading and writing a large number of data. (The only data that can be read and
written is FM.)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-149


Storage Device Instructions

List of CPU Units/Base Units That can be Used


KV-5500/5000/3000 KV Nano Series
CPU CPU
EXTENDED INSTRUCTIONS

KV-7500/ function function KV-N14□□


Name KV-8000 KV-1000
7300 version version KV-NC32T KV-N24□□
2.0 or Lower KV-N40□□
higher than 2.0 KV-N60□□
MWRIT ○ ○ ○ ○ ○ ○ -
MREAD ○ ○ ○ ○ ○ ○ -
MFREE ○ ○ ○ ○ ○ ○ -
MMKDIR ○ ○ ○ ○ ○ ○ -
MRMDIR ○ ○ ○ ○ ○ ○ -
MDEL ○ ○ ○ ○ - ○ -
MPRINT
5
○ ○ ○ - - ○ -
MREADL ○ ○ ○ - - ○ -
MCOPY  ○ ○ ○ - - ○ -
Storage Device Instructions

MMOV ○ ○ ○ - - ○ -
MREN ○ ○ ○ - - ○ -
MFREEK ○ ○ ○ - - ○ -
MSTAT ○ ○ ○ - - ○ -

Reference Storage device instructions cannot be used with KV-N14□□/N24□□/N40□□/N60□□.


If storage device instructions are used, when a storage device instruction is executed while
operating, a memory card not inserted error (error code 1) is stored in CM2390, the error
code for storage device instructions.

Storage device instruction usage example

■When saving unsigned binary values and 1-word data line by line
The following file is 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
Data from DM1009
MWRIT instruction settings
Decimal unsigned binary values for DM1000 to DM1009 are written to the storage device with a line
feed code for each word.
Folder: ABC File name: MWRIT 1 word line feed

<Reference ladder program>

5-150 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MR000 [4] = Decimal unsigned binary


#4 (Mnemonics list)
DW
Start writing DM500 LD MR000
Save format DW #4 DM500
[0] = Add mode #0 DW #0 DM501
DW DW $0101 DM502

EXTENDED INSTRUCTIONS
DM501 MWRIT "ABC\MWRIT 1 word line feed" DM1000 #10 DM500 MR001
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

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-151


Storage Device Instructions

■When saving unsigned binary values and 10-word data line by line
The following file is 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 written to the storage device with a line
feed code every 10 words.
Folder: ABC File name: MWRIT line feed

5 <Reference ladder program>


Storage Device Instructions

MR000 [4] = Decimal unsigned binary


#4 (Mnemonics list)
DW
Start writing DM500 LD MR000
Save format DW #4 DM500
[0] = Add mode #0 DW #0 DM501
DW DW $0A01 DM502
DM501 MWRIT "ABC\MWRIT line feed" DM1000 #50 DM500 MR001
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

5-152 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

■When reading unsigned binary values and data with line feed every 10 words
The CSV file data below is read to DM1100 to DM1149.

EXTENDED INSTRUCTIONS
MREAD instruction settings
Folder: ABC File name: MREAD_DATA

<Reference ladder program>

MR100 [4] = Decimal unsigned binary


#4
DW
(Mnemonics list) 5
Start reading DM600 LD MR100

Storage Device Instructions


read format DW #4 DM600
[0] = Standard mode #0 DW #0 DM601
DW MREAD "ABC\MREAD_DATA" DM1100 #50 DM600 MR101
DM601
read mode

MREAD
"ABC¥MREAD_DATA" DM1100 #50
Folder name Read head device Amount of
File name read data

DM600 MR101
read format Reading complete

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-153


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
Code Content Cause How to handle
0 Normal ― ―
Memory card not Either the memory card is not inserted or Insert the memory card, and completely
1
inserted the memory card slot cover is open. close the memory card slot cover.
The file name contains characters that are
2 Abnormal file name Specify the file name correctly.
not allowed.
The specified file or directory does not
3 File does not exist Specify the file name correctly.
exist.

5
The specified file or directory already
4 File already exists Rename the file or directory.
exists.
The file system of the memory card is in
5 File load error Check the file system of the memory card.
Storage Device Instructions

error.
• Remove the write protection from the
• The specified file is write-protected. specified file.
• The memory card is write-protected. • Remove the write protection from the
6 File write error
• The file system of the memory card is in memory card.
error. • Check the file system of the memory
card.
Abnormal file read The specified read/write position indicates
7 Correctly specify the read/write position.
Write position outside of the file range.
The file could not be saved successfully
Not enough space on
8 due to insufficient space on the memory Delete the unnecessary file.
memory card
card.
Data not conforming to the specified format
Either correct the content of the file, or
9 Format error or out-of-range data was saved when the
select the correct format.
file was read.
When accessing the same file, use
Another function is accessing the specified
10 File access competition exclusive control between the storage
file, so the instruction was not executed.
device instruction and other functions.
• New files/folders cannot be created as
4096 files and/or folders are stored in the
CPU memory restricted CPU memory. Confirm the restrictions of the executed
11
error • The file/folder that the device is storage device instruction.
attempting to create exceeds the16th
hierarchy.
The instruction was not executed due to the Confirm the restrictions of the executed
1000 Other errors
file system restriction. storage device instruction.

Point The value stored in CM2390 will be cleared to 0 if closed successfully after the execution
of next storage device instructions.

5-154 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-155


MWRITMemory card write

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


MWRIT

MWRIT

MWRIT
Storage Write data to the memory
write card (CPU memory).

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition MWRIT


S1 S2 n M W R I T S1 S2 n
D1 D2 D1 D2

Operand Explanation Occupied size


Specifies the file ((drive No. +) folder name + file name + end code
8 bits × (number of
S1 NULL: 1 to 247 characters) for saving data or the start of the folder
characters + 1)
name for storing it.*1*2*3
S2 Specifies the start to save.*1 *4

n Specifies the number of data to save. (0 to 65535) 16 bits

5
Specifies the start to store save format-related parameters and the
D1 16 bits x 6
save state of the data.
D2 Specifies the storage location for the notification bit.*5 1 bit × 2
Storage Device Instructions

*1 When specifying bit data, specify the start of the channel.


*2 To specify a text string using constants, enclose with " ". Thecharacters "#" and "$" cannot be used.
1-byte characters:ASCII code (1 byte)
2-byte characters:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 The occupied size is as follows depending on D1 (save format).
• 16bitBIN / 16bitHEX / 16bit unsigned binary / 16bit signed binary
16 bits × n
• 32bitBIN / 32bitHEX / 32bit unsigned binary / 32bit signed binary / floating point type real number
32 bits × n
• ASCII text string
8 bits × n (up to NULL)
*5 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of 2 continuous words is used as notification bit data. Bits other than LSB do not change.

Point • This function 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.

Description of Operation
MWRIT This instruction writes n data (16-bit/32-bit/ASCII text string) starting from S2 to
the memory card (memory card or CPU memory for the KV-8000/7000 Series) according
to the content of parameters ( D1 to D1 +4) under the file name specified by S1
at the rising edge of the execution condition.
The number of actually saved data is written to D1 +5, the completion notification is
written to D2 , and the error notification for an abnormal end is written to D2 +1.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”
5-156 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Storage Device Instructions

Example 16-bit data


bit bit
15 0

S2 12345 Parameter When file S1 .BIN


D1 ∼ D1 +4
S2 +1 23456 3930A05B0787・・・6EB2D5DD

EXTENDED INSTRUCTIONS
S2 +2 34567
Storage
Device

When file S1 .CSV
S2 + n −2 45678
12345, 23456, 34567,・・・, 45678, 56789
S2 + n −1 56789

32-bit data
bit bit bit bit
31 16 15 0

S2 +1 0012345678 S1 Parameter When file S1 .BIN


D1 ∼ D1 +4 4EBC610015CD5B07D2029649・・・
S2 +3 0123456789 S1 +2
・・・3538D08B146A0ACE
S2 +5 1234567890 S1 +4 Storage


Device hen file S1 .CSV
S2 +2 • n −2)+1 2345678901 S2 +2 • n −2)
S2 +2 (• n −1)+1 3456789012 S2 +2 ( n −1)
12345678, 123456789, 1234567890,・・・ ・・
・, 2345678901, 3456789012 5
ASCII text string

Storage Device Instructions


Number of character Number of character

S2 1 A(41H) B(42H) 2 Parameter


D1 ∼ 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 (DDH) 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 for 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 OFF
executing)

* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/retrieval
processing time.

Point If the following storage instructions are executed while CR3214 (Storage instruction
being executed) is OFF, they may not be executed. To execute storage instructions
continuously, check that the completion notification of the previous storage instruction
is ON before executing the next storage instruction.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-157
Storage Device Instructions

Point When the setting of save format D1 has been specified in BIN data, it is stored
as follows:
16-bit data
EXTENDED INSTRUCTIONS

bit bit
15 0

12345 3039H
3930A05B
23456 5BA0H

32-bit data
bit bit bit bit
31 16 15 0

1234567890 499602D2H
D20296493538D08B
2345678901 8BD03835H

5 S1 setting
Specify the name of the file to save data within 1 to 249 characters (including end code NULL(0H) and folder name).
Storage Device Instructions

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)

(Example) DM1 T(54H) A(41H) DM1 C(43H) ¥(5CH)


When DM0 has
DM2 NULL(00H) DM2 D(44H) A(41H)
been specified
DM3 T(54H) A(41H)

DM4 NULL(00H)

Point • File names are automatically appended with an extension according to the save
format setting D1 .
• For KV-8000/7000 series, storage to be saved can be designated by adding "0:\"
or "1:\"in the beginning.

n setting range
Set the number of data to save. The setting range changes according to the setting value of D1 .

D1 setting
0,2,4,6 (16 bits) 1,3,5,7,9 (32 bits) 8(ASCII)
value
Setting range 1 to 65535 1 to 32767 0 to 1999

5-158 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

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
unsigne unsigne signed signed text real
saved BIN BIN HEX HEX
d BIN d BIN BIN BIN string number
Extension
appended .BIN .CSV
to S1
Save
BIN data Comma Separated Value
format
5
Reference When the save format is set to ASCII string, the kana or Chinese characters can be written

Storage Device Instructions


after specified with Shift-JIS code.

D1 +1: Write mode settings

The following four write modes can be selected.

Mode Content
Holds the content of the current file, and adds and saves data to the end of that file.
A new file is made if the file does not exist.
0: Add mode Example
File name: ABC (data to save) File name: ABC

Holds the content of the current file, and overwrites and saves data to a position in
the file specified by the write position ( D1 +3) from the start of the file. An error
1: Write position occurs if the file does not exist.
specification mode 1
Example
(offset from start of file)
File name: ABC (data to save) File name: ABC

([ D1 +3・ D1 +4]
Write position )
Holds the content of the current file, and overwrites and saves data to a position in
the file specified by the write position ( D1 +4) from the end of the file. An error
occurs if the file does not exist.
2: Write position
Example
specification mode 2
File name: ABC (data to save) File name: ABC
(offset from end of file)

Write position [
( D1 +3・ D1 +4]

Deletes the content of the file and writes data. A new file is made if the file does not
exist.

3: New mode Example Overwrite


File name: ABC (data to save) File name: ABC

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-159


Storage Device Instructions

D1 +2: Option settings


Set line feed specification and fixed digit specification of the data to save.

D1 +2
EXTENDED INSTRUCTIONS

bit bit
15 0 Add line feed OFF ON OFF ON
Fixed digit
output OFF OFF ON ON
Setting value 0 1 2 3

Add line feed (Set end of file processing when outputting as a CSV file.)
OFF : Inserts a comma ($2C).
ON : Inserts a line feed CR+LF ($D$A).
Fixed digit output (The number of digits in the data is fixed when outputting
as a .CSV file.)
OFF : Variable (Zero suppression is ON.)
* When "2" or "3" is specified to D1 , fixed digits is set at all times.
ON : The number of digits can be fixed by the following number of digits.

5 Save format
D1
2 3 4

16bit 32bit

16bit 32bit
6 7 8 9

Details 16bit 32bit ASCII Floating


unsigned unsigned signed signed Text real
Storage Device Instructions

saved HEX HEX BIN BIN BIN BIN string number


Number of digits 4 8 5 10 6 11 ― 13

Reserved ("0" is set.)

KV-8000/7500/7300/5500/5000/3000、KV
KV-8000/7500/7300/5500/5000/3000, KV NanoNanoシリーズ
Series
0 : Line feed (for CSV file export, line feeding (not including the
file end) is performed.)
1∼255 : Line feeding at the specified comma.
* D1 Line feeding cannot effected when 0, 1, or 8 is specified.
* When KV-1000, 0 is set.

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 10 0 0 C 0 0 7 B 0 0 D 20 4 39 30 A 0 5B 0 78 76 E B 2D 5 D D F F F F

16-bit data
TEST1.CSV 1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
(31H) (2CH) (31H) (32H) (2CH) (31H) (32H) (33H) (2CH) (31H) (32H) (33H) (34H) (2CH) (31H) (32H) (33H) (34H) (35H) (2CH)

ASCII data
TEST1.CSV " A B C D " , " 1 2 3 4 " , " ァ ィ ゥ ェ
(22H) (41H) (42H) (43H) (44H) (22H) (2CH) (22H) (31H) (32H) (33H) (34H) (22H) (2CH) (22H) (B1H) (B2H) (B3H) (B4H) (22H)

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 only when write position specification mode 1 or 2 is set for the write
mode ( D1 +1).
When data has been written to the storage device, the following are stored in ( D1 +3) and
( D1 +4). (0 is stored immediately after power is turned on)
① When ( D1 +1) = 0
 (Reserved for the system)
② When ( D1 +1) = 1
 The next writing position is stored in ( D1 +3) and ( D1 +4).
*The number increases by the number of bytes written every time the instruction is executed.
③ When ( D1 +1) = 2
 The next writing position is stored in ( D1 +3) and ( D1 +4).
*The number decreases by the number of bytes written every time the instruction is executed.
④ When ( D1 +1) = 3
 (Reserved for the system)
Also, data can be written from the specified position by setting a value (offset value) to the write position
([ D1 +3/ D1 +4]) before the instruction is executed.

5-160 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

The position to write to can be specified in 1-byte units.

Example1 When the write mode " D1 +1" is "1" .... Write position specification mode
(offset from start of file) file index position

EXTENDED INSTRUCTIONS
Setting value Stored value
[ D1 +3・ Description [ D1 +3・
D1 +4] D1 +4]
Data is overwritten from the start of the file.
Example File name: ABC (data to save) File name: ABC
$0 $4
$0 $4

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
5
$1∼ $0 $1

Storage Device Instructions


When $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 .

Example 2 When the write mode " D1 +1" is "2"...... After the write position specification mode
(offset from end of file) is executed, the stored value is $0 at all times.

File index position


Setting value Stored value
[ D1 +3・ Description [ 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∼
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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-161


Storage Device Instructions

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 A05B0787 01000C007B00 01A05B078700


format

CSV a b c " A B C D E F G H " A " a b c " , H


(61H) (62H) (63H) (22H) (41H) (42H) (43H) (44H) (45H) (46H) (47H) (48H) (22H) (41H) (22H) (61H) (62H) (63H) (22H) (2CH) (48H)
format

…Pointer position
...Corrupted data

5
D1 +5: Number of written data
Storage Device Instructions

The number of actually written data is stored after write processing to the storage device ends.

Number
Stored
Save format of Data
Content value
D1 to Write
D1 +5

0. 16bit BIN Example
1. 32bit BIN
File name: ABC (data to save)
2. 16bit HEX 4
3. 32bit HEX File name: ABC
4. unsigned 16-bit
BIN
4 File name: ABC (data to save)
5. unsigned 32-bit Example
Size exceed
BIN
6. signed 16-bit BIN File name: ABC 2
7. signed 32-bit BIN
9. Floating real
number
Example File name: ABC S2 S2 +39
Free space (for 100 characters) NULL
Text string data of 40 characters + NULL 40
File name: ABC
40 characters
8. ASCII text
40
string Example File name: ABC S2 S2 +39
Free space (for 30 characters) NULL
Text string data of 40 characters + NULL
Size exceed 30
File name: ABC
30 characters 10 characters

Notification bit ( D2 : completion notification, D2 +1: error notification)

Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D2 ON when write processing to the storage device ends. It becomes ON either
notification
when the command is normally finished, or abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.
5-162 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Storage Device Instructions

Point • Set the save format, write mode and options to appropriate values before
executing the instruction.
• When setting the write position, set appropriate values before executing the instruction.
• The result of END processing after execution of the instruction is completed is

EXTENDED INSTRUCTIONS
written for the write position, number of written data, completion notification,
and error notification.
• When save format 8 (ASCII text string) is set, the text string preceding the end
code (NULL) from D2 is output enclosed by double quotation marks ("").
• When the text string is longer than the number of data (n) to write, only the number
of data (n) characters to write are from the start of the text string are stored.
• Double quotation marks (") in text strings are converted to two double quotation
marks ("").
Example 12" AB" 345(NULL) "12" "AB" "345"
• File names are automatically appended with an extension according to the save
format setting.
5
• Several scans are sometimes required for writing to the device. If the value of the

Storage Device Instructions


data to write is changed during write processing to the memory card, the
concurrency of each of the written data values cannot be ensured.
Please implement exclusive control by using the completion notification 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-8000/7000 series, it can be executed
without "\" (backslash).

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 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 is specified in S1 by indirect specification
• When a bit other than the start of the channel is specified when bit data is specified for S1 ,
S2 and D1
CR2012
• When a value outside of the range is specified to a parameter
• When a value is specified for reservation of a parameter
• When the indirect specification or index modification range is inappropriate
• When the number of characters written at one time is 2000 or more
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-163


Storage Device Instructions

Sample Program
Each time R1000 turns ON, data memories DM1000 to DM1099 are added to the file "ABC\DATA"*.
The save format is CSV file format. ON is output to R500 after writing ends.
EXTENDED INSTRUCTIONS

CR2008 R1004 (Mnemonics list)


RES ①
1 scan ON LD CR2008
R1000 R1004 #6 RES R1004
↑ DW ② LDP R1000
DM500 ANB R1004
DW #6 DM500
#0
DW #0 DM501
DW ③
DW #0 DM502
DM501
MWRIT "ABC\DATA" DM1000 #100 DM500 R1004
#0 LD R1004
DW ④
SET R500
DM502

5
CON
MWRIT RES R1004
"ABC¥DATA" DM1000 #100 ⑤
DM500 R1004
Storage Device Instructions

R1004 R500 R1004


SET RES ⑥

(1) The completion notification 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 destination>: DM1000 to DM1099 (100)
<completion notification>: R1004 <error notification>: R1005

(6) Process completion output is turned ON and completion notification 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-180
* Input "0:\ABC\DATA" or "ABC\DATA" for the KV-8000/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-164 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

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 ① LD CR2008
1 scan ON
RES R1004
R1000 R1004 CM700 DM0 LDP R1000
↑ LDA TBCD ASC STA ② ANB R1004
calendar timer (Year)
MPS
CM701 DM1 LDA CM700
LDA TBCD ASC STA ③ CON
calendar timer (Month)
TBCD
CM702 DM2 CON
LDA TBCD ASC STA ④ ASC
calendar timer (Day)
CON
CM703 DM3 STA DM0
LDA TBCD ASC STA ⑤ MRD
calendar timer (Hour)
LDA CM701
CM704
LDA
calendar timer (Minute)
TBCD ASC
DM4
STA ⑥
CON
TBCD
CON
5
$0 DM5 ASC

Storage Device Instructions


LDA STA ⑦ CON
STA DM1
SADD MRD
"ABC\" DM0 DM10 ⑧ LDA CM702
CON
#6 TBCD
DW ⑨ CON
DM500 ASC
#3 CON
DW ⑩ STA DM2
DM501 MRD
#0 LDA CM703
DW ⑪ CON
DM502 TBCD
MWRIT CON
DM10 DM1000 #100 ⑫ ASC
DM500 R1004 CON
STA DM3
R1004 R500 R1004
SET RES ⑬ MRD
LDA CM704
CON
(1) The completion notification is reset to its initial state. TBCD
(2) Calendar timer (Year) 00 to 99 is converted to ASCII code CON
ASC
and stored to DM0. CON
(3) Calendar timer (Month) 01 to 12 is converted to ASCII STA DM4
code and stored to DM1. MRD
LDA $0
(4) Calendar timer (Day) 01 to 31 is converted to ASCII code CON
and stored to DM2. STA DM5
(5) Calendar timer (Hour) 00 to 23 is converted to ASCII code MRD
and stored to DM3. SADD "ABC\" DM0 DM10
MRD
(6) Calendar timer (Minute) 00 to 59 is converted to ASCII DW #6 DM500
code and stored to DM4. MRD
(7) NULL (00H) is stored to DM5 (the ASCII codes of DM1 to DW #3 DM501
MRD
DM4 are converted to character strings). DW #0 DM502
(8) The calendar timers and folder name "ABC" are united into MPP
a single text string, and stored to DM10 to make "ABC\ MWRIT DM10 DM1000 #100 DM500 R1004
LD R1004
yymmddhhmm". (Folder name and file name are made.) SET R500
(9) DM500 (Save format): singed 16-bit BIN, CSV file CON
(10) DM501 (Write mode): New mode RES R1004
(11) DM502 (Option): Insert a comma at end of data, and
change number of data digits
(12) Start of save <folder>: ABC <file name>: DM10
<save destination>: DM1000.DM1099 (100)
<completion notification>: R1004 <error notification>:
R1005
(13) Process completion output is turned ON and completion
notification is reset.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-165
Storage Device Instructions

The values of data memories DM1000 to DM1099, and then DM2000 to DM2199 are written to the
memory card in CSV file format.
Each time that R1000 turns ON, the file is written to folder "ABC" with the execution date and timetaken
as the file name. ON is output to R500 after writing ends.
EXTENDED INSTRUCTIONS

CR2008 R1004 R1006 (Mnemonics list)


RES RES ① LD CR2008
1 scan ON
RES R1004
R1000 R1004 CM700 DM0 CON
↑ LDA TBCD ASC STA ② RES R1006
calendar timer (Year)
LDP R1000
CM701 DM1 ANB R1004
LDA TBCD ASC STA ③ MPS
calendar timer (Month) LDA CM700
CM702 DM2 CON
LDA TBCD ASC STA ④ TBCD
calendar timer (Day) CON
ASC
$0 DM3
CON

5
LDA STA ⑤
STA DM0
MRD
SADD LDA CM701
"ABC\" DM0 DM10 ⑥ CON
Storage Device Instructions

TBCD
#6 CON
DW ⑦ ASC
DM500 CON
#3 STA DM1
DW ⑧ MRD
DM501 LDA CM702
#0 CON
DW ⑨ TBCD
DM502 CON
MWRIT ASC
DM10 DM1000 #100 ⑩ CON
DM500 R1004 STA DM2
MRD
R1004 R1006 #0 LDA $0
DW ⑪ CON
DM501
STA DM3
MWRIT MRD
DM10 DM2000 #200 ⑫ SADD "ABC\" DM0 DM10
DM500 R1006 MRD
R1006 R500 R1004 DW #6 DM500
SET RES ⑬ MRD
DW #3 DM501
(1) The completion notification is reset to its initial state. MRD
DW #0 DM502
(2) Calendar timer (Year) 00 to 99 is converted to ASCII code MPP
and stored to DM0. MWRIT DM10 DM1000 #100 DM500 R1004
(3) Calendar timer (Month) 01 to 12 is converted to ASCII code LD R1004
ANB R1006
and stored to DM1. DW #0 DM501
(4) Calendar timer (Day) 01 to 31 is converted to ASCII code and MWRIT DM10 DM2000 #200 DM500 R1006
stored to DM2. LD R1006
(5) NULL (OOH) is stored to DM3 (the ASCII codes of DM1 to SET R500
CON
DM2 are converted to character strings). RES R1004
(6) The calendar timers and folder name "ABC" are united into a
single text string, and stored to DM10 to
make"ABC\yymmdd". (Folder name and file name are made.)
(7) DM500 (Save format): singed 16-bit BIN, CSV file
(8) DM501 (Write mode): New mode
(9) DM502 (Option): Insert a comma at end of data, and change
number of data digits
(10) Start of save <folder>: ABC <file name>: DM10
<save destination>: DM1000 to DM1099 (100)
<completion notification>: R1004 <alarm notification>: R1005
(11) DM501 (Write mode): Add mode
(12) Start of save <folder>: ABC <file name>: DM10
<save destination>: DM2000 to DM2199 (200)
<completion notification>: R1006 <error notification>: R1007
(13) Process completion output is turned ON and completion
notification is reset.
5-166 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-167


MREADReads data from
memory card (CPU memory)

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


MREAD

MREAD

MREAD
Storage Reads data from memory
read card (CPU memory).

Ladder program Input mode


EXTENDED INSTRUCTIONS

Execution condition MREAD


S D1 n M R E A D S D1 n
D2 D3 D2 D3

Operand Explanation Occupied size


Specifies the file ((drive No. +) folder name + file name + end code
8 bits × (number of
S NULL: 1 to 247 characters) saved in the memory card (CPU memory)
*1*2*3 characters + 1)
or the start of the folder name for storing it.
D1 Specifies the start of the storage location for the read data.*1 *4

n Specify the number of data to read. (0 to 65535) 16 bits

5 D2
Specifies the start to store the parameters related to the read data
type, etc. and the data read status.
16 bits x2

D3 Specifies the storage location for the notification bit.*5 1 bit ×2


Storage Device Instructions

*1 When specifying bit data, specify the start of the channel.


*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters:ASCII code (1 byte)
2-byte characters:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 The occupied size is as follows depending on D2 (read format).
• 16bitBIN / 16bitHEX / 16bit unsigned binary / 16bit signed binary
16 bits × n
• 32bitBIN / 32bitHEX / 32bit unsigned binary / 32bit signed binary / floating point type real
number
32 bits × n
• ASCII text string
8 bits × n (up to NULL)
*5 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.

Point • This function 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-168 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MREAD n data (16-bit/32-bit/ASCII text string) of the content of the parameters ([ D2 to
+4]) are saved at the rising edge of the execution condition to the data starting

EXTENDED INSTRUCTIONS
D2
from D1 from the file specified by S .
The number of actually saved data is written to D2 +5, the completion notification is
written to D3 , and the error notification for an abnormal end is written to D3 +1.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

Example 16-bit data


bit bit
15 0

5
When file S .BIN Parameter D1 12345
D2 ∼ D2 +4
3930A05B0787・・・6EB2D5DD D1 +1 23456

D1 +2 34567
Storage

Storage Device Instructions


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 ∼ 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 Number of Number of
D2 ∼ D2 +4 character character
When file S .CSV
D1 1 A(41H) B(42H) 2
Storage "ABC" ,"123",・・・,"abc……z"
Device D1 +1 3 C(43H) NULL(00H) 4

* Specify the start string separated by " when reading ASCII string, and specify a value
larger than the maximum number of characters of the string enclosed by " for the
number n of read data.

Scan
ON

Execution condition
OFF

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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-169


Storage Device Instructions

Point When the setting of read format [ D2 + 0] has been specified in BIN data, it is
stored as follows:
16-bit data
EXTENDED INSTRUCTIONS

bit bit
15 0

12345 3039H
3930A05B
23456 5BA0H

32-bit data
bit bit bit bit
31 16 15 0

1234567890 499602D2H
D20296493538D08B
2345678901 8BD03835H

5 S setting
Specify the name of the file to read from the storage device in the range of 1 to 247 characters
Storage Device Instructions

(including end code NULL(0H) and folder name).

S "file name" "folder\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)

DM1 T(54H) A(41H) DM1 C(43H) ¥(5CH)


(Example)
When DM0
DM2 NULL(00H) DM2 D(44H) A(41H)
is specified
DM3 T(54H) A(41H)

DM4 NULL(00H)

Point When designating storage with the KV-8000/7000 series, it can be executed without
"\" (backslash).

n setting range
Sets the number of data to read. The setting range changes according to the setting value of D2 .

D2 setting
0,2,4,6 (16 bits) 1,3,5,7,9 (32 bits) 8(ASCII)
value
n setting range 1 to 65535 1 to 32767 0 to 1999*

* When reading an ASCII text string, specify a value larger than the maximum number of characters in
the text string enclosed with (").

5-170 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

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 Device Instructions


You can select from the following three read modes.

Mode Content
Data is read from the start of the file at all times.
0: Regular mode Example File name:ABC
Read position
Data is read from a position specified by the read position from the start of the
1: Read position file.
specification mode 1
Example File name: ABC
(offset from start of file)
Read position(
[ D2 +3・ D2 +4])
Data is read from a position specified by the read position from the end of the file.
2: Read position
Example File name: ABC
specification mode 2
(offset from end of file)
Read position([ D2 +3・ D2 +4])

D2 +2: Reserved for the system

Sets "0".

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-171


Storage Device Instructions

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 10 0 0 C 0 0 7 B 0 0 D 20 4 39 30 A 0 5B 0 78 76 E B 2D 5 D D F F F F

16-bit data
TEST1.CSV 1 , 1 2 , 1 2 3 , 1 2 3 4 , 1 2 3 4 5 ,
(31H) (2CH) (31H) (32H) (2CH) (31H) (32H) (33H) (2CH) (31H) (32H) (33H) (34H) (2CH) (31H) (32H) (33H) (34H) (35H) (2CH)

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

5 After the reading from the storage device is finished, the position counting from the start of the file to the
end of the newly read data is stored in the read position ([ D2 +3/ D2 +4]). When reading is
performed again in this state, the next data will be read.
Storage Device Instructions

Also, data can be read from the specified position by setting a value (offset value) to the read position
([ D2 +3/ D2 +4]) before executing the instruction.
The position to read from can be specified in 8-bit (1-byte) units.

Point When reading ASCII text strings, set the number of data to read n to a value
larger than the maximum number of characters in the text string enclosed with (").
If a number of data to read less than the maximum number of characters is set, the
data read out next may differ from the actual data.

Example1 When the read mode " D2 +1" is "1"… Read position specification mode (offset from start of file)

file index position


Setting value Stored value
[ D2 +3・ Description [ 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
$0 $1 $5

$1∼ When $2 is set


File name: ABC number of data to read File name: ABC
n $6
#4
$0 $2 $6

5-172 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Example 2 When the read mode " D2 +1" is "2"... Read position specification mode (offset from end

file index position

EXTENDED INSTRUCTIONS
Setting value Stored value
[ D2 +3・ Description [ D2 +3・
D2 +4] D2 +4]
$0 error
Data is read from the specified position counting from the end of the file.
Example When $6 is set
File name: ABC number of data to read File name: ABC
n $2
#4 $22222220
$1∼ $2222221C $22222222

When $4 is set
File name: ABC number of data to read File name: ABC

$22222220 $22222222

#4 $22222222
$0
5

Storage Device Instructions


Point Pay attention to the following when specifying the position to read from.
16-bit BIN 01000204 32-bit BIN B C 0 0 4 E 61 5B 0 7 1 5 C D
TEST1.BIN TEST1.BIN
○ × ○ × ○ ○ × × × ○ × × × ○
.CSV file
" A B C " , " 1 2
TEST1.CSV (22H) (41H) (42H) (43H) (22H) (2H) (22H) (31H) (32H)
○:Correctly read position
○ × × × × × ○ × × × ×: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.

Read Stored
Save format Number
Content value
D2 of Data
D2 +5

0. 16bit BIN Example File name: ABC D1 D1 +39
1. 32bit BIN 100 items of data
40
2. 16bit HEX 40 items of data
3. 32bit HEX read from file ABC
4. unsigned 16-bit
Example File name: ABC
BIN D1 D1 +29
40 30 items of data
5. unsigned 32-bit
30 items of data
BIN read from file ABC
30
6. signed 16-bit BIN
7. signed 32-bit BIN
9. Floating real
number
Example File name: ABC D1 D1 +39
100 characters of data NULL
40
40 characters of data
8. ASCII text + NULL read
40
string Example File name: ABC D1 D1 +29
30 characters of data NULL
30
30 characters of data
+ NULL read

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-173


Storage Device Instructions

Notification bit ( D3 : completion notification, D3 +1: error notification)

Item Content
EXTENDED INSTRUCTIONS

This device turns OFF when execution of the instruction starts, and turns ON
Completion when read processing to the memory card ends.
D3
notification It becomes ON either when the command is normally finished, or abnormally
finished.
Error This device turns OFF when execution ends successfully, and turns ON
D3 +1 notification when execution ends in error.

Point • When the data to read is outside the specified format range, an error occurs, and
an error code is output to CM2390 to end read processing.
• During a CSV file read, when there are spaces, commas, or line feeds at the file

5 index positions after the data is read, the file index to be output to the result data
becomes the data position following the comma or line feed. (Reading of the
space, comma or line feed at the end of the data is skipped.)
Storage Device Instructions

• During a CSV file read, reading of empty fields (e.g. sections with continuous
commas ",") is skipped, and data is not stored. The data to be read next is stored
to the next storage location (not skipped storage location). During this operation,
skipped data is counted as the number of data.
• The result of END processing after execution of the instruction is completed is
written for the read position, number of read data, completion notification, and
error notification.
• When a text string contains two continuous double quotation marks ("), the
double quotation marks are read as a single character.
• Individual double quotation marks in a text string (including before and after the text
string) are ignored.
Example  "12" "AB" "345" 12" AB" 345(NULL)
• File names are automatically appended with an extension according to the read
format setting.
• Several scans are sometimes required for reading to the device. During
execution of the MREAD instruction, data values read from the memory card are
written in order to the start of the specified storage location.
For this reason, do not read data in a range processed by the MREAD instruction
before the completion notification turns ON.
The portion of data in some cases may not be reflected. To prevent this, please
implement exclusive control by using the completion notification D3 or
CR3214 (Storage instruction executing).
• When CR3214 is ON during the execution of storage device instructions, MREAD
command can not be executed. Therefore, it is necessary to implement exclusive
control by using CR3214 as follows.

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-8000/7000 series, it can be executed without
"\" (backslash).

5-174 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device 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; OFF in other cases.
• When the text string specified by S does not contain the end code (NULL)
• When the text string specified by S exceeds 247 characters (including NULL)
• When a timer/counter is specified in S by indirect specification
• When a bit other than the start of the channel is specified when bit data is specified for S ,
CR2012 D1 and D2
• When a value outside of the range is specified to a parameter
• When a value is specified for reservation of a parameter
• When the indirect specification or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
5
* The instruction is not executed when CR2012 turns ON.

Storage Device Instructions


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program
When R1000 turns ON, the data (100 items) in the file "DATA.CSV" under the folder* "ABC" in the
memory card is read, and is stored to data memories DM1000 to DM1099.
ON is output to R500 after reading ends.

CR2008 R1004 (Mnemonics list)


RES ①
1 scan ON LD CR2008
R1000 R1004 #6 RES R1004
DW ② LD R1000
DM500 ANB R1004
DW #6 DM500
#0
DW #0 DM501
DW ③
DW #0 DM502
DM501
MREAD "ABC\DATA" DM1000 #100 DM500 R1004
#0 LD R1004
DW ④ SET R500
DM502 CON
MREAD RES R1004
"ABC¥DATA" DM1000 #100 ⑤
DM500 R1004
R1004 R500 R1004
SET RES ⑥

(1) The completion notification is reset to its initial state.


(2) DM500 (Read format): singed 16-bit BIN, CSV file
(3) DM501 (Read mode): Regular mode
(4) DM502 (Reserved for system): Set to "0"
(5) Start of save<folder>: ABC <file name>: DATA
<number of read data>: 100 <save destination>: DM1000 onwards
<completion notification>: R1004 <error notification>: R1005
(6) Process completion output is turned ON and completion notification is reset.
* Input "0:\ABC\" or "1:\ABC\" for the KV-8000/7000 Series. (If "0:\" is not input, data will be written to
the memory card.)

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-175


MFREE
Gets thecard
memory free space
(CPU in the
memory) in
bytes.

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


MFREE

For KV-8000 / 7000 series


MFREE
Memory capacity Gets the free space in the
MFREE For other series
acquisition
(in byte)
memory card (CPU memory)
in bytes.
MFREE
EXTENDED INSTRUCTIONS

KV-8000/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

Ladder program Input mode

5 Execution condition MFREE


D1 D2 M F R E E D1 D2
Storage Device Instructions

Operand Explanation Occupied size


It designates storage which confirms the amount of free space. (0:
n 16 bits
Memory card, 1: CPU memory)
D1 Specifies the storage location for the free space.*1 32 bits
D2 Specifies the storage location for the notification bit.*2 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


*2 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.

Point • This function cannot be used with KV-N14□□/N24□□/N40□□/N60□□.


• To get the free space in kilobytes, use the MFREEK instruction.
"MFREEK instruction", page 5-214

5-176 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MFREE Free space in the storage is stored in bytes to [ D1 / D1 +1] at the rising edge of the
execution condition.

EXTENDED INSTRUCTIONS
The completion notification is written to D2 , and the error notification for an abnormal
end is written to [ D2 +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

Example D1 +1 D1
Remaining capacity
Storage 32-bit BIN data

Scan
5

Storage Device Instructions


ON

Execution condition
OFF

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 ( D2 : completion notification, D2 +1: error notification)

Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D2 ON when acquisition of free space on the storage device ends. The device
notification
turns ON whichever way execution ends, successfully or in error.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.

Point • The result of END processing after execution of the instruction is completed is
written for the completion notification and error notification.
• Several scans are sometimes required for acquiring free space.
• The get free space sometimes differs from the actual free space when file
operations were being performed via an FTP server function during acquisition
processing or the logging function was being used.
• While the storage device instructions is in execution, MFREE command can not
be executed while the CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
RXXXXX CR3214 MFREE
D1 D2

• This instruction cannot be used in interrupt programs or in the initialization


module.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-177


Storage Device 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; OFF in other cases.
• When a relay other than the start of the channel is specified in D1
• When the indirect specification or index modification range is inappropriate
CR2012 • When an access outside the operand range occurs
It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
5 KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Storage Device Instructions

Sample Program
When R1000 turns ON, the free space in the memory card is retrieved in bytes and stored in data
memory [DM1000/DM1001].

Outputs ON to R500 after completion of storage.

CR2008 R1004 (Mnemonics list)


RES ①
1 scan ON LD CR2008
RES R1004
R1000 MFREE
DM1000 R1004 ② LD R1000
MFREE DM1000 R1004
R1004 R500 R1004 LD R1004
SET RES ③ SET R500
CON
RES R1004

(1) The completion notification is reset to its initial state.


(2) Acquisition of free space<save destination>: DM1000/DM1001
<completion notification>: R1004 <error notification>: R1005
(3) Process completion output is turned ON and completion notification is reset.

5-178 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-179


MMKDIR
Creates
card a memory).
(CPU folder in the memory

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


MMKDIR

MMKDIR
MMKDIR Creating storage Creates a folder in the memory
folder card (CPU memory).

Ladder program Input mode


Execution condition MMKDIR
S D M M K D I R S D
EXTENDED INSTRUCTIONS

Operand Explanation Occupied size


Specifies the folder ((drive No. +) folder name + end code NULL: 1 to 8 bits × (number of
S
247 characters) to create or the start for storing it.*1*2*3 characters + 1)
D Specifies the storage location for the notification bit.*4 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters:ASCII code (1 byte)
5 2-byte characters:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
Storage Device Instructions

*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.

Point • This function 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).

Description of Operation
MMKDIR The folder specified by S in the storage device is made at the rising edge of the
execution condition.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

5-180 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Example S "Folder A" "Folder A\Folder B"

Storage Storage device Storage Storage device

EXTENDED INSTRUCTIONS
Device Device
Example
of folder Folder A
Folder A
structure

Folder A

When a folder already exists, nothing Prepare a new folder (folder A) in advance. It
Note happens, processing ends successfully, and cannot be prepared together with folder B.
the completion notification relay turns ON.

5
Scan
ON

Execution condition

Storage Device Instructions


OFF

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 ( D : completion notification, D +1: error notification)

Item Content
Turns OFF when execution of the instruction starts, and turns ON when the
Completion folder has finished being made.
D
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.

Point • Several scans are sometimes required for making the folder.
• The result of END processing after execution of the instruction is completed is
written for the notification bit.
• The storage location when indirect specification or index modification is
specified to the notification bit data becomes the storage location at the rising
edge of the execution condition.
• While the storage device instructions is in execution, MMKDIR command can not
be executed while the CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
RXXXXX CR3214 MMKDIR
S D

• This instruction cannot be used in interrupt programs or in the initialization module.


• When designating storage with the KV-8000/7000 series, it can be executed
without "\" (backslash).

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-181


Storage Device 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. Otherwise, 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 is specified in S by indirect specification
CR2012
• When a bit other than the start of the channel is specified when bit data is specified for S
• When the indirect specifying or index modification range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
5 KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
Storage Device Instructions

"CR/CM List", page A-43

Sample Program
The folder currently stored to data memory DM1000 is made each time that R1000 turns ON.
If the folder already exists, the folder is not made and processing is completed. The folder is output
toR500 after processing is completed.
(Mnemonics list)
CR2008 R1004
RES ① LD CR2008
1 scan ON RES R1004
R1000 R1004 LD R1000
MMKDIR ANB R1004
DM1000 R1004 ②
MMKDIR DM1000 R1004
LD R1004
R1004 R500 R1004 SET R500
SET RES ③ CON
RES R1004

(1) The completion notification is reset to its initial state.


(2) The folder is made.
(3) Process completion output is turned ON and completion notification is reset.

5-182 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-183


MRMDIRDeletes the specified
folder in the memory card (CPU
memory).

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


MRMDIR

MRMDIR
MRMDIR Delete storage Deletes the specified folder in the
folder memory card (CPU memory).

Ladder program Input mode


Execution condition MRMDIR
S D M R M D I R S D
EXTENDED INSTRUCTIONS

Operand Explanation Occupied size


Specifies the folder ((drive No. +) folder name + end code NULL: 1 to 8 bits × (number of
S
247 characters) to delete or the start for storing it.*1*2*3 characters + 1)
D Specifies the storage location for the notification bit.*4 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters:ASCII code (1 byte)
5 2-byte characters:Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
Storage Device Instructions

*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.

Point This function 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).
• Use the MDEL instruction to delete a file.
"MDEL instruction", page 5-186

Description of Operation
MRMDIR The folder specified by S in the storage device is deleted at the rising edge of the
execution condition.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

When the folder specified by S does not exist


D +1 turns ON, and 3 (the file or folder does not 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-184 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

EXTENDED INSTRUCTIONS
CR2011 No change in state
• ON when the text string specified by S does not contain the end code "NULL"
• ON when the text string including end code exceeds 247 characters
• ON when the relay specified in S is not Timer, Counter, or start of the channel
CR2012 • ON when the indirect specification or index modify range is inappropriate.
• When an access outside the operand range occurs
Otherwise, OFF
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
5

Storage Device Instructions


Sample Program
Delete the log files in the memory card in the rising edge of Input Relay R0.
(Mnemonics list)
R000 MRMDIR
“LOGO” MR000 LD R000
MRMDIR "LOG0" MR000
File delete Delete result

For more information, please refer to "Logging/Tracing" in the User's Manual of the CPU unit used.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-185


MDEL Deletes the specified
file in the memory card (CPU
memory)

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


MDEL

MDEL
MDEL Delete storage Deletes the specified file in the
file memory card (CPU memory).

Ladder program Input mode


Execution condition MDEL
S D M D E L S D
EXTENDED INSTRUCTIONS

Operand Explanation Occupied size


Specifies the file ((drive No. +) folder name + file name + extension +
8 bits × (number of
S end code NULL: 1 to 247 characters) to delete or the start for storing
characters + 1)
it. Specify the extension along with the file name.* 1*2*3
D Specifies the storage location for the notification bit.*4 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.

5 1-byte characters: ASCII code (1 byte)


2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Storage Device Instructions

Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)


*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.

Point • This function 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).
• Use the MDEL instruction to delete a file.
"MRMDIR instruction", page 5-184

Description of Operation
MDEL The file specified by S in the storage device is deleted at the rising edge of the
execution condition.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
• D turns OFF when execution of the instruction starts, and turns ON when write
processing to the storage ends. It becomes ON either when the command is normally
finished, or abnormally finished.
• D +1 turns OFF when the instruction ends successfully, and turns ON when
execution ends in error.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

When the folder specified by S does not exist


D +1 turns ON, and 3 (the file or folder does not exist) is stored in CM2390.

5-186 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Operation flag

CR2009 No change in state


CR2010 No change in state

EXTENDED INSTRUCTIONS
CR2011 No change in state
• ON when the text string specified by S does not contain the end code "NULL"
• ON when the text string including end code exceeds 247 characters
• ON when the relay specified in S is not Timer, Counter, or start of the channel
CR2012 • ON when the indirect specification or index modify range is inappropriate.
• When an access outside the operand range occurs
Otherwise, OFF
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
5

Storage Device Instructions


Sample Program
Delete the log files in the memory card.
(Mnemonics list)
R000 MDEL
“LOGO¥LOGO00.CSV” MR000 LD R000
MDEL "LOG0\LOG000.CSV" MR000
File delete Delete Result

For more information, please refer to "Logging/Tracing" in the User's Manual of the CPU unit used.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-187


MPRINTWrites a text sting
into a file in the memory card
(CPU memory).

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


MPRINT

Writes the text string into the


MPRINT MPRINT Storage text
end of the file in the memory
string write
card (CPU memory).

Ladder program Input mode


Execution condition MPRINT
EXTENDED INSTRUCTIONS

S1 S2 D M P R I N T S1 S2 D

Operand Explanation Occupied size


Specifies the file name ((drive No. +) folder name + file name + end
8 bits × (number of
S1 code NULL: 1 to 247 characters) to write the text string or the start for
*1*2*3 characters + 1)
storing it. Specify the extension along with the file name.
Specifies the text string data to write or the start for storing the text 8 bits × (number of
S2
string.* 1 characters + 1)
D Specifies the storage location for the notification bit.*4 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


5 *2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
Storage Device Instructions

1-byte characters: ASCII code (1 byte)


2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of 2 continuous words is used as notification bit data. Bits other than LSB do not change.

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/
3000Series CPU units with CPU function version 2.0 or higher and with KV-
NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
• To include a folder name in the file name, the folder must be created beforehand.
• When designating storage with the KV-8000/7000 series, it can be executed
without "\" (backslash).

5-188 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MPRINT The text string in the storage device specified with S2 is written to the end of the file
specified with at the rising edge of the execution condition.

EXTENDED INSTRUCTIONS
S1
If the file specified with S1 is not found, a new file will be created.
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

Example
To write one line of new product data in
Storage "Product information.TXT" in the storage device

5
Device

When the text string "2010/06/07,22:36:01,No.15,AB123BCD" is stored in DM0:

Storage Device Instructions


2010/06/07,18:15:58,No.12,AB1234CD 2010/06/07,18:15:58,No.12,AB1234CD
2010/06/07,19:20:05,No.13,AB1235CD 2010/06/07,19:20:05,No.13,AB1235CD
2010/06/07,20:23:11,No.14,AB1236CD + DM0 2010/06/07,20:23:11,No.14,AB1236CD
2010/06/07,21:31:22,No.15,AB1237CD 2010/06/07,21:31:22,No.15,AB1237CD
2010/06/07,22:36:01,No.16,AB1238CD

"Product information.TXT" before instruction is executed "Product information.TXT" after instruction is executed

* To put entries on new lines as in the example above, the CR+LF new line code
must be entered at the end of the line.
Input CR/LF using the CHR instruction to enterCHR(H0D)/CHR(H0A).

Point • The completion notification and error notification are written as the result of the
END process when execution of the instruction is completed.
• If CR3214 is ON when another storage device instruction is being executed, the
MPRINT instruction cannot be executed. Therefore, the implementation of
exclusive control is necessary by using CR3214 as follows.

Example
RXXXXX CR3214 MPRINT
S1 S2 n

• 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 executing)
OFF

* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is
OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/retrieval
processing time.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-189


Storage Device Instructions

S1 setting
Specify the name of the file storing the data with 1 to 247 characters (including end code NULL (00H)
and folder name).
EXTENDED INSTRUCTIONS

S1 "file name" "folder name\file name"

Storage Storage device Storage Storage device


Device Device
Example of
File
folder structure Folder

File

When a folder is not specified, the


Point Prepare a folder beforehand.
data is saved to 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 Device Instructions

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 ( D : completion notification, D +1: error notification)

Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D ON when write processing to the storage device ends. It becomes ON either
notification
when the command is normally finished, or abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.

Operation flag

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 or S2 does not contain the end code (NULL (00H))
• When the text string (including end code) specified with S1 exceeds 247 characters
• When the text string (including end code) specified with S2 exceeds 2000 characters
CR2012
• When a bit data other than the timer, counter or channel start is specified in S1 or S2
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
5-190 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -
Storage Device Instructions

Sample Program
When the internal relay MR000 turns ON, the text string stored in data memory from DM0 is writtenonto
the end of the "Product Information.TXT" file in the storage device. R500 turns ON if a write erroroccurs.

EXTENDED INSTRUCTIONS
(Mnemonics list)
MR000 MPRINT
"Product LDP MR000
DM0 MR100
Information.TXT"
MPRINT "Product Information.TXT" DM0 MR100
LD MR100
MR100 MR101 R500 AND MR101
SET SET R500

Memory
Card
Text string stored in data memory from DM0

2010/06/07, 22:36:01, No.16, AB1238CD


5

Storage Device Instructions


2010/06/07, 18:15:58, No.12, AB1234CD DM0 2(32H) 0(30H)
2010/06/07, 19:20:05, No.13, AB1235CD
2010/06/07,
2010/06/07,
20:23:11,
21:31:22,
No.14,
No.15,
AB1236CD
AB1237CD
+ DM1
DM2
1(31H)
/ (31H)
0(30H)
0(30H)

"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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-191


MREADL Only one line of the
file in the read
memory)is memory
out card (CPU

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


MREADL

Read one line Only one line of the file in the


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

Operand Explanation Occupied size


Specifies the file name ((drive No. +) folder name + file name + end
8 bits × (number of
S code NULL: 1 to 247 characters) to read the text string or the start for
characters + 1)
storing it. Specify the extension along with the file name.*1*2*3
8 bits × (number of
D1 Specifies the start to store the read string data.*1
characters + 1)
Specifies the start for storing the parameters related to the position or
D2 16 bit ×4
upper limit of the read data.* 1

5 *1
D3 Specifies the storage location for the notification bit.*4

When specifying bit data, specify the start of the channel.


1 bit ×4
Storage Device Instructions

*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters: ASCII code (1 byte)
2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 4 continuous bits are occupied. When word data is specified, the LSB
of 4 continuous words is used as notification bit data. Bits other than LSB do not change.

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/
3000Series CPU units with CPU function version 2.0 or higher and with KV-
NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).

5-192 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MREADL At the rising edge of the execution condition, 1 line of data is read from the position of
[ D2 / D2 +1] bytes in the file specified by , and stored starting with .

EXTENDED INSTRUCTIONS
S D1
If there is no line feed code (CR(0DH), LF(0AH), CR+LF) in the read data, [ D2 +2]
bytes are read and [ D3 +3] is turned ON.
The completion notification is written in D3 . If the process ends abnormally, an error
notification is written in [ D3 +1]. If the read data contains EOF, [ D3 +2] turns ON.
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

Scan

5
ON

Execution Condition
OFF

MREADL Only 1 scan Only 1 scan

Storage Device Instructions


Read process
ON
End notice( D3 )
OFF

( D2・D2 +1)
Read position

ON
CR3214
(Storage instruction executing) OFF

* Writing is performed irrespective of execution status. So if the instruction is executed in one time
scanning, writing will be performed again in the next time scanning, even if the input condition is
OFF.
In addition, the actual writing time elapse depends on data capacity and file storage/access
processing time.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-193


Storage Device Instructions

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 structure Folder

File

File name:DATA.TXT Folde:rABC 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 Device Instructions

(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 ,
TEST1.TXT (31H)(2CH)(31H)(32H)(2CH)(31H)(32H)(33H)(2CH)(31H)(32H)(33H)(34H)(2CH)(31H)(32H)(33H)(34H)(35H)(2CH)

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 feed position is read out.
After the reading from the storage device is finished, the position counting from the start of the file to the
end of the newly read data is stored in the read position ([ D2 / D2 +1]). When reading is performed
again in this state, the next data will be read.
The position to be read out can be specified in 8-bit unit (1-byte unit).

5-194 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Example1 File index position


Setting value Stored value
[ D2 +3・ Details [ D2 +3・

EXTENDED INSTRUCTIONS
D2 +4] D2 +4]
Read from the position at the start of the file.
Example File name: ABC.TXT
$0 Text string to read out CR(0DH) $8
$0

Read from specified position counted from start of file.


Example For $1
File name: ABC.TXT
Text string to read out CR(0DH) $8
$0 $1
$1∼ For $2
File name::
ABC.TXT
Text string to read out CR(0DH) $8 5
$0 $2

Storage Device Instructions


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 the system

Sets "0".

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-195


Storage Device Instructions

Notification bit data ( D3 to D3 +3)

Item Content
EXTENDED INSTRUCTIONS

This device turns OFF when execution of the instruction starts, and turns
Completion ON when read processing to the memory card ends.
D3
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D3 +1 notification when execution ends in error.
After one line is read in, the system judges whether the file end has been
File end
D3 +2 reached. This device turns ON if the file end is reached, and turns OFF if the
notification
file end is not reached.
No line return This device turns ON if there is no line return code within the read upper limit
D3 +3
code notification bytes, and turns OFF if there is a line return code.
5
Point • The result of END processing after execution of the instruction is completed is
Storage Device Instructions

written for the notification bit data.


• Several scans are sometimes required for reading to the device. During
execution of the MREADLinstruction, data values read from the storage device
are written in order to the start of the specified storage location.
For this reason, do not read data in a range processed by the MREADL
instruction before the completion notification bit data turns ON.
The portion of data in some cases may not be reflected. To prevent this, please
implement exclusive control by using the completion notification or CR3214
(Storage instruction executing).
• The MREADL instruction cannot be executed while another executing storage
device instruction CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
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-8000/7000 series, it can be executed
without "\" (backslash).

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 end code) specified with S exceeds 247 characters
• When the value of [ D2 +2] is 2000 or more
• When the relay specified in S is not Timer, Counter, or start of the channel
CR2012
• When a bit data other than the timer, counter or channel start is specified in D1 or D2
• When D1 +[ D2 +2] is outside the device / work area range
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-196 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Sample Program
When the internal relay MR000 turns ON, the data from byte 10 of the file "DATA.csv" in the memory
card to the line feed position is read, and stored in data memory from DM0. R500 turns ON when a

EXTENDED INSTRUCTIONS
read error occurs.

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

5
AND MR101
SET R500

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-197


MCOPYA file in the memory
card (CPU memory) is copied.

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


MCOPY

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

Operand Explanation Occupied size


Specifies the copy source file name ((drive No. +) folder name + file
name + end code NULL: 1 to 247 characters), folder name (folder 8 bits × (number of
S1
name + end code NULL: 1 to 247 characters), or the start for storing characters + 1)
these names. Specify the extension along with the file name.*1*2*3
Specifies the copy destination file name ((drive No. +) folder name +
file name + end code NULL: 1 to 247 characters), folder name (folder 8 bits × (number of
S2
name + end code NULL: 1 to 247 characters), or the start for storing characters + 1)
these names. Specify the extension along with the file name.*1*2*3
Specifies parameters related to the copy format or storage location.* 1 16 bits
5 S3
D Specifies the storage location for the notification bit.*4 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


Storage Device Instructions

*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters: ASCII code (1 byte)
2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of 2 continuous words is used as notification bit data. Bits other than LSB do not change.

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
• To include a folder name in the file name, the folder must be created beforehand.

5-198 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MCOPY At the rising edge of the execution condition, the file specified with S1 is copied to
following the parameters specified in .

EXTENDED INSTRUCTIONS
S2 S3
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

Example Specify the copy source file name and copy destination file name in the range of 1 to
247characters (including end code NUL (00H) and folder name).

Item S1 Copy source: DM0 S2 Copy destination: DM50

Folder name:ABC
File name: DATA.csv Folder name:XYZ File name: TEST.csv 5
DM0 A(41H) B(42H) DM0 X(58H) Y(59H)

Storage Device Instructions


(Example)
When : DM0
DM1 C(43H) ¥(5CH) DM1 Z(60H) ¥(5CH)
and S1 DM2 D(44H) A(41H) DM2 T(54H) E(45H)
S2 : DM50
are specified DM3 T(54H) A(41H) DM3 S(53H) T(54H)
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 migrating to a different storage (Only KV-8000/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 migrating to a different storage, you can choose to migrate files and subfolders
inside the folder all together by designating the folder.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-199


Storage Device Instructions

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

5 if the input condition is OFF at the next scan.

Point • If a folder is specified in S1 , all files directly under the S1 folder are copied
Storage Device Instructions

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 S3 value.
• If a file is specified in S1 and a folder in S2 , the file specified with S1 is
copied 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-200 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Notification bit ( D : completion notification, D +1: error notification)

Item Content

EXTENDED INSTRUCTIONS
The device turn OFF when the instruction execution starts, and turns ON
Completion when change is completed.
D
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.

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.
• The storage location when indirect specification or index modification is 5
specified to the notification bit data becomes the storage location at the rising

Storage Device Instructions


edge of the execution condition.
• The MCOPY instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. For this reason, Therefore, the
implementation of exclusive control is necessary by using CR3214 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-8000/7000 series, it can be executed
without "\" (backslash).

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 or S2 does not contain the end code (NULL (00H))
• When the text string (including end code) specified with S1 or S2 exceeds 247
characters
CR2012
• When a bit data other than the timer, counter or channel start is specified in S1 or S2
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-201


Storage Device Instructions

Sample Program
When the internal relay MR000 turns ON, the file "DATA.csv" in the folder "ABC" in the memory card is
copied into the folder "XYZ" with the file name "TEST.csv". If a file already exists, it is overwritten.
EXTENDED INSTRUCTIONS

R500turns 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
SMOV MCOPY DM0 DM100 #0 MR100
"XYZ¥TEST.csv" DM100 LD MR100
AND MR101
SET R500
MCOPY
DM0 DM100 #0 MR100

5 MR100 MR101 R500


SET
Storage Device Instructions

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

Copied file

5-202 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-203


MMOV
A file in the
memory) memory card (CPU
is moved.

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


MMOV

MMOV MMOV Move file in A file in the memory card


storage device (CPU memory) is moved.

Ladder program Input mode


Execution condition MMOV
S1 S2 S3 D M M O V S1 S2 S3 D
EXTENDED INSTRUCTIONS

Operand Explanation Occupied size


Specifies the move source file name ((drive No. +) folder name + file
name + end code NULL: 1 to 247 characters), folder name (folder 8 bits × (number of
S1
name + end code NULL: 1 to 247 characters), or the start for storing characters + 1)
these names. Specify the extension along with the file name.*1*2*3
Specifies the move destination file name ((drive No. +) folder name +
file name + end code NULL: 1 to 247 characters), folder name (folder 8 bits × (number of
S2
name + end code NULL: 1 to 247 characters), or the start for storing characters + 1)
these names. Specify the extension along with the file name.*1*2*3

5
Specifies parameters related to the file move format or storage
S3 16 bits
location.*1
D Specifies the storage location for the notification bit.*4 1 bit ×2
Storage Device Instructions

*1 When specifying bit data, specify the start of the channel.


*2 To specify a text string using constants, enclose with " ". Thecharacters "#" and "$" cannot be
used.
1-byte characters: ASCII code (1 byte)
2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of 2 continuous words is used as notification bit data. Bits other than LSB do not change.

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).
• To include a folder name in the file name, the folder must be created beforehand.

5-204 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MMOV At the rising edge of the execution condition, the file specified with S1 in the storage
device is moved to following the parameters specified in .

EXTENDED INSTRUCTIONS
S2 S3
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

Example Specify the move source file name and move destination file name in the range of 1 to247
characters (including end code NUL (00H) and folder name).

Item S1 Copy source: DM0 S2 Copy destination: DM50

Folder name:ABC File name: DATA.csv Folder name:XYZ File name: TEST.csv 5
DM0 A(41H) B(42H) DM0 X(58H) Y(59H)

Storage Device Instructions


(Example) DM1 C(43H) ¥(5CH) DM1 Z(60H) ¥(5CH)
When : DM0
and S1 DM2 D(44H) A(41H) DM2 T(54H) E(45H)
S2 : DM50
DM3 T(54H) A(41H) DM3 S(53H) T(54H)
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 moving to a different storage (Only KV-8000/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 moving to a different storage, you can choose to move files and subfolders
inside the folder all together by designating the folder.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-205


Storage Device Instructions

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

* 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

5 if the input condition is OFF at the next scan.

Point • If a folder is specified in S1 , all files directly under the S1 folder are moved
Storage Device Instructions

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 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-206 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Notification bit ( D : completion notification, D +1: error notification)

Item Content

EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts, and turns
Completion ON when moving ends.
D
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.

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.
• The storage location when indirect specification or index modification is 5
specified to the notification bit data becomes the storage location at the rising

Storage Device Instructions


edge of the execution condition.
• The MMOV instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.

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-8000/7000 series, it can be executed
without "\" (backslash).

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 or S2 does not contain the end code (NULL (00H))
• When the text string (including end code) specified with S1 or S2 exceeds 247
characters
CR2012
• When a bit data other than the timer, counter or channel start is specified in S1 or S2
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-207


Storage Device Instructions

Sample Program
When the internal relay MR000 turns ON, the file "DATA.csv" in the folder "ABC" in the memory card is
moved to the folder "XYZ" with the file name "TEST.csv". If a file already exists, it is overwritten.
EXTENDED INSTRUCTIONS

R500turns 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
SMOV MMOV DM0 DM100 #0 MR100
"XYZ¥TEST.csv" DM100 LD MR100
AND MR101
SET R500
MMOV
DM0 DM100 #0 MR100

5 MR100 MR101 R500


SET
Storage Device Instructions

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

Folder name: XYZ Folder name: XYZ

File name: TEST.csv

Moved file

5-208 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-209


MRENChange the file name
in the memory card (CPU
memory).

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


MREN

MREN MREN Rename file in Change the file name in the


storage device memory card (CPU memory).

Ladder program Input mode


Execution condition MREN
S1 S2 D M R E N S1 S2 D
EXTENDED INSTRUCTIONS

Operand Explanation Occupied size


Specifies the file name ((drive No. +) folder name + file name + end
code NULL: 1 to 247 characters) to be changed, folder name (folder 8 bits × (number of
S1
name + end code NULL: 1 to 247 characters), or the start for storing characters + 1)
these names. Specify the extension along with the file name.* 1*2*3
Specifies the changed file name (file name + end code NULL: 1 to 247
characters), folder name (folder name + end code NULL: 1 to 247
8 bits × (number of
S2 characters), or the start for storing these names. To change a file
characters + 1)
name including the extension, specify the extension along with the file
*1*2*3

5
name.
D Specifies the storage location for the notification bit.*4 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


Storage Device Instructions

*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
used.
1-byte characters: ASCII code (1 byte)
2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)
Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of 2 continuous words is used as notification bit data. Bits other than LSB do not change.

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).

5-210 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MREN At the rising edge of the execution condition, the file name specified with S1 is
changed to the file name specified with .

EXTENDED INSTRUCTIONS
S2
The completion notification is written to D , and the error notification for an abnormal
end is written to [ D +1].
The error code is stored in CM2390.
"List of Error Codes for Storage Device Instructions", page 5-154

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 changed and the file name after change in the
5
Example
range of 1 to 247 characters (including the end code NULL (00H)).
Specify the extension along with the file name.

Storage Device Instructions


Item S1 File name to be changed: DM0 S2 New file name: DM50

Folder name:ABC File name: DATA.csv File name: TEST.csv

DM0 A(41H) B(42H) DM50 T(54H) E(45H)


(Example) DM1 C(43H) ¥(5CH) DM51 S(53H) T(54H)
When : DM0
and S1 DM2 D(44H) A(41H) DM52 . (2EH) c(63H)
S2 : DM50
are specified DM3 T(54H) A(41H) DM53 s(73H) v(76H)
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 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.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-211


Storage Device Instructions

Notification bit ( D : completion notification, D +1: error notification)

Item Content
EXTENDED INSTRUCTIONS

The device turn OFF when the instruction execution starts, and turns ON
Completion when change is completed.
D
notification It becomes ON either when the command is normallyfinished, or abnormally
finished.
Error This device turns OFF when execution ends successfully, and turns ON
D +1 notification when execution ends in error.

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.
5 • The storage location when indirect specification or index modification is
specified to the notification bit data becomes the storage location at the rising
Storage Device Instructions

edge of the execution condition.


• The MREN instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.

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
ON when one of the following conditions is established. Otherwise, OFF.
• When the text string specified by S1 or S2 does not contain the end code (NULL (00H))
• When the text string (including end code) specified with S1 or S2 exceeds 247
characters
CR2012
• When a bit data other than the timer, counter or channel start is specified in S1 or S2
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-212 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Sample Program
When the internal relay MR000 turns ON, the file "DATA.csv" in the folder "ABC" in the memory card is
changed to "TEST.csv". R500turns ON if an error occurs.

EXTENDED INSTRUCTIONS
(Mnemonics list)
MR000 SMOV LDP MR000
"ABC¥DATA.csv" DM0
SMOV "ABC\DATA.csv" DM0
MREN DM0 "TEST.csv" MR100
MREN LD MR100
DM0 “TEST.csv” MR100 AND MR101
SET R500
MR100 MR101 R500
SET

Storage Device Instructions


Memory Memory card Memory Memory card
card card

Folder name: ABC Folder name: ABC

File name: TEST.csv File name: TEST.csv

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-213


MFREEKGets the free space in
the memory
memory) card
in kilobytes (CPU

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


MFREEK

For KV-8000/7000 series


MFREEK
Memory capacity Gets the free space in the
MFREEK For other series
acquisition (in
kilobytes)
memory card (CPU
memory) in kilobytes.
MFREEK
EXTENDED INSTRUCTIONS

KV-8000/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

Ladder program Input mode

5 Execution condition MFREEK


D1 D2 M F R E E K D1 D2
Storage Device Instructions

Operand Explanation Occupied size


Specifies the storage with the free space to be checked. (0: Memory
n 16 bits
card / 1: CPU memory).*1
Specifies the start to store the free space. *1 32 bits
D1
D2 Specifies the storage location for the notification bit.*2 1 bit ×2

*1 When specifying bit data, specify the start of the channel.


*2 When bit data is specified, 2 continuous bits are occupied. When word data is specified, the LSB
of each of the 2 continuous words is used as notification bit data. Bits other than LSB do not
change.

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• To get the free space in kilobytes, use the MFREEK instruction.
"MFREE instruction", page 5-176

5-214 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

Description of Operation
MFREEK Free space in the storage is stored in bytes to [ D1 / D1 +1] at the rising edge of the
execution condition.

EXTENDED INSTRUCTIONS
The completion notification is written to D2 , and the error notification for an abnormal
end is written to [ D2 +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

Example D1 +1 D1
Free space
Storage 32-bit BIN data
Device

5
Scan
ON

Execution Condition
OFF

Storage Device Instructions


MFREEK 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 ( D2 : completion notification, D2 +1: error notification)

Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion
D2 ON when acquisition of free space on the storage device ends. The device
notification
turns ON whichever way execution ends, successfully or in error.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.

Point • The result of END processing after execution of the instruction is completed is
written for the completion notification and error notification.
• Several scans are sometimes required for acquiring free space.
• The get free space sometimes differs from the actual free space when file
operations were being performed via an FTP server function during acquisition
processing or the logging function was being used.
• The MFREEK instruction cannot be executed while the storage device instruction
executing control relay CR3214 is ON. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
RXXXXX CR3214 MFREEK
D1 D2

• This instruction cannot be used in interrupt programs or in the initialization


module.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-215


Storage Device 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; OFF in other cases.
• When a relay other than the start of the channel is specified in D1
• When the indirect specification or index modification range is inappropriate
CR2012 • When an access outside the operand range occurs
It will not change when indirect specification or index modification is not specified in the operand,
and the access outside the operand range is not checked.
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.

5 KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Storage Device Instructions

Sample Program
When the internal relay MR000 turns ON, the free space in the memory card is stored in DM0, DM1.
R500turns ON if an error occurs.
(Mnemonics list)
MR000 MFREEK LDP MR000
DM0 MR100 MFREEK DM0 MR100
LD MR100
AND MR101
MR100 MR101 R500 SET R500
SET

DM1 DM0
Free space
Storage 32-bit BIN data
Device

5-216 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-217


MSTAT
Gets the status of the files in the
memory card (CPU memory).

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


MSTAT

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
EXTENDED INSTRUCTIONS

S D1 D2 M S T A T S1 D1 D2

Operand Explanation Occupied size


Specifies the file name ((drive No. +) folder name + file name + end
8 bits × (number of
S code NULL: 1 to 247 characters) to get the status or the start for
characters + 1)
storing it. Specify the extension along with the file name.*1*2*3
D1 Specifies the start to store the acquisition results. *1 16 bit ×10
D2 Specifies the storage location for the notification bit.*4 1 bit ×3

*1 When specifying bit data, specify the start of the channel.


*2 To specify a text string using constants, enclose with " ". The characters "#" and "$" cannot be
5 used.
1-byte characters: ASCII code (1 byte)
Storage Device Instructions

2-byte characters: Language set in "Project language settings" (KV-8000/7000 Series)


Shift JIS code (2-byte) (KV-5500/5000/3000/1000 and KV Nano Series)
*3 For KV-8000/7500/7300, it specifies the drive number with "0: \" (for memory card) or "1: \" (for
CPU memory) in the beginning. It will operate the targeted storage as a memory card if it is not
designated.
*4 When bit data is specified, 3 continuous bits are occupied. When word data is specified, the LSB
of 3 continuous words is used as notification bit data. Bits other than LSB do not change.

Point • This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and with KV-NC32T.
"KV-5000/3000 CPU Function Version", page 4
• Use half-width and full-width characters to create distinct file names (capital letters
and lower case letters are not differentiated between).

Description of Operation
MSTAT At the rising edge of the execution condition, the status of the file in the storage device
specified with S is retrieved, and the results are stored in D1 to D1 +9.

The completion notification is written to D2 , and the error notification for an abnormal
end is written to [ D2 +1].
The error code is stored in CM2390.
“List of Error Codes for Storage Device Instructions”

5-218 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

File status storage ( D1 to D1 +9)

Acquisition
result Details of retrieval

EXTENDED INSTRUCTIONS
storage
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
5 ON when archive
6∼15 (Reserved: fixed to 0)
D1 +1 (Reserved)

Storage Device Instructions


D1 +2
File size
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: Day (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 ( D2 : Completion notification, D2 +1: Error notification, D2 +2: Presence)

Item Content
This device turns OFF when execution of the instruction starts, and turns
Completion ON when completed.
D2
notification It becomes ON either when the command is normally finished, or
abnormally finished.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1 notification when execution ends in error.
D2 +2 Presence This device turns ON when the file or folder is present, and turns OFF when absent.

Point • It may take several scans to complete the retrieval process.


• The result of END processing after execution of the instruction is completed is
written for the notification bit.
• The storage location when indirect specification or index modification is
specified to the notification bit data becomes the storage location at the rising
edge of the execution condition.
• The MSTAT instruction cannot be executed if CR3214 is ON when the storage
device instruction is being executed. Therefore, the implementation of exclusive
control is necessary by using CR3214 as follows.
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-8000/7000 series, it can be executed
without "\" (backslash).

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-219


Storage Device 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 the text string specified by S does not contain the end code (NULL (00H))
• When the text string (including end code) specified with S exceeds 247 characters
• When the relay specified in S is not Timer, Counter, or start of the channel
CR2012
• When a relay other than the start of the channel is specified in D1
• When the indirect specification and index modify range is inappropriate
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50
* The instruction is not executed when CR2012 turns ON.
5 KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43
Storage Device Instructions

Sample Program
When the internal relay MR000 turns ON, the status of the file "DATA" in the folder "ABC" in the memory
card is retrieved and stored in data memory DM100 to DM109. R500turns ON if an error occurs.

(Mnemonics list)
MR000 SMOV LDP MR000
"ABC¥DATA.csv" DM0
SMOV "ABC\DATA.csv" DM0
MSTAT DM0 DM100 MR000
MSTAT LD MR100
DM0 DM100 MR000 AND MR101
SET R500
MR100 MR101 R500
SET

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-220 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Storage Device Instructions

MEMO

EXTENDED INSTRUCTIONS
5

Storage Device Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-221


Access Window Instructions
AWNUMDisplay user message 1
in access window

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


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

Operand Explanation Occupied size


Specifies the value displayed as user message 1 in access window or
S 16 bits
the storage location.

Description of Operation
AWNUM When the execution condition turns from OFF to ON, the value of S is displayed as
user message 1 in the access window.

5 When the execution condition turns from ON to OFF, the display of user message 1 is
canceled.
Access Window Instructions

Reference For details on user message display, refer to "User's Information" in "KV-5500/5000/
3000 Series User's Manual", "2-12 User's Information" in "KV-1000 Series User's
Manual", or "4-11 Access Window" in "KV Nano Series (Terminal Block Type) User's
Manual".

Point • At the rising edge of execution condition, CR2900 is set; at the falling edge of
execution condition, CR2900 is reset. When the execution condition is ON, the
value specified in S is always copied to CM1720, and the result is rapidly
reflected to the access window.
• When the execution condition is ON, if the value of S is changed, the display
content of user message 1 is also changed.
• If the access window is operated, message display will be canceled even if the
execution condition is ON (CR2900 is reset at this time). In such case, it is
necessary to change the execution condition from OFF to ON in order to display
user message 1 again.
• When both user message 1 and user message 2 are ON, user message 1 is
displayed on a priority.
• When multiple AWNUM instructions exist in a project, the state of access window
is based on the last AWNUM instruction executed.
• This instruction cannot be used in interrupt programs or in the initialization
module.
• There is no access window in KV-NC32T. If the expansion access window
cassette is not connected with the KV-NC32T or KV Nano Series, an error does
not occur and nothing is executed. At this time, KV STUDIO will not generate a
conversion error.

5-222 - KV-8000/7000/5000/3000/1000 Series/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. Does
CR2012
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, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

Sample Program 5

Access Window Instructions


When relay R1000 is ON, value 10 will be displayed in access window.

#10 (Mnemonics list)


R1000
AWNUM LD R1000
AWNUM #10

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-223


AWMSGDisplay user message 2
in access window

KV 8000 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

Operand Explanation Occupied size


Specifies the string displayed as user message 2 in access window or
S Number of characters
the storage location.*1*2

*1 When a bit device has been specified in S , specify the start device of the channel.
*2 When ASCII strings are specified using constants, enclose with " ". # and $ cannot be used.
In addition, please input with less than DBC case 24 characters.

5 Description of Operation
AWMSG
Access Window Instructions

When the execution condition turns from OFF to ON, the string stored starting with S
is displayed as user message 2 in the access window.
When the execution condition turns from ON to OFF, the display of user message 2 is
canceled.

Reference For details on user message display, refer to "User's Information" in "KV-5500/5000/
3000 Series User's Manual", "2-12 User's Information" in "KV-1000 Series User's
Manual", or "4-11 Access Window" in "KV Nano Series (Terminal Block Type) User's
Manual".

Point • At the rising edge of execution condition, CR2901 is set; at the falling edge of
execution condition, CR2901 is reset. When the execution condition is ON, the
string stored starting with S is always copied to CM1721 to CM1737, and the
result is reflected immediately to the access window.
• When the execution condition is ON, if the text string currently stored starting
from S is changed, the display content of user message 2 is also changed.
• If the access window is operated, message display will be canceled even if the
execution condition is ON (CR2901 is reset at this time). In such case, it is
necessary to change the execution condition from OFF to ON in order to display
user message again.
• When both user message 1 and user message 2 are ON, user message 1 is
displayed on a priority.
• When multiple AWMSG instructions exist in a project, the state of access window
is based on the last AWMSG instruction executed.
• Character strings that can be displayed in the access window are only 1-byte
characters (ASCII codes 20h to 7Eh, A1h to DFh) up to 24 characters from the
start of the character string stored starting with S .
2-byte characters such as Chinese characters cannot be displayed.
• This instruction cannot be used in interrupt programs or in the initialization
module.
• There is no access window in KV-NC32T. If the expansion access window
cassette is not connected with the KV-NC32T or KV Nano Series, an error does
not occur and nothing is executed. At this time, KV STUDIO will not generate a
conversion error.

5-224 - KV-8000/7000/5000/3000/1000 Series/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. Otherwise, OFF.
• When the range of S is inappropriate
CR2012 • When a bit other than the start of the channel is specified when bit data is specified for S
• When a timer/counter is specified in S by indirect specification
• When the indirect specification and index modify range is inappropriate

* The instruction is not executed when CR2012 turns ON.


KV-5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43 5

Access Window Instructions


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-225


AWSHOWDisplay user message
in access window

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


AWSHOW

AWSHOW
Display user message in
AWSHOW Display user message
access window.

Ladder program Input mode


Execution condition AWSHOW
S A W S H O W S
EXTENDED INSTRUCTIONS

Operand Explanation Occupied size


S Specifies the ID of the user message to show. (1 to 63) 16 bits

Description of Operation
AWSHOW The user message with the ID specified in S is displayed in the access window at the
rising edge of the execution condition.
To turn the user message OFF, operate the access window, execute the AWHIDE

5 instruction, or reset the applicable CR.

For more details about user message display, refer to "User Messages" in the User's
Reference
Access Window Instructions

Manual of the CPU unit used.

Point • When the execution condition is ON, no changes will be made even if the S
value is changed.
• CR that supports the user message with the ID specified at the rising edge of the
execution conditions is set.
• When AWSHOW instruction and AWHIDE instruction are executed simultaneously,
priority will be given to the instruction that was executed afterwards within the
ladder program.
• If there are several AWSHOW instructions in a project, the access window
follows the first executed AWSHOW instruction.
• This instruction cannot be used in interrupt programs or in the initialization
module.

5-226 - KV-8000/7000/5000/3000/1000 Series/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. Otherwise, OFF.
• When the indirect specification or index modification range is inappropriate
CR2012 • When the S value is outside the range of 1 to 63
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300 When CR2012 is ON, error details are stored in CM5150 to CM5176.

Sample Program 5

Access Window Instructions


When relay R000 turns ON, the ID1 user message is displayed in the access window.
(Mnemonics list)
R000 AWSHOW
#1 LD R000
AWSHOW #1

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-227


AWHIDEHide the user message
being displayed in access
window

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


AWHIDE

AWHIDE
Hide the user message being
AWHIDE Hide user message
displayed in access window.

Ladder program Input mode


Execution condition AWHIDE
S A W H I D E S
EXTENDED INSTRUCTIONS

Operand Explanation Occupied size


S Specifies the ID of the user message to hide. (1 to 63) 16 bits

Description of Operation
AWHIDE The user message with the ID specified in S is hidden at the rising edge of the
execution condition.

Reference For more details about user message display, refer to "User Messages" in the User's
5 Manual of the CPU unit used.
Access Window Instructions

Point • When the execution condition is ON, no changes will be made even if the S
value is changed.
• CR that supports the user message with the ID specified at the rising edge of the
execution conditions is reset.
• When AWSHOW instruction and AWHIDE instruction are executed simultaneously,
priority will be given to the instruction that was executed afterwards within the
ladder program.
• This instruction cannot be used in interrupt programs or in the initialization
module.

Operation flag

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
CR2012 • When the S value is outside the range of 1 to 63
• When an access outside the operand range occurs
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300 When CR2012 is ON, error details are stored in CM5150 to CM5176.

5-228 - KV-8000/7000/5000/3000/1000 Series/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

Access Window Instructions

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-229


Free Operation Counter
Instruction
RFSFRCUpdate the current
value of free operation

KV-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano counter as the latest value

RFSFRC

Update the current value of


RFSFRC
RFSFRC Free operation counter
free operation counter as the
current value update
latest value.

Ladder program Input mode


Execution condition RFSFRC
EXTENDED INSTRUCTIONS

R F S F R C

Description of Operation
RFSFRC Free operation counter is updated to the latest value when the execution condition is ON.
The updated free operation counter values are as follows.
KV-8000/7500/7300 CM1030 to CM1031: 1 ms counter
CM1032 to CM1033: 10 μs counter

5
CM1034 to CM1035: 1 μs counter
CM1036 to CM1037: 0.1 μs counter
KV-5500/5000/3000, KV Nano CM708 to CM709: 1 ms counter
Free Operation Counter Instruction

Operation flag

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-8000, the transit time between two points is calculated using the latest value of the free
operation counter.
(Mnemonics list)
DR34000 RFSFRC
LD DR34000
Pass point 1 OR DR34001
RFSFRC
DR34001 LD DR34000
MOV.L CM1030 DM0
Pass point 2 LD DR34001
CAL-.L CM1030 DM0 DM2
DR34000 MOV.L
CM1030 DM0
Pass point 1
Free running counter Passing time
(1ms)
DR34001
- .L CM1030 DM0 DM2
Pass point 2
Free running counter Passing time Passing time
(1ms) at point 1

5-230 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Free Operation Counter Instruction

MEMO

EXTENDED INSTRUCTIONS
5

Free Operation Counter Instruction

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-231


Sensor Setting Instruction
SPRDSensor parameter read

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


SPRD

SPRD SPRD Sensor Reads the parameters for the


parameter read specified sensor.

Ladder program Input mode


Execution condition SPRD
n1 n2 n3 S P R D n1 n2 n3
EXTENDED INSTRUCTIONS

n4 D
n4 D

Operand Explanation Occupied size


Specifies the unit number (0 to 48, "0" is specified for KV-8000, KV-
n1 16 bits
7500 and KV-5500 units). $ cannot be used.*1
n2 Specifies the node address (1 to 256) or storage location. 16 bits
Specifies the slot number or its storage location. Specify 0 when using
n3 devices other thana slot device, or when specifying a communication 16 bits
adaptor.
n4 Specifies the parameter number or its storage location. 16 bits

5 D Specifies the result storage location.*2 16 bits × 4*3

*1 Only unit numbers of constants and FB arguments can be specified.


Sensor Setting Instruction

*2 When specifying bit data, specify the start of the channel.


*3 Depending on the read parameter type, a size of 16 bits × 5 or more is occupied.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4

Description of Operation
SPRD At the rising edge of execution condition, the parameter specified with n4 for the
sensor with node address n2 and slot number n3 connected to the n1 unit is
read. When completed, the completion bit is stored in bit 0 of D , the execution failed
bit in bit 1 of D , the completion code in D + 1, the detailed completion code in
D + 2, the number of array elements (1 when not an array) in D +3, and the
contents of the read parameter in D +4 onwards.

5-232 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Sensor Setting Instruction

D ~: Result storage destination

Result storage destination Content

EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts,
Completion and turns ON when reading of the parameters is completed.
Bit 0
bit Turns ON regardless of whether the instruction ends normally
or abnormally.
D If execution of the instruction fails, this device turns ON
Execution
Bit 1 simultaneously with the completion bit.
failed bit
This device turns OFF when execution of the instruction starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code is stored when reading of the parameters
D +1 Completion code
is completed. (Normally 0)

D +2 Detailed completion code


A detailed code is stored when reading of the parameters is 5
completed.

Sensor Setting Instruction


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 depending on the read parameter.

Point The execution will fail if an "Ethernet/IP device reserved" sensor is specified.

ON
Execution condition
OFF

ON
1 bit of D
OFF

ON
0 bit of D
OFF

Number of
Number of sensor setting executions
instruction executions (unit)
(CM1650)
D +1 0 when successful At failure

If the sensor parameter read instruction is executed at the rising edge of the execution conditions, the
process will continue even if the input conditions are turned OFF at the next scan.
The completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.
When the instruction is executed, the number of sensor setting instruction executions is incremented by
1, and is decremented when the execution finishes.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-233


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.

Scan
EXTENDED INSTRUCTIONS

ON
Execution condition
OFF

SPRD Start execution at this scan

Number of sensor setting 16 16


instruction executions One sensor setting instruction is

5 (unit) (CM1650) 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
ON when one of the following conditions is established. Otherwise, OFF.
• When the unit number specified with n1 is 49 or more
• When the unit specified by the unit number in n1 is not the EtherNet/IP unit
• When a continuous 4-word area cannot be secured from D
• When a bit other than the start of the channel is specified when bit data is specified for D
CR2012
• When the indirect specifying or index modification range is inappropriate
• When the unit specified by the unit number in n1 is not connected during the use of KV-8000/
7000 series
• When an access outside the operand range occurs.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-234 - KV-8000/7000/5000/3000/1000 Series/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

Sensor Setting Instruction


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-235


SPWRSensor parameter write

KV-8000 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

Operation Explanation Occupied size


Specifies the unit number (0 to 48, "0" is specified for KV-8000, KV-
n1 16 bits
7500 and KV-5500 units). $ cannot be used.*1
n2 Specifies the node address (1 to 256) or storage location. 16 bits
Specifies the slot number or its storage location. Specify 0 when using
n3 devices other thana slot device, or when specifying a communication 16 bits
adaptor.

5 n4
D
Specifies the parameter number or its storage location.
Specifies the result storage location.*2
16 bits
16 bits × 4*3

*1 Only unit numbers of constants and FB arguments can be specified.


Sensor Setting Instruction

*2 When specifying bit data, specify the start of the channel.


*3 Depending on the written parameter type, a size of 16 bits × 5 or more is occupied.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4

Description of Operation
SPWR At the rising edge of execution condition, the setting values set with D +4 onward are
written into the parameter specified with n4 for the sensor with node address n2
and slot number n3 connected to the n1 unit. When completed, the completion bit
is stored in bit 0 of D , the execution failed bit in bit 1 of D , the completion code in
D +1, and the detailed completion code in D +2.

5-236 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Sensor Setting Instruction

D ~: Result storage destination

Result storage destination Content

EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts,
Completion and turns ON when writing of the parameters is completed.
Bit 0
bit Turns ON regardless of whether the instruction ends normally
or abnormally.
D If execution of the instruction fails, this device turns ON
Execution
Bit 1 simultaneously with the completion bit.
failed bit
This device turns OFF when execution of the instruction starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code when parameter writing is completed is
D +1 Completion code
stored. (Normally 0)

D +2 Detailed completion code


The detailed completion code is stored when the writing of the 5
parameter is completed.

Sensor Setting Instruction


D +3 Reserved for system 0 (Fixed value)
The setting value is stored. The number of data items
D +4~ Setting value
occupied differs depending on the written parameter.

Point The execution will fail if an "Ethernet/IP device reserved" sensor (adaptor) is
specified.

ON
Execution condition
OFF

ON
1 bit of D
OFF

ON
0 bit of D
OFF

Number of
Number of sensor setting executions
instruction executions (unit)
(CM1650)

D +1 0 when successful At failure

If the sensor parameter read instruction is executed at the rising edge of the execution conditions, the
process will continue even if the input conditions are turned OFF at the next scan.
The completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.
When the instruction is executed, the number of sensor setting instruction executions is incremented by
1, and is decremented when the execution finishes.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-237


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) One sensor setting instruction is

5 (CM1650) 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
ON when one of the following conditions is established. Otherwise, OFF.
• When the unit number specified with n1 is 49 or more
• When the unit specified by the unit number in n1 is not the EtherNet/IP unit
• When a continuous 64-bit area cannot be secured from D
• When a bit other than the start of the channel is specified when bit data is specified for D
CR2012
• When the indirect specifying or index modification range is inappropriate
• When the unit specified by the unit number in n1 is not connected during the use of KV-8000/
7000 series
• When an access outside the operand range occurs.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-238 - KV-8000/7000/5000/3000/1000 Series/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

Sensor Setting Instruction


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-239


SSVC
Sensor service execution

KV-8000 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

Operand Explanation Occupied size


Specifies the unit number (0 to 48, "0" is specified for KV-8000, KV-
n1 16 bits
7500 and KV-5500 units). $ cannot be used.*1
n2 Specifies the node address (1 to 256) or storage location. 16 bits
Specifies the slot number or storage location. Specify 0 when using
n3 devices other thana slot device, or when specifying a communication 16 bits
adaptor.
n4 Specifies the service number or storage location. 16 bits

5 D Specifies the start to store the results.*2 16 bits × 4 *3

*1 Only unit numbers of constants and FB arguments can be specified.


Sensor Setting Instruction

*2 When specifying bit data, specify the start of the channel.


*3 Up to 16 bits × 6 depending on the specified service.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4

Description of Operation
SSVC At the rising edge of execution condition, the service specified with n4 for the sensor
with node address n2 and slot number n3 connected to the n1 unit is
executed. When completed, the completion bit is stored in bit 0 of D , the execution
failed bit in bit 1 of D , the completion code in D +1, and the detailed completion
code in D +2.

5-240 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Sensor Setting Instruction

D ~: Result storage destination

Result storage destination Content

EXTENDED INSTRUCTIONS
This device turns OFF when execution of the instruction starts,
Completion
Bit 0 Turns ON regardless of whether the instruction ends normally
bit
or abnormally.
If execution of the instruction fails, this device turns ON
D Execution
Bit 1 simultaneously with the completion bit.
failed bit
This device turns OFF when execution of the instruction starts.
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code is stored when execution of the service is
D +1 Completion code
completed. (Normally 0)

5
The detailed completion code is stored when execution of the
D +2 Detailed completion code
service is completed.
D +3 Reserved for system 0 (Fixed value)

Sensor Setting Instruction


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
1 bit of D
OFF

ON
0 bit of D OFF

Number of
Number of sensor setting executions
instruction executions (unit)
(CM1650)

D +1 0 when successful At failure

The sensor service execution instruction is executed at the rising edge of the execution
conditions.Theprocess continue seven if the input conditions are OFF at the net scan.
When the instruction is executed, the number of sensor setting instruction executions is incrementedby
1, and is decremented when the execution finishes.
The completion bit and failure bit of the result storage destination turn ON at completion, and turn OFF
when execution starts.

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-241


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) One sensor setting instruction is

5 (CM1650) 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
ON when one of the following conditions is established. Otherwise, OFF.
• When the unit number specified with n1 is 49 or more
• When the unit specified by the unit number in n1 is not the EtherNet/IP unit
• When a continuous 4-word area cannot be secured from D
• When a bit other than the start of the channel is specified when bit data is specified for D
CR2012
• When the indirect specifying or index modification range is inappropriate
• When the unit specified by the unit number in n1 is not connected during the use of KV-8000/
7000 series
• When an access outside the operand range occurs.
"Out-of-range access of operands", page 1-50

* The instruction is not executed when CR2012 turns ON.


KV-8000/7500/7300/5500/5000/3000 When CR2012 is ON, error details are stored in CM5150 to CM5176.
KV Nano Series When CR2012 is ON, error details are stored in CM2250 to CM2276.
"CR/CM List", page A-43

5-242 - KV-8000/7000/5000/3000/1000 Series/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

Sensor Setting Instruction


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-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-243


Cyclic Communication Refresh
Instruction
RFSCI Refresh cyclic communication
input

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


RFSCI

RFSCI(.U)
RFSCI.S

RFSCI RFSCI.D
RFSCI.L
RFSCI

RFSCI.F
Refresh cyclic Refreshes the cyclic
communication communication input
@RFSCI(.U) input data.
EXTENDED INSTRUCTIONS

@RFSCI.S

@RFSCI @RFSCI.D
@RFSCI.L
RFSCI

@RFSCI.F

Ladder program Input mode


Execution condition RFSCI
D n R F S C I D n

5
Execution condition RFSCI
D n @ R F S C I D n

Operand Explanation Occupied size


Cyclic Communication Refresh Instruction

Specifies the start for refreshing the cyclic communication input .U .S 16 bits× n
D
data.* 1*2 .D .L .F 32 bits× n
n Specifies the number of data items to refresh.* 3 —

*1 Only R, B, DM, W and the variables and labels assigned to them can be specified.
*2 When specifying bit data, specify the start of the channel.
*3 Only constants and variables / labels set as constants can be specified.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4

Description of Operation
RFSCI(.U) When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the unsigned 16-bit BIN data assigned to D .

RFSCI.S When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the signed 16-bit BIN data assigned to D .

Example Execution condition


RFSCI
DM102 #3

KV-EP21V
CPU unit Cyclic communication data
DM100 Leading word
DM101 Leading word+1
DM102 Leading word+2
DM103 Leading word+3
DM104 Leading word+4
Refresh data in Leading word+5
DM105
specified range.

5-244 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Cyclic Communication Refresh Instruction

RFSCI.D When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the unsigned 32-bit BIN data assigned to [ D / D +1].

RFSCI.L When the execution condition is ON, the cyclic communication input data specified by

EXTENDED INSTRUCTIONS
n is refreshed from the signed 32-bit BIN data assigned to [ D / D +1].

Example Execution condition


RFSCI.D
DM102 #3

KV-EP21V
CPU unit Cyclic communication data
DM101 DM100 Leading word+1 Leading word
DM103 DM102 Leading word+3 Leading word+2
DM105 DM104 Leading word+5 Leading word+4

5
DM107 DM106 Leading word+7 Leading word+6
DM109 DM108 Leading word+9 Leading word+8
DM111 DM110 Leading word+11 Leading word+10

Cyclic Communication Refresh Instruction


Refresh data in
specified range.

RFSCI.F When the execution condition is ON, the cyclic communication input data specified by
n is refreshed from the single precision floating point type real number assigned to
[ D / D +1].

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-245


Cyclic Communication Refresh 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 from the start of the cyclic communication data is guaranteed.
• Only the devices / variables assigned to the connection are refreshed.
EXTENDED INSTRUCTIONS

• Even if multiple EtherNet/IP units 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.
EtherNet/IP unit
CPU unit
Cyclic communication data

Area 1 Connection 1
Range specified with
refresh instruction code
Area 2 Connection 2

5
• If there are devices / variables which have not been assigned to the cyclic
Cyclic Communication Refresh Instruction

communication data are found in the range specified with the operand, only the
devices / variables assigned to the connection will be refreshed.
EtherNet/IP unit
CPU unit
Cyclic communication data

Area 1 Connection 1

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
RFSCI DM100 #10
Normal node 1

5-246 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Cyclic Communication Refresh Instruction

MEMO

EXTENDED INSTRUCTIONS
5

Cyclic Communication Refresh Instruction

- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-247


RFSCO
Refresh cyclic communication
output

KV-8000 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
S n R F S C O S n

Execution condition RFSCO


S n @ R F S C O S n

5 Operand Explanation Occupied size


Specifies the start for refreshing the cyclic communication output .U .S 16 bits× n
S
Cyclic Communication Refresh Instruction

data.* 1*2 .D .L .F 32 bits× n


n Specifies the number of data items to refresh.*3 —

*1 Only R, B, DM, W and the variables and labels assigned to them can be specified.
*2 When specifying bit data, specify the start of the channel.
*3 Only constants and variables / labels set as constants can be specified.

Point This instruction can be used with KV-8000/7000 Series CPU units, KV-5000/3000
Series CPU units with CPU function version 2.0 or higher and KV Nano Series base
units with CPU function version 2.0 or higher.
"KV-5000/3000 CPU Function Version", page 4
"KV Nano Series CPU Function Version", page 4

Description of Operation
RFSCO(.U) When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the unsigned 16-bit BIN data assigned to S .

RFSCO.S When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the signed 16-bit BIN data assigned to S .

Example Execution condition


RFSCO
DM102 #3

KV-EP21V
CPU unit
Cyclic communication data
DM100 Leading word
DM101 Leading word+1
DM102 Leading word+2
DM103 Leading word+3
DM104 Leading word+4
Refresh data in Leading word+5
DM105
specified range.

RFSCO.D When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the unsigned 32-bit BIN data assigned to [ S / S +1].

5-248 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


Cyclic Communication Refresh Instruction

RFSCO.L When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the signed 32-bit BIN data assigned to [ S / S +1].

Example Execution condition


RFSCO.D

EXTENDED INSTRUCTIONS
DM102 #3

32-bit refresh KV-EP21V


CPU unit Cyclic communication data

DM101 DM100 Leading word+1 Leading word


DM103 DM102 Leading word+3 Leading word+2
DM105 DM104 Leading word+5 Leading word+4
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.
5

Cyclic Communication Refresh Instruction


RFSCO.F When the execution condition is ON, the cyclic communication output data specified by
n is refreshed from the single precision floating point type real number assigned to
[ S / S +1].

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 from the start of the cyclic communication data is guaranteed.
• Only the devices / variables assigned to the connection are refreshed.
• Even if multiple EtherNet/IP units 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.
EtherNet/IP unit
CPU unit device
Cyclic communication data

Area 1 Connection 1
Range specified with
refresh instruction code
Area 2 Connection 2

• If there are devices / variables which have not been assigned to the cyclic
communication data are found in the range specified with the operand, only the
devices / variables assigned to the connection will be refreshed.
EtherNet/IP unit
CPU unit device
Cyclic communication data

Area 1 Connection 1

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.

@RFSCO.□Only one scan is executed at the rising edge of the execution conditions.
- KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual - 5-249
Cyclic Communication Refresh Instruction

Operation flag

CR2009 No change in state


CR2010 No change in state
EXTENDED INSTRUCTIONS

CR2011 No change in state


CR2012 No change in state

Sample Program
When cyclic communication is normal, ten words of cyclic communication output data assigned after
data memory DM100 is refreshed.
(Mnemonics list)
RFSCO
DM10260.0
5 Normal node 1
DM100 #10 LD DM10260.0
PSTA DM100 #10
Cyclic Communication Refresh Instruction

5-250 - KV-8000/7000/5000/3000/1000 Series/KV Nano series instruction reference manual -


APPENDICES

APPENDICES
This chapter describes instruction execution time, character code table
(ASCII), control relay/control memory table and instruction index, etc.

Arithmetic Operation Storage....................................... A-2


Operation Processing Time Table................................ A-9
CR/CM List ................................................................ A-43
Character Code Table................................................ A-97
Instruction Table Cannot be Used.............................. A-98
Index ........................................................................A-100
Instruction Index ...................................................... A-102

- KV-8000/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-40
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-44
SUB.D 32-bit internal register - S+1 S = 32-bit internal register
SUB.L Upper Lower Upper Lower Upper Lower
Arithmetic Operation Storage

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

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

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-66
32-bit internal register 32-bit internal register
ROOT.F
Single precision floating point type real number Single precision floating point type real number

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-8000/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-8000/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-8000/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-8000/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-8000/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-8000/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-8000/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-8000/7000 Series, if one of the devices below is specified in S instead of
DM, the processing time differs.
Destination device Difference in processing time
R, MR, LR, B, VB, TM -0.002 (µs)
EM,FM,ZF,W,VM +0.041 (µs)

Operation 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-8000 (µs) KV-7500/7300 (µs) KV-5500/5000/3000 (µs) KV-1000 (µs) KV Nano Series (µs)
0.018 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-8000 KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
(µs) (µs) (µs) (µs) Series (µs)
Index Source 0.006 0.006 0.010 0.025 0.350
modification Destination 0.006 0.006 0.010 0.025 0.550
Indirect Source 0.016 0.016 0.080 to 0.100 0.175 0.900
specifying Destination 0.016 0.016 0.120 to 0.140 0.250 to 0.300 1.300

■Check for out-of-range access of operands


When specifying operands that are checked for out-of-range access in KV-8000 of CPU function
version 2.0 or later, add the following time.
KV-8000〔µs〕
0.050

■Specification of array subscript


When the subscript of the array variable specified in an operand in KV-8000 of CPU function version
2.0 or later is other than a constant, add the following time.
KV-8000〔µs〕
0.100

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


Operation Processing Time Table

■IN-OUT argument of function block


When a BOOL type (also including bit specification of word data) IN-OUT argument is specified to an
operand in KV-8000 of CPU function version 2.0 or later, add the following time.
KV-8000〔µs〕
0.100

■ Operation error
When either of the settings is configured in "CPU system setting*" → "the action when an error occurs in setting ",
processing time increases when the instruction to detect the error (manipulate CR2012) is executed.
• "Calculation error " is assigned to " Continue (low level error)"
• "Keep in error log" is configured
APPENDICES

Processing time (µs)


Condition
KV-8000 KV-7500/7300 KV-5500/5000/3000/1000 KV Nano Series
In the event of absence of
0.003 0.003 0.020 0.500
operation error
In the event of occurrence of
2.948 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
Operation Processing Time Table

log" is configured. In these cases, CR2012 operates according to the specification for each instruction.
"KV Studio User's Manual "CPU system setting""

■ Specify word device bit


KV-8000/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-8000 (μs) KV-7500/7300 (μs) KV-5500/5000/3000 (μs) KV Nano Series (μs)
Source/Destination 0.006 0.006 0.010 to 0.020 0.050

■ Direct I/O
KV-8000/7500/7300/5500/5000/3000, KV Nano Series For direct I/O, the standards of added processing time are
shown below.
Condition KV-8000 (μs) KV-7500/7300 (μs) KV-5500/5000/3000 (μs) KV Nano Series (μs)
Source 0.734 0.734 5.400 0.600
Destination 0.682 0.682 4.700 0.600
The processing time of the instructions is as follows. The processing time varies within ±30%.

Basic Instructions

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
KV-8000 7300 5000/3000 KV-1000 Series
LD/LDB - 0.00096 0.00096 0.010 0.025 0.050
AND/ANB – 0.00096 0.00096 0.010 0.025 0.065
OR/ORB – 0.00096 0.00096 0.010 0.025 0.065
LDP/LDF – 0.009 0.009 0.030 0.225 0.620
ANP/ANF – 0.009 0.009 0.040 0.250 0.580
ORP/ORF – 0.009 0.009 0.040 0.250 0.680
LDPB/LDFB – 0.009 0.009 0.040 – 0.620
A-10 - KV-8000/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
KV-8000 KV-1000
7300 5000/3000 Series
ANPB/ANFB – 0.010 0.010 0.050 – 0.580
ORPB/ORFB – 0.010 0.010 0.050 – 0.670
BLD/BLDB .U.D 0.009 0.009 0.080 0.150 1.400
BAND/BANB .U.D 0.009 0.009 0.080 0.150 1.300
BOR/BORB .U.D 0.009 0.009 0.080 0.150 1.300
LD= .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.740 – 4.100

APPENDICES
LD< .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.120 0.300 0.300
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 4.100
LD> .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 3.800
LD<= .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.120 0.300 0.160

Operation Processing Time Table


.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 4.100

- KV-8000/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 Nano
KV-8000 KV-1000
7300 5000/3000 Series
LD>= .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 4.000
LD<> .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.120 0.300 0.160
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.740 – 4.100
AND= .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.250
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.400
APPENDICES

.DF S1 =DM, S2 = Constant 0.081 0.081 0.730 – 3.900


AND< .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.150 0.325 0.250
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.500
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 3.900
AND> .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.250
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 3.800
Operation Processing Time Table

AND<= .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.150 0.325 0.250


.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 3.800
AND>= .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.250
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.081 0.081 0.980 – 3.800
AND<> .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.160
.F S1 =DM, S2 = Constant 0.064 0.064 0.530 0.875 2.400
.DF S1 =DM, S2 = Constant 0.081 0.081 0.740 – 3.800
OR= .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.061 0.061 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.078 0.078 0.740 – 3.900
OR< .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.061 0.061 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.078 0.078 0.980 – 3.900
OR> .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.061 0.061 0.520 0.850 2.500
.DF S1 =DM, S2 = Constant 0.078 0.078 0.980 – 3.800
OR<= .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.061 0.061 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.078 0.078 0.980 – 3.900
OR>= .U.S.D.L S1 =DM, S2 = Constant 0.015 0.015 0.150 0.325 0.260
.F S1 =DM, S2 = Constant 0.061 0.061 0.520 0.850 2.400
.DF S1 =DM, S2 = Constant 0.078 0.078 0.980 – 3.800
OR<> .U.S.D.L S1 =DM, S2 = Constant 0.012 0.012 0.150 0.325 0.140
.F S1 =DM, S2 = Constant 0.061 0.061 0.520 0.850 2.300
.DF S1 =DM, S2 = Constant 0.078 0.078 0.730 – 3.900
OUT/OUB – 0.003 0.003 0.010 0.025 0.050

A-12 - KV-8000/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
KV-8000 KV-1000
7300 5000/3000 Series
SET/RES – Execution condition is ON 0.003 0.003 0.010 0.025 0.070
Execution condition is OFF 0.003 0.003 0.010 0.025 0.070
KEEP – 0.021 0.021 0.080 0.200 2.800
DIFU – Execution condition is ON 0.018 0.018 0.070 0.350 3.200
Execution condition is OFF 0.018 0.018 0.070 0.350 3.000
DIFD – Execution condition is ON 0.024 0.024 0.100 0.425 3.200
Execution condition is OFF 0.024 0.024 0.100 0.425 3.000
ONDL – Execution condition is ON 0.081 0.081 0.840 1.650 4.800

APPENDICES
Execution condition is OFF 0.075 0.075 0.670 1.250 4.000
OFDL – Execution condition is ON 0.090 0.090 0.830 1.725 4.900
Execution condition is OFF 0.087 0.087 0.720 1.275 2.900
SHOT – Execution condition is ON 0.147 0.147 0.860 2.225 6.900
Execution condition is OFF 0.136 0.136 0.840 1.900 6.400
FLIK – Execution condition is ON 0.154 0.154 0.800 2.000 5.500
Execution condition is OFF 0.107 0.107 0.810 1.550 7.100

Operation Processing Time Table


ALT – Execution condition is ON 0.064 0.064 0.530 1.125 3.500
Execution condition is OFF 0.064 0.064 0.460 1.050 3.200
BOUT .U.D 0.009 0.009 0.080 0.150 1.700
BOUB .U.D 0.015 0.015 0.130 0.275 1.700
BSET .U.D Execution condition is ON 0.012 0.012 0.080 0.150 1.700
Execution condition is OFF 0.009 0.009 0.030 0.100 0.250
BRES .U.D Execution condition is ON 0.012 0.012 0.080 0.150 1.700
Execution condition is OFF 0.009 0.009 0.030 0.100 0.250
TMR – S = Constant 0.045 0.045 0.350 1.175 0.720
S = Constant, Execution 0.045 0.045 0.150 1.550 0.730
condition is OFF
TMH – S = Constant 0.045 0.045 0.350 1.175 0.720
S = Constant, Execution 0.045 0.045 0.150 1.550 0.730
condition is OFF
TMS – S = Constant 0.045 0.045 0.360 1.175 0.720
S = Constant, Execution 0.045 0.045 0.160 1.550 0.730
condition is OFF
TMU – S = Constant 0.045 0.045 0.780 – 0.720
S = Constant, Execution 0.045 0.045 0.680 – 0.730
condition is OFF
C – S = Constant 0.051 0.051 0.320 1.900 0.620
S = Constant, Execution 0.051 0.051 0.170 1.525 0.640
condition is OFF
OUTC – S = Constant 0.036 0.036 0.270 1.900 0.480
S = Constant, Execution 0.036 0.036 0.120 1.875 0.490
condition is OFF
ITVL – S = Constant 0.230 0.230 1.670 3.325 20.400
UDC – S = Constant 0.115 0.115 1.110 2.750 3.700
UDT – S = Constant 0.133 0.133 1.110 2.650 5.000

- KV-8000/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 Nano
KV-8000 KV-1000
7300 5000/3000 Series
END – 0.000 0.000 0.000 0.000 0.000
ENDH – 0.000 0.000 0.000 0.000 0.000
CON – 0.000 0.000 0.000 0.000 0.000
MPS – 0.003 0.003 0.010 0.025 0.070
MRD – 0.003 0.003 0.010 0.025 0.070
MPP – 0.003 0.003 0.010 0.025 0.080
ANL – 0.003 0.003 0.010 0.025 0.090
ORL – 0.003 0.003 0.010 0.025 0.100
INV – 0.003 0.003 0.010 – 0.020
APPENDICES

MEP – 0.006 0.006 0.020 – 0.860


MEF – 0.009 0.009 0.040 – 0.970
RFSX – n = #16 0.875*1 0.875*1 5.800 – 3.800
Execution condition is OFF 0.012 0.012 0.030 – 0.360
RFSY – n =#16 0.910*1 0.910*1 5.600 – 3.200
Execution condition is OFF 0.012 0.012 0.030 – 0.350
* When the target is an expansion unit for KV-5000/3000 series, RFSX command: 3.751, RFSY command:
Operation Processing Time Table

3.190

Applied Instructions

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
KV-8000 KV-1000
7300 5000/3000 Series
SFT – 1ch 0.541 0.541 2.020 6.100 22.600
1ch, clock input is OFF 0.087 0.087 0.400 0.750 12.500
100ch 41.507 41.507 146.020 446.100 354.600
100ch, clock input is OFF 0.087 0.087 0.400 0.750 12.400
MEMSW – − − – 0.000 −
STP to STE At the time of non-execution 0.047 0.047 0.290 0.425 1.100
STP – 0.044 0.044 0.110 0.225 1.200
STE – 0.000 0.000 0.000 0.000 0.000
STG to JMP – At the time of non-execution 0.044 0.044 0.320 0.625 0.630
STG to ENDS – At the time of non-execution 0.044 0.044 0.320 0.600 0.740
STG – 0.031 0.031 1.740 3.525 0.690
JMP – 0.041 0.041 0.170 0.375 0.570
ENDS – 0.034 0.034 0.150 0.400 0.500
W-ON – Execution condition is ON 0.023 0.023 0.170 0.500 1.700
Execution condition is OFF 0.023 0.023 0.170 0.450 1.700
W-OFF – Execution condition is ON 0.023 0.023 0.180 0.525 1.700
Execution condition is OFF 0.023 0.023 0.180 0.475 1.700
W-UE – Execution condition is ON 0.081 0.081 0.640 1.400 3.100
Execution condition is OFF 0.081 0.081 0.640 1.350 2.500

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


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition
KV-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
W-DE – Execution condition is ON 0.081 0.081 0.640 1.400 3.000
Execution condition is OFF 0.081 0.081 0.640 1.350 2.500
MC – 0.009 0.009 0.030 0.025 0.380
MCR – 0.003 0.003 0.010 0.025 0.190
CALL – At the time of non-execution 0.018 0.018 0.050 0.075 0.440
At the time of execution 0.129 0.150 0.550 1.100 1.400
SBN – 0.000 0.000 0.000 0.000 0.000
RET – 0.094 0.109 0.550 1.100 0.900

APPENDICES
ECALL – At the time of non-execution 0.021 0.021 0.090 – 0.240
At the time of execution 0.196 0.287 1.830 – 7.600
FOR to NEXT .U.D S =#1 0.150 0.150※1 1.770 2.875 3.900
S =#1000 43.213 43.213 352.000 700.000 260.500
BREAK – Execution condition is ON 0.161 0.161 0.520 0.750 3.600
Execution condition is OFF 0.023 0.023 0.060 0.075 0.480
CJ – At the time of non-execution 0.035 0.035 0.090 0.175 0.230

Operation Processing Time Table


At the time of execution 0.061 0.061 0.500 0.725 0.780
(branch)
NCJ – At the time of non-execution 0.038 0.038 0.120 0.175 0.240
At the time of execution 0.064 0.064 0.530 0.725 0.780
(branch)
GOTO – 0.064 0.064 0.520 0.750 0.780
LABEL – 0.000 0.000 0.000 0.000 0.000
SCJ – At the time of non-execution 0.055 0.055 0.190 – 0.750
At the time of execution 0.081 0.081 0.600 – 1.400
MCALL – Argument 0: At the time of 0.904 1.170 1.420 5.920 13.200
execution
Argument 10: At the time of 1.423 1.802 2.230 7.520 15.500
execution (device 5, value 5)
MSTRT – Argument 0: At the time of 0.918 1.184 1.450 6.160 14.300
execution
Argument 10: At the time of 1.436 1.816 2.080 7.840 16.600
execution (device 5, value 5)
MEND – 0.016 0.016 0.020 0.075 0.200
FB – Argument 0: At the time of 0.979 1.210
execution
Argument 10: At the time of 1.272 1.593
execution (IN5, IN-OUT 5)
FEND – 0.010 0.010
FUN – Argument 0: At the time of 0.960*3 0.964
execution
Argument 10: At the time of 1.411*3 1.299
execution (IN5, IN-OUT 5)
MDSTRT – 0.012 0.012 0.020 0.075 1.500
MDSTOP – 0.012 0.012 0.020 0.075 1.500
ZPUSH .S Execution condition is ON 0.205 0.205 1.120 1.675 6.300
Execution condition is OFF 0.012 0.012 0.100 0.225 0.380
.L Execution condition is ON 0.239 0.239 1.240 – 7.000
Execution condition is OFF 0.012 0.012 0.100 – 0.390

- KV-8000/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-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
ZPOP .S Execution condition is ON 0.236 0.236 1.540 2.125 8.800
Execution condition is OFF 0.012 0.012 0.040 0.225 0.390
.L Execution condition is ON 0.305 0.305 2.080 – 9.700
Execution condition is OFF 0.012 0.012 0.040 – 0.390

ADRSET – Other than TC 0.006 0.006 0.020 0.050 1.400


Other than TC, Execution 0.006 0.006 0.020 0.050 0.090
condition is OFF
TC 0.015 0.015 0.050 0.150 1.400
TC, Execution condition is 0.015 0.015 0.050 0.150 0.130
APPENDICES

OFF
ADRINC – Execution condition is ON 0.029 0.029 0.090 0.225 1.400
Execution condition is OFF 0.021 0.021 0.070 0.225 0.100
ADRDEC – Execution condition is ON 0.029 0.029 0.090 0.225 1.700
Execution condition is OFF 0.021 0.021 0.070 0.225 0.100
ADRADD .S Execution condition is ON 0.040 0.040 0.100 0.350 1.900
Execution condition is OFF 0.035 0.035 0.100 0.300 0.240
Operation Processing Time Table

.L Execution condition is ON 0.040 0.040 0.120 – 1.800


Execution condition is OFF 0.035 0.035 0.120 – 0.100
ADRSUB .S Execution condition is ON 0.043 0.043 0.120 0.375 1.900
Execution condition is OFF 0.038 0.038 0.120 0.350 0.240
.L Execution condition is ON 0.043 0.043 0.130 – 1.800
Execution condition is OFF 0.038 0.038 0.130 – 0.100
FRSET – Execution condition is ON 2.569 2.569 10.400 – –
Execution condition is OFF 0.032 0.032 0.090 – –
FRSTM – At the rising edge of execution 1.875 1.875 1.030 – –
condition
Execution condition is OFF 0.179 0.179 0.850 – –
FRLDM – At the rising edge of execution 1.863 1.863 1.030 – –
condition
Execution condition is OFF 0.179 0.179 0.850 – –
UPSTRT – At the rising edge of execution 4.929 8.425 – – –
condition
Execution condition is OFF 0.438 0.438 – – –
UPSTOP – At the rising edge of execution 4.618 7.449 – – –
condition
Execution condition is OFF 0.265 0.265 – – –
UFSUS – At the rising edge of execution 4.625 7.471 – – –
condition
Execution condition is OFF 0.268 0.268 – – –
UFRSM – At the rising edge of execution 4.607 7.449 – – –
condition
Execution condition is OFF 0.265 0.265 – – –
UMALLOC – At the rising edge of execution 4.700 8.039 – – –
condition
Execution condition is OFF 0.216 0.216 – – –

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


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition
KV-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
UREAD .U.S.D.L.F 1 word (expansion unit) 1.172*2 1.172*2 7.000 – 52.000
1000 words (expansion unit) 39.118*2 39.118*2 332.000 – 499.000
1 word (CPU Ethernet/FL-net) 4.013 4.013 19.100 – –
1000 words (CPU Ethernet/ 114.613 114.613 400.000 – –
FL-net)
At the time of non-execution 0.021 0.021 0.070 – 0.290
UWRIT .U.S.D.L.F 1 word (expansion unit) 1.199*2 1.199*2 7.800 – 42.000
1000 words (expansion unit) 40.635*2 40.635*2 383.000 – 420.000
1 word (CPU Ethernet/FL-net) 3.992 3.992 21.380 – –

APPENDICES
1000 words (CPU Ethernet/ 125.631 125.631 400.000 – –
FL-net)
At the time of non-execution 0.021 0.021 0.070 – 0.290
UFILL .U.S.D.L.F 1 word (expansion unit) 1.155*2 1.155*2 7.300 – 31.000
1000 words (expansion unit) 36.272*2 36.272*2 375.000 – 424.000
1 word (CPU Ethernet/FL-net) 2.357 2.357 17.750 – –
1000 words (CPU Ethernet/ 68.098 68.098 116.380 – –

Operation Processing Time Table


FL-net)
At the time of non-execution 0.018 0.018 0.090 – 0.290

ACNT − When the execution 0.014 − − − −


condition is ON
When the execution condition 0.014 − − − −
is OFF
WSIZE − When the execution 0.017 − − − −
condition is ON
When the execution condition 0.017 − − − −
is OFF
BSIZE − When the execution 0.017 − − − −
condition is ON
When the execution condition 0.017 − − − −
is OFF
*1 For CPU function version 2.1 or earlier, the processing time is shown below.
When FOR to NEXT command S = #1: 0.308, S = #1000: 106.525
*2 The processing time when an expansion unit for KV-5000/3000 series is used is as follows.
UREAD command For 1 word: 4.665, For 1000 word: 285.781
UWRIT command For 1 word: 5.033, For 1000 word: 353.824
UFILL command For 1 word: 4.972, For 1000 word: 348.964
*3 The processing time is as follows when the CPU function version is 2.0 or lower.
Argument 0: 0.673 at execution, Argument 10: 1.121 at execution (IN5, IN-OUT5)

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


Operation Processing Time Table

Arithmetic Operation Instructions

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV-1000 KV Nano
KV-8000
7300 5000/3000 Series
MOV .U.S Execution condition is ON 0.012 0.012 0.090 0.150 0.170
Execution condition is OFF 0.006 0.006 0.020 0.075 0.180
.D.L.F Execution condition is ON 0.012 0.012 0.090 0.150 0.270
Execution condition is OFF 0.006 0.006 0.020 0.075 0.270
.DF Execution condition is ON 0.038 0.038 0.290 – 1.400
Execution condition is OFF 0.032 0.032 0.170 – 0.250
APPENDICES

LDA .U.S DM is specified 0.012 0.012 0.090 0.150 0.140


DM is specified, Execution 0.006 0.006 0.020 0.075 0.290
condition is OFF
Constant is specified 0.006 0.006 0.020 0.050 0.150
Constant is specified, Execution 0.006 0.006 0.020 0.050 0.150
condition is OFF
.D.L DM is specified 0.012 0.012 0.090 0.150 0.160
DM is specified, Execution 0.006 0.006 0.020 0.075 0.290
Operation Processing Time Table

condition is OFF
Constant is specified 0.006 0.006 0.020 0.050 0.160
Constant is specified, Execution 0.006 0.006 0.020 0.050 0.150
condition is OFF
.F DM is specified 0.015 0.015 0.100 0.175 0.160
DM is specified, Execution 0.009 0.009 0.030 0.100 0.200
condition is OFF
Constant is specified 0.009 0.009 0.040 0.100 0.260
Constant is specified, Execution 0.009 0.009 0.020 0.050 0.240
condition is OFF
.DF DM is specified 0.029 0.029 0.280 – 1.200
DM is specified, Execution 0.026 0.026 0.130 – 0.210
condition is OFF
Constant is specified 0.029 0.029 0.180 – 1.000
Constant is specified, Execution 0.029 0.029 0.130 – 0.250
condition is OFF
STA .U.S Execution condition is ON 0.003 0.003 0.010 0.025 0.110
Execution condition is OFF 0.003 0.003 0.010 0.025 0.120
.D.L.F Execution condition is ON 0.003 0.003 0.010 0.025 0.030
Execution condition is OFF 0.003 0.003 0.010 0.025 0.130
.DF Execution condition is ON 0.035 0.035 0.250 – 0.770
Execution condition is OFF 0.029 0.029 0.180 – 0.390
PLDA .U Execution condition is ON 0.029 0.029 0.150 – 1.600
Execution condition is OFF 0.029 0.029 0.100 – 0.250
.D Execution condition is ON 0.032 0.032 0.160 – 1.600
Execution condition is OFF 0.032 0.032 0.110 – 0.250
PSTA .U Execution condition is ON 0.038 0.038 0.180 – 1.700
Execution condition is OFF 0.038 0.038 0.130 – 0.250
.D Execution condition is ON 0.041 0.041 0.190 – 2.000
Execution condition is OFF 0.041 0.041 0.140 – 0.250
TMIN – Execution condition is ON 0.023 0.023 0.130 0.250 −
Execution condition is OFF 0.018 0.018 0.060 0.175 −

A-18 - KV-8000/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
KV-8000
7300 5000/3000 Series
DW .U.S Execution condition is ON 0.006 0.006 0.020 0.050 0.130
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.D.L.F Execution condition is ON 0.006 0.006 0.030 0.075 0.180
Execution condition is OFF 0.006 0.006 0.030 0.075 0.140
.DF Execution condition is ON 0.041 0.041 0.190 – 1.100
Execution condition is OFF 0.035 0.035 0.170 – 0.270
BMOV .U n =#1 0.153 0.153 0.980 2.025 10.200
n =#1, Execution condition 0.012 0.012 0.060 0.150 0.250
is OFF

APPENDICES
n =#1000 30.675 30.675 81.420 184.7 89.200
n =#1000, Execution 0.012 0.012 0.060 0.150 0.250
condition is OFF
.D n =#1 0.153 0.153 0.980 2.025 10.500
n =#1, Execution condition 0.012 0.012 0.060 0.150 0.250
is OFF
n =#1000 32.116 32.116 133.960 275.900 169.700
n =#1000, Execution 0.012 0.012 0.060 0.150 0.250

Operation Processing Time Table


condition is OFF
FMOV .U n =#1 0.118 0.118 0.760 1.350 9.600
n =#1, Execution condition 0.015 0.015 0.060 0.150 0.250
is OFF
n =#1000 4.177 4.177 33.070 53.100 128.700
n =#1000, Execution 0.015 0.015 0.060 0.150 0.250
condition is OFF
.D n =#1 0.110 0.110 0.760 1.350 9.600
n =#1, Execution condition 0.012 0.012 0.060 0.150 0.250
is OFF
n =#1000 7.606 7.606 65.810 105.800 247.900
n =#1000, Execution 0.012 0.012 0.060 0.150 0.250
condition is OFF
.DF n =#1 0.104 0.104 0.780 – 8.400
n =#1, Execution condition 0.018 0.018 0.090 – 0.250
is OFF
n =#1000 0.018 0.018 117.90 – 176.200
n =#1000, Execution 0.018 0.018 0.090 – 0.250
condition is OFF
PMOV .U Execution condition is ON 0.150 0.150 0.810 1.525 0.250
Execution condition is OFF 0.029 0.029 0.100 0.275 0.250
.D Execution condition is ON 0.142 0.142 0.780 1.500 0.250
Execution condition is OFF 0.026 0.026 0.090 0.250 0.250
BYLMOV – n =#1 0.503 0.503 2.690 – 15.100
n =#1, Execution condition 0.018 0.018 0.080 – 0.260
is OFF
n =#1000 15.606 15.606 42.890 – 124.500
n =#1000, Execution 0.018 0.018 0.080 – 0.260
condition is OFF

- KV-8000/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-1000 KV Nano
KV-8000
7300 5000/3000 Series
BYBMOV – n =#1 0.503 0.503 2.690 – 12.300
n =#1, Execution condition 0.018 0.018 0.080 – 0.260
is OFF
n =#1000 15.605 15.605 42.890 – 75.400
n =#1000, Execution 0.018 0.018 0.080 – 0.260
condition is OFF
BBMOV n =#1 0.273 – – – –
n =#1, Execution condition 0.040 – – – –
is OFF
n =#1000 1.358 – – – –
APPENDICES

n =#1000, Execution 0.040 – – – –


condition is OFF
ADD .U.S S = Constant 0.006 0.006 0.020 0.050 0.130
S = Constant, Execution 0.006 0.006 0.020 0.050 0.170
condition is OFF
.D.L S = Constant 0.006 0.006 0.020 0.050 0.090
S = Constant, Execution 0.006 0.006 0.020 0.050 0.170
condition is OFF
Operation Processing Time Table

.F S = Constant 0.032 0.032 0.110 0.275 2.000


S = Constant, Execution 0.032 0.032 0.110 0.275 0.290
condition is OFF
.DF S = Constant 0.058 0.058 2.100 – 2.600
S = Constant, Execution 0.055 0.055 0.050 – 0.390
condition is OFF
SUB .U.S S = Constant 0.006 0.006 0.020 0.050 0.150
S = Constant, Execution 0.006 0.006 0.020 0.050 0.170
condition is OFF
.D.L S = Constant 0.006 0.006 0.040 0.100 0.130
S = Constant, Execution 0.006 0.006 0.040 0.100 0.200
condition is OFF
.F S = Constant 0.032 0.032 0.110 0.275 2.000
S = Constant, Execution 0.032 0.032 0.110 0.275 0.290
condition is OFF
.DF S = Constant 0.058 0.058 2.020 – 2.700
S = Constant, Execution 0.055 0.055 0.060 – 0.390
condition is OFF
MUL .U.S S = Constant 0.015 0.015 0.040 0.100 0.140
S = Constant, Execution 0.015 0.015 0.040 0.100 0.170
condition is OFF
.D.L S = Constant 0.029 0.029 0.110 0.275 0.170
S = Constant, Execution 0.029 0.029 0.100 0.250 0.190
condition is OFF
.F S = Constant 0.044 0.044 0.130 0.325 2.000
S = Constant, Execution 0.044 0.044 0.130 0.325 0.290
condition is OFF
.DF S = Constant 0.072 0.072 1.570 – 2.600
S = Constant, Execution 0.069 0.069 0.050 – 0.390
condition is OFF

A-20 - KV-8000/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
KV-8000
7300 5000/3000 Series
DIV .U.S S = Constant 0.072 0.072 0.170 0.450 0.500
S = Constant, Execution 0.072 0.072 0.170 0.450 0.190
condition is OFF
.D S = Constant 0.084 0.084 0.320 0.825 4.100
S = Constant, Execution 0.081 0.081 0.320 0.825 0.200
condition is OFF
.L S = Constant 0.084 0.084 0.480 1.225 4.600
S = Constant, Execution 0.081 0.081 0.320 0.825 0.200
condition is OFF
.F S = Constant 0.107 0.107 0.370 0.925 2.000

APPENDICES
S = Constant, Execution 0.107 0.107 0.370 0.925 0.290
condition is OFF
.DF S = Constant 0.136 0.136 2.860 – 2.800
S = Constant, Execution 0.133 0.133 0.050 – 0.390
condition is OFF
INC .U.S.D.L Execution condition is ON 0.026 0.026 0.130 0.250 0.380
Execution condition is OFF 0.018 0.018 0.060 0.200 0.190
DEC .U.S.D.L Execution condition is ON 0.026 0.026 0.130 0.250 0.290

Operation Processing Time Table


Execution condition is OFF 0.018 0.018 0.060 0.200 0.090
ROOT .U.S Execution condition is ON 0.788 0.788 2.830 6.700 4.300
Execution condition is OFF 0.006 0.006 0.020 0.050 0.140
.D Execution condition is ON 1.523 1.523 5.210 12.650 11.100
Execution condition is OFF 0.006 0.006 0.020 0.050 0.150
.L Execution condition is ON 1.529 1.529 5.230 12.680 11.400
Execution condition is OFF 0.006 0.006 0.020 0.050 0.150
.F Execution condition is ON 0.763 0.763 3.250 7.725 4.900
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 1.176 1.176 8.100 – 5.200
Execution condition is OFF 0.006 0.006 0.030 – 0.150
POW .U Execution condition is ON 0.164 0.164 1.370 – 7.000
Execution condition is OFF 0.006 0.006 0.020 – 0.400
.S Execution condition is ON 0.184 0.184 1.520 – 7.000
Execution condition is OFF 0.006 0.006 0.020 – 0.400
.D Execution condition is ON 0.207 0.207 2.010 – 10.500
Execution condition is OFF 0.006 0.006 0.020 – 0.400
.L Execution condition is ON 0.268 0.268 2.220 – 13.100
Execution condition is OFF 0.006 0.006 0.020 – 0.400
.F Execution condition is ON 3.067 6.529 9.500 – 43.200
Execution condition is OFF 0.006 0.006 0.050 – 0.380
.DF Execution condition is ON 3.626 7.618 15.500 – 44.200
Execution condition is OFF 0.012 0.012 0.070 – 0.080

- KV-8000/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-1000 KV Nano
KV-8000
7300 5000/3000 Series
CMP .U.S.D.L Execution condition is ON 0.012 0.012 0.020 0.050 0.220
Execution condition is OFF 0.006 0.006 0.020 0.050 0.210
.F Execution condition is ON 0.023 0.023 0.070 0.150 2.700
Execution condition is OFF 0.018 0.018 0.070 0.175 0.380
.DF Execution condition is ON 0.041 0.041 0.800 – 3.600
Execution condition is OFF 0.036 0.036 0.050 – 0.080
ZCMP .U.S.D.L Execution condition is ON 0.078 0.078 0.630 1.075 1.700
Execution condition is OFF 0.015 0.015 0.050 0.175 0.240
APPENDICES

.F Execution condition is ON 0.107 0.107 0.730 1.525 6.500


Execution condition is OFF 0.015 0.015 0.050 0.175 0.260
.DF Execution condition is ON 0.156 0.156 1.450 – 8.700
Execution condition is OFF 0.033 0.033 0.110 – 0.350
ANDA .U.D S = Constant 0.006 0.006 0.020 0.050 0.960
S = Constant, Execution 0.006 0.006 0.020 0.050 0.090
condition is OFF
ORA .U.D S = Constant 0.006 0.006 0.020 0.050 1.000
Operation Processing Time Table

S = Constant, Execution 0.006 0.006 0.020 0.050 0.090


condition is OFF
EORA .U.D S = Constant 0.006 0.006 0.020 0.050 0.960
S = Constant, Execution 0.006 0.006 0.020 0.050 0.090
condition is OFF
ENRA .U.D S = Constant 0.009 0.009 0.030 0.075 1.000
S = Constant, Execution 0.009 0.009 0.030 0.075 0.090
condition is OFF
COM .U.D Execution condition is ON 0.006 0.006 0.020 0.050 0.140
Execution condition is OFF 0.006 0.006 0.020 0.050 0.140
NEG .U.S.D.L. Execution condition is ON 0.003 0.003 0.010 0.025 0.130
F
Execution condition is OFF 0.003 0.003 0.010 0.025 0.130
.DF Execution condition is ON 0.021 0.021 0.180 – 0.130
Execution condition is OFF 0.015 0.015 0.110 – 0.140
SRA .U.D Execution condition is ON 0.006 0.006 0.020 0.050 1.400
Execution condition is OFF 0.006 0.006 0.020 0.050 0.370
SLA .U.D Execution condition is ON 0.006 0.006 0.020 0.050 1.400
Execution condition is OFF 0.006 0.006 0.020 0.050 0.370
ASRA .U.D Execution condition is ON 0.006 0.006 0.020 – 1.300
Execution condition is OFF 0.006 0.006 0.020 – 0.300
.S Execution condition is ON 0.018 0.018 0.060 – 1.400
Execution condition is OFF 0.018 0.018 0.060 – 0.370
.L Execution condition is ON 0.021 0.021 0.070 – 1.300
Execution condition is OFF 0.021 0.021 0.070 – 0.300
ASLA .U.S.D.L Execution condition is ON 0.006 0.006 0.020 – 0.300
Execution condition is OFF 0.006 0.006 0.020 – 0.300
RRA .U.D Execution condition is ON 0.012 0.012 0.040 0.100 3.000
Execution condition is OFF 0.012 0.012 0.040 0.100 0.300
RLA .U.D Execution condition is ON 0.012 0.012 0.040 0.100 3.200
Execution condition is OFF 0.012 0.012 0.040 0.100 0.300

A-22 - KV-8000/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
KV-8000
7300 5000/3000 Series
RRNCA .U.D Execution condition is ON 0.012 0.012 0.040 0.100 1.900
Execution condition is OFF 0.012 0.012 0.040 0.100 0.280
RLNCA .U.D Execution condition is ON 0.006 0.006 0.020 0.050 1.900
Execution condition is OFF 0.006 0.006 0.020 0.050 0.280
WSR .U n1 =#1, n2 =#1 0.202 0.202 1.180 2.175 16.900
n1 =#1000, n2 =#1000 34.771 34.771 114.560 263.525 187.600
Execution condition is OFF 0.012 0.012 0.060 0.150 0.450
.D n1 =#1, n2 =#1 0.190 0.190 1.140 2.075 16.900
n1 =#1000, n2 =#1000 39.639 39.639 202.450 377.850 365.400

APPENDICES
Execution condition is OFF 0.012 0.012 0.060 0.150 0.460

Operation Processing Time Table

- KV-8000/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-1000 KV Nano
KV-8000
7300 5000/3000 Series
WSL .U n1 =#1, n2 =#1 0.173 0.173 1.080 1.950 17.500
n1 =#1000, n2 =#1000 34.833 34.833 118.170 263.300 188.200
Execution condition is OFF 0.012 0.012 0.060 0.150 0.450
.D n1 =#1, n2 =#1 0.173 0.173 1.090 1.950 17.500
n1 =#1000, n2 =#1000 39.618 39.618 202.560 376.275 365.900
Execution condition is OFF 0.012 0.012 0.060 0.150 0.460
BSR .U.D n1 =#1, n2 =#1 0.147 0.147 0.980 1.675 13.900
n1 =#1000, n2 =#1000 12.894 12.894 54.740 173.300 229.200
Execution condition is OFF 0.012 0.012 0.060 0.150 0.480
APPENDICES

BSL .U.D n1 =#1, n2 =#1 0.133 0.133 0.940 1.600 14.800


n1 =#1000, n2 =#1000 13.637 13.637 54.710 173.225 215.200
Execution condition is OFF 0.012 0.012 0.060 0.150 0.480
LIMIT .U.S.D.L Execution condition is ON 0.110 0.110 0.720 – 2.100
Execution condition is OFF 0.021 0.021 0.070 – 0.260
BANDC .S Execution condition is ON 0.110 0.110 0.860 – 1.900
Execution condition is OFF 0.070 –
Operation Processing Time Table

0.021 0.021 0.260


.L Execution condition is ON 0.110 0.110 0.720 – 2.100
Execution condition is OFF 0.021 0.021 0.070 – 0.260
ZONE .S Execution condition is ON 0.121 0.121 0.770 – 2.300
Execution condition is OFF 0.021 0.021 0.070 – 0.250
.L Execution condition is ON 0.118 0.118 0.770 – 2.100
Execution condition is OFF 0.021 0.021 0.070 – 0.250
APR .U.S MIN search 0.224 0.224 1.190 – 13.500
MAX search 1.197 1.197 4.790 – 31.700
Execution condition is OFF 0.015 0.015 0.070 – 0.260
.D MIN search 0.225 0.225 1.220 – 14.800
MAX search 1.152 1.152 4.170 – 42.500
Execution condition is OFF 0.015 0.015 0.070 – 0.270
.L MIN search 0.225 0.225 1.240 – 14.600
MAX search 1.175 1.175 4.260 – 42.300
Execution condition is OFF 0.015 0.015 0.070 – 0.270
.F MIN search 0.233 0.233 2.530 – 18.400
MAX search 1.794 1.794 6.730 – 49.200
Execution condition is OFF 0.015 0.015 0.070 – 0.310
.DF MIN search 0.302 0.322 – – –
MAX search 2.310 2.453 – – –
Execution condition is OFF 0.023 0.023 – – –
RAMP – Execution condition is ON 0.389 0.389 1.970 – 16.000
Execution condition is OFF 0.115 0.115 0.780 – 6.300

A-24 - KV-8000/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
KV-8000
7300 5000/3000 Series
TPOUT – Execution condition is ON 0.151 0.151 1.050 – 8.900
Execution condition is OFF 0.104 0.104 0.770 – 7.100
LLFLT – During execution of operation 0.292 0.292 2.320 – 21.500
During standby for operation 0.279 0.279 1.510 – 11.600
Execution condition is OFF 0.225 0.225 1.270 – 9.200
TBCD .U Execution condition is ON 0.038 0.038 0.130 0.325 4.500
Execution condition is OFF 0.038 0.038 0.130 0.325 1.200
.D Execution condition is ON 0.084 0.084 0.290 0.725 5.300

APPENDICES
Execution condition is OFF 0.084 0.084 0.290 0.725 1.200
TBIN .U Execution condition is ON 0.012 0.012 0.040 0.100 3.700
Execution condition is OFF 0.012 0.012 0.040 0.100 1.200
.D Execution condition is ON 0.023 0.023 0.080 0.200 4.200
Execution condition is OFF 0.023 0.023 0.080 0.200 1.200
MPX – Execution condition is ON 0.018 0.018 0.060 0.150 0.940
Execution condition is OFF 0.018 0.018 0.060 0.150 0.920

Operation Processing Time Table


DMX – Execution condition is ON 0.015 0.015 0.050 0.100 1.600
Execution condition is OFF 0.012 0.012 0.050 0.100 1.200
GRY .U.D Execution condition is ON 0.003 0.003 0.010 0.025 5.000
Execution condition is OFF 0.003 0.003 0.010 0.025 1.200
RGRY .U.D Execution condition is ON 0.003 0.003 0.010 0.025 5.700
Execution condition is OFF 0.003 0.003 0.010 0.025 1.200
DISN .U Execution condition is ON 0.118 0.118 0.840 1.575 8.400
Execution condition is OFF 0.018 0.018 0.060 0.150 0.250
.D Execution condition is ON 0.118 0.118 1.120 2.175 9.300
Execution condition is OFF 0.018 0.018 0.060 0.150 0.250
UNIN .U Execution condition is ON 0.161 0.161 0.920 1.650 11.000
Execution condition is OFF 0.043*1 0.018 0.060 0.125 0.250
.D Execution condition is ON 0.182 0.182 1.310 2.350 11.500
Execution condition is OFF 0.043*1 0.018 0.060 0.125 0.250
DISB .U Execution condition is ON 0.118 0.118 0.700 1.275 8.000
Execution condition is OFF 0.018 0.018 0.060 0.150 0.250
.D Execution condition is ON 0.118 0.118 0.840 1.575 8.400
Execution condition is OFF 0.018 0.018 0.060 0.150 0.250
UNIB .U Execution condition is ON 0.138 0.138 0.740 1.300 10.700
Execution condition is OFF 0.043*1 0.018 0.060 0.125 0.250
.D Execution condition is ON 0.159 0.159 0.950 1.650 11.000
Execution condition is OFF 0.043*1 0.018 0.060 0.125 0.250
SWAP .U.D Execution condition is ON 0.003 0.003 0.010 0.025 0.050
Execution condition is OFF 0.003 0.003 0.010 0.025 0.020

- KV-8000/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-1000 KV Nano
KV-8000
7300 5000/3000 Series
BSWAP – n =#1 0.179 0.179 0.840 – 7.100
n =#1, Execution condition 0.009 0.009 0.050 – 0.260
is OFF
n =#1000 33.192 33.192 125.690 – 77.100
n =#1000, Execution 0.009 0.009 0.050 – 0.260
condition is OFF
XCH .U.D Execution condition is ON 0.102 0.102 0.600 1.050 0.940
Execution condition is OFF 0.015 0.015 0.050 0.125 0.250
DECO – n =#1 0.110 0.110 0.580 1.125 14.000
APPENDICES

n =#8 0.386 0.386 1.500 3.825 16.300


Execution condition is OFF 0.015 0.015 0.050 0.125 0.370
ENCO – n =#1 0.101 0.101 0.590 1.050 12.000
n =#256 0.480 0.480 2.240 5.175 14.800
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
ABS .S Execution condition is ON 0.018 0.018 0.070 – 0.960
Execution condition is OFF 0.026 0.026 0.080 – 0.140
Operation Processing Time Table

.L Execution condition is ON 0.018 0.018 0.080 – 0.910


Execution condition is OFF 0.030 0.030 0.090 – 0.150
.F Execution condition is ON 0.012 0.012 0.040 – 2.400
Execution condition is OFF 0.012 0.012 0.040 – 0.130
.DF Execution condition is ON 0.049 0.049 0.270 – 2.700
Execution condition is OFF 0.046 0.046 0.210 – 0.140
FLOAT .U.S Execution condition is ON 0.018 0.018 0.060 0.150 1.900
Execution condition is OFF 0.018 0.018 0.060 0.150 0.140
.D.L Execution condition is ON 0.015 0.015 0.050 0.125 1.900
Execution condition is OFF 0.015 0.015 0.050 0.125 0.130
DFLOAT .U Execution condition is ON 0.023 0.023 0.660 – 4.300
Execution condition is OFF 0.023 0.023 0.020 – 0.140
.S Execution condition is ON 0.023 0.023 0.710 – 4.100
Execution condition is OFF 0.023 0.023 0.020 – 0.140
.D Execution condition is ON 0.021 0.021 0.740 – 4.500
Execution condition is OFF 0.021 0.021 0.020 – 0.130
.L Execution condition is ON 0.021 0.021 0.800 – 4.300
Execution condition is OFF 0.021 0.021 0.020 – 0.130
INTG .U.S.D.L Execution condition is ON 0.015 0.015 0.080 0.200 2.100
Execution condition is OFF 0.015 0.015 0.080 0.200 0.130

A-26 - KV-8000/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
KV-8000
7300 5000/3000 Series
DINTG .U Execution condition is ON 0.026 0.026 0.750 – 3.600
Execution condition is OFF 0.021 0.021 0.020 – 0.150
.S Execution condition is ON 0.026 0.026 0.790 – 3.600
Execution condition is OFF 0.021 0.021 0.020 – 0.150
.D Execution condition is ON 0.026 0.026 0.730 – 3.900
Execution condition is OFF 0.021 0.021 0.020 – 0.150
.L Execution condition is ON 0.026 0.026 0.780 – 3.600
Execution condition is OFF 0.021 0.021 0.020 – 0.150
DFTOF – Execution condition is ON 0.179 0.179 0.960 – 3.800

APPENDICES
Execution condition is OFF 0.006 0.006 0.020 – 0.150
FTODF – Execution condition is ON 0.098 0.098 0.680 – 3.900
Execution condition is OFF 0.006 0.006 0.020 – 0.150
DISF – Execution condition is ON 0.943 0.943 0.850 1.500 17.500
Execution condition is OFF 0.012 0.012 0.040 0.125 0.310
UNIF – Execution condition is ON 0.414 0.414 1.320 2.850 41.700
Execution condition is OFF 0.040 0.150

Operation Processing Time Table


0.012 0.012 0.270
EXP .F Execution condition is ON 1.055 1.055 3.750 9.200 11.700
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 2.067 2.067 9.500 – 13.900
Execution condition is OFF 0.006 0.006 0.040 – 0.150
LOG .F Execution condition is ON 0.498 0.498 1.910 4.500 13.900
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 2.331 2.331 11.700 – 16.600
Execution condition is OFF 0.006 0.006 0.040 – 0.150
LOG10 .F Execution condition is ON 0.592 0.592 2.240 – 13.500
Execution condition is OFF 0.006 0.006 0.020 – 0.130
.DF Execution condition is ON 2.452 2.452 11.900 – 15.900
Execution condition is OFF 0.006 0.006 0.040 – 0.150
RAD .F Execution condition is ON 0.170 0.170 0.830 1.675 2.900
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 0.113 0.113 1.560 – 4.400
Execution condition is OFF 0.006 0.006 0.020 – 0.150
DEG .F Execution condition is ON 0.170 0.170 0.830 1.675 3.000
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 0.113 0.113 1.560 – 4.300
Execution condition is OFF 0.006 0.006 0.020 – 0.150
SIN .F Execution condition is ON 0.865 0.865 3.330 7.925 10.700
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 1.305 1.305 10.600 – 12.800
Execution condition is OFF 0.006 0.006 0.040 – 0.150

- KV-8000/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-1000 KV Nano
KV-8000
7300 5000/3000 Series
COS .F Execution condition is ON 0.897 0.897 3.320 7.900 10.700
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 1.276 1.276 10.800 – 12.700
Execution condition is OFF 0.006 0.006 0.040 – 0.150
TAN .F Execution condition is ON 1.440 1.440 5.160 12.500 12.300
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 1.753 1.753 12.500 – 14.500
Execution condition is OFF 0.006 0.006 0.040 – 0.150
ASIN .F Execution condition is ON 0.894 0.894 5.770 13.775 12.600
APPENDICES

Execution condition is OFF 0.006 0.006 0.020 0.050 0.130


.DF Execution condition is ON 2.295 2.295 10.900 – 12.700
Execution condition is OFF 0.006 0.006 0.040 – 0.150
ACOS .F Execution condition is ON 0.920 0.920 5.700 13.600 16.600
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 2.319 2.319 10.900 – 16.400
Execution condition is OFF 0.040 –
Operation Processing Time Table

0.006 0.006 0.150


ATAN .F Execution condition is ON 1.584 1.584 6.340 15.450 16.100
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
.DF Execution condition is ON 3.432 3.432 11.800 – 16.500
Execution condition is OFF 0.006 0.006 0.040 – 0.150
ATAN2 .F Execution condition is ON 0.979 1.978 – – –
Execution condition is OFF 0.005 0.029 – – –
.DF Execution condition is ON 1.858 3.817 – – –
Execution condition is OFF 0.013 0.057 – – –
ASC – Execution condition is ON 0.084 0.084 0.520 0.900 1.500
Execution condition is OFF 0.006 0.006 0.020 0.050 1.200
RASC – Execution condition is ON 0.049 0.049 0.590 1.075 2.200
Execution condition is OFF 0.006 0.006 0.020 0.050 1.200
DASC .U Execution condition is ON 0.633 0.633 3.100 6.325 9.800
Execution condition is OFF 0.018 0.018 0.060 0.175 0.260
.S Execution condition is ON 0.673 0.673 3.260 6.500 12.500
Execution condition is OFF 0.018 0.018 0.060 0.175 0.260
.D Execution condition is ON 1.124 1.124 5.260 11.075 10.900
Execution condition is OFF 0.018 0.018 0.060 0.175 0.260
.L Execution condition is ON 1.130 1.130 5.210 10.875 13.400
Execution condition is OFF 0.018 0.018 0.060 0.175 0.260

A-28 - KV-8000/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
KV-8000
7300 5000/3000 Series
RDASC .U Execution condition is ON 0.610 0.610 2.960 6.100 12.400
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
.S Execution condition is ON 0.627 0.627 3.170 6.400 13.900
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
.D Execution condition is ON 1.115 1.115 5.380 10.700 13.600
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
.L Execution condition is ON 1.141 1.141 5.590 11.025 15.000
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
HASC .U n =#4 0.549 0.549 2.710 5.050 7.400

APPENDICES
n =#4, Execution condition is 0.021 0.021 0.070 0.200 0.260
OFF
.D n =#8 0.854 0.854 3.980 7.875 8.100
n =#8, Execution condition is 0.021 0.021 0.070 0.200 0.260
OFF
RHASC .U Execution condition is ON 0.480 0.480 2.630 5.125 11.300
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
.D Execution condition is ON 4.470 8.850

Operation Processing Time Table


0.900 0.900 12.300
Execution condition is OFF 0.015 0.015 0.050 0.125 0.260
FASC – Execution condition is ON 6.329 9.673 72.980 94.000 48.200
Execution condition is OFF 0.012 0.012 0.040 0.125 0.260
RFASC – Execution condition is ON 4.915 8.692 37.450 64.800 67.700
Execution condition is OFF 0.009 0.009 0.050 0.125 0.270
LEN – 1 character 0.146 0.146 0.950 1.800 6.000
1999 characters 28.773 28.773 136.970 304.575 137.700
Execution condition is OFF 0.009 0.009 0.050 0.125 0.260
SMOV – Send 1 character 0.509 0.509 2.230 3.950 12.100
Send 1999 characters 111.933 111.933 218.860 490.475 258.900
Execution condition is OFF 0.009 0.009 0.050 0.125 0.260
SADD – 1 character+1 character 0.454 0.454 3.440 6.800 16.300
999 characters +1000 61.635 61.635 253.800 548.325 263.000
characters
Execution condition is OFF 0.012 0.012 0.060 0.150 0.260
SRGHT – Extract 1 character from 2 0.575 0.575 2.370 4.600 14.100
characters
Extract 1998 characters from 1999 115.701 115.701 310.440 661.100 260.600
characters
Execution condition is OFF 0.012 0.012 0.060 0.150 0.260
SLEFT – Extract 1 character from 2 0.296 0.296 2.280 4.375 14.500
characters
Extract 1998 characters from 1999 28.907 28.907 219.080 490.450 261.000
characters
Execution condition is OFF 0.012 0.012 0.060 0.150 0.260
SMID – Extract 1 character starting from 0.584 0.584 2.460 4.825 13.500
2nd character in 3 characters
Extract 1997 characters starting 108.477 108.477 310.450 661.250 260.000
from 2nd character in 1999
characters
Execution condition is OFF 0.015 0.015 0.070 0.175 0.260

- KV-8000/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-1000 KV Nano
KV-8000
7300 5000/3000 Series
SRPLC – Replace 2nd character in 2 0.863 0.863 4.780 9.075 17.500
characters
Replace 1997 characters starting 137.663 137.663 529.580 1115.07 529.700
from 2nd character in 1999 5
characters
Execution condition is OFF 0.018 0.018 0.080 0.200 0.260
SINS – Insert 1 character after 1st 0.736 0.736 4.110 8.250 18.800
character in 2 characters
Insert 999 character after 1st 60.181 60.181 312.580 660.150 265.200
character in 1000 characters
Execution condition is OFF 0.015 0.015 0.070 0.175 0.260
APPENDICES

SDEL – Delete 1st character in 2 0.506 0.506 2.810 5.425 14.200


characters
Delete 1 character starting from 61.492 61.492 265.430 578.525 260.900
1000th character in 1999
characters
Execution condition is OFF 0.015 0.015 0.070 0.175 0.260
STRIM – Delete 1st character in 2 0.679 0.679 3.650 – 14.900
characters
Removes each 500 characters 669.850 –
Operation Processing Time Table

162.042 162.042 445.200


from both ends of the 1999
characters.
Execution condition is OFF 0.012 0.012 0.060 – 0.260
SFIND – Search 1 character in 2 characters 0.523 0.523 2.800 5.400 25.800
Search 1000 characters in 1999 72.042 72.042 621.500 820.275 452.000
characters
Execution condition is OFF 0.015 0.015 0.070 0.175 0.260
SFINDN – Search 1 character in 2 characters 0.581 0.581 2.680 – 30.600
Search 1000 characters in 1999 43.329 43.329 916.890 – 328.400
characters
Execution condition is OFF 0.015 0.015 0.070 – 0.260
SCMP – Compare 1 character 0.259 0.259 1.530 3.175 11.200
Compare 1999 characters 96.178 96.178 443.500 983.475 358.100
Execution condition is OFF 0.009 0.009 0.050 0.125 0.260
DISS – Divide 1 character 0.276 0.276 1.590 3.175 12.200
Divide 1999 characters 73.444 73.444 303.220 680.600 316.100
Execution condition is OFF 0.009 0.009 0.050 0.125 0.260
UNIS – n =#1 0.213 0.213 1.170 2.275 10.500
97.818 97.818 340.830 1126.15 146.800
n =#1999
0
Execution condition is OFF 0.012 0.012 0.060 0.150 0.250
RCOM – Execution condition is ON 0.063*1 0.025 9.700 46.800 13.500
Execution condition is OFF 0.060*1 0.029 0.150 0.125 3.300

A-30 - KV-8000/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
KV-8000
7300 5000/3000 Series
CAL+ .U.S.D.L S1 =DM, S2 = Constant 0.021 0.021 0.110 – 0.960
S1 =DM, S2 = 0.012 0.012 0.040 – 0.300
Constant, Execution condition is
OFF
.F S1 =DM, S2 = Constant 0.044 0.044 0.180 – 2.300
S1 =DM, S2 = 0.041 0.041 0.130 – 0.260
Constant, Execution condition is
OFF
.DF S1 =DM, S2 = Constant 0.058 0.058 2.350 – 3.400
S1 =DM, S2 = 0.058 0.058 0.100 – 0.260

APPENDICES
Constant, Execution condition is
OFF
CAL– .U.S.D.L S1 =DM, S2 = Constant 0.021 0.021 0.110 – 0.990
S1 =DM, S2 = 0.012 0.012 0.040 – 0.300
Constant, Execution condition is
OFF
.F S1 =DM, S2 = Constant 0.044 0.044 0.180 – 2.300
S1 =DM, S2 = 0.041 0.041 0.130 – 0.260
Constant, Execution condition is

Operation Processing Time Table


OFF
.DF S1 =DM, S2 = Constant 0.058 0.058 2.370 – 3.500
S1 =DM, S2 = 0.058 0.058 0.110 – 0.260
Constant, Execution condition is
OFF
CALж .U.S S1 =DM, S2 = Constant 0.026 0.026 0.120 – 0.970
S1 =DM, S2 = 0.018 0.018 0.050 – 0.300
Constant, Execution condition is
OFF
.D.L S1 =DM, S2 = Constant 0.041 0.041 0.190 – 1.200
S1 =DM, S2 = 0.032 0.032 0.120 – 0.300
Constant, Execution condition is
OFF
.F S1 =DM, S2 = Constant 0.058 0.058 0.240 – 2.300
S1 =DM, S2 = 0.055 0.055 0.180 – 0.260
Constant, Execution condition is
OFF
.DF S1 =DM, S2 = Constant 0.078 0.078 1.820 – 3.400
S1 =DM, S2 = 0.072 0.072 0.100 – 3.400
Constant, Execution condition is
OFF
CAL/ .U.S S1 =DM, S2 = Constant 0.055 0.055 0.250 – 1.500
S1 =DM, S2 = 0.049 0.049 0.190 – 0.310
Constant, Execution condition is
OFF
.D.L S1 =DM, S2 = Constant 0.052 0.052 0.390 – 1.600
S1 =DM, S2 = 0.046 0.046 0.330 – 0.310
Constant, Execution condition is
OFF
.F S1 =DM, S2 = Constant 0.121 0.121 0.490 – 2.400
S1 =DM, S2 = 0.118 0.118 0.430 – 0.260
Constant, Execution condition is
OFF
.DF S1 =DM, S2 = Constant 0.141 0.141 3.130 – 3.700
S1 =DM, S2 = 0.136 0.136 0.100 – 0.260
Constant, Execution condition is
OFF
- KV-8000/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-1000 KV Nano
KV-8000
7300 5000/3000 Series
CAL& .U.D S1 =DM, S2 = Constant 0.021 0.021 0.110 – 1.700
S1 =DM, S2 = 0.012 0.012 0.040 – 0.250
Constant, Execution condition is
OFF
CAL| .U.D S1 =DM, S2 = Constant 0.021 0.021 0.110 – 1.600
S1 =DM, S2 = 0.012 0.012 0.040 – 0.250
Constant, Execution condition is
OFF
CAL^ .U.D S1 =DM, S2 = Constant 0.021 0.021 0.110 – 1.700
S1 =DM, S2 = 0.012 0.012 0.040 – 0.250
APPENDICES

Constant, Execution condition is


OFF
CAL~ .U.D Execution condition is ON 0.026 0.026 0.110 – 1.400
Execution condition is OFF 0.021 0.021 0.040 – 0.250
CAL>> .U.D Execution condition is ON 0.064 0.064 0.110 – 1.900
Execution condition is OFF 0.021 0.021 0.040 – 0.380
.S Execution condition is ON 0.072 0.072 0.150 – 1.900
Execution condition is OFF 0.021 0.021 0.080 – 0.380
Operation Processing Time Table

.L Execution condition is ON 0.072 0.072 0.160 – 1.700


Execution condition is OFF 0.018 0.018 0.090 – 0.240
CAL<< .U.S.D.L Execution condition is ON 0.064 0.064 0.110 – 1.900
Execution condition is OFF 0.021 0.021 0.040 – 0.380
CPMSET – S2 =2-byte binary 0.243 0.243 3.000 – 19.900
S2 =1999-byte text string 121.783 121.783 345.290 – 471.900
Execution condition is OFF 0.012 0.012 0.060 – 0.380
CPMGET – S2 =2-byte binary 0.492 0.492 2.960 – 19.600
S2 =1999-byte text string 85.881 85.881 208.420 – 350.500
Execution condition is OFF 0.015 0.015 0.070 – 0.390
CPSASC – 1 character 0.414 0.414 1.830 – 10.500
1999 characters 33.429 33.429 126.730 – 110.500
Execution condition is OFF 0.012*1 0.009 0.050 – 0.260
RCPSASC – 1 character 0.388 0.388 1.980 – 12.000
1999 characters 62.029 62.029 262.900 – 233.700
Execution condition is OFF 0.012 0.012 0.060 – 0.260

*1 The processing time is as follows when the CPU function version is 2.0 or lower.
UNIN instruction(.U / .D) :when the execution condition is OFF 0.018
UNIB instruction(.U / .D) :when the execution condition is OFF 0.018
RCOM instruction :when the execution condition is ON 0.025,
when the execution condition is OFF 0.029
CPSASC instruction :when the execution condition is OFF 0.009

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


Operation Processing Time Table

Extended Instructions

Processing time (µs)


Instruction Suffix Measurement condition KV-7500/ KV-5500/ KV Nano
KV-8000 KV-1000
7300 5000/3000 Series
HKEY – Execution condition is ON 0.127 0.127 0.430 1.025 3.900
Execution condition is OFF 0.070 0.070 0.380 0.825 3.600
SEG .U Execution condition is ON 0.076 0.076 0.610 1.000 2.200
Execution condition is OFF 0.015 0.015 0.050 0.150 0.110

APPENDICES
.D Execution condition is ON 0.076 0.076 0.610 1.000 2.400
Execution condition is OFF 0.015 0.015 0.050 0.150 0.110
BCNT .U Execution condition is ON 0.006 0.006 0.020 0.050 1.700
Execution condition is OFF 0.006 0.006 0.020 0.050 0.100
.D Execution condition is ON 0.012 0.012 0.040 0.100 2.200
Execution condition is OFF 0.012 0.012 0.040 0.100 0.100
DCNT .U n =#1 0.092 0.092 0.640 1.125 10.800

Operation Processing Time Table


n =#1000 41.686 41.686 125.490 300.800 101.000
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.D n =#1 0.092 0.092 0.640 1.125 10.600
n =#1000 43.141 43.141 150.490 325.800 114.700
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
SER .U n =#1 0.092 0.092 0.790 1.125 14.400
n =#1000, searching object: 33.106 33.106 125.640 275.825 83.600
terminal
Execution condition is OFF 0.009 0.009 0.050 0.125 0.370
.D n =#1 0.092 0.092 0.790 1.125 14.500
n =#1000, searching object: 34.534 34.534 150.640 300.825 88.000
terminal
Execution condition is OFF 0.009 0.009 0.050 0.125 0.300
DSER .U n =#1 0.276 0.276 1.150 – 16.400
n =#1000, all consistent 30.462 30.462 166.100 – 141.200
Execution condition is OFF 0.015 0.015 0.070 – 0.260
.D n =#1 0.279 0.279 1.150 – 16.300
n =#1000, all consistent 31.876 31.876 141.070 – 148.300
Execution condition is OFF 0.015 0.015 0.070 – 0.260

- KV-8000/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-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
MAX .U.S n =#1 0.092 0.092 0.630 1.125 7.300
n =#1000 41.712 41.712 125.480 300.800 90.500
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.D.L n =#1 0.092 0.092 0.630 1.125 14.500
n =#1000 43.140 43.140 150.480 325.8 401.500
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.F n =#1 0.133 0.133 – – –
n =#1000 64.795 64.795 – – –
APPENDICES

Execution condition is OFF 0.012 0.012 – – –


.DF n =#1 0.159 0.159 – – –
n =#1000 73.399 73.399 – – –
Execution condition is OFF 0.012 0.012 – – –
MIN .U.S n =#1 0.092 0.092 0.630 1.125 7.300
n =#1000 41.712 41.712 125.480 300.800 90.500
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
Operation Processing Time Table

.D.L n =#1 0.092 0.092 0.630 1.125 13.900


n =#1000 43.149 43.149 150.480 325.800 400.800
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.F n =#1 0.133 0.133 – – –
n =#1000 66.163 66.163 – – –
Execution condition is OFF 0.012 0.012 – – –
.DF n =#1 0.159 0.159 – – –
n =#1000 74.801 74.801 – – –
Execution condition is OFF 0.012 0.012 – – –
AVG .U.S n =#1 0.110 0.110 0.720 1.325 12.700
n =#1000 27.405 27.405 95.690 251.250 61.300
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.D n =#1 0.144 0.144 0.840 1.625 19.300
n =#1000 34.641 34.641 130.870 326.700 406.200
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.L n =#1 0.153 0.153 0.870 1.700 20.900
n =#1000 43.261 43.261 160.870 401.700 444.000
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.F n =#1 0.222 0.222 – – –
n =#1000 51.900 51.900 – – –
Execution condition is OFF 0.012 0.012 – – –
.DF n =#1 0.251 0.251 – – –
n =#1000 60.544 60.544 – – –
Execution condition is OFF 0.012 0.012 – – –

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


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition
KV-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
WSUM .U.S n =#1 0.087 0.087 0.640 1.125 4.300
n =#1000 27.359 27.359 95.530 250.850 53.000
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.D n =#1 0.104 0.104 0.700 1.275 12.900
n =#1000 34.558 34.558 130.570 325.950 399.700
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.L n =#1 0.113 0.113 0.730 1.350 12.900
n =#1000 43.178 43.178 160.570 400.950 436.100

APPENDICES
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
.F n =#1 0.119 0.119 – – –
n =#1000 51.796 51.796 – – –
Execution condition is OFF 0.012 0.012 – – –
.DF n =#1 0.139 0.139 – – –
n =#1000 60.431 60.431 – – –
Execution condition is OFF 0.012 0.012 – – –

Operation Processing Time Table


BSUM .U n =#1 0.084 0.084 0.630 1.250 8.200
n =#1000 20.887 20.887 73.010 188.300 56.700
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
CRC – n =#1 0.322 0.322 1.740 3.275 14.900
n =#1000 93.345 93.345 196.520 452.800 197.000
Execution condition is OFF 0.012 0.012 0.060 0.150 0.260
ZRES – Number of device: 2 0.141 0.141 1.020 1.775 8.900
Number of device: 1000 0.866 0.866 33.010 48.925 11.900
Execution condition is OFF 0.009 0.009 0.050 0.125 0.250
EXT .U Execution condition is ON 0.012 0.012 0.040 0.100 0.270
Execution condition is OFF 0.012 0.012 0.040 0.100 0.140
.D Execution condition is ON 0.015 0.015 0.050 0.125 0.270
Execution condition is OFF 0.015 0.015 0.050 0.125 0.140
BCMP .U n =#1 0.164 0.164 0.890 1.725 26.400
n =#1000 74.807 74.807 200.640 651.025 1678.70
0
Execution condition is OFF 0.015 0.015 0.070 0.175 0.360
.D n =#1 0.164 0.164 0.890 1.725 27.100
n =#1000 77.681 77.681 250.640 701.025 1799.70
0
Execution condition is OFF 0.144 0.144 0.070 0.175 0.360
BCMPI .U.S n =#1 0.144 0.144 0.740 1.425 24.200
n =#1000 67.612 67.612 155.560 550.850 752.200
Execution condition is OFF 0.015 0.015 0.070 0.175 0.360
.D.L n =#1 0.141 0.141 0.730 1.400 24.200
n =#1000 69.046 69.046 180.550 575.825 804.100
Execution condition is OFF 0.015 0.015 0.070 0.175 0.360

- KV-8000/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-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
BCMPI – n =#1 0.247 – – – –
n =#1, 0.014 – – – –
Execution condition is OFF
n =#1 1.500 – – – –
n =#1, 0.014 – – – –
Execution condition is OFF
RND – Execution condition is ON 0.121 0.121 0.660 – 1.800
Execution condition is OFF 0.012 0.012 0.040 – 0.250
SORT .U.S n =#2 (sorts descending 0.403 0.403 2.510 – 10.300
APPENDICES

order data into ascending order)


n =#1000 (sorts descending 747.099 747.099 3227.050 – 1689.90
order data into ascending order) 0
Execution condition is OFF 0.021 0.021 0.060 – 0.210
.D.L n =#2 (sorts descending 0.403 0.403 2.560 – 10.500
order data into ascending order)
n =#1000 (sorts descending 663.879 663.879 3497.150 – 1763.20
order data into ascending order) 0
Operation Processing Time Table

Execution condition is OFF 0.021 0.021 0.060 – 0.260


SORTN .U.S n =#2, number of 0.775 0.775 3.290 – 23.000
comparisons=1 (sorts descending
order data into ascending order)
n =#1000, number of 88.225 88.225 557.700 – 247.900
comparisons=1000 (sorts
descending order data into
ascending order)
Execution condition is OFF 0.115 0.115 0.850 – 8.300
.D.L n =#2, number of 0.775 0.775 3.340 – 23.400
comparisons=1 (sorts descending
order data into ascending order)
n =#1000, number of 89.813 89.813 593.400 – 259.000
comparisons=1000 (sorts
descending order data into
ascending order)
Execution condition is OFF 0.115 0.115 0.850 – 8.500
FIFOW .U.D N (table length) =1 0.259 0.259 1.100 2.175 13.500
N (table length) =1000 0.259 0.259 1.140 2.200 16.000
Execution condition is OFF 0.015 0.015 0.050 0.150 0.300
FIFOR .U N (table length) =1 0.274 0.274 1.280 2.425 20.600
N (table length) =1000 30.904 30.904 81.750 210.175 94.200
Execution condition is OFF 0.009 0.009 0.050 0.125 0.390
.D N (table length) =1 0.274 0.274 1.330 2.475 23.300
N (table length) =1000 32.345 32.345 133.900 235.225 169.500
Execution condition is OFF 0.009 0.009 0.050 0.125 0.300
LIFOW .U.D N (table length) =1 0.259 0.259 1.100 2.175 13.500
N (table length) =1000 0.259 0.259 1.140 2.200 15.900
Execution condition is OFF 0.015 0.015 0.050 0.150 0.300
LIFOR .U.D N (table length) =1 0.274 0.274 1.080 1.925 14.300
N (table length) =1000 30.904 30.904 1.130 1.975 14.400
Execution condition is OFF 0.009 0.009 0.050 0.125 0.390

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


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition
KV-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
FWRIT .U N (table length) =1 0.239 0.239 1.070 2.100 13.200
Execution condition is OFF 0.021 0.021 0.070 0.200 0.390
.D N (table length) =1 0.230 0.230 1.110 2.100 15.100
Execution condition is OFF 0.018 0.018 0.060 0.175 0.300
FINS .U N (table length) =1 0.210 0.210 1.200 2.600 19.500
N (table length) =1000, insert 47.612 47.612 126.200 327.650 86.300
position: start
Execution condition is OFF 0.015 0.015 0.070 0.200 0.390
.D N (table length) =1 0.202 0.202 1.240 2.600 21.900

APPENDICES
N (table length) =1000, insert 49.034 49.034 151.240 352.650 110.700
position: start
Execution condition is OFF 0.012 0.012 0.060 0.175 0.300
FDEL .U N (table length) =1 0.194 0.194 1.090 2.350 19.900
N (table length) =1000, delete 47.598 47.598 126.020 327.175 93.300
position: start
Execution condition is OFF 0.009 0.009 0.050 0.125 0.390

Operation Processing Time Table


.D N (table length) =1 0.193 0.193 1.140 2.400 22.300
N (table length) =1000, delete 49.029 49.029 151.020 352.175 168.500
position: start
Execution condition is OFF 0.009 0.009 0.050 0.125 0.300
WTIME – Execution condition is ON 7.689 10.572 19.000 22.700 19.200
Execution condition is OFF 0.006 0.006 0.020 0.050 0.250
SEC – Execution condition is ON 0.317 0.317 12.400 16.925 16.100
Execution condition is OFF 0.009 0.009 0.050 0.125 0.260
RSEC – Execution condition is ON 0.354 0.354 15.180 22.225 16.300
Execution condition is OFF 0.009 0.009 0.050 0.125 0.260
AJST – Execution condition is ON 7.697 10.919 17.341 21.050 26.900
Execution condition is OFF 0.006 0.006 0.040 0.075 0.090
LDWK – 0.388 0.388 1.900 4.250 14.400
LDWKB – 0.391 0.391 1.910 4.275 14.500
ANDWK – 0.391 0.391 1.910 4.225 14.200
ANDWKB – 0.394 0.394 1.920 4.250 14.200
ORWK – 0.391 0.391 1.810 4.125 14.300
ORWKB – 0.394 0.394 1.820 4.150 14.400
LDCAL – 0.351 0.351 1.760 3.900 15.000
LDCALB – 0.351 0.351 1.770 3.925 15.100
ANDCAL – 0.354 0.354 1.770 3.875 14.600
ANDCALB – 0.351 0.351 1.780 3.900 14.800
ORCAL – 0.354 0.354 1.670 3.775 14.800
ORCALB – 0.351 0.351 1.680 3.800 15.000
ARES – Execution condition is ON 1.425 0.049 11.690 21.200 12.300
Execution condition is OFF 0.012 0.012 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.052 0.052 0.010 0.025 1.300
Execution condition is OFF 0.006 0.006 0.010 0.025 0.130

- KV-8000/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-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
EI – Execution condition is ON 0.075 0.075 0.440 0.700 1.900
Execution condition is OFF 0.006 0.006 0.020 0.050 0.130
DIC – Execution condition is ON 0.101 0.101 0.550 0.775 3.100
Execution condition is OFF 0.006 0.006 0.020 0.050 0.250
INT – 0.00000 0.00000 0.000 0.000 0.000
RETI – 0.00000 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
APPENDICES

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 −
Operation Processing Time Table

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

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


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition
KV-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
CHGTGT – Execution condition is ON - - − − 9.600
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

APPENDICES
FCNT – Execution condition is ON - - 0.760 1.475 4.700
Execution condition is OFF - - 0.590 1.400 4.400
RCNT – Execution condition is ON - - 1.260 1.950 10.700
Execution condition is OFF - - 1.010 1.875 6.100
PLSOUT – Execution condition is ON - - 0.670 1.025 4.500
Execution condition is OFF - - 0.540 0.950 3.900
MCMP – n =#1 0.411 0.411 2.020 3.900 21.100

Operation Processing Time Table


n =#32 3.363 3.363 12.170 28.975 28.100
Execution condition is OFF 0.015 0.015 0.070 0.200 0.310
INCENC – n =#1 - - 4.140 8.825 41.700
n =#1, Execution condition is 4.140 8.825 8.800
- -
OFF
n =#32 - - 19.370 52.075 71.800
n =#32, Execution condition is OFF - - 19.370 52.075 8.800
ABSENC – n =#1 0.561 0.561 3.820 8.575 43.000
n =#1, Execution condition is 0.127 0.127 3.820 8.575 7.800
OFF
n =#32 0.561 0.561 19.050 51.825 73.100
n =#32, Execution condition is OFF 0.127 0.127 19.060 51.825 7.800
LOGE – Execution condition is ON 0.015 0.015 0.050 0.125 1.800
Execution condition is OFF 0.015 0.015 0.050 0.125 0.370
LOGD – Execution condition is ON 0.015 0.015 0.050 0.125 1.800
Execution condition is OFF 0.015 0.015 0.050 0.125 0.370
TRGD – Execution condition is ON 0.133 0.133 10.380 – 5.000
Execution condition is OFF 0.021 0.021 0.060 – 1.800
TRGR – Execution condition is ON *1 - - - -
Execution condition is OFF *1 - - - -
PID – When RES input is ON→OFF 1.445 1.445 5.070 13.100 50.300
When PAUSE input is ON 0.394 0.394 1.980 4.700 24.600
During operation 0.395 0.395 1.980 13.625 51.100
PIDAT – During standby 1.036 1.036 5.380 – 21.200
During operation 2.727 2.727 10.560 – 55.300
During automatic tuning 1.426 1.426 6.680 – 29.000
When automatic tuning is 3.065 3.065 11.430 – 48.600
completed
Execution condition is OFF 0.769 0.769 2.990 – 16.400

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


Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition
KV-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
MWRIT – Execution condition is OFF 0.383 0.426 1.610 3.450 15.160
At the rising edge of execution 2.788 2.788 4.190 10.550 39.060
condition
MREAD – Execution condition is OFF 0.383 0.426 1.610 3.450 15.170
At the rising edge of execution 2.788 2.788 4.020 9.725 39.100
condition
MFREE – Execution condition is OFF 0.216 0.216 0.950 1.850 8.350
At the rising edge of execution 1.888 1.888 1.070 2.625 17.940
condition
APPENDICES

MMKDIR – Execution condition is OFF 0.222 0.239 1.060 2.125 12.510


At the rising edge of execution 2.238 2.238 2.200 5.925 26.070
condition
MRMDIR – Execution condition is OFF 0.222 0.239 1.060 – 12.510
At the rising edge of execution 2.400 2.400 1.940 – 25.920
condition
MDEL – Execution condition is OFF 0.222 0.239 1.060 – 12.620
At the rising edge of execution 2.363 2.363 1.940 – 26.140
Operation Processing Time Table

condition
MPRINT – 1 character, Execution condition is 0.253 0.337 1.740 – 14.870
OFF
1 character, At the rising edge of 2.400 2.400 2.850 – 28.300
execution condition
1999 characters, Execution 0.256 0.256 136.410 – 147.230
condition is OFF
1999 characters, At the rising 31.138 31.138 138.870 – 160.580
edge of execution condition
MREADL – Execution condition is OFF 0.449 0.449 1.900 – 22.390
At the rising edge of execution 2.488 2.488 3.060 – 36.140
condition
MCOPY – Execution condition is OFF 0.271 0.305 1.310 – 15.590
At the rising edge of execution 2.700 2.700 3.630 – 31.240
condition
MMOV – Execution condition is OFF 0.271 0.305 1.310 – 15.470
At the rising edge of execution 2.650 2.650 3.630 – 31.230
condition
MREN – Execution condition is OFF 0.265 0.299 1.630 – 14.250
At the rising edge of execution 2.613 2.613 3.650 – 29.560
condition
MFREEK – Execution condition is OFF 0.216 0.216 0.990 – 8.600
At the rising edge of execution 2.063 2.063 1.120 – 18.150
condition
MSTAT – Execution condition is OFF 0.288 0.322 1.510 – 14.490
At the rising edge of execution 2.300 2.300 2.570 – 27.860
condition
AWNUM – At the rising edge of execution 0.560 1.100 5.400
- -
condition
Execution condition is OFF - - 0.490 1.225 5.100
AWMSG – 1 character, At the rising edge of 0.900 1.950 9.900
- -
execution condition
24 characters, At the rising edge of 2.810 6.625 11.800
- -
execution condition
Execution condition is OFF - - 0.860 1.725 6.600
A-40 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Operation Processing Time Table

Processing time (µs)


Instruction Suffix Measurement condition
KV-8000 KV-7500/ KV-5500/ KV-1000 KV Nano
7300 5000/3000 Series
AWSHOW – Execution condition is OFF 0.085 0.085 – – –
At the rising edge of execution 0.072 0.072 – – –
condition
AWHIDE – Execution condition is OFF 0.085 0.085 – – –
At the rising edge of execution 0.072 0.072 – – –
condition
SPRD – Execution condition is ON 4.254 6.866 2.260 – 23.780
Execution condition is OFF 0.282 0.296 1.300 – 8.400
SPWR – Execution condition is ON 4.262 6.873 2.260 – 24.050

APPENDICES
Execution condition is OFF 0.282 0.304 1.300 – 8.660
SSVC – Execution condition is ON 4.281 6.888 2.260 – 23.790
Execution condition is OFF 0.282 0.303 1.300 – 8.410
RFSFRC – Execution condition is ON 0.044 0.044 0.070 – 0.600
Execution condition is OFF 0.044 0.044 0.050 – 0.240
RFSCI .U.S.D.L. 1 word (expansion unit) 3.567 3.567 5.400 – 27.760
F
1 word (CPU Ethernet/IP) 3.818 3.818 12.900 – –

Operation Processing Time Table


Execution condition is OFF 0.021 0.021 0.020 – 0.020
RFSCO .U.S.D.L. 1 word (expansion unit) 3.634 3.634 5.400 – 27.810
F
1 word (CPU Ethernet/IP) 3.860 3.860 13.000 – –
Execution condition is OFF 0.021 0.021 0.020 – 0.020
*1 The processing5 time varies depending on the contents of the operation recorder setting or the
execution status of the ladder program.
For the reference target value of the processing time, refer to the scan time extension displayed in
the operation recorder setting dialog.

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


Operation Processing Time Table

MEMO
APPENDICES
Operation Processing Time Table

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


CR/CM List

Control Relays CR (For KV-8000)

Control relays (CR0000 - CR7915) can be used to perform operations such as checking the operation
status of the CPU unit and setting and monitoring the built-in functions.
Control relays reserved for the system cannot be used.
Attribute
CR R: Read only Function
Blank: Read/write
Logging and tracing execution (ON: enabled, OFF:
CR0000
disabled)
CR0001 R Logging or tracing operation in progress
CR0002 R Logging or tracing file writing completion

APPENDICES
CR0003 R Logging buffer less than 50% warning
CR0004 R Logging buffer overflow
CR0005 R Data to be written in RUN mode during logging present
CR0006 and
- Reserved for the system
CR0007 Logging or tracing function (ID0)
CR0008 R Logging or tracing error
CR0009 R Logging trace No memory space error
CR0010 R Logging or tracing device or trigger setting error
CR0011 R Tracing file save trigger monitor

CR/CM List
CR0012 R Tracing data capture completion
CR0013 R Logging or tracing setting to be written present
CR0014 and
- Reserved for the system
CR0015
CR0100 to
Logging or tracing function (ID1 to ID9)
CR0915
CR1000 to
Real-time chart monitor (ID10)
CR1015
CR1100 to
- Reserved for the system
CR2001
CR2002 R Always turned ON
CR2003 R Always turned OFF
CR2004 R 10 ms clock pulse (duty cycle: 50%)
CR2005 R 100 ms clock pulse (duty cycle: 50%)
CR2006 R 1 s clock pulse (duty cycle: 50%)
CR2007 R Turned OFF for just one scan when operation starts
CR2008 R Turned ON for just one scan when operation starts
CR2009 Turned ON when the calculation result is negative or when an overflow occurs
CR2010 R Turned ON when the calculation result is zero
CR2011 R Turned ON when the calculation result is positive
CR2012 R Turned ON when a calculation execution error occurs
CR2013 to
- Reserved for the system
CR2302
CR2303 Fixed scan time operation (ON: enabled, OFF: disabled)
Turned ON for just one scan when the scan time setting (the fixed scan time operation and END
CR2304 R
processing time settings) is exceeded
CR2305 - Reserved for the system
CR2306 R Indicates backup battery errors (ON: error, OFF: normal)
CR2307 Clears the minimum and maximum scan time values
Sets the END processing time (ON: enabled, OFF: disabled; if CR2303 is turned ON at the same
CR2308
time, CR2303 is given priority)
CR2309 and
- Reserved for the system
CR2310
CR2311 R Indicates RTC low voltage error (ON: error has occurred, OFF: normal)
CR2312 - Reserved for the system
CR2313 Forces switch of the VT sensor application screen (ON: switch, OFF: do not switch)
Project password authentication status (ON: authentication disabled, OFF: authentication
CR2314 R
enabled)

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


CR/CM List

Attribute
CR R: Read only Function
Blank: Read/write
CR2315 to
- Reserved for the system
CR2813
Zero suppression during execution of DASC and FASC instructions (all suffixes; ON: execute,
CR2814
OFF: do not execute)
Omission of "+" during execution of DASC.S, DASC.L, and FASC instructions (ON: execute,
CR2815
OFF: do not execute)
CR2900 to
- Reserved for the system
CR3005
CR3100 R Inter-unit synchronization refreshing time exceeded
CR3101 to
- Reserved for the system
CR3115
CR3200 CPU memory save save request
APPENDICES

CR3201 R CPU memory save being performed


CR3202 R CPU memory save complete
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)
CR/CM List

CR3208 to
- Reserved for the system
CR3209
CR3210 R Arbitrary logging/trace operation
CR3211 to - Reserved for the system
CR3213
CR3214 R Storage instruction executing
CR3215 - Reserved for the system
CR3300 to
Alarm relay
CR3415
CR3500 R Alarm operation relay (ON: one of CR3300 to CR3415 is turned ON)
Record an entry in the log when an alarm relay switches from ON to OFF (ON: record, OFF: do
CR3501
not record)
CR3502 The alarm relay log is cleared when this switches from OFF to ON
CR3503 to
- Reserved for the system
CR3512
CR3513 R Logging internal buffer overflow
CR3514 HKEY instruction - Disables multiple keys
CR3515 R HKEY instruction - Scan completion
CR3600 to
R HKEY information storage area
CR3615
CR3700 to
- Reserved for the system
CR3901
CR3902 R Indicates that the serious error log is full
CR3903 R Indicates that the minor error log is full
CR3904 R RUN-PRG selector switch status (ON: RUN, OFF: PROG)
CR3905 R A serious error has occurred
CR3906 R A minor error has occurred
CR3907 to
Reserved for the system
CR3908
CR3909 Clears the current error (Set this relay in the ladder program)
CR3910 Clear all error and event history when OFF→ON
CR3911 to
- Reserved for the system
CR4000
CR4001 to
R Expansion unit status (expansion units 1 - 48)
CR4300
CR4301 to
- Reserved for the system
CR4315
CR4400 R AW up key being pressed
CR4401 R AW down key being pressed

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


CR/CM List

Attribute
CR R: Read only Function
Blank: Read/write
CR4402 R AW left key being pressed
CR4403 R AW right key being pressed
CR4404 R AW MENU key being pressed
CR4405 R AW ENT key being pressed
CR4406 to
- Reserved for the system
CR4414
CR4415 R AW user message being displayed
CR4500 AW line 1 blinking
CR4501 AW line 2 blinking
CR4502 AW line 3 blinking
CR4503 AW line 4 blinking

APPENDICES
CR4504 to
- Reserved for the system
CR4600
CR4601 to
AW user message 1 to 63
CR4915
CR5000 to
- Reserved for the system
CR5315
CR5400 Memory card mount request
CR5401 Memory card unmount request
CR5402 R Memory card used

CR/CM List
CR5403 R Memory card recognized
CR5404 R Memory card is available
CR5405 R Memory card is write protected
CR5406 to
- Reserved for the system
CR5407
CR5408 CPU memory mount request
CR5409 CPU memory unmount request
CR5410 R CPU memory used
CR5411 R CPU memory recognized
CR5412 to
- Reserved for the system
CR4915
CR5500 Project load execution request
CR5501 - Reserved for the system
CR5502 Project save execution request
CR5503 - Reserved for the system
CR5504 R Project load execution complete
CR5505 R Project load execution failure
CR5506 R Project save execution complete
CR5507 R Project save execution failure
CR5508 Recipe load request
CR5509 - Reserved for the system
CR5510 R Recipe load complete
CR5511 R Recipe load failed
CR5512 Recipe save request
CR5513 - Reserved for the system
CR5514 R Recipe save complete
CR5515 R Recipe save failed

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


CR/CM List

Attribute
CR R: Read only Function
Blank: Read/write
CR5600 Operation record 0 Save request
CR5601 R Operation record 0 Operating
CR5602 R Operation record 0 Save trigger monitor
CR5603 R Operation record 0 Saving
CR5604 R Operation record 0 Collecting
CR5605 R Operation record 0 Setting error
CR5606 - Reserved for the system
Operation recorder function (ID0)
DR5607 R Operation record 0 Save completed
CR5608 R Operation record 0 Save error
CR5609 R Device record 0 Buffer shortage
CR5610 to
APPENDICES

- Reserved for the system


CR5613
CR5614 Operation record 0 Buffer area full save mode
CR5615 - Reserved for the system
CR5700 to
Operation recorder function (ID1~ID3)
CR5919
CR6000 to
- Reserved for the system
CR7915
CR/CM List

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


CR/CM List

Control Memory CM (For KV-8000)

Control memory entries (CM0000 - CM7599) can be used to perform operations such as checking the
operation status of the CPU unit and setting and monitoring the built-in functions.
Control memory entries reserved for the system cannot be used.
Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold

CM0000 and
- Reserved for the system
CM0699
CM0700 R Read from RTC (year)
CM0701 R Read from RTC (month)

APPENDICES
CM0702 R Read from RTC (day)
CM0703 R Read from RTC (hour)
CM0704 R Read from RTC (minute)
CM0705 R Read from RTC (second)
CM0706 R Read from RTC (day of the week)
CM0707 to
- Reserved for the system
CM709
CM0710 R File register current bank number
CM0711 to

CR/CM List
- Reserved for the system
CM0899
CM900 R CPU function version
CM901 to
- Reserved for the system
CM906
CM907 R Project Version
CM908 to
- Reserved for the system
CM999
CM1000 and
R Scan time measuring value (1 μs) (32-bit)
CM1001
CM1002 and
R END processing time measured value (1 μs unit) (32-bit)
CM1003
CM1004 and
R Minimum fixed scanning time (1 μs unit) (32-bit)
CM1005
CM1006 and
R Maximum fixed scanning time (1 μs unit) (32-bit)
CM1007
CM1008 and
Fixed scanning time run set value (1 μs unit) (32-bit)
CM1009
CM1010 and
END processing time set value (1 μs unit) (32-bit)
CM1011
CM1012 and
R Scanning time when setting is exceeded (1 μs unit) (32-bit)
CM1013
CM1014 and
R END processing time exceeds value (1 μs unit) (32-bit)
CM1015
CM1016 to
- Reserved for the system
CM1029
CM1030 and
R 32-bit 1 ms Free Run counter
CM1031
CM1032 and
R 32-bit 10 μs Free Run counter
CM1033
CM1034 and
R 32-bit 1 μs Free Run counter
CM1035
CM1036 and
R 32-bit 0.1 μs Free Run counter
CM1037
CM1038 to
- Reserved for the system
CM1499
CM1500 to
R Log/trace (ID0 to ID9) File Save Counter
CM1509

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


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

A-48 - KV-8000/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

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 - Recipe load Drive number Yes
CM1871 Recipe load Folder number Yes
CM1872 Reserved for the system
CM1873 Recipe load Completion code Yes
CM1874 Reserved for the system
CM1875 Recipe save Drive number Yes
CM1876 Recipe save Reference folder number Yes
CM1877 Recipe save Output folder number Yes
CM1878 Recipe save Completion code

CR/CM List
Yes
CM1879 Reserved for the system
CM1880 Project load drive number (request)
CM1881 Project load folder number (request)
CM1882 R Project load drive number (complete)
CM1883 R Project load folder number (complete)
CM1884 R Project load completion code
CM1875 to
- Reserved for the system
CM1877
CM1888 Project save drive number (request)
CM1889 Project save folder number (request)
CM1890 R Project save drive number (complete)
CM1891 R Project save folder number (complete)
CM1892 R Project save completion code
CM1893 to
- Reserved for the system
CM1999
CM2000 to
R Device record 0 Average sampling period
CM2001
CM2002 to Device record 0 Average number of changed
R
CM2003 Operation recorder devices
CM2004 to function (ID0)
R Device record 0 Maximum collection period
CM2005
CM2006 to
− Reserved for the system
CM2009
CM2010 to
Operation recorder function (ID1~ID3)
CM2039
CM2040 to
− Reserved for the system
CM2389
CM2390 R Error code for storage device instruction
Power OFF during storage access
CM2391 (Becomes value other than 0 during occurrence. Please change it to 0 from
the program.)
CM2392 Memory card retry occurrence times (still hold in case of power off)
CM2393 Memory card check error times (still hold in case of power off)
CM2394 Memory card timeout occurrence times (still hold in case of power off)
CM2395 Reset delay time when error occurs on the memory card
CM2396 to
− Reserved for the system
CM2399
CM2400 to
R Inter-unit synchronization refreshing beginning time (0.1μs)
CM2401

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


CR/CM List

Attribute
Hold
CM R: Read only Function
Blank: Read/write Yes: Hold

CM2402 to
R Inter-unit synchronization refreshing finishing time (0.1μs)
CM2403
CM2404 to Inter-unit synchronization refreshing beginning time maximum (0.1μs)
Yes
CM2405 (To reset, please change it to 0 from this program.)
CM2406 to Inter-unit synchronization refreshing finishing time maximum (0.1μs)
Yes
CM2407 (To reset, please change it to 0 from this program.)
CM2408 to
R Inter-unit synchronization refreshing operation time (0.1μs)
CM2409
CM2410 to
− Reserved for the system
CM5099
Year and month (Indicated as decimal values. The
CM5100 R last two digits show Month, and previous digits from Yes
hundred show Year. Example: 1210 → October 2012)
APPENDICES

CM5101 R Day Yes


CM5102 R Hour Yes
CM5103 R Minute Yes
CM5104 R Details of the latest Second Yes
CM5105 R serious error Error number Yes
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
CR/CM List

CM5126 R Detailed information, piece 20* Yes


CM5127 to
- Reserved for the system
CM5149
Year and month (Indicated as decimal values. The
CM5150 R last two digits show Month, and previous digits from Yes
hundred show Year. Example: 1210 → October 2012)
CM5151 R Day Yes
CM5152 R Hour Yes
CM5153 R Minute Yes
CM5154 R Details of the latest minor Second Yes
CM5155 R error Error number Yes
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
CM6000 Operation record 0 Save completion code
CM6001 − Reserved for the system
CM6002 Operation record 0 Save counter
CM6003 − Reserved for the system
CM6004 R Operation record 0 Save progress detail 1
CM6005 R Operation recorder Operation record 0 Save progress detail 2
CM6006 R function (ID0) Operation record 0 Save progress
CM6007 to
− Reserved for the system
CM6009
CM6010 to
R Operation record 0 Save path
CM6171
CM6172 to
− Reserved for the system
CM6199
CM6200 to
Operation recorder function (ID1~ID3)
CM6799
CM6800 to
− Reserved for the system
CM7599

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


CR/CM List

■Detailed Information of the Error-For KV-8000


• 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.
25 PIDAT, outside of sampling period range.
Detailed information,
26 PIDAT, outside of comparison constant range.
piece 1
27 PIDAT, outside of integral constant range.
(CM0712/CM5157)
28 PIDAT, outside of differential constant range.
29 PIDAT comparison constant, two-degree freedom parameters outside of range.
30 PIDAT integral constant, two-degree freedom parameters outside of range.
31 PIDAT differential constant, two-degree freedom parameters outside of range.
32 PIDAT, outside of operation quantity upper limit or lower limit range.
33 PIDAT, outside of operation quantity change width limit range.
34 PIDAT, outside of measured value change width range.
35 PIDAT, AT state transition error.
36 PIDAT, outside of operation control flag range.
37 Operation period exceeded.
38 PIDAT, outside of AT adjustment parameter range.
39 PIDAT, outside of AT hysteresis range.
40 PIDAT, outside of AT timeout range.
41 PIDAT, outside of AT calculation control mode setting range.
42 PIDAT, AT timeout.
43 PIDAT, AT comparison constant exceeded.
44 PIDAT, AT integral constant exceeded.
45 PIDAT, AT differential constant exceeded.
46 Root of negative number cannot be calculated.
47 Incorrect ABS instruction operand.
48 Calculation overflow.
49 UR, UM, or UV unit not connected.
50 Unit device (R) not assigned.
51 Unit device (DM) not assigned.
52 Unit categories disagree.
53 Operation recorder ID illegal
54 Stack overflow
Detailed information,
piece 2 Fixed to 00H.
(CM5158)
Detailed information,
piece 3 Upper bits of the step number at which the error occurred.
(CM5159)
Detailed information,
piece 4 Lower bits of the step number at which the error occurred.
(CM5160)

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


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)
* When CR2012 is ON, CM0712 stores immediate values, and CM5150 to CM5176 stores values
after several scans.
• Error numbers 50, 53, 55, 56, 58, 59 and 63(Unit number errors)
Detailed Information, Piece n Description
Detailed information, piece 1 Unit number (the unit number will not be stored if it cannot be
(CM5107) determined according to the occurrence conditions of the error)
Detailed information, pieces 2 to 20
Fixed to 00H
(CM5108 to CM5126)
APPENDICES

• Error number 54 (Number of units error)


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
CR/CM List

(CM5109 to CM5126)
• Error number 127 (Auto loading failure error)
Detailed Information, Piece n Description
Detailed information, piece 1
(CM5157) Detailed content of the error

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-52 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-53


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-54 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-55


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-56 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-57


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-58 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-59


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-60 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-61


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-62 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-63


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-64 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-65


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-66 - KV-8000/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
CM0204, CM0205 Operation panel Set up 3rd line display attribute
KV-D30
CM0206, CM0207 Set up 4th line display attribute
0 Pages
CM0208 Setup module 1
CM0209 Setup module 2

CR/CM List
CM0210 to CM0399 Page 1 to 19 (same as CM0200 to CM0209)
CM0400 For conversion enable/inhibited setting
CM0401 For settings of page conversion
CM0402 Operation panel Current display page
CM0403 to CM0409 KV-D30 Reserved for system
CM0410 to CM0415 Direct access function
CM0416 to CM0499 - Reserved for system
CM0500 to CM0699 - Reserved for system
CM0700 R (year)
CM0701 R (month)
CM0702 R (day)
Read from
CM0703 R (hour)
calendar timer
CM0704 R (Minute)
CM0705 R (s)
CM0706 R (week)(0: (Sun), 1 (Mon), 2: (Tues) 3: (Wed) 4: (Thur) 5: (Fri), 6 (Sat))
CM0707 - Reserved for system
CM0708, CM0709 R Free Run Counter (32-bit, 1ms)
CM0710 R Current memory No.of FM
CM0711 R If V2.0 CPU functional version is used, save "2", for other situations, save "0"
CM0712 R Execution time of constant cycle module (10µs unit)
CM0713 to CM0715 - Reserved for system
CM0716 Maximum exeuction time (10µs unit) for Fixed Period Module
CM0717 to CM0719 - Reserved for system
CM0720 R Scan time measuring value (10µs unit)
CM0721 Fixed scanning time run set value (10µs unit)
Exceeds scanning time set up (-fixed scanning time running/END processing time
CM0722 R
settings) scanning time (10µs unit)
CM0723 END processing time measured value (10µs unit)
CM0724 to CM0725 - Reserved for system
CM0726 R Minimum fixed scanning time (10µs unit)
CM0727 R Maximum fixed scanning time (10µs unit)
CM0728 END processing time set value (10µs unit)
Exceeds scanning time set up (-fixed scanning time running/END processing time
CM0729
settings) scanning time (10µs unit)
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-67
CR/CM List

Attributes
Device No. R: Read only. Function
Blank: R/W

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
(CTH1)
APPENDICES

CM1493 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-68 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-69


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
0
CM2067 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-70 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-71


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
8 No ENCO instruction ON bit
APPENDICES

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-72 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-73


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-74 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-75
CR/CM List

Attribute
CR R: Read only Function
Blank: Read/write
CR3005 Project load execution failure
CR3006 Project save execution completion
CR3007 Project save execution failure
CR3008 to
- Reserved for the system
CR3209
CR3210 R Optional logging or tracing memory card is in use
CR3211 R Memory card is in use
CR3212 R Memory card recognition complete
CR3213 R Memory card present
CR3214 R Memory card executing instructions
CR3215 R Memory card write protection
APPENDICES

CR3300 to
- Alarm relays
CR3415
CR3500 R Alarm operation relay (ON: one of CR3300 to CR3415 is turned ON)
Record an entry in the log when an alarm relay switches from ON to OFF (ON: record, OFF: do not
CR3501
record)
CR3502 The alarm relay log is cleared when this switches from OFF to ON
CR3503 to
Reserved for the system
CR3513
CR3514 Disables multiple keys
HKEY instruction
CR3515 R Scan completion
CR/CM List

CR3600 to
R HKEY information storage area
CR3615
CR3700 F1 customize switch 1
CR3701 F2 customize switch 2
CR3702 F3 customize switch 3
CR3703 F4 customize switch 4
CR3704 LED1 customize indicator 1
CR3705 LED2 customize indicator 2
CR3706 LED3 customize indicator 3
CR3707 LED4 customize indicator 4
CR3708 Green back light (lights when this is turned ON)
CR3709 Red back light (lights when this is turned ON)
Operator panel KV-D30 System message display language (ON: Japanese, OFF:
CR3710
English)
CR3711 Buzzer ON
Screen display setting (ON: positive display, OFF:
CR3712
negative display)
CR3713 Alarm interrupt enable (ON: enabled, OFF: disabled)
Page switching (switches to the page indicated by the
CR3714
value of CM0401 on a rising edge; forced OFF)

CR3715 Disables page switching using the "▲" and "▼" keys
(ON: disabled, OFF: enabled)
CR3800 Sets external output 0 to ON when this is turned ON
CR3801 Sets external output 1 to ON when this is turned ON
CR3802 to
- Reserved for the system
CR3815
CR3900 The serious error log is cleared when this switches from OFF to ON
CR3901 The minor error log is cleared when this switches from OFF to ON
CR3902 R Indicates that the serious error log is full
CR3903 R Indicates that the minor error log is full
CR3904 R RUN-PROG selector switch status (ON: RUN, OFF: PROG)
CR3905 R A serious error has occurred
CR3906 R A minor error has occurred
CR3907 The power on log is cleared when this switches from OFF to ON
CR3908 The power off log is cleared when this switches from OFF to ON
CR3909 Clears the current error

A-76 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-77


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-78 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-79


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-80 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-81


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-82 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-83


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-84 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-85


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM0712 to
- Reserved for the system
CM719
CM0720 R Scan time measured value (in units of 10 μs)
CM0721 Set value during fixed scan time operation (in units of 10 μs)
Scan time (in units of 10 μs) when the scan time setting (the fixed scan time
CM0722 R
operation and END processing time settings) is exceeded
CM0723 R END processing time measured value (in units of 10 μs)
CM0724,
- Reserved for the system
CM725
CM0726 R Minimum scan time value (in units of 10 μs)
CM0727 R Maximum scan time value (in units of 10 μs)
APPENDICES

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


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM1690 to
- Reserved for the system
CM1699
CM1700 R AutoLoad folder No. (request) ○
CM1701 R RunLoad folder No. (request) ○
CM1702 R Folder No. during project load (request) ○
CM1703 R Folder No. during project save (request) ○
CM1704 to
Reserved for the system
CM1709
CM1710 R Completion code of automatic loading when power is turned on
CM1711 R Automatic loading folder No. during power-on (complete)

APPENDICES
CM1712 R Automatic loading completion code during PROG→RUN ○
CM1713 R Automatic loading folder No. during PROG→RUN (complete) ○
CM1714 R Completion code during project load ○
CM1715 R Folder No. during project load (complete) ○
CM1716 R Completion code during project save ○
CM1717 R Folder No. during project save (complete) ○
CM1718,
- Reserved for the system
CM1719

CR/CM List
CM1720 User message 1 ○
CM1721 to User message 2
CM1737 (up to 24 characters + end code (00H)) ○
CM1738 Access window operation disabled setting ○
CM1739 Reserved for the system
CM1740 to Ladder project name
CM1756 (up to 32 characters + end code (00H))
CM1757 to Project name to be displayed in the access window
CM1763 (up to 12 characters + end code (00H))
CM1764 to
- Reserved for the system
CM1779
CM1780 Access window initial screen setting, enabled ○
CM1781 Access window initial screen setting, device type ○
Access window
CM1782 Access window initial screen setting, screen ID ○
CM1783 Access window initial screen setting, screen ID ○
CM1784 Access window initial screen setting, device number ○
CM1785 Access window initial screen setting, device number ○
CM1786 Access window initial screen setting, display format ○
Access window initial screen setting, device name
CM1787 ○
representation
CM1788 Access window initial screen setting, key lock status ○
Access window initial screen setting, display
CM1789 ○
language
CM1790 to
- Reserved for the system
CM2199
CM2200 Year and month ○
CM2201 Day ○
CM2202 Hour ○
CM2203 Minute ○
CM2204 Seconds ○
CM2205 Detailed information of Number ○
the latest serious error, 1
CM2206 Detailed information, number of valid pieces of data ○
unit
CM2207 Detailed information, piece 01 ○
CM2208 Detailed information, piece 02 ○
: ○
CM2226 Detailed information, piece 20 ○
CM2227 to
- Reserved for the system
CM2249

- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-87


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM2250 Year and month ○
CM2251 Day ○
CM2252 Hour ○
CM2253 Minute ○
CM2254 Seconds ○
Detailed information of
CM2255 the latest minor error, Number ○
1 unit*1
CM2256 Detailed information, number of valid pieces of data ○
CM2257 Detailed information, piece 01 ○
CM2258 Detailed information, piece 02 ○
APPENDICES

: ○
CM2276 Detailed information, piece 20 ○
CM2277 to
- Reserved for the system
CM2388
CM2389 R Number of connected expansion units
CM2390 R Error code for memory card instructions
CM2391 Power OFF when accessing memory card ○
CM2392 Memory card retry occurrence times ○
CR/CM List

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


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM4828,
- Reserved for the system
CM4829
CM4830 Constant when rotation direction is detected ○
CM4831 Enable, clear, and sign setting ○
CM4832,
High-speed counter Ring counter lower limit ○
CM4833
function (CTH3)
CM4834,
Ring counter upper limit ○
CM4835
CM4836,
Preset input ○
CM4837
CM4838,
- Reserved for the system ○
CM4839

APPENDICES
CM4840 to
- Reserved for the system
CM4899
CM4900,
R Frequency measured result (Hz or rpm)
CM4901
CM4902 Number of pulses per rotation ○
Frequency counter
CM4903 function (CTH0) Number of scans ○
CM4904 External input source ○
CM4905 - Reserved for the system
CM4906 Set frequency (Hz) ○

CR/CM List
Specified frequency pulse
CM4908 Duty cycle (0 to 100%) ○
output function (CH0)
CM4909 - Reserved for the system
CM4910,
R Frequency measured result (Hz or rpm)
CM4911
CM4912 Number of pulses per rotation ○
Frequency counter
CM4913 function (CTH1) Number of scans ○
CM4914 External input source ○
CM4915 - Reserved for the system
CM4916 Set frequency (Hz) ○
Specified frequency pulse
CM4918 Duty cycle (0 to 100%) ○
output function (CH1)
CM4919 - Reserved for the system
CM4920,
R Frequency measured result (Hz or rpm)
CM4921
CM4922 Number of pulses per rotation ○
Frequency counter
CM4923 function (CTH2) Number of scans ○
CM4924 External input source ○
CM4925 - Reserved for the system
CM4926 Set frequency (Hz) ○
Specified frequency pulse
CM4928 Duty cycle (0 to 100%) ○
output function (CH2)
CM4929 - Reserved for the system
CM4930,
R Frequency measured result (Hz or rpm)
CM4931
CM4932 Number of pulses per rotation ○
Frequency counter
CM4933 function (CTH3) Number of scans ○
CM4934 External input source ○
CM4935 - Reserved for the system
CM4936 Set frequency (Hz) ○
Specified frequency pulse
CM4938 Duty cycle (0 to 100%) ○
output function (CH3)
CM4939 Reserved for the system
CM4940 to
- Reserved for the system
CM4999
CM5000 to
For built-in serial assignment
CM5999

- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-89


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM6000 to
For extension function assignment 1
CM6999
CM7000 to
For extension function assignment 2
CM7999
CM8000,
Target value or travel Set
CM8001
CM8002 Acceleration rate Set
CM8003 Deceleration rate Set
CM8004, CPU positioning function,
axis 1
Operation frequency Set
CM8005
CM8006 Point parameter 1 Operation mode Set
APPENDICES

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


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8800 I/O setting
CM8801 Sensor enable
CM8802,
Comparator 0, current value
CM8803
CM8804,
Comparator 1, current value
CM8805
CM8806,
Comparator 2, positioning
CM8807
CM8808 Starting speed
CM8809 Origin returning operation: starting frequency
CM8810 Origin returning operation: acceleration rate

APPENDICES
CM8811 Origin returning operation: deceleration rate
CM8812,
Origin returning operation: operation frequency
CM8813
CM8814 Origin returning operation: detailed settings
CM8815 JOG operation: starting frequency
CM8816 JOG operation: acceleration rate
CM8817 CPU positioning function, JOG operation: deceleration rate
axis 1
CM8818,
JOG operation: operation frequency

CR/CM List
CM8819
CM8820,
Home position
CM8821
CM8822,
- Reserved for the system
CM8823
CM8824,
Current coordinate change value
CM8825
CM8826, Operation speed change value during speed control
CM8827 mode
CM8828,
Target coordinate change value
CM8829
CM8830,
R Output pulse, current coordinate
CM8831
CM8832,
R Output frequency, current value
CM8833
CM8834 R Error code
CM8835 R Execution point number
CM8836 to
- Reserved for the system
CM8839

- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-91


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8840 I/O setting
CM8841 Sensor enable
CM8842,
Comparator 0, current value
CM8843
CM8844,
Comparator 1, current value
CM8845
CM8846,
Comparator 2, positioning
CM8847
CM8848 Starting speed
CM8849 Origin returning operation: starting frequency
CM8850 Origin returning operation: acceleration rate
APPENDICES

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


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8880 I/O setting
CM8881 Sensor enable
CM8882,
Comparator 0, current value
CM8883
CM8884,
Comparator 1, current value
CM8885
CM8886,
Comparator 2, positioning
CM8887
CM8888 Starting speed
CM8889 Origin returning operation: starting frequency
CM8890 Origin returning operation: acceleration rate

APPENDICES
CM8891 Origin returning operation: deceleration rate
CM8892,
Origin returning operation: operation frequency
CM8893
CM8894 Origin returning operation: detailed settings
CM8895 JOG operation: starting frequency
CM8896 JOG operation: acceleration rate
CM8897 CPU positioning function, JOG operation: deceleration rate
axis 3
CM8898,
JOG operation: operation frequency

CR/CM List
CM8898
CM8900,
Home position
CM8901
CM8902,
Reserved for the system
CM8903
CM8904,
Current coordinate change value
CM8905
CM8906, Operation speed change value during speed control
CM8907 mode
CM8908,
Target coordinate change value
CM8909
CM8910,
R Output pulse, current coordinate
CM8911
CM8912,
R Output frequency, current value
CM8913
CM8914 R Error code
CM8915 R Execution point number
CM8916 to
Reserved for the system
CM8919

- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-93


CR/CM List

Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8920 I/O setting
CM8921 Sensor enable
CM8922,
Comparator 0, current value
CM8923
CM8924,
Comparator 1, current value
CM8925
CM8926,
Comparator 2, positioning
CM8927
CM8928 Starting speed
CM8929 Origin returning operation: starting frequency
CM8930 Origin returning operation: acceleration rate
APPENDICES

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-94 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-95


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-96 - KV-8000/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-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-97


Instruction Table Cannot be Used
It describes the command terms that cannot be used within the initialization module, function block,
macro, sub-routine program, interruption program (except fixed-cycle module).

● Initialization module, interruption program (except fixed-cycle module)


Instruction Type Instruction
Common @XXXX Differential execution type
instructions
LDP/LDF Load pulse/load pulse fall
ANP/ANF AND pulse/AND pulse fall
ORP/ORF OR pulse/OR pulse fall
Contact Instructions
LDPB/LDFB Load pulse/Load pulse fall
ANPB/ANFB AND pulse/AND pulse fall
APPENDICES

ORPB/ORFB OR bar pulse/OR bar pulse fall


DIFU/DIFD Differential up / Differential down
ONDL/OFDL ON delay / OFF delay
Output instructions SHOT One shot
Basic FLIK Flicker
Instructions
ALT Alternate
TMR/TMH/TMS/ Timer / high-speed timer / high-speed 1ms timer /
TMU high-speed 10μs timer
Instruction Table Cannot be Used

C Counter
Timer, counter OUTC Output counter
instructions
ITVL Interval timer
UDC Up/down counter
UDT Up/down timer
Connection/
MEP/MEF Mep/Mef
End Instruction
Shift Instruction SFT Shift
STG/JMP/ENDS Stage / Jump / end stag,e
Stage processing
W-ON/W-OFF Wait ON/ Wait OFF
Applied instruction
Instructions W-UE/W-DE Wait rising edge / Wait falling edge
Sub-routine entry/Sub-routine return/to LABEL
Flow instruction SBN/RET/SCJ
instruction
File Register Instructions FRSTM/FRLDM File Register batch save / File Register batch read
RAMP/TPOUT/ Ramp signal, time proportional output, lead-lag
Arrithmetic Data control instructions
LLFLT filter
operation
instructions Text processing RCOM Character string readout
instruction
Data processing HKEY Hex key input
instructions SORTN Split and sort binary data
Cam switch instructions ABSENC/INCENC Abstract encoder / incremental encoder
Frequency counter
FCNT/RCNT Measure frequency / Measure speed
instructions
PID control instruction PID/PIDAT PID / PID with auto tuning
MWRIT/MREAD/ Write storage device/read storage device/get storage
MFREE/MMKDIR device space/create storage device directory
Extended MRMDIR/MDEL Delete storage device file/folder
Instructions Storage device
Write storage device text string / read one storage
instructions MPRINT/MREADL/
device line / copy storage device file / move
MCOPY/MMOV/
storage device file / rename storage device file /
MREN/MFREEK/
get storage device free space in kilobyte unit / get
MSTAT
storage device file status
Access window AWNUM/AWMSG User message 1/2
instructions AWSHOW/AWHIDE Display user message/delete user message
Sensor setting SPRD/SPWR/ Read sensor parameter / write sensor parameter
instruction SSVC / execute sensor service
A-98 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Instruction Table Cannot be Used

● Function block

Instruction Type Instruction


Applied
Macro instructions MCALL/MSTRT Macro call / macro start
Instructions

* The FEND (function block end) instruction is written in the function block. It cannot be used in other types of
programs such as functions or modules.

● Function

Instruction Type Instruction


Macro instructions MCALL/MSTRT Macro call / macro start
Applied FB Function block

APPENDICES
Function block
Instructions FBSTRT Instance type function block start
instructions
FBCALL Instance type function block call

● Macro

Instruction Type Instruction


Macro instructions MCALL/MSTRT Macro call / macro start
Applied FB/FUN Function block / function

Instruction Table Cannot be Used


Function block
Instructions FBSTRT Instance type function block start
instructions
FBCALL Instance type function block call

* The MEND (macro end) instruction is written in the self-hold type macro. It cannot be used in other types of
programs such as sub-routine type macros or modules.

● Subroutine

Instruction Type Instruction


Memory switch
MEMSW Memory switch
Applied instruction
Instructions Stage processing
STG/JMP/ENDS Stage / Jump / end stage
instruction
High-speed
Extended
processing INT/RETI Break / break return
Instructions
instructions

- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-99


Index
Device List (KV-5500/5000/3000) ......................... 1-12
Symbols Bit device ·············································· 1-12
Constant ··············································· 1-14
□ .D ......................................................................1-28 Internal register ······································ 1-14
□ .DF ....................................................................1-28 Macro operand device ····························· 1-14
□ .F ......................................................................1-28 Word device ·········································· 1-13
□ .L ......................................................................1-28 Device List (KV-7000) ......................................1-4, 1-8
□ .S ......................................................................1-28 Bit device ··········································1-4, 1-8
□ .U ......................................................................1-28 Constant ········································· 1-6, 1-10
Internal register ································ 1-6, 1-10
Macro operand device ······················· 1-5, 1-10
Numbers Word device ······································1-5, 1-9
Double precision floating point type real number . 1-34
16-bit BIN data ......................................................1-31
APPENDICES

32-bit BIN data ......................................................1-31


64-bit BIN data ......................................................1-31 E
Every-scan Execution Type and Differential Execution
A Type ...................................................................... 1-39
About initialization of previous value 1-39
ASCII .................................................................... A-97 Detect the condition of execution condition's falling
ASCII code ............................................................1-38 edge 1-39
Detect the condition of execution condition's rising
edge ···················································· 1-39
Index

B Differential execution type ························ 1-39


Every-scan execution type 1-39
Precautions on the use of differential execution
BIN data ................................................................1-31
type instructions ····································· 1-40
16-bit BIN data ······································ 1-31
32-bit BIN data ······································ 1-31
64-bit BIN data ······································ 1-31
Binary Coded Decimal ..........................................1-33
F
Bit device ..............................................................1-16
Bit device processing of word device ....................1-49 falling edge ........................................................... 1-39
Function ............................................................... A-99
Function block ..................................................... A-99
C
Calendar contact instruction constant entry ........5-102
G
Character code .....................................................1-38
Constant ................................................................1-18 Global device range .................... 1-7, 1-11, 1-15, 1-18
DEC constant (#) ··································· 1-18
Fixed text string 1-18
HEX constant ($) 1-18 H
Single precision floating point type real number 1-
33 How to Input When Using Local Devices ............. 2-60
Constants ..............................................................1-22
Control Relays ............................................A-43, A-53
I
D Infinitely large ....................................................... 1-37
Initialization module ............................................. A-98
DEC ......................................................................1-32 Internal register ........................... 1-6, 1-10, 1-14, 1-18
Device List (KV Nano Series) Internal Registers ................................................. 1-22
Bit device ············································· 1-20
Constants ············································· 1-22
Internal registers ···································· 1-22 L
Macro argument devices ························· 1-22
Word device ·········································· 1-21 List of control relay control memory ..................... A-43
Device List (KV-1000) ...........................................1-16 Local device list (KV Nano Series) ....................... 1-23
Bit device ············································· 1-16 Local device list (KV-1000) ................................... 1-18
Constant ·············································· 1-18 Local device list (KV-5500/5000/3000) ................. 1-15
Internal register ······································ 1-18 Local device list (KV-7000) ............................1-7, 1-11
Word device ·········································· 1-17
A-100 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -
Index

Unit Special Instruction ······························1-2


M
Macro ................................................................... A-99 V
Value change when exceeding max. or min. ........ 1-37
O Variable
Processing of bit data and word data
Operand ........................................................ 1-3, 1-44 by operand ············································ 1-46
Conventions and cautions in operand list ···· 1-44
Other matters needing attention ················ 1-51
Processing of Bit Device and W
Word Device T, C, CTH, CTC ··················· 1-46
Word unit processing of bit device ........................ 1-47

APPENDICES
P
Precautions on the use of differential execution
type .......................................................................1-40

Index
Relationship between numerical representation ...1-35
16-bit data ············································ 1-35
32-bit data ············································ 1-36
Value change when exceeding max. or
min. ····················································· 1-37
Representation of numerical value .......................1-32
BIN ····················································· 1-32
BIN Coded DEC ····································· 1-33
DEC signed ·········································· 1-32
DEC unsigned ······································· 1-32
Double precision floating point type real
number ················································ 1-34
HEX ···················································· 1-32
Single precision floating point type real
number ················································ 1-33

S
Shift JIS code ........................................................1-38
Single precision floating point type real number ...1-33
Structure of Instruction ............................................1-3
Instruction Code ······································ 1-3
Operand Code ········································· 1-3
Processing time of instructions ···················· 1-3
Subroutine ............................................................ A-99
Suffix .....................................................................1-28
Definition of Suffixes ······························· 1-28
Difference between .D and .L ··················· 1-29
Difference between .U and .S ··················· 1-29
System device ............................. 1-7, 1-11, 1-15, 1-18

T
Types of Instruction .................................................1-2
Applied Instructions ·································· 1-2
Arithmetic Operation Instructions ················· 1-2
Basic Instructions ····································· 1-2
Extended Instructions ······························· 1-2
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-101
Instruction Index
BCMP ................................................................... 5-47
Symbols BCMPI .................................................................. 5-51
BCNT ...................................................................... 5-9
< ..........................................................................2-12 BLD ......................................................................... 2-8
<= .......................................................................2-12 BLDB ...................................................................... 2-8
<> .......................................................................2-12 BMOV ................................................................... 4-24
= ..........................................................................2-12 BOR ........................................................................ 2-8
> ..........................................................................2-12 BORB ..................................................................... 2-8
>= .......................................................................2-12 BOUB ................................................................... 2-34
BOUT .................................................................... 2-34
BREAK ................................................................. 3-33
A BRES .................................................................... 2-36
BSET .................................................................... 2-36
ABS .....................................................................4-186 BSIZE ................................................................... 3-98
APPENDICES

ABSENC ................................................................. * 1 BSL ..................................................................... 4-130


ACNT ....................................................................3-94 BSR .................................................................... 4-128
ACOS ..................................................................4-232 BSUM ................................................................... 5-37
ADD ......................................................................4-40 BSWAP ............................................................... 4-178
ADRADD ...............................................................3-66 BYBMOV .............................................................. 4-36
ADRDEC ...............................................................3-64 BYLMOV ............................................................... 4-34
ADRINC ................................................................3-64
ADRSET ...............................................................3-62
ADRSUB ...............................................................3-66 C
Instruction Index

AJST .....................................................................5-94
ALT .......................................................................2-31 C ........................................................................... 2-46
ANB .........................................................................2-2 CAL- ................................................................... 4-324
AND ........................................................................2-2 CAL^ ................................................................... 4-340
ANDA ....................................................................4-80 CAL* ................................................................... 4-328
ANDCAL .............................................................5-101 CAL/ .................................................................... 4-332
ANDCALB ...........................................................5-101 CAL& .................................................................. 4-336
ANDWK .................................................................5-96 CAL+ ................................................................... 4-320
ANDWKB ..............................................................5-96 CAL<< ................................................................ 4-348
ANF .........................................................................2-4 CAL>> ................................................................ 4-344
ANFB ......................................................................2-6 CAL | ................................................................ 4-338
ANL .......................................................................2-68 CAL~ ................................................................... 4-342
ANP .........................................................................2-4 CALL ..................................................................... 3-27
ANPB ......................................................................2-6 CHGSP ....................................................................* 1
APR .....................................................................4-138 CHGSPX .................................................................* 1
ARES ..................................................................5-105 CHGSPY .................................................................* 1
ASC .....................................................................4-236 CHGTGT .................................................................* 1
ASIN ....................................................................4-232 CJ ......................................................................... 3-37
ASLA ...................................................................4-104 CMP ...................................................................... 4-72
ASRA ..................................................................4-100 COM ..................................................................... 4-88
ATAN ..................................................................4-232 CON ...................................................................... 2-64
ATAN2 ................................................................4-234 COS .................................................................... 4-228
AVG ......................................................................5-27 CPMGET ............................................................ 4-194
AWHIDE ..............................................................5-239 CPMSET ............................................................. 4-188
AWMSG ..............................................................5-235 CPSASC ............................................................. 4-316
AWNUM ..............................................................5-233 CRC ...................................................................... 5-39
AWSHOW ...........................................................5-237

D
B
DASC .................................................................. 4-240
BANB ......................................................................2-8 DCNT .................................................................... 5-11
BAND ......................................................................2-8 DEC ...................................................................... 4-64
BANDC ...............................................................4-134 DECO ................................................................. 4-182
BBCMP .................................................................5-55 DEG .................................................................... 4-224
BBMOV .................................................................4-38 DFLOAT ............................................................. 4-200
*1 Refer to the user's manual for the CPU or base unit.

A-102 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Index

DFTOF ................................................................4-210
DI ........................................................................5-109 H
DIC ......................................................................5-111
DIFD ......................................................................2-22 HASC .................................................................. 4-248
DIFU ......................................................................2-22 HKEY ...................................................................... 5-2
DINTG .................................................................4-206 HOME ......................................................................* 1
DISB ....................................................................4-172 HOMEX ...................................................................* 1
DISF ....................................................................4-214 HOMEY ...................................................................* 1
DISN ...................................................................4-168 HSP .................................................................... 5-107
DISS ....................................................................4-308
DIV ........................................................................4-54
DMX ....................................................................4-162 I
DSER ....................................................................5-19
DW ........................................................................4-20 INC ....................................................................... 4-60

APPENDICES
INCENC ...................................................................* 1
INT ...................................................................... 5-113
E INTG ................................................................... 4-202
INV ........................................................................ 2-70
ECALL ...................................................................3-31 IS_ □□□ ........................................................... 3-100
EI .........................................................................5-109 ITVL ...................................................................... 2-52
ENCO ..................................................................4-184
END ......................................................................2-62
ENDH ....................................................................2-62 J

Instruction Index
ENDS ....................................................................3-12
ENRA ....................................................................4-86 JMP ...................................................................... 3-12
EORA ....................................................................4-84 JOG .........................................................................* 1
EXP .....................................................................4-218 JOGX .......................................................................* 1
EXT .......................................................................5-43 JOGY .......................................................................* 1

F K
KEEP .................................................................... 2-20
FASC ..................................................................4-256
FB .........................................................................3-48
FBCALL ................................................................3-52
FBSTRT ................................................................3-52
L
FCNT ...................................................................... * 1
LABEL .................................................................. 3-37
FDEL .....................................................................5-88
LD ........................................................................... 2-2
FEND ....................................................................3-48
LDA ......................................................................... 4-6
FIFOR ...................................................................5-72
LDB ......................................................................... 2-2
FIFOW ..................................................................5-68
LDCAL ................................................................ 5-101
FINS ......................................................................5-86
LDCALB .............................................................. 5-101
FLIK ......................................................................2-29
LDF ......................................................................... 2-4
FLOAT ................................................................4-198
LDFB ...................................................................... 2-6
FMOV ....................................................................4-26
LDP ......................................................................... 2-4
FOR ......................................................................3-33
LDPB ...................................................................... 2-6
FRLDM ..................................................................3-74
LDWK ................................................................... 5-96
FRSET ..................................................................3-70
LDWKB ................................................................. 5-96
FRSTM ..................................................................3-72
LEN ..................................................................... 4-264
FTODF ................................................................4-212
LIFOR ................................................................... 5-80
FUN .......................................................................3-48
LIFOW .................................................................. 5-76
FWRIT ...................................................................5-84
LIMIT .................................................................. 4-132
LLFLT ................................................................. 4-154
G LOG .................................................................... 4-218
LOG10 ................................................................ 4-222
GOTO ...................................................................3-37 LOGD ......................................................................* 1
LOGE .......................................................................* 1
GRY ....................................................................4-164
*1 Refer to the user's manual for the CPU or base unit.

- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-103


Instruction Index

ORG ........................................................................ * 1
M ORGX ...................................................................... * 1
ORGY ...................................................................... * 1
MAX ......................................................................5-21 ORWK .................................................................. 5-96
MC ........................................................................3-23 ORWKB ................................................................ 5-96
MCALL ..................................................................3-43 OUB ...................................................................... 2-16
MCMP ..................................................................... * 1 OUT ...................................................................... 2-16
MCOPY ...............................................................5-209 OUTC ................................................................... 2-50
MCR ......................................................................3-23
MDEL ..................................................................5-197
MDSTOP ...............................................................3-56 P
MDSTRT ...............................................................3-56
MEF ......................................................................2-72 PID ..................................................................... 5-121
MEMSW ..................................................................3-4 PIDAT ................................................................. 5-130
APPENDICES

MEND ...................................................................3-43 PLDA .................................................................... 4-14


MEP ......................................................................2-72 PLS .......................................................................... * 1
MFREE ...............................................................5-187 PLSOUT .................................................................. * 1
MFREEK .............................................................5-225 PLSX ....................................................................... * 1
MIN .......................................................................5-21 PLSY ....................................................................... * 1
MMKDIR .............................................................5-191 PMOV ................................................................... 4-30
MMOV .................................................................5-215 POW ..................................................................... 4-68
MOV ........................................................................4-2 PSTA .................................................................... 4-16
MPP ......................................................................2-66 PSTRT ..................................................................... * 1
Instruction Index

MPRINT ..............................................................5-199
MPS ......................................................................2-66
MPX ....................................................................4-162
R
MRD ......................................................................2-66
RAD .................................................................... 4-224
MREAD ...............................................................5-179
RAMP ................................................................. 4-146
MREADL .............................................................5-203
RASC ................................................................. 4-238
MREN .................................................................5-221
RCOM ................................................................ 4-312
MRMDIR .............................................................5-195
RCNT ....................................................................... * 1
MSTAT ................................................................5-229
RCPSASC .......................................................... 4-318
MSTRT ..................................................................3-43
RDASC ............................................................... 4-244
MUL ......................................................................4-48
RES ...................................................................... 2-18
MWRIT ................................................................5-167
RET ...................................................................... 3-27
RETI ................................................................... 5-113
N RFASC ............................................................... 4-260
RFSCI ................................................................. 5-255
RFSCO ............................................................... 5-260
NCJ .......................................................................3-37
RFSFRC ............................................................. 5-241
NEG ......................................................................4-90
RFSPS .................................................................... * 1
NEXT ....................................................................3-33
RFSPSX .................................................................. * 1
RFSPSY .................................................................. * 1
RFSX .................................................................... 2-74
O RFSY .................................................................... 2-74
RGRY ................................................................. 4-164
OFDL ....................................................................2-25
RHASC ............................................................... 4-252
ONDL ....................................................................2-25
RLA .................................................................... 4-112
OR ...........................................................................2-2
RLNCA ............................................................... 4-120
ORA ......................................................................4-82
RND ...................................................................... 5-58
ORB ........................................................................2-2
ROOT ................................................................... 4-66
ORCAL ................................................................5-101
RRA .................................................................... 4-108
ORCALB .............................................................5-101
RRNCA ............................................................... 4-116
ORF ........................................................................2-4
RSEC ................................................................... 5-92
ORFB ......................................................................2-6
ORL .......................................................................2-68
ORP ........................................................................2-4
ORPB ......................................................................2-6
*1 Refer to the user's manual for the CPU or base unit.

A-104 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Index

S U
SADD ..................................................................4-268 U_ □□□□□ (Unit special instruction)
SBN .......................................................................3-27 For KV-XLE02/EP21V/KV-NC1EP
SCJ .......................................................................3-41 U_CSTOP .....................................................* 2
SCMP ..................................................................4-304 U_CSTRT ......................................................* 2
SDEL ...................................................................4-290 U_CREG .......................................................* 2
SEC .......................................................................5-92 U_CERR ........................................................* 2
SEG ........................................................................5-5 U_MSGTO .....................................................* 2
SER .......................................................................5-15 U_MSGSND ..................................................* 2
SET .......................................................................2-18 U_MSGRCV ..................................................* 2
U_MSGST .....................................................* 2
SFIND .................................................................4-296
U_NDTO ........................................................* 2
SFINDN ...............................................................4-300

APPENDICES
U_NDSTAT ...................................................* 2
SFT .........................................................................3-2
U_SBMON .....................................................* 2
SHOT ....................................................................2-27
U_SBNAME ...................................................* 2
SIN ......................................................................4-228 U_STMON .....................................................* 2
SINS ....................................................................4-286 U_SLREG ......................................................* 2
SLA .......................................................................4-98 For KV-XLE02/EP21V/LE21V/LE20V/KV-NC1EP
SLEFT .................................................................4-274 U_ELCYC (KV-EP21V/LE21V/NC1EP) .....* 2
SMID ...................................................................4-278 U_ELSTAT(KV-EP21V/LE21V/NC1EP).... * 2
SMOV .................................................................4-266 U_FCSTAT*3 .................................................* 2
SORT ....................................................................5-60 U_MLATTA ....................................................* 2

Instruction Index
SORTN .................................................................5-64 U_MLSTAT ....................................................* 2
SPRD ..................................................................5-243 U_MLSUB .....................................................* 2
SPWR .................................................................5-247 U_MLTEXT ....................................................* 2
SRA .......................................................................4-94 U_MLTO ........................................................* 2
SRGHT ...............................................................4-270 U_MLTOGR ..................................................* 2
SRPLC ................................................................4-282 U_SOPEN .....................................................* 2
SSVC ..................................................................5-251 U_SRCVNP ...................................................* 2
STA .......................................................................4-10 U_SRDBUF ...................................................* 2
U_SSTAT ......................................................* 2
STE .........................................................................3-8
U_SUDPTO ...................................................* 2
STG .......................................................................3-12
U_SWRBUF ..................................................* 2
STP .........................................................................3-8
For KV-XLE02/XL202/XL402
STRIM .................................................................4-294
U_PLSTAT ....................................................* 2
SUB .......................................................................4-44 U_PLCYC ......................................................* 2
SWAP .................................................................4-176 U_PRDBUF ...................................................* 2
For KV-XLE02
U_CCTTO .....................................................* 2
T U_CCTSND ...................................................* 2
U_CCTRCV ...................................................* 2
TAN .....................................................................4-228 U_CCTST ......................................................* 2
TBCD ..................................................................4-158 U_SSELPT ....................................................* 2
TBIN ....................................................................4-160 For KV-SC20V/SSC02
TCH ......................................................................... * 1 U_RDCNT .....................................................* 2
TCHX ...................................................................... * 1 U_RDCPT0 ...................................................* 2
TCHY ...................................................................... * 1 U_RDCPT1 ...................................................* 2
TMH ......................................................................2-38 U_RDHZ ........................................................* 2
TMIN .....................................................................4-18 U_RDRPM .....................................................* 2
TMR ......................................................................2-38 U_WRCNT ....................................................* 2
TMS ......................................................................2-38 U_WRCTC0 ..................................................* 2
TMU ......................................................................2-42 U_WRCTC1 ..................................................* 2
TPOUT ................................................................4-150 U_WRPST .....................................................* 2
TRGD ...................................................................... * 1 For KV-SSC02
TRGR ...................................................................... * 1 U_DISOCP ....................................................* 2
U_RDBF ........................................................* 2
For KV-AD40V/SAD04
U_RDAD ........................................................* 2
U_RDADB .....................................................* 2
*1 Refer to the user's manual for the CPU or base unit.
*2 Please refer to related unit user's manual.
*3 Only KV-XLE02/EP21V/LE21V/KV-NC1EP is supported.
- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-105
Instruction Index

U_WRAVG .................................................... * 2 U_RDPPNT.................................................... * 2


U_WRLMT .................................................... * 2 U_SELSP ....................................................... * 2
U_WROFST .................................................. * 2 U_WRCPOS .................................................. * 2
U_WRSCL .................................................... * 2 U_WRPOR..................................................... * 2
For KV-SAD04 U_WRPPNT ................................................... * 2
U_RDBF ....................................................... * 2 U_WRPPS ..................................................... * 2
For KV-DA40V/SDA04 U_WRPPSS ................................................... * 2
U_WRDA ...................................................... * 2 U_WRPVEL ................................................... * 2
U_WRLMT .................................................... * 2 For KV-XH16ML/XH04ML
U_WROFST .................................................. * 2 U_RDCPOS ................................................... * 2
U_WRSCL .................................................... * 2 U_RDCVEL .................................................... * 2
For KV-ML16V/MC40V/MC20V U_RDFTRQ.................................................... * 2
U_WRPPNT .................................................. * 2 U_WRMD ....................................................... * 2
U_RDPPNT .................................................. * 2 U_WRTTRQ................................................... * 2
U_RDPMC .................................................... * 2 U_WRTVL ...................................................... * 2
APPENDICES

U_RDFPOS .................................................. * 2 U_WRVTL ...................................................... * 2


U_RDFVEL ................................................... * 2 U_WRVVEL ................................................... * 2
U_RDFTRQ (KV-ML16V) .......................... * 2 For KV-SH04PL
U_RDCPOS .................................................. * 2 U_DISOCP..................................................... * 2
U_RDCVEL ................................................... * 2 UDC ...................................................................... 2-58
U_RDCNT.D ................................................. * 2 UDT ...................................................................... 2-44
U_WRCPOS ................................................. * 2 UFILL .................................................................... 3-92
U_WRPPS .................................................... * 2 UFRSM ................................................................. 3-82
U_WRPVEL .................................................. * 2 UFSUS ................................................................. 3-82
Instruction Index

U_WRPOR ................................................... * 2 UMALLOC ............................................................ 3-86


U_RDMD ...................................................... * 2 UNIB ................................................................... 4-174
U_WRMD (KV-ML16V) ............................. * 2 UNIF ................................................................... 4-216
U_WRVVEL (KV-ML16V) ......................... * 2 UNIN ................................................................... 4-170
U_WRVTL (KV-ML16V) ............................ * 2 UNIS ................................................................... 4-310
U_WRTTRQ (KV-ML16V) ......................... * 2
UPSTOP ............................................................... 3-80
U_WRTVL (KV-ML16V) ............................ * 2
UPSTRT ............................................................... 3-76
U_WRFRNO ................................................. * 2
U_WRFBNO ................................................. * 2 UREAD ................................................................. 3-88
U_WRFNO .................................................... * 2 UWRIT .................................................................. 3-90
U_WRFVR .................................................... * 2
U_RDMERC ................................................. * 2
U_RDSERC .................................................. * 2 W
U_RDAERC ................................................... * 2
U_WRBNK .................................................... * 2 W-DE .................................................................... 3-21
U_WRPPB .................................................... * 2 W-OFF .................................................................. 3-19
U_RDPPB ..................................................... * 2 W-ON ................................................................... 3-19
U_WRSVPB (KV-ML16V) ......................... * 2 WSIZE .................................................................. 3-96
U_RDSVPB (KV-ML16V) .......................... * 2 WSL .................................................................... 4-126
U_WRSYSB .................................................. * 2 WSR ................................................................... 4-124
U_RDSYSB .................................................. * 2 WSUM .................................................................. 5-33
U_WRPSB .................................................... * 2 WTIME ................................................................. 5-90
U_RDPSB ..................................................... * 2 W-UE .................................................................... 3-21
U_WRSPB .................................................... * 2
U_RDSPB ..................................................... * 2
U_WRSCON ................................................. * 2 X
U_WRSCOF ................................................. * 2
For KV-SIR32X XCH .................................................................... 4-180
U_DISOCP ................................................... * 2
U_DISOVP..................................................... * 2
U_RDBF ........................................................ * 2 Z
For KV-XH16ML/XH04ML/SH04PL
U_RDAERC ................................................... * 2 ZCMP ................................................................... 4-76
U_RDFPOS ................................................... * 2 ZONE ................................................................. 4-136
U_RDFVEL .................................................... * 2 ZPOP .................................................................... 3-58
U_RDMD ....................................................... * 2 ZPUSH ................................................................. 3-58
U_RDPMC ..................................................... * 2 ZRES .................................................................... 5-41
*2 Please refer to related unit user's manual.

A-106 - KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual -


Instruction Index

APPENDICES
Instruction Index

*1 Refer to the user's manual for the CPU or base unit.

- KV-8000/7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual - A-107


Revision History
Printing Date Version Details of Revision

2015/4 Initial version


2015/4 Second version
2016/1 Third version
2016/8 Fourth version
2017/9 Sixth version
2019/8 1st revision
1st edition
2020/5 2nd revision
1st edition

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


WARRANTIES AND DISCLAIMERS
(1) KEYENCE warrants the Products to be free of defects in materials and workmanship for a period of one (1)
year from the date of shipment. If any models or samples were shown to Buyer, such models or samples were
used merely to illustrate the general type and quality of the Products and not to represent that the Products
would necessarily conform to said models or samples. Any Products found to be defective must be shipped to
KEYENCE with all shipping costs paid by Buyer or offered to KEYENCE for inspection and examination. Upon
examination by KEYENCE, KEYENCE, at its sole option, will refund the purchase price of, or repair or replace
at no charge any Products found to be defective. This warranty does not apply to any defects resulting from
any action of Buyer, including but not limited to improper installation, improper interfacing, improper repair,
unauthorized modification, misapplication and mishandling, such as exposure to excessive current, heat,
coldness, moisture, vibration or outdoors air. Components which wear are not warranted.
(2) KEYENCE is pleased to offer suggestions on the use of its various Products. They are only suggestions, and it
is Buyer's responsibility to ascertain the fitness of the Products for Buyer’s intended use. KEYENCE will not be
responsible for any damages that may result from the use of the Products.
(3) The Products and any samples ("Products/Samples") supplied to Buyer are not to be used internally in
humans, for human transportation, as safety devices or fail-safe systems, unless their written specifications
state otherwise. Should any Products/Samples be used in such a manner or misused in any way, KEYENCE
assumes no responsibility, and additionally Buyer will indemnify KEYENCE and hold KEYENCE harmless from
any liability or damage whatsoever arising out of any misuse of the Products/Samples.
(4) OTHER THAN AS STATED HEREIN, THE PRODUCTS/SAMPLES ARE PROVIDED WITH NO OTHER
WARRANTIES WHATSOEVER. ALL EXPRESS, IMPLIED, AND STATUTORY WARRANTIES, INCLUDING,
WITHOUT LIMITATION, THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, AND NON-INFRINGEMENT OF PROPRIETARY RIGHTS, ARE EXPRESSLY DISCLAIMED. IN
NO EVENT SHALL KEYENCE AND ITS AFFILIATED ENTITIES BE LIABLE TO ANY PERSON OR ENTITY
FOR ANY DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, SPECIAL OR CONSEQUENTIAL DAMAGES
(INCLUDING, WITHOUT LIMITATION, ANY DAMAGES RESULTING FROM LOSS OF USE, BUSINESS
INTERRUPTION, LOSS OF INFORMATION, LOSS OR INACCURACY OF DATA, LOSS OF PROFITS,
LOSS OF SAVINGS, THE COST OF PROCUREMENT OF SUBSTITUTED GOODS, SERVICES OR
TECHNOLOGIES, OR FOR ANY MATTER ARISING OUT OF OR IN CONNECTION WITH THE USE OR
INABILITY TO USE THE PRODUCTS, EVEN IF KEYENCE OR ONE OF ITS AFFILIATED ENTITIES WAS
ADVISED OF A POSSIBLE THIRD PARTY’S CLAIM FOR DAMAGES OR ANY OTHER CLAIM AGAINST
BUYER. In some jurisdictions, some of the foregoing warranty disclaimers or damage limitations may not
apply.

BUYER'S TRANSFER OBLIGATIONS:


If the Products/Samples purchased by Buyer are to be resold or delivered to a third party, Buyer must provide
such third party with a copy of this document, all specifications, manuals, catalogs, leaflets and written
information provided to Buyer pertaining to the Products/Samples.

E 1101-3
Copyright (c) 2018 KEYENCE CORPORATION. All rights reserved. 084575GB 2050-1 909GB Printed in Japan

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy