Script Programing Manual
Script Programing Manual
Chapter
OVERVIEW
1
Chapter PROGRAMMING
2 SCRIPT
Chapter DATA
Programable Controller 3 PROCESSING
Chapter SCRIPT SYNTAX
KV-7000/5000/3000/1000 Series 4 AND PRECAUTIONS
KV Nano Series Chapter BASIC
5 FUNCTIONS
6
Chapter
APPLICATION
FUNCTIONS
ARITHMETIC
Manual 7
Chapter
OPERATION FUNCTIONS
EXTENDED
8 FUNCTIONS
Please read this Manual before use. · List of Control Relays/
Keep this Manual in a safe place for later reference. Control Memories
· Index
Type Description
This manual describes how to connect, and maintain the KV-7000
KV-7000 Series User's Manual Series. It also describes the CPU built-in functions and how to
create ladder programs.
This Manual describes the configuration/specification, CPU
KV-5500/5000/3000 Series
internal function, ladder programming method of KV-5500/5000/
User's Manual
3000 Series.
This manual describes system configurations and specifications,
KV Nano Series Base Unit (terminal
built-in functions in the base unit, and how to create ladder
block type) User's Manual
programs for the terminal block type KV Nano Series.
This manual describes system configurations and specifications,
KV Nano Series Base Unit (connector
built-in functions in the CPU unit, and how to create ladder
type) User's Manual
programs for the connector type KV Nano Series.
KV-7000/5000/3000/1000 Series and
This Manual describes various instructions available in Ladder
KV Nano Series Instruction Reference
program.
Manual
KV-7000/5000/3000/1000 Series and
This Manual describes the script programming method and
KV Nano Series Script Programming
available operators, control statements and functions, etc.
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 PLC.
This Manual describes the basic functions and how to use the KV-
KV-1000 Introduction Manual
1000 briefly.
KV-1000 Series This Manual describes the specifications, integrated functions and
User's Manual operating method of the KV-1000 PLC.
KV-1000 Series This manual describes how to make ladder programs using the
Programming Manual KV-1000 PLC, and modules/macros and local devices.
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:
Failure to observe this item causes a risk that consequently results in death or
DANGER
serious injury.
WARNING Failure to observe the items mentioned may result in death or serious injury.
CAUTION Failure to observe the items mentioned may result in medium or minor injury.
Failure to observe this item may cause damage to the product itself as well to
NOTICE
other property.
Reference Here are listed items further enriching the understanding of the main text, and the
information useful to know.
General Precautions
• Before using KV STUDIO, confirm whether the function and performance of KV-
7500/7300/5500/5000/3000/1000 or KV Nano Series are normal before use.
• Verify that this device functions correctly 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.
If you use the product in a manner that falls outside of the ranges indicated in its
CAUTION
specifications, protection provided by the product may be damaged.
450GB
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - 1
KV-7500/7300 CPU Function Version
The KV-7000 Series functions differ according to the CPU function version.
The CPU function version can be checked using "Tools"→"Check CPU function version"→"PLC" in the KV STUDIO
menu (* KV STUDIO Ver. 8 or later is required).
The CPU function version can be updated using "Tools"→"Check CPU function version"→"PLC"→"System program
update" in the KV STUDIO menu (* KV STUDIO Ver. 8.1 or later is required).
■ Differences in CPU function according to CPU function version
Release date July 2017 June 2016 December 2015 June 2015 March 2015
CPU function version 2.2 2.1 2.0 1.1 1.0
KV STUDIO compatible version 9.2 or later 9.1 or later 9.0 or later 8.1 or later 8.0 or later
Compatible KV-7500 Yes Yes Yes Yes Yes
CPU unit KV-7300 Yes Yes Yes Yes Yes
KV-XLE02
Compatible KV-XL402 Yes No
expansion KV-XL202
unit KV-XH16ML
Yes No
KV-XH04ML
Project name Up to 64 characters Up to 32 characters
Program name Up to 64 characters Up to 24 characters
Program comment Up to 256 characters Up to 32 characters
OFF processing setting when
Yes No
program execution is stopped
Assignment for interrupt program
CPU Yes No
of work area for script text string
function
Inter-unit synchronization Yes No
Inter-unit synchronization
Yes No
read/write CPU device
KV socket communication Yes*1 No
Function block function Yes (compatible with unspecified unit argument types) Yes No
Application package Yes No No
Function block instruction 3 instructions added (FB,FEND,FUN) No additions
Unit program instruction 5 instructions added (UMALLOC,UPSTRT, UPSTOP,UFSUS,UFRSM) No additions
Instructions Floating point instruction 1 instruction added (ATAN2) No additions
script Data control instruction Specifications of 1 instruction expanded (APR)*2 No additions
Data processing instruction Specifications of 4 instructions expanded (MAX,MIN,AVG,WSUM)*3 No additions
Unit type judgment instruction Yes No
*1 KV socket communication can only be used with the KV-7500.
*2 Double precision floating point type real numbers can now be specified in linear approximation instructions
(APR). (Scaling)
*3 Single/double precision floating point type real numbers can now be specified in search max. value (MAX),
search min. value (MIN), average (AVG), and word sum (WSUM) instructions.
KV Nano Series CPU Function Version
The KV Nano Series functions differ according to the CPU function version.
The CPU function version can be checked using "Tools"→"Check CPU function version"→"PLC" in the KV STUDIO
menu (* KV STUDIO Ver. 7 or later is required).
The CPU version can be updated using "Tools"→"Check CPU function version"→"System program update" in the KV
STUDIO menu (* KV STUDIO Ver. 7.1 or later is required).
■ Differences in CPU function according to CPU function version
KV-N14*/N24*/N40*/N60*
CPU function version Release date Compatible functions
Ver. 1.0 October 17, 2012 Initial version
Ver. 2.0 May 15, 2013 Compatible with EtherNet/IP unit KV-NC1EP
KV-NC32T
CPU function version Release date Compatible functions
Ver. 2.0 May 15, 2013 Initial version
KV-5500/5000/3000 CPU Function Version
The CPU function version has been added to the KV-5500/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
1
Describes features of KV scripts such as script application example
(program example) and KV script type, operators and control
Chapter OVERVIEW
statements, functions, etc.
1
2
2
Chapter
PROGRAMMING
SCRIPT
Describes script making steps as well as error message and warning
message during conversion. 3
4
3
Chapter DATA PROCESSING
Describes script processing device, constant range (type) and 5
programming method, index modification and indirect specifying, etc.
6
7
4
Chapter
SCRIPT SYNTAX
AND PRECAUTIONS
Describes how to use assignment statement and operators used in
scripts as well as syntax of control statement, etc.
8
A
5
Chapter BASIC FUNCTIONS
Describes contact functions, bit functions, bit output functions, output
functions, and timer/counter functions, etc.
6
Chapter
APPLICATION
FUNCTIONS
Describes program flow control functions, macro functions, Index
register functions, and indirectly specifying functions, etc.
ARITHMETIC
7
Describes data more functions, arithmetic operation functions, logical operation
OPERATION functions, data shift functions, data conversion functions, floating real number
Chapter functions, and text string processing functions, etc.
FUNCTIONS
8
Describes data processing functions, table processing functions, clock
EXTENDED processing functions, high speed processing functions, record functions, memory
Chapter FUNCTIONS card functions, and access window functions, etc.
Chapter 1 OVERVIEW
KV Scripts························································································ 1-2
Features of KV Script ························································································ 1-2
How to Use KV Scripts ······················································································ 1-3
KV Script Type ················································································· 1-8
Box Script······································································································· 1-8
Area Script······································································································ 1-9
KV Script Function·········································································· 1-10
About Assignment Statement·············································································1-10
About Operator ······························································································· 1-11
About Control Statement···················································································1-12
About Suffix ···································································································1-14
About Script Function·······················································································1-17
APPENDICES
CR/CM List ···························································································A-2
Control Relays CR (For KV-7500/7300) ································································ A-2
Control Memory Entries CM (For KV-7500/7300) ···················································· A-5
Control Relays CR (For KV-5500/5000/3000) ······················································· A-10
Control Memory CM (For KV-5500/5000/3000) ····················································· A-16
Control Relays CR (For KV Nano series)····························································· A-23
Control Memory Entries CM (For KV Nano series) ················································ A-33
ASCII Code Table ················································································ A-45
List of Characters That Cannot Be Used ················································ A-46
List of Unusable Functions ·································································· A-48
Index ································································································· A-49
Functions Index ·················································································· A-54
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
"DM0·DM1" scripted using only device Nos. (in the example on the left, DM0) to which 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."
KV script is a program language developed for operation processing and text string processing that
failed using former Ladder language. Since KV script can be programed in Ladder language, Ladder
1 program needs not to be interrupted during application.
KV Scripts
Features of KV Script
Ladder program is applicable to feedback control programming of driver control and sensor, etc.
For complicated value operation processing and text string processing program, the programming
becomes complicated, and the debug and maintenance also difficult.
KV script is a programming language developed to remedy main problems of these ladder programs.
Using script to supersede complicated part that cannot be described by ladder program, allows to
prepare program effectively.
Ladder program
KV script
OVERVIEW
How to Use KV Scripts
We will use the following example to describe how to realize operation processing and text string
1
KV Scripts
processing that failed using Ladder program.
3cm
Top
3cm
Height 4cm Trapeze A
Top
Height 2cm Trapeze B
Bottom Bottom
5cm 5cm
As mentioned above, the trapezoid area formula can be programmed using a rung of script program.
Same processing can be programmed using ladder as follows.
Ladder Programming
CR2002 DM1 DM2 DM3 #2 DM1000
LDA ADD MUL DIV STA
Normal ON Top Bottom Height of Area of
trapeze A trapeze A
"Firstly save the area of trapezoid A to TM (DM1000), calculate area of trapezoid B, and plus the area
of trapezoid A" shall be described in ladder program.
Programming via script functions such as SIN function and COS function is more simple than same
processing via ladder.
Ladder programming example as follows.
Ladder Programming
During ladder programming, the operation results of SIN function and COS function need to be
temporarily stored in TM before addition operation.
OVERVIEW
Programming text string processing with KV Script
KV script simple and convenient programming even if character processing (text string processing).
1
When using string operator
KV Scripts
From DM 100, plus CR (0DH) and LF (0AH) into text string " KEYENCE" and then store.
Ladder Programming
CR2002 SMOV
"KEYENCE" DM100
Always ON
MOV
$D0A DM2000
MOV
$0 DM2001
SADD
DM100 DM2000 DM100
Programming Script
CR2002
DM100.T = "KEYENCE" + CHR($0D) + CHR($0A)
Always ON
Because control codes cannot be directly processed by using SADD instruction in Ladder program, so,
shall be stored in the device and then connected to the required text string. Thanks to special function,
KV script can simply connect text strings and control codes.
Reference • The text string is truly the "string" of "character". The text string is bracketed using
double quote(" ").
For detail, see "Fixed text string (text string type constant)", Page 3-46
• Suffix .T added to DM100 indicates that the device for storing text string with KV script.
For detail, see "Data Type (suffix)", Page 3-55
DM10 = SFIND(DM40.T, "@", 0) ' Search "@" from DM40.T, store the position to DM10.
When processing such a complicated processing as text string, script function allows simple
programming as the sample program above mentioned.
Besides, above sample program can be also programmed according to following method.
Reference Text string processing function is a function to perform text string operations such as edition
and conversion of text string and string data processing such as search, etc., including LEN
function for testing string length, SMID and SLEFT functions for extracting text string, etc.
For text string function, see "Chapter 7 ARITHMETIC OPERATION FUNCTIONS", Page 7-1.
OVERVIEW
Programming control statements with KV Scripts
KV script, can enable functions such as conditional branch and reprocessing, etc. simply via control
statements. 1
KV Scripts
For multi-branch control
The control "To store corresponding version information according to the word device value", can be
programmed with SELECT statement as follows.
About details of SELECT statement, please see "SELECT CASE to statement (multiple branch
control)", Page 4-18
Ladder Programming Store version information corresponding version No. saved in DM01 to DM02.
DM1 SMOV
= "KV-5000" DM2
#5000
DM1 SMOV
= "KV-3000" DM2
#3000
DM1 SMOV
= "KV-1000" DM2
#1000
DM1 DM1 DM1 SMOV
<> <> <> "Other Version" DM2
#5000 #3000 #1000
Two KV script types are available, each with different programming style.
1 Box Script
KV Script Type
Programming
Point When execution condition is false, the program inside Box Script will be not
executed but jumped (please pay attention to partial functions such as differential
command, etc.)
OVERVIEW
Area Script
Area Script is a script that can be executed during scanning even if the execution condition is not
1
KV Script Type
established.
The programming area on edit screen occupies whole 1 rung.
Programming
Area script programming
Programming
among ladder
circuits.
KV script can enable programming program a Series of ladder control in a format similar to BASIC
language.
1
About Assignment Statement
KV Script Function
Via KV script, you can program using assignment statement, and store the value and operation result to
the device.
Assignment statement
DM1000 = DM1001 + 10
Right result (value) is stored into the device programed on the left of "=".
CR2002 SMOV
"KEYENCE" DM1000
Always ON
Storage device
Bit assignment
To map the status of bit device R3001 to R3000.
OVERVIEW
About Operator
For KV script, arithmetic operation and logical operation, etc. need not to be converted to special
1
KV Script Function
instructions such as Ladder program, operators can be directly programed, which enabling more visible
programming.
Operation example
To multiply DM100 value by 10, add DM101 result and then multiply by 2. Assign (store) operation result to
DM1000.
List of operators
Symbols Processing content Program example
^ Calculate the power DM500 = DM100 ^2
* Calculate product of 2 value (multiplication) DM502 = DM100 * 3
Arithmetic / Calculate quotient of 2 values (division) DM504=DM100/4
operator MOD Divide 2 values, return remainder DM506=DM100 MOD 5
+ Calculate summation of 2 values (addition ) DM508 = DM100 + 6
- Calculate difference of 2 values (subtraction) DM510 = DM100 -7
< Less than MR500=DM100<10
<= Less than or equal to (below) MR501=DM100 <= 20
Comparison > Larger than MR502=DM100 >30
>= Larger than or equal to (above) MR503=DM100 >= 40
operator
Equal to (equivalent)
= MR504=DM100 = 50
* identical to "?" of assignment
<> Unequal to (unequivalent) MR505 = DM100 <> 60
Text string
+, & Connect 2 text strings DM600.T="KEY"+"ENCE"
operator
NOT Calculate logical NOT of value MR600=NOT R000
Calculate logical AND of 2 values (bit
AND MR601=R000 AND R001
Logic device relation, word device relation)
Calculate logical OR of 2 values (bit device
operator OR MR602=R000 OR R001
relation, word device relation)
Calculate XOR of 2 values (bit device
XOR MR603=R000 XOR R001
relation, word device relation)
For operators, see "Operator", Page 4-6.
Two kinds of control statements are available, including conditional branch statement and loop control
statement.
OVERVIEW
Loop control statement
To process according to specified conditional loop.
1
Type of loop control statement
KV Script Function
Control
Basic format Description
statement
FOR <word device>=<default>
TO <final value> STEP <increment > Loop processing is performed
FOR statement <processing statement>
until <word device>= <final value>
NEXT
About Suffix
1 In Ladder language, the suffix attached with an instruction can indicate the operation type of the
KV Script Function
instruction; meanwhile, in KV script, the suffix attached with a device or constant can indicatethe
operation type of a function or the meaning of value stored in the device.
For data type (suffix), see "Data Type (suffix)", Page 3-55.
Suffix type
Suffix Type Programmable range
.U unsigned 16-bit data 0 to 65535
.S signed16-bit data -32768 to +32767
.D unsigned 32-bit data 0 to 4294967295
.L signed 32-bit data -2147483648 to +2147483647
-3.4E+38N-1.4E-45
N=0
.F Single precision floating point type
1.4E-45N3.4E+38
(Number of effective digits: approx. 7 digits)
-1.79E+308N-2.23E-308
N=0
.DF* Double precision floating point type
2.23E-308N1.79E+308
(Number of effective digits: approx. 16 digits)
.B Bit type (Boolean value) 1(ON, TRUE), 0(OFF, FALSE)
.T Text string type Text string
* • The ".DF" suffix can be used only with the KV STUDIO Ver. 6.00 and higher versions.
• The ".DF" suffix can only be specified with KV-7000 Series CPU units, KV-5500/5000/3000 Series CPU
units that have CPU function version 2.0 or higher and with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version", Page 2
Operator
Programming Script DM1000.D = 123456
DM1100.F = 123.456
BMOV(R1000, DM1200.D, DM2000, 50)
Ladder Programming
CR2002 MOV.D
#123456 DM1000
Always ON
CR2002 MOV.F
+123.456 DM1100
Always ON
R1000 BMOV.D
DM1200 DM2000 #50
OVERVIEW
Omitting suffix
For programming of the device whose suffix omitted, the processing type depends on the device type.
Device type Type processed when suffix is omitted (default type)
1
R(DR),B,MR,LR,T,C,CTC*3,CR,UR .B (bit type)
KV Script Function
DM,W,EM*2,ZF*2,FM*2,TM,CM,V,P,UM,UV
.U ( unsigned 16-bit data)
indirect specifying (* ) device
KV-7500/7300 :.L ( signed 32-bit data)
*1 KV-5500/5000/3000 :.L ( signed 32-bit data)
Z
KV-1000 :.S (signed 16-bit data)
KV Nano Series :.L ( signed 32-bit data)
CTH*3 .D ( unsigned 32-bit data)
Label suffix
For programming when suffix of global label/local label is omitted, the processing type depends on the
"data format" selected when registering a label.
Label data type Type processed when suffix is omitted (default type)
bit (BOOL) .B
1-word unsigned integer (UINT) .U
2-word unsigned integer (UDINT) .D
1-word signed integer (INT) .S
2-word signed integer (DINT) .L
Single precision floating
.F
point type real number (REAL)
Double precision floating
.DF*1
point type real number (LREAL)
Text string (STRING) (.T)*2
Timer .B
Counter .B
This varies depending on the data format in use when the
Array
array size is specified.
*1 • The ".DF" suffix can be used only with the KV STUDIO Ver. 6.00 and higher versions.
• The ".DF" suffix can only be specified with KV-7000 Series CPU units, KV-5500/5000/3000 Series CPU
units that have CPU function version 2.0 or higher and with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version", Page 2
*2 For the label whose data type is "text string", suffix cannot be attached (Generally, suffix is omitted when
using).
Declaration
KV Script Function
Format Description
statement
DM1000 will be still processed as .D (32-bit
TYPE DM1000.D
unsigned number). even if suffix omitted
TYPE EM1000 to EM2000 will be still processed
TYPE EM1000 - EM2000.F
as..F( 32-bit single precision floating point
(TYPE EM1000.F - EM2000)
type) even if suffix omitted.
Point • Type declaration is valid only for the script programmed using TYPE.
• During type declaration for local label and array, the type larger than data format
selected during label registration and text string type shall be declared.
Example When "1-word unsigned integer" is selected in Data Format, if 32 bit type
declaration (TYPE [label name].D, etc.) is made, error will occur.
• When the type of global label is declared with TYPE, the suffix after type
declaration will become valid.
Reference When the device after type declaration is used via indirect specifying, it will be processed
as .U by default.
OVERVIEW
About Script Function
KV-7500/7300/5500/5000/3000/1000 or KV Nano Series ladder instructions can be used via KV script for
1
KV Script Function
script function.
To discriminate from ladder instructions, the instruction used via KV script are called "script function".
Function
Ladder language compiles program by connecting instructions via symbol lines, but KV script uses
assignment statement, operators, control statement and script function to compile program.
Script functions basically cover all ladder instructions. Because that operators and assignment
statement can be used, the function corresponding to operation type instructions (ADD, MUL, etc.) and
data move instruction ( MOV , DW , etc.) can not be used.
MR1000 MR1002
MR1001
Most of script functions shall be programmed according to function name identical to ladder instruction.
The action is identical to ladder instruction.
Reference Since script needs not to operate internal registers, LDA and STA instruction are not used.
Some functions are unavailable in ladder instruction but can be added via KV script.
Type Description
Function group for operation of word device and bit device, Including ANDA and
Operation processing
ORA logical operation, BMOV and FMOV for data movement, and SIN and COS
function
floating-point operation etc.
String processing Function group for text string processing, including LEN for testing string length,
function SMID/SLEFT for extracting text string, etc.
Data processing Function group for data processing, including MAX, MIN, and BCNT for calculating
function the number of ON bits in specified word device.
Function group for processing other than operation, text string, data processing,
Other Function including TMR, ADRST for indirect specifying, MWRIT and MREAD functions for
memory card control , etc.
1 Every script shall be converted to ladder. During function execution, the status of operation flag will be also
changed correspondingly. The status of operation flag will vary before and after execution of script program.
Besides, ladder generated via script conversion can be programed according to different function
KV Script Function
combinations, so, if operation flag varies with the change of script program, it cannot be used.
Programming Script
The chapter describes how to operate Box Script/Area Script as well as menus and edit screen.
Programming Script
Box script/area script can be programmed by combining ladder program in ladder edit window.
KV script can be programed after checking script programming area in ladder edit window.
(1) (3)
(2)
2 Script input methods are available. But function will not vary with different input methods. So, please
select as you like.
2
Direct input (default)
Programming Script
Like ladder instruction programming scripts can be directly programmed on Ladder Editor.
1 From the menu, select "Script (S)" "Change edit method (N)" "Direct input (D)".
Other procedure From "Tool (T)" "Option (O)", select "Direct input" in "Input format" of "Script setting" tab.
Window input
To input scripts in text edit window displayed during script programming.
1 From the menu, select "Script (S)" "Change edit method(N)" "Window(W)".
Other procedure From "Tool (T)" "Option (O)", select "Window(Window entry)" in "Entry method" of
"Script" tab.
Box Script
This section describes precautions on how to make/edit and use box scripts.
2 Box Script is a script that can specify the time and sequence to executing KV script programs using
ladder with ladder execution conditions.
Box Script
Box Script is executed only when execution condition specified by ladder is true, programming can be
adaptable with operation formula.
Box scripts are suitable for making programs excluding several lines of operation formula and
complicated control statements.
Besides, for execution condition programmed via Ladder, the program in box script can only program
execution processing statement, so, control statement is not required, it can be used simply.
Box Script
Ladder Programming
Box Script
· DM0=0 DM2=50 1999
· DM0=50 DM2=74
· DM0=100 DM2=98
· DM0=500 DM2=293
· DM0=1000 DM2=537
· DM0=2000 DM2=1024
· DM0=4000 DM2=1999
50
0 DM0
0 4000
Box Script
Ladder Programming
Box Script
2 Operation Flow
Box Script
The operation flows for making and editing box scripts are described as follows.
• From menu……
New a box script "Script (S)"
Correct program
"Insert box script (B)"
• From right-click menu
Convert scripts
Verify error by
popped window
When conversion successful
Use Monitor
or Simulator function
1 To program execution condition in Ladder Editor, click the cell in which box script to be edited is located.
2
Box Script
Box script is made at this section.
Select the cell.
Reference Box script occupies 6 cell (cell 5 to 10). Execution condition can be programmed within cell 1 to cell
4.
Regardless of the position of the selected cell, the box script shall be make in the cell 5 to
cell 10.
2 From the menu, select "Script (S)" "Insert box script (B)".
Box Script
2
Box Script
Reference Execution condition can be also programed after making box scripts.
Then program
execute conditions
Other procedure From right-click menu, select "Edit script (X)" "Convert all scripts (C)"
Box Script
When conversion successful
Box Script
Other procedure • Select the extended box script, select "Edit script (X)" "Display/hide converted ladder
2 (V)"from right-click menu.
• key+ key
Box Script
Reference If editing script after script conversion, the converted ladder will be not displayed. (
disappears)
To display ladder, script shall be converted again.
Other procedure Select the comment part ( ) of the folded ladder rung. select "Display/hide converted
ladder (V)" from right-click menu.
Box Script
To reedit the box script programmed, double-click the Box Script to be edited.
Other procedure After selecting the box script to be edited, click the following keys:
• key
• key
• key
Please double
click in this box
Uneditable status
Editable status
Box Script
1 Select the box script to be copied, select "Edit (E)" "Copy (C)" from the menu.
2
Box Script
2 Select the cell (rung) to paste box script copied according to step 1.
From the menu, select "Edit (E)" "Paste (P)".
Reference The whole rung including box script can be also copied.
Box Script
Select rung
When the execution condition of box script is OFF, the script program will be not executed. For this the
following points shall be noted.
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual,
"Precautions when using differential execution Type Instructions."
Box Script
Box script
Ladder Programming
Observe the extend ladder program, if the reset condition of timer instruction is CR2002 (normal ON),
the timer cannot be reset after executing.
To solve this problem, DIFU instruction can be connected with AND as execution condition.
Box Script
Ladder Programming
When execution condition (MR2000) of Box Script is TRUE, R1100 will be ON only in 1 scanning via
DIFU instruction. In this case, RES function programmed on the 1st rung of Box Script enables the
timer to reset, unrelated to the previous status of the ladder. After execution of Box Script, the timer is
cleared and timer function (contact) acts correctly.
Area Script
This section describes precautions on how to make/edit and use of Area Script.
Area script is every-scan execution type, suitable to the program including conditional branch
and loop control.
Area script allows to simplify programming of complicated conditional branch and multiple
branches.
Area script
* the description on the right side of single quote (') shall be processed as comment.
Ladder Programming
If conditional branch is complex, or program is lengthened via ladder programming, area script can
enable improving programming efficiency.
Area Script
Using area script to program the part from disk category identifying to storaging.
When the disk reaches the check point, disk color can be detected via color sensor.
•Red "1" is stored in DM10
•Yellow "2" is stored in DM10
•Orange "3" is stored in DM10
•Gold "4" is stored in DM10
Color sensor
Script
Area Script
• From icon……
• From key operation… key + key
New a area script
• From menu……
Modify program "Script (s)" "Insert area script (A)"
Program and edit scripts "Script edit (X)" "Insert area script (A)"
Use Monitor
or Simulator function
Area Script
Select cell
2 From the menu, select "Script (S)" "Insert area script (A)".
*Area script can be inserted from the menu, tool bar and keyboard.
Area Script
2
Area Script
Area Script
extend ladder under area script.
(if script conversion fails, will be not displayed)
Other procedure • Select the expanded area script, select "Edit script (X)" "Display/hide converted
ladder (V)" from right-click menu.
• key+ key
Reference If editing script after script conversion, the converted ladder will be not displayed. (
disappears)
To display ladder, script shall be converted again.
Area Script
2
Area Script
1 Double-click the area script to be edited to reedit the area script programmed.
Other procedure Select the Area Script that you want to edit, press the following keys.
• key
• key
Please double
click in this box
Uneditable
Editable
Area Script
Selected
Delete area
script
Deleted
Area Script
1 Select the area script to be copied, select "Edit (E)" "Copy (C)" from the menu.
2
Area Script
Selected
Important Local label and label array can be used only when CPU unit is KV-7500/7300/5500/
5000/3000 or KV Nano Series. When CPU unit is KV-1000, local label and label
array cannot be used.
2
Pre-setting the label for the device used in the program can allow label programming.
Label can be divided into two types: global label and local label.
Global label
Global label refers to the common label in whole project.
1 global device must be assigned with 1 global label.
Convert script
When
conversion fails
End
1 From the menu, select "View (V)" "Label edit window (L)". Label edit window appears.
*1 The character and character string that cannot be specified also available, such as reserved word
of KV STUDIO, etc.
"Precautions when using label", Page 2-32
Item Description
Label name Set within single-byte 16 character, double-byte 8 character. *1
Device Specify the device to which global label is assigned. *2
Device Comment Display the device comment assigned. Cannot be edited.
*1 The character and character string that cannot be specified also available, such as reserved word
of KV STUDIO, etc.
"Precautions when using label", Page 2-32
*2 The device that cannot be specified also available.
KV STUDIO User's Manual
Point Labels can be set for global devices, but labels cannot be set for local devices.
2
Label Programming and Label Array
Local label
Local label refers to label that can be used when CPU is KV-7500/7300/5500/5000/3000 or KV Nano
Series, only valid in every module, and every module shall be set.
For the device (VB, VM) whose local label using system area (working memory) of KV-7500/7300/5500/
5000/3000 or KV Nano Series, local label can be also set even if service condition of the device is not 2
known.
Reference Working memory has 50000 words in VM, 16384 points (1024ch) in VB (for the KV Nano
Series, 9500 words in VM, 8192 points (512ch) in VB), which assignment can be
managed by using KV STUDIO.
"About Script Work Memory (Work Devices)", Page 2-62
Register programmed
labels* as local labels
Convert script
When
conversion fails
End
2 Under script editing mode, select the label range registered as local label, select "Register local
label (L)" from right-click menu.
Select range
2
Label Programming and Label Array
Item Description
Label name Automatically stored after label range selection. *1
Default to "1-word unsigned integer".
Data format Data format can be changed by clicking drop-down menu.
"About label type", Page 2-32
During constant assignment of local label, constant can be specified. Constant is not
Constant
assigned if blank.
Label comment Specify comment to be added to local label.
*1 The character and character string that cannot be specified also available, such as reserved word
of KV STUDIO, etc.
"Precautions when using label", Page 2-32
Reference All labels of the module being edited can be registered in batch as local label.
"Batch register of local label", Page 2-31
Data Format of every local label changes to "1-word unsigned integer", which, can be separately
changed.
Point During batch registration, all labels in module are registered. So, the error flag is
also registered as label, the error occurring in script conversion may appear in
normal conversion.
Example DN1000 = 10 ..... Before batch registration: during script conversion, error
occurs.
...... After batch registration: error will not occur during script
conversion.
After batch registration, it is recommended to check content registered via label
edit window.
2 label.
Label Programming and Label Array
*1 • The ".DF" suffix can be used only with the KV STUDIO Ver. 6.00 and higher versions.
• The ".DF" suffix can only be specified with KV-7000 Series CPU units, KV-5500/5000/3000 Series
CPU units that have CPU function version 2.0 or higher and with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version", Page 2
*2 If a .D suffix is added to the label, it will be handled as the current value.
Reference Type declaration can be also conducted based on TYPE. The relations among "Data
Format", "Type declaration" based on TYPE, and "Direct specifying" of suffix via label
edit window are as follows.
Data format < Type declaration < Direct specifying
When registering labels, the suffix which can be specified based on data type (data format) in label edit
window is limited as follows.
Reference When programming the suffix that cannot be specified, error will appear during script
conversion.
* When specifying ".T", please specify the leading device of channel to assign the bit device.
Other precautions
• Same label name can be set for global label and local label. It operates in form of local label.
• Text string such as reserved words can not be used in label name.
"List of Characters That Cannot Be Used", Page A-46
• When CPU unit is KV-7500/7300/5500/5000/3000 or KV Nano Series, label is double-byte character/
single-byte character sensitive but is not case-sensitive.
• Index modification cannot be conducted for local label.
"Index Modification", Page 3-48
• Index modification and indirect specifying cannot be conducted for label array.
"Label Array", Page 2-34
• When constant is assigned in label, index modification and indirect specifying cannot be performed.
• Label and word device bit cannot be specified.
"Processing Word Device as Bit Device", Page 3-42
Label Array
When registering label, label array can be used by specifying "Array" in Data Format via label edit window.
2 Point When CPU is KV-1000, label array cannot be used (global label array, local label
array).
Label Programming and Label Array
Array
Array refers to continuous aggregation of same data type.
KV script represents the array in form of "label + [label end code]", Multi-dimensional array can be
realized by taking comma as end code for separating label.
Maximal 8-dimensional label array can be specified.
End code
Reference For label end code of label array, except integer (DEC, HEX), integer type (.U /.S /.D /.L)
device, macro argument (P0 to P9, V0 to V9) and the function with formula and return
value can be also programmed.
Example: LABEL[1, 2, DM0]
LABEL[1, DM2 * 3, Z01]
Point The following describes a data storage diagram when the array size of label is
registered as "10,10" in label edit window.
LABEL[0,0]
LABEL[0,1]
LABEL[0,2]
LABEL[0,9]
2
0 1 2 3 4 5 6 7 8 9
4 …
5
6
7
LABEL[9,9]
8
LABEL[9,0]
9 90 … … … 97 98 99 100
When Data Format of label array is selected as "1-word unsigned integer" or "1-
word signed integer", in above label array, 10x10 = 100 words shall be guaranteed
as label array area.
1 From the menu, select "View (V)" → "Label edit window (L)". Label edit window appears.
2 Register global label array name and set data format to "Array".
2
Label Programming and Label Array
Select "Array", the "Array size" dialog box will pop up.
Item Description
Specify label type. Click input box, select label type from the drop down menu
Data
displayed.
• Specify array size. Via comma separation, maximal 8 dimensional array can be
specified.
Array size
• Please specify the array size within 1 to 131071. *1
• When major data of array is uncertain, can be replace with "?". *2
Point Global label array occupies global device whose size has been specified in array.
2 Under script editing mode, select the label range as local label register, select "Register local
label (L)" from right-click menu.
Right-click menu
2
Label Programming and Label Array
Select "Array", the "Array size" dialog box will pop up.
Item Description
Specify type of local label array. Click input box, select label type from the drop down
Data
menu displayed.
• Specify array size. Via comma separation, maximal 8 dimensional array can be
Array size specified.
• When major data of array is uncertain, can be replace with "?".
Execution condition
In the script, all operation formulas are handled as .L (signed 32-bit), .F (single precision floating point
type) or .DF (double precision floating point type).
• When all types (U,.D,.S) other than .F and .L and .DF are specified by arithmetic element (device or
constant) in operation formula, it will be still processed as .L. Operation result shall be also calculated
according to .L .
• If .F is used by arithmetic element (device and constant) in operation formula, all operations before .F
will be conducted as .L, all operations and operation result after this will be processed as .F (single
precision floating point type).
• If .DF is used by arithmetic element (device and constant) in operation formula, all operations before
.DF will be conducted as .L or .F, all operations and operation result after this will be processed as
.DF (double precision floating point type).
Point • Operation formula shall be processed within the range of .L (signed 32-bit ) (-
2147483648 to +2147483647). Care shall be taken during calculation exceeds the
.L range.
• The operation formula expands all arithmetic elements to .L operation, and
operational precision will be impaired sometimes when .D (unsigned 32-bit )
contained in the operation formula.
"Type conversion leads to data loss", Page 2-40
• When impairing precision, "Warning" display can be set.
"Setting method of warning level", Page 2-41
2 Warning Message
Script Conversion Output Message
The message displayed when expected operation result cannot be obtained after execution of Ladder
program converted from script program. The warning reason shall be removed as possible.
It will occur when the result type of assignment statement on the right side is different from the left type,
the operation formula includes .D, or when the function cannot be executed with the current model.
After conversion of above script, output window displays following messages (when setting script
warning level to "high").
[Warning 1103]: "=": (signed 32-bit integer type suffix 16-bit integer type) data may be lost due
to assignment.
In this case, by changing suffix of the left device from .U to .L (i.e. left type and right type are
conformable), warning message will be no longer displayed.
"Precautions on Script Programming", Page 2-39
KV-N24**
Functions that generate warnings KV-N14** KV-N40** KV-NC32T
KV-N60**
WTIME/AJST Warning - -
MWRIT/MREAD/MFREE/MFREEK/MMKDIR/MRMDIR/
Warning Warning -
MDEL/MPRINT/MREADL/MCOPY/MMOV/MREN/MSTAT
AWNUM/AWMSG - - Warning
When converted, the following message is displayed in the output window (when the script warning
level is set to "High").
[Warning 1008]: "MWRIT": Using a function that cannot be executed on the current model.
For the KV Nano Series, the number of internal positioning axes and the internal high speed counter
numbers differ according to the unit. If there is a function that specifies an axis number or counter
number that cannot be used, a warning occurs during conversion.
For the axis numbers and high speed counter numbers that can be used with the KV Nano Series, refer
to the "KV Nano Series User's Manual".
The "Warning" level is displayed in output window when changing script conversion.
1 From the menu, select "Script (S)" "Set script warning level (W)".
Other procedure Select "Tool(T)" "Option(O)" from the menu, and then select "High", "Medium" or
"None" in "Warning level" of "Script" tab.
2 "Script warning level setting" dialog box appears. You can select the warning level.
Item Note
All warning information can be displayed including errors and warnings.
Example 1) when the precision of operation formula is impaired
High · DM1000.U = DM2000.L (Assign .L type data to .U type device)
Example 2) Assign data other than signed 16-bit data to index
· DM1000.U:DM2000.L = 10 (Index modification via .L device)
Only error is displayed (for example, when processing out-of-range constants).
Example) When the operation both two constants exceeds the range of constants.
Medium
· DM1000.D= 90000 * 50000
(Assign a value out of constants range (4500000000))
None No alarm will be displayed.
Not output warning After the checkbox is selected, the warning that occurs when specifying a suffix
when different suffix different from the data type defined when registering global label is not output.
specified for global Example) When specifying global label to “1-word signed integer: UINT”and suffix .L is
label data type specified via script
Error Message
Error will occur when part of scrip programs can not be converted ladder program and error causes will
be displayed in output window.
2 Errors must be removed. Otherwise, programs cannot be transferred into CPU unit even if conversion
successes. You can correct scripts according to error messages displayed in the window that pops up.
Script Conversion Output Message
Typing error
• Function name error.
Example) correct BLD ( DM1000, 10 ) error BLF ( DM1000, 10 )
• Device name error.
Example) correct DM1000.D error -> DN1000.D
• 2-byte character (Only comments and character constants can use 2-byte characters)
Example) correct DM1000.D error DM1000.D
• 0(zero) and O (letter) are confused.
etc.
Syntax error
• The control statement format is wrong.
Example) correct IF R1000 THEN error IF R1000 THEN
DM1000 += 1 DM1000 += 1
END IF END
Others
• Nonexistent device is specified.
• There are more than 1024 (single-byte) characters in a script rung.
• Array label end code is specified in the label that has not been registered to array.
2
When conversion error occurs
When a conversion error occurs, the error position and contents will be displayed in the window that
pops up.
When a conversion error occurs, the following dialog box will appear and
error information will be displayed in the window that pops up.
(2)
(1)
Reference • In the case of many errors and warnings, other errors will be still displayed when
selecting "Convert all scripts(C)" even if one error is corrected.
Many warnings Only an error is corrected Many warnings
"Convert all
scripts(C)"
"Convert selected
script(S)"
Since only the corrected scripts are converted, the correction verification will be
simpler.
• By using converted ladder show/hide (Ctrl+G), a converted ladder can be displayed
and confirmed or a developed ladder can be closed even while editing the script.
Function Block
Function blocks are ladder circuits used many times repeatedly in a project that are registered and
standardized under a name of your choosing.
The registered function blocks can be called from a script program, and scripts can be used within the
function blocks as well.
2
Calling Function Blocks
Function Block
How to use
Programming Script FB(MR1000,"FunctionBlock",DM0,#0,MR2000)
Calling functions
Functions are executed only when the execution condition is ON, unlike function blocks which execute
repeatedly once called even if the execution condition turns OFF. They can be called using the FUN
function.
How to use
Programming Script FUN(MR1000,"Function",DM0,#0,MR2000)
Function blocks can be programmed with a mixture of ladder programs and scripts, or can be created
using scripts only.
For information on creating function blocks, see the "KV-7000 Series User's Manual", "4-8 Function
Block".
Macro Call 2
Macro
Calling subroutine macro
The macro that is registered as subroutine type can call MCALL function.
"MCALL function", Page 6-6
How to use
Programming Script MCALL(MR1000,"Macro A", DM1000, #50, MR2000)
Ladder Programming
How to use
Programming script MSTRT(MR1000, "MacroA", DM1000, #50, MR2000)
Ladder Programming
Macro
Newly make macro can be used with scripts by programming with ladder or scripts with script.
• From right-click menu, select "Edit macro (M)" "New macro (N)"
Point If macro name contains "+" / "-", "The bit under macro execution status" cannot be
programmed in script (The script identifies "+ /-" to operators).
For details of "The bit under macro execution status", see "KV-5500/5000/3000
Series User's Manual" and "KV Nano Series User's Manual".
Reference For detailed information on unit device contained in script program and the setting of
macro argument device, please see "KV-7000 Series User's Manual", "4-9 Macro" ,
"KV-5500/5000/3000 Series User's Manual", "3-9 Macro" and "KV Nano Series
User's Manual", "4-9 Macro."
Point The script has no functions equivalent to END instruction and ENDH instruction
and shall use ladder programming END and ENDH instructions.
MEMO
Macro
Monitor Function
Monitor function allows to debug script program under online state or during starting simulator.
2
Register monitor
Script Debug Function
1 When KV STUDIO is in Monitor status or Simulator status, click the script to be monitored,
select "Registration monitor window" from the right-click menu.
Watch window
From monitor window, current value and bit status of all devices in script can be monitored by only
selecting script, without the steps such as device registration, etc. But the current value can be only
displayed.
2
1 When KV STUDIO is in Monitor or Simulator status, click the script to be monitored, select
Other procedure
If programming other scripts, the device displayed in Monitor Window will be automatically switched.
KV STUDIO provides various convenient functions and input auxiliary functions for Script Programming.
2
Script Function List
Input Auxiliary Function and Other Info
If function name is unknown, optional function can be called as follows after inputting function in
midway.
Select the function to be used and press key or double click, insert the selected function to the
cursor position in Script Editor, and the script function format prompt is displayed.
Reference • Optional script function can be also called when any content not input. In this case, all
optional functions are displayed in alphabetic sequence.
• In this case, all optional functions are displayed in alphabetic sequence.
When inputting function, "Script function format hints" can simply inform messages such as argument
and return value, etc.
Reference "Script function format hints (H)" can be also called during script programming.
Point When calling script function format hints, the cursor must be placed to the right
side of "(" or start position of function. When the cursor is at other positions, the
script function format hints cannot be called.
Reserved word
The word (reserved word) such as control statement and function, etc. registered to KV script will be
blue during programming. If character color is not changed, it indicates an input error.
2 The character color of reserved word can be changed via the "option setting" dialog box
Reference
Input Auxiliary Function and Other Info
of KV STUDIO.
HELP Function
For details of function format and how to use, please see "Script function help".
1 From the menu, select "Help (H)" "Script Function Help (L)".
"Script function help" directory appears.
The cursor position as follows, shall be before and after or in middle of function, or a part of function is
within the selected range.
2 Click button.
2
Input Auxiliary Function and Other Info
KV script can program the content from single quote( ' ) (or "REM ") to line feed (carriage return entry)
at any position of script program as comment. Comment programming can improve efficiency of debug
and program modification. It is recommended that comment shall be programed together with script.
2
Reference
• Even increase of comment line will not influence program size and scanning time.
• The number of characters entered on a single rung is up to 1024 characters (half-
width)including scripts and comments.
When programming scripts, understandable programming method enables improving debug efficiency.
Similar to ladder program, script programs finished shall be easy-to-understand in modification,
2 maintenance and reuse. So, the written script shall be understandable and clear.
So, it can be effectively used without programmer.
Input Auxiliary Function and Other Info
Sample Program
Abstruse program
Intelligible program
Calculate 10 average values of data.
IF CR2008 or LDP (r5200) THEN ' R5200 = FIFO table initialization trigger
EM2200 = 0 ' number of data stored in current FIFO table
EM2201 = 10 ' maximal number of FIFO table
Z01 = 0 ' index initialization
END IF
Inline Mnemonics
With inline mnemonics, mnemonics can be programmed directly in script program, i.e. mnemonics
language can be mixed with script language.
Plus "!! " attached at the start of mnemonics is used to discriminate from script.
Programming script
IF R1000 = ON THEN
DM1000 = DM1000 + 3
BSET(MR1015 = OFF, DM2000, 10)
ELSE
!!LD R01000 Inline mnemonics
!!OR R04000
!!ANB MR1000
!!OUT R04000
END IF
Ladder Programming
When converting the script program to Ladder, work memories can be used for CPU unit KV-7500/
7300/5500/5000/3000 or KV Nano Series, work memory and work devices for CPU unit KV-1000.
2
Work memory (work device)
Input Auxiliary Function and Other Info
Work memory (work device) refers to the device for temporarily storing partial operation result such as
complicated operation formula.
In script program, during script conversion, KV STUDIO can allocate work devices from the pre-
determined area automatically, so, reuse of devices doesn't occur during use.
Work memory*
* When CPU unit is KV-1000, work devices such as EM64536 can be used.
Operation description The result obtained by carrying out [DM3000-50] operation is stored in work memory
(@VM0) temporally, and then multiplied with DM2000, the final result is stored in left
DM1000.L.
Work memories used for scripts can be checked via "Setup work area" dialog box.
"KV STUDIO User's Manual"
In the status, the program cannot be transferred to PLC, so the area of work devices shall be enlarged
as follows.
1 From the menu, select "Convert (A)" "Entire assignment setting of local devices (A)", and
"CPU system setting" dialog box will appear.
Reference The setting for the reserved work devices for the script is only displayed in projects where
"KV-1000" is selected for the model (CPU unit).
2 Edit the column for the reserved work devices for the script.
According to error message of output window, change assignment of every workspace.
2
Input Auxiliary Function and Other Info
Bit work
devices
Word work
devices
String work
devices
Reference Three types of work devices in workspace: "bit work device" for temporarily storing bit
status, "word working device" for temporarily storing operation result, and "text string work
devices" for temporarily storing text string.
Point Work devices for text string can be reused for many times in a project, so, care
shall be taken when programming script using text string via interrupt program.
XYM Marking
Reference After selecting "Display by XYM (X)", programming can be enabled with normal Device
No. (mixable).
If the XYM marking is canceled after editing the script with XYM marking, an error will occur when the
script using X or Y is converted again. For M and L, the device number changes from a decimal to a CH
marking such as R, so note that the device number in the converted results will change.
Example) M100 = ON
The results of converting this script to a M100 ladder are:
· When using XYM marking, the script is converted to MR604.
· When not using XYM marking, the script is converted to MR100.
MEMO
2
Input Auxiliary Function and Other Info
DATA PROCESSING
DATA PROCESSING
Device refers to element (variable) used in internal relay and data memory, etc. of CPU unit, enabling to
supply data used for operation and functions and store function execution results.
The device varies with the models (CPU units).
Local Index
Number of operation specifying(*)*8
Device name Range *1 Main functions device Modify
points (Power ON, Refer-
(@)*1 (:Z/:#) Store
PRG →RUN) ence
Device used for
Input relay*10 capturing ON/OFF
info from peripherals.
Device used for
Output relay*10 R000 to R199915*2 *13 Total 32000 sending ON/OFF info Clear/hold*3 *12 Yes Yes Yes No
to peripherals
Internal Devices that can be
auxiliary used in CPU and
relay*10 expansion unit
Link relay B00 to B7FFF*10 32768 Clear/hold*3 No Yes Yes No
Internal Devices that can be
MR000 to MR99915 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*7 Yes Yes Yes No
(contact) and up/down
counter contact
Devices used for
controlling PLC
Control relay CR000 to CR7915 1280 function or capturing Hold No No No No
the status from
peripherals.
DATA PROCESSING
■ KV-7000 word device
When start Indirect
Local Index
Number of operation specifying(*)*8
Device name Range *1 Main functions device Modify
points (Power ON, Refer-
(@)*1 (:Z/:#) Store
PRG →RUN) ence
*3 Yes Yes Yes Yes
Data memory DM0 to DM65534 65535 Clear/hold
Expansion data
memory
EM0 to EM65534 65535
Device for storing
Clear/hold*3 Yes Yes Yes Yes
3
Dial mode
524288 numerical data No
3 Leading
R
UR
Leading device (R) assigned to
UR0 to UR9 the expansion unit is No No Yes
processed as an argument.
Device and Constants
■ 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)
■ Internal register
Number When start operation
Device name Range Main functions
of points (Power ON, PRG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)
DATA PROCESSING
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”.
Local device Global device
Total
Device name*1 Reserved devices in the whole
project*2
Counts/range number 3
32000 points (2000 CH) 32000 points
*1 Link relays (B), link registers (W), file registers (ZF), high-speed counters (CTH), high-speed counter
comparators (CTC), control relays (CR), control memories (CM), and index registers (Z) cannot be used as a local
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 mnemonic : TMR @0 #100).
Point • If relays (R) and temporary data memories (TM) are used as 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 a
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.
R000 to R015
Input relay - ×
(R1000 to R99915*3) from peripheral
Input/output/ equipment
Internal
To output ON/
auxiliary
R500 to R507 OFF info to
Output relay relay total Clear/hold*4 ×
(R1000 to R99915*3) peripheral
15936 points
equipment
Internal R508 to R915*2 Used in CPU and
Clear/hold*4 ×
auxiliary relay R1000 to R99915*3 expansion unit
Link relay B00 to B3FFF*10 16384 Clear/hold*4 × ×
Internal 16000 Only usable
MR000 to MR99915 Clear ×
auxiliary relay inside CPU
Latch relay LR000 to LR99915 16000 Hold ×
Contact device
for 10μs, 1ms,
10ms, 100ms
Timer (contact) T0 to T3999 4000 Clear ×
down counter,
10ms up/down
counter
Contact device
Counter(contact) C0 to C3999 4000 for up counter, Clear/hold*8 ×
up/down counter
High-speed
Used for contact
counter
CTC0 to CTC3 4 of high-speed Clear/hold*8 × × × ×
comparator
counter
(contact)
Used to control
PLC function,
Control relay CR000 to CR3915 640 Hold × × × ×
acquire
equipment status
Reference Some input, output and internal auxiliary relays can be used for interrupt and high speed
counter.
“KV-5500/5000/3000 series User's Manual, "3-6 Device and Constants””
DATA PROCESSING
KV-5500/5000/3000 word device
When operation Index Indirect
Local
Number of starts modific specifying (*)*9
Device name Range*1 Main Functions device
points (Power ON, ation
(@)*1
PROG RUN) (:Z/:#) Lookup Store
Data Memory DM0 to DM65534 65535 Clear/hold*4
Extended data
Clear/hold*4
memory
EM0 to EM65534 65535
Used for
3
Consecutive numbering:
131072 numerical data ×
Internal
auxiliary Used to output
R500 to R507 relay total ON/ OFF info to
Output relay clear*4 ×
(R1000 to R59915*3) 9536 points peripheral
equipment
R508 to R915*2 Used in CPU and
Internal clear*4 ×
R1000 to R59915*3 expansion unit
auxiliary relay
MR000 to MR99915*4 16000 clear ×
Internal Only usable
auxiliary relay LR000 to LR99915 16000 inside CPU hold ×
(latch relay)
Contact device
for 1ms, 10ms,
Timer (contact) T0 to T3999 100ms down Clear ×
Timer/
counter/10ms
Counter
up/down counter
contact
Contact device for
Counter total 4000
C0 to C3999 up counter,up/ hold*9 ×
(contact)
down counter
High-speed
Used for contact
counter
CTC0 to CTC3 4 of high-speed hold*9 × × × ×
comparator
counter
(contact)
Used to control
PLC function or
Control relay*6 CR000 to CR3915 640 - × × × ×
acquire
equipment status
Reference Some input, output and internal auxiliary relays can be assigned for interrupt and high
speed counter.
KV-1000 User's Manual, “Chapter 4 Interrupt"
KV-1000 User's Manual, “Chapter 5 High-speed Counter"
DATA PROCESSING
KV-1000 word device
When operation Index Indirect
Local
Number of starts modific specifying (*)*10
Device name Range*1 Main Functions device
points (Power ON, ation
(@)*1 Lookup Sore
PROG RUN) (:Z/:#)
Data Memory DM0 to DM65534 65535 Device for storing Hold *4
*
Extended EM0 to EM65534 5 65535 numerical data Hold *4
data memory FM0 to FM32766*5 32767 (16-bit) Hold *4 3
Device for storing
Constant
Constant Range Main Functions
Used to specify DEC constant. ("#"
(#)0 to (#)65535 (Unsigned 16-bit) can be omitted. )
(#)-32768 to (#)+32767 (Signed 16-bit) Displayed as "K"
DEC (#) Reference
(#)0 to (#)4294967295 (Unsigned 32-bit) when using the XYM
(#)-2147483648 to (#)+2147483647 (Signed 32-bit) display mode. (K can
be omitted.)
(#)-3.4E+38N(#)-1.4E-45
Single precision Used to specify single precision
N=(#)0
floating point type floating point type constant. ("#"
(#)+1.4E-45N(#)+3.4E+38
real number can be omitted.)
(Significant digits : approx. 7 digits)
(#)-1.79E+308N(#)-2.23E-308
Double precision Used to specify double precision
N=(#)0
floating point type floating point type constant. ("#"
(#)+2.23E-308N(#)+1.79E+308
real number can be omitted.)
(Number of effective digits: approx. 16 digits)
Used to specify HEX constants.
$0 to $FFFF (16 bits) Displayed as "H"
HEX ( $) Reference
$0 to $FFFFFFFF (32 bits) when using the XYM
display mode.
Fixed text string
Example) "Model ABC","Month/08:30:15" Used to fixed text string
(" ")
■ Internal register
When start
Number of operation
Device name Range Main functions
points (Power ON,
PRG → RUN)
Device for temporary data storage
Internal register - 1 Clear
(16-bit/32-bit/64-bit)
DATA PROCESSING
Local Device List (KV-5500/5000/3000)
What shown in the table below is default value of quantity and range of local device and global device that
can be used when creating projects. The number of appointed local device can be changed in "CPU
system setting" -> "Entire assignment setting of local devices" on "work space".
*1 Link relay (B), link register (W), file register (ZF), high-speed counter (CTH), high-speed counter comparator
(CTC), control relay (CR), control memory (CM) and index register (Z) cannot be used as local device.
When @FMxxx is used, consume work area as local device.
*2 When making new project, unifiedly ensure the area of device that can be used as local device.
(for calculation, assume to use 10 modules, call macro for 50 times.)
Reserved quantity of the devices is changed according to requirement.
*3 Use channel (ch) unit to set up use quantity.
*4 Programmed as " @+ (Device No.) " only when Device No. is specified as the operand of timer/ counter command.
Mnemonic symbol input example: TMR @0 #100
Point • If relay (R) and temporary data memory (TM) are used as local device, always set
up the quantity of relay and data memory.
• The following device must be processed as global device:
- KV-5500/5000/3000 PLC I/O Relay List
- Expansion unit device
- Device for reference of touch panel etc external connection equipment
- Common device in the whole project
- Device that requires data transmission between modules
• Local Device shall be numbered from 0 using consecutive numbers as possible.
• Since R, DM is distributed in expansion unit, as global device, use area is
required. When use local device, please use MR or EM with priority.
• If local device or global device is used out of the specified range, conversion
error might occur.
• When use various commands that designate first element as operand as well as
index modification or indirect designation, please do not exceed usable scope
of local device or global device.
What shown in the table below is default value of quantity and range of local device and global device that
can be used when creating projects. The number of appointed local device can be changed in "CPU
system setting" -> "Entire assignment setting of local devices" on "work space".
*1 High-speed counters (CTH), high-speed counter comparator (CTC), control relays (CR), control memories
(CM), and index registers (Z) cannot be used as a device.
*2 When a project is created, the device area used for global devices can be guaranteed as a whole
(this area is calculated according to the assumption that 10 modules are used and 50 macros are
called).
The number of reserved devices can be changed as required.
*3 Number can be set in “ch” unit.
*4 This number includes the workspace used for script devices.
*5 Operands used as timer and counter instructions can be described as @+ (device code number)
only in device editing. (Example for inputting mnenomic : TMR @0 #100).
Point • If relay (R) and temporary data memory (TM) are used as local device, always set
up the quantity of relay and data memory.
• The following device must be processed as global device:
- KV-1000 PLC I/O Relay List
- Expansion unit device
- Device for reference of touch panel etc external connection equipment
- Common device in the whole project
- Device that requires data transmission between modules
• Local Device shall be numbered from 0 using consecutive numbers as possible.
• Since R, DM is distributed in expansion unit, as global device, use area is
required. When use local device, please use MR or EM/FM with priority.
• If local device or global device is used out of the specified range, conversion
error might occur.
• When use various commands that designate first element as operand as well as
index modification or indirect designation, please do not exceed usable scope
of local device or global device.
DATA PROCESSING
Device List (KV Nano Series)
DATA PROCESSING
Macro argument devices
Macro argument devices that can only be used in macros are listed below.
Value V V0 to V9
Accepts device values or constants as
X X X
3
arguments.
Constant
Internal register
When operation
Number of starts
Device name Range Main Functions
points (Power ON,
PROG RUN)
A device to temporarily store data
Internal register - 1 Clear
(16 bits/32 bits/64 bits)
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."
Local Device Global Device
3 Device Name*1 Reserved Number of
Number of Devices
Total Number of
Devices in the Entire Devices
and Range
Device and Constants
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.
DATA PROCESSING
Device notation method
Example
DM0:#1 This means DM1.
R1000:#1 This means R1001.
Example
@DM0 @R10000
● XYM marking
The designation of device by XYM notation of the list below is possible for device (R(DR)/MR/LR/DM/
EM/FM).
*1 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”.
DATA PROCESSING
Suffix entry
Devices:(R (DR) / MR / LR / B / T / C / DM / EM / FM / ZF / W / TM / CM / *DM / *EM / *FM / *ZF / *W /
*TM) Enter .□ (□:U, S, D, L, F, DF, B, T) here.
Example
DM0.F (Values DM0 - DM1 are calculated as floating point data)
R1000.U (calculated as 16-bit data between R1000 - R1015)
3
Suffix entries can be used only in KV scripts.
Bit Device
Bit status
The status of the bit device is described in the following representation method.
Bit status Denotation Program example
3 ON (TRUE) ON, 1, TRUE MR1000=ON, MR1001=1, MR1002=TRUE
OFF (FALSE) OFF, 0, FALSE MR2000=OFF, MR2001=0, MR2002=FALSE
Device and Constants
I/O relay R
Overview Input relay is the device that acquires ON/OFF information from peripheral equipment into
PLC.
Output relay is the device that sends ON/OFF instruction or arithmetic operation result
from PLC to PLC peripheral equipment.
R00012
Device name Device No. (00000 to 99915*2 )
*1 When CPU unit is KV-1000 or KV Nano Series, the range is "000 to 599"
*2 When CPU unit is KV-1000, the range is "000 to 59915"
DATA PROCESSING
Application Input Relay
• Used peripheral equipment connected, including button and switch (for example
Selector Switch, limit switch, photoelectric switch, digital switch), etc.
• Input relay can be used as high speed inputs such as interrupt, high speed counter,
positioning function etc. (The input relays that can be used differ per 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 3
KV-NC32T R000 to R015
Default Default setting of output relay: shutoff and cleared when powering ON and when PPROG
RUN.
• When CPU unit is KV-7500/7300/5500/5000/3000 or KV Nano Series, power off hold
function in CPU system setting allows to set up holding status.
• When CPU unit is KV-1000, MEMSW instruction allows to set up holding status.
Unit No. : Starting from CPU, according to the unit connection sequence, assign
00, 01, 02, 03, 04 , and the like.
Unit relay No. : Number of relay points occupied from 00000 are assigned to relay
No.
Unit No. 00
01 02 03 04 05
KV-B16XA KV-C32XA KV-B16TA KV-C32TA KV-H20
KV-U7 CPU
10CH
unit 16-input 32-input 16-output 32-output occupied
Unit R0000 to R00015 (input)
relay No. R00500 to R00507 (output) 00000 to 00015 00000 to 00115 00000 to 00015 00000 to 00115 00000 to 00915
* Devices from R000 to R915 used by the CPU (base) unit cannot be used as unit devices.
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - 3-21
Device and Constants
DATA PROCESSING
Link relay B
Overview This device cannot be used when the compatible model (CPU unit or base unit to use) is
the KV-1000.
It is used as link relay when connecting via FL-net, etc. Different from other relays, device
No. is specified in HEX.
B1EE7
Device name Device No. (0000 to 7FFF)
Note • These relays cannot be assigned as the unit device of expansion unit.
• In the same project, the link relay with same Device No. can be programmed for many
times.
Default Default setting of link relay: shutoff and cleared when powering ON and when PPROG
RUN. Power off hold in CPU system setting allows to set up holding status.
DATA PROCESSING
Internal auxiliary relay R/B/MR/LR
R
Overview R unassigned to actual I/O relay and expansion unit relay is used as internal auxiliary relay.
Range • R1000 to R199915 * (can be assigned as the expansion input unit No.)
* The relay numbers that can be used differ by model.
KV-7500/7300: R000 to R199915
KV-5500/5000/3000: R1000 to R99915
KV-1000: R1000 to R59915
KV Nano Series: R1000 to R59915
B
Overview This device cannot be used when the compatible model (CPU unit to use) is the KV-1000.
When FL-net is not connected, B that is not assigned to link relay can be used as internal
auxiliary relay.
B1EE7
Device and Constants
Note • These relays cannot be assigned as the unit device of expansion unit.
• In the same project, the link relay with same Device No. can be programmed for many
times.
Default Under default status, when powering ON and output is off when powering ON or when
PPROG RUN. Power off hold function in CPU system setting allows to set up holding
status.
* The relay numbers that can be used differ by model.
KV-7500/7300 B0000 to B7FFF
KV-5500/5000/3000 B0000 to B3FFF
KV-1000 ---
KV Nano Series B0000 to B1FFF
DATA PROCESSING
MR
Overview The device that can be used only inside CPU.
MR02809
Device name Device No. (00000 to 99915) 3
Reference • Input allows zero suppression when programming.
Point By default, the range for the KV-7000 Series is MR200000 to MR399915, and the
range for the KV-5000/3000/1000 and KV Nano Series is MR50000 to MR99915.*
indicates it cannot be used because it is already assigned to local device.
(The reserved area can be changed using "whole local assignment setting" set in
CPU system setting)
Note • These relays cannot be assigned as the unit device of expansion unit.
• In the same project, the MR with same Device No. can be programmed for many times.
Default When powering ON, or PROG->RUN, status will be cleared, output will be OFF.
LR (Latch relay)
Overview This device could only be used in CPU to hold status.
LR02308
3 Device name Device No. (00000 to 99915*)
Device and Constants
Note • These relays cannot be assigned as the unit device of expansion unit.
• In one project, the latch relay with same Device No. can be programmed for many
times.
DATA PROCESSING
Timer (contact) T
Overview Timer including contact (1 bit) and current value (32 bit). Timer is a device for turning
contact ON, when current value of down timer is equal to "0".
T0501.B
3
Note 4 timer functions available: 10μs timer, 1ms timer, 10ms timer, 100ms timer.
Default When powering ON, or PROG RUN , status will be cleared, output will be OFF.
Current value is identical to setting value when powering ON or PR O G RUN.
Setting value is held.
* The relay numbers that can be used differ by model.
KV-7500/7300/5500/5000/3000/1000: T0000.B to T3999.B
KV Nano Series: T000.B to T511.B
How to program the timer when timer function is operated via scripts
Specifying via execution condition of timer for timer function argument (timer reset relay), timer No. and
setting value (time before timeup), enables programming the timer's operation.
Example)
Timer device (T0000 to T3999*) Setting vale (0 to 4294967295, device No.)
TMR (R1000,T501,1000
Timer function name Timer execution condition
(100ms down timer)
*1 The device numbers that can be used differ according to the model.
KV-7500/7300/5500/5000/3000/1000: T0000.B to T3999.B
KV Nano Series: T000.B to T511.B
*2 This function cannot be used with the KV-1000.
Reference The device (unsigned 32-bit data) and formula can be specified in setting value.
"TMR function", Page 22
Timer error
Timer error as follows:
TMR (100ms Timer) : within± (100ms + 1 scanning time)
TMH (10ms Timer) : within± (10ms + 1 scanning time)
TMS (1ms Timer) : within ± (1ms + 1 scanning time)
TMU (10μs Timer) : within ± (10μs + 1 scanning time)
3
Precautions when using a timer function
Device and Constants
When using timer function in IF statement or Box Script, if IF statement or Box Script is not executed
during timer function execution, the current value of timer will be not updated.
If time measurement is continued, and every instruction executed, the elapsed time will be reflected in
current value of timer . If reaching setting time, timer contact will be ON rapidly after execution again.
Programming Script IF MR1000 = ON THEN
TMR (MR2000 = ON, T100, 200)
END IF
Execute condition is OFF, Do not reset even if execution
so timer function is reset condition is OFF
Current
value
Since TMR function is not
scanned, the current value is
stored with “8” and not updated
Setting
value
20 20 18 16 14 20 20 18 16 14 12 10 8 ˄6˅ ˄4˅ ˄2˅ ˄0˅ 0
(When timeup) IF statement starts again
Point When correcting, if current value exceeds setting value, the current value is
corrected to the value identical to the setting value.
DATA PROCESSING
Counter (contact) C
Overview Counter including contact (1 bit) and current value (32 bit).
Counter is a device in which contact is ON when current value is the same as setting
value (counting is finished).
How to program the counter when counter function is operated via scripts
Specifying via execution condition (counter reset) of the counter for counter function argument, counter No.,
setting value and count input relay enables programming the counter's operation.
When count input relay OFF->ON (differential type), the current value of counter function will be
incremented by "1"; when the current value reaches setting value, counter contact is ON.
Reference The device (unsigned 32-bit data) and formula can be specified via setting value.
"CNT function", Page 5-32
Point When correcting, if current value exceeds setting value, the current value is
corrected to the value identical to the setting value.
Overview High-speed counter compare including contact (1 bit) and setting value.
High speed counter comparator is a device that turns ON when current value of high
speed counter is the same as setting value.
3 Point When CTC is used as interrupt element, CTC (contact) is not ON.
Device and Constants
Reference • Suffix can be added when programming. When processed as contact, suffix.B must be
attached; when processing setting value, suffix.D must be attached.
• When suffix is omitted, the type will be processed as .B (bit type), unless type
declaration is available.
Note Interrupt program can be also executed with CTC as interrupt condition.
Overview Control relay is an internal auxiliary relay to control PLC function and acquire PLC status.
DATA PROCESSING
Word Device
Overview Data memory and extended data memory are used to store lookup data or 16-bit/point
operation result during function operation.
When CPU unit is KV-5500/5000/3000, FM is used as File Register.
"File register ZF/FM" (page 3-33)
3
DM06143
Reference • Input allows zero suppression when programming.
Example) DM6143
• Suffix can be added when programming
Example) DM1000.S (signed 16 bit), DM2000.D (Unsigned 32 bit)
• When suffix is omitted, the type will be processed as .U (signed 16-bit), unless type
declaration is available.
• Processed as the bit device.
Example) DM1100.Bthe lowest bit of DM1100
• When the compatible model (CPU unit or base unit to use) is the KV-7500/7300/5500/
5000/3000 or KV Nano, it can be processed as the bit device whose bit position is
specified.
Example) DM1200.12the 13th bit of Device of DM1200
Note • Only Data Memory (DM) can be assigned as the unit device of expansion unit.
16 bits
When processing 32-bit data
• 2 devices can be used to process 32-bit data. For 32-bit data, low 16 bits will be stored
in Data Memory of the specified Device No., and high 16 bit will be stored in Data
Memory of the next Device No.. When processing unsigned DEC number, 0 to
4294967295 can be processed; when processing signed DEC number, -2147483648
to + 2147483647 can be processed; when processing HEX number, $0 to $FFFFFFFF
can be processed.
• When processing 32-bit data, suffix .D or .L shall be added on Device No..
DM1 DM0
bit bit bit bit bit bit bit bit
31 24 23 16 15 8 7 0
32 bits
Unit No. : Starting from CPU, according to the unit connection sequence, assign
00, 01, 02, 03, 04...., and the like.
Unit DM No. : Assign the occupied Data Memory from 0000.
Suffix : When programming, Data Memory and expansion Data Memory may
have suffix. When suffix is omitted, these memorizers are processed
as unsigned 16-bit (.U ).
DATA PROCESSING
Example)
Unit No. 00 01 02 03 04 05
Unit DM No.
0000to0019 0000to 0021 0000to 0017 0000 to 0401 0000to 0401 0000to 0401 3
The 5 th of KV-AD40 .................... DM01_0004
Point When CPU unit is KV-1000, only FM (FM00000 to FM32766) can be processed.
"Data memory/Extended data memory DM/EM/FM" (page 3-31)
ZF/FM cannot be used when the compatible model (base unit to use) is the KV-
Nano Series.
ZF0372
Note • These relays cannot be assigned as the unit device of expansion unit.
• Device types and range are different between consecutive number method and Bank
switching mode.
ZF: when file register is processed with consecutive number method
Process whole area of File Register as 1 device.
When CPU unit is KV-1000 , it cannot be used.
File register area
<( <(
FM00000 ... ... FM32767 FM00000 ... ... FM32767 FM00000 ... ... FM32767 FM00000 ... ... FM32767
16 bits
DATA PROCESSING
When processing 32-bit data
• 2 devices can be used to process 32-bit data. For 32-bit data, low 16bits will be stored
in Data Memory of the specified Device No., and high 16 bits will be stored in Data
Memory of the next Device No.. When processing unsigned DEC number, 0 to
4294967295 can be processed; when processing signed DEC number, -2147483648
to + 2147483647 can be processed; when processing HEX number, $0 to $FFFFFFFF
can be processed.
• When processing 32-bit data, suffix .D or .L shall be added on Device No..
3
32 bits
Link register W
Overview This device cannot be used when the compatible model (CPU unit to use) is the KV-1000.
It is used as link register when connecting via FL-net, etc. Different from other word
devices, Device No. is specified using HEX system.
W3A6F
Note These relays cannot be assigned as the unit device of expansion unit.
16 bits
When processing 32-bit data
• 2 devices can be used to process 32-bit data. For 32-bit data, low 16 bits will be stored
in Data Memory of the specified Device No., and high 16 bits will be stored in Data
Memory of the next Device No.. When processing unsigned DEC number, 0 to
4294967295 can be processed; when processing signed DEC number, -2147483648
to + 2147483647 can be processed; when processing HEX number, $0 to $FFFFFFFF
can be processed.
• When processing of 32-bit data, suffix .D or .L shall be added on Device No..
W2BE1 W2BE0
bit bit bit bit bit bit bit bit
31 24 23 16 15 8 7 0
32 bits
DATA PROCESSING
Temporary data memory TM
Overview Temporary data memory is a 16-bit word device that can conduct same processing with
Data Memory. Some device areas are also used to temporarily store arithmetic operation
data or arithmetic operation result data.
Reference • TM000 to TM003 are used in operation instructions such as DIV, MUL in ladder, TM000
and TM001 used for processing 32-bit above data. It is recommended that these
temporary data memories are not used for other purposes.
• Input allows zero suppression when programming.
Example) TM10
• Suffix can be added when programming
Example) TM10.D (Unsigned 32-bit)
• When suffix is omitted, if without type declaration, process as .U (Unsigned 16-bit).
TM No. Application
TM000 to TM001 64-bit data
TM002/TM003 Used to store the remainder after dividing
TM004 to TM511 Common*
Default When powering ON or PROG -> RUN, temporary data memoryis cleared.
Overview By adding suffix .D to timer device, timer device can process current value.
Reference When timer device processes current value, suffix.D cannot be omitted. When suffix is
omitted, if without type declaration, it is processed as .B (timer contact).
Point When current value changes, if current value exceeds setting value, current value
will be changed to the value identical to setting value.
Overview By adding suffix.D to counter device, counter device can process current value.
Reference When Counter device processes current value, suffix.D cannot be omitted. When suffix is
3 omitted, if without type declaration, it is processed as .B (counter contact).
Device and Constants
Point When current value changes, if current value exceeds setting value, current value
will be changed to the value identical to setting value.
* The device numbers that can be used differ by model.
KV-7500/7300/5500/5000/3000/1000: C0000.D to C3999.D
KV Nano Series: C000.D to C255.D
Overview High speed counter is 32-bit counter used to collect short interval signal that cannot be
collected by counter instruction.
Default Under default status, output is off when powering ON and when status is cleared during
PPROG RUN.
• When the compatible model (CPU unit or base unit to use) is the KV-5500/5000/3000
or KV Nano, power off hold function in CPU system setting allows to set hold mode.
• When CPU unit is KV-1000, MEMSW instruction allows to set hold mode.
DATA PROCESSING
High-speed counter comparator (setting value) CTC
Overview By adding suffix.D to CTC, setting value of high-speed counter (32-bit) can be processed.
Reference When high-speed counter compare device processes setting value, suffix .D cannot be
omitted. When suffix is omitted, if without type declaration, it is processed as .B (contact). 3
Index register Z
Overview 32-bit word device that is used to specify No. attached to destination device during index
modification. Just like data memory, it may store data and operation result.
Range Z1 to Z12
Control memory CM
Overview Control memory is a specific word device to control PLC function and acquire PLC status.
DATA PROCESSING
Processing Bit Device in Word Unit
If the bit device without suffix.B is specified according to functions and assignment statements of word
device used, it will be processed in word unit starting from the specified bit device.
Example)
DM0000.U = R3000.U
R30015 R30000
3
DM0000.D = R3000.D
R30115 R30100R30015 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
If the bit device with suffix is not at the leading of a channel, straddle the next channel and process in
word unit.
R30505.U = R30003.U
R30102 R30003
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
In general, word device is processed as the device of 16-bit/32-bit, but it can be processed as bit device
after adding suffixof bit type.
Point High-speed counter (CTH) and index register (Z) cannot be processed as the bit
device.
3
Device and Constants
1 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1
Lowest bit
1: Contact ON
0: Contact OFF
The lowest bit of DM1000 is 1, so, DM1000.B shall be processed as per "ON".
Denotation Example)
&/
Random word device Bit position (.0 to .15)
DATA PROCESSING
When DM123 value is #59 ($3B)
bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit
0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1
When DM123 is treated as bit device at the specified bit position, bit status as follows.
Device Bit status 3
DM123.0 ON
When the compatible model (CPU unit or base unit to use) is the KV-7500/7300/5500/5000/3000 or KV
Nano, you can add "D" to the front end of device No. of I/O relay (R), and it works as direct I/O relay.
Denotation Example)
Direct I/O relay
DR001
I/O relay
Point • When CPU unit is KV-1000, direct I/O relay cannot be used.
• If the compatible model (base unit to use) is the KV Nano Series, direct I/O relays
cannot be used on the expansion unit.
• No suffix other than .B could be added.
For direct I/O relays, see "KV-5500/5000/3000 series User's Manual" or "KV Nano series User's Manual".
Constant
Constant and its range will vary with function used and suffixof device.
06143
Reference Adding suffix via constant and programming, can expand the range of constant. (suffix is
not added to constant in programming generally)
300U : 16-bit, unsigned (0 to 65535)
500S : 16-bit, signed (-32768 to +32767)
3000D : 32-bit, unsigned (0 to 4294967295)
5000L : 32-bit, signed (-2147483648 to +2147483647)
123F : Single precision floating point type (-3.4E+38N1.4E-45
N=0
1.4E-45N3.4E+38)
(Number of effective digits: approx. 7 digits)
1.2345678DF : Double precision floating point type (-1.79E+308N-2.23E-308
N=0
2.23E-308N1.79E+308)
(Number of effective digits: approx. 16 digits)
Point • For constant suffix, "." (point) is not added when programming.
• For the KV Nano Series, an operation error occurs when using denormalized
single precision floating point types.
DATA PROCESSING
$ HEX constant
Denotation HEX constant takes "$" as prefix, attached with HEX value.
Example) HEX symbol Value
$1AF7 3
Reference Due to HEX number without suffix, 16-bit/32-bit will be identified via the number of digits after
"$".
$00FF(4 digits or less) ……16-bit
$0000 00FF (5 digits or more)……32-bit
Point • When programming, if HEX constant has no prefix "$" and contains A to F , error
will occur; if it does not contain A to F, it will be considered as DEC number.
• When programming, sign (+/-) cannot be attached to HEX constant.
Overview When programming, single precision floating point type real number can act as floating
real number.
1234.56
• 8-bit above is represented in exponential form.
• DEC constant is represented by suffix.
Example) Value single precision floating point type
1234F
Reference DEC constant can also contain prefix "#" when programming. For signed DEC constant,
only "+" can be omitted.
Range -3.4E+38N-1.4E-45
N=0
+1.4E-45N+3.4E+38 (Number of effective digits: approx. 7 digits)
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38 cannot be
used.)
Overview When programming, double precision floating point type real number can act as floating
real number.
3 Example) Value
12345.6786
Device and Constants
1234F
Reference DEC constant can also contain prefix "#" when programming. For signed DEC constant,
only "+" can be omitted.
Range -1.79E+308N-2.23E-308
N=0
+2.23E-308N+1.79E+308 (Number of effective digits: approx. 16 digits)
Overview During programming, any text string can be bracketed using double quote (").
“Operation result”
DM1000.T = " " + "Operation result" + " " “Operation result” is stored in DM1000.T.
Point Text string will be processed as label if (" ") not inputted.
DATA PROCESSING
Devices that can be used with index modification and indirect specifying are listed below.
KV-7500/7300/5500/
Device KV-1000 KV Nano
5000/3000
Index Indirect Index Indirect Index Indirect
Type Symbol Name
modification specifying modification specifying modification specifying
R Relay * * *
CR Control relay - - - - - -
Bit
T
C
Timer (contact)
Counter (contact)
*
*
*
*
*
*
3
Device
MR Internal auxiliary relay * * *
* Indirect specifying is possible, but the address cannot be stored with the "*(device)" description.
Point • Index modification is not possible for CR, CTC, CTH, Z, labels (label arrays), and
bit specifying devices of word devices.
• Indirect specifying is not possible for CR, CTC, CTH, Z, and bit specifying
devices of word devices.
Index Modification
"Index modification" refers to the method for specifying numbered device by adding the value and
constant of index register (Z) to corresponding device.
The range of the value that can be summarized is signed 32-bit value (-2147483648 to +2147483647).
The devices that can be used differ by unit. See "Devices that can be used with index modification and
3 indirect specifying" on page 3-38.
Index modification can be used together with indirect specifying (*) or local device (@).
Index Modification and Indirect Specifying
Point • Label (label array) and bit specifying device of word device cannot perform
index modification.
• When specify the device out of range that is capable of index modification
according to argument, control relay CR2012 is ON and this function is not
executed. But operation continues.
Example
The current value stored in DM1000 will be saved as triggering signal at the rising edge of
R0001.
Index register will be initialized during start of operation; the data is stored in memories
starting from DM0000 at the rising edge of R0001( OFF -> ON change).
Programming Script
IF LDP(CR2008) THEN
Set index register Z01 to 0 when
Z01=0 starting operation.
END IF
Write value of DM1000 to destination
IF LDP(R0001) THEN device to be index-modified at rising
DM0000:Z01 = DM1000 edge of R0001.
INC(Z01) Increment (+1) index register Z01
END IF
DM0099 1234
DATA PROCESSING
Point Since the device (value) to be index-modified is processed as signed 32-bit data,
the index register whose type is not declared will be automatically performed as
".L (signed 32-bit)".
Reference If 10 or more index registers (Z) are required in a project, index register function (ZPUSH/
ZPOP) can be used for batch cleaning or restoring index register of every module or
macro. Besides, due to automatic cleaning or restoring when interrupt program is started 3
and stopped, ZPUSH/ZPOP function needs not to be used.
Reference If it is used when making ladder using unit device, the device No. assigned can be clearly
identified. Besides, when making macro as argument device, it is valid when UR/UM is
used.
Example)
UR0:2
UM1:32
* during index modification via expression, must add bracket () to the expression.
• Indirect specifying (*) operates the address via special function, changing the device to be searched.
• Index modification is represented via [base address device + relative offset (index constant)], and
indirect specifying represented via ["*" + specifying destination address storage device].
• Indirect specifying can be used with index modification (: Z /: (#) decimal constant) and local device (@).
2 words must be used for address storage due to address managed as 32-bit.
Point • If the device outside range of applicability is addressed via indirect specifying,
the action of function cannot be guaranteed.
• If the device outside range of applicability is addressed according to the
condition operation formula, the operation result cannot be guaranteed.
Example)
<When the address of DM1 is set to FM100 and programmed as "*FM100">
Device Value
FM100FM101 DM0 25
Indicates value FM100 specify 1234
DM1 1234
of DM1’s address or DM1.
DM2 0
DM3 96
The devices that can be used differ by unit. See "Devices that can be used with index modification and
indirect specifying" on page 3-38.
DATA PROCESSING
Reference • If indirect specifying device is a timer (T) or counter (C), contact, current value and
setting value will depend on the function argument used and additional suffix.
• Use programming format of local device " *@( device) ".
• Indirect specifying device is processed as .U (unsigned 16 bit).
• Type declaration can be also conducted for indirect specifying.
Point The devices that can store addresses vary depending on the unit. For details, see
“Devices that can be used with index modification and indirect specifying.”
"ADRSET function", Page 6-22
2 For every argument (device) of indirect specifying function, Prefix "*" can be added to the
device for storing current address.
Example)
EM1000.U = AVG( FM100.U,10) Store average vaue of 10-word data starting from
FM100 (DM0) to EM1000.U.
Point Before adding prefix "*" to address storage device, ADRSET function must be
used to store the address of device to be indirectly addressed.
Point When changing the address to be searched, do not use common operators
(+, -,*, /, etc.). Otherwise, Ladder fails to operate correctly.
• The device type can be represented by adding suffixto indirect specifying device.
Programming Script *DM1000.F = 123.567 ' *DM1000 indirect specifying device is processed as .F
3 ' (single precision floating point type).
Index Modification and Indirect Specifying
• If using type declaration (TYPE) to specify the type of indirect specifying device, the suffixcan be
omitted when programming.
Programming Script TYPE *DM1000.F ' Type declaration: DM1000 is processed as .F.
*DM1000 = 123.567 ' Even if the suffix is omitted, the device of DM1000
' indirect specifying is also processed as .F.
• When programming, if the suffixof indirect specifying device without type declaration is omitted, the
device will be processed as .U.
Programming Script *DM1000 = 65535 ' * DM1000 indirect specifying device without type
' declaration is processed as .U (unsigned 16 bit).
In this case, even if the device type of indirect specifying is not.U, if suffixof indirect specifying device
is omitted, can be also processed as.U.
Programming Script ADESET (MR2000, ' MR2000 address is stored in DM1000.D( DM1000.D).
DM1000.D) ' MR2000 is bit device but suffix is omitted,
*DM1000 = 123 ' DM1000 ( = MR2000 ) is processed as. U ( word
' device).
• If the type of indirect specifying device has been declared, the type of address storage device is declared as
.D (unsigned 32-bit).
Programming Script TYPE *DM1000.F ' *DM1000DM1000 is declared as .F,
' and DM1000 as .D.
TYPE *DM2000.S ' *DM2000 acts as . S declaration,
' or DM 2 000 as .D declaration.
ADESET (EM5000, DM1000) ' DM1000 is processed as .D .
*DM1000 = 123.567 ' *DM1000 (= EM5000 ) is processed as .F .
ADESET (FM6000, DM2000) ' DM2000 is processed as .D .
*DM2000 = -555 ' * DM 2000 ( = FM6000 ) is processed as. S .
DATA PROCESSING
Example for indirect specifying
During initial scanning, DM0 address will be stored to FM100/FM101.
DM1000 current value is stored from DM0 in turn and triggered at rising edge of R0001.
DM0099 1234
How To Program
During index modification for indirect specifying device, you can program according to following method.
Example)
DATA PROCESSING
For KV script, device type and constant type can be represented by adding suffix to the device.
For the device with the suffix ".U", ".S", ".D", ".L", ".F", ".DF", ".B" or ".T", the type of processing data
varies with different suffixes.
Suffix
A suffix refers to a symbol attached to the end of the device, and can be divided into seven kinds as
follows.
3
According to suffix, every device can process Data Memory value, etc. as follows:
Suffix .U is processed as unsigned 16-bit data. (0 to 65535)
Suffix .S is processed as signed 16-bit data. (-32768 to 32767)
Suffix .D is processed as unsigned 32-bit data. (0 to 4294967295)
Suffix .L is processed as signed 32-bit data. (-2147483648 to 2147483647)
Suffix .F is processed as single precision floating point type real number data.
-3.4E+38≤N≤-1.4E - 45
N=0
1.4E - 45≤N≤3.4E+38
(Number of effective digits: approx. 7 digits)
(For the KV Nano Series, an absolute value in a range of 1.4E-45 to 1.2E-38 cannot be used.)
Suffix .DF is processed as double precision floating point type real number data.
-1.79E+308≤N≤-2.23E-308
N=0
2.23E-308≤N≤1.79E+308
(Number of effective digits: approx. 16 digits)
The suffix specified by ladder program can be only added at the end of an instruction, not
Reference
device (for script, suffix is only added at the end of the device, not function).
● Suffix omitted
For programming of the device whose suffix omitted, the processing type depends on the device type.
Programming Script DM1000 = 2000 ’When omitted, data is processed as unsigned 16-bit (.U).
END IF
* The signed 32 bit data (.L) will be replaced with unsigned 32-bit data (.D). If "Set script warning
level" is set too higher, the warning will be sent during script conversion.
The type of device can also be declared in advance via "TYPE" programming.
Reference
Type declaration is valid only in type statement script.
For details, see "About Type Declaration (TYPE)".
■ About .U and .S
Suffix .U processes BIN data as unsigned 16-bit data.
Suffix .S processes BIN data as signed 16-bit data.
Correspondingly, the decimal representation relation between BIN data and corresponding suffix, is
shown below.
DATA PROCESSING
• If suffix is .S, DM1000 value is compiled to "-1".
Correspondingly, the decimal representation relation between BIN data and corresponding suffix is
shown below.
Point
During processing of 32-bit data (.D,.L,.F), device No. of even number must be
used.
■ About .F
.F suffix will process BIN data as single precision floating point type real number. The data is 32-bit
type.
Single precision floating point type real number data is indicated with specific bit (internal
representation).
So, direct bit operation and analysis on internal representation must be avoided.
3 Single precision floating point type real number value is a value represented according to the following
method.
Data Type (suffix)
ˉ1.234×2ˉ3
Sign Mantissa Exponent
($FC)= 125
11111100
($FD)= 126
11111101
($FE)= 127
11111110
($FF)= not used
11111111
Point
Suffix .D, .L and .F shall be added to the device when 32-bit data is processed by
word devices such as DM/W/EM/FM/TM, etc.
In this case, the device uses 2 words with continuous No..
The device to be specified is that the suffix is added to low 16bits.
Example) DM1000.D [DM1001/DM1000].
DATA PROCESSING
■ About .DF
.DF suffix will process BIN data as double precision floating point type real number. The data is 32-bit
type.
Double precision floating point type real number data is indicated with specific bit (internal
representation).
So, direct bit operation and analysis on internal representation must be avoided.
Double precision floating point type real number value is a value represented according to the following 3
method.
000000000000($ 000)
= 2045
000000000000($ 000)
= 2046
000000000000($ 000)
= 2047
111111111111($ FFF)= not used
Point
Suffix .DF shall be added to the device when double precision floating point type
real number is processed by word devices such as DM/W/EM/FM/TM, etc.
In this case, the device uses 4 words with continuous No.. Use an even number
device when handling .DF.
The device to be specified is that the suffix is added to low 16bits.
Example) DM1000.DF [DM1003•DM1002•DM1001•DM1000] .
.DF can be used with KV-7000 CPU units, KV-5000/3000 Series CPU units that
have CPU function version 2.0 or higher and with KV Nano Series base units.
■ About .B
.B suffix processes BIN data as bit data.
3 Reference
If the word device is bit processed (suffix .B), and the lowest significant digit is the bit
target. As mentioned in above example, DM10.B is specified in the argument of SET
function, the least significant bit of DM10 changes to "1". TRUE/FALSE judgement of word
Data Type (suffix)
■ About .T
Suffix .T processes BIN data as text-string data.
bit bit
15 0
Data storage status K(4BH) E(45H) :DM100
Y(59H) E(45H) :DM101
N(4EH) C(43H) :DM102
E(45H) CR(0DH) :DM103
LF(0AH) NUL(00H) :DM104
DATA PROCESSING
Value change when exceeding max./min. value
When arithmetic operation result exceeds maximum value or minimum value, according to data type,
data change is shown below respectively.
1.4×10-45* 3.4×1038
0 (1.4E-45) (3.4E38)
2.23×10-308 1.79×10308
0 (2.23E-308) (1.79E308)
help_topic_start
• Even if the device with type declaration, other suffix will still be addressed firstly.
DATA PROCESSING
help_topic_start
● When operation formula does not contain floating point data (.F, .DF, constant
value)
● When operation formula contains floating point data (.F, .DF, constant value)
Even if the device storing the results is .F, if the right-hand side contains .DF, the
precision will drop.
DATA PROCESSING
help_topic_start
PRAGMA Directive
If the operation formula contains a single precision floating point type data (.F, constant), the operation is
executed after converting the type to a single precision floating point type (.F). However, by using a PRAGMA
directive, compilation can be instructed to convert the type to a double precision floating point type (.DF).
By operating with double precision, a drop in precision, including in the interim operation results, can be
prevented. 3
The PRAGMA directive instruction cannot be used with the KV-1000.
● Operation formula
Programming Script
DM1000.F = 123.45
DM1004.S = -1998
#PRAGMA DOUBLE ON
DM2010.DF = DM1000.F 3.141592 ‘ ...(3) Effective interval of PRAGMA
Operation description
The right-hand sides (1), (2) and (3), (4) are the exactly same operation formula, but (3), (4) specify to
convert the floating point type operation to a double precision floating point type with a PRAGMA
directive. (1), (2) are operated with a single precision floating point type and (3), (4) are operated with a
double precision floating point type.
(1)The operation formula contains only a single precision floating point type (.F, constant) so it is operated
using the single precision floating point type. The operation results are converted to the left-hand side
type (double precision floating point type (.DF), and stored in DM2000 to DM2003 (4 words).
(2)The operation formula contains only an integer type (.S, constant), so the integer type value is
converted into a signed 32-bit integer (.L) and then operated. The operation results are converted
into double precision floating point type (.DF), and stored in DM2004 to DM2007 (4 words).
(3)The operation formula contains only a single precision floating point type (.F), but PRAGMA
DOUBLE Is valid so each is converted into a double precision floating point type (.DF) and operated.
The operation results are stored in DM2010 to DM2013 (4 words).
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - 3-65
Data Type (suffix)
DATA PROCESSING
(4)PRAGMA DOUBLE is valid but the operation formula does not contain floating point type data so,
the operation is executed with the same rules as (2). The operation results are converted into double
precision floating point type (.DF) and stored in DM2014 to DM2017 (4 words).
3
Data Type (suffix)
The operation results differ for (1) (DM2000) and (3) (DM2010).
Point
• The size of the double precision floating point type (.DF) is 4 words (64 bits).
• When operating integers, they are first converted into signed 32-bit integers (.L)
regardless of the validity of the PRAGMA directive. To operate the integers as
floating point types, for example with case (4) above, part of the target device
must be extended into a float point type such as:
DM2014.DF=TODF(DM1004.S)/25.
The same effect can be attained by noting the constant as a decimal as shown
below.
DM2014.DF=DM1004.S/25.0
• The operation precision increases by operating as a double precision type, but
the execution speed is slower than the single precision type. Using the
PRAGMA directive only where operation precision is required is the key point.
The PRAGMA directive cannot be written to cross other control statements (where
Point
control blocks cross).
"Precautions on use of nesting", Page 4-32
[When FOR statement (repeated control statement) and PRAGMA directive
intersect]
FOR <Word device (1) value> TO <end value> 'control statement (1)
Process statement (1)
FOR <word device (2) value> TO <end value> 'control statement (2)
Process statement (2)
#PRAGMA DOUBLE ON 'PRAGMA directive
Operation Formula
NEXT
#PRAGMA DOUBLE OFF
NEXT
DATA PROCESSING
● Operation of functions
Programming Script
#PRAGMA DOUBLE ON 3
DM1010.DF = SIN(DM100.F) ‘ ...(2) Effective interval of PRAGMA
Operation description
The right-hand sides of (1) and (2) are the exact same operation formula, but (2) specifies to convert
the floating point type operation to a double precision floating point type with a PRAGMA directive.
When a PRAGMA directive is issued, even when a single precision floating point type (.F) is specified
for the function's argument, if the function specifications support double precision operation, the type
will be converted to a double precision floating point type and executed.
(1)The argument is a single precision floating point type (.F) so it is operated using the single precision
(SIN.F). The operation results are converted to the left-hand side type (double precision floating
point type (.DF)) and stored in DM1000 to DM1003 (4 words).
(2)The argument's single precision floating point type (.F) is converted to a double precision floating
point type (.DF) and operated with double precision (SIN.DF). The operation results are stored in
DM1010 to DM1013 (4 words).
The script for (2) is written in the following manner without the PRAGMA directive.
Point
Even if there is a function in the PRAGMA directive, the following functions will
not be extended to double precision floating point type data.
• TOU function (converted to .U (unsigned 16-bit integer))
• TOS function (converted to .S (signed 16-bit integer))
• TOD function (converted to .D (unsigned 32-bit integer))
• TOL function (converted to .L (signed 32-bit integer))
• TOF function (converted to .F (single precision floating point type data))
MEMO
3
Data Type (suffix)
Assignment Statement
SCRIPT SYNTAX AND PRECAUTIONS
Assignment statement is the statement whereby the result or value on the right side of equal sign (=) is
assigned to the left side of equal sign.
• 1 If multiple equal signs(=) are used on one line, the initial (the most left) equal sign(=) is processed
as "=" of assignment, the later equal signs(=) are processed as comparative sign(=).
in this case, the left side of equal sign(=) assigned is processed as the left, and the right side
processed as the right side.
Assignment Statement
R1000 = DM1000 >= 500.............Equal sign, inequality sign allowed
(calculation result is only formula of
Boolean value)
● Operation assignment statement
Operation assignment statement is a assignment statement programed with right device omitted in four
arithmetic operation for left assignment statement device.
There are 4 operation assign statements as follows.
+=, - =, * =, /=
Left side right side operation assignment statement
DM1000.U = DM1000.U + 1 DM1000.U += 1
Besides, when using operation assignment statement, right operation is based on type operation on the
left side.
DM2100.D += SRA (EM1000, 8) 2 'DM2100.D = DM2100.D + TOD (SRA (EM1000, 8)2)
The following script operation results are same (.L range), but LD converted is different.
Programming Script DM3000.T +="ABC" 'And DM3000.T = DM3000.T + "ABC" Meaning same
Assignment Statement
● When the type on right side is different from that on left side
• Assignment statement is FALSE when the types on right side and left side are different (type
conversion cannot be performed).
Operation description Assign right DM2000.U (constant: unsigned 16 bit) to DM1000.T (character string type)
(conversion error)
4 • Even if the types are different, different types .U,.S,.D,.L,.F can also be converted (precision drops
Assignment Statement
sometimes).
Operation description Assign right DM2100.D (unsigned 32 bit) to DM1100.U (unsigned 16 bit). In such a case,
low 16 bit is only assigned to DM2100.D.
Script alarm grade setting "Setting method of warning level", Page 2-41
Operation description Assign right DM1000.U (unsigned 16 bit) to 3 (constant). (conversion error)
• During formula and function programming on the left side, incorrect as assignment statement, error
appears.
Operation description Assign right DM1000.U (unsigned 16 bit) to left formula . (conversion error). changes
error.
MEMO
Assignment Statement
Operator
SCRIPT SYNTAX AND PRECAUTIONS
Operators is a data processing symbol, including addition (+), multiplication (*), etc. used in working
equation.
Operator List
■ Operator type
The operators include the following 4 kinds: "arithmetic operator", "comparison operator", "character
string connection operators", and "logical operator", etc.
4 Operators shall be programed with single byte character.
Point
Operator
● Arithmetic operator
Arithmetic operator can return arithmetic operation result of 2 values.
*1 Exponentiation can be used for .F and .DF suffixes with KV-7000 Series CPU units, with KV-
5000/3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
*2 A single-byte space is required before and after symbol.
● Comparison operator
Return the evaluation result of size relation of 2 values in Boolean value (ON or OFF).
● Logic operator
In case bit relation operation for result of logical operation of 2 values and word relation operation
Boolean value (ON or OFF), a word value is returned.
*4
relation, word device relation)
Calculate exclusive logical OR of 2 devices (bit MR603 = R000 XOR R001
4
XOR
device relation, word device relation)
Operator
*4 1-byte space is required before and after symbol.
Point • To operate device (operate element), please specify the relation of the bit device
relation or the word device. Do not perform logical operation of bit device and
word device, etc.
• When the types and sizes of operation device (operate element) are different,
operate with larger type.
Example) DM1000.U and DM2000.D.... operate with 32 bit type
Operator priority
When multiple operators are used in 1 formula, each operation section of the formula is evaluated
(calculated) according to the specified sequence. This sequence is called operator priority.
Operator
The priority of all comparison operators is same. So, when multiple comparison operators are specified
in 1 formula, evaluating is performed according to the sequence( from left to right) of operators.
Example) When R1000 = R000 OR R001 AND DM0 = 100 assignment statement
R1000 = (R000 OR (R001 AND (DM0 = 100) ) ) Operation.
Operation sequence 1: DM0 = 100 comparison (ON or OFF) ............compare result (1)
Operating sequence 2: Compare result (1) and R001 logical AND ......result (2)
Operating sequence 3: Result (2) and R000 logical OR .....................result (3)
Operating sequence 4: Assign result (3) to R1000
● Change priority
(if using parentheses () ), operation in "( )" is implemented before outer operation, so, priority can be
changed, the part with working equation is firstly evaluated. The priority of operators is kept in "( )" .
4
Example) 1 SELECT CASE DM2000 SELECT control statement
2 CASE 1
3 DM1000 = 100 Separately used as processing statement
Operator
4 CASE 2
5 DM3000 = DM1000 + 5 Separately used as processing statement
6 END SELECT
* Although same "DM1000 = 100 " is programed on the 3 rd line of assignment statement example
and on the 7th line of comparison operator example, its meanings are different.
Control Statement
SCRIPT SYNTAX AND PRECAUTIONS
Control statement is used to change the flowing direction of program, and, where applicable, enable
processing flow branching or looping, change execution selection and the number of execution.
Control
Control Statement
(2) Dual branch control statement shall be separately processed according to conditional
formula
IF Conditional formula A THEN
• If conditional formula A is TRUE,
Processing statement B
processing statement B will be executed.
ELSE
I f c o n d i t i o n a l f o r m u l a A i s FA L S E ,
IF statement Processing statement C
processing statement C will be executed.
END IF
(3) Execute multiple branch control statements according to multiple conditional formula
D is executed.
・・
Control
statement Content of control
The statement is a loop control statement for loop process before the conditional formula
of the number specified is TRUE
FOR FOR initial value
statement TO final value STEP incremental value • From initial value to final value, and also an
incremental value , loop execution of
4
Processing statement A
NEXT processing statement.
The variable number of loop control statement in loop process during conditional formula
Control Statement
is TRUE
WHILE
statement WHILE conditional formula
• Loop execution of processing statement
Processing statement
during conditional formula is TRUE.
END WHILE
The variable number of loop control statement in loop process before conditional formula
is TRUE
DO statement
DO
• Loop execution of processing statement
Processing statement
during conditional formula is FALSE.
UNTIL conditional formula
In loop control statement, unrelated to loop condition, exit from loop control
Control Statement
4
<Processing statement 1> Processing statement 1 will be executed.
END IF IF statement end
END IF
Tip
• If the result of conditional formula is bit (return Boolean value) formula, it can be used in any formula.
• Processing statement is a series of programming processing between THEN to END IF, and can be
programmed among multiple lines if required.
• IF statement can be nested, multiple-branch processing can then be conducted by programming IF
statement in processing statement and selecting AND condition.
Reference Up to 200 layers are available for the IF statement nesting (program IF statement in IF
statement).
"About control statements nesting", Page 4-32.
Processing flow
Control Statement
THEN processing
statement 1 statement 2
IF statement end
Programming example
Programming Script IF (10 <= DM1000) AND (DM1000 <= 50) THEN 'if DM 1000 is more than 10 or
less than 50
FM1000.T = "within the range" 'specifies that the character
string 'is saved to FM 1000.T
END IF 'IF statement end
Operation description If DM1000 value is more than 10 and less than 50, character string "within range" is
stored into FM1000.T.
If the value is out of the range, any operation will be not executed.
Reference The part from (single quote) (or "REM") to the end of line( before line feed input) is
processed as comment. So there is no any influence on actual operation.
For details of comment writing, see "About Comments Function", Page 2-57
Control Statement
4
<Processing statement 1> processing statement 1 will be executed.
ELSE If conditional formula is FALSE,
<Processing statement 2> processing statement 2 will be executed
Control Statement
END IF
Tip
• If the result of conditional formula is bit (return Boolean value) formula, it can be used in any formula.
• Processing statement is a series of programming processing between THEN to END IF, capable of
programming among lines if required.
• IF statement can be nested, so multiple-branch processing can be conducted by programming IF
statement in processing statement and selecting AND condition.
Reference IF statement nesting (program IF statement in IF statement), maximal upto 200 layers.
"About control statements nesting", Page 4-32.
Processing flow
Control Statement
not executed, but processing statement 2
statement 1 statement 2
below ELSE will be executed.
IF statement end
Programming example
Operation description If contact R1000 is ON, COS (DM1100) result will be stored in DM1000.F.
If contact R1000 is not ON (OFF), and contact R0002 is ON, return value of SIN
(DM1100) will be stored in DM1000.F.
If R1000 is not ON (OFF), and R0002 is also not ON (OFF), BMOV function will be used
to transfer 10 word data of DM5000 to DM5500.
"SIN", Page 7-140
"COS", Page 7-142
"BMOV", Page 7-2
Control Statement
ELSE IF <Conditional formula 2> THEN If conditional formula 1.2 is FALSE, conditional formula 3 is TRUE,
*2
ELSE *1
If all conditional formula are FALSE,
<Processing statement n> *1 processing statement n will be executed.
END IF IF statement ends here.
ELSE IF R1002 THEN 'If R1000, R1001 are not ON, R1002 is ON,
ELSE IF R1003 THEN 'If R1000, R1001, R1002 are not ON, R1003 is ON,
ELSE IF R1004 THEN 'If R1000, R1001, R1002, R1003 are not ON, R1004 is ON,
ELSE 'If R1000, R1001, R1002, R1003, R1004 are not ON,
END IF
Tip
• If the result of conditional formula is bit ( return Boolean value) formula, it can be used in any formula.
• Processing statement is a series of programming processing between control statements, capable of
programming among lines if required.
• ELSE IF statement is different from IF statement, multiple lines are programmable, but it is not a
nesting structure.
Processing flow
4
equation 2 (5)
(When conditional (TRUE or FALSE)
equation 1 is TRUE) FALSE
(4) When condition is FALSE
(When conditional
TRUE
Control Statement
Conditional equation 3 is FALSE)
THEN processing equation 3
When condition is TRUE (TRUE or FALSE)
(7)
statement 1 (When conditional FALSE
equation 2 is TRUE) (6)
TRUE When condition is TRUE
THEN processing (When conditional
equation 3 is TRUE)
statement 2
THEN processing
statement 3
IF statement end
(2) If conditional formula is "TRUE", processing statement 1 below THEN will be executed, and jump to
END IF( middle formula will be not executed).
(3) If conditional formula is "FALSE", "TRUE" or "FALSE" will be identified with conditional formula 2.
(4) If conditional formula 2 is "TRUE", processing statement 2 will be executed, and jump to END IF
(middle formula is not executed).
(5) If conditional formula 2 is "FALSE", "TRUE" or "FALSE" will be identified with conditional formula 3.
(6) If conditional formula 3 is "TRUE", processing statement will be executed, and jump to END IF
(middle formula is not executed).
(7) If conditional formula 3 is "FALSE", "TRUE" or "FALSE" will be identified with conditional formula,
and the like.
Control Statement
help_topic_start
SELECT CASE ~
Basic format Format description
SELECT CASE Word device According to the value of word device, conditional branch
4 CASE Constant 1 *3
Processing statement 1
If constant 1 and word device value are same,
processing statement 1 will be performed.
CASE
Control Statement
CASE ELSE*1 If constant and word device value are not same,
Processing statement n *1
the processing statement will be performed.
END SELECT
SELECT statement ends here.
*1 Can be omitted.
*2 Up to 200 CASE constants ( ELSE ) can be programed.
*3 A character string, device which handles a character string, or a bit type device cannot be
specified for constant 1.
CASE ELSE 'If DM1000 value is the value other than above,
END SELECT
* The conditional formula using comparison operator can be written into the constant part. In this case,
" IS" is used for comparison.
(example) IS >= 100 ( more than 100), IS < > 30 ( values other than 30)
Processing flow
4
conditional (2) Processing executing processing statement 1, jump
value 1 statement 1 to ENDSELECT.
(3)
Control Statement
When comparison (3) If "conditional value 1 = compare source"
source ≠ conditional is FALSE, transfer to compare the next
value 1 When comparison source conditional value.
equals conditional value 2
CASE
Processing (4) Compare conditional value 2 and
conditional (4)
statement 2 compare source, if "conditional value 2 =
value 2
(5) compare source" is TRUE, processing
When comparison
statement 2 will be executed. Execute
source ≠ conditional processing statement 2, then, jump to
value 2
When comparison source END SELECT.
CASE equals conditional value 3
(5) If "conditional value 2 = compare source"
conditional (6) Processing
is FALSE, transfer to compare the next
value 3 statement 3
conditional value.
(7)
When comparison (6) Compare conditional value 3 and
source ≠ conditional
value 3
compare source, if "conditional value 3 =
compare source" is TRUE, processing
CASE ELSE processing statement 3 will be executed. Execute
statement 4 processing statement 3, then, jump to
END SELECT.
Tip
• The selected constant may be single constant, or multiple specifying and range specifying constants.
Control Statement
4
IF LDP(R000) = ON THEN 'If workpiece drop sensor ( R000) is ON,
DM1000 += 1 'Good counter (DM1000) plus _1
END IF
Control Statement
Defective
discharging
LED column
Sensor for
workpieces fall NG
OK OK OK
100pcs 100pcs 100pcs
Point If the selected constants are multiple, the processing statement written on the
upper line is firstly executed; the processing statement written later will be not
executed.
Programming Script SELECT CASE DM1000 'Set selection reference to DM1000.
Processing statement 1
CASE 3 TO 20 'If DM1000 value is above 3, below 20,
Processing statement 2
CASE IS >= 15 'If DM1000 value is more than 15
4
Control Statement
Processing statement 3
CASE ELSE 'If DM1000 value is the value other than
above,
Processing statement 4
END SELECT
* if the value stored in DM1000 (compare source) is 17, the 2nd CASE and the 3rd
CASE, will be matched. In this case, the 2nd CASE is given the priority for
selection, and processing statement 2 will be executed. After processing
statement is executed, END SELECT is jumped to, and processing statement 3
is not executed.
Control Statement
help_topic_start
MC ~ THEN ~ MCR
Basic format Format description
4
MC <MC Execution condition > THEN If MC execution condition is TRUE,
master control processing will be conducted.
If MC execution condition is OFF, the function between MC to MCR will be executed in OFF status.
For details please refer to "KV-5500/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual", MC, MCR command.
Tip
• If conditional formula result is the bit type (return Boolean value), MC execution condition can be
used in any format.
• Processing statement is a series of programming processing between MC to MCR, which can be
used in programming multiple lines if required.
Processing flow
Control Statement
condition is TRUE) condition is FALSE)
below THEN is set to OFF.
Setup processing
Execute THEN statement as OFF
processing statement then execute
Control Statement
help_topic_start
FOR ~ NEXT
Basic format
1 FOR <Word device>=<Initial value > TO <Final value >[ STEP <incremental value >]*1
4 2 <Processing statement>
3 NEXT
Control Statement
Format description
1 · Determine initialization and termination value of word device limiting the number of loop controls.
Determine how many word device values willbe added to every processing via STEP
(the line is not added)
2 · The processing statement will be executed before word device exceeds final value.
3 · Plus incremental value to word device.
Tip
Multiple elements are programed on the 1st line of format example. It shall be described separately.
Reference According to constant symbol of STEP program, automatically identify "final value" and
"word device final value".
Example)FOR DM1100 = 100 TO 0 STEP - 5
Subtract 5 from 100, the value stored in DM1100 before 0.
Processing flow
(1)
(1) Assign the initial value to word device.
Evaluate default value
to FOR word device (2) Set final value indicating the end of loop
(initialization process) process. Besides, set the increment
value added on the value of word device.
(2)
Setup final and addition
4
(3) Identify whether the value of word device
value (increment value)
of word device is less than final value.
Control Statement
(3) (4) If (3) condition is "TRUE", processing
statement will be executed.
(6)
NEXT
Add increment
to word device
Next
Point If programming single precision floating point type real number on added value
(incremental value), suffix .F shall be added on the specified word device.
Control Statement
In programming of FOR ~ NEXT statement, the incremental value specified by STEP is as follows.
The range that can be specified by STEP : -32767 to 32767 (-32768 cannot be specified)
If the range value is specified, error will occur during script conversion.
4 ● When specifying single precision floating point type constant with STEP
Control Statement
The constant with decimal point can be specified with incremental value specified by STEP, but, shall
be noted.
The constant with decimal point is automatically converted to single precision floating point type real
number. In this case, some error will occur, error will also occur in loop index sometimes.
Programming example
Programming Script FOR DM1000 = 0 TO 1000 STEP 10 'Before DM1000 value exceeds 1000
'loop
DM2000 += 9 'DM2000 value plus 9 every time
Point A script should be programmed in the loop control statement to end loop process.
If the loop processing is not stopped, this then becomes "infinite loop" (permanent
loop processing) and scanning timeout occurs during program execution (infinite
loop is not detected as error during conversion).
"Loop control statement and processing time", Page 4-35
Reference Up to 100 layers are available for nesting of FOR ~ NEXT statement.
"About control statements nesting", Page 4-32
help_topic_start
Control Statement
This is a line feed symbol.
*2 If DM1000 value is above 100, the processing statement will be not executed, will be executed
from the next line of END WHILE.
Tip
• If the result of conditional formula is bit (return Boolean value) formula, it can be used in any formula.
• Processing statement is a series of programming processing between WHILE ~ END WHILE,
capable of programming among lines if required.
Reference In loop control statement of WHILE statement/DO ~ UNTIL statement, maximal 199 layers
are programmable for nesting of combination composition.
Combination and nesting via master control and IF statement can be also conducted.
"About control statements nesting", Page 4-32
Control Statement
Processing flow
is false (when execution is true (when execution (3) If conditional formula is "FALSE" END
Control Statement
condition is FALSE) condition is TRUE) WHILE statement will enter the next step.
Execute processing
statement
END WHILE
Next
Programming example
Programming Script From loop control statement, exit via BREAK statement
WHILE R1000 = OFF 'During R1000 is OFF (condition is on
'TRUE), loop
IF (DM2000 MOD 8) = 0 THEN 'If DM2000 becomes a multiple of 8, then
ELSE IF DM2000 > 100 THEN 'If DM2000 value exceeds 100
Point A script should be programmed in the loop control statement to end loop control.
If the loop processing is not stopped, this then becomes "infinite loop" (permanent
loop processing) and scanning timeout occurs during program execution (infinite
loop is not detected as error during conversion).
For details, see "Loop control statement and processing time", Page 4-35.
help_topic_start
DO ~ UNTIL
Basic format Format description
DO Perform loop control
<Processing statement> Perform Processing statement
UNTIL <conditional formula> If conditional formula is FALSE, return to statement
start (DO).*1
4
Control Statement
* Insert a single-byte space.
This is a line feed symbol.
UNTIL DM1000 >= 100 If DM1000 value is not above 100, return to sentence leading (DO).*2
*2 If DM1000 value is above 100, processing statement will be not executed, the execution will start
from the next line of UNTIL.
Tip
• If the result of conditional formula is bit (return Boolean value) formula, it can be used in any formula.
• Processing statement is a series of programming processing between DO ~ UNTIL, capable of
programming among lines if required.
• As the action (loop process) control statement identical to DO ~ UNTIL statement, can use WHILE
statement.
• DO ~ UNTIL statement is firstly processed, then conditional formula identified. loop identification
condition FALSE .
For details, see "WHILE Statement (pre-judge loop control)", Page 4-27.
Point In loop control statement of WHILE statement/DO ~ UNTIL statement, maximal 199
layers are programmable for nesting of combination composition.
Combination and nesting via master control and IF statement can be also
conducted.
For details, see "About control statements nesting", Page 4-32.
Control Statement
Processing flow
(1)
(1) Execute processing statement.
Execute processing
statement
(2) Identify "TRUE" or "FALSE" via DO execu-
(2) tion condition, determine DO to UNTIL
processing method.
4
TRUE DO execution
condition (TRUE or FALSE) (3) If conditional formula is "FALSE", return to
(1) (DO ~ UNTIL statement leading).
Control Statement
(3)
FALSE (4) If conditional formula is "TRUE", will enter
When execution condition
next step.
When execution condition
is TRUE (when execution is FALSE (when execution
condition is TRUE) condition is FALSE)
Next
Point A script should be programmed in the loop control statement to end loop control.
If the loop processing is not stopped, this then becomes "infinite loop" (permanent
loop processing) and scanning timeout occurs during program execution (infinite
loop is not detected as error during conversion).
"Loop control statement and processing time", Page 4-35
help_topic_start
BREAK Processing
It is used in force termination of loop control (exit from loop).
BREAK
Basic format Format description
<loop control statement start> Program in loop process *1
Control Statement
*1 BREAK must be programmed in loop process statement.
* Except FOR ~ NEXT, loop process statement can be also used in WHILE statement, DO ~ UNTIL
statement.
Programming example
When BREAK statement is programmed in the nested loop control statement, the loop control
statement with BREAK programming is only terminated.
BREAK
END IF
NEXT 'When Break execute,
'FOR statement (3) End.
NEXT
NEXT
Operation description FOR statement (3) contains control statement of BREAK statement, so, only FOR
statement (3) is terminated during execution of BREAK.
"Precautions on Using Control Statement", Page 4-32.
Control Statement
statement (2) is nested in FOR statement (1), and then 3 layers of FOR statement (3) are nested in it.
FOR <value of word device (1)> TO <end value> FOR statement (1) ǂǂ
Processing statement
ǂǂǂǂFOR <value of word device (2)> TO <end value> FOR statement (2)
ǂǂǂǂǂProcessing statement
1 layer
2 layer
ǂǂǂǂǂ FOR <value of word device (3)> TO <end value> FOR statement (3)
3 layer
ǂǂǂǂǂǂProcessing statement
ǂǂǂǂǂ NEXT
ǂǂǂNEXT
NEXT
Point Programming cannot be made under the following loop control statement or
conditional branch or loop control statement and conditional branch statement
cross.
[[FOR statement (loop control statement) and WHILE statement (loop control
statement) cross]
FOR <value of word device (1)> TO <end value> 'Control statement (1)
ǂǂProcessing statement (1)
ǂǂFOR <value of word device (2)> TO <end value>
ǂǂǂǂǂProcessing statement (2)
'Control statement (2)
4
Control Statement
ǂǂǂǂǂWHILE <condition equation > 'Control statement (3)
ǂǂǂ Processing statement (3)
ǂǂNEXT
ǂǂǂǂǂEND WHILE
NEXT
FOR <value of word device (1)> TO <end value> 'Control statement (1)
ǂǂǂProcessing statement (1)
ǂǂǂFOR <value of word device (2)> TO <end value> 'Control statement (2)
ǂǂǂǂǂǂProcessing statement (2)
ǂǂǂǂǂǂIF <conditional equation> THEN 'Conditional branch statement
ǂǂǂǂǂǂǂProcessing statement (3)
ǂǂǂNEXT
ǂǂǂǂǂǂEND IF
NEXT
Control Statement
Example The 3-layer nesting using loop control statement (FOR statement, WHILE statement, do
statement) is produced to calculate the number of actual processing.
When executing the program, 10 FOR loop s x 10 WHILE loop s x 10 DO loops take place,
execute 1000 times of the most deep nesting processing.
Control Statement
DM1002.D = 0
WHILE DM1000.D < 200000 '(1) to (2) processing shall be repeat
'for 200,000 times.
In this case, there is no problem for 1 loop processing whereas for 200,000 times of loop processing,
the total processing time is within allowed scanning time (over 300ms for KV-7500/7300/5500/5000/
3000/1000).
If the program is used in KV script, easy programming can be enabled by using smaller programs to
program a complicated procedure and loop process. However, attention should be paid to the scanning
time.
Control Statement
When the processing time of loop control statement is long (complicated operation processing and
macro processing), scanning timeout will still occur, even if the number of loops is small.
To avoid scanning timeout, changes should be made to the program in order to execute several
scanning ( or scanning every time) processes.
Operation description If R1004 is OFF, 0 is then stored in DM1000.D and DM1002.D (initialize) to set up R1004.
If R1004 is ON and DM1000.D is less than 200,000, 1 is then added to the current value of
DM1000.D, and the value from 1 to 200,000 is added in turn, and stored to DM1002.D
(operation is executed in each time scanning).
Control Statement
Infinite loop
Programming Script WHILE MR1000 = OFF If MR1000 is ON, loop process will be ended
DM1001 += 1
DM1000 = DM1000 + DM1001
IF DM1000 > 1000 THEN
Add end condition of repeat control
BREAK statement.
END IF Execute BREAK after DM1000 changed to
1000 above, end repeat control.
END WHILE
"BREAK Processing", Page 4-31
Reference You can program the BREAK statement for force termination of a loop control.
Alternatively, you can program MR1000 = ON to terminate the program. From the
perspective of "improved program readability, it is recommended that the BREAK
statement used in terminating a loop control.
Programming Script
4
CR2008
MR1000 = ON
Ladder development
CR2008 NCJ
#1000
ON 1 scan at operation start
CR2002 MR1000
Always ON
LABEL
#1000
[Area Script]
Programming Script
MR1000 = ON
+
Ladder development
CR2002 MR1000
The MR1000=ON programed with KV script is converted to the OUT command taking normal ON
(CR2002) as execution condition. So the script should be executed. After this, MR1000 is ON.
Reference When clearing the value of bit device and word device, RES function can be reset, or
select [Debug (D)] → [All Clear Device (L)] from the menu.
Execution timing
Scan
Script execute ON
OFF
ON
OUT command
Bit device for holding output
OFF
How to use
Since "MR1000 = ON" is ON, then it should be turned to OFF by executing "MR1000 = OFF" or RES
(MR1000).
4
Programming Script
IF R2000 = ON THEN
MR1000 = ON
+ ELSE
MR1000 = OFF
END IF
LD NCJ
R2000
#2000
CR2002 MR1000
Always ON
CR2002 CJ
#2001
Always ON
LABEL
#2000
CR2003 MR1000
Always OFF
LABEL
#2001
Reference To use script to control the bit device, instead of use assignment statement, the SET/RES
function should be used.
Programming Script DM1000.D = T0.D 'Store the current value of timer T0 to DM1000.D.
DM1002.D = C5.D 'Store the current value of counter C5 to DM1002.D.
T0.D = DM1100.D 'Replace the current value of timer T0 with the value
'stored in DM1100.D.
C5.D = DM1102.D 'Replace the current value of counter C5 with the value
'stored in DM1102.D.
LD
CR2002 MOV.D
T0000 DM01000
Always ON
Store device
CR2002 MOV.D
C0005 DM01002
Always ON
Store device
CR2002 MOV.D
DM01100 T0000
Always ON
CR2002 MOV.D
DM01102 C0005
Always ON
LD
T100 MR1000
4
SET
Operation description Timer device T100 enables T100 contact ON 5 seconds after programmed start.
Only when RES (T100), or PLC power OFF or "RUN PROG" conversion is converted,
the contact can be cleared.)
LD Notice
MR2000 NCJ
#2000 If condition execution of statement is
#500
FALSE, statement processed via N CJ
MR1000
T101 command is jumped.In this case, keep the
status of every contact(the status before N
LABEL
#2000
CJ jump), when execution condition of
timer function is ON, timer is not reset.
The timer continues action before reset, processing statement jumps with N CJ command,
so, even if timeout, timer contact changes to ON in PLC, will not output. In such status,
when execution condition of IF statement is TRUE, processing statement is executed, so,
any action without timer function, timer contact ON, output.
Operation description
(1) (3)
No scan processing
ON
Execution condition statement of IF statement
for IF statement
(MR 2000) OFF (2)
Perform condition ON
for timer function
(MR1000) OFF
(5)
ON
Status for
timer contact (T101)
OFF
(4)
(timeup)
0
Restart IF statement
(1) When execution condition of IF statement (MR2000) is ON, and when execution
condition of timer (MR1000) is ON, timer T101 acts. timer contact T101 changes to
ON 5 seconds after action starts.
(2) When execution condition of IF statement( MR2000) changes to ON, and execution
condition of timer( MR1000) changes to OFF, the timer is reset.
(3) Timer action is unrelated to execution condition of timer before timeout, when
execution condition of IF statement changes to OFF, processing statement( timer
function) of IF statement is not scaned. In this case,, timer function seems in pause
mode, but actually in continual action( due to no reset input).
(4) But after timeout, processing statement will be not scaned. So in stead of output,
timer contact will be in standby status.
(5) During scan when execution condition of next IF statement is TRUE, timer contact
changes to ON without timer action.
END IF
CR2002 CJ
#2001
Always ON
LABEL
#2000
CR2002 T101
RES
Always ON
LABEL
#2001
Operation description When execution condition (MR2000) of IF statement is ON, and when execution condition
of timer (MR1000) is ON, timer T101 acts.
Timer contact T101 changes to ON 5 seconds after action starts.
When execution condition (MR2000) of IF statement changes to OFF, reset timer device
(T101).
*1 When programming area script including timer function between CJ-LABEL command, or
programming in sub-program, timer function may fail to normal working, this fails to be avoided
using above method.
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual.
MR1000 #500
T101
LABEL
#1001
ON
Status for timer
contact (T101)
OFF
4 (4)
(timeup)
Precautions on Script Programming
0
Restart IF statement
(1) When execution condition of Box Script (MR2000) is ON, and when execution condition
of timer (MR1000) is ON, timer T101 acts. timer contact T101 changes to ON 5 seconds
after action starts.
(2) When execution condition of Box Script (MR2000) changes to ON, and execution condi-
tion of timer (MR1000) changes to OFF, and the timer is reset.
(3) Timer action is unrelated to execution condition of timer before timeout, when execution
condition of Box Script changes to OFF, processing statement( timer function) of Box
Script is not scaned. In this case, the timer function contines to work, although it seems
that it is paused (cause no reset input).
(4) But after setup timeout, processing statement will be not scaned, so, timer contact will
be not output, and in standby status.
(5) During scan when execution condition of next Box Script is TRUE, timer contact
changes to ON without timer action.
Precautions When execution condition of Box Script is OFF, resetting timer function contained in Box
Script can avoid this problem.
Script programming change as follows.*1
Operation description Reset timer device via contact B of execution condition of Box Script.
*1 When programming area script including timer function between CJ- LABEL, or programming in
sub-routine, timer function may not work, and the above measures also do not work.
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual.
Ladder development
Timer/Counter stop (clear) when execution condition is false
MR1000 MC
4
MCR
MEMO
4
Precautions on Script Programming
LDPxxx
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
LDP
Load pulse
*1
Return value = LDP (Rising edge detection device)
Recognized Type Const
BASIC FUNCTIONS
Argument/Return
Explanation Device Formula
Value .U .S .D .L .F .DF *3*4
.B .T #/$
S Rising edge
Specifies the device No. whose rising
detection - - - - - - .B - -
*2 edge is to be detected.
device
R Return value Specifies the device No. to be activated. - - - - - - .B - - -
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
5 *2 When a word device has been specified to the rising edge detection device, the state of the LSB
is detected.
Contact Function
*3 Direct I/O Relays (DR) can be specified when KV-7500/7300/5500/5000/3000 or KV Nano Series
is used.
*4 Devices for bit position of word device can be specified when KV-7500/7300/5500/5000/3000 or
KV Nano Series is used.
Description of Operation
When the rising edge (OFF -> ON) of S is detected, the device specified by R is turned ON
for one scan.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Contact Instructions".
● Example of format
MR2000 = LDP (MR1000)
MR1000 MR2000
↑
Device for rising Return value
edge inspection
Point Attention is required when using this function in box scripts or IF statements.
"Precautions When Using Box Script", Page 2-13
BASIC FUNCTIONS
Programmed Script
Operation Description MR2000 is turned ON for one scan only when the total of DM1000 and DM1001 is 1000
or more (the operation result is FALSE->TRUE).
Operation Description The content of ten words starting from DM1000 is block-moved to ten words starting from
DM2000 only at the scan where the rising edge (OFF->ON) of R3000 is detected.
Contact Function
Ladder conversion R3000 BMOV
↑ DM1000 DM2000 #10
Device for rising
edge inspection Conversion Conversion
source device destination device
Reference Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"BMOV Function"
The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, .
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
5 *2 When a word device has been specified to the falling edge detection device, the state of the
LSB is detected.
*3 Direct I/O Relays (DR) can be specified when KV-7500/7300/5500/5000/3000 or KV Nano Series
Contact Function
is used.
*4 Devices for bit position of word device can be specified when KV-7500/7300/5500/5000/3000 or
KV Nano Series is used.
Description of Operation
When the falling edge (ON-> OFF) of S is detected, the device specified by R is turned ON
for one scan.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Contact Instructions."
● Example of format
MR2000 = LDF (MR1000)
MR1000 MR2000
↓
Device for falling Return value
edge inspection
Point Attention is required when using this function in box scripts or IF statements.
"Precautions When Using Box Script", Page 2-13
BASIC FUNCTIONS
Programmed Script
Operation Description MR2000 is turned ON for one scan only when the total of DM1000 and DM1001 is 1000
or more (the operation result is TRUE-> FALSE).
Contact Function
Ladder conversion
R3000 BMOV
↓ DM1000 DM2000 #10
Device for falling
edge inspection Move Move
source device destination device
Reference Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"BMOV Function"
The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
*1 The return value can be omitted. When omitted, the operation result is stored in a work relay.
5 *2 When a word device has been specified to the rising edge detection device, the status of the
lowest bit is detected.
*3 Setable between direct I/O Relays (DR).
Contact Function
Point The KV-1000 series does not support the LDPB function.
Description of Operation
When the rising edge (OFF -> ON) of S is detected, the device specified by R is turned OFF
for one scan.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Contact Instructions."
● Example of format
MR2000 = LDPB (MR1000)
MR1000 MR2000
↑
Device for rising Return value
edge inspection
Point Attention is required when using this function in box scripts or IF statements.
"Precautions When Using Box Script", Page 2-13
BASIC FUNCTIONS
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F *3*4
.B .T #/$
S Falling edge
Specifies the device No. whose falling
detection
edge is to be detected.
- - - - - .B - -
*2
device
R Return value Specifies the device No. to be activated. - - - - - .B - - -
*1 The return value can be omitted. When omitted, the operation result is stored in a work relay.
*2 When a word device has been specified to the falling edge detection device, the state of the
5
LSB is detected.
Contact Function
*3 Direct I/O Relays (DR) can be specified.
*4 Bit position devices can be specified as word device.
Point The KV-1000 series does not support the LDFB function.
Description of Operation
When the falling edge (ON-> OFF) of S is detected, the device specified by R is turned OFF
for one scan.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Contact Instructions."
● Example of format
MR2000 = LDFB (MR1000)
MR1000 MR2000
↓
Device for falling Return value
edge inspection
Point Attention is required when using this function in box scripts or IF statements.
"Precautions When Using Box Script", Page 2-13
Bit load
*1
Return value = BLD (read device, bit position)
Argument/Return Applicable Suffix Const
BASIC FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored to a work device.
5 *2 When a bit device has been specified to S , the relay of the device No. to be calculated by the
value of the [device No. + n ] is specified. Operation is normal even when relays straddle channels.
Bit Contact Function
*3 For the value of the bit position, specify 0 to 15 when the suffix of the read device is .U, and 0 to
31 when the suffix is .D.
*4 Direct I/O Relays (DR) can be specified when KV-7500/7300/5500/5000/3000 or KV Nano Series
is used.
*5 Devices for bit position of word device can be specified when KV-7500/7300/5500/5000/3000 or
KV Nano Series is used.
Description of Operation
The ON/OFF state of Bit n of S is transferred to R .
bit S bit
15 0
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
ON
n bit of S
OFF
ON
BLD function
OFF
● Example of format
R1000 = BLD (DM1000, 10)
DM1000 R1000
B
#10 Return value
Read device
BASIC FUNCTIONS
When the suffix of S is .D: The values of lower 5 bits of n are used.
Sample Program
● When specifying bit device
Programmed Script
Operation Description
R1000 = BLD (MR2009.U, 10)
R1000 is turned ON when bit 10 (MR2103) of MR2009.U is ON.
5
Reference Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TMR function"
The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
*1 The return value can be omitted. When omitted, the operation result is stored to a work device.
5 *2 When a bit device has been specified to S , the relay of the device No. to be calculated by the
value of the [device No. + n ] is specified. Operation is normal even when relays straddle channels.
Bit Contact Function
*3 For the value of the bit position, specify 0 to 15 when the suffix of the read device is .U, and 0 to
31 when the suffix is .D.
*4 Direct I/O Relays (DR) can be specified when PCL KV-7500/7300/5500/5000/3000 or KV Nano
Series is used.
*5 Devices for bit position of word device can be specified when KV-7500/7300/5500/5000/3000 or
KV Nano Series is used.
Description of Operation
The ON/OFF state of Bit n of S is invert-transferred to R .
bit S bit
15 0
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
ON
n bit of S
OFF
ON
BLDB function
OFF
● Example of format
R1000 = BLDB (DM1000, 10)
DM1000 R1000
B
#10 Return value
Read device
BASIC FUNCTIONS
When the suffix of S is .D: The values of lower 5 bits of n are used.
Sample Program
● When specifying a bit to a read device
Programmed Script
Operation Description
R1000 = BLDB (MR2009.U, 10)
R1000 is turned ON when bit 10 (MR2103) of MR2009.U is OFF.
5
Reference Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TMR function"
The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Set
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
5 *2 Direct I/O Relays (DR) can be specified when PCL KV-7500/7300/5500/5000/3000 or KV Nano
Series is used.
Output Function
*3 Devices for bit position of word device can be specified when KV-7500/7300/5500/5000/3000 or
KV Nano Series is used.
Description of Operation
When the execution condition is TRUE, D is turned ON. Once the destination device is turned ON,
it is held in the ON state even if the execution condition becomes FALSE. (Devices in ON state are
turned OFF by the SET function.)
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-5500/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Output Instructions."
"RES function"
● Example of format
SET (R3000, MR1000)
R3000 MR1000
SET
Execution condition Destination device
Sample Program
● When specifying a word device to the destination device
Programmed Script SET (MR1000, DM2000.B)
Operation Description When MR1000 is ON, the LSB of DM2000 is turned ON and held in this state.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Reset
BASIC FUNCTIONS
Formula
Explanation Device
Value .U .S .D .L .F .DF .B*2*3 .T #/$
D destination Specifies the device No. of the
device destination device to turn OFF.
- - - - - - .B - - -
R Return value No - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
*2 Direct I/O Relays (DR) can be specified when KV-7500/7300/5500/5000/3000 or KV Nano Series
is used.
5
Output Function
*3 Devices for bit position of word device can be specified when KV-7500/7300/5500/5000/3000 or
KV Nano Series is used.
Description of Operation
When the execution condition is TRUE, D is turned OFF. (Devices that were turned ON by the SET
function are turned OFF by the RES function.)
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Output Instructions."
"SET function"
● Example of format
RES (R3000, MR1000)
R3000 MR1000
RES
Execution condition Destination device
Sample Program
● When specifying a word device to the destination device
Programmed Script RES (MR1001, DM2000.B)
Operation Description When MR1001 is ON, the LSB of DM2000 is set to OFF.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Bit output
*1 "[ ]" can be omitted. (When the execution condition has been omitted, CR2002 (always ON) is
5 *2
specified.)
When a bit device has been specified by D , the relay of the device No. to be calculated by
the value of the [device No.+ ] is specified. Operation is normal even when relays straddle
Bit output Function
channels.
*3 For the value of the bit position, specify 0 to 15 when the suffix of the destination device is .U,
and 0 to 31 when the suffix is .D.
Description of Operation
When the execution condition is TRUE, Bit n of D is turned ON, and when the execution
condition is FALSE, it is turned OFF.
bit
15
D bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
● Example of format
• D : 16-bit instruction
BOUT (MR1000, DM2000, 12)
MR1000 DM2000
B
Execution condition #12
Target device
• D : 32-bit instruction
BOUT (MR1000 = OFF, DM2100.D, 28)
MR1000 DM2100
B.D
Execution condition #28
Target device
BASIC FUNCTIONS
When the suffix of D is .D: The values of the lower 5 bits of n
D are used.
Sample Program
● When specifying a bit device to the destination device
Programmed Script
Operation Description
BOUT (DM1000 <= 100, MR2002.U, 14)
When DM1000 is 100 or less, bit 14 (MR2100) of MR2002.U is turned ON, and when
5
DM1000 is greater than 100, bit 14 is turned OFF.
*1 "[ ]" can be omitted. (When the execution condition has been omitted, CR2002 (always ON) is
5 *2
specified.)
When a bit device has been specified by D , the relay of the device No. to be calculated by
the value of the [device No.+ ] is specified. Operation is normal even when relays straddle
Bit output Function
channels.
*3 For the value of the bit position, specify 0 to 15 when the suffix of the destination device is .U,
and 0 to 31 when the suffix is .D.
Description of Operation
When the execution condition is TRUE, Bit n of D is turned OFF, and when the execution
condition is FALSE, it is turned ON.
bit
15
D bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
● Example of format
• D : 16-bit instruction
BOUB (MR1000, DM2000, 12)
MR1000 DM2000
B
Execution condition #12
Destination device
• D : 32-bit instruction
BOUB (MR1100 = OFF, DM2100.D, 28)
MR1100 DM2100
B.D
Execution condition #28
Destination device
BASIC FUNCTIONS
When the suffix of D is .D: The values of the lower 5 bits of n are used.
Sample Program
● When specifying a bit device to the destination device
Programmed Script
Operation Description
BOUB (DM1000 <= 100, MR2002.U, 14)
When DM1000 is 100 or less, bit 14 (MR2100) of MR2002.U is turned OFF, and when
5
DM1000 is greater than 100, bit 14 is turned ON.
Bit set
*1 "[ ]" can be omitted. (When the execution condition has been omitted, CR2002 (always ON) is
5 specified.)
*2 When a bit device has been specified by D , the relay of the device No. to be calculated by
Bit output Function
the value of the [device No.+ n ] is specified. Operation is normal even when relays straddle
channels.
*3 For the value of the bit position, specify 0 to 15 when the suffix of the destination device is .U,
and 0 to 31 when the suffix is .D.
Description of Operation
When the execution condition is TRUE, Bit n of D is turned ON. Once the destination device
is turned ON, it is held in the ON state even if the execution condition becomes FALSE. (Devices in ON
state are turned OFF by the BRES function.)
bit
15
D bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
● Example of format
• D : 16-bit instruction
BSET (R1000, DM1000, 10)
R1000 DM1000
BSET
Execution condition #10
Destination device
BASIC FUNCTIONS
Execution condition
Destination device
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Bit reset
*1 "[ ]" can be omitted. (When the execution condition has been omitted, CR2002 (always ON) is
5 *2
specified.)
When a bit device has been specified by D , the relay of the device No. to be calculated by
Bit output Function
the value of the [device No.+ n ] is specified. Operation is normal even when relays straddle
channels.
*3 For the value of the bit position, specify 0 to 15 when the suffix of the destination device is .U,
and 0 to 31 when the suffix is .D.
Description of Operation
When the execution condition is TRUE, Bit n of D is turned OFF.
bit
15
D bit
0
bit
31
D +1 bit
16
bit
15
D bit
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
● Example of format
• D :16-bit instruction
BRES (MR1000, DM2000, 5)
MR1000 DM2000
BRES
Execution condition #5
Destination device
• D : 32-bit instruction
BRES (MR1100 = OFF, DM2100.D, 30)
MR1100 DM2100
BRES.D
Execution condition #30
Destination device
BASIC FUNCTIONS
When the suffix of D is .D: The values of the lower 5 bits of n are used.
Sample Program
● When specifying a bit device to the destination device
Programmed Script
Operation Description
BRES (DM1000 >= 100, MR2008.U, 10)
When DM1000 is 100 or more, bit 10 (MR2102) of MR2008.U is turned OFF.
5
Timer
Argument/Return
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
D Timer Specifies the device No. of the timer.(T0 to
*3 - - - - - - - - - - -
device T3999 )
S Timer Specifies the setting value of the timer in
setting value
*2
100 ms units.(0 to 4294967295)
.D .D .D .D - - - -
R Return value No - - - - - - - - - - -
*1 "[ ]" can be omitted. The execution condition can also be used as a reset. (When the execution
5 condition is OFF, the TMR function is reset.)
When the execution condition is omitted, use the RES function separately to reset the timer.
Timer/counter Function
*2 When a bit device has been specified to the timer setting value, continuous 32 bits are
occupied, and when a word device has been specified, continuous two words are occupied.
*3 For the KV Nano Series, device numbers T0 to T511 can be specified.
Description of Operation
When the execution condition is TRUE, the timer specified by D is ON. S becomes the
current value, and is decremented by 1 every 100 ms. When the current value becomes "0", the
specified timer device (contact) turns ON. When the execution condition is FALSE, the specified timer
is turned OFF and the current value is reset.
Scan
ON
Execution
condition OFF
Value set in S
Current value
#00000
ON
Timerǂ T D
Reference The error of the TMR instruction is "within ± (100 ms + 1 scan time)."
BASIC FUNCTIONS
function (instruction), OUTC, UDC, and UDT instructions can be used.
• Operation formulas can also be specified to setting values. Attention is required in the
following instances as the range in which operation formulas can be handled is -
2147483648 to +2147483647.
• Operation formulas can also be specified to setting values. When the result of the
operation formula is a minus value, the value obtained by adding 4294967295 to the
result of the operation formula is set as the setting value.
• Attention is required when using this function in box scripts and programming this
5
Timer/counter Function
function in sub-routines.
"Precautions About Use of Timer Device/ Counter Device", Page 4-40
Point • When the current value is greater than the setting value when the current value is
rewritten, the current value is changed to the same value as the setting value.
• As unsigned 32-bit data is used for the counter setting value and current value of the
TMR function, unsigned 32-bit (.D) must be used for the devices to store the current
value and setting value and the data to change.
• To change the timer setting value or to read the setting value, specify a device
(unsigned 32- bit) to the setting value.
KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual,
"Timer/Counter Instructions"
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
5
Timer/counter Function
BASIC FUNCTIONS
5
Timer/counter Function
High-speed timer
*1 • "[ ]" can be omitted. The execution condition can also be used as a reset. (When the execution
5 condition is OFF, the TMH function is reset.)
• When the execution condition is omitted, use the RES function separately to reset the timer.
Timer/counter Function
*2 When a bit device has been specified to the timer setting value, continuous 32 bits are
occupied, and when a word device has been specified, continuous two words are occupied.
*3 For the KV Nano Series, device numbers T0 to T511 can be specified.
Description of Operation
When the execution condition is TRUE, the timer specified by n is ON. S becomes the
current value, and is decremented by 1 every 10 ms.When the current value becomes "0", the
specified timer device (contact) turns ON. When the execution condition is FALSE, the specified timer
is turned OFF and the current value is reset.
Scan
ON
Execution
condition OFF
Value set in S
Current value
#00000
ON
Timer T
H D
Reference The error of the TMR instruction is "within ± (10 ms + 1 scan time)."
BASIC FUNCTIONS
function (instruction), OUTC, UDC, and UDT instructions can be used.
• Operation formulas can also be specified to setting values. Attention is required
in the following instances as the range in which operation formulas can be handled is
-2147483648 to +2147483647:
• Operation formulas can also be specified to setting values. When the result of the
operation formula is a minus value, the value obtained by adding 4294967295 to
the result of the operation formula is set as the setting value.
• Attention is required when using this function in box scripts and programming this
5
function in sub-routines.
Timer/counter Function
"Precautions About Use of Timer Device/ Counter Device", Page 4-40
"TMR function"
Sample Program
● When using operation formulas for the setting value
Programmed Script TMH (R1000, T150, DM1000 + 100)
Operation Description High-speed timer T150 is activated for the duration that the execution condition R1000 is
TRUE. When the execution condition is FALSE, the timer is stopped and the current value
is reset.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Argument/Return
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
D Timer Specifies the device No. of the timer.(T0 to
*3 - - - - - - - - - - -
device T3999 )
S Timer Specifies the setting value of the timer in
setting value
*2
1ms units. (0 to 4294967295)
.D .D .D .D - - - -
R Return value No - - - - - - - - - - -
*1 • "[ ]" can be omitted. The execution condition can also be used as a reset. (When the execution
5 condition is OFF, the TMS function is reset.)
• When the execution condition is omitted, use the RES function separately to reset the timer.
Timer/counter Function
*2 When a bit device has been specified to the timer setting value, continuous 32 bits are
occupied, and when a word device has been specified, continuous two words are occupied.
*3 For the KV Nano Series, device numbers T0 to T511 can be specified.
Description of Operation
When the execution condition is TRUE, the timer specified by D is ON. S becomes the
current value, and is decremented by 1 every 1ms. When the current value becomes "0", the specified
timer device (contact) turns ON. When the execution condition is FALSE, the specified timer is turned
OFF and the current value is reset.
Scan
ON
Execution
condition OFF
Value set in S
Current value
#00000
ON
Timer T
S D
BASIC FUNCTIONS
function (instruction), OUTC, UDC, and UDT instructions can be used.
• Operation formulas can also be specified to setting values. Attention is required
in the following instances as the range in which operation formulas can be handled is
-2147483648 to +2147483647:
• Operation formulas can also be specified to setting values. When the result of the
operation formula is a minus value, the value obtained by adding 4294967295 to
the result of the operation formula is set as the setting value.
• Attention is required when using this function in box scripts and programming this
5
Timer/counter Function
function in sub-routines.
"Precautions About Use of Timer Device/ Counter Device", Page 4-40
*1 • "[ ]" can be omitted. The execution condition can also be used as a reset. (When the execution
5 condition is OFF, the TMU function is reset.)
• When the execution condition is omitted, use the RES function separately to reset the timer.
Timer/counter Function
*2 When a bit device has been specified to the timer setting value, continuous 32 bits are
occupied, and when a word device has been specified, continuous two words are occupied.
*3 For the KV Nano Series, device numbers T0 to T511 can be specified.
Point The TMU function can only be used with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution condition is TRUE, the timer specified by D is ON. S becomes the
current value, and is decremented by 1 every 10μs. When the current value becomes "0", the specified
timer device (contact) turns ON. When the execution condition is FALSE, the specified timer is turned
OFF and the current value is reset.
Scan
ON
Execution
condition OFF
Value set in S
Current value
#00000
ON
Timer T
U D
Point • When using KV-5500/5000/3000, the device No. identical with other TMR, TMH, TMS,
TMU function (instruction), UDT instructions cannot be used.
BASIC FUNCTIONS
• Operation formulas can also be specified to setting values. Attention is required
in the following instances as the range in which operation formulas can be handled is
-2147483648 to +2147483647:
• Operation formulas can also be specified to setting values. When the result of the
operation formula is a minus value, the value obtained by adding 4294967295 to
the result of the operation formula is set as the setting value.
• Attention is required when using this function in box scripts and programming this
function in sub-routines.
5
"Precautions About Use of Timer Device/ Counter Device", Page 4-40
Timer/counter Function
"TMR function" (Page 5-22)
Counter
CNT ([Counter execution condition,] *1 counter device, counter setting value, input device )
Argument/Return Applicable Suffix Const
BASIC FUNCTIONS
5 R Return value No - - - - - - - - - - -
*1 "[ ]" can be omitted. The execution condition can also be used as a reset. (When the execution
Timer/counter Function
Description of Operation
When the execution condition TRUE, the timer specified by n is ON. S becomes the current
value, and is decremented by 1 every 1 ms. When the current value becomes "0", the specified timer
device (contact) turns ON. When the execution condition is FALSE, the specified timer is turned OFF
and the current value is reset
ON
R00000 ←Reset input #12 Count input S
C0000 OFF
R00001 ON
Execution
condition OFF
C000
n
S1
11
8 9 10
7
6
4 5
2 3
D :Current value 1
ON
D :counter output contact
BASIC FUNCTIONS
in the following instances as the range in which operation formulas can be handled is
-2147483648 to +2147483647:
• Operation formulas can also be specified to setting values. When the result of the
operation formula is a minus value, the value obtained by adding 4247483648 to
the result of the operation formula is set as the setting value.
Timer/counter Function
Counter devices handle current values by specifying .D (unsigned 32-bit) as their suffix.
● Reading the current value
Specify the counter device to the right side using an assignment statement, and specify the device to
store the current value of the read counter device to the left side.
Point • When the current value is greater than the setting value when the current value is
rewritten, the current value is changed to the same value as the setting value.
• As unsigned 32-bit data is used for the counter setting value and current value of the
CNT function, unsigned 32-bit (.D) must be used for the devices to store the current
value and setting value and the data to change.
• To change the counter setting value or to read the setting value, specify a device
(unsigned 32-bit) to the setting value.
KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual,
"Timer/Counter Instructions"
5 Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Timer/counter Function
BASIC FUNCTIONS
5
Timer/counter Function
Refresh X
*1
RFSX ([Execution condition,] Leading device for changing input, number of relays)
5 *1 " [ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
Direct I/O Function
Description of Operation
In general, this function can be used for executing END instruction in ladder, or when changing batch-
changing input by anything in 1 scan period.
When the execution condition is TRUE, status of inputs of n bit devices starting from D will
be changed.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Direct I/O Instructions".
Point For the KV Nano Series, this function cannot be used with relays assigned to expansion units.
● Example of format
RFSX (MR1000, R3000, 128)
MR1000 RFSX
R3000 #128
Execution condition Input Refresh leading device Number of relay
Refresh Y
RFSY ([Execution condition,] *1 Leading device for changing output, number of relays)
Argument/Return Recognized Type Const
BASIC FUNCTIONS
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
D Leading device
Specifies leading No. of device for changing
for changing
output status
- - - - - - .B - - -
output
n Number of Specifies number of relays for changing
relays output status. (1 to 256)
*2 .U .U .U .U - - - -
R Return value No - - - - - - - - - - -
*1 " [ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed 5
at all times (at every scan)).
Description of Operation
In general, this function can be used for executing END instruction in ladder, or when changing batch-
changing output by anything in 1 scan period.
When the execution condition is TRUE, status of inputs of n bit devices starting from D will
be changed.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Direct I/O Instructions".
Point For the KV Nano Series, this function cannot be used with relays assigned to expansion units.
● Example of format
RFSY (MR1000, R3000, 128)
MR1000 RFSY
R3000 #128
Execution condition
Output Refresh leading device Number of relay
5
Direct I/O Function
Call
6 Description of Operation
Flow Functions
● Example of format
CALL (R3000, 10)
R3000 #10
CALL
Execution condition
Reference The CALL function can be programmed down to a nesting level of 16.
Point • Only constants can be specified as the sub-routine No. Devices or formulas cannot be
used.
• Sub-routine No. constants cannot be specified by $ (HEX).
• The SBN and RET instructions are not available by script functions. Program them in
the ladder.
Program A
BMOV(DM1000,EM2000,20)
CALL(R1000,10)
ZRES(DM1000,DM1200)
Program B
SBN
Program A
ࡊࡠࠣࡓ A #10
BMOV(DM1000,EM2000,20)
CALL(R1000,10) Subroutine
ZRES(DM1000,DM1200)
RET
Program B
ࡊࡠࠣࡓ B
APPLICATION FUNCTION
BMOV(DM1000,EM2000,20)
a nesting level of 16. CALL(R1000,10)
ZRES(DM1000,DM1200)
• To call a different sub-routine from inside a
Program A
subroutine, the sub-routine to be called must
END
already be defined (programmed in the above rung).
SBN
#20
Subroutine A
RET
SBN
Call 6
#10
Flow Functions
Subroutine B
BMOV(DM1200,EM2100,20)
CALL(R1100,20)
ZRES(DM1100,DM1300)
RET
ENDH
Ecall
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
*2 Enter the macro name set on KV STUDIO enclosed by " ".
6 *3 Specify sub-routine No. within the range of 0 to 99. Sub-routine No. cannot be specified by $ (HEX).
Point
Description of Operation
When the execution condition is TRUE, Sub-routine n specified by Module S is executed.
All types of module (every scan, initialization, standup, fixed period) can be specified except macro.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual", "Flow Instructions."
● Example of format
ECALL(MR1000, "Module 1",1)
MR1000 ECALL
“module 1” #1
Execution condition
APPLICATION FUNCTION
6
Flow Functions
Macro call
MCALL ([Execution condition,]*1 "Macro name (Text string) " [,Macro argument 1,
Macro argument 2, Macro argument 3……, Macro argument 10])
Recognized Type Const
APPLICATION FUNCTION
Argument/Return
Explanation Device Formula
value .U .S .D .L .F .DF .B .T #/$
S1 Macro name
Specifies the macro name by a text string. - - - - - - - - *3 - -
(Text string)
S2 Specifies the macro argument.(The number
Macro
*2
argument *4
of arguments differs according to the - - - - - - - -
macro).
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
6 *2
at all times (at every scan)).
The number and attribute of macro argument devices differ according to the argument setting
made to the macro to execute.
Macro Functions
Description of Operation
When the execution condition is TRUE, the sub-routine type macro specified by S1 is executed.
The argument specified by S2 is handed over to the macro. With macros, arguments are handled
as device No (P0 onwards) or constants (V0 onwards) according to the argument settings.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual", "Macro Instructions."
● Example of format
MCALL (R3000, "Marco 1", DM1000, 10)
R3000 MCALL Macro 1
DM1000 #10
Execution condition
Argument 1 Argument 2
Point • Text strings other than sub-routine type macros enclosed by " " cannot be programmed
as macro names.
• When the MCALL function is handled in box scripts or in IF statements, attention is
required as OFF processing when stopped may operate differently to when executed
with an instruction.
"KV-7000 Series User's Manual, "4-9 Macro""
"KV-5500/5000/3000 series User Manual "3-9 Macro""
"KV Nano series User Manual "4-9 Macro""
Macro start
MSTRT ([Execution condition,]*1 "Macro name (Text string) " [,Macro argument 1,
Macro argument 2, Macro argument 3……, Macro argument 10]*2 )
Argument/Return Recognized Type Const
APPLICATION FUNCTION
Explanation Device Formula
value .U .S .D .L .F .DF .B .T #/$
S1 Macro name
Specifies the macro name by a text string. - - - - - - - - *4 - -
(Text string)
S2 Specifies the macro argument.(The number
Macro
*3
argument *5
of arguments differs according to the - - - - - - - -
macro).
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
*2 The number of arguments differs according to the macro to execute. 6
*3 The number and attribute of macro argument devices differ according to the argument setting
Macro Functions
made to the macro to execute.
"KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual",
"MSTRT Instructions"
*4 Enter the macro name set on KV STUDIO enclosed by " ".
*5 When an ID No. is used, the format becomes "(macro name)_(ID No.)". For example) Batch send_2
For details, please see "KV-7000 Series User's Manual", "4-9 Macro", "KV-5500/5000/
3000 Series User's Manual", "3-9 Macro" or KV Nano Series User's Manual", "4-9 Macro."
Description of Operation
When the execution condition is TRUE, the self-hold type macro specified by S1 is executed.
The argument specified by S2 is handed over to the macro. With macros, arguments are handled
as device Nos. (P0 onwards) or constants (V0 onwards) according to the argument settings.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Macro Instructions."
● Example of format
MSTRT (R3000, "Macro2", DM1000, 10)
R3000 MSTRT Macro 2
DM1000 #10
Execution condition
Argument 1 Argument 2
Point • Text strings other than self-hold type macros enclosed by " " cannot beprogrammed as
macro names.
• When the MSTRT function is handled in box scripts or in IF statements, attention is
required as OFF processing when stopped may operate differently to when executed
with an instruction.
KV-7000 Series User's Manual, "4-9 Macro"
KV-5500/5000/3000 series User Manual "3-9 Macro"
KV Nano Series User's Manual, "4-9 Macro"
Macro end
Description of Operation
When the execution condition is TRUE, self-hold type macros with a MEND function written to them
6 stop.
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Macro Functions
● Example of format
MEND (R3000 = OFF)
R3000 MEND
Execution condition
Point • The MEND function can be used only when the content of a self-hold type macro is
programmed by a script.
• At least one MEND function (instruction) must be programmed in self-hold type
macros.
APPLICATION FUNCTION
6
Macro Functions
Function block
6 *2
at all times (at every scan)).
The number of arguments differs according to the function block to execute.
*3 The number and attributes of argument devices differ according to the argument setting
Function Block Functions
Description of Operation
When the execution condition is TRUE, the function block specified in S1 function block name
(text string) starts.
The argument specified by S2 argument is handed over to the function block. With function
blocks, the arguments are handled as devices or constants according to the argument settings.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual", "Function Block Instructions"
● Example of format
FB (R3000, "FunctionblockA", 1, DM0)
R3000 FunctionblockA
Point • Text strings other than function block names enclosed by " " cannot be written in
function block name.
• When an FB function with the "OFF processing while execution is stopped" setting
enabled is handled in box scripts or in IF statements, attention is required as OFF
processing when stopped may operate differently to when executed with an instruction.
"KV-7000 Series User's Manual", "4-8 Function Block"
APPLICATION FUNCTION
value .U .S .D .L .F .DF .B .T #/$
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
tions
Function Block Func-
When the execution condition is TRUE, function blocks with an FEND function written to them stop.
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual", "Function Block Instructions”
● Example of format
FEND (R3000 = OFF)
R3000 FEND
Execution condition
Function
6 *2
at all times (at every scan)).
The number and attributes of argument devices differ according to the argument setting
configured in the function to execute.
Function Block Functions
Description of Operation
When the execution condition is TRUE, the function block specified in S1 function name (text
string) is executed.
The argument specified by S2 argument is handed over to the function. With function, the
arguments are handled as devices or constants according to the argument settings.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual", "Function Block Instructions”
● Example of format
FUN (R3000, "FunctionB", EM0, MR000)
R3000 FunctionB
Point Text strings other than function names enclosed by " " cannot be written in function name.
"KV-7000 Series User's Manual", "4-8 Function block"
APPLICATION FUNCTION
6
tions
Function Block Func-
Module start
Description of Operation
When the execution condition is TRUE, Module S is executed.
The module in ON status operates from next scan period.
No operation is executed when the module is ON.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Module Instructions."
● Example of format
MDSTRT (MR1000, "Module 1")
MR1000 MDSTRT
Module 1
Execution condition
Point • As the default status at the start of the module execution, the differential execution type
instruction turns ON when the rising edge is detected, and turns OFF when the falling
edge is detected. The differential sign cannot be detected immediately in initial
execution stage.
• When MDSTRT and MDSTOP function instruction are required to be executed for
many times for the same module in the same scan period, the final module instruction
is executed.
• Execution of initialization module cannot be stopped or started.
Module stop
APPLICATION FUNCTION
value .U .S .D .L .F .DF .B .T #/$
S Module name
Specifies the module name by a text string. - - - - - - - - *2 - -
(Text string)
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
*2 Enter the macro name set on KV STUDIO enclosed by " ".
Module Functions
When the execution condition is TRUE, Module S is executed.
No operation is executed when the module is ON.
The instruction can stop its own module.
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "ModuleInstructions."
● Example of format
MDSTOP (MR1000, "Module 1")
MR1000 MDSTOP
Module 1
Execution condition
Point • If MDSTRT function (instruction) and MDSTOP function (instruction) are executed the
same module multiple times in the same scan, the module instruction executed last will
be followed.
• Do not stop all modules. Under this circumstance, please restore by using any method.
(Only after the program is stopped.)
• Cut off the power supply of KV-7500/7300/5500/5000/3000/1000 or KV Nano
series PLC once, and power on again.
• Toggle selector switch "RUN-PROG" of KV-7500/7300/5500/5000/3000/1000 or
KV Nano series PLC to "PROG" mode.
• In KV STUDIO, turn RUN mode to OFF, then ON again.
• Execution of initialization module cannot be stopped or started.
Zpush
Operation description
When the execution condition is TRUE, the values of Z1 to Z10 index registers are stored in the data block
specified by D . After the function is executed, the value of [ D +0]is incremented by 1.
Point • Before the execution of initial ZPUSH function,[ D +0] is set to 0. This is not
necessary from the second "ZPUSH function" onwards.
• The "ZPUSH function" and "ZPOP function" are used as a pair.
• Do not write to the range of D occupied by the "ZPUSH function" in other functions and
instructions.
• When the data block range exceeds the device range, the function is not executed.
bit
31
bit bit
16 15
bit
0
Save times D +0
APPLICATION FUNCTION
Z1 Z1 D +1 D +2
Z2 Z2 D +3 D +4
…
…
Z10 Z10 D +19 D +20
Reserved for system Reserved for system D +21 D +22
Reserved for system Reserved for system D +23 D +24
Reference "The "ZPUSH function" and ZPOP function" are programmed nested. When nesting these
functions, specify the same leading device.
6
bit bit bit bit
31 16 15 0
Z1 DM1DM2
ZPUSH
DM0
ZPOP
DM0 Reserved for system DM71DM72
bit
31
bit bit
16 15
bit
0
Save times D +0
bit
15
bit
0
Save times D +0
Z1 Z1 D +1
APPLICATION FUNCTION
Z2 Z2 D +2
…
…
Z10 Z10 D +10
Reserved for system Reserved for system D +11
Reserved for system Reserved for system D +12
● Example of format
ZPUSH (MR3000, DM1000.L)
6 MR1000 ZPUSH.L
DM1000
Execution condition
Index Register Functions
Return value
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "3-8 Index Register Instructions."
APPLICATION FUNCTION
6
ZPop
6
*3 When the type of device for store destination is specified in .S:
• A minimum of 13 continuous words is occupied. When nesting functions, "number of register
purges x 12 words + 1" words are occupied.
Index Register Functions
Description of Operation
When the execution condition is TRUE, the values of Z1 to Z10 index registers are stored in the data block
(index register stored in ZPUSH function) specified by D . After the function is executed, the value of
[ D +0] is incremented by 1.
Point • The "ZPUSH function" and "ZPOP function" are used as a pair.
• The function is not executed when either of the following conditions is TRUE:
• [ D +0] is "0".
• When the data block range exceeds the device range
APPLICATION FUNCTION
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
6
bit bit
15 0
D +1 Z1 Z1
D +1 Z1 Z1
D +2 Z2 Z2
…
Reserved Reserved
D +12 for system for system
● Example of format
ZPOP (MR1000, DM1000.L)
MR1000 ZPOP.L
DM1000
Execution condition
Return value
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Index Register Instructions."
Set address
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
Description of Operation
When the execution condition is TRUE, the address of S is stored in continuous two words starting
from D . After the addresses are stored, the result will be identical with that indirectly specified by
S when the function is programmed by indirect specification (* destination Store device).
● Example of format
ADRSET (R3000, DM1000, DM2000.D)
R3000 ADRSET
DM1000 DM2000
Execution condition
Indirect Store
designation device destination device
APPLICATION FUNCTION
generate and manipulate addresses.
Sample Program
● When specifying a bit device to the indirect specification device
Programmed Script ADRSET (R3000, MR1000, DM2000.D)
When R3000 is ON, the address of bit device MR1000 is stored in
6
Description of Operation
Functions
Indirect Specification
● When using an index register
Programmed Script ADRSET (DM1000:Z1, DM2000.D:Z1)
Description of Operation The address of the DM (1000+Z1) is stored in DM (2000+Z1) .D at every
scan (no execution condition).
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Hint
When the address of a bit device is used for indirect specification, the address is processed as a word
device if the suffix is omitted. To process the address as a bit device, modify it by the .B suffix.
Increment address
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
*2 Continuous two words are used.
*3 Only DM, W, EM, ZF, FM can be specified.
6
Description of Operation
Functions
Indirect Specification
When the execution condition is TRUE, the indirect specification address currently stored in D
becomes the next address. When a word device address is currently stored, this indicates the address of
the next word device, or when a bit device address is currently stored, this indicates the address of the
next bit device.
Adds 1 to the address currently stored in D .
D +1 D D +1 D
Address Address ˇ1
● Example of format
ADRINC (R3000, DM2000.D)
R3000 ADRINC
DM2000
Execution condition
Address store Device
Point • Two continuous words starting from the specified device No. are always occupied as
the address Store device.
• Before the ADRINC function is used, be sure to set the indirect specification address to
the address Store device by the ADRSET function.
• Be sure to use the ADRSET, ADRINC, ADRDEC, ADRADD, and ADRSUB functions to
generate and manipulate addresses.
• The function is not executed when either of the following conditions is TRUE:
• D is inappropriate
• The address is inappropriate after the increment.
APPLICATION FUNCTION
Description of Operation When the R3000 is ON, the indirect specification address currently stored
in DM(2000+Z1). D is the next address.*
*Before execution, the address must be stored in DM2000.D by the ADRSET function (instruction).
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Hint
6
When the currently stored address is a bit device, the ADRINC function indicates the next bit device. When
Functions
Indirect Specification
the address straddles channels at this time, the address becomes the address of the next channel.
Decrement address
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
*2 Continuous two words are used.
*3 Only DM, W, EM, ZF, FM can be specified.
6
Description of Operation
Functions
Indirect Specification
When the execution condition is TRUE, the indirect specification address currently stored in D is made
into the previous address. When a word device address is currently stored, this indicates the address of
the previous word device, or when a bit device address is currently stored, this indicates the address of the
previous bit device.
The address currently stored in D is subtracted by 1.
D +1 D D +1 D
Address Address ˉ1
● Example of format
ADRDEC (R3000, DM2000.D)
R3000 ADRDEC
DM2000
Execution condition
Address store
Device
Point • Two continuous words starting from the specified device No. are always occupied as
the address store device.
• Before the ADRDEC function is used, be sure to set the indirect specification address
to the address Store device by the ADRSET function.
• Be sure to use the ADRSET, ADRINC, ADRDEC, ADRADD, and ADRSUB functions to
generate and manipulate addresses.
• The function is not executed when either of the following conditions is TRUE:
• D is inappropriate
• The address is inappropriate after the decrement.
APPLICATION FUNCTION
Description of Operation When the R3000 is ON, the indirect specification address currently stored
in DM(2000+Z1). D is made into the previous address.*
*Before execution, the address must be stored in DM2000.D by the ADRSET function (instruction).
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Hint
6
When the currently stored address is a bit device, the ADRDEC function indicates the previous bit device.
Functions
Indirect Specification
When the address straddles channels at this time, the address becomes the address of the previous
channel.
Add address
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan)).
Description of Operation
When the execution condition is TRUE, the indirect specification address currently stored in D is made
into the address by adding S . When the address of the word device is currently stored, this indicates
only address of the word device of address add value is added, or when the address of the bit device is
currently stored, this indicates only bit address of the bit device is added.
S is subtracted from the address in D .
D +1 D S D +1 D
Address + Value of S Value of address + S
● Example of format
ADRADD (R3000, DM1000.S,DM2000.D)
R3000 ADRADD
DM1000 DM2000
Execution condition
Address Address
addition value store Device
Point • Two continuous words starting from the specified device No. are always occupied as
the address store device.
• Before the ADRADD function is used, be sure to set the indirect specification address
to the address store device by the ADRSET function.
• Be sure to use the ADRSET, ADRINC, ADRDEC, ADRADD, and ADRSUB functions to
generate and manipulate addresses.
• The function is not executed when either of the following conditions is TRUE:
• D is inappropriate
• The address is inappropriateafter the increment.
APPLICATION FUNCTION
adding the value specified by the address add value.
Functions
Indirect Specification
Reference "ADRSET function"
Subtract address
Description of Operation
When the execution condition is TRUE, the indirect specification address currently stored in D is made
into the address obtained by subtracting S . When the address of the word device is currently stored,
this indicates the address of the word device that is obtained by subtracting the address subtract value, or
when the address of the bit device is currently stored, this indicates the bit device obtained by subtracting
the address subtract value.
S is subtracted from the address in D .
D +1 D S D +1 D
Address ˉ Value of S Value of address ˉ S
● Example of format
ADRSUB (R3000, DM1000.S, DM2000.D)
R3000 ADRSUB
DM1000 DM2000
Execution condition
Address Address
subtraction value store Device
Point • Two continuous words starting from the specified device No. are always occupied as
the address store device.
• Before the ADRSUB function is used, be sure to set the indirect specification address
to the address store device by the ADRSET function.
• Be sure to use the ADRSET, ADRINC, ADRDEC, ADRADD, and ADRSUB functions to
generate and manipulate addresses.
• The function is not executed when either of the following conditions is TRUE:
• D is inappropriate
• The address is inappropriate after the decrement.
APPLICATION FUNCTION
adding the value specified by the address add value.
Functions
Indirect Specification
Reference "ADRSET function"
Switch mode
6 Description of Operation
File register Functions
When the execution condition is TRUE, switch the current file register No. to n .
"About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual", "File Register Instructions."
● Example of format
FRSET (MR1000, 2)
MR1000 FRSET
#2
Execution condition
APPLICATION FUNCTION
6
Return value*1 =FRSTM (Drive number*2, Bank No., File No., result store device)
*5
Argument/Return Recognized Type Const
Explanation Device Formula
APPLICATION FUNCTION
6 *1 The return value can be omitted. When omitted, the operation result is stored in the internal
registers.
File register Functions
*2 For KV-7500/7300 only, set drive number (0: memory card, 1:CPU memory). In case of KV-5500/
5000/3000, this cannot be set.
*3 Set bank number to scope of 0-15 for KV-7500/7300, 0 to 3 for KV-5500/5000/3000.
*4 Please specify the number of data within the range of 0 to 999.
*5 T,C,CTC,CTH,Z cannot be specified.
*6 When a bit device has been specified to the store result Store device, continuous two bits are
used as the notification bit. When a word device has been specified, each of the LSBs of
continuous two words is used as the notification bit device.
Description of Operation
When the execution condition is TRUE, the data in file register of the n2 bank number is batch-
stored in memory card in BIN bits on the drive number n1 as the file name specified by S file
number.
The write complete notification and abnormality end warning is stored in D .
When the FRSTM function is started normally, R is ON, otherwise OFF.
Reference • The file name stored in memory card is "\FR\FR (file NO. 3-digit) .FRU" (file extension is
FRB in case of KV-5500/5000/3000 .)
(Example) When setting 10 to S , create the file \FR\FR010.FRU on the memory
card or CPU memory.
• Meaning of notification bit of D
APPLICATION FUNCTION
6
Return value*1 =FRLDM (Drive number*2, Bank No., File No., result store device )
*5
Argument/Return Recognized Type Const
Explanation Device Formula
APPLICATION FUNCTION
*1 The return value can be omitted. When omitted, the operation result is stored in the internal registers.
*2 For KV-7500/7300 only, set drive number (0: memory card, 1:CPU memory). In case of KV-5500/
5000/3000, this cannot be set.
*3 Set bank number to scope of 0-15 for KV-7500/7300, 0-3 for KV-5500/5000/3000.
*4 Please specify the number of data within the range of 0 to 999.
*5 T,C,CTC,CTH,Z cannot be specified.
*6 When a bit device has been specified to the read result store device, continuous two bits are
used as the notification bit. When a word device has been specified, each of the LSBs of
continuous two words is used as the notification bit device.
Description of Operation
When execution conditions are satisfied (TRUE), the data saved in drive number n1 and specified
by S file number (\FR\FR(file number consisting of 3 digits).FRB) is read, and saved in the n2
Reference • The file name read in memory card is "\FR\FR (file NO. 3-digit) .FRU" ((file extension is
FRB in case of KV-5500/5000/3000.)
(Example) When setting 10 to S , the file \FR\FR010.FRU is read from the memory
card or CPU memory.))
• Meaning of notification bit of D
APPLICATION FUNCTION
6
6 D2
Execution
result*3
Specifies the leading device in which
to store the results.
.U .U .U .U − − − − − ○ −
Unit Program Functions
Point • The UPSTRT function can be used only by KV STUDIO ver.9.0 or later.
• The UPSTRT function can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 CPU Function Version" (page 2)
Description of Operation
At the rising edge of the execution condition S1 , the unit program specified by S2 in the n1
When the function is complete, the used slot number is stored in D1 , and the execution results are
APPLICATION FUNCTION
Specifies the parameters of the unit program to start.
S2 +2 Parameter
For flow: specifies the first block number to execute.
Slot specification ON : The slot specified by S2 +1 is used.
S2 +3 0 bit
method OFF : An assignable empty slot is automatically used.
If the unit program start function is executed at the rising edge of the execution condition, the process
will continue even if the input conditions are turned OFF at the next scan.
The result storage destination device completion bit and failed bit turn ON at completion, and turn
OFF when executing the function.
For details, see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Unit Program Instructions."
● Example of format
UPSTRT(MR1000, #1, DM0, DM10, DM11)
MR1000 UPSTRT
#1 DM0 DM10 DM11
Execution condition Unit No. Request details Execution start Execution result
slot number
Point • The UPSTOP function can be used only by KV STUDIO ver.9.0 or later.
• The UPSTOP function can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 CPU Function Version" (page 2)
Description of Operation
At the rising edge of the execution condition S , the unit program being executed in the slot
specified by n2 in the n1 unit is stopped forcefully, and the slot becomes empty.
When the function is complete, the execution results are stored in D1 and D1 +1.
For details, see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Unit Program Instructions."
APPLICATION FUNCTION
bit
D1 abnormally.
Execution If execution of the function fails, turns ON simultaneously with the
1 bit
failed bit completion bit. Turns OFF when executing the function.
The completion code is stored when the function is complete.
0: Started normally.
1: The specified unit program does not exist.
2: There are no empty slots.
3: Operation enabled is OFF.
4: A unit program error has occurred.
D1 +1 Completion code
5:
6:
The specified slot does not exist.
The specified slot is in use. 6
7: The unit program is already being executed.
● Example of format
UPSTOP(MR1000, #1, #0, DM0)
MR1000 UPSTOP
#1 #0 DM0
Execution condition Unit No. Slot number Execution result
Suspend flow
UFSUS ( Execution condition, Unit No., Slot number, Request details, Execution result )
Argument/Return Recognized Type Const
Explanation Device Formula
APPLICATION FUNCTION
6
Execution Specifies the leading device in which
D1 .U .U .U .U − − − − − ○ −
result*2 to store the results.
Point • The UFSUS function can be used only by KV STUDIO ver.9.0 or later.
• The UFSUS function can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 CPU Function Version" (page 2)
Description of Operation
At the rising edge of the execution condition S , the flow being executed in the slot specified by
n2 in the n1 unit is suspended, following the method specified in n3 .
When the function is complete, the execution results are stored in D1 and D1 +1.
APPLICATION FUNCTION
bit
D1 abnormally.
Execution If execution of the function fails, turns ON simultaneously with the
1 bit
failed bit completion bit. Turns OFF when executing the function.
The completion code is stored when the function is complete.
0: Started normally.
1: The specified unit program does not exist.
2: There are no empty slots.
3: Operation enabled is OFF.
4: A unit program error has occurred.
D1 +1 Completion code
5:
6:
The specified slot does not exist.
The specified slot is in use. 6
7: The unit program is already being executed.
For details, see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Unit Program Instructions."
● Example of format
UFSUS(MR1000, #1, DM10, #0, DM0)
MR1000 UFSUS
#1 DM10 #0 DM0
Execution condition Unit No. Slot number Request details Execution result
Resume flow
Point • The UFRSM function can be used only by KV STUDIO ver.9.0 or later.
• The UFRSM function can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 CPU Function Version" (page 2)
Description of Operation
At the rising edge of the execution condition S , the suspended flow in the slot specified by n2
For details, see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Unit Program Instructions."
APPLICATION FUNCTION
bit
D1 abnormally.
Execution If execution of the function fails, turns ON simultaneously with the
1 bit
failed bit completion bit. Turns OFF when executing the function.
The completion code is stored when the function is complete.
0: Started normally.
1: The specified unit program does not exist.
2: There are no empty slots.
3: Operation enabled is OFF.
4: A unit program error has occurred.
D1 +1 Completion code
5:
6:
The specified slot does not exist.
The specified slot is in use. 6
7: The unit program is already being executed.
● Example of format
UFRSM(MR1000, #1, DM10, DM0)
MR1000 UFRSM
#1 DM10 DM0
Execution condition Unit No. Slot number Execution result
6
Allocation result Specifies the device in which the leading ○ −
D2 .U .U .U .U − − − − −
storage destination address of the allocated area is stored.
Point • The UMALLOC function can be used only by KV STUDIO ver.9.0 or later.
• The UMALLOC function can be used with KV-7000 Series CPU units that have CPU
function version 2.0 or later only.
"KV-7500/7300 CPU Function Version" (page 2)
Description of Operation
At the rising edge of the execution condition S , an area of the number of words specified by
n2 from the buffer memory of the n1 unit is allocated. The leading address of the allocated area
is stored in D2 and the execution results are stored in D1 .
For details, see "KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual", "Unit Program Instructions."
APPLICATION FUNCTION
storage destination
Read buffer
6
R Return value None - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
Buffer memory Functions
Description of Operation
When execution condition is TRUE, read buffer of n1 connected with CPU unit, address of n2
● Example of format
UREAD (MR1000, 3, DM1200, DM1000, DM1100)
MR1000 UREAD
#3 DM1200 DM1000 DM1100
Execution condition
Unit No. Leading address Read data store Number of read data
for buffer memory object leading device
APPLICATION FUNCTION
6
Write buffer
6
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).
Buffer memory Functions
*2 Please specify a unit number within the range of 0 to 48 (0 to 15 for the Nano Series). $(HEX)
cannot be specified.
*3 Please specify the buffer memory start address as 0 to 59999 for KV-7500/7300 and 0 to 32767
all others.
*4 Please specify the read data number as 1 to 60000 for KV-7500/7300 and 1 to 32768 all others.
*5 CTC,CTH,Z cannot be specified.
*6 The text string operation can only be specified. Operation other than text string operation (e.g.
DM0+DM2) cannot be programmed.
Description of Operation
When execution condition is TRUE, n3 data of device stored in the address of n2 starting from
S are written into the buffer of n1 connected with CPU unit.
S Write n2
S +1 Write n2 +1
S +2 Write n2
Ă
S + n3 -2 Write n2 + n3 -2
S + n3 -1 Write n2 + n3 -1
APPLICATION FUNCTION
[ S +2(n-2) S +2(n-2)+1] Transfer [ n2 +2(n-2) n2 +2(n-2)+1]
[ S +2(n-1) S +2(n-1)+1] Transfer [ n2 +2(n-1) n2 +2(n-1)+1]
Reference • When the constant is specified in S , UWRIT function executes the operation
identical with UFILL function.
"UFILL function"
Buffer file
Description of Operation
When execution condition is TRUE, data stored in the address of n2 in S are batch-written into
the buffer of n1 connected with CPU unit in three batches.
n2
n2 +1
n2
Ă
n2 + n3 -3
n2 + n3 -2
n2 + n3 -1
[ n2 n2 +1]
[ n2 +2 n2 +3]
APPLICATION FUNCTION
[ n2 +4 n2 +5]
Ă
[ S S +1]
[ n2 +2(n-3) n2 +2(n-3)+1]
[ n2 +2(n-2) n2 +2(n-2)+1]
[ n2 +2(n-1) n2 +2(n-1)+1]
● Example of format
6
6 Point • The unit type judgment function can be used in KV STUDIO Ver. 9.1 or later only.
• The unit type judgment function can be used with KV-7000 Series CPU units that
Unit type judgment function
Description of Operation
The unit type of the n1 unit is checked at the rising edge of the execution condition, and D
turns ON if it matches the unit type corresponding to the instruction. D turns OFF if there is no
match or if it is not connected.
● Example of format
IS_XH16ML(@CR2008, #1,MR000)
@CR2008 IS_XH16ML
#1 MR000
Execution condition
Unit No. Execution result
Block move
7 *2
*3
When device T or C is specified, the current value becomes the move source.
When device T or C is specified, the current value becomes the move destination.
Data Move Function
*4 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002, R1012) of the channel has been specified, the relay is
handled in16/32 bits straddling the next channel.
Description of Operation
When the execution condition is established (TRUE), n move data of word block starting from
S is block-moved to the work block starting from D . (When the move destination is 32-bit
data, the word block becomes the "specified number of move data x 2 words".)
S +2 Move D +2
...
...
...
S + n -2 Move D + n -2
S + n -1 Move D + n -1
...
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Move Instructions".
0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0
bit bit
15 MR1100 0
bit
15 MR1000 bit
0
1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0
Reference • Data blocks (bit) at the move source and move destination will be moved successfully
even if they partially straddle channels.
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Fill move
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution condition is established (TRUE), n 16-bit/32-bit data (unsigned/signed)
stored in S is block-moved to the word block starting from D . (When the move destination is
32-bit data, the word block becomes the "specified number of move data x 2 words".)
D +2
S
...
D + n -3
D + n -2
D + n -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]
[
7-4 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
• S : When move source device is 64 bits (.DF)
[ D D +1 D +2 D +3]
[ D +4 D +5 D +6 D +7]
[ D (n-3)
+4 D (n-3)
+4 +1 D (n-3)
+4 +2 D (n-3)
+4 +3]
[ D (n-2)
+4 D (n-2)
+4 +1 D (n-2)
+4 +2 D (n-2)
+4 +3]
[ D (n-1)
+4 D (n-1)
+4 +1 D (n-1)
+4 +2 D (n-1)
+4 +3]
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Move Instructions".
● Example of format
FMOV (MR1000, DM1000.U, EM2000, 5)
MR1000 S :DM1000
7
FMOV
DM1000 EM2000 #5 D :EM2000
Execution condition n When :#5
Move source Move destination
device device
Sample Program
0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0
bit bit
15 MR1200 0
bit
15 MR1100 bit
0
1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1
Reference • Data blocks (bit) at the move source and move destination will be moved successfully
even if they partially straddle channels.
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Partial move
PMOV ( [execution condition,] *1 move source device, move source leading bit position,
move destination device, move destination leading bit position, number of move bits)
ARITHMETIC OPERATION FUNCTIONS
Description of Operation
When the execution condition is established (TRUE), bits from n1 of the 16-bit/32-bit data stored in
S are block-moved by n3 bits to bits from n2 of D .
S : Move source
device
n1
bit bit
15 0
D : Move destination
device
n2
[ S S +1]
[ D D +1]
n2
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Move Instructions".
Reference The original values of bits that are not moved (not destinationed for the move) are held as
they are.
7
● Example of format
Point The function is not executed when either of the following conditions is established:
• When the suffix of S is .U, and n3 = 0 or 16 < n1 + n3 or 16< n2 + n3 .
• When the suffix of S is .D, and n3 = 0 or 32 < n1 + n3 or 32< n2 + n3 .
0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0
1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1
bit bit bit bit
15 MR2100 0 15 MR2000 0
Description of Operation Bits onwards from the bit position specified by EM3001 of the 16-bit data stored in
DM3000 are moved at every scan (no execution condition) to bits onwards from the bit
position specified by EM3002 of DM3001 in blocks (bits) by the number of move bits
specified by the lower three bits (extracted) of EM3000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"ANDA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Byte B move
BYBMOV ( [execution condition,] *1 move source byte string leading device, move source
ARITHMETIC OPERATION FUNCTIONS
byte offset, move destination byte string storage destination leading device,
move source byte offset, number of move bytes )
Argument/Return Supported Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Move source *3
Specifies the leading device storing the
byte string .U .S .D .L .F .DF .B .T - -
*2 move source byte string data.
leading device
n1
Specifies the device storing the position from the
Move source
move source byte string leading device, or .U .U .U .U - - - -
byte offset
specifies that position. (0 to 65535)
D Move destination *3
Specifies the leading device of the move
byte string .U .S .D .L .F .DF .B .T - -
*2 destination byte string.
leading device
7 n2
Specifies the device storing the position from the
Move destination
move destination byte string leading device, or .U .U .U .U - - - -
byte offset
specifies that position. (0 to 65535)
Data Move Function
n3
Specifies the device storing the number of
Number of
bytes to move, or specifies the size of the .U .U .U .U - - - -
move bytes
move data. (1 to 65535)
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 • For the bit device, specify the leading device of the channel.
• S and D may be the same device.
*3 The ".DF" suffix cannot be specified for device Z.
Point • The BYBMOV function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be used with KV-7000 Series CPU units and with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
D D(44H) E(45H)
D +1 1(31H) 2(32H)
D +2 3(33H) F(46H)
D +3
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Move Instructions."
● Example of format
BYBMOV (MR1000, DM2000, 4, EM4000, 2, 8)
BYBMOV
MR1000
DM2000 #4 EM4000
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Byte L move
BYLMOV ( [execution condition,] *1 move source byte string leading device, move source
ARITHMETIC OPERATION FUNCTIONS
byte offset, move destination byte string storage destination leading device,
move source byte offset, number of move bytes )
Argument/Return Supported Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Move source *3
Specifies the leading device storing the
byte string .U .S .D .L .F .DF .B .T - -
*2 move source byte string data.
leading device
Specifies the device storing the position from the
n1 Move source
move source byte string leading device, or .U .U .U .U - - - -
byte offset
specifies that position. (0 to 65535)
D Move destination *3
Specifies the leading device of the move
byte string .U .S .D .L .F .DF .B .T - -
*2 destination byte string.
leading device
7
Specifies the device storing the position from the
n2 Move destination
move destination byte string leading device, or .U .U .U .U - - - -
byte offset
specifies that position. (0 to 65535)
Data Move Function
Point • The BYLMOV function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be used with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
D 1(31H) C(43H)
D +1 3(33H) E(45H)
D +2 G(47H) 2(32H)
D +3
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Move Instructions."
● Example of format
BYLMOV (MR1000, DM1000, 4, EM3000, 2, 8)
BYLMOV
MR1000
DM1000 #4 EM3000
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Increment memory
7 Description of Operation
Functions
Arithmetic Operation
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Arithmetic/Comparison Instructions."
● Example of format
INC (LDP (MR2000), DM1000.U)
MR2000 DM1000
↑ INC
Execution condition Increment destination device
Functions
Arithmetic Operation
Reference
content, refer to "New a box script", step 5, (Page 2-10).
Decrement memory
7 Description of Operation
Functions
Arithmetic Operation
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Arithmetic/Comparison Instructions."
● Example of format
DEC (DM1000.U)
CR2002 DM1000
DEC
Always ON Decrement destination device
Functions
Arithmetic Operation
content, refer to "New a box script", step 5, (Page 2-10).
Square root
*1
Return value = ROOT (operation destination device )
ARITHMETIC OPERATION FUNCTIONS
R
Stores the value of the ROOT function
Return value .U .S .D .L .F .DF - - - -
processing result. *2
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
7 • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Point
Functions
Arithmetic Operation
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The square root of the data stored in S is calculated, and the result is stored in R .
S ˇ1 S R ˇ1 R
Float Float
32 bits 32 bits
• S : When operation destination device is double-precision floating point type real number (.DF)
S +3 S +2 S +1 S R +3 R +2 R +1 R
Double precision floating point type real number Double precision floating point type real number
64 bits 64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Arithmetic/Comparison Instructions."
● Example of format
DM2000.U = ROOT (DM1000.U)
CR2002 DM1000 DM2000
LDA EXT ROOT STA
Always ON Operation destination device Return value
7
Functions
Arithmetic Operation
Sample Program
● When using operation formulas
Programmed Script DM2000.L = ROOT (DM1000.S * EM1000.S)
Description of Operation The square root of the product (multiplication) of the data stored in DM1000.S and
EM1000.S is calculated, and the result is stored in DM2000.L.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Square root
*1
Return value = SQRT (Operation destination device )
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
7 • The SQRT function can be used only with KV STUDIO Ver. 4.00 or higher.
Point
Functions
Arithmetic Operation
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
This function is similar to "ROOT function" except function name is different.
"ROOT function"
Functions
Arithmetic Operation
AND A
*1
Return value =ANDA (Operation destination device, operation data device)
ARITHMETIC OPERATION FUNCTIONS
*3 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The logical AND operation of the data stored in the S1 operation destination device and binary
data stored in the S2 operation data device is executed.
● Example of format
• S1 : When operation destination device is 16 bits (.U/.S)
DM2000.U = ANDA (DM1000.U, $00FF)
CR2002 DM1000 $FF DM2000
LDA ANDA STA
Always ON Operation destination device Return value
bit bit
15 0
DM1000
S1 :Operation destination device 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
AND bit
0
$FF
S2 :Operation destination device 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ANDA
bit bit
15 0
DM2000
R :Return value 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 STA
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Logic Operation Instructions."
7
Operation destination device 0 0 1 1
Operation data device 0 1 0 1
Return value 0 0 0 1
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"FMOV function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
ORA
*1
Return value = ORA ( Operation destination device, operation data device)
ARITHMETIC OPERATION FUNCTIONS
S2
Specifies the device to which the logical OR
Operation Handled as same
*2 data is currently stored, or the logical OR type as S1 .
- - - -
data device
data.
*4
ORA function type is identical to the 1st
R Return value .U .S .D .L .F .DF - - - -
argument.*3
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
7 than the leading relay (e.g. R002, R1012) of the channel has been specified, the relay is
handled in16/32 bits straddling the next channel.
Logic Operation Functions
*3 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S1 and the BIN data stored in S2 are ORed.
● Example of format
• S1 : When operation destination device is 16 bits (.U/.S)
DM2000.U = ORA (DM1000.U, $00FF)
CR2002 DM1000 $FF DM2000
LDA ORA STA
Always ON Operation data device Return value
bit bit
15 0
DM1000
S1 :Operation destination device 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
OR bit
0
$FF
S2 :Operation destination device 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ORA
bit bit
15 0
DM2000
R :Return value 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 STA
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Logic Operation Instructions."
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBCD function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Exclusive ORAA
*1
Return value = EORA (Operation destination device, operation data device )
ARITHMETIC OPERATION FUNCTIONS
7 than the leading relay (e.g. R002, R1012) of the channel has been specified, the relay is
handled in16/32 bits straddling the next channel.
*3 When the type different from the 1st argument is specified by return value, type conversion will
Logic Operation Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
Description of Operation
The exclusive OR operation of the data stored in the S1 operation target device and the binary
data stored in the S2 operation data device is executed.
● Example of format
• S1 : When operation destination device is 16 bits (.U/.S)
DM2000.U = EORA (DM1000.U, $00FF)
CR2002 DM1000 $FF DM2000
LDA EORA STA
Always ON Operation destination device Return value
bit bit
15 0
DM1000
S1 :Operation destination device 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
XOR bit
0
$FF
S2 :Operation destination device 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 EORA
bit bit
15 0
DM2000
R :Return value 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 STA
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Logic Operation Instructions."
● Example of use
The EORA function is used, for example, to invert the ON and OFF states of only the bits specified by
the operation data device on data specified by the operation destination device as the logic of only
arbitrary bits specified as 1 (ON) is inverted.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Exclusive NORAA
*1
Return value = ENRA (Operation destination device, operation data device)
ARITHMETIC OPERATION FUNCTIONS
S2
Specifies the device to which the exclusive
Operation Handled as same
*2 NOR data is currently stored, or the type as S1 .
- - - -
data device
exclusive NOR data.
*4
ENRA function type is identical to the 1st
R Return value *3 .U .S .D .L .F .DF - - - -
argument.
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
7 than the leading relay (e.g. R002, R1012) of the channel has been specified, the relay is
handled in16/32 bits straddling the next channel.
*3 When the type different from the 1st argument is specified by return value, type conversion will
Logic Operation Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The exclusive NOR operation of the data stored in the S1 operation target device and the binary
data stored in the S2 operation data device is executed. The results are stored in the R return
value.
● Example of format
• S1 : When operation destination device is 16 bits (.U/.S)
DM2000.U = ENRA (DM1000.U, $00FF)
CR2002 DM1000 $FF DM2000
LDA ENRA STA
Always ON Operation destination device Return value
bit bit
15 0
DM1000
S1 :Operation destination device 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 LDA
bit
15
XNOR bit
0
$FF
S2 :Operation destination device 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ENRA
bit bit
15 0
DM2000
R :Return value 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 STA
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Logic Operation Instructions."
Reference Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"BCNT function"
● Example of use
The ENRA function is used to understand bit changes between the previous value and the current
value as ON: ON or OFF:OFF matching bits can be extracted.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Complement
*1
Return value = COM (Operation destination device)
ARITHMETIC OPERATION FUNCTIONS
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
Description of Operation
Each of the bits of the BIN data stored in S is inverted.
R :Return value 0 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1
S S ˇ 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
R R ˇ 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
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Logic Operation Instructions".
● Example of format
DM2000.U = COM (DM1000.U)
Negative
*1
Return value = NEG (Operation destination device )
ARITHMETIC OPERATION FUNCTIONS
7 Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
Logic Operation Functions
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The plus/minus sign of the BIN data stored in S is inverted (2's complement is calculated).
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 1
bit bit
15 0
S ・ S ˇ1 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
perform
#12345678
bit bit bit bit
31 16 15 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
bit bit
31 0
R ・ R ˇ1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 1 1 0 0 1 0 ←After
perform
#-12345678
• S : Operation destination device is double precision floating point type real number
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
bit bit
63 0
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Logic Operation Instructions."
● Example of format
DM2000.S = NEG (DM1000.S) 7
CR2002 DM1000 DM2000
Sample Program
● To invert the sign of the bit device
Programmed Script DM2000.U = NEG (MR1000.U)
Description of Operation The plus/minus sign of the BIN data stored in MR1000 is inverted.
The result is stored in DM2000.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
value as it can invert the plus/minus sign of BIN data specified by the operation destination device.
7 Point When the NEG function is used on signed 16-bit data (.S), the range that can be handled
is -32768 to 32767. For this reason, the operation result becomes -32768 when -32768
Logic Operation Functions
has been operated on by the NEG function. At this time, +32768 can be calculated by
using the TOL function to extend the data to signed 32-bit data (.L) and inverting its sign.
Also, as the device is handled as a formula by prefixing it with a minus operator (-) instead
of using the NEG function, the data is automatically extended to signed 32-bit data (.L),
and the sign of -32768 is inverted to find +32768.
Absolute value
*1
Return value = ABS (Operation destination device)
ARITHMETIC OPERATION FUNCTIONS
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The absolute value of binary data saved in S operation destination device is saved to R
return value.
• S : When the operation destination device is unsigned 16/32 bits data (.U/.D)
S : The operation destination device is saved to R return value without processing.
• S : When the operation destination device is signed 16/32 bits data (.S/.L) or single/double
precision floating point type real number data (.F/.DF)
When S 0, the operation destination device is saved to R return value without processing.
When S <0, the operation destination device is saved to R return value after the sign is
reversed (two's complement operation).
bit bit
15 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1
bit bit
15 0
CR2002 DM2000
STA.S
Always ON Return value
Shift right A
*1
Return value = SRA ( Operation destination device, number of right shifts)
ARITHMETIC OPERATION FUNCTIONS
R
SRA function type is identical to the 1st
Return value .U .S .D .L .F .DF - - - -
argument.*2
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
7 *3 The ".DF" suffix cannot be specified for device Z.
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Data Shift Functions
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S is shifted to the right by n , and "0" is stored in upper bit.
R ˖Return value 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 10 0 1
Store 0 1
CR2009
(Carry)
S S +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
R R +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
Store 0
1
CR2009
(Carry)
Sample Program
7
● To shift a bit device right
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Shift left A
*1
Return value = SLA (operation destination device, number of left shifts)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
7 *3 The ".DF" suffix cannot be specified for device Z.
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Data Shift Functions
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S is shifted to the left by n and "0" is stored in lower bit.
1 11 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 R ˖Return value
1
Store 0
CR2009
(Carry)
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 S ・ S +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 R ・ R +1
1 Store 0
CR2009
(Carry)
Sample Program
● To shift a bit device left 7
DM2000.U = SLA (MR1000.U, 10)
Description of Operation The data currently stored in MR1000.U is shifted to the left by 10 bits.
The result is stored in DM2000.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
HINT
The SLA function is used, for example, to disperse and unite data stored in word devices, etc. as it
can shift any number of bits to the left.
Programmed Script DM2000 = ANDA (DM1000, $F)
DM2000 = ORA (M1000, SLA (ANDA (DM1001, $F), 4))
DM2000 = ORA (DM1000, SLA (ANDA (DM1002, $F), 8))
DM2000 = ORA (DM1000, SLA (ANDA (DM1003), 12))
Description of Operation The BCD data stored DM1000, DM1001, DM1002, and DM1003 is united as 4-digit BCD
one digit at a time from the lower bit, and stored in DM2000.
DKV DKV DKV
&/㧦
&/㧦
&/㧦
&/㧦
&/㧦
Reference The above script functions in an equivalent way to data conversion instruction UNIN (nibble unit).
"ANDA function"
"ORA function"
"UNIN function"
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano
Series Instruction Reference Manual, "Data Conversion Instructions" "UNIN
Instructions."
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - 7-41
KV-7500/7300 KV-5500/5000/3000 KV-1000 KV Nano
ASRA
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
7
Point • The ASRA function can be used only with KV STUDIO Ver. 6.00 or higher.
Data Shift Functions
• This function can only be used with KV-7000 Series CPU units KV-5500/5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S operation target device is right shifted by the number of bits specified with
n number of arithmetic right shifts. When S 0, "0" is stored in the bits shifted right from the
high-order bit, and "1" is stored when S <0.
bit
bit ( n -1) bit
15 0
S : 59417
S : Operation destination device 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1
R : Return value 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 10 0 1
R : 1856
High n bits Delete
1
Store 0
CR2009
(Carry)
R : Return value 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0
R : -63
High n bits Delete
1
Stores signed value
CR2009
0 or more: 0
When S value is
Less than 0: 1
(Carry)
S ・ S +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 3894011929
R ・ R +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 10 0 1 121687872
1
Store 0
CR2009
(Carry)
S ・ S +1 1CR2009
1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0(キャリー)
1 1 0 -1865478994
n=4
7
R ・ R +1 1 1 1 1 1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 -116592438
1
Stores signed value
0 or more: 0 CR2009
When S value is
Less than 0: 1 (Carry)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Shift Instructions."
● Example of format
DM2000.U = ASRA (DM1000.U, 5)
CR2002 DM1000 #5 EM2000
LDA ASRA STA
Always ON Operation destination device Return value
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
7 *3 The ".DF" suffix cannot be specified for device Z.
Data Shift Functions
Point • The ASLA function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be used with KV-7000 Series CPU units, KV-5500/5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S operation target device is left shifted by the number of bits specified with
n number of arithmetic left shifts. "0" is stored in the bits shifted left from the low-order bit.
1
Store 0
CR2009
(Carry)
S S +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 3894011929
n=5
R R +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 0 0 0 0 0
54330144
Delete Low n bits
1
CR2009 Store 0
(Carry)
Sample Program 7
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Rotate right A
*1
Return value = RRA (operation destination device, number of right rotates)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
7 be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
Data Shift Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S is rotated to the right by n with carry flag (CR2009).
CR2009
1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1
(Carry)
n times rotates
bit bit
CR2009 15 0
0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 R ˖Return value
(Carry)
0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 S ・ S +1
CR2009
1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
(Carry)
n times rotates
bit bit
CR2009 31 0
0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 R ・ R +1
(Carry)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see
Instruction Reference Manual, "Data Shift Instructions."
KV-7000/5000/3000/1000 Series and KV Nano Series
7
Point When the data is rotated to the right, the LSB is stored in carry flag (CR2009).
Sample Program
● To rotate a bit device right
Programmed Script DM2000.U = RRA (R1000.U, 10)
Description of Operation The data currently stored in R1000.U is rotated to the right by 10 bits.
The result is stored in DM2000.
HINT
With the SRA function, the MSB becomes "0" at each shift. However, with the RRA function, the LSB is
shifted around to the MSB via the carry flag.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Rotate left A
*1
Return value = RLA (operation destination device, number of left rotates)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
7 be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
Data Shift Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
Description of Operation
The data stored in S is rotated to the left by n with carry flag (CR2009).
1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0
Status of marking
(1-bit rotate)
differs for different S ˖Operation destination device
previous calculate result.
CR2009
1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 1
(Carry)
n times rotates
bit bit
15 0 CR2009
0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 R ˖Return value
(Carry)
1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 S ・ S +1
CR2009
1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1
(Carry)
n times rotates
bit bit
31 0 CR2009
0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 R ・ R +1
(Carry)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Shift Instructions."
7
● Example of format
Point When the data is rotated to the left, the MSB is stored in carry flag (CR2009).
Sample Program
● To rotate a bit device left
Programmed Script DM2000.U = RLA (R1000.U, 10)
Description of Operation The data currently stored in R1000.U is rotated to the left by 10 bits.
The result is stored in DM2000.
HINT
With the SLA function, the LSB becomes "0" at each shift. However, with the RLA function, the MSB is
shifted around to the LSB via the carry flag.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
7 16 or more (when the operation destination device has a .U suffix) or 32 or more (when the
operation destination device has a .D suffix).
Data Shift Functions
In the case of a .U suffix instruction, the remainder value obtained by dividing the value of n
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S is rotated to the right by n without a carry, and the result is stored in R .
(1-bit rotate)
0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0
n times rotates
bit bit
15 0
1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 R :Return value
CR2009(Carry) 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 S ・ S +1
0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0
n times rotates
bit bit
31 0
1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 R ・ R +1
CR2009(Carry) 1
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Shift Instructions."
Reference The state of the LSB as a result of having performed a rotate is entered to the carry flag 7
(CR2009).
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2100.D = TBIN (RRNCA (DM1100.D, 16))
Description of Operation The 8-digit BCD data currently stored in DM1100.D is rotated to the right without a carry
by 16 bits, the upper and lower words (upper 4 digits and lower 4 digits of the 8-digit
BCD) are swapped, and the result is converted to 32-bit BIN data and stored in
DM2000.D.
Ladder conversion CR2002 DM1100 #16 DM2100
LDA.D RRNCA.D TBIN.D STA.D
Always ON Operation destination device Return value
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBIN function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
*1 The return value can be omitted. When omitted, the conversion result is stored in internal
registers.
*2 When a device has been specified to n , operation is as follows when the value of n is
7 16 or more (when the operation destination device has a .U suffix) or 32 or more (when the
operation destination device has a .D suffix).
Data Shift Functions
In the case of a .U suffix instruction, the remainder value obtained by dividing the value of n
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S is rotated to the left by n without a carry, and the result is stored in R .
(1 bit cycle)
1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1
n times rotates
bit bit
15 0
0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 R :Return value
CR2009 (Carry) 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 S ・ S +1
1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1
n times rotates
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 R ・ R +1
CR2009 (Carry) 0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Shift Instructions."
Reference The state of the MSB as a result of having performed a rotate is entered to the carry flag 7
(CR2009).
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2100.D = TBIN (RLNCA (DM1100.D, 16))
Description of Operation The 8-digit BCD data currently stored in DM1100.D is rotated to the left without a carry by
16 bits, the upper and lower words (upper 4 digits and lower 4 digits of the 8-digit BCD)
are swapped, and the result is converted to 32-bit BIN data and stored in DM2000.D.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBIN function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
WSR ( [execution condition,] *1 operation destination device, number of operation range data, number of shifts)
ARITHMETIC OPERATION FUNCTIONS
7 *2 When a bit device has been specified, 16/32 continuous bits are handled.
When a relay other than the leading relay (e.g. R002, R1012) of the channel has been specified,
the relay is handled in16/32 bits straddling the next channel.
Data Shift Functions
Description of Operation
When the execution condition is established (TRUE), n1 data (16-bit/32-bit) stored in devices
starting from D is shifted to the right (towards the larger device No.) by n2 shifts.
"0" is stored in sections (devices) in the shift source range that do not straddle the shift destination range.
D 1000 0
D +1 2000 0
Store 0
0
0
n1
...
D + n2 1000
( D +1)+ n2 2000
8000
D + n1 -1 9000
...
n2
8000
( D + n1 -1)+ n2 9000
D +1 100000 D 0
D +3 200000 D +2 0
Store 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
● Example of format
WSR (R3000, DM1000.U, 32, 10)
R3000 WSR
DM1000 #32 #10
Execution condition
Conversion destination device
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"ANDA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Description of Operation
When the execution condition is established (TRUE), n1 data (16-bit/32-bit) stored in devices
starting from D is shifted to the left (towards the smaller device No.) by n2 shifts.
"0" is stored in sections (devices) in the shift source range that do not straddle the shift destination range.
D - n2 1000
( D +1)- n2 2000
n2
...
D 1000
D +1 2000
8000
( D + n1 -1)- n2 9000
n1
...
0
0
Store 0
8000 0
D + n1 -1 9000 0
( 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
Store 0
800000 0
D +2( n1 -1)+1 900000 D +2( n1 -1) 0
● Example of format
WSL (R3000, DM1000.U, 32, 10)
R3000 WSL
DM1000 #32 #10
Execution condition
Operation destination device
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"ANDA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
When a bit device has been specified, the LSB of n1 number of word devices is
destinationed for shifting. Bits other than the lowermost bit do not change.
*3 T, C, CR, CTC, CTH, Z, CM can not be used.
Description of Operation
When the execution condition is established (TRUE), the state of n1 devices starting from D is
shifted to the right (towards the larger device No.) by n2 shifts. When D is a word device, only
the LSB of each word device is targeted for shifting. (Bits other than the LSB do not change.)
"OFF" is stored in sections (LSB in the case of word devices) in the shift source range (device) that do
not straddle the shift destination range.
● Example of format
BSR (R3000, MR1002, 3, 4)
R3000 BSR.D
MR1002 #3 #4
Execution condition
Operation destination device
Add 0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Shift Instructions."
Sample Program
● When this function is used in combination with other functions
Programmed Script BSR (DM3000, EM3000, ANDA (EM3001, $F))
Description of Operation The state of the LSBs of the number of word devices specified by EM3000 starting from
DM3000 is shifted to the right by the count specified by the lower four bits (extracted) of
EM3001 at every scan (no execution condition).
"OFF" is stored in LSB of sections (devices) in the shift source range that do not straddle
the shift destination range. 7
straddles channels.
When a bit device has been specified, the LSB of n1 is targeted for shifting. Bits other than
the lowermost bit do not change.
*3 T, C, CR, CTC, CTH, Z, CM can not be used.
Description of Operation
When the execution condition is established (TRUE), the state of n1 devices starting from D is
shifted to the left (towards the smaller device No.) by n2 shifts. When D is a word device, only
the LSB of each word device is targeted for shifting. (Bits other than the LSB do not change.)
"OFF" is stored in sections (LSB in the case of word devices) in the shift source range (device) that do
not straddle the shift destination range.
"0" is stored in sections (devices) in the shift source range that do not straddle the shift destination range.
● Example of format
BSL (R3000, MR1009, 2, 3)
R3000 BSL.D
MR1009 #2 #3
Execution condition
Operation destination device
Add 0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Shift Instructions."
7-60 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
Point • When n2 = 0, the operation result does not change with before the operation was
executed.
• The function is not executed when either of the following conditions is established:
Sample Program
● When this function is used in combination with other functions
Programmed Script BSL (DM3000.B, EM3000, ANDA (EM3001, $F))
Description of Operation The state of the LSBs of the number of word devices specified by EM3000 starting from
DM3000.B is shifted to the left by the count specified by the lower four bits (extracted) of
EM3001 at every scan (no execution condition).
"OFF" is stored in LSB of sections (devices) in the shift source range that do not straddle
the shift destination range.
• Note that this function sometimes cannot be used depending on the argument of the
7
Reference
Limit
*1
Return value = LIMIT(Upper limit value, lower li mit value, input value)
ARITHMETIC OPERATION FUNCTIONS
channel leading relay (R002, R1012 etc.) are specified, it jumps to the next channel for 16/32 bit
processing.
• When specifying CTH, current value is processed. When using CTC, process setting value.
*3 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
Point • When using KV-1000, please use system macro "LIMITS" and "LIMITL".
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
Upper/lower limit control is performed for S3 via S2 and S1 , the result is stored in R .
Output value Output value
Upper limit
Input value
Input value
Lower limit
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Control Instructions."
@VM0 DM1000
LDA STA
Return value
@VM0 DM1100
LDA.D STA.D
Return value
Return value
*1
= BANDC ( Lower limit for dead band, upper limit for dead band, input value)
ARITHMETIC OPERATION FUNCTIONS
*2 • When a bit device has been specified, 16/32 continuous bits are handled. If relays other than
channel leading relay (R002, R1012 etc.) are specified, it jumps to the next channel for 16/32 bit
processing.
• When specifying CTH, current value is processed. When using CTC, process setting value.
*3 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
Point • When using KV-1000, please use system macro "BANDSS" and "BANDL".
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
Dead band control is performed for S3 via S2 and S1 , and the result is stored in R .
Output value Output value
Input value
Input value
7
limit value)
* The value with 16 bits symbol within the BIN data range is stored in R .
• R <=-32768→ R =-32768
• S1 : When dead angle (no output area) lower limit value is 32 bits (.L)
DM1100.L = BANDC(DM2010.L, DM2110, DM2210)
CR2002 #0 BANDC.L
LDA.D DM2010 DM2110 DM2210 @VM0
Always ON dead spots dead spots Input value
upper limit lower limit
@VM0 DM1100
LDA.L STA.L
Return value
* The value with 32 bits symbol within the BIN data range is stored in [ R +1].
• [ R R +1]<=-2147483648→[ R R +1]=-2147483648
• [ R R +1]>=+2147483647→[ R R +1]=+2147483647
ZONE
Return value
*1
= ZONE (Negative bias, positive bias, input value )
ARITHMETIC OPERATION FUNCTIONS
• When specifying CTH, current value is processed. When using CTC, process setting value.
*3 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
Point • ZONE function is special function of KV-5500/5000/3000. When using KV-1000, please
use system macro "BANDSS" " BANDL".
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
Zone control is performed for S3 via S2 and S1 , and the result is stored in R .
Output value Output value
Plus deviation
Input value
Input value
Negative deviation
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Control Instructions."
@VM0 DM1000
LDA.S STA.S
Return value
@VM0 DM1100
LDA.L STA.L
Return value
* The value with 32 bits symbol within the BIN data range is stored in [ R R +1].
• [ R • R +1]<=-2147483648→[ R • R +1]=-2147483648
• [ R • R +1]>=+214748364→[ R • R +1]=+2147483647
Linear approximation
*1
Return value = APR ( Input value, leading device of data table,
number of data records )
ARITHMETIC OPERATION FUNCTIONS
*4 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*5 The ".DF" suffix cannot be specified for device Z.
Point • When using KV-1000, please use system macro "APRS" "APRL" "APRF".
• The argument device ".DF" can be used in KV STUDIO Ver. 9.0 or later only.
• The argument device ".DF" can be specified with KV-7000 Series CPU units that have
CPU function version 2.0 or later only.
• The return value device ".DF" can be used in KV STUDIO Ver. 6.00 or later only.
• The return value device ".DF" can only be specified with KV-7000 Series CPU units,
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or later, and
with KV Nano Series base units.
"KV-7500/7300 CPU Function Version" (Page 2)
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
• S1 : When input value is 16 bits (.U /.S)
Linear approximation is performed for n data records of S1 starting from S2 .
S1 is searched according to the polyline data table range, and search result is used to perform
2-point polyline proximation. The result is stored in R .
Leading 1 S2 +2 S2 +3
of table
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 Please store the number of polyline data table records to (the number of records). In addition,
n shall take the value more than 2.
Polyline proximate calculation [ S1 • S1 +1] search (input value) is located in polyline data table
range, perform polyline proximate calculation at 2 points back and forth.
Calculation result is stored in [ R • R +1] (return value).
Y
(X 2 ,Y 2 ) (X 3 ,Y 3 ) Broken data form
Index X Y
YP
[ S2 ・ S2 +1 ] 0 0 10
(X 1 ,Y 1 ) Leading of table 1 8 13
2 14 20
(X 0 ,Y 0 )
(X 4 ,Y 4 ) (X 5 ,Y 5 ) 3 20 20 [ n ]
4 23 6
X
XP (X 6 ,Y 6 ) 5 26 6
Y 2 −Y 1 Number
YP = (X P−X 1)+Y 1
6 28 0
X 2 −X 1 of records
Polyline data table, please store in turn from the Device No. specified from (table head) according to
the sequence of (X0, Y0), (X1, Y1), (Xn-1, Yn-1), (Xn, Yn) [ S2 • S2 +1] Stands for the state of
devices in order from the specified device No.
[ n ] Please store the number of polyline data table records to (the number of records).
In addition,[ n ] please take 2 above.
Polyline proximate calculation [ S1 • S1 +1] search (input value) is located in polyline data table
range, perform polyline proximate calculation at 2 points back and forth.
Calculation result is stored in [ R • R +1] (return value).
YP [ S2 ・ S2 + 1 ] 0 0 5.2
Leading of table 1 3.3 6.8
(X 1 ,Y 1 ) 2 5.7 13.9
(X 0 ,Y 0 )
3 7.9 13.9 [ n ]
(X 4 ,Y 4 ) (X 5 ,Y 5 )
4 9.9 2.1
X
5 12.2 2.1
7 XP (X 6 ,Y 6 ) Number
6 15.5 0 of records
Y 2 −Y 1
YP = (X P−X 1)+Y 1
X 2 −X 1
Data Control Function
Polyline data table, please store in turn from the Device No. specified from (table head) according to
the sequence of (X0, Y0), (X1, Y1) … (Xn-1, Yn-1), (Xn, Yn) [ S2 • S2 +1] Stands for the state of
devices in order from the specified device No.
Please set X value of polyline data table according to ascending sequence.(X0 < X1 … < Xk … <Xn)
[ n ] Please store the number of polyline data table records to (the number of records).
In addition, [ n ] please take 2 above.
YP [ S2 ・ S2 +1 0 0 5.2
S2 + 2・ S2 +3 ] 1 3.3 6.8
(X 1 ,Y 1 ) Leading of table 2 5.7 13.9
(X 0 ,Y 0 )
3 7.9 13.9 [ n ]
(X 4 ,Y 4 ) (X 5 ,Y 5 )
4 9.9 2.1
X
5 12.2 2.1
7
XP (X 6 ,Y 6 ) Number
6 15.5 0 of records
Y 2 −Y 1
YP = (X P−X 1)+Y 1
X 2 −X 1
[ n ] Please store the number of polyline data table records to (the number of records).
In addition, [ n ] please take 2 above.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Control Instructions."
● Example of format
DM1000.S = APR(DM2000.S, DM2100, DM2200)
CR2002 APR.S
DM2000 DM2100 DM2200 @VMO
Always ON Number of
Input value Data table
leading device data recorels
@VM0 DM1000
LDA.S STA.S
Return value
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
7
Data Control Function
Ramp signal
RAMP ([execution condition,] *1 input value, change rate setting, time unit setting,
ARITHMETIC OPERATION FUNCTIONS
output value )
Argument/Return Supported Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S1 *2 Specifies the input value, or the device
Input value .S .S .S .S - - - -
storing the input value. (-32768 to 32767)
S2 Specifies the change rate per time unit, or
Change rate
*2 the device storing the change rate. (0 to .U .U .U .U - - - -
setting
65535)
S3 Time unit
*2 Specifies the time unit. (0 to 2) .U .U .U .U - - - -
setting *3
D *2 Stores the results of the input value plus the
Output value .S .S .S .S - - - - - -
inclination amount at the set interval.
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
7 at all times (at every scan).)
*2 • If a bit device is specified, 16 continuous bits are processed. When a channel other than the leading
Data Control Function
channel (R002, R1012, etc.) is specified, 16 bits are processed crossing to the next channel.
• When CTH is specified, the current value is processed. If CTC is used, the set value is processed.
• T, C, CTH, CTC and Z process the low-order 16 bits.
*3 Specify the time unit setting in the range of 0 to 2.
Explanation of S3 time unit setting
Value Time unit
0 1 second unit
1 1 minute unit
2 1 hour unit
Point • The RAMP function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution conditions are established (TRUE), the D (output value) is changed at the specified
inclination ( S2 (change rate setting/ S3 (time unit setting)) until it matches the S1 input value.
Value
S1
(Input value)
D
(Output value)
Time
Execution TRUE
conditions FALSE
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Control Instructions."
7-74 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
● Example of format
RAMP (MR1000, DM1000.S, DM2000.U, 1, EM1000.S)
MR1000 RAMP
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted 7
content, refer to "New a box script", step 5, (Page 2-10).
7 • When CTH is specified, the current value is processed. If CTC is used, the set value is
processed.
Data Control Function
Point • The TPOUT function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution conditions are established (TRUE), the D output relay turns ON for the S1
D ON
OFF
S1 ×1ms S1 ×1ms S1' ×1ms
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Control Instructions."
Point • The function is not executed when one of the following conditions is established.
• When S2 < S1
• When S2 =0
• An error within ±10μs+1 scan time occurs.
• When 0 is specified for S1 , the function does not turn ON 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 function cannot be used in an interrupt program or initialization module.
• Caution is required when using in a subroutine program, between the STP to STE
instructions, between the STG to JMP/ENDS instructions or between the CJ (NCJ) to
7
LABEL instructions.
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Lead-lag filter
7 leading channel (R002, R1012, etc.) is specified, 16 bits are processed crossing to the next
channel.
*3 • When CTH is specified, the current value is processed. If CTC is used, the set value is processed.
Data Control Function
Point • The LLFLT function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be used with KV-7000 Series CPU units, KV-5500/5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution conditions are established (TRUE), the lead-lag operation is executed for S
Description of D1 parameter
Device Description
Specifies the cycle time for executing the instruction. (1 to
D1 Sampling cycle (TS) 60000ms)
Specify the smaller value than Lag/Lead time.
Specifies the time constant for the lag element. (0 to 65535ms)
D1 +1 Lag time (T1)
Lag is disabled if 0 is specified.
Specifies the time constant for the lead element. (0 to 65535ms)
D1 +2 Lead time (T2)
Lead is disabled if 0 is specified.
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "LLFLT Instruction."
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
Point • If writing is attempted during RUN, the sampling cycle ( D1 +1) will be initialized, and
the output value ( D2 ) will be initialized with the input value ( S ).
• This function cannot be used in an interrupt program or initialization module.
• Caution is required when using in a subroutine program, between the STP to STE
instructions, between the STG to JMP/ENDS instructions or between the CJ (NCJ) to
LABEL instructions.
"KV-5500/5000/3000 Series User’s Manual "Cautions for using Timer Instruction""
"KV Nano Series User’s Manual "Cautions for using Timer Instruction""
• Caution is required when using write during RUN.
"KV-5500/5000/3000 Series User’s Manual "Writing during RUN"" 7
"KV Nano Series User’s Manual "Writing during RUN""
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
TransferBCD
*1
Return value = TBCD (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
7 versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
Data Conversion Functions
Description of Operation
The 16-bit BIN data stored in S is converted to 4-digit BCD (16-bit) data or 32-bit BIN data is
converted to 4-digit BCD (32-bit) data, and is stored in R .
S ˖Conversion 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
destination device
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
R ˖Return value 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
1 2 3 4
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
S S +1 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
12345678
BCD conversion
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
R R +1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
1 2 3 4 5 6 7 8
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
● Example of format
Point When the range 0 to 9999 is exceeded when S is 16 bits, or the range 0 to 99999999
is exceeded when it is 32 bits, the value of S is stored in R .
Sample Program
● To specify the bit device
Programmed Script
Description of Operation
DM2000.D = TBCD (MR1000.D)
The BIN data stored in MR1000.D is converted to 8-digit BCD (32-bit) data.
7
The conversion result is stored in DM2000.D.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
TransferBIN
*1
Return value = TBIN (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
7
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
Data Conversion Functions
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The 4-digit (16-bit) data stored in S is converted to 16-bit BIN data or 8-digit BCD (32-bit) data is
converted to 32-bit BIN data, and is stored in R .
S ˖Conversion 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
destination device
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
R ˖Return value 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
1234
S S +1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
1 2 3 4 5 6 7 8
BIN
conversion
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
R R +1 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
12345678
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
7-82 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
Sample Program
● To specify the bit device
Description of Operation The 8-digit BCD (32 -bit) data stored in MR1000.D is converted to BIN data.
The conversion result is stored in DM2000.D.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Multiplex
*1
Return value = MPX ( conversion destination device, conversion digit position)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 The number of digits 0 to 3 (4 bits/1 digit) is specified to the conversion digit position by a
constant. (Devices cannot be specified.)
*3 When 32-bit data has been specified to the conversion destination device, the lower 16 bits
7 (lower word) becomes the conversion destination (effective conversion digits).
*4 Even when a relay other than the leading relay (e.g. R1002 or R1005) of the channel for the bit
Data Conversion Functions
device has been specified for the conversion destination device, the function operates normally
straddling the next channel.
*5 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*6 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The 4 bits (0 digit to 3 digits) from n of the 16-bit data stored in S are converted to numbers
(0 to 15). The result of turning ON only the bit specified by the values after conversion to numbers is
stored in R .
Bit n (#1)
#3 #2 #1 #0
S ˖Conversion 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1
destination device
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
Sample Program
● To decode a bit device to 16-bit BIN data
Programmed Script DM2000 = MPX (MR1000.U, 3)
Description of Operation The value of the 3rd digit (four bits, bit 12 to bit 15) of the data stored in MR1000.U is
decoded, and result is stored in DM2000.
Ladder conversion
CR2002 MR1000 #3 DM2000
LDA MPX STA
AlwaysON Conversion destination device Return value
7
● When this function is used in combination with other functions
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBIN function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Demultiplex
*1
Return value = DMX (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When 32-bit data has been specified to the conversion destination device, the lower 16 bits
(lower word) becomes the conversion destination (effective bits).
*3 Even when a relay other than the leading relay (e.g. R1002 or R1005) of the channel for the bit
device has been specified for the conversion destination device, the function operates normally
straddling the next channel.
7 *4 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
Data Conversion Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The uppermost bit positions (0 to 15) in the ON bits of the 16-bit data stored in S is stored in
R as 16-bit (stored in lower four bits) data.
Ignore
F E D C B A 9 8 7 6 5 4 3 2 1 0
S ˖Conversion 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0
destination device
Because the highest bit
is 7 in bits ON (become 1),
R ˖Return value 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
so store 7 (0111 in binary) to R return value.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
DM2000 = DMX (DM1000)
CR2002 DM1000 DM2000
LDA DMX STA
Always ON Operation destination device Return value
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
7 Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
Data Conversion Functions
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The 16-bit or 32-bit BIN data stored in S is converted to gray code, and is stored in R .
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
DM2000.U = GRY (DM1000.U)
CR2002 DM1000 DM2000
LDA GRY STA
Always ON Conversion destination device Return value
bit
Decimal
16 15 14 13 12 9 8 7 6 5 4 3 2 1 0
7
Sample Program
● Example of use
The GRY function is used, for example, to output the current value as it is as gray code as it can
convert BIN data specified by the conversion destination device to gray code.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
7 Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
Data Conversion Functions
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The gray code stored in S is converted to 16-bit or 32-bit BIN data, and is stored in R .
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
DM2000.U = RGRY (DM1000.U)
CR2002 DM1000 DM2000
LDA RGRY STA
Always ON Conversion destination device Return value
7
Sample Program
● Example of use
The RGRY function is used, for example to input the current value of the gray code as it is as BIN data
as it can convert gray code specified by the conversion destination device to BIN data.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Disperse N
continuous bits are handled. When a relay other than the leading relay (e.g. R002, R1012) of the
channel has been specified, the relay is handled straddling the next channel.
When a word device has been specified, S 1/2 continuous words are handled. D 4/8
continuous words are handled.
*3 Postfix of S data specified, .U or .B specifies 0 to 4; .D specifies 0 to 8.
*4 CTC, CTH, Z can not be specified.
Description of Operation
When the execution condition is established (TRUE),data in S is dispersed in n halfwidth
charaters (4-bit) data, the result is stored in D .
4 bit upper stored 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
n
0 0 0 2 ˖ D +2
0 0 0 1 ˖ D +3
S +1 1 2 3 4 5 6 7 8 ˖ S
bit bit bit bit
0 0 0 8 ˖ D
0 0 0 7 ˖ D +1
0 0 0 6 ˖ D +2
0 0 0 5 ˖ D +3
n
0 0 0 4 ˖ D +4
0 0 0 3 ˖ D +5
0 0 0 2 ˖ D +6
0 0 0 1 ˖ D +7
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series 7
Instruction Reference Manual, "Data Conversion Instructions."
UniteN
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
7 *2 When a bit device has been specified, S 64/128 continuous bits are handled.
continuous bits are handled. When a relay other than the leading relay (e.g. R002, R1012) of the
D 16/32
Data Conversion Functions
channel has been specified, the relay is handled straddling the next channel.
When a word device has been specified, S 4/8 continuous words are handled. D 1/2
words are handled.
*3 Postfix of S data specified, .U or .B specifies 0 to 4; .D specifies 0 to 8.
*4 CTC, CTH, Z can not be specified.
Description of Operation
When the execution condition is established (TRUE), lower 4 bits of data stored in devices starting
from S are united to n BIN data, the result is stored in D .
5 㧦
5
㧦
P
5
㧦
5 㧦
& 㧦
5 㧦
5 㧦
5
㧦
P
5
㧦
5 㧦
5 㧦
5 㧦
& 㧦 㧦 &
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see
Instruction Reference Manual, "Data Conversion Instructions."
KV-7000/5000/3000/1000 Series and KV Nano Series
7
Disperse B
D Disperse data
Specify the leading device storing Handled as same
storage type as S .
- - - - - ƻ -
*2 disperse byte data.
device *4
n Number of Specify the number of byte data to be
*3 .U .U .U .U - - - - - ƻ -
disperse data dispersed.
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
7 *2 When a bit device has been specified, S 16/32 continuous bits are handled. D 32/64
continuous bits are handled. When a relay other than the leading relay (e.g. R002, R1012) of the
Data Conversion Functions
channel has been specified, the relay is handled straddling the next channel.
When a bit device has been specified, S 1/2 continuous words are handled. D 2/4
words are handled.
*3 Postfix of S data specified, .U or .B specifies 0 to 2; .D specifies 0 to 4.
*4 CTC, CTH, Z can not be specified.
Description of Operation
When the execution condition is established (TRUE), data in S is dispersed in n half-width
characters (8-bit) data, the result is stored in D .
8 bit upper stored 0.
S ˖ 1 2 3 4
D ˖ 0 0 3 4
n
D +1 ˖ 0 0 1 2
S +1˖ 1 2 3 4 5 6 7 8 ˖ S
D ˖ 0 0 7 8
D +1 ˖ 0 0 5 6
n
D +2 ˖ 0 0 3 4
D +3 ˖ 0 0 1 2
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
7
DISB (R3000, DM1000.U, DM2000, DM2100.U)
UniteB
UNIB ([execution condition,] *1 Opera tion destination device, unite data store
device, number of data to be united )
ARITHMETIC OPERATION FUNCTIONS
channel has been specified, the relay is handled straddling the next channel.
When a word device has been specified, S 2/4 continuous words are handled. D 1/2
words are handled.
*3 Postfix of S data specified, .U or .B specifies 0 to 2; .D specifies 0 to 4.
*4 CTC, CTH, Z can not be specified.
Description of Operation
When the execution condition is established (TRUE), lower 8 bits of data stored in devices starting
from S are united to n BIN data, the result is stored in D .
5 㧦
P
5
㧦
& 㧦
5 㧦
5 㧦
& 㧦 㧦 &
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format 7
UNIB (R3000, DM1000.U, DM2000, DM2100.U)
Swap
Return value
*1
=SWAP (Exchange destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the exchange result is stored in internal registers.
*2 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
7 Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
Data Conversion Functions
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The value of high byte (high 8-bit) of 16 bit data and lower byte (low 8-bit) in S stores the result to R .
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
DM2000.U = SWAP (DM1000.U)
CR2002 DM1000 DM2000
LDA SWAP STA
Always ON Swap destination device Return value
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBCD function" 7
• The KV script is converted to a ladder program before execution. To check the
Block swap
BSWAP ([execution condition,] *1 swap destination device, number of target data items )
ARITHMETIC OPERATION FUNCTIONS
• The BSWAP function can be used only with KV STUDIO Ver. 6.00 or higher.
7 Point
• This function can only be specified with KV-7000 Series CPU units, KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Data Conversion Functions
Description of Operation
When the execution conditions are established (TRUE), the high-order bytes (high-order 8 bytes) and
low-order bytes (low-order 8 bytes) of the n number of target data items starting with the D
D + n -2 ST UV UV ST D + n -2
D + n -1 WX YZ YZ WX D + n -1
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
BSWAP (MR1000, DM2000, 4)
MR1000 BSWAP
DM2000 #4
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
8-bit decode
- - - -
of bits within range 1 to 8) to convert. .U .U .U .U
*4
destination range
R Return value None - - - - - - - - - - -
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 When a word device has been specified, the LSB of continuous 2n number of word devices
7 becomes the decode result store destination. (Bits other than the LSB do not change.)
*3 CTC, CTH, Z can not be specified.
Data Conversion Functions
*4 A device can be specified for the conversion target range only when the following conditions are
satisfied.
• When the KV STUDIO version is Ver. 6.00 or higher
• Only when the compatible model is a KV-7000 Series CPU unit, a KV-5500/5000/3000 Series
CPU unit that have CPU function version 2.0 or higher, or a KV Nano Series base unit.
Description of Operation
When the execution condition is established (TRUE), the states of the number of devices (number of
bits) specified by the n starting from S is converted to a numerical value (0 to 255). For 2 n
bit devices starting from D , the device with "leading No. + numerical value" is ON, and other
devices are turned OFF.
When the S is a word device, n indicates the number of bits to convert to numerical values,
and when the store destination device is a word device, of the word devices of continuous 2 n
number of conversion destination ranges starting from the specified device, the LSB of the "leading
No. + (nth) value obtained after conversion to numerical value" device is turned ON, and the LSB of all
other devices turns OFF. (Bits other than the LSB do not change.)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
Sample Program
● When this function is used in combination with other functions
Programmed Script DECO (ORA (DM3000, DM3001), MR3000, 5)
Description of Operation The lower five bits of the result of ORing the data currently stored in DM3000 and
DM3001 is decoded at every scan (no execution condition).
Of 25 continuous devices starting from MR3000, the "leading No. + (nth) value obtained
after conversion to numerical value" device is turned ON, and all other devices turn OFF. 7
8-bit encode
*1
Return value = ENCO (conversion destination device, number of conversion
ARITHMETIC OPERATION FUNCTIONS
destination ranges)
Argument/Return Supported Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Conversion
Specifies the leading device of the
destination - - - - - - .B - - -
*2 range to convert.
device *3
n Number of
Specifies the number of ranges *5 *5 *5 *5
conversion
(number of bits within range 1 to 256) .U .U .U .U - - - - *5
destination
to convert.
ranges
*6
*4
R Return value .U type ENCO function available .U .S .D .L .F .DF - - - -
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
7 *2 When a word device has been specified, the LSB of continuous n number of word devices
is targeted for encoding.
Data Conversion Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
States of n devices (number of bits) starting from S , the position (0 to 255) of the smallest ON
bit device are stored in R as 16-bit data.
When S is a word device, n indicates the number of words (devices), and the number of
devices specified by the number of conversion destination ranges, the position (0 to 255) of the
smallest word device whose LSB is ON is stored in R as 16-bit data.
R Return value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Conversion Instructions."
● Example of format
DM2000.U = ENCO (MR1000, 8)
CR2002 MR1000
ENCO
DM2000
STA
7
Always ON #8 Return value
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.U = TBCD (ENCO (MR3000, 32))
Description of Operation Of 32 bit devices (MR3000 to MR3115) starting from MR3000, the position (16-bit data)
of the smallest ON device is converted to 4-digit BCD data and stored in DM2000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBCD function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Uconversion
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
• TOU
The data stored in S is converted to unsigned 16-bit BIN data, and the result is stored in R .
Reference • When 32-bit BIN data has been specified, the lower 16 bits are targeted for conversion.
• When single/double precision floating point type real number has been specified as
the conversion destination data, the lower 16 bits of the result after having converted
to unsigned 32-bit BIN data is targeted for conversion.
• Set the suffix of the device for storing the return value to .U .
• TOS
The data stored in S is converted to signed 16-bit BIN data, and the result is stored in R .
Reference • When 32-bit BIN data has been specified, the lower 16 bits are targeted for conversion.
• When single/double precision floating point type real number has been specified as
the conversion destination data, the lower 16 bits of the result after having converted
to signed 32-bit BIN data is targeted for conversion.
• Set the suffix of the device for storing the return value to .S.
7-108 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
• TOD
The data stored in S conversion destination device is converted to unsigned 32-bit BIN data,
and the result is stored in R return value.
• TOL
The data stored in S is converted to signed 32-bit BIN data, and the result is stored in R .
Reference • When 16-bit BIN data has been specified to the conversion destination data, the 32-
bit data of the result of having extended the data is targeted for conversion.
• When single/double precision floating point type real number has been specified as
the conversion destination data, the result after having converted to signed 32-bit 7
BIN data is targeted for conversion.
● Example of format
DM2000.L = TOL (DM1000.S)
CR2002 DM1000 DM2000
LDA.S EXT.S STA.L
Always ON Conversion destination device Return value
Sample Program
The operation formula programmed by the script is operated on as signed 32-bit data (.L).
When converting to a ladder from script, and the suffix of the device to substitute (store) the operation
result is other than ".L", the type conversion alarm is generated.
To avoid the type conversion warning, use each of the "TOU, TOS, TOD, TOL" functions to convert the
operation result to the same type as the device to substitute.
● When the type of the device for substituting the operation result is unsigned 32-bit data ".D"
Programmed Script DM1000.D = TOD ((DM2000 + 50) * DM2100 + 10)
Description of Operation The operation result (operated on by .L) of the right side of "=" is converted to unsigned
32-bit data ".D", and substituted (stored) to DM1000.D on the left side.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
Data Conversion Functions
Point • The CPMSET function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution conditions are established (TRUE), the data stored in the S1 input data storage
destination device is added after the data size (byte unit) stored in the D output data storage
destination device. The data is saved with the type specified with the high-order 4 bits of the S2
parameter, and the data size (byte unit) specified with the low-order 12 bits.
When adding data for the first time, 0 is stored in the D output data storage destination device
before the function is executed.
The CPMSET function is a function for creating CIP data type text string data and numeric data.
Refer to "KV Ethernet/IP User's Manual" for details on the CIP data types.
bit bit
15 0
S2
Data type Data size (byte unit)
7
storage Specifies the leading device for storing the
.U .S .D .L .F .DF .B .T - -
designation retrieved data.
*2
device
Data Conversion Functions
*1 "[ ]" can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 When specifying a bit device, specify the leading device of the channel.
Point • The CPMGET function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution conditions are established (TRUE), the data following the offset position specified
with the D1 receive data offset of the receive data stored in the S1 input data storage
designation device is stored in the D2 output data storage destination device. The data is stored
with the data type specified with the high-order 4 bits of the S2 parameter and the data size (byte
unit) specified with the low-order 12 bits of the S2 parameter. The D1 receive data offset is
updated after the data is stored.
The CPMGET function is used to retrieve the text string data and numeric data of the received CIP data type.
Refer to "EtherNet/IP Function User's Manual" for details on the CIP data types.
bit bit
15 0
S2
Data type Data size (byte unit)
Receive data
S1 +0 Data size (Byte unit) Receive data offset* *
D1
S1 +1 Retrieved data
S1 +2 D2 +0
S1 +3 D2 +1
S1 +4
S1 +5
D2 +2
7
● Example of format
CPMGET (MR0, EM2000, $1003, DM1000, DM2000)
MR000 CPMGET
EM2000 $1003 DM1000 DM2000
Return value
*1
= FLOAT (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When the type other than .F is specified by return value, type conversion will be automatically
conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
7 Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
Floating Point Functions
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The binary data (16-bit/32-bit (unsigned/signed), double precision floating point type real type data)
stored in S conversion destination device is converted into single precision floating point type
real number data, and the results are stored in the R return value.
16-bit BIN data Single precision floating point type real number
16 bits 32 bits
32-bit BIN data Single precision floating point type real number
32 bits 32 bits
• S : When the type of conversion destination device is double precision floating point type real number
bit
63
S +3 S +2 S +1 S bit
0
bit
32
R +1 R bit
0
64 bits 32 bits
● Example of format
Point When S integer value exceeds -16777216 to 16777215 (24-bit BIN system) range,
the 25th bit onwards is rounded.
Sample Program
● Example of use
Programmed Script DM2000.F = FLOAT (DM1000.U + 123)
7
The operation result of DM1000.U+123 is converted to single precision floating point
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Fconversion
*1 When the type other than .F is specified by return value, type conversion will be automatically
conducted during conversion.
*2 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
7 versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
Floating Point Functions
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The data stored in S is converted to single precision floating point type real number data, and the
result is stored in R .
"FLOAT function"
● Example of format
DM2000.F = TOF (DM1000.D)
CR2002 DM1000 DM2000
LDA.D FLOAT.D STA.F
Always ON Conversion destination device Return value
Reference • The conversion destination data is converted into 32-bit single precision floating point
type real number with the FLOAT instruction corresponding to the data type (16-bit/32-
bit (unsigned/signed)).
• If the conversion destination data is a double precision floating point type real number,
it is converted into 32-bit single precision floating point type real number by the DFTOF
instruction.
• The .F suffix must be specified to the device for storing the return value.
Return value
*1
= DFLOAT (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in 64-bit internal
registers.
*2 When the type other than .DF is specified by return value, type conversion will be automatically
conducted during conversion.
Point • The DFLOAT function can be used only with KV STUDIO Ver. 6.00 or higher.
Floating Point Functions
• This function can only be used with KV-7000 Series CPU units, KV-5500/5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The binary data (16-bit/32-bit (unsigned/signed), single precision floating point type real type data)
stored in S conversion destination device is converted into double precision floating point type
real number data, and the results are stored in the R return value.
32-bit BIN data Double precision floating point type real number
32 bits 64 bits
• S : When the type of conversion destination device is single precision floating point type real
number
bit bit bit bit
31 S +1 S 0 63 R +3 R +2 R +1 R 0
Single precision floating point type real number Double precision floating point type real number
32 bits 64 bits
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
DF conversion
*1 When the type other than .DF is specified by return value, type conversion will be automatically
conducted during conversion.
*2 The ".DF" suffix cannot be specified for device Z.
Point • The TODF function can be used only with KV STUDIO Ver. 6.00 or higher.
7 • This function can only be used with KV-7000 Series CPU units, KV-5500/5000/3000
Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
Floating Point Functions
Description of Operation
The data stored in S is converted to double precision floating point type real number data, and
the result is stored in R .
"DFLOAT function"
● Example of format
DM2000.DF = TODF (DM1000.S)
CR2002 DM1000 DM2000
LDA.S DFLOAT.S STA.DF
Reference • The conversion destination data is converted into 64-bit double precision floating point
type real number with the DFLOAT instruction corresponding to the data type (16-bit/
32-bit (unsigned/signed), single precision floating point type real number).
• The .DF suffix must be specified to the device for storing the return value.
Integer conversion
Return value
*1
= INTG (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 C, T, CTC, CTH, Zcan not be used.
*3 When the type other than .L is specified by return value, type conversion will be automatically
conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
7 Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
Floating Point Functions
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• The range of the single precision floating point type real number is shown below.
Description of Operation
The single/double precision floating point type real number data stored in S is converted to
signed 32-bit BIN data, and the result is stored in R .
• S : When the type of conversion destination device is single precision floating point type real number
bit bit
31 S +1 S 0 R +1 R
Single precision floating point type real number Signed 32-bit binary data
32 bits 32 bits
• S : When the type of conversion destination device is double precision floating point type real number
bit bit
63 S +3 S +2 S +1 S 0 R +1 R
Double precision floating point type real number Signed 32-bit binary data
64 bits 32 bits
7-122 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
● Example of format
Point • When S is outside the single precision floating point type real number range, or
when the converted data is outside the 16-/signed 32-bit BIN range, the bit pattern of is
stored in R .
• When S is outside the double precision floating point type real number range, or
when the converted data is outside the 16-/signed 32-bit BIN range, the lower 32-bit
pattern of is stored in R .
7
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Integer conversion
Return value
*1
= INT (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 C, T, CTC, CTH, Zcan not be used.
*3 When the type other than .L is specified by return value, type conversion will be automatically
conducted during conversion.
7 *4 The ".DF" suffix cannot be specified for device Z.
Floating Point Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
This function is similar to "INTG function" except function name is different.
Disperse F
7 *2
at all times (at every scan).)
When a bit device has been specified, 32 continuous bits are handled. When a relay other than
Floating Point Functions
the leading relay (e.g. R002, R1012) of the channel has been specified, the relay is handled
straddling the next channel.
*3 The constant setting is the range of floating real numbers.
*4 C, T, CTC, CTH, Zcan not be used.
Point Refer to the "INTG function" for details on the range of the single precision floating
point type real number.
Description of Operation
When the execution condition is established (TRUE), the mantissa section and exponent section of the
32-bit single precision floating point type real number of S are dispersed, the mantissa section is
stored as signed 32-bit BIN data to the specified D1 , and the exponent section is stored as signed
16-bit BIN data to the specified D2 .
D1 +1 D1
Sǂ+1 S Mantissa part: Signed 32-bit binary data
Single precision floating point type real number Spilit 32 bits (2 words)
32 bits (2 words)
D2
Exponent part: Signed 16-bit binary data
Separate example for ˉ1.234×10嘑嘓
16 bits (1 word)
Mantissa Exponent
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
Point • With the DISF function, an error sometimes occurs as single precision floating point
type real number (BIN) are being converted to a mantissa section (decimal) and an
exponent section (decimal).
• The function is not executed when the data to disperse is outside the single precision
floating point type real number range.
Sample Program
● When this function is used in combination with other functions
7
Programmed Script DISF (LOG (DM3000.F), EM3000.L, EM3100)
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"LOG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
UniteF
Return value
*1
= UNIF (mantissa store device, exponent store device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal
registers.
*2 When a bit device has been specified, 32 continuous bits are handled. When a relay other than
the leading relay (e.g. R002, R1012) of the channel has been specified, the relay is handled
7 straddling the next channel.
*3 When the type other than .F is specified by return value, type conversion will be automatically
Floating Point Functions
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The signed 32-bit BIN data of S1 is taken as the mantissa, and the signed 16-bit BIN data of S2
are united, and the resulting 32-bit single precision floating point type real number value is stored in
R .
S1 +1 S1
Mantissa: Signed 32-bit binary data
R +1 R
32 bits (2 words)
Merge Single precision floating point type real number
S2 32 bits (2 words)
16 bits (1 word)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
Point • With the UNIF function, an error sometimes occurs as a mantissa section (DEC) and
an exponent section (DEC) are being converted to single precision floating point type
real number (BIN).
• When the operation result is outside the single precision floating point type real number
range, "0" is stored in .
7
R
Sample Program
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"EXP function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= EXP (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The exponent function value is obtained using the exponent of the single precision floating point
type real number stored in the [ S +1• S ] conversion destination device.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
bit bit
63 S +3 S +2 S +1 S 0
bit
63 R +3 R +2 R +1 R bit
0
Point When the value to operate on or the operation result is outside the single precision
floating point type real number range, the value of S is stored in R .
Sample Program
● Example of use 7
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"FLOAT function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= LOG (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The natural logarithm of the single precision floating point type real number stored in
[ S +1• S ] conversion destination device is obtained.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
Single precision floating point type real number Single precision floating point type real number
Log 32 bits 32 bits
Double precision floating point type real number Double precision floating point type real number
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
● Example of format
Point When the value to be operated on is 0 or a minus value, or the operation result is outside
the single precision floating point type real number range, the value of S is stored in
R .
Sample Program
● When this function is used in combination with other functions
7
Programmed Script DM2000.L = INTG (LOG (DM1000.F)
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"INTG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Log10
Return value
*1
= LOG10 (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
Point • The LOG10 function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The constant logarithm of the single precision floating point type real number stored in
[ S +1• S ] conversion destination device is obtained.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
7
Radian
Return value
*1
= RAD ( conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
Point • The LOG10 function can be used only with the KV STUDIO Ver. 6.00 or higher.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The angle (° unit) of the single precision floating point type real number stored in [ S +1• S ]
conversion destination device is converted into a radian angle.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
Single precision floating point type real number
32 bits
Single precision floating point type real number
32 bits
rad
• When S : conversion destination device suffix is .DF
The angle (° unit) of the double precision floating point type real number stored in
[ S +3• S +2• S +1• S ] conversion destination device is converted into a radian angle.
The results become the 64-bit double precision floating point type real number, and are stored in the
[ R +3• R +2• R +1• R ] return value.
bit bit bit bit
63
S +3 S +2 S +1 S 0 63
R +3 R +2 R +1 R 0
Point When the value to operate on is outside the single precision floating point type real
number range, the value of S is stored in R .
Sample Program
● Example of use 7
Programmed Script DM2000.F = RAD (DM1000.D)
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Degree
Return value
*1
= DEG ( conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The angle (radian unit) of the single precision floating point type real number stored in [ S +1• S ]
conversion destination device is converted into degree (°) unit.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
Single precision floating point type real number rad Single precision floating point type real number
32 bits 32 bits
• When S : conversion destination device suffix is .DF
The angle (radian unit) of the double precision floating point type real number stored in
[ S +3• S +2• S +1• S ] conversion destination device is converted into degree (°) unit.
The results become the 64-bit double precision floating point type real number, and are stored in the
[ R +3• R +2• R +1• R ] return value.
bit bit bit bit
63
S +3 S +2 S +1 S 0 63
R +3 R +2 R +1 R 0
Double precision floating point type real number rad Double precision floating point type real number
64 bits 64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
7-138 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
Reference Angle (°) and radian (rad) are calculated as follows:
Point When the value to operate on is outside the single precision floating point type real
number range, the value of S is stored in R .
Sample Program
● When this function is used in combination with other functions 7
DM2000.L = INTG (DEG (DM1000.F))
Description of Operation Convert the angle (arc) of single precision floating point type real number stored in
DM1000.F to degree (°), convert the result to 32 bit, signed BIN data, then store it in
DM2000.L.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"INTG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Sine
Return value
*1
= SIN (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher versions.
Floating Point Functions
Point
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
• The range of the single precision floating point type real number which can be handled
with this function is as follows:
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The sine (SIN) value of the single precision floating point type real number angle (radian unit) stored
in [ S +1• S ] conversion destination device is obtained.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
Single precision floating point type real number Single precision floating point type real number
SIN 32 bits 32 bits
SIN Double precision floating point type real number Double precision floating point type real number
64 bits 64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
7
● Example of format
Point When the value to be operated on is outside the single precision floating point type real
number range that can be handled by the SIN function, the value of S is stored in
R .
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.F = SIN (RAD (DM1000.F))
Description of Operation The angle (° unit) of the single precision floating point type real number stored in
DM1000.F is converted to radian unit, and the sine value is calculated and the result is
stored in DM2000.F.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RAD function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Cosine
Return value
*1
= COS (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Floating Point Functions
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• The range of the single precision floating point type real number which can be handled
with this function is as follows:
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The cosine (COS) value of the single precision floating point type real number angle (radian unit)
stored in [ S +1• S ] conversion destination device is obtained.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
COS Single precision floating point type real number Single precision floating point type real number
32 bits 32 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
7
● Example of format
Point When the value to be operated on is outside the single precision floating point type real
number range that can be handled by the COS function, the value of S is stored in
R .
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.F = COS (RAD (DM1000.F))
Description of Operation The angle (° unit) of the single precision floating point type real number stored in
DM1000.F is converted to radian unit, and the cosine value is calculated and the result is
stored in DM2000.F.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RAD function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Tangent
Return value
*1
= TAN (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Floating Point Functions
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• The range of the single precision floating point type real number which can be handled
with this function is as follows:
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The tangent (TAN) value of the single precision floating point type real number angle (radian unit)
stored in [ S +1• S ] conversion destination device is obtained.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
Single precision floating point type real number Single precision floating point type real number
TAN 32 bits 32 bits
7-144 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
• When S : conversion destination device suffix is .DF
The tangent (TAN) value of the double precision floating point type real number angle (radian unit)
stored in [ S +3• S +2• S +1• S ] conversion destination device is obtained.
The results become the 64-bit double precision floating point type real number, and are stored in the
Double precision floating point type real number Double precision floating point type real number
TAN 64 bits 64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
7
● Example of format
Point When the value to be operated on is outside the single precision floating point type real
number range that can be handled by the TAN function, the value of S is stored in
R .
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.F = TAN (RAD (DM1000.F))
Description of Operation The angle (° units) of the single precision floating point type real number stored in
DM1000.F is converted to radian unit, and the tangent value is calculated and the result
is stored in DM2000.F.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RAD function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Arc sine
Return value
*1
= ASIN (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Floating Point Functions
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The angle (radian unit) is calculated from the sine (SIN) value of the single precision floating point
type real number angle stored in [ S +1• S ] conversion destination device.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
ASIN Single precision floating point type real number Single precision floating point type real number
32 bits 32 bits
• When S : conversion destination device suffix is .DF
The angle (radian unit) is calculated from the sine (SIN) value of the double precision floating point
type real number stored in [ S +3• S +2• S +1• S ] conversion destination device.
The results become the 64-bit double precision floating point type real number, and are stored in the
[ R +3• R +2• R +1• R ] return value.
bit bit bit bit
63 S +3 S +2 S +1 S 0 63 R +3 R +2 R +1 R 0
ASIN Double precision floating point type real number Double precision floating point type real number
64 bits 64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
7-146 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
Reference Angle (°) and radian (rad) are calculated as follows:
Point When the value to operate on is outside of the range -1.0 to 1.0, the value of S is
stored in R .
Sample Program
● When this function is used in combination with other functions
7
Programmed Script DM2000.F = DEG (ASIN (DM1000.F))
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"DEG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Arc cosine
Return value
*1
= ACOS (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Floating Point Functions
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The angle (radian unit) is calculated from the cosine (COS) value of the single precision floating
point type real number angle stored in [ S +1• S ] conversion destination device.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
ACOS Single precision floating point type real number Single precision floating point type real number
32 bits 32 bits
• When S : conversion destination device suffix is .DF
The angle (radian unit) is calculated from the cosine (COS) value of the double precision floating
point type real number stored in [ S +3• S +2• S +1• S ] conversion destination device.
The results become the 64-bit double precision floating point type real number, and are stored in the
[ R +3• R +2• R +1• R ] return value.
bit bit bit bit
63 S +3 S +2 S +1 S 0 63 R +3 R +2 R +1 R 0
ACOS Double precision floating point type real number Double precision floating point type real number
64 bits 64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
Point When the value to operate on is outside of the range -1.0 to 1.0, the value of S is
stored in R .
Sample Program
● When this function is used in combination with other functions 7
Programmed Script DM2000.F = DEG (ACOS (DM1000.F))
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"DEG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Arc tangent
Return value
*1
= ATAN (operation destination device)
ARITHMETIC OPERATION FUNCTIONS
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Floating Point Functions
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When S : conversion destination device suffix is .U/.S/.D/.L/.F
The angle (radian unit) is calculated from the tangent (TAN) value of the single precision floating
point type real number angle stored in [ S +1• S ] conversion destination device.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S +1 S R +1 R
ATAN Single precision floating point type real number Single precision floating point type real number
32 bits 32 bits
ATAN Double precision floating point type real number Double precision floating point type real number
64 bits 64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
7-150 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
Reference Angle (°) and radian (rad) are calculated as follows:
Point When the value to operate on is outside the single precision floating point type real
number range, the value of S is stored in R .
Sample Program
● When this function is used in combination with other functions 7
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"DEG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Arc tangent2
Return value
*1
= ATAN2 (operation destination device 1, operation destination device 2)
ARITHMETIC OPERATION FUNCTIONS
Point • The ATAN2 function can be used only by KV STUDIO ver.9.0 or later.
• Can be specified with KV-7000 Series CPU units that have CPU function version 2.0 or later only.
"KV-7500/7300 CPU Function Version" (Page 2)
• Refer to the "INTG function" for details on the range of the single precision floating
point type real number and double precision floating point real number.
Description of Operation
• When the S1 conversion destination device 1 and S2 conversion destination device 2 suffix is .U/.S/.F
The angle (radian unit) on the single precision floating point type real number X axis is calculated
from the Y coordinate, a single precision floating point type real number converted from the value
specified with [ S1 +1· S1 ] conversion destination device 1, and the X coordinate, a single
precision floating point type real number converted from the value specified with [ S2 +1· S2 ]
conversion destination device 2.
The results become the 32-bit single precision floating point type real number, and are stored in the
[ R +1• R ] return value.
S2 +1 S2 S1 +1 S1 R +1 R
Single precision floating point type real number , Single precision floating point type real number Single precision floating point type real number
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Floating Point Instructions."
7-152 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
Reference The ATAN instruction uses the TAN value to find the angle up to -π/2(rad) < R < π/2(rad).
The ATAN2 instruction uses coordinates (S2, S1) to find the angle up to -π(rad)< R ≦
π(rad).
S1
R
S2 X
● Example of format 7
DM2100.F = ATAN2 ( DM1100.F, DM1102.F )
Point When the value to operate on is outside the single precision floating point type real
number range, the R value is not converted.
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.F = DEG ( ATAN2 ( DM1000.F, DM1002.F ) )
Description of Operation The angle (radian units) on the X axis is calculated from the single precision floating
point type real number X coordinate stored in DM1000.F and the single precision floating
point type real number Y coordinate stored in DM1002.F, and the result is converted to
degree (°) units and stored in DM2000.F.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"DEG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= ASC (conversion destination device )
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the conversion result is stored in internal
registers.
*2 Even when a relay other than the leading relay (e.g. R1002 or R1005) of the channel for the bit
device has been specified for the conversion destination device, the function operates normally
straddling the next channel.
*3 When the type other than .U is specified by return value, type conversion will be automatically
7 conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
Functions
Text Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
Description of Operation
The value of the lower eight bits of the BIN data stored in S is converted to HEX annotation ASCII
text code, and the result is stored in R .
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 S
conversion
0 0 A 5
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
After 0 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 R
convertion
4 1 3 5
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
● Example of format
DM2000.U = ASC (DM1000.U)
CR2002 DM1000 DM2000
LDA ASC STA
Always ON Conversion destination device Return value
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SRA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Text Processing
Functions
Return value
*1
= RASC (conversion destination device )
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the conversion result is stored in internal
registers.
*2 Though 32-bit data also can be used for the conversion destination data, only the lower 16 bits
are targeted for conversion.
*3 Even when a relay other than the leading relay (e.g. R1002 or R1005) of the channel for the bit
7 device has been specified for the conversion destination device, the function operates normally
straddling the next channel.
Functions
Text Processing
*4 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*5 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The HEX annotation ASCII text code (two characters worth) of the 16 bits stored in S are
converted to BIN data, the 16-bit data (lower eight bits are the conversion value, and the upper eight
bits are "0") of the result is stored in R .
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 S
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 R
conversion
0 0 6 C
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on ASCII codes, see "ASCII Code Table", Page A-45
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
● Example of format
DM2000.U = RASC (DM1000.U)
CR2002 DM1000 DM2000
LDA RASC STA
Always ON Conversion destination device Return value
Sample Program 7
Text Processing
Functions
● When this function is used in combination with other functions
Programmed Script DM2000.U = RASC (SWAP (DM1000))
Description of Operation The values of the upper byte (upper eight bits) and the lower byte (lower eight bits) of the
HEX annotation ASCII text code currently stored in DM1000 are swapped.
As a result of the swap, the bytes are converted to 16-bit BIN data, and the result is
stored in DM2000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SWAP function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= DASC (conversion destination device, conversion parameter)
ARITHMETIC OPERATION FUNCTIONS
Point The function might not operate correctly when a value outside of the range is specified to
the conversion parameter.
Description of Operation
The BIN data stored in S1 is converted to DEC ASCII code text string according to the S2 , and
the result is stored in R .
R +2 ten one
N
R +3 U
L
(00H)
R +3 thousand hundred
R
+4
+5
N
U
ten
L
(00H)
one
7
Text Processing
Functions
Store 00H in last No change before and
bit automatically. after command perform.
R +4 hundred ten
N
R +5 one U
L
(00H)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
VM2 VM0
Always ON
MOV
#00000 VM2
MOV.D
VM0 @VM2
CR2002 MOV
CR2814 @VM0
Always ON
ASCII Conversion zero suppression setting
#3 CR2814
LDA STA
ASCII Conversion zero suppression setting
CR2002 DASC
7 Always ON
DM1000 *@VM2
LDA STA
ASCII Conversion zero suppression setting
CR2002 SMOV
*@VM2 DM2000
Always ON
Return value
Point • When a constant is used for the conversion destination data, it cannot be specified in
HEX ($).
• Only 1-byte characters (ASCII code) can be specified for data conversion.
• Attention is required when changing or looking up CR2814/CR2815 by interrupt
programs.
• When either of the following conditions is established, the end code (NUL (00H)) is
stored in R .
• When a device other than the leading device of the channel is specified when a bit
device is specified to R .
• When a timer/counter is specified to R by indirect specifying.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBIN function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Text Processing
Functions
Return value
*1
= STR (conversion destination device )
ARITHMETIC OPERATION FUNCTIONS
Description of Operation
DEC ASCII text string conversion or single precision floating point type text string conversion is
performed according to the argument type specified by S .
bit
15
S bit
0
bit
15
bit
0
R +2 ten one
N
R +3 U
L
(00H)
R +3 thousand hundred
R +4 ten one
N
R +5 U
L
(00H)
bit
31
S +1 bit
16
bit
15
S bit
0
bit
15
bit
0
R
+3
+4
ten thousand thousand
hundred ten
7
N
Text Processing
Functions
R +5 one U
L
(00H)
• When the S conversion destination device is single precision floating point type: The same
operation as the FASC function* is performed.
bit
15
“12.30000” bit
0
R 1(31H) 2(32H)
S +1 S
R +1 .(2EH) 3(33H)
+12.3
R +2 0(30H) 0(30H)
Single precision floating point type real number
R +3 0(30H) 0(30H)
N
R +5 U
L (00H)
Point • When either of the following conditions is established, the end code (NUL (00H)) is
stored in R .
• When a device other than the leading device of the channel is specified when a bit
device is specified to R
• When a timer/counter is specified to R by indirect specifying
VM2 VM0
Always ON
MOV
#0 VM2
MOV.D
VM0 @VM2
CR2002 MOV
CR2800 @VM0
Always ON
Send break signal
CR2814
SET
ASCII Conversion
zero suppression setting
CR2815
SET
ASCII conversion
+ omit signal
7 DASC
DM1000 *@VM2
Functions
Text Processing
MOV
@VM0 CR2800
Text Processing
Functions
Return value
*1
= RDASC (conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
*2 For bit devices, specify the leading device of the channel.
*3 T, C, CR, CTC, CTH, Z can not be used.
7 *4 When a bit device has been specified, 32 continuous bits are handled.
When a relay other than the leading relay (e.g. R002 or R1012) of the channel has been
specified, the relay is handled in16/32 bits straddling the next channel.
Functions
Text Processing
*5 When the type other than .L is specified by return value, type conversion will be automatically
conducted during conversion.
*6 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The DEC ASCII text string currently stored starting from S is converted to signed 32-bit BIN data,
and the result is stored in R .
bit
15
bit
0
bit
31
R +1 bit
16
bit
15
R bit
0
S +4 hundred ten
N
S +5 one U (00H)
L NUL (00H) shall add to end of string.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
RDASC.L
DM01000 @VM0
CR2002 MOV.L
@VM0 DM2000
Always ON
Return value
Point • Specify a text string comprising $30 to $39 ("0" to "9") and $2B, $2D ("±": only in the
case of signed conversion) to the decimal ASCII text string specified by the conversion
destination data.
• When an ASCII text string other than the above has been specified to S , the
function is not executed.
• When the ASCII text string specified by S does not contain a NUL (00H), the 7
function converts text strings up to 11 characters.
Text Processing
Functions
• When either of the following conditions is established, 0 is stored in R :
• When there is an invalid character in . S
• When the value after conversion is outside the signed 32-bit BIN data range
• When a device other than the leading device of the channel is specified when a bit
device is specified to S .
• When a timer/counter is specified to S by indirect specifying.
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.L = RDASC (SLEFT (DM1000.T, 7))
Description of Operation The leading seven characters of the decimal ASCII text string currently stored starting
from DM1000.T are cut, and converted to signed 32-bit BIN data, and the result is stored
in DM2000.L.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SLEFT function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= HASC ( conversion destination device,number of conversion digits )
ARITHMETIC OPERATION FUNCTIONS
Description of Operation
The BIN data stored in S is converted to a HEX ASCII text string appended with the end code
NUL (00H), and the result is stored in R for the specified n . (when n =0, all of the data of
S is converted with zeros suppressed.)
n =1 n =2
N
HEX ASCII string R C(43H) U
L
(00H) R 2(32H) C(43H)
N
R +1 U
L
(00H)
n =3 n =4
R 1(31H) 2(32H) R 0(30H) 1(31H)
N
R +1 C(43H) U
L
(00H) R +1 2(32H) C(43H)
N
U (00H)
R +2 L
n =0
R 1(31H) 2(32H)
N
R +1 C(43H) U
L
(00H)
n =7 n =8
R 0(30H) 1(31H) R 0(30H) 0(30H)
7
R 1(31H) 2(32H)
R +1 C(43H) D(44H)
R +2 E(45H) 0(30H)
Text Processing
Functions
N
R +3 U
L
(00H)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
● Example of format
DM2000.T = HASC (DM1000, 3)
CR2002 ADRSET
VM2 VM0
Always ON
MOV
#0 VM2
MOV.D
VM0 @VM0
CR2002 HASC
DM1000 *@VM0 #3
Always ON
Conversion destination device
CR2002 SMOV
*@VM0 DM2000
Always ON
Store device
stored in R .
• When a device other than the leading device of the channel is specified when a bit
device is specified to R .
• When a timer/counter is specified to R by indirect specifying.
• When 5 or more is specified to n in the case of .U suffix instructions and 9 or
more is specified in the case of .D suffix instructions
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.T = HASC (SRA (DM1000.D, 8), 0)
The BIN data currently stored in DM1000.D is shifted to the right by 8 bits.
7
Description of Operation
The value of the shift result (upper 24 bits before the shift) is converted to a HEX ASCII
text string, and is stored in EM2000.T for the effective number of digits with zero
Functions
Text Processing
suppress ON.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SRA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Text Processing
Functions
Return value
*1
= RHASC ( conversion destination device )
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device.
*2 For bit devices, specify the leading device of the channel.
*3 T, C, CR, CTC, CTH, Z can not be used.
*4 When a bit device has been specified, 32 continuous bits are handled. When a relay other than
the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is handled in
32 bits straddling the next channel.
7 *5 When the type other than .D is specified by return value, type conversion will be automatically
conducted during conversion.
*6 The ".DF" suffix cannot be specified for device Z.
Functions
Text Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
Description of Operation
The DEC ASCII text string currently stored starting from S is converted to unsigned 32-bit BIN
data, and the result is stored in R .
HEX ASCII string Unsigned 32-bit BIN data
bit bit
15 0
S 1(31H) 2(32H)
S +1 A(41H) B(42H) R +1 R
S +2 C(43H) D(44H) 1 2 A B C D 1 4
S +3 1(31H) 4(34H)
N
S +4 U
L (00H)
bit bit
15 0
S 1(31H) 2(32H)
R +1 R
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
R +1 R
N
S 1(31H) U
L (00H) 0 0 0 0 0 0 0 1
bit
15
bit
0
R +1 R
N
S U
L (00H) 0 0 0 0 0 0 0 0
7-172 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
Point • A value in the range $30 to $39 ("0" to "9") or $41 to $46 ("A" to "F") must be currently
stored in HEX ASCII text string specified by the S conversion destination data.
• Use uppercase A to F (41H to 46H) in HEX ASCII text strings. Lowercase characters
7
are not supported.
Text Processing
Functions
• When either of the following conditions is established, 0 is stored in R :
• When there is an invalid character in S
• When the value after conversion is outside the unsigned 32-bit BIN data range
• When a device other than the leading device of the channel is specified when a bit
device is specified to S
• When a timer/counter is specified to S by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.D = RHASC (SLEFT (DM1000.T, 6))
Description of Operation The leading six characters of the HEX ASCII text string currently stored starting from
DM1000.T are cut, and converted to unsigned 32-bit BIN data, and the result is stored in
DM2000.D.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SLEFT function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
*2 When a bit device has been specified, 32 continuous bits are occupied. When a relay other than
the leading relay (e.g. R002 or R1012) of the channel has been specified, 32 bits are occupied
straddling the next channel.
*3 Refer to the "INTG function" for details on the range of the single precision floating point type
real number.
*4 For bit devices, specify the leading device of the channel.
*5 T, C, CR, CTC, CTH, Z can not be used.
Description of Operation
The single precision floating point type real number data stored in S is converted to a text string
appended with the end code NUL (00H) according to S1 to S3 and the conversion parameter
stored in S5 , and the result is stored in R .
The conversion parameter device is specified as follows.
Display Specifies "0" when converting to a decimal point format text string, and "1"
S1
specification format when converting to an exponent format text string.
S2 Total number of digits Specify within the range 1 to 24 digit.
S3 Number of decimal Specify within the range 0 to 7 digit.
The content to specify in the conversion parameter is as follows.
R +(31H) 0(30H)
S2 +1 S2
R +1 1(31H) 2(32H)
+12.3
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
● Example of format
DM2000.T = FASC (0, 10, 3, DM1200.F, DM1000)
CR2002 ADRSET
VM2 VM0
Always ON
MOV
#0 VM2
7
MOV.D
Text Processing
Functions
VM0 @VM4
CR2002 MOV
#0 @VM0
Always ON
MOV
#10 @VM1
MOV
#3 @VM2
MOV
CR2814 @VM3
ASCII Conversion
DM1000 zero suppression setting CR2814
LDA STA
Conversion parameter ASCII Conversion
zero suppression setting
FASC
@VM0 DM1200 *@VM4
stored in R :
• When the argument value is out of range
• When a single precision floating point type real number out of the range has been
specified
• When the number of digits of the text string to store has exceeded the total number
of digits
• When a device other than the leading device of the channel is specified when a bit
device is specified to R
• When a timer/counter is specified to R by indirect specifying
• When the total number of digits and the number of digits past the decimal point do
not satisfy the following conditions
0< S3 <= 7
3 <= S2 <= 24 7 <= S2 <= 24
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.T = FASC (0, 10, 3, SIN (DM1000.F), 3)
Description of Operation The sine (SIN) value of the angle of the single precision floating point type real number
stored in DM1000.F is calculated, and the result is converted to a decimal point format
text string that takes three of the total of ten digits as the number of digits past the
decimal point. (conversion with zero suppress and sign omission)
The converted text string is appended with the end code NUL (00H), and is stored in
EM2000.T. (The conversion destination device need not be converted to a single
precision floating point type by using the FLOAT function, etc.)
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SIN function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Text Processing
Functions
Return value
*1
= RFASC (conversion destination device )
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device.
*2 For bit devices, specify the leading device of the channel.
*3 When a bit device has been specified, 32 continuous bits are occupied. When a relay other than
the leading relay (e.g. R002 or R1012) of the channel has been specified, 32 bits are occupied
7 straddling the next channel.
*4 A NUL (00H) is required at the end of the floating text string that it specified by the conversion
Functions
Text Processing
destination device.
*5 T, C, CR, CTC, CTH, Z can not be used.
*6 When the type other than .F is specified by return value, type conversion will be automatically
conducted during conversion.
*7 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The single precision floating point text string currently stored starting from S is converted to single
precision floating point type real number data, and the result is stored in R .
when single precision floating point text string “+012.30”
bit bit
15 0
S +(2BH) 0(30H)
R +1 R
S +1 1(31H) 2(32H)
+12.3
S +2 .(2EH) 3(33H)
N Single precision floating point type real number
S +3 U
L (00H)
S +(2BH) 1(31H)
S +1 .(2EH) 2(32H) R +1 R
Point • Only the values of $30 to $39 ("0" to "9"), $2B ("+"), $2C ("-"), $45 ("E"), and $2E (".")
must be currently stored in single precision floating point text string to be specified by
7
the conversion destination data.
Text Processing
Functions
• When either of the following conditions is established, 0 is stored in R :
• When the length of a text string is 0
• When the format of the text string is incorrect
• When the numerical value after conversion exceeds the single precision floating
point type real number rangea
• When the number of digits of the text string to store has exceeded the total number of digits
• When a device other than the leading device of the channel is specified when a bit
device is specified to S .
+
ˉ
Symbols Value
+ +
Eˉ
ˉ
Symbols Value Symbols Value
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"COS function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
7
Functions
Text Processing
Return value
*1
= VAL (conversion destination device )
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
*2 For bit devices, specify the leading device of the channel.
*3 A NUL (00H) is required at the end of the single precision floating point text string that it
specified by the conversion destination device. 7
*4 When a bit device has been specified, 32 continuous bits are occupied. When a relay other than
Text Processing
Functions
the leading relay (e.g. R002 or R1012) of the channel has been specified, 32 bits are occupied
straddling the next channel.
*5 T, C, CR, CTC, CTH, Z can not be used.
*6 When the type other than .F is specified by return value, type conversion will be automatically
conducted during conversion.
*7 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units. "KV-5500/5000/3000 CPU Function Version"
(Page 2)
Description of Operation
This function differs from the "RFASC function" in name only, and operation, etc. are the same.
For details on operation, see "RFASC function".
Return value
*1
= LEN ( conversion destination device)
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
*2 To specify a text string using constants, enclose with " ".
*3 For bit devices, specify the leading device of the channel.
7 *4
*5
T, C, CR, CTC, CTH, Z can not be used.
When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
Functions
Text Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The number of characters of the text string currently stored starting from S is counted, and the
result is stored in R as 16-bit BIN data.
S a(61H) b(62H) R 26
S +1 c(63H) d(64H) 16 bits
(1 word)
S +2 e(65H) f(66H)
˖
w(77H) x(78H)
y(79H) z(7AH)
N
U (00H)
L
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
Destination string
CR2002 MOV
@VM0 DM2000
Always ON
Return value
Text Processing
Functions
device is specified to S by indirect specifying
• When a timer/counter is specified to S by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.T = SINS (DM1000.T, DM1100.T, LEN (DM1000.T) - 10)
Description of Operation The length (number of characters) of the text string currently stored starting from
DM1000 is calculated, and the text string currently stored starting from DM1100 is
inserted ten characters in front (LEN (DM1000.T) -10). The text string resulting from the
insertion is appended with the end code NUL (00H) and is stored in DM2000.
bit bit
15 0
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SINS function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= SRGHT ( cut destination device, number of cut characters )
ARITHMETIC OPERATION FUNCTIONS
When "0" has been specified, one character's worth of NUL (00H) is stored in return value.
*6 T, C, CR, CTC, CTH, Z can not be used.
Description of Operation
The text string currently stored starting from S is cut from the right end by n characters
(number of bytes), appended with the end code NUL (00H), and the result is stored in R .
bit bit
15 0
S A(41H) B(42H)
S +1 C(43H) D(44H)
S +2 E(45H) F(46H)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM0
CR2002 SRGHT
DM1000 *@VM0 #40
Always ON
Cut destination device
CR2002 SMOV
*@VM0 DM2000
Always ON
Return value
Point • When either of the following conditions is established, the end code (NUL (00H)) is
stored:
• When the text string specified by S does not contain the end code (NUL(00H))
7
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
Text Processing
Functions
• When the text string to be stored in R onwards exceeds the device range
• When a device other than the leading device of the channel is specified when a bit
device is specified to S and R .
• When a timer/counter is specified to S and R by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.L = RDASC (SRGHT (DM1000.T, 8))
Description of Operation The final eight characters (lower eight digits) of the DEC ASCII text string currently stored
starting from DM1000 are cut, and converted to signed 32-bit BIN data, and the result is
stored in EM2000.L.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RDASC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= RIGHT ( cut destination device, number of cut characters )
ARITHMETIC OPERATION FUNCTIONS
When "0" has been specified, one character's worth of NUL (00H) is stored in return value.
*6 T, C, CR, CTC, CTH, Z can not be used.
Description of Operation
This function differs from the "SRGHT function" in name only, and operation, etc. are the same.
For details on operation, see "SRGHT function".
Text Processing
Functions
Return value
*1
= SLEFT ( cut destination device, number of cut characters )
ARITHMETIC OPERATION FUNCTIONS
7 *4
*5
"$" cannot be used.
Specify the number of characters (number of bytes) from the left end (leading end) to the
Functions
Text Processing
Description of Operation
The text string currently stored starting from S is cut from the left end (leading end) by n
characters (number of bytes), appended with the end code NUL (00H), and the result is stored in R .
bit bit
15 0
K(4BH) L(4CH)
NUL (00H) shall store to end of string.
M(4DH) N(4EH)
S(53H) T(54H)
N
U(55H) U
L (00H)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM0
CR2002 SLEFT
DM1000 *@VM0 #40
Always ON
Cut destination device
CR2002 SMOV
*@VM0 DM2000
Always ON
Return value
Point • When either of the following conditions is established, the end code (NUL (00H)) is
stored:
• When the text string specified by S does not contain the end code (NUL 7
(00H))
Text Processing
Functions
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When the text string to be stored in R onwards exceeds the device range
• When a device other than the leading device of the channel is specified when a bit
device is specified to S and R
• When a timer/counter is specified to S and R by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.D = RHASC (SLEFT (DM1000.T, 4))
Description of Operation The leading four characters (upper four digits) of the HEX ASCII text string currently
stored starting from DM1000.T are cut, and converted to unsigned 16-bit BIN data, and
the result is stored in EM2000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RHASC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= LEFT (cut destination device, number of cut characters)
ARITHMETIC OPERATION FUNCTIONS
Description of Operation
This function differs from the "SLEFT function" in name only, and operation, etc. are the same.
For details on operation "SLEFT function".
Text Processing
Functions
Return value
*1
= SMID (cut destination device, cut character position, number of cut characters)
ARITHMETIC OPERATION FUNCTIONS
7 *2
memory.
For bit devices, specify the leading device of the channel.
Functions
Text Processing
Description of Operation
The text string currently stored starting from S is cut from n1 (number of bytes) by n2
characters (number of bytes), appended with the end code NUL (00H), and the result is stored in R .
Position ˌ
S +2 E(45H) F(46H)
n2 number of
K(4BH) L(4CH)
character N
K(4BH) L(4CH) U
L (00H)
S(53H) T(54H)
N
U(55H) U
L (00H)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM0
CR2002 SMID
DM1000 *@VM0 #8
Always ON Cut destination device
#16
CR2002 SMOV
*@VM0 DM2000
Always ON
Return value
• When either of the following conditions is established, the end code (NUL (00H)) is
Point
stored: 7
• When the text string specified by does not contain the end code (NUL
S
Text Processing
Functions
(00H))
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When S text string length < n1 .
• When the text string to be stored in R onwards exceeds the device range
• When a device other than the leading device of the channel is specified when a bit
device is specified to S and R .
• When a timer/counter is specified to S and R by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.D = RHASC (SMID (DM1000.T, 2, 4))
Description of Operation The four characters (middle four digits) from the 2nd character of the HEX ASCII text
string currently stored starting from DM1000.T are cut, and converted to unsigned 16-bit
BIN data, and the result is stored in EM2000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RHASC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Return value
*1
= MID ( cut destination device, cut character position, number of cut characters )
ARITHMETIC OPERATION FUNCTIONS
7 *3
*4
To specify a text string using constants, enclose with " ".
"$" cannot be used.
*5 Specify the number of characters (number of bytes) from the cut characters to the cut
Functions
Text Processing
Description of Operation
This function differs from the "SMID function" in name only, and operation, etc. are the same.
For details on operation "SMID function".
Text Processing
Functions
7 *1
*2
The return value can be omitted. When omitted, the conversion result is stored in a work device/memory.
For bit devices, specify the leading device of the channel.
*3 To specify a text string using constants, enclose with " ".
Functions
Text Processing
Description of Operation
The text string of n2 characters (number of bytes) from n1 (number of bytes) of the text string
currently stored starting from S1 is replaced with the text string currently stored starting from the
S2 , appended with the end code NUL (00H), and the result is stored in R .
Position 0
When n1 = 4 and n2 = 2,
S(53H) T(54H) string after replace are as follows. T(54H) U(55H)
N N
U(55H) U
L (00H)
U
L (00H)
NUL (00H) shall add to end of string. NUL (00H) shall store to end of string.
S2 X(58H) Y(59H)
N
S2 +1 Z(5AH) U
L (00H)
MOV.D
VM0 @VM0
CR2002 SRPLC
DM1000 DM1200 *@VM0
Always ON Replace destination device Replace string device
#10 #20
CR2002
Always ON
SMOV
*@VM0 DM2000 7
Return value
Text Processing
Functions
Point • When either of the following conditions is established, the end code (NUL (00H)) is
stored:
• When the text string specified by S1 and S2 does not contain the end code
(NUL (00H))
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When S text string length < n1 .
• When the length of the text string after the replace exceeds 2000 characters
including (NUL (00H))
• When a device other than the leading device of the channel is specified when a bit
device is specified to S1 , S2 , and R .
• When a timer/counter is specified to S1 , S2 and R by indirect
specifying
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RDASC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
7
HINT
Functions
Text Processing
Operation of the SRPLC function changes as follows according to the content specified to the argument:
Example 1) Operation is the same as the SINS function when "0" is specified to the number of replace
characters.
The replace text string is inserted (no replace destination range) to the 4th character of
the replace destination text string.
Example2) Operation is the same as the SDEL function when an empty text string (NUL only) is
specified to the replace text string.
The four characters from the 2nd character of the replace destination text string are
deleted (no replace text string).
Text Processing
Functions
memory.
*2 For bit devices, specify the leading device of the channel.
*3 To specify a text string using constants, enclose with " ".
*4 "$" cannot be used.
*5 Specify the number of characters (number of bytes) from the replace leading position to the
number of replace characters within the range 0 to 1999.
*6 T, C, CR, CTC, CTH, Z can not be used.
*7 The leading character of the text string specified by S1 is taken to be "0".
Description of Operation
This function differs from the "SRPLC function" in name only, and operation, etc. are the same.
For details on operation "SRPLC function".
Return value
*1
= SINS (insert destination device, insert text string device, insert leading position)
ARITHMETIC OPERATION FUNCTIONS
7 *2
*3
For bit devices, specify the leading device of the channel.
To specify a text string using constants, enclose with " ".
*4 "$" cannot be used.
Functions
Text Processing
*5 Specify the number of characters (number of bytes) from the insert leading position to the
number of insert characters within the range 0 to 1999.
*6 T, C, CR, CTC, CTH, Z can not be used.
*7 The leading character of the text string specified by S1 is taken to be "0".
Description of Operation
The text string currently stored starting from S1 is inserted to n (number of bytes) of the text
string currently stored starting from S2 , appended with the end code NUL (00H), and the result is
stored in R .
Position ˌ
S(53H) T(54H)
NUL (00H) shall add to end of string.
N
U(55H) U
L (00H)
Character string shall insert NUL (00H) shall add to end of string.
S2 G(47H) H(48H)
S2 +1 I (49H) J(4AH)
N
S2 +1 U
L (00H)
MOV.D
VM0 @VM0
CR2002 SINS
DM1000 DM1200 *@VM0
Always ON Insert
7
Insert string device
destination device
#10
Text Processing
Functions
CR2002 SMOV
*@VM0 DM2000
Always ON
Storage device
Point • When either of the following conditions is established, the end code (NUL (00H)) is stored:
• When the text string specified by S1 and S2 does not contain the end code
(NUL (00H))
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When S text string length < n .
• When the length of the text string after the insert exceeds 2000 characters
including (NUL (00H))
• When a device other than the leading device of the channel is specified when a bit
device is specified to S1 , S2 , and R
• When a timer/counter is specified to S1 , S2 and R by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.D = RHASC (SINS (DM1000.T, EM1000.T, 2))
Description of Operation The HEX ASCII text string currently stored starting from EM1000.Tis inserted at the 2nd
character (number of bytes) from the start of the HEX ASCII text string currently stored in
DM1000.T.
The HEX ASCII text string resulting from the insert is converted to unsigned 32-bit BIN
data, and the result is stored in EM2000.D.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RDASC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
leading position )
Argument/Return Supported Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S1 Insert Specifies the device to which the text s
destination tring to be inserted is stored, or the - - - - - - - .T *3
*2
device *6 insert destination text string.
S2 Insert text
Specifies the device to which the text string
string - - - - - - - .T *3
*2 to insert is stored, or the insert text string.
device *6
̊ Insert leading Specifies the insert leading position
*7 .U .U .U .U - - - - *4
position (number of bytes). (0 to 1999)
*2
R Return value *6 .T type INSERT function available - - - - - - - .T - -
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
7 *2 For bit devices, specify the leading device of the channel.
*3 To specify a text string using constants, enclose with " ".
Functions
Text Processing
Description of Operation
This function differs from the "SINS function" in name only, and operation, etc. are the same.
For details on operation "SINS function".
Text Processing
Functions
of delete characters)
Argument/Return Supported Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Delete Specifies the device to which the text
destination string to be deleted is stored, or the - - - - - - - .T *3
*2
device *7 delete destination text string.
n1 Delete leading Specifies the delete leading position
*4 .U .U .U .U - - - -
position *5 (number of bytes). (0 to 1999)
n2 Number of
Specifies the number of characters
delete .U .U .U .U - - - -
*4 (number of bytes) to delete. (0 to 1999)
characters *6
*2
R Return value*7 .T type SDEL function available - - - - - - - .T -
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
7 *2 For bit devices, specify the leading device of the channel.
*3 To specify a text string using constants, enclose with " ".
Functions
Text Processing
Description of Operation
The text string of n2 characters (number of bytes) is deleted from the n1 position (number of
bytes) of the text string currently stored starting from S , appended with the end code NUL (00H),
and the result is stored in R .
Position ˌ n1 =2, n2 =2
Delete start position n2
bit bit
15 0
S +2 E(45H) F(46H) R +2
K(4BH) L(4CH)
K(4BH) L(4CH)
S(53H) T(54H)
N
S(53H) T(54H) U(55H) U
L (00H)
N
U(55H) U
L (00H)
NUL (00H) shall store
to end of string.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM0
CR2002 SDEL
DM1000 *@VM0 #10
Always ON
Delete destination device
#20
CR2002 SMOV
*@VM0 DM2000
Always ON
Return value 7
Text Processing
Functions
Point • When either of the following conditions is established, the end code (NUL (00H)) is
stored:
• When the text string specified by S does not contain the end code (NUL
(00H))
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When S text string length < n1 .
• When the text string to be stored in R onwards exceeds the device range
• When a device other than the leading device of the channel is specified when a bit
device is specified to S and R
• When a timer/counter is specified to S and R by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.D = RHASC (SDEL (DM1000.T, 2, 4))
Description of Operation A text string of four characters (number of bytes) is deleted from the 2nd character
(number of bytes) of the HEX ASCII text string currently stored starting from DM1000.T.
The HEX ASCII text string resulting from the delete is converted to unsigned 16-bit BIN
data, and the result is stored in EM2000.D.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RHASC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Description of Operation
The text string of n1 characters (number of bytes) is deleted from the n2 position (number of
bytes) of the text string currently stored starting from S , appended with the end code NUL (00H),
and the result is stored in R .
Position ˌ n1 =2, n2 =2
Delete start position n2
bit bit
15 0
S +2 E(45H) F(46H) R +2
K(4BH) L(4CH)
K(4BH) L(4CH)
S(53H) T(54H)
N
S(53H) T(54H) U(55H) U
L (00H)
N
U(55H) U
L (00H) NUL (00H) shall store
to end of string.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM0
CR2002 SDEL
DM1000 *@VM0 #10
Always ON Delete
destination device
#20
CR2002 SMOV
*@VM0 DM2000
Always ON
Return value 7
• When either of the following conditions is established, the end code (NUL (00H)) is
Text Processing
Functions
Point
stored:
• When the text string specified by S does not contain the end code (NUL
(00H))
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When S text string length < n2 .
• When the text string to be stored in R onwards exceeds the device range
• When a device other than the leading device of the channel is specified when a bit
device is specified to S and R .
• When a timer/counter is specified to S and R by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2000.D = RHASC (DELETE (DM1000.T, 4, 2))
Description of Operation A text string of four characters (number of bytes) is deleted from the 2nd character
(number of bytes) of the HEX ASCII text string currently stored starting from DM1000.T.
The HEX ASCII text string resulting from the delete is converted to unsigned 16-bit BIN
data, and the result is stored in EM2000.D.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RHASC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Trim
Return value
*1
= TRIM ( Target text string device )
ARITHMETIC OPERATION FUNCTIONS
7 Point • The TRIM function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
Functions
Text Processing
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
Removes all 1-byte spaces (20H) and tabs (09H) at both ends (leading and end) of a text string stored
starting from the device specified with S target text string device. An end code NUL(00H) is
added, and the results are stored in R return value.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM2
CR2002 MOV
#0 @VM0
Always ON @VM0
BSET
#0
@VM0
BSET
#1
CR2002 STRIM
DM1000 @VM0 *@VM2
7
Always ON Target text
CR2002 string device SMOV
*@VM2 DM2000
Text Processing
Functions
Always ON
Return value
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2500.D = RHASC (TRIM (DM1000.T))
Description of Operation The 1-byte spaces and tabs are removed from both ends (leading and end) of a
hexadecimal ASCII text string stored starting from DM1000.T.
The HEX ASCII text string resulting from the delete is converted to unsigned 16-bit BIN
data, and the result is stored in EM2500.D.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
LTRIM Trim 1-byte space and tab at left end of text string
Left trim
Return value
*1
= LTRIM ( Target text string device)
ARITHMETIC OPERATION FUNCTIONS
7 Point • The LTRIM function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
Functions
Text Processing
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
Removes all 1-byte spaces (20H) and tabs (09H) at the left end (leading) of a text string stored
starting from the device specified with S target text string device. An end code NUL(00H) is
added, and the results are stored in R return value.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM2
CR2002 MOV
#0 @VM0
Always ON
@VM0
BSET
#0
CR2002 STRIM
DM1000 VM0 *@VM2
Always ON Target text
string device
CR2002 SMOV
Always ON
*@VM2 DM2000
Return value
7
Text Processing
Functions
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2500.D = RHASC (LTRIM (DM1000.T))
Description of Operation The 1-byte spaces and tabs are removed from the left end (leading) of a hexadecimal
ASCII text string stored from DM1000.T.
The HEX ASCII text string resulting from the delete is converted to unsigned 16-bit BIN
data, and the result is stored in EM2500.D.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
RTRIM Trim 1-byte space and tab at right end of text string
Right trim
Return value
*1
= RTRIM ( Target text string device )
ARITHMETIC OPERATION FUNCTIONS
7 Point • The RTRIM function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
Functions
Text Processing
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
Removes all 1-byte spaces (20H) and tabs (09H) at the right end (leading) of a text string stored
starting from the device specified with S target text string device. An end code NUL(00H) is
added, and the results are stored in R return value.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM2
CR2002 MOV
#0 @VM0
Always ON
@VM0
BSET
#1
CR2002 STRIM
DM1000 @VM0 *@VM2
Always ON Target text
string device
CR2002 SMOV
Always ON
*@VM2 DM2000
Return value
7
Text Processing
Functions
Sample Program
● When this function is used in combination with other functions
Programmed Script EM2500.D = RHASC (RTRIM (DM1000.T))
Description of Operation The 1-byte spaces and tabs are removed from the right end (leading) of a hexadecimal
ASCII text string stored from DM1000.T.
The HEX ASCII text string resulting from the delete is converted to unsigned 16-bit BIN
data, and the result is stored in EM2500.D.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
STRIM Trim 1-byte space and tab from specified text string position
Return value
*1
= STRIM ( Target text string device, deleted positional parameters )
ARITHMETIC OPERATION FUNCTIONS
7 *3
*4
To specify a text string using constants, enclose with " ".
T, C, CTC, CTH, Z can not be used.
Functions
Text Processing
Point • The STRIM function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
Removes all 1-byte spaces and tabs at the position specified with S2 delete position specifying
parameter from the text string stored startting from the device specified with S1 target text string
device. An end code NUL(00H) is added, and the results are stored in R return value.
The details specified with the delete position specifying parameter are given below.
S2 value Details
All 1-byte spaces and tabs at the left end of the text string
1 are deleted.
(Same action as LTRIM function)
All 1-byte spaces and tabs at the right end of the text string
2 are deleted.
(Same action as RTRIM function)
All 1-byte spaces and tabs at both ends of the text string
3 are deleted.
(Same action as TRIM function)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
MOV.D
VM0 @VM0
CR2002 STRIM
DM1000 #3 *@VM0
Always ON Target text
string device
CR2002 SMOV
*@VM0 DM2000
Always ON
Return value
Sample Program 7
● When this function is used in combination with other functions
Text Processing
Functions
Programmed Script EM2500.D = RHASC (STRIM (DM1000.T, 3))
Description of Operation The 1-byte spaces and tabs are removed from both ends (leading and end) of a
hexadecimal ASCII text string stored starting from DM1000.T.
The HEX ASCII text string resulting from the delete is converted to unsigned 16-bit BIN
data, and the result is stored in EM2500.D.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
Split
*1
Return value = SPLIT (split source text string, limit text string, split text string 1,
ARITHMETIC OPERATION FUNCTIONS
Dn Split text string Specifies the device storing the split text
7
*2 - - - - - - - .T - -
n *4 string n.
R *2 Stores the number of divisions. The
Return value*5 *6 .U .S .D .L .F .DF - - - -
SPLIT function uses the .U type.
Functions
Text Processing
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
*2 For bit devices, specify the leading device of the channel.
*3 To specify a text string using constants, enclose with " ".
*4 Specify the argument number n in the range of 1 to 10.
*5 T, C, CTC, CTH, Z can not be used.
*6 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
Point • The SPLIT function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The S1 split source text string is split with the S2 limit text string, and the results are stored in
the D1 to Dn split text strings.
The number of text string divisions is stored in R return value.
● Example of format
DM5000.U = SPLIT (DM2000.T, ",", EM3000.T, EM3100.T, EM3200.T)
Sample Program
Description of Operation
DM5000.U = SPLIT (DM2000.T, ",", EM3000.T, EM3100.T, EM3200.T)
The text string "date, data, record" stored in DM2000.T is split by "," (comma) and stored
7
in EM3000.T, EM3100.T, and EM3200.T.
Text Processing
Functions
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
leading position)
Argument/Return Supported Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S1 Search Specifies the device to which the text
destination string to be searched is stored, or the - - - - - - - .T *3
*2
device *6 search destination text string.
S2 Search text
Specifies the device to which the text string
string - - - - - - - .T *3
*2 to search is stored, or the search text string.
device *6
n Search leading Specifies the search leading position
*4 .U .U .U .U - - - - *4
position *5 (number of bytes).(0 to 1999)
*8
*7
R Return value .U type SFIND function available .U .S .D .L .F .DF - - - -
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/memory.
7 *2
*3
For bit devices, specify the leading device of the channel.
To specify a text string using constants, enclose with " ".
*4 "$" cannot be used.
Functions
Text Processing
*5 Specify the number of characters (number of bytes) from the search leading position to the
number of search characters within the range 0 to 1999.
*6 T, C, CTC, CTH, Z can not be used.
*7 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*8 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher versions.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units. "KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution condition is established (TRUE), the search text string currently stored in S2 is
searched from the n position (number of bytes) of the search destination text string currently
stored starting from S1 .
The leading character position (number of bytes starting from S1 ) of the search text string that was
first found from n onwards as a result of the search is stored in R .
Position ˌ
Destination text string Position n
to be searched
String shall search
S1 +4 C(43H) D(44H)
When n =6, position for detected string CDE after 6 is 8.
S1 +5 E(45H) F(46H)
R 8
CR2002 MOV
@VM0 DM2000
Always ON
Search result
Text Processing
Functions
(NUL (00H))
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When (length of text string) < (length of n + S2 text string) (Length of text
strings do not include end code “NUL (00H)".)
• When a device other than the leading device of the channel is specified when a bit
device is specified to S1 and S2
• When a timer/counter is specified to S1 and S2 by indirect specifying
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.U = SFIND (DM1000.T, SMID (DM1200.T, 4, 6), 0)
Description of Operation The text string currently stored starting from DM1000.T is searched from the start of the
search destination text string currently stored starting from DM1200.T, and the text string
resulting from having cut six characters (number of bytes) from the 4th character
(number of bytes) is searched.
The leading character position of the search text string that was first found from the start
of the search destination text string as a result of the search is stored in DM2000.U.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SMID function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
7
*6
*5
R Return value .U type SFINDN function available .U .S .D .L .F .DF - .T - -
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
Functions
Text Processing
memory.
*2 For bit devices, specify the leading device of the channel.
*3 To specify a text string using constants, enclose with " ".
*4 T, C, CTC, CTH, Z can not be used.
*5 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*6 The ".DF" suffix cannot be specified for device Z.
Point • The SFINDN function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution conditions are established (TRUE), the text string stored starting from the device
specified with S2 search text string is searched from the S4 search start byte position of the
text string having the number of search target bytes. The search leads with the device specified in
S1 search target device.
The start position (number of bytes) of the text string specified with S2 found first after the
specified position in the text string specified with the S3 number of search target bytes is stored in
R return value.
If the text string specified with S2 is not found, or if the text string length of S2 is 0, "$FFFF" is
stored in R .
S1 +7 d(64H) Z(60H)
S1 +8 2(32H) K(4BH) When S3 =18 and S4 =4, the position where the text
e(65H) y(79H) string "Key" is detected after position 4 is 10.
NUL(00H) 3(33H)
A(41H) b(62H) R 10
c(63H) N(4EH)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series 7
Instruction Reference Manual, "Text Processing Instructions."
Text Processing
Functions
● Example of format
DM2000.U = SFINDN ( EM1000.T, EM3000.T, 50, 4)
CR2002 MOV
#50 @VM0
Always ON
MOV
#4 @VM1
CR2002 SFINDN
EM1000 EM3000 @VM0 @VM2
Always ON
Search destination Search string
device device
CR2002 MOV
@VM2 DM2000
Always ON
Search result
Sample Program
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10).
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
7 memory.
*2 For bit devices, specify the leading device of the channel.
Functions
Text Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
S1
S1
+4
+5
C(43H)
E(45H)
D(44H)
F(46H)
When n =6, position for detected string CDE after 6 is 8. 7
Text Processing
Functions
R 8
S(53H) T(54H)
Search range
N
U(55H) U
L (00H)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
● Example of format
DM2000.U = INSTR (8, DM1000.T, DM1200.T)
CR2002 MOV
#0 @VM0
Always ON
SFIND
DM1000 DM1200 @VM0
Search destination device Search string device
#8
CR2002 MOV
@VM0 DM2000
Always ON
Search result
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SMID function"
• The KV script is converted to a ladder program before execution. To check the
Text Processing
Functions
Return value
*1
= FIND ( search destination device, search text string device )
ARITHMETIC OPERATION FUNCTIONS
*1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
*2 For bit devices, specify the leading device of the channel.
*3 To specify a text string using constants, enclose with " " (up to 31 1-byte characters).
7 *4 T, C, CTC, CTH, Z can not be used.
*5 When the type other than .U is specified by return value, type conversion will be automatically
Functions
Text Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
When the execution condition is established (TRUE), the search text string currently stored starting
from S2 is searched from the search destination text string currently stored starting from S1 .
The leading character position (number of bytes) from S1 of the search text string that was first
found as a result of the search is stored in R .
Position 0
Destination text string
to be searched
Text string to be searched
S1 +4 C(43H) D(44H)
S1 +5 E(45H) F(46H)
R 8
S(53H) T(54H)
Search range
N
U(55H) U
L (00H)
CR2002 MOV
@VM0 DM2000
Always ON
Search result
Text Processing
Functions
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When (length of text string) < (length of S2 text string)
• When a device other than the leading device of the channel is specified when a bit
device is specified to S1 and S2
• When a timer/counter is specified to S1 and S2 by indirect specifying
• When S2 string length is 0, or character string not found, 65535 is input to. R
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.U = FIND (DM1000.T, SMID (DM1200.T, 4, 6))
Description of Operation The text string currently stored starting from DM1000.T is searched from the start of the
search destination text string currently stored starting from DM1200.T, and the text string
resulting from having cut six characters (number of bytes) from the 4th character
(number of bytes) is searched.
The leading character position of the search text string that was first found from the start
of the search destination text string as a result of the search is stored in DM2000.U.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SMID function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
DISS ([execution condition,] *1 disperse destinat ion device, store destination device )
ARITHMETIC OPERATION FUNCTIONS
7 *3
*4
To specify a text string using constants, enclose with " ".
T, C, CR, CTC, CTH, Z can not be used.
*5 T, C, CTC, CTH, Z can not be used.
Functions
Text Processing
Description of Operation
When the execution condition is established (TRUE), the text string in byte units currently stored
starting from S is dispersed into D and stored.
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)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
● Example of format
DISS (R3000, DM1000.T, DM2000)
R3000 DISS
DM1000 DM2000
Execution condition
Separate Store
destination device destination device
Sample Program
● When this function is used in combination with other functions
Programmed Script DISS (SMID (DM1000.T, EM1000, EM1001), DM2000)
Description of Operation The text string currently stored starting from DM1000.T is cut from the character position
(number of bytes) specified by EM1000 by the number of characters (number of bytes)
specified by EM1001 at every scan (no execution condition).
The text string in byte units resulting from the cut is dispersed to word units starting from
DM2000 and is stored.
7
Text Processing
Functions
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SMID function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
UNIS ( [execution condition,] *1 unite destination device, store destination device, number of unite characters)
ARITHMETIC OPERATION FUNCTIONS
7 *2
at all times (at every scan).)
For bit devices, specify the leading device of the channel.
Functions
Text Processing
Description of Operation
When the execution condition is established (TRUE), the text string in word units currently stored
starting from S is united into byte units for n characters (number of word units) , appended
with the end code NUL (00H) and stored starting from D .
S a(61H)
S +1 b(62H) D a(61H) b(62H)
n ˖ ˖
S + n -1 z(7AH) D +( n /2)-1
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
Point The function is not executed when either of the following conditions is established:
• When the value of n is "0" or "2000" or more
• When the text string including the end code (NUL (00H)) exceeds 2000 characters
• When a device other than the leading device of the channel is specified when a bit
device is specified to S and D
• When a timer/counter is specified to S and D by indirect specifying
Sample Program
● To specify the bit device 7
Text Processing
Functions
Programmed Script UNIS (MR3000.U < 10, MR1000.U, MR2000.T, 10)
Description of Operation When MR3000.U is smaller than 10, the text string in word units currently stored starting
from MR1000.U is united to byte units for ten characters (number of word units), and
appended with the end code NUL (00H) and stored starting from MR2000.T.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"ANDA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10).
Convert characters
Return value
*1
= CHR ( conversion destination device )
ARITHMETIC OPERATION FUNCTIONS
7 Description of Operation
Functions
Text Processing
The ASCII code data stored in S is converted to a half-width text string appended with the end
code NUL (00H), and the result is stored in R .
● Example of format
DM1000.T = CHR ($0A)
CR2002 ADRSET
VM2 VM0
Always ON
MOV
#0 VM2
MOV.D
VM0 @VM2
Sample Program
Text Processing
Functions
Return value
*1
= CPSASC ( target data storage destination)
ARITHMETIC OPERATION FUNCTIONS
• The CPSASC function can be used only with KV STUDIO Ver. 6.00 or higher.
7
Point
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Functions
Text Processing
Description of Operation
The CIP text string type data stored starting from the device specified with S conversion target
data storage designation device is converted into a text string, and the results are stored in R
return value.
The CPSASC function is used to convert the CIP text string type data, and process it as a text string.
Refer to "EtherNet/IP Function User's Manual" for details on the CIP data types.
When the CPSASC function is executed, the CIP text string type data is converted and stored in the
return value.
CIP text string type data (“ABCDE”) Converted text string data
bit bit bit bit
15 0 15 0
S +0 5(0005H) A(41H) B(42H) Return value
S +1 B(42H) A(41H) C(43H) D(44H)
S +2 D(44H) C(43H) E(45H) NULL(00H)
S +3 E(45H)
NULL(00H) is added to the end,
The CIP text string type data specifies and the high-order byte and
the data size with the leading word, low-order byte of the text string
and stores the text string in the order equivalent to the data size are
of low-order byte to high-order byte. interchanged and stored.
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual, "Text Processing Instructions."
MOV
#0 VM2
MOV.D
VM0 @VM0
CR2002 CPSASC
DM1000 *@VM0
Always ON
SMOV
7
CR2002
Text Processing
Functions
*@VM0 DM2000
Always ON
Return value
*1
= RCPSASC (target data storage destination, converted data
storage destination )
ARITHMETIC OPERATION FUNCTIONS
7 *1 The return value can be omitted. When omitted, the conversion result is stored in a work device/
memory.
Functions
Text Processing
*2 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*3 To specify a text string using constants, enclose with " ".
Point • The RCPSASC function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The text string stored in the S conversion target data storage destination device is converted into CIP
text string type data, and the results are stored in the D converted data storage destination device.
After conversion, the number of characters (byte units) stored in D are stored in R return value.
The RCPSASC function is used to convert the CIP text string type data, and process it as a text string.
Refer to the "KV Ethernet/IP User's Manual" for details on the CIP data type.
When the RCPSASC function is executed, the CIP text string type data is converted and stored in the
return value.
Text string “ABCDE” CIP text string type data (“ABCDE”)
bit bit
15 0 5(0005H) D +0
S +0 A(41H) B(42H) B(42H) A(41H) D +1
S +1 C(43H) D(44H) D(44H) C(43H) D +2
S +1 E(45H) NULL(00H) E(45H) D +3
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Text Processing Instructions."
7-236 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
● Example of format
DM3000 = RCPSASC (DM1000.T, DM2000)
RCPSASC
DM1000 DM2000 @VM0
CR2002 MOV
@VM0 DM3000
Always ON
Text Processing
Functions
7
Functions
Text Processing
7-segment decode
*1
Return value = SEG ( decode destination device, destination digit position )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Decode Specifies the device to which the decode
destination destination data is stored or the decode .U .U .D .D - - - -
*2
device destination data.
Specifies the device to which the digit
n position to decode is stored, or the decode
Destination
EXTENDED FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When a bit device has been specified to the S decode destination device, 16/32
continuous bits are handled. When a relay other than the leading relay (e.g. R002 or R1012) of
the channel has been specified, the relay is handled in 16/32 bits straddling the next channel.
8 *3 When a device is specified to the n destination digit position, and the value stored in device
exceeds 0 to 3 or 0 to 7, operation is as follows.
Functions
Data Processing
When the decode destination device suffix is .U: The values of the lower two bits of the specified
device are used.
When the decode destination device suffix is .D: The values of the lower three bits of the specified
device are used.
For example, when the suffix of the S decode destination device is .U, DM01000 is specified
to n , and that value is 23 (BIN: 0000 0000 0001 0111), "3" is used as the value of n as the
value of the lower two bits is "3".
*4 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*5 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The four bits (one digit) of n digits of the 16-bit/32-bit data stored in S are decoded to data (8
bits) for 7-segment display, and the result is stored in R .
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
in case of 1234
#3 #2 #1 #0
EXTENDED FUNCTIONS
2
F E D C B A 9 8 7 6 5 4 3 2 1 0
Functions
Data Processing
in case of 12345678
#7 #6 #5 #4 #3 #2 #1 #0
S 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 DM1100.D
F E D C B A 9 8 7 6 5 4 3 2 1 0
R 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 1 DM2100.U
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
Bit1
$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
$7 0 0 1 0 0 1 1 1
Bit4
Bit2
$8 0 1 1 1 1 1 1 1
$9 0 1 1 0 1 1 1 1
$A 0 1 1 1 0 1 1 1
$B 0 1 1 1 1 1 0 0 Bit3
$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
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - 8-3
Sample Program
● When this function is used in combination with other functions
Programmed Script R2000.U = SEG (TBCD (DM1000), 3)
Description of Operation The 16-bit BIN data currently stored in DM1000 is converted to 4-digit BCD (16-bit) data,
and the value of the 1000's digit (3rd digit) of the conversion result is decoded to data for
7-segment display to turn ON the corresponding output relays (R2000 to R2015 (R2007)).
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
EXTENDED FUNCTIONS
"TBCD function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, step 5, (Page 2-10)
8
Functions
Data Processing
EXTENDED FUNCTIONS
8
Functions
Data Processing
Bit count
*1
Return value = BCNT (operation destination )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Operation Specifies the operation destination device
.U .U .D .D - - - -
destination or the operation destination data.
*3
*2
R Return value .U type BCNT function available .U .S .D .L .F .DF - - - -
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
EXTENDED FUNCTIONS
*2 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*3 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
8
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Functions
Data Processing
Description of Operation
The number of ON bits of the (16-bit/32-bit) BIN data stored in S are counted, and the result is
stored in return value.
S 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 1
ķ ĸ Ĺ ĺ Ļ
R ʿ00005
S 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
ķ ĸ Ĺ ĺ Ļ ļ Ľľ Ŀ
R ʿ00009
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
8-6 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
● Example of format
DM2000.U = BCNT (DM1000.U)
CR2002 DM1000 DM2000
LDA BCNT STA
Always ON Operation destination device Return value
Sample Program
● To count a bit device
EXTENDED FUNCTIONS
Programmed Script DM2000.U = BCNT (MR1000.D)
Description of Operation The ON bits of the 32-bit BIN data stored in MR1000.D are counted.
The result is stored in DM2000.U.
Ladder conversion CR2002 MR1000 DM2000
LDA.D BCNT.D STA
Always ON Operation destination device Return value
Functions
Data Processing
Description of Operation The data stored in DM1000.D is ORed by the data stored in DM1100.D, and the number
of ON bits of the operation result is counted and stored in DM2000.U.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"ORA function"
• The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Data count
*1
Return value = DCNT ( detection destination, detection range leading device,
number of detected data )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S1 Detection Specifies the device to which the value to
*2 .U .U .D .D .D - - -
destination detect is stored, or the detection value.
S2 Detection
Specifies the leading device of the data Handled as same type
range leading as S1 .
- - - - -
*2 block to detect.
device
EXTENDED FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
8 *3
handled in 16/32 bits straddling the next channel.
When the type other than .U is specified by return value, type conversion will be automatically
Functions
Data Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
n block data starting from S2 are each compared with the data in S1 , and the number of
matching data is stored in R .
bit bit
S1 Detection destination
15 0 bit15 bit0
R Return value
S2 ˇ n ˉ2 4567 Compare
bit15 bit0
S2 +3 23456789 S2 +2 Compare
Calculate and save the number of
S2 +5 34567890 S2 +4 Compare device whose value equals that of
detection destination (32-bit). Save
…
n
…
…
the result to return value (16-bit).
˄2 n Word˅ S2 +2˄ n -3˅+1 12345678 S2 +2˄ n -3˅ Compare
Result 2
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
EXTENDED FUNCTIONS
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
DM2000.U = DCNT (DM1000.U, DM1200.U, 4)
CR2002
Always ON
DM1000
LDA
Detection destination device
DM1200
DCNT
#4
DM2000
STA
Return value
8
Detection range
Functions
Data Processing
leading device
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.U = DCNT (COM (DM1000.D), MR1000.D, EM2000)
Description of Operation The 32-bit BIN data of number of detection data indicated by EM2000 starting from
MR1000 (.D) are each compared with the value resulting from having inverted the bits of
unsigned 32-bit BIN data currently stored in DM1000.D, and the number of matching
data is stored in DM2000.U.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"COM function"
• The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Search
*1
Return value = SER ( detection destination, detection range leading device,
number of detected data )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S1 Detection Specifies the device to which the value to
*2 .U .U .D .D .D - - -
destination detect is stored, or the detection value.
S2 Detection
Specifies the leading device of the data Handled as same type
range leading as S1 .
- - - - -
*2 block to detect.
device
EXTENDED FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
n block data starting from S2 are each compared with the data in S1 , and the number of
matching data is stored in R .
When multiple matching data are detected, the smallest device No. is stored.
bit bit
S1 Detection destination
15 0 bit15 bit0
R Return value
S2 ˇ n ˉ2 3456 Compare
bit15 bit0
bit
31
bit bit
16 15
bit
0
bit
31
S1 Detection destination bit
0
23456789 Compare
S2 +3 S2 +2 Detect and save the No. of
device whose value equals that
S2 +5 34567890 S2 +4 Compare
of detection destination (32-bit).
n … ˖ Save the result to return value
…
˄2 nǂWord˅ (32-bit).
S2 +2˄ n -3˅+1 45678901 S2 +2˄ n -3˅ Compare
EXTENDED FUNCTIONS
Result S2 +2
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
DM2000.U = SER (DM1000.U, DM1200.U, 40)
8
CR2002 DM1000 DM1200 DM2000
Functions
Data Processing
LDA SER STA
Always ON Detection destination device #40 Return value
Detection range
leading device
stored in R .
• When a bit device has been specified to the detection range leading device, the value
obtained by converting not to 16-bit units but to decimal units taking R (MR, LR) 0000
as its reference point is stored in search result (return value).
(example) When the search result is MR82312: 823x16+12=13180 is stored.
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.U = SER (NEG (DM1000.D), MR1000.D, EM2000.U)
Description of Operation The block of unsigned 32-bit BIN data of number of detection data indicated by EM2000
starting from MR1000.D are each compared with the values resulting from having
inverted the sign of unsigned 32-bit BIN data currently stored in DM2000.U.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"NEG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10)
Search value
Return value
*1
= DSER ( Detection data, detection range leading device, number of detection
device, number of detection store device )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S1 *2 Specify detection data or the device
Search data .U .U .D .D .D - - -
storing detection data.
S2 Detection
Specifies the leading device of the Handled as same type
range leading as S1 . - - - - -
*2 range to detect.
device
EXTENDED FUNCTIONS
n Number of
Specify the number of device to be
detection store .U .U .U .U - - - -
*2 detected or stored.
device
D Number of
Specify the device store detection result
detection store .U .U .U .U - - - - - -
*2 (the number of detections).
device
Specify the device store detection position *4
R Return value (offset from the leading device of detection .U .S .D .L .F .DF - - - -
*3
range). .U type DSER function available
8 *1
*2
The return value can be omitted. When omitted, the operation result is stored in working memory.
When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
Functions
Data Processing
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32 bits straddling the next channel.
*3 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
To search n devices starting from S2 by using S1 as keyword.
• The number of the device in conformity with S1 is stored in D .
• From the initial conformable device position S1 in relative position R .
• When conformable data not found, it is stored in D and R .
EXTENDED FUNCTIONS
Count the number of device whose value
identical to the value of detection destination
device (16 bit). Detection result (position)
is stored into return value (16 bit).
8
3
S2 +5 23456789 S2 +2 Compare
16 bits
n
…
( 2× n Word)
S2 +( n - 3 ) +1 45678901 S2 +( n - 3) Compare Number of consistent
Functions
Data Processing
D
S2 +( n - 2 )+1 23456789 S2 +( n - 2) Compare
2
- 1 )+1 56789012 - 1) Compare Result
S2 +( n S2 +( n 16 bits
● Example of format
DM2000.U = DSER (DM1000.U, EM0, DM1002, DM2002)
CR2002 DSER
DM1000 EM0 @VMO DM1002
Always ON
Search data Search range leading device Number of
search devices
MOV
@VM1 DM2002
Detect number of
store device
@VM0 DM2000
LDA STA
Return value
*2
range data the number of search range data.
*6
R MAX function type is identical to the 1st
Return value *5 .U .S .D .L .F .DF - - - -
argument.
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 The range of numerical values that can be handled differs according to the instruction suffix.
*3 When a bit device has been specified, 16/32/64 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32/64 bits straddling the next channel.
*4 When S type is .F or .DF, T and C cannot be specified.
8 *5 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
Functions
Data Processing
Point • The argument devices ".F" and ".DF" can be used in KV STUDIO Ver. 9.0 or later only.
• The argument devices ".F" and ".DF" can be specified with KV-7000 Series CPU units
that have CPU function version 2.0 or later only.
• The return value device ".DF" can be used in KV STUDIO Ver. 6.00 or later only.
• The return value device ".DF" can only be specified with KV-7000 Series CPU units,
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or later, and
with KV Nano Series base units.
"KV-7500/7300 CPU Function Version" (Page 2)
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The maximum value is searched in the (16-bit/32-bit/64-bit) BIN data stored in n words starting
from S . (When the search destination is 32-bit data, the search range becomes the "specified
number of data x 2 words" and when 64-bit data it becomes the "specified number of data x 4 words".)
The maximum value as a result of the search is stored in R .
S 1234
S +1 2345
bit15 bit0
S ˇ n ˉ2 8765
S ˇ n ˉ1 7654
S 1234
S +1 2345
S ˇ n ˉ2 ˉ2345
S ˇ n ˉ1 ˉ3456
EXTENDED FUNCTIONS
bit bit bit bit
31 16 15 0
S +1 12345678 S
S +3 23456789 S +2
34567890 Save Max. value
S +5 S +4
n bit
R Return value bit
31 0
• S
S +2˄ n ˉ1˅+1 76543210
Functions
Data Processing
bit bit bit bit
31 16 15 0
S +1 12345678 S
S +3 23456789 S +2
n bit
31
R Return value bit
0
• S : When the search destination device is a single precision floating point type (.F)
bit bit bit bit
31 16 15 0
S +1 1.234 S
S +3 2.345 S +2
3.456 Save Max. value
S +5 S +4
n bit
R Return value bit
31 0
• S : When the search destination device is a double precision floating point type (.DF)
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
S +3 1.2345678 S
S +7 2.3456789 S +4
S +11 3.4567890 S +8 Save Max. value
…
n bit
63
R Return value bit
0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
● Example of format
DM2000.U = MAX (DM1000.U, 32)
CR2002 #0 DM1000 DM2000
LDA.D MAX STA
Always ON #32 Return value
Search destination device
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000 = TBCD (MAX (DM1000.U, EM1100.U))
Description of Operation The maximum value is searched in the data stored in the range of EM1100 words starting
8 from DM1000. The maximum value in the search result is converted to 4-digit BCD data,
and stored in DM2000.
Functions
Data Processing
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"TBCD function"
• The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5,(Page 2-10)
EXTENDED FUNCTIONS
8
Functions
Data Processing
destination .U .S .D .L .F .DF - - - -
*2 range to detect.
device *3*4
n Number of Specifies the device currently storing the
search number of data in the range to search, or .U .U .U .U - - - -
EXTENDED FUNCTIONS
*2
range data the number of search range data.
*6
R MIN function type is identical to the 1st
Return value *5 .U .S .D .L .F .DF - - - -
argument.
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 The range of numerical values that can be handled differs according to the instruction suffix.
*3 When a bit device has been specified, 16/32/64 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32/64 bits straddling the next channel.
*4 When S type is .F or .DF, T and C cannot be specified.
8 *5 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
*6 The ".DF" suffix cannot be specified for device Z.
Functions
Data Processing
Point • The argument devices ".F" and ".DF" can be used in KV STUDIO Ver. 9.0 or later only.
• The argument devices ".F" and ".DF" can be specified with KV-7000 Series CPU units
that have CPU function version 2.0 or later only.
• The return value device ".DF" can be used in KV STUDIO Ver. 6.00 or later only.
• The return value device ".DF" can only be specified with KV-7000 Series CPU units,
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or later, and
with KV Nano Series base units.
"KV-7500/7300 CPU Function Version" (Page 2)
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The minimum value is searched in the (16-bit/32-bit/64-bit) BIN data stored in n words starting
from S . (When the search destination is 32-bit data, the search range becomes the "specified
number of data x 2 words" and when 64-bit data it becomes the "specified number of data x 4 words".)
The minimum value as a result of the search is stored in R .
• S : When the search destination device is unsigned 16-bit data (.U)
bit bit
15 0
S 1234
S +1 2345
Save Min. value
S +2 3456
R Return value
n
…
bit15 bit0
S ˇ n ˉ2 8765
S ˇ n ˉ1 7654
S 1234
S +1 2345
Save Min. value
S +2 3456
R Return value
n
… bit15 bit0
S ˇ n ˉ2 ˉ2345
S ˇ n ˉ1 ˉ3456
EXTENDED FUNCTIONS
bit bit bit bit
31 16 15 0
S +1 12345678 S
S +3 23456789 S +2
n bit
31
bit
0
Functions
Data Processing
31 16 15 0
S +1 12345678 S
S +3 23456789 S +2
n bit
31
R bit
0
• S : When the search destination device is a single precision floating point type (.F)
bit bit bit bit
31 16 15 0
S +1 1.234 S
S +3 2.345 S +2
3.456 Save Min. value
S +5 S +4
n bit
R Return value bit
31 0
• S : When the search destination device is a double precision floating point type (.DF)
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
S +3 1.2345678 S
S +7 2.3456789 S +4
n bit
63
R Return value bit
0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - 8-19
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
DM2000.U = MIN (DM1000.U, 32)
CR2002 #0 DM1000 DM2000
LDA.D MIN STA
Always ON #32 Return value
Search destination device
Sample Program
● When this function is used in combination with other functions
Programmed Script DM2000.S = NEG ( MIN ( DM1000.S, EM1100 ) )
Description of Operation The minimum value is searched in the data stored in the range of EM1100 words starting
8 from DM1000. The sign of the MIN value in the search result is inverted, and stored in
DM2000.S.
Functions
Data Processing
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"NEG function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5,(Page 2-10)
EXTENDED FUNCTIONS
8
Functions
Data Processing
Average
*1
Return value = AVG (operation destination device, number of operation range data )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Operation *6
Specifies the leading device of the
destination .U .S .D .L .F .DF - - - -
*2 range to average.
device *3*4
n Number of Specifies the number of data in the range to
operation average or the device to which that number .U .U .U .U - - - -
EXTENDED FUNCTIONS
*2
range data is currently stored.
*6
R AVG function type is identical to the 1st
Return value *5 .U .S .D .L .F .DF - - - -
argument.
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 The range of numerical values that can be handled differs according to the instruction suffix.
*3 When a bit device has been specified, 16/32/64 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32/64 bits straddling the next channel.
*4 When S type is .F or .DF, T and C cannot be specified.
8 *5 When the type different from the 1st argument is specified by return value, type conversion will
be automatically conducted during conversion.
Functions
Data Processing
Point • The argument devices ".F" and ".DF" can be used in KV STUDIO Ver. 9.0 or later only.
• The argument devices ".F" and ".DF" can be specified with KV-7000 Series CPU units
that have CPU function version 2.0 or later only.
• The return value device ".DF" can be used in KV STUDIO Ver. 6.00 or later only.
• The return value device ".DF" can only be specified with KV-7000 Series CPU units,
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or later, and
with KV Nano Series base units.
"KV-7500/7300 CPU Function Version" (Page 2)
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The average value of all BIN data (16-bit/32-bit (unsigned/signed)/64-bit) stored in n words is
calculated starting from S . (When the operation destination is 32-bit data, the operation range
becomes the "specified number of data x 2 words" and when 64-bit data it becomes the "specified
number of data x 4 words".)
The average value as a result of the search is stored in R .
S 16
S +1 256
S +2 4096
…
n
( n Word) S + n -3 16383 Average is stored in R (return value).
R Return value
S + n -2 32767 bit15 bit0
S -32700
S +1 -16350
S +2 -8175
n
…
…
˄ n Words˅ S ˇ n ˉ3 8175 Average is stored in R (return value).
R Return value
S ˇ n ˉ2 16350 bit15 bit0
EXTENDED FUNCTIONS
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 Words˅ S +2˄ n -3˅+1 78901234 S +2˄ n -3˅ Average is stored in R (return value).
R +1 R
S +2˄ n -2˅+1 89012345 S +2˄ n -2˅ bit
31
bit
0
Functions
Data Processing
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 Words˅ S +2˄ n -3˅+1 78901234 S +2˄ n -3˅ Average is stored in R (return value).
R +1 R
S +2˄ n -2˅+1 89012345 S +2˄ n -2˅ bit
31
bit
0
• S : When the search destination device is a single precision floating point type (.F)
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 Words) S +2 ( n -3) +1 −1.234 S +2 ( n -3) Average is stored in R (return value).
R +1 R
S +2 ( n -2) +1 −2.345 S +2 ( n -2) bit
31
bit
0
• S : When the search destination device is a double precision floating point type (.DF)
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
S +3 1.2345678 S
S +7 2.3456789 S +4
S +11 3.4567890 S +8
…
n
…
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - 8-23
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
DM2000.U = AVG (DM1000.U, 32)
CR2002 #0 DM1000 DM2000
LDA.D AVG STA
Always ON #32 Return value
Operation destination device
Point
8
Functions
Data Processing
EXTENDED FUNCTIONS
8
Functions
Data Processing
Word sum
*1
Return value = WSUM ( operation destination device, number of operation range data )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Operation *6
Specifies the leading device of the
destination .U .U .D .D .F .DF - - - -
*2 range tototal.
device *3*4
n Number of Specifies the device currently storing the
operation number of data in the range to total, or the .U .U .U .U - - - -
EXTENDED FUNCTIONS
*2
range data total range data.
*6
*5
R Return value .L type WSUM function available .U .S .D .L .F .DF - - - -
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 The range of numerical values that can be handled differs according to the instruction suffix.
*3 When a bit device has been specified, 16/32/64 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32/64 bits straddling the next channel.
*4 When S type is .F or .DF, T and C cannot be specified.
8 *5 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*6 The ".DF" suffix cannot be specified for device Z.
Functions
Data Processing
Point • The argument devices ".F" and ".DF" can be used in KV STUDIO Ver. 9.0 or later only.
• The argument devices ".F" and ".DF" can be specified with KV-7000 Series CPU units
that have CPU function version 2.0 or later only.
• The return value device ".DF" can be used in KV STUDIO Ver. 6.00 or later only.
• The return value device ".DF" can only be specified with KV-7000 Series CPU units,
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or later, and
with KV Nano Series base units.
"KV-7500/7300 CPU Function Version" (Page 2)
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The total value of all BIN data (16-bit/32-bit (unsigned)/64-bit) stored in the range of words specified
by n is calculated with the device specified by S as the leading device. (When the operation
destination is 32-bit data, the operation range becomes the "specified number of data x 2 words" and
when 64-bit data it becomes the "specified number of data x 4 words") The operation results and total
value are stored in R .
S 16
S +1 256
S +2 4096
…
S ˇ n ˉ2 32767
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)
S +2 ( n -1) +1 90123456 S +2 ( n -1) Total R Return value
32 bits
EXTENDED FUNCTIONS
• S : When the search destination device is a single precision floating point type (.F)
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) 8
S +2 ( n -1) +1 −3.456 S +2 ( n -1) Total R Return value
Functions
Data Processing
32 bits
• S : When the search destination device is a double precision floating point type (.DF)
bit bit bit bit bit bit bit bit
63 48 47 32 31 16 15 0
S +3 1.2345678 S
S +7 2.3456789 S +4
S +11 3.4567890 S +8
…
…
…
n
(4 n word) S +4 ( n -3) +1 −1.234567 S +4 ( n -3)
S +4 ( n -2) +1 −2.345789 S +4 ( n -2)
S +4 ( n -1) +1 −3.456890 S +4 ( n -1) Total R Return value
64 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
DM2000.L = WSUM (DM1000.U, 24)
CR2002 #0 DM1000 DM2000
LDA.D WSUM STA.L
Always ON #24 Store device
Operation destination device
Reference When the operation result exceeds the range (-2147483648 to +2147483647) of signed
32-bit data, the lower 32-bit data is stored in return value, and the upper 32-bit data is
stored in TM001 and TM000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
EXTENDED FUNCTIONS
"FLOAT function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5,(Page 2-10)
Hint
8 When the result of having performed an operation by the WSUM function exceeds the signed 32-bit
range, the lower 32-bit data is stored in return value, and the upper 32-bit data is stored in temporary
data memories TM0 and TM1.
Functions
Data Processing
The WSUM uses the upper 32-bit (TM0/TM1) data to handle data as 64-bit data.
Reference The temporary data of TM0/TM1 is used also in other operation formulas. For this reason,
when data is to be handled as 64-bit data, the data must be stored in a separate device
immediately after the WSUM has been programmed.
EXTENDED FUNCTIONS
8
Functions
Data Processing
Byte sum
*1
Return value = BSUM (operation destination device, number of operation range data )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Operation
Specifies the leading device of the
destination .U .U .U .U - - - .U - -
*2 *4 range to calculate the total value.
device *3
n Number of
Specifies the number of data (in byte units)
operation .U .U .U .U - - - -
*2 to calculate the total value.
range data
EXTENDED FUNCTIONS
*6
*5
R Return value .U type BSUM function available .U .S .D .L .F .DF - - - -
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
*2 The range of numerical values that can be handled differs according to the instruction suffix.
*3 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32 bits straddling the next channel.
*4 T, C, CTC, CTH, Z cannot be used.
8 *5 When the type other than .D is specified by return value, type conversion will be automatically
conducted during conversion.
*6 The ".DF" suffix cannot be specified for device Z.
Functions
Data Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The total values of each of the lower and upper eight bits of the BIN data currently stored in the
specified range starting from the S are calculated, and are stored in R . When n is an
odd number, up to the upper eight bits of the last device are calculated. Calculation is performed in
order upper to lower bits, and when n is an odd number, the lower eight bits of the last word data
are ignored.
16 bits (1 word)
S BDH 21H
BDH
S +1 B4H DDH 21H
S +2 B7H B0H B4H
…
S ˇ n ÷2ˉ3 4EH 43H 45H
4BH
59H 45H R +1 R
S ˇ n ÷2ˉ2 + 45H
R Return value
S ˇ n ÷2ˉ1 4BH 45H Total
32 bits
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
8-30 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
● Example of format
DM2000.D = BSUM (DM1000, 24)
CR2002 #0 DM1000 DM2000
LDA.D BSUM STA.D
Always ON #24 Storage device
Operation destination device
Reference When the operation result exceeds the signed 32-bit data range, the lower 32-bit data is
stored in return value, and the upper 32-bit data is stored in TM001 and TM000.
EXTENDED FUNCTIONS
Point
• When a device other than the leading device of the channel is specified when a bit
device is specified to S
Sample Program
● When this function is used in combination with other functions
8
Programmed Script DM2000.D = BSUM (DM1000.T, LEN (DM0000.T))
Functions
Data Processing
Description of Operation The ASCII text string currently stored in DM1000.T is totaled in byte units, and the result
is stored in [DM2000, DM2001].
Ladder conversion CR2002 MOV
#0 @VM0
Always ON
LEN
DM0 @VM0
Number of operation range
CR2002 #0 DM1000 DM2000
LDA.D BSUM STA.D
Aways ON @VM0 Storage device
Operation destination device
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"LEN function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5,(Page 2-10)
*1
Return value = CRC ( default, operation method, operation order, invert bit
operation order,data block leading device, number of data )
order
*5
S4 Invert bit order .U .U .U .U - - - -
S5 Data block Specifies the leading device of the data
*3 .U .U .U .U - - - - - -
leading device*5 block to calculate.
n Number of
*4 Specifies the number of data (1- 65535). .U .U .U .U - - - -
data
*7
*6
R Return value .U type CRC function available .U .S .D .L .F .DF - - - -
*1 The return value can be omitted. When omitted, the operation result is stored in internal registers.
8
*2 When the specified device or the value of the formula is other than "0" or "1", the value is handled as " 1 ".
*3 When specifying a bit device, specify the leading device of the channel.
*4 When S3 is "0", specify the number in 1-word (16-bit) units.
When S3 is "1 (other than "0")", specify the number of 1-byte (8-bit) units.
Functions
Data Processing
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The CRC value of n data starting from S5 is calculated in the operation mode specified by
S1 to S4 operation data bit order inversion, and is stored in R .
The operation mode is specified as follows.
CRC Operation Method
Item
When "1" is specified When "0" is specified
The value set to 16-bit internal register is The CRC default is fixed at
S1 CRC default
used as the CRC default. 0x0000.
CRC Operation
S2 CRC-ITU-T(CRC-CCITT) CRC-16(CRC-ANSI)
Method
Operation is performed in order upper 8 bits Operation is performed only on
-> lower 8 bits. the lower 8 bits.
n : Even n : Odd number (The upper 8 bits are ignored.)
Order of bit
15
bit bit
8 7
bit
0
bit
15
bit bit
8 7
bit
0
bit
15
bit bit
8 7
bit
0
S3
operation (1) (2) (1) (2) (1)
(3) (4) (3) (4) (2)
Operation Data
CRC-ITU-T ( S2 =1) CRC-16 ( S2 =0)
Bit Order Inversion
bit bit bit bit
7 0 7 0
Not inverted
S4 : "0" Operating order Operating order
bit bit bit bit
Inverted 7 0 7 0
● Example of format
EXTENDED FUNCTIONS
EM2000.U = CRC (1, 0, 0, 0, DM1000.U, 256)
CR2002 #1
LDA
Always ON
#0 @VB00
<>
#0
#0 @VB01
<>
8
#0
CR2002 @VB02
Functions
Data Processing
Always ON
#0 @VB03
<>
#0
CR2002 CRC
@VB00 DM1000 #256
Always ON
CR2002 EM2000
STA
Always ON Return value
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions", CRC Instruction.
Point When either of the following conditions is established, the value of S1 is stored in
R :
• When a word device or timer/counter has been specified to S1
• When a device other than the leading device of the channel is specified when a
timer/counter or a bit device is specified to S2 by indirect specification
• When the value of n is "0"
Zone reset
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 The ".DF" suffix cannot be specified for device Z.
Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
8
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Functions
Data Processing
Description of Operation
When the execution condition is established (TRUE), all of the values of D1 and D2 are reset.
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
* The suffix is handled as .U even if .D .L .F .DF are specified as the suffix. For this reason, "0" is stored
for the specified one word as the final word.
D1 : R01005ǃ D2 : R01011
R01002: ON ON :R01002
R01003: ON ON :R01003
R01004: ON ON :R01004
EXTENDED FUNCTIONS
R01008: ON Reset OFF :R01008
R01009: ON OFF :R01009
R01010: ON OFF :R01010
D2 R01011: ON OFF :R01011
R01012: ON ON :R01012
R01013: ON ON :R01013
Reference When a word device has been specified, the word becomes "0" in word units, and
when a bit device has been specified, the bit becomes OFF in bit units. 8
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
Functions
Data Processing
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
ZRES (R3000, DM1000.U, DM1099.U)
R3000 DM1000
ZRES
DM1099
Execution condition
Reset device
Sample Program
● To specify the bit device
Programmed Script ZRES (R3000, MR1008, MR1207)
Description of Operation When R3000 turns ON, all of the 32 bits from M1008 to MR1207 are reset (are turned OFF).
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
8 *2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002, or R1012) of the channel has been specified, the relay is
handled in 16/32 bits straddling the next channel.
Functions
Data Processing
*3 When a bit device has been specified, the program will function normally even if the bit device
straddles channels.
When a word device has been specified to D , the LSB of n number of 16-bit word
devices becomes the store destination of the result. Bits other than the lowermost bit do not
change.
Description of Operation
When the execution condition is established (TRUE), n block data starting from S1 and n
block data starting from S2 are each compared.
When the compare result matches, ON is stored in bit devices for the number of compare data starting
from D . When the compare result does not match, OFF is stored.
When the D is a word device, storage of the compare result is handled in 16-bit word device units,
and only the LSB of each word device is targeted. (Bits other than the LSB do not change.)
If all data matches as a result of the compare, R are turned ON. Otherwise, the bit devices are
turned OFF.
S1 +1 5678 S2 +1 5678 D +1 ON
S1 +2 0 S2 +2 1000 D +2 OFF
n
…
˄ n Words˅
S1 + n ˉ2 4567 S2 + n ˉ2 5678 D + n ˉ2 OFF
S1 + n ˉ1 7890 S2 + n ˉ1 7890 D + n ˉ1 ON
S1 +3 56780123 S1 +2 S2 +3 56780123 S2 +2 D +1 ON
…
˄2 n Words˅
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
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, v KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
EXTENDED FUNCTIONS
Reference Manual, "Data Processing Instructions."
● Example of format
R3000 = BCMP (DM1000.U, DM1200.U, MR2000, 40)
CR2002 BCMP
DM1000 DM1200 MR2000
8
Always ON
Compare source device Compare source device Result stroe device
#40
Functions
Data Processing
CR2010 R3000
Sample Program
● When this function is used in combination with other functions
Programmed Script MR2000 = BCMP (DM1000.L, EM2000.L, MR3000, ANDA (EM3000, $3F))
Description of Operation Of signed 32-bit BIN data block starting from DM1000.L and signed 32-bit BIN data
block starting from EM2000 (.L), the data of the number of compare data (number of
compare data x 2 words) indicated by the lower six bits (extracted) of EM3000 are each
compared.
The compare result is stored in 16-bit data starting from MR3000.
If all of the data is matching as a result of the compare, MR2000 is turned ON. Otherwise,
MR2000 is turned OFF.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"ANDA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10)
8 than the leading relay (e.g. R002, or R1012) of the channel has been specified, the relay is
handled in 16/32 bits straddling the next channel.
Functions
Data Processing
*3 When a bit device has been specified, the program will function normally even if the bit device
straddles channels.
When a word device has been specified to D the LSB of n number of 16-bit word
devices becomes the store destination of the result. Bits other than the lowermost bit do not
change.
Description of Operation
When the execution condition is established (TRUE), n block data starting from S1 and the
data in S2 are each compared.
When the compare result matches, ON is in n bit devices starting from D . When the compare
result does not match, OFF is .
When the D is a word device, storage of the compare result is handled in 16-bit word device units,
and only the LSB of each word device is targeted. (Bits other than the LSB do not change.)
If all data matches as a result of the compare, the bit devices specified by the R are turned ON.
Otherwise, the bit devices are turned OFF.
S1 +1 5678 D +1 OFF
bit bit
16 0
S1 +2 0 D +2 OFF
n S2 1234
…
( n Word)
S1 + n ˉ2 1234 D + n ˉ2 ON
S1 + n ˉ1 7890 D + n ˉ1 OFF
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
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
EXTENDED FUNCTIONS
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
R3000 = BCMPI (DM1000.U, DM1200, MR2000, 40)
CR2002 BCMPI
8
DM1000 DM1200 MR2000
Always ON
Compare source device Compare source device Result store device
#40
Functions
Data Processing
CR2010 R3000
Sample Program
● When this function is used in combination with other functions
Programmed Script MR2000 = BCMPI (DM1000.D, RRNCA(MR1000.D, 16), MR3000, 24)
Description of Operation The unsigned 24*32-bit BIN data blocks starting from DM1000.D are each compared
with the value resulting from having rotated (upper/lower words swapped) the unsigned
32-bit BIN data currently in MR1000.D 16 bits to the right without a carry.
The compare result is in 16-bit data starting from MR3000.
If all of the data is matching as a result of the compare, MR2000 is turned ON. Otherwise,
MR2000 is turned OFF.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RRNCA function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10)
Random
*1
Return value = RND (type of random number)
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Type of Specifies the operation destination device of
random generated random number or the operation .U .U .U .U - - - - -
*2
number destination data.
*4
*3
R Return value .U type RND function available .U .S .D .L .F .DF - - - -
EXTENDED FUNCTIONS
*1 The return value can be omitted. When omitted, the operation result is stored instored in working
memory.
*2 When (R1002, R1005, etc.) other than initial channel of the bit device is specified for category of
random number (conversion destination device), jump the following channel can also exert
normal function.
*3 When the type other than .U is specified by return value, type conversion will be automatically
conducted during conversion.
*4 The ".DF" suffix cannot be specified for device Z.
8 Point • The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
Functions
Data Processing
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
S generates the category of random number (operation destination device) to random number
R .
The random number occurring is analog random number of 1- 65535. When S = 0, R stores
1 in return value.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
DM1000.U = RND (DM1000.U)
CR2002 #0
LDA.D
Always ON
MOV
DM1000 @VM0
Type of
random number
RND
@VM0
@VM0 DM1000
LDA STA
Return value
EXTENDED FUNCTIONS
8
Functions
Data Processing
Sort
8 *3
n words are occupied if the type is .D/.L.
When a bit device is specified, 16 continuous bits are occupied. When a word device is
Functions
Data Processing
Point • The SORT function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The n number of binary data items to sort in the data table specified with D data table
leading device is sorted with the sorting order specified in S sorting order.
D 123 3 D
D +1 15 15 D +1
D +2 84 21 D +2
3 84
1398 123
653 653
D + n −1 21 1398 D + n −1
D ・ D +1 12345 6665321 D ・ D +1
31 12345
619987 8004
6665321 2165
D +2(n−1)
・ D +2(n−1)+1 78261 31 D +2(n−1)
・ D +2(n−1)+1
EXTENDED FUNCTIONS
Point The SORT function sorts all data when the function is executed. Therefore, if a large
value is specified in n , the scan time may increase.
If the effect onto the scan time needs to be adjusted, divide the data to be sorted into
several scans using the SORTN function.
"SORTN function", Page 8-44
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see
Instruction Reference Manual, "Data Processing Instructions."
KV-7000/5000/3000/1000 Series and KV Nano Series
8
Functions
Data Processing
● Example of format
SORT (MR1000, EM0, DM2000.D, 100)
MR1000 SORT.D
EM0 DM2000 #100
Partition sort
*1
Return value = SORTN ( sort control flag, sort order, number of comparison times,
data table leading device, number of data items to sort )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S1 Sort control
Controls the sorting process. - - - - - - .B - - -
flag
S2 Specifies the sorting order. (0: ascending, 1:
Sorting order .U .U .U .U - - - -
descending)
EXTENDED FUNCTIONS
S3 Number of
Specifies the number of comparisons to be
comparison .U .U .U .U - - - -
*3 made in one scan. (1 to 65535)
times
D Data table
Specifies the leading device of the byte
leading .U .S .D .L - - - - - -
*2 sequence to search for.
device
n Number of data
*3 Specifies the number of data items to sort. .U .U .U .U - - - -
items to sort
R This device turns OFF during sorting, and
Return value - - - - - - .B - - -
turns ON when sorting is completed.
8 *1 The return value can be omitted. When omitted, the bit information is stored in a work device.
*2 When a bit device is specified, n channel is occupied if the D type is .U/.S, and 2x
Functions
Data Processing
Point • The SORTN function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can only be specified with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The n number of binary data items to sort in the data table specified with D data table
leading device is sorted with the sorting order specified in S2 sorting order.
The number of comparisons made per scan is specified with S3 number of comparison times.
D 123 1 D
D +1 15 3 D +1
D +2 84 15 D +2
D +3 3 71 D +3
D +4 1398 84 D +4
D +5 914 88 D +5
EXTENDED FUNCTIONS
D +6 71 123 D +6
D +7 1 512 D +7
D +8 6219 914 D +8 Three comparisons are made
per scan, and the data is sorted
D +9 7003 1398 D +9
over multiple scans.
D +10 512 6219 D +10 R =ON is written when sorting
is completed.
D +11 88 7003 D +11
Functions
Data Processing
ON
SORTN function
execution conditions OFF
S1 : ON
ON
R :Return value
OFF
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Data Processing Instructions."
● Example of format
MR2000 = SORTN (MR1000, EM10, EM20, DM1000.D, 100)
CR2002 MOV
EM10 @VM0
Always ON Sorting order
MOV
EM20 @VM1
Number of
comparison times
MR1000 SORTN.D
@VM0 DM1000 #100 @VB00
Execution condition
Data table
leading device
@VB00 MR2000
Return value
Write FIFO
FIFOW ([execution condition,] *1 data store device, data table leading device )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Specifies the device to which the data to
Data store Handled as same type
device
*2 write to the FIFO data block is currently as D .
- - - -
stored.
D Data table Specifies the leading device of the FIFO
.U .U .D .D .D - - - - -
leading device data table.
EXTENDED FUNCTIONS
8 Description of Operation
When the execution condition is established (TRUE), the data (16-bit/32-bit) stored in is written
Functions
Table Processing
D +1 max Max. number of storage number: Max number that data block can store (specifyd by user).
Data table
D +2 A
D +n+1 C
• Before executing this function, reset (store "0") the number of data (n) to be stored in D . Also,
set the maximum number of stored data items to D +1.
• As the leading device D of the data table, specify the same device as leading device of the
data table for the corresponding FIFOR function.
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
…
…
S C D +(n+1) C D +(n+1)
EXTENDED FUNCTIONS
bit bit
15 0
D
D
+1
+3
n
max
D
D +2
8
Functions
Table Processing
D +5 A D +4
n D +7 B D +6
:
bit
31
S +1 S bit
0
D +(2n+3) C D +(2n+2)
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)
For details on operation flag changes, "About operation flag (CR2009 to CR2012)", Page 1-18
For details, KV-5500/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual,
"Table Processing Instructions".
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Table Processing Instructions."
Point The function is not executed when either of the following conditions is established:
• When maximum number of stored data is "0"
• When the number of data exceeds the maximum number of stored data
EXTENDED FUNCTIONS
• When the maximum number of stored data is a number that causes the data table to
exceed the device range
Sample Program
● When an index register is used
Description of Operation When R3000 turns ON, the 16-bit data currently stored in DM1000 is written to the end of
the data block starting from DM (2000+Z1).
Functions
Table Processing
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Programmed Script IF LDP (R3000) THEN 'The entire data table is cleared
EXTENDED FUNCTIONS
DM1001 = 10 'The maximum number of
'stored data is set to 10 when
END IF
'R3000 turns ON.
FIFOW (LDP (R3100), DM2000, DM1000) 'Write to the data block is
'performed when R3100 turns ON.
Description of Operation When the rising edge of R3000 (change from OFF to ON state) has been detected, the
data table having ten data blocks is initialized from the 16-bit data table leading device
DM1000. (A data table comprises the number of stored data, maximum number of stored
data, and data block, and is a total of 12 words.)
When the rising edge of R3100 (change from OFF to ON state) has been detected, the 8
16-bit data currently stored in DM2000 is written to the end of the data block.
Functions
Table Processing
Point In a 32-bit data table, the number of stored data, maximum number of stored data, and
data block are all handled as 32-bit data. For this reason, attention is required to the data
table structure (number of required words).
Reference When the data table is a 32-bit data table, single precision floating point type real number
data also can be used as the write data.
Read FIFO
FIFOR ([execution condition,] *1 data table leading device, data store device )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
D1 Data table Specifies the leading device of the FIFO
*2 .U .U .D .D .D - - - - -
leading device data table.
D2 Data store Specifies the leading device to store data Handled as same type
*2
as D1 .
- - - - -
device that is read from the FIFO data block.
R Return value None - - - - - - - - - - -
EXTENDED FUNCTIONS
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32 bits straddling the next channel.
Description of Operation
8 When the execution condition is established (TRUE), the leading data currently stored in data block
specified by the D1 is read, and is stored in D2 .
After the data is stored, the content of the data block is pushed forward by one data, and the number
Functions
Table Processing
D +1 max Max. number of storage number: Max number that data block can store (specifyd by user).
Data table
D +2 A
D +n+1 C
D1 n D1 n-1
D1 +1 max bit
15
D2 bit
0
D1 +1 max bit
15
D2 bit
0
D1 +2 A D1 +2 B A
D1 +3 B D1 +3 C
…
D1 +4 C
: D1 +n E
D1 +n+1 E
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
…
EXTENDED FUNCTIONS
D1 +(2n+1) D D1 +(2n)
D1 +(2n+3) E D1 +(2n+2)
(2) After the data is stored, the content of the data block is pushed forward by one data item at a time.
n is then decremented (by 1) after the data is pushed.
bit bit
31 0
D1 +1 n-1 D1
8
D1 +3 max D1 +2 bit
31
D2 +1 D2 bit
0
D1 +5 B D1 +4 A
D1 +7 C D1 +6
Functions
Table Processing
…
D1 +(2n+1) E D1 +(2n)
D1 +(2n+3) Blank(0) D1 +(2n+2)
Store 0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Table Processing Instructions."
● Example of format
FIFOR (R3000 = OFF, DM2000.U, DM1000)
R3000 FIFOR
DM2000 DM1000
Execution condition
FIFO data table Result store device
Point The function is not executed when either of the following conditions is established:
• 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 a number that causes the data table to
exceed the device range
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
EXTENDED FUNCTIONS
Hint
The data at the start of the data block is read as the data to be read by the FIFOR function.
Programmed Script FIFOW (LDP (R3100), DM2000, DM1000) 'Write to the data block is performed
'when R3100 turns ON.
FIFOR (LDP (R3101), DM1000, DM2100) 'Read from the data block is performed
'when R3101 turns ON.
8 Description of Operation When the rising edge of R3100 (change from OFF to ON state) has been detected, the
data stored in DM2000 is written to the data block starting from DM1000.
Functions
Table Processing
When the rising edge of R3101 (change from OFF to ON state) has been detected, data
is read from the table block and stored in DM2100.
bit bit bit bit bit bit
15 0 15 0 15 0
DM1002 A A B A
…
DM1003 B B
…
DM2000 data
EXTENDED FUNCTIONS
8
Functions
Table Processing
Write LIFO
LIFOW ([execution condition,] *1 data store device, data table leading device )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Specifies the device to which the data to
Data store Handled as same type
*2 write to the LIFO data block is currently as D .
- - - -
device
stored.
D Data table Specifies the leading device of the LIFO
.U .U .D .D .D - - - - -
leading device data table.
EXTENDED FUNCTIONS
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32 bits straddling the next channel.
8 Description of Operation
Functions
Table Processing
When the execution condition is established (TRUE), the data (16-bit/32-bit) stored in S is written
to the end of the data block specified by the D .
D +1 max Max. number of storage number: Max number that data block can store (specifyd by user).
Data table
D +2 A
D +n+1 C
• Before executing this function, reset (store "0") the number of data (n) to be stored in D . Also,
set the maximum number of stored data items to D +1.
• As the leading device D of the data table, specify the same device as leading device of the
data table for the corresponding LIFOR function.
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
…
…
S
EXTENDED FUNCTIONS
bit
15
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)
8
D +1 n D
D +3 max D +2
D A D
Functions
Table Processing
+5 +4
n D +7 B D +6
:
bit
31
S +1 S bit
0
D +(2n+3) C D +(2n+2)
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)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Table Processing Instructions."
● Example of format
LIFOW (R3000, DM1000, DM2000.U)
R3000 LIFOW
DM1000 DM2000
Execution condition
Result store device LIFO data table
Sample Program
● When an index register is used
EXTENDED FUNCTIONS
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Hint
8
The data table used by the LIFOW function is in the same structure as the data table used by the
Functions
Table Processing
DM2000 n n+1
DM2002 A A
DM2003 B B
: :
DM2000+n+1 C C
Add data in DM1000
D D
DM1000 data
EXTENDED FUNCTIONS
8
Functions
Table Processing
Read LIFO
LIFOR ([execution condition,] *1 data table leading device, data store device )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
D1 Data table Specifies the leading device of the LIFO
*2 .U .U .D .D .D - - - - -
leading device data table.
D2 Data store Specifies the leading device to store data Handled as same type
*2
as D1 .
- - - - -
device that is read from the LIFO data block.
R Return value None - - - - - - - - - - -
EXTENDED FUNCTIONS
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 When a bit device has been specified, 16/32 continuous bits are handled. When a relay other
than the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is
handled in 16/32 bits straddling the next channel.
Description of Operation
8 When the execution condition is established (TRUE), the final data currently stored in data block
specified by the D1 is read, and is stored in D2 .
Functions
Table Processing
After the data is stored, the content of the data block is pushed forward by one data, and the number
of stored data is decremented (-1).
("0" is stored in last data section that is read.)
D +1 max Max. number of storage number: Max number that data block can store (specifyd by user).
Data table
D +2 A
D +n+1 C
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
Store 0
8-58 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
• D1 : When the data table leading device is 32 bits (.D/.L/.F)
(1) When the execution condition is ON, the 32-bit data currently stored in [ D1 +(2n+2)/ D1 +
(2n+3)] is stored in device specified by [ D2 / D2 +1].
bit bit
31 0
D1 +1 n D1
D1 +3 max D1 +2
D1 +5 A D1 +4
D1 +7 B D1 +6
…
D1 +(2n+1) C D1 +(2n) D2 +1 D2
EXTENDED FUNCTIONS
bit bit
31 0
D1 +(2n+3) D D1 +(2n+2)
D1 +1 n-1 D1
D1 +3 max D1 +2
D1 +5 A D1 +4
D1 +7 B D1 +6
8
…
Functions
Table Processing
D1 +(2n+1) C D1 +(2n) bit
31
D2 +1 D2 bit
0
Store 0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Table Processing Instructions."
● Example of format
LIFOR (R3000 = OFF, DM2000.U, DM1000)
R3000 LIFOR
DM2000 DM1000
Execution condition
LIFO data table Data store device
Point The function is not executed when either of the following conditions is established:
• 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 a number that causes the data table to
exceed the device range
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
EXTENDED FUNCTIONS
Hint
The data at the end of the data block is read as the data to be read by the LIFOR function.
Programmed Script LIFOW (LDP (R3100 ), DM2000, DM1000) 'Write to the data block is performed
'when R3100 turns ON.
LIFOR (LDP (R3101 ), DM1000, DM2100) 'Read from the data block is performed
'when R3101 turns ON.
8 Description of Operation When the rising edge of R3100 (change from OFF to ON state) has been detected, the
data stored in DM2000 is written to the data block starting from DM1000.
Functions
Table Processing
When the rising edge of R3101 (change from OFF to ON state) has been detected, data
is read from the table block and stored in DM2100.
bit bit bit bit bit bit
15 0 15 0 15 0
DM1002 A A A
DM1003 B B B
Stored in DM2100
…
DM1000+n C C C
DM1000+n+1 D D D
EXTENDED FUNCTIONS
8
Functions
Table Processing
FWRIT( [execution condition, *1 data store device, data table leading device, write block position)
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
Specifies the device to which the data to
S Data store Handled as same type
*2 overwrite is currently stored, or the overwrite as D .
- - - - ƻ ƻ
device
data.
D Data table Specifies the leading device of the data
*2 .U .U .D .D .D - - - - ƻ -
leading device table.
EXTENDED FUNCTIONS
Description of Operation
Functions
Table Processing
When the execution condition is established (TRUE), the data (16-bit/32-bit) stored in S is
overwritten at n of the data block 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
1st A D +2 A D +2
Data list
1st B D +3 B D +3
…
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
1st D +5 A D +4 D +5 A D +4
Data block (for saving data)
1st D +7 B D +7 B
Data list
D +6 D +6
…
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
● Example of format
FWRIT (R3000, DM1000.U, DM2000, 5)
R3000 FWRIT
DM1000 DM2000 #5
Execution condition
Data store device Data table
Point The function is not executed when either of the following conditions is established:
EXTENDED FUNCTIONS
• When the value of n is 0 or greater than number of data (N)
• When maximum number of stored data (max) is "0"
• When the number of data exceeds the maximum number of stored data
• When the maximum number of stored data is a number that causes the data table to
exceed the device range
Sample Program
● When an index register is used 8
Functions
Table Processing
Programmed Script FWRIT (R3000, DM1000:Z1, DM2000:Z2, DM2100)
Description of Operation When R3000 turns ON, the 16-bit data currently stored in DM (1000+Z1) is overwritten on
the block position indicated by DM2100 of the data block starting from DM (2000+Z2).
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Hint
The FWRIT function can be used in either of the data tables used by the FIFOW function/FIFOR
function or the LIFOW function/LIFOR function.
Description of Operation The 16-bit data currently stored in DM1000 is overwritten on each of the second data
blocks of the FIFO data blocks starting from DM2000 and LIFO data blocks starting from
DM3000 at every scan (no execution condition).
bit bit bit bit
15 0 15 0
DM2000 n n DM3000
DM2002 A A DM3002
When the execution condition is established (TRUE), the data (16-bit/32-bit) stored in S is
inserted at n of the data block specified by D .
2st B D +3 B D +3
…
E
…
Nst D D +N+1
D D +(N+1)+1
2st D +7 B D +6 D +7 B D +6
…
D +(2n+5) E D +(2n+4)
…
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Table Processing Instructions."
Point The function is not executed when either of the following conditions is established:
• When the value of n is 0 or greater than number of data (N)
• When maximum number of stored data (max) is "0"
• When the number of data exceeds the maximum number of stored data
EXTENDED FUNCTIONS
• When the maximum number of stored data is a number that causes the data table to
exceed the device range
Sample Program
● When an index register is used
Description of Operation When R3000 turns ON, the 16-bit data currently stored in DM (1000+Z1) is inserted at
the block position indicated by DM2100 of the data block starting from DM (2000+Z2).
Functions
Table Processing
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5 (Page 2-10)
Hint
The FINS function can be used in either of the data tables used by the FIFOW function/FIFOR function
or the LIFOW function/LIFOR function.
Description of Operation The 16-bit data currently stored in DM1000 is inserted at each of the 2nd data blocks of
the FIFO data blocks starting from DM2000 and the LIFO data blocks starting from
DM3000 at every scan (no execution condition).
bit bit bit bit
15 0 15 0
DM2000 n n DM3000
DM2002 A A DM3002
DM1000 data DM1000 data DM1000 data
DM2000+n C C DM3000+n
DM2000+n+1 D D DM3000+n+1
8 Description of Operation
Functions
Table Processing
When the execution condition is established (TRUE), the data at n of the data block specified by
the D is deleted.
After the data is deleted, the content of the data block is pushed forward by one data, and the number
of stored data is decremented (-1).
Number of data N D N 1 D
Max. number of storage data max D +1 max D +1
1st A D +2 A D +2
Data table
2st B D +3 B D +3
…
Data block
(for saving data) n st C D D +N
…
0 D +N+
Number of data D +1 N D D +1 N 1 D
Max. number of storage data D +3 max D +2 D +3 max D +2
Data block (for saving data)
1st D +5 A D +4 D +5 A D +4
Data table
2st D +7 B D +6 D +7 B D +6
…
D +(2N+3) 0 D +(2N+2)
Nst D +(2N+3) D D +(2N+2) Store 0
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-
18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Table Processing Instructions."
Point The function is not executed when either of the following conditions is established:
• When the value of n is 0 or greater than number of data (N)
• When maximum number of stored data (max) is "0"
• When the number of data exceeds the maximum number of stored data
EXTENDED FUNCTIONS
• When the maximum number of stored data is a number that causes the data table to
exceed the device range
Sample Program
● When an index register is used
Programmed Script
Description of Operation
FDEL (R3000, DM2000:Z1, DM2100)
When R3000 turns ON, the data at the block position indicated by DM2100 of the data
8
block starting from DM (2000+Z1) is deleted.
Functions
Table Processing
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
Hint
The FDEL function can be used in either of the data tables used by the FIFOW function/FIFOR function
or the LIFOW function/LIFOR function.
Description of Operation During every scanning (no execution condition), the data stored in the 2nd data block of
DM 2000 FIFO data block, and the 2nd data block of DM3000 LIFO data block will be
deleted once.
bit bit bit bit
15 0 15 0
DM2002 A A DM3002
B B
DM2000+n D D DM3000+n
DM2000+n+1 E E DM3000+n+1
Write time
.U .U .U .U - - - -
S6 Second data (0 to 59) .U .U .U .U - - - -
S7 Day of week data (0 to 6) .U .U .U .U - - - -
R Return value None - - - - - - - - - - -
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
Description of Operation
When the execution condition is established (TRUE), the time data currently stored in S1 to S7
S2 Month 1 to 12
S3 Day 1 to 31
S5 Minute 0 to 59
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Clock Processing Instructions."
MOV
#7 @VM2
MOV
EXTENDED FUNCTIONS
#22 @VM3
MOV
#38 @VM4
MOV
#43 @VM5
MOV
#5 @VM6
@VMO
WTIME 8
Time setting device
Functions
Time Processing
Point • The time data cannot be written independently and directly to control memories.
• When the WTIME function is used, specify the time data in the correct format (year/
month/day/hours/minutes/seconds).
The day of the week is not checked for the year, month, day, hour, minutes, and
seconds settings.
• When the data to write is in the inappropriate format as the time data, the WTIME
function is not executed.
*1 The return value can be omitted. When omitted, the operation result is stored in a work device/a
work memory.
*2 When a bit device has been specified, continuous 96 bits are handled as the date/time data and
continuous 32 bits are handled as the second data. A relay other than the leading relay (e.g.
R002 or R1012) of the channel can be specified.
*3 T, C, CTC, CTH, Z cannot be used.
*4 When the type other than .D is specified by return value, type conversion will be automatically
• The argument device ".DF" can be used only with the KV STUDIO Ver. 6.00 and higher
Functions
Time Processing
Point
versions.
• The argument device ".DF" can only be specified with KV-7000 Series CPU units, with
KV-5500/5000/3000 Series CPU units that have CPU function version 2.0 or higher and
with KV Nano Series base units.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
Description of Operation
The six words (96 bits) of date/time data currently stored starting from S are converted to a total
number of seconds referenced to year 2000, January 1st, 0:0:0 (hours: minutes: seconds), and stored
in R as 32-bit BIN data (unsigned).
S +4 minute 0 to 59
S +5 second 0 to 59
Reference Date/time data is specified entirely as 16-bit BIN data, and can be used as both unsigned
and signed.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Clock Processing Instructions."
Store device
EXTENDED FUNCTIONS
Point When either of the following conditions is established, 0 is stored in R :
• When the date/time data to convert is in an inappropriate format
• When a timer/counter is specified to S and R by indirect specification
Sample Program
● When this function is used in combination with other functions
8
Programmed Script RSEC (TOL (SEC (CM0700)) + 864000, DM2000)
Functions
Time Processing
Description of Operation The date/time ten days from the current date/time is calculated.
The current date/time (2000, January 1st, 0:0:0 (hours: minutes: seconds) data currently
stored starting from CR0700 is converted to a total number of seconds from the
reference date/time.
The total number of seconds ten days after obtained by adding 864000 seconds (ten
days) to the total number of seconds of the conversion result is reverse-calculated to
date/time data, and stored in six words from DM2000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"RSEC function"
• The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
*2
device *3
R Return value None - - - - - - - - - - -
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 When a bit device has been specified, continuous 96 bits are handled as the date/time data and
continuous 32 bits are handled as the second data. A relay other than the leading relay (e.g.
R002 or R1012) of the channel can be specified.
*3 Timer devices and counter devices cannot be used.
8
Description of Operation
Functions
Time Processing
The total number of seconds (32-bit BIN data (unsigned)) referenced to "year 2000, January 1st, 0:0:0"
and specified by the S is converted to date/time data, and is stored in six words (96 bits) starting
from the device specified by the D .
bit
31
S +1 bit bit
16 15
S bit
0
bit
15
bit
0
hour D +3 (0 to 23)
Minute D +4 (0 to 59)
Second D +5 (0 to 59)
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Clock Processing Instructions."
● Example of format
RSEC (DM1000.D, DM2000)
CR2002 RSEC
DM1000 DM2000
Always ON
Conversion source device Store device
Point The function is not executed when either of the following conditions is established:
• When the second data to convert is in an inappropriate format
• When a timer/counter is specified to S and D by indirect specification
EXTENDED FUNCTIONS
(three days) to the total number of seconds of the conversion result is reverse-calculated
to date/time data, and stored in six words from DM2000.
Reference • Note that this function sometimes cannot be used depending on the argument of the
function it is combined with.
"SEC function"
• The KV script is converted to a ladder program before execution. To check the
converted content, refer to "New a box script", step 5, (Page 2-10)
Functions
Time Processing
Adjust
AJST([execution condition,]*1 )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .B .DF .T #/$
R Return value None - - - - - - - - - - -
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
* This function cannot be used with the KV-N14**. No error will occur when an attempt is made to
EXTENDED FUNCTIONS
Description of Operation
When the execution condition is established (TRUE), the "seconds" of the current time according to the
built-in calendar timer is set to "0" when it is 0 to 29, or "minutes" is incremented by one digit and
8 "seconds" is set to "0" when "seconds is 30 to 59 to adjust the timer to the nearest minute unit ("0"
seconds).
Functions
Time Processing
● Example of format
AJST (R3000)
R3000
AJST
Execution condition
Reference When the execution condition is omitted, the script becomes as follows:
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
EXTENDED FUNCTIONS
8
Functions
Time Processing
DI Disable interrupt
EI Enable interrupt
Disable interrupt
DI ([execution condition] *1 )
Enable interrupt
EI ([execution condition] *1 )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
R Return value None - - - - - - - - - - -
EXTENDED FUNCTIONS
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
Description of Operation
The DI function disables execution of the interrupt program when the execution condition is
established (TRUE).
The EI function enables execution of the interrupt program when the execution condition is
established (TRUE).
8 Execution of interrupt programs temporarily disabled by the DIfunction are enabled (disable
canceled) by the EI function.
• Once the EI function is executed, interrupts up to execution of the DI function are enabled.
Processing Functions
High-speed
● Example of format
DI (R3000)
R3000
DI
Execution condition
EI (R3000 = OFF)
R3000
EI
Execution condition
Point When the EI function is executed once in an interrupt disabled state at the start of
operation, interrupts are enabled until the DI function is executed.
Reference When the interrupt program is executed, other interrupts are disabled until execution of that
interrupt program ends. To enable other interrupts, the EI function must be executed during
execution of the interrupt program. When the EI function is executed, the interrupt program
having the higher priority than the executed interrupt factor can be enabled (nested interrupt).
Note, however, that interrupts by the same interrupt factor cannot be programmed.
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
EXTENDED FUNCTIONS
*2 The high-speed counter number is specified as a single digit number (0 to 3). The high-speed
counter number that can be used differs according to the unit.
Description of Operation
When the execution condition is established (TRUE),change the current value of CTH specified by
S high-speed counter no. to the latest value.
At the same time, the CR (control relay) of CTH overflow and change method shall be also changed to 8
the latest status.
Processing Functions
High-speed
KV-5500/5000/3000/1000
High-speed Control relay to be refresh
counter Overflow Change method
CTH0 CR2403 CR2412
CTH1 CR2407 CR2413
KV Nano Seriese
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "High-speed Processing Instructions."
● Example of format
RFSCTH (MR1000, 1)
MR1000 RFSCTH
#1
Execution condition
Disable interrupt
Description of Operation
The DIC function disables execution of the interrupt program when the execution condition is
8 established (TRUE).
At the same time, D is set if the state before function execution is an interrupt enabled state, and
is reset if the state before function execution is an interrupt disabled state.
Processing Functions
High-speed
Reference The interrupt state before execution of the interrupt program is disabled is stored in the
interrupt state store device. For this reason, use this function in combination with the EI
function (enable interrupt) to nest interrupts.
MR1000 D MR1000 D
DIC DIC
Execution condition Execution condition
D D
EI EI
OFF ON
Status for interrupt forbidden Status for allow interrupt
Input
Interrupt program
process
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "High-speed Processing Instructions."
Sample Program
● Example of use
EXTENDED FUNCTIONS
Programmed Script DIC (R2000)
FOR DM1000 = 0 TO 10
DM2000.L = DM2000 + DM1000
NEXT
EI (R2000)
Description of Operation Execution of the interrupt program in the specified range is disabled at every scan (no
execution condition). If the state before execution of the DIC function is the enabled
state, R2000 is set, and if it is interrupt disabled, R2000 is reset.
8
When R2000 is ON (state before execution of interrupt processing is an interrupt enabled
Processing Functions
High-speed
state), execution of the interrupt program by the EI function and below is enabled.
Reference The KV script is converted to a ladder program before execution. To check the converted
content, refer to "New a box script", step 5, (Page 2-10)
.U .U .U .U - - - - ƻ*4 ƻ ƻ
condition falling edge: 2, rising edge and falling edge: 3).
R Return value None - - - - - - - - - - -
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
Description of Operation
8
When the execution condition is TRUE, the 1-word data specified by S is set to the detection
condition of the n2 cause interrupt of n1 unit.
Depending on the value of S , the following detection conditions are available.
Processing Functions
High-speed
S Detection condition
0 to 1 Rising edge
2 Falling edge
3 Rising edge and falling edge
Point • Specifying S to the range of 4 to 65535 does not result in operation error, but
the detection condition is not changed.
• When execution of this instruction is completed, the detection condition is
changed.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "IEDGE Instructions".
● Example of format
IEDGE(MR1000, 1,0, 3)
MR1000 IEDGE KV-SIR32XT
Detection
Unit number Input number condition
#1 #0 #3
EXTENDED FUNCTIONS
8
Processing Functions
High-speed
.S .S .S .S - - - - - -
value operation results.
R Return value None - - - - - - .B - - - -
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 The D1 parameter occupies 51 continuous words. Refer to the explanation of the PIDAT
instruction code for details on the parameter.
• The PIDAT function can be used only with KV STUDIO Ver. 6.00 or higher.
8
Point
• This function can only be used with KV-7000 Series CPU units, with KV-5500/5000/
3000 Series CPU units that have CPU function version 2.0 or higher and with KV Nano
PID Function
Description of Operation
The D2 manipulated value (PID operation results) are retrieved from the S measured value
and D1 parameter. At the first call, (when executing initialization), the execution conditions are
turned ON and the D1 parameter work area is cleared to zero before calling the PIDAT function.
When continuing operations, the execution conditions remain ON, and the PIDAT function is called
out.
Reference After the PIDAT function is called after the execution conditions have turned OFF and ON,
the initialization process will be executed.
● Example of format
PIDAT (DM1000, EM1000, DM2000)
CR2002 PIDAT
DM1000 EM1000 DM2000
Always ON Measured Parameter Manipulated
value leading device value
EXTENDED FUNCTIONS
8
PID Function
Enable logging
logging ID. (0 to 9)
R Return value None - - - - - - - - - - -
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 Cannot be specified by "$".
Description of Operation
8 The LOGE function enables execution of logging by the logging ID specified by the n when the
Log Function
execution condition is established (TRUE). After the function is executed, the logging execution relay
of each logging ID is set.
The LOGD function disables execution of logging by the logging ID specified by the n when the
execution condition is established (TRUE). After the function is executed, the logging execution relay
of each logging ID is reset.
● Example of format
LOGE (R3000, DM1000)
R3000
• DM1000
LOGE
Execution condition Logging ID
Point When a device is specified to n and 10 or more has been set, the function is not
executed.
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
EXTENDED FUNCTIONS
*2 Please specify the logging ID as 0-10. Please specify the logging ID as 10 when instruction
trigger is used on real-time curve monitor.
Description of Operation
When the execution condition is established (TRUE), acquiring logging ID data is specified by the
n logging ID.
Under general condition, data is acquired by log, trace, real-time curve monitor via END processing
timing. Using TRGD instruction, can acquire data via any timing of ladder.
8
Log Function
Point • Only up to eight TRGD functions (instructions) can be used per ID in one project.
• To acquire data using TRGD function (instruction), it is necessary to set trigger
category to "instruction trigger " via log, trace, real-time curve monitor setting of KV
STUDIO. If it is not set to "instruction trigger", even if TRGD function (instruction) is
executed, data cannot be acquired.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual, "Logging Instructions."
● Example of format
TRGD (MR1000, 1)
MR1000 #1
TRGD
Execution condition
S2 Save data store Specifies the leading device to which the data
*4 .U .U .U .U - - - - - -
device *5 to save is currently stored.
n Number of save Specifies the device currently storing the
data store number of data in the range to save, or the .U .U .U .U - - - - -
device number of save data.
D1 Specifies the leading device to store save
Save formatstore
*5 format-related parameters and the save .U .U .U .U - - - - - -
device *6
state of the data.
D2 Save result Specifies the bit device for notifying the save
8
*2 - - - - - - .B - - -
store device result.
R Turns ON when the function is successfully
Return value - - - - - - .B - - -
started up, and turns OFF when startup fails.
Functions
Storage Device
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
*2 When a bit device has been specified to the save result store device, continuous two bits are
used as the notification bit. When a word device has been specified, each of the LSBs of
continuous two words is used as the notification bit device.
*3 To specify a text string using constants, enclose with " ".
*4 When saving index register Z and digital trimmer values set in the access window, copy the data
once to a data memory DM, for example, and then set that data memory DM.
*5 For bit devices, specify the leading device of the channel.
*6 When a bit device has been specified to D1 , 96 continuous bits are occupied. When a word
device has been specified, six continuous words are occupied.
*7 T, C, CR, CTC, CTH, Z cannot be used.
Point Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KVSTUDIO, only a warning is displayed).
Description of Operation
Stored data with range specified by n number of save data store device is written to the memory
card or the CPU memory, at a location starting with a device specified by S2 save data store
device and then a file name (character string) specified by S1 save file name.
Write processing is performed according to the write parameters specified by the D1 , and the write
completion notification and abnormal end alarm notification are stored in D2 .
When the MWRIT function is successfully started up, the R is turned ON. If startup failed, the
return value is turned OFF.
For details on parameters relating to the save format that is stored in D1 , KV-7000/5000/3000/
1000 Series and KV Nano Series Instruction Reference Manual "MWRIT Instruction."
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual, "Storage Device Instructions".
EXTENDED FUNCTIONS
● Example of format
MR1100 = MWRIT (DM5000.T, DM1000.U, DM1100.U, DM1200.U,
MR2000)
CR3214 @VB01
Execute command
of storage @VB00
device in progress RES
CR3214 CJ
#2000
8
Execute command of storage
Functions
Storage Device
device in progress FOR
#2
@VB00 MWRIT
DM5000 DM1000 DM1100
Save file name Save data Number of
@VB00 @VB00
SET
NEXT
LABEL
#2000
@VB01 MR1100
Point The function is not executed when either of the following conditions is established:
• When the text string specified by S1 does not contain the end code (NUL (00H))
• When the text string specified by S1 exceeds 247 characters (including end code
“NUL (00H)")
• When a timer/counter is specified to S1 by indirect specification
• When a device other than the leading device of the channel is specified when a bit
device is specified to S1 , S2 and D1
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
*2 When a bit device has been specified to the read result store device, continuous two bits are
used as the notification bit. When a word device has been specified, each of the LSBs of
continuous two words is used as the notification bit device.
*3 To specify a text string using constants, enclose with " ".
*4 For bit devices, specify the leading device of the channel.
*5 When reading ASCII text string data, specify the maximum number of characters (number of
bytes) in the text string.
*6 When a bit device has been specified to D2 , 96 continuous bits are occupied. When a word
device has been specified, six continuous words are occupied.
*7 T, C, CR, CTC, CTH, Z cannot be used.
Point Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
Data of file name (character string) specified by S Read File Name is read from the storage,
starting from device specified by D1 Read Data Store Device, with range specified by n
Number Of Read Data, and then stored.
Read processing is performed according to the read parameters specified by the D2 , and the read
completion notification and abnormal end alarm notification are stored in D3 .
When the MREAD function is successfully started up, the R is turned ON. If startup failed, the
return value is turned OFF.
For details on parameters relating to the read format that is stored in D2 , KV-7000/5000/3000/
1000 Series and KV Nano Series Instruction Reference Manual "MREAD Instruction."
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Storage Device Instructions."
EXTENDED FUNCTIONS
● Example of format
MR1100 = MREAD (DM5000.T, DM1000.U, DM1100.U, DM1200.U,
MR2000)
CR3214 @VB01
Execute command
of storage device @VB00
in progress RES
CR3214 CJ 8
#2000
Functions
Storage Device
Execute command of
storage device in progress FOR
#2
@VB00 MREAD
DM5000 DM1000 DM1100
Read file name Read data Number of
saving data
DM1200 MR2000
@VB00 @VB00
SET
NEXT
LABEL
#2000
@VB01 MR1100
Point The function is not executed when either of the following conditions is established:
• When the text string specified by S does not contain the end code (NUL (00H))
• When the text string specified by S exceeds 247 characters (including end code
“NUL (00H)")
• When a timer/counter is specified to S by indirect specification
• When a device other than the leading device of the channel is specified when a bit
device is specified to S , D1 and D2
• When a value outside of the range is specified to an argument
• When a value is specified for reservation of an argument
D2 Get result store Specifies the bit device for notifying the free
*3 - - - - - - .B - - -
device space get result.
Point Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
Obtain the free space (in kilobyte units) on the memory card or CPU memory specified by the n
drive number, store the 32-bit binary data (two words) on the device specified by the D1 capacity
storage device, and the free space completion notice and abnormal end alarm notice on D2
obtained result device.
D1 +1 D1
Free Space Available
32-bit BIN data
Memory card
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details, please see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference
Manual, "Storage Device Instructions."
Execute command
of storage device @VB00
in progress RES
CR3214 CJ
#2000
Execute command of
storage device in progress
FOR
EXTENDED FUNCTIONS
#2
@VB00 MFREE
DM1000 R1000
@VB00 @VB00
SET
NEXT
8
LABEL
Functions
Storage Device
#2000
@VB01 MR1100
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 getting 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 MFREE function is not executed while a storage device function is being executed
(CR3214 is ON).
• When a relay other than the leading relay of the channel has been specified to D1 ,
the function is not executed.
• This instruction cannot be used in interrupt programs or in the initialization module.
D2 Get result store Specifies the bit device for notifying the
*3 - - - - - - .B - - -
device free space get result.
R Turns ON when the function is successfully
Return value - - - - - - .B - - -
started up, and turns OFF when startup fails.
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
*2 When a bit device has been specified, 32 continuous bits from the start of the channel are
handled.
*3 When a bit device has been specified to the get result store device, continuous two bits are
8 used as the notification bit. When a word device has been specified, each of the LSBs of
continuous two words is used as the notification bit device.
Functions
Storage Device
*4 For KV-7000 Series, you can select memory card or CPU memory for checking the free space.
Point • The MFREEK function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV-NC32T.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
Obtain the free space (in kilobyte units) on the memory card or CPU memory specified by the n
drive number, store the 32-bit binary data (two words) on the device specified by the D1 capacity
storage device, and the free space completion notice and abnormal end alarm notice on D2
obtained result device.
D1 +1 D1
Free Space Available
32-bit BIN data
Memory card
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "MFREEK Instruction."
Execute command
of storage device @VB00
in progress RES
CR3214 CJ
#2000
Execute command of
storage device in progress
FOR
EXTENDED FUNCTIONS
#2
@VB00 MFREEK
EM1000 MR2000
@VB00 @VB00
SET
8
NEXT
LABEL
Functions
Storage Device
#2000
@VB01 MR1100
Item Description
This device turns OFF when execution of the instruction starts, and turns
Completion ON when acquisition of free space on the memory card (or CPU memory)
D2
notification ends. The device turns ON whichever way execution ends, successfully or
in error.
Error This device turns OFF when execution ends successfully, and turns ON
D2 +1
notification when execution ends in error.
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 getting 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 function is not executed while a storage device function is being
executed (CR3214 is ON).
• When a relay other than the leading relay of the channel has been specified to D1 ,
the function is not executed.
• This instruction cannot be used in interrupt programs or in the initialization module.
D Make result store Specifies the device for notifying the make
*4 - - - - - - .B - - -
device result.
R Turns ON when the function is successfully
Return value - - - - - - .B - - -
started up, and turns OFF when startup fails.
*1 The return value can be omitted. When omitted, the operation result is stored in a work device/
relay.
*2 To specify a text string using constants, enclose with " ".
*3 For bit devices, specify the leading device of the channel.
8 *4 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
been specified, each of the lowermost bits of two continuous words is used as the notification bit
Functions
Storage Device
Point Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
A directory is made on the memory card or CPU memory using the path name (test string) specified
by S .
The make result is stored in D .
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Storage Instructions."
Execute command
of storage device @VB00
in progress RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR
EXTENDED FUNCTIONS
#2
@VB00 MMKDIR
DM1000 R1000
@VB00 @VB00
SET
NEXT
LABEL 8
#2000
Functions
Storage Device
@VB01 MR1100
Item Description
Turns OFF when execution of the function starts, and turns ON when the
Completion
D directory has finished being made.
notification
Turns ON whichever way execution of the function ends, successfully or in error.
Error Turns OFF when execution of the function ends successfully, and turns ON
D +1
notification when execution ends in error.
Point • Several scans are sometimes required for making the directory.
• The result of END processing after execution of the function is completed is written for
the notification bit device.
• The store destination when indirect specification or index modify is specified to a
notification bit device becomes the store destination at the rising edge of the execution
condition.
• The MMKDIR function is not executed while a storage device function is being
executed (CR3214 is ON).
• The function is not executed when either of the following conditions is established:
• When the text string specified by S does not contain the end code (NUL
(00H))
• When the text string specified by S exceeds 247 characters (including end
code “NUL (00H)")
• When a timer/counter is specified to S by indirect specification
• When a device other than the leading device of the channel is specified when a bit
device is specified to S
• This instruction cannot be used in interrupt programs or in the initialization module.
stored in DM1000.
The make result is stored in R5000 (notification of DIR make completion this time) and
R5001 (DIR make result notification this time).
When startup of the MMKDIR function fails (MR2000=OFF), R5000 is turned ON to start
up the MMKDIR function again.
EXTENDED FUNCTIONS
8
Functions
Storage Device
*1 The return value can be omitted. When omitted, the operation result is stored in working device.
*2 To specify a text string using constants, enclose with " ".
*3 When a bit device has been specified, specify the leading device of the channel.
*4 When a bit device has been specified, 2 continuous bits are occupied. When a word device has
8 been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
Functions
Storage Device
Point Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
Delete a directory from memory card or CPU memory, using a path name (character string) specified
by S Delete Directory Name.
Delete result is stored in D .
Execute command of
storage device in progress @VB00
RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR
EXTENDED FUNCTIONS
#2
@VB00 MRMDIR
DM1000 MR2000
@VB00 @VB00
SET
NEXT
LABEL 8
#2000
Functions
Storage Device
@VB01 MR1100
Return value
Item Description
Turns OFF when execution of the function starts, and turns ON when the
Completion
D directory has finished being deleted.
notification
Turns ON whichever way execution of the function ends, successfully or in error.
Error Turns OFF when execution of the function ends successfully, and turns ON
D +1
notification when execution ends in error.
Point • Several scans are sometimes required for deleting the directory.
• The result of END processing after execution of the function is completed is written for
the notification bit device.
• Storage destination during indirect specifying, index modification in notice bit device
changes to the storage destination for the rising edge of function operation.
• The MRMDIR function is not executed while a storage device function is being
executed (CR3214 is ON).
• The function is not executed when either of the following conditions is established:
• When the text string specified by S does not contain the end code (NUL
(00H))
• When the text string specified by S exceeds 247 characters (including end
code “NUL (00H)")
• When a timer/counter is specified to S by indirect specification
• When a device other than the leading device of the channel is specified when a bit
device is specified to S
• This instruction cannot be used in interrupt programs or in the initialization module.
8 been specified, each of the lowermost bits of two continuous words is used as the notification bit
device. Bits other than the lowermost bit do not change.
Functions
Storage Device
Point Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
Delete the file whose file name (text string) specified by S from the memory card or CPU memory.
Delete result is stored in D .
Execute command of
storage device in progress @VB00
RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR
EXTENDED FUNCTIONS
#2
@VB00 MDEL
DM1000 MR2000
@VB00 @VB00
SET
NEXT
LABEL 8
#2000
Functions
Storage Device
@VB01 MR1100
Return value
Item Description
Completion During function operation, OFF; file deletion is complete, ON.
D
notification Turns ON whichever way execution of the function ends, successfully or in error.
Error Turns OFF when execution of the function ends successfully, and turns ON
D +1 notification when execution ends in error.
Point • Several scans are sometimes required for deleting the directory.
• The result of END processing after execution of the function is completed is written for
the notification bit device.
• Storage destination during indirect specifying, index modification in notice bit device
changes to the storage destination for the rising edge of function operation.
• The MDEL function is not executed while a storage device function is being executed
(CR3214 is ON).
• The function is not executed when either of the following conditions is established:
• When the text string specified by S does not contain the end code (NUL
(00H))
• When the text string specified by S exceeds 247 characters (including end
code “NUL (00H)")
• When a timer/counter is specified to S by indirect specification.
• When a device other than the leading device of the channel is specified when a bit
device is specified to S .
• This instruction cannot be used in interrupt programs or in the initialization module.
Point • The MPRINT function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV-NC32T.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
The text string specified with S2 write text string is written to the end of the file name (text string)
specified with S1 save file name. If the save file specified with S1 is not found, a new file will be
created.
The writing completion notice and abnormal end error notice are stored in D write results storage
device.
The R return value turns ON when the MPRINT function starts normally, and turns OFF if it fails.
Reference The notification bit for the D write results storage device has the following meaning.
(Example) When MR2000 has been specified
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Storage Instructions."
Execute command of
@VB00
storage device in progress
RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR
EXTENDED FUNCTIONS
#2
@VB00 MPRINT
DM5000 DM1000 MR2000
8
LABEL
#2000
@VB01 MR1100
Functions
Storage Device
Return value
*1 The return value can be omitted. When omitted, the operation result is stored in a work device/relay.
*2 The read parameter occupies four continuous words.
*3 The reading results storage device uses four continuous bits as the notification bits.
*4 To specify a text string using constants, enclose with " ".
*5 For bit devices, specify the leading device of the channel.
*6 T, C, CTC, CTH, Z cannot be used.
Point • The MREADL function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV-NC32T.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
One line is read from the file name (text string) specified with S read file name, and is read to the
device specified with D1 read text string storage destination device.
(The character codes which express a line are 0DH (CR), 0AH (LF) and 0D0AH (CR+LF).)
The maximum byte size of the text string to read out is set with [ D2 +2] (number of upper limit bytes
to read). If the length of text data of one line in the file is longer than that specified by [ D2 +2],
[ D3 +3] (no line return character notification) is ON and text data is stored in D1 up to [ D2 +2]
bytes.
The reading completion notice and abnormal end alarm notice are stored in D3 read text string
storage destination device.
The R return value turns ON when the MREADL function starts normally, and turns OFF if it fails.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on D2 and D3 parameters, see KV-7000/5000/3000/1000 Series and KV Nano
Series Instruction Reference Manual, "MREADL Instruction."
Execute command of
storage device in progress @VB00
RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR
EXTENDED FUNCTIONS
#2
@VB00 MREADL
DM5000 DM1000 EM1000 MR2000
8
LABEL
#2000
@VB01 MR1100
Functions
Storage Device
Return value
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
*2 The copy format parameter occupies one word.
*3 The copy results storage device uses two continuous bits as the notification bits.
*4 To specify a text string using constants, enclose with " ".
*5 For bit devices, specify the leading device of the channel.
*6 T, C, CTC, CTH, Z cannot be used.
Point • The MCOPY function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV-NC32T.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
The file name (text string) specified with S1 copy source file name/folder name is copied into the
file specified with S2 copy destination file name/folder name.
If a file or folder with the same name is found at the copy destination, whether to overwrite the data or
generate an error will be judged following the S3 copy format parameters.
When copy format parameter value is 0: If file with same name is found, data is overwritten.
When copy format parameter value is 1: If file with same name is found, error occurs without
overwriting the data.
The copy completion notice and abnormal end alarm notice are stored in D copy results storage
device.
The R return value turns ON when the MCOPY function starts normally, and turns OFF if it fails.
S2
● Example of format
EXTENDED FUNCTIONS
MR1100 = MCOPY (DM5000.T, DM1000.T, EM1000, MR2000)
CR3214 @VB01
Execute command of
@VB00
storage device in progress
RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR 8
#2
Functions
Storage Device
@VB00 MCOPY
DM5000 DM1000 EM1000 MR2000
LABEL
#2000
@VB01 MR1100
Return value
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
*2 The move format parameter occupies one word.
*3 The move results storage device uses two continuous bits as the notification bits.
*4 To specify a text string using constants, enclose with " ".
*5 For bit devices, specify the leading device of the channel.
*6 T, C, CTC, CTH, Z cannot be used.
Point • The MMOV function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV-NC32T.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
The file name (text string) specified with S1 move source file name/folder name is moved to the file
specified with S2 move destination file name/folder name.
If a file or folder with the same name is found at the move destination, whether to overwrite the data or
generate an error will be judged following the S3 move format parameters.
When move format parameter value is 0: If file with same name is found, data is overwritten.
When move format parameter value is 1: If file with same name is found, error occurs without
overwriting the data.
The move completion notice and abnormal end alarm notice are stored in D move results storage
device.
The R return value turns ON when the MMOV function starts normally, and turns OFF if it fails.
S2
EXTENDED FUNCTIONS
● Example of format
MR1100 = MMOV (DM5000.T, DM1000.T, EM1000, MR2000)
CR3214 @VB01
Execute command of
storage device in progress @VB00
RES
CJ
8
CR3214
#2000
Execute command of
storage device in progress FOR
Functions
Storage Device
#2
@VB00 MMOV
DM5000 DM1000 EM1000 MR2000
LABEL
#2000
@VB01 MR1100
Return value
*4
renamed *5 text string in the range of 1 to 247 characters
(including end code NUL and folder name).)
EXTENDED FUNCTIONS
8
device
R Turns ON if function starts successfully,
Return value - - - - - - .B - - -
and turns OFF if the function fails.
Functions
Storage Device
*1 The return value can be omitted. When omitted, the operation result is stored in a work device.
*2 The move results storage device uses two continuous bits as the notification bits.
*3 To specify a text string using constants, enclose with " ".
*4 For bit devices, specify the leading device of the channel.
*5 T, C, CTC, CTH, Z cannot be used.
Point • The MREN function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV-NC32T.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
The file name or folder name (text string) specified with S1 file name/folder name to be renamed is
renamed with the file name or folder name specified with S2 new file name/folder name.
The rename completion notice and abnormal end alarm notice are stored in D file name rename
results storage device.
The R return value turns ON when the MREN function starts normally, and turns OFF if it fails.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on actions, see KV-7000/5000/3000/1000 Series and KV Nano Series Instruction
Reference Manual, "MREN Instruction."
Execute command of
storage device in progress @VB00
RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR
EXTENDED FUNCTIONS
#2
@VB00 MREN
DM5000 DM1000 MR2000
LABEL
#2000
8
Functions
Storage Device
@VB01 MR1100
Return value
D1 File status
storage Specifies the device which stores the file
.U .U .U .U - - - - - -
destination status.
*4
device
D2 Retrieved results
Specifies the bit device which notifies the
storage - - - - - - .B - - -
*2 retrieved results.
device
R Turns ON if function starts successfully,
Return value - - - - - - .B - - -
and turns OFF if the function fails.
8 *1 The return value can be omitted. When omitted, the operation result is stored in a work device.
*2 The reading results storage device uses three continuous bits as the notification bits.
Functions
Storage Device
Point • The MSTAT function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV-NC32T.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
• Cannot be used with KV-N14**/N24**/N40**/N60**. (A conversion error will not occur in
KV STUDIO, only a warning is displayed).
Description of Operation
The status of the file specified with S file name is stored in D1 file status storage destination
device.
The retrieval completion notification, abnormal end alarm notification and presence of file are stored in
D2 retrieved results storage device.
The R return value turns ON when the MSTAT function starts normally, and turns OFF if it fails.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "MSTAT Instruction."
Execute command of
@VB00
storage device in progress
RES
CR3214 CJ
#2000
Execute command of
storage device in progress FOR
EXTENDED FUNCTIONS
#2
@VB00 MSTAT
DM5000 EM1000 MR2000
8
LABEL
#2000
@VB01 MR1100
Functions
Storage Device
Return value
Point 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 will not occur and the function
Description of Operation
When the S1 is ON, the value specified by the S2 is displayed on the access window as user
message 1.
When the S1 is OFF, display of user message 1 is canceled.
● Example of format
AWNUM (R3000, DM1000)
CR2002 MOV
DM1000 CM1720
Always ON
Usermessage 1
R3000 CR2900
SET
Usermessage 1 display
R3000 CR2900
RES
Usermessage 1 display
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Access Window Instructions."
Reference When user messages 1 and 2 are displayed simultaneously, user message 1 is given
priority and displayed.
EXTENDED FUNCTIONS
• When a project contains multiple AWNUM functions, the state of the access window
conforms to the last executed AWNUM function.
• This instruction cannot be used in interrupt programs or in the initialization module.
Functions
Access Window
8 Point 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 will not occur and the function
will not execute. (A conversion error will not occur in KV STUDIO).
Functions
Access Window
Description of Operation
When S1 is ON, the value specified by the S2 is displayed on the access window as user
message 2.
When S1 is OFF, display of user message2 is canceled.
● Example of format
AWMSG (R3000, DM1000.T)
CR2002 SMOV
DM1000 CM1721
Always ON
Usermessage 2-1
R3000 CR2901
SET
Usermessage 2 display
R3000 CR2901
RES
Usermessage 2 display
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Access Window Instructions."
Reference When user messages 1 and 2 are displayed simultaneously, user message 1 is given
priority and displayed.
EXTENDED FUNCTIONS
display is canceled.
(CR2901 also is reset at this time.) If the AWMSG function is called again, CR2900
turns ON.
• When a project contains multiple AWMSG functions, the state of the access window
conforms to the last executed AWMSGfunction.
• Only text strings up to 24 characters (ASCII codes 20h to 7Eh, A1h to DFh) long from
the text string currently stored starting from the device specified by S2 can be
displayed in the access window. 2-byte characters such as Chinese characters cannot
be displayed. 8
• This instruction cannot be used in interrupt programs or in the initialization module.
Functions
Access Window
• The function is not executed when either of the following conditions is established:
• When a device other than the leading device of the channel is specified when a bit
device is specified to S2
• When a timer/counter is specified to S2 by indirect specification
Description of Operation
When S1 executions conditions are turned from OFF to ON, the user message specified according
to the user message ID displayed in S2 is displayed.
Reference To remove user message display, operate the access window or execute the AWHIDE
8 command.
For details on operation flag changes, see "About operation flag (CR2009 to CR2012)", Page 1-18
Functions
Access Window
Point • When execution conditions are ON, S2 value does not change even if altered.
• CR is set for user message of ID designated at the rising edge of executions conditions.
• If the AWSHOW function and the AWHIDE function are executed simultaneously, follow
operation of the function executed last.
• If there are multiple AWSHOW functions in a project, the state of the access window
follows the first AWSHOW function that is executed.
• This instruction cannot be used in interrupt programs or in the initialization module.
EXTENDED FUNCTIONS
hidden
R Return value None - - - - - - - - - - -
Description of Operation
When S1 execution conditions are turned from OFF to ON, the user message display specified
according to the user message ID display in S2 is hidden.
Functions
Access Window
section.
Point • When execution conditions are ON, S2 value does not change even if altered.
• CR is set for user message of ID designated at the start of executions conditions.
• If the AWSHOW function and the AWHIDE function are executed simultaneously,
follows operation of the function executed last.
• This instruction cannot be used in interrupt programs or in the initialization module.
Description of Operation
When execution condition is true, refresh FREE RUN counter (CM708, CM709) to the latest value.
The following shows devices of updated FREE RUN counter.
KV-7500/7300 CM1030 to CM1031: 1ms counter
CM1032 to CM1033: 10us counter
CM1034 to CM1035: 1us counter
8 KV-5500/5000/3000,KV Nano
CM1036 to CM1037: 0.1us counter
CM708 to CM709: 1ms counter
Function
FREE RUN Counter
For details, KV-7000/5000/3000/1000 Series and KV Nano Series Instruction Reference Manual,
"Free Run Counter Instruction."
● Example of format
RFSFRC (MR1000)
MR1000 RFSFRC
Execution condition
EXTENDED FUNCTIONS
8
Function
FREE RUN Counter
SPRD (execution condition, unit number, node address, slot number, parameter number,
completion code )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Execution Specifies the bit device used for execution
condition - - - - - - .B - -
condition.
n1 *1 Specifies a unit number (0 to 48,
Unit number - - - - - - - - -
KV-7500/KV-5500 is "0").
EXTENDED FUNCTIONS
8
R Return value None - - - - - - - - - -
*1 $ (hexadecimal specification) cannot be used. The range for KV Nano Series unit numbers is 0 to 15.
*2 CTC, CTH, Z cannot be used.
Sensor Setting Function
*3 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is handled in
16 bits straddling the next channel.
*4 For bit devices, specify the leading device of the channel.
*5 The number of stored words (four words or more) differs according to the execution results.
Point • The SPRD function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV Nano Series basic unit.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Description of Operation
When the S execution conditions turn ON, the parameters specified with n4 for the node
address n2 and slot number n3 sensor connected to the n1 unit are read out. When
finished, the completion bit is set in bit 0 of D , the execution failed bit in bit 1 of D , the
completion code in D +1, the detailed completion code in D +2, the number of array
elements (1 when not an array) in D +3, and the contents of the read parameter in D +4 and
following.
EXTENDED FUNCTIONS
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code is stored when reading of the
D +1 Completion code
parameters is completed. (Normally 0)
The detailed completion code is stored when reading of the
D +2 Detailed completion code
parameters is completed.
The number of array elements in the read parameter is stored.
D +3 Number of array elements 1 is stored if the parameter is not an array, and 0 is stored if
the instruction ends abnormally.
D +4 to Read results
The parameter value is stored. The number of data items
occupied differs according to the read parameter.
8
If the sensor parameter read instruction is executed at the rising edge of the execution conditions, the
process will continue even if the input conditions are turned OFF at the next scan. The result storage
destination device completion bit and failed bit turn ON at completion, and turn OFF when execution
starts.
When the instruction is executed, the number of sensor setting instruction executions is incremented
by 1, and is decremented when the execution finishes.
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Sensor Setting Instructions."
● Example of format
Programmed Script SPRD (MR0,1,1,1,805,DM0)
Description of Operation When MR000 turns ON, the contents of parameter No. 805 for the node address 1, slot
No. 1 sensor connected to the first connected unit are read out and stored in DM0 and
following.
Ladder conversion SPRD
MR000
#1 #1 #1
#805 DM0
SPWR (execution condition, unit number, node address, slot number, parameter number,
completion code )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Execution Specifies the bit device used for execution
condition - - - - - - .B - -
condition.
n1 *1 Specifies a unit number (0 to 48,
Unit number - - - - - - - - -
KV-7500/KV-5500 is "0").
EXTENDED FUNCTIONS
8
R Return value None - - - - - - - - - -
*1 $ (hexadecimal specification) cannot be used. The range for KV Nano Series unit numbers is 0 to 15.
*2 CTC, CTH, Z cannot be used.
Sensor Setting Function
*3 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is handled in
16 bits straddling the next channel.
*4 For bit devices, specify the leading device of the channel.
*5 The number of stored words (four words or more) differs according to the execution results.
Point • The SPWR function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV Nano Series basic unit.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Description of Operation
When the S execution conditions turn ON, the setting value specified with D +4 and following
is written into the parameter specified with n4 of the node address n2 , slot No. n3 sensor
connected to the n1 unit. When writing is completed, the completion bit is set in bit 0 of D , the
execution failed bit in bit 1 of D , the completion code in D +1, and the detailed completion
code in D +2.
EXTENDED FUNCTIONS
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code is stored when writing of the parameter
D +1 Completion code
is completed. (0 when normal)
The detailed completion code is stored when writing of the
D +2 Detailed completion code
parameter is completed.
D +3 Reserved for system 0 (fixed value)
The setting value is stored. The number of data items
D +4 to Setting value
occupied differs according to the write parameter.
The execution will fail if an "EtherNet/IP device reserved" sensor (adaptor) is specified.
8
Point
● Example of format
Programmed Script SPWR (MR0,1,1,1,833,DM0)
Description of Operation When MR000 turns ON, the setting value 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.
Ladder conversion SPWR
MR000
#1 #1 #1
#833 DM0
SSVC (execution condition, unit number, node address, slot number, parameter number,
completion code )
Argument/Return Recognized Type Const
Explanation Device Formula
Value .U .S .D .L .F .DF .B .T #/$
S Execution Specifies the bit device used for execution
condition - - - - - - .B - -
condition.
n1 *1 Specifies a unit number (0 to 48,
Unit number - - - - - - - - -
KV-7500/KV-5500 is "0").
EXTENDED FUNCTIONS
8
R Return value None - - - - - - - - - -
*1 $ (hexadecimal specification) cannot be used. The range for KV Nano Series unit numbers is 0 to 15.
*2 CTC, CTH, Z cannot be used.
Sensor Setting Function
*3 When a bit device has been specified, 16 continuous bits are occupied. When a relay other than
the leading relay (e.g. R002 or R1012) of the channel has been specified, the relay is handled in
16 bits straddling the next channel.
*4 For bit devices, specify the leading device of the channel.
*5 Up to six words are used depending on the specified service.
Point • The SSVC function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV Nano Series basic unit.
"KV-5500/5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Description of Operation
When the execution conditions turn ON, the service specified with n4 of the node address n2 ,
slot No. n3 sensor connected to the n1 unit is executed. When execution is completed, the
completion bit is set in bit 0 of D , the execution failed bit in bit 1 of D , the completion code in
D +1, and the detailed completion code in D +2.
EXTENDED FUNCTIONS
Reserved for
Bits 2 to 15 OFF (fixed value)
system
The completion code is stored when execution of the service
D +1 Completion code
is completed. (0 when normal)
The detailed completion code is stored when execution of the
D +2 Detailed completion code
service is completed.
D +3 Reserved for system 0 (fixed value)
D +4 Specifies the send data (maximum two words) according to
Send data
+5 the service being executed.
8
D
Point The execution will fail if an "EtherNet/IP device reserved" sensor is specified.
● Example of format
Programmed Script SSVC (MR0,1,2,3,1,DM0)
Description of Operation When MR000 turns ON, the service No. 1 service of the node address 2, slot No. 3
sensor connected to the unit No. 1 KV-EP21V is executed. The results are stored in DM0
and following.
Ladder conversion SSVC
MR000
#1 #2 #3
#1 DM0
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 For bit devices, specify the leading device of the channel.
Point • The RFSCI function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV Nano Series basic unit.
Description of Operation
When the execution conditions turn ON, the cyclic communication input data from the data assigned
to the device specified with S to the number of data items specified with n is refreshed. (If
the leading device is 32-bit data, the number of refreshed words is number of data items x 2.)
• When S : leading device is 16 bits (.U/.S)
Example) When leading device is DM102 (.U) and number of data items is 3
CPU unit KV-EP21V
assignment device cyclic communication data
DM100 Leading word
DM101 Leading word+1
DM102 Leading word+2
DM103 Leading word+3
DM104 Leading word+4
Data in specified Leading word+5
DM105
range is refreshed.
• When S : leading device is 32 bits (.D/.L/.F)
Example) When leading device is DM102.D and number of data items is 3
CPU unit KV-EP21V
assignment device cyclic communication data
DM101 DM100 Leading word+1 Leading word
DM103 DM102 Leading word+3 Leading word+2
DM105 DM104 Leading word+5 Leading word+4
DM107 DM106 Leading word+7 Leading word+6
DM109 DM108 Leading word+9 Leading word+8
DM111 DM110 Leading word+11 Leading word+10
Data in specified
range is refreshed.
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Refresh Cyclic Communication Instruction".
EXTENDED FUNCTIONS
8
Refresh Function
Cyclic Communication
*1 [ ] can be omitted. (When the execution condition has been omitted, the instruction is executed
at all times (at every scan).)
*2 For bit devices, specify the leading device of the channel.
Point • The RFSCO function can be used only with KV STUDIO Ver. 6.00 or higher.
• This function can be specified only with KV-7000 Series CPU unit, KV-5500/5000/3000
Series CPU unit with CPU function version 2.0 or higher, or KV Nano Series basic unit.
8
"KV-5500/5000/3000 CPU Function Version" (Page 2)
"KV Nano Series CPU Function Version" (Page 2)
Refresh Function
Cyclic Communication
Description of Operation
When the execution conditions turn ON, the cyclic communication input data from the data assigned
to the device specified with D to the number of data items specified with n is refreshed. (If
the leading device is 32-bit data, the number of refreshed words is number of data items x 2.)
• When D : leading device is 16 bits (.U/.S)
Example) When leading device is DM102 (.U) and number of data items is 3
CPU unit KV-EP21V
assignment device cyclic communication data
DM100 Leading word
DM101 Leading word+1
DM102 Leading word+2
DM103 Leading word+3
DM104 Leading word+4
Data in specified Leading word+5
DM105
range is refreshed.
• When D : leading device is 32 bits (.D/.L/.F)
Example) When leading device is DM102.D and number of data items is 3
CPU unit KV-EP21V
assignment device cyclic communication data
DM101 DM100 Leading word+1 Leading word
DM103 DM102 Leading word+3 Leading word+2
DM105 DM104 Leading word+5 Leading word+4
DM107 DM106 Leading word+7 Leading word+6
DM109 DM108 Leading word+9 Leading word+8
DM111 DM110 Leading word+11 Leading word+10
Data in specified
range is refreshed.
For details on execution timing, see KV-7000/5000/3000/1000 Series and KV Nano Series
Instruction Reference Manual, "Cyclic Communication Refresh Instruction".
EXTENDED FUNCTIONS
8
Refresh Function
Cyclic Communication
8
Refresh Function
Cyclic Communication
APPENDICES
CR/CM List ······················································· A-2
ASCII Code Table············································· A-45
List of Characters That Cannot Be Used ··············· A-46
List of Unusable Functions ································· A-48
Index ····························································· A-49
Functions Index ··············································· A-54
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
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
APPENDICES
CR1000 to
Real-time chart monitor (ID10)
CR1015
CR1100 to
− Reserved for the system
CR2001
CR2002 R Always turned ON
CR2003 R Always turned OFF
CR2004 R 10 ms clock pulse (duty cycle: 50%)
CR2005 R 100 ms clock pulse (duty cycle: 50%)
CR2006 R 1 s clock pulse (duty cycle: 50%)
CR2007 R Turned OFF for just one scan when operation starts
CR2008 R Turned ON for just one scan when operation starts
CR2009 Turned ON when the calculation result is negative or when an overflow occurs
CR2010 R Turned ON when the calculation result is zero
CR2011 R Turned ON when the calculation result is positive
CR2012 R Turned ON when a calculation execution error occurs
CR2013 to
− Reserved for the system
CR2302
CR2303 Fixed scan time operation (ON: enabled, OFF: disabled)
Turned ON for just one scan when the scan time setting (the fixed scan time operation and END
CR2304 R
processing time settings) is exceeded
CR2305 − Reserved for the system
CR2306 R Indicates backup battery errors (ON: error, OFF: normal)
CR2307 Clears the minimum and maximum scan time values
Sets the END processing time (ON: enabled, OFF: disabled; if CR2303 is turned ON at the same
CR2308
time, CR2303 is given priority)
CR2309
and − Reserved for the system
CR2310
CR2311 R Indicates RTC low voltage error (ON: error has occurred, OFF: normal)
CR2312 − Reserved for the system
CR2313 Forces switch of the VT sensor application screen (ON: switch, OFF: do not switch)
Attribute
CR R: Read only Function
Blank: Read/write
Project password authentication status (ON: authentication disabled, OFF: authentication
CR2314 R
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
CR3203 R CPU memory save error
CR3204 to
− Reserved for the system
CR3206
Instruction RAM mode operation
CR3207 The RAM mode activation of file register instructions, storage device instructions towards the
CPU memory. (ON: enable, OFF: disable)
APPENDICES
CR3208 to
− Reserved for the system
CR3209
CR3210 R Arbitrary logging/trace operation
CR3211 to
− Reserved for the system
CR3213
CR3214 R Storage instruction executing
CR3215 − Reserved for the system
CR3300 to
Alarm relay
CR3415
CR/CM List
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
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - A-3
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
− 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
APPENDICES
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
R: Read only Hold
CM Function
Blank: Read/ Yes: Hold
write
CM0000 and
− Reserved for the system
CM0699
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 to
− Reserved for the system
APPENDICES
CM709
CM0710 R File register current bank number
CM0711 − Reserved for the system
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
CR/CM List
CM908 to
− Reserved for the system
CM999
CM1000 and
R Scan time measuring value (1 μs) (32-bit)
CM1001
CM1002 and
R END processing time measured value (1 μs unit) (32-bit)
CM1003
CM1004 and
R Minimum fixed scanning time (1 μs unit) (32-bit)
CM1005
CM1006 and
R Maximum fixed scanning time (1 μs unit) (32-bit)
CM1007
CM1008 and
Fixed scanning time run set value (1 μs unit) (32-bit)
CM1009
CM1010 and
END processing time set value (1 μs unit) (32-bit)
CM1011
CM1012 and
R Scanning time when setting is exceeded (1 μs unit) (32-bit)
CM1013
CM1014 and
R END processing time exceeds value (1 μs unit) (32-bit)
CM1015
CM1016 to
− Reserved for the system
CM1029
CM1030 and
R 32-bit 1 ms Free Run counter
CM1031
CM1032 and
R 32-bit 10 μs Free Run counter
CM1033
CM1034 and
R 32-bit 1 μs Free Run counter
CM1035
CM1036 and
R 32-bit 0.1 μs Free Run counter
CM1037
CM1038 to
− Reserved for the system
CM1499
CM1500 to
R Log/trace (ID0 to ID9) File Save Counter
CM1509
Attribute
R: Read only Hold
CM Function
Blank: Read/ Yes: Hold
write
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)
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
APPENDICES
CM1700 and
Digital trimmer 0 upper limit (32-bit)
CM1701
CM1702 and
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
CR/CM List
CM1710 and
Digital trimmer 5 upper limit (32-bit)
CM1711
CM1712 and
Digital trimmer 6 upper limit (32-bit)
CM1713
CM1714 and
Digital trimmer 7 upper limit (32-bit)
CM1715
CM1716 to
− Reserved for the system
CM1719
CM1720 R AW user message display number
CM1721 to
− Reserved for the system
CM1735
CM1736 AW initial display language setting
CM1737 AW initial comment number setting
CM1738 Access window operation disabled setting
CM1739 − Reserved for the system
CM1740 to
R Ladder project name (up to 32 characters + end code)
CM1772
CM1773 to
− Reserved for the system
CM1779
CM1780 Access window initial screen setting, enabled
CM1781 Access window initial screen setting, device type
CM1782 Access window initial screen setting, screen ID
CM1783 Access window initial screen setting, screen ID
CM1784 Access window initial screen setting, device number
CM1785 Access window initial screen setting, device number
CM1786 Access window initial screen setting, display format
CM1787 Access window initial screen setting, device name representation
CM1788 Access window initial screen setting, key lock status
Attribute
R: Read only Hold
CM Function
Blank: Read/ Yes: Hold
write
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
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)
APPENDICES
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
CM5099
CM5100 R Year and month Yes
CM5101 R Day Yes
CM5102 R Hour Yes
CM5103 R Minute Yes
CR/CM List
CM5104 R Second Yes
Details of the latest serious
CM5105 R Number Yes
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.
• No. 50, 53, 55, 56, 58, 59, 63 (unit number errors)
Detailed Information, Piece n Explanation
Detailed information 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 2 to 20
Fixed to 00H
(CM5108 to CM5126)
APPENDICES
(CM5157)
Detailed information 2 to 20
Fixed to 00H
(CM5158 to CM5176)
CR/CM List
Error number of each unit
(CM5158)
Expansion Information 3 to 20
Fixed to 00H
(CM5159 to CM5176)
The control relay (CR0000 to CR7915) can check the operating state of the CPU unit, and set up or monitor each built-in
function.
The system-reserved control relay cannot be used.
Attributes
Device No. R: Read only. Function
Blank: R/W
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
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)
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
CR/CM List
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
Attributes
Device No. R: Read only. Function
Blank: R/W
CR2412 R CTH0 change direction (ON: at the side of subtraction, OFF: at the side of adding)
CR2413 R CTH1 change direction (ON: at the side of subtraction, OFF: at the side of adding)
CR2414 R CTH0 special internal block (50ns)
CR2415 R CTH1 special internal block (50ns)
CR2500 Start operation (ON: enable, OFF: disable)
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
CR2802 R Scan data load
Serial
CR2803 R 1 scanning ON in the event of occurrence of text data receiving error
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
CR/CM List
instruction are executed (ON: enable, OFF: disable)
When DASC.S, DASC.L and FASC instruction execution are executed, "+" is
CR2815
omitted. (ON: enable, OFF: disable)
CR2900 User message display1 (ON: display, OFF: not display)
Access window
CR2901 User message display2 (ON: display, OFF: not display)
CR2902 to CR2915 - Reserved for the system
CR3000 Limit switch CW input
CR3001 Limit switch CCW input
CR3002 Origin sensor input
CR3003 Stop sensor input
CR3004 R In the course of zero suppression
CR3005 R Origin suppression end
CR3006 Positioning end relay
CR3007 CPU positioning Error/clearing error
CR3008 function axis X Warning/clearing warning
CR3009 Pulse output/emergency stop
CR3010 Driver operation start
CR3011 Current value change request (level detection)
CR3012 Operation speed change request (level detection)
CR3013 Consistency relay of comparator 2
CR3014 -
Reserved for the system
CR3015 -
Attributes
Device No. R: Read only. Function
Blank: R/W
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
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
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
CR/CM List
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
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
CM1595 CTH01 change direction detection constant
CM1596, CM1597 Lower limit of CTH0 ring counter
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
CR/CM List
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
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
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)
APPENDICES
Attributes
Device No. R: Read only. Function
Blank: R/W
APPENDICES
CM2024 Error code
CM2025 Specify point No.
CM2026, CM2027 Resting position coordinate setpoint
CM2028, CM2029 Comparator 2
CM2030 I/O setting
CM2031 Start sensor
CM2032, CM2033 Comparator 0
CR/CM List
CM2034, CM2035 Comparator 1
CM2036 Origin return: starting speed
CM2037 Zero return: acceleration/deceleration time
CM2038, CM2039 Origin return: running speed
CM2040 JOG operation: starting speed
CM2041 CPU JOG operation: acceleration/deceleration time
CM2042, CM2043 Positioning JOG operation: running speed
CM2044, CM2045 function Current value change setting value
CM2046, CM2047 Y axis Operation speed change setting value
CM2048 Set up the origin return detail
CM2049 Operation in progress point No.(M code)
CM2050, CM2051 R Current position
CM2052, CM2053 R Current speed
CM2054 Error code
CM2055 Specify point No.
CM2056, CM2057 Resting position coordinate setpoint
CM2058, CM2059 Comparator 2
CM2060, CM2061 Target value/amount of movement
CM2062 Startup speed
CPU
CM2063 Positioning Acceleration/deceleration time
CM2064, CM2065 function Operation speed
CM2066 Point parameter Operation mode
CM2067 0 Specified pulse number for stop sensor
CM2068, CM2069 Reserved for system
CM2070 to CM2379 Point parameter 1 to 31 (The same with CM2060 to CM2069)
CM2380 to CM2389 - Reserved for system
CM2390 R Error code used for memory card instruction
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
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
APPENDICES
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:
APPENDICES
15 Frequency counter instruction operand error
16 0 division operation
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
CR/CM List
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
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
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
APPENDICES
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
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
CR/CM List
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)
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
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
APPENDICES
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)
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
CR/CM List
CR2602, Rising Edge Falling Edge Both Rising and Falling Edges
CR2603 CR2602 OFF ON OFF ON
CR2603 OFF OFF ON ON
CR2604, Rising Edge Falling Edge Both Rising and Falling Edges
CR2605 CR2604 OFF ON OFF ON
CR2605 OFF OFF ON ON
CR2606, Rising Edge Falling Edge Both Rising and Falling Edges
CR2607 CR2606 OFF ON OFF ON
CR2607 OFF OFF ON ON
CR2608 to
Reserved for the system
CR2813
Zero suppression during execution of DASC and FASC instructions (all suffixes; ON: execute,
CR2814
OFF: do not execute)
Omission of "+" during execution of DASC.S, DASC.L, and FASC instructions (ON: execute, OFF:
CR2815
do not execute)
User message display 1
CR2900
(ON: displayed, OFF: hidden)
Access window
User message display 2
CR2901
(ON: displayed, OFF: hidden)
CR2902 to
- Reserved for the system
CR2914
CR2915 R Indicates the presence of an access window cassette (ON: connected, OFF: not connected)
CR3000 Project load execution request
CR3001 - Reserved for the system
CR3002 Project save execution request
CR3003 - Reserved for the system
CR3004 Project load execution completion
A-24 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
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
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
APPENDICES
CR3513
CR3514 Disables multiple keys
HKEY instruction
CR3515 R Scan completion
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
CR/CM List
CR3704 LED1 customize indicator 1
CR3705 LED2 customize indicator 2
CR3706 LED3 customize indicator 3
CR3707 LED4 customize indicator 4
CR3708 Green back light (lights when this is turned ON)
CR3709 Red back light (lights when this is turned ON)
Operator panel KV-D30 System message display language (ON: Japanese, OFF:
CR3710
English)
CR3711 Buzzer ON
Screen display setting (ON: positive display, OFF:
CR3712
negative display)
CR3713 Alarm interrupt enable (ON: enabled, OFF: disabled)
Page switching (switches to the page indicated by the
CR3714
value of CM0401 on a rising edge; forced OFF)
CR3715 Disables page switching using the "▲" and "▼" keys
(ON: disabled, OFF: enabled)
CR3800 Sets external output 0 to ON when this is turned ON
CR3801 Sets external output 1 to ON when this is turned ON
CR3802 to
- Reserved for the system
CR3815
CR3900 The serious error log is cleared when this switches from OFF to ON
CR3901 The minor error log is cleared when this switches from OFF to ON
CR3902 R Indicates that the serious error log is full
CR3903 R Indicates that the minor error log is full
CR3904 R RUN-PROG selector switch status (ON: RUN, OFF: PROG)
CR3905 R A serious error has occurred
CR3906 R A minor error has occurred
CR3907 The power on log is cleared when this switches from OFF to ON
CR3908 The power off log is cleared when this switches from OFF to ON
CR3909 Clears the current error
Attribute
CR R: Read only Function
Blank: Read/write
CR3910 to
- Reserved for the system
CR4115
CR4200 R CTH0 dedicated internal clock (50 ns)
CR4201 R CTH0 dedicated internal clock (1 μs)
CR4202 R CTH0 dedicated internal clock (10 μs)
CR4203 R CTH0 dedicated internal clock (100 μs)
CR4204 - Reserved for the system
CR4205 R Indicates the presence of CTH0 (ON: present, OFF: not present)
CR4206 Detects overflows and underflows of CTH0 (ON: detected, OFF: not detected)
CR4207 R Indicates the change direction of CTH0 (ON: down counting, OFF: up counting)
CTH0 external signal preset
CR4213 to
- Reserved for the system
CR4302
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
CR/CM List
CR4306
CTC0 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4307 time that comparator CTC0 is turned ON (ON: execute,
OFF: do not execute)
Comparator matching output disabled when comparator
CR4308
CTC1 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output turned OFF when
CR4309 comparator CTC1 is turned ON (ON: execute, OFF: do
not execute)
Action when high-speed counter Comparator matching output turned ON when comparator
CR4310
comparator CTC1 is turned ON CTC1 is turned ON (ON: execute, OFF: do not execute)
Comparator matching output inversion (ON/OFF) each
CR4311 time that comparator CTC1 is turned ON (ON: execute,
OFF: do not execute)
Automatic reset of CTH0 (ON: execute, OFF: do not
CR4312
execute)
High-speed counter CTH0 count input mode selection
Single Phase
1x 2x 4x 2-Pulse
CR4313 to W/O Direction W/ Direction
CR4315 CR4313 OFF ON OFF ON OFF ON
CR4314 OFF OFF ON ON OFF OFF
CR4315 OFF OFF OFF OFF ON ON
Attribute
CR R: Read only Function
Blank: Read/write
CTH1 external signal preset
APPENDICES
Comparator matching output inversion (ON/OFF) each
CR4507 time that comparator CTC2 is turned ON (ON: execute,
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)
CR/CM List
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
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
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
APPENDICES
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
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
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
APPENDICES
CR5000 to
- Reserved for the system
CR5315
CR5400 Start operation (ON: execute, OFF: do not execute)
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
CR/CM List
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
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
Attribute
CR R: Read only Function
Blank: Read/write
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
CR8200 Forced stop
CR8201 Deceleration stop
CR8202 Error clear
CR8203 Warning clear
CR8204 Current coordinate change request (level detection)
APPENDICES
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
CR8214 Origin sensor input
CR8215 Stop sensor input
CR8300 Forced stop
CR/CM List
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)
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
Attribute
CR R: Read only Function
Blank: Read/write
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
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
APPENDICES
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
CR8701 R Positioning complete relay
CR8702 R Error
CR8703 R Warning
CR8704 R Origin returning operation in progress
CR/CM List
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
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
APPENDICES
CM0199
CM0200,
Attribute setting displayed on the first line Set
CM0201
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
CR/CM List
CM0210 to
Page 1 to 19 (the same as CM0200 to CM0209) Set
CM0399
CM0400 For enabling and disabling transitions Set
CM0401 For the page switching setting Set
CM0402 Current page displayed Set
CM0403 to Operator panel KV-D30 Reserved for the system Set
CM409
CM0410 to
Direct access function Set
CM415
CM0416 to
Reserved for the system Set
CM0499
CM0500 to
- Reserved for the system
CM699
CM0700 R Read from RTC (year)
CM0701 R Read from RTC (month)
CM0702 R Read from RTC (day)
CM0703 R Read from RTC (hour)
CM0704 R Read from RTC (minute)
CM0705 R Read from RTC (second)
CM0706 R Read from RTC (day of the week)
CM0707 - Reserved for the system
CM0708,
R 32-bit, 1 ms, free-run counter
CM709
CM0710 Reserved for the system
CM0711 R CPU function version
Attribute Hold
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM0712 to
- Reserved for the system
CM719
CM0720 R Scan time measured value (in units of 10 μs)
CM0721 Set value during fixed scan time operation (in units of 10 μs)
Scan time (in units of 10 μs) when the scan time setting (the fixed scan time
CM0722 R
operation and END processing time settings) is exceeded
CM0723 R END processing time measured value (in units of 10 μs)
CM0724,
- Reserved for the system
CM725
CM0726 R Minimum scan time value (in units of 10 μs)
CM0727 R Maximum scan time value (in units of 10 μs)
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
APPENDICES
CM1602,
R Input capture when INT1 occurs
CM1603
CM1604,
R Input capture when INT2 occurs
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
CR/CM List
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 ID9)
CM1669
CM1670 to
- Reserved for the system
CM1679
CM1680 R Logging or tracing 0 file save counter ○
CM1681 R Logging or tracing 1 file save counter ○
CM1682 R Logging or tracing 2 file save counter ○
CM1683 R Logging or tracing 3 file save counter ○
CM1684 R Logging or tracing 4 file save counter ○
CM1685 R Logging or tracing 5 file save counter ○
CM1686 R Logging or tracing 6 file save counter ○
CM1687 R Logging or tracing 7 file save counter ○
CM1688 R Logging or tracing 8 file save counter ○
CM1689 R Logging or tracing 9 file save counter ○
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM1690 to
- Reserved for the system
CM1699
CM1700 R AutoLoad folder No. (request) ○
CM1701 R RunLoad folder No. (request) ○
CM1702 R Folder No. during project load (request) ○
CM1703 R Folder No. during project save (request) ○
CM1704 to
Reserved for the system
CM1709
CM1710 R Completion code of automatic loading when power is turned on
CM1711 R Automatic loading folder No. during power-on (complete)
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) ○
APPENDICES
CM1718,
- Reserved for the system
CM1719
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))
CR/CM List
CM1757 to Project name to be displayed in the access window
CM1763 (up to 12 characters + end code (00H))
CM1764 to
- Reserved for the system
CM1779
CM1780 Access window initial screen setting, enabled ○
CM1781 Access window Access window initial screen setting, device type ○
CM1782 Access window initial screen setting, screen ID ○
CM1783 Access window initial screen setting, screen ID ○
CM1784 Access window initial screen setting, device number ○
CM1785 Access window initial screen setting, device number ○
CM1786 Access window initial screen setting, display format ○
Access window initial screen setting, device name
CM1787 ○
representation
CM1788 Access window initial screen setting, key lock status ○
Access window initial screen setting, display
CM1789 ○
language
CM1790 to
- Reserved for the system
CM2199
CM2200 Year and month ○
CM2201 Day ○
CM2202 Hour ○
CM2203 Minute ○
CM2204 Seconds ○
CM2205 Detailed information of Number ○
the latest serious error, 1 Detailed information, number of valid pieces of data
CM2206 ○
unit
CM2207 Detailed information, piece 01 ○
CM2208 Detailed information, piece 02 ○
: ○
CM2226 Detailed information, piece 20 ○
CM2227 to
- Reserved for the system
CM2249
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM2250 Year and month ○
CM2251 Day ○
CM2252 Hour ○
CM2253 Minute ○
CM2254 Seconds ○
Detailed information of
CM2255 the latest minor error, Number ○
1 unit*1
CM2256 Detailed information, number of valid pieces of data ○
CM2257 Detailed information, piece 01 ○
CM2258 Detailed information, piece 02 ○
: ○
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
APPENDICES
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
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM4828,
- Reserved for the system
CM4829
CM4830 Constant when rotation direction is detected ○
CM4831 Enable, clear, and sign setting ○
CM4832,
High-speed counter Ring counter lower limit ○
CM4833
function (CTH3)
CM4834,
Ring counter upper limit ○
CM4835
CM4836,
Preset input ○
CM4837
CM4838,
- Reserved for the system ○
CM4839
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 ○
APPENDICES
CM4905 - Reserved for the system
CM4906 Set frequency (Hz) ○
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 ○
CR/CM List
CM4914 External input source ○
CM4915 - Reserved for the system
CM4916 Set frequency (Hz) ○
Specified frequency pulse
CM4918 Duty cycle (0 to 100%) ○
output function (CH1)
CM4919 - Reserved for the system
CM4920,
R Frequency measured result (Hz or rpm)
CM4921
CM4922 Number of pulses per rotation ○
Frequency counter
CM4923 function (CTH2) Number of scans ○
CM4924 External input source ○
CM4925 - Reserved for the system
CM4926 Set frequency (Hz) ○
Specified frequency pulse
CM4928 Duty cycle (0 to 100%) ○
output function (CH2)
CM4929 - Reserved for the system
CM4930,
R Frequency measured result (Hz or rpm)
CM4931
CM4932 Number of pulses per rotation ○
Frequency counter
CM4933 function (CTH3) Number of scans ○
CM4934 External input source ○
CM4935 - Reserved for the system
CM4936 Set frequency (Hz) ○
Specified frequency pulse
CM4938 Duty cycle (0 to 100%) ○
output function (CH3)
CM4939 Reserved for the system
CM4940 to
- Reserved for the system
CM4999
CM5000 to
For built-in serial assignment
CM5999
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM6000 to
For extension function assignment 1
CM6999
CM7000 to
For extension function assignment 2
CM7999
CM8000,
Target value or travel Set
CM8001
CM8002 Acceleration rate Set
CM8003 Deceleration rate Set
CM8004, CPU positioning function,
axis 1
Operation frequency Set
CM8005
CM8006 Point parameter 1 Operation mode Set
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
APPENDICES
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8800 I/O setting
CM8801 Sensor enable
CM8802,
Comparator 0, current value
CM8803
CM8804,
Comparator 1, current value
CM8805
CM8806,
Comparator 2, positioning
CM8807
CM8808 Starting speed
CM8809 Origin returning operation: starting frequency
CM8810 Origin returning operation: acceleration rate
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
APPENDICES
CM8817 CPU positioning function, JOG operation: deceleration rate
axis 1
CM8818,
JOG operation: operation frequency
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
CR/CM List
CM8827 mode
CM8828,
Target coordinate change value
CM8829
CM8830,
R Output pulse, current coordinate
CM8831
CM8832,
R Output frequency, current value
CM8833
CM8834 R Error code
CM8835 R Execution point number
CM8836 to
- Reserved for the system
CM8839
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8840 I/O setting
CM8841 Sensor enable
CM8842,
Comparator 0, current value
CM8843
CM8844,
Comparator 1, current value
CM8845
CM8846,
Comparator 2, positioning
CM8847
CM8848 Starting speed
CM8849 Origin returning operation: starting frequency
CM8850 Origin returning operation: acceleration rate
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
APPENDICES
CM8867 mode
CM8868,
Target coordinate change value
CM8869
CM8870,
R Output pulse, current coordinate
CM8871
CM8872,
R Output frequency, current value
CM8873
CM8874 R Error code
CM8875 R Execution point number
CM8876 to
- Reserved for the system
CM8879
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8880 I/O setting
CM8881 Sensor enable
CM8882,
Comparator 0, current value
CM8883
CM8884,
Comparator 1, current value
CM8885
CM8886,
Comparator 2, positioning
CM8887
CM8888 Starting speed
CM8889 Origin returning operation: starting frequency
CM8890 Origin returning operation: acceleration rate
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
APPENDICES
CM8897 CPU positioning function, JOG operation: deceleration rate
axis 3
CM8898,
JOG operation: operation frequency
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
CR/CM List
CM8907 mode
CM8908,
Target coordinate change value
CM8909
CM8910,
R Output pulse, current coordinate
CM8911
CM8912,
R Output frequency, current value
CM8913
CM8914 R Error code
CM8915 R Execution point number
CM8916 to
Reserved for the system
CM8919
Hold
Attribute
CM Function ○: Hold
R: Read only
Set: Holding can
Blank: Read/write
be set
CM8920 I/O setting
CM8921 Sensor enable
CM8922,
Comparator 0, current value
CM8923
CM8924,
Comparator 1, current value
CM8925
CM8926,
Comparator 2, positioning
CM8927
CM8928 Starting speed
CM8929 Origin returning operation: starting frequency
CM8930 Origin returning operation: acceleration rate
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
APPENDICES
CM8947 mode
CM8948,
Target coordinate change value
CM8949
CM8950,
R Output pulse, current coordinate
CM8951
CM8952,
R Output frequency, current value
CM8953
CM8954 R Error code
CM8955 R Execution point number
CM8956 to
Reserved for the system
CM8959
APPENDICES
17 Illegal logging ID.
18 Direct processing error.
19 Unit on which direct processing cannot be performed.
20 Jump destination subroutine does not exist.
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.
CR/CM List
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.
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - A-43
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
High 4-bit
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 「 イ ツ メ
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 ・ オ ナ ユ
A S
6 C
K
Y
N & 6 F V f v ヲ カ ニ ヨ
Low 4-bit
B E
7 E T ’ 7 G W g w ァ キ ヌ ラ
APPENDICES
L B
8 BS AN ( 8 H X h
C
x ィ ク ネ リ
9 HT EM ) 9 I Y i y ゥ ケ ノ ル
A LF UB
S
: J Z j z ェ コ ハ レ
B VT SC + ; K [ k {
E
ォ サ ヒ ロ
When KV-700/700+M, KV-P16, KV-10 (16), or KV-24 (40) is selected for the PLC model
Characters that cannot be used
When KV-700/700+M, KV-P16, KV-10 (16), or KV-24 (40) is selected for the PLC model
Characters that cannot be used
APPENDICES
Character strings that cannot be used IF, THEN, ELSIF, ELSE, END_IF,
INITIAL_STEP, END_STEP,
NOT, MOD, AND, XOR, OR,
PROGRAM, WITH, END_PROGRAM, R_EDGE,
READ_ONLY, READ_WRITE,
REPEAT, UNTIL, END_REPEAT,
RESOURCE, END_RESOURCE,
RETAIN, NON_RETAIN,
RETURN,
● Function block
Type of function Function
Macro functions MCALL/MSTRT Macro call / macro start
* The FEND (function block end) function is written in the function block. It cannot be used in other types of programs such
List of Unusable Functions
as functions or modules.
● Function
Type of function Function
Macro functions MCALL/MSTRT Macro call / macro start
Function block
FB Function block
functions
● Macros
Type of function Function
Macro functions MCALL/MSTRT Macro call / macro start
Function block
FB/FUN Function block / function
functions
* The MEND (macro end) function is written in the self-holding type macro. It cannot be used in other types of programs
such as sub-routine type macros or modules.
A C
About assignment statement ·······················1-10 Call function list ·······································2-52
Bit assignment ······································1-10 Calling Function Blocks ·····························2-46
Numerical value assignment ····················1-10 Calling function blocks ····························2-46
Text string assignment ····························1-10 Calling function blocks
About comments function ···························2-57 Calling functions ···································2-46
About control statement ·····························1-12 Change priority ········································· 4-8
Conditional transfer control statements ······1-12 Combination of index modification and
Loop control statement ···························1-13 indirect specifying ··································3-54
About control statements nesting ·················4-32 Comment writing method ···························2-57
About infinite loop ·····································4-37 Comparison operator ································· 4-6
About Input Auxiliary Function ·····················2-52 Comparison operator priority ························ 4-8
About label suffix ······························ 1-15, 2-32 Conditional transfer control statements ·········1-12
About label type ·······································2-32 Constant ·················································3-44
About operation type ·································3-63 (#) DEC constant ···································3-44
About parallel connection of box script ··········2-39 $ HEX constant ·····································3-45
About processing time ·······························4-35 Double precision floating point type
About script function ·································1-17 constant ···········································3-46
APPENDICES
About suffix ·············································1-14 Fixed text string
About the bit of global label ························2-33 (text string type constant) ·····················3-46
About timer actions in a loop control Single precision floating point type
statement ············································4-37 constant ···········································3-45
Actual nesting actions ·······························4-34 Control memory CM ··································3-40
AND ······················································· 4-7 Control relay CR ······································3-30
Application area of work devices ··················2-63 Control Relays ·································· A-2, A-10
Application method of indirect specifying ·······3-51 Control Statement List ·······························4-10
Index
Area script ········································1-9, 2-16 Control statements nesting ·························4-32
Area script is used in the following cases ·······2-16 Copy area script ·······································2-24
Array ·····················································2-34 Copy box script ········································2-12
ASCII Code Table ···································· A-45 Counter (contact) C ··································3-29
Assignment setting of script work device ·······2-62 Counter (current value) C ···························3-38
Customization ·········································2-61
Customizing script window ······················2-61
B
Batch register of local label ·························2-31
Bit assignment ·········································1-10
Bit assignment statement ···························· 4-2
Bit device ···························· 3-2, 3-6, 3-13, 3-20
B ························································3-24
Bit status ·············································3-20
LR (Latch relay) ····································3-26
MR ·····················································3-25
R ·······················································3-23
Specify invalid type ································2-42
Status of Hold Control Bit Device ··············4-38
Bit status ················································3-20
Boolean value ··········································3-20
Box script ·········································· 1-8, 2-4
BREAK Processing ···································4-31
D E
Data memory/Extended data memory Error Message ·········································2-42
DM/EM/FM ··········································3-31 Error display in output window ·················2-43
Data processing ········································ 3-1 Error message when script conversion ······2-42
Data range processed by operation formula ···3-63 Function argument error ·························2-42
Data Type (suffix) ·····································3-55 Specify invalid type ································2-42
About Type Declaration (TYPE) ················3-62 Syntax error ·········································2-42
Device type declaration ··························1-16 Typing error ·········································2-42
Value change when exceeding When conversion error occurs ·················2-43
max./min. value ··································3-61 Error message when script conversion ·········2-42
Delete area script ·····································2-23 Example for indirect specifying ····················3-53
Delete box script ······································2-11
Device and constants ································· 3-2
Device denotation method ··························3-17 F
Device List ··············································· 3-2
Bit device ········································ 3-6, 3-8 Features of area script ······························2-16
Temporary data memory TM ····················3-37 Features of box script ································· 2-4
Word device ···································· 3-7, 3-9 Features of KV script ································· 1-2
APPENDICES
Device List (KV Nano Series) ······················3-13 File register ZF/FM ···································3-33
Bit device ·············································3-13 Flow Functions ··································· 6-2, 6-4
Constant ··············································3-15 FOR to NEXT Statement
Internal register ·····································3-15 (specified loop control times) ···················4-24
Macro argument devices ·························3-15 Precautions on Using FOR to NEXT
Word device ·········································3-14 statement ·········································4-26
Device List (KV-5500/5000/3000/1000) ·········· 3-6 The range that can be specified with
Constant ··············································3-10 STEP ···············································4-26
Index
H K
HELP Function ········································2-54 KV-5500/5000/3000 word device ·················· 3-7
High-speed counter (current value) CTH ·······3-38
High-speed counter comparator (contact)
CTC ···················································3-30 L
High-speed counter comparator (setting value)
CTC ···················································3-39 Label Array ·············································2-34
How to input scripts ··································· 2-3 Label Programming ··································2-25
Direct input ··········································· 2-3 Link register W ········································3-35
Window input ········································· 2-3 Link relay B ·············································3-22
How to process setting/current value of List of Characters That Cannot Be Used ······ A-46
the counter ···········································3-29 Character that cannot be used in device
How to process setting/current value of comments ········································ A-47
the timer ··············································3-28 Characters that cannot be used in labels ··· A-46
How to program script ································ 2-2 Characters that cannot be used in program
How to Use An Assignment Statement ··········· 4-2 names (module names, function block
Bit assignment statement ························· 4-2 names, macro names) ························ A-46
Numerical value assignment statement ······· 4-2 List of control relay control memory ··············· A-2
APPENDICES
Operation assignment statement ··············· 4-3 Local label ··············································2-29
String assignment statement ····················· 4-2 Local label array ······································2-37
When it can not be assigned to left side ······ 4-4 Loop control statement ······················ 1-13, 4-11
When the type on right side is different from Loop control statement and
that on left side ··································· 4-4 processing time ····································4-35
How to Use KV Scripts ······························· 1-3
How to use output window ··························2-44
M
Index
I Macro ····················································2-47
Macro call ···············································2-47
I/O relay R ··············································3-20 Calling self-hold type macro ····················2-47
IF to ELSE IF Statement Calling subroutine macro ························2-47
(Conditional Branch (3)) ··························4-16 Macro Functions ··························· 6-6, 6-7, 6-8
IF to ELSE Statement Making Area Script ···································2-18
(Conditional Branch (2)) ··························4-14 Making Box Script ····································· 2-6
IF to Statement (Conditional Branch (1)) ········4-12 MC to MCR Statement (Master control) ·········4-22
Index modification ····································3-48 MC to MCR When using timer /
Invalid index modification ························3-50 counter function ····································4-45
Modify the device with suffix ····················3-49 MOD ······················································· 4-6
Modify via index constant ························3-49 Monitor function ·······································2-50
Modify via index register ·························3-48
Modify via the device and expression ········3-49
Index modification and indirect specifying ······3-47
N
Index register Z ········································3-39
New a area script ·····································2-19
Indirect specifying (*) ·································3-50
New a box script ······································· 2-7
Indirect specifying principle ·························3-50
NOT ······················································· 4-7
Indirect specifying programming ··················3-50
Inline Mnemonics ·····································2-60
Input (How to input scripts) ·························· 2-3
Direct input ··········································· 2-3
Window input ········································· 2-3
Internal auxiliary relay R/B/MR/LR ···············3-23
S
P
Script ······················································ 1-2
PRAGMA Directive ···································3-65 Script conversion output message ···············2-40
Index
Precautions about the use of timer function ····4-41 Script function ·········································1-10
Precautions About Use of Timer Device/ Script function format hints ·························2-53
Counter Device ·····································4-40 Script function list ·····································2-52
Timer/ Counter contact ···························4-41 Script syntax and precautions ······················ 4-1
Precautions about use of timer function in Script type ··············································· 1-8
Box Script and IF statement ····················4-42 Script warning level setting ·························2-41
Specify timer function using Box Script ·······4-43 SELECT CASE to Statement
Use timer function in IF statement of (Multi-branch control) ·····························4-18
area script ·········································4-42 Simple indirect specifying #TM ····················3-54
Precautions on Script Programming ·············4-38 Specify timer function using Box Script ·········4-43
Precautions on script programming ··············2-39 String assignment ·····································1-10
Precautions on using assignment statement ··· 4-4 String assignment statement ························ 4-2
Precautions on Using Control Statement ·······4-32 String Connection Operator ························· 4-6
About timer actions in a loop control Suffix ·····················································3-55
statement ·········································4-37 About .B ··············································3-60
Loop control statement and processing About .D and .L ·····································3-57
time ·················································4-35 About .DF ············································3-59
Precautions when programming script ··········2-61 About .F ··············································3-58
Precautions when using a timer function ·······3-28 About .T ··············································3-60
Use timer function in IF statement of About .U and .S ····································3-56
area script ·········································4-42 Suffix type ···············································1-14
Precautions when using box script ···············2-13
When using timer function ·······················2-14
Precautions when using label ······················2-32
Processing Bit Device in Word Unit ··············3-41
Processing word device as bit device ···········3-42
Programing Function Blocks Using Script ······2-46
Programming control statements with
KV Scripts ············································· 1-7
For multi-branch control ··························· 1-7
A-52 - KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual -
Index
T
Timer (contact) T ······································3-27
Timer (current value) T ······························3-37
Timer error ··············································3-28
TYPE ·····················································3-62
Type conversion leads to data loss ···············2-40
Type of indirect specifying device ·················3-52
W
Warning message ·····································2-40
About warning leve ································2-41
Script warning level setting ······················2-41
Setting method of warning level ················2-41
Watch window ·········································2-51
When conversion error occurs ·····················2-43
When looking up notes on indirect specifying
APPENDICES
and index modification ····························1-18
Every function operation table when invalid
address is specified ····························1-18
When processing as the bit device at any bit ···3-42
When processing as the bit device at
the lowerest bit ·····································3-42
When using box scripts in the following cases ··· 2-4
When using differential execution type
Index
functions ··············································2-13
When using operation functions ···················· 1-4
When using operators ································ 1-3
When using string operator ·························· 1-5
When using text string processing function ····· 1-6
When using timer function ··························2-14
When WHILE statement is imperatively
terminated ···········································4-28
When work devices are insufficient ··············2-63
WHILE Statement (pre-judge loop control) ·····4-27
Window input ············································ 2-3
Word device ·················· 3-3, 3-7, 3-9, 3-14, 3-31
Work device ············································2-62
Write easy-reading script ···························2-58
X
XOR ······················································· 4-7
XYM Marking ···········································2-65
A D
ABS ·······················································7-36 DASC ·················································· 7-158
ACOS ·················································· 7-148 DCNT ····················································· 8-8
ADRADD ················································6-28 DEC ······················································7-16
ADRDEC ················································6-26 DECO ·················································· 7-104
ADRINC ·················································6-24 DEG ···················································· 7-138
ADRSET ················································6-22 DELETE ··············································· 7-206
ADRSUB ················································6-30 DFLOAT ··············································· 7-118
AJST ·····················································8-74 DI ··························································8-76
ANDA ····················································7-22 DIC ·······················································8-78
APR ······················································7-68 DISB ······················································7-96
ASC ···················································· 7-154 DISF ···················································· 7-126
ASIN ···················································· 7-146 DISN ·····················································7-92
ASLA ·····················································7-44 DISS ···················································· 7-228
ASRA ····················································7-42 DMX ······················································7-86
ATAN ··················································· 7-150 DSER ····················································8-12
ATAN2 ················································· 7-152
AVG ······················································8-22
AWHIDE ··············································· 8-119 E
AWMSG ··············································· 8-116
APPENDICES
I P
INC ·······················································7-14 PIDAT ····················································8-82
INSERT ················································ 7-202 PMOV ····················································· 7-6
INSTR ·················································· 7-222
INT ······················································ 7-124
INTG ··················································· 7-122 R
IS_□□□ ···················································6-54
RAD ···················································· 7-136
RAMP ····················································7-74
L RASC ·················································· 7-156
RCPSASC ············································ 7-236
LDF ························································ 5-4 RDASC ················································ 7-166
LDFB ······················································ 5-7 REPLACE ············································ 7-199
LDP ························································ 5-2 RES ······················································5-13
LDPB ······················································ 5-6 RFASC ················································ 7-178
LEFT ··················································· 7-190 RFSCI ·················································· 8-128
LEN ····················································· 7-182 RFSCO ················································ 8-130
LIFOR ····················································8-58 RFSCTH ················································8-77
LIFOW ···················································8-54 RFSFRC ·············································· 8-120
LIMIT ·····················································7-62 RFSX ·····················································5-36
APPENDICES
LLFLT ····················································7-78 RFSY ·····················································5-37
LOG ···················································· 7-132 RGRY ····················································7-90
LOG10 ················································· 7-134 RHASC ················································ 7-172
LOGD ····················································8-84 RIGHT ················································· 7-186
LOGE ····················································8-84 RLA ·······················································7-48
LTRIM ·················································· 7-210 RLNCA ··················································7-52
RND ······················································8-40
ROOT ····················································7-18
M RRA ······················································7-46
Functions Index
RRNCA ··················································7-50
MAX ······················································8-14 RSEC ····················································8-72
MCALL ···················································· 6-6 RTRIM ················································· 7-212
MCOPY ················································ 8-106
MDEL ·················································· 8-100
MDSTOP ················································6-15 S
MDSTRT ················································6-14
MEND ····················································· 6-8 SDEL ··················································· 7-204
MFREE ··················································8-90 SEC ······················································8-70
MFREEK ················································8-92 SEG ······················································· 8-2
MID ····················································· 7-194 SER ······················································8-10
MIN ·······················································8-18 SET ·······················································5-12
MMKDIR ················································8-94 SFIND ·················································· 7-218
MMOV ················································· 8-108 SFINDN ··············································· 7-220
MPRINT ··············································· 8-102 SIN ······················································ 7-140
MPX ······················································7-84 SINS ···················································· 7-200
MREAD ··················································8-88 SLA ·······················································7-40
MREADL ·············································· 8-104 SLEFT ················································· 7-188
MREN ·················································· 8-110 SMID ··················································· 7-192
MRMDIR ················································8-98 SORT ····················································8-42
MSTAT ················································ 8-112 SORTN ··················································8-44
MSTRT ··················································· 6-7 SPLIT ·················································· 7-216
MWRIT ··················································8-86 SPRD ·················································· 8-122
SPWR ·················································· 8-124
SQRT ····················································7-20
N SRA ······················································7-38
SRGHT ················································ 7-184
NEG ······················································7-32 SRPLC ················································· 7-196
SSVC ·················································· 8-126
STR ····················································· 7-162
O STRIM ················································· 7-214
SWAP ·················································· 7-100
ORA ······················································7-24
ORG·························································· *2
- KV-7000/5000/3000/1000 Series and KV Nano Series Script Programming Manual - A-55
Functions Index
U_RDCPT0··················································· *1
T U_RDCPT1··················································· *1
U_RDHZ ······················································· *1
TAN ······························································· 7-144 U_RDRPM···················································· *1
TBCD ······························································· 7-80 U_WRCNT··················································· *1
TBIN ································································ 7-82 U_WRCTC0·················································· *1
TMH ································································· 5-26 U_WRCTC1·················································· *1
TMR ································································· 5-22 U_WRPST ···················································· *1
KV-SSC02
TMS ································································· 5-28
U_DISOCP ··················································· *1
TMU ································································· 5-30
U_RDBF ······················································· *1
TOD ······························································· 7-108
KV-AD40V/KV-SAD04
TODF ····························································· 7-120
U_RDAD······················································· *1
TOF ······························································· 7-116
U_RDADB ···················································· *1
TOL ································································ 7-108
U_WRAVG ··················································· *1
TOS ······························································· 7-108 U_WRLMT···················································· *1
TOU ······························································· 7-108 U_WROFST ················································· *1
TPOUT ···························································· 7-76 U_WRSCL ···················································· *1
TRGD ······························································ 8-85 KV-SAD04
TRIM ······························································ 7-208 U_RDBF ······················································· *1
KV-DA40V/KV-SDA04
U_WRDA ······················································ *1
U U_WRLMT···················································· *1
APPENDICES
U_WROFST ················································· *1
U_*****(Unit specific function) U_WRSCL ···················································· *1
KV-XLE02/EP21V KV-ML16V/MC40V/MC20V
U_CSTOP ·····················································*1 U_WRPPNT ················································· *1
U_CSTRT······················································*1 U_RDPPNT ·················································· *1
U_CREG ·······················································*1 U_RDPMC···················································· *1
U_CERR························································*1 U_RDFPOS ·················································· *1
U_MSGTO·····················································*1 U_RDFVEL··················································· *1
U_MSGSND ··················································*1 U_RDFTRQ (KV-ML16V) ····························· *1
U_MSGRCV ··················································*1 U_RDCPOS·················································· *1
Functions Index
U_DISOVP ····················································*1
U_RDBF ························································*1
KV-XH16ML/XH04ML/SH04PL
U_RDAERC···················································*1
U_RDFPOS···················································*1
U_RDFVEL····················································*1
U_RDMD ·······················································*1
U_RDPMC·····················································*1
U_RDPPNT ···················································*1
U_SELSP ······················································*1
U_WRCPOS··················································*1
U_WRPOR ····················································*1
U_WRPPNT ··················································*1
U_WRPPS·····················································*1
U_WRPPSS ··················································*1
U_WRPVEL···················································*1
KV-XH16ML/XH04ML
U_RDCPOS ··················································*1
U_RDCVEL ···················································*1
U_RDFTRQ···················································*1
U_WRMD ······················································*1
U_WRTTRQ ··················································*1
U_WRTVL ·····················································*1
APPENDICES
U_WRVTL ·····················································*1
U_WRVVEL···················································*1
KV-SH04PL
U_DISOCP ····················································*1
UFILL ······························································· 6-52
UFRSM ···························································· 6-44
UFSUS ···························································· 6-42
UMALLOC ······················································· 6-46
UNIB ································································ 7-98
Functions Index
UNIF ······························································ 7-128
UNIN ································································ 7-94
UNIS ······························································ 7-230
UPSTOP ·························································· 6-40
UPSTRT ·························································· 6-38
UREAD ···························································· 6-48
UWRIT ····························································· 6-50
V
VAL ································································ 7-181
W
WSL ································································· 7-56
WSR ································································ 7-54
WSUM ····························································· 8-26
WTIME ····························································· 8-68
Z
ZONE ······························································· 7-66
ZPOP ······························································· 6-20
ZPUSH ···························································· 6-16
ZRES ······························································· 8-34
E 1101-3
Copyright (c) 2015 KEYENCE CORPORATION. All rights reserved. 084308E 1097-6 450GB Printed in Japan