FBD Third
FBD Third
nv Series
Programming Instructions
(LD/FBD/SFC/ST)
PROSEC, TOSLINE, TOSDIC and CIEMAC are the registered trade names of Toshiba.
IBM is a registered trade name of International Business Machines Corporation.
Microsoft and Windows are the registered trade name of Microsoft Corporation in the U.S.A.
and in other countries.
DeviceNet is a registered trade name of Open DeviceNet Vendor Association Inc.
1 General
This manual describes the usage of LD/FBD/SFC instructions and functions of TOSHIBA Integrated Controller V series and
Unified Controller nv-series.
This chapter explains the following items:
LD Language:
Ladder Diagram is a graphic language for commonly used Boolean operation and is described using a combination of
contacts and coils. The LD language can be treated in the same manner as electrical relay circuits and must be connected to
the left and right power rails.
Horizontal link
Switch_1 Switch_3 Motor_On
Offset Value
LD SET
Value
LD
Note: The characters “LD”, “ST” and “SET” are
displayed on the semi-graphic Program Editor,
but not displayed on the full-graphic one.
FBD Language:
Function block diagram is a graphic language that expresses the flow of signals and data and is described using a
combination of functions and function blocks.
Timer_1
Switch1 AND_BOOL TON Start
IN Q
LD ST
Switch2 T_Value
PT ET
LD ST
preset ADD_TIME
LD
DelayTime
LD
SFC Language:
Sequential Function Chart is a graphic language suited for sequential control and consists of an SFC structure unit, which
shows the control flow, action unit, which shows the action performed at each step, and transition condition unit, which shows
the conditions for advancing through the steps.
START
T0
S1_ON S2_ON
S1 N Action_1 LED S2
T1
S3_ON
S3
T2
6F8C1226
1. General 1-4
1.2 Data
1.2.1 Data Type
The following table shows the data types supported by the Unified Controller nv Series and Integrated Controller V Series and
their data range.
Notation Data type Bits Data range
BOOL Boolean 1 0(FALSE), 1(TRUE)
INT Integer 16 -32768 to 32767
DINT Double integer 32 -2147483648 to 2147483647
UINT Unsigned integer 16 0 to 65535
38 -45
-3.40282310 to -1.40129810
REAL Real numbers 32 0
1.40129810-45 to 3.4028231038
-2147483648 to 2147483647ms
TIME Duration 32
(-596h31m23s648ms to 596h31m23s647ms )
DATE
Date 32 1998-01-01 to 2097-12-31 (*3)
D (abbreviation)
TIME_OF_DAY
Time of day 32 00:00:00.000 to 23:59:59.999 (*3)
TOD (abbreviation)
DATE_AND_TIME 0001-01-01-00:00:00.000
Date and time of day 64
DT (abbreviation) - 9999-12-31-23:59:59.999 (*3)
Maximum number of characters: 256
Fixed-length character Character code system: shift JIS
STRING
string Possibility use only with the retained global variable
(*2)
WORD Bit string of length 16 16 0000 to FFFF
DWORD Bit string of length 32 32 00000000 to FFFFFFFF
PTR (*1) Word pointer — —
PTRB (*1) Bit pointer — —
(*1) The integrated controller supports this data type to enable flexible address handling and provide compatibility with
programs on conventional machines.
(*2) When using string definition instruction DEF_STRING, it may be used in variable scope without retain specification. Refer
to the Define String instruction page for details.
(*3) In the DATE, TIME_OF_DAY(TOD), and DATE_AND_TIME(DT) types, an asterisk (*) is displayed in the V engineering
tool (program monitor, data value monitor) if data exceeding the range above is set. No setting is allowed from the V
engineering tool (e.g. data value monitoring).
6F8C1226
1. General 1-5
DataType
Notation
Data Type can be Example of constant specification
(DataType)
omitted?
BOOL#0, BOOL#FALSE,0, FALSE
BOOL Boolean Yes
BOOL#1, BOOL#TRUE, 1, TRUE
INT Integer Yes INT#15, 15, INT#16#F
DINT Double integer Yes DINT#15, 15, DINT#16#F
UINT Unsigned integer Yes UINT#15, 15, UINT#16#F
REAL Real numbers Yes REAL#15, 15, REAL#16#F, 15.0, 1.5E+1
d=Day、h=Hour、m=Minute、s=Second、ms=Millisecond
A decimal point can be used in the last field.
Each effective unit can overflow.
TIME Duration No
<DataType> can be specified in TIME# and T#.
TIME#6d_10m, TIME#16d_5h_4m_3s_21ms
T#6d_10m, T#12.34s
DATE
Date No DATE#2007-12-10, D#2007-12-10
D(abbreviation)
TIME_OF_DAY
Time of day No TIME_OF_DAY#1:2:3.456, TOD#1:2:3
TOD(abbreviation)
DWORD#305419896, 305419896
DWORD Bit string of length 32 Yes
DWORD#16#1234_5678, 16#12345678
6F8C1226
1. General 1-6
(2)Double integer (DINT)/Real numbers (REAL)/Duration (TIME)/Time of day (TOD)/Bit string of length 32(DWORD)
15 0
0 data (L)
1 data (H)
(3)Date (DATE)
15 0
0 year (INT)
1 day month
The following notation is used when the above data range is exceeded:
Infinity: Exponent e=255, Mantissa m=0
NAN: Exponent e=255, Mantissa m≠0
Note: For addition/subtraction of real data, if the absolute value of two data differ significantly (difference in
exponent 24), the result is the value of the data with larger absolute value.
6F8C1226
1. General 1-9
1.2.4 Variables
Variables used in applications are divided into local variables and global variables.
Major classification Minor classification Variable feature
A variable that can be used only in the POU in which it is included.
The variable value cannot be retained because memory is reset each
Temporary variable
time the POU is executed.
Initialization is required before using the variable.
A variable that can be used only in the POU in which it is included.
The variable value is retained because memory is reserved statically.
The initial operation varies depending on the setting in "Module
Parameter" - "Controller Operation Setting" - "Local Variable
Static variable Initialization."
Local variable
If "Yes" is set, the variable is initialized to zero when the controller
starts up in RUN.
If "No" is set, the variable is not initialized when the controller starts up
in RUN, and starts from the previous operation result. *1
Non-tracking type A variable that can be used only in the POU in which it is included.
static variable The variable value is retained because memory is reserved statically.
In the initialization operation, the variable is initialized to zero when the
(Unified Controller nv controller starts up in RUN.
series only) In a duplex system, this variable is not tracked.
A variable that can be used if the stations are organically linked via
scan transmission, and managed in an integrated fashion. It is used
Network variable for exchanging information and data between different stations. The
scope of the variable is the system in which the variable is used. Only
scan memory such as TC-net and FL-net can be network variables.
A variable that is used globally in the station, and used for referring to
information and data of the transmission modules in the station. The
scope of the variable is the station in which the variable is used.
For a station variable declared as Boolean, available slots are
Station global variable restricted.
Global variable [Integrated Controller V series]
Can be used only in Slot 0 and Slot 1.
[Unified Controller nv series]
Can be used only in Slot 0.
A variable that is used globally in the controller, and used for
exchanging information and data between different programs in the
controller. The scope of the variable is the controller in which the
Controller global
variable is used.
variable
Controller variables include controller-specific variables (special
registers, data registers), user-defined user variables, and I/O
variables.
*1 The local variable area (e.g. the area storing the previous value of the rising edge detection instruction and instance of the
timer instruction) that is automatically generated in the standard function block is initialized to zero.
(3)Temporary variable
Temporary variables used within POU are declared using the keyword VAR_TEMP.
Variables:
Variable Data type Dec.
TEMP_VAR_1 INT VAR_TEMP
TEMP_VAR_2 WORD VAR_TEMP
LD ST
LD
SAMPLE1 SAMPLE3
LD SET
LD
(2) Example of normally open Contact Gate and SET Store instruction
[Number of programs that can be registered in each task in the Unified Controller nv series]
Unit:Number of programs
Controller
Task name Priority Execution method
type1 type2
Event task EV 1 8 8
Event (Select EV or IP)
Interrupt task 16 16
IP
*1 Event
Ultra 2
(Select IP or SS)
high-speed SS 1 - Scan
task
High-speed
HS 3 128 128
task Scan (Select HS or RIO)
RIO task *2 RIO 0 -
Main task MS 4 256 512 Scan
*1 An interrupt task can be selected in Priority 1 or Priority 2.
*2 Only type1 can be selected.
6F8C1226
1. General 1-15
Controller S T T F A
t e a u r
a m s n g
t p k c u
i o t m
c r r i e
POU Instance a e o n
(Program v l g n t
Organization a y i
Unit ) r s v
i v t a
a a r l
b r a u
l i t e
e a i
b o
l n
S3 S2 L3 L2 L1
e
(L3DS) (L2DS)
Program Program √ √ √ - √
instance
Function - *2 437 2048 512 64 - √ - √ √
Function Function block (2048) (2048) √ √ - - √
block instance
*2 S3PU21: 437, S3PU45: 821, S3PU55/S3PU65: 917
6F8C1226
1. General 1-16
1.3.3 Program
A program is a combination of program body, functions, and function blocks. Functions and function blocks may be used in
common among several programs and function blocks.
Task
Function Function
6F8C1226
1. General 1-18
1.3.4 Function
1.3.4.1 What is Function?
A function is executed with specific arguments and outputs a function value. In other words, it always produces the same
operation result for the same input and does not have internal storage. Instructions such as SIN and COS defined by
IEC61131-3 are examples of functions.
LD LD SET
SAMPLE2
LD
Instructions to store the result to be connected to a function is divided into Store instruction (ST) and Set Store instruction (SET).
The following rules apply to these instructions:
Store (ST)
Set Store (SET)
EN input Function processing ENO output instruction Remarks
instruction action
action
Update with (*1)
OFF Not executed [Outputs 0] OFF No data update default value
(0)
Normal
Yes ON
Executed completion Update with
Update with
ON (Outputs Error Depend on operation
operation result
operation result) completion function result
(Error) (*2)
Update with
No — Executed — Not available operation
result
(*1) When EN input is OFF, function output is 0 and if that output is used directly as input to another instruction, the input to that
instruction is 0. For example, if a coil instruction is connected to a BOOL output type function, that coil becomes OFF. However,
if that instruction is a Set Store instruction, 0 is not stored and no data update is performed as shown in the above table.
(*2) In the function description, if there is no description of ENO output, the EN input state is output as the ENO output.
6F8C1226
1. General 1-19
SIGNAL1 SIGNAL2
GT_INT In the case where SAMPLE1 > SAMPLE2
EN ENO When SIGNAL1=OFF
SAMPLE1 SIGNAL3 SIGNAL2OFF
SIGNAL3OFF
LD When SIGNAL1=ON
SAMPLE2
SIGNAL2ON
LD SIGNAL3ON
LD SET
SAMPLE2 SAMPLE3
LD LD
When EN is FALSE(OFF), 0 is output.
When SIGNAL1=OFF
SIGNAL2OFF
SAMPLE4 is unchanged
When SIGNAL1=ON
SIGNAL2ON
SAMPLE4(SAMPLE1+SAMPLE2)SAMPLE3
6F8C1226
1. General 1-20
LD ST
DATA1
LD
DATA2 MUL_REAL
LD
DATA2
LD
Supported case:
STRING1 LEFT STRING2
LD IN ST
NUMBER L
LD
Unsupported case:
(1) Function value is stored in two or more variables
D notQ
R
6F8C1226
1. General 1-22
Program:
TABLE[XI] ADD_DINT SAMPLE
LD ST
TABLE[XJ]
LD
Description:
When index register XI=1, XJ=3 Array: TABLE
SAMPLE=TABLE[XI] + TABLE[XJ] 0 100
=TABLE[1] + TABLE[3] 1 150
2 70
=150 + 30
3 30
is calculated and the result 180 is stored in SAMPLE.
Therefore, the range of real data of the Integrated Controller and Unified Controller is as follows:
Integrated
Input/output data
Controller
Unified Controller
Decimal
Real data representation S2/S3 L2/L3
representation
7FFF.FFFF
+NAN
+Nonnumeric : +3.4028235E+38
(not a number) +INF
7F80.0001 (+Maximum value)
+Infinity +INF(Infinity) 7F80.0000
+3.4028235E+38(+Maximum value) 7F7F.FFFF
Normalized
: :
value
+1.1754944E-38 0080.0000
+1.1754942E-38 007F.FFFF
Unnormalized
: :
value
+1.4012985E-45 0000.0001
+0 0000.0000 +0
Zero +0 +0
-0 8000.0000 -0
-1.4012985E-45 8000.0001
Unnormalized
: :
value
-1.1754942E-38 807F.FFFF
-1.1754944E-38 8080.0000
Normalized : :
value
-3.4028235E+38(-Maximum value) FF7F.FFFF
-Infinity -INF(Infinity) FF80.0000
FF80.0001 -3.4028235E+38
-NAN -INF
-Nonnumeric : (-Maximum value)
(not a number)
FFFF.FFFF
6F8C1226
1. General 1-25
●Important
・ In the Integrated Controller and Unified Controller, the calculation results are different when
"infinity" or "nonnumeric" is inputted in a calculation using real data, or when the calculation
result becomes "infinity" or "nonnumeric."
・ When real data is used in the user program and the effect of the difference exists, the
validity of calculation result="maximum value" can be ensured by writing the program in the
following manner.
・ When real calculation is needed, real calculation can be used as a function with EN so that
a factor resulting in a calculation result of "infinity" or "nonnumeric" can be detected when
ENO=FALSE(OFF).
・ The cautions on handling real data are as follows:
・ Check if it is within the expected input/output data range. Is the limit processing
required before or after the calculation?
・ In division, is there any division with divisor=0?
・ In data comparison, is it OK to use "=" (equality)?
・ When calculation is done as a function with EN and the ENO output is normal (ON),
is the calculation result required to be used?
6F8C1226
1. General 1-26
(1)Specification by constant
One step if the data structure is a single word constant specification and two steps if the data structure is a two word size
constant specification.
Note: Currently, only single index modification is allowed. Double index is not allowed. (This is currently under
development.)
6F8C1226
1. General 1-28
Arguments:
The following data types are supported for input and output arguments and the instruction symbol
(*1) This function is compatible with the instruction which the controller described in the column has. The controller is shown
as below:
Programmable Controller PROSEC T Series: T
Control Station PCS Series: PCS
6F8C1226
1. General 1-29
Caution
When an unsupported instruction is used during programming, the action depends on the controller as follows:
With the S controller, POU using unsupported instruction is not downloaded to the controller. If it is downloaded, the
engineering tool displays an error message indicating that it is an unsupported message.
With the L controller, POU using unsupported message can be downloaded to the controller, but the program will go into
fallback mode or fail when it detects the unsupported instruction.
End of Conditional
√ √ √ √ √ √ √ √ √ 1
Execution Instruction
Master Control Set MCS √ √ √ √ √ √ √ √ √ 1
Master Control Reset MCR √ √ √ √ √ √ √ √ √ 1
XCHG_UINT √ √ √ √ — — — — — 2
XCHG_REAL √ √ √ √ — — — — — 2
XCHG_WORD √ √ √ √ — — — — — 2
XCHG_DWORD √ √ √ √ — — — — — 2
XCHG_TIME √ √ √ √ — — — — — 2
XCHG_TOD √ √ √ √ — — — — — 2
XCHG_DATE √ √ √ √ — — — — — 2
Step √ √ √ √ √ √ √ √ 1.10 1
Transition √ √ √ √ √ √ √ √ 1.10 2
Divergence/Convergence
√ √ √ √ √ √ √ √ 1.10 2
of Sequence
Divergence/Convergence
of Simultaneous √ √ √ √ √ √ √ √ 1.10 2
Sequences
Link √ √ √ √ √ √ √ √ 1.10 2
U
Action (User defined type) √ √ √ √ √ √ √ √ 1.10 3/5
Sequence
SEQ — √ — — — 1.10 — √ — 2
(See Note)
Phase Step N
— √ — — — 1.10 — √ — 5
(See Note)
Variable(BOOL)
Diagram
Input Output
Function:
• Normally open contact of variable (BOOL).
Input Condition Output
OFF Regardless of variable (BOOL) state OFF
Variable (BOOL)=OFF OFF
ON
Variable (BOOL)=ON ON
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
• Coil SIGNAL3 is ON only when states of SIGNAL1 and SIGNAL2 are both ON.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is treated as OFF and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-3
Variable (BOOL)
Diagram
Input Output
Function:
• Relay coil b contact (always closed contact) corresponding to variable (BOOL).
Input Condition Output
OFF Regardless of variable (BOOL) state OFF
Variable (BOOL)=OFF ON
ON
Variable (BOOL)=ON OFF
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
• Coil SIGNAL3 is ON only when states of SIGNAL1 and SIGNAL2 are both OFF.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is treated as OFF and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-4
Variable (BOOL)
Diagram
Input P Output
Function:
• The output is kept ON for 1 scan time, when the input is ON and the variable(BOOL) changes from OFF to ON.
Input Condition Output
OFF Regardless of variable (BOOL) state OFF
Variable (BOOL)=OFF→OFF OFF
Variable (BOOL)=ON→OFF OFF
ON
Variable (BOOL)=OFF→ON ON
Variable (BOOL)=ON→ON OFF
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
P
• When the variable SIGNAL1 is ON and the variable SIGNAL2 changes from OFF to ON, coil SIGNAL3 keeps ON for 1 scan
time only.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is treated as OFF and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-5
Variable (BOOL)
Diagram
Input N Output
Function:
• The output is kept ON for 1 scan time, when the input is ON and the variable(BOOL) changes from ON to OFF.
Input Condition Output
OFF Regardless of variable (BOOL) state OFF
Variable (BOOL)=OFF→OFF OFF
Variable (BOOL)=ON→OFF ON
ON
Variable (BOOL)=OFF→ON OFF
Variable (BOOL)=ON→ON OFF
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
N
• When the variable SIGNAL1 is ON and the variable SIGNAL2 changes from ON to OFF, coil SIGNAL3 keeps ON for 1 scan
time only.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is treated as OFF and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-6
Function:
• The output is kept ON for 1 scan time, when the input changes from OFF to ON.
Input Condition Output
OFF Regardless of previous input state OFF
Previous input=OFF ON
ON
Previous input=ON OFF
Program example:
SIGNAL1 SIGNAL2
↑
• The coil SIGNAL2 keeps ON for 1 scan time only when the variable SIGNAL1 changes from OFF to ON.
SIGNAL1
SIGNAL2
t t t
Function:
• The output is kept ON for 1 scan time, when the input changes from ON to OFF.
Input Condition Output
Previous input=OFF OFF
OFF
Previous input=ON ON
ON Regardless of previous input state OFF
Program example:
SIGNAL1 SIGNAL2
↓
• The coil SIGNAL2 keeps ON for 1 scan time only when the variable SIGNAL1 changes from ON to OFF.
SIGNAL1
SIGNAL2
t t t
t:1 Scan time
6F8C1226
2. Contacts & Coils 2-8
Function:
• The output is turned ON, when the input is OFF, and the output is turned OFF, when the input is ON.
Input Condition Output
OFF — ON
ON — OFF
Program example:
SIGNAL1 SIGNAL2
I
• Coil SIGNAL2 becomes OFF when variable SIGNAL1 is ON and ON when variable SIGNAL1 is OFF.
SIGNAL1
SIGNAL2
6F8C1226
2. Contacts & Coils 2-9
Variable (BOOL)
Diagram
Input
Function:
• Relay coil of a variable(BOOL).
• The input state is stored in the variable(BOOL).
Input Action Output
OFF Variable (BOOL)=OFF —
ON Variable (BOOL)=ON —
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
• The coil SIGNAL3 becomes ON only when these states of variables SIGNAL1 and SIGNAL2 are both ON.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-10
Variable (BOOL)
Diagram
Input
Function:
• Negated coil of a variable(BOOL).
• The negated input state is stored in the variable(BOOL).
Input Action Output
OFF Variable (BOOL)=ON —
ON Variable (BOOL)=OFF —
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
• The coil SIGNAL3 becomes OFF only when these states of variables SIGNAL1 and SIGNAL2 are both ON.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-11
Variable (BOOL)
Diagram S
Input
Function:
• Set coil of a variable(BOOL).
• When the input state is ON, the variable is set to ON, and remains ON.
Input Action Output
OFF Variable (BOOL)=Unchanged —
ON Variable (BOOL)=ON —
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
S
• The coil SIGNAL3 is set to ON when state of variables SIGNAL1 and SIGNAL2 are both ON, and then the variable SIGNAL3
remains ON even when SET coil input becomes OFF.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-12
Variable (BOOL)
Diagram R
Input
Function:
• Reset coil of a variable(BOOL).
• When the input state is ON, the variable is reset to OFF, and remains OFF.
Input Action Output
OFF Variable (BOOL)=unchanged —
ON Variable (BOOL)=OFF —
Program example:
SIGNAL1 SIGNAL2 SIGNAL3
R
• The coil SIGNAL3 is reset to OFF when state of variables SIGNAL1 and SIGNAL2 are both ON, and then variable SIGNAL3
remains OFF even when RESET coil input becomes OFF.
SIGNAL1
SIGNAL2
SIGNAL3
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-13
Variable (BOOL)
Diagram P
Input
Function:
• When the input changes from OFF to ON, the variable(BOOL) is kept to ON for 1 scan time only.
Input Action Output
OFF Variable (BOOL)=OFF —
When previous input=OFF, variable (BOOL)=ON —
ON
When previous input=ON, variable (BOOL)=OFF —
Program example:
SIGNAL1 SIGNAL2
P
• When the variable SIGNAL1 changes from OFF to ON, the variable SIGNAL2 is kept to ON for 1 scan time only.
SIGNAL1
SIGNAL2
t t t
t:1 Scan time
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs. However, the input state for pulse operation is saved.
6F8C1226
2. Contacts & Coils 2-14
Variable (BOOL)
Diagram N
Input
Function:
• When the input changes from ON to OFF, the variable(BOOL) is kept to ON for 1 scan time only.
Input Action Output
When previous input=OFF, variable (BOOL)=OFF —
OFF
When previous input=ON, variable (BOOL)=ON —
ON Variable (BOOL)=OFF —
Program example:
SIGNAL1 SIGNAL2
N
• When the variable SIGNAL1 changes from ON to OFF, the variable SIGNAL2 is kept to ON for 1 scan time only.
SIGNAL1
SIGNAL2
t t t
t:1 Scan time
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs. However, the input state for pulse operation is saved.
6F8C1226
2. Contacts & Coils 2-15
Variable (BOOL)
Diagram
Input
Function:
• This is a coil that retains the state of a variable (BOOL) when forced, regardless of the input state.
• The operation as forced coil is not guaranteed when the same variable is used as coil in more than one place.
Input Action Output
OFF Variable(BOOL)=retains previous state —
ON Variable(BOOL)=retains previous state —
Program example:
SIGNAL1 SIGNAL2
• The forced set state of variable SIGNAL2 is retained regardless of the state of variable SIGNAL1.
• If the state of variable SIGNAL2 just before being forced set is ON, the forced coil retains the ON state (see ex.1).
• If the state of variable SIGNAL2 just before being forced set is OFF, the forced coil retains the OFF state (see ex.2).
SIGNAL1
SIGNAL2
ex.1 ex.2
Set forced Reset Set forced Reset
forced forced
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-16
Variable (BOOL)
Diagram
Input
Function:
• This is a negated coil that retains the state of a variable (BOOL) when forced, regardless of the input state.
• The operation as forced negated coil is not guaranteed when the same variable is used as coil in more than one place.
Input Action Output
OFF Variable(BOOL)=retains previous state —
ON Variable(BOOL)=retains previous state —
Program example:
SIGNAL1 SIGNAL2
• The forced set state of variable SIGNAL2 is retained regardless of the state of variable SIGNAL1.
• If the state of variable SIGNAL2 just before being forced set is OFF, the forced negated coil retains the OFF state (see ex.1).
• If the state of variable SIGNAL2 just before being forced set is ON, the forced negated coil retains the ON state (see ex.2).
SIGNAL1
SIGNAL2
ex.1 ex.2
Set forced Reset Set forced Reset
forced forced
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-17
Variable (BOOL)
Diagram S
Input
Function:
• This is a SET coil that retains the state of a variable (BOOL) when forced, regardless of the input state.
• The operation as forced SET coil is not guaranteed when the same variable is used as coil in more than one place.
Input Action Output
OFF Variable(BOOL)=retains previous state —
ON Variable(BOOL)=retains previous state —
Program example:
SIGNAL1 SIGNAL2
S
• The forced set state of variable SIGNAL2 is retained regardless of the state of variable SIGNAL1.
• If the state of variable SIGNAL2 just before being forced set is OFF, the forced SET coil retains the OFF state (see ex.1).
• If the state of variable SIGNAL2 just before being forced set is ON, the forced SET coil retains the ON state (see ex.2).
SIGNAL1
SIGNAL2
ex.1 ex.2
Set forced Reset Set forced Reset
forced forced
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-18
Variable (BOOL)
Diagram R
Input
Function:
• This is a RESET coil that retains the state of a variable (BOOL) when forced, regardless of the input state.
• The operation as forced RESET coil is not guaranteed when the same variable is used as coil in more than one place.
Input Action Output
OFF Variable(BOOL)=retains previous state —
ON Variable(BOOL)=retains previous state —
Program example:
SIGNAL1 SIGNAL2
R
• The forced set state of variable SIGNAL2 is retained regardless of the state of variable SIGNAL1.
• If the state of variable SIGNAL2 just before being forced set is ON, the forced RESET coil retains the ON state (see ex.1).
• If the state of variable SIGNAL2 just before being forced set is OFF, the forced RESET coil retains the OFF state (see ex.2).
SIGNAL1
SIGNAL2
ex.1 ex.2
Set forced Reset Set forced Reset
forced forced
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs.
6F8C1226
2. Contacts & Coils 2-19
Variable (BOOL)
Diagram P
Input
Function:
• This is a positive transition-sensing coil that retains the state of a variable (BOOL) when forced, regardless of the input state.
• The operation as forced positive transition-sensing coil is not guaranteed when the same variable is used as coil in more
than one place.
Input Action Output
OFF Variable(BOOL)=retains previous state —
ON Variable(BOOL)=retains previous state —
Program example:
SIGNAL1 SIGNAL2
P
• The forced set state of variable SIGNAL2 is retained regardless of the state of variable SIGNAL1.
• If the state of variable SIGNAL2 just before being forced set is OFF, the forced positive transition-sensing coil retains the
OFF state (see ex.1).
• If the state of variable SIGNAL2 just before being forced set is ON, the forced positive transition-sensing coil retains the ON
state (see ex.2).
SIGNAL1
t t
SIGNAL2
ex.1 ex.2
Set forced Reset Set forced Reset t:1 Scan time
forced forced
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs. However, the input state for pulse operation is saved.
6F8C1226
2. Contacts & Coils 2-20
Variable (BOOL)
Diagram N
Input
Function:
• This is a negative transition-sensing coil that retains the state of a variable (BOOL) when forced regardless of the input state.
• The operation as forced negative transition-sensing coil is not guaranteed when the same variable is used as coil in more
than one place.
Input Action Output
OFF Variable(BOOL)=retains previous state —
ON Variable(BOOL)=retains previous state —
Program example:
SIGNAL1 SIGNAL2
N
• The forced set state of variable SIGNAL2 is retained regardless of the state of variable SIGNAL1.
• If the state of variable SIGNAL2 just before being forced set is ON, the forced negative transition-sensing coil retains the ON
state (see ex.1).
• If the state of variable SIGNAL2 just before being forced set is OFF, the forced negative transition-sensing coil retains the
OFF state (see ex.2).
SIGNAL1
t t t
SIGNAL2
ex.1 ex.2
Set forced Reset Set forced Reset
forced forced
t :1Scan time
Error information:
• When there is a boundary error due to index modification, the value of variable (BOOL) is unchanged and data boundary
over occurs. However, the input state for pulse operation is saved.
6F8C1226
3. Execution Control 3-1
3 Execution Control
Diagram Circuit P
JCR
Function:
• When input to JCS is ON, instructions between JCS and JCR are skipped and instructions are executed from JCR.
• When input to JCS is OFF, instructions between JCS and JCR are executed.
• JCS and JCR must be used as pair.
• JCS must be described before JCR.
• The JCS-JCR combination may be nested.
Input Condition Output
OFF Jump not performed (Between JCS and JCR are executed.) —
ON Jump performed —
Program example:
SIGNAL1
JCS
Circuit A
JCR
Circuit B
Diagram Circuit P
Label
LABEL:
Function:
• When input to jump instruction is ON, instructions between Jump and Label instructions are skipped and instructions are
executed from Label instruction.
• When input to jump instruction is OFF, instructions between Jump and Label instructions are executed.
• Jump and Label must be used as pair.
• Jump-Label instructions may be nested.
Input Condition Output
OFF Jump not performed (Between Jump and Label are executed.) —
ON Jump performed —
Program example:
SIGNAL1
JMP_A
Circuit A
JMP_A
LABEL :
Circuit B
Condition input
Diagram
Circuit P
Function:
• When input to Conditional Execution Instruction is OFF, instructions between Conditional Execution Instruction and End of
Conditional Execution Instruction are skipped and instructions are executed from End of Conditional Execution Instruction.
• When input to Conditional Execution Instruction is ON, instructions between Conditional Execution Instruction and End of
Conditional Execution Instruction are executed.
• Conditional Execution Instruction and End of Conditional Execution Instruction must be used as pair.
• Conditional Execution Instruction and End of Conditional Execution Instruction may be nested.
Input Condition Output
OFF Jump performed —
Jump not performed (Between and are
ON —
executed.)
Program example:
SIGNAL1
Circuit A
Circuit B
• When variable SIGNAL1 is ON, Circuit A and Circuit B instructions are executed.
• When SIGNAL1 is OFF, Circuit A is not executed and instructions are executed from Circuit B.
6F8C1226
3. Execution Control 3-5
Diagram Circuit P
MCR
Function:
• When input to MCS is OFF, the power rail input between MCS and MCR is reset to OFF.
• When input to MCS is ON, normal operation is performed.
• MCS and MCR must be used as pair.
• MCS must come before MCR.
• MCS-MCR combination cannot be nested.
Input Condition Output
OFF Power rail input OFF —
ON Normal operation —
Program example:
SIGNAL1
MCS
1234 MOVE_INT SAMPLE1 Circuit A1
LD ST
Circuit B
4 Counters
Counters Up Counter
Instance name
CTU
Count up command CU Q Count up status
Diagram
Reset command R CV Current value
Preset value PV
Arguments:
Arg. Operand Type Const. Description
CU BOOL √ Count up command
Input R BOOL √ Reset command
PV INT √ Preset value
Outpu Q BOOL — Count up status
t CV INT — Current value
Instance structure:
Name Type Description
Q BOOL Count up status
CV INT Current value
Function:
• When the Reset command R is ON, the current value CV is initialized to 0. However, count up at the rising edge of the
count up command is not performed while R=ON.
• When the Reset command R is OFF, count up is performed at the rising edge of the count up input.
• When the current value CV reaches a preset value PV, count up status Q is set to ON.
Input Output
Action
CU R Q CV
* ON Not executed When CV<PV: 0
OFFÆ ON CV=CV+1 until PV is OFF
reached When CV=PV: Current CV
OFF
Otherwise — ON
6F8C1226
4. Counters 4-3
Program example:
Up_Ctr SIGNAL1
SIGNAL1 CTU SIGNAL3 SIGNAL2
CU Q
SAMPLE1
SIGNAL2
R CV SAMPLE2
ST SAMPLE2
SAMPLE1 PV
LD SIGNAL3
• While variable SIGNAL2 is ON, variable SAMPLE2 becomes 0 because current value CV is initialized.
• When variable SIGNAL2 is OFF, count up is performed when variable SIGNAL1 changes from OFF to ON.
• When the preset value of variable SAMPLE1 is equal to the current value, variable SIGNAL3 becomes ON because count
up status Q becomes ON.
[Supplement]
• Positive transition-sensing contact or rising edge detector need not be programmed prior to number up input CU because
number up input CU detects the rising edge with Up counter instruction.
Error information:
• If preset value PV is less than 0, Up Counter instruction is executed with 0 as the limit.
6F8C1226
4. Counters 4-4
Instance name
CTD
Count down command CD Q Count down status
Diagram
Load command LD CV Current value
Preset value PV
Arguments:
Arg. Operand Type Const. Description
CD BOOL √ Count down command
Input LD BOOL √ Load command
PV INT √ Preset value
Outpu Q BOOL — Count down status
t CV INT — Current value
Instance structure:
Name Type Description
Q BOOL Count down status
CV INT Current value
Function:
• When the Load command LD is ON, the current value CV is initialized with preset value PV. However, while LD=ON,
count down is not performed at the rising edge of the Count Down command.
• When the Load command LD is OFF, count down is performed at the rising edge of the count down input.
• When the current value CV reaches 0, the count down status Q is set to ON.
Input Output
Action
CD LD Q CV
* ON Not executed When CV>0: PV
OFFÆON CV=CV-1 until 0 is reached OFF
Otherwise OFF — When CV=0: Current CV
ON
6F8C1226
4. Counters 4-5
Program example:
Dn_Ctr SIGNAL1
SIGNAL1 CTD SIGNAL3 SIGNAL2
CD Q
SAMPLE1
SIGNAL2
LD CV SAMPLE2
ST SAMPLE2
SAMPLE1 PV
LD SIGNAL3
• While variable SIGNAL2 is ON, variable SAMPLE2 becomes preset value PV because current value CV is initialized.
• When variable SIGNAL2 is OFF, count down is performed when variable SIGNAL1 changes from OFF to ON. The current
value is stored in SAMPLE2.
• When the variable SAMPLE2 which is the current value becomes 0, variable SIGNAL3 becomes ON because the count
down status Q becomes ON.
[Supplement]
• Positive transition-sensing contact or rising edge detector need not be programmed prior to number down input CU
because count down input CD detects the rising edge with Down Counter instruction.
Error information:
• If preset value PV is less than 0, Down Counter instruction is executed with 0 as the limit.
6F8C1226
4. Counters 4-6
Instance name
CTUD
Count up command CU QU Count up status
Load command LD
Preset value PV
Arguments:
Arg. Operand Type Const. Description
CU BOOL √ Count up command
CD BOOL √ Count down command
Input R BOOL √ Reset command
LD BOOL √ Load command
PV INT √ Preset value
QU BOOL — Count up status
Outpu
QD BOOL — Count down status
t
CV INT — Current value
Instance structure:
Name Type Description
QU BOOL Count up status
QD BOOL Count down status
CV INT Current value
Function:
• When the Reset command R is ON, current value CV is initialized to 0.
• When the Load command LD is ON and the Reset command R is OFF, the current value CV is initialized with preset value
PV.
• While R=ON or LD=ON, count at the rising edge of the count up command and count down command are not performed.
• When the Reset command R and Load command LD are OFF, count up is performed at the rising edge of the count up
input.
• When the Reset command R and Load command LD are OFF, count down is performed at the rising edge of the count
down input.
• When the current value CV reaches a preset value PV, count up status QU is set to ON.
• When the current value CV reaches 0, count down status QD is set to ON.
• When both the count up input CU and count down input CD are ON, count operation is not performed.
Input Action Output
CU CD R LD QU QD CV
* * ON * Not executed 0
OFF ON When CV<PV: When CV>0: PV
ON ON — OFF OFF
OFFÆ OFF CV=CV+1 until Current
ON OFF OFF PV is reached When CV=PV: When CV=0: CV
OFF OFFÆ CV=CV-1 until ON ON
ON 0 is reached
6F8C1226
4. Counters 4-7
Program example:
Ud_Ctr SIGNAL1
SIGNAL1 CTUD SIGNAL5 SIGNAL2
CU QU
SIGNAL2 SIGNAL6 SIGNAL3
CD QD
SIGNAL3 SIGNAL4
R CV SAMPLE2 SAMPLE1
ST
SIGNAL4
LD SAMPLE2
SIGNAL5
SAMPLE1 PV
LD SIGNAL6
• While variable SIGNAL3 is ON, variable SAMPLE2 becomes 0 because current value CV is initialized.
• While variable SIGNAL3 is OFF and variable SIGNAL4 is ON, variable SAMPLE2 becomes preset value PV because
current value CV is initialized.
• Count up is performed when variable SIGNAL1 changes from OFF to ON and count down is performed when variable
SIGNAL2 changes from OFF to ON. The current value is stored in SAMPLE2. However, count is not performed when
variables SIGNAL1 and SIGNAL2 are both ON.
• When variable SAMPLE2 which is the current value reaches the preset value PV, variable SIGNAL5 becomes ON.
• When variable SAMPLE2 which is the current value reaches 0, variable SIGNAL6 becomes ON.
[Supplement]
• Positive transition-sensing contact or rising edge detector need not be programmed prior to count up input CU or count
down input CD because count up input CU and number down input CD detect the rising edge with Up Down Counter
instruction.
Error information:
• If preset value PV is less than 0, Up Down Counter instruction is executed with 0 as the limit.
6F8C1226
5. Timers 5-1
5 Timers
● Important
・ For the Integrated Controller V Series controller, change the preset time in the timer stop state
(*1).
・ If it is changed in the time up state (Preset time (PT)≦ Duration (CT)), the output may change
in a controller in which "PT change support in time up state" has not been done.
"PT change support in time up state" version in the [Integrated Controller V Series]
Version
Controller Not
Supported
supported
S2PU22/32/72 ~V02.03 V02.04~
S2 S2PU22A/32A/72A/72D N/A V02.50~, V03.70~
S2PU82 N/A V02.00~, V03.00~
S3PU** ~V02.05 V02.06~, V02.10~
S3
S3PU**A N/A V02.50~, V03.70~
L1 L1PU1*H,LC5** ~V02.49 V02.50~
L2PU1* ~V03.00 V03.10~
L2
L2PU22 ~V03.0D V03.10~
L3PU11 ~V03.00 V03.10~
L3
L3PU21 ~V03.0K V03.10~
6F8C1226
5. Timers 5-3
On-Delay Timer
Timers *1
(0.1ms/1ms/10ms/100ms/0.1min)
LD/FBD language Instance name
notation
TON
Timer activation command IN Q Time up status
Instance name
TON_□□
Timer activation command IN Q Time up status
TONM_P
Timer activation command IN Q Time up status
Arguments:
• TON (1ms unit)
• TON_□□/TONM_P[□□ indicates 100us(0.1ms unit), 10ms (10ms unit), or 100ms (100ms unit).]
Instance structure:
• TON (1ms unit)
Function:
• When timer activation command IN is ON, time up status Q is set to ON after the preset time elapses.
• Duration is added.
• When timer activation command IN is OFF, duration is cleared to zero.
• The setting range of preset time PT is as follows.
Input Output
Action
IN Q ET
FALSE(OFF) Not executed FALSE(OFF) 0
Duration < Preset time FALSE(OFF)
TRUE(ON) Executed Current ET
Duration ≧ Preset time TRUE(ON)
6F8C1226
5. Timers 5-5
Program example:
[LD/FBD language notation]
Ondelay_1 SIGNAL1
SIGNAL1 TON SIGNAL2 SAMPLE1
IN Q
SAMPLE1 PT ET SAMPLE2 SAMPLE2
LD ST
SIGNAL2
• After variable SIGNAL1 becomes ON, variable SIGNAL2, which is time up status, is set to ON after the preset time specified
with variable SAMPLE1 elapses. Duration is stored to variable SAMPLE2.
• The content of duration after duration reaches the preset time specified with variable SAMPLE1 is held as long as variable
SIGNAL1 is ON.
• When variable SIGNAL1 is OFF, duration is cleared, variable SAMPLE2 becomes zero, and variable SIGNAL2, which is
time up status, is set to OFF.
Error information:
• If preset time PT is less than 0, On-Delay Timer instruction takes an absolute value for operation.
• For the Integrated Controller V series L controller, the internal timer minimum unit is 100ms, so update is made in units of
100ms even if TON instruction of 1ms unit is used.
6F8C1226
5. Timers 5-6
Instance name
TOF_□□
Timer activation command IN Q Time up status
TOFM_P
Timer activation command IN Q Time up status
Arguments:
• TOF (1ms unit)
Instance structure:
• TOF (1ms unit)
Function:
• After timer activation command IN becomes OFF, time up status Q is set to OFF after the preset time elapses.
• Duration is added.
• The setting range of preset time PT is as follows.
Input Output
Action
IN Q ET
Duration < Preset time TRUE(ON)
FALSE(OFF) Executed Current ET
Duration ≧ Preset time FALSE(OFF)
TRUE(ON) Not executed TRUE(ON) 0
6F8C1226
5. Timers 5-8
Program example:
[LD/FBD language notation]
Offdelay_1 SIGNAL1
SIGNAL1 TOF SIGNAL2 SAMPLE1
IN Q
SAMPLE1 PT ET SAMPLE2 SAMPLE2
LD ST
SIGNAL2
• After variable SIGNAL1 becomes OFF, variable SIGNAL2, which is time up status, is set to OFF after the preset time
specified with variable SAMPLE1 elapses. Duration is stored to variable SAMPLE2.
• The content of duration after duration reaches the preset time specified with variable SAMPLE1 is held as long as variable
SIGNAL1 is OFF.
• When variable SIGNAL1 is ON, duration is cleared, variable SAMPLE2 becomes zero, and variable SIGNAL2, which is time
up status, is set to ON.
Error information:
• If preset time PT is less than 0, Off-Delay Timer instruction takes an absolute value for operation.
• For the Integrated Controller V Series L controller, the internal timer minimum unit is 100ms, so update is made in units of
100ms even if TOF instruction of 1ms unit is used.
6F8C1226
5. Timers 5-9
Instance name
TP_□□
Timer activation command IN Q Time up status
Arguments:
• TP (1ms unit)
Instance structure:
• TP (1ms unit)
Function:
• After timer activation command IN becomes ON, time up status Q is set to ON until the preset time elapses.
• Duration is added.
• When timer activation command becomes OFF after the preset time elapses, duration is cleared.
• The setting range of preset time PT is as follows.
Input Output
Action
IN Q ET
FALSE(OFF) Not executed FALSE(OFF) 0
Duration < Preset time TRUE(ON)
TRUE(ON) Executed Current ET
Duration ≧ Preset time FALSE(OFF)
6F8C1226
5. Timers 5-11
Program example:
[LD/FBD language notation]
Plstimer_1 SIGNAL1
SIGNAL1 TP SIGNAL2 SAMPLE1
IN Q
SAMPLE1 PT ET SAMPLE2 SAMPLE2
LD ST
SIGNAL2
• After variable SIGNAL1 becomes ON, variable SIGNAL2 is set to ON until the preset time specified with variable SAMPLE1
elapses. After duration reaches the preset time, variable.
• SIGNAL2 becomes OFF. Duration is stored to variable SAMPLE2.
• Duration is still updated even if variable SIGNAL1 becomes OFF before duration reaches the preset time specified with
variable SAMPLE1.
• The content of duration after duration reaches the preset time specified with variable SAMPLE1 is held as long as variable
SIGNAL1 is ON. When variable SIGNAL1 becomes OFF, duration is cleared to zero, and "0" is stored to variable SAMPLE2
as the result.
Error information:
• If preset time PT is less than 0, Pulse Timer instruction takes an absolute value for operation.
• For the Integrated Controller V Series L controller, the internal timer minimum unit is 100ms, so update is made in units of
100ms even if TP instruction of 1ms unit is used.
6F8C1226
5. Timers 5-12
Instance name
SS_P
Timer activation command IN Q Time up status
Arguments:
Arg. Operand Type Const. Description
IN BOOL √ Timer activation command
Input
PT DINT √ Preset time
Q BOOL — Time up status
Output
ET DINT — Duration
Instance structure:
Name Type Description
Q BOOL Time up status
ET DINT Duration
Function:
• After Timer activation command IN becomes ON, time up status Q is set to ON until preset time elapses.
• Duration ET is added.
• If Timer activation command becomes OFF before the timer expires, the time up status also becomes OFF.
• After preset time has elapsed, duration ET is cleared when Timer activation command becomes OFF.
• The range of preset time PT is as follows:
SS_P (100ms timer) : 0 to 2147483647 ×100ms [59652h19m24s700ms (2485.51348day)]
SSM_P (0.1 minute timer) : 0 to 2147483647 × 0.1 minutes [3579139h24m42s (149130.8088day)]
Input Output
Action
IN Q ET
OFF Not executed OFF 0
Duration < Preset time ON Current
ON Executed
Duration ≧ Preset time OFF ET
6F8C1226
5. Timers 5-13
Program example:
SS_1 SIGNAL1
SIGNAL1 SS_P SIGNAL2 SAMPLE1
IN Q
SAMPLE1 PT ET SAMPLE2 SAMPLE2
LD ST
SIGNAL2
• After variable SIGNAL1 becomes ON, variable SIGNAL2 is ON until preset time specified with variable SAMPLE1 elapses.
After the duration reaches a preset time, variable SIGNAL2 becomes OFF. Duration is stored in variable SAMPLE2.
• When variable SIGNAL1 becomes OFF before duration ET reaches the preset time specified with variable SAMPLE1,
variable SAMPLE2 which is the duration becomes 0. Variable SIGNAL2 which is the time up status also becomes OFF.
• After duration ET has reached the preset time specified with SAMPLE1, its content is retained while variable SIGNAL1 is ON.
When variable SIGNAL1 becomes OFF, duration is cleared to 0 and 0 is stored in variable SAMPLE2.
Error information:
• When preset time PT is less than 0, the Pulse timer instruction operates on the absolute value.
• When preset time PT=0, the time up status becomes ON for just 1 scan.
6F8C1226
5. Timers 5-14
Instance name
Date and time of day update RTC
Diagram command IN Q Output
Preset date and time of day PDT CDT Current date and time
of day
Arguments:
Arg. Operand Type Const. Description
IN BOOL √ Date and time of day update command
Input
PDT DT — Preset date and time of day
Q BOOL — Output
Output
CDT DT — Current date and time of day
Instance structure:
Name Type Description
Q BOOL Output
Function:
• When the Date and time of day update command IN changes from OFF to ON, the calendar is updated with the specified
preset date and time of day PDT.
(The millisecond part of PDT is ignored, and the calendar is updated with the PDT value.)
• When Date and time of day update command IN is ON, the current calendar content is output to current date and time of day
CDT.
• The state of Date and time of day update command IN is output to output Q.
Input Output
Action
IN Q CDT
Not
OFF Not executed OFF
updated
When previous input=OFF:
Update calendar
(CDT=PDT) Current
ON Executed ON
When previous input=ON: CDT
CDT=Current date and
time of day
Program example:
RTC_1
SIGNAL1 RTC SIGNAL2
IN Q
SAMPLE1 SAMPLE2
LD PDT CDT ST
• When variable SIGNAL1 changes from OFF to ON, the calendar is updated with the preset date and time of day specified
with variable SAMPLE1.
• While SIGNAL1 is ON, the current time is output to variable SAMPLE2.
• Variable SIGNAL2 becomes ON when variable SIGNAL1 is ON and SIGNAL2 becomes OFF when variable SIGNAL1 is
OFF.
Error information:
• The calendar is not updated when the content of preset date and time of day CDT is abnormal.
6F8C1226
5. Timers 5-15
nv dedicated
Timers Real Time Clock
instruction
LD/FBD language Instance name
notation
RTC_N
Date and time of day
update command IN Q Completion output
Arguments:
Instance structure:
Function:
• When the date and time of day command IN changes from OFF to ON, the calendar is updated with the specified preset date
and time of day PDT.
• When the date and time of day command IN is ON, the current calendar content is output to the current date and time of day
CDT.
• When date and time of day update is complete, output Q is set to ON.
Input Output
Action
IN Q CDT
FALSE(OFF) Not executed FALSE(OFF)
Previous input =FALSE(OFF): Not updated
FALSE(OFF)
Calendar is updated
TRUE(ON) Executed
Previous input =TRUE(ON):
TRUE(ON) Current CDT
Current date/time ÆCDT
6F8C1226
5. Timers 5-16
Program example:
[LD/FBD language notation]
RTC_1
SIGNAL1 RTC_N SIGNAL2
IN Q
SAMPLE1 PDT CDT SAMPLE2
LD ST
• When variable SIGNAL1 changes from OFF to ON, the calendar is updated with the preset date and time of day specified
with variable SAMPLE1. After the calendar is updated, completion output SIGNAL2 becomes ON.
• Current day/time is output to variable SAMPLE2, after variable SIGNAL1 becomes ON and the calendar is updated.
Error information:
• The calendar is not updated when the content of preset date and time of day CDT is abnormal. Completion output outputs
the state of Date and time of day update command IN.
6F8C1226
5. Timers 5-17
On/Off-Delay Timer
TOSDIC-compatible
Timers On/Off-Delay Timer
instruction
LD/FBD language Instance name
notation
DEL_L
Input flag U1 Y Result output
Arguments:
Instance structure:
Function:
• After input flag U1 becomes ON, result output is set to ON after on-delay time H1. After input flag U1 becomes OFF, result
output is set to OFF after off-delay time H2.
• After input flag U1 becomes ON, result output Y is set to ON after on-delay time H1.
• After input flag U1 becomes OFF, result output Y is set to OFF after off-delay time H2.
6F8C1226
5. Timers 5-18
• When the input becomes OFF during on-delay, off-delay time measurement starts while continuing on-delay.
• When the input becomes ON during off-delay, off-delay is stopped, the output is inversed, and then on-delay is started.
• When the input becomes OFF during on-delay and becomes ON again during off-delay, off-delay is stopped and on-delay is
started again.
• If off-delay is shorter than on-delay (off-delay is stopped during on-delay operation), there is no output.
Normal Input becomes OFF Input becomes ON Input is changed Off-delay is stopped
Operation during on-delay during off-delay during on/off-delay during on-delay
ti
Input U1
Output Y
-> Time
Program example:
[LD/FBD language notation]
DEL_1
S1 DEL_L S2
U1 Y
DP11LD H1 ON ON_TIME ST
• S2, where ON change of S1 is delayed for DP11 [sec] and OFF change of S1 is delayed for DP12 [sec], is output.
Error information:
• If on/off-delay time is a negative number, On/Off-Delay Timer instruction takes an absolute value for operation.
• When on/off-delay time =0, Input U1=Output Y.
• If on/off-delay time is nonnumeric, nonnumeric abnormal is set to ON, and the instruction itself is not processed.
6F8C1226
6. Filp-Flops 6-1
6 Filp-Flops
Instance name
SR
Diagram Set input S1 Q1 Output
Reset input R
Arguments:
Arg. Operand Type Const. Description
S1 BOOL √ Set input
Input
R BOOL √ Reset input
Output Q1 BOOL — Output
Instance structure:
Name Type Description
Q1 BOOL Output
Function:
• When set input S1 is ON, output Q1 is set to ON regardless of the input state of reset input R.
• When set input S1 is OFF and reset input R is ON, output Q1 is reset to OFF.
• Output Q1 is unchanged when set input S1 and reset input R are both OFF.
Input Output
Action
S1 R Q1
Retain
OFF OFF Not executed
previous value
OFF ON OFF
Executed
ON * ON
Program example:
FF_1 SIGNAL1
SIGNAL1 SR SIGNAL3 SIGNAL2
S1 Q1
SIGNAL2 SIGNAL3
R
Instance name
RS
Diagram Set input S Q1 Output
Reset input R1
Arguments:
Arg. Operand Type Const. Description
S BOOL √ Set input
Input
R1 BOOL √ Reset input
Output Q1 BOOL — Output
Instance structure:
Name Type Description
Q1 BOOL Output
Function:
• When reset input R1 is ON, output Q1 is reset to OFF regardless of the input state of set input S.
• When reset input R1 is OFF and set input S is ON, output Q1 is set to ON.
• Output Q1 is unchanged when set input S and reset input R1 are both OFF.
Input Output
Action
S R1 Q1
Retain previous
OFF OFF Not executed
value
* ON OFF
Executed
ON OFF ON
Program example:
FF_1 SIGNAL1
SIGNAL1 RS SIGNAL3 SIGNAL2
S Q1
SIGNAL2 SIGNAL3
R1
Filp-Flops Semaphore
Instance name
SEMA
Diagram Test and set command CLAIM BUSY Semaphore status output
Arguments:
Arg. Operand Type Const. Description
CLAIM BOOL √ Test and set command
Input
RELEASE BOOL √ Release command
Output BUSY BOOL — Semaphore status output
Instance structure:
Name Type Description
BUSY BOOL Semaphore status output
X BOOL Internal variable
Function:
• Initially, resets internal variable X to OFF.
• State of internal variable X is output to semaphore status output BUSY.
• After internal variable X is output to semaphore status output BUSY, internal variable X is set to ON when test and set
command CLAIM is ON.
• When test and set command CLAIM is OFF and release command RELEASE is ON after internal variable X is output to
semaphore status output BUSY, semaphore state output BUSY and internal variable X are reset to OFF .
Input Output
Action
CLAIM RELEASE BUSY
OFF OFF BUSY=Internal variable Xn-1
BUSY=Internal variable Xn-1 Previous Xn-1
ON *
Internal variable Xn=ON
BUSY=OFF
OFF ON OFF
Internal variable Xn=OFF
6F8C1226
6. Filp-Flops 6-5
Program example:
SEMA_1
SIGNAL1 SEMA SIGNAL3
CLAIM BUSY
SIGNAL2
RELEASE
SIGNAL1
SIGNAL2
SIGNAL3
• The state of internal variable X after executing previous SEMA_1 is output to variable SIGNAL3.
Except when variable SIGNAL1=OFF and variable SIGNAL2=ON
• When variable SIGNAL1 is ON, internal variable X is set to ON.
• When variable SIGNAL1 is OFF and variable SIGNAL2 is ON, internal variable X and variable SIGNAL3 becomes OFF.
6F8C1226
7. Moving 7-1
7 Moving
Variable (BOOL)
Diagram
Input Output
Arguments:
• The following data types are supported for input and output:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
Variable (BOOL)
Input Output
Input Output
INT INT
DINT DINT
UINT UINT
REAL REAL
WORD WORD
DWORD DWORD
TIME TIME
TOD TOD
DATE DATE
Function:
(1)Combination of Normally Open Contact Gate instruction and ST instruction or function and function block input
• When variable (BOOL) is ON, input data is output as the result.
• When variable (BOOL) is OFF, output is set to 0.
Input Action Output
OFF 0
Executed
ON Input data
Program example:
(1)Normally Open Contact Gate instruction + ST instruction
SIGNAL1
SAMPLE1 SAMPLE2
LD ST
Error information:
• When there is a boundary error due to index modification, Normally Open Contact Gate instruction is executed with the value
of variable (BOOL) reset to OFF and data boundary over occurs.
6F8C1226
7. Moving 7-4
Variable (BOOL)
Diagram
Input Output
Arguments:
• The following data types are supported for input and output:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
Variable (BOOL)
Input Output
Input Output
INT INT
DINT DINT
UINT UINT
REAL REAL
WORD WORD
DWORD DWORD
TIME TIME
TOD TOD
DATE DATE
Function:
(1)Combination of Normally Closed Contact Gate instruction and ST instruction or function and function block input
• When variable (BOOL) is OFF, input data is output as result.
• When variable (BOOL) is ON, output is set to 0.
Input Action Output
OFF Input data
Executed
ON 0
Program example:
(1)Normally Closed Contact Gate instruction + ST instruction
SIGNAL1
SAMPLE1 SAMPLE2
LD ST
Error information:
• When there is a boundary error due to index modification, Normally Closed Contact Gate instruction is executed with the
value of variable (BOOL) reset to OFF and data boundary over occurs.
6F8C1226
7. Moving 7-6
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
Function:
• Input data is output as result.
Program example:
SAMPLE1 MOVE_INT SAMPLE2
1234 1234
LD ST
• Content of variable SAMPLE1 1234 is moved to variable SAMPLE2.
6F8C1226
7. Moving 7-7
TMOV
Input table TBL Output table
Diagram
Transfer word number N
Arguments:
Arg. Operand Type Const. Description Remarks
TBL PTR — Input table
Input
N UINT √ Transfer word number 1 ≤ N ≤ 1024
Output — PTR — Output table
Function:
• N data words starting at input table are transferred as block to output table.
• 1 to 1024 words may be transferred. If N=0, no table transfer is performed.
• When transferring 2W length data such as DINT, REAL, TIME, TOD, DATE, or DWORD, up to 512 data can be transferred
by specifying transfer words × 2.
• Direct I/O variable cannot be specified for input table or output table.
Table Table word Error
Action
specification number flag
1 ≤ N ≤ 1024 Executed —
Not direct I/O N=0 Not executed —
N > 1024 Executed with N=1024 as limit —
Direct I/O * Not executed ON
Batch
transfer
N words N words
Program example:
ARRAY1 TMOV ARRAY2 ARRAY1 ARRAY2
LD TBL ST 1234 1234
8 2345 2345
N
LD 3456 3456
4567 4567
8 words
5678 5678
6789 6789
7890 7890
8901 8901
• The 8 words source data starting from variable ARRAY1 are transferred as block to destination starting at variable ARRAY2.
6F8C1226
7. Moving 7-8
Error information:
• If the number of transfer words exceed 1024W, operation is performed with 1024 as the limit.
• If the input table or output table exceeds the specified range, table transfer is not performed and data boundary over occurs.
• Table transfer is not performed if direct I/O variables are specified for input table or output table. Also, the Error Flag is set
to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
7. Moving 7-9
Instance name
XCHG_xxx
Diagram Input 1 IN1 OUT1 Output 1
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description
IN1 √ Input 1
Input
IN2 √ Input 2
See below
OUT1 — Output 1
Output
OUT2 — Output 2
XCHG_xxx
Input 1 IN1 OUT1 Output 1
Instance structure:
Name Type Description
OUT1 See above Output 1
OUT2 See above Output 2
Function:
• Input data Input 1 is output to Output 2 and Input 2 is output to Output 1.
Input 1 Output 1
Input 2 Output 2
6F8C1226
7. Moving 7-10
Program example:
Xchg_1
XCHG_INT
SAMPLE1 SAMPLE1
1234 IN1 OUT1 5678
LD ST
SAMPLE2 SAMPLE2
5678 IN2 OUT2 1234
LD ST
TINZ_xxx
Initialization data IN Output table
Diagram
Count N
Arguments:
• The following data types are supported for input arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
IN See below √ Initialization data
Input
N UINT √ Count 1 ≤ N ≤ 1024
Output — PTR — Output table
TINZ_xxx
Initialization data IN Output table
Count N
Function:
• An N word block starting at output table is initialized with initialization data IN.
• 1 to 1024 words may be transferred. If N=0, no table initialization is performed.
• Direct I/O variable cannot be specified for output table.
Table Table word Error flag
Action
specification number
1 ≤ N ≤ 1024 Executed —
Not direct I/O N=0 Not executed —
N > 1024 Executed with N=1024 as limit —
Direct I/O * Not executed ON
Output table
Program example:
SAMPLE1 TINZ_INT ARRAY1 SAMPLE1 ARRAY1
LD IN ST 1234 1234
8 1234
N
LD 1234
1234
8 words
1234
1234
1234
1234
• 8 words block starting at variable ARRAY1 is initialized with content of variable SAMPLE1 1234.
Error information:
• If the number of transfer words exceed 1024W, operation is performed with 1024 as the limit.
• If the output table exceeds the specified range, table initialization is not performed and data boundary over occurs.
• Table transfer is not performed if direct I/O variable is specified for output table. Also, the Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
8. Comparison 8-1
8 Comparison
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — BOOL — Output
Input n
Function:
• Compares the value of input data and outputs the comparison result.
ON is output when the condition Input 1 > Input 2 >...> Input n is satisfied.
OFF is output when the condition Input 1 > Input 2 >...> Input n is not satisfied.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Input Condition Output
Input data When Input 1 > Input 2 >...> Input n is satisfied ON
Input 1...Input n When Input 1 > Input 2 >...> Input n is not satisfied OFF
6F8C1226
8. Comparison 8-3
Program example:
SAMPLE1 GT_INT SIGNAL1
7777 1
LD ST
SAMPLE2
6666
LD
SAMPLE3
5555
LD
SAMPLE4
4444
LD
• Compares the data in variables SAMPLE1 to 4 and outputs ON to variable SIGNAL1 because the condition SAMPLE1 >
SAMPLE2 > SAMPLE3 > SAMPLE4 is satisfied.
Error information:
• If NAN data is entered as input when the input data type is REAL, OFF is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
8. Comparison 8-4
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — BOOL — Output
Input n
Function:
• Compares the value of input data and outputs the comparison result.
ON is output when the condition Input 1 ≥ Input 2 ≥...≥ Input n is satisfied.
OFF is output when the condition Input 1 ≥ Input 2 ≥...≥ Input n is not satisfied.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Input Condition Output
Input data When Input 1 ≥ Input 2 ≥…≥ Input n is satisfied ON
Input 1...Input n When Input 1 ≥ Input 2 ≥…≥ Input n is not satisfied OFF
6F8C1226
8. Comparison 8-5
Program example:
SAMPLE1 GE_INT SIGNAL1
7777 1
LD ST
SAMPLE2
6666
LD
SAMPLE3
6666
LD
SAMPLE4
5555
LD
• Compares the data in variables SAMPLE1 to 4 and outputs ON to variable SIGNAL1 because the condition SAMPLE1 ≥
SAMPLE2 ≥ SAMPLE3 ≥ SAMPLE4 is satisfied.
Error information:
• If NAN data is entered as input when the input data type is REAL, OFF is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
8. Comparison 8-6
Comparison Equal
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — BOOL — Output
Input n
Function:
• Compares the value of input data and outputs the comparison result.
ON is output when the condition Input 1=Input 2=...=Input n is satisfied.
OFF is output when the condition Input 1=Input 2=...=Input n is not satisfied.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Input Condition Output
Input data When Input 1=Input 2=…=Input n is satisfied ON
Input 1...Input n When Input 1=Input 2=…=Input n is not satisfied OFF
6F8C1226
8. Comparison 8-7
Program example:
SAMPLE1 EQ_INT SIGNAL1
1234 1
LD ST
SAMPLE2
1234
LD
SAMPLE3
1234
LD
SAMPLE4
1234
LD
• Compares the data in variables SAMPLE1 to 4 and outputs ON to variable SIGNAL1 because the condition
SAMPLE1=SAMPLE2=SAMPLE3=SAMPLE4 is satisfied.
Error information:
• If NAN data is entered as input when the input data type is REAL, OFF is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
8. Comparison 8-8
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — BOOL — Output
Input n
Function:
• Compares the value of input data and outputs the comparison result.
ON is output when the condition Input 1 ≤ Input 2 ≤...≤ Input n is satisfied.
OFF is output when the condition Input 1 ≤ Input 2 ≤...≤ Input n is not satisfied.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Input Condition Output
Input data When Input 1 ≤ Input 2 ≤…≤ Input n is satisfied ON
Input 1...Input n When Input 1 ≤ Input 2 ≤…≤ Input n is not satisfied OFF
6F8C1226
8. Comparison 8-9
Program example:
SAMPLE1 LE_INT SIGNAL1
1111 1
LD ST
SAMPLE2
2222
LD
SAMPLE3
2222
LD
SAMPLE4
3333
LD
• Compares the data in variables SAMPLE1 to 4 and outputs ON to variable SIGNAL1 because the condition SAMPLE1 ≤
SAMPLE2 ≤ SAMPLE3 ≤ SAMPLE4 is satisfied.
Error information:
• If NAN data is entered as input when the input data type is REAL, OFF is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
8. Comparison 8-10
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — BOOL — Output
Input n
Function:
• Compares the value of input data and outputs the comparison result.
ON is output when the condition Input 1 < Input 2 <...< Input n is satisfied.
OFF is output when the condition Input 1 < Input 2 <...< Input n is not satisfied.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Input Condition Output
Input data When Input 1 < Input 2 <…< Input n is satisfied ON
Input 1...Input n When Input 1 < Input 2 <…< Input n is not satisfied OFF
6F8C1226
8. Comparison 8-11
Program example:
SAMPLE1 LT_INT SIGNAL1
1111 1
LD ST
SAMPLE2
2222
LD
SAMPLE3
3333
LD
SAMPLE4
4444
LD
• Compares the data in variables SAMPLE1 to 4 and outputs ON to variable SIGNAL1 because the condition SAMPLE1 <
SAMPLE2 < SAMPLE3 < SAMPLE4 is satisfied.
Error information:
• If NAN data is entered as input when the input data type is REAL, OFF is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
8. Comparison 8-12
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1, 2 Input number=2
Output — BOOL — Output
Input 2
Function:
• Compares the value of input data and outputs the comparison result.
ON is output when the condition Input 1≠Input 2 is satisfied.
OFF is output when the condition Input 1≠Input 2 is not satisfied.
• Number of input data must be 2.
• Input 1 and Input 2 must have the same data type.
Input Condition Output
Input data When Input 1≠Input 2 is satisfied ON
Input 1, Input 2 When Input 1≠Input 2 is not satisfied OFF
6F8C1226
8. Comparison 8-13
Program example:
SAMPLE1 NE_INT SIGNAL1
1111 1
LD ST
SAMPLE2
2222
LD
• Compares the data in variables SAMPLE1 and SAMPLE2 and outputs ON to variable SIGNAL1 because the condition
SAMPLE1≠SAMPLE2 is satisfied.
Error information:
• If NAN data is entered as input when the input data type is REAL, OFF is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-1
9 Selection
Selection Maximum
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
• The maximum value of input data Input 1 to Input n is obtained and output as result.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
6F8C1226
9. Selection 9-3
Program example:
• The maximum value of input data SAMPLE1 to SAMPLE4 is obtained and the maximum value 6666 is stored in variable
SAMPLE5.
Error information:
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-4
MAXL_xxx
Input table TBL Output
Diagram
Number N
Arguments:
• The following data types are supported for output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
TBL PTR — Input table
Input
N UINT √ Number 1 ≤ N ≤ 256
Output — See below — Output
MAXL_xxx
Input table TBL Output
Number N
Function:
• The maximum value is obtained out of N data starting from the variable specified with input table TBL and the result is output.
Also, the table pointer of the maximum value is output to index register XL.
• The allowed range of number N is 1 ≤ N ≤ 256.
• If number N=0, the top data of the input table is output as result and index register XL is set to 0.
• If there is more than one maximum, the one with the smallest table pointer No. is output to index register XL.
• Direct I/O variable cannot be specified for input table.
Table specification Table word number Action Error flag
1 ≤ N ≤ 256 Executed —
Not direct I/O N=0 Not executed —
N > 256 Executed with N=256 as limit —
Direct I/O * Not executed ON
6F8C1226
9. Selection 9-5
Program example:
• The maximum value is obtained from 6 data in input table ARRAY1 and the maximum value 100 is stored in variable
SAMPLE1. Also, the table pointer 2 of the maximum value is output to index register XL.
Error information:
• If N exceeds 256, N is limited to 256.
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When direct I/O variable is specified as input table, table data maximum is not obtained. Also, the Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-6
Selection Minimum
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
• The minimum value of input data Input 1 to Input n is obtained and output as result.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
6F8C1226
9. Selection 9-7
Program example:
• The minimum value of input data SAMPLE1 to SAMPLE4 is obtained and the minimum value -5555 is stored in variable
SAMPLE5.
Error information:
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-8
MINL_xxx
Input table TBL Output
Diagram
Number N
Arguments:
• The following data types are supported for output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
TBL PTR — Input table
Input
N UINT √ Number 1 ≤ N ≤ 256
Output — See below — Output
MINL_xxx
Input table TBL Output
Number N
Function:
• The minimum value is obtained out of N data starting from the variable specified with input table TBL and the minimum value
is output as result. Also, the table pointer of the minimum value is output to index register XL.
• The allowed range of number N is 1 ≤ N ≤ 256.
• If number N=0, the top data of the input table is output as result and index register XL is set to 0.
• If there is more than one minimum, the one with the smallest table pointer No. is output to index register XL.
• Direct I/O variables cannot be specified for input table.
Table specification Table word number Action Error flag
1 ≤ N ≤ 256 Executed —
Not direct I/O N=0 Not executed —
N > 256 Executed with N=256 as limit —
Direct I/O * Not executed ON
6F8C1226
9. Selection 9-9
Program example:
• The minimum value is obtained from 6 data in input table ARRAY1 and the minimum value -100 is stored in variable
SAMPLE1. Also, the table pointer 2 of the minimum value is output to index register XL.
Error information:
• If N exceeds 256, N is limited to 256.
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When direct I/O variable is specified as input table, table data minimum is not obtained. Also, the Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-10
Input 2
Diagram
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
• The average of input data Input 1 to Input n is obtained and output as result.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Output = (Input 1 + Input 2 + Input 3 + ... + Input n) / n
6F8C1226
9. Selection 9-11
Program example:
• The average value of input data SAMPLE1 to SAMPLE4 is obtained and the average value 1111 is stored in variable
SAMPLE5.
Error information:
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-12
AVEL_xxx
Input table TBL Output
Diagram
Number N
Arguments:
• The following data types are supported for output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
TBL PTR — Input table
Input
N UINT √ Number 1 ≤ N ≤ 256
Output — See below — Output
AVEL_xxx
Input table TBL Output
Number N
Function:
• The average value is obtained from N data starting from the variable specified with input table TBL and the result is output.
• The allowed range of number N is 1 ≤ N ≤ 256.
• If number N=0, the top data of the input table is output as result.
• Direct I/O variables cannot be specified for input table.
Table specification Table word number Action Error flag
1 ≤ N ≤ 256 Executed —
Not direct I/O N=0 Not executed —
N > 256 Executed with N=256 as limit —
Direct I/O * Not executed ON
Output = (TBL[0] + TBL[1] +...+ TBL[N-1]) / N
6F8C1226
9. Selection 9-13
Program example:
• The average value is obtained from 6 data in input table ARRAY1 and the average value -10 is stored in variable SAMPLE1.
Error information:
• If N exceeds 256, N is limited to 256.
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When direct I/O variable is specified as input table, table data average is not obtained. Also, the Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-14
Selection Limiter
LIMIT_xxx
Minimum MN Output
Maximum MX
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
MN √ Minimum
Input IN √ Input value
See below
MX √ Maximum
Output — — Output
LIMIT_xxx
Minimum MN Output
Input value IN
Maximum MX
Function:
• If input value IN is within maximum MX and minimum MN (minimum MN ≤ input value IN ≤ maximum MX) the input value is
output as result.
• If IN is greater than maximum MX, maximum MX is output as result.
• If IN is less than minimum MN, minimum MN is output as result.
• Input data cannot have mixed data types.
OUT = MIN{MAX(IN, MN), MX}
6F8C1226
9. Selection 9-15
Program example:
Error information:
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
Note
The input data IN is limited to + Infinity or - Infinity INF before LIMIT processing.
The condition is as follows:
• The Input value IN is REAL type.
• The value NAN or INF is set as the data MN, IN and MX.
Input data Limited data
Hex.
MN,IN,MX MN, IN, MX
+ NAN 16#7F80_0001 - 16#7FFF_FFFF
+ MAX
+ INF 16#7F80_0000
+ MAX 16#7F7F_FFFF
:
+ MIN 16#0000_0001
16#0000_0000
0 Input data
16#8000_0000
- MIN 16#8000_0001
:
- MAX 16#FF7F_FFFF
- INF 16#FF80_0000
- MAX
- NAN 16#FF80_0001 - 16#FFFF_FFFF
6F8C1226
9. Selection 9-16
Selection Selector
SEL_xxx
Select input G Output
Input 1 IN1
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
G BOOL √ Select input
Input IN0 √ Input 0
IN1 See below √ Input 1
Output — — Output
SEL_xxx
Select input G Output
Input 0 IN0
Input 1 IN1
Function:
• Input 0 or Input 1 is selected depending on the status of select input G.
When select input G=OFF, Input 0 is selected and output as result.
When select input G=ON, Input 1 is selected and output as result.
• Input 0 and Input 1 must have the same data type.
6F8C1226
9. Selection 9-17
Program example:
• Because select input variable SIGNAL1 is ON, 2000 is stored in SAMPLE3 as result.
6F8C1226
9. Selection 9-18
Selection Multiplex
MUX_xxx
Input point No. K Output
Diagram Input 0
Input(n-1)
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
K UINT √ Input point No. 0 ≤ K ≤ (n-1)
Input
— See below √ Input 0...Input(n-1) 2 ≤ n ≤ 14
Output — — Output
MUX_xxx
Input point No. K Output
Input 0
Input(n-1)
Function:
• Selects input data specified with input point No. K. Input 0 is selected if input point No. K=0 and Input (n-1) is selected if input
point No. K=(n-1).
• Up to 14 input data are allowed.
• Input 0 to (n-1) must have the same data type.
6F8C1226
9. Selection 9-19
Program example:
• Because the input point No. specified by SAMPLE1 is 2, -9876 which is the content of variable SAMPLE4 is stored in
variable SAMPLE5.
Error information:
• When input point No. K. Input number, operation is performed with K limited to (Input number-1).
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
9. Selection 9-20
MPX_xxx
Input table TBL Output
Arguments:
• The following data types are supported for output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
TBL PTR — Input table
Input K UINT √ Selection point No. 0 ≤ K ≤ (N-1)
N UINT √ Table word number 1 ≤ N ≤ 256
Output — See below — Output
MPX_xxx
Input table TBL Output
Function:
• The K (selection pointer No.) data is selected from N word data specified with input table TBL and result is output.
• Table word number may be from 1 to 256.
• Direct I/O variables cannot be specified for input table.
Table specification Table word number Action Error flag
1 ≤ N ≤ 256 Executed —
Not direct I/O N=0 Not executed —
N > 256 Executed with N=256 as limit —
Direct I/O * Not executed ON
6F8C1226
9. Selection 9-21
Program example:
• From the 6 input table specified with variable ARRAY1, -200 which is the K data (specified by selection pointer No. K=2 in
SAMPLE1) is stored in variable SAMPLE3.
Error information:
• If table word number N exceeds 256, N is limited to 256.
• When selection point No. K ≥ Table word number, operation is performed with K limited to (Table word number-1). Also, the
specific register Table Operation Error Flag is set ON.
• When direct I/O variable is specified as input table, table multiplexing is not performed. Also, the Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-1
10 Type Conversion
TIME_TO_UINT
15 Duration-Real Numbers Conversion TIME_TO_REAL
TIME_TO_BCD_WORD
16 Duration-BCD Conversion
TIME_TO_BCD_DWORD
17 Truncation TRUNC
18 Sign Negative NEG
19 DEG-RAD Conversion DEG_TO_RAD
20 RAD-DEG Conversion RAD_TO_DEG
BIN_INT_P PCS
21 BIN Conversion
BIN_DINT_P PCS
DT_TO_TOD
22 Time Data Type Conversion
DT_TO_DATE
23 Concatenate Time Data CONCAT_D_TOD
24 ASCII-HEX Conversion ATOH_T T
25 HEX-ASCII Conversion HTOA_T T
26 ASCII-Real Numbers Conversion ASC_TO_REAL
27 Real Numbers-ASCII Conversion REAL_TO_ASC
ASCII (Decimal)-Double Integer
28 ASCDEC_TO_DINT
Conversion
ASCII (Hexadecimal)-Double Integer
29 ASCHEX_TO_DINT
Conversion
Double Integer-ASCII (Decimal)
30 DINT_TO_ASCDEC
Conversion
Double Integer-ASCII (Hexadecimal)
31 DINT_TO_ASCHEX
Conversion
32 Array-String Conversion ARRAY_TO_STRING
33 String-Array Conversion STRING_TO_ARRAY
34 Tag Number Conversion TO_INDEX
6F8C1226
10. Type Conversion 10-3
xxx_TO_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
xxx_TO_xxx
Input Output
Function:
• The entered integer data is converted to specified integer data.
• The conversion range and limits are shown below.
Instruction Input Output Limit
INT_TO_DINT -32768 to 32767 -32768 to 32767 —
0 to 32767 0 to 32767 —
INT_TO_UINT
Input < 0 0 √
-32768 to 32767 -32768 to 32767 —
DINT_TO_INT Input < -32768 -32768 √
Input > 32767 32767 √
0 to 65535 0 to 65535 —
DINT_TO_UINT Input < 0 0 √
Input > 65535 65535 √
0 to 32767 0 to 32767 —
UINT_TO_INT
Input > 32767 32767 √
UINT_TO_DINT 0 to 65535 0 to 65535 —
6F8C1226
10. Type Conversion 10-4
Program example:
(1) Normal execution
SAMPLE1 DINT_TO_INT SAMPLE2
−1234 −1234
LD ST
• Input data -1234 in variable SAMPLE1 is converted to INT and the result -1234 is stored in variable SAMPLE2.
• Because input data -40000 in SAMPLE1 exceeds the valid data range for INT, the result -32768 is stored in SAMPLE2.
Error information:
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-5
xxx_TO_REAL
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input
Output — REAL — Output
xxx_TO_REAL
Input Output
Input Symbol
INT INT_TO_REAL
DINT DINT_TO_REAL
UINT UINT_TO_REAL
Function:
• The entered integer data is converted to REAL data.
• If input is DINT, integer data between -16777215 and 16777215 is converted precisely to REAL.
Program example:
• Input data 1234 in variable SAMPLE1 is converted to REAL and the result 1234.0 is stored in variable SAMPLE2.
6F8C1226
10. Type Conversion 10-6
xxx_TO_xxx
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
xxx_TO_xxx
Input Output
Function:
• The entered integer data is converted to specified bit string data.
• The conversion range and limits are shown below.
Instruction Input Output Limit
INT_TO_WORD -32768 to 32767 16#8000 to 16#7FFF —
INT_TO_DWORD -32768 to 32767 16#FFFF8000 to 16#00007FFF —
-32768 to 32767 16#8000 to 16#7FFF —
DINT_TO_WORD Input < -32768 16#8000 √
Input > 32767 16#7FFF √
DINT_TO_DWORD -2147483648 to 2147483647 16#80000000 to 16#7FFFFFFF —
UINT_TO_WORD 0 to 65535 16#0 to 16#FFFF —
UINT_TO_DWORD 0 to 65535 16#0 to 16#0000FFFF —
Program Example:
SAMPLE1 INT_TO_WORD SAMPLE2
−1234 16#FB2E
LD ST
• Input data -1234 in SAMPLE1 is converted to WORD and the result 16#FB2E is stored in SAMPLE2.
Error information:
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-7
xxx_TO_BCD_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
xxx_TO_BCD_xxx
Input Output
Function:
• The entered integer data is converted to BCD data.
• The conversion range and limits are shown below.
Instruction Input Output Limit BCD error
0 to 9999 16#0 to 16#9999 — —
INT_TO_BCD_WORD Input < 0 16#0 √ ON
Input > 9999 16#9999 √ ON
0 to 32767 16#0 to 16#32767 — —
INT_TO_BCD_DWORD
Input < 0 16#0 √ ON
0 to 9999 16#0 to 16#9999 — —
DINT_TO_BCD_WORD Input < 0 16#0 √ ON
Input > 9999 16#9999 √ ON
0 to 99999999 16#0 to 16#99999999 — —
DINT_TO_BCD_DWORD Input < 0 16#0 √ ON
Input > 99999999 16#99999999 √ ON
0 to 9999 16#0 to 16#9999 — —
UINT_TO_BCD_WORD
Input > 9999 16#9999 √ ON
UINT_TO_BCD_DWORD 0 to 65535 16#0 to 16#65535 — —
6F8C1226
10. Type Conversion 10-8
Program example:
(1) Normal execution
SAMPLE1 UINT_TO_BCD_WORD SAMPLE2
1234 16#1234
LD ST
• The input data 1234 in SAMPLE1 is converted to BCD and the result 16#1234 is stored in SAMPLE2.
Error information:
• If the BCD data after conversion exceeds the valid range of the output data, the conversion result is limited by
16#0 or 16#9999 when WORD
16#0 or 16#99999999 when DWORD
• Also, the specific register BCD Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-9
xxx_TO_TIME
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input
Output — TIME — Output
xxx_TO_TIME
Input Output
Input Symbol
INT INT_TO_TIME
DINT DINT_TO_TIME
UINT UINT_TO_TIME
Function:
• The entered integer data is converted to TIME data.
• Input data is converted as ms unit.
Program example:
SAMPLE1 INT_TO_TIME SAMPLE2
1234 T#1234ms
LD ST
• Input data 1234 in variable SAMPLE1 is converted to TIME and the result T#1234ms is stored in variable SAMPLE2.
6F8C1226
10. Type Conversion 10-10
REAL_TO_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — REAL √ Input
Output — See below — Output
REAL_TO_xxx
Input Output
Symbol Output
REAL_TO_INT INT
REAL_TO_DINT DINT
REAL_TO_UINT UINT
Function:
• The entered REAL data is converted to fixed point integer data.
• Fractions are rounded according to IEC559.
2.6 → 3
3.4 → 3
-2.4 → -2
• The range of integer data after conversion is as follows. If the conversion result exceeds this range, the limit of the output
data type is output.
INT conversion : -32768 to 32767
DINT conversion: -2147483648 to 2147483647
UNIT conversion: 0 to 65535
6F8C1226
10. Type Conversion 10-11
Program example:
(1) Normal execution
SAMPLE1 REAL_TO_INT SAMPLE2
4.567 5
LD ST
• Input data 4.567 in variable SAMPLE1 is converted to INT and the result 5 is stored in variable SAMPLE2.
• Input data 54321.0 in SAMPLE1 is converted to INT, but the result 32767 is stored in SAMPLE2 because the valid data
range of SAMPLE2 is exceeded.
Error information:
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• When input data type is REAL, if NAN data is entered as input, 0 is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-12
REAL_TO_BCD_xxx
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — REAL √ Input
Output — See below — Output
REAL_TO_BCD_xxx
Input Output
Symbol Output
REAL_TO_BCD_WORD WORD
REAL_TO_BCD_DWORD DWORD
Function:
• The entered REAL data is rounded at the first decimal place and the result is converted to BCD data.
• The conversion range and limits are as follows:
Instruction Input (after rounding) Output Limit BCD error
0.0 to 9999.0 16#0 to 16#9999 — —
REAL_TO_BCD_WORD Input < 0.0 16#0 √ ON
Input > 9999.0 16#9999 √ ON
0.0 to 99999995.0 16#0 to 16#99999992 — —
REAL_TO_BCD_DWORD Input < 0.0 16#0 √ ON
Input > 99999995.0 16#99999999 √ ON
Program example:
(1) Normal execution
SAMPLE1 REAL_TO_BCD_WORD SAMPLE2
1234.0 16#1234
LD ST
• Converts input data 1234.0 in SAMPLE1 to BCD and stores the result 16#1234 in SAMPLE2.
• Stores the result 16#9999 in SAMPLE2 because input data 12345.0 in SAMPLE1 exceeds the valid range.
6F8C1226
10. Type Conversion 10-13
Error information:
• If the BCD data after conversion exceeds the valid range of the output data, the conversion result is limited by
16#0 or 16#9999 when WORD
16#0 or 16#99999999 when DWORD
Also, the special register BCD Error Flag is set to ON.
• If nonnumeric data is entered as input, the result is 0. Also, the special register BCD Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-14
REAL_TO_TIME
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — REAL √ Input
Output — TIME — Output
Function:
• The entered REAL data is rounded at the first decimal place and the result is converted to TIME data.
• Input data is converted as ms unit.
• After conversion, the range of duration data is from T# -2147483648ms to T#2147483647ms. If the conversion result
exceeds this range, the limit of the output data type is output.
Program example:
(1) Normal execution
SAMPLE1 REAL_TO_TIME SAMPLE2
4.567 T#5ms
LD ST
• Input data 4.567 in variable SAMPLE1 is converted to elapsed time and the result T#5ms is stored in variable SAMPLE2.
• Converts input data 3.4E+20 in SAMPLE1 to elapsed time, but stores the result T#2147483647ms in SAMPLE2 because
valid data range of SAMPLE2 is exceeded.
Error information:
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• If nonnumeric data is entered as input, 0 is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-15
xxx_TO_xxx
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
xxx_TO_xxx
Input Output
Function:
• The entered bit string data is converted to integer data.
• The conversion range and limits are shown below.
Instruction Input Output Limit
WORD_TO_INT 16#0 to 16#7FFF 0 to 32767 —
16#8000 to 16#FFFF -32768 to -1 —
WORD_TO_DINT 16#0 to 16#7FFF 0 to 32767 —
16#8000 to 16#FFFF -32768 to -1 —
WORD_TO_UINT 16#0 to 16#FFFF 0 to 65535 —
16#0 to 16#7FFF 0 to 32767 —
DWORD_TO_INT 16#7FFF < Input ≤ 16#7FFFFFFF 32767 √
16#7FFFFFFF < Input < 16#FFFF8000 -32768 √
16#FFFF8000 ≤ Input ≤ 16#FFFFFFFF -32768 to -1 —
DWORD_TO_DINT 16#0 to 16#7FFFFFFF 0 to 2147483647 —
16#80000000 to 16#FFFFFFFF -2147483648 to -1 —
16#0 to 16#FFFF 0 to 65535 —
DWORD_TO_UINT 0 to 65535 (Low order word is √
Input > 16#FFFF
treated as UINT data)
Program example:
SAMPLE1 WORD_TO_INT SAMPLE2
16#FB2E −1234
LD ST
• The input data 16#FB2E in SAMPLE1 is converted to INT and the result -1234 is stored in SAMPLE2.
Error information:
• If input data is greater than 16#FFFF, the low order 16 bits of the converted DWORD data is output.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-16
xxx_TO_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
xxx_TO_xxx
Input Output
Function:
• The entered bit string data is converted to specified bit string data.
• The conversion range and limits are shown below.
Instruction Input Output Limit
WORD_TO_DWORD 16#0 to 16#FFFF 16#0 to 16#FFFF —
16#0 to 16#FFFF 16#0 to 16#FFFF —
DWORD_TO_WORD
Input > 16#FFFF Low order 16 bits are output √
Program Example:
(1) Normal execution
• The input data 16#00001234 in SAMPLE1 is converted to WORD and the result 16#1234 is stored in SAMPLE2.
• Because the input data 16#00012345 in SAMPLE1 exceeds the valid data range for WORD variable, the result 16#2345 is
stored in SAMPLE2. If EN is used, ENO is reset to OFF.
Error information:
• If input data is greater than 16#FFFF, the low order 16 bits of the converted DWORD data is output.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-17
xxx_BCD_TO_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
xxx_BCD_TO_xxx
Input Output
Function:
• The entered BCD data is converted to integer data.
• Data between 16#A and 16#F is invalid in each digit of input data.
• The conversion range and limits are shown below. The result is 0 if 16#A to 16#F is present in each digit.
Instruction Input Output Limit BCD error
16#0 to 16#9999 0 to 9999 — —
WORD_BCD_TO_INT
Each digit input > 16#9 0 — ON
16#0 to 16#9999 0 to 9999 — —
WORD_BCD_TO_DINT
Each digit input > 16#9 0 — ON
16#0 to 16#9999 0 to 9999 — —
WORD_BCD_TO_UINT
Each digit input > 16#9 0 — ON
16#0 to 16#9999 0 to 9999 — —
DWORD_BCD_TO_INT Input >16#9999 9999 √ ON
Each digit input > 16#9 0 — ON
16#0 to 16#99999999 0 to 99999999 — —
DWORD_BCD_TO_DINT
Each digit input > 16#9 0 — ON
16#0 to 16#65535 0 to 65535 — —
DWORD_BCD_TO_UINT Input > 16#65535 65535 √ ON
Each digit input > 16#9 0 — ON
6F8C1226
10. Type Conversion 10-18
Program example:
(1) Normal execution
• The input data 16#00001234 in SAMPLE1 is converted to WORD and the result 16#1234 is stored in SAMPLE2.
• Because the input data 16#00012345 in SAMPLE1 exceeds the valid data range for WORD variable, the result 16#2345 is
stored in SAMPLE2. If EN is used, ENO is reset to OFF.
Error information:
• If the input BCD data contains invalid data between 16#A and 16#F, the conversion result is 0. Also, the specific register
BCD Error Flag is set to ON.
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-19
xxx_BCD_TO_REAL
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input
Output — REAL — Output
xxx_BCD_TO_REAL
Input Output
Input Symbol
WORD WORD_BCD_TO_REAL
DWORD DWORD_BCD_TO_REAL
Function:
• The entered BCD data is converted to REAL data.
• Data between 16#A and 16#F is invalid in each digit of input data.
• The conversion range is shown below. The result is 0 if 16#A to 16#F is present in each digit.
Instruction Input Output BCD error
16#0 to 16#9999 0.0 to 9999.0 —
WORD_BCD_TO_REAL
Each digit input > 16#9 0.0 ON
16#0 to 16#99999999 0.0 to 100000000.0 —
DWORD_BCD_TO_REAL
Each digit input > 16#9 0.0 ON
Program example:
(1) Normal execution
SAMPLE1 WORD_BCD_TO_REAL SAMPLE2
16#1234 1234.0
LD ST
• Input data 16#1234 in variable SAMPLE1 is converted to REAL and the result 1234.0 is stored in variable SAMPLE2.
• Stores the result 0.0 in SAMPLE2 because the input data 16#1A39 in SAMPLE1 contains invalid data A.
Error information:
• If the input BCD data contains invalid data between 16#A and 16#F, the conversion result is 0. Also, the special register
BCD Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-20
xxx_BCD_TO_TIME
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input
Output — TIME — Output
xxx_BCD_TO_TIME
Input Output
Input Symbol
WORD WORD_BCD_TO_TIME
DWORD DWORD_BCD_TO_TIME
Function:
• The entered BCD data is converted to TIME data.
• Input data is converted as ms unit.
• Data between 16#A and 16#F is invalid in each digit of input data.
• The conversion range is shown below. The result is 0 if 16#A to 16#F is present in each digit.
Instruction Input Output BCD error
16#0 to 16#9999 T#0ms to T#9999ms —
WORD_BCD_TO_DINT
Each digit input > 16#9 T#0ms ON
16#0 to 16#99999999 T#0ms to T#99999999ms —
DOWRD_BCD_TO_DINT
Each digit input > 16#9 T#0ms ON
6F8C1226
10. Type Conversion 10-21
Program example:
(1) Normal execution
SAMPLE1 WORD_BCD_TO_TIME SAMPLE2
16#1234 T#1234ms
LD ST
• Input data 16#1234 in variable SAMPLE1 is converted to elapsed time and the result T#1234ms is stored in variable
SAMPLE2.
• Stores the result T#0ms in SAMPLE2 because the input data 16#1A39 in SAMPLE1 contains invalid data A.
Error information:
• If the input BCD data contains invalid data between 16#A and 16#F, the conversion result is 0. Also, the special register
BCD Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-22
TIME_TO_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — TIME √ Input
Output — See below — Output
TIME_TO_xxx
Input Output
Symbol Output
TIME_TO_INT INT
TIME_TO_DINT DINT
TIME_TO_UINT UINT
Function:
• The entered TIME data is converted to specified integer data.
• Converts with output in ms unit.
• The conversion range and limits are as follows:
Instruction Input Output Limit
-T#32768ms to T#32767ms -32768 to 32767 —
TIME_TO_INT Input < -T#32768ms -32768 √
Input > T#32767ms 32767 √
-T#2147483648ms -2147483648 to —
TIME_TO_DINT
to T#2147483647ms 2147483647
T#0ms to T#65535ms 0 to 65535 —
TIME_TO_UINT Input < T#0ms 0 √
Input > T#65535ms 65535 √
6F8C1226
10. Type Conversion 10-23
Program example:
(1) Normal execution
SAMPLE1 TIME_TO_INT SAMPLE2
−T#1234ms −1234
LD ST
• Converts input data -T#1234ms in SAMPLE1 to INT and stores the result -1234 in SAMPLE2.
• Stores the result -32768 in SAMPLE2 because input data -T#40000ms in SAMPLE1 exceeds the valid data range for INT.
Error information:
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-24
TIME_TO_REAL
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — TIME √ Input
Output — REAL — Output
Function:
• The entered TIME data is converted to REAL data.
• Converts with output in ms unit.
• TIME data between -T#16777215ms to T#16777215ms will be accurate when converted to REAL.
Program example:
SAMPLE1 TIME_TO_REAL SAMPLE2
T#1234ms 1234.0
LD ST
• Input data T#1234ms in variable SAMPLE1 is converted to REAL and the result 1234.0 is stored in variable SAMPLE2.
6F8C1226
10. Type Conversion 10-25
TIME_TO_BCD_ xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — TIME √ Input
Output — See below — Output
TIME_TO_BCD_xxx
Input Output
Symbol Output
TIME_TO_BCD_WORD WORD
TIME_TO_BCD_DWORD DWORD
Function:
• The entered TIME data is converted to BCD data.
• The conversion range and limits are shown below.
Instruction Input Output Limit BCD error
T#0ms to T#9999ms 16#0 to 16#9999 — —
TIME_TO_BCD_WORD Input < T#0ms 16#0 √ ON
Input > T#9999ms 16#9999 √ ON
T#0ms to T#99999999ms 16#0 to 16#99999999 — —
TIME_TO_BCD_DWORD Input < T#0ms 16#0 √ ON
Input > T#99999999ms 16#99999999 √ ON
6F8C1226
10. Type Conversion 10-26
Program example:
(1) Normal execution
• Converts input data T#1234ms in SAMPLE1 to BCD and stores the result 16#1234 in SAMPLE2.
• Stores the result 16#9999 in SAMPLE2 because input data T#12345ms in SAMPLE1 exceeds the valid range.
Error information:
• If the BCD data after conversion exceeds the valid range of the output data, the conversion result is limited by
16#0 or 16#9999 when WORD
16#0 or 16#99999999 when DWORD
Also, the special register BCD Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-27
TRUNC_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — REAL √ Input
Output — See below — Output
TRUNC_xxx Output
Input
Symbol Output
TRUNC_INT INT
TRUNC_DINT DINT
TRUNC_UINT UINT
Function:
• The entered REAL data is converted to fixed point integer data.
• Fractions are truncated.
2.6 → 2
-1.5 → -1
-2.4 → -2
• The range of integer data after conversion is as follows. If the conversion result exceeds this range, the limit of the output
data type is output.
INT conversion : -32768 to 32767
DINT conversion : -2147483648 to 2147483647
UNIT conversion : 0 to 65535
6F8C1226
10. Type Conversion 10-28
Program example:
(1) Normal execution
• Input data 4.567 in variable SAMPLE1 is converted to INT and the result 4 is stored in variable SAMPLE2.
• Input data 54321.0 in SAMPLE1 is converted to INT, but the result 32767 is stored in SAMPLE2 because the valid data
range of SAMPLE2 is exceeded.
Error information:
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• When input data type is REAL, if NAN data is entered as input, 0 is output as the result.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-29
NEG_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
NEG_xxx Output
Input
Function:
• The sign of the input data is negated and the result is output.
Program example:
(1) Normal execution
SAMPLE1 NEG_INT SAMPLE2
1234 −1234
LD ST
• The sign of the input data 1234 in SAMPLE1 is inverted and the result -1234 is stored in variable SAMPLE2.
• The sign of the input data -32768 in SAMPLE1 is inverted, but the result 32767 is stored in SAMPLE2 because the valid data
range of SAMPLE2 is exceeded.
Error information:
• If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is
output.
• When input data type is REAL, if NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-30
DEG_TO_RAD
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — REAL √ Input
Output — REAL — Output
Function:
• The entered angle data is converted to radian data.
Output = Angle · π / 180
Program example:
SAMPLE1 DEG_TO_RAD SAMPLE2
90.0 1.57079
LD ST
• The input data 90 in variable SAMPLE1 is converted to radian and the result 1.57079 is stored in variable SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-31
RAD_TO_DEG
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — REAL √ Input
Output — REAL — Output
Function:
• The entered radian data is converted to angle data.
Output = Radian data · 180 / π
Program example:
SAMPLE1 RAD_TO_DEG SAMPLE2
1.57079 90.0
LD ST
• The input data 1.57079 in variable SAMPLE1 is converted to angle and the result 90 is stored in variable SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-32
BIN_xxx_P
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
BIN_xxx_P Output
Input
Function:
• The entered BCD data is converted to INT data.
• The valid range of input data and the limit of output data are as follows. Input data between 16#A and 16#F are invalid.
BIN_INT_P : 16#0 to 16#9999 (When each digit > 9: Limit each digit to 9)
BIN_DINT_P : 16#0 to 16#99999999 (When each digit > 9: Limit each digit to 9)
Instruction Input Output Limit
Valid input : Each digit 16#0 to 16#9 0 to 9999 —
BIN_INT_P
Invalid input : Each digit > 16#9 Limit each digit: 9 √
Valid input : Each digit 16#0 to 16#9 0 to 99999999 —
BIN_DINT_P
Invalid input : Each digit > 16#9 Limit each digit: 9 √
• Invalid input data error can be detected by using a BIN Conversion instruction in the condition expression of an IF statement.
Valid input data : Executes statements after THEN.
Invalid input data : Executes statements after ELSE.
6F8C1226
10. Type Conversion 10-33
Program example:
(1) Normal execution
• The input data 16#1234 in SAMPLE1 is converted to BIN and the result 1234 is stored in SAMPLE2.
• Because the input data 16#1A39 in SAMPLE1 contains invalid data A, the result 1939 is stored in SAMPLE2. Also, the
condition expression of the IF statement is reset to OFF.
Error information:
• If the input BCD data contains invalid data between 16#A and 16#F, the abnormal digit is limited to 9.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-34
DT_TO_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — DT — Input
Output — See below — Output
DT_TO_xxx Output
Input
Symbol Output
DT_TO_TOD TOD
DT_TO_DATE DATE
Function:
• The entered DT data is converted to specified TOD data or DATE data.
Program Example:
(1) DT_TO_TOD
• The time of day data is extracted from input data DT#1999-8-24-17:34:56 in SAMPLE1 and the result TOD#17:34:56 is
stored in SAMPLE2.
(2) DT_TO_DATE
• The date data is extracted from input data DT#1999-8-24-17:34:56 in SAMPLE1 and the result DATE#1999-8-24 is stored
in SAMPLE2.
6F8C1226
10. Type Conversion 10-35
CONCAT_D_TOD
Input 1 Output
Diagram
Input 2
Arguments:
Arg. Operand Type Const. Description Remarks
— DATE √ Input 1 (Date data)
Input
— TOD √ Input 2 (Time of day data)
Output — DT — Output
Function:
• The date data Input 1 is concatenated with time of day data Input 2 and the result is output.
Program example:
SAMPLE1 CONCAT_D_TOD SAMPLE3
DATE#1999-8-24 DT#1999-8-24-17:34:56
LD ST
SAMPLE2
TOD#17:34:56
LD
• The date data DATE#1999-8-24 in SAMPLE1 is concatenated with time data TOD#17:34:56 in SAMPLE2 and the result
DT#1999-8-24-17:34:56 is stored in SAMPLE3.
6F8C1226
10. Type Conversion 10-36
ATOH_T
Source table TBL Destination table
Diagram
Table size N
Arguments:
Arg. Operand Type Const. Description Remarks
TBL PTR — Source table
Input
N UINT √ Table size 1 ≤ N ≤ 64
Output — PTR — Destination table
Function:
• The N word ASCII data starting at variable specified with source table TBL is converted to WORD and the result is stored in
destination table.
• Conversion is performed from low order byte of the source table and stored from the highest digit of the destination table.
• Valid ASCII data is “0”(16#30) to “9”(16#39) and “A”(16#41) to “F”(16#46).
• If the table size is odd, only the high order byte is updated in the final data of the destination table.
• Table size N is the size of the source table and may be between 1 and 64.
• If N=0, no conversion is performed.
• Direct I/O variable cannot be specified for source table or destination table. (S controller only)
Table
Table size Action Error Flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O * Not executed ON
6F8C1226
10. Type Conversion 10-37
Program example:
ARRAY1 ATOH_T ARRAY2
TBL
LD ST
SAMPLE2
9 N
LD
Source table (ASCII data) Destination table (WORD)
ARRAY1 ARRAY2
F 8 7 0 F 0
“1”(16#31) “0”(16#30) 16#0123
“3”(16#33) “2”(16#32) 16#4567
“5”(16#35) “4”(16#34) Conversion 16#89AB
“7”(16#37) “6”(16#36) 16#CDEF
9 words “9”(16#39) “8”(16#38) 16#01∗∗
“B”(16#42) “A”(16#41) Because N=9, only the high order byte is
“D”(16#44) “C”(16#43) updated for the final word of the destination
“F”(16#46) “E”(16#45) table. Low order byte is previous value.
“1”(16#31) “0”(16#30)
• The 9 words ASCII data starting at source table ARRAY1 is converted to WORD and the result is stored in variable
ARRAY2.
• Because the table size is odd, only the top byte of the destination table ARRAY2[4] is updated and the low order byte retains
the previous value.
Error information:
• If the conversion source data contains invalid data (ASCII code other than “0” to “9” and “A” to “F”), no conversion is
performed and the S register Error Flag is set to ON.
• If table size N exceeds 64, it is limited to N=64.
• ASCII to HEX conversion is not performed if direct I/O variables are specified for source table or destination table. Also, the
specific register Error Flag is set ON. (S controller only)
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-38
HTOA_T
Source table TBL Destination table
Diagram bl
Table size N
Arguments:
Arg. Operand Type Const. Description Remarks
TBL PTR — Source table
Input
N UINT √ Table size 1 ≤ N ≤ 32
Output — PTR — Destination table
Function:
• The N word WORD data starting at variable specified with source table TBL is converted to ASCII data and the result is
stored in destination table.
• Conversion is performed from top of the source table and stored from the low order byte of the destination table.
• Table size N is the size of the source table and may be between 1 and 32.
• If N=0, no conversion is performed.
• Direct I/O variable cannot be specified for source table or destination table. (S controller only)
Table
Table size Action Error Flag
specification
1 ≤ N ≤ 32 Executed —
Not direct I/O N=0 Not executed —
N > 32 Execute with N=32 as limit —
Direct I/O * Not executed ON
Program example:
Error information:
• If table size N exceeds 32, it is limited to N=32.
• HEX to ASCII conversion is not performed if direct I/O variables are specified for source table or destination table. Also, the
6F8C1226
10. Type Conversion 10-39
ASC_TO_REAL
Input string Output
Diagram
Converted N
characters
Arguments:
Arg. Operand Type Const. Description Remarks
— STRING — Input string
Input
N UINT √ Converted characters 1 ≤ N ≤ 64
Output — REAL — Output
Function:
• N characters from the beginning of the entered input string are converted to REAL.
• The input string may be expressed in numerical or exponential format.
Numerical format : 123.456
Exponential format : -123.456E+2
• The valid range of Converted characters is 1 ≤ N ≤ 64. If N=0, no conversion is performed.
• The following characters may be converted. However, spaces are valid only when they are at the beginning of the string. A
space character is also counted as one character.
+, -, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, E, e, .(period), (space)
• The entered character string is analyzed as follows:
.
e
SP + +
Number . Number E Number
- -
Program example:
(1) When the input string is specified in numerical format.
SAMPLE1 ASC_TO_REAL SAMPLE3
162.25 162.25
LD ST
SAMPLE2
6 N
LD
• 6 characters (specified by SAMPLE2) starting from the beginning of string “162.25” in SAMPLE1 are converted to REAL and
the result 162.25 is stored in SAMPLE3.
SAMPLE2
7 N
LD
6F8C1226
10. Type Conversion 10-41
• 7 characters (specified by SAMPLE2) starting from the beginning of string “12.5E-23” in SAMPLE1 are converted to REAL
and the result 0.125 is stored in SAMPLE3.
Error information:
• If there is a character code that cannot be converted within N characters from the beginning of the input string, 0 is output as
the result.
• When the number of input characters is greater than the Converted characters N, N is limited to the number of entered
characters.
• If the converted data exceeds the range of real data, 0 is output as the result.
• If Converted characters N exceeds 64, it is limited to N=64.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-42
REAL_TO_ASC
Input data Output
Decimal N
characters
Arguments:
Arg. Operand Type Const. Description Remarks
— REAL √ Input data
Input ≥ 0 : 0 ≤ SIZE ≤ 9
Input SIZE UINT √ Output characters
Input < 0 : 0 ≤ SIZE ≤ 10
N UINT √ Decimal characters 0≤N≤7
Output — REAL — Output
Function:
• The entered REAL data is converted to fixed point decimal string format specified by SIZE and N and the result is output.
• SIZE specifies the number of output characters including the decimal characters N and the valid range depends on whether
the input data is positive or negative.
Input data ≥ 0 :0 ≤ SIZE ≤ 9
Input data < 0 :0 ≤ SIZE ≤ 10
• N specifies the number of decimal characters in the output string and the valid range is 0 ≤ N ≤ 7.
Largest value that can be converted: ±9999999.0 (Positive: SIZE=9, N=1 specified, Negative: SIZE=10, N=1 specified)
Smallest value that can be converted: ±0.0000001 (Positive: SIZE=9, N=7 specified, Negative: SIZE=10, N=7 specified)
• If the converted result cannot be stored in the output string format specified by SIZE and N, an Error Flag in the specific
register is set to ON to indicate that characters are truncated.
• When SIZE=0, the result is NULL .
.
N
SIZE
6F8C1226
10. Type Conversion 10-43
Program example:
(1) Normal execution
SAMPLE1 REAL_TO_ASC SAMPLE4
162.25 162.2
LD ST
SAMPLE2
5 SIZE
LD
SAMPLE3
1 N
LD
• REAL data 162.25 in SAMPLE1 is converted to string using Output characters 5 in SAMPLE2 and Decimal characters 1 in
SAMPLE3 and the result “162.2” is stored in SAMPLE4.
SAMPLE2
5 SIZE
LD
SAMPLE3
2 N
LD
• REAL data -12.345 in SAMPLE1 is converted to string using Output characters 5 in SAMPLE2 and Decimal characters 2 in
SAMPLE3 and the result “-12.3” is stored in SAMPLE4. The Error Flag in specific register is set to ON to indicate that
characters are truncated.
Error information:
• If the converted result cannot be stored within SIZE, an Error Flag in the specific register is set to ON to indicate that
characters are truncated.
• No conversion is performed when SIZE is greater than the defined string size.
• If input data is NAN, no conversion is performed.
• If SIZE and N specifying the output string format exceed the valid range, they are limited by the maximum valid value.
• When |input data| > 9999999, input data is limited to ±9999999.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-44
ASCDEC_TO_DINT
Conversion table TBL Output
Diagram
Table size N
Arguments:
Arg. Operand Type Const. Description Remarks
TBL PTR — Conversion table
Input
N UINT √ Table size 1 ≤ N ≤ 64
Output — DINT — Output
Function:
• From conversion table TBL consisting of decimal ASCII data (including end code CR), the number of words specified by
table size N are converted to DINT and the result is output.
• Valid ASCII data are ”0”(16#30) to “9”(16#39), “-“(16#2D), “+”(16#2B) and CR(16#0D).
• The content of the conversion table that is subject to conversion starts with a number, “+” or “-“ and ends with end code CR.
• Table size N is from 1 to 64. When N=0, the result is output as 0.
• The range of data to be converted is from -2147483648 to 2147483647.
• The data format of the conversion table is as follows:
(1)”12345678” (2)”–876543210” (3)”+135792468”
0 “2”(16#32) “1”(16#31) 0 “8”(16#38) “-”(16#2D) 0 “1”(16#31) “+”(16#2B)
1 “4”(16#34) “3”(16#33) 1 “6”(16#36) “7”(16#37) 1 “5”(16#35) “3”(16#33)
2 “6”(16#36) “5”(16#35) 2 “4”(16#34) “5”(16#35) 2 “9”(16#39) “7”(16#37)
3 “8”(16#38) “7”(16#37) 3 “2”(16#32) “3”(16#33) 3 “4”(16#34) “2”(16#32)
4 * CR(16#0D) 4 “0”(16#30) “1”(16#31) 4 “8”(16#38) “6”(16#36)
5 * * 5 * CR(16#0D) 5 * CR(16#0D)
• Direct I/O variables cannot be specified for conversion table. (S controller only)
Table
Table word count Action Error Flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 0 output —
N > 64 Execute with N=64 as limit —
Direct I/O ∗ Not executed ON
6F8C1226
10. Type Conversion 10-45
Program example:
(1) Normal execution
ASCDEC_TO_DINT TBL1 structure
TBL1 SAMPLE2 0 “1” (16#31) “-“ (16#2D)
TBL -1234
LD ST 1 “3” (16#33) “2” (16#32)
SAMPLE1 2 CR(16#0D) “4” (16#34)
3 N
LD
• Starting with conversion table TBL1, the 3 words ASCII data specified by SAMPLE1 is converted to DINT and the result
-1234 is stored in variable SAMPLE2.
• Because no CR code is detected when converting the 3 words ASCII data specified by SAMPLE1 starting with conversion
TBL1 to DINT, the result 0 is stored in variable SAMPLE2 and the special register Error Flag is set to ON.
Error information:
• If an ASCII code other than the specified character is present before the CR code, if “+“ or “-“ is present anywhere other than
the beginning of data, or if the CR code is not present, the result is 0 and the special register Error Flag is set to ON.
• If the conversion result exceeds the maximum value of DINT type, the limit value is output. Also, the special register Error
Flag is set to ON.
• If table size exceeds 64, it is limited to N=64.
• When direct I/O variable is specified as conversion table, no operation is performed. Also, the special register Error Flag is
set to ON. (S controller only)
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-46
ASCHEX_TO_DINT
Conversion table TBL Output
Diagram
Table size N
Arguments:
Arg. Operand Type Const. Description Remarks
TBL PTR — Conversion table
Input
N UINT √ Table size 1 ≤ N ≤ 64
Output — DINT — Output
Function:
• From conversion table TBL consisting of hexadecimal ASCII data (including end code CR), the numbers of words specified
by table size N are converted to DINT and the result is output.
• Valid ASCII data are as follows:
“0” (16#30) to “9” (16#39), “A”(16#41) to “F”(16#46), “a”(16#61) to “f”(16#66), CR(16#0D)
• The content of the conversion table that is subject to conversion starts with a number, “A” to “F”, or “a” to “f” and ends with
end code CR.
• Table size N is from 1 to 64. When N=0, the result is output as 0.
• The data to be converted is from 0 to FFFFFFFF.
• The data format of the conversion table is as follows:
(1) “12345678” (2) “ABCDef01”
0 “2” (16#32) “1” (16#31) 0 “B” (16#42) “A” (16#41)
1 “4” (16#34) “3” (16#33) 1 “D” (16#44) “C” (16#43)
2 “6” (16#36) “5” (16#35) 2 “f” (16#66) “e” (16#65)
3 “8” (16#38) “7” (16#37) 3 “1” (16#31) “0” (16#30)
4 * CR (16#0D) 4 * CR (16#0D)
5 * * 5 * *
• Direct I/O variables cannot be specified for conversion table. (S controller only)
Table
Table word count Action Error Flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 0 output —
N > 64 Execute with N=64 as limit —
Direct I/O ∗ Not executed ON
6F8C1226
10. Type Conversion 10-47
Program example:
(1) Normal execution
ASCHEX_TO_DINT TBL1 structure
TBL1 SAMPLE2 0 "A" (16#41) "1" (16#31)
TBL 109364
LD ST 1 "3" (16#33) "B" (16#42)
SAMPLE1 2 CR(16#0D) "4" (16#34)
3 N
LD
• Starting with conversion table TBL1, the 3 words ASCII data specified by SAMPLE1 is converted to DINT and the result
109364 is stored in variable SAMPLE2.
• Because no CR code is detected when converting the 3 words ASCII data specified by SAMPLE1 starting with conversion
TBL1 to DINT, the result 0 is stored in variable SAMPLE2 and the special register Error Flag is set to ON.
Error information:
• If an ASCII code other than the specified character is present before the CR code or if the CR code is not present, the result
is 0 and the special register Error Flag is set to ON.
• If the conversion result exceeds the maximum value of DINT type, the limit value is output. Also, the special register Error
Flag is set to ON.
• If table size exceeds 64, it is limited to N=64.
• When direct I/O variable is specified as conversion table, no operation is performed. Also, the special register Error Flag is
set to ON. (S controller only)
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-48
DINT_TO_ASCDEC
Conversion data IN Store destination
Diagram table
Table size N
Arguments:
Arg. Operand Type Const. Description Remarks
IN DINT — Conversion data
Input
N UINT √ Table size 1 ≤ N ≤ 64
Output — PTR — Store destination table
Function:
• Conversion data IN is converted to decimal ASCII data and the result is output with end code CR appended at the end of
converted ASCII data. Also, the number of converted character codes is output to index register XL. (XL contains the
number of character codes including the end code CR.)
• Table size N is from 1 to 64. No operation is performed when N=0.
• The range of data to be converted is from -2147483648 to 2147483647.
• The data format of the storage destination table is as follows:
(1) 1234567890 (2) –876543210
0 “2”(16#32) “1”(16#31) 0 “8”(16#38) “-“(16#2D)
1 “4”(16#34) “3”(16#33) 1 “6”(16#36) “7”(16#37)
2 “6”(16#36) “5”(16#35) 2 “4”(16#34) “5”(16#35)
3 “8”(16#38) “7”(16#37) 3 “2”(16#32) “3”(16#33)
4 “0”(16#30) “9”(16#39) 4 “0”(16#30) “1”(16#31)
5 * CR(16#0D) 5 * CR(16#0D)
• I/O variable cannot be specified directly for storage destination table. (S controller only)
Table
Table word count Action Error flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O ∗ Not executed ON
6F8C1226
10. Type Conversion 10-49
Program example:
(1) Normal execution
DINT_TO_ASCDEC TBL1 structure
SAMPLE1 TBL1 0 "1" (16#31) "-" (16#2D)
-1234 IN
LD ST 1 "3" (16#33) "2" (16#32)
SAMPLE2 2 CR(16#0D) "4" (16#34)
3 N
LD
• Content -1234 of conversion table SAMPLE1 is converted to ASCII (decimal) and the result is stored in a 3 words area
specified by SAMPLE2 starting from storage destination table TBL1. The number of characters 6 is stored in index register
XL.
• Because the content of conversion data SAMPLE1 cannot be converted to ASCII (decimal) and stored in 3 words area
specified by SAMPLE2 and starting with storage destination table TBL1 (4 words are required), the contents of storage
destination table TBL1 and index register XL are unchanged. Also, the special register Error Flag is set to ON.
Error information:
• If the conversion result cannot be stored in area of with number of words specified by N, the result is not updated and the
special register Error Flag is set to ON.
• If table size exceeds 64, it is limited to N=64.
• When direct I/O variable is specified as storage destination table, no operation is performed. Also, the special register Error
Flag is set to ON. (S controller only)
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-50
DINT_TO_ASCHEX
Conversion data IN Storage
Diagram destination table
Table size N
Arguments:
Arg. Operand Type Const. Description Remarks
IN DINT — Conversion data
Input
N UINT √ Table size 1 ≤ N ≤ 64
Output — PTR — Storage destination table
Function:
• Conversion data IN is converted to hexadecimal ASCII data and the result is output with end code CR appended at the end
of converted ASCII data. Also, the number of converted character codes is output to index register XL. (XL contains the
number of character codes including the end code CR.)
• Table size N is from 1 to 64. No operation is performed when N=0.
• The range of data to be converted is from -2147483648 to 2147483647.
• The data format of the storage destination table is as follows:
(1) 305419896 (2) –876543210
0 “2”(16#32) “1”(16#31) 0 “A”(16#41) “F”(16#46)
1 “4”(16#34) “3”(16#33) 1 “6”(16#36) “C”(16#43)
2 “6”(16#36) “5”(16#35) 2 “0”(16#30) “8”(16#38)
3 “8”(16#38) “7”(16#37) 3 “F”(16#46) “4”(16#34)
4 0 CR(16#0D) 4 0 CR(16#0D)
5 * * 5 * *
• I/O variable cannot be specified directly for storage destination table. (S controller only)
Table specification Table word count Action Error flag
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O ∗ Not executed ON
6F8C1226
10. Type Conversion 10-51
Program example:
(1) Normal execution
DINT_TO_ASCHEX TBL1 structure
SAMPLE1 TBL1 0 “1”(16#31) “5”(16#35)
332340 IN
LD ST 1 “3”(16#33) “2”(16#32)
SAMPLE2 2 CR(16#0D) “4”(16#34)
3 N
LD
• Content 332340 of conversion table SAMPLE1 is converted to ASCII (hexadecimal) and the result is stored in a 3 words
area specified by SAMPLE2 starting from storage destination table TBL1. The number of characters 6 is stored in index
register XL.
• Because the content of conversion data SAMPLE1 cannot be converted to ASCII (hexadecimal) and stored in 2 words area
specified by SAMPLE2 and starting with storage destination table TBL1 (3 words are required), the contents of storage
destination table TBL1 and index register XL are unchanged. Also, the special register Error Flag is set to ON.
Error information:
• If the conversion result cannot be stored in area of with number of words specified by N, the result is not updated and the
special register Error Flag is set to ON.
• If table size exceeds 64, it is limited to N=64.
• When direct I/O variable is specified as storage destination table, no operation is performed. Also, the special register Error
Flag is set to ON. (S controller only)
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-52
ARRAY_TO_STRING
Array data IN Storage
Diagram destination string
Table size N variable
Arguments:
Arg. Operand Type Const. Description Remarks
IN PTR — Array data
Input
N UINT √ Table size 1 ≤ N ≤ 129
Storage destination string
Output — STRING —
variable
Function:
• An N word shift JIS character code starting from input array data IN is output as STRING.
• The data to be converted is N words starting from IN and ends with CR code (16#0D).
• The table size N indicates the conversion size of the array data. No operation is performed when N=0.
• The range of table size N is from 1 to 129 (up to 256 bytes + CR code).
• The data formats of the conversion source and destination table are as follows:
(1)12345678 (2)–87654321
0 “2”(16#32) “1”(16#31) 0 “8”(16#38) “-”(16#2D) <Conversion source>
1 “4”(16#34) “3”(16#33) 1 “6”(16#36) “7”(16#37)
2 “6”(16#36) “5”(16#35) 2 “4”(16#34) “5”(16#35)
3 “8”(16#38) “7”(16#37) 3 “2”(16#32) “3”(16#33)
4 * CR(16#0D) 4 CR(16#0D) “1”(16#31)
5 * * 5 * *
N=5 N=5
<Conversion destination>
0 VAR length=6 0 VAR length=6 ←Character code storage area word count as STRING[12]
1 STRING length=8 1 STRING length=9 ←Number of bytes up to CR code
2 “2”(16#32) “1”(16#31) 2 “8”(16#38) “-”(16#2D)
Example:
3 “4”(16#34) “3”(16#33) 3 “6”(16#36) “7”(16#37) When character string is declared
4 “6”(16#36) “5”(16#35) 4 “4”(16#34) “5”(16#35) as follows:
Stored
5 “8”(16#38) “7”(16#37) 5 “2”(16#32) “3”(16#33) character codes Variable Data type Dec.
6 * * 6 * “1”(16#31) A STRING[12] VAR
7 * * 7 * *
• Direct I/O variable cannot be specified for input array and storage destination string. (S controller only)
Table
Table word count Action Error flag
specification
1 ≤ N ≤ 129 Executed —
Not direct I/O N=0 Not executed —
N > 129 Execute with N=129 as limit —
Direct I/O ∗ Not executed ON
6F8C1226
10. Type Conversion 10-53
Program example:
• Starting with conversion source array data TBL1, 3 words array data specified by variable SAMPLE1 is stored in STRING
variable SAMPLE2. The data up to the end code CR in the conversion source are converted.
Error information:
• If the conversion source data cannot be stored in the storage destination STRING variable (INT((number of character codes
up to CR+1)/2) > VAR length), the result is unchanged.
• If there is no CR code in the N word array starting with the conversion source data, the result is unchanged. (Data format
error)
• If the array data contains invalid 2 byte character code, it is replaced with ?? in the result.
• If N > 129, the operation is limited to N=129.
• When direct I/O variable is specified as conversion source array and output string, no operation is performed. Also, the
special register Error Flag is set to ON. (S controller only)
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-54
STRING_TO_ARRAY
Input string IN Storage
destination array
Diagram Converted L
characters
Start of converted P
characters
Arguments:
Arg. Operand Type Const. Description Remarks
IN STRING — Input string
Input L UINT √ Converted characters
P UINT √ Start of converted characters
Output — PTR — Storage destination array
Function:
• L character codes from the P character of the input string IN are stored in the specified array.
• CR code (16#0D) is appended at the end of the converted character code.
• No operation is performed when L=0.
• The data formats of the input string and destination are as follows:
(1) “12345678” (2) “–87654321” <Input string>
0 VAR length=6 0 VAR length=6 ←Character code storage area words as STRING[12]
1 STRING length=8 1 STRING length=9 ←Stored character bytes
2 “2”(16#32) “1”(16#31) 2 “8”(16#38) “-”(16#2D)
Example:
3 “4”(16#34) “3”(16#33) 3 “6”(16#36) “7”(16#37)
When string variable is declared as
4 “6”(16#36) “5”(16#35) 4 “4”(16#34) “5”(16#35) follows:
Stored
5 “8”(16#38) “7”(16#37) 5 “2”(16#32) “3”(16#33) Variable Data type Dec.
character code
6 * * 6 * “1”(16#31) A STRING[12] VAR
7 * * 7 * *
When L=4,P=2 When L=5,P=3
• Direct I/O variable cannot be specified for input string and storage destination array. (S controller only)
6F8C1226
10. Type Conversion 10-55
Program example:
STRING_TO_ARRAY SAMPLE1 structure
SAMPLE1 TBL1 0 VAR length=6
IN 1 STRING length=5
LD ST
2 "1" (16#31) "5" (16#35)
SAMPLE2
3 "3" (16#33) "2" (16#32)
3 L
LD 4 * "4" (16#34)
SAMPLE3 5 * *
2 P 6 * *
LD 7 * *
• In the conversion source input string SAMPLE1, 3 characters specified by variable SAMPLE2 from conversion character
start position 2 specified by variable SAMPLE3 are output to storage destination array TBL1 with end code CR appended.
Error information:
• When the conversion character position P=0, L characters from the beginning are stored in the array.
• When conversion character position P > storage character count, only CR code is stored in the array.
• When direct I/O variable is specified as input string and storage destination table, no operation is performed. Also, the
special register Error Flag is set to ON. (S controller only)
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
10. Type Conversion 10-56
Arguments:
Function:
• The variable specified with tag variable TAG is converted to an array number within the type specified with tag type TYPE,
and the result is output.
• The range of the tag type is from 0 to 3 (from 0 to 2 for the MCS type tag controller (model1000) because SQ is not included).
• I/O variable cannot be specified directly for tag variable.
• Array type notation (e.g. PV_PARA[0]) and Tag No. notation (e.g. FIC101) can be specified for tag variable.
• This instruction is useful when processing using tags is made common (user FB) and tag variables are switched. For details,
refer to "Program example."
Note:
• For the DS type tag controller, tag numbers of PV and LP are different, so no extension is required (e.g. FIC101. TAG). For
the MCS type tag controller (model 1000), tag numbers of PV and LP are common, so Tag No. notation without extension
(e.g. FIC101) is not interpreted correctly. Therefore, specify tag numbers with extension (e.g. FIC101.PVP and FIC101.ALP
for LP, FIC101.TAG for PV).
6F8C1226
10. Type Conversion 10-57
Program example:
[LD/FBD language notation]
TAG_FB_2 (IND02.TAG);
PV2 := TAG_FB_2.OUT;
• The user function block (TAG_FB) that has tag No. (TAG) as an input argument is executed twice.
• If IND01.TAG is specified, XI=0 in TAG_FB. If IND02.TAG is specified, XI=1. The specified tag variable is accessed in
each case.
Error information:
• If anything other than 0 to 3 (0 to 2 for the MCS type tag controller (model1000)) is specified for tag type TYPE, or if tag
variable TAG is out of range, a table operation error occurs and the result output is "-1".
• When I/O variable is specified directly for tag variable, the operation is as follows.
Controller Action
Integrated
S controller Table operation error flag is set to ON, and Result = -1.
Controller V series
Unified Controller nv series Error flag and table operation error flag are set to ON, and Result = -1.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-1
11 Numeric Function
SQRT
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The square root of the input REAL data is obtained and the result is output.
Program example:
SAMPLE1 SQRT SAMPLE2
3.0 1.732051
LD ST
• The square root of the input data 3 in SAMPLE1 is obtained and the result 1.732051 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-3
EXP
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The exponential of the input REAL data is obtained and the result is output.
1
Input data
0 88.7228
Program example:
SAMPLE1 EXP SAMPLE2
3.0 20.08553
LD ST
• The exponential of the input data 3 in SAMPLE1 is obtained and the result 20.08553 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• If the operation result overflows, the result is infinity.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-4
LOG
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The common logarithm of the input REAL data is obtained and the result is output.
• If the input data is 0, the result is 0.
Input data
-3.40282E+38 3.40282E+38
0
Program example:
SAMPLE1 LOG SAMPLE2
3.0 0.4771213
LD ST
• The common logarithm of the input data 3 in SAMPLE1 is obtained and the result 0.4771213 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-5
LN
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The natural logarithm of the input REAL data is obtained and the result is output.
• If the input data is 0, the result is 0.
Output = ln ( | input | )
Result output
88.7228
Input data
-3.40282E+38 3.40282E+38
0
Program example:
SAMPLE1 LN SAMPLE2
3.0 1.098612
LD ST
• The natural logarithm of the input data 3 in SAMPLE1 is obtained and the result 1.098612 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-6
ABS_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description
Input — √ Input
See below
Output — — Output
ABS_xxx
Input Output
Function:
• The absolute value of the input data is obtained and the result is output.
• For INT data, the absolute value of the maximum negative value is the maximum positive value.
Input data Result output
ABS_INT -32768 32767
ABS_DINT -2147483648 2147483647
Program example:
SAMPLE1 ABS_INT SAMPLE2
-1234 1234
LD ST
• The absolute value of the input data -1234 in SAMPLE1 is obtained and the result 1234 is stored in SAMPLE2.
Error information:
• When data type is REAL, if NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-7
SIN
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The sine of the input REAL data is obtained and the result is output.
• The input data must be in radians.
Input data
-4π -3π -2π -π 0 π 2π 3π 4π
-1.0
Program example:
SAMPLE1 SIN SAMPLE2
1.47198 0.8660254
LD ST
• The sine of the input data 1.47198 in SAMPLE1 is obtained and the result 0.8660254 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-8
COS
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The cosine of the input REAL data is obtained and the result is output.
• The input data must be in radians.
Input data
0
-4π -3π -2π -π π 2π 3π 4π
-1.0
Program example:
SAMPLE1 COS SAMPLE2
1.047198 0.5
LD ST
• The cosine of the input data 1.047198 in SAMPLE1 is obtained and the result 0.5 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-9
TAN
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The tangent of the input REAL data is obtained and the result is output.
• The input data must be in radians.
Input data
-4π -3π -2π -π 0 π 2π 3π 4π
-Infinity
Program example:
SAMPLE1 TAN SAMPLE2
1.047198 1.732051
LD ST
• The tangent of the input data 1.047198 in SAMPLE1 is obtained and the result 1.732051 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-10
ASIN
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The arcsine of the input REAL data is obtained and the result is output. The output data is in radians.
• Input data must be between -1.000000 and +1.000000.
• If Input data > 1.000000, Input data is assumed to be 1.000000.
• If Input data < -1.000000, Input data is assumed to be -1.000000.
1.0
-0.5
Input data
-2.0 -1.5 -1.0 0 0.5 1.0 1.5 2.0
-1.0
-2.0
Program example:
SAMPLE1 ASIN SAMPLE2
0.5 0.5235988
LD ST
• The arcsine of the input data 0.5 in SAMPLE1 is obtained and the result 0.5235988 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-11
ACOS
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The arccosine of the input REAL data is obtained and the result is output.
• The output data is in radians.
• Input data must be between -1.000000 and +1.000000.
• If Input data > 1.000000, Input data is assumed to be 1.000000.
• If Input data < -1.000000, Input data is assumed to be -1.000000.
3.0
2.0
1.0
Input data
-2.0 -1.5 -1.0 -0.5 0 0.5 1.0 1.5 2.0
Program example:
SAMPLE1 ACOS SAMPLE2
0.5 1.047198
LD ST
• The arccosine of the input data 0.5 in SAMPLE1 is obtained and the result 1.047198 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
11. Numeric Function 11-12
ATAN
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description
Input — REAL √ Input
Output — REAL — Output
Function:
• The arctangent of the input REAL data is obtained and the result is output.
• The output data is in radians.
1.0
Input data
0
-1.0
-2.0
Program example:
SAMPLE1 ATAN SAMPLE2
0.5 0.4636476
LD ST
• The arctangent of the input data 0.5 in SAMPLE1 is obtained and the result 0.4636476 is stored in SAMPLE2.
Error information:
• If NAN data is entered as input, the result is NAN.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
12. Logical Operation 12-1
12 Logical Operation
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
• The Bitwise Boolean AND of input data Input 1 to Input n is obtained and the result is output.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Program example:
SAMPLE1 AND_WORD SAMPLE5
16#79AF 16#1084 15 0
LD ST SAMPLE1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1
SAMPLE2
16#9584 SAMPLE2 1 0 0 1 0 1 0 1 1 0 0 0 0 1 0 0
LD SAMPLE3 0 0 0 1 0 0 1 1 1 1 1 0 0 1 1 0
SAMPLE3
16#13E6 SAMPLE4 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 1
LD
SAMPLE5 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0
SAMPLE4
16#F2E7
LD
• The Bitwise Boolean AND of input data in SAMPLE1 to SAMPLE4 is obtained and the result 16#1084 is stored in SAMPLE5.
6F8C1226
12. Logical Operation 12-3
TAND
Input table 1 TBL1 Output table
Arguments:
Arg. Operand Type Const. Description Remarks
TBL1 PTR — Input table 1
Input TBL2 PTR — Input table 2
N UINT √ Table word number 1 ≤ N ≤ 64
Output — PTR — Output table
Function:
• The Bitwise Boolean AND of N word data starting from Input table 1 and Input table 2 is obtained and the result is stored in
the specified output table.
• Table word number N must be between 1 and 64.
• If table word number N is 0, no operation is performed.
• Direct I/O variable cannot be specified for input table or output table.
Table
Table word number Action Error flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O * Not executed ON
Program example:
TABLE1 TAND TABLE3 TABLE1 TABLE2 TABLE3
TBL1
LD ST 0 16#F035 0 16#236B 0 16#2021
TABLE2 1 16#00FF 1 16#AAAA 1 16#00AA
TBL2 2 16#5555 2 16#0F0F 2 16#0505
LD
3
N
LD
• The Bitwise Boolean AND of 3 words data starting from input tables TABLE1 and TABLE2 is obtained and the result is
stored in output table TABLE3.
Error information:
• If N exceeds 64, it is limited to N=64.
• If there is an area error due to index modification, no operation is performed.
• If direct I/O variables are specified for input table and output table, no operation is performed and Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
12. Logical Operation 12-4
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
• The Bitwise Boolean OR of input data Input 1 to Input n is obtained and the result is output.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Program example:
SAMPLE1 OR_WORD SAMPLE5
16#1234 16#BF77 15 0
LD ST SAMPLE1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
SAMPLE2
16#9876 SAMPLE2 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0
LD SAMPLE3 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1
SAMPLE3
16#2345 SAMPLE4 1 0 0 0 0 1 1 1 0 1 1 0 0 1 0 1
LD
SAMPLE5 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1
SAMPLE4
16#8765
LD
• The Bitwise Boolean OR of input data in SAMPLE1 to SAMPLE4 is obtained and the result 16#BF77 is stored in SAMPLE5.
6F8C1226
12. Logical Operation 12-5
TOR
Input table 1 TBL1 Output table
Arguments:
Arg. Operand Type Const. Description Remarks
TBL1 PTR — Input table 1
Input TBL2 PTR — Input table 2
N UINT √ Table word number 1 ≤ N ≤ 64
Output — PTR — Output table
Function:
• The Bitwise Boolean OR of N word data starting from Input table 1 and Input table 2 is obtained and the result is stored in the
specified output table.
• Table word number N must be between 1 and 64.
• If table word number N is 0, no operation is performed.
• Direct I/O variable cannot be specified for input table or output table.
Table
Table word number Action Error flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O * Not executed ON
Program example:
TABLE1 TOR TABLE3 TABLE1 TABLE2 TABLE3
TBL1
LD ST 0 16#F035 + 0 16#236B 0 16#F37F
TABLE2 1 16#00FF + 1 16#AAAA 1 16#AAFF
TBL2 2 16#5555 + 2 16#0F0F 2 16#5F5F
LD
3
N
LD
• The Bitwise Boolean OR of 3 words data starting from input tables TABLE1 and TABLE2 is obtained and the result is stored
in output table TABLE3.
Error information:
• If N exceeds 64, it is limited to N=64.
• If there is an area error due to index modification, no operation is performed.
• If direct I/O variables are specified for input table and output table, no operation is performed and Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
12. Logical Operation 12-6
NOT_xxx
Diagram Input Output
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input
See below
Output — — Output
Function:
• The Bitwise Boolean NOT of input data is obtained and the result is output.
Program example:
SAMPLE1 NOT_WORD SAMPLE2
16#1234 16#EDCB
LD ST
• The Bitwise Boolean NOT of input data 16#1234 in SAMPLE1 is obtained and the result 16#EDCB is stored in SAMPLE2.
6F8C1226
12. Logical Operation 12-7
TNOT
Input table TBL Output table
Diagram
Table word number N
Arguments:
Arg. Operand Type Const. Description Remarks
TBL PTR — Input table
Input
N UINT √ Table word number 1 ≤ N ≤ 1024
Output — PTR — Output table
Function:
• The Bitwise Boolean NOT of N word data starting from the input table is obtained and the result is stored in the specified
output table.
• Table word number N must be between 1 and 1024.
• If table word number N is 0, no operation is performed.
• Direct I/O variable cannot be specified for input table or output table.
Table
Table word number Action Error flag
specification
1 ≤ N ≤ 1024 Executed —
Not direct I/O N=0 Not executed —
N > 1024 Executed with N=1024 as limit —
Direct I/O * Not executed ON
Program example:
TABLE1 TNOT TABLE2 TABLE1 TABLE2
TBL
LD ST 0 16#F035 0 16#0FCA
3 1 16#00FF 1 16#FF00
N 2 16#5555 2 16#AAAA
LD
• The Bitwise Boolean NOT of 3 words data starting from input table TABLE1 is obtained and the result is stored in output
table TABLE2.
Error information:
• If N exceeds 1024, it is limited to N=1024.
• If there is an area error due to index modification, no operation is performed.
• If direct I/O variables are specified for input table and output table, no operation is performed and Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
12. Logical Operation 12-8
Input n
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
• The Bitwise Boolean XOR of input data Input 1 to Input n is obtained and the result is output.
• Up to 15 input data are allowed.
• Input 1 to n must have the same data type.
Program example:
SAMPLE1 XOR_WORD SAMPLE5
16#1234 16#2E62 15 0
LD ST SAMPLE1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
SAMPLE2
16#9876 SAMPLE2 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0
LD SAMPLE3 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1
SAMPLE3
16#2345 SAMPLE4 1 0 0 0 0 1 1 1 0 1 1 0 0 1 0 1
LD
SAMPLE5 0 0 1 0 1 1 1 0 0 1 1 0 0 0 1 0
SAMPLE4
16#8765
LD
• The Bitwise Boolean XOR of input data in SAMPLE1 to SAMPLE4 is obtained and the result 16#2E62 is stored in
SAMPLE5.
6F8C1226
12. Logical Operation 12-9
Arguments:
Arg. Operand Type Const. Description Remarks
TBL1 PTR — Input table 1
Input TBL2 PTR — Input table 2
N UINT √ Table word number 1 ≤ N ≤ 64
Output — PTR — Output table
Function:
• The Bitwise Boolean XOR of N word data starting from Input table 1 and Input table 2 is obtained and the result is stored in
the specified output table.
• Table word number N must be between 1 and 64.
• If table word number N is 0, no operation is performed.
• Direct I/O variable cannot be specified for input table or output table.
Table
Table word number Action Error flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O * Not executed ON
Program example:
TABLE1 TXOR TABLE3 TABLE1 TABLE2 TABLE3
TBL1
LD ST 0 16#F035 ⊕ 0 16#236B 0 16#D35E
TABLE2 1 16#00FF ⊕ 1 16#AAAA 1 16#AA55
TBL2 2 16#5555 ⊕ 2 16#0F0F 2 16#5A5A
LD
3
N
LD
• The Bitwise Boolean XOR of 3 words data starting from Input table TABLE1 and TABLE2 is obtained and the result is stored
in output table TABLE3.
Error information:
• If N exceeds 64, it is limited to N=64.
• If there is an area error due to index modification, no operation is performed.
• If direct I/O variables are specified for input table and output table, no operation is performed and Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
12. Logical Operation 12-10
TXNR
Input table 1 TBL1 Output table
Arguments:
Arg. Operand Type Const. Description Remarks
TBL1 PTR — Input table 1
Input TBL2 PTR — Input table 2
N UINT √ Table word number 1 ≤ N ≤ 64
Output — PTR — Output table
Function:
• The Bitwise Boolean NOT XOR of N word data starting from Input table 1 and Input table 2 is obtained and the result is
stored in the specified output table.
• Table word number N must be between 1 and 64.
• If table word number N is 0, no operation is performed.
• Direct I/O variable cannot be specified for input table or output table.
Table
Table word number Action Error flag
specification
1 ≤ N ≤ 64 Executed —
Not direct I/O N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O * Not executed ON
Program example:
TABLE1 TXNR TABLE3 TABLE1 TABLE2 TABLE3
TBL1
LD ST 0 16#F035 ⊕ 0 16#236B 0 16#2CA1
TABLE2 1 16#00FF ⊕ 1 16#AAAA 1 16#55AA
TBL2 2 16#5555 ⊕ 2 16#0F0F 2 16#A5A5
LD
3
N
LD
• The Bitwise Boolean NOT XOR of 3 words data starting from Input table TABLE1 and TABLE2 is obtained and the result is
stored in output table TABLE3.
Error information:
• If N exceeds 64, it is limited to N=64.
• If there is an area error due to index modification, no operation is performed.
• If direct I/O variables are specified for input table and output table, no operation is performed and Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
12. Logical Operation 12-11
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1,2 Input number=2
See below
Output — — Output
Input 2
Function:
• The Bitwise Boolean AND of input data Input 1 and Input 2 is obtained and OFF is output if the result is 0 and ON is output if
otherwise.
• Input 1 and Input 2 must have the same data type.
Program example:
SAMPLE1 TEST_WORD SIGNAL1
16#1234 1
LD ST
SAMPLE2
16#98C3
LD
• Input data SAMPLE1 and SAMPLE2 are tested and the result ON is output to SIGNAL1.
6F8C1226
13. Bit Operation 13-1
13 Bit Operation
SHR_xxx
Input IN Output
Diagram
Shift number N
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
IN See below √ Input
Input
N UINT √ Shift number
Output — See below — Output
SHR_xxx
Input IN Output
Shift number N
Function:
• Right shifts the input data by shift number N and outputs the result.
• Empty bits after shifting are padded with 0.
• The bit that is shifted out last is input to the specific register Carry Flag.
• The shift number N is as follows. The data is not shifted when shift number N=0.
Symbol Shift number
SHR_WORD MOD(N/16)
SHR_DWORD MOD(N/32)
Program example:
SAMPLE1 SHR_WORD SAMPLE3 F E D C B A 9 8 7 6 5 4 3 2 1 0
16#9876 IN 16#261D SAMPLE1
LD 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0
ST
SAMPLE2
18 N
LD F E D C B A 9 8 7 6 5 4 3 2 1 0 CF
SAMPLE3
0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1
0 is entered.
• Right shifts the input data 16#9876 in SAMPLE1 by shift number (=MOD(18/16)) specified by variable SAMPLE2 and stores
the result 16#261D in SAMPLE3. The bit data ON shifted out last is stored in specific register Carry Flag.
6F8C1226
13. Bit Operation 13-3
SHL_xxx
Input IN Output
Diagram
Shift number N
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
IN See below √ Input
Input
N UINT √ Shift number
Output — See below — Output
SHL_xxx
Input IN Output
Shift number N
Function:
• Left shifts the input data by shift number N and outputs the result.
• Empty bits after shifting are padded with 0.
• The bit that is shifted out last is input to the specific register Carry Flag.
• The shift number N is as follows. The data is not shifted when shift number N=0.
Symbol Shift number
SHL_WORD MOD(N/16)
SHL_DWORD MOD(N/32)
Program example:
SAMPLE1 SHL_WORD SAMPLE3 F E D C B A 9 8 7 6 5 4 3 2 1 0
16#9876 IN 16#61D8 SAMPLE1
LD 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0
ST
SAMPLE2
18 N
LD CF F E D C B A 9 8 7 6 5 4 3 2 1 0
SAMPLE3
0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 0 0
0 is entered.
• Left shifts the input data 16#9876 in SAMPLE1 by shift number (=MOD(18/16)) specified by variable SAMPLE2 and stores
the shift result 16#61D8 in SAMPLE3. The last shifted bit OFF is stored in specific register Carry Flag.
6F8C1226
13. Bit Operation 13-4
ROR_xxx
Input IN Output
Diagram
Rotate number N
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
IN See below √ Input
Input
N UINT √ Rotate number
Output — See below — Output
ROR_xxx
Input IN Output
Rotate number N
Function:
• Right rotates the input data by rotate number N and outputs the result.
• The last bit data rotated from the least significant bit is input to the specific register Carry Flag.
• Rotate number N is as follows. No bit is rotated if rotate number N=0.
Symbol Rotate number
ROR_WORD MOD(N/16)
ROR_DWORD MOD(N/32)
Program example:
SAMPLE1 ROR_WORD SAMPLE3
16#9876 IN 16#A61D F E D C B A 9 8 7 6 5 4 3 2 1 0 CF
LD SAMPLE1
ST 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 ∗
SAMPLE2
18 N
LD
F E D C B A 9 8 7 6 5 4 3 2 1 0 CF
SAMPLE3
1 0 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1
• Right rotates the input data 16#9876 in SAMPLE1 by rotate number (=MOD(18/16)) specified by SAMPLE2 and stores the
rotated result 16#A61D in SAMPLE3. The last bit data ON rotated from the least significant bit is stored in specific register
Carry Flag.
6F8C1226
13. Bit Operation 13-5
ROL_xxx
Input IN Output
Diagram
Rotate number N
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
IN See below √ Input
Input
N UINT √ Rotate number
Output — See below — Output
ROL_xxx
Input IN Output
Rotate number N
Function:
• Rotates input data left by N bits and outputs the result.
• The last bit data rotated from the most significant bit is input to specific register Carry Flag.
• Rotate number N is as follows. No bit is rotated if rotate number N=0.
Symbol Rotate number
ROL_WORD MOD(N/16)
ROL_DWORD MOD(N/32)
Program example:
SAMPLE1 ROL_WORD SAMPLE3
16#9876 IN 16#61DA CF F E D C B A 9 8 7 6 5 4 3 2 1 0
LD SAMPLE1
ST ∗ 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0
SAMPLE2
18 N
LD
CF F E D C B A 9 8 7 6 5 4 3 2 1 0
SAMPLE3
0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 1 0
• Left rotates the input data 16#9876 in SAMPLE1 by rotate number (=MOD(18/16)) specified by SAMPLE2 and stores the
rotated result 16#61DA in SAMPLE3. The last bit data ON rotated from the least significant bit is stored in specific register
Carry Flag.
6F8C1226
13. Bit Operation 13-6
SFA_xxx_P
Input IN Output
Diagram
Shift number N
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
IN See below √ Input
Input
N INT √ Shift number
Output — See below — Output
SFA_xxx_P
Input IN Output
Shift number N
Function:
• Arithmetic shifts the input data by shift number N and outputs the result.
• If shift right is specified, the most significant bit is fixed as sign and the state of the most significant bit is inserted in most
significant bit-1.
• If shift left is specified, the most significant bit is fixed as sign and the bits starting from the most significant bit-1 are shifted
left.
• Shift number N specifies the shift number and shift direction. No shift is performed if shift number=0.
Symbol Shift number Shift direction
SFA_WORD_P MOD(N/16) N < 0: Left
SFA_DWORD_P MOD(N/32) N > 0: Right
6F8C1226
13. Bit Operation 13-7
Program example:
(1) Shift right
F E D C B A 9 8 7 6 5 4 3 2 1 0
SAMPLE1
SAMPLE1 SFA_WORD_P SAMPLE3 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0
16#9876 IN 16#E61D
LD ST
SAMPLE2 F E D C B A 9 8 7 6 5 4 3 2 1 0
N SAMPLE3
18 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 1
LD
Fixed 0 is entered.
• Arithmetic left shifts input data 16#9876 in SAMPLE1 by shift number (=MOD(18/16)) specified by SAMPLE2 and stores the
shift result 16#E1D8 in SAMPLE3.
6F8C1226
13. Bit Operation 13-8
SFL_xxx_P
Input IN Output
Diagram
Shift number N
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
IN See below √ Input
Input
N INT √ Shift number
Output — See below — Output
SFL_xxx_P
Input IN Output
Shift number N
Function:
• Logical shifts the input data by shift number N and outputs the result.
• Shift number N specifies the shift number and shift direction. No shift is performed if shift number=0.
Symbol Shift number Shift direction
SFL_WORD_P MOD(N/16) N < 0: Left
SFL_DWORD_P MOD(N/32) N > 0: Right
6F8C1226
13. Bit Operation 13-9
Program example:
(1) Shift right
F E D C B A 9 8 7 6 5 4 3 2 1 0
SAMPLE1
SAMPLE1 SFL_WORD_P SAMPLE3 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0
16#9876 IN 16#261D
LD ST
SAMPLE2 F E D C B A 9 8 7 6 5 4 3 2 1 0
18 SAMPLE3
N 0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 1
LD
0 is entered.
• Logical shifts right input data 16#9876 in SAMPLE1 by shift number (=MOD(18/16)) specified by SAMPLE2 and stores the
shift result 16#261D in SAMPLE3.
14 Arithmetic Operation
Input n
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
Input data Input 1 to Input n are added and the result is output.
Up to 15 input data are allowed.
Input 1 to n must have the same data type.
Output = Input 1 + Input 2 +...+ Input n
Important:
With ADD_REAL, if the absolute value of addend and augend differ significantly (difference in exponent 24), the result is
the value of the data with larger absolute value.
6F8C1226
14. Arithmetic Operation 14-3
Program example:
SAMPLE1 ADD_INT SAMPLE5
12765 -1000
LD ST
SAMPLE2
-32653
LD
SAMPLE3
7654
LD
SAMPLE4
11234
LD
The input data in SAMPLE1 to SAMPLE4 are added and the result -1000 is stored in SAMPLE5.
Error information:
If an overflow occurs, the limit value is output as result.
When input data type is REAL, if NAN data is entered as input, the result is NAN.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-4
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1,2
See below
Output — — Output
Input 2
Function:
Input data Input 1 and Input 2 are added with carry including the specific register S register Carry Flag and the result is
output.
The Carry Flag is processed as follows:
When there is carry from most significant bit (carry out) : Carry Flag is set to ON
When there is no carry from most significant bit (no carry out) : Carry Flag is reset to OFF
When EN is used, ENO output is set as follows:
Carry from most significant bit (carry out) or
Carry from most significant bit-1 to most significant bit: ENO output is reset to OFF
Input 1 and input 2 must have the same data type.
Output=Input 1+Input 2+Carry Flag
6F8C1226
14. Arithmetic Operation 14-5
Program example:
(1) When there is no carry out (CF), or overflow (OV) and input Carry Flag (input CF)=OFF
SAMPLE1 ADC_INT SAMPLE3 SAMPLE1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 0 7856
7856 10573
LD ST SAMPLE2 0 0 0 0 1 0 1 0 1 0 0 1 1 1 0 1 2717
SAMPLE2
2717 +) Input CF 0
LD SAMPLE3 0 0 1 0 1 0 0 1 0 1 0 0 1 1 0 1 10573
CF 0
OV 0
The input data 7856 in SAMPLE1 and 2717 in SAMPLE2 are added with carry and the result 10573 is stored in SAMPLE3.
Also, the specific register Carry Flag is reset to OFF.
(2) When there is carry out (CF) and overflow (OV), and input Carry Flag (input CF)=OFF
SAMPLE1 ADC_INT SAMPLE3 SAMPLE1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -32768
-32768 22768
LD ST SAMPLE2 1 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 -10000
SAMPLE2
-10000 +) Input CF 0
LD SAMPLE3 0 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 22768
CF 1
OV 0
The input data -32768 in SAMPLE1 and -10000 in SAMPLE2 are added with carry and the result 22768 is stored in
SAMPLE3. Also, the specific register Carry Flag is set to ON.
Error information:
When EN is used, ENO output is reset to OFF if overflow or carry occurs.
6F8C1226
14. Arithmetic Operation 14-6
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See √ Input 1,2
Output — below — Output
Function:
Input data Input 2 is subtracted from Input 1 and the result is output.
Input 1 and input 2 must have the same data type.
Output=Input 1-Input 2
Important:
With SUB_REAL, if the absolute value of subtrahend and minuend differ significantly (difference in exponent 24), the result
is the value of the data with larger absolute value.
Program example:
SAMPLE1 SUB_INT SAMPLE3
4378 2033
LD ST
SAMPLE2
2345
LD
The input data in SAMPLE2 is subtracted from SAMPLE1 and the result 2033 is stored in SAMPLE3.
Error information:
If an overflow occurs, the limit value is output as result.
When input data type is REAL, if NAN data is entered as input, the result is NAN.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-7
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See √ Input 1, 2
Output — below — Output
Input 2
Function:
Input data Input 2 is subtracted from Input 1 with carry including the specific register Carry Flag and the result is output.
Carry Flag is processed as follows:
When there is borrow to the most significant bit (borrow in) : Carry Flag is set to ON
When there is no borrow to the most significant bit (no borrow in) : Carry Flag is reset to OFF
When EN is used, ENO output is set as follows:
When there is borrow to the most significant bit (borrow in) or
When there is borrow from the most significant bit to most significant bit-1: ENO output=OFF
Input 1 and input 2 must have the same data type.
Output=Input 1-Input 2-Carry Flag
6F8C1226
14. Arithmetic Operation 14-8
Program example:
(1) When there is no borrow in (CF) or overflow (OV), and input Carry Flag (input CF)=OFF
SAMPLE1 SBB_INT SAMPLE3 SAMPLE1 0 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 23648
23648 13313
LD ST SAMPLE2 0 0 1 0 1 0 0 0 0 1 0 1 1 1 1 1 10335
SAMPLE2
10335 +) Input CF 0
LD SAMPLE3 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 13313
CF 0
OV 0
Input data 10335 in SAMPLE2 is subtracted from 23648 in SAMPLE1 with carry and the result 13313 is stored in SAMPLE3.
Also, the specific register Carry Flag is reset to OFF.
(2) When there is borrow in (CF), overflow (OV), and input Carry Flag (input CF)=OFF
CF 1
OV 0
Input data -28000 in SAMPLE2 is subtracted from 10000 in SAMPLE1 with carry and the result -27536 is stored in
SAMPLE3. Also, the specific register Carry Flag is set to ON.
Error information:
When EN is used, when borrow in or underflow occurs, ENO output is reset to OFF.
6F8C1226
14. Arithmetic Operation 14-9
Diagram Input 2
Input n
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1…n 2 ≤ n ≤ 15
See below
Output — — Output
Input n
Function:
Input data Input 1 to Input n are multiplied and the result is output.
Up to 15 input data are allowed.
Input 1 to n must have the same data type.
Output=Input 1 * Input 2 * ··· * Input n
6F8C1226
14. Arithmetic Operation 14-10
Program example:
SAMPLE1 MUL_INT SAMPLE5
12 -24192
LD ST
SAMPLE2
-32
LD
SAMPLE3
21
LD
SAMPLE4
3
LD
Input data in SAMPLE1 to SAMPLE4 are multiplied and the result -24192 is stored in SAMPLE5.
Error information:
If an overflow occurs, the limit value is output as result.
When input data type is REAL, if NAN data is entered as input, the result is NAN.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-11
Arguments:
Arg. Operand Type Const. Description Remarks
Input — INT √ Input 1, 2
Output — DINT — Output
Function
INT input data Input 1 and Input 2 are multiplied and the result is output as DINT.
The number of input data is fixed at 2.
Input 1 and input 2 must have the same data type.
Output=Input 1 * Input 2
Program example:
SAMPLE1 MUL_INT_DINT SAMPLE5
129 -421185
LD ST
SAMPLE2
-3265
LD
The input data 129 in SAMPLE1 is multiplied with -3265 in SAMPLE2 and the result -421185 is stored in SAMPLE5.
6F8C1226
14. Arithmetic Operation 14-12
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1, 2
See below
Output — — Output
Input 2
Function:
Input data Input 1 is divided with Input 2 and the result is output.
Input 1 and Input 2 must have the same data type.
Output=Input 1/ Input 2
Program example:
SAMPLE1 DIV_INT SAMPLE3
24378 10
LD ST
SAMPLE2
2345
LD
The input data 24378 in SAMPLE1 is divided by 2345 in SAMPLE2 and the result 10 is stored in SAMPLE3.
Error information:
If divided by 0 error occurs, the limit is output as operation result. Also, the specific registers Error Flag and Divide Error Flag
are set to ON.
If the operation result exceeds the valid data range, the limit value is output.
When input data type is REAL, if NAN data is entered as input, the result is NAN.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-13
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — √ Input 1, 2
See below
Output — — Output
Input 2
Function:
Input data Input 1 is divided by Input 2 and the remainder is output.
Input 1 and Input 2 must have the same data type.
Output=MOD (Input 1/ Input 2)
Program example:
SAMPLE1 MOD_INT SAMPLE3
24378 928
LD ST
SAMPLE2
2345
LD
The input data 24378 in SAMPLE1 is divided by 2345 in SAMPLE2 and the remainder 928 is stored in SAMPLE3.
Error information:
If divided by 0 error occurs, the remainder 0 is output as operation result. Also, the specific registers Error Flag and Divide
Error Flag are set to ON.
If EN is included, ENO output is OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-14
INC_xxx Output
Diagram
Input_Output 1 V V Input_Output 1
Arguments:
The following data types are supported for input/output and output arguments and the instruction symbol depends on the
data type:
Arg. Operand Type Const. Description Remarks
Input/Output — — Input_Output 1
See below
Output — — Output
INC_xxx Output
Input_Output 1 V V Input_Output 1
Function:
The input/output data Input_Output 1 is incremented and the result is output.
The result is not limited even if the result exceeds the data range.
Output=Input_Output 1+1
6F8C1226
14. Arithmetic Operation 14-15
Program example:
(1)
INC_INT SAMPLE2
1000
ST
SAMPLE1 SAMPLE1
999 V V
LD ST
The input data 999 in variable SAMPLE1 is incremented and the result 1000 is stored in variables SAMPLE1 and SAMPLE2.
(2)
INC_INT SAMPLE2
-32768
ST
SAMPLE1 SAMPLE1
32767 V V
LD ST
The input data 32767 in variable SAMPLE1 is incremented and the result -32768 is stored in variables SAMPLE1 and
SAMPLE2.
Error information:
When input data type is REAL, if NAN data is entered as input, the result is NAN.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-16
DEC_xxx Output
Diagram
Input_Output 1 V V Input_Output 1
Arguments:
The following data types are supported for input/output and output arguments and the instruction symbol depends on the
data type:
Arg. Operand Type Const. Description Remarks
Input/Output — — Input_Output 1
See below
Output — — Output
DEC_xxx Output
Input_Output 1 V V Input_Output 1
Function:
The input/output data Input_Output 1 is decremented and the result is output.
The result is not limited even if the result exceeds the data range.
Output=Input_Output 1 - 1
6F8C1226
14. Arithmetic Operation 14-17
Program example:
(1)
DEC_INT SAMPLE2
998
ST
SAMPLE1 SAMPLE1
999 V V
LD ST
The input data 999 in variable SAMPLE1 is decremented and the result 998 is stored in variables SAMPLE1 and SAMPLE2.
(2)
DEC_INT SAMPLE2
32767
ST
SAMPLE1 SAMPLE1
-32768 V V
LD ST
The input data -32768 in variable SAMPLE1 is decremented and the result 32767 is stored in variables SAMPLE1 and
SAMPLE2.
Error information:
When input data type is REAL, if NAN data is entered as input, the result is NAN.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-18
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input 1 REAL √ Input 1
Input
Input 2 See below √ Input 2
Output — REAL — Output
Function:
Input data Input 1 is raised to the Input 2 power and the result is output.
Output=(Input 1)Input 2
Program example:
SAMPLE1 EXPT_INT SAMPLE3
12.45 546.91946
LD ST
SAMPLE2
2.5
LD
SAMPLE1 is raised to the SAMPLE2 power and the result 546.91946 is stored in SAMPLE3.
Error information:
If the operation result exceeds the valid data range, the limit value is output.
If Input 1=Input 2=0, 0 is output as the result and the specific register Error Flag is set to ON.
If Input 1 < 0 and Input 2 has decimal fractions (example: Input 1=-2, Input 2=-2.5), the result is 0 and the specific register
Error Flag is set to ON.
When input data type is REAL, if NAN data is entered as input, the result is NAN.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-19
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — Note 1 Input 1,2
See below
Output — — Output
Note 1: For constant specification of input 1, constant specification is not allowed for DT type.
Input 2
Function:
Input data Input 1 is added and Input 2 and the result is output.
The number of input data is fixed at two.
In case of addition of DT type and integer data, integer data is assumed to be number of days.
Output=Input 1+Input 2
6F8C1226
14. Arithmetic Operation 14-20
Program example:
(1) When TIME+TIMETIME
SAMPLE1 ADD_T_T SAMPLE3
T#12345ms T#15801ms
LD ST
SAMPLE2
T#3456ms
LD
The input data T#12345ms in SAMPLE1 is added with T#3456ms in SAMPLE2 as time data and the result T#15801ms is
stored in SAMPLE3.
The input data D#1999-8-1in SAMPLE1 is added to input data 5 in SAMPLE2 as time data and the result D#1999-8-6 is
stored in SAMPLE3.
Error information:
If an overflow occurs, the limit value is output as result.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-21
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — Note 1 Input 1,2
See below
Output — — Output
Note 1: For constant specifcation of input 1, constant specification is not allowed for DT type.
Input 2
Function:
Input data Input 2 is subtracted from Input 1 and the result is output.
The number of input data is fixed at two.
For subtraction of integer type data, integer data is assumed to be number of days.
Output=Input 1-Input 2
6F8C1226
14. Arithmetic Operation 14-22
Program example:
(1) When TIME-TIMETIME
SAMPLE1 SUB_T_T SAMPLE3
T#12345ms T#8889ms
LD ST
SAMPLE2
T#3456ms
LD
The input data T#3456ms in SAMPLE2 is subtracted from T#12345ms in SAMPLE1 as time data and the result T#8889ms
is stored in SAMPLE3.
The input data 5 in SAMPLE2 is subtracted from input data D#1999-8-6 in SAMPLE1 as time data and the result D#1999-8-1
is stored in SAMPLE3.
Error information:
If an overflow occurs, the limit value is output as result.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-23
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input 1 TIME √ Input 1
Input
Input 2 See below √ Input 2
Output — TIME — Output
Input 2
Function:
Input data Input 1 is multiplied with Input 2 as time data and the result is output.
Output=Input 1 * Input 2
Program example:
SAMPLE1 MUL_T_INT SAMPLE3
T#12345ms T#37035ms
LD ST
SAMPLE2
3
LD
The input data T#12345ms in SAMPLE1 is multiplied with 3 in SAMPLE2 as time data and the result T#37035ms is stored in
SAMPLE3.
Error information:
If the operation result exceeds the valid data range, the limit value is output.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
14. Arithmetic Operation 14-24
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input 1 TIME √ Input 1
Input
Input 2 See below √ Input 2
Output — TIME — Output
Function:
Input data Input 1 is divided by Input 2 as time data and the result is output.
Output=Input 1/ Input 2
Program example:
SAMPLE1 DIV_T_INT SAMPLE3
T#12345ms T#4115ms
LD ST
SAMPLE2
3
LD
The input data T#12345ms in SAMPLE1 is divided by 3 in SAMPLE2 as time data and the result T#4115ms is stored in
SAMPLE3.
Error information:
If the operation result exceeds the valid data range, the limit value is output.
If divided by 0 error occurs, the limit is output as operation result. Also, the specific registers Error Flag and Divide Error Flag
are set to ON.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
15. Data Processing 15-1
15 Data Processing
SETC
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — BOOL √ Input
Output — BOOL — Output
Function:
• When the input is ON, the specific register Carry Flag is set to ON.
• When the input is OFF, the specific register Carry Flag is unchanged.
• The state of the input is output as the result.
Input Action Output
OFF Do not execute (Carry Flag is unchanged) OFF
ON Execute (Carry Flag=ON) ON
Program example:
SIGNAL1 SETC SIGNAL2
1 1
LD ST
• When SIGNAL1 is ON, the Carry Flag is set to ON and ON is output to variable SIGNAL2.
6F8C1226
15. Data Processing 15-3
RSTC
Diagram Input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — BOOL √ Input
Output — BOOL — Output
Function:
• When the input is ON, the specific register Carry Flag is reset to OFF.
• When the input is OFF, the specific register Carry Flag is unchanged.
• The state of the input is output as the result.
Input Action Output
OFF Do not execute (Carry Flag is unchanged) OFF
ON Execute (Carry Flag=OFF) ON
Program example:
SIGNAL1 RSTC SIGNAL2
1 1
LD ST
• When SIGNAL1 is ON, the Carry Flag is reset to OFF and ON is output to variable SIGNAL2.
6F8C1226
15. Data Processing 15-4
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input data
Output — — Bit no. output
Function:
• Searches the input data from the most significant bit and outputs the number of the first bit that is ON.
• The output bit number depends on the data type of the input data as follows:
WORD :0 to 15
DWORD :0 to 31
• If the input data has no ON bit, -1 is output. Also, the specific register Encode Error Flag set to ON.
Program example:
SAMPLE1 ENC_WORD_INT SAMPLE2 Bit no. 15 12 8 4 0
16#1234 12 WORD 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
LD ST
Bit search direction
• Encodes the input data SAMPLE1 and stores 12 as the result in SAMPLE2.
Error information:
• If input data=0, an encode error occurs with -1 output as the result and the specific register Encode Error Flag is set to ON.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
15. Data Processing 15-5
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Bit no. input
Output — — Result output
Input/Output M — Target data
Function:
• Of the target data, the bit specified with bit no. input is set to ON. The operation result is output in result output.
• The input bit number depends on the data type of the target data as follows:
WORD: 0 to 15 … Bit no. position=MOD (Bit no. input/16)
DWORD: 0 to 31 … Bit no. position=MOD (Bit no. input/32)
Program example:
SAMPLE1 DEC_INT_WORD SAMPLE3 Bit no. 15 12 8 4 0
12 16#1234 WORD 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
LD ST
SAMPLE2 SAMPLE2
16#0234 M M Bit no. input
LD ST
• Of the content 16#0234 in target data SAMPLE2, the 12th bit specified with bit no. input SAMPLE1 is set to ON. As the result
of this decode operation, the content of target data SAMPLE2 is 16#1234 and the result 16#1234 is stored in SAMPLE3.
Error information:
• When bit no. input < 0, no decode operation is performed.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
15. Data Processing 15-6
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input data
Output — INT — Bit count output
BC_xxx
Input data Bit count output
Function:
• Counts the number of bits in the input data that are ON and output the result.
Program example:
SAMPLE1 BC_WORD SAMPLE2 Bit no. 15 12 8 4 0
16#1234 5 WORD 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
LD ST
• Counts the number of bits in input data SAMPLE1 and stores 5 as the result in SAMPLE2.
6F8C1226
15. Data Processing 15-7
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
— See below √ Bit pointer
Input
N UINT √ Table size 1 ≤ N ≤ 64
Output — PTR — Target table
Function:
• The bit position specified with bit pointer in the N word table starting with the target table is set to ON.
• The table size must be between 1 and 64 words (1024 bits).
• If table size N=0, no table set is performed.
• If the bit pointer points outside the target table, no table set is performed and the specific register Table Operation Error is set
to ON.
• Direct I/O variables cannot be specified for target table.
Table specification Table word count Action Error flag
Not direct I/O 1 ≤ N ≤64 Executed —
N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O ∗ Not executed ON
6F8C1226
15. Data Processing 15-8
Program example:
SAMPLE1 TSET_INT TBL1 Target table TBL1
88 0 151413121110 9 8 7 6 5 4 3 2 1 0
LD ST
1 31302928272625242322212019 18 17 16
SAMPLE2
6 N
LD 5 95949392919089888786858483 82 81 80
Set to ON
Bit pointer=88
• In the 6 word (which is specified with table size SAMPLE2) table data starting with target table TBL1, the bit position
specified with bit pointer in input data SAMPLE1 is set to ON.
Error information:
• If the bit pointer points outside the target table, Table Operation Error is set to ON.
• If table size N > 64, operation is performed with N=64.
• If direct I/O variable is specified for target table, no operation is performed and Error Flag is set to ON.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
15. Data Processing 15-9
Arguments:
• The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description Remarks
— See below √ Bit pointer
Input
N UINT √ Table size 1 ≤ N ≤ 64
Output — PTR — Target table
Function:
• The bit position specified with bit pointer in the N word table starting with the target table is reset to OFF.
• The table size must be between 1 and 64 words (1024 bits).
• If table size N=0, no table reset is performed.
• If the bit pointer points outside the target table, no table reset is performed and the specific register Table Operation Error is
set to ON.
• Direct I/O variables cannot be specified for target table.
Table specification Table word count Action Error flag
Not direct I/O 1 ≤ N ≤ 64 Executed —
N=0 Not executed —
N > 64 Execute with N=64 as limit —
Direct I/O ∗ Not executed ON
6F8C1226
15. Data Processing 15-10
Program example:
Target tabel TBL1
SAMPLE1 TRST_INT TBL1
88 0 151413121110 9 8 7 6 5 4 3 2 1 0
LD ST
1 31302928272625242322212019 18 17 16
SAMPLE2
6 N
LD 5 95949392919089888786858483 82 81 80
Reset to OFF
Bit pointer=88
• In the 6 word (which is specified with table size SAMPLE2) table data starting with target table TBL1, the bit position
specified with bit pointer in input data SAMPLE1 is reset to OFF.
Error information:
• If the bit pointer points outside the target table, Table Operation Error is set to ON.
• If table size N > 64, operation is performed with N=64.
• If direct I/O variable is specified for target table, no operation is performed and Error Flag is set to ON.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
16. I/O Instructions 16-1
16 I/O
MREAD
Execution enabled input E Completion output
Bus/Unit/Slot T
Arguments:
Arg. Operand Type Const. Description Range
Input E BOOL √ Execution enabled input
T WORD √ Bus/Unit/Slot
TADDR WORD √ Extended memory top address 0 to 7FFFH
P PTR — Transfer destination variable
N UINT √ Transfer word number 1 to 256W
Output — BOOL — Completion output
Function:
• If execution enabled input E is OFF, no data is input from the special module.
• If execution enabled input E is ON, data is transferred from special module internal extended memory specified by the input
argument to the CPU module.
• Input arguments specify the transfer source (special module slot location and special module internal extended memory top
address), transfer destination (CPU module internal variable), and transfer word number.
• If an execution error is detected, the specific register Error Flag is set.
• 1 to 256 words may be transferred.
• Direct I/O variable cannot be specified for transfer destination variable.
Input Action Output Error flag
OFF Not executed OFF —
Executed: Normal ON —
ON
Not executed: Error ON ON
6F8C1226
16. I/O Instructions 16-3
Program example:
Transfer destination
SIGNAL1 MREAD SIGNAL2 Special module internal extended address variable SAMPLE3
1 E 1
LD ST 15 0 15 0
SAMPLE1 16#0000
16#1_1_06 T N=200W
LD TADR=16#0100 Transfer
SAMPLE2 N=200W
16#0100 TADDR
LD
SAMPLE3 16#01C8
1234 P
LD
SAMPLE4
200 N
LD
IO specification: SAMPLE1
Bus: Channel 1
Unit: 1
Slot: 6
16#7FFF
• Variable SAMPLE1 specifies the special module slot location. (Bus: Channel 1, Unit: 1, Slot: 6)
• Variable SAMPLE2 specifies the read top address of the extended memory in special module. (16#0100)
• Variable SAMPLE3 specifies the transfer destination variable.
• Variable SAMPLE4 specifies the transfer word number. (specify 200W)
• When SIGNAL1 is ON, the data specified with the above input argument is transferred. Upon normal completion, SIGNAL2
is set to ON.
Error information:
• When the module cannot be accessed because the specified special module is not installed or is abnormal.
• When the specified module is not a special module.
• When the transfer word number exceeds 256W.
• When the transfer source special module extended address is outside 0 to 7FFF.
• When the range specified by the transfer destination variable exceeds the allowed area.
• When direct I/O variable is specified for transfer destination variable.
• If the above error occurs, specific register Error Flag is set to ON without performing any operation.
6F8C1226
16. I/O Instructions 16-4
M W RITE
Execution enabled input E Com pletion output
Bus/Unit/Slot T
Transferred words N
Arguments:
Arg. Operand Type Const. Description Range
Input E BOOL √ Execution enabled input
T WORD √ Bus/Unit/Slot
TADDR WORD √ Extended memory top address 0 to 7FFFH
P PTR — Transfer destination variable
N UINT √ Transfer words 1 to 256W
Output — BOOL — Completion output
Function:
• If execution enabled input E is OFF, no data is output to special module.
• If execution enabled input E is ON, data is transferred from transfer source variable in the CPU module specified by input
argument to the special module internal extended memory.
• Input arguments specify the transfer source (CPU module internal variable), transfer destination (special module slot
location and special module internal extended memory top address), and transfer word number.
• If an execution error is detected, the specific register Error Flag is set.
• 1 to 256 words may be transferred.
• Direct I/O variable cannot be specified for transfer source variable.
Input Action Output Error flag
OFF Not executed OFF —
Executed: Normal ON —
ON
Not executed: Error ON ON
Program example:
6F8C1226
16. I/O Instructions 16-5
• Variable SAMPLE1 specifies the special module slot location. (Bus: Channel 1, Unit: 1, Slot: 6)
• Variable SAMPLE2 specifies the special module internal extended memory write top address. (16#0100)
• Variable SAMPLE3 specifies the transfer source variable.
• Variable SAMPLE4 specifies the transfer word number. (specify 200W)
• When SIGNAL1 is ON, the data specified with the above input argument is transferred. Upon normal completion, SIGNAL2
is set to ON.
Error information:
• When the module cannot be accessed because the specified special module is not installed or is abnormal.
• When the specified module is not a special module.
• When the transfer word number exceeds 256W.
• When the range specified by the transfer source variable exceeds the allowed area.
• When the transfer destination special module extended address is outside 0 to 7FFF.
• When direct I/O variable is specified for transfer source variable.
• If the above error occurs, specific register Error Flag is set to ON without performing any operation.
6F8C1226
16. I/O Instructions 16-6
nV dedicated
I/O Special Module Data Input (nv)
instruction
LD/FBD language MREAD_
notation Completion
Execution request REQ DONE output
Basic unit slot / node
/unit / slot T ERROR Error
Extended memory
address TADDR STATU Status
Transfer destination
P
variable
Transfer word count N
Arguments:
Allowable
Setting value Valid range Remarks
range
Basic unit slot 0 to 255 0 0: I/O directly under the
controller
Node 0 to 255 3 to 34
NX-I/√ 1
Unit 0 to 255
G3-I/√ 1 to 7
NX-I/√ 0 to 15
Slot 0 to 255
G3-I/√ 0 to 11
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 Transfer word count (1 to 256) :256W
Instance structure:
Function:
• This function block reads data from an arbitrary memory address for the I/O module with memory of NX-I/O and G3-I/O.
• When execution request REQ changes from OFF to ON, data for transfer word count is read from extended memory
address TADDR of the specified basic unit slot / node / unit / slot to transfer destination variable P.
• For transfer word count, 1 to 256 words can be specified.
• When it is completed normally, completion output DONE becomes ON for 1 scanning time.
• When it is completed with an error, error ERROR becomes ON for 1 scanning time.
• When transfer is completed with or without an error, the details are output to status STATUS.
• I/O variable cannot be specified directly for transfer destination variable.
• For MREAD_N, MWRITE_N and XMIT_N instructions, up to 48 requests can be made simultaneously per controller.
• The status values are as follows.
Program example:
[LD/FBD language notation]
MREAD_N_1
SIGNAL1 MREA _ SIGNAL2
1 REQ DONE 1
L ST
SAMPLE1 SIGNA 3
16 0001020 T ERROR 0
L ST
SAMPLE2 SIGNA 5
16#0100 TADDR STATUS 8
L ST
SAMPLE3
123 P
L Transfer destination variable
Extended address in special module SAMPLE3
SAMPLE4
20 N 1 0 1 0
L 16#0000
N=200W
Transfer
TADR=16#0100
N=200W
16#01C8
IO specification: SAMPLE1
Basic unit slot : 0
Node 1
Unit 2
16#7FFF Slot: 3
• The installation slot location of the special module is specified with variable SAMPLE1 (Basic unit slot :0, Node :1, Unit :
2, Slot :3).
• The read top address of the extended memory in special module is specified with variable SAMPLE2 (16#0100).
• The destination variable is specified with variable SAMPLE3.
• Transfer word count is specified with variable SAMPLE4 (200W specified).
• When variable SIGNAL1 is ON, transfer operation is performed with the data specified in the input arguments above. When
it is completed normally, variable SIGNAL2 becomes ON.
Error information:
When I/O variable is specified directly for destination, the operation is as follows.
Controller Processing
Special module data input processing is not
executed.
Unified Controller nv series
Error flag and table operation error flag are set to
ON.
6F8C1226
16. I/O Instructions 16-9
nv dedicated
I/O Special Module Data Output (nv)
instruction
LD/FBD language Instance name
notation
MWRITE_
Execution permission input REQ DONE Completion output
Basic unit slot / node
/ unit / slot T ERROR Error
Arguments:
Function:
• This function block writes data to an arbitrary memory address for the I/O module with memory of NX-I/O and G3-I/O.
• When execution request REQ changes from OFF to ON, data for transfer word count is written to extended memory address
TADDR of the specified basic unit slot / node / unit / slot from transfer destination variable P.
• For transfer word count, 1 to 256 words can be specified.
• When it is completed normally, completion output DONE becomes ON for 1 scanning time.
• When it is completed with an error, error ERROR becomes ON for 1 scanning time.
• When transfer is completed with or without an error, the details are output to status STATUS.
• I/O variable cannot be specified directly for transfer source variable.
• For MREAD_N, MWRITE_N and XMIT_N instructions, up to 48 requests can be made simultaneously per controller.
• The status values are as follows.
Completion
Status
status Content Description
STATUS
DONE ERROR
MWRITE_N management
0 to 63 TRUE FALSE
buffer number
-5001 FALSE TRUE Transfer word count abnormal Transfer word count exceeds 256.
When 0≦ Extended memory address
Extended memory specification
-5002 FALSE TRUE specification ≦16#7FFF:(TADDR+N-1)
address abnormal
≧16#8000
The specification range of transfer source
-5003 FALSE TRUE Boundary abnormal
variable exceeds the area.
Transfer source variable I/O variable is specified directly for transfer
-5004 FALSE TRUE
specification abnormal source variable.
I/O is installed in the specified basic unit
-5005 FALSE TRUE Module abnormal slot/node/unit/slot, but it is in degeneration or
specified as hot-swap.
A certain period of time elapsed, but
MWRITE_N instruction cannot be executed
-5006 FALSE TRUE Management buffer full
because MWRITE_N management buffer is
full.
6F8C1226
16. I/O Instructions 16-11
Instance structure:
Name Type Description Remarks
Completion
DONE BOOL
output Can be accessed from the user
ERROR BOOL Error program.
STATUS INT Status
TIMECNT DINT Time count Cannot be accessed from the user
RESERVE Bit string of length 32 Reserved program.
Program example:
[LD/FBD language notation]
MWRITE_N_
SIGNAL1 MWRITE_ SIGNAL2
1 RE DON 1
L ST
Transfer destination variable
SAMPLE1 SIGNA 3
16 0001020 T ERRO 0 SAMPLE3 Extended address in special module
L ST 1 0 0 1
SAMPLE2 SIGNA 5 16#000
16#010 TADDR STATUSR 8 N=200W
L ST Transfer TADR=16#010
SAMPLE3
123 P N=200W 0
L
SAMPLE4
16#01C
20 N
L
• The installation slot location of the special module is specified with variable SAMPLE1 (Basic unit slot :0, Node :1, Unit :
2, Slot :3).
• The read top address of the extended memory in special module is specified with variable SAMPLE2 (16#0100).
• The transfer source variable is specified with variable SAMPLE3.
• Transfer word count is specified with variable SAMPLE4 (200W specified).
• When variable SIGNAL1 changes OFF to ON, transfer operation is performed with the data specified in the input arguments
above. When it is completed normally, variable SIGNAL2 becomes ON.
Error information:
• When I/O variable is specified directly for transfer source, the operation is as follows.
Controller Processing
Special module data output processing is not
Unified Controller nv series executed.
Error flag and table operation error flag are set to ON.
6F8C1226
16. I/O Instructions 16-12
Arguments::
Arg. Operand Type Const. Description Range
Input E BOOL √ Execution enabled input
T WORD √ Bus/Unit/Slot
TADDR WORD √ Extended memory top address 0 to 7FFFH
P STRING — Transfer destination variable
N UINT √ Transfer word number 1 to 129W
CODE WORD √ End code specification
Output — BOOL — Completion output
Function:
• If execution enabled input E is OFF, no string data is input from the ASC module.
• If execution enabled input E is ON, data is transferred from ASC module internal extended memory specified by the input
argument to the STRING variable in the CPU module.
• The store target data is N words starting from TADDR and the data from the beginning up to the specified end code is
stored.
• The low order byte (16#00 to 16#FF) of the CODE input data is used as the end code.
• For input arguments, specify the transfer source (ASC module slot location and ASC module internal extended memory top
address), transfer destination (CPU module internal variable), transfer word number, and end code.
• If a double-byte code in the data read from ASC module is invalid, the invalid double-byte code is stored in STRING variable
replaced by ??.
6F8C1226
16. I/O Instructions 16-13
Important:
• Specify the same code for the end code in the ASC module and the end code specification CODE in this instruction.
Program example:
SIGNAL1 ASCREAD SIGNAL2 Extended address in Transfer destination
1 E 1 ASC module variable SAMPLE3
LD ST 15 0 15 0
SAMPLE1 16#0000 VAR length=6
16#1_1_06 T
String length=8
LD
SAMPLE2 TADDR=16#0080 “2“ “1“ “2“ “1“
16#0080 TADDR “4“ “3“ Transfer “4“ “3“
LD “6“ “5“ “6“ “5“
SAMPLE3 “8“ “7“ “8“ “7“
P
““ “CR“ * *
LD
SAMPLE4 16#0085 * *
5 N
LD IOSpecification: SAMPLE1
SAMPLE5 Bus: Channel 1 Variables:
16#000D CODE Unit: 1 Variable Data type Dec.
LD Slot: 6 SAMPLE3 STRING[12] VAR
16#7FFF
• Variable SAMPLE1 specifies the ASC module slot location. (Bus: Channel 1, Unit: 1, Slot: 6)
• Variable SAMPLE2 specifies the read top address of the extended memory in ASC module. (16#0080)
• Variable SAMPLE3 specifies the transfer destination STRING variable.
• Variable SAMPLE4 specifies the transfer word number. (5W specified)
• Variable SAMPLE5 specifies the end code. ("CR" specified)
• When variable SIGNAL1 is ON, the content specified with the above input argument is transferred and the character data up
to the specified end code is stored in the STRING variable. Upon normal completion, SIGNAL2 is set to ON.
6F8C1226
16. I/O Instructions 16-14
Error information:
• When the ASC module cannot be accessed because the specified ASC module is not installed or is abnormal.
• When the specified module is not a special module.
• When the transfer word number exceeds 129W.
• When the transfer source ASC module extended address is not between 0 and 7FFF.
• When the range specified by the transfer destination variable exceeds the allowed area.
• When direct I/O variable is specified for transfer destination variable.
• If the above error occurs, the specific register Error Flag is set to ON without performing any operation.
6F8C1226
16. I/O Instructions 16-15
Arguments:
Arg. Operand Type Const. Description Range
Input E BOOL √ Execution enabled input
T WORD √ Bus/Unit/Slot
TADDR WORD √ Extended memory top address 0 to 7FFFH
P STRING — Transfer source variable
N UINT √ Transfer word number 1 to 129W
CODE WORD √ End code specification
Output — BOOL — Completion output
Function:
• If execution enabled input E is OFF, no data is output to ASC module.
• If execution enabled input E is ON, data is transferred from transfer source variable in the CPU module specified by input
argument to the ASC module internal extended memory.
• The storage target data is output with the valid character code stored in STRING variable appended with the end code
specified with end code specification CODE.
• The low order byte (16#00 to 16#FF) of the CODE input data is used as the end code.
• For input arguments, specify the transfer source (CPU module internal variable), transfer destination (special module slot
location and ASC module internal extended memory top address), transfer word number, and end code.
• If an execution error is detected, the specific register Error Flag is set.
• 1 to 129 words (up to 256 bytes + end code) can be specified as transfer word number.
Normally, the transfer word number N is specified as INT ((string declaration byte size+2)/2). By specifying this way, the
6F8C1226
16. I/O Instructions 16-16
application program need not be aware of the actual number of character code bytes stored in the STRING variable.
• Direct I/O variable cannot be specified for transfer source variable.
Important:
• Specify the same code for the end code in the ASC module and the end code specification CODE in this instruction.
Program example:
SIGNAL1 ASCWRITE SIGNAL2 Transfer source Extended address
1 E 1 variable SAMPLE3 in ASC module
LD ST 15 0 0 15
SAMPLE1 VAR length=6 16#0000
16#1_1_06 T
String length=8
LD
SAMPLE2 “2“ “1“ “2“ “1“ TADR=16#0240
Transfer
16#0240 TADDR “4“ “3“ “4“ “3“
LD “6“ “5“ “6“ “5“
SAMPLE3 “8“ “7” “8“ “7“
P
““ ““ ““ “CR“
LD
SAMPLE4 Variables: 16#0245
5 N Variable Data type Dec.
LD SAMPLE3 STRING[12] VAR
SAMPLE5
16#000D CODE
LD IO specification: SAMPLE1
Bus: Channel 1
Unit: 1 16#7FFF
Slot: 6
• Variable SAMPLE1 specifies the ASC module slot location. (Bus: Channel 1, Unit: 1, Slot: 6)
• Variable SAMPLE2 specifies the ASC module internal extended memory write top address. (16#0240)
• Variable SAMPLE3 specifies the transfer source STRING variable.
• Variable SAMPLE4 specifies the transfer word number. (5W specified)
• Variable SAMPLE5 specifies the end code. ("CR" specified)
• When SIGNAL1 is ON, transfer is performed with the end code specified with the above input argument appended. Upon
normal completion, SIGNAL2 is set to ON.
Error information:
• When the ASC module cannot be accessed because the specified ASC module is not installed or is abnormal.
• When the specified module is not a special module.
• When the transfer word number exceeds 129W.
• When the range specified by the transfer source variable exceeds the allowed area.
• When the transfer destination special module extended address is not between 0 and 7FFF.
• When INT (string declaration byte size+2)/2)>N.
• When direct I/O variable is specified for transfer source variable.
• If the above error occurs, the specific register Error Flag is set to ON without performing any operation.
6F8C1226
16. I/O Instructions 16-17
Arguments:
Function:
• This is a dedicated instruction for I/O interruption task.
• When GET_IP_INF instruction is used in the I/O interruption task, the activation factor (I/O, TC-net100, START_P) of the I/O
interruption task can be obtained.
• The obtained result is transferred to the specified storage destination table.
• For storage destination table specification, static variable, non-tracking type / static variable (unified controller), temporary
variable, user variable, special register (SW) or system variable (ZW), and data register (D) are valid. If other variable is
specified, state change detection information is not read.
• The structure of state change detection information varies depending on the activation factor as shown below.
Program example:
[LD/FBD language notation]
Controller
I/O state
change /* IP3 Program */
I/O interruption / State change detection
notification registration Inf information
GET_IP_IN →Info*/
information ST
Point No. 0
I/O-1 IP0 /* When Info activation factor=I/O
Word No. IP1
IP2 Interruption processing from I/O-1 module word No.= 1
I/O interruption
Point No.1 IP3 event processing
I/O-1 program (IP3)
IP4 /* When Info activation factor=TC-net
Word No.1 IP5
Interruption processing from TC-net 100 module
IP6
I/O interruption
TC-net10 event processing
state change program (IP6)
notification /* IP6 Program */
IP15 / State change detection
Point No.0 Inf information
GET_IP_INF →Info*/
Block No. ST
Word No. /* When Info point No.=1
Point No.1 Interruption processing for point No.=1
Block No.
Word No.
/* When Info point No.=2
Point No.2
Interruption processing for point No.=2
Block No.
Word No.
When the same I/O interruption task (IP3) is set from the setting screen of I/O state change notification or TC-net100 state
change notification:
• Using the I/O interruption program, state change detection information is read to variable Info with GET_IP_INF instruction.
Interruption processing from the I/O module and interruption processing from TC-net100 can be programmed and executed
as different cases depending on the activation factor read.
When the same I/O interruption task (IP6) is set with multiple point number settings from the setting screen of TC-net100 state
change notification:
• Using the I/O interruption program, state change detection information is read to variable Info with GET_IP_INF instruction.
Interruption processing by TC-net100 point number can be programmed and executed as different cases depending on the
point number read.
Error information:
• If any variable other than static variable, non-tracking type / static variable (unified controller), temporary variable, user
variable, special register (SW) or system variable (ZW), or data register (D) is specified, state change detection information
is not read, and table operation error and error flag are set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
16. I/O Instructions 16-20
Function:
• Performs data I/O of N words, which is specified by a batch I/O variable or by direct notation (%IQ), with the corresponding
I/O module as follows and sets the execution output to ON.
(1) When the corresponding I/O module is an input module
Stores the content input from the input module in batch output variable. (Data input)
(2) When the corresponding I/O module is an output module
Outputs the content of the batch I/O variable to the I/O module. (Data output)
• Performs direct I/O with the I/O module (such as digital I/O, TL-S20, TL-F10, TC-net) assigned to the batch I/O variable.
However, because model 2000 TL-F10 module supports only synchronous mode. Only I/O synchronized with scan is
performed even with this instruction.
• 1 to 64 words may be specified for word count N.
If N > 64: N=64 is assumed.
If N=0: Not executed
• Direct I/O instruction must be specified in I/O module units. Therefore, I/O of multiple I/O modules cannot be processed with
a single direct I/O instruction. In such case, I/O is performed only for the first module and the execution output is reset to
OFF.
• No I/O is performed if the I/O module corresponding to the specified batch I/O variable is not installed or if there is an I/O
fallback.
6F8C1226
16. I/O Instructions 16-21
Program example:
SAMPLE1 IO_T SIGNAL1
1234 1
LD ST
SAMPLE2
4 N SAMPLE1: 4W output
LD module
• Outputs 4W from a batch I/O variable SAMPLE1 to a 4W output module.
Error information:
• No I/O is performed when anything other than batch I/O variable or direct notation (%IQ) is used for batch I/O specification
input.
• When I/O of multiple I/O modules is specified with a single direction I/O instruction, I/O is performed only for the first module.
• If word count N exceeds 64, it is limited to N=64.
• When I/O is specified only for the even number words of an I/O module set up Scan access 2W, I/O is performed only for the
specified even number words.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
16. I/O Instructions 16-22
nv dedicated
I/O I/O Node State Read
instruction
LD/FBD language notation
GET_SIO_STS
Basic unit slot BASESLOT I/O node State
Arguments:
Function:
• I/O node state specified with basic unit slot (BASESLOT) and I/O node number (NODE) is read. The output (I/O node state)
varies depending on the task using this instruction.
• Therefore, in event task - I/O degeneracy task (EV4), the I/O node that was abnormal this time can be identified with this
instruction and special register (SW), or system variable (ZW) I/O degeneracy information (type1:SW[340] to SW[346]
/type2:ZW[300] to ZW[306]).
In event task - I/O degeneracy recovery task (EV6), the I/O node that returned normally this time can be identified with this
instruction and special register (SW), or system variable (ZW) I/O degeneracy recovery information (type1:SW[350] to SW
[356]/type2:ZW[310] to ZW[316]).
• For basic unit slot (BASESLOT), "0" (I/O directly under the controller) is specified.
• For I/O node number (NODE), I/O node number (3 to 34) is specified.
6F8C1226
16. I/O Instructions 16-23
Program example:
[LD/FBD language notation]
Event task - I/O degeneracy task (EV4): [Example for type1]
I
S[340].B[1] S[340].B[3] VAL1
ELSEI
S[340].B[1] S[340].B[3] VAL1
END_FO
ENDIF
ELSEI
S[350].B[1] S[350].B[3] VAL1
ENDIF
Error information:
If the specified I/O node is not registered, or if basic unit slot number or I/O node number exceeds the specification range, the
result is set to OFF.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
16. I/O Instructions 16-25
nV dedicated
I/O I/O Module State Read
instruction
LD/FBD language notation
GET_IO_STS
Basic unit slot BASESLOT I/O module state
Arguments:
Function:
• I/O module state specified with basic unit slot (BASESLOT), I/O node number (NODE), unit number (UNIT), and slot number
(SLOT) is read. The output (I/O module state) varies depending on the task using this instruction.
• Therefore, in event task - I/O degeneracy task (EV4), the I/O module that was abnormal this time can be identified with this
instruction and special register (SW), or system variable (ZW) I/O degeneracy information (type1:SW[340] to SW[346]
/type2:ZW[300]to ZW[306]).
6F8C1226
16. I/O Instructions 16-26
In event task - I/O degeneracy recovery task (EV6), the I/O module that returned normally this time can be identified with this
instruction and special register (SW), or system variable (ZW) I/O degeneracy recovery information (type1:SW[350]to SW
[356]/type2:ZW[310]to ZW[316]).
• For basic unit slot (BASESLOT), "0" (I/O directly under the controller) is specified.
• For I/O node number (NODE), I/O node number (3 to 34) is specified.
• For unit number (UNIT), unit number (1 to 7) is specified.
• For slot number (SLOT), slot number (0 to 15) is specified.
Program example:
[LD/FBD language notation]
Event task - I/O degeneracy task (EV4) :[Example for type1]
I
S[340].B[0] S[340].B[2] VAL1
Indicates the I/O module where the following information is abnormal. Describes the processing related to the I/O module.
1)SW[341] to SW[344]: I/O degeneracy information (Main slot No./node No./unit No./slot No.)
ELSEI
S[340].B[0] S[340].B[2] VAL1
GET_IO_ST IO_O
0
BASESLO
X DINT_TO_UIN NOD
1 UNI
X DINT_TO_UIN SLOT
IO_O
Describes the processing related to the I/O module.
END_FO
END_FO
ENDIF
\
Z1 := DINT_TO_UINT(XI);
Z2 := DINT_TO_UINT(XJ);
IO_OK := GET_IO_STS(0, Z1, 1, Z2)
IF IO_OK = FALSE THEN
(* processing related to the I/O module *)
END_IF
END_FOR;
END_FOR;
END_IF;
Indicates the I/O module where the following information is abnormal recovery. Describes the processing related to the I/O module.
1)SW[351] to SW[354]: I/O degeneracy recovery information (Main slot No./node No./unit No./slot No.)
ELSEI
S[350].B[0] S[350].B[2] VAL1
IO_O
Describes the processing related to the I/O module.
END_FO
END_FO
ENDIF
Error information:
• If the specified I/O module is not registered, or if basic unit slot number or I/O node number exceeds the specification range,
or if unit number or slot number exceeds the specification range, the result is set to OFF.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
16. I/O Instructions 16-29
nV dedicated
I/O I/O Degeneracy Request
instruction
LD/FBD language notation
IOFB_REQ
Basic unit slot BASESLOT Execution
output
I/O node number NODE
Unit number
UNIT
Slot number
SLOT
Modifier EN input Edge execution Index modification
√ √ -
ST language notation Execution output := IOFB_REQ(BASESLOT, NODE, UNIT, SLOT);
Arguments:
Function:
• A degeneracy request is made to the I/O module specified with basic unit slot (BASESLOT), I/O node number (NODE), unit
number (UNIT), and slot number (SLOT).
• For basic unit slot (BASESLOT), “0”(I/O directly under the controller) is specified.
• For I/O node number (NODE), I/O node number (3 to 34) is specified.
• For unit number (UNIT), unit number (1 to 7) is specified.
• For slot number (SLOT), slot number (0 to 15) is specified.
6F8C1226
16. I/O Instructions 16-30
Program example:
[LD/FBD language notation]
SAMPLE2
3
NODE
LD
SAMPLE3
1
UNIT
LD
SAMPLE4
5
LD
SLOT
• The basic unit slot CPU is specified with variable SAMPLE1, I/O node number =3 is specified with variable SAMPLE2, unit
number =1 is specified with variable SAMPLE3, and slot number =5 is specified with variable SAMPLE4.
• A degeneracy request of the I/O module specified with BASESLOT, NODE, UNIT, and SLOT is made.
Error information:
• If the specified I/O module is not registered, or if basic unit slot number or I/O node number exceeds the specification range, or if
unit number or slot number exceeds the specification range, the result is set to OFF.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
16. I/O Instructions 16-31
nv dedicated
I/O I/O Degeneracy Recovery Request
instruction
LD/FBD language notation
IORC_REQ
Basic unit slot BASESLOT Execution
output
I/O node number NODE
Unit number UNIT
Slot number SLOT
Arguments:
Function:
• A degeneracy recovery request is made to the I/O module specified with basic unit slot (BASESLOT), I/O node number
(NODE), unit number (UNIT), and slot number (SLOT).
• For basic unit slot (BASESLOT), “0”(I/O directly under the controller) is specified.
• For I/O node number (NODE), I/O node number (3 to 34) is specified.
• For unit number (UNIT), unit number (1 to 7) is specified.
• For slot number (SLOT), slot number (0 to 15) is specified.
6F8C1226
16. I/O Instructions 16-32
Program example:
[LD/FBD language notation]
IORC_REQ SIGNAL1
SAMPLE1
0 BASESLOT
LD
SAMPLE2
3 NODE
LD
SAMPLE3
1 UNIT
LD
SAMPLE4
5 SLOT
LD
• The basic unit slot CPU is specified with variable SAMPLE1, I/O node number =3 is specified with variable SAMPLE2, unit
number =1 is specified with variable SAMPLE3, and slot number =5 is specified with variable SAMPLE4.
• A degeneracy recovery request of the I/O module specified with BASESLOT, NODE, UNIT, and SLOT is made.
Error information:
• If the specified I/O module is not registered, or if basic unit slot number or I/O node number exceeds the specification range,
or if unit number or slot number exceeds the specification range, the result is set to OFF.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-1
17 Process Operation
DB_xxx
Data input IN Output
Diagram
Dead band width H
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description
IN See below √ Data input
Input
H See below √ Dead band width
Output — See below — Output
Function:
For data specified with data input IN and dead band width H, if data input IN is outside the dead band width H, the result of
subtracting dead band width H from data input IN is output.
For data specified with data input IN and dead band width H, if data input IN is inside the dead band width H, 0 is output.
Condition Action
When data IN > 0
Result=IN-|H|
|IN| > |H|
When data IN < 0
Result=IN+|H|
|IN| ≤ |H| Result=0
6F8C1226
17. Process Operation 17-3
Program example:
SAMPLE1 DB_INT SAMPLE3 Result output
140 IN 40
LD ST
SAMPLE2
-100 H
LD
H H Data input IN
Dead band width H
Performs dead band operation of the input data 140 in variable SAMPLE1 and dead band width 100 in variable SAMPLE2
and stores the difference 40 between the input data and dead band width in variable SAMPLE3 because the data input
exceeds the dead band width.
Error information:
When input data type is REAL, if NAN data is entered as input, the result is NAN.
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-4
Instance name
DIF2
Execution flag E OUT Output
Diagram
Data input IN
Rate time T
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
Input IN REAL √ Data input
T REAL √ Rate time (sec)
Output OUT REAL — Output
Instance structure:
Name Type Description
OUT REAL Derivative result output
B4X REAL Previous input (Xn-1)
B4Y REAL Previous output (Yn-1)
Function:
When Execution Flag E is OFF, Output OUT becomes zero.
When Execution Flag E is ON, Output OUT becomes (T・S)/(1+T・S).
The unit of rate time T is seconds. The absolute value of the input data is used as rate time T.
Differentiation is performed by backward difference method.
DIF2 instance
Execution flag E Action
preprocessing
Xn-1 = Xn Yn= (Xn - Xn-1 +Yn-1) • T / (CT+T)
OFF Yn-1 = 0
T :Rate time
ON — CT :Control scan time
Xn :Current input
Xn-1:Previous input
Yn :Current output
Yn-1: Previous output
Important:
The scan time of the task using this instruction must be in constant scan mode. (S controller only)
6F8C1226
17. Process Operation 17-5
Program example:
DIF2_01
SIGNAL1 DIF2 SAMPLE3 Control time CT=0.5 seconds
E OUT 150.0
ST Instance content (DIF2_01)
SAMPLE1 (beforeafter operation)
1000.0 IN
LD B4X(Xn-1) :100.01000.0
SAMPLE2
B4Y(Yn-1) :0.0150.0
0.1 T
LD
When the variable SIGNAL1 is ON, performs differential operation using input data 1000.0 in variable SAMPLE1, rate time
0.1 in variable SAMPLE2, and instance variable DIF2_01, and stores the differential result 150.0 in variable SAMPLE3.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If the scan time of the task using this instruction is in floating scan mode, no operation is performed and the specific register
Error Flag is set to ON. (S controller only)
6F8C1226
17. Process Operation 17-6
Instance name
INTG
Execution flag E OUT Output
Integral time T
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
IN REAL √ Data input
Input
T REAL √ Integral time (sec)
INI REAL √ Initial value
Output OUT REAL — Output
Instance structure:
Name Type Description
OUT REAL Integral result output
B4Y REAL Previous output (Yn-1)
Function:
When Execution Flag E is OFF, initial value INI is output.
When Execution Flag E is ON, integration is performed.
The unit of integral time T is seconds. The absolute value of the input data is used as integral time T.
INTG instance
Execution flag E Action
preprocessing
Result = INI
OFF -
Yn = INI
In case T=0 :Yn = Yn-1
In case T <> 0 :Yn = Xn • CT / T + Yn-1
T :Integral time
ON - CT :Control scan time
Xn :Current input
Yn :Current output
Yn-1 :Previous output
6F8C1226
17. Process Operation 17-7
Important:
The scan time of the task using this instruction must be in constant scan mode. (S controller only)
Program example:
INTG_01
SIGNAL1 INTG SAMPLE4 Control time CT=0.5 seconds
E OUT 50.0
ST
SAMPLE1
Instance content (INTG_01)
100.0 IN (beforeafter operation)
LD B4Y(Yn-1) :0.050.0
SAMPLE2
1.0 T
LD
SAMPLE3
0.0 INI
LD
When variable SIGNAL1 is ON, performs integration operation using input data 1000.0 in variable SAMPLE1, integral time
1.0 in variable SAMPLE2, initial value 0.0 in variable SAMPLE3, and instance variable INTG_01, and stores the integration
result 50.0 in variable SAMPLE4.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If the scan time of the task using this instruction is in floating scan mode, no operation is performed and the specific register
Error Flag is set to ON. (S controller only)
6F8C1226
17. Process Operation 17-8
Instance name
PID2
Execution flag E D_MV MV output
SV input SV
Diagram
PV input PV
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
SV REAL √ SV input [Engineering value]
Input PV REAL √ PV input [Engineering value]
PV_P PTR — PV parameter variable
LP_P PTR — LP parameter variable
Output D_MV REAL — MV output [%]
Pointers to tag table are placed in PV parameter variable and LP parameter table.
The following symbols are referenced by PV_P and LP_P. The structure of the PV/LP parameters are described at the end of
this section.
Operand Symbol Type R/W Description
PV_P RH REAL R PV range high [Engineering unit]
(PV_PARA) RL REAL R PV range low [Engineering unit]
LP_P KP REAL R Proportional gain
(LP_PARA) TI REAL R Integral time [minute]
TD REAL R Rate time [minute]
ALP REAL R 2DOF proportionality coefficient
CDR BOOL R Control direction (reverse=0/direct=1)
R/W: R=Read only, W=Write only, RW=Read/Write
Instance structure:
Name Type Description
D_MV REAL MV difference output (MV)[%]
B4SV REAL SV previous value (SVn-1) [%]
SVF REAL SV calculation intermediate value [%]
B4E REAL Deviation previous value (En-1) [%]
B4D REAL Differential previous value (Dn-1) [%]
B4PV REAL PV previous value (PVn-1) [%]
6F8C1226
17. Process Operation 17-9
Function:
When the Execution Flag E is OFF, initializes the PID2 instance area.
When Execution Flag E is ON, performs two degrees of freedom PID operation.
Super two degrees of freedom PID (where =1.0 and =0) is used for PID operation.
Backward difference method is used for operation of the derivative term. (=0.1)
Direct I/O variables cannot be specified for PV parameter variable or LP parameter variable. (S controller only)
PV/LP parameter specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
PID2 instance
Execution flag E Action
preprocessing
SVn-1 = SVn
SVF = SVn SVF = SVn • CT / (CT+TI)
en-1 = SVF - PVn + α • (SVn - SVn-1) • TI / (CT + TI)
Dn-1 = 0 + SVF • TI / (CT + TI)
PVn-1 = PVn ∆MV = (SVF - PVn) - en-1
en = SVF - PVn
OFF
In case TI <> 0:
∆MV = ∆MV+CT • en / TI
In case TD <> 0:
∆D=(-PVn+PVn-1) • TD / (CT+0.1•TD)
- Dn-1 • CT / ( CT+0.1 • TD)
∆MV = ∆MV+∆D
Dn= Dn+ ∆D
In case TD=0:
Dn=0
∆MV = ∆MV • Kp
In case CDR=1:
∆MV = - ∆MV
ON —
Kp :Proportional gain
TI :Integral time
TD :Rate time
CT :Control scan time
: coefficient
SVn :Current setting value
SVn-1 :Previous setting value
en :Current deviation
en-1 :Previous deviation
PVn :Current process value
PVn-1 :Previous process value
MV :Output
D :Differential term
Dn :Current differential term
Dn-1 :Previous differential term
6F8C1226
17. Process Operation 17-10
Important:
The scan time of the task using this instruction must be in constant scan mode. (S controller only)
Program example:
PID2_01
SIGNAL1 PID2 SAMPLE4 Control time CT=0.5 seconds
E D_MV -73.61369
ST
SAMPLE1
500.0 SV
LD
SAMPLE2
0.0 PV
LD
PV_PARA
[n].TAG PV_P
LD
LP_PARA
[m].TAG LP_P
LD
When variable SIGNAL1 is ON, performs two degrees of freedom PID operation using SV input data 500.0 in variable
SAMPLE1, PV input data 0.0 in variable SAMPLE2, PV parameter variable PV_P, and LP parameter variable LP_P and
stores the result in variable SAMPLE4.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If RH=RL, the Divide Error Flag is set to ON and 0 is output.
If the PV parameter or LP parameter specification is invalid (such as specifying variable other than PV/LP tag parameter),
Table Operation Error is set to ON and 0 is output. (L controller only)
If direct I/O variable is specified for PV parameter variable and LP parameter variable, no operation is performed and the
specific register Error Flag is set to ON. (S controller only)
If the scan time of the task using this instruction is in floating scan mode, no operation is performed and the specific register
Error Flag is set to ON. (S controller only)
6F8C1226
17. Process Operation 17-11
Instance name
MVS
Execution flag E OUT Output
MV difference input IN
Diagram
MV initial value MV0
MV input MV
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
IN REAL √ MV difference input [%]
Input MV0 REAL √ MV initial value[%]
MV REAL √ MV input[%]
LP_P PTR — LP parameter variable
Output OUT REAL — Output [%]
A pointer to tag table is placed in LP parameter variable.
The following symbols are referenced by LP_P. The structures of the LP parameters are described at the end of this section.
Operand Symbol Type R/W Description
DMV REAL R MV rate limit [%]
LP_P
MH REAL R MV high limit [%]
(LP_PARA)
ML REAL R MV low limit [%]
R=Read only, W=Write only, RW=Read/Write
Instance structure:
Name Type Description
OUT REAL Output (MV) [%]
MVW REAL MV work [%]
Function:
When the Execution Flag is OFF, performs MV operation and outputs the result.
When the Execution Flag is ON, performs tracking operation and outputs the result.
The MVS instruction does not set output in MV of LP tag data. Store instruction must be used to set the output of the MVS
instruction to MV of the LP tag data.
6F8C1226
17. Process Operation 17-12
Direct I/O variables cannot be specified for LP parameter variables. (S controller only)
LP parameter specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
Program example:
MVS_01
SIGNAL1 MVS LP_DATA[m].MV
0 60.0 LP parameter (LP_P)
E OUT
LD ST
SAMPLE1
10.0 IN 100.0 DMV
LD 125.0 MH
SAMPLE2 -25.0 ML
50.0 MV0
LD
LP_DATA[m].MV
50.0 MV
LD
LP_PARA
[m].TAG LP_P
LD
When the variable SIGNAL1 is OFF, MV operation is performed against the MV difference input 10.0 in variable SAMPLE1
using the MV input and LP parameter LP_P, and the result 60.0 is stored in LP_DATA[m].MV.
6F8C1226
17. Process Operation 17-13
Error information:
If NAN data is entered in input data, the result is output as NAN.
If the LP parameter specification is invalid (such as specifying variable other than LP tag parameter), Table Operation Error
is set to ON and 0 is output. (L controller only)
If direct I/O variable is specified for LP parameter variable, no operation is performed and the specific register Error Flag is
set to ON. (S controller only)
6F8C1226
17. Process Operation 17-14
MVF
Execution flag E Q Output
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
Input
IN REAL √ MV fixed value[%]
Input/Output LP_D PTR — LP data variable
Output — REAL — Output
A pointer to tag table is placed in LP data variable.
The following symbols are referenced by LP_D. The structure of the LP data is described at the end of this section.
Operand Symbol Type R/W Description
LP_D MV REAL W MV value[%]
(LP_DATA) SMV BOOL W SEQ-MV operation
R/W : R=Read only, W=Write only
Function:
When Execution Flag E is ON, registers the MV fixed value (set SMV flag).
When Execution Flag E is OFF, unregisters the MV fixed value (reset SMV flag).
Direct I/O variables cannot be specified for LP data variables. (S controller only)
LP data specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
Important:
When the MVF instruction is used, the LP data variable SMV flag is used exclusively (ON when E input is TRUE and OFF
when FALSE). To use the SMV flag in other applications, the MVF instruction must be removed or processing must be
stopped by resetting EN to OFF.
Program example:
SIGNAL1 MVF SAMPLE3
0 E 80.0
LD ST
SAMPLE1
80.0 IN
LD
LP_DATA LP_DATA
[m].SV LP_D LP_D [m].SV
LD LD
When variable SIGNAL1 is ON, stores the MV input 80.0 specified with variable SAMPLE1 in LP data MV and sets the SMV
flag. When variable SIGNAL1 is OFF, the SMV flag is reset.
Input value SAMPLE1 is output to SAMPLE3 unchanged.
6F8C1226
17. Process Operation 17-15
Error information:
If NAN data is entered in input data, the result is output as NAN.
If the LP data specification is invalid (such as specifying variable other than LP tag data), Table Operation Error is set to ON
and 0 is output. (L controller only)
If direct I/O variable is specified for LP data variable, no operation is performed and the specific register Error Flag is set to
ON. (S controller only)
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-16
PLN_xxx
Data input IN Output
Diagram
Polynomial line table TBL
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description
IN See below √ Data input
Input
TBL PTR — Polygonal line table
Output — See below — Output
PLN_xxx
Data input IN Output
Function:
With the input data IN as X axis input, outputs the Y axis approximation result using the function table specified with the
polygonal line table TBL.
The size and structure of the polygonal line table are as follows. Different table formats are used for INT data and REAL
data.
[PLN_INT] [PLN_REAL]
Maximum points: 40 Maximum points: 11
Table top address: Point n When less than 11 points: Add two end codes (H80000000)
15 0 31 0
Number of points n X0
X0 Y0
Y0 X1
X1 Y1
11 points maximum
Y1 40 points maximum
Data must be stored in the polygonal table such that X0 < X1 <・・・Xn-1.
When data input IN ≤ X0, the corresponding Y value is Y0 and when data input IN ≥ Yn-1, the Y value is Yn-1.
Direct I/O variable cannot be specified for polygonal line table.
Table specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
Program example:
6F8C1226
17. Process Operation 17-17
Y
SAMPLE2:Polynomial line table
100
-100 X0 SAMPLE3:80
50 Y0
-50 X1
-100 Y1
0 X2
X
0 Y2 -100 IN 100
50 X3
100 Y3
100 X4
-100 Y4
-100
For input data in variable SAMPLE1, calculates the Y corresponding to input data 40 based on polygonal line table specified
with variable SAMPLE2 and stores the result 80 in SAMPLE3.
Error information:
When input data type is REAL, if NAN data is entered as input, the result is NAN.
If direct I/O variable is specified for polygonal line table, no operation is performed and the specific register Error Flag is set
to ON.
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-18
nv dedicated
Process Operation Polygonal Line Function (high-speed version)
instruction
LD/FBD language PLN_REAL2
notation
Data input IN Output
Polygonal line
table TBL
Modifier EN input Edge execution Index modification
√ √ -
ST language notation Output := PLN_REAL2 (IN, TBL);
Arguments:
Function:
With the input data IN as X axis input, the Y axis approximation result is output using the function table specified with the
polygonal line table TBL.
The size and structure of the polygonal line table are as follows.
Xn-1
Yn-1
Data must be stored in the polygonal line table such that X0 < X1 <・・・Xn-1.
When data input IN ≦ X0, the corresponding Y value is Y0 and when data input IN ≧Xn-1, the Y value is Yn-1.
Output = (IN-Xn-1) (Yn-Yn-1)/(Xn-Xn-1)+Yn-1
Where Xn-1 and Xn are values enclosing input data IN (Xn-1≦IN<Xn) and Yn-1 and Yn correspond to Xn-1 and Xn.
6F8C1226
17. Process Operation 17-19
Program example:
[LD/FBD language notation]
SAMPLE1 PLN_REAL2 SAMPLE3 Structure declaration: type PLN_REAL2
40 IN 80 Member name Data type
LD ST
NUM DINT
SAMPLE2
5 TBL POINT ARRAY [0..21] OF REAL
LD
Variable declaration
Variable Data type Dec.
name
SAMPLE2: Polygonal line table
SAMPLE1 REAL VAR
5 NUM SAMPLE2 type PLN_REAL2 VAR
Y
-100 X0
100
50 Y0
SAMPLE3:80
-50 X1
-100 Y1
0 X2
0 Y2
X
50 X3 -100 IN 100
100 Y3
100 X4
-100 Y4
-100
Error information:
When polygonal line table exceeds the variable area, the polygonal line function is not processed, and data boundary over
occurs.
When input data type is REAL, the operation is as follows.
Controller Action
Unified Controller nv series Nonnumeric and infinite data is limited to the maximum value in calculation.
When I/O variable is specified directly for polygonal line table, the operation is as follows.
Controller Action
Unified Controller nv series Error flag and table operation error are set to ON, and Result =0.
ILNL_xxx
Data input IN Output
Diagram
Polynomial line table TBL
Arguments:
The following data types are supported for input and output arguments and the instruction symbol depends on the data type:
Arg. Operand Type Const. Description
IN See below √ Data input
Input
TBL PTR — Polygonal line table
Output — See below — Output
ILNL_xxx
Data input IN Output
Function:
With the input data IN as Y axis input, outputs the X axis approximation result using the function table specified with the
polygonal line table TBL.
The size and structure of the polygonal line table are as follows.
[ILNL_INT] [ILNL_REAL]
Maximum points: 40 Maximum points: 11
Table top address: Point n When less than 11 points: Add two end codes (H80000000)
15 0 31 0
Number of points n X0
X0 Y0
Y0 X1
X1 Y1
11 points maximum
Y1 40 points maximum
Data must be stored in the polygonal table such that X0 < X1 <・・・ Xn-1.
If data input IN intersects the polygonal line at two or more places, the one with the smallest X value has priority.
6F8C1226
17. Process Operation 17-21
X
Output
If data input IN is outside the range of Y axis on the polygonal line table, the X value for the maximum (or minimum) Y value
on the polygonal line table is output.
Y
a
(X5,Y5) Output X5 when input value is a
Output X2 when input value is b
(X0,Y0) (X4,Y4)
(X1,Y1) (X3,Y3)
(X2,Y2)
b
X
X2 X5
Program example:
SAMPLE1 ILNL_REAL SAMPLE3 Variable declaration
80 IN 40
LD ST Variable Data type Comment Dec.
SAMPLE2 SAMPLE1 Real Data Input VAR
4 TBL
SAMPLE2 Array[0..21] Polynomial line VAR
LD
of Real table
For input data in variable SAMPLE1, calculates the X corresponding to input data 80 based on polygonal line table specified
with variable SAMPLE2 and stores the result 40 in SAMPLE3.
Error information:
When input data type is REAL, if NAN data is entered as input, the result is NAN.
If direct I/O variable is specified for polygonal line table, no operation is performed and the specific register Error Flag is set
to ON.
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-23
Arguments:
Function:
With the input data IN as Y axis input, the X axis approximation result is output using the function table specified with the
polygonal line table TBL.
The size and structure of the polygonal line table are as follows.
Xn-1
Yn-1
Data must be stored in the polygonal line table such that X0 < X1 <・・・ Xn-1.
If data input IN intersects the polygonal line at two or more places, the one with the smallest X value has priority.
6F8C1226
17. Process Operation 17-24
Output X
If data input IN is outside the range of Y axis on the polygonal line table, the X value for the maximum (or minimum) Y value
on the polygonal line table is output.
Y
a
(X5,Y5) 入力値がaの場合は X5value
Output X5 when input を出力 is a
(X0,Y0) 入力値がbの場合は X2value
Output X2 when input を出力 is b
(X4,Y4)
(X1,Y1) (X3,Y3)
(X2,Y2)
b
X2 X5 X
Xn - X n-1
f(x)=(IN-Yn-1) + X n-1
Yn - Y n-1
Where Yn-1 and Yn are values enclosing input data IN (Yn-1≦IN<Yn) and Xn-1 and Xn correspond to Yn-1 and Yn.
When point count =0 is specified, Result = Input data.
6F8C1226
17. Process Operation 17-25
Program example:
[LD/FBD language notation]
SAMPLE1 ILNL_REAL2 SAMPLE3 Structure declaration: type ILNL_REAL2
80 IN 80 Member name Data type
LD ST
NUM DINT
SAMPLE2
TBL POINT ARRAY [0..21] OF REAL
5
LD
Variable declaration
Variable Data type Dec.
SAMPLE2: Polygonal table Name
SAMPLE1 REAL VAR
5 NUM SAMPLE2 type ILNL_REAL2 VAR
-100 X0 Y
50 Y0 100
-50 X1 IN
-100 Y1
0 X2
0 Y2
50 X3 X
100 Y3 -100 100
100 X4
-100 Y4 SAMPLE3:40
-100
For input data in variable SAMPLE1, the X corresponding to input data 80 is calculated based on polygonal line table
specified with variable SAMPLE2. The result "40" is stored to variable SAMPLE3.
Error information:
When polygonal line table exceeds the variable area, the inverse polygonal line function is not processed, and data
boundary over occurs.
When input data type is REAL, the operation is as follows.
Controller Action
Unified Controller nv series Nonnumeric and infinite data is limited to the maximum value in calculation.
When I/O variable is specified directly for polygonal line table, the operation is as follows.
Controller Action
Unified Controller nv series Error flag and table operation error are set to ON, and Result =0.
DT
Execution flag E Output
Data input IN
Sampling time T
Work M M Work
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
IN REAL √ Data input
Input
I INT √ Sample number
T INT √ Sampling time (0.1 sec. unit)
Input/Output M PTR — Work (6+I2 words)
Output — REAL — Output
Function:
When Execution Flag E is OFF, data input IN is output as the result.
When the Execution Flag is ON, dead time operation is performed for data input IN and the result is output.
Sampling time is set in 0.1 second units.
Sampling number must be between 1 and 256.
If sampling time T > scan time, linear interpolation is performed between samples.
If sample number I ≤ 0, no dead time operation is performed.
If the sample number is changed during dead time operation, the result is unpredictable.
Specify the data save area used by the DT instruction for work. The size of the work depends on the sample number I (6+I2
words).
Direct I/O variable cannot be specified for work.
Work specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
6F8C1226
17. Process Operation 17-27
Sample value
(I2 words)
Program example:
SIGNAL1 DT SAMPLE4 Arg. declaration
1 E 20 Variable Data type Dec. Comment
LD ST
SIGNAL1 BOOL VAR Execution flag
SAMPLE1
160 IN
SAMPLE1 REAL VAR Data input
LD SAMPLE2 INT VAR Sampling time
SAMPLE3 ARRAY[0..11] VAR W ork
3 I OF INT
LD
SAMPLE4 REAL VAR Result output
SAMPLE2
10 T
LD
SAMPLE3 SAMPLE3
5 M M
LD ST
6F8C1226
17. Process Operation 17-28
Input X
Scan time
(0.5[s])
Sampling period
(10 [0.1s])
Output Y
20 160
40 40
When the execution flag in variable SIGNAL1 is ON, dead time operation is performed using data input in variable
SAMPLE1, sample number 3, sample period in variable SAMPLE2, and work specification in variable SAMPLE3. The result
is stored in variable SAMPLE4.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If the sample number exceed 256, operation is performed with 256 as the limit.
If the sample number is changed during dead time operation, the result is unpredictable.
Do not write to work. The result is unpredictable.
If direct I/O variable is specified for work, no operation is performed and the specific register Error Flag is set to ON.
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-29
MAV
Execution flag E Output
Data input IN
Sample period T
Work M M Work
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
IN REAL √ Data input
Input
I INT √ Number of Samples
T INT √ Sampling period (0.1 sec. unit)
Input/Output M PTR — Work (6+I2 words)
Output — REAL — Output
Function:
When Execution Flag E is OFF, data input IN is output as the result.
When the Execution Flag is ON, moving average operation is performed for data input IN and the result is output.
Sampling time is set in 0.1 second units.
Sample number must be between 1 and 256.
When sampling time T > scan time, the output at sampling time is output once more (retained).
When sample number I ≤ 0, no moving average operation is performed.
If the sample number is changed during moving average operation, the result is unpredictable.
Specify the data save area used by the MAV instruction for work. The size of the work depends on the sample number I
(6+I2 words).
Direct I/O variable cannot be specified for work variable.
Work specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
6F8C1226
17. Process Operation 17-30
Sample value
(I2 words)
Program example:
SIGNAL1 MAV SAMPLE4 Arg. declaration:
1 E 93.333 Variable Data type Dec. Comment
LD ST
SIGNAL1 BOOL VAR Execution flag
SAMPLE1
160 IN SAMPLE1 REAL VAR Data input
LD SAMPLE2 INT VAR Sampling time
SAMPLE3 ARRAY[0..11] VAR Work
3 I OF INT
LD
SAMPLE2
SAMPLE4 REAL VAR Result output
10 T
LD
SAMPLE3 SAMPLE3
5 M M 0
LD ST
6F8C1226
17. Process Operation 17-31
(6) (7)
(8)
Input X (5)
(9)
(4) (10)
(3)
(2)
(1)
Scan time
(0.5[s])
Sampling period
(10[0.1s])
((5)+(6)+(7))/3 ((6)+(7)+(8))/3
Output Y ((4)+(5)+(6))/3
((2)+(3)+(4))/3 ((7)+(8)+(9))/3
((8)+(9)+(10))/3
((3)+(4)+(5))/3
20 160
40 40
When the execution flag in variable SIGNAL1 is ON, moving average operation is performed using data input in variable
SAMPLE1, sample number 3, sample period in variable SAMPLE2, and work specification in variable SAMPLE3. The result
is stored in variable SAMPLE4.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If the sample number exceed 256, operation is performed with 256 as the limit.
If the sample number is changed during moving average operation, the result is unpredictable.
Do not write to work. The result is unpredictable.
If direct I/O variable is specified for work, no operation is performed and the specific register Error Flag is set to ON.
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-32
Data IN
Sample I
Sampling cycle T
Work M M Work
Arguments:
Function:
When execution flag E is OFF, data input IN is output as the result.
When execution flag E is ON, moving average operation is performed for data input IN and the result is output.
Sampling time is set in 0.1 second units.
Sample count must be between 1 and 256.
When sampling time T > scan time, the output at sampling time is output once more (retained).
When sample number I ≦ 0, no moving average operation is performed.
If the sample number is changed during moving average operation, the result becomes undefined.
Specify the data save area used by the MAV instruction for work. The size of the work depends on the sample count I (6+I2
words).
I/O variable cannot be specified directly for work.
6F8C1226
17. Process Operation 17-33
15 0
Timer counter
Sample data counter
Current output
[2 words]
Sample value total
[2 words] Maximum number
of words: 518 words
(6+2562 words)
Sample value
(I2 Words)
● Important
・If sample count is changed during moving average operation, the result output becomes
unstable.
・Do not write to work. The result output becomes undefined.
・The difference between Moving Average (low speed version) and Moving Average (high speed
version) is in the summation operation to calculate the moving average. The following table
describes the algorithm, advantage, and disadvantage of using the summation operation to
be considered.
Program example:
[LD/FBD language notation]
SIGNAL1 MA _ SAMPLE4
1 E 93.333
L ST
S MPLE1 Arg.declaratio
16 I
L Variable Data Commen Dic
SIGNAL BOOL Execution flag VAR
3 I SAMPLE REAL Data input VAR
L Sampling cycle VAR
SAMPLE INT
SAMPLE2 SAMPLE ARRAY[0..11] OF INT Work VAR
1 T
SAMPLE REAL Result output VAR
L
SAMPLE3 SAMPLE3
5 M M 0
L ST
When the execution flag in variable SIGNAL1 is ON, moving average operation is performed using data input in variable
SAMPLE1, sample number 3, sample cycle in variable SAMPLE2, and work specification in variable SAMPLE3. The result
is stored in variable SAMPLE4.
Error information:
When work exceeds the variable area, moving average is not processed, and data boundary over occurs.
When input data type is REAL, the operation is as follows.
Controller Action
Integrated Controller V series Nonnumeric and infinite data is limited to the
Unified Controller nv series maximum value in calculation.
Controller Action
Integrated Controller V series Error flag is set to ON, and Result =0.
Error flag and table operation error are set to ON,
Unified Controller nv series
and Result =0.
When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-35
Instance name
DLM_xxx
Execution flag E OUT Output
Diagram
Data input IN
Rate limit D
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
Input IN See below √ Data input
D See below √ Rate limit
Output OUT See below — Output
Instance name
DLM_xxx
Execution flag E OUT Output
Data input IN
Rate-of-change limit D
Instance structure:
Name Type Description
OUT See above Output
B4Y See above Previous output (Yn-1)
6F8C1226
17. Process Operation 17-36
Function:
When Execution Flag E is OFF, data input IN is output as the result.
When the Execution Flag E is ON, the rate limit is calculated for data input IN and the result is output.
Execution flag E Action
OFF Result output = IN
Difference = IN - Yn-1
In case +|D| ≥ Difference ≥ –|D|: Yn=IN
In case +|D| < Difference: Yn = Yn-1 + |D|
When –|D| > Difference: Yn = Yn-1 - |D|
Program example:
DLM_01
SIGNAL1 DLM_REAL SAMPLE3
1 E OUT 100
LD ST
SAMPLE1
120 IN
LD
SAMPLE2
50 D
LD
When the variable SIGNAL1 is ON, rate limit is calculated for data input 120 in variable SAMPLE1 using the rate limit 50 in
variable SAMPLE2 and previous output B4Y 50 stored in instance variable DLM_01, and the result 100 is stored in variable
SAMPLE3.
Error information:
When input data type is REAL, if NAN data is entered as input, the result is NAN.
6F8C1226
17. Process Operation 17-37
Instance name
LAG2
Execution flag E OUT Output
Lead time T1
Lag time T2
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution flag
IN REAL √ Data input
Input
T1 REAL √ Lead time (second)
T2 REAL √ Lag time (second)
Output OUT REAL — Output
Instance structure:
Name Type Description
OUT REAL Output
B4X REAL Previous input (Xn-1)
B4Y REAL Previous output (Yn-1)
Function:
When Execution Flag E is OFF, data input IN is output as the result.
1 T1 S
When the Execution Flag E is ON, X is calculated for data input IN and the result is output.
1 T2 S
The absolute values of lead time T1 and lag time T2 are used for the operation.
T1 :Lead time
T2 :Lag time
CT :Control scan time
Xn :Current input
Xn-1 :Previous input
Yn :Current output
Yn-1 :Previous output
6F8C1226
17. Process Operation 17-38
Important:
The scan time of the task using this instruction must be in constant scan mode. (S controller only)
Program example:
LAG2_01
SIGNAL1 LAG2 SAMPLE4 Before operation :Instance (LAG2_01)
1 E OUT 712.0
LD ST 1000.0 B4X
SAMPLE1 640.0 B4Y
1000.0 IN
LD
SAMPLE2
1.0 T1
LD After operation :Instance (LAG2_01)
SAMPLE3 1000.0 B4X
2.0 T2 712.0 B4Y
LD
When variable SIGNAL1 is ON, lag/lead filter operation is performed for data input 1000.0 in variable SAMPLE1 using the
lead time 1.0 in variable SAMPLE2, lag time 2.0 in variable SAMPLE3, and instance variable LAG2_01, and the result 712.0
is stored in variable SAMPLE4.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If the scan time of the task using this instruction is in floating scan mode, no operation is performed and the specific register
Error Flag is set to ON. (S controller only)
6F8C1226
17. Process Operation 17-39
UNT
Data input IN Output
Diagram
PV parameter PV_RH
Arguments:
Arg. Operand Type Const. Description
IN REAL √ Data input [%]
Input
PV_RH PTR — PV parameter (RH)
Output — REAL — Output [Engineering unit]
Function:
Converts data input IN to engineering units from range high limit (RH) and range low limit (RL) of PV parameter table and
outputs the result.
The structure of the PV parameters is described at the end of this chapter.
Direct I/O variable cannot be specified for PV parameter. (S controller only)
PV parameter specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
Output = (RH - RL) / 100 ( Input + RL
Program example:
EMBED Word.Picture.8
Performs engineering unit conversion of the data input 80.0 in variable SAMPLE1 using RH100.0 and
RL100.0 in the PV parameter variable and stores the result 60.0 in variable SAMPLE2.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If direct I/O variable is specified for PV parameter, no operation is performed and the specific
register Error Flag is set to ON. (S controller only)
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-40
PCT
Data input IN Output
Diagram
PV parameter PV_RH
Arguments:
Arg. Operand Type Const. Description
IN REAL √ Data input [Engineering unit]
Input
PV_RH PTR — PV parameter (RH)
Output — REAL — Output [%]
Function:
Converts data input IN to % from range high limit (RH) and range low limit (RL) of PV parameter table and outputs the result.
The structure of the PV parameters is described at the end of this chapter.
Direct I/O variable cannot be specified for PV parameter. (S controller only)
PV parameter specification Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
Output = 100 / (RH - RL) (Input - RL)
Program example:
SAMPLE1 PCT SAMPLE2 PV parameter
80.0 IN 90.0 PV_PARA[n].RH = 100.0
LD ST PV_PARA[n].RL = -100.0
PV_PARA[n].RH
100.0 PV_RH
LD
Performs reverse engineering unit conversion of the data input 90.0 in variable SAMPLE1 using RH100.0 and RL-100.0 in
the PV parameter variable and stores the result 80.0 in variable SAMPLE2.
Error information:
If NAN data is entered in input data, the result is output as NAN.
If RH=RL, the Divide Error Flag is se to ON due to zero divide and the output is as follows:
Output = (+Infinity when Input > RL, -Infinity when Input < RL)
If direct I/O variable is specified for PV parameter, no operation is performed and the specific register Error Flag is set to ON.
(S controller only)
If EN is included, ENO output is reset to OFF when the above error occurs.
6F8C1226
17. Process Operation 17-41
Arguments:
Arg. Operand Type Const. Description
E BOOL √ Execution control input
Input
LP_P PTR — LP parameter
Output Q BOOL — Execution output
MV REAL — Manipulated value
I/O PV_D PTR — PV data/setting
The structures of the PV_D and LP_P parameters are described at the end of this chapter.
Parameter Structure:
PV data/setting
Name Type Description Unit
PVC REAL Process measurement input (Range: 0.0 to 100.0) %
ASV REAL Auto mode setting (Range: 0.0 to 100.0) %
CSV REAL Cascade mode setting (Range: 0.0 to 100.0) %
MMV REAL Manual mode manipulated value input (Range: -25.0 to 125.0) %
TMV REAL MV tracking input (Range: -25.0 to 125.0) %
MODE DWORD Mode setting
31 2 1 0
TR MODE
LP parameter
Name Type Description Unit
Kp REAL Proportional gain
TI REAL Integral time min.
TD REAL Rate time min.
GP REAL Gap (Range: 0.0 to 10.0) %
ISV REAL Auto mode setting initial value (Range: 0.0 to 100.0) %
FT REAL Process input filter coefficient (Range: 0.1 to < 1)
DSV REAL Setting ASV rate-of-change limit % / t
DMMV REAL Manual mode manipulated value MMV rate-of-change limit % / t
STS DWORD Status
31 2 1 0
DR IMODE
Initial mode specification IMODE: bits <1 to 0>
00: Manual mode
01: Auto mode
10: Cascade mode
11: (Auto mode)
Polarity D/R specification DR: bit <2>
0: Direct
1: Reverse
MH REAL Manipulated value high limit (Range: -25.0 to 125.0) %
When MH < ML, MH=ML is assumed.
ML REAL Manipulated value low limit (Range: -25.0 to 125.0) %
DMV REAL Manipulated value rate-of-change limit % / t
N REAL Control cycle setting (Range: N ≥ 1)
PID operation is performed every N scan.
When N ≤ 0, N=1 is assumed.
Instance structure:
Name Type Description Unit
Q BOOL Execution output
MV REAL Manipulated value (Range: -25.0 to 125.0) %
B4E REAL Previous error (en-1)
B4D REAL Previous derivative term (Dn-1)
B4PV REAL Previous PV (PVn-1)
B4SV REAL Previous SV (SVn-1)
MVN REAL Current manipulated value
C REAL Internal counter
Counts the number of scans.
Decrements internal counter each scan starting from C=N. When
C ≤ 0, PID operation is performed and C is set equal to N once more.
DT0 REAL Control cycle (Δt) Sec.
* In Function - [Algorithm], this is denoted with the symbol in parentheses in the Description column.
6F8C1226
17. Process Operation 17-43
Function:
Performs Essential Succession (Pre-derivative real PID algorithm) PID operation as follows for PV data/setting stored in
PV_D based on the parameter specified with LP_P and outputs the manipulated value MV as the result.
The execution control input E and execution output Q are set as follows:
Execution control input E Action Execution
output Q
OFF Initialized OFF
C≤0 Executed ON
ON
C>0 Not executed OFF
Direct I/O variables cannot be specified for PV_D data/setting and LP parameter variables.
PV_D/LP_P parameter Action Error flag
Non-direct I/O variable Executed —
Direct I/O variable Not executed ON
[Operation expression]
Digital filter
PVn (1 FT) PVC FT PVn 1 (0.0 FT 1.0)
PID
ΔMVn = Kp • (ΔPn+ Δln +ΔDn) (See Gap operation and integration control)
MVn = MVn-1 ΔMVn (Direct specification: Subtraction, Reverse specification: Addition)
where
Pn en en1
en SVn PVn (See Gap operation)
e t
In n (When TI 0, I 0)
TI
t scheduled scan setting N
TD PVn1 PVn t Dn1
Dn
t TD
Dn Dn1 Dn
0 .1 ( fixed)
Ln1 MVn1 MV
6F8C1226
17. Process Operation 17-44
[Function block]
MVCn
Integration
enable control
PID operation MVn=MVn-1±ΔMVn
ΔIn Speed-
1 High
position
Auto mode Ti・s convert low Rate
Rate limiter (Speed type) Manipulated
ASV ΔMVn limiter limiter
DSV +SVn en + value
MVCn MV *2
+ Gap 1 ΔPn + + Kp MVS H/L DMV
Cascade Ope.
mode CSV (Speed type)
- -
Manual mode
Td・s ΔDn DMMV
PVn 1+η・Td・s (η=0.1) (Speed type )
Filter
coefficient
FT 1
1+T・s
*1 The control polarity D/R specification in the speed to positional format conversion specification performs subtraction if
direct specification and addition if reverse specification.
*2 The switching of output polarity of manipulated value output MV is performed with external logic (ladder circuit).
(Integration control)
Ln=MVn - MV
(SV-PV)
when reverse is specified
GP[%] GP[%]
Ln-1•ΔIn 0 Integration disabled
L n-1•ΔIn 0 Integration enabled
when direct is specified
Ln-1•ΔIn 0 Integration disabled
L n-1•ΔIn 0 Integration enabled
[Supplementary description]
For the initial value of the manipulated value, the final value MV up to the previous time is output.
MV tracking
This function is valid only in auto mode and cascade mode. (This specification is invalid in manual mode.)
When tracking directive TR is 1, the high and low limit of manipulated value MV are valid, but the differential limit
of MV is invalid. In this case, the internal MVn is set as MVn=MV.
And when the tracking directive changes to 0, addition/subtraction of ΔMV is started from the MVn at that point.
Auto mode
Changing of ASV is valid in auto mode and manual mode.
When auto mode is entered, SVn is approached to ASV while limiting the rate-of-change.
SVn=SVn-1±|DSV|
Also, MMV is equal to MV so that switching from auto mode to manual mode is bumpless.
Therefore, MMV cannot be changed during auto mode.
Both the high/low limit and rate limiter of manipulated value MV are valid.
6F8C1226
17. Process Operation 17-45
Cascade mode
Changing of CSV is valid in all modes.
SVn becomes equal to CSV when cascade mode is entered. In this case, both the high/low limit and rate limiter of
manipulated value MV are valid.
Also, ASV is equal to SVn and MMV is equal to MV so that switching from cascade mode to auto mode and to
manual mode is bumpless.
Therefore, ASV and MMV cannot be changed during cascade mode.
Manual mode
Changing of MMV is valid only in manual mode.
When manual mode is entered, MV is approached to MMV while limiting the rate-of-change.
MV=MV±|DMMV|
Both the high / low limit and rate limiter of manipulated value MV are invalid.
Also, MVn is equal to MV so that switching from manual mode to auto mode or cascade mode is bumpless.
And when switching to auto mode or cascade mode, addition/subtraction of MV is started from the MVn at that
point.
Control polarity DR specification
Direct specification: MV is decreased when PV is increased. (DMV subtraction)
MVn=MVn-1 − DMV
Reverse specification: MV is increased when PV is increased. (DMV addition)
MVn=MVn-1 + DMV
Rate limiter of manual mode manipulated value setting MMV input DMMV
MV is approached to MMV with rate-of-change DMMV.
1. When +|DMMV| ≥ (MMV-MV) ≥ -|DMMV| :MV=MMV
2. When (MMV-MV) > +|DMMV| :MV=MV+|DMMV|
3. When (MMV-MV) < -|DMMV| :MV=MV-|DMMV|
Rate limiter of auto mode setting ASV input DSV
SVn is approached to ASV with rate-of-change DSV.
1. When +|DSV| ≥ (ASV-SVn-1) ≥ -|DSV| :SVn=ASV
2. When (ASV-SVn-1) > +|DSV| :SVn=SVn-1+|DSV|
3. When (ASV-SVn-1) < -|DSV| :SVn=SVn-1-|DSV|
High / low limit of manipulated output MH, ML
1. When MH < ML :MH=ML
If high / low limit output is MVXn
2. When MVn > MH :MVXn=MH
3. When MVn < ML :MVXn=ML
When instruction input is OFF
PID initialization is performed. The content is as follows:
1. Sets the operation mode MODE to mode specified by initial mode IMODE.
MODE=IMODE
2. For the initial value of the manipulated value, the final value MV up to the previous time is output.
3. Auto mode setting is set to the value set to auto mode initial value ISV.
ASV=ISV
4. Internal data is initialized as follows:
MV0=MV
MMV=MV
PV0=PVC
SV0=ASV or CSV (Depends on initial mode. However, it is set to ASV in manual mode.)
D0=0
C=N
e0-1=e0
When instruction input is ON
Performs PID operation.
Performs PID operation every N scans which is the set control cycle.
(Executes if the internal counter C is 0 or less, resets the internal counter C to N and sets instruction output to ON.
If the internal counter is greater than 0, decrements C and resets the instruction output to OFF.)
6F8C1226
17. Process Operation 17-46
SVn-1
Manual ― ― Previous Set MMV ― MV No No MV MMV
mode Changeable Changeable value Changeable MVn
― PID
Tracking Changeable Operation Yes Yes
Auto =OFF Set ASV ― ASVSVn result
mode Tracking (Changeable) Set TMV MV Yes No Internal
MV
=ON manipulat
Not
PID ed value
changeable MVCn
Tracking ― Operation Yes Yes MVn
=OFF Changeable result Output
Cascade limit
SVn Set CSV CSV
mode
Tracking Not Set TMV MV Yes No
=ON changeable
Important:
The scan cycle of the task using this instruction must be in scheduled scan mode. (S controller only) When specifying
floating scan, the specific variable Error Flag is set to ON without performing operation.
Program example:
PID3_1
SIGNAL1 PID3 SIGNAL2
E Q
ST
TBL2 SAMPLE1
LP_P MV
LD ST
TBL1 TBL1
PV_D PV_D
LD ST
When SIGNAL1 is ON, performs Essential Succession PID operation with the content of parameters specified by variables
TBL1 and TBL2 and stores the result in variable SAMPLE1.
Error information:
If direct I/O variable is specified for PV data/setting variable and LP parameter variable, no operation is performed and the
specific register Error Flag is set to ON.
If the scan cycle of the task using this instruction is floating scan mode, no operation is performed and the specific register
Error Flag is set to ON. (S controller only)
6F8C1226
17. Process Operation 17-47
Parameter structure:
The structure of each parameter used in function instructions is shown below. Use the following structure for functions that
require parameters. Note that these structures are predefined in the standard structure of the engineering tool.
PV parameter structure:
Data type Parent type
typePV_PARA STRUCT
PV data structure:
Data type Parent type
typePV_DATA STRUCT
LP parameter structure:
Data type Parent type
typeLP_PARA STRUCT
LP data structure:
Data type Parent type
typeLP_DATA STRUCT
18 Program Control
Function:
• When the input state is ON, program, user defined function, and user defined function block are terminated and control
returns to the instruction following the corresponding CALL instruction.
• If connected directly to left power rail, program, user defined function, and user defined function block are terminated
unconditionally and control returns to the instruction following the corresponding CALL instruction.
Input Action Output
OFF No return —
ON Return —
[Supplement]
• This instruction is not necessary in order to return to the instruction following the corresponding CALL instruction at the end
of program, user defined function, or user defined function block. Use the Return instruction when it is necessary to return to
the instruction following the corresponding CALL instruction in the middle of a program.
Program example:
SIGNAL1 SIGNAL2
RETURN
• Returns only when the state of variables SIGNAL1 and SIGNAL2 is ON.
6F8C1226
18. Program Control 18-3
Input argument n
Function:
• Executes the user defined function.
• Up to 15 input arguments including function value may be defined.
• User defined function and user defined function block may be nested up to 6 levels.
Program example:
USERFUN
SAMPLE1 IN0 SAMPLE5
User defined function content
SAMPLE2 IN1
ADD_INT SUB_INT MUL_INT
IN0 USERFUN
SAMPLE3 IN2
IN1
SAMPLE4 IN3
IN2
IN3
• Executes the content of user defined function using variables SAMPLE1 to 4 as input arguments and stores the result in
variable SAMPLE5.
6F8C1226
18. Program Control 18-4
Function:
• Executes the user defined function block.
• Up to 15 input and output arguments may be defined.
• User defined function and user defined function block may be nested up to 6 levels.
Program example:
USERFB_1
USERFB
SAMPLE1 IN0 OUT1 SAMPLE5
User defined function block content
SAMPLE2 IN1 OUT2 SAMPLE6
ADD_INT SUB_INT MUL_INT
IN0 OUT1
SAMPLE3 IN2
IN1
SAMPLE4 IN3
IN2
IN3
IN1
IN2
IN3
• Executes the content of user defined function block using variables SAMPLE1 to 4 as input arguments and stores the result
in variables SAMPLE5 and SAMPLE6.
6F8C1226
18. Program Control 18-5
EN_P
Execution control input E Output
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input TASK UINT √ Task type
NO UINT √ Task entry no.
Output — BOOL — Output
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, execution of the program specified by Task type and Task entry no. is enabled
and ON is output as the result.
• The range of Task type TASK is as follows.
Task type specification Task name
0 Event task EV
1 Super high-speed task SS
2 Interrupt task IP
3 High-speed task HS
4 Main task MS
5 Background task BG
• The range of Task entry no. depends on the controller model. Refer to the operation manual for details.
Execution control input Action Output
OFF — OFF
ON Enables execution of the specified program. ON
Program example:
SIGNAL1 EN_P SIGNAL2 Main task
1 E 1 000 P_2050
LD ST
001 P_2051
4 TASK
LD 009 P_2059
010 P_2060 Disabled→Enabled
10 NO
LD
• When execution control input SIGNAL1 is ON, execution of program P_2060 registered in entry no. 010 of main task
specified by task type TASK and task entry no. NO is enabled.
Error information:
• No operation is performed if an unregistered program, invalid task type, or invalid task entry no. is specified.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
18. Program Control 18-6
DIS_P
Execution control input E Output
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input TASK UINT √ Task type
NO UINT √ Task entry no.
Output — BOOL — Output
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, execution of the program specified by Task type and Task entry no. is disabled
and ON is output as the result.
• The range of Task type TASK is as follows.
Task type specification Task name
0 Event task EV
1 Super high-speed task SS
2 Interrupt task IP
3 High-speed task HS
4 Main task MS
5 Background task BG
• The range of Task entry no. depends on the controller model. Refer to the operation manual for details.
Execution control input Action Output
OFF — OFF
ON Disables execution of the specified program. ON
Program example:
SIGNAL1 DIS_P SIGNAL2 Main task
1 E 1 000 P_2050
LD ST
001 P_2051
4 TASK
LD 009 P_2059
010 P_2060 Enabled→Disabled
10 NO
LD
• When execution control input SIGNAL1 is ON, execution of program P_2060 registered in entry no. 10 of main task specified
by task type TASK and task entry no. NO is disabled.
Error information:
• No operation is performed if an unregistered program, invalid task type, or invalid task entry no. is specified.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
18. Program Control 18-7
START_P
Execution control input E Output
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input TASK UINT √ Task type
NO UINT √ Task entry no.
Output — BOOL — Output
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the program specified by Task type and Task entry no. is executed and ON is
output as the result.
• The range of Task type TASK is as follows. However, super high speed task (SS), high speed task (HS), and main task (MS)
which performs scan cannot be set.
Task type specification Task name
0 Event task EV
2 Interrupt task IP
5 Background task BG
• The range of Task entry no. depends on the controller model. Refer to the operation manual for details.
Execution control input Action Output
OFF — OFF
ON Starts the specified event program. ON
Program example:
SIGNAL1 START_P SIGNAL2 Event task
1 E 1 000 P_2050
LD ST
001 P_2051
0 TASK
LD 006 P_2056 Start up
007 P_2057
6 NO
LD START_P Execute
• When execution control input SIGNAL1 is ON, the program P_2056 registered in entry no. 006 of event task specified by
task type TASK and task entry no. NO is started up.
Error information:
• No operation is performed if an unregistered program, invalid task type, or invalid task entry no. is specified.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
18. Program Control 18-8
EI_T
Diagram Execution control input Result
Arguments:
Arg. Operand Type Const. Description Remarks
Input — BOOL √ Execution control input
Output — BOOL — Result
Function:
• When the input is OFF, outputs OFF without performing operation.
• When the input is ON, execution of task with higher priority than the executing task is enabled and ON is output as the result.
• Interrupt events that occur while execution is disabled are held until interrupt enable instruction is executed and the held task
is executed after execution is enabled.
Important:
• If interrupt is disabled, it must be enabled within the same POU.
Program example:
SIGNAL1
I/O
Interrupt DI_T
factor IP task
Circuit A Execution
disabled
• Disables interrupt when the variable SIGNAL1 is ON. This interrupt is disabled while circuit A is executing. Enables interrupt
when the variable SIGNAL2 is ON. Then the interrupt task (IP) is started up by the suspended I/O interrupt.
6F8C1226
18. Program Control 18-9
DI_T
Diagram Execution control input Result
Arguments:
Arg. Operand Type Const. Description Remarks
Input — BOOL √ Execution control input
Output — BOOL — Result
Function:
• When the input is OFF, outputs OFF without performing operation.
• When the input is ON, execution of task with higher priority than the executing task is disabled and ON is output as the result.
• Interrupt events that occur while execution is disabled are held until interrupt enable instruction is executed and the held task
is executed after execution is enabled.
Important:
• If interrupt is disabled, it must be enabled within the same POU.
Program example:
SIGNAL1
I/O DI_T
Interrupt
factor IP task
Circuit A Execution
disabled
• Disables interrupt when the variable SIGNAL1 is ON. This interrupt is disabled while circuit A is executing. Enables interrupt
when the variable SIGNAL2 is ON. Then the interrupt task (IP) is invoked by the suspended I/O interrupt.
6F8C1226
19. String Processing 19-1
19 String Processing
LEN
Diagram Input string Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — STRING — Input string
Output — UINT — Output
Function:
• Calculates the length of the input string and outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 LEN SAMPLE2
Input string String length
7
LD ST ABCDE FG 7
• Calculates the length of string "ABCDEFG" in input data SAMPLE1 and stores the result "7" in SAMPLE2.
Error Information:
• If the STRING variable is specified as direct I/O, the result is '0' and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
19. String Processing 19-3
LEFT
Input string IN Output
Diagram
Extraction character length L
Arguments:
Arg. Operand Type Const. Description Remarks
IN STRING — Input string
Input
L UINT √ Extraction character length
Output — STRING — Output
Function:
• Extracts the string specified by Extraction character length L from the left end of the input string IN and outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 LEFT SAMPLE3
Input string Extracted string
IN
LD ST ABCDE FG ABC
SAMPLE2
3 L Extraction character count
LD 3
• Extracts the number of characters specified by Extraction character length "3" in SAMPLE2 from the left end of the string
"ABCDEFG" in SAMPLE1and stores the result "ABC" in SAMPLE3.
Error information:
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
19. String Processing 19-4
RIGHT
Input string IN Output
Diagram
Extraction character length L
Arguments:
Arg. Operand Type Const. Description Remarks
IN STRING — Input string
Input
L UINT √ Extraction character length
Output — STRING — Output
Function:
• Extracts the number of characters specified by Extraction character length L from the right end of the input string IN and
outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 RIGHT SAMPLE3 Input string Extracted string
IN
LD ST ABCDE FG EFG
SAMPLE2
3 L Extraction character length
LD 3
• Extracts the number of characters specified by Extraction character length "3" in SAMPLE2 from the right end of the string
"ABCDEFG" in SAMPLE1and stores the result "EFG" in SAMPLE3.
Error information:
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
19. String Processing 19-5
MID
Input string IN Output
Diagram L
Extraction character length
Arguments:
Arg. Operand Type Const. Description Remarks
IN STRING — Input string
Input L UINT √ Extraction character length
P UINT √ Extraction character top position
Output — STRING — Output
Function:
• Extracts the number of characters specified by Extraction character length L starting from the Extraction character top
position P of the input string IN and outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 MID SAMPLE4 Input string Extracted string
IN
LD ST ABCDEFG BCD
SAMPLE2 Extraction character length
3 L
LD 3
SAMPLE3
P
2 Extracted string position
LD 2
• Extracts the number of characters specified by Extraction character length "3" in SAMPLE2, starting from Extraction
character top position "2" in SAMPLE3 of the string "ABCDEFG" in SAMPLE1 and stores the result "BCD" in SAMPLE3.
Error information:
• If number of characters from Extraction character top position P is less than the Extraction character length, the entire string
starting at position P is output.
• If Extraction character top position P is greater than the Input string length, the result is a null string.
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
Also, when EN is used, ENO output is used to OFF.
6F8C1226
19. String Processing 19-6
CONCAT_STRING
Input string 1 IN1 Output
Diagram
Input string 2 IN2
Arguments:
Arg. Operand Type Const. Description Remarks
IN1 STRING — Input string 1
Input
IN2 STRING — Input string 2
Output — STRING — Output
Function:
• Concatenates Input string 1 with Input string 2 and outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 CONCAT_STRING SAMPLE3 Input string 1
IN1 ABCD
LD ST Output string
SAMPLE2 +
ABCDEFG
3 IN2 Input string 2
LD EFG
• Concatenates the string "ABCD" in SAMPLE1 with Extraction string "EFG" in SAMPLE2 and stores the result "ABCDEFG" in
SAMPLE3.
Error information:
• If the string length after concatenation exceeds the output string variable size, the result is unchanged.
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
19. String Processing 19-7
INSERT
Input string IN1 Output
Insert position P
Arguments:
Arg. Operand Type Const. Description Remarks
IN1 STRING — Input string
Input IN2 STRING — Insertion character string
P UINT √ Insertion position
Output — STRING — Output
Function:
• Inserts the Insertion string IN2 at Insertion position P of the input string IN1 and outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 INSERT SAMPLE4 Input string Inserted string
IN ABC ADEFGBC
LD ST
SAMPLE2
3 L Insert position
LD
1
SAMPLE3
P
1 Insert string
LD
DEFG
• Inserts the Insertion character string "DEFG" in SAMPLE2 into string "ABC" in SAMPLE1 at Insertion position "1" specified
by SAMPLE3 and stores the result "ADEFGBC" in SAMPLE4.
Error information:
• If number of characters in Insertion string IN1 is less than Insertion position P, Insertion string is inserted at the end of the
Input string IN1.
• If the Insertion position P is "0", IN2 is inserted at the start of the Input string IN1.
• If the string length after insertion exceeds the output string variable size, the result is unchanged.
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF only when the string size is exceeded or when the string variable is specified
as direct I/O.
6F8C1226
19. String Processing 19-8
DELETE
Input string IN Output
Delete position P
Arguments:
Arg. Operand Type Const. Description Remarks
IN STRING — Input string
Input L UINT √ Deletion character length
P UINT √ Delete position
Output — STRING — Output
Function:
• Deletes a string of length L from the Deletion position P of the input string IN and outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 DELETE SAMPLE4 Input string Deleted string
IN ABCDEFG ABG
LD ST
SAMPLE2 Delete position Deletion character length
4 L
LD 3 4
SAMPLE3
P
3
LD
• Deletes the number of characters specified by Deletion character length "4" in SAMPLE2 from string "ABCDEFG" in
SAMPLE1 starting from Delete position "3" specified by SAMPLE3 and stores the result "ABG" in SAMPLE4.
Error information:
• If number of characters from Delete position P is less than Deletion character length, the entire string starting at position P is
deleted.
• If Input string length is less than Delete position P, the input string is output unchanged.
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
Also, when EN is used, ENO output is reset to OFF.
6F8C1226
19. String Processing 19-9
REPLACE
Input string IN1 Output
Replacement position P
Arguments:
Arg. Operand Type Const. Description Remarks
IN1 STRING — Input string
IN2 STRING — Replacement character string
Input
L UINT √ Replacement character length
P UINT √ Replacement position
Output — STRING — Output
Function:
• Replaces a string of length L starting at Replacement position P of the input string IN1 with Replacement character string IN2
and outputs the result.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 REPLACE SAMPLE5 Input string Replaced string
IN1 ABCDEFG ABXYZG
LD ST
SAMPLE2 Replace position Replacement character length
4 IN2
LD 3 4
SAMPLE3
3 L Replace character string
LD
SAMPLE4 XYZ
3 P
LD
• For string "ABCDEFG" specified by SAMPLE1, replaces the number of characters specified by Replacement character
length in SAMPLE3 starting at Replacement position 3 specified by SAMPLE4 with the Replacement string "XYZ" specified
by SAMPLE2 and stores the result "ABXYZG" in SAMPLE5.
Error information:
• If Input string length is less than Replacement position P, the Replacement string is output following the Input string.
• If the string length after replacement exceeds the output string variable size, the result is unchanged.
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF only when the string size is exceeded or when the string variable is specified
as direct I/O.
6F8C1226
19. String Processing 19-10
FIND
Input string IN1 Output
Diagram
Search character string IN2
Arguments:
Arg. Operand Type Const. Description Remarks
IN1 STRING — Input string
Input
IN2 STRING — Search character string
Output — UINT — Output
Function:
• Searches the Search character string IN2 from the input string IN1 and outputs the first found string position.
• If a matching string cannot be found, 0 is output.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
Program example:
SAMPLE1 FIND SAMPLE3 Input string Search result
IN1 3
LD ST ABCDEFG 3
SAMPLE2
IN2
LD Search string
CD
• Searches the string "CD" specified by SAMPLE2 from the string "ABCDEFG" in SAMPLE1 and stores the result 3 in
SAMPLE3.
Error Information:
• If the STRING variable is specified as direct I/O, the result is unchanged and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
19. String Processing 19-11
Arguments:
Arg. Operand Type Const. Description Remarks
Input — UINT √ String byte count input
Output — STRING — Output
Function:
• Reserves a STRING data variable area of string byte count specified with input.
<Variable declaration>
Variable Data type Dec.
VAR_STRING STRING[8] VAR
In this case, a value from 1 to 8 is set as the string byte count input.
The STRING variable contains the number of string bytes (word size) that can be used in the variable. However, if STRING
is used for a static variable, the above string byte count information is cleared at run time. Therefore, the STRING type can
only be used in a global variable with retain specification.
Therefore, in order to use STRING variable in a variable scope outside this restriction, this instruction must be used under
the following condition:
• To use the string variable in a variable scope that will be initialized, this Define String instruction must be executed.
Local variable, global variable, SW/D register, IQ register: Must be executed during run time.
Temporary variable: Must be executed each time POU execution is performed.
• Set the string byte count within the string size specified in the variable declaration.
(String size when declaring 1 ≤ input ≤ STRING)
• Updates the word size of the STRING body of the STRING data.
VAR length ←INT((input+1) / 2)
• The string variable can be initialized by using it in combination with Array-String Conversion (ARRAY_TO_STRING)
instruction.
• Direct I/O variables cannot be specified for the variable scope of STRING variables.
String data structure:
VAR length 1W
STRING length 1W
STRING body
Up to 128W
Important:
• Specify input within string size of STRING [A] declared in the variable declaration.
If a value greater than this is specified, a boundary error occurs or the content of variable allocated after STRING [A] will be
destroyed. Be very careful when setting the string byte count input value to be input.
Program example:
SAMPLE1 DEF_STRING SAMPLE2 SAMPLE2 data
12 VAR length=6
LD ST
STRING length
<Variable declaration> STRING body
Variable Data type Dec.
SAMPLE2 STRING[12] VAR
• Executes Define String instruction with declaration character count "12" in variable SAMPLE1 in order to use STRING
variable SAMPLE2 with variable scope=static variable, This declares the use of a 6 word area in VAR length of STRING
variable SAMPLE2.
Error information:
• If string byte count input > 256, an abnormal input is assumed and the VAR length of the specified STRING is set to 0.
• If the STRING variable is specified as direct I/O, the result is not updated and the specific register Error Flag is set to ON.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
20. Control Statements 20-1
20 Control Statements
Control statements IF
Diagram IF
Function:
• Indicates the start of IF statement.
• A condition expression is described between IF and THEN. If the condition expression is ON, the code following THEN is
executed. If the condition expression is OFF, the code following THEN is skipped and the code following ELSE is executed.
• The condition expression following IF must be instructions that outputs BOOL type result (such as bit sequence instructions,
compare instructions, or logical operation instructions).
Program example:
IF
Condition expression
THEN
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
ELSE
Process 2
SUB_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_IF
FALSE
Condition
expression
TRUE
Process 1 Process 2
• If the states of condition expression variables SIGNAL1 and SIGNAL2 are both ON, Process 1 (addition) is performed.
Otherwise, Process 2 (subtraction) is performed.
6F8C1226
20. Control Statements 20-3
Diagram THEN
Function:
• The following table shows the processing when the condition expression in an IF statement is satisfied.
Condition Action
Condition expression is satisfied (ON) Executes the process following THEN
Condition expression is not satisfied (OFF) Does not execute the process following THEN
Program example:
IF
Condition expression
THEN
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
ELSE
Process 2
SUB_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_IF
FALSE
Condition
expression
TRUE
Process 1 Process 2
• If the states of condition expression variables SIGNAL1 and SIGNAL2 are both ON, Process 1 (addition) following THEN is
performed. Otherwise, Process 2 (subtraction) following ELSE is performed.
6F8C1226
20. Control Statements 20-4
Diagram ELSE
Function:
• The following table shows the processing when the condition expression in an IF statement is not satisfied.
Condition Action
Condition expression is satisfied (ON) Does not execute the process following ELSE
Condition expression is not satisfied (OFF) Executes the process following ELSE
Program example:
IF
Condition expression
THEN
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
ELSE
Process 2
SUB_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_IF
FALSE
Condition
expression
TRUE
Process 1 Process 2
• If the states of condition expression variables SIGNAL1 and SIGNAL2 are both ON, Process 1 (addition) following THEN is
performed. Otherwise, Process 2 (subtraction) following ELSE is performed.
6F8C1226
20. Control Statements 20-5
Diagram ELSEIF
Function:
• Indicates the start of ELSEIF statement.
• A condition expression is described between ELSEIF and THEN. If the condition expression is ON, the code following THEN
is executed. If the condition expression is OFF, the code following THEN is skipped and the code following ELSE is
executed.
• The condition expression following ELSEIF must be instructions that outputs BOOL type result (such as syntax instructions,
compare instructions, or logical operation instructions).
Program example:
IF
Condition expression 1
THEN
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
ELSEIF
Condition expression 2
THEN
Process 2
SUB_INT
SAMPLE1 SAMPLE3
SAMPLE2
ELSE
Process 3
MUL_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_IF
6F8C1226
20. Control Statements 20-6
FALSE
Condition
expression 1
FALSE
TRUE Condition
expression 2
TRUE
• If the states of Conditional Expression 1 variables SIGNAL1 and SIGNAL2 are both ON, Process 1 (addition) is performed
and if the states of Condition Expression 2 variables SIGNAL3 and SIGNAL4 are both ON, Process 2 (subtraction) is
performed. Otherwise, Process 3 (multiply) following ELSE is performed.
6F8C1226
20. Control Statements 20-7
Diagram END_IF
Function:
• Indicates the end of IF statement.
Program example:
IF
Condition expression
THEN
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
ELSE
Process 2
SUB_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_IF
FALSE
Condition
expression
TRUE
Process 1 Process 2
• If the states of condition expression variables SIGNAL1 and SIGNAL2 are both ON, Process 1 (addition) following THEN is
performed. Otherwise, Process 2 (subtraction) following ELSE is performed.
6F8C1226
20. Control Statements 20-8
CASE
Diagram INDEX xxx
Arguments:
Arg. Operand Type Const. Description Remarks
Input INDEX DINT — Index register specification (condition
value)
Function:
• Specifies the index register used as the start of CASE statement and condition value.
• Index registers XI,XJ,XK,XL,XM,XN,XP,and XQ may be used.
Program example:
CASE
INDEX XI
:
10
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
.. :
20 30
Process 2
SUB_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_CASE
TRUE
XI=10
Process 1
FALSE
TRUE
20 ≤ XI ≤ 30
Process 2
FALSE
• If the content of index register XI, which is the condition value is "10" Process 1 (addition) is performed and if the content of
index register XI is greater than or equal to "20" and less than or equal to "30" Process 2 (subtraction) is performed.
6F8C1226
20. Control Statements 20-9
Control statements :
:
Diagram Comparison data
Arguments:
Arg. Operand Type Const. Description Remarks
Input — DINT √ Comparison data
Function:
• If the content of index register specified with the CASE statement and the content of comparison data are equal, the code
following the : instruction is executed.
• The CASE condition is not evaluated after executing the code following the : instruction. (This is equivalent to the C
language break statement.)
• The comparison data may be specified using variables or constants.
Condition Action
Index register=Comparison data Executes the code following :
Index register≠Comparison data Does not execute the code following :
Program example:
CASE
INDEX XI
:
SAMPLE1
Process 1
ADD_INT
SAMPLE2 SAMPLE4
SAMPLE3
.. :
20 30
Process 2
SUB_INT
SAMPLE2 SAMPLE4
SAMPLE3
END_CASE
6F8C1226
20. Control Statements 20-10
TRUE
XI=SAMPLE1
Process 1
FALSE
TRUE
20 ≤ XI ≤ 30
FALSE Process 2
• If the content of index register XI, which is the condition value, is equal to the content of SAMPLE1, Process 1 (addition) is
performed and if the content of index register XI is between "20" and "30" Process 2 (subtraction) is performed.
6F8C1226
20. Control Statements 20-11
Control statements .. :
.. :
Diagram Comparison data 1 Comparison data 2
Arguments:
Arg. Operand Type Const. Description Remarks
— DINT √ Comparison data 1
Input
— DINT √ Comparison data 2
Function:
• When the content of index register specified with the CASE statement is between Comparison Data 1 and Comparison Data
2, the code following the .. : instruction is executed.
• The CASE condition is not evaluated after executing the code following the .. : instruction. (This is equivalent to the C
language break statement.)
• Comparison Data 1 and Comparison Data 2 may be specified using variables or constants.
Condition Action
Index register is between Comparison Data 1 and Comparison Data 2 Executes the code following .. :
Index register is outside Comparison Data 1 and Comparison Data 2 Does not execute the code following .. :
Program example:
CASE
INDEX XI
:
SAMPLE1
Process 1
ADD_INT
SAMPLE2 SAMPLE4
SAMPLE3
.. :
20 30
Process 2
SUB_INT
SAMPLE2 SAMPLE4
SAMPLE3
END_CASE
6F8C1226
20. Control Statements 20-12
TRUE
XI=SAMPLE1
Process 1
FALSE
TRUE
20 ≤ XI ≤ 30
FALSE Process 2
• If the content of index register XI, which is the condition value, is equal to the content of SAMPLE1, Process 1 (addition) is
performed and if the content of index register XI is greater than or equal to "20" and less than or equal to "30," Process 2
(subtraction) is performed
6F8C1226
20. Control Statements 20-13
Control statements ,
,
Diagram Comparison data
Arguments:
Arg. Operand Type Const. Description Remarks
Input — DINT √ Comparison data
Function:
• Used to enumerate comparison data in CASE statement.
• If the content of index register specified in the CASE statement is equal to the comparison data or if the subsequent
condition is satisfied, the code following the , instruction is executed.
• The CASE condition is not evaluated after executing the code following the , instruction. (This is equivalent to the C
language break statement.)
• The comparison data may be specified using variables or constants.
Condition Action
Index register=Comparison data Executes the code following ,
Index register≠Comparison data Does not execute the code following ,
Program example:
CASE
INDEX XI
, :
SAMPLE1 SAMPLE2
Process 1
ADD_INT
SAMPLE3 SAMPLE5
SAMPLE4
.. :
20 30
Process 2
SUB_INT
SAMPLE3 SAMPLE5
SAMPLE4
END_CASE
6F8C1226
20. Control Statements 20-14
TRUE
XI=SAMPLE1
FALSE
TRUE
XI=SAMPLE2
Process 1
FALSE
TRUE
20 ≤ XI ≤ 30
Process 2
FALSE
• If the content of index register XI, which is the condition value, is equal to the content of SAMPLE1 or equal to variable
SAMPLE2, Process 1 (addition) is performed and if the content of index register XI is greater than or equal to "20" and less
than or equal to "30," Process 2 (subtraction) is performed.
6F8C1226
20. Control Statements 20-15
Control statements .. ,
.. ,
Diagram Comparison data 1 Comparison data 2
Arguments:
Arg. Operand Type Const. Description Remarks
— DINT √ Comparison data 1
Input
— DINT √ Comparison data 2
Function:
• Used to enumerate comparison data in CASE statement.
• If the content of index register specified in the CASE statement is between Comparison Data 1 and Comparison Data 2 or if
the subsequent condition is satisfied, the code following the .., instruction is executed.
• The CASE condition is not evaluated after executing the code following the .. , instruction. (This is equivalent to the C
language break statement.)
• Comparison Data 1 and Comparison Data 2 may be specified using variables or constants.
Condition Action
Index register is between Comparison Data 1 and Comparison Data 2 Executes the code following .. ,
Index register is outside Comparison Data 1 and Comparison Data 2 Does not execute the code following .. ,
Program example:
CASE
INDEX XI
:
SAMPLE1
Process 1
ADD_INT
SAMPLE3 SAMPLE5
SAMPLE4
.. , :
20 30 SAMPLE2
Process 2
SUB_INT
SAMPLE3 SAMPLE5
SAMPLE4
END_CASE
6F8C1226
20. Control Statements 20-16
TRUE
XI=SAMPLE1
Process 1
FALSE
TRUE
20 ≤ XI ≤ 30
FALSE
TRUE
XI=SAMPLE2
Process 2
FALSE
• If the content of index register XI, which is the condition value, is equal to the content of SAMPLE1, Process 1 (addition) is
performed and if the content of index register XI is greater than or equal to "20" and less than or equal to "30" or equal to
variable SAMPLE2, Process 2 (subtraction) is performed.
6F8C1226
20. Control Statements 20-17
Diagram ELSE
Function:
• If the content of the index register in the CASE statement does not satisfy any of the specified conditions, the code following
the ELSE statement is executed. (This is equivalent to the C language default statement.)
Condition Action
Index register satisfies the condition with the previous Does not execute the process following ELSE
comparison data
Index register does not satisfy the condition with the Executes the process following ELSE
previous comparison data
Program example:
CASE
INDEX XI
:
SAMPLE1
Process 1
ADD_INT
SAMPLE3 SAMPLE5
SAMPLE4
.. , :
20 30 SAMPLE2
Process 2
SUB_INT
SAMPLE3 SAMPLE5
SAMPLE4
ELSE
Process 3
MUL_INT
SAMPLE3 SAMPLE5
SAMPLE4
END_CASE
6F8C1226
20. Control Statements 20-18
TRUE
XI=SAMPLE1
Process 1
FALSE
TRUE
20 ≤ XI ≤ 30
FALSE
TRUE
XI=SAMPLE2
Process 2
FALSE
Process 3
• If the content of index register XI, which is the condition value, is equal to the content of variable SAMPLE1, Process 1
(addition) is performed and if the content of Index Register XI is greater than or equal to "20" and less than or equal to "30"
or equal to variable SAMPLE2, Process 2 (subtraction) is performed. Otherwise, Process 3 (multiplication) is performed.
6F8C1226
20. Control Statements 20-19
Diagram END_CASE
Function:
• Indicates the end of CASE statement.
Program example:
CASE
INDEX XI
:
10
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
.. :
20 30
Process 2
SUB_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_CASE
TRUE
XI=10
Process 1
FALSE
TRUE
20 ≤ XI ≤ 30
FALSE Process 2
• If the content of index register XI, which is the condition value, is "10," Process 1 (addition) is performed and if the content of
index register XI is greater than or equal to "20" and less than or equal to "30," Process 2 (subtraction) is performed.
6F8C1226
20. Control Statements 20-20
FOR_DO
Diagram INDEX xxx MIN xxx MAX xxx STEP xxx
Arguments:
Arg. Operand Type Const. Description Remarks
INDEX DINT — Index register specification (repeat count)
MIN DINT √ initial value input
Input
MAX DINT √ Final value input
STEP DINT √ increment input
Function:
• Indicates the start of FOR statement and sets the loop condition.
• The instructions between FOR_DO and END_FOR are repeated until the loop count in index register reaches the final value.
• The loop condition is specified using the index register, which specifies the loop count INDEX, and variables or constants
specifying the initial value MIN, final value MAX, and increment STEP.
Condition Action
Index register content > Final value End repetition.
Index register content ≤ Final value Repeats instruction between FOR_DO and END_FOR.
Program example:
FOR_DO
INDEX XI MIN 0 MAX 9 STEP 1
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_FOR
XI=XI+1
TRUE
XI > 9
FALSE
Process 1
• Process 1 (addition) is repeated until the loop count in index register XI exceeds "9".
6F8C1226
20. Control Statements 20-21
Diagram EXIT
Function:
• Forces end of FOR statement.
Program example:
FOR_DO
INDEX XI MIN 0 MAX 9 STEP 1
Process 1
SIGNAL1 SIGNAL2
ADD_INT
EN ENO
SAMPLE1 SAMPLE3
SAMPLE2
Process 2
IF
SIGNAL2 SIGNAL3
THEN
EXIT
END_IF
END_FOR
XI=XI+1
TRUE
XI > 9
FALSE
Process 1
TRUE
SIGNAL2
FALSE
• Process 1 (addition) is repeated until the loop count in index register XI exceeds"9", but the FOR statement is terminated if
the variable SIGNAL2 in the IF statement is ON.
6F8C1226
20. Control Statements 20-22
Diagram END_FOR
Function:
• Indicates the end of FOR statement.
Program example:
FOR_DO
INDEX XI MIN 0 MAX 9 STEP 1
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_FOR
XI=XI+1
TRUE
XI > 9
FALSE
Process 1
• Process 1 (addition) is repeated until the loop count in index register XI exceeds "9".
6F8C1226
20. Control Statements 20-23
Diagram WHILE
Function:
• Indicates the start of WHILE statement.
• A condition expression is described between WHILE and DO. The code between DO and END_WHILE is executed while
the condition expression is ON and jumps to code following END_WHILE when the condition expression becomes OFF.
• The condition expression following WHILE must contain instruction that outputs BOOL type result (such as bit sequence
instructions, compare instructions, or logical operation instructions).
Program example:
WHILE
Condition expression
DO
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_WHILE
FALSE
Condition
expression
TRUE
Process 1
• Process 1 (addition) is repeated if the states of variables SIGNAL1 and SIGNAL2, which are the condition expression, are
both ON. Otherwise, jumps to the code following the END_WHILE statement.
6F8C1226
20. Control Statements 20-24
Control statements DO
Diagram DO
Function:
• The following table shows the processing when the condition expression in a WHILE statement is satisfied.
Condition Action
Condition expression is satisfied (ON) Executes the code between DO and END_WHILE
Condition expression is not satisfied (OFF) Does not execute the code between DO and END_WHILE
Program example:
WHILE
Condition expression
DO
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_WHILE
FALSE
Condition
expression
TRUE
Process 1
• Process 1 (addition) is repeated if the states of variables SIGNAL1 and SIGNAL2, which are the condition expression, are
both ON. Otherwise, jumps to the code following the END_WHILE statement.
6F8C1226
20. Control Statements 20-25
Diagram EXIT
Function:
• Forces end of WHILE statement.
Program example:
WHILE
SIGNAL1 SIGNAL2
DO
Process 1
SIGNAL3 SIGNAL4
ADD_INT
EN ENO
SAMPLE1 SAMPLE3
SAMPLE2
Process 2
IF
SIGNAL4 SIGNAL5
THEN
EXIT
END_IF
END_WHILE
FALSE
SIGNAL1
TRUE
Process 1
TRUE
SIGNAL4
FALSE
• Process 1 (addition) is repeated while variable SIGNAL1, which is the condition expression, is ON, but if the variable
SIGNAL4 in the IF statement is ON, termination of the WHILE statement is forced and jumps to the code following the
END_WHILE statement.
6F8C1226
20. Control Statements 20-26
Diagram END_WHILE
Function:
• Indicates the end of WHILE statement.
Program example:
WHILE
Condition expression
DO
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
END_WHILE
FALSE
Condition
expression
TRUE
Process 1
• Process 1 (addition) is repeated if the states of variables SIGNAL1 and SIGNAL2, which are the condition expression, are
both ON. Otherwise, jumps to the code following the END_WHILE statement.
6F8C1226
20. Control Statements 20-27
Diagram REPEAT
Function:
• Indicates the start of REPEAT statement.
• Processing is described between REPEAT and UNTIL. The code between REPEAT and UNTIL is executed while the
condition expression following UNTIL is OFF and jumps to code following END_REPEAT when it becomes ON.
• The condition expression following UNTIL must contain instruction that outputs BOOL type result (such as bit sequence
instructions, compare instructions, or logical operation instructions).
Program example:
REPEAT
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
UNTIL
Condition expression
END_REPEAT
Process 1
FALSE
Condition
expression
TRUE
• Process 1 (addition) is repeated if the states of variables SIGNAL1 and SIGNAL2, which are the condition expression, are
not both ON. If the states of variables SIGNAL1 and SIGNAL2 are both ON, jumps to the code following the END_REPEAT
statement without looping.
6F8C1226
20. Control Statements 20-28
Diagram UNTIL
Function:
• Indicates the start of the condition expression of the REPEAT statement.
Condition Action
Condition expression is satisfied (ON) Ends REPEAT - UNTIL loop
Condition expression is not satisfied (OFF) Executes the code between REPEAT and UNTIL
Program example:
REPEAT
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
UNTIL
Condition expression
END_REPEAT
Process 1
FALSE
Condition
expression
TRUE
• Process 1 (addition) is repeated if the states of variables SIGNAL1 and SIGNAL2, which are the condition expression, are
not both ON. If the states of variables SIGNAL1 and SIGNAL2 are both ON, jumps to the code following the END_REPEAT
statement without looping.
6F8C1226
20. Control Statements 20-29
Diagram EXIT
Function:
• Forces end of REPEAT statement.
Program example:
REAPEAT
Process 1
SIGNAL3 SIGNAL4
ADD_INT
EN ENO
SAMPLE1 SAMPLE3
SAMPLE2
Process 2
IF
SIGNAL4 SIGNAL5
THEN
EXIT
END_IF
UNTIL
SIGNAL1 SIGNAL2
END_REPEAT
Process 1
TRUE
SIGNAL4
FALSE
FALSE
SIGNAL1
TRUE
• Process 1 (addition) is repeated while variable SIGNAL1, which is the condition expression, is OFF, but if the variable
SIGNAL4 in the IF statement is ON, termination of the REPEAT statement is forced and jumps to the code following the
END_REPEAT statement.
6F8C1226
20. Control Statements 20-30
Diagram END_REPEAT
Function:
• Indicates the end of REPEAT statement.
Program example:
REPEAT
Process 1
ADD_INT
SAMPLE1 SAMPLE3
SAMPLE2
UNTIL
Condition expression
END_REPEAT
Process 1
FALSE
Condition
expression
TRUE
• Process 1 (addition) is repeated if the states of variables SIGNAL1 and SIGNAL2, which are the condition expression, are
not both ON. If the states of variables SIGNAL1 and SIGNAL2 are both ON, jumps to the code following the END_REPEAT
statement without looping.
6F8C1226
21. Communication 21-1
21 Communication
Instance name
USEND_T
Execution request REQ DONE Completion output
Arguments:
Arg. Operand Type Const. Description Range
REQ BOOL √ Execution request
CMD PTR — Send command
Input
P PTR — Send data
N UINT √ Send data word number 1 to 1000W
DONE BOOL — Completion output
Output ERROR BOOL — Error
STATUS INT — Socket No. or error status
Send command data structure
15 0
Requested Ethernet Module Slot No.
Socket Service Command
Request Parameter
(See below for details)
Instance structure:
Name Type Description
DONE BOOL Completion output
ERROR BOOL Error
STATUS INT Socket No. or error status
TIMECNT DINT Time count
RESERVE DWORD Reserved
Restrictions:
Item S3 S2 L3 L2 L1
# of Ethernet modules/station 4 1
# of sockets/Ethernet module 12
Single bus Yes Yes Yes Yes Yes
TCP/IP
Duplex bus No No Yes Yes No
Protocol
Single bus Yes Yes Yes Yes Yes
UDP/IP
Duplex bus Yes Yes Yes Yes No
Transferred text size/socket 1000 words
6F8C1226
21. Communication 21-3
Function:
• This is a function block that communicates with TCP/IP or UDP/IP protocol using the Ethernet module.
• When the Execution request REQ changes from OFF to ON, N words starting from Send data P are sent with the content of
the specified Send command CMD.
• Send data word number may be 1 to 1000W.
• When data transfer completes, Completion output DONE is kept ON for one scan time.
• If an error occurs, ERROR is kept ON for one scan time.
• When transfer completes successfully or unsuccessfully, Socket No. or error status STATUS contains the detailed
completion information.
• The instruction completes successfully (DONE=ON) starting from the second scan after execution request (REQ=ON).
Therefore, depending on how the control cycle is set and application program is created, it may take several seconds before
normal completion. Also, a list of error status codes is included after the URCV_T instruction. (Error Status Code List)
• Notes on using this communication function block instruction in a duplex system are included after the Error Status Code List.
(Notes for duplex system)
D-UDPPortNo.
Socket No. :Socket ID (0 to 11) (identifier obtained with UDP open)
D-IP address :Destination IP address
Specifying 255.255.255.255 as the destination IP address results in broadcast send.
D-UDPPortNo. :Destination socket UDP port No.
Error status:
15 0
=0: Normal complete, ≠0: Error status
D-TCPPortNo.
S-TCPPortNo.
TimeCnt
Kind :Open type (1/2)
1=Active open - client
2=Passive open - server
D-IP address :Destination IP address (valid only for active open)
D-UDPPortNo. :Destination socket TCP port No. (valid only for active open)
S-TCPPortNo. :Source specified socket TCP port No.
TimeCnt :Receive wait timeout interval (1 to 65535: 0.1 second unit, 0: unlimited)
(valid only for passive open)
Socket No. or Error Status:
15 0
Socket No.(0 to 11), error status
Socket No. is set in STATUS when TCP completes successfully (DONE=ON). This Socket No. is used to obtain the send,
6F8C1226
21. Communication 21-7
UDPPortNo.
S-IP address :Source IP address
UDPPortNo. :UDP port no. (1024 to 65535)
Error status:
15 0
=0: Normal end ,≠0: Error status
D-UDPPortNo.
DRID :Destination register type code
(Only register D can be specified when the destination is S3.)
0=XW/Ywxxx, 1=Wxxx, 2=LWxxx, 3=RWxxx, 4=Dxxx
5=F(0 to 32767)xxx, 6=F(0 to 65535), 7=Txxx, 8=Cxxx, 9=SWxxx
DRegNo. :Destination register No.
TimeCnt :Timeout interval 1 to 32767 (0.1 second unit) when bit 15=0
Defaults to 30 seconds when bit15=1
D-IP address : Destination IP address
D-UDPPortNo. : Destination UDP port No.
Error status:
15 0
=0: Normal end ,≠0: Error status
D-UDPPortNo.
D-TCPPortNo.
S-TCPPortNo.
TimeCnt
Socket No. :Socket ID (1 to 8)
Kind :Open type (1/2)
1=Active open - client
2=Passive open - server
D-IP address :Destination IP address
D-TCPPortNo. :Destination socket TCP port No.
S-TCPPortNo. :Source specified socket TCP port No.
TimeCnt :Receive wait timeout interval (1 to 65535: 0.1 second unit, 0: unlimited)
Socket No. or Error Status:
15 0
Socket No. ( 1 to 8), error status
Program example:
USEND_T_1
SIGNAL1 USEND_T SIGNAL2
1 REQ DONE
LD ST
SAMPLE1 SAMPLE4
CMD ERROR
LD ST
SAMPLE2 SAMPLE5 Request command
P STATUS SAMPLE1
LD ST
2 Slot No.
SAMPLE3
50 N 16#0031 UDP open request
LD 8080 Source station UDP port no.
• The request command (slot No.=2, Command=16#0031, Source UDP port No.=8080) is specified with variable SAMPLE1.
• UDP open request specified with the request command is made at the rise of variable SIGNAL1 from OFF to ON.
• When UDP open completes normally, the completion output variable SIGNAL2 is kept ON for 1 scan time. The socket ID is
stored in status output variable SAMPLE5.
• When UDP open is unsuccessful, the error output variable SIGNAL3 is kept ON for 1 scan time. The Error status is stored
in status output variable SAMPLE5.
6F8C1226
21. Communication 21-14
nv dedicated
Communication Socket Communication Send
instruction
LD/FBD language Instance name
notation
USEND_N
Execution request REQ DONE Completion output
Arguments:
15 0
Requested Ethernet Module Slot No.
Socket Service Command
Request Parameter
6F8C1226
21. Communication 21-15
Instance structure:
Restrictions:
Function:
• This is a function block for the Unified Controller nv series that communicates with TCP/IP or UDP/IP protocol using the
Ethernet module.
• When execution request REQ changes from OFF to ON, N words starting from send data P are sent with the content of the
specified request command CMD.
• For word send command, send data word count is 1 to 1000 words. For byte send command, it is 1 to 2000 bytes.
• When transfer is completed normally, completion output DONE becomes ON for 1 scanning time.
• When it is completed with an error, error ERROR becomes ON for 1 scanning time.
• When transfer is completed with or without an error, the details are output to Socket No. or error status STATUS.
• The instruction completes normally (DONE=ON) starting from the second scan after execution request (REQ=ON).
Therefore, depending on how the control cycle is set and application program is created, it may take several seconds before
normal completion.
• I/O variable cannot be specified directly for send data.
• The request commands vary depending on the Ethernet module. The request commands are described below. Also, a list
of error status codes is included after the URCV_N instruction. (Error Status Code List)
• Notes on using this communication function block instruction in a duplex system are included after the Error Status Code List.
(Notes for duplex system)
6F8C1226
21. Communication 21-16
Type Module installation location Bus type Module name Request command type *
Single EN811,EN821 Single bus request command
type1 Main unit Single bus request command and
Duplex -
duplex bus request command
Single EN811, EN821 Single bus request command
type2 Main unit Single bus request command and
Duplex FN812
duplex bus request command
Reset request:
• Resets the Ethernet module from the user program.
• The request command and Error status are as follows:
<Request command>
15 0
Requested Ethernet Module Slot No.
Command (16#0011)
<Error status>
15 0
=0:Normal complete, ≠0: Error status
<Error status>
15 0
=0:Normal complete, ≠0: Error status
• Notes on duplex bus Ethernet module: The "Other station confirmed request" is not a duplex bus request command. Make
the request by specifying the IP address for both Ethernet A and B systems. Program according to the system request
specification (such as the command is successful if either A or B is successful/the command is successful if both A and B are
successful).
6F8C1226
21. Communication 21-18
UDPPortNo.
• Socket No. is set in STATUS when UDP completes successfully (DONE=ON). This Socket No. is used to obtain the send,
receive, close, and EN board control socket identifier.
<Request command>
15 0
Requested Ethernet Module Slot No.
Command (16#0032)/Duplex (16#0232)
Socket No.
D-IP address
D-UDPPortNo.
Socket No. : Socket ID (0 to 11) (identifier obtained with UDP open)
Destination IP address: Destination IP address
Specifying 255.255.255.255 as the destination IP address results in
broadcast send.
D-UDPPortNo. : Destination socket UDP port No.
<Error status>
15 0
=0: Normal complete, ≠0: Error status
6F8C1226
21. Communication 21-19
<Request command>
15 0
Requested Ethernet Module Slot No.
Command (16#0034)/Duplex (16#0234)
Socket No.
Socket No : Socket ID (0 to 11) (identifier obtained with UDP open)
<Error Status>
15 0
=0: Normal complete, ≠0: Error status
D-TCPPortNo.
S-TCPPortNo.
TimeCnt
Kind : Open type (1/2)
1= Active open - client
2= Passive open - server
D-IP address : Destination IP address (valid only for active open)
D-TCPPortNo. : Destination socket TCP port No. (valid only for active open)
S-TCPPortNo. : Source specified socket TCP port No.
TimeCnt : Receive wait timeout interval (1 to 65535: 0.1 second unit, 0: unlimited)
(valid only for passive open)
• Socket No. is set in STATUS when TCP completes successfully (DONE=ON). This Socket No. is used to obtain the send,
receive, close, and EN board control socket identifier.
6F8C1226
21. Communication 21-20
<Error status>
15 0
=0:Normal complete, ≠0: Error status
<Error status>
15 0
=0:Normal complete, ≠0: Error status
D-UDPPortNo.
<Error status>
15 0
=0:Normal complete, ≠0: Error status
6F8C1226
21. Communication 21-21
Program example:
[LD/FBD language notation]
USEND_N_1
SIGNAL1 USEND_N SIGNAL2
REQ DONE
SIGNAL3
SAMPLE1
CM ERROR
LD
SAMPLE2 SAMPLE4
LD P STATU
S
Request command SAMPLE1
SAMPLE3 2 Slot No.
0 N 16#0031 UDP open request
LD 5000 Source station UDP port No.
• The request command (slot No.=2, Command=16#0031, Source UDP port No.=5000) is specified with variable SAMPLE1.
• UDP open request specified with the request command is made at the rise of variable SIGNAL1 from OFF to ON.
• When UDP open completes normally, the completion output variable SIGNAL2 is kept ON for 1 scan time. The socket ID is
stored in status output variable SAMPLE4.
• When UDP open is unsuccessful, the error output variable SIGNAL3 is kept ON for 1 scan time. The Error status is stored
in status output variable SAMPLE4.
Error information:
• When the specification range of send data exceeds the area, Socket Communication Send is not processed, and data
boundary over occurs.
• When I/O variable is specified directly for send data, the operation is as follows.
Controller Action
Socket Communication Send is not executed.
Unified Controller nv series
Error flag and table operation error flag are set to ON.
6F8C1226
21. Communication 21-22
Instance name
URCV_T
Execution request REQ DONE Completion output
Arguments:
Arg. Operand Type Description Range
Input REQ BOOL Execution request
CMD PTR Request command
P PTR Receive data
N UINT Receive data word count 1 to 1001W
Output DONE BOOL Completion output
ERROR BOOL Error
STATUS INT Status
Request command data structure:
15 0
Requested Ethernet Module Slot No.
Socket Service Command
Request Parameter
(See below for detail)
Instance structure:
Name Type Description
DONE BOOL Completion output
ERROR BOOL Error
STATUS INT Status
TIMECNT DINT Time count
RESERVE DWORD Reserved
Restrictions:
Item S3 S2 L3 L2 L1
# of Ethernet modules/station 4 1
# of sockets/Ethernet module 12
Single bus Yes Yes Yes Yes Yes
TCP/IP
Duplex bus No No Yes Yes No
Protocol
Single bus Yes Yes Yes Yes Yes
UDP/IP
Duplex bus Yes Yes Yes Yes No
Transferred text size/socket 1000 words
6F8C1226
21. Communication 21-23
Function:
• This is a function block that communicates with TCP/IP or UDP/IP procedure using the Ethernet module.
• When the Execution request REQ changes from OFF to ON, N words starting from Receive data P are received with the
content of the specified Receive command CMD.
• Receive data word number may be from 1 to 1001W.
• When data receive completes, Completion output DONE is kept to ON for one scan time.
• If an error occurs, ERROR is kept to ON for one scan time.
• The detail status is output to STATUS when receive completes normally or abnormally.
• The instruction completes successfully (DONE=ON) starting from the second scan after execution request (REQ=ON).
Therefore, depending on how the control cycle is set and application program is created, it may take several seconds before
normal completion. Also, a list of error status codes is included after the URCV_T instruction. (Error Status Code List)
• Notes on using this communication function block instruction in a duplex system are included after the Error Status Code List.
(Notes for duplex system)
Bit description:
Name Description Set condition Reset condition
TCP Using TCP During TCP open During socket close request
UDP Using UDP During UDP open During socket close request
AOP Active open During TCP active open During socket close request
POP Passive open During TCP passive open During socket close request
CON Connecting During TCP connection During socket close request or when RCL is ON
RCV Receive data When there is receive data No receive data
RCL Disconnected When closed by opposite party During socket close request
when connecting
6F8C1226
21. Communication 21-26
Example: Socket 4 information of single bus request command installed in slot 3 for model 3000
• Direct notation
%MW13.1703811
LD ------------------ ST
• Variable notation
SOCKET_INF3[4]
LD ---------------------ST
Station variables (Slot3)
Variable Data type WordNo BitNo
SOCKET_INF3 Array[0..63] OF WORD 1703808 0
D-UDPPortNo.
TimeCnt
Socket No. :Socket ID (0 to 11) (identifier obtained by UDP open)
D-IP address :Source IP address
Specifying 0.0.0.0 as the source IP address results in broadcast receive.
D-UDPPortNo. :Source socket UDP port No.
Do not check the source port when the command is duplex (16#0233) or UDP port No. is "0".
TimeCnt :Receive wait timeout interval (1 to 65535: 0.1 second unit, 0: unlimited)
Error status:
15 0
=0: Normal complete, ≠0: Error status
6F8C1226
21. Communication 21-27
D-UDPPortNo.
DRID : Destination register type code
(Only register D/SW can be specified when the destination is S3.)
0=XW/Ywxxx, 1=Wxxx, 2=LWxxx, 3=RWxxx, 4=Dxxx, 5=F(0 to 32767)xxx
6= F(0 to 65535), 7=Txxx, 8=Cxxx, 9=SW
DRegNo :Destination register No.
TimeCnt :Time out interval 1 to 32767 (0.1 second unit) when bit 15=0
Defaults to 30 seconds when bit15=1
D-IP address :Destination IP address
D-UDPPortNo. :Destination UDP port No.
6F8C1226
21. Communication 21-29
D-UDPPortNo.
TimeCnt
Socket No. :Socket ID (1 to 8)
D-IP address :Source IP address
Specifying 0.0.0.0 as the source IP address results in broadcast receive.
D-UDPPortNo. :Source socket UDP port No.
TimeCnt :Receive wait timeout interval (1 to 65535: 0.1 second unit, 0: unlimited)
Socket No. or Error Status:
15 0
Socket No.(1 to 8), error status
Command (16#0338)
Socket No.
TimeCnt
Socket No.: Socket ID (1 to 8)
TimeCnt: Receive timeout interval (1 to 65535: 0.1 second unit, 0: unlimited)
Socket No. or Error Status:
15 0
Socket No.(1 to 8), error status
6F8C1226
21. Communication 21-30
Program example:
URCV_T_1
SIGNAL1 URCV_T SIGNAL2 Request command SAMPLE1
1 REQ DONE 2 Slot No.
LD ST
16#0033 UDP receive request
SAMPLE1 SAMPLE4
CMD ERROR 11 UDP socket no.
LD ST 16#12_34_56_78 Send source IP address
SAMPLE2 SAMPLE5
P STATUS 8080 Send source target socket UDP No.
LD ST
300 Receive wait timeout
SAMPLE3
50 N
LD
• The request command (Slot No.=2, Command=16#0033, UDP socket No.=11, Source IP address=16#12_34_56_78,
Source socket UDP No.=8080, Receive timeout inteval=30 seconds) is specified with variable SAMPLE1.
• UDP receive request specified with the request command is made at the rise of variable SIGNAL1 from OFF to ON.
• When UDP receive completes normally, the completion output variable SIGNAL2 is kept ON for 1 scan time. "0" is stored in
status output variable SAMPLE5.
• When UDP receive request is unsuccessful, the error output variable SIGNAL3 is kept ON for 1 scan time. The Error status
is stored in status output variable SAMPLE5.
6F8C1226
21. Communication 21-31
Processing outline:
• Detect that you are online with the duplex switch event task (EV3). Set the flag indicating that duplex switching has occurred
to ON. (Figure 1) (Example: DUPLEX_CHG_REQ=ON)
• In each program using the communication function block, initialize the USEND_T/URCV_T instruction local variable during
duplex switching. Also, initialize the information to start again from the initialized state (socket open process).
a) Initialization program (Figure 2)
Important
The flag set in (1) indicating that duplex switching has occurred must be reset to OFF when all initialization of related
USEND_T/URCV_T instructions have completed in all programs. (Initialize only the first scan in which duplex switching
occurred.)
b) When entering REQ command to USEND_T/URCV_T instruction using a derivative instruction (for example ┤P├),
change the description to ┤P├ equivalent circuit (Figure 3).
c) Program the normal USEND_T/URCV_T instruction after you have performed a) and b) above.
Program example:
Figure 1: Program to detect changing to online in EV3
DUPLEX_ DUPLEX_
CHG_REQ CHG_REQ
(S)
LD ST
4
N
LD
nv dedicated
Communication Socket Communication Receive
instruction
LD/FBD language Instance name
notation
URCV_N
Execution request REQ DONE Completion
output
Request command CMD ERROR Error
Arguments:
Instance structure:
Restrictions:
6F8C1226
21. Communication 21-34
Function:
• This is a function block that communicates with TCP/IP or UDP/IP procedure using the Ethernet module.
• When execution request REQ changes from OFF to ON, N words starting from receive data P are received with the content
of the specified request command CMD.
• For word receive command, send data word count is 1 to 1001 words. For byte receive command, it is 2 to 2002 bytes.
• When receive is completed normally, completion output DONE becomes ON for 1 scanning time.
• When it is completed with an error, error ERROR becomes ON for 1 scanning time.
• When receive is completed with or without an error, the details are output to status STATUS.
• The instruction completes successfully (DONE=ON) starting from the second scan after execution request (REQ=ON).
Therefore, depending on how the control cycle is set and application program is created, it may take several seconds before
normal completion.
• I/O variable cannot be specified directly for receive data.
• The request commands and error codes vary depending on the Ethernet module.
6F8C1226
21. Communication 21-35
Type Module installation location Bus type Module name Request command type *
Single EN811, EN821 Single bus request command
type1 Main unit Single bus request command and
Duplex -
duplex bus request command
Single EN811, EN821 Single bus request command
type2 Main unit Single bus request command and
Duplex FN812
duplex bus request command
* Notes on request command type
• Both the single bus request command and duplex bus request command may be used for duplex bus (FN812), but the
duplex bus request command cannot be used for single bus (EN811,EN821). Be sure to use a single bus request command.
• When the destination is single bus, use a single bus request command even if the source Ethernet module is duplex bus.
<Error status>
15 0
Socket No. (0 to 31) or Error status
• Relation between Socket No. obtained with the open command and Socket No. obtained with this command.
The Socket No. obtained by UDP/TCP open command is a number controlled by the communication function block
instruction and is different from the real Socket No. obtained by the Ethernet module. Send, receive, or close can be
performed using the Socket No. obtained with an open command. However, the detailed information for each socket
controlled by Ethernet module cannot be accessed. Therefore, use this command to obtain the Socket No. controlled by the
Ethernet module and access the socket information using that value as offset.
The information for each socket controlled by the Ethernet module is available as station global. Register a station global
variable or use direct instruction word notation (%MW13.offset address) to access it from the user application program.
The information for each socket is organized as follows:
Socket 63
+64 Socket 0
Socket information
for single bus Socket 1
request command
(1 word x 64 sockets) :
Socket 63
Bit description:
(Example) Socket 4 information of single bus request command installed in slot 3 for type 1
Direct notation
%MW13.3276672
LD ―― ST
Variable declaration
SOCKET_INF3 [4]
LD ―― ST
<Request command>
15 0
Requested Ethernet Module Slot No.
Command (16#0033) /Duplex (16#0233)
Socket No.
D-IP address
D-UDPPortNo.
TimeCnt
Socket No. : Socket ID (0 to 11) (identifier obtained by UDP open)
D-IP address : Source IP address
Specifying 0.0.0.0 as the source IP address results in broadcast receive.
D-UDPPortNo. : Source socket UDP port No.
Do not check the source port when the command is duplex (16#0233) or UDP
port No
TimeCnt : Receive wait timeout interval (1 to 65535: 0.1 second unit, 0: unlimited)
<Error status>
15 0
=0: Normal complete, ≠0: Error status
6F8C1226
21. Communication 21-38
<Error Status>
15 0
=0: Normal complete, ≠0: Error status
D -UDPPortNo.
TimeCnt
<Error Status>
15 0
=0: Normal complete, ≠0: Error status
6F8C1226
21. Communication 21-39
Program example:
[LD/FBD language notation]
URCV_N_1
SIGNAL1 URCV_N SIGNAL2
REQ DONE
SIGNAL3
SAMPLE1
CMD ERROR Request command SAMPLE1
LD
2 Slot No.
SAMPLE2 SAMPLE4 16#0033 UDP receive request
LD P STATUS 11 UDP socket No.
ST
16#AC_10_ Source address
SAMPLE3 40_5 172.16.64.5
50 N 5000 Source target socket UDP No.
LD 300 Receive timeout
• The request command (Slot No.=2, Command=16#0033, UDP socket No.=11, Source IP address=172.16.64.5, Source
socket UDP No.=5000, Receive timeout inteval=30 seconds) is specified with variable SAMPLE1.
• UDP receive request specified with the request command is made at the rise of variable SIGNAL1 from OFF to ON.
• When UDP receive completes normally, the completion output variable SIGNAL2 is kept ON for 1 scanning time. "0" is
stored in status output variable SAMPLE4.
• When UDP open is unsuccessful, the error output variable SIGNAL3 is kept ON for 1 scaning time. The Error status is
stored in status output variable SAMPLE4.
Error information:
• When the specification range of receive data exceeds the area, Socket Communication Receive is not processed, and data
boundary over occurs.
• When I/O variable is specified directly for receive data, the operation is as follows.
Controller Action
Socket Communication Receive is not executed.
Unified Controller nv Series Error flag and table operation error flag are set to
ON.
6F8C1226
21. Communication 21-40
Overview of processing:
1) Detect online upgrade with duplex switching event task (EV3).
Set the flag indicating that duplex switching occurs to ON ([Example (1)]).
(Example: DUPLEX_CHG_REQ=TRUE(ON))
2) In each of the programs using communication, initialize the instance data of USEND_T/URCV_T instruction at duplex
switching. Also, initialize information so that the operation starts from the initialization state (socket open processing) again.
• Initialization program ([Example (2)])
● Important
Reset the flag that indicates that duplex switching set to TRUE(ON) in 1) occurs to FALSE(OFF)
when the initialization of all the related USEND_T/URCV_T instructions for all programs are
completed (initialization is performed only for the first scan after duplex switching).
• Change the description to ┤P├ equivalent circuit ([Example (3)]) if the REQ command is input to
USEND_T/URCV_T/USEND_N/URCV_N instruction using the differentiation instruction (eg. ┤P├).
• Perform normal programming of USEND_T/URCV_T/USEND_N/URCV_N instruction after implementing 2).
Program example:
[Example (1)]: Program that detects online upgrade in EV3
DUPLEX_ DUPLEX_
CHG_REQ CHG_REQ
(S)
USEND_T_
REQUEST
USEND_T DONE
RE DONE Circuit when -|P|- is used
ST
CM ERRO REQ_CMD REQUEST
CM ERRO ( )
L ST
P STATUS REQUEST
P STATUS
L ST P
N
N
L
XMIT_T
Execution request REQ DONE Completion
output
Bus / Unit / Slot / Node no. PRM ERROR Error
Arguments:
Arg. Operand Type Const. Description Range
REQ BOOL √ Execution request
PRM PTR — Bus / Unit / Slot / Node No.
Input
CMD PTR — Request command
DATA PTR — Send/receive data
DONE BOOL — Completion output
Output ERROR BOOL — Error
STATUS INT — Status
Instance structure:
Name Type Description
DONE BOOL Completion output
ERROR BOOL Error
STATUS INT Status
RESERVE ARRAY 3W Reserved
Function:
• Function block that communicates with FL-net custom procedure using FL-net module.
• Send / receive is performed with the content of the specified request command CMD at the rise of execution request REQ.
• The format of the bus / unit / slot / node No. PRM is as follows:
15 12 8 0
Bus Unit Slot
Node no.
• Refer to the FL-net User's Guide for the detail of the request command CMD.
• The table data specified with DATA is sent during send and the received data is stored in table specified with DATA during
receive.
• Completion output Q and ERROR are set to ON for one scan only.
• The STATUS contains the completion code if normal completion and error status if abnormal completion.
• Refer to the FL-net User's Guide for the detail of the code No.
6F8C1226
21. Communication 21-45
Program example:
XMIT_T_1 Bus / Unit / Slot / Node no.: SAMPLE1
SIGNAL1 XMIT_T SIGNAL2 16#000A Bus/Unit/Slot
1 REQ DONE 1 Node no.
LD ST
SAMPLE1 SAMPLE4
PRM ERROR Request command: SAMPLE2
LD ST 1 Command no.
SAMPLE2 SAMPLE5 0 Area specification
CMD STATUS 4 Offset L
LD ST
0 Offset H
SAMPLE3
DATA 10 Read word size
LD
• Bus / Unit / Slot / Node No. (basic unit/slot 10, node No. 1) is specified with variable SAMPLE1.
• Request command (Command=cyclic data read, Area=area1, Offset address=4, Read word count=10 words) is specified
with variable SAMPLE2.
• The cyclic data read request specified with request command is made at the rise of variable SIGNAL1 from OFF to ON.
• When cyclic data read request completes normally, the completion output variable SIGNAL2 is set to ON for 1 scanning time.
Also, the normal completion code is stored in variable SAMPLE5, which is the status output.
• When cyclic data read request is unsuccessful, the error output variable SIGNAL3 is set to ON for 1 scanning time. Also, the
error status is stored in variable SAMPLE5, which is the status output.
6F8C1226
21. Communication 21-46
Communication FB (XMIT_N)
nv dedicated
Communication Communication FB(XMIT_N)
instruction
LD/FBD language Instance name
notation
XMIT_N
Completion
Execution request REQ DONE output
Basic unit slot/node/unit/
slot/node no. PRM ERROR Error
Instance structure:
Function:
• This function block communicates with FL-net custom procedure using FL-net module.
• Send/receive is performed with the content of the specified request command CMD at the rise of execution request REQ.
• The format of basic unit slot / node / unit / slot / node number PRM is as follows.
6F8C1226
21. Communication 21-47
15 8 7 0
Unit Slot
Basic unit slot Node
Node no.
Program example:
[LD/FBD language notation]
• Basic unit slot / node / unit / slot / node number (built-in, node 3, unit 1, slot 10, node number 1) is specified with variable
SAMPLE1.
• Request command (command = word block read, virtual address =16#0001_8000, read word count =10 words) is specified
with variable SAMPLE2.
• The word block read request specified with request command is made at the rise of variable SIGNAL1 from OFF to ON.
• When the word block read request is completed normally, the completion output variable SIGNAL2 becomes ON for 1
scanning time. Also, the normal completion code is stored in variable SAMPLE5, which is the status output.
• When the word block read request is not completed normally, the error output variable SIGNAL3 becomes ON for 1 scanning
time. Also, the error status is stored in variable SAMPLE5, which is the status output.
6F8C1226
22. Duplex Control 22-1
22 Duplex Control
DUPLEX_CHG
Diagram Execution control input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — BOOL √ Execution control input
Output — BOOL — Output
Function:
• If the execution control input is OFF, OFF is output without performing any operation.
• If the execution control input is ON, online and standby are changed and ON is output.
Program example:
SIGNAL1 DUPLEX_CHG SIGNAL2
1 1
LD ST
• Online and standby are changed when the execution control input SIGNAL1 is ON.
Before instruction execution: DUPLEX_CHG
PS IF PU PS IF PU
Online Standby
After instruction execution:
PS IF PU PS IF PU
Standby Online
Error information:
• This instruction has no affect on non-duplex system.
• If the target system is not in standby state, no switching is performed.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
22. Duplex Control 22-3
DUPLEX_DOWN
Diagram Execution control input Output
Arguments:
Arg. Operand Type Const. Description Remarks
Input — BOOL √ Execution control input
Output — BOOL — Output
Function:
• If the execution control input is OFF, OFF is output without performing any operation.
• If the execution control input is ON, shutdown of self system is forced and ON is output.
Program example:
SIGNAL1 DUPLEX_DOWN SIGNAL2
1 1
LD ST
• When the execution control input SIGNAL1 is ON, shutdown of the self system is forced.
Before instruction execution: DUPLEX_DOWN
PS IF PU PS IF PU
Online Standby
After instruction execution:
PS IF PU PS IF PU
Down Online
Error information:
• This instruction has no affect on non-duplex system.
• When the target system is not in standby state, the self system is not shutdown.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
22. Duplex Control 22-4
Arguments:
Arg. Operand Type Const. Description Remarks
— PTR — Variable specification
Input
N UINT √ Equalizer size 1 ≤ N ≤ 1024
Normal: ON
Output — BOOL — Parameter normal/abnormal output
Abnormal: OFF
Function:
• Equalizes an N word area starting from the variable specified with the variable specification.
• Variables for which partial equalization can be specified are DW register and user variables.
• 1 to 1024 words may be specified for equalizer size N.
If N>1024, operation is performed assuming N=1024 and output is reset to OFF to indicate a parameter error.
If N=0: No operation is performed.
• If the specified variable is not a DW register or user variable, or if variable specification+size exceeds the area of the variable,
output is reset to OFF to indicate a parameter error.
• Up to eight partial equalize (variable specification, address specification) requests are possible within the same single scan.
• Subsequent equalize requests are not executed and output is reset to OFF to indicate a parameter error.
Program example:
SAMPLE1 EQUALIZE_VAR SIGNAL1 User variable
1
LD ST
SAMPLE2 SAMPLE1
100 N 100W
LD Equalize 100W starting from
SAMPLE1
• Partially equalizes a 100 words area starting from user variable SAMPLE1.
Error information:
• When this instruction is used on non-duplex system, no operation is performed and parameter error occurs.
• If the destination system is in standby, partial equalize is not performed.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
22. Duplex Control 22-5
Arguments:
Arg. Operand Type Const. Description Remarks
3: DW register
SCOPE UINT √ Variable type specification
4: User variable
Input
ADDR DINT √ Top address specification ADDR ≥ 0
N UINT √ Equalize size 1 ≤ N ≤ 1024
Normal: ON
Output — BOOL — Parameter normal/abnormal output
Abnormal: OFF
Function:
• In the variable SCOPE specified with variable type, equalizes an N word area starting from the top address ADDR.
• Variables for which partial equalization can be specified are DW register (=3) and user variables (=4).
• 1 to 1024 words may be specified for equalizer size N.
If N > 1024, operation is performed assuming N=1024 and output is reset to OFF to indicate a parameter error.
If N=0: No operation is performed.
• If the specified variable is not a DW register (=3) or user variable (=4), or if top address+size exceeds the area of the variable,
output is reset to OFF to indicate a parameter error.
• Up to eight partial equalize (variable specification, address specification) requests are possible within the same single scan.
• Subsequent equalize requests are not executed and output is reset to OFF to indicate a parameter error.
Program example:
SAMPLE1 EQUALIZE_ADDR SIGNAL1 User variable
4 SCOPE 1
LD ST
SAMPLE2 200
200 ADDR 100W
LD Equalizes 100W starting from user variable
SAMPLE3 address 200
100 N
LD
• Partially equalizes a 100 word area starting from user variable address 200.
Error information:
• When this instruction is used on non-duplex system, no operation is performed and parameter error occurs.
• If the destination system is in standby, partial equalize is not performed.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
23. Process Control 23-1
23 Process Control
No Instruction Remarks
1 Current Output PID PID_P
2 Current Output Sample PI SPI_P
3 Pulse Output PID PIDP_P
4 Pulse Output Sample PI SPIP_P
5 Feed Forward FFD_P
6 Double Cross Limit DCL_P
PID algorithm:
The PID algorithm for current output PID, current output sample PI, pulse output PID, and pulse output sample PI is as
described in the figure below. (Pulse output is ΔMV output, but the algorithm is as shown below for all.)
α 1
+ +
+ 1 + 1
SV 1- α Kp MV
1+β Tis + Tis
- + - +
αγ
+
Tds
1+ηTds
-
PV
Features:
This is equivalent to hyper PID implemented in the small-scale system (MCS) and TOSDIC-CIE-DS (PCS-DS).
• An improved bilinear transformation is used for derivative calculation.
• A hyper PID unique method is used for anti-reset-windup (ARW) function. As ARW function, the integrating term is restricted
(only in the decreasing direction of output restriction) when restricting the MV output (when the internal totalized value does
not match the actual output).
• The 2 degrees of freedom operation is filter format and can use 3 parameters: α, β, and γ.
Coefficient PID algorithm
α β γ
1 1 1 General PID (deviation PID)
1 1 0 PI-D (PV derivative type PID)
0 1 0 I-PD
α 1 0 2 degrees of freedom for P term only
α 1 γ 2 degrees of freedom for PD term only
α β 0 2 degrees of freedom for PI term only
α β γ 2 degrees of freedom for all
• A gap function is used as a non-linear function. Depending on the amount of deviation, the non-linear element defined by
gap width and gap gain is reflected to the size of the rate limiter.
6F8C1226
23. Process Control 23-2
PV input PV
FFS
Feed forward static characteristic
FFD
Feed forward dynamic characteristic
Tracking MV input TR
Arguments:
Arg. Operand Type Const. Description
Input SV REAL √ SV input [Engineering value]
PV REAL √ PV input [Engineering value]
GAN REAL √ Feed forward gain
PID proportional gain compensation
Specify 1.0 when feed forward is not used
FFS REAL √ Feed forward static characteristic [%]
Specify 0.0 when feed forward is not used
FFD REAL √ Feed forward dynamic characteristic [%]
Specify 0.0 when feed forward is not used
TR REAL √ Tracking MV input [%]
When tracking, % value used as MV initial value during
initialization
MVT BOOL √ Tracking request flag
LP_D PTR ― LP data variable
LP_P PTR ― LP parameter variable
Output MV REAL ― Result output (MV) [%] (positional type)
Pointers to tag table are placed in LP data variable and LP parameter variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Array Tag symbol
MCS connection DS connection
version version
(L1,L2,L3) (L2DS,L3DS)
Operand
LP_D LP_DATA[0] FIC100.SV FIC100.CLI
LP_P LP_PARA[0] FIC100.OA FIC100.TAG[0]
6F8C1226
23. Process Control 23-3
Instance structure:
Name Type Description
B4MODE UINT Control mode previous value (initial value: M) Used to detect change in control mode
CT REAL Actual time totalization (initial value: Main scan cycle) Used for scan time measurement
B4E REAL P term previous value (initial value: SV-PV)
During speed type operation, this is used to calculate the speed component from difference
with previous value
B4D REAL SV filter differential term input previous value (initial value: αγSV-PV)
Used to calculate change in input in differential approximation operation
B5D REAL SV filter differential term input next to previous value (initial value: αγSV-PV)
Used for exact differential term in improved bilinear transformation
B4D1 REAL SV filter differential term (initial value: 0) SV filter αγ term
B4D2 REAL SV filter proportional/integral term (initial value: (1-α)SV) αβ term of SV filter
B4MV REAL MV totalization limit previous value (initial value: TR)
High/low rate limiter previous MV totalization value (proportional/differential term assurance)
B4FFD REAL Feed forward dynamic characteristic difference calculation previous value (initial value: FFD)
Previous value for adding dynamic characteristic by difference
6F8C1226
23. Process Control 23-4
Function:
• There is no execution flag. This instruction is always executed. If the operation must be reset, set MVT as initialization
request. In this case, TR is also necessary in order to initialize MV.
• The result of executing the feed forward instruction (FFD_P) can be used as input (GAN, FFS, FFD) to feed forward. If feed
forward is not used, use fixed values (GAN=1, FFS=0, FFD=0).
• The PV parameter variable is referenced with the indicator PV no. (PVP) of the LP parameter variable.
• Direct I/O variables cannot be specified for PV data variable or LP parameter variable.
• Control operation function
• Hyper PID is used for control operation. Output is the high/low rate limited positional type MV value.
♦ SV filter
An SV filter with super 2 degrees of freedom PID is implemented. Hyper PID adds a delay filter to SV in order to reduce
the change in MV even when SV changes suddenly. This SV filter is not related to change in PV and PV change
(disturbance) characteristic is unchanged. When tuning PID, set the parameters to be appropriate for the disturbance.
Under this condition, the filter status can be optimized for the step change of SV.
The 2 degrees of freedom parameters (α, β, γ) of hyper PID are semi-fixed values. Under normal condition, the initial
values can be used without change.
The SV filter includes differential operation. This differential operation uses an improved bilinear transformation that is
an improved version of the bilinear transformation which is a popular digital operation. Under normal condition, bilinear
transformation is used and a switch is made to exact differential when the rate time setting is relatively shorter than the
scan time. The rate time can be changed during control operation without problem.
The SV filter operation is performed during each scan cycle. Control operation is performed based on the specified
control cycle (DT0).
♦ Anti-reset windup
An anti-reset windup (ARW) function is added to cancel the excessive saturation of the integrating term. The method
used here suppresses the change in the saturating direction of the integrating term when MV is saturated at high/low
limit. Also, the internal MV totalization is high/low limited by high limit (MH+MV rate limiter) and low limit (ML-MV rate
limiter).
Although the ARW function is provided, a slight reset windup condition occurs. This is designed to prevent MV from
changing when there is a minute change in disturbance (change in PV) and SV when MV is saturated. Therefore, if SV
is reversed when MV is saturated, tracking by MV may be delayed. In such case, handle this from the application
program by changing the control mode to M mode and tracking manually, or temporarily switching to non-PID control
operation and using batch processing control for example.
♦ Non-linear processing
A gap function is incorporated as non-linear PID. When the deviation is within the gap width, the change in MV output
is suppressed by multiplying the rate limiter by gap gain.
6F8C1226
23. Process Control 23-5
Program example:
PID_01
FIC100.SV PID_P FIC100.MV In case of L1
SV MV
LD ST
FIC100.PV
PV
LD
Variables:
1 Variable Data type Dec.
GAN
LD PID_01 PID_P VAR
0 Controller Variables:
FFS Variable Data type
LD
!FIC100 typeLP_PARA
0
FFD !FIC100 typeLP_DATA
LD !FIC100 typePV_DATA
FIC100.MV
TR
LD
0
MVT
LD
FIC100.SV
LP_D
LD
FIC100.OA
LP_P
LD
Error information:
• If nonnumeric data is entered in input data, the result is output as nonnumeric.
• If RH=RL, the Divide Error Flag is set to ON and the previous value is held in output.
• If the LP parameter specification is incorrect (such as specifying variable other than LP tag parameter), the Table Operation
Error is set to ON and the previous value is held in output.
Notes:
• MV output when control is stopped
When PID operation is stopped because of tracking request or control stop warning, the output is as follows depending on
the condition for stopping.
Stop condition MV output
Tracking request flag (TR)=ON Tracking MV input (TR)
Mode=M or RM Tracking MV input (TR)
When mode changes Previous MV (held)
Control stop warning (CLI)=ON or MV error (MVE)=ON Previous MV (held)
Setting MV (SMV=ON or CMV=ON) Tracking MV input (TR)
6F8C1226
23. Process Control 23-6
PV input PV
FFS
Feed forward static characteristic
Tracking MV input TR
Arguments:
Arg. Operand Type Const. Description
SV REAL √ SV input [Engineering value]
PV REAL √ PV input [Engineering value]
GAN REAL Feed forward gain
√ PID proportional gain compensation
Specify 1.0 when feed forward is not used
FFS REAL Feed forward static characteristic [%]
√
Specify 0.0 when feed forward is not used
Input FFD REAL Feed forward dynamic characteristic [%]
√
Specify 0.0 when feed forward is not used
TR REAL Tracking MV input [%]
√ When tracking, % value used as MV initial value during
initialization
MVT BOOL √ Tracking request flag
LP_D PTR ― LP data variable
LP_P PTR ― LP parameter variable
Output MV REAL ― Result output (MV) [%] (positional type)
Pointers to tag table are placed in LP data variable and LP parameter variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Array Tag symbol
Instance structure:
Name Type Description
B4MODE UINT Control mode previous value (initial value: M) Used to detect change in control mode
CT REAL Actual time totalization (initial value: Main scan cycle) Used for scan time measurement
B4E REAL P term previous value (initial value: SV-PV)
During speed type operation, this is used to calculate the speed component from difference
with previous value
B4D REAL SV filter differential term input previous value (initial value:αγSV-PV)
Used to calculate change in input in differential approximation operation
B5D REAL SV filter differential term input next to previous value (initial value: αγ SV-PV)
Used for exact differential term in improved bilinear primary transformation
B4D1 REAL SV filter differential term (initial value: 0) SV filter αγ term
B4D2 REAL SV filter proportional/integral term (initial value: (1-α)SV) αβ term of SV filter
B4MV REAL MV totalization limit previous value (initial value: TR)
High/low rate limiter previous MV totalization value (proportional/differential term assurance)
B4FFD REAL Feed forward dynamic characteristic difference calculation previous value (initial value: FFD)
Previous value for adding dynamic characteristic by difference
6F8C1226
23. Process Control 23-8
Function:
• There is no execution flag. This instruction is always executed. If the operation must be reset, set MVT as initialization
request. In this case, TR is also necessary in order to initialize MV.
• The result of executing the feed forward instruction (FFD_P) can be used as input (GAN, FFS, FFD) to feed forward. If feed
forward is not used, use fixed values (GAN=1, FFS=0, FFD=0).
• The PV parameter variable is referenced with the indicator PV no. (PVP) of the LP parameter variable.
• Direct I/O variables cannot be specified for PV data variable or LP parameter variable.
• Control operation function
Hyper PID is used for control operation. Output is the high/low rate limited positional type MV value.
♦ SV filter
An SV filter with super 2 degrees of freedom PID is implemented. Hyper PID adds a delay filter to SV in order to reduce
the change in MV even when SV changes suddenly. This SV filter is not related to change in PV and PV change
(disturbance) characteristic is unchanged. When tuning PID, set the parameters to be appropriate for the disturbance.
Under this condition, the filter status can be optimized for the step change of SV.
The 2 degrees of freedom parameters (α, β, γ) of hyper PID are semi-fixed values. Under normal condition, the initial
values can be used without change.
The SV filter includes differential operation. This differential operation uses an improved bilinear transformation that is
an improved version of the bilinear transformation which is a popular digital operation. Under normal condition, bilinear
transformation is used and a switch is made to exact differential when the rate time setting is relatively shorter than the
scan time. The rate time can be changed during control operation without problem.
The SV filter operation is performed during each scan cycle. Control operation is performed based on the specified
control cycle (T0, T1).
♦ Anti-reset windup
An anti-reset windup (ARW) function is added to cancel the excessive saturation of the integrating term. The method
used here suppresses the change in the saturating direction of the integrating term when MV is saturated at high/low
limit. Also, the internal MV totalization is high/low limited by high limit (MH+MV rate limiter) and low limit (ML-MV rate
limiter).
Although the ARW function is provided, a slight reset windup condition occurs. This is designed to prevent MV from
changing when there is a minute change in disturbance (change in PV) and SV when MV is saturated. Therefore, if SV
is reversed when MV is saturated, tracking by MV may be delayed. In such case, handle this from the application
program by changing the control mode to M mode and tracking manually, or temporarily switching to non-PID control
operation and using batch processing control for example.
Non-linear processing
A gap function is incorporated as non-linear PID. When the deviation is within the gap width, the change in MV output is
suppressed by multiplying the rate limiter by gap gain.
6F8C1226
23. Process Control 23-9
T1 Control time
T0 Sample time
MV
In sample PI, control operation is executed continuously during T1. Unlike intermittent control withΔT of PID, the
operation cycle is always the scan cycle. Therefore, the continuity of the proportional term and differential term is broken.
This discontinuity is handled by initializing the proportional term and differential term each time control execution is
started (beginning of T1).
The SV filter section is calculated during each cycle irrelevant of T0 and T1.
Program example:
PID_01
In case of L1
FIC100.SV SPI_P FIC100.MV
SV MV
LD ST
FIC100.PV
PV
LD
1
Variables:
GAN Variable Data type Dec.
LD PID_01 SPI_P VAR
0 Controller Variables:
FFS Variable Data type
LD
0 !FIC100 typeLP_PARA
FFD !FIC100 typeLP_DATA
LD
!FIC100 typePV_DATA
FIC100.MV
TR
LD
0
Scan cycle: 0.5s
MVT Sample time (T0): 20
LD Control time (T1): 5
FIC100.SV
LP_D
LD
FIC100.OA
LP_P
LD
• Performs sample PI operation of adjuster tag (FIC100). (Sample time: 10s, control time: 2.5s)
• This example uses basic PID (feed forward not used). For advanced PID, see the program example (assuming PID_P as
SPI_P) for the feed forward instruction (feed forward used).
6F8C1226
23. Process Control 23-10
Error information:
• If nonnumeric data is entered in input data, the result is output as nonnumeric.
• If RH=RL, the Divide Error Flag is set to ON and the previous value is held in output.
• If the LP parameter specification is incorrect (such as specifying variable other than LP tag parameter), the Table Operation
Error is set to ON and the previous value is held in output.
Notes:
• MV output when control is stopped
When PID operation is stopped because of tracking request or control stop warning, the output is as follows depending on
the condition for stopping.
Stop condition MV output
Tracking request flag (TR)=ON Tracking MV input (TR)
Mode=M or RM Tracking MV input (TR)
When mode changes Previous MV (held)
Control stop warning (CLI)=ON or MV error (MVE)=ON Previous MV (held)
Setting MV (SMV=ON or CMV=ON) Tracking MV input (TR)
6F8C1226
23. Process Control 23-11
Arguments:
Arg. Operand Type Const. Description
Input SV REAL √ SV input [Engineering value]
PV REAL √ PV input [Engineering value]
REAL Feed forward gain
GAN √ PID proportional gain compensation
Specify 1.0 when feed forward is not used
REAL Feed forward static characteristic [%]
FFS √
Specify 0.0 when feed forward is not used
MVT BOOL √ Tracking request flag
LP_D PTR ― LP data variable
LP_P PTR ― LP parameter variable
Output DMV REAL ― Result output (ΔMV) [%] (speed type)
CL BOOL ― Output request Pulse output update request
Pointers to tag table are placed in LP data variable and LP parameter variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Array Tag symbol
MCS connection DS connection
version version
(L1,L2,L3) (L2DS,L3DS)
Operand
LP_D LP_DATA[0] FIC100.SV FIC100.CLI
LP_P LP_PARA[0] FIC100.OA FIC100.TAG[0]
6F8C1226
23. Process Control 23-12
Instance structure:
Name Type Description
B4MODE UINT Control mode previous value (initial value: M) Used to detect change in control mode
CT REAL Actual time totalization (initial value: Main scan cycle) Used for scan time measurement
B4E REAL P term previous value (initial value: SV-PV)
During speed type operation, this is used to calculate the speed component from difference
with previous value
B4D REAL SV filter differential term input previous value (initial value: αγSV-PV)
Used to calculate change in input in differential approximation operation
B5D REAL SV filter differential term input next to previous value (initial value: αγSV-PV)
Used for exact differential term in improved bilinear primary transformation
B4D1 REAL SV filter differential term (initial value: 0) SV filter αγ term
B4D2 REAL SV filter proportional/integral term (initial value: (1-α)SV) αβ term of SV filter
6F8C1226
23. Process Control 23-13
Function:
• There is no execution flag. This instruction is always executed. If the operation must be reset, set MVT as initialization
request.
• The result of executing the feed forward instruction (FFD_P) can be used as input (GAN, FFS) to feed forward. If feed
forward is not used, use fixed values (GAN=1, FFS=0).
• The PV parameter variable is referenced with the indicator PV no. (PVP) of the LP parameter variable.
• Direct I/O variables cannot be specified for PV data variable or LP parameter variable.
• Control operation function
Hyper PID is used for control operation.
Output is the high/low rate limited positional type MV value.
♦ SV filter
An SV filter with super 2 degrees of freedom PID is implemented.
Hyper PID adds a delay filter to SV in order to reduce the change in MV even when SV changes suddenly. This SV
filter is not related to change in PV and PV change (disturbance) characteristic is unchanged. When tuning PID, set the
parameters to be appropriate for the disturbance. Under this condition, the filter status can be optimized for the step
change of SV.
The 2 degrees of freedom parameters (α, β, γ) of hyper PID are semi-fixed values. Under normal condition, the initial
values can be used without change.
The SV filter includes differential operation. This differential operation uses an improved bilinear transformation that is
an improved version of the bilinear transformation which is a popular digital operation. Under normal condition, bilinear
transformation is used and a switch is made to exact differential when the rate time setting is relatively shorter than the
scan time. The rate time can be changed during control operation without problem.
The SV filter operation is performed during each scan cycle. Control operation is performed based on the specified
control cycle (DT0).
♦ Non-linear processing
A gap function is incorporated as non-linear PID.
When the deviation is within the gap width, the change in MV output is suppressed by multiplying the rate limiter by gap
gain.
6F8C1226
23. Process Control 23-14
Program example:
PID_01
FIC100.SV PIDP_P FIC100.PMV In case of L1
SV DMV
LD ST
FIC100.PV FIC100.POR
PV CL
LD ST
1
GAN Variables:
LD
Variable Data type Dec.
0
FFS PID_01 PIDP_P VAR
LD Controller Variables:
0 Variable Data type
MVT
LD !FIC100 typeLP_PARA
FIC100.SV !FIC100 typeLP_DATA
LP_D !FIC100 typePV_DATA
LD
FIC100.OA
LP_P
LD
Error information:
• If nonnumeric data is entered in input data, the result is output as nonnumeric.
• If RH=RL, the Divide Error Flag is set to ON and the previous value is held in output.
• If the LP parameter specification is incorrect (such as specifying variable other than LP tag parameter), the Table Operation
Error is set to ON and the previous value is held in output.
6F8C1226
23. Process Control 23-15
Arguments:
Arg. Operand Type Const. Description
Input SV REAL √ SV input [Engineering value]
PV REAL √ PV input [Engineering value]
GAN REAL √ Feed forward gain
PID proportional gain compensation
Specify 1.0 when feed forward is not used
FFS REAL √ Feed forward static characteristic [%]
Specify 0.0 when feed forward is not used
MVT BOOL √ Tracking request flag
LP_D PTR ― LP data variable
LP_P PTR ― LP parameter variable
Output DMV REAL ― Result output (ΔMV) [%] (speed type)
CL BOOL ― Output request Pulse output update request
Pointers to tag table are placed in LP data variable and LP parameter variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Array Tag symbol
MCS connection DS connection
version version
(L1,L2,L3) (L2DS,L3DS)
Operand
LP_D LP_DATA[0] FIC100.SV FIC100.CLI
LP_P LP_PARA[0] FIC100.OA FIC100.TAG[0]
6F8C1226
23. Process Control 23-16
Instance structure:
Name Type Description
B4MODE UINT Control mode previous value (initial value: M) Used to detect change in control mode
CT REAL Actual time totalization (initial value: Main scan cycle) Used for scan time measurement
B4E REAL P term previous value (initial value: SV-PV)
During speed type operation, this is used to calculate the speed component from difference
with previous value
B4D REAL SV filter differential term input previous value (initial value: αγ SV-PV)
Used to calculate change in input in differential approximation operation
B5D REAL SV filter differential term input next to previous value (initial value: αγ SV-PV)
Used for exact differential term in improved bilinear primary transformation
B4D1 REAL SV filter differential term (initial value: 0) SV filter αγ term
B4D2 REAL SV filter proportional/integral term (initial value: (1-α)SV) αβ term of SV filter
6F8C1226
23. Process Control 23-17
Function:
• There is no execution flag. This instruction is always executed. If the operation must be reset, set MVT as initialization
request.
• The result of executing the feed forward instruction (FFD_P) can be used as input (GAN, FFS) to feed forward. If feed
forward is not used, use fixed values (GAN=1, FFS=0).
• The PV parameter variable is referenced with the indicator PV no. (PVP) of the LP parameter variable.
• Direct I/O variables cannot be specified for PV data variable or LP parameter variable.
• Control operation function
Hyper PID is used for control operation.
The high/low rate limited speed type MV value and output request flag indicating the pulse update timing are output.
♦ SV filter
An SV filter with super 2 degrees of freedom PID is implemented.
Hyper PID adds a delay filter to SV in order to reduce the change in MV even when SV changes suddenly. This SV
filter is not related to change in PV and PV change (disturbance) characteristic is unchanged. When tuning PID, set the
parameters to be appropriate for the disturbance. Under this condition, the filter status can be optimized for the step
change of SV.
The 2 degrees of freedom parameters (α, β, γ) of hyper PID are semi-fixed values. Under normal condition, the initial
values can be used without change.
The SV filter includes differential operation. This differential operation uses an improved bilinear transformation that is
an improved version of the bilinear transformation which is a popular digital operation. Under normal condition, bilinear
transformation is used and a switch is made to exact differential when the rate time setting is relatively shorter than the
scan time. The rate time can be changed during control operation without problem.
The SV filter operation is performed during each scan cycle. Control operation is performed based on the specified
control cycle (T0, T1).
♦ Non-linear processing
A gap function is incorporated as non-linear PID.
When the deviation is within the gap width, the change in MV output is suppressed by multiplying the rate limiter by gap
gain.
♦ Sampling and control
The sample PI adjusts the time where control is intermittent in the control cycle of the PID operation.
Output is updated during the control time (T1) at the front half of the sample time (T0).
CL
T1 Control time
T0 Sample time
MV
In sample PI, control operation is executed continuously during T1. Unlike intermittent control with ΔT of PID, the
operation cycle is always the scan cycle. Therefore, the continuity of the proportional term and differential term is
broken. This discontinuity is handled by initializing the proportional term and differential term each time control
execution is started (beginning of T1).
The SV filter section is calculated during each cycle irrelevant of T0 and T1.
6F8C1226
23. Process Control 23-18
Program example:
PID_01
FIC100.SV SPIP_P FIC100.PMV In case of L1
SV DMV
LD ST
FIC100.PV FIC100.POR
PV CL
Variables:
LD ST
Variable Data type Dec.
1
GAN PID_01 SPIP_P VAR
LD Controller Variables:
0 Variable Data type
FFS
LD !FIC100 typeLP_PARA
0 !FIC100 typeLP_DATA
MVT !FIC100 typePV_DATA
LD
FIC100.SV
LP_D Scan cycle: 0.5s
LD
Sample time (T0): 20
FIC100.OA
Control time (T1): 5
LP_P
LD
• Performs sample PI operation of adjuster tag (FIC100). (Sample time: 10s, control time: 2.5s)
• This example outputs directly to adjuster tag pulse output ΔMV (PVM) and pulse output request (POR).
• This example uses basic PID (feed forward not used). For advanced PID, see the program example (assuming PIDP_P as
SPIP_P) for the feed forward instruction (feed forward used).
Error information:
• If nonnumeric data is entered in input data, the result is output as nonnumeric.
• If RH=RL, the Divide Error Flag is set to ON and the previous value is held in output.
• If the LP parameter specification is incorrect (such as specifying variable other than LP tag parameter), the Table Operation
Error is set to ON and the previous value is held in output.
6F8C1226
23. Process Control 23-19
Arguments:
Arg. Operand Type Const. Description
Input X REAL √ Input variable [Engineering value]
FF_P PTR ― Feed forward parameter variable
LP_D PTR ― LP data variable
Output GAN REAL ― Feed forward gain
FFS REAL ― Feed forward static characteristic [%]
FFD REAL ― Feed forward dynamic characteristic [%]
A pointer to tag table is placed in LP data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Array Tag symbol
MCS connection DS connection
version version
(L1,L2,L3) (L2DS,L3DS)
Operand
LP_D LP_DATA[0] FIC100.SV FIC100.CLI
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
LP_D MODE UINT R control mode
(LP_DATA) Used for control operation execution, reset condition
CLI BOOL R Control stop alarm Used for control operation reset condition
MVE BOOL R MV error
SMV BOOL R Sequence MV
CMV BOOL R Computer MV
R/W: R=Read only, W=Write only, R/W=Read/Write
Instance structure:
Name Type Description
B4MODE UINT Control mode previous value (initial value: M) Used to detect change in control mode
B4D REAL Feed forward dynamic characteristic input value
B4Y REAL Feed forward dynamic characteristic temporary delay
Function:
• There is no execution flag. This instruction is always executed.
• Direct I/O variables cannot be specified for PV parameter variable or LP parameter variable.
• Control operation function
Three types of output, gain compensation (GAN), static characteristic compensation (FFS), and dynamic characteristic
compensation (FFD) are calculated as gain scheduling type feed forward.
KO 1+TPS
X K
1+TDS
+
HL
-
limit
Program example:
Performs PID operation of adjuster tag (FIC100) with feed forward of disturbance element (IND100.PV) added.
Error information:
• If nonnumeric data is entered in input data, the result is output as nonnumeric.
6F8C1226
23. Process Control 23-22
Arguments:
Arg. Operand Type Const. Description
Input PV REAL √ Master input variable [%]
AIR REAL √ Air flow [Engineering value]
FUEL REAL √ Fuel flow [Engineering value]
FTR REAL √ Fuel MV tracking value [Engineering value]
ATR REAL √ Air MV tracking value [Engineering value]
DCL_P PTR ― Double cross limit parameter table
LP_FD PTR ― Fuel LP data variable
LP_FP PTR ― Fuel LP parameter variable
LP_AD PTR ― Air LP data variable
LP_AP PTR ― Air LP parameter variable
Output FSV REAL ― Fuel adjuster SV [Engineering value]
ASV REAL ― Air adjuster SV [Engineering value]
Pointers to tag table are placed in LP data variable and LP parameter variable.
A setup example is shown below. Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Array Tag symbol
MCS DS connection
connection version
version (L2DS,L3DS)
Operand (L1,L2,L3)
LP_FD,LP_AD LP_DATA[0] FIC100.SV FIC100.CLI
LP_FP,LP_AP LP_PARA[0] FIC100.OA FIC100.TAG[0]
6F8C1226
23. Process Control 23-23
Instance structure:
Name Type Description
B4FMODE UINT (Not used)
B4AMODE UINT (Not used)
PD1 REAL (Not used)
PD2 REAL (Not used)
DLM1 REAL (Not used)
DLM2 REAL (Not used)
Function:
• There is no execution flag. This instruction is always executed.
• Direct I/O variables cannot be specified for LP parameter variable, LP data variable, or DCL parameter variable.
• Control operation function
The fuel and air settings are calculated using combustion control as a model.
Master input
MED
AIR.PV 1 100-K3
% UNIT F
βμ 100
100+K1
100
MED
FUEL.PV 100+K4 L
% βμ UNIT A
100 low
limit
100-K2
100
6F8C1226
23. Process Control 23-25
Program example:
FIC100.PV PV AIC100.PV PV
LD LD
1 GAN 1 GAN
LD LD
0 FFS 0 FFS
LD LD
0 FFD 0 FFD
LD LD
FIC100.MV TR AIC100.MV TR
LD LD
0 MVT 0 MVT
LD LD
Performs double cross limit control with master PID (DIC100) result output (MV) as master input, gives that result to fuel flow
PID(FIC100) and air flow PID(AIC100), and optimizes the fuel flow and air flow.
6F8C1226
23. Process Control 23-26
Error information:
• If nonnumeric data is entered in input data, the result is output as nonnumeric.
• The fuel flow and air flow are calculated with % value as input when the respective indicator is RH=RL.
• If the LP data specification is invalid (such as specifying variable other than LP tag data), the Table Operation Error is set to
ON and the previously held value is output.
6F8C1226
24. Tag Operartion Funtions 24-1
24 Tag Operartion
Mode MODE
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input MODE UINT √ Mode (0:M/1:A/2:C/3:RM)
LP_D PTR — LP data variable
Output — BOOL — Output
A pointer to tag table is placed in LP data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Operand Array Tag symbol
LP_D LP_DATA[0] FIC100.CLI
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
LP_D MODE UINT W Control mode
(LP_DATA)
R/W: R=Read only, W=Write only, R/W=Read/Write
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the mode of the LP data variable specified with LP_D is set to the value specified
with MODE and ON is output as the result.
Execution Action Output
control input
OFF — OFF
ON Sets the mode of the specified LP data variable. ON
6F8C1226
24. Tag Operartion Funtions 24-3
Program example:
SIGNAL1 CMLP_P SIGNAL2
1 E 1
LD ST
1 MODE
LD
FIC100.SV LP_D
LD
• When the Execution Control Input SIGNAL1 is ON, sets the adjuster tag (FIC100) mode to A.
Error information:
• If the LP parameter specification is incorrect (such as specifying variable other than LP tag parameter), the Table Operation
Error is set to ON and the instruction itself is treated as no process.
• If the mode is out of range (4 or greater) the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-4
Mode MODE
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input MODE UINT √ Mode (0:M/1:A/2:C/3:RM)
PB_D PTR — PB data variable
Output — BOOL — Output
The C mode is valid only when tag type is 2PC in DC connection version. Otherwise, the mode is M/A/RM.
A pointer to tag table is placed in PB data variable.
A setup example is shown below.
Array no.=0, tag no.=XV100 are assumed for the used push button tag.
Notation Operand Array Tag symbol
PB_D PB_DATA[0] XV100.ASA
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
PB_D MODE UINT W control mode
(PB_DATA)
Referenced by TYPE UINT R Tag type (used only in DS connection version only)
PB_D (SOV/MOT/MOV/PB4/PB8/PB2/2PC)
(PB_PARA)
R/W: R=Read only, W=Write only, R/W=Read/Write
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the mode of the PB data variable specified with PB_D is set to the value specified
with MODE and ON is output as the result.
Execution Action Output
control input
OFF — OFF
ON Sets the mode of the specified PB data variable. ON
6F8C1226
24. Tag Operartion Funtions 24-5
Program example:
SIGNAL1 CMPB_P SIGNAL2
1 E 1
LD ST
1 MODE
LD
XV100.SCN LP_D
LD
• When the Execution Control Input SIGNAL1 is ON, sets the push button tag (XV100) mode to A.
Error information:
• If the PB parameter specification is incorrect (such as specifying variable other than PB tag parameter), the Table Operation
Error is set to ON and the instruction itself is treated as no process.
• If the mode is out of range (4 or greater) the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-6
Mode MODE
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input MODE UINT √ Mode (0:M/1:A/2:C/3:RM)
SQ_D PTR — SQ data variable
Output — BOOL — Output
A pointer to tag table is placed in SQ data variable.
A setup example is shown below.
Array no.=0, tag no.=SEQ100 are assumed for the used sequence tag.
Notation Operand Array Tag symbol
SQ_D SQ_DATA[0] SEQ100.STA
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
SQ_D MODE UINT W control mode
(SQ_DATA)
R/W: R=Read only, W=Write only, R/W=Read/Write
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the mode of the SQ data variable specified with SQ_D is set to the value
specified with MODE and ON is output as the result.
Execution Action Output
control input
OFF — OFF
ON Sets the mode of the specified SQ data variable. ON
6F8C1226
24. Tag Operartion Funtions 24-7
Program example:
SIGNAL1 CMSQ_P SIGNAL2
1 E 1
LD ST
1 MODE
LD
SEQ100.STA SQ_D
LD
• When the Execution Control Input SIGNAL1 is ON, sets the sequence tag (SEQ100) mode to A.
Error information:
• If the SQ parameter specification is incorrect (such as specifying variable other than SQ tag parameter), the Table Operation
Error is set to ON and the instruction itself is treated as no process.
• If the mode is out of range (4 or greater) the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-8
Tilt SVK
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
SVP REAL √ Target value
SVK REAL √ Tilt
Input
SVT REAL √ Tilt unit (1: sec./60:min./3600: hr)
LP_P PTR — LP parameter variable
LP_D PTR — LP data variable
Output — BOOL — Output
Pointers to tag table are placed in LP parameter variable and LP data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Operand Array Tag symbol
LP_P LP_PARA[0] FIC100.TAG[0]
LP_D LP_DATA[0] FIC100.CLI
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
LP_P SVP REAL R/W SV ramp target value
(LP_PARA) SVK REAL R/W SV ramp increment
SVT REAL R/W SV ramp time coefficient
LP_D SSV BOOL W SEQ-SV intervention status
(LP_DATA)
R/W: R=Read only, W=Write only, RW=Read/Write
6F8C1226
24. Tag Operartion Funtions 24-9
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, sets the setup information (SVP, SVK, SVT) of the LP parameter variable
specified by LP_P to the value specified with input argument, sets the SSV of LP data variable specified by LP_D to ON, and
output ON as the result. (Start of Set SV directive)
• This instruction provides the setup information (SVP, SVK, SVT) and directive (SSV) to perform ramp SV action, but does
not perform the actual ramp SV action. A separate program must be created to perform the ramp SV action. (See program
example)
• This instruction is used together with the Reset SV (RSV_P) instruction.
Execution Action Output
control input
OFF No process OFF
ON Starts the Set SV directive of the specified LP variable ON
Error information:
• If the LP parameter and LP data specifications are incorrect (such as specifying variable other than LP tag parameter), the
Table Operation Error is set to ON and the instruction itself is treated as no process.
• If a "nonnumeric" is input as input data, Nonnumeric Input Error is set to ON and the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-10
Program example:
SSV control section
SSV_REQ SSV_P SIGNAL1 SSV_REQ RSV_P SIGNAL2 In case of L3DS
P E N E
ST ST
FIC100.CLI
80 SVP LP_D
LD LD
5 SVK
LD
1 SVT
LD
FIC100.
TAG[0] LP_P
LD
FIC100.CLI
LP_D
LD
Variables:
Variable Data type Dec.
SSV_REQ BOOL VAR
SSV_EXEC BOOL VAR
SIGNAL1 BOOL VAR
SIGNAL2 BOOL VAR
PID_01 PID_P VAR
DLM_01 DLM_REAL VAR
Controller Variables:
Variable Data type
!FIC100 typeLP_PARA_DS
!FIC100 typeLP_DATA_DS
ZF ARRAY[0..4095] OF REAL
6F8C1226
24. Tag Operartion Funtions 24-11
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input
LP_D PTR — LP data variable
Output — BOOL — Output
A pointer to tag table is placed in LP data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Operand Array Tag symbol
LP_D LP_DATA[0] FIC100.CLI
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
LP_D SSV BOOL W SEQ-SV intervention status
(LP_DATA)
R/W: R=Read only, W=Write only, R/W=Read/Write
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the SSV of the LP data variable specified with LP_D is reset to OFF and ON is
output as the result. (Resetting Set SV directive)
• This instruction is used together with the Set SV (SSV_P) instruction.
Execution Action Output
control input
OFF No process OFF
ON Resets the Set SV directive of the specified LP variable ON
Program example:
Refer to the program example of the Set SV (SSV_P) instruction.
Error information:
• If the LP data specification is incorrect (such as specifying variable other than LP tag parameter), the Table Operation Error
is set to ON and the instruction itself is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-13
Tilt MVK
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
MVP REAL √ Target value
MVK REAL √ Tilt
Input
MVT REAL √ Tilt unit (1: sec./60:min./3600: hr)
LP_P PTR — LP parameter variable
LP_D PTR — LP data variable
Output - BOOL — Output
Pointers to tag table are placed in LP parameter variable and LP data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Operand Array Tag symbol
LP_P LP_PARA[0] FIC100.TAG[0]
LP_D LP_DATA[0] FIC100.CLI
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
LP_P MVP REAL R/W MV ramp target value
(LP_PARA) MVK REAL R/W MV ramp increment
MVT REAL R/W MV ramp time coefficient
LP_D SMV BOOL W SEQ-MV intervention status
(LP_DATA)
R/W: R=Read only, W=Write only, R/W=Read/Write
6F8C1226
24. Tag Operartion Funtions 24-14
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, sets the setup information (MVP, MVK, MVT) of the LP parameter variable
specified by LP_P to the value specified with input argument, sets the SMV of LP data variable specified by LP_D to ON, and
output ON as the result. (Start of Set MV directive)
• This instruction provides the setup information (MVP, MVK, MVT) and directive (SMV) to perform ramp MV action, but does
not perform the actual ramp MV action. A separate program must be created to perform the ramp MV action. (See program
example)
• This instruction is used together with the Reset MV (RMV_P) instruction.
Execution Action Output
control input
OFF No process OFF
ON Starts the Set MV directive of the specified LP variable ON
Error information:
• If the LP parameter and LP data specifications are incorrect (such as specifying variable other than LP tag parameter), the
Table Operation Error is set to ON and the instruction itself is treated as no process.
• If a "nonnumeric" is input as input data, Nonnumeric Input Error is set to ON and the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-15
Program example:
SMV control section
SMV_REQ SMV_P SIGNAL1 SMV_REQ RMV_P SIGNAL2 In case of L3DS
P E N E
ST ST
FIC100.CLI Variables:
80 SVP LP_D Variable Data type Dec.
LD LD
SMV_REQ BOOL VAR
5 SVK SMV_EXEC BOOL VAR
LD SIGNAL1 BOOL VAR
SIGNAL2 BOOL VAR
1 SVT
LD PID_01 PID_P VAR
FIC100. DLM_01 DLM_REAL VAR
TAG[0] LP_P Controller Variables:
LD
Variable Data type
FIC100.CLI
LP_D !FIC100 typeLP_PARA_DS
LD !FIC100 typeLP_DATA_DS
ZF ARRAY[0..4095] OF REAL
Instrumentation FB section SMV execution section
PID_01
FIC100.SV PID_P FIC100.MV FIC100.MVE FIC100.CLI FIC100.SMV SMV_EXEC
SV MV / / ( )
LD ST DLM_REAL_1
FIC100.PV SMV_EXEC SEL_REAL SMV_EXEC DLM_REAL SMV_EXEC FIC100.MV
PV G E
LD LD ST
FIC100.MV
1 GAN IN0 IN
LD LD
FIC100.
0 FFS MVP IN1
LD LD
ZF[23] DIV_REAL MUL_REAL DIV_REAL
0 FFD D
LD LD
FIC100.MV
TR 1000
LD LD
FIC100.
0 MVT MVK
LD LD
FIC100.CLI FIC100.
LP_D MVT
LD LD
FIC100.
TAG[0] LP_P
LD
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input
LP_D PTR — LP data variable
Output — BOOL — Output
A pointer to tag table is placed in LP data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Operand Array Tag symbol
LP_D LP_DATA[0] FIC100.CLI
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
LP_D SMV BOOL W SEQ-MV intervention status
(LP_DATA)
R/W: R=Read only, W=Write only, R/W=Read/Write
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the SMV of the LP data variable specified with LP_D is reset to OFF and ON is
output as the result. (Resetting Set MV directive)
• This instruction is used together with the Set MV (SMV_P) instruction.
Execution Action Output
control input
OFF No process OFF
ON Resets the Set MV directive of the specified LP variable ON
Program example:
Refer to the program example of the Set MV (SMV_P) instruction.
Error information:
• If the LP data specification is incorrect (such as specifying variable other than LP tag parameter), the Table Operation Error
is set to ON and the instruction itself is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-17
Mode MOD
MV value MV
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
MOD UINT √ Mode (0:M/1:A/2:C/3:RM)
Input MV REAL √ MV value[%]
LP_P PTR — LP parameter variable
LP_D PTR — LP data variable
Output — BOOL — Output
Pointers to tag table are placed in LP parameter variable and LP data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used adjuster tag.
Notation Operand Array Tag symbol
LP_P LP_PARA[0] FIC100.TAG[0]
LP_D LP_DATA[0] FIC100.CLI
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
LP_P MVP REAL R/W MV ramp target value
(LP_PARA) MVK REAL R/W MV ramp increment
MVT REAL R/W MV ramp time coefficient
LP_D SMV BOOL W SEQ-MV intervention status
(LP_DATA)
R/W: R=Read only, W=Write only, R/W=Read/Write
6F8C1226
24. Tag Operartion Funtions 24-18
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the MV value is set immediately to the specified value and the mode is set to the
specified mode.
Sets setup information of the LP parameter variable specified with LP_P to the value specified with the input argument
(MVP=input argument MV, MVK=2000, MVT=1), sets the SMV of LP data variable specified by LP_D to ON, sets the mode
to the mode specified with the input argument, and outputs ON as the result. (Start of Set MV directive, The actual action is
step action (change immediately to specified MV value) because the tilt is set large.)
• This instruction provides the setup information (MVP, MVK, MVT) and directive (SMV) to perform ramp MV action, but does
not perform the actual ramp MV action. A separate program must be created to perform the ramp MV action. (See program
example)
• This instruction is used together with the Reset MV (RMV_P) instruction.
Execution Action Output
control input
OFF No process OFF
ON Starts the Set MV directive of the specified LP variable ON
Error information:
• If the LP parameter and LP data specifications are incorrect (such as specifying variable other than LP tag parameter), the
Table Operation Error is set to ON and the instruction itself is treated as no process.
• If a "nonnumeric" is input as input data, Nonnumeric Input Error is set to ON and the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-19
Program example:
SCV control section
SCV_REQ SCV_P SIGNAL1 SCV_REQ RMV_P SIGNAL2 In case of L3DS
P E N E
ST ST
FIC100.CLI Variables:
0 MOD LP_D Variable Data type Dec.
LD LD
SCV _REQ BOOL VAR
10 MV SMV_EXEC BOOL VAR
LD SIGNAL1 BOOL VAR
FIC100. SIGNAL2 BOOL VAR
TAG[0] LP_P
LD PID_01 PID_P VAR
FIC100.CLI DLM_01 DLM_REAL VAR
LP_D Controller Variables:
LD
Variable Data type
!FIC100 typeLP_PARA_DS
!FIC100 typeLP_DATA_DS
ZF ARRAY[0..4095] OF REAL
Instrumentation FB section SMV execution section
PID_01
FIC100.SV PID_P FIC100.MV FIC100.MVE FIC100.CLI FIC100.SMV SMV_EXEC
SV MV / / ( )
LD ST DLM_REAL_1
FIC100.PV SMV_EXEC SEL_REAL SMV_EXEC DLM_REAL SMV_EXEC FIC100.MV
PV G E
LD LD ST
FIC100.MV
1 GAN IN0 IN
LD LD
FIC100.MVP
0 FFS IN1
LD LD
ZF[23] DIV_REAL MUL_REAL DIV_REAL
0 FFD D
LD LD
FIC100.MV
TR 1000
LD LD
FIC100.
0 MVT MVK
LD LD
FIC100.CLI FIC100.
LP_D MVT
LD LD
FIC100.
TAG[0] LP_P
LD
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
BNO UINT √ Push button no. (1 to 8)
Input
PB_P PTR — PB parameter variable
PB_D PTR — PB data variable
Output — BOOL — Output
Pointers to tag table are placed in PB parameter variable and PB data variable.
A setup example is shown below.
Array no.=0, tag no.=FIC100 are assumed for the used push button tag.
Notation Operand Array Tag symbol
PB_P PB_PARA[0] XV100.TAG[0]
PB_D PB_DATA[0] XV100.ASA
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
PB_P MODS UINT R Mode usage setting
(PB_PARA)
PB_D MODE UINT R Mode (0:M/1:A/2:C/3:RM)
(PB_DATA) RFO[n] BOOL W Button ON request (n=0: button 1 to 7: button 8)
R/W: R=Read only, W=Write only, R/W=Read/Write
6F8C1226
24. Tag Operartion Funtions 24-21
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, sets the specified push button ON.
When the button manipulation enable condition (PB_P.MODS="Not used" or (PB_P.MODS="Use" and PB_D.MODE=A
mode)) is satisfied, sets the corresponding bit of the RFO of the PB data variable specified with PB_D to ON and outputs ON
as the result. (Button ON directive)
• This instruction sets the button ON (RFO). The content of RFO is reflected in FO by standard output process. Therefore, the
result of this instruction is not reflected when FO is accessed immediately after executing this instruction (in that control
cycle). The reflected result can be accessed on the next cycle.
Execution Action Output
control input
OFF No process OFF
ON Executes button ON directive of the specified PB variable ON
Program example:
• At the rise of PB request (PB_REQ), issues a button 2ON directive for the push button tag (XV100).
Error information:
• If the PB parameter and PB data specifications are incorrect (such as specifying variable other than PB tag parameter), the
Table Operation Error is set to ON and the instruction itself is treated as no process.
• If the push button on. (BNO) is out of range (not 1 to 8), the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-22
Arguments:
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the specified push button is locked. When the push button no. (BNO) is between
1 and 8, the corresponding button is locked. If the push button no. is 0, the button is unlocked.
Sets the corresponding bit of the IFO of the PB data variable specified by PB_D to ON (or resets all bits to OFF) and outputs
ON as the result. (Button lock directive)
• This instruction locks the button (IFO). The content of IFO is reflected in FO by standard output process. Therefore, the
result of this instruction is not reflected when FO is accessed immediately after executing this instruction (in that control
cycle). The reflected result can be accessed on the next cycle.
Execution Action Output
control input
OFF No process OFF
ON Executes button lock directive of the specified PB variable ON
Program example:
In case of L3DS
• At the rise of LB request (LB_REQ), issues a button 2 lock directive for the push button tag (XV100). At the fall of LB
request, unlocks the lock.
Error information:
• If the PB data specification is incorrect (such as specifying variable other than PB tag data), the Table Operation Error is set
to ON and the instruction itself is treated as no process.
• If the push button on. (BNO) is out of range (not 0 to 8), the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-24
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
STATE UINT √ Directive to timer
Input
(0: start/1: stop/2: reset)
T_D PTR — T data variable
Output — BOOL — Output
A pointer to tag table is placed in T data variable.
A setup example is shown below.
The timer tag to be used will be array no.=0.
T_DATA[0]
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
T_D STAT BOOL W Start
(T_DATA) STOP BOOL W Stop
RST BOOL W Reset
R/W: R=Read only, W=Write only, R/W=Read/Write
The following symbols can be accessed to check the execution status of the timer tag.
Operand Symbol Type R/W Description
T_PARA SET INT R/W Set value (target value)
T_DATA VAL INT R/W Clock value (current value)
STAT BOOL R Start
STOP BOOL R Stop
RST BOOL R Reset
UP BOOL R Timeout
R/W: R=Read only, W=Write only, R/W=Read/Write
For the timer tag, the unit of SET and VAL is different between the first half and second half of the array.
Array no. Unit Clock range Precision
(error)
0 to 255 0.1 s 0.0[s] to 3276.7[s] 0.1 [s] max.
256 to 511 0.1 min 0.0[min] to 3276.7[min] 0.1 [min] max.
(0.0[s] to 196602[s]) (6[s])
6F8C1226
24. Tag Operartion Funtions 24-25
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the specified timer tag is activated.
Manipulates the STAT, STOP, RST of the T data variable specified by T_D and outputs ON as the result (timer manipulation
directive). The relationships between the directive (STATE) to the timer and STAT, STOP, RST are as shown below and
either STAT, STOP, or RST is set to ON.
Directive to timer
Manipulation
STATE
STAT STOP RST
0: Start ON OFF OFF
1: Stop OFF ON OFF
2: Reset OFF OFF ON
Timing chart:
Start Start
Stop Stop Reset Reset
Timer maximum(32767)
T_PARA[n].SET
T_DATA[nA].VAL
Timer initial value (0)
T_DATA[n].STAT
T_DATA[n].STOP
T_DATA[n].RST
T_DATA[n].UP
t
Error information:
• If the T data specification is incorrect (such as specifying variable other than T tag data), the Table Operation Error is set to
ON and the instruction itself is treated as no process.
• If the directive to the timer (STATE) is out of range (not 0 to 2), the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-26
Notes:
• This instruction executes a timer manipulation directive (STAT, STOP, RST). The timer tag clocking (updating current value,
timeout judgment) is synchronized with the main scan process and is performed before program execution. Therefore, the
result of this instruction is not reflected when UP status is accessed immediately after executing this instruction (in that
control cycle). The reflected result can be accessed on the next cycle. Also, when using this instruction in a high-speed scan
process, caution is necessary because the actual timer tag clocking is synchronized with the scan process.
• The timer precision (tolerance) is affected by the scan process cycle because the timer clocking is synchronized with the
main scan process. At maximum, the offset is equal to the main scan process cycle.
• If this instruction is executed for the same timer tag more than once in the same process cycle, the instruction (directive)
executed last is effective and other instructions are not reflected (either start, stop, or reset action per process cycle).
• Only the timer tag (T_PARA(DATA)) can be used with this instruction. Clock or count down (TC_PARA(DATA)) cannot be
used.
Program example:
In case of L3DS
Variables:
Variable Data type Dec.
STAT_REQ BOOL VAR
STOP_REQ BOOL VAR
RST_REQ BOOL VAR
SIGNAL1 BOOL VAR
SIGNAL2 BOOL VAR
SIGNAL3 BOOL VAR
Controller Variables:
Variable Data type
T_PARA ARRAY[0..511] OF typeT_PARA_DS
T_DATA ARRAY[0..511] OF typeT_DATA_DS
T_DATA[0].UP
UP time
process
• At the rise of start request (STAT_REQ), issues a start directive to the timer tag (T_DATA[0]).
• At the rise of stop request (STOP_REQ), issues a stop directive to the timer tag (T_DATA[0]).
• At the rise of reset request (RST_REQ), issues a reset directive to the timer tag (T_DATA[0]).
• At time-up (T_DATA[0].UP=ON), executes the UP time process.
6F8C1226
24. Tag Operartion Funtions 24-27
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
STATE UINT √ Directive to counter
Input
0: Increment, 1: Decrement, 2: Reset
C_D PTR — C data variable
Output — BOOL — Output
A pointer to tag table is placed in C data variable.
A setup example is shown below.
The timer tag to be used will be array no.=0.
C_DATA[0]
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
C_D INC BOOL W Increment
(C_DATA) DEC BOOL W Decrement
RST BOOL W Reset
R/W: R=Read only, W=Write only, R/W=Read/Write
The following symbols can be accessed to check the execution status of the counter tag.
Operand Symbol Type R/W Description
C_PARA SET INT R/W Set value (target value)
C_DATA VAL INT R/W Clock value (current value)
STAT BOOL R Start
STOP BOOL R Stop
RST BOOL R Reset
UP BOOL R Count up
DOWN BOOL R Count down
R/W: R=Read only, W=Write only, R/W=Read/Write
6F8C1226
24. Tag Operartion Funtions 24-28
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the specified counter tag is activated.
Manipulates the INC, DEC, RST of the C data variable specified by C_D and outputs ON as the result (timer manipulation
directive). The relationships between the directive (STATE) to the counter and INC, DEC, RST are as shown below and
either INC, DEC, or RST is set to ON.
Directive to counter Manipulation
STATE INC DEC RST
0: Increment ON OFF OFF
1: Decrement OFF ON OFF
2: Reset OFF OFF ON
Timing chart:
Decrement Reset Decrement Reset
Increment Set value=0 Increment
Counter maximum(32767)
C_DATA[n].VAL
C_PARA[n].SET
Counter initial value(0)
-C_PARA[n].SET
Counter minimum(-32768)
C_DATA[n].UP
C_DATA[n].DOWN
t
Error information:
• If the C data specification is incorrect (such as specifying variable other than C tag data), the Table Operation Error is set to
ON and the instruction itself is treated as no process.
• If the directive (STATE) to the counter is out of range (not 0 to 2), the instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-29
Notes:
• This instruction executes a counter manipulation directive (INC, DEC, RST). The updating of the counter tag (current value
count, up judgment) is synchronized with the main scan process and is performed before program execution. Therefore, the
result of this instruction is not reflected when UP status is accessed immediately after executing this instruction (in that
control cycle). The reflected result can be accessed on the next cycle. Also, when using this instruction in a high-speed scan
process, caution is necessary because the actual counter tag update is synchronized with the scan process.
• If this instruction is executed for the same counter tag more than once in the same process cycle, the instruction (directive)
executed last is effective and other instructions are not reflected (only 1 count changes per process cycle).
• Only the counter tag (C_PARA(DATA)) can be used with this instruction. Clock or count down (TC_PARA(DATA)) cannot be
used.
Program example:
In case of L3DS
Variables:
Variable Data type Dec.
INC_REQ BOOL VAR
DEC_REQ BOOL VAR
RST_REQ BOOL VAR
SIGNAL1 BOOL VAR
SIGNAL2 BOOL VAR
SIGNAL3 BOOL VAR
Controller Variables:
Variable Data type
C_PARA ARRAY[0..511] OF typeC_PARA_DS
C_DATA ARRAY[0..511] OF typeC_DATA_DS
• At the rise of increment request (INC_REQ), issues an increment directive to the counter tag (C_DATA[0]). At the rise of
decrement request (DEC_REQ), issues a decrement directive to the counter tag (C_DATA[0]). At the rise of reset request
(RST_REQ), issues a reset directive to the counter tag (C_DATA[0]).
• At count up (C_DATA[0].UP=ON), executes the UP time process.
• At count down (C_DATA[0].DOWN=ON), executes the DOWN time process.
6F8C1226
24. Tag Operartion Funtions 24-30
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input
STEP PTR — Jump destination step instance
Output — BOOL — Output
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, the step activation location is changed and ON is output as the result.
Deactivates the step to which this instruction is connected and activates the step specified by jump destination step (STEP).
Execution control input Action Output
OFF No process OFF
ON Changes the activation location to the specified step ON
Error information:
• If a variable other than a step is specified for the jump destination step (STEP) or if the connected destination of the
Execution Control Input (E) of this instruction is not a step type instruction (Step, Answer Step, Phase End Step), Boundary
Error is set to ON and this instruction is treated as no process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-31
Program example:
• If the PHASE 1, 2 repeat condition (CONTINUE) is ON, self step jump (SJ_P) occurs and the active location changes from
S1 to PHASE1 when execution of PHASE1 and PHASE2 completes and S1 becomes active (repeats execution of PHASE1
and PHASE2).
• When the repeat condition (CONTINUE) is reset to OFF, self step jump is not performed when S1 becomes active and
continues to the next step when T4 is set to ON.
6F8C1226
24. Tag Operartion Funtions 24-32
Restriction:
• This instruction cannot be connected to non-SFC network (normal LD circuit). If it is connected to normal LD circuit,
unrelated step instruction (step instruction just before the SJ_P instruction in the execution sequence) will be deactivated. Or,
a boundary error may occur. A BOOL type LD/FBD circuit may be inserted between the Step instruction (or Answer Step
instruction, Phase End instruction) and SJ_P instruction.
SEQ instruction to which SFC network is connected
S11 Disabled
T12 TON_1 Enabled SJ_P SIGNAL1 COND1 SJ_P SIGNAL2
TON
S12 IN Q E E
ST ST
• A variable other than a step name cannot be specified as the jump destination step (STEP) of a SJ_P instruction. If a
variable other than a step name is specified, a boundary error may occur and SJ_P instruction is treated as a no process.
• Only the inside of the level (operation and phase) to which the SJ_P instruction is connected to may be specified. Jump to
other level is not possible.
Operation Phase 1
SEQ001 P11
SEQ
T11
Enabled
INI P12
T1 T12
COND3 SJ_P SIGNAL3
1 PHASE1 P13 E
Time#10s ST
T2 T13
Enabled P11 STEP
2 PHASE2 P14 LD
Time#10s PhaseEnd
T3
COND1 SJ_P SIGNAL1
S1 E Phase 2
ST
T4 P21
PHASE1 STEP
Disabled
T21
LD
P22
COND2 SJ_P SIGNAL2
S2 E T22
ST
Disabled COND4 SJ_P SIGNAL4
T4 P23 E
P23 STEP ST
LD T23
P11 STEP
P24 LD
PhaseEnd
6F8C1226
24. Tag Operartion Funtions 24-33
• In the case of parallel processing, jump to other parallel process, outside the parallel processes, or into the parallel process
is not possible.
S1
T1
T2
COND1 SJ_P SIGNAL1
S2 E
ST
S14 STEP
LD
• The SJ_P instruction cannot connect to a Phase Step instruction. Connection is allowed to Step instruction, Answer Step
instruction, and Phase End Step instruction. If a SJ_P instruction is connected to a Phase Step instruction, the Phase Step
instruction itself may be inactive, but the inside of the phase is not inactive.
S11
Disabled
T12
COND1 SJ_P SIGNAL?
1 PHASE1 E
Time#10s ST
T12
S11 STEP
S12 LD
Enabled
T13
COND2 SJ_P SIGNAL2
S13 E
ST
S12 STEP
LD
6F8C1226
24. Tag Operartion Funtions 24-34
SQ parameter SQ_P
i bl
Jump destination STEP
i
Arguments:
Arg. Operand Type Const. Description Remarks
E BOOL √ Execution control input
Input SQ_P PTR — SQ parameter variable
STEP PTR — Jump destination step instance
Output — BOOL — Output
A pointer to tag table is placed in SQ parameter variable.
A setup example is shown below.
Array no.=0, tag no.=SEQ100 are assumed for the used sequence tag.
Notation Operand Array Tag symbol
SQ_P SQ_PARA[0] SEQ100.TAG[0]
The following tag symbols are referenced by this instruction.
Operand Symbol Type R/W Description
Referenced by ALIT[0..31] BOOL ARRAY W Alarm bit (all bits are cleared when RJ is executed)
SQ_P PHNO[0..31] BOOL ARRAY W Active phase map (all bits are cleared when RJ is
(SQ_DATA) executed)
ALNO[0..31] BOOL ARRAY W Alarm phase map (all bits are cleared when RJ is
executed)
CNNO[0..31] BOOL ARRAY W Confirm wait phase map (all bits are cleared when RJ is
executed)
APNO UINT W Active phase no. setting (cleared when RJ is executed)
R/W: R=Read only, W=Write only, R/W=Read/Write
Function:
• When the Execution Control Input E is OFF, OFF is output without performing any operation.
• When the Execution Control Input E is ON, resets the sequence tag information specified by the SQ parameter variable
(SQ_P), activates the step specified by jump destination step (STEP, and outputs ON as the result.
Execution Action Output
control input
OFF No process OFF
ON Changes the activation location to the specified step ON
Error information:
• If the jump destination step (STEP) is specified incorrectly, Boundary Error is set to ON and the instruction is treated as no
process.
• When EN is used, ENO output is reset to OFF when the above error occurs.
6F8C1226
24. Tag Operartion Funtions 24-35
Program example:
In case of L3DS
Variables:
Variable Data type Dec.
SEQ001 RJ_REQ BOOL VAR
SEQ T1 BOOL VAR
T2 BOOL VAR
INI T3 BOOL VAR
T1 T4 BOOL VAR
SIGNAL1 BOOL VAR
1 PHASE1
Controller Variables:
Time#10s
Variable Data type
T2
!SEQ001 typeSQ_PARA_DS
2 PHASE2
!SEQ001 typeSQ_DATA_DS
Time#10s
T3
INI STEP
LD
• When the reset jump condition (RJ_REQ) is OFF, PHASE1, PHASE2, and S1 are repeatedly executed in sequence. When
the reset jump condition (RJ_REQ) is ON, all active information and alarm information of sequence tag (SEQ001) are reset
and INI is activated regardless of the current active location.
6F8C1226
24. Tag Operartion Funtions 24-36
Restriction:
• The sequence that may be specified with the RJ_P instruction can only specify within the same program. Specification from
other task or user defined function block and phase level is not possible (compile error will occur). To specify from another
task (program), use a global variable.
Example that will result in compile error
Program (MS_001)
Operation Phase 1
SEQ001 P11 RJ_REQ2
SEQ RJ_P SIGNAL2
P E
T11
ST
INI
P12
SEQ001 SQ_P
T1
T12 LD
1 PHASE1
P13 INI STEP
Time#10s
T2 FB_1 LD
T13
USER_FB
P14
PhaseEn
Operation Phase 1
SEQ001 P11
SEQ Global_RJ Global_RJ
RJ_P
P E (R) T11
INI
P12
T1 SEQ001 SQ_P T12
1 PHASE1 LD
P13 RJ_REQ2 Global_RJ
Time#10s INI STEP P (S)
T2 T13
LD
FB_1
P14
USER_FB PhaseEn
RJ_REQ1 Global_RJ
P (S)
• Only operation step can specify RJ_P instruction. Phase step cannot specify RJ_P instruction. If RJ_P is used in a phase, a
boundary error will occur and the RJ_P instruction will be treated as no process.
Program (MS_001)
Operation Phase 1
SEQ001 P11
SEQ Boundary error
T11
INI Normal P12 RJ_REQ3 RJ_P SIGNAL3
T1 RJ_REQ1 P E
RJ_P SIGNAL1 T12
P E ST
1 PHASE1 P13
ST SQ_P
Time#10s SEQ001
T2 SQ_P T13 LD
SEQ001
2 PHASE2 LD P14 STEP
P11
Time#10s PhaseEn LD
INI STEP
T3
LD
• No variable other than a step name can be specified as the jump destination step (STEP) of a RJ_P instruction. If a variable
other than a step name is specified, a boundary error may occur and RJ_P instruction is treated as a no process.
• A step in a parallel process cannot be specified as the jump destination step (STEP) of a RJ_P instruction (activation
location cannot be changed within a parallel process). If a step in a parallel process is specified, steps are executed in
sequence from that location and holds at the end of the parallel process (waiting for other parallel process to end). In such
case, the reactivation location must be switch.
25 RAS
Instance structure:
Name Type Description
NAME WORD ARRAY [0 to 24] Trace variable name
POINTER DINT Trace variable pointer
DATATYPE DINT Trace data type
RH DINT Range high limit
RL DINT Range low limit
EU DINT Unit
COMMENT WORD ARRAY [0 to 7] Comment
INDEX DINT Link buffer pointer
DATA DINT ARRAY [0 to 55] Link buffer
NOTINIT DINT Initialization flag
Function:
• A function block to perform cyclic trace that is written within a program.
• A single variable can be traced with a single function block description.
• Periodically traces static variable and temporary variable, or global variable used within a program. (When the cycle time is
less than 50ms, the cyclic trace data is lacking by the transmission load.)
• Specify the task to trace, the trace FB name to use, and variable name from [Product view] - [View] - [Data trace] of the V
engineering tool. Refer to the V Engineering Tool User's Guide for details.
Important:
• Do not specify direct output variable as the variable name to perform cyclic trace. Correct value cannot be traced.
In this case, perform cycle trace specifying a batch output variable rather than a direct output variable.
6F8C1226
25.RAS 25-3
Program example:
DATALOGC_1 DATALOGC_2
DATALOGC DATALOGC
• Performs cyclic trace of two variables VAR_BOOL and VAR_REAL specified from the V engineering tool.
Arguments
Function
• When execution control input E is OFF, calendar data acquisition is not executed.
• When execution control input E is ON, calendar data in the format specified with calendar data type specification is obtained,
and output to the variable specified with data storage destination.
• The calendar data type and calendar format are as follows.
15 8 7 0
0 Month 01:Year 2001 or later
0 Day 00:Year 2097
1 BCD code 0 Hour
0 Minute
0 Second
15 0
Year
Day Month
2 DT type
TOD type
Program example
[LD/FBD language notation]
REQ
GET_CLND
E BCD_DAT
1 TYPE
BCD
Storesデータフォーマットで
calendar data in the
カレンダデータを格納
BCD data format.
• When execution control input REQ is ON, calendar data in the format specified with calendar data type specification TYPE is
obtained, and stored to the specified variable BCD_DAT.
Error information
• No processing is performed unless calendar data type specification TYPE is valid specification.
• When EN is used, ENO is reset to OFF when the above error occurs.
6F8C1226
25.RAS 25-6
Interlock Diagnosis
Arguments:
Instance structure:
Function:
• This function block creates, monitors, and diagnoses the interlock signals of the entire system.
It can display the diagnosis result for the interlock signals of the entire system by using the V Engineering Tool's add-in
software, "Interlock Diagnosis Package." For details, refer to "Interlock Diagnosis Package Operation Manual (6E8C4679)."
• LD circuit that consists of a contact, b contact, contact force, left bus, and horizontal/vertical connection lines is input to
interlock circuit input BI. The number of available contacts is 1 to 32.
• Only coils (normal coils) can be connected to interlock circuit output BO.
• Interlock circuit diagnosis permission ENA can be specified with constants and variables. Interlock diagnosis is performed
when ENA is ON, or stopped when it is OFF.
When ENA=FALSE(OFF), the interlock circuit is not disconnected because interlock circuit output BO= interlock circuit input
BI.
• Interlock circuit screen permission DSP can be specified only with constants. The interlock diagnosis screen is displayed
when it is ON, or not displayed when it is OFF.
When the interlock circuit consists of the main circuit and other sub circuits, only relevant interlock signals can be displayed
on the interlock diagnosis screen by setting DSP=TRUE(ON) for the main circuit and DSP=FALSE(OFF) for the sub circuits.
• Interlock group number GRP is a number for grouping the interlock signals of the entire system by plant monitoring section
for efficient diagnosis and monitoring. It can be specified to 1 to 32 using only constants.
6F8C1226
25.RAS 25-7
• Function block DIAG_D can be used only in programs for the POU type. Also, DIAG_D is used in conditions where it
operates in every cycle in the scan system tasks (mains task (MS), high-speed task (HS), ultra-high speed task (SS)) (e.g.
there are cycles not executed due to the IF statement).
• The group specified with interlock group number GRP must use the interlock circuit in the same task.
Restrictions:
• I/O variable, index modification, non-pointer BOOL cannot be specified directly for the variable specified for contacts of the
interlock circuit.
• Only coils (normal coils) can be connected to interlock circuit output BO.
• Interlock group number GRP must use the interlock circuit in the same task.
Correct example: Group number is used in MS010, MS100, and MS250.
Wrong example: Group number is used in MS010 and HS050.
• Function block DIAG_D cannot be used in functions or function blocks for the POU type.
6F8C1226
25.RAS 25-8
Program example:
DIAG_D_1
X1 X2 X5 DIAG_D Y0
BI BO
X3 X4 1
LD ENA
1 Only normal coil can
DSP be connected.
LD
Interlock circuit 30
LD GRP
• Because ENA input is ON, the state of interlock circuit input BI is monitored. Interlock circuit output BO outputs the state of
interlock circuit input BI as it is.
Error information:
• If I/O variable, index modification, or non-pointer BOOL that cannot be specified directly for the variable specified for
contacts of the interlock circuit is specified, the monitoring result is not displayed correctly when the state of interlock circuit
input BI becomes OFF.
• If the calendar of the controller is abnormal, the monitoring result cannot be displayed correctly.
6F8C1226
26. SFC 26-1
26 SFC
1 Step
2 Initial Step
3 Transition
Divergence/Convergence of
4
Sequence
Divergence/Convergence of
5
Simultaneous sequence
6 Link
B
BOOL
7 Action
U
User Defined
Note
8 Sequence SEQ
Note
9 Phase Step N
Note
10 Phase End Step P hase End
Note
11 Answer Step Ans
Note: V-Tool3 and Worksheet Editor do not support these instructions yet.
6F8C1226
26. SFC 26-2
•
SFC Step
Function:
• Represents the minimum unit of SFC network operation.
• When the state of predecessor transition becomes ON, the connected steps become active and the ladder circuit or action
connected on the right side of the step is executed.
• The step state can be determined from the following variables:
Step flag: step name .X (ON when step is active, OFF when step is inactive)
Step execution duration: step name .T (represents the duration when step is active and is cleared to zero the first time
the step is active)
• Steps cannot be placed consecutively. A transition must be placed between steps.
• Step is not executed consecutively within the same scan.
Program example:
T0 T0
SIGNAL1 SIGNAL1
S1 Transition T1 S1
=ON
T1 T1
S2 N SIGNAL2 S2 N SIGNAL2
S3.X S3.X
Scan
T0
T2
S1.X
S1.T
T1
S2.X
S2.T
• When transition T1 becomes ON while step S1 is active, step S1 becomes inactive and step S2 becomes active. Step S1
remains active until transition T1 becomes ON.
6F8C1226
26. SFC 26-3
Important:
• All steps within an SFC network, whether they are active or inactive, are executed during each scan. With LD circuits directly
connected in step flag status, active steps are executed ON and inactive steps are executed OFF. Therefore, do not use
coils with the same variable name in more than one step. A sample program and its process is shown below.
(1)When an LD circuit is connected to the step
If a coil with the same variable name is used in steps S1 and S3, the BOOL variable SIGNAL1 is set to ON when step S1 is
active. Next, the BOOL variable SIGNAL1 becomes OFF because step S3 is inactive. In other words, SIGNAL1=OFF is the final
value of this variable.
T0 SIGNAL1
S1 Step S1=Active: BOOL variable SIGNAL1=ON
T1
SIGNAL2
S2
T2
SIGNAL1
Step S3=Inactive: BOOL variable SIGNAL1=OFF
S3
T3
T0
S1 N SIGNAL1 Step S1=Active: BOOL variable due to action execution SIGNAL1=ON
T1
SIGNAL2
S2
T2
S3 N SIGNAL1 Step S3=Inactive: BOOL variable due to action not executed SIGNAL1=unchanged
T3
6F8C1226
26. SFC 26-4
Function:
• Represents the minimum unit of SFC network operation.
• Only during controller cold start, the connected initial step becomes active unconditionally and makes all other steps
connected to the same SFC network inactive. Also, the connected ladder circuit and action are executed.
• The step state can be determined from the following variables:
Step activation flag: step name .X (ON when step is active, OFF when step is inactive)
Step duration: step name .T (represents the duration when step is active and is cleared to zero when the step first
becomes active)
• One initial step is required in an SFC network.
• Initial steps cannot be placed consecutively. A transition must be placed between initial step and other step.
• Initial step is not executed consecutively within the same scan.
Program example:
<During cold start>
T1 T1
• During controller cold start, initial step INI becomes active and other steps S1 on the same circuit become inactive.
• After initial step INI has been active for 30 seconds, it becomes inactive and step S1 becomes active.
6F8C1226
26. SFC 26-5
SFC Transition
Function:
• Defines the transition condition from step to step.
• Transition to the next step is performed when the variable specified for transition is ON.
• An LD circuit or FBD circuit with BOOL output may be specified on the left connecting side of the transition. The operation
result of this connected circuit is assigned to the variable specified with the transition and transition is made to the next step
when the operation result is ON.
• The operation of the network stops when the SFC network ends with the transition.
Program example:
T0 T0
SIGNAL1 SIGNAL1
S1 S1
T1 When transition T1
T1=ON
S2 N SIGNAL2 S2 N SIGNAL2
S3.X S3.X
• Step S2 becomes active when transition T1 becomes ON. Step S1 remains active until transition T1 becomes ON.
T0 T0
SIGNAL1 SIGNAL1
S1 S1
T1 T1
When S2.T≥30s
S2 N SIGNAL2 S2 N SIGNAL2
S3.X S3.X
• When step S2 is active, if duration of S2 exceeds 30 seconds, step S2 becomes inactive and step S3 becomes active.
6F8C1226
26. SFC 26-6
Diagram
Function:
• Selectively executes the SFC flow according to the transition condition placed at the beginning of each divergence of
sequence.
• Only one circuit is executed with the divergence of sequence. Scan is made from the left transition state and the first branch
circuit that satisfies the condition is executed. If more than one transition is satisfied, the priority of transition evaluation is
from left to right.
• A step must be placed on the predecessor divergence of sequence.
• A transaction must be placed on the predecessor divergence of sequence.
Program example:
SIGNAL1
Transitions T12 and T13 are both ON
S1
S2 S4 S6 S8
T2 T4 T6 T8
S3 S5 S7 S1
T3 T5 T7
• When transitions T12 and T13 both become ON while step S1 is active, step S1 becomes inactive and step S4 becomes
active.
• The step execution priority for the divergence of sequence is S2 > S4 > S6 > S8.
6F8C1226
26. SFC 26-7
Variable (BOOL)
Diagram
Variable (BOOL)
Function:
• Simultaneously executes more than one step following divergence of simultaneous sequences.
• Up to 15 divergences of simultaneous sequences are allowed.
• Divergence of simultaneous sequences ends when execution of all branch circuit ends. (Transition to steps following the
convergence of simultaneous sequences is not performed until execution of all branch circuit completes.)
• A transition must be placed on the predecessor divergence of simultaneous sequences.
• A transition must be placed below the successor convergence of simultaneous sequences.
Program example:
SIGNAL1
S1
T1
S2 S4 S6 S8
T2 T4 T6 T8
S3 S5 S7 S9
T3
S10
• When transition T1 becomes ON while step S1 is active, step S1 becomes inactive and steps S2, S4, S6, and S8 become
active.
• When steps S3, S5, S7, and S9 become active, if transition T3 is ON, steps S3, S5, S7, and S9 are made inactive and step
S10 becomes active.
6F8C1226
26. SFC 26-8
SFC Link
Diagram
Step name
Function:
• Represents the link destination (loop or jump destination) of the network.
• If the predecessor transition condition becomes ON, transition is made to the step specified by the link.
Program example:
(1) Loop specification
T0 T0
SIGNAL1 SIGNAL1
S1 S1
T1 T1
S2 S2
Equivalent circuit
T2 T2
S3 S3
T3 T3
S1
Note) Tools use representation on left.
• When transition T3 becomes ON while step S3 is active, step S3 becomes inactive and step S1 becomes active.
T1 T11 T11 T1
S2 S3 S2
Equivalent circuit
T2 T21 T2 T21
S3 S4 S3 S4
T3 T4 T3 T4
S5 S5
• When transition T11 becomes ON while step S1 is active, step S1 becomes inactive and step S3 becomes active.
6F8C1226
26. SFC 26-9
SFC Action
Function:
• An action can be added to a step and it is executed when the step becomes active.
• More than one action can be connected to a step.
• A qualifier (action qualifier) can be used to specify the behavior of the action.
• The action state can be determined from the following variables:
Active flag :action name .Q (ON when action is active, OFF when action is inactive)
Activation :action name .A (ON when action is executed, OFF when action is not executed)
Action timer work :action name .T (action duration with timer)
• Two types of actions are available:
BOOL action :Specified with a qualifier in the action box and a variable (BOOL).
The specified action variable (BOOL) can be controlled according to the qualifier.
User defined action :Specified with a qualifier in the action box, action name, and indicator variable.
(Indicator variable is optional.) The execution of the program specified with action name can be
controlled according to the qualifier. Also, the indicator variable may be updated within the action
program.
• The following qualifier types and actions are available:
Qualifier types:
Qualifier Action
N or none Specified action variable is ON while the action input is ON. Or executes the specified program.
R: Reset Resets the set state of the specified action variable when the action input is ON. Or resets the set
state of the specified program. (The actual reset is performed by the corresponding set action.)
S: Set Specified action variable is set while the action input is ON. Or continues execution of the
specified program.
L: time Limited Keeps the specified action variable to ON for the specified interval when the action input is ON.
Or executes the specified program. If the input becomes OFF before the specified interval, the
specified action variable is immediately reset to OFF. Or stops execution of the specified
program.
6F8C1226
26. SFC 26-10
Qualifier Action
D: Time delayed When action input is ON, sets the specified action variable to ON after the specified delay. Or
executes the specified program. If the input becomes OFF before the specified interval, the
specified variable is not set to ON and the specified program is not executed.
P: Pulse Sets the specified action variable to ON only when the action input changes from OFF to ON. Or
executes the specified program. Unlike P0 or P1, this action performs final scan.
P0: Pulse Sets the specified action variable to ON only when the action input changes from ON to OFF. Or
(falling edge) executes the specified program. Unlike P, this action does not perform final scan.
P1: Pulse Sets the specified action variable to ON only when the action input changes from OFF to ON. Or
(rising edge) executes the specified program. Unlike P, this action does not perform final scan.
SD: Stored and time Retains the state when the action input is ON and sets the specified action variable to ON after
delayed the specified delay. Or executes the specified program. The action is not executed if there is a
reset before the specified interval.
DS: Delayed and When the action input is ON, performs set operation, sets the specified action variable, and
Stored executes the specified program after the specified delay. Does not perform set operation if the
input becomes OFF before the specified interval. The corresponding reset action is necessary to
reset the stored action.
SL: Stored and time Retains the action state when the action input is ON and then sets the specified action variable
limited and executes the specified program for the specified interval. The set action must be reset before
it can be reused.
NH: N without final Same action as N without final scan.
scan
SH: S without final Same action as S without final scan.
scan
LH: L without final Same action as L without final scan.
scan
DH: D without final Same action as D without final scan.
scan
(3) L: Limited
Scan
Step status
AN.Q
Setting time
AN.T
Setting time Setting time
Step status
AN.Q
Setting time
AN.T
Setting time Setting time
6F8C1226
26. SFC 26-12
(5) P: Pulse
Scan
Step status
AN.Q
AN.A (Actual operation)
Final scan performed
AN.T
AN.T
Setting time Setting time
AN.T
Setting time Setting time
Step status
AN.Q
Setting time
AN.T
Setting time Setting time
Step status
AN.Q
Setting time
AN.T
Setting time Setting time
Important:
• When specifying an action qualifier, always use R to reset the action variable specified with S, SD, DS, SL, or SH. A Coil
instruction cannot be used to reset action variables.
6F8C1226
26. SFC 26-15
Program example:
T0 T0
SIGNAL1 SIGNAL1
S1 Transition S1
T1=ON
T1 T1
S2 N SIGNAL2 S2 N SIGNAL2
T2 T2
S3 S3
T3 T3
Scan
T0
T2
S1.X
SIGNAL1
T1
S2.X
SIGNAL2
T2
• When transition T1 becomes ON while step S1 is active, step S1 becomes inactive and step S2 becomes active.
• The connected N action variable SIGNAL2 is ON only while step S2 is ON.
6F8C1226
26. SFC 26-16
SFC Sequence
Diagram
SQ parameter
SEQ
Function:
• Associates connected SFC network with sequence tag.
• Controls the execution of SFC network according to the mode of the associated sequence tag.
C mode: SFC network execution (continuous progress)
A mode: SFC network execution (conf progress)
M/RM mode: SFC network halt (jump to end of SFC network)
(Refer to the Phase Step instruction for details concerning continuous progress and conf progress.)
• Single step execution
When the mode of the sequence tag is M/RM, the SFC network can be executed for just one process cycle from the tool
(pressing the button on the program editor control panel) or by setting the sequence tag SSE ON.
Single step execution example:
Initialized state During execution (1 scan only) After executing 1 scan>
Program example:
In M or RM mode In A or C mode
SEQ001 SEQ001
SEQ SEQ
INI INI
T1 T1
1 PHASE1 1 PHASE1
Time#10s Time#10s
T2 T2
2 PHASE2 2 PHASE2
Time#10s Time#10s
T3 T3
Restriction:
• This instruction must be written at the beginning of an SFC network. If it is written in the middle of an SFC network, its
operation will be unstable (not as expected).
• The beginning of the sequence parameter must be specified for the SQ parameter. An index register cannot be specified for
array no. A Table Operation Error will occur if there is an incorrect specification.
Correct example :SQ_PARA[1] :SEQ001.TAG[0]
Wrong example :SQ_DATA[1] :SEQ001.TYPE SQ_PARA[XI]
6F8C1226
26. SFC 26-19
Function:
• Unlike the Step instruction, action (sub screen) is performed from the phase step itself.
• When the transition condition of the previous step becomes ON, the connected phase step becomes active and executes
the ladder circuit or action connected to the right side of the phase step (if conf progress wait, the connection on the right side
of the phase step remains OFF and the ladder circuit is not executed. When "acknowledge operation" is performed the
connection on the right side of the phase step becomes ON.) At the same time, the SFC network written in the action (sub
screen) is executed as "phase". When phase execution completes (phase end instruction becomes active) and the transition
condition of the proceeding step becomes ON, its own phase step is deactivated (inactive).
• The portion containing the Sequence instruction and Phase Step instruction is referred to as the operation and the portion
expanded by the Phase Step instruction is referred to as the phase.
• A number from 1 to 32 is set as the phase no. This number is used to associate with a sequence tag member (phase name
(PNAM) and interlock/single selection (FA)) and the phase execution status can be monitored from OIS-DS.
• The Phase Step instruction has a congestion monitor timer. If phase execution does not completed before the congestion
monitor timer expires, a congestion alarm is issued. In this case, the timer value is limited by the set value. Congestion
monitor is disabled when the congestion monitor timer is set to 0 seconds (time#0s).
• The step state can be determined from the following variables:
Step flag :step name .X (ON when step is active, OFF when step is inactive)
Step execution duration :step name .T (represents the duration when step is active and is cleared to zero the first time
the step is active)
• Phase step cannot be placed consecutively with other steps. A transition must be placed between phase step and other
step.
• Phase step is not executed consecutively within the same scan.
• Conf progress and continuous progress
Phase execution can be controlled with sequence tag execution control information (mode, interlock/single setting). When
the sequence tag mode is C mode, phase is executed continuously regardless of the interlock/single setting. When the
sequence tag mode is A mode, phase is executed continuously as in C mode if the interlock/single setting is interlock, but if
the interlock/single setting is single, the phase is temporarily halted (conf progress wait) before execution, a conf progress
wait alarm is issued, and phase execution is resumed after it is acknowledged by the operator.
Phase setting Interlock Single
Sequence mode
C mode (continuous progress) Execute Execute
A mode (conf progress) Execute Temporary halt Executed resumed when acknowledged
M, RM mode Halt Halt
If several phases are in "conf progress wait" in a parallel process, a single acknowledge will cancel all acknowledge waits and
resume execution.
When the mode is switched to C while in "conf progress wait", all conf progress waits are canceled and changed to continuous
execution. Also, if the mode is switched to M/RM while in "conf progress wait" and single step execution is performed, conf
progress wait is canceled and inside of the phase is executed.
Acknowledge method:
[conf progress]
• Press the button on the OIS-DIS sequence tag point screen.
• Press the button on the tool's program editor control panel.
• Set conf progress request (CNE) of sequence tag ON from tool's tag editor or other program.
6F8C1226
26. SFC 26-20
T2 T2 T2
4 PHASE4 4 PHASE4 4 PHASE4
Time#10s Time#10s Time#10s
T3 T3 T3
If transition (T1) becomes ON when PHASE1 is active, PHASE2 and PHASE3 become active. Execution within phase is
started immediately because PHASE2 is "interlock". PHASE3 is temporarily halted and placed in conf progress wait because it is
"single". When acknowledged, PHASE3's conf progress wait is canceled and the inside of PHASE3 is executed.
Program example:
Main screen (operation) Sub screen (phase)
SEQ001
SEQ P1INI
T11
INI
S11
T1
T12
1 PHASE1
Time#10s S12
T2
T13
2 PHASE2
Time#10s S13
T3 PhaseEnd
• When phase 1 (step name: PHASE1) becomes active, the initial step (step name: P1INI) of the sub screen (phase) becomes
active. Step is executed sequentially from P1INI and "Phase execution complete" is indicated when the phase end step (step
name: S13) becomes active. When S13 becomes active and operation transition condition (T2) becomes ON, phase
execution is ended and the active point is moved to the next step (phase).
Restriction:
• Description in phase level is not allowed (phase step nesting is not allowed). If phase steps are nested, operation will be
unstable (not as expected).
6F8C1226
26. SFC 26-21
Step name
phase_End
Program example:
Main screen (operation) Sub screen (phase)
SEQ001
SEQ P1INI
T11
INI
S11
T1
T12
1 PHASE1
Time#10s S12
T2
T13
2 PHASE2
Time#10s S13
T3 PhaseEnd
• When phase 1 (step name: PHASE1) becomes active, the initial step (step name: P1INI) of the sub screen (phase) becomes
active. Step is executed sequentially from P1INI and "Phase execution complete" is indicated when the phase end step (step
name: S13) becomes active. When S13 becomes active and operation transition condition (T2) becomes ON, phase
execution is ended and the active point is moved to the next step (phase).
Restriction:
• Description at the operation level is not allowed. If phase step is nested, operation will be unstable (not as expected).
• At least one phase end step must be written within a phase. If there is no phase end step, the phase will not end (no
transition of operation active pointer).
6F8C1226
26. SFC 26-22
Step name
Ans
Answer timer
Function:
• Represents the minimum unit of SFC network operation.
• When the state of the predecessor transition becomes ON, the connected answer step becomes active and the ladder circuit
or action connected on the right side of the answer step is executed.
• Answer step can be written more than once only in phase. Description at the operation level is not allowed.
• Answer step instruction has an answer back monitor timer. If execution of the answer step does not complete before the
answer back monitor timer expires (answer back proceeding transition is satisfied), an answer back alarm is issued. In this
case, the timer value is limited by the set value. Answer back monitor is disabled when the timer is set to 0 seconds
(time#0s).
• The step state can be determined from the following variables:
Step flag :stepname.X (ON when step is active, OFF when step is inactive)
Step execution duration :stepname.T (represents the duration when step is active and is cleared to zero the first time
the step is active)
• Answer step cannot be placed consecutively with other steps. A transition must be placed between Answer step and other
step.
• Answer step is not executed consecutively within the same scan.
Program example:
Main screen (operation) Sub screen (phase)
SEQ001
SEQ P1INI
T11
INI SIGNAL1
S11 PB_P
↑ E
T1 Ans
Time#10s 1 BNO
1 PHASE1 PB_DATA[1].
FI[1]
Time#10s T12 PB_PARA[1] PB_P
T2
PB_DATA[1] PB_D
S12
PhaseEnd
• When answer step (step name: S1) becomes active, Push Button instruction (PB_P) is executed and PB_DATA[1] button 1
is pressed. If the transition condition (PB_DATA[1].FI[1]) is satisfied before the answer back timer expires (10s), no alarm is
issued and transition is made to the next step. If the timer expires, an answer back alarm is issued.
Restriction:
• Description at the operation level is not allowed. Please be sure to describe in phase level. When it describes in operation
level, an active step does not move.
6F8C1226
Appendix A Using Any Function A-1
These are Standard Functions for any data types. The user can use these symbols without selection of the data
type.
Input 1 x Output
Diagram Input 2
Input n
Arguments
• The following data types are supported for input and output arguments:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — — Output
Input 1 x Output
Input 2
Input n
Function
• The type of the instruction symbol (data type) is the same as the output data type.
Refer to the following rule tables for the input data type that can be used at once.
The data type that doesn't exist in the following tables becomes the compile error.
[Table: Rules of data types] √: Compile OK, —: Compile Error
Input 1…n data type
Output data type Input 1…n data type
INT DINT UINT REAL WORD
INT INT √ — — — —
DINT — — — — —
UINT — — — — —
REAL — — — — —
WORD — — — — —
DINT INT √ √ √ — √
DINT √ √ √ — √
UINT √ √ √ — √
REAL — — — — —
WORD √ √ √ — √
UINT INT — — — — —
DINT — — — — —
UINT — — √ — √
REAL — — — — —
WORD — — √ — √
REAL INT √ — √ √ —
DINT — — — — —
UINT √ — √ √ —
REAL √ — √ √ —
WORD — — — — —
6F8C1226
Appendix A Using Any Function A-3
• If the output data type and the input data type are different, the input data type fix according to the output data type.
That is, Type Conversion Instruction is inserted between input data and the instruction.
• If the input data type is "WORD", Type Conversion Instruction "Bit string - Integer conversion" is inserted.
Type Conversion Type Conversion Instruction
It converts it from "WORD" to "DINT". WORD_TO_DINT
It converts it from "WORD" to "UINT". WORD_TO_UINT
• Refer to the description of "Arithmetic Operation Instructions" for a detailed description of each instruction (ADD /
SUB / MUL / DIV).
Program example
SAMPLE1 + SAMPLE4 SAMPLE1 Type Conversion Instruction ADD_REAL SAMPLE4
“INT” “REAL” “INT” “INT - REAL Conversion” “REAL”
LD ST LD INT_TO_REAL ST
SAMPLE2 Internal SAMPLE2
“REAL” Process “REAL”
LD LD
SAMPLE3 Type Conversion Instruction
SAMPLE3 “UINT-REAL Conversion”
“UINT” “UINT”
LD UINT_TO_REAL
LD
[Operation description]
• As the output data type is "REAL", "ADD_REAL" is used.
• To operate variable SAMPLE1 ("INT") and variable SAMPLE3 ("UINT") by "REAL", Type Conversion Instructions
are automatically inserted.
6F8C1226
Appendix A Using Any Function A-4
Input 1 x Output
Diagram Input 2
Arguments
• The following data types are supported for input and output arguments:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1,2
Output — — Output
Input 1 x Output
Input 2
Function
• The type of the instruction symbol (data type) is the same as the output data type.
Refer to the following rule tables for the input data type that can be used at once.
The data type that doesn't exist in the following tables becomes the compile error.
[Table: Rules of data types] √: Compile OK, —: Compile Error
Input 1…n data type
Output data type Input 1…n data type
INT DINT UINT REAL WORD
INT INT √ — — — —
DINT — — — — —
UINT — — — — —
REAL — — — — —
WORD — — — — —
DINT INT √ √ √ — √
DINT √ √ √ — √
UINT √ √ √ — √
REAL — — — — —
WORD √ √ √ — √
UINT INT — — — — —
DINT — — — — —
UINT — — √ — √
REAL — — — — —
WORD — — √ — √
REAL INT √ — √ √ —
DINT — — — — —
UINT √ — √ √ —
REAL √ — √ √ —
WORD — — — — —
• If the output data type and the input data type are different, the input data type fix according to the output data type.
That is, Type Conversion Instruction is inserted between input data and the instruction.
• If the input data type is "WORD", Type Conversion Instruction "Bit string - Integer conversion" is inserted.
6F8C1226
Appendix A Using Any Function A-5
Program example
SAMPLE1 - SAMPLE3 SAMPLE1 Type Conversion Instruction SUB_REAL SAMPLE3
“INT” “REAL” “INT” “INT - REAL Conversion” “REAL”
LD ST LD INT_TO_REAL ST
SAMPLE2 Internal SAMPLE2
“REAL” Process “REAL”
LD LD
[Operation description]
• As the output data type is "REAL", "ADD_REAL" is used.
• To operate variable SAMPLE1 ("INT") and variable SAMPLE3 ("UINT") by "REAL", the Type Conversion
Instructions are automatically inserted.
6F8C1226
Appendix A Using Any Function A-6
Diagram Input 2
Input n
Arguments
• The following data types are supported for input and output arguments:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — — Output
Input n
Function
• The type of the instruction symbol (data type) is the same as the output data type.
Refer to the following rule tables for the input data type that can be used at once.
The data type that doesn't exist in the following tables becomes the compile error.
[Table: Rules of data types] √: Compile OK, —: Compile Error
Input 1…n data type
Output data type Input 1…n data type
BOOL WORD DWORD
BOOL BOOL √ — —
WORD — — —
DWORD — — —
WORD BOOL — — —
WORD — √ —
DWORD — — —
DWORD BOOL — — —
WORD — √ √
DWORD — √ √
• If the output data type and the input data type are different, the input data type fix according to the output data type.
That is, Type Conversion Instruction is inserted between input data and the instruction.
• Refer to the description of "Logical Operation Instructions" for a detailed description of each instruction (Bitwise
Boolean AND / Bitwise Boolean OR / Bitwise Boolean XOR).
6F8C1226
Appendix A Using Any Function A-7
Program example
SAMPLE1 AND SAMPLE4 SAMPLE1 AND_DWORD SAMPLE4
“DWORD” “DWORD” “DWORD” “DWORD”
LD ST LD ST
SAMPLE2 Internal SAMPLE2
“DWORD” Process “DWORD”
LD LD
SAMPLE3 SAMPLE3 Type Conversion Instruction
“WORD” “WORD” “WORD - DWORD Conversion”
LD LD WORD_TO_DWORD
[Operation description]
• As the output data type is "DWORD", "AND_DWORD" is used.
• To operate variable SAMPLE3 ("WORD") by "DWORD", Type Conversion Instructions are automatically inserted.
6F8C1226
Appendix A Using Any Function A-8
Input ~ Output
Diagram
Arguments
• The following data types are supported for input and output arguments:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input
Output — — Output
Input x Output
Function
• The type of the instruction symbol (data type) is the same as the output data type.
Refer to the following rule tables for the input data type that can be used at once.
The data type that doesn't exist in the following tables becomes the compile error.
[Table: Rules of data types] √: Compile OK, —: Compile Error
Input data type
Output data type
BOOL WORD DWORD
BOOL √ — —
WORD — √ —
DWORD — √ √
• If the output data type and the input data type are different, the input data type fix according to the output data type.
That is, Type Conversion Instruction is inserted between input data and the instruction.
• Refer to the description of "Logical Operation Instructions" for a detailed description of each instruction (Bitwise
Boolean NOT).
Program example
SAMPLE1 ~ SAMPLE2 Internal SAMPLE1 Type Conversion Instruction NOT_DWORD SAMPLE2
“WORD” “DWORD” Process “WORD” “WORD - DWORD Conversion” “DWORD”
LD ST LD WORD_TO_DWORD ST
[Operation description]
• As the output data type is "DWORD", "NOT_DWORD" is used.
• To operate variable SAMPLE1 ("WORD") by "DWORD", Type Conversion Instructions are automatically inserted.
6F8C1226
Appendix A Using Any Function A-9
Input 1 xx Output
Diagram Input 2
Input n
Arguments
• The following data types are supported for input and output arguments:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1…n 2 ≤ n ≤ 15
Output — BOOL — Output
Input 1 xx Output
Input 2
Input n
Function
• Refer to the following rule tables for the input data type that can be used at once.
The data type that doesn't exist in the following tables becomes the compile error.
[Table: Rules of data types] √: Compile OK, —: Compile Error
Input i in 1…n Input j in 1…n data type
data type INT DINT UINT REAL WORD DWORD
INT √ √ √ √ √ —
DINT √ √ √ — √ —
UINT √ √ √ √ √ √
REAL √ — √ √ — —
WORD √ √ √ — √ √
DWORD — — √ — √ √
• When all the rules of "Input 1 …n" are “√", the compiler is successes.
• The type of the instruction symbol is fixed by the input data type.
If "Input 1 ... n" has two kinds or more of the data type, the data type is fixed by the rule in the following tables.
[Table: Rules of data types] —: Compile Error
Input i in 1…n Input j in 1…n data type
data type INT DINT UINT REAL WORD DWORD
INT INT DINT DINT REAL DINT —
DINT DINT DINT DINT — DINT —
UINT DINT DINT UINT REAL UINT DWORD
REAL REAL — REAL REAL — —
WORD DINT DINT UINT — WORD DWORD
DWORD — — DWORD — DWORD DWORD
6F8C1226
Appendix A Using Any Function A-10
• If the data type of the inputs have three kinds or more of the data type, the data type of the instruction symbol is
fixed by the following flow.
Input 1
“INT” “INT” “REAL” “REAL”
Input 2
“INT”
Type of Instruction symbol
Input 3 (Data Type)
“REAL” “REAL”
Input n
“UINT”
• If the data type of inputs (1…n) and the fixed data type are different, the input data type fix according to the fixed
data type. That is, the Type Conversion Instruction is inserted between input data and the instruction.
• If the input data type is "WORD", "Bit string - Integer conversion" of the Type Conversion Instructions is inserted.
Type Conversion Type Conversion Instruction
It converts it from "WORD" to "DINT". WORD_TO_DINT
It converts it from "WORD" to "UINT". WORD_TO_UINT
Important
• “Comparison Function Instructions” are used following the data types that are not supported.
“TIME”, “TIME_OF_DAY (Abbreviation: TOD)”,
“DATE (Abbreviation: D)”, “DATE_AND_TIME (Abbreviation: DT)”
Program example
SAMPLE1 > SAMPLE5 SAMPLE1 Type Conversion Instruction GT_REAL SAMPLE5
“INT” “REAL” “INT” “INT - REAL Conversion” “REAL”
LD ST LD INT_TO_REAL ST
SAMPLE2 Internal SAMPLE2
“REAL” Process “REAL”
LD LD
SAMPLE3 SAMPLE3 Type Conversion Instruction
“UINT” “UINT” “UINT - REAL Conversion”
LD LD UINT_TO_REAL
[Operation description]
• Because variable SAMPLE1, variable SAMPLE2 and variable SAMPLE3 are different each the data type, the
data type of instruction fix “REAL” by previous table “Fix the data type”.
• To convert the variable SAMPLE1 ("INT") and variable SAMPLE3 ("UINT") into "REAL ", the type conversion
instruction is automatically inserted.
6F8C1226
Appendix A Using Any Function A-11
Arguments
• The following data types are supported for input and output arguments:
Arg. Operand Type Const. Description Remarks
Input — See below √ Input 1,2 Input number=2
Output — BOOL — Output
Input 1 xx Output
Input 2
Function
• Refer to the following rule tables for the input data type that can be used at once.
The data type that doesn't exist in the following tables becomes the compile error.
[Table: Rules of data types] √: Compile OK, —: Compile Error
Input 2 data type
Input 1 data type
INT DINT UINT REAL WORD DWORD
INT √ √ √ √ √ —
DINT √ √ √ — √ —
UINT √ √ √ √ √ √
REAL √ — √ √ — —
WORD √ √ √ — √ √
DWORD — — √ — √ √
• When all the rules of "Input 1, 2" are “√", the compiler is successes.
• The type of the instruction symbol is fixed by the input data type. If "Input 1, 2 " have two kinds or more of the data
type, the data type is fixed by the rule in the following tables.
[Table: Rules of data types] —: Compile Error
Input 2 data type
Input 1 data type
INT DINT UINT REAL WORD DWORD
INT INT DINT DINT REAL DINT —
DINT DINT DINT DINT — DINT —
UINT DINT DINT UINT REAL UINT DWORD
REAL REAL — REAL REAL — —
WORD DINT DINT UINT — WORD DWORD
DWORD — — DWORD — DWORD DWORD
• If the data type of inputs (1, 2) and the fixed data type are different, the input data type fix according to the fixed
data type. That is, Type Conversion Instruction is inserted between input data and the instruction.
• If the input data type is "WORD", "Bit string - Integer conversion" of the Type Conversion Instructions is inserted.
Type Conversion Type Conversion Instruction
It converts it from "WORD" to "DINT". WORD_TO_DINT
It converts it from "WORD" to "UINT". WORD_TO_UINT
6F8C1226
Appendix A Using Any Function A-12
Important
• “Comparison Function Instructions” are used following the data types that are not supported.
“TIME”, “TIME_OF_DAY (Abbreviation: TOD)”,
“DATE (Abbreviation: D)”, “DATE_AND_TIME (Abbreviation: DT)”
Program example
SAMPLE1 <> SAMPLE3 SAMPLE1 Type Conversion Instruction NE_REAL SAMPLE3
“INT” “REAL” Internal “INT” “INT - REAL Conversion” “REAL”
LD ST Process LD INT_TO_REAL ST
SAMPLE2 SAMPLE2
“REAL” “REAL”
LD LD
[Operation description]
• Because variable SAMPLE1 and variable SAMPLE2 are different each the data type, the data type of instruction
fix “REAL” by previous table “Fix the data type”.
• To convert the variable SAMPLE1 ("INT") into "REAL ", the type conversion instruction is automatically inserted.
6F8C1226
Index 1
Index
Answer Step ····························································26-22
Symbol Arccosine·································································11-11
Arcsine ····································································11-10
, ··········································································· 20-13
Arctangent ·······························································11-12
. . , ········································································· 20-15
Arithmetic Shift ··························································13-6
. . : ········································································· 20-11
Array-String Conversion···········································10-52
: ············································································· 20-9
Average Value····························································9-10
A Average of Table Data ···············································9-12
ASC Module String Data Input ································ 16-12 Bit Counter ································································15-6
ASC Module String Data Output ····························· 16-15 Bit String- Integer Conversion ·································10-15
ASCII (Decimal)-Double Integer Conversion ··········· 10-44 Bitwise Boolean AND of Table Data···························12-3
ASCII-HEX Conversion ············································ 10-36 Bitwise Boolean NOT XOR of Table Data ················12-10
ASCII-Real Numbers Conversion ···························· 10-40 Bitwise Boolean NOT of Table Data···························12-7
F INC ··········································································14-14
INSERT ······································································19-7
FBD Language ···························································· 1-2
INTG ··········································································17-6
FFD_P ····································································· 23-19
INT_TO_BCD_DWORD··············································10-7
FIND ········································································ 19-10
INT_TO_BCD_WORD ················································10-7
FOR_DO·································································· 20-20
INT_TO_DINT·····························································10-3
Falling Edge Detector ················································· 2-7
INT_TO_DWORD ·······················································10-6
Feed Forward ·························································· 23-19
INT_TO_REAL····························································10-5
Find String······························································· 19-10
INT_TO_TIME ····························································10-9
Fix MV ····································································· 17-14
INT_TO_UINT·····························································10-3
Forced Coil································································ 2-15
INT_TO_WORD··························································10-6
Forced Negated Coil ················································· 2-16
IOFB_REQ ·······························································16-29
Forced Negative Transition-sensing Coil··················· 2-20
IORC_REQ·······························································16-31
Forced Positive Transition-sensing Coil ···················· 2-19
IO_T ·········································································16-20
Forced RESET Coil···················································· 2-18
Increment ································································14-14
Forced SET Coil ························································ 2-17
Index Registers··························································1-22
Function ···································································· 1-18
Initial Step··································································26-4
Function Block ·························································· 1-21
6F8C1226
Index 4
J MV Calculation ························································17-11
MVF ·········································································17-14
Jump ··········································································· 3-3
MVS ·········································································17-11
Jump Control Reset ···················································· 3-2
MWRITE ·····································································16-4
Jump Control Set ························································ 3-2
MWRITE_N ································································16-9
U
UINT_TO_BCD_DWORD ··········································· 10-7
UINT_TO_BCD_WORD ············································· 10-7
UINT_TO_DINT·························································· 10-3
UINT_TO_DWORD ···················································· 10-6
UINT_TO_INT ···························································· 10-3
UINT_TO_REAL ························································· 10-5
UINT_TO_TIME·························································· 10-9
UINT_TO_WORD ······················································· 10-6
UNT ········································································· 17-39
UNTIL ······································································ 20-28
URCV_N ·································································· 21-33
URCV_T··································································· 21-22
USEND_N ······························································· 21-14
USEND_T ·································································· 21-2
Up Counter·································································· 4-2
Up Down Counter ······················································· 4-6
User Defined Function ·············································· 18-3
User Defined Function Block····································· 18-4
V
Variable Declaration Examples·································· 1-10
Variable Memory Allocation Rules ······························· 1-9
W
WHILE ····································································· 20-23
WORD_BCD_TO_DINT ··········································· 10-17
WORD_BCD_TO_INT ·············································· 10-17
WORD_BCD_TO_REAL··········································· 10-19
WORD_BCD_TO_TIME ··········································· 10-20
WORD_BCD_TO_UINT ··········································· 10-17
Unified Controller nv series & Integrated Controller V series
Programming Instructions (LD/FBD/SFC/ST)
October 31, 2008 Second Edition
1226.2.0810