Beruflich Dokumente
Kultur Dokumente
USER’S MANUAL
Instructions
(SX-Programmer Expert)
FEH200n
Preface
Thank you for purchasing Fuji Electric Programmable Controller MICREX-SX Series.
This User’s Manual describes the memory, language, and system definition of MICREX-SX series.
Read this manual carefully to ensure correct operation and also read the corresponding user’s manuals listed below.
Notes
1. This manual may not be reproduced in whole or part in any form without prior written approval by the manufacturer.
2. The contents of this manual (including specifications) are subject to change without prior notice.
3. If you find any ambiguous or incorrect descriptions in this manual, please write them down (along with the manual No.
shown on the cover) and contact FUJI.
Safety Precautions
Be sure to read the “Safety Precautions” thoroughly before using the module.
Here, the safety precautions items are classified into “Warning” and “Caution”.
Warning : Incorrect handling of the device may result in death or serious injury.
Caution : Incorrect handling of the device may result in minor injury or physical damage.
Warning
Place the emergency stop circuit, interlock circuit or the like for safety outside the PLC. A failure of PLC might break or
cause problems to the machine.
Caution
Sufficiently make sure of safety before program change, forced output, starting, stopping or anything else during a run.
The wrong operation might break or cause machine problems.
Revision
* The manual No. is printed at the bottom right of the cover of this manual.
Sep. 2000 FEH200a The tentative specifications and description of the processor bus access have been
added.
Standard CPU specifications added.
Redundant system and fail-soft specifications added.
High-performance CPU NP1PS-74 specifications added.
July 2017 FEH200n Widely revised reflecting the contents of the latest Japanese version.
(The suffix “n” is added to the manual No. in accordance with the Japanese version.)
Contents
Preface
Safety Precautions
Revision
Contents
Section 1 Specifications
1-1 Operation of MICREX-SX Series......................................................................................................1-1
1-1-1 SX bus...........................................................................................................................................................1-1
1-1-2 Processor bus................................................................................................................................................1-2
1-2 Programming of MICREX-SX Series................................................................................................1-3
1-2-1 Overview of programming..............................................................................................................................1-3
1-2-2 Other basic terms...........................................................................................................................................1-5
1-2-3 Representations in programming tool............................................................................................................1-6
1-2-4 Notes on programming..................................................................................................................................1-7
1-2-5 How to calculate the number of steps............................................................................................................1-9
1-2-6 Using this user’s manual................................................................................................................................1-10
1-3 Input/Output (I/O) Address Assignment..........................................................................................1-11
1-3-1 Address assignment example........................................................................................................................1-11
1-3-2 Rules for assigning I/O addresses.................................................................................................................1-11
1-3-3 Assigning I/O addresses to an application program......................................................................................1-12
1-4 Memory..............................................................................................................................................1-13
1-4-1 Memory map..................................................................................................................................................1-13
1-4-2 I/O memory area (512 words, I/O extension mode: Max. 4096 words).........................................................1-26
1-4-3 Standard memory area..................................................................................................................................1-27
1-4-4 Retain memory area......................................................................................................................................1-29
1-4-5 User FB instance memory area.....................................................................................................................1-31
1-4-6 System FB instance memory area.................................................................................................................1-32
1-4-7 Initialization area............................................................................................................................................1-34
1-4-8 System memory area (512 words).................................................................................................................1-35
1-4-9 Temporary area..............................................................................................................................................1-61
1-5 Variables............................................................................................................................................1-64
1-5-1 What is a variable?........................................................................................................................................1-64
1-5-2 Memory assignment.......................................................................................................................................1-65
1-5-3 Local variables and global variables..............................................................................................................1-65
1-5-4 Variable declaration........................................................................................................................................1-66
1-6 Data type............................................................................................................................................1-70
1-6-1 Basic data......................................................................................................................................................1-70
1-6-2 Organization of data types.............................................................................................................................1-72
1-6-3 Basic data types.............................................................................................................................................1-73
1-6-4 Representation of constants..........................................................................................................................1-76
1-6-5 Derived data types.........................................................................................................................................1-77
1-6-6 Notes on structures........................................................................................................................................1-82
1-6-7 Notes on floating-point calculation.................................................................................................................1-84
1-7 Tasks..................................................................................................................................................1-87
1-7-1 Task specifications.........................................................................................................................................1-87
1-7-2 Types and operations of tasks.......................................................................................................................1-87
1-7-3 Example of fixed cycle task operation............................................................................................................1-88
1-7-4 Example of event task operation....................................................................................................................1-89
1-7-5 Task interrupt processing...............................................................................................................................1-90
1-8 Program Organization Unit (POU)...................................................................................................1-91
1-8-1 Program organization unit (POU)...................................................................................................................1-91
1-8-2 User FB..........................................................................................................................................................1-95
1-9 Performance Specifications.............................................................................................................1-100
1-9-1 SPH300..........................................................................................................................................................1-100
1-9-2 SPH300EX.....................................................................................................................................................1-104
1-9-3 SPH2000........................................................................................................................................................1-106
1-9-4 SPH3000........................................................................................................................................................1-108
Contents
1-9-5 SPH200..........................................................................................................................................................1-110
1-10 Operating Flowchart.......................................................................................................................1-112
1-11 SX Series Processing Time............................................................................................................1-113
1-11-1 Concept of processing time in SX series.....................................................................................................1-113
1-11-2 Basic data transmission processing and time..............................................................................................1-113
1-11-3 Relation between task processing and I/O processing time........................................................................1-114
1-11-4 Constant scan..............................................................................................................................................1-116
1-11-5 Execution band ratio setting........................................................................................................................1-118
1-11-6 I/O response time........................................................................................................................................1-119
1-12 Calendar Function...........................................................................................................................1-120
1-12-1 Calendar’s value range................................................................................................................................1-120
1-12-2 Calendar accuracy.......................................................................................................................................1-120
1-12-3 Monitoring and setting up the calendar clock from the D300win.................................................................1-120
1-12-4 Monitoring and setting up the calendar clock from an application program.................................................1-121
1-12-5 Time adjustment function.............................................................................................................................1-121
1-12-6 Example of calendar FB..............................................................................................................................1-122
Appendix 8 Changing Resource (CPU) (How to change CPU type in D300winV3 project)
Appendix 8-1 Overall Procedure............................................................................................................App.8-1
Appendix 8-2 Detailed Procedure for Changing CPU Type in D300winV3 Project............................App.8-2
Instruction Index
Section 1 Specifications
1-4 Memory....................................................................................................1-13
1-4-1 Memory map.................................................................................................1-13
(1) NP1PS-32/32R (SPH300)............................................................................1-13
(2) NP1PS-74/74R (SPH300)............................................................................1-14
(3) NP1PS-117/117R (SPH300).........................................................................1-15
(4) NP1PS-245R (SPH300)...............................................................................1-16
(5) NP1PS-74D (SPH300EX).............................................................................1-17
(6) NP1PM-48R/48E (SPH2000).......................................................................1-18
(7) NP1PM-256E/256H (SPH2000)...................................................................1-19
(8) NP1PU-048E (SPH3000).............................................................................1-20
(9) NP1PU-128E (SPH3000).............................................................................1-21
(10) NP1PU-256E (SPH3000)...........................................................................1-22
(11) NP1PH-16 (SPH200)..................................................................................1-24
(12) NP1PH-08 (SPH200)..................................................................................1-25
1-4-2 I/O memory area (512 words, I/O extension mode: Max. 4096 words).........1-26
1-4-3 Standard memory area..................................................................................1-27
1-4-4 Retain memory area......................................................................................1-29
1-4-5 User FB instance memory area.....................................................................1-31
1-4-6 System FB instance memory area................................................................1-32
1-4-7 Initialization area...........................................................................................1-34
1-4-8 System memory area (512 words)................................................................1-35
(1) System memory............................................................................................1-35
(2) Resource operating status %MW10.0 (Read only).....................................1-37
(3) Resource switch / User ROM state %MW10.1 (Read only).......................1-38
(4) Resource fatal fault factor %MW10.2 (Read only)......................................1-39
(5) Resource nonfatal fault factor %MW10.4 (Read only)................................1-40
(6) CPU error factor %MW10.6 (Read only)....................................................1-41
(7) Memory error factor %MW10.8, %MW10.9 (Read only)............................1-41
(8) SX bus error factor %MW10.10, %MW10.11..............................................1-42
(9) Application error factor %MW10.12, %MW10.13 (Read only)....................1-42
(10) User fatal fault %MW10.14 to %MW10.16...............................................1-43
(11) User nonfatal fault %MW10.18 to %MW10.20.........................................1-43
(12) System definition error factor %MW10.22 to %MW10.29 (Read only).....1-44
(13) Application program error factor %MW10.38, %MW10.39.......................1-46
(14) Announce relay %MW10.42, %MW10.43................................................1-47
(15) Redundancy announce relay %MW10.46,
Redundant operation mode %MW10.47 (Read only).................................1-48
(16) Resource operation/running information
%MW10.48, %MW10.49 (Read only).........................................................1-49
(17) Resource configuration/fault information
%MW10.50, %MW10.51 (Read only).........................................................1-50
(18) Configuration information %MW10.52 to %MW10.67 (Read only)...........1-51
(19) Configuration fault information
%MW10.68 to %MW10.83 (Read only)......................................................1-52
(20) Fail-soft information of module directly connected to SX bus
%MW10.84 to %MW10.99 (Read only)......................................................1-52
(21) Remote I/O master 0 I/O module configuration/fault information
%MW10.128 to %MW10.143 (Read only)..................................................1-53
(22) Remote I/O master 1 I/O module configuration/fault information
%MW10.144 to %MW10.159 (Read only)..................................................1-54
(23) Remote I/O master 2 I/O module configuration/fault information
%MW10.160 to %MW10.175 (Read only)..................................................1-54
(24) Remote I/O master 3 I/O module configuration/fault information
%MW10.176 to %MW10.191 (Read only)..................................................1-55
(25) Remote I/O master 4 I/O module configuration/fault information
%MW10.192 to %MW10.207 (Read only)..................................................1-55
(26) Remote I/O master 5 I/O module configuration/fault information
%MW10.208 to %MW10.223 (Read only)..................................................1-56
(27) Remote I/O master 6 I/O module configuration/fault information
%MW10.224 to %MW10.239 (Read only)..................................................1-56
(28) Remote I/O master 7 I/O module configuration/fault information
%MW10.240 to %MW10.255 (Read only)..................................................1-57
(29) “Fail-soft maintenance operation prohibition” mode /
“Hide the error display state” mode %MW10.256 (Read only).................1-58
(30) Station No. in hide the error display state mode
%MW10.257 to %MW10.272 (Read only)..................................................1-59
(31) I/O extension mode status %MW10.273 (Read only)...............................1-59
(32) Ethernet interface information
%MW10.440 to %MW10.445 (Read only)..................................................1-60
(33) Free-run counter information %MD10.446 (Read only)............................1-60
(34) SX bus transmission error rate information
%MW10.508 to %MW10.511 (Read only)..................................................1-60
1-4-9 Temporary area.............................................................................................1-61
(1) Use of temporary area..................................................................................1-61
(2) Restrictions on a temporary size..................................................................1-62
(3) Using the temporary area.............................................................................1-62
1-5 Variables..................................................................................................1-64
1-5-1 What is a variable?........................................................................................1-64
1-5-2 Memory assignment......................................................................................1-65
1-5-3 Local variables and global variables.............................................................1-65
1-5-4 Variable declaration.......................................................................................1-66
(1) Types of variable declaration statements.....................................................1-66
(2) AT specification variables (position variables)..............................................1-66
(3) Symbolic variables........................................................................................1-67
(4) Retain variables............................................................................................1-68
(5) Initialization variable.....................................................................................1-68
(6) Restrictions on variable names.....................................................................1-69
1-6 Data type.................................................................................................1-70
1-6-1 Basic data......................................................................................................1-70
1-6-2 Organization of data types............................................................................1-72
1-6-3 Basic data types............................................................................................1-73
1-6-4 Representation of constants..........................................................................1-76
1-6-5 Derived data types........................................................................................1-77
(1) Array data types............................................................................................1-77
(2) Structured data types....................................................................................1-79
(3) Restrictions on derived data types................................................................1-81
1-6-6 Notes on structures.......................................................................................1-82
1-6-7 Notes on floating-point calculation................................................................1-84
(1) About “floating point precision lowering”.......................................................1-84
(2) Loss of trailing digits.....................................................................................1-84
(3) Measures against loss of trailing digit...........................................................1-84
(4) Occurrence of “Loss of trailing digits”, and effect on floating-point
calculation instructions..................................................................................1-85
1-7 Tasks.......................................................................................................1-87
1-7-1 Task specifications........................................................................................1-87
1-7-2 Types and operations of tasks.......................................................................1-87
1-7-3 Example of fixed cycle task operation...........................................................1-88
1-7-4 Example of event task operation...................................................................1-89
1-7-5 Task interrupt processing..............................................................................1-90
CPU IN OUT
Input Output
module module
S_END S_START
Data packet (shown as a red circle in the above figure) circulates in a fixed cycle.
While circulating, data are exchanged and information (input/output [I/O]
information) to each module is kept refreshing.
This cycle in which information is refreshed is called “SX bus tact cycle” (abbreviated as “tact cycle”). The features and notes of
the tact cycle are described below.
1) Since the tact cycle operates in a fixed cycle, I/O refresh cycle and program cycle are always synchronized. The jitter of the
tact cycle is 100µs or less.
2) The SX bus tact cycle is high-speed. The default value is “1ms”.
3) The SX bus is not provided only in a main base board. It also can be used for expansion base boards/units.
4) The tact cycle is a base time to operate a SX bus system. The SX system operates based on the tact cycle.
Concretely, a program is started and executed, and I/Os are refreshed at the tact cycle.
5) The tact cycle is the time required to circulate around the modules. The more modules are connected, the longer the tact time
becomes.
6) The SX bus has a loop structure as shown in the image figure above. Be sure to connect an SX bus terminating plug at the
both ends of the SX bus (base board).
7) Set the SX bus tact cycle to an appropriate value. If the actual tact cycle exceeds the default value (1ms), a “tact cycle
observation error” occurs. In this case, increase the tact cycle setting and set an appropriate value.
Under the “tact cycle observation error” condition, the program execution cycle will fluctuate.
1-1
Section 1 Specifications Processor bus
1-2
Section 1 Specifications Programming
By the above basic structure, D300win has features that improve the efficiency of program creation and reusability of programs.
As shown in the figure below, “Memory,” “Program,” and “operation method” are combined like building blocks.
Memory
Program
System definition
Program
Compilation
Operation method
1-3
Section 1 Specifications Programming
Variable,
Data type POU, FB, FC
Variable,
Task
Data type
System definition
POU, FB, FC
Compilation
Task
1-4
Section 1 Specifications Basic terms
Configuration Configuration
P-link
PW CPU CPU P-link I/O I/O I/O PW CPU P-link I/O I/O
0 1 IF 0 IF
SX bus
T-link
(2) Resource
A resource consists of one CPU and associated resources (such as I/O modules and programs) and is equivalent to the process
function to execute programs.
For a system with only one CPU, you can think “resource” = “CPU”.
1-5
Section 1 Specifications Representations in programming tool
1-6
Section 1 Specifications Notes on programming
1-7
Section 1 Specifications Notes on programming
Network No.
Execution
order
Execution
order
1-8
Section 1 Specifications Notes on programming
Coil 1
Inverted coil 1
Set coil 1
Reset coil 1
RETURN Return 1
Applied instructions are represented as FBs. Add the number of steps of each FB.
BOOL SET1
SR
Q1 BOOL Set reset flip-flop SR 8
BOOL RESET
RS_1
BOOL SET1
RS
Q1 BOOL Reset set flip-flop RS 8
BOOL RESET
R_TRIG_1
R_TRIG
Rising edge trigger R_TRIG 6
BOOL CLK Q BOOL
F_TRIG_1
F_TRIG
Falling edge trigger F_TRIG 6
BOOL CLK Q BOOL
CTU_1
CTU
BOOL CU Q BOOL Up counter CTU 12
BOOL RESET
INT PV CV INT
CTD_1
CTD
BOOL CD Q BOOL Down counter CTD 12
BOOL LOAD
INT PV CV INT
1-9
Section 1 Specifications Using this user’s manual
1-10
Section 1 Specifications Address assignment
I/O addresses
SX bus station No. %IX1.0.0 to %IX1.0.15
CPU No. %IX2.0.0 to %IX2.0.15
%IX2.1.0 to %IX2.1.15
%IX3.0.0 to %IX3.0.15
%IX3.1.0 to %IX3.1.15
%IX3.2.0 to %IX3.2.15
%IX3.3.0 to %IX3.3.15
%QX4.0.0 to %QX4.0.5
%QX5.0.0 to %QX5.0.7
%QX6.0.0 to %QX6.0.15
%QX7.0.0 to %QX7.0.15
%QX7.1.0 to %QX7.1.15
%QX8.0.0 to %QX8.0.15
%QX8.1.0 to %QX8.1.15
%QX8.2.0 to %QX8.2.15
%QX8.3.0 to %QX8.3.15
Period Period
2) Remote I/O
Prefix SX bus station No. Remote I/O station No. Word No. Bit address
1-11
Section 1 Specifications Address assignment
1-12
Section 1 Specifications Memory map
1-4 Memory
1-4-1 Memory map
(1) NP1PS-32/32R (SPH300)
%MW10.0 %MWo.10.0
System memory
(M)
512 words
%MW10.511 %MWo.10.511
Notes:
1) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system FB
instance memory can be increased or decreased by the loader settings. The above figure shows the default values. For
details, see “3-5-2 CPU memory size definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) The first 2K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
1-13
Section 1 Specifications Memory map
%MW10.0 %MWo.10.0
System memory
(M)
512 words
%MW10.511 %MWo.10.511
Notes:
1) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system FB
instance memory can be increased or decreased by the loader settings. The above figure shows the default values. For
details, see “3-5-2 CPU memory size definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) The first 2K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
1-14
Section 1 Specifications Memory map
%MW10.0 %MWo.10.0
System memory
(M)
512 words
%MW10.511 %MWo.10.511
Notes:
1) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system FB
instance memory can be increased or decreased by the loader settings. The above figure shows the default values. For
details, see “3-5-2 CPU memory size definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) The first 2K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
1-15
Section 1 Specifications Memory map
%MW10.0 %MWo.10.0
System memory
(M)
512 words
%MW10.511 %MWo.10.511
Notes:
1) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system FB
instance memory can be increased or decreased by the loader settings. The above figure shows the default values. For
details, see “3-5-2 CPU memory size definition.”
* When changing the memory size, set the size so that the total of the standard memory and retain memory is equal to or
less than 392192 words.
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) The first 2K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
1-16
Section 1 Specifications Memory map
%MW1.500000 %MW254.0.1.500000
Basic/Expanded CPU common standard memory (M)
Basic CPU write area
%MW1.502047 %MW254.0.1.502047
%MW1.600000 %MW254.0.1.600000
Basic/Expanded CPU common standard memory (M)
Expanded CPU write area
%MW1.602047 %MW254.0.1.602047
%MW1.700000 %MW254.0.1.700000
Basic/Expanded CPU common standard memory (M)
Basic/Expanded CPU write area
%MW1.702047 %MW254.0.1.702047
Notes:
1) The above figure shows the addresses of the Expanded CPU memory when the Basic CPU No. is 0. “254” is the SX station
No. of the Basic CPU. If the Basic CPU No. is 1, replace 254 with 253. If the No. is 2, replace 254 with 252.
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No. Only the basic CPU memory can be accessed from another CPU.
3) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system FB
instance memory can be increased or decreased by the loader settings. The above figure shows the default values. For
details, see “3-5-2 CPU memory size definition.”
4) The first 2K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
5) For the specifications and operations of SPH300EX (NP1PS-74D), refer to the user’s manual “SPH300EX (FEH192).”
1-17
Section 1 Specifications Memory map
%MW1.0
Standard memory
(M) Program memory
64K words
%MW1.65535 48K steps
%MW1.98304 %MW.1.98304
Standard memory for multi-CPU
(M)
0 word
%MW3.0
Retain memory
(normal)
(M)
%MW3.8191 8K words
%MW3.32768 %MW.3.32768 (Note 1)
Retain memory for multi-CPU
(M)
0 word Temporary area
32K words
%MW10.0 %MW.10.0
System memory
(M)
512 words
%MW10.511 %MW.10.511
Notes:
1) The size of standard memory, retain memory, user FB instance memory, and system FB instance memory can be
increased or decreased by the loader settings. The above figure shows the default values. For details, see “3-5-2 CPU
memory size definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) Reserve a memory for multi-CPU to perform inter-CPU memory access. For details, see “3-5-2 CPU memory size
definition.”
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
5) When used in a single CPU system, the standard memory and retain memory for multi-CPU system can be used as an
ordinary self-CPU memory.
1-18
Section 1 Specifications Memory map
%MW10.0 %MW.10.0
System memory
(M)
512 words
%MW10.511 %MW.10.511
Notes:
1) The size of standard memory, retain memory, user FB instance memory, and system FB instance memory can be increased
or decreased by the loader settings. The above figure shows the default values. For details, see “3-5-2 CPU memory size
definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) Reserve a memory for multi-CPU to perform inter-CPU memory access. For details, see “3-5-2 CPU memory size
definition.”
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
5) When used in a single CPU system, the standard memory and retain memory for multi-CPU system can be used as an
ordinary self-CPU memory.
6) There is a difference in the access speed between the normal memory (32K words) and the other memory (352K words).
For details, see “Appendix 9 SPH2000/SPH3000 Series Memory Access Time.”
1-19
Section 1 Specifications Memory map
%MW10.0 %MWo.10.0
System memory
(M)
512 words
%MW10.511 %MWo.10.511
Notes:
1) The size of standard memory, retain memory, user FB instance memory, and system FB instance memory can be increased
or decreased by the loader settings. The above figure shows the default values. For details, see “3-5-2 CPU memory size
definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) Reserve a memory for multi-CPU to perform inter-CPU memory access. For details, see “3-5-2 CPU memory size
definition.”
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
5) The first 96K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
6) When used in a single CPU system, the standard memory and retain memory for multi-CPU system can be used as an
ordinary self-CPU memory.
7) See <High-speed program memory> on the later page.
8) There is a difference in the access speed between the normal memory (32K words) and the other memory (128K words).
For details, see “Appendix 9 SPH2000/SPH3000 Series Memory Access Time.”
1-20
Section 1 Specifications Memory map
%MW10.0 %MWo.10.0
System memory
(M)
512 words
%MW10.511 %MWo.10.511
Notes:
1) The size of standard memory, retain memory, user FB instance memory, and system FB instance memory can be increased
or decreased by the loader settings. The above figure shows the default values. For details, see “3-5-2 CPU memory size
definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) Reserve a memory for multi-CPU to perform inter-CPU memory access. For details, see “3-5-2 CPU memory size
definition.”
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
5) The first 96K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
6) When used in a single CPU system, the standard memory and retain memory for multi-CPU system can be used as an
ordinary self-CPU memory.
7) See <High-speed program memory> on the later page.
8) There is a difference in the access speed between the normal memory (32K words) and the other memory (224K words).
For details, see “Appendix 9 SPH2000/SPH3000 Series Memory Access Time.”
1-21
Section 1 Specifications Memory map
%MW10.0 %MWo.10.0
System memory
(M)
512 words
%MW10.511 %MWo.10.511
Notes:
1) The size of standard memory, retain memory, user FB instance memory, and system FB instance memory can be increased
or decreased by the loader settings. The above figure shows the default values. For details, see “3-5-2 CPU memory size
definition.”
2) When accessing the memory of another CPU in a multi-CPU system, enter the CPU No. in o. When accessing the own
memory, you do not need to enter the CPU No.
3) Reserve a memory for multi-CPU to perform inter-CPU memory access. For details, see “3-5-2 CPU memory size
definition.”
4) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
5) The first 96K words of the standard memory (M) are a high-speed memory area that is accessed at a higher speed. Another
CPU can not access this area as a global memory. The size cannot be changed.
6) When used in a single CPU system, the standard memory and retain memory for multi-CPU system can be used as an
ordinary self-CPU memory.
7) See <High-speed program memory> on the later page.
8) There is a difference in the access speed between the normal memory (32K words) and the other memory (352K words).
For details, see “Appendix 9 SPH2000/SPH3000 Series Memory Access Time.”
1-22
Section 1 Specifications Memory map
You can assign a POU to the high-speed program memory by the loader setting; [Resource setting] > [Compiler setting] > [Optimize
option] > [Option setting]. For the setting procedure, refer to the user’s manual SX-Programmer Expert (D300win) <reference>
(FEH257) “Section 10-5-1 Compiler setting.” (In the image below, “High speed” indicates the high-speed program area.)
* The settings of the dialog box shown above takes effect after compilation.
The size of the high-speed program memory area is 224K bytes (224 x 1024 = 229376 bytes).
(When converted to steps, approximately 1 step = 1 to 32 bytes.)
On the “Infos” tab window of the message window, you can check how much of the high-speed program memory is consumed
after compilation.
Note: If the remaining capacity becomes less than 10000 bytes, a warning is issued.
* If the high-speed program memory capacity is exceeded, the shortage capacity is displayed.
1-23
Section 1 Specifications Memory map
%I %Q
I/O memory
(I/Q)
512 words (8192 points)
%MW1.0
Standard memory
(M)
Program memory
8K words
%MW1.8191
16K steps
%MW3.0
Retain memory
(M)
4K words
%MW3.4095
Temporary area
System FB instance memory 4K words
(M)
8K words
* 1K=1024
%MW10.0
System memory
(M)
512 words
%MW10.511
Initialization area
Notes:
1) The size of standard memory, retain memory, user FB instance memory, system FB instance memory and initialization are
can be increased or decreased by the loader settings. The above figure shows the default values. For details, see “3-5-2
CPU memory size definition.”
2) No multi-system can be built up using a standard CPU module.
3) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
1-24
Section 1 Specifications Memory map
%I %Q
I/O memory
(I/Q)
512 words (8192 points)
%MW1.0
Standard memory
(M)
Program memory
4K words
%MW1.4095
8K steps
%MW3.0
Retain memory
(M)
2K words
%MW3.2047
(Note 1)
Temporary area
System FB instance memory 4K words
(M)
4K words
* 1K=1024
%MW10.0
System memory
(M)
512 words
%MW10.511
Initialization area
Notes:
1) The size of standard memory, retain memory, user FB instance memory, system FB instance memory and initialization are
can be increased or decreased by the loader settings. The above figure shows the default values.
For details, see “3-5-2 CPU memory size definition.”
2) No multi-system can be built up using a standard CPU module.
3) For the I/O address assignment, see “1-3 Input/output (I/O) Address Assignment.”
1-25
Section 1 Specifications I/O memory
1-4-2 I/O memory area (512 words, I/O extension mode: Max. 4096 words)
The I/O memory area is a window through which data is exchanged between the CPU and external devices. This area is used
by input devices such as pushbuttons, switches, and sensors which send data to the CPU and by output devices such as relays,
solenoids, and indicators which show the results of program executions.
G Key point:
1) Input is represented by the %I (prefix), and output by the %Q (prefix). When actually assigning an I/O address, these
prefixes are followed by a size and address in the variable declaration. For details, see “1-3 Input/output (I/O) Address
Assignment.”and “1-5-4 Variable declaration.”
2) This area is also used to control I/O that is connected directly to the SX bus and remote I/O such as T-links.
3) Both input and output cannot exist in the same word.
4) When accessing the I/O memory area from a POD or other external device, each access takes 81 Tact time.
(only SPH300, SPH300EX)
5) The following CPUs support the I/O extension mode:
SPH300 (NP1PS-74: V2364 or later; NP1PS-74R/117/117R: V2664 or later; NP1PS-245R: V2064 or later), SPH300EX,
SPH2000 (NP1PM-256E/256H: V**08 or later), and SPH3000 (all versions).
<Normal mode>
15 0
%I %Q
I/O memory
512 words
1-26
Section 1 Specifications Standard memory
G Key point:
1) In the direct addressing mode, this memory area is specified in the format of %Mo1. ..... (replace o with any of X, W,
or D). Usually, since a variable declaration is used to assign memory to an application program, you may neglect
addresses in programming. For details, see “1-5 Variables.”
2) The table below shows the memory statuses at “cold start” and “warm start”.
3) For SPH300, the first 2K words of the standard memory are a high-speed memory area where data access in the CPU
is processed at high speed. On the other hand, when data is accessed from an external device such as POD, single
access operation requires 81 tacts.
4) For SPH3000, the first 96K words of the standard memory are a high-speed memory area where data access in the
CPU is processed at high speed. When accessed from an external device such as POD, there is no difference in
responsibility between the standard memory (high-speed) and the other memories.
5) In a multi-CPU system, the standard memory area excluding the high-speed memory can be accessed as a global
memory from another CPU (only for SPH300 and SPH300EX).
6) In a multi-CPU system of SPH2000 and SPH3000 series, the standard memory for multi-CPU needs to be reserved to
access the memory from another CPU as a global memory.
7) When SPH2000 and SPH3000 series CPU is used in a single CPU system, the standard memory for multi-CPU can be
used as a self-CPU memory. However, when using multiple words such as arrays or structures, it is not possible to use
across the standard memory and standard memory for multi-CPU.
8) The size of the standard memory area can be changed taking those of other areas into account (only for SPH).
However, the size of the high-speed memory area of SPH300 and SPH3000 cannot be changed.
For how to change the memory sizes, see “3-5-2 CPU memory size definition.”
9) For SPH300 and SPH3000, no continuous access is allowed to the high-speed access memory area and the
boundaries between other areas. For example, an array or structure cannot lie across the boundary.
1-27
Section 1 Specifications Standard memory
IEC representation
NP1PS-32/32R
: 6K words
NP1PS-74/74R/74D
: 30K words
NP1PS-117/117R
: 126K words
NP1PS-245R
: 254K words
(SPH2000)
15 0
%MW1.0
Standard memory
(M)
NP1PM-48R/48E NP1PM-48R/48E
%MW1.98304 Standard memory %MW.1.98304
NP1PM-256E/256H for multi-CPU NP1PM-256E/256H
%MW1.2097152 %MW.1.2097152
* 0 word by default
(SPH3000)
15 0
%MW1.0 Standard memory
(high speed)
(M)
96K words (fixed)
%MW1.98303
%MW1.98304
Standard memory
(M)
NP1PU-048E
: 0 word Address representation
NP1PU-128E for a multi-CPU system
: 672K words
NP1PU-256E CPU No.
: 1568K words
NP1PU-048E NP1PU-048E
%MW.1.262144 %MW.1.262144
NP1PU-128E Standard memory NP1PU-128E
%MW1.1048576 for multi-CPU %MW.1.1048576
NP1PU-256E NP1PU-256E
%MW.1.2097152 * 0 word by default %MW.1.2097152
1-28
Section 1 Specifications Retain memory
G Key point:
1) In the direct addressing mode, this memory area is specified in the format of %Mo3. ..... (replace o with any of X, W,
or D). Usually, since a variable declaration is used to assign memory to an application program, you may neglect
addresses in programming. For details, see “1-5 Variables.”
2) The table below shows the memory statuses at “cold start” and “warm start”.
3) You can select whether or not to clear this area when transferring the project.
If you select “clear,” the system cold-starts and if “not clear,” the system warm-starts.
4) In a multi-CPU system, the retain memory area can be accessed as a global memory from another CPU (only for
SPH300 and SPH300EX).
5) In a multi-CPU system of SPH2000 and SPH3000 series, the retain memory for multi-CPU needs to be reserved to
access the memory from another CPU as a global memory.
6) When SPH2000 and SPH3000 series CPU is used in a single CPU system, the standard memory for multi-CPU can be
used as a self-CPU memory. However, when using multiple words such as arrays or structures, it is not possible to use
across the standard memory and standard memory for multi-CPU.
7) The size of the retain memory area can be changed taking those of other areas into account.
For how to change the memory sizes, see “3-5-2 CPU memory size definition.” (Only for SPH)
Notes:
The CPU runs in “cold start” mode when started by the “Initial run” command of the loader and in “warm start” mode when the
system power is turned ON or started by the “Run” command of the loader.
1-29
Section 1 Specifications Retain memory
IEC representation
(SPH2000)
15 0
%MW3.0
Retain memory
(M)
%MW3.32768 %MW.3.32768
Retain memory
for multi-CPU
NP1PM-48R/48E
* 0 word by default
NP1PM-256E/256H * Conditions for initialization of retain memory
: 224K words • When “initial startup” is executed from D300win
• When the CPU is started after downloading the project
with “clear retain memory area”
• When the CPU is started after CPU’s memory boundary
(SPH3000)
definitions have been changed
15 0
%MW3.0
Retain memory
(M)
NP1PU-048E
: 32K words
NP1PU-128E
: 112K words
NP1PU-256E
: 224K words
1-30
Section 1 Specifications User FB instance memory
G Key point:
1) The size of the user FB instance memory area can be changed taking those sizes of other areas into account.
For how to change the memory sizes, see “3-5-2 CPU memory size definition.”
User FB instance memory * Conditions for initialization of user FB instance memory area
(M) • When “initial startup” is executed from D300win
• When the CPU is started after downloading the project with “clear FB/SFB retain variables”
NP1PS-32/32R
: 4K words
NP1PS-74/74R/74D
: 16K words
NP1PS-117/117R
: 32K words
NP1PS-245R
: 65K words
NP1PM-48R/48E
: 8K words
NP1PM-256E/256H
: 64K words
NP1PU-048E
: 40K words
NP1PU-256E
: 72K words
NP1PH-16
: 4K words
NP1PH-08
: 2K words
1-31
Section 1 Specifications System FB instance memory
G Key point:
1) At PLC startup, predefined initialization is performed. Instance memory data are retained or reset to 0 (zero) depends
on memory area.
Note that even in the retained area, it is possible to select whether to clear the values when downloading projects from
D300win.
Example) The current values of the counter and additional timer, and the previous value of the edge detect are
retained, whereas the current value of the timer is reset to 0.
2) The No. of words used by each system FB is as follows.
8 words / Timer, 4 words / Counter, and 2 words / Edge detect instruction counter
3) The size of the system FB instance memory area can be changed taking those of other areas into account.
For how to change the memory sizes, see “3-5-2 CPU memory size definition.”
4) By default, the number of points of timers, additional timers, counters, and edge detect instruction counters have been
preset for each CPU as shown below. If necessary, you can change these numbers.
Additional
Timer Counter Edge detect Others
timer
NP1PS-32/32R 512 points 128 points 256 points 1024 points 8192 words
NP1PS-74/74R/74D
NP1PS-117/117R
2048 points 512 points 1024 points 4096 points 32768 words
NP1PS-245R
NP1PM-256E/256H
NP1PU-048E/256E 2560 points 640 points 1280 points 5120 points 40960 words
NP1PM-48R/48E 512 points 128 points 256 points 1024 points 8192 words
NP1PH-16 256 points 64 points 128 points 512 points 4096 words
NP1PH-08 128 points 32 points 64 points 256 points 2048 words
To set the timer, additional timer, counter, edge detect, and other system FB areas, the following conditions must be
met.
(No. of timers) x words + (No. of counters) 4 words + (No. of edge detect counters) x words + others
<= Preset size of system FB instance memory area
1-32
Section 1 Specifications System FB instance memory
Total. timer
NP1PS-32/32R: 1K words
NP1PS-74/74R/74D/117/117R/245R, NP1PM-256E/256H: 4K words
NP1PU-048E/256E: 5K words
NP1PM-48R/48E: 1K words
NP1PH-08: 0.25K words, NP1PH-16: 0.5K words
Timer
NP1PS-32/32R: 4K words
NP1PS-74/74R/74D/117/117R/245R, NP1PM-256E/256H: 16K words
NP1PU-048E/256E: 20K words
NP1PM-48R/48E: 4K words
NP1PH-08: 1K words, NP1PH-16: 2K words
Others
NP1PS-32/32R: 8K words
NP1PS-74/74R/74D/117/117R/245R, NP1PM-256E/256H: 32K words
NP1PU-048E/256E: 40K words
NP1PM-48R/48E: 8K words
NP1PH-08: 2K words, NP1PH-16: 4K words
1-33
Section 1 Specifications Initialization area
G Key point:
From the table shown above, the numbers (default value) of variables for which initial values can be set are calculated
by the formulas below.
NP1PH-16: 2560 / 5 =512 (Any digits under the decimal point are truncated) 512 points
NP1PH-08: 768 / 5 =153 (Any digits under the decimal point are truncated) 153 points
3) The size of a user FB initialization area requires: No. of words of the preset user FB instance area x 9/8
Initialization area
Initial user FB value * SPH300 has an area that stores a total of 3,200 initial values for standard and
storing area retain memory combined. You do not neet to care about the “initialization area.”
In addition, for SPH300, you can set initial values for variables in the user FB
NP1PH-16: corresponding to the capacity of the user FB instance memory.
4608 words * SPH2000 and SPH3000 have an area that stores a total of 12,800 (3,200 for
(default) SPH2000 software version V01) initial values for standard and retain memory
NP1PH-08: combined. You do not neet to care about the “initialization area.”
2304 words In addition, for SPH2000 and SPH3000, you can set initial values for variables
(default) in the user FB corresponding to the capacity of the user FB instance memory.
NP1PH-16:
2560 words
(default)
NP1PH-08:
768 words
(default)
1-34
Section 1 Specifications System memory
1-36
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.0.0 Run ON while the CPU is running. a a a
%MX10.0.1 Stop ON while the CPU is stopped. a a a
%MX10.0.2 Fatal fault ON when a fatal error occurs in the resource. a a a
%MX10.0.3 Nonfatal fault ON when a nonfatal error occurs in the resource. a a a
ON when the CPU is a working CPU in the redundant a
%MX10.0.4 Redundancy working station a –
mode. Note 2
a
%MX10.0.6 1:1 redundancy ON when the system is in the 1-to-1redundant mode. a –
Note 2
Notes:
1) <When %MX10.0.13 = 0 (the modules on the SX bus do not support fail-soft operation)>
For common modules, fail-soft is not performed, and for the I/O modules connected to the SX bus, fail-soft is not
performed even if enabled by the loader setting (D300win).
<When %MX10.0.13 = 1 (the modules on the SX bus support fail-soft operation)>
For common modules, fail-soft is performed, and for the I/O modules connected to the SX bus, fail-soft is performed
according to the loader setting (D300win).
2) Only for NP1PM-256H
1-37
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.1.0 Indicates the 4-bit number (0-F) set by the CPU No.
| CPU No. selection key switch on the CPU module front panel. a a –
%MX10.1.3 Setting range: CPU No.0 to No.7 for CPU modules
(%MX10.1.4, %MX10.1.5)
%MX10.1.4 a
User ROM operation mode (0, 0): Mode with user ROM operation a –
%MX10.1.5 Note 4
(1, 0): Mode with no user ROM operation
a
%MX10.1.6 User ROM card connection state 1: connected 0: unconnected a a
Note 1
1: write-protected a
%MX10.1.7 User ROM card write protect a a
0: write-permitted (enabled when %MX10.1.6 = 1) Note 1
%MX10.1.8 STOP position ON when the key switch is at the “STOP” position. a a a
ON when the key switch is at the “TERM” position
%MX10.1.9 TERM position (lower position) a a a
(lower position).
TERM position (upper position) ON when the key switch is at the “TERM” position
%MX10.1.10 a a a
(Note 2, 3) (upper position).
%MX10.1.11 RUN position ON when the key switch is at the “RUN” position. a a a
%MX10.1.12
| Not used – – –
%MX10.1.15
Notes:
1) Only for CPU modules that support the user ROM card (compact flash card)
2) The TERM position flag is also set ON when the key switch is in an unknown state.
3) For CPU modules that support the user ROM card, this flag is set “ON” when the key switch is set at the “UROM_TERM”
position.
4) Only for the software version V67 or later of CPU modules that support user ROM cards
1-38
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.2.0 CPU error ON when a fatal fault occurs in the CPU module. a a a
%MX10.2.1 Power supply error ON when a power-off condition occurs. a a a
ON when an error occurs in the memory in the CPU
%MX10.2.2 Memory error a a a
module.
ON when an SX bus error such as a disconnection of
%MX10.2.3 SX bus error a a a
cable or terminating plug occurs.
ON when an application program or system definition
%MX10.2.4 Application error a a a
contains an error.
%MX10.2.8
Not used – – –
%MX10.2.9
Remote I/O module error on ON when the system is down because an error occurs in a
%MX10.2.10 – – –
remote I/O master board remote I/O unit or module.
%MX10.2.11 Driver error – – –
%MX10.2.12 Not used – – –
%MX10.2.13 Other hardware error ON when an error occurs in the CPU No. selection switch. a a a
%MX10.2.14 Not used – – –
ON when one of the user fatal fault flags (%MX10.14.0 to
%MX10.2.15 User fatal error a a a
%MX10.16.15) is set ON by an application program.
Notes:
1) “Common modules” are modules that are connected to the SX bus without occupying an I/O area (for example, a CPU
module, communication module, etc.).
The bit is set ON if a fault occurs in a common module in the following condition: the version of the I/O module and base
board is V10 or later, the version of the communication module is V1030 or later, and they are all in the same configuration.
2) Only for NP1PM-256H
1-39
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.4.0
Not used – – –
%MX10.4.1
ON when an error occurs in the memory of the self-CPU
%MX10.4.2 Memory error a a a
module.
%MX10.4.3 SX bus error ON when an error occurs in the SX bus. a a a
ON when an application program or system definition contains
%MX10.4.4 Application error a a a
an error.
ON when a fault occurs in an I/O module controlled by the
%MX10.4.5 I/O module error a a a
self-CPU module and fail-soft operation is enabled. (Note)
Common module error ON when a fault occurs in a common module (excluding self-
%MX10.4.6 a a a
(Note 1) CPU module) on the SX bus.
%MX10.4.7
Not used – – –
%MX10.4.8
ON when the user ROM card cannot be recognized for the
following reasons.
User ROM card • The user ROM is broken. a
%MX10.4.9 – –
recognition error • The user ROM is not formatted in FAT. Note 4
• The user ROM in not compatible with SPH.
When this bit is ON, %MX10.1.6 and %MX10.1.7 are set OFF.
%MX10.4.10 Remote I/O module error ON when an error occurs on the remote I/O unit or module. – – –
ON when a disconnection of the equalized bus is detected in
Equalized bus a
%MX10.4.11 the redundant mode. – –
disconnection Note 3
OFF when the equalized bus is reconnected.
ON when the contents of the user ROM card does not
User ROM card - CPU a
%MX10.4.12 coincide with those of the CPU. The system definition, project a –
mismatch Note 2
and password are verified.
ON when a fault occurs in a key switch on CPU,or a fault
occurs in a Mode selection switch on general purpose
interface module.
If a fault occurs in the key switch, the CPU module operates
%MX10.4.13 Other hardware error a a a
assuming that the key switch is set to “TERM.”
If a fault occurs in the Mode selection switch, the general
purpose interface module operates assuming that the switch
is set to “loader mode”.
ON when the voltage of the data backup battery falls below
%MX10.4.14 Battery error a a a
the threshold level or the battery is dead.
ON when one of the user fatal fault flags (%MX10.18.0 to
%MX10.4.15 User nonfatal fault a a a
%MX10.20.15) is set ON by an application program.
Notes:
1) “Common modules” are modules that are connected to the SX bus without occupying an I/O area (for example, a CPU
module, communication module, etc.).
The bit is set ON if a fault occurs in a common module in the following condition: the version of the I/O module and base
board is V10 or later, the version of the communication module is V1030 or later, and they are all in the same configuration.
2) Only for CPU modules that support user ROM cards (compact flash card)
3) Only for NP1PM-256H
4) Only for the software version V69 or later of SPH300
1-40
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
Arithmetic processor Hardware error in the arithmetic LSI in the CPU module:
%MX10.6.0 a a a
error %MX10.2.0 is set ON
Hardware error in the OS control LSI in the CPU module:
%MX10.6.1 OS processor error a – –
%MX10.2.0 is set ON.
%MX10.6.2
| Not used – – –
%MX10.6.15
SPH
SPH SPH
Address Name Description Level 2000/
300 200
3000
ON when an error occurs in the system ROM in Fatal fault
%MX10.8.0 System ROM error a a a
the CPU module. (Note 3)
ON when an error occurs in the system RAM in the Fatal fault
%MX10.8.1 System RAM error a a a
CPU module. (Note 3)
ON when an error occurs in the application Fatal fault
%MX10.8.2 Application ROM error a a a
program ROM in the CPU module. (Note 1, 3)
ON when an error occurs in the application Fatal fault
%MX10.8.3 Application RAM error a a a
program RAM in the CPU module. (Note 3)
%MX10.8.4
| Not used – – –
%MX10.8.14
a
%MX10.8.15 Memory backup error ON when no power-failure-time data is retained. Fatal fault – –
Note 2
%MX10.9.0
| Not used – – –
%MX10.9.14
Memory backup error ON when no power-failure-time data is retained. Nonfatal a
%MX10.9.15 a a
(Note 4) This bit can be set OFF by an application program. fault Note 2
Notes:
1) This bit is also set ON when an error occurs in the user ROM card.
2) For SPH300, the bit set ON when a memory backup error occurs depends on the module version.
Earlier than V**.25: %MX10.8.15, V10.30 or later: %MX10.9.15
3) If these errors occur, initialize the resource from D300win, and re-download the project. If the error is not reset, it is a
hardware fault.
4) A memory backup error is detected when the CPU power is turned ON/OFF or reset. If the CPU power is turned OFF and
then ON again immediately after the error is detected for the first time, the error is reset when the CPU is powered ON for
the second time. If the CPU power is not turned ON for a long time after error detection, the error recurs when the CPU is
powered ON for the second time.
1-41
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description Level 2000/
300 200
3000
ON when an error occurs in the LSI controlling the
%MX10.10.0 SX bus LSI error Fatal fault a a a
SX bus.
ON when the same SX bus station number is
Station No.
%MX10.10.1 assigned to more than one module in the Fatal fault a a a
double-assignment
configuration.
ON when the number of modules connected to the
%MX10.10.2 Module count exceeded Fatal fault a a a
SX bus exceeds 254.
%MX10.10.3
| Not used – – –
%MX10.10.12
SX bus transmission ON when a transmission error occurs in the SX
%MX10.10.13 Fatal fault a a a
error bus.
ON when an access error occurs in the processor
Processor bus access
%MX10.10.14 bus. (when the cause of the error is attributable to Fatal fault a – a
error
the self-CPU module)
ON when the I/O data has not been refreshed by
%MX10.10.15 I/O refresh slow-down Fatal fault a a a
the SX bus for longer than 128ms.
%MX10.11.0
| Not used – – –
%MX10.11.13
SPH
SPH SPH
Address Name Description Level 2000/
300 200
3000
%MX10.12.0 System definition error ON when the system definition contains an error. Fatal fault a a a
Application program ON when the application program contains an
%MX10.12.1 Fatal fault a a a
error error.
%MX10.12.2
| Not used – – –
%MX10.12.15
%MX10.13.0 Note used – – –
Application program ON when the application program contains an Nonfatal
%MX10.13.1 a a a
error error. fault
%MX10.13.2
| Not used – – –
%MX10.13.15
1-42
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.14.0 User fatal fault factor 0 When any of these bits is set ON by an application
program, a fatal error occurs and the CPU stops
| |
%MX10.14.15 User fatal fault factor 15
%MX10.15.0 User fatal fault factor 16
| | a
%MX10.15.15 User fatal fault factor 31
%MX10.16.0 User fatal fault factor 32
| |
%MX10.16.15 User fatal fault factor 47
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.18.0 User nonfatal fault factor 0 When any of these bits is set ON by an application
program, a nonfatal error occurs and the CPU continues
| |
operation.
%MX10.18.15 User nonfatal fault factor 15 When the bit that is ON is set OFF by an application
program, the CPU recovers from the nonfatal fault
%MX10.19.0 User nonfatal fault factor 16
condition.
| | a
%MX10.19.15 User nonfatal fault factor 31
%MX10.20.0 User nonfatal fault factor 32
| |
%MX10.20.15 User nonfatal fault factor 47
1-43
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description Level 2000/
300 200
3000
%MX10.22.0 – – –
ON when the contents of the system
Fatal
%MX10.22.1 System definition error definition in the CPU module do not a a a
fault
match the actual system configuration.
ON when the tact cycle is set to 0.5ms
in a system in which a standard CPU is Fatal
%MX10.22.2 System running definition error a a a
used or two or more common modules fault
are connected in one configuration.
ON when the system DO (output)
definition is set in a module directly Fatal
%MX10.22.3 System DO setting error a a a
connected to the SX bus, but it is not a fault
digital output module.
ON when an error is found in the
Fatal a
%MX10.22.4 Redundancy setting error “memory copy range” specification in a –
fault Note 1
the system redundancy setting.
ON when fail-soft startup is enabled if
Fatal
%MX10.22.5 Fail-soft startup setting error any module is not applicable to fail-soft a a a
fault
in the system.
%MX10.22.6
| Not used – – –
%MX10.22.9
ON when the switch setting in the CPU
CPU running definition Fatal
%MX10.22.10 module is different from the CPU No. set a a a
error fault
in the system definition.
ON when the memory space used by an
Fatal
%MX10.22.11 CPU memory boundary definition error application program exceeds the total a a a
fault
memory capacity.
%MX10.22.12
| Not used – – –
%MX10.22.15
CPU I/O group definition error ON when an input module is defined for Fatal a – a
%MX10.23.0
for default tasks an output module. fault
CPU I/O group definition error
%MX10.23.1
for level 0 tasks
CPU I/O group definition error (for level
%MX10.23.2
1 tasks
CPU I/O group definition error
%MX10.23.3
for level 2 tasks
CPU I/O group definition error
%MX10.23.4
for level 3 tasks
ON when fail-soft definition of direct I/O Fatal
%MX10.23.5 Direct I/O fail-soft definition error a – a
contains an error. fault
Remote I/O master 0 ON when fail-soft definition contains an Fatal a – a
%MX10.23.6
fail-soft definition error error. fault
Remote I/O master 1
%MX10.23.7
fail-soft definition error
Remote I/O master 2
%MX10.23.8
fail-soft definition error
Remote I/O master 3
%MX10.23.9
fail-soft definition error
1-44
Section 1 Specifications System memory
Notes:
1) Only for NP1PM-256H
2) Only for models that support built-in Ethernet
3) The system definition error factor includes errors that do not occur during normal operation because D300win suppresses
them from occurring (for example, by checking them during compilation).
1-45
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description Level 2000/
300 200
3000
ON when the run time for a default task exceeds
%MX10.38.0 Application WDT error Fatal fault a a a
the preset value of a watchdog timer.
Application execution ON when an error such as “temporary size-over”
%MX10.38.1 Fatal fault a a a
error occurs during user program execution.
%MX10.38.2
| Not used – – –
%MX10.38.10
ON when the specified storage address is not
%MX10.38.11 FB instance setting error Fatal fault a a a
found.
ON when the preset initial value exceeds the
%MX10.38.12 Initial value setting error Fatal fault a a a
defined range of a storage area.
SFM boundary definition ON when a size greater than the maximum SFM
%MX10.38.13 Fatal fault a a a
error capacity value is defined.
%MX10.38.14 POU instruction error ON when the POU instruction contains an error. Fatal fault a – a
%MX10.38.15 Task registration error ON when the task registration contains an error. Fatal fault a a a
%MX10.39.0 Missing level 0 task ON when a task is missing. Nonfatal a a a
These bits can be set OFF by an application fault
%MX10.39.1 Missing level 1 task
program.
%MX10.39.2 Missing level 2 task
%MX10.39.3 Missing level 3 task
%MX10.39.4 Level 0 task slow-down ON when program execution is deferred and the Nonfatal a a a
predefined fixed cycle time is not maintained. fault
%MX10.39.5 Level 1 task slow-down
These bits can be set OFF by an application
%MX10.39.6 Level 2 task slow-down program.
%MX10.39.7 Level 3 task slow-down
%MX10.39.8
| Not used – – –
%MX10.39.14
ON when the tact cycle does not match the system
Tact cycle monitoring Nonfatal
%MX10.39.15 definition. a a a
error fault
This bit can be set OFF by an application program.
Notes:
The system definition error factor includes errors that do not occur during normal operation because D300win suppresses
them from occurring (for example, by checking them during compilation).
1-46
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
ON at the first startup after program download and at
%MX10.42.0 Initial flag initial startup (cold start). This flag never is set OFF during a a a
operation.
ON when a power-off condition occurred in the preceding
%MX10.42.1 Power-off flag a a a
session.
%MX10.42.2
| Not used – – –
%MX10.42.12
Indicates which option is chosen for the “waiting time mode
Waiting time mode for for structure check” in the system definition. a a
%MX10.42.13 –
structure check indication OFF: Wait structure agreement (default) Note 1 Note 1
ON: Wait specified time
ON when one or more dummy modules are mounted in one
%MX10.42.14 Dummy module flag a a a
system.
Processor bus access
%MX10.42.15 ON when the processor bus is disabled. a a a
disable flag
ON from the start of operation until the first execution of the
%MX10.43.0 Level 0 start flag a a a
level 0 task.
ON from the start of operation until the first execution of the
%MX10.43.1 Level 1 start flag a a a
level 1 task.
ON from the start of operation until the first execution of the
%MX10.43.2 Level 2 start flag a a a
level 2 task.
ON from the start of operation until the first execution of the
%MX10.43.3 Level 3 start flag a a a
level 3 task.
%MX10.43.4
| Not used – – –
%MX10.43.14
ON from the start of operation until the first execution of
%MX10.43.15 Default task start flag a a a
default task.
Notes:
1) Only for SPH200 whose software version is V45 or later and SPH300 whose software version is V69 or later.
1-47
Section 1 Specifications System memory
(15) Redundancy announce relay %MW10.46, Redundant operation mode %MW10.47 (Read only)
(Only for SPH300, NP1PM-256H)
SPH SPH
Address Name Description
300 2000
ON during operation in the redundant mode and when the working
Redundancy continuation
%MX10.46.0 system is switched to a standby one. (The CPU that is changed a a
start flag
over from standby to working mode)
%MX10.46.1
| Not used – –
%MX10.42.15
Indicates a 4-bit CPU logical No. in the redundant mode (0-7).
%MX10.47.0
You can recognize the default working CPU taken over by the
| Redundant logical CPU No. a a
standby CPU. It is undefined in the mode other than the redundant
%MX10.47.3
mode.
%MX10.47.4
Not used – –
%MX10.47.5
%MX10.47.6 Module redundancy setting ON when NP1PM-256H is in redundant mode. – a
Redundant annunciator ON when an announce relay is enabled for a pair of CPUs 0 and 1
%MX10.47.8 a a
relay mode 0 during operation in the 1:1 redundant mode.
Redundant annunciator ON when an announce relay is enabled for a pair of CPUs 2 and 3
%MX10.47.9 a a
relay mode 1 during operation in the 1:1redundant mode.
Redundant annunciator ON when an announce relay is enabled for a pair of CPUs 4 and 5
%MX10.47.10 a a
relay mode 2 during operation in the 1:1 redundant mode.
Redundant annunciator ON when an announce relay is enabled for a pair of CPUs 6 and 7
%MX10.47.11 a a
relay mode 3 during operation in the 1:1 redundant mode.
In redundant mode,
OFF: When the CPU is the default working system
Default working/standby
%MX10.47.12 (the physical CPU No. is even) – a
status
ON: When the CPU is the default standby system
(the physical CPU No. is odd).
%MX10.47.13
| Not used – –
%MX10.47.15
1-48
Section 1 Specifications System memory
Notes:
1) The CPU No. means the No. that is selected by the switch.
1-49
Section 1 Specifications System memory
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.50.0 CPU 0 configuration ON when the CPU module of the corresponding No. is
connected to the SX bus and its resource operation status
%MX10.50.1 CPU 1 configuration
is “normal” or “Nonfatal fault.”
%MX10.50.2 CPU 2 configuration
Note: For SPH200, only CPU 0 is the target.
%MX10.50.3 CPU 3 configuration
a a a
%MX10.50.4 CPU 4 configuration
%MX10.50.5 CPU 5 configuration
%MX10.50.6 CPU 6 configuration
%MX10.50.7 CPU 7 configuration
%MX10.50.8
| Not used – – –
%MX10.50.15
SPH
SPH SPH
Address Name Description 2000/
300 200
3000
%MX10.51.0 CPU 0 fault ON when the CPU module of the corresponding No. is
connected to the SX bus and its resource operation status
%MX10.51.1 CPU 1 fault
is “Fatal fault” or “Nonfatal fault.”
%MX10.51.2 CPU 2 fault
Note: For SPH200, only CPU 0 is the target.
%MX10.51.3 CPU 3 fault
a a a
%MX10.51.4 CPU 4 fault
%MX10.51.5 CPU 5 fault
%MX10.51.6 CPU 6 fault
%MX10.51.7 CPU 7 fault
%MX10.51.8
| Not used – – –
%MX10.51.15
Point:
In the redundant mode, “(17) Resource configuration/fault information” and “(18) SX bus configuration information” described on
the next page are used to enable the application program to recognize a fault on the standby side. Battery voltage drop on the
standby side can be detectedd as a nonfatal fault.
1-50
Section 1 Specifications System memory
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.53 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.54 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.55 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.56 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.57 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.58 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.59 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
%MW10.60 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128
%MW10.61 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144
%MW10.62 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160
%MW10.63 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176
%MW10.64 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192
%MW10.65 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208
%MW10.66 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224
%MW10.67 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240
1-51
Section 1 Specifications System memory
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.69 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.70 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.71 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.72 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.73 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.74 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.75 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
%MW10.76 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128
%MW10.77 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144
%MW10.78 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160
%MW10.79 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176
%MW10.80 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192
%MW10.81 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208
%MW10.82 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224
%MW10.83 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240
(20) Fail-soft information of module directly connected to SX bus %MW10.84 to %MW10.99 (Read only)
When fail-soft or individual reset cannot be done for any of the modules connected to the SX bus, the bit corresponding to the
SX station No. of the module is set ON.
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.85 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.86 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.87 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.88 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.89 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.90 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.91 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
%MW10.92 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128
%MW10.93 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144
%MW10.94 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160
%MW10.95 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176
%MW10.96 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192
%MW10.97 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208
%MW10.98 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224
%MW10.99 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240
1-52
Section 1 Specifications System memory
(21) Remote I/O master 0 I/O module configuration/fault information %MW10.128 to %MW10.143
(Read only)
When there is a module under the control of the remote I/O master 0 and it is normal or in a nonfatal fault condition, the bit
corresponding to the remote station No. of the module is set ON.
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.128 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.129 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.130 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.131 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.132 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.133 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.134 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.135 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
When there is a module under the control of the remote I/O master 0 and it is in a fatal or nonfatal fault condition, the bit
corresponding to the remote station No. of the module is set to ON.
<Fault information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.136 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.137 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.138 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.139 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.140 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.141 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.142 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.143 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
The interpretation of paragraphs (22) through (28) is identical to that of paragraph (21).
1-53
Section 1 Specifications System memory
(22) Remote I/O master 1 I/O module configuration/fault information %MW10.144 to %MW10.159
(Read only)
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.144 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.145 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.146 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.147 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.148 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.149 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.150 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.151 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.152 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.153 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.154 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.155 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.156 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.157 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.158 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.159 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
(23) Remote I/O master 2 I/O module configuration/fault information %MW10.160 to %MW10.175
(Read only)
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.160 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.161 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.162 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.163 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.164 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.165 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.166 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.167 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.168 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.169 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.170 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.171 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.172 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.173 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.174 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.175 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
1-54
Section 1 Specifications System memory
(24) Remote I/O master 3 I/O module configuration/fault information %MW10.176 to %MW10.191
(Read only)
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.176 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.177 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.178 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.179 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.180 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.181 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.182 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.183 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.184 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.185 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.186 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.187 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.188 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.189 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.190 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.191 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
(25) Remote I/O master 4 I/O module configuration/fault information %MW10.192 to %MW10.207
(Read only)
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.192 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.193 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.194 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.195 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.196 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.197 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.198 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.199 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.200 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.201 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.202 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.203 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.204 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.205 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.206 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.207 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
1-55
Section 1 Specifications System memory
(26) Remote I/O master 5 I/O module configuration/fault information %MW10.208 to %MW10.223
(Read only)
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.208 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.209 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.210 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.211 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.212 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.213 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.214 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.215 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.216 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.217 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.218 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.219 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.220 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.221 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.222 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.223 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
(27) Remote I/O master 6 I/O module configuration/fault information %MW10.224 to %MW10.239
(Read only)
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.224 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.225 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.226 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.227 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.228 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.229 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.230 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.231 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.232 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.233 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.234 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.235 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.236 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.237 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.238 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.239 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
1-56
Section 1 Specifications System memory
(28) Remote I/O master 7 I/O module configuration/fault information %MW10.240 to %MW10.255
(Read only)
<Configuration information>
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.240 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.241 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.242 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.243 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.244 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.245 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.246 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.247 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.248 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.249 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.250 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.251 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.252 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.253 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.254 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.255 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
1-57
Section 1 Specifications System memory
(29) “Fail-soft maintenance operation prohibition” mode / “Hide the error display state” mode %MW10.256
(Read only)
(Only for SPH300 software version V63 or later, SPH2000, and SPH3000)
• “Fail-soft maintenance operation prohibition” mode
In this mode, no module or unit that is directly connected to the SX bus is additionally connected or reconnected even if the
SPH system is set in the fail-soft startup mode.
• “Compulsion setting hold state” mode (Only for SPH300 software version V65 or later)
In this mode, the forcible setting for I/O is held even if the power supply is turned OFF and then ON again.
• System start watch time (Only for SPH300 software version V65 or later)
System startup monitoring time in the fail-soft startup mode is indicated.
1-58
Section 1 Specifications System memory
(30) Station No. in hide the error display state mode %MW10.257 to %MW10.272 (Read only)
(Only for SPH300 software version V63 or later, SPH2000, and SPH3000)
When the “hide the error display state” option is to ON and the target station exists, the bit corresponding to the station No. is set
ON.
Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address
%MW10.258 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.259 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.260 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.261 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.262 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.263 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.264 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
%MW10.265 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128
%MW10.266 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144
%MW10.267 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160
%MW10.268 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176
%MW10.269 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192
%MW10.270 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208
%MW10.271 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224
%MW10.272 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240
%MW10.273
1-59
Section 1 Specifications System memory
%MW10.443 IP address (H) Indicates the IP address set for the Ethernet built in the CPU.
The factory default setting is “192.168.0.1”. You can change it in the system
%MW10.444 IP address (L) definition.
%MW10.445 Loader command port No. Indicates the loader command port No., which is fixed to “507”.
“Free-run counter information” is supported by SPH2000 software version V11 or later and all versions of SPH3000.
(34) SX bus transmission error rate information %MW10.508 to %MW10.511 (Read only)
Executing 100,000 tacts, the number of the tacts where an SX bus error occurred is expressed by the ppm. If, of executed tacts,
even one tact is erroneous, the value becomes “10.” These data are updated every 100,000 tacts.
For example, if the tact time is 1 ms, it will be updated every 1 minute 40 seconds; if it is 5 ms, it will be updated every 8 minutes
and 20 seconds.
Notes:
Each system flag information of the system memory area can be read by an application program. However, be sure not to
use it for “event variables,” which start the event tasks of an application program. (Otherwise, some variables may not start
the associated task).
1-60
Section 1 Specifications Temporary area
INT#100
1-61
Section 1 Specifications Temporary area
G Key point:
Tact Tact
1-62
Section 1 Specifications Temporary area
pou3
execution
Task 0
pou2 pou2
Interrupt
execution execution
Task 1
Nesting FCT3
Nesting FCT2
FCT1
Time
Usage of a 1K 2K 3K 2K 1K
temporary area words words words words words
1-63
Section 1 Specifications Variables
1-5 Variables
1-5-1 What is a variable?
To implement application programs in MICREX-SX Series, it is necessary to assign variables to program code bodies and
assign real CPU memory addresses to the variables associated with the instruction codes manually by the user or automatically
by the loader.
The use of variables enables you to write application programs with a highly reusable software structure.
G Key point:
1-64
Section 1 Specifications Memory assignment
<For D300winV2>
<For D300winV3>
PLC memory
sensor01 %IX1.0.1
Variables for I/O are assigned
sensor01 %IX1.0.2 I/O area
to the I/O area in the CPU
by the user.
AT range
cnd_01
Variables (symbolic variables)
to which no real address is cnd_02 %MX1.512.0 Internal memory area
assigned are automatically
%MX1.512.1
assigned by the loader.
Thus, the loader automatically assigns CPU’s internal memory (memory outside AT range) to variables not assigned to
addresses (no AT specification). This eliminates the need for managing tedious memory assignment.
Global variable
1-65
Section 1 Specifications Variables
Statement Description
VAR Identifies the beginning of the declaration of a local variable.
VAR_INPUT Identifies the beginning of the declaration of an input variable for a function / function block.
Identifies the beginning of the declaration of an output variable for a function block. Used only to declare
VAR_OUTPUT
a symbolic variable.
VAR_IN_OUT Identifies the beginning of the declaration of an input/output variable for a function block.
VAR_EXTERNAL Identifies the beginning of the declaration of a global variable to be used in a POU. (Note)
Identifies the beginning of the declaration of a variable that is to be available to all programs in a project
VAR_GLOBAL
(global variable).
END_VAR Identifies the end of a variable block.
RETAIN Added to the VAR or VAR_GLOBAL statement to declare a retain variable.
AT Used to directly assign an address to a variable.
Notes:
When using a global variable in POUs, it is necessary to declare it in a VAR_EXTERNAL declaration statement on each
variable worksheet for the POUs.
<For D300winV2>
Colon Semicolon
Comment
Variable
name Data type Refer to “1-6” for data types.
<For D300winV3>
Notes:
You can omit “X” (bit address) of the memory size, however, when it is omitted, it may cause confusion.
It is recommended not to omit “X” (bit address)
1-66
Section 1 Specifications Variables
G Key point:
• To assign 32-bit DINT or DWORD type variables, 32-bit array type variables, and structure type variables to real
addresses (AT specification), assign them to even addresses.
(Example for D300winV2)
VAR
DATA1 AT %MD1.0 : DINT ;
DATA2 AT %QD3.0 : DWORD ;
END_VAR
• To divide a 32-bit data type into 16-bit data type for processing, the upper and lower words are assigned as shown
below.
31 16 15 0
32-bit data Upper Lower
15 0
16-bit data Lower
Upper
<For D300winV2>
<For D300winV3>
1-67
Section 1 Specifications Variables
f Retain variables
f Retain variables
f Initialization variables
f Initialization variables
1-68
Section 1 Specifications Variables
G Key point:
• The SPH300 has an area that stores a total of 3200 initial values for standard and retain memory combined.
There is no need to be aware of the initialization area.
Also, in the SPH300, it is also possible to set initial values for variables inside the user FBs up to the capacity of the
user FB instance memory.
• The SPH2000/SPH3000 has an area that stores a total of 12800 initial values (3200 initial values for software version
V01) for standard and retain memory combined. There is no need to be aware of the initialization area.
Also, in the SPH2000/SPH3000, it is also possible to set initial values for variables inside the user FBs up to the
capacity of the user FB instance memory.
1-69
Section 1 Specifications Basic data
32-bit binary
Sign 2 2 2 2 2 2 2 2 2 2 2 2 2 217 216 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
30 29 28 27 26 25 24 23 22 21 20 19 18
Bit weight
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit position
%MD3.0
%MD3.2 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
The numeric value that can be represented in 16-bit and 32-bit area is as follows.
8-digit BCD
1-70
Section 1 Specifications Basic data
Range when treated as binary data Data range when treated as BCD data
Decimal 16-bit area 32-bit area Decimal 16-bit area 32-bit area
conversion representation
+2147483647 Max. 7FFFFFFF
+2147483646 7FFFFFFE Upper limit overflow
+99999999 +99999999
+99999998 +99999998
Range of positive number
+256
+255 +100
+254 + 99
+ 98
-32766 8002
-32767 8001
-32768 8000
-32769 Lower limit overflow
-2147483647 80000001
-2147483648 Min. 80000000
1-71
Section 1 Specifications Organization of data types
ANY
elementary
ANY_NUM
ANY_REAL
REAL
ANY_INT
INT , DINT , UINT , UDINT
ANY_BIT
BOOL , WORD , DWORD
Retain variable
STRING
ANY_DATE
DT , DATE , TOD
TIME
Data type names in italics represent generic data types and boxed data type names represent basic data types.
1-72
Section 1 Specifications Basic data types
Notes:
1) 16# represents a hexadecimal number.
1) BOOL (Boolean)
The minimum unit of data that can be represented by a single memory bit (0 or 1).
1-73
Section 1 Specifications Basic data types
7) TIME (duration)
The TIME data type handles the set value or current value of a timer. Time data in the range from 0 to 4,294,967,295 ms can
be represented. Units are d (day), h (hours), m (minutes), s (seconds) and ms (milliseconds). You can combine them in various
ways.
<Example>
8) DATE (date)
The DATE data type handles date (year, month, day) data. A DATE occupies 32 memory bits and can represent date data from
the calendar years 1970 to 2106.
9) TOD (time of day)
The TOD data type handles time of day (hour, minute, second) data. A TOD occupies 32 memory bits and can represent time
data from 0:00:00 to 23:59:59. The data type of TIME_OF_DAY is the same as that of DT.
10) DT (date and time of day)
The DT data type handles date and time (year, month, day, hour, minute, second) data. A DT occupies 32 memory bits and can
represent date and time data from the calendar years 1970 to 2106. The data type of DATE_AND_TIME is the same as that of
DT.
<Example for DATE, TOD, and DT:>
1-74
Section 1 Specifications Basic data types
1-75
Section 1 Specifications Representation of constants
Some data types can be omitted. However, it is recommended to attach them as long as possible to identify the type.
The following table shows examples of representation of constants. The integer types (INT, DINT, UINT, and UDINT) can be
represented in a hexadecimal form and bit string types (WORD and DWORD) can be represented in a binary or hexadecimal as
shown below.
1-76
Section 1 Specifications Derived data types
5 INT type data f To access this data item, specify file 1[5].
6 INT type data Note: If the specified value is out of the range, the lower or upper limit value is accessed.
(For example, if file 1[11] is specified, file [10] is accessed.)
7 INT type data
1-77
Section 1 Specifications Derived data types
1 2 3
1
2
3
4
5
6 f To access this data item, specify file2 [3] [5].
7
8
9
10
1-78
Section 1 Specifications Derived data types
<Access method>
Variables of a structured data type are accessed in the form of <variable name>.<member name>. Examples of <member
name> in the above example are x_pos, y_pos, depth, and rpm. To access the rotational speed in hole_pro, specify
“hole_pro. rpm.”
1-79
Section 1 Specifications Derived data types
<Array of structures>
Structures may be contained in an array.
<Sample data type definition>
The example shown below defines an array of 10 machines, indexed from 1 to 10, which are defined in the above example.
<Access method>
Structures in an array are accessed in the form of <variable name>[<array index>].<member name>. Examples of <member
name> in the above example are x_pos, y_pos, depth, and rpm. To access the rotational speed of the 5th machine in
num_hole_pro, you specify num_hole_pro [5].rpm.
<Structure of arrays>
Array is defined as an element of a structure.
<Sample data type definition>
The example shown below defines a structure “machine2” of which the “depth” member is an array of depths. of depths.
1-80
Section 1 Specifications Derived data types
<Access method>
An array in a structure is accessed in the form of <variable name>.<member name>[<array index>]. Examples of <member
name> in the above example are x_pos, y_pos, depth, and rpm. To access the 5th depth in the member “depth” of
“hole_pro_02,” you specify hole_pro_02.depth[5].
<Structure initialization>
No variable of a structured data type can be initialized in a variable declaration. Structured data type variables must be explicitly
initialized in the program (code body).
<Sample initialization program in ST language>
1-81
Section 1 Specifications Notes on structures
1-82
Section 1 Specifications Notes on structures
If structure data needs to be exchanged like this example, transfer each member individually because the uniqueness of the
32-bit data cannot be guaranteed when transferred by whole structure.
(4) Uniqueness of data for arrays other than structures (one-dimensional/two-dimensional) and basic data types
The uniqueness of data for arrays other than structures (one-dimensional/two-dimensional) and basic data types is
guaranteed per element.
1-83
Section 1 Specifications Notes on floating-point calculation
Significant Loss of
digits trailing digits Since the smaller number becomes 0 in the calculation,
the calculation result is the same as larger number.
1-84
Section 1 Specifications Notes on floating-point calculation
(4) Occurrence of “Loss of trailing digits”, and effect on floating-point calculation instructions
1) Occurrence of “Loss of trailing digits”, and effect on floating-point calculation instructions
The table below shows floating-point calculations instructions, occurrences and effect of “Loss of trailing digits”.
“Loss of trailing digits” occurs at floating-point addition and subtraction, therefore, we have focused on instruction which executes
floating-point addition and subtraction.
As for FILTER/INT/DIF_REAL instructions, their internal process considers “Loss of trailing digits”, so defined as group B.
Therefore, group C instructions requires measures against “Loss of trailing digits”.
Occurrence and
Class Name Function name
effect
Arithmetic function ABS_REAL Absolute value A
SQRT Square root A
LN Natural logarithm A
LOG Common logarithm A
EXP Exponent A
SIN Sine A
COS Cosine A
TAN Tangent A
ASIN Arc sine A
ACOS Arc cosine A
ATAN Arc tangent A
ADD Addition C
SUB Subtraction C
MUL Multiplication A
DIV Division A
EXPT Exponent A
NEG Negation A
Time type data function MUL_T_R Multiply time A
DIV_T_R Divide time A
Original function DBAND_REAL Dead band C
BIAS_REAL Bias C
Original function block FILTER_REAL Filter B
INT_REAL Integrate B
DIF_REAL Differentiate B
1-85
Section 1 Specifications Notes on floating-point calculation
1-86
Section 1 Specifications Tasks
1-7 Tasks
Tasks determine the sequence (time schedule) of program execution.
The MICREX-SX series CPU modules use three types of tasks: default task for cyclic processing, fixed cycle tasks, and event
tasks.
Assign POUs that will always be executed to a task to determine their execution sequence.
3) Event task
• The event task is executed once each time a specified BOOL variable turns to “1.” Assign POUs such as the ones to handle
interrupts from a communications module or high-speed counter module.
• You can assign two or more POUs to the event task.
1-87
Section 1 Specifications Tasks
<Operating conditions>
Task priority: Task 0 > Task 1 > Default task (cyclic)
Tact cycle: 1 ms
Task type: Task 0: Periodic task (1 tact cycle)
Task 1: Periodic task (3 tact cycles)
Default task: Asynchronous with the tact cycle
Notes:
The task execution cycle must be an integral multiple value of the SX bus tact.
<Task operation>
TC0
TE0
TC1
TE1
Tact
Task 0
Default
Interrupt Interrupt
TED
TCD
Tact processing
time
Tact cycle
The default task operates while no fixed cycle task or event task is operating. (They start in synchronization with the tact cycle.)
Be sure to adjust the execution times and the start cycle of the upper level tasks to reserve the execution time of the default task.
(Otherwise, “application WDT error” may occur or “upper level task delay error” may occur.)
1-88
Section 1 Specifications Tasks
<Operating conditions>
Task priority: Task 0 > Task 1 > Default task (cyclic)
Tact cycle: 1 ms
Task type: Task 0: Event task
Task 1: Periodic task (1 tact cycle)
Default task: Asynchronous with the tact cycle
<Task operation>
Task 0
Task 1
Tact processing
time
Task 0: Event task
Tact period
Task 1: Fixed cycle task
: Task start request
Task level
: Data input processing Task 0 > Task 1 > Default
An event task does not start immediately when an event occurs but at the beginning of the next tact cycle after the event is
recognized.
The task execution cycle appears on the resource information screen after the task is executed twice. When the
CPU stops/starts or the CPU is switched between the working and standby sides in the redundant mode while the
resource information screen opens, measurement stops temporarily and then restarts.
Before the execution cycle can appear on the screen, the task must be executed twice after the CPU stops/starts or
is switched between the working and standby sides.
1-89
Section 1 Specifications Tasks
Arithmetic
Arithmetic operation
Task start operation start end Task end
When a tact interrupt occurs during the arithmetic operation, the operation is interrupted as illustrated in the figure below.
When a tact interrupt occurs, the system checks the startup conditions for a new task. If a task startup request is present, the
system performs the data input operation for that task and starts the task having the highest priority. Consequently, another task
is likely to be executed while the current task is suspended as shown in the figure below.
When the arithmetic operation ends, the system checks the time until the next tact interrupt occurs and, if it is longer than
the time required to perform the data output operation, performs the data output processing and terminates the task. If the
time to the next tact interrupt is shorter than the time required to perform the data output operation, the system keeps the
task suspended and executes no output operation for the task. The data output operation is carried out only after the system
executes the next tact processing. Since the time up to the next tact interrupt is computed at the end of the arithmetic operation,
no tact interrupt can occur during the execution of the data output operation.
Arithmetic operation
Data input operation suspended. Data output operation
1-90
Section 1 Specifications POU
User function
No program organization unit can be defined recursively. No function block can be called from a function. However, functions
can be called from a function block.
User function
User function
System function block
User function
SPH2000/3000
1-91
Section 1 Specifications POU
SPH200
Notes:
1) One VAR_IN_OUT declaration uses two words.
2) For the software version V62 and earlier, user function blocks have a variable capacity of up to 256 words.
3) For the software version V01 of the NP1PM-48R, user function blocks have a variable capacity of up to 4096 words.
<F.Y.I.> Comparison of data areas used when 100 words of data are processed as a function block
1) If processing is performed using VAR_INPUT and VAR_OUTPUT variables, a data area totaling 400 words is required: 100
words for input-side external variables, 100 words for VAR_INPUT variables, 100 words for VAR_OUTPUT variables, and
100 words for output-side external variables.
2) If VAR_IN_OUT variables are used, only 2 words of data are used for passing data into the FB, because data processing
within the FB is also performed using external variables as-is. Consequently, the total data area required is 102 words.
Thus, when dealing with large amounts of data, such as array-type or structure variables, we recommend using
VAR_IN_OUT variables.
If VAR_IN_OUT variables are used as array, the array variables are directly read or written instead of FB instance memory.
If an upper level interrupt occurs during FB execution and the same array is accessed (written) by the upper level interrupt,
the change is also reflected to the FB that is continuously executed after the interrupt is finished.
On the other hand, in the case of VAR_INPUT variables, all the array contents are copied in the FB instance memory when
an FB is called and the FB instance memory is accessed. Therefore, the above phenomenon does not occur.
FB
VAR_IN_OUT
variables 2 words 100 words Data used
2) 100 words 100 words 102 words
1-92
Section 1 Specifications POU
1) Function
A function is a program organization unit that, when executed, generates a single data as a return value.
A function has no internal state, that is, executions of a function with the same input parameters always generate the same
output. Predefined functions can be used in other programs, functions, and function blocks.
The value of variables that are used only within a function are unpredictable when the function is called.
PG FCT
VAR VAR_INPUT
A:INT; IN1:INT;
B:INT; IN2:INT;
C:INT; END_VAR
D:INT; VAR
END_VAR TEMP:INT; The value is unpredictable
END_VAR when the function is called.
D:=AAA(B,C);
1-93
Section 1 Specifications POU
2) Function block
A function block is a program organization unit that, when executed, generates one or more data items. A function block can
have two or more copies of data which are called instances. Each instance is given an identifier called the instance name. An
instance has output, internal, and input variables.
Some of the output and internal variables must retain their contents until the function block is called next time. Consequently, a
function block does not always generate the same output even when it is called multiple times with the same input parameters.
The program that calls a function block can access only the input and output variables of the function block; it can access none
of the internal variables of the function block.
Predefined function blocks can be used within a program or function block.
The instances of a function block can be referenced only within the program organization unit in which they are declared unless
the instances are declared globally.
FB name: AAA
Notes:
1) OUT retains the old value when it is called the next time.
2) Instances of the same FB do not affect each other if they are of different types.
3) Program
A program is the basic program organization unit for a user application. Only programs can be assigned to tasks (neither
functions nor function blocks can be assigned to a task). A program has neither input variables nor output variables.
1-94
Section 1 Specifications User FB
1-8-2 User FB
(1) Variables used in user FBs
1) Input variable (VAR_INPUT)
Input variables are used to input data into the FB. By declaring an input variable in the variable worksheet, the FB has the
terminal of the data type that corresponds to the data of the variable on the left side.
Since the instance area is used, the input variable value is held in the FB.
2) Output variable (VAR_OUTPUT)
Output variables are used to output data from the FB. By declaring an output variable in the variable worksheet, the FB has
the terminal of the data type that corresponds to the data of the variable on the right side.
Since the instance area is used, the output variable value is held in the FB.
3) Input/output variable (VAR_IN_OUT)
Input/Output variables have both input and output variables of the FB.
Data is held outside the FB and the instance area is not used. Therefore, the input/output variable value is not held in the FB.
Since the data values are not held in the FB, variables that are connected to the input/output variable can be rewritten from a
program other than the FB.
The consumption of the instance memory can be reduced.
Input variable VAR_INPUT data type User FB Output variable VAR_OUTPUT data type
Input/output variable VAR_IN_OUT data type Input/output variable VAR_IN_OUT data type
1-95
Section 1 Specifications User FB
(2) Instance
“Instance” is a memory area that is reserved for using FBs.
The input variable value and output variable value are temporarily transferred to this area before a program in the FB is
executed.
Because of this system, even if an FB is used, the program area for the codes of the FB is not consumed every time the FB is
called. Only the area for the call processing is consumed.
The instance memory area is consumed.
IEC representation Address representation for a multi-CPU system (Note 2), (Note 3)
(Input) (Output)
%I %Q
Input/output memory
(I/Q) (Note 4)
512 words (8192 points)
%MW1.0
Standard memory
(M) Program memory
64K words
%MW1.65535 48K steps This area is not
%MW1.98304 %MW.1.98304 consumed by the
For multi-CPU standard memory number of steps
(M) for the FB codes
0 word
every time an FB
%MW3.0 is called.
Retain memory
(M)
8K words
%MW3.8191
%MW3.32768 %MW.3.32768 (Note 1)
For multi-CPU retain memory
(M)
0 word Temporary area
32K words
%MW10.0 %MW.10.0
System memory
(M)
512 words
%MW10.511 %MW.10.511
1-96
Section 1 Specifications User FB
1-97
Section 1 Specifications User FB
2) Enter the name, select the type and language, and then click the [OK] button. The POU is added as shown below.
4) Select “VAR” for the usage of the variable that is used in the FB.
6) After creating the circuit, compile the project with the [Make] or [Rebuild Project] command.
1-98
Section 1 Specifications User FB
1-99
Section 1 Specifications SPH300
Item Specification
Type NP1PS-32/32R NP1PS-74/74R NP1PS-117/117R
Control system Stored program, Cyclic scanning system (default task), fixed cycle task, event task
Input/output connection method Direct input/output (local bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Tact synchronous refresh
I/O control system * For information on the remote I/O control system, refer to the user’s manual
of each remote I/O.
CPU 32-bit OS processor, 32-bit execution processor
Memory types Program memory, data memory, temporary memory
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart) Adhere to IEC61131-3
Length of instructions Variable length (depending on language)
Notes:
1) The area sizes of standard memory, retain memory, the instance memory for user FBs, and the instance memory for
system FBs can freely be increased or decreased. Default values are shown in the above table.
2) The I/O expansion function is supported by the following CPU versions. NP1PS-74: V2364 or later; NP1PS-74R/117/117R:
V2664 or later.
NP1PS-32/32R do not support the I/O extension function.
For NP1PS-74/74R, the maximum I/O memory in the I/O extension mode is 1856 words (29696 points).
3) Hardware version NP1PS-32: V24 or later, NP1PS32R: V26 or later
Software version: V63 or later
1-100
Section 1 Specifications SPH300
BOOL, INT, DINT, UINT, UDINT, REAL,TIME, DATE, TOD, DT, STRING, WORD,
Available basic data type (Note 1)
DWORD
One level
Data type nesting
(array of arrays, structure of arrays, array of structures, structure of structures)
No. of structure data type members 200
Max. No. of elements of array data type 16-bit data type: 4096, 32-bit data type: 2048
Default tasks (Cyclic scanning): 1
No. of tasks Fixed cycle tasks: 4
Event tasks: 4 (Total of 4 tasks when fixed cycle task is used.)
Program instance (No. of POUs / resource) 256 (Max. no. of instances allowed in one task = 128)
No. of POUs in a project 1000
No. of user function blocks 512
Nesting of user function blocks (Note 2) 127 levels
No. of user functions 512
Nesting depth of user functions (Note 2) 127 levels
Global variable 15000
Variable
Local variable 15000/POU
A total of 3200 for standard memory and retain memory.
No. of initial values set for variables
Initial values can be set for variables inside user FBs up to the capacity of the
(Note 3)
user FB instance memory.
VAR_INPUT : Up to 128
No. of user FB terminals 128 in total
VAR_OUTPUT : Up to 128
No. of registered libraries 16/project
Library
Nesting depth 8 levels
Self-diagnosis (memory check, ROM sum check),
Diagnostic function
System configuration supervising, Module fault monitoring
Security function Password
Up to 31 Dec. 2069 23:59:59 ±27sec/month (when active)
Calendar
When multi-CPU system is used, time is synchronized.
Backup recovery range: Data memory, calendar IC memory, RAS area
Battery: Primary lithium battery
Switching time: within 5 min. (at 25°C)
Battery backup (Note 4)
Durability (at 25°C):
NP1PS-32/32R: 5 years, NP1PS-74/74R: 1.3 years,
NP1PS-117/117R: 1.3 years
Memory backup by flash ROM Application programs, system definitions, ZIP files are saved in the flash ROM
(built in CPU module) built in the CPU.
Memory backup by user ROM card
Application programs, system definitions, zip files and compressed projects can
(removable)
be saved in a user ROM card (compact flash card).
(only for NP1PS-32R/74R/117R)
Notes:
1) The available basic data type depends on the instruction.
2) Total of nesting levels for user function blocks and user functions.
3) Direct character strings (character string constants) used in programs are treated as initial values.
The number of initial values used for character string variables and the number of character string constants depends on
the number of characters used in them.
One two-character initial value (1-bit characters) is used for a character string variable or a character string constant.
4) Higher ambient temperatures will shorten the backup time. Set the battery replacement period using the fact that a 10°C
increase in ambient temperature will roughly halve the backup time as a rough guide. Note that the battery is not
consumed when the control power is engaged.
1-101
Section 1 Specifications SPH300
(2) NP1PS-245R
Item Specification
Type NP1PS-245R
Stored program, Cyclic scanning system (default task), fixed cycle task, event
Control system
task
Input/output connection method Direct input/output (local bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Tact synchronous refresh
I/O control system * For information on the remote I/O control system, refer to the user’s manual
of each remote I/O.
CPU 32-bit OS processor, 32-bit execution processor
Memory types Program memory, data memory, temporary memory
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart) Adhere to IEC61131-3
Length of instructions Variable length (depending on language)
Notes:
1) The area sizes of standard memory, retain memory, the instance memory for user FBs, and the instance memory for
system FBs can freely be increased or decreased. Default values are shown in the above table.
2) When storing a program of this CPU in a “memory-card if module (format: NP1F-MM1),” the maximum program memory is
119808 steps, and the maximum program capacity per POU is 4096 steps.
3) When changing the memory size, set the size so that the total of standard memory and retain memory is less than or
equal to 392192 words.
4) The available basic data type depends on the instruction.
1-102
Section 1 Specifications SPH300
Notes:
1) Total of nesting levels for user function blocks and user functions.
2) Direct character strings (character string constants) used in programs are treated as initial values.
The number of initial values used for character string variables and the number of character string constants depends on
the number of characters used in them.
One two-character initial value (1-bit characters) is used for a character string variable or a character string constant.
3) Higher ambient temperatures will shorten the backup time. Set the battery replacement period using the fact that a 10°C
increase in ambient temperature will roughly halve the backup time as a rough guide. Note that the battery is not
consumed when the control power is engaged.
1-103
Section 1 Specifications SPH300EX
1-9-2 SPH300EX
Item Specification
Type NP1PS-74D
Stored program, Cyclic scanning system (default task), fixed cycle task, event
Control system
task
Input/output connection method Direct input/output (local bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Tact synchronous refresh
I/O control system * For information on the remote I/O control system, refer to the user’s manual
of each remote I/O.
CPU 32-bit OS processor, 32-bit execution processor
Memory types Program memory, data memory, temporary memory
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart) Adhere to IEC61131-3
Length of instructions Variable length (depending on language)
Notes:
1) The area sizes of standard memory, retain memory, the instance memory for user FBs, and the instance memory for
system FBs can freely be increased or decreased. Default values are shown in the above table.
2) The I/O expansion function can be used only on the basic SX bus.
3) For the specifications and operations of SPH300EX, refer to the user’s manual “SPH300EX (FEH192).”
1-104
Section 1 Specifications SPH300EX
BOOL, INT, DINT, UINT, UDINT, REAL,TIME, DATE, TOD, DT, STRING,
Available basic data type (Note 1)
WORD, DWORD
One level
Data type nesting
(array of arrays, structure of arrays, array of structures, structure of structures)
No. of structure data type members 200
Max. No. of elements of array data type 16-bit data type: 4096, 32-bit data type: 2048
Default tasks (Cyclic scanning): 1
No. of tasks Fixed cycle tasks: 4
Event tasks: 4 (Total of 4 tasks when fixed cycle task is used.)
Program instance (No. of POUs / resource) 256 (Max. no. of instances allowed in one task=128)
No. of POUs in a project 1000
No. of user function blocks 512
Nesting of user function blocks (Note 2) 127 levels
No. of user functions 512
Nesting depth of user functions (Note 2) 127 levels
Global variable 15000
Variable
Local variable 15000/POU
A total of 3200 for standard memory and retain memory.
No. of initial values set for variables (Note 3) Initial values can be set for variables inside user FBs up to the capacity of the
user FB instance memory.
VAR_INPUT : Up to 128
No. of user FB terminals 128 in total
VAR_OUTPUT : Up to 128
No. of registered libraries 16/project
Library
Nesting depth 8 levels
Multi-CPU function (Note 4) Max 8 units per configuration. * Can be mixed with SPH2000 series
Self-diagnosis (memory check, ROM sum check),
Diagnostic function
System configuration supervising, Module fault monitoring
Security function Password
Up to 31 Dec. 2069 23:59:59 ±27sec/month (when active)
Calendar
When multi-CPU system is used, time is synchronized.
Backup recovery range: Data memory, calendar IC memory, RAS area
Battery: Primary lithium battery
Switching time: within 5 min. (at 25°C)
Battery backup (Note 5)
Durability (at 25°C):
When NP8P-BT is used: approx. 0.65 years;
When NP8P-BTS is used: approx. 1.75 years
Memory backup by flash ROM Application programs, system definitions, ZIP files are saved in the flash ROM
(built in CPU module) built in the CPU.
Memory backup by user ROM card Application programs, system definitions, zip files and compressed projects
(removable) can be saved in a user ROM card (compact flash card).
Notes:
1) The available basic data type depends on the instruction.
2) Total of nesting levels for user function blocks and user functions.
3) Direct character strings (character string constants) used in programs are treated as initial values.
The number of initial values used for character string variables and the number of character string constants depends on
the number of characters used in them.
One two-character initial value (1-bit characters) is used for a character string variable or a character string constant.
4) The multi-CPU function can be used only on the basic SX bus.
5) Higher ambient temperatures will shorten the backup time. Set the battery replacement period using the fact that a 10°C
increase in ambient temperature will roughly halve the backup time as a rough guide. Note that the battery is not
consumed when the control power is engaged.
1-105
Section 1 Specifications SPH2000
1-9-3 SPH2000
Item Specification
Type NP1PM-48R/48E NP1PM256E/256H
Stored program, Cyclic scanning system (default task), fixed cycle task, event
Control system
task
Input/output connection method Direct input/output (local bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Tact synchronous refresh
I/O control system * For information on the remote I/O control system, refer to the user’s manual
of each remote I/O.
CPU 32-bit RISC processor
Memory types Program memory, data memory, temporary memory
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart) Adhere to IEC61131-3
Length of instructions Variable length (depending on language)
Notes:
1) For NP1PM-256E/NP1PM-256H, the maximum I/O memory in the I/O extension mode is 4096 words.
NP1PM-48R/NP1PM-48E do not support the I/O extension function.
2) The available basic data type depends on the instruction.
1-106
Section 1 Specifications SPH2000
Application programs, system definitions, and zip files can be saved in a flash
User ROM (optional)
ROM.
Notes:
1) Total of nesting levels for user function blocks and user functions.
2) Direct character strings (character string constants) used in programs are treated as initial values.
The number of initial values used for character string variables and the number of character string constants depends on
the number of characters used in them.
One two-character initial value (1-bit characters) is used for a character string variable or a character string constant.
3) Higher ambient temperatures will shorten the backup time. Set the battery replacement period using the fact that a 10°C
increase in ambient temperature will roughly halve the backup time as a rough guide. Note that the battery is not
consumed when the control power is engaged.
1-107
Section 1 Specifications SPH3000
1-9-4 SPH3000
Item Specification
Type NP1PU-048E NP1PU-128E NP1PU-256E
Stored program, Cyclic scanning system (default task), fixed cycle task, event
Control system
task
Input/output connection method Direct input/output (local bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Tact synchronous refresh
I/O control system * For information on the remote I/O control system, refer to the user’s manual
of each remote I/O.
CPU 32-bit RISC processor
Memory types Program memory, data memory, temporary memory
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart) Adhere to IEC61131-3
Length of instructions Variable length (depending on language)
Notes:
1) The available basic data type depends on the instruction.
1-108
Section 1 Specifications SPH3000
Notes:
1) Total of nesting levels for user function blocks and user functions.
2) Direct character strings (character string constants) used in programs are treated as initial values.
The number of initial values used for character string variables and the number of character string constants depends on
the number of characters used in them.
One two-character initial value (1-bit characters) is used for a character string variable or a character string constant.
3) Higher ambient temperatures will shorten the backup time. Set the battery replacement period using the fact that a 10°C
increase in ambient temperature will roughly halve the backup time as a rough guide. Note that the battery is not
consumed when the control power is engaged.
1-109
Section 1 Specifications SPH200
1-9-5 SPH200
Item Specification
Type NP1PH-16 NP1PH-08
Stored program, Cyclic scanning system (default task), fixed cycle task, event
Control system
task
Input/output connection method Direct input/output (local bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Tact synchronous refresh
I/O control system * For information on the remote I/O control system, refer to the user’s manual
of each remote I/O.
CPU 16-bit OS processor, 16-bit execution processor
Memory types Program memory, data memory, temporary memory
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart) Adhere to IEC61131-3
Length of instructions Variable length (depending on language)
Notes:
1) The available basic data type depends on the instruction.
2) For standard CPUs earlier than version **30 or D300win loaders earlier than version 2.0, 2048 steps/POU.
1-110
Section 1 Specifications SPH200
Notes:
1) Higher ambient temperatures will shorten the backup time. Set the battery replacement period using the fact that a 10°C
increase in ambient temperature will roughly halve the backup time as a rough guide. Note that the battery is not
consumed when the control power is engaged.
1-111
Section 1 Specifications Operating flowchart
Power-on
User program execution processing (run concurrently with system control processing)
(Note 3)
Mode selection
Fatal fault Running Executed only Step execution Stopped
during the first
Initialize user data scan after the
CPU enters the
running state.
Start user WDT I/O data input processing
Scan cycle
(Note 2)
Notes:
1) Do not change the CPU No. selection key switch during the operation.
2) The execution time of the default task specified by the programming loader refers to the time in this section.
3) Sometimes it takes time to finish message related instruction when mode transition occurs.
1-112
Section 1 Specifications Processing time
Program Program
Output Input Output Input Output
operation operation
SX bus
Tact cycle
1, 2, ... 10ms
1-113
Section 1 Specifications Processing time
SX bus tact I O I O I O
Execution time of
default task
1-114
Section 1 Specifications Processing time
(2) Task execution cycle when the POU execution time of the default task is longer than the task cycle
In this case, Task execution cycle (program execution cycle) = Two tact cycle.
SX bus tact I O I O I O
1-115
Section 1 Specifications Constant scan
I O I O I O I O
POU1 POU3
Interrupt Interrupt
Idle time
POU3
POU2
1-116
Section 1 Specifications Constant scan
(5) Notes on using constant scan with interrupt task (fixed cycle task, event task)
When using both the constant scan and an interrupt task, note the following points.
Constant scan have function to execute default task in constant & stable cycle.
If constant scan is used with interrupt task, then interrupt task is executed during default task execution.
During interrupt task execution, default task is paused. After end of interrupt task, default task is resumed.
In other words, above pause time (= interrupt task execution time) is added to default task execution time.
Therefore, when setting of constant scan time, consider default task time, interrupt task execution time, number of execution
times and margin.
Notes:
1) I/O refresh cycle of the remote I/O
Even during constant scan operation, I/O refresh of the remote I/O is executed without synchronizing with the program
scan.
Therefore, I/O refresh of the remote I/O is not executed at constant cycle.
2) If the actual instruction execution time exceeds the constant scan set time, only in the scan in which the set time is
exceeded, the constant scan set time is ignored.
1-117
Section 1 Specifications Execution band ratio setting
If a lot of message-communication FBs (e.g. M_SEND, M_RECEIVE, R_READ, and R_WRITE) are used, message-
communication may become very slow.
In this case, it is possible to improve message-communication speed by changing execution band ratio setting.
Available ratio setting range is :
“Application : System” = “1 : 9”, “2 : 8”, “3 : 7”, “4 : 6”, “5 : 5”, or “6 : 4”.
The default setting is “6 : 4”.
* In the case of SPH3000MG(NP1PU1-256NE), SPH3000MM(NP1PU2-48E, and NP1PU2-256E), the application setting range
is from 2 to 7.
In addition, when the E-SX bus tact is set to 2 ms or more, the application setting range is 2 to 8.
Tact time
System
Output
System
process-
processing
ing
2)
2)
2) System processing
“Output processing”, “CPU system observation”, “Message processing”, “Application operation observation”, etc. are executed.
1-118
Section 1 Specifications I/O response time
Reads input.
Input
Output
Minimum I/O response time = Input filter delay + Task cycle time + Output response delay
Input
Output
Maximum I/O response time = Input filter delay + (Task cycle time) x 2 + Output response delay
1-119
Section 1 Specifications Calendar
1-12-3 Monitoring and setting up the calendar clock from the D300win
1) Click the [Project Control Dialog] button in the menu bar. The project control dialog opens.
Click here.
Click here.
Set values
3) Click the [Change ...] button. The “PLC time setting” dialog box After setting values,
opens. On this dialog box, you can set any desired value. click this button.
1-120
Section 1 Specifications Calendar
1-12-4 Monitoring and setting up the calendar clock from an application program
1) HW_RTC (Hardware RTC) — Original FB
Use the hardware RTC function block (HW_RTC) to monitor and set up the calendar clock from an application program. For
detailed instructions, see the description of HW_RTC.
Notes:
DT type (date and time type) data should be specified for HW_RTC. The range of DT data is January 1, 1970 00:00:00 to
February 7, 2160 6:18:15. The data allowed for HW_RTC ranges from January 1, 1970 00:00:00 to December 31
23:59:59. (If any date and time is specified, an expected value will be set.)
When setting up the calendar clock using data supplied from an external device, it is necessary to convert the input data to the
DT type. The DT type data is equivalent to a 32-bit unsigned integer in seconds that starts at January 1st, 00:00:00, 1970.
(Examples:)
(1) January 1st, 12:34:54, 1970 to DINT#45296 WORD#16#0000B0F0
(2) January 1st, 00:00:00, 1998 to DINT#883612800 WORD#16#34AADC80
Power
supply
CPU CPU
0 1
1-121
Section 1 Specifications Calendar
[IN_OUT]
<Terminal name> <Data type> <Description>
DT_ARY dt_ary The following data are output in each element of the array respectively.
[Data type] Declare the data type on the data type work sheet.
Dt_ary : ARRAY[1..7] OF UINT;(*Output*)
mon_ary : ARRAY[0..12] OF UINT;(*Work area*)
yer_ary : ARRAY[0..3] OF UINT;(*Work area*)
Notes:
When using this FB together with Y_ZFC003, either of the data type declarations is used. The same contents are declared.
1-122
Section 1 Specifications Calendar
2) Example
1-123
Section 1 Specifications Calendar
Notes:
Input data must be within the data range. If it exceeds the data range, abnormal data is output
from FB.
Please consider Month & Day combination (for example, “Month = 4” & “Day = 31” is not allowed.)
Also, “Month = 2” & “Day = 29” is not allowed except leap year.
[OUTPUT]
<Terminal name> <Data type> <Description>
out DATE_AND_TIME Data in “DATE_AND_TIME” data type is output.
[Data type] Declare the data type on the data type work sheet.
dt_ary : ARRAY[1..7] OF UINT;(*Input data*)
mon_ary : ARRAY[0..12] OF UINT;(*Work area*)
yer_ary : ARRAY[0..3] OF UINT;(*Work area*)
Notes:
When using this FB together with Y_ZFC002, either of the data type declarations is used. The same contents are declared.
1-124
Section 1 Specifications Calendar
2) Example
1-125
Section 2 Programming Language
2-3 LD Language...........................................................................................2-37
2-3-1 Structure of LD language..............................................................................2-37
2-3-2 LD language..................................................................................................2-37
2-3-3 LD language instructions...............................................................................2-38
(1) Normal open contact (NO contact), normal close contact (NC contact),
and coil.........................................................................................................2-38
(2) Inverted coil..................................................................................................2-38
(3) Set coil, reset coil..........................................................................................2-39
(4) Connector.....................................................................................................2-39
(5) Jump.............................................................................................................2-40
(6) Return...........................................................................................................2-40
2-4 FBD Language........................................................................................2-41
2-4-1 Structure of FBD language............................................................................2-41
2-4-2 Function block summary...............................................................................2-42
(1) Symbols used in the function block summary...............................................2-42
(2) Describing a function block in the IL language.............................................2-43
(3) Describing a function block in the ST language............................................2-43
(4) Function block summary...............................................................................2-44
2-4-3 Standard FBs (Function Blocks)....................................................................2-52
(1) Set reset flip-flop SR...................................................................................2-52
(2) Reset set flip-flop RS..................................................................................2-52
(3) Rising edge trigger R_TRIG.......................................................................2-53
(4) Falling edge trigger F_TRIG.......................................................................2-53
(5) Up counter CTU..........................................................................................2-54
(6) Down counter CTD.....................................................................................2-54
(7) Up down counter CTUD..............................................................................2-55
(8) Pulse TP.....................................................................................................2-56
(9) On-delay timer TON....................................................................................2-56
(10) Off-delay timer TOF..................................................................................2-57
(11) Real-time clock RTC.................................................................................2-57
2-4-4 Original FBs (Function Blocks)......................................................................2-58
(1) Ring counter RCT.......................................................................................2-58
(2) Integrating timer TMR.................................................................................2-59
(3) Retriggerable timer MR...............................................................................2-60
(4) Open channel M_OPEN.............................................................................2-61
(5) Send message M_SEND............................................................................2-64
(6) Receive message M_RECEIVE.................................................................2-65
(7) Direct read READ_WORD/READ_BOOL..................................................2-66
(8) Direct write WRITE_WORD/WRITE_BOOL...............................................2-67
(9) Remote data read R_READ.......................................................................2-68
(10) Remote data write R_WRITE...................................................................2-69
(11) File data read F_READ............................................................................2-72
(12) File data write F_WRITE..........................................................................2-74
(13) Extension test & set EXT_T_S.................................................................2-76
(14) Sequential file store FFST........................................................................2-77
(15) Sequential file load first FIFO...................................................................2-78
(16) Sequential file load last FILO....................................................................2-79
(17) Filter FILTER_DINT..................................................................................2-80
(18) Filter FILTER_REAL.................................................................................2-81
(19) Integrate INT_DINT..................................................................................2-82
(20) Integrate INT_REAL ...............................................................................2-83
(21) Differentiate DIF_DINT.............................................................................2-84
(22) Differentiate DIF_REAL............................................................................2-85
(23) Pulse count PULSE_CNT.........................................................................2-86
(24) Pulse output PULSE_OUT.......................................................................2-86
(25) Pulse PWM...............................................................................................2-87
(26) Hardware RTC (Real-time Clock) HW_RTC............................................2-87
(27) Test & set T_S..........................................................................................2-88
(28) Change bank BANK_CHG .....................................................................2-89
2-4-5 User ROM card expansion FBs.....................................................................2-90
2-4-5-1 User ROM card expansion FBs............................................................2-90
2-4-5-2 FB specifications...................................................................................2-91
(1) CSV file write _F_WRITE_CSV_DINT/_F_WRITE_CSV_DINT_LF...........2-91
(2) CSV file read _F_READ_CSV_DINT/_F_READ_CSV_DINT_LF...............2-94
(3) CSV file data append
_F_APPEND_CSV_DINT/_F_APPEND_CSV_DINT_LF.............................2-97
(4) CSV file data append _F_APPEND/_F_APPEND_LF..............................2-100
(5) File delete _F_DELETE/_F_DELETE_LF.................................................2-102
(6) File read with offset _F_OFFSET_READ/_F_OFFSET_READ_LF..........2-104
(7) Free capacity read _F_GET_DRV_SIZE..................................................2-107
(8) File name create _F_CREATE_FILE_NAME............................................2-108
(9) Error status................................................................................................. 2-110
2-4-6 Function summary....................................................................................... 2-111
(1) Symbols used in the function summary...................................................... 2-111
(2) Describing a function in the IL language..................................................... 2-112
(3) Describing a function in the ST language................................................... 2-112
(4) Specification of enable flags (EN/ENO)...................................................... 2-113
(5) Function summary...................................................................................... 2-116
2-4-7 Original FCTs (Functions)............................................................................2-136
(1) Set bit SBIT_WORD.................................................................................2-136
(2) Set bit SBIT_DWORD...............................................................................2-136
(3) Reset bit RBIT_WORD.............................................................................2-137
(4) Reset bit RBIT_DWORD..........................................................................2-137
(5) Test bit TBIT_WORD................................................................................2-138
(6) Test bit TBIT_DWORD..............................................................................2-138
(7) Decode DECODE_WORD........................................................................2-139
(8) Decode DECODE_DWORD.....................................................................2-139
(9) Encode ENCODE_WORD........................................................................2-139
(10) Encode ENCODE_DWORD...................................................................2-140
(11) Bit count BITCOUNT_WORD ...............................................................2-140
(12) Bit count BITCOUNT_DWORD..............................................................2-140
(13) Convert string to number STR_TO_UINT..............................................2-141
(14) Convert number to string UINT_TO_STR..............................................2-141
(15) Convert shift-JIS to string SJ_TO_STR..................................................2-142
(16) Convert string to shift-JIS STR_TO_SJ..................................................2-142
(17) Byte length BYTE_LEN..........................................................................2-143
(18) Dead band DBAND_INT.........................................................................2-143
(19) Dead band DBAND_DINT......................................................................2-144
(20) Dead band DBAND_REAL.....................................................................2-144
(21) Bias BIAS_INT........................................................................................2-145
(22) Bias BIAS_DINT.....................................................................................2-145
(23) Bias BIAS_REAL....................................................................................2-146
(24) Step sequence SC_COIL/SC.................................................................2-147
(25) 32-bit addition with carry ADC/ADCO.....................................................2-148
(26) 32-bit subtraction with borrow SBB/SBBO.............................................2-149
(27) 64-bit multiplication MULL/MULU...........................................................2-150
(28) 64-bit division DIVL/DIVU.......................................................................2-151
(29) Shift left 32 bits with carry SLC/SLCO....................................................2-152
(30) Shift right 32 bits with carry SRC/SRCO................................................2-153
2-4-8 Arithmetic functions.....................................................................................2-154
(1) Absolute value ABS_INT..........................................................................2-154
(2) Absolute value ABS_DINT........................................................................2-154
(3) Absolute value ABS_REAL.......................................................................2-155
(4) Square root (√) SQRT................................................................................2-155
(5) Natural logarithm LN.................................................................................2-156
(6) Common logarithm LOG...........................................................................2-156
(7) Exponent EXP ........................................................................................2-157
(8) Sine SIN....................................................................................................2-157
(9) Cosine COS..............................................................................................2-158
(10) Tangent TAN...........................................................................................2-158
(11) Arc sine ASIN.........................................................................................2-159
(12) Arc cosine ACOS....................................................................................2-159
(13) Arc tangent ATAN .................................................................................2-160
(14) Addition ADD...........................................................................................2-160
(15) Subtraction ............................................................................................2-161
(16) Multiplication MUL..................................................................................2-161
(17) Division DIV............................................................................................2-162
(18) Division remainder MOD........................................................................2-162
(19) Exponent EXPT......................................................................................2-163
(20) Move MOVE...........................................................................................2-163
(21) Negation NEG........................................................................................2-164
2-4-9 Bit string functions.......................................................................................2-165
(1) Shift left SHL_WORD................................................................................2-165
(2) Shift left SHL_DWORD.............................................................................2-165
(3) Shift right SHR_WORD.............................................................................2-166
(4) Shift right SHR_DWORD..........................................................................2-166
(5) Rotate left ROL_WORD............................................................................2-167
(6) Rotate left ROL_DWORD.........................................................................2-167
(7) Rotate right ROR_WORD .......................................................................2-168
(8) Rotate right ROR_DWORD......................................................................2-168
(9) Logical product AND.................................................................................2-169
(10) Logical add OR.......................................................................................2-169
(11) Exclusive OR XOR.................................................................................2-170
(12) Logical negation NOT.............................................................................2-170
(13) Negation NOT_BOOL.............................................................................2-171
(14) Negation NOT_WORD...........................................................................2-171
(15) Negation NOT_DWORD.........................................................................2-172
2-4-10 Selection/comparison functions................................................................2-173
(1) Select SEL................................................................................................2-173
(2) Maximum value MAX ...............................................................................2-174
(3) Minimum value MIN..................................................................................2-174
(4) Limit LIMIT................................................................................................2-175
(5) Comparison (>) GT...................................................................................2-176
(6) Comparison (>=) GE.................................................................................2-177
(7) Comparison (=) EQ...................................................................................2-178
(8) Comparison (<=) LE.................................................................................2-179
(9) Comparison (<) LT....................................................................................2-180
(10) Comparison (≠) NE.................................................................................2-181
2-4-11 Type conversion functions........................................................................2-182
(1) Type conversion DINT_TO_INT................................................................2-182
(2) Type conversion UINT_TO_INT................................................................2-182
(3) Type conversion UDINT_TO_INT.............................................................2-183
(4) Type conversion REAL_TO_INT...............................................................2-183
(5) Type conversion TIME_TO_INT...............................................................2-184
(6) Type conversion WORD_TO_INT.............................................................2-184
(7) Type conversion INT_TO_DINT ...........................................................2-185
(8) Type conversion UINT_TO_DINT.............................................................2-185
(9) Type conversion UDINT_TO_DINT..........................................................2-186
(10) Type conversion REAL_TO_DINT..........................................................2-186
(11) Type conversion TIME_TO_DINT...........................................................2-187
(12) Type conversion DWORD_TO_DINT.....................................................2-187
(13) Type conversion INT_TO_UINT.............................................................2-188
(14) Type conversion DINT_TO_UINT...........................................................2-188
(15) Type conversion UDINT_TO_UINT........................................................2-189
(16) Type conversion REAL_TO_UINT..........................................................2-189
(17) Type conversion TIME_TO_UINT...........................................................2-190
(18) Type conversion WORD_TO_UINT........................................................2-190
(19) Type conversion INT_TO_UDINT...........................................................2-191
(20) Type conversion DINT_TO_UDINT........................................................2-191
(21) Type conversion UINT_TO_UDINT........................................................2-192
(22) Type conversion REAL_TO_UDINT.......................................................2-192
(23) Type conversion TIME_TO_UDINT........................................................2-193
(24) Type conversion DWORD_TO_UDINT..................................................2-193
(25) Type conversion DT_TO_UDINT............................................................2-194
(26) Type conversion DATE_TO_UDINT.......................................................2-194
(27) Type conversion TOD_TO_UDINT.........................................................2-195
(28) Type conversion INT_TO_REAL............................................................2-195
(29) Type conversion DINT_TO_REAL..........................................................2-196
(30) Type conversion UINT_TO_REAL..........................................................2-196
(31) Type conversion UDINT_TO_REAL.......................................................2-197
(32) Type conversion TIME_TO_REAL..........................................................2-197
(33) Type conversion WORD_TO_BOOL......................................................2-198
(34) Type conversion DWORD_TO_BOOL....................................................2-198
(35) Type conversion BOOL_TO_WORD......................................................2-199
(36) Type conversion DWORD_TO_WORD..................................................2-199
(37) Type conversion INT_TO_WORD ........................................................2-200
(38) Type conversion UINT_TO_WORD........................................................2-200
(39) Type conversion BOOL_TO_DWORD...................................................2-201
(40) Type conversion WORD_TO_DWORD..................................................2-201
(41) Type conversion DINT_TO_DWORD ...................................................2-202
(42) Type conversion UDINT_TO_DWORD..................................................2-202
(43) Type conversion INT_TO_TIME ...........................................................2-203
(44) Type conversion DINT_TO_TIME..........................................................2-203
(45) Type conversion UINT_TO_TIME..........................................................2-204
(46) Type conversion UDINT_TO_TIME........................................................2-204
(47) Type conversion REAL_TO_TIME.........................................................2-205
(48) Type conversion UDINT_TO_DT............................................................2-205
(49) Type conversion UDINT_TO_DATE.......................................................2-206
(50) Type conversion UDINT_TO_TOD.........................................................2-206
(51) Type conversion TRUNC_INT................................................................2-207
(52) Type conversion TRUNC_DINT.............................................................2-207
(53) Type conversion TRUNC_UINT.............................................................2-208
(54) Type conversion TRUNC_UDINT...........................................................2-208
(55) Type conversion W_BCD_TO_INT.........................................................2-209
(56) Type conversion D_BCD_TO_INT.........................................................2-209
(57) Type conversion W_BCD_TO_DINT......................................................2-210
(58) Type conversion D_BCD_TO_DINT.......................................................2-210
(59) Type conversion INT_TO_W_BCD......................................................... 2-211
(60) Type conversion DINT_TO_W_BCD...................................................... 2-211
(61) Type conversion INT_TO_D_BCD.........................................................2-212
(62) Type conversion DINT_TO_D_BCD.......................................................2-212
2-4-12 String functions.........................................................................................2-213
(1) Get length LEN.........................................................................................2-213
(2) Get left sub-string LEFT............................................................................2-213
(3) Get right sub-string RIGHT.......................................................................2-214
(4) Get middle sub-string MID........................................................................2-214
(5) Concatenate CONCAT..............................................................................2-215
(6) Insert string INSERT.................................................................................2-215
(7) Delete string DELETE...............................................................................2-216
(8) Replace string REPLACE.........................................................................2-216
(9) Find string FIND........................................................................................2-217
(10) Compare string (>) GT_STRING............................................................2-217
(11) Compare string (>=) GE_STRING..........................................................2-218
(12) Compare string (=) EQ_STRING............................................................2-218
(13) Compare string (<=) LE_STRING..........................................................2-219
(14) Compare string (<) LT_STRING.............................................................2-219
(15) Compare string (≠) NE_STRING............................................................2-220
2-4-13 Time type data functions...........................................................................2-221
(1) Add time ADD_T_T...................................................................................2-221
(2) Add time ADD_TD_T................................................................................2-221
(3) Add time ADD_DT_T................................................................................2-221
(4) Subtract time SUB_T_T............................................................................2-222
(5) Subtract time SUB_D_D...........................................................................2-222
(6) Subtract time SUB_TD_T.........................................................................2-222
(7) Subtract time SUB_TD_TD.......................................................................2-223
(8) Subtract time SUB_DT_T.........................................................................2-223
(9) Subtract time SUB_DT_DT.......................................................................2-223
(10) Multiply time MUL_T_N..........................................................................2-224
(11) Multiply time MUL_T_R..........................................................................2-224
(12) Divide time DIV_T_N ............................................................................2-225
(13) Divide time DIV_T_R..............................................................................2-225
(14) Concatenate time CONCAT_D_D..........................................................2-226
(15) Convert DT to TOD DT_TO_TOD..........................................................2-226
(16) Convert DT to DATE DT_TO_DATE......................................................2-226
2-4-14 Double-precision floating-point calculation functions (FCTs)....................2-227
2-4-14-1 Common Specifications......................................................................2-227
(1) Double-precision floating-point format........................................................2-227
(2) Double-precision floating-point notation (PLC Applications).......................2-228
(3) Enable flag (EN/ENO terminal)...................................................................2-228
(4) D_REAL type structure access...................................................................2-228
2-4-14-2 Function of double-precision floating-point calculation FCTs..............2-230
(1) List of double-precision floating-point calculation FCTs..............................2-230
2-4-14-3 Type conversion functions...................................................................2-232
(1) Type conversion INT_TO_DOUBLE.........................................................2-232
(2) Type conversion DOUBLE_TO_INT.........................................................2-232
(3) Type conversion UINT_TO_DOUBLE......................................................2-233
(4) Type conversion DOUBLE_TO_UINT.......................................................2-233
(5) Type conversion DINT_TO_DOUBLE......................................................2-234
(6) Type conversion DOUBLE_TO_DINT.......................................................2-234
(7) Type conversion UDINT_TO_DOUBLE....................................................2-235
(8) Type conversion DOUBLE_TO_UDINT....................................................2-235
(9) Type conversion REAL_TO_DOUBLE.....................................................2-236
(10) Type conversion DOUBLE_TO_REAL...................................................2-236
(11) Type conversion RAD_DOUBLE............................................................2-237
(12) Type conversion DEG_DOUBLE............................................................2-237
2-4-14-4 Arithmetic operation functions.............................................................2-238
(1) Addition ADD_DOUBLE............................................................................2-238
(2) Subtraction SUB_DOUBLE......................................................................2-238
(3) Multiplication MUL_DOUBLE....................................................................2-239
(4) Division DIV_DOUBLE.............................................................................2-239
(5) Sine SIN_DOUBLE...................................................................................2-240
(6) Cosine COS_DOUBLE.............................................................................2-240
(7) Tangent TAN_DOUBLE............................................................................2-241
(8) Arc sine ASIN_DOUBLE...........................................................................2-241
(9) Arc cosine ACOS_DOUBLE.....................................................................2-242
(10) Arc tangent ATAN_DOUBLE..................................................................2-242
(11) Square root SQRT_DOUBLE.................................................................2-243
(12) Exponent EXP_DOUBLE.......................................................................2-243
(13) Natural logarithm LN_DOUBLE..............................................................2-244
2-4-14-5 Comparison functions.........................................................................2-245
(1) Comparison EQ_DOUBLE........................................................................2-245
(2) Comparison NE_DOUBLE........................................................................2-245
(3) Comparison GT_DOUBLE........................................................................2-246
(4) Comparison GE_DOUBLE........................................................................2-246
(5) Comparison LT_DOUBLE.........................................................................2-247
(6) Comparison LE_DOUBLE........................................................................2-247
2-4-14-6 Restrictions.........................................................................................2-248
2-5 ST Language.........................................................................................2-250
2-5-1 Structure of ST language............................................................................2-250
2-5-2 ST operators................................................................................................2-250
2-5-3 ST statements.............................................................................................2-251
2-5-4 ST language statements.............................................................................2-251
(1) Assignment statement (:=).........................................................................2-251
(2) IF statement................................................................................................2-252
(3) CASE statement.........................................................................................2-253
(4) FOR statement...........................................................................................2-254
(5) WHILE statement........................................................................................2-255
(6) REPEAT statement.....................................................................................2-255
(7) RETURN statement....................................................................................2-256
(8) EXIT statement...........................................................................................2-256
2-6 IL Language..........................................................................................2-257
2-6-1 Structure of IL language..............................................................................2-257
2-6-2 IL instruction summary................................................................................2-258
2-6-3 IL language instructions..............................................................................2-261
(1) Load LD....................................................................................................2-261
(2) Load not LDN............................................................................................2-261
(3) Store ST....................................................................................................2-262
(4) Store not STN...........................................................................................2-262
(5) Set S.........................................................................................................2-263
(6) Reset R.....................................................................................................2-263
(7) Logical product AND.................................................................................2-264
(8) Logical product AND(................................................................................2-264
(9) Logical inverted product ANDN................................................................2-265
(10) Logical inverted product ANDN( ...........................................................2-265
(11) Logical add OR.......................................................................................2-266
(12) Logical add OR(......................................................................................2-266
(13) Logical inverted add ORN......................................................................2-267
(14) Logical inverted add ORN(.....................................................................2-267
(15) Exclusive OR XOR.................................................................................2-268
(16) Exclusive OR XOR(................................................................................2-268
(17) Exclusive NOR XORN............................................................................2-269
(18) Exclusive NOR XORN(...........................................................................2-269
(19) Addition ADD..........................................................................................2-270
(20) Addition ADD( .......................................................................................2-270
(21) Subtraction SUB.....................................................................................2-271
(22) Subtraction SUB(....................................................................................2-271
(23) Multiplication MUL..................................................................................2-272
(24) Multiplication MUL( ...............................................................................2-272
(25) Division DIV............................................................................................2-273
(26) Division DIV(...........................................................................................2-273
(27) Comparison GT......................................................................................2-274
(28) Comparison GT(.....................................................................................2-274
(29) Comparison GE......................................................................................2-275
(30) Comparison GE(.....................................................................................2-275
(31) Comparison EQ......................................................................................2-276
(32) Comparison EQ(.....................................................................................2-276
(33) Comparison NE......................................................................................2-277
(34) Comparison NE(.....................................................................................2-277
(35) Comparison LE.......................................................................................2-278
(36) Comparison LE(......................................................................................2-278
(37) Comparison LT.......................................................................................2-279
(38) Comparison LT(......................................................................................2-279
(39) Unconditional jump JMP.........................................................................2-280
(40) TRUE conditional jump JMPC................................................................2-280
(41) FALSE conditional jump JMPCN............................................................2-281
(42) Unconditional call CAL...........................................................................2-281
(43) TRUE conditional call CALC...................................................................2-282
(44) FALSE conditional call CALCN...............................................................2-282
(45) Unconditional return RET .....................................................................2-283
(46) TRUE conditional return RETC..............................................................2-283
(47) FALSE conditional return RETCN..........................................................2-284
2-7 SFC Elements.......................................................................................2-285
2-7-1 Structure of SFC..........................................................................................2-285
2-7-2 Description of SFC......................................................................................2-286
2-7-2-1 SFC elements.......................................................................................2-286
(1) Initial step....................................................................................................2-286
(2) Normal step................................................................................................2-287
(3) Jump...........................................................................................................2-287
(4) Termination step.........................................................................................2-288
(5) Action/action qualifier..................................................................................2-289
(6) Transition....................................................................................................2-293
2-7-2-2 Step transition.......................................................................................2-294
(1) Single-flow transition...................................................................................2-294
(2) Divergence of sequence selection..............................................................2-294
(3) Convergence of sequence selection...........................................................2-295
(4) Simultaneous sequences-divergence.........................................................2-296
(5) Simultaneous sequences-convergence......................................................2-296
2-7-2-3 Automatically generated SFC variables................................................2-297
2-7-3 SFC programming precautions...................................................................2-298
(1) Step reset processing.................................................................................2-298
(2) Programming a jump in an action/transition...............................................2-298
(3) Precautions for using a processor link module...........................................2-299
2-7-4 Continuous operation of SFC......................................................................2-300
Section 2 Programming Language Programming Languages
Graphic languages can be used for programming in combination with any of the above languages on one worksheet.
The available combinations of languages are listed in the table below.
Notes:
1) Specify the programming language on the “Insert” dialog box of the POU in D300win.
<“Insert” dialog box>
2) The control statements (e.g., IF statement) can be used. For more information, refer to the user’s manual “SX-Programmer
Expert (D300win) <LD/FBD Editor Operations> (FEH257-1).”
3) In actions and transitions of SFC elements, text languages (IL and ST) are available.
4) Operations for when a transfer error occurs that are common to each instruction on the following pages are described
below.
1) If an error occurs during the read access from the global memory via the processor bus occurs, ENO is set to 0 (*1) and
the operation result is undefined. (*2).
(*1) ENO flag: ENO flag is a execution flag in the CPU and set to 0 when an error occurs.
(*2) “Undefined” data means a value that is defined by the hardware of the CPU.
(Example 0 or operation result value up to the moment”)
2) If an error occurs during the write access to the global memory via the processor bus, ENO is set to 0 and the storage
operation may be undefined. (*3).
(*3) When data writing is not performed, the value in the storage destination does not change.
5) The number of steps in the instruction summary table indicates the minimum number of steps in the intermediate language.
One step of the intermediate language may be from 1 to 4 words in size depending on the type of data or operands.
6) EN (enable input) and ENO (enable output) described in the detailed explanations of instructions are the functions for
controlling execution.
2-1
Section 2 Programming Language Programming Languages
For how to read the languages, see the first page of the subsection for each language.
2-3 LD Language P2-27
2-4 FBD Language P2-41
2-5 ST Language P2-250
2-6 IL Language P2-257
2-7 SFC Language P2-285
2-2
Section 2 Programming Language List (LD language)
Coil 1 P2-38
S Set 1 P2-39
R Reset 1 P2-39
SR
BOOL SET1 Q1 BOOL Set reset flip-flop SR 8 P2-52
BOOL RESET
RS_1
RS
BOOL SET Q1 BOOL Reset set flip-flop RS 8 P2-52
BOOL RESET1
R_TRIG_1
F_TRIG_1
2-3
Section 2 Programming Language List (IEC standard FB)
CTU_1
CTU
BOOL CU Q BOOL Up counter CTU 12 P2-543
BOOL RESET
INT PV CV INT
CTD_1
CTD
BOOL CD Q BOOL Down counter CTD 12 P2-54
BOOL LOAD
INT PV CV INT
CTUD_1
CTUD
BOOL CU QU BOOL
BOOL CD QD BOOL Pulse TP 18 P2-55
BOOL RESET CV INT
BOOL LOAD
INT PV
TP_1
TP
BOOL IN Q BOOL Up down counter CTUD 10 P2-56
TIME PT ET TIME
TON_1
TON
BOOL IN Q BOOL On-delay timer TON 10 P2-56
TIME PT ET TIME
TOF_1
TOF
BOOL IN Q BOOL Off-delay timer TOF 10 P2-57
TIME PT ET TIME
RTC_1
RTC
BOOL EN Q BOOL Real-time clock RTC 10 P2-57
DT PDT CDT DT
2-4
Section 2 Programming Language List (original FB)
RCT_1
RCT
BOOL CU Q BOOL Ring counter RCT 12 P2-58
BOOL RESET
INT PV CV INT
TMR_1
TMR
BOOL IN Q BOOL Integrating timer TMR 10 P2-59
BOOL RESET
TIME PT ET TIME
MR_1
MR
BOOL IN Q BOOL Retriggerable timer MR 10 P2-60
TIME PT ET TIME
M_OPEN_1
M_OPEN
BOOL EN_C VALID BOOL
UINT MODULE_NO ERROR BOOL
UINT CHANNEL_NO STATUS INT
UDINT STATION_NO CON_NO UINT Open channel M_OPEN 29 P2-61
UINT MODULE_TYPE
UINT MODE
UINT SUB_MODE
UINT RPORT_NO
UINT SPORT_NO
M_SEND_1
M_SEND
BOOL REQ DONE BOOL
UINT CON_NO ERROR BOOL Send message M_SEND 16 P2-64
STATUS INT
ANY SD SD ANY
UINT SIZE
M_RECEIVE_1
M_RECEIVE
BOOL EN_R NDR BOOL
UINT CON_NO ERROR BOOL Receive message M_RECEIVE 16 P2-65
STATUS INT
ANY RD RD ANY
UINT SIZE
2-5
Section 2 Programming Language List (original FB)
READ_WORD_1
READ_WORD
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct read READ_WORD 16 P2-66
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY RD RD ANY
READ_BOOL_1
READ_BOOL
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL
Direct read READ_BOOL 16
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY RD RD ANY
WRITE_WORD_1
WRITE_WORD
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct write WRITE_WORD 16 P2-67
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY SD SD ANY
WRITE_BOOL_1
WRITE_BOOL
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL
Direct write WRITE_BOOL 16
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY SD SD ANY
R_READ_1
R_READ
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
UINT CHANNEL_NO STATUS INT
Remote data read R_READ 16 P2-68
UDINT STATION_NO
UINT VAR_TYPE
ANY REMOTE_VAR REMOTE_VAR ANY
UINT SIZE
ANY RD RD ANY
R_WRITE_1
R_WRITE
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
UINT CHANNEL_NO STATUS INT
Remote data write R_WRITE 16 P2-69
UDINT STATION_NO
UINT VAR_TYPE
ANY REMOTE_VAR REMOTE_VAR ANY
UINT SIZE
ANY SD SD ANY
2-6
Section 2 Programming Language List (original FB)
F_READ_1
F_READ
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
STATUS INT
File data read F_READ 16 P2-72
ANY FILE_NAME FILE_NAME ANY
UINT SIZE F_SIZE UINT
ANY RD RD ANY
F_WRITE_1
F_WRITE
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
File data write F_WRITE 16 P2-74
STATUS INT
ANY FILE_NAME FILE_NAME ANY
UINT SIZE
ANY WD WD ANY
EXT_T_S_1
EXT_T_S
BOOL REQ DONE BOOL
Q BOOL Extension test & set EXT_T_S 14 P2-76
ERROR BOOL
STATUS INT
ANY IN IN ANY
FFST_1
FFST
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
STRUCT FCB FCB STRUCT Sequential file store FFST 12 P2-77
ARRAY IN IN ARRAY
UINT X_SIZE
UINT Y_SIZE
FIFO_1
FIFO
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
STRUCT FCB FCB STRUCT Sequential file load first FIFO 12 P2-78
ARRAY OUT OUT ARRAY
UINT X_SIZE
UINT Y_SIZE
FILO_1
FILO
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
STRUCT FCB FCB STRUCT Sequential file load last FILO 12 P2-79
ARRAY OUT OUT ARRAY
UINT X_SIZE
UINT Y_SIZE
Notes:
The FB with at an upper right corner in the name column are not supported by the SPH200s.
2-7
Section 2 Programming Language List (original FB)
FILTER_DINT_1
FILTER_DINT
BOOL RUN XOUT DINT
DINT XIN Filter FILTER_DINT 10 P2-80
TIME TAU
FILTER_REAL_1
FILTER_REAL
BOOL RUN XOUT REAL
REAL XIN Filter FILTER_REAL 10 P2-81
TIME TAU
INT_DINT_1
INT_DINT
BOOL RUN XOUT DINT
BOOL R1 Q BOOL Integrate INT_DINT 16 P2-82
DINT XIN
DINT X0
TIME I_T
INT_REAL_1
INT_REAL
BOOL RUN XOUT REAL
BOOL R1 Q BOOL Integrate INT_REAL 16 P2-83
REAL XIN
REAL X0
TIME I_T
DIF_DINT_1
DIF_DINT
BOOL RUN XOUT DINT Differentiate DIF_DINT 10 P2-84
DINT XIN
TIME D_T
DIF_REAL_1
DIF_REAL
BOOL RUN XOUT REAL Differentiate DIF_REAL 10 P2-85
REAL XIN
TIME D_T
PULSE_CNT_1
PULSE_CNT
BOOL RUN OUT INT Pulse count PULSE_CNT 12 P2-86
BOOL IN CMP BOOL
TIME DURATION
2-8
Section 2 Programming Language List (original FB)
PULSE_OUT_1
PULSE_OUT
BOOL RUN OUT BOOL
Pulse output PULSE_OUT 12 P2-86
TIME PERIOD CMP BOOL
INT COUNT
PWM_1
PWM
BOOL RUN OUT BOOL Pulse PWM 10 P2-87
TIME PERIOD
TIME WIDTH
HW_RTC_1
HW_RTC
BOOL EN Q BOOL Hardware RTC (Real-time clock) HW_RTC 10 P2-87
DT PDT CDT DT
T_S_1
T_S
ERROR BOOL Test & set T_S 6 P2-88
BOOL IN IN BOOL
Q BOOL
BANK_CHG_1
BANK_CHG
BOOL REQ DONE BOOL
Change bank BANK_CHG 14 P2-89
UINT MODULE_NO ERROR BOOL
STATUS INT
BUSY BOOL
2-9
Section 2 Programming Language List (user ROM card expansion FB)
No. of
FB name Function name Function description Page
steps
_F_WRITE_CSV_DINT Write CSV file Writes user variables (array) to a file on the user
ROM card in CSV format. 1.1K P2-91
_F_WRITE_CSV_DINT_LF Write CSV file
* (Long file name adapted)
_F_READ_CSV_DINT Read CSV file Reads a CSV-format file from the user ROM card
into user variables. 0.7K P2-94
_F_READ_CSV_DINT_LF Read CSV file
* (Long file name adapted)
_F_APPEND_CSV_DINT Append data to CSV file Appends a row of data to an existing CSV-format
file. 0.9K P2-96
_F_APPEND_CSV_DINT_LF Append data to CSV file
* (Long file name adapted)
_F_APPEND Append data to file Appends binary data to the end of a file on the
user ROM card. 0.6K P2-99
_F_APPEND_LF Append data to file
* (Long file name adapted)
_F_DELETE Delete file Deletes an existing file on the user ROM card.
_F_DELETE_LF Delete file 0.5K P2-101
* (Long file name adapted)
_F_OFFSET_READ Reading of a file with an Reads data in the user ROM card using the offset
offset position from the beginning of data and read size.
_F_OFFSET_READ_LF Reading of a file with an 0.4K P2-103
* offset
(Long file name adapted)
_F_GET_DRV_SIZE Reading of the remaining Reads the total memory capacity and remaining
capacity capacity of the user ROM card mounted on CPU. 0.4K P2-106
_F_CREATE_FILE_NAME File name creation Creates file names used for the file access library.
* The input of a number of STRING variables are
0.4K P2-107
concatenated, and output to F_NAME, a WORD
array variable.
* For the SPH2000 series, these FBs are only supported by CPUs whose software version is V08 or later.
2-10
Section 2 Programming Language List (type conversion FCT)
Arithmetic functions
Selection/comparison functions
String functions
2-11
Section 2 Programming Language List (type conversion FCT)
2-12
Section 2 Programming Language List (type conversion FCT)
2-13
Section 2 Programming Language List (type conversion FCT)
2-14
Section 2 Programming Language List (type conversion FCT)
2-15
Section 2 Programming Language List (arithmetic FCT)
2) Arithmetic functions
ADD
ANY_NUM ANY_NUM
ANY_NUM No. of input
• Addition ADD P2-160
•
operands + 1
•
ANY_NUM
2-16
Section 2 Programming Language List (arithmetic FCT)
SUB
ANY_NUM ANY_NUM Subtraction SUB 3 P2-161
ANY_NUM
MUL
ANY_NUM ANY_NUM
ANY_NUM No. of input
Multiplication MUL P2-161
• operands + 1
•
•
ANY_NUM
DIV
ANY_NUM ANY_NUM Division DIV 3 P2-162
ANY_NUM
MOD
ANY_INT ANY_INT Division remainder MOD 4 P2-162
ANY_INT
EXPT
REAL REAL Exponent EXPT 3 P2-163
REAL
2-17
Section 2 Programming Language List (bit string FCT)
SHL _WORD
WORD IN WORD Shift left SHL _WORD 3 P2-165
UINT N
SHL _DWORD
DWORD IN DWORD Shift left SHL _DWORD 3 P2-165
UINT N
SHR _WORD
WORD IN WORD Shift right SHR _WORD 3 P2-166
UINT N
SHR _DWORD
DWORD IN DWORD Shift right SHR _DWORD 3 P2-166
UINT N
ROL _WORD
WORD IN WORD Rotate left ROL _WORD 3 P2-167
UINT N
ROL _DWORD
DWORD IN DWORD Rotate left ROL _DWORD 3 P2-167
UINT N
ROR _WORD
WORD IN WORD Rotate right ROR _WORD 3 P2-168
UINT N
ROR _DWORD
DWORD IN DWORD Rotate right ROR _DWORD 3 P2-168
UINT N
AND
ANY_BIT ANY_BIT
ANY_BIT No. of input
Logical product AND P2-169
• operands + 1
•
•
ANY_BIT
OR
ANY_BIT ANY_BIT
ANY_BIT No. of input
Logical add OR P2-169
• operands + 1
•
•
ANY_BIT
2-18
Section 2 Programming Language List (bit string FCT)
XOR
ANY_BIT ANY_BIT
ANY_BIT No. of input
• Exclusive XOR P2-170
operands + 1
•
•
ANY_BIT
2-19
Section 2 Programming Language List (selection/comparison FCT)
4) Selection/comparison functions
SEL_BOOL
BOOL G BOOL
Select SEL_BOOL 8 P2-173
BOOL IN0
BOOL IN1
SEL_INT
BOOL G INT
INT IN0
Select SEL_INT
INT IN1
SEL_DINT
BOOL G DINT
Select SEL_DINT
DINT IN0
DINT IN1
SEL_UINT
BOOL G UINT
Select SEL_UINT
UINT IN0
UINT IN1
SEL_UDINT
BOOL G UDINT
Select SEL_UDINT
UDINT IN0
UDINT IN1
SEL_REAL
BOOL G REAL
Select SEL_REAL
REAL IN0
REAL IN1
SEL_WORD
BOOL G WORD
Select SEL_WORD
WORD IN0
WORD IN1
SEL_DWORD
BOOL G DWORD
DWORD IN0
Select SEL_DWORD
DWORD IN1
SEL_TIME
BOOL G TIME
TIME IN0
Select SEL_TIME
TIME IN1
SEL_STRING
BOOL G STRING
STRING IN0 Select SEL_STRING
STRING IN1
2-20
Section 2 Programming Language List (selection/comparison FCT)
MAX_INT
INT INT Maximum value MAX_INT 3 P2-174
INT
MAX_DINT
DINT DINT Maximum value MAX_DINT
DINT
MAX_UINT
UINT UINT Maximum value MAX_UINT
UINT
MAX_UDINT
UDINT UDINT Maximum value MAX_UDINT
UDINT
MAX_REAL
REAL REAL
Maximum value MAX_REAL
REAL
MIN_INT
INT INT Minimum value MIN_INT 3 P2-174
INT
MIN_DINT
DINT DINT Minimum value MIN_DINT
DINT
MIN_UINT
UINT UINT Minimum value MIN_UINT
UINT
MIN_UDINT
UDINT UDINT Minimum value MIN_UDINT
UDINT
MIN_REAL
REAL REAL
Minimum value MIN_REAL
REAL
2-21
Section 2 Programming Language List (selection/comparison FCT)
LIMIT_INT
INT MN INT
Limit LIMIT_INT 6 P2-175
INT IN
INT MX
LIMIT_DINT
DINT MN DINT
DINT IN
Limit LIMIT_DINT
DINT MX
LIMIT_UINT
UINT MN UINT
UINT IN Limit LIMIT_UINT
UINT MX
LIMIT_UDINT
UDINT MN UDINT
UDINT IN Limit LIMIT_UDINT
UDINT MX
LIMIT_REAL
REAL MN REAL
REAL IN Limit LIMIT_REAL
REAL MX
2-22
Section 2 Programming Language List (selection/comparison FCT)
GT
elementary BOOL
elementary
No. of input
•
Comparison (>) GT operands P2-176
• x3 - 1
•
elementary
GE
elementary BOOL
No. of input
elementary
Comparison (>=) GE operands P2-177
•
• x3 - 1
•
elementary
EQ
elementary BOOL
No. of input
elementary
Comparison (=) EQ operands P2-178
•
• x3 - 1
•
elementary
LE
elementary BOOL
No. of input
elementary
Comparison (<=) LE operands P2-179
•
• x3 - 1
•
elementary
LT
elementary BOOL
No. of input
elementary
Comparison (<) LT operands P2-180
•
• x3 - 1
•
elementary
NE
elementary BOOL Comparison (≠) NE 3 P2-181
elementary
Notes:
STRING type data is not available to an “elementary” of GT, GE, EQ, LE, LT or NE.
2-23
Section 2 Programming Language List (string FCT)
4) String functions
LEFT
STRING IN STRING Get left sub-string LEFT 10 P2-213
UINT L
RIGHT
STRING IN STRING Get right sub-string RIGHT 10 P2-214
UINT L
MID
STRING IN STRING
UINT L Get middle sub-string MID 11 P2-214
UINT P
CONCAT
STRING STRING Concatenate CONCAT 11 P2-215
STRING
INSERT
STRING IN1 STRING
STRING IN2
Insert string INSERT 11 P2-215
UINT P
DELETE
STRING IN STRING
UINT L Delete string DELETE 11 P2-216
UINT P
REPLACE
STRING IN1 STRING
STRING IN2 Replace string REPLACE 12 P2-216
UINT L
UINT P
FIND
STRING IN1 INT Find string FIND 4 P2-217
STRING IN2
2-24
Section 2 Programming Language List (string FCT)
GT_STRING
STRING IN1 BOOL Compare string GT_STRING 4 P2-217
STRING IN2
GE_STRING
STRING IN1 BOOL Compare string GE_STRING 4 P2-218
STRING IN2
EQ_STRING
STRING IN1 BOOL Compare string EQ_STRING 4 P2-218
STRING IN2
LE_STRING
STRING IN1 BOOL Compare string LE_STRING 4 P2-219
STRING IN2
LT_STRING
STRING IN1 BOOL Compare string LT_STRING 4 P2-219
STRING IN2
NE_STRING
STRING IN1 BOOL Compare string NE_STRING 4 P2-220
STRING IN2
2-25
Section 2 Programming Language List (time type data FCT)
ADD_T_T
TIME TIME Add time ADD_T_T 5 P2-221
TIME
ADD_TD_T
TOD TOD Add time ADD_TD_T 8 P2-221
TIME
ADD_DT_T
DT DT Add time ADD_DT_T 8 P2-221
TIME
BUS_T_T
TIME TIME Subtract time SUB_T_T 5 P2-222
TIME
SUB_D_D
DATE TIME Subtract time SUB_D_D 6 P2-222
DATE
SUB_TD_T
TOD TOD Subtract time SUB_TD_T 8 P2-222
TIME
SUB_TD_TD
TOD TIME Subtract time SUB_TD_TD 6 P2-223
TOD
BUS_DT_T
DT DT Subtract time SUB_DT_T 8 P2-223
TIME
BUS_DT_DT
DT TIME Subtract time SUB_DT_DT 6 P2-223
DT
MUL_T_N
TIME TIME Multiply time MUL_T_N 7 P2-224
UDINT
MUL_T_R
TIME TIME Multiply time MUL_T_R 7 P2-224
REAL
DIV_T_N
TIME TIME Divide time DIV_T_N 7 P2-225
UDINT
2-26
Section 2 Programming Language List (time type data FCT)
DIV_T_R
TIME TIME Divide time DIV_T_R 7 P2-225
REAL
CONCAT_D_D
DATE DT Concatenate time CONCAT_D_D 5 P2-226
TOD
2-27
Section 2 Programming Language List (original FCT)
SBIT_WORD
WORD IN WORD Set bit SBIT_WORD 3 P2-136
UINT N
SBIT_DWORD
DWORD IN DWORD Set bit SBIT_DWORD 3 P2-136
UINT N
RBIT_WORD
WORD IN WORD Reset bit RBIT_WORD 3 P2-137
UINT N
RBIT_DWORD
DWORD IN DWORD Reset bit RBIT_DWORD 3 P2-137
UINT N
TBIT_WORD
WORD IN WORD Test bit TBIT_WORD 3 P2-138
UINT N
TBIT_DWORD
DWORD IN DWORD Test bit TBIT_DWORD 3 P2-138
UINT N
2-28
Section 2 Programming Language List (original FCT)
DBAND_INT
INT IN INT Dead band DBAND_INT 5 P2-143
INT DB
DBAND_DINT
DINT IN DINT Dead band DBAND_DINT 5 P2-144
DINT DB
DBAND_REAL
REAL IN REAL Dead band DBAND_REAL 5 P2-144
REAL DB
BIAS_INT
INT IN INT Bias BIAS_INT 5 P2-145
INT DZ
BIAS_DINT
DINT IN DINT Bias BIAS_DINT 5 P2-145
DINT DZ
BIAS_REAL
REAL IN REAL Bias BIAS_REAL 5 P2-146
REAL DZ
SC_COIL
BOOL RUN UINT
Step sequence coil SC_COIL 6 P2-147
UINT STEP
UINT IN
SC
BOOL RUN BOOL
Step sequence bit SC 6 P2-147
UINT STEP
UINT IN
ADC
DINT IN1 DINT
32-bit addition with carry ADC 6 P2-148
DINT IN2
BOOL CYIN
2-29
Section 2 Programming Language List (original FCT)
ADCO
DINT IN1 BOOL
DINT IN2 Carry after 32-bit addition ADCO 6 P2-148
BOOL CYIN
SBB
DINT IN1 DINT
DINT IN2 32-bit subtraction with borrow SBB 6 P2-149
BOOL BIN
SBBO
DINT IN1 BOOL
DINT IN2 Borrow after 32-bit subtraction SBBO 6 P2-149
BOOL BIN
DIVL
DINT IN1 DINT Lower-order digit in 64-bit division
DINT IN2 6 P2-151
DIVL
DINT IN3
DIVU
DINT IN1 DINT Upper-order digit in 64-bit division
DINT IN2
6 P2-151
DIVU
DINT IN3
SLC
DWORD IN DWORD Shift left 32 bits with carry SLC 5 P2-152
BOOL CYIN
SRC
DWORD IN DWORD Shift right 32 bits with carry SRC 5 P2-153
BOOL CYIN
SRCO
DWORD BOOL Carry after 32 bits shift right SRCO 4 P2-153
2-30
Section 2 Programming Language List (Double-precision
floating-point calculation FCT)
No. of
Types Names Overview Page
steps
Type Converts INT data (16-bit signed integer) to DOUBLE type data
INT_TO_DOUBLE 7 P2-232
conversion (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_INT 3 P2-232
conversion into INT data (16-bit signed integer).
Type Converts UINT type data (16-bit unsigned integer) into DOUBLE
UINT_TO_DOUBLE 7 P2-233
conversion type data (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_UINT 3 P2-233
conversion into UINT type data (16-bit unsigned integer).
Type Converts DINT type data (32-bit signed integer) into DOUBLE type
DINT_TO_DOUBLE 7 P2-234
conversion data (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_DINT 3 P2-234
conversion into DINT type data (32-bit signed integer).
Type Converts UDINT type data (32-bit unsigned integer) into DOUBLE
UDINT_TO_DOUBLE 7 P2-235
conversion type data (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_UDINT 3 P2-235
conversion into UDINT type data (32-bit unsigned integer).
Type Converts REAL data (single-precision floating-point data) into
REAL_TO_DOUBLE 7 P2-236
conversion DOUBLE type data (double- precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_REAL 3 P2-236
conversion into REAL data (single- precision floating-point data).
Type
RAD_DOUBLE Converts angles into radians. 7 P2-237
conversion
Type
DEG_DOUBLE Converts radians into angles. 7 P2-237
conversion
Arithmetic ADD_DOUBLE Adds DOUBLE type data (double-precision floating-point data). 8 P2-238
Arithmetic SUB_DOUBLE Subtracts DOUBLE type data (double-precision floating-point data). 8 P2-238
Arithmetic MUL_DOUBLE Multiplies DOUBLE type data (double-precision floating-point data). 8 P2-239
Arithmetic DIV_DOUBLE Divides DOUBLE type data (double-precision floating-point data). 8 P2-239
Calculates the sine of DOUBLE type data (double-precision
Arithmetic SIN_DOUBLE 7 P2-240
floating-point data) (radians).
Calculates the cosine of DOUBLE type data (double-precision
Arithmetic COS_DOUBLE 7 P2-240
floating-point data) (radians).
Calculates the tangent of DOUBLE type data (double-precision
Arithmetic TAN_DOUBLE 7 P2-241
floating-point) (radians).
Calculates the arc sine of DOUBLE type data (double-precision
Arithmetic ASIN_DOUBLE 7 P2-241
floating-point data).
Calculates the arc cosine of DOUBLE type data (double-precision
Arithmetic ACOS_DOUBLE 7 P2-242
floating-point data).
Calculates the arc tangent of DOUBLE type data (double-precision
Arithmetic ATAN_DOUBLE 7 P2-242
floating-point data).
Calculates the square root of DOUBLE type data (double-precision
Arithmetic SQRT_DOUBLE 7 P2-243
floating-point data).
Calculates the exponent of DOUBLE type data (double-precision
Arithmetic EXP_DOUBLE 7 P2-243
floating-point data).
Calculates the natural logarithm of DOUBLE type data (double-
Arithmetic LN_DOUBLE 7 P2-244
precision floating-point data).
2-31
Section 2 Programming Language List (Double-precision
floating-point calculation FCT)
2-32
Section 2 Programming Language List (ST language)
2-2-4 ST language
(1) ST operators
(2) ST statements
2-33
Section 2 Programming Language List (IL language)
2-2-5 IL instruction
The IL instructions can be used only in the IL language.
2-34
Section 2 Programming Language List (IL language)
Notes:
BOOL type cannot be used for GT, GT(, GE or GE(, either.
2-35
Section 2 Programming Language List (IL language)
G Key point:
The number of steps depends on the operand used. The number of steps for a variable that holds an array may be large.
2-36
Section 2 Programming Language LD language
2-3 LD Language
2-3-1 Structure of LD language
LD language is a graphical language that consists of contacts and coils that are connected to two vertical bus lines.
LD language are used with FBD language in applications where timers, counters, and applications instructions are to be used.
<Examples of LD language>
Notes:
The graphical languages supported by the MICREX-SX series are of the free-layout format. Multiple circuits may be laid out
in any location on a work sheet.
2-3-2 LD language
Coil 1 P2-38
S Set 1 P2-39
R Reset 1 P2-39
2-37
Section 2 Programming Language LD language
SW4
(1) These symbols denote NO contacts, NC
Function
Inverted coil
SW1 SW2 SW3 SW4 SW5 FLAG
Symbol
Equivalent
SW1 FLAG
(1) The inverted coil generates the inverted
Function
SW3
SW4
SW5
2-38
Section 2 Programming Language LD language
SW1
SW1 LAMP1
S R S
SW2
SW2 LAMP1
R
LAMP1
(4) Connector
Connector • The sample circuit shown below assumes that the source is connected
to the destination.
Symbol
XYZ
2-39
Section 2 Programming Language LD language
(5) Jump
Jump
001
Symbol
012
<Operation>
Program execution causes a jump to Processing 1 and circuit 012
is processed when condition 1 turns on. Circuit 011 is skipped.
(6) Return
Return
Programming processing
Symbol
RETURN
2-40
Section 2 Programming Language FBD language
Comment
Comments may appear in any location
on the worksheet.
Notes:
The graphical languages supported by the MICREX-SX series are of the free-layout format. Multiple circuits may be laid out
in any location on a work sheet.
2-41
Section 2 Programming Language FB
The notational conventions used in the function block summary charts are almost the same as those which are used in the
function summary charts except the following:
• There are instructions that have two or more output terminals.
• Edge inputs can be used.
• The number of input terminals is fixed (and cannot be extended).
• Both input and output terminals have a predefined name (parameter name).
• There are instructions that have the IN_OUT parameter.
T_S_1
T_S
ERROR BOOL Test & set T_S 6 P2-88
BOOL IN IN (Note 6)
Q BOOL
Notes:
1) The number of steps depends on the operands used. Consequently, the number of steps of array variables will be greater
than that of scalar variables.
2) Every FB uses its own memory area called an instance memory in order to operate. An FB number called an instance
name is assigned to each FB. This means that the FBs with the same instance name assigned share the same instance
area. Pay attention to any duplicate instance name when an FB is used.
3) The FBs provided in the MICREX-SX Series (IEC standard FBs and original FBs) are called “system FBs,” and the FBs
created by the user are called “user FBs.” The system FBs use the system FB instance memory and user FBs use the
user FB instance memory.
4) The standard memory area not specified in the AT statement is used. (2-word/FB instance).
5) D300win does not check the data type of the terminal associated with functions ANY or ARRAY_OF** or ARRAY_OF_*X.
Use the data types appropriate for function blocks, following their detailed explanations.
2-42
Section 2 Programming Language FB
2-43
Section 2 Programming Language IEC standard FB
SR
BOOL SET1 Q1 BOOL Set reset flip-flop SR 8 P2-52
BOOL RESET
RS_1
RS
BOOL SET Q1 BOOL Reset set flip-flop RS 8 P2-52
BOOL RESET1
R_TRIG_1
F_TRIG_1
F_TRIG
Falling edge detection F_TRIG 6 P2-53
BOOL CLK Q BOOL
CTU_1
CTU
BOOL CU Q BOOL
Up counter CTU 12 P2-54
BOOL RESET
INT PV CV INT
CTD_1
CTD
BOOL CD Q BOOL Down counter CTD 12 P2-54
BOOL LOAD
INT PV CV INT
2-44
Section 2 Programming Language IEC standard FB
CTUD_1
CTUD
BOOL CU QU BOOL
BOOL CD QD BOOL
Up down counter CTUD 18 P2-55
BOOL RESET CV INT
BOOL LOAD
INT PV
TP_1
TP
BOOL IN Q BOOL Pulse TP 10 P2-56
TIME PT ET TIME
TON_1
TON
BOOL IN Q BOOL On-delay timer TON 10 P2-56
TIME PT ET TIME
TOF_1
TOF
BOOL IN Q BOOL Off-delay timer TOF 10 P2-57
TIME PT ET TIME
RTC_1
RTC
BOOL EN Q BOOL Real-time clock RTC 10 P2-57
DT PDT CDT DT
2-45
Section 2 Programming Language Original FB
RCT_1
RCT
BOOL CU Q BOOL Ring counter RCT 12 P2-58
BOOL RESET
INT PV CV INT
TMR_1
TMR
BOOL IN Q BOOL
Integrating timer TMR 10 P2-59
BOOL RESET
TIME PT ET TIME
MR_1
MR
BOOL IN Q BOOL Retriggerable timer MR 10 P2-60
TIME PT ET TIME
M_OPEN_1
M_OPEN
BOOL EN_C VALID BOOL
UINT MODULE_NO ERROR BOOL
UINT CHANNEL_NO STATUS INT
UDINT STATION_NO CON_NO UINT Open channel M_OPEN 29 P2-61
UINT MODULE_TYPE
UINT MODE
UINT SUB_MODE
UINT RPORT_NO
UINT SPORT_NO
M_SEND_1
M_SEND
BOOL REQ DONE BOOL
UINT CON_NO ERROR BOOL Send message M_SEND 16 P2-64
STATUS INT
ANY SD SD ANY
UINT SIZE
M_RECEIVE_1
M_RECEIVE
BOOL EN_R NDR BOOL
UINT CON_NO ERROR BOOL Receive message M_RECEIVE 16 P2-65
STATUS INT
ANY RD RD ANY
UINT SIZE
2-46
Section 2 Programming Language Original FB
READ_WORD_1
READ_WORD
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct read READ_WORD 16 P2-66
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY RD RD ANY
READ_BOOL_1
READ_BOOL
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL
Direct read READ_BOOL 16
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY RD RD ANY
WRITE_WORD_1
WRITE_WORD
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct write WRITE_WORD 16 P2-67
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY SD SD ANY
WRITE_BOOL_1
WRITE_BOOL
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL
Direct write WRITE_BOOL 16
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY SD SD ANY
R_READ_1
R_READ
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
UINT CHANNEL_NO STATUS INT
UDINT STATION_NO Remote data read R_READ 16 P2-68
UINT VAR_TYPE
ANY REMOTE_VAR REMOTE_VAR ANY
UINT SIZE
ANY RD RD ANY
R_WRITE_1
R_WRITE
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
UINT CHANNEL_NO STATUS INT
Remote data write R_WRITE 16 P2-69
UDINT STATION_NO
UINT VAR_TYPE
ANY REMOTE_VAR REMOTE_VAR ANY
UINT SIZE
ANY SD SD ANY
2-47
Section 2 Programming Language Original FB
F_READ_1
F_READ
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
STATUS INT
File data read F_READ 16 P2-72
ANY FILE_NAME FILE_NAME ANY
UINT SIZE F_SIZE UINT
ANY RD RD ANY
F_WRITE_1
F_WRITE
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL
STATUS INT
File data write F_WRITE 16 P2-74
ANY FILE_NAME FILE_NAME ANY
UINT SIZE
ANY WD WD ANY
EXT_T_S_1
EXT_T_S
BOOL REQ DONE BOOL
Q BOOL Extension test & set EXT_T_S 14 P2-76
ERROR BOOL
STATUS INT
ANY IN IN ANY
FFST_1
FFST
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
STRUCT FCB FCB STRUCT Sequential file store FFST 12 P2-77
ARRAY IN IN ARRAY
UINT X_SIZE
UINT Y_SIZE
FIFO_1
FIFO
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
STRUCT FCB FCB STRUCT Sequential file load first FIFO 12 P2-78
ARRAY OUT OUT ARRAY
UINT X_SIZE
UINT Y_SIZE
FILO_1
FILO
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
STRUCT FCB FCB STRUCT Sequential file load last FILO 12 P2-79
ARRAY OUT OUT ARRAY
UINT X_SIZE
UINT Y_SIZE
Notes:
The FB with at an upper right corner in the name column are not supported by the SPH200s.
2-48
Section 2 Programming Language Original FB
FILTER_DINT_1
FILTER_DINT
BOOL RUN XOUT DINT
DINT XIN Filter FILTER_DINT 10 P2-80
TIME TAU
FILTER_REAL_1
FILTER_REAL
BOOL RUN XOUT REAL
REAL XIN Filter FILTER_REAL 10 P2-81
TIME TAU
INT_DINT_1
INT_DINT
BOOL RUN XOUT DINT
BOOL R1 Q BOOL Integrate INT_DINT 16 P2-82
DINT XIN
DINT X0
TIME I_T
INT_REAL_1
INT_REAL
BOOL RUN XOUT REAL
BOOL R1 Q BOOL Integrate INT_REAL 16 P2-83
REAL XIN
REAL X0
TIME I_T
DIF_DINT_1
DIF_DINT
BOOL RUN XOUT DINT Differentiate DIF_DINT 10 P2-84
DINT XIN
TIME D_T
DIF_REAL_1
DIF_REAL
BOOL RUN XOUT REAL Differentiate DIF_REAL 10 P2-85
REAL XIN
TIME D_T
PULSE_CNT_1
PULSE_CNT
BOOL RUN OUT INT Pulse count PULSE_CNT 12 P2-86
BOOL IN CMP BOOL
TIME DURATION
2-49
Section 2 Programming Language Original FB
PULSE_OUT_1
PULSE_OUT
BOOL RUN OUT BOOL
Pulse output PULSE_OUT 12 P2-86
TIME PERIOD CMP BOOL
INT COUNT
PWM_1
PWM
BOOL RUN OUT BOOL
Pulse PWM 10 P2-87
TIME PERIOD
TIME WIDTH
HW_RTC_1
HW_RTC
BOOL EN Q BOOL
Hardware RTC (Real-time clock) HW_RTC 10 P2-87
DT PDT CDT DT
T_S_1
T_S
ERROR BOOL
Test & set T_S 6 P2-88
BOOL IN IN BOOL
Q BOOL
BANK_CHG_1
BANK_CHG
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL Change bank BANK_CHG 14 P2-89
STATUS INT
BUSY BOOL
2-50
Section 2 Programming Language User ROM card expansion FB
No. of
FB name Function name Function description Page
steps
_F_WRITE_CSV_DINT Write CSV file Writes user variables (array) to a file on the
user ROM card in CSV format. 1.1K P2-91
_F_WRITE_CSV_DINT_LF Write CSV file
* (Long file name adapted)
_F_READ_CSV_DINT Read CSV file Reads a CSV-format file from the user ROM
card into user variables. 0.7K P2-94
_F_READ_CSV_DINT_LF Read CSV file
* (Long file name adapted)
_F_APPEND_CSV_DINT Append data to CSV file Appends a row of data to an existing CSV-
format file. 0.9K P2-97
_F_APPEND_CSV_DINT_LF Append data to CSV file
* (Long file name adapted)
_F_APPEND Append data to file Appends binary data to the end of a file on the
user ROM card. 0.6K P2-100
_F_APPEND_LF Append data to file
* (Long file name adapted)
_F_DELETE Delete file Deletes an existing file on the user ROM card.
_F_DELETE_LF Delete file 0.5K P2-102
* (Long file name adapted)
_F_OFFSET_READ Reading of a file with an Reads data in the user ROM card using the
offset offset position from the beginning of data and
read size. 0.4K P2-104
_F_OFFSET_READ_LF Reading of a file with an
* offset
(Long file name adapted)
_F_GET_DRV_SIZE Reading of the remaining Reads the total memory capacity and
capacity remaining capacity of the user ROM card 0.4K P2-107
mounted on CPU.
_F_CREATE_FILE_NAME File name creation Creates file names used for the file access
* library. The input of a number of STRING
0.4K P2-108
variables are concatenated, and output to F_
NAME, a WORD array variable.
* For the SPH2000 series, these FBs are only supported by CPUs whose software version is V08 or later.
Notes:
Only numbers can be written or read to/from a file. When including characters or spaces, an error occurs.
2-51
Section 2 Programming Language Standard FB
SR
SR
INPUT1 SET1 Q1 LAMP
Symbol
INPUT2 RESET
SR
BOOL SET1 Q1 BOOL
Set preference
SET1 RESET Q
1 * 1
0 1 0
0 0 Previous output
RS
RS
INPUT1 SET Q1 LAMP
Symbol
INPUT2 RESET1
RS
BOOL SET Q1 BOOL
INPUT1
(1) RS implements a reset set flip-flop.
Function
INPUT2
When SET1 and RESET inputs are LAMP
supplied at the same time, “RESET1”
(Reset Input) takes precedence over SET1.
RESET1 SET Q
1 * 0
0 1 1
0 0 Previous output
2-52
Section 2 Programming Language Standard FB
R_TRIG
R_TRIG
INPUT1 CLK Q LAMP
Symbol
R_TRIG
BOOL CLK Q BOOL <Operation>
INPUT1
(1) R_TRIG senses the rising edge of the
Function
LAMP
input and sets and holds the output as (“1”)
1 scan
for one scan period.
Note 1: The old value for an input “CLK” has a retain attribute assigned.
This means that at start-up (warm start), the retained old value is used.
At initial start-up (cold start) or download, it is reset to 0.
F_TRIG
F_TRIG
INPUT1 CLK Q LAMP
Symbol
F_TRIG
BOOL CLK Q BOOL <Operation>
INPUT1
(1) F_TRIG senses the falling edge of the LAMP
Function
Note 1: The old value for an input “CLK” has a retain attribute assigned.
This means that at start-up (warm start), the retained old value is used.
At initial start-up (cold start) or download, it is reset to 0.
2-53
Section 2 Programming Language Standard FB
CTU
CTU
INPUT1 CU Q LAMP
Symbol
INPUT2 RESET
CTU
BOOL CU Q BOOL INT#5 PV CV CURRENT
BOOL RESET
INT PV CV INT <Operation>
INPUT2
(1) CTU increments the current value “CV” by 1
Function
INPUT1
on the rising edge of the count input “CU.” 1 2 3 4 5
(2) When the current value “CV” exceeds
the preset value “PV,” an “Q” is set to “1.” INT#5
(Preset value)
Reset input
Count input CURRENT
Output Notes:
(3) The preset value can take on a value from 1) The current value for a count input has a retain attribute assigned.
0 to 32767. This means that at start-up (warm start), counting continues from the retained
old value. At initial start-up (cold start) or download, it is reset to 0.
(4) Counting continues up to the maximum
2) An “Q” value is the result of a comparison between PV and CV values. When
value (32767). This value will not be “RESET” = 0, the counted-up “Q” value is reset to 0 if a “PV” value is modified
exceeded. (increased).
(5) It is necessary to initially reset the count
value by supplying a RESET signal.
CTD
CTD
INPUT1 CD Q LAMP
Symbol
INPUT2 LOAD
CTD PV CV CURRENT
BOOL CD Q BOOL INT#5
BOOL LOAD
INT PV CV INT <Operation>
INPUT2
(1) CTD decrements the current value “CV” by
Function
INPUT1
1 2 3 4 5
1 on the falling edge of the count input “CD.”
(2) The “Q” is turned on when the current value
“CV” reaches the preset value “PV.” INT#5
Initialization input 0
CURRENT
Count input
Current value
Output
(3) The preset value can take on a value from LAMP
0 to 32767.
(4) Counting continues up to the minimum Note 1: The current value for a count input has a retain attribute assigned.
value (-32768). This value will not be This means that at start-up (warm start), counting continues from the
exceeded in the negative direction. retained old value. At initial start-up (cold start) or download, it is reset to 0.
(5) It is necessary to initialize the count value
initially by supplying a LOAD signal.
2-54
Section 2 Programming Language Standard FB
CTUD
CTUD
INPUT1 CU QU LAMP1
Symbol
INPUT2 CD QD LAMP2
INPUT3 RESET CV CURRENT
CTUD
BOOL CU QU BOOL INPUT4 LOAD
BOOL CD QD BOOL INT#5 PV
BOOL RESET CV INT
BOOL LOAD
INT PV
<Operation>
INPUT3
INPUT4
(1) CTUD increments the current value “CV”
Function
2-55
Section 2 Programming Language Standard FB
(8) Pulse TP
TP
TP
INPUT1 IN Q LAMP
Symbol
TIME#10s PT ET CURRENT
TP
BOOL IN Q BOOL
INPUT1
(1) TP starts its timer when “IN” is turned on
Function
LAMP
and holds the “Q” on until the preset time
“PT” is reached. The current time is output TIME#10s
in “ET.” CURRENT
0
Input “IN”
10 seconds
Output “Q”
Preset time “PT” Notes:
1) Precision of timer instructions
Current time “ET” When a timer instruction is executed, a +0 to +2 scan time error occurs to
update the elapsed time.
2) The timer compares between “PT” and “ET” values and outputs the
(2) The time base is 1 ms.
result into “Q” whenever “IN” is set to “1.” When the “PT” value is modified
(3) The preset time is as below. (increased) after time-up, “Q” is set to “1.” The timer continues its operation
0 to 4294967295ms from the current value.
(4) The “Q” will not turn on if the preset time is
set to 0.
TON
TON
INPUT1 IN Q LAMP
Symbol
TIME#10s PT ET CURRENT
TON
BOOL IN Q BOOL
INPUT1
(1) TON starts its on-delay timer when the “IN”
Function
LAMP
turns on and turns on the “Q” when the
preset time “PT” is reached. TIME#10s
The current time is output in “ET.”
CURRENT
(2) When the “IN” turns off, the current timer
value is set to 0 and the “Q” to OFF. 10 seconds
2-56
Section 2 Programming Language Standard FB
TOF
TOF
INPUT IN Q LAMP
Symbol
TIME#10s PT ET CURRENT
TOF
BOOL IN Q BOOL
INPUT1
(1) TOF turns on its “Q” to reset the current
Function
LAMP
value to 0 when the “IN” turns on.
When the input signal turns off, TOF starts TIME#10s
counting and turns off its output when the
CURRENT
preset time is reached.
10 seconds
Input “IN”
Output “Q” Notes:
1) Precision of timer instructions
Preset time
When a timer instruction is executed, a +0 to +2 scan time error occurs to
(2) The time base is 1ms. update the elapsed time.
2) Under a condition of “IN” = OFF, when “PT” exceeds “ET,” “Q” is set to “1,”
(3) The preset time is as below.
causing the timer to operate. When “ET” = “PT,” “Q” is set to “0.”
0 to 4294967295ms
(4) If the preset time is set to 0, the “Q” turns
off immediately when the “IN” turns off.
RTC
RTC
INPUT1 EN Q LAMP
Symbol
INPUT1
(1) Fetches the preset value “PDT” at the rising
Function
2-57
Section 2 Programming Language Original FB
RCT
RCT
INPUT1 CU Q LAMP
Symbol
INPUT2 RESET
RCT
BOOL CU Q BOOL INT#5 PV CV CURRENT
BOOL RESET
INT PV CV INT <Operation>
INPUT2
(1) RCT increments the current value “CV” by
Function
INPUT1
1 on the rising edge of the count input “CU.” 1 2 3 4 5 1 2 3 4 5 6
(2) The output signal “Q” is turned on when the
current value “CV” reaches the preset value INT#5
“PV.” The current value and output signal Preset value
are turned off on the rising edge of the next
count input. CURRENT
LAMP
Reset input
Count input Notes:
Current value 1) The current value for a count input has a retain attribute assigned.
This means that at start-up (warm start), counting continues from the retained
Output old value. At initial start-up (cold start) or download, it is reset to 0.
(3) The preset value can take on a value from 2) When a “PV” value is modified during operation, the output “Q” outputs the
result of comparison between ”PV” and “CV” values.
0 to 32767.
If the modified “PV” value lowers the “CV” value, “Q” is set to “1” and the “CV”
(4) It is necessary to reset the count value value is decreased to the “PV” value. Next time a “CU” value is entered, “CV”
initially by supplying a RESET signal. is set to 0.
2-58
Section 2 Programming Language Original FB
TMR
TMR
INPUT1 IN Q LAMP
Symbol
INPUT2 RESET
TMR ET CURRENT
BOOL IN Q BOOL TIME#5s PT
BOOL RESET
TIME PT ET TIME <Operation>
INPUT2
(1) TMR starts counting if an OFF-to-ON
Function
INPUT1
transition of input “IN” occurs when 2 seconds 3 seconds
“RESET” is off, and suspends counting
when the input signal turns off. TMR TIME#5s
resumes counting when the input is turned Preset value
on again.
(2) The output “Q” is turned on when the CURRENT
current value “ET” reaches the preset LAMP
value “PT.”
(3) The time base is 1ms. Notes:
(4) The preset time is as below. 1) The current value for a count input has a retain attribute assigned.
0 to 4294967295ms This means that at start-up (warm start), counting continues from the retained
old value. At initial start-up (cold start) or download, it is reset to 0.
2) Precision of timer instructions
When a timer instruction is executed, a +0 - +2 scan time error occurs to
update the elapsed time.
3) Under a condition of “IN” = 1, when “PT” is modified, an output “Q” compares
between new “PT” and “ET” values and outputs the result regardless of its
current output value. Setting “PT” smaller than “ET” causes “Q” to be set to
“1” and the “ET” value is the same as for “PT.”
2-59
Section 2 Programming Language Original FB
MR
MR
INPUT1 IN Q LAMP
Symbol
TIME#10s PT ET CURRENT
MR
BOOL IN Q BOOL
TIME PT ET TIME <Operation>
INPUT1
2-60
Section 2 Programming Language Original FB
M_OPEN M_RECEIVE.
<Terminal description>
Symbol
Input
M_OPEN EN_C: Requests open processing (a 0 to 1 transition requests open
BOOL EN_C VALID BOOL processing and a 1 to 0 transition requests close processing).
UINT MODULE_NO ERROR BOOL MODULE NO: SX bus station number of communication module to
UINT CHANNEL_NO STATUS INT transmit through.
CHANNEL_NO: Channel number within the communication module
UDINT STATION_NO CON_NO UINT
(0 if the module has only one channel).
UINT MODULE_TYPE STATION_NO: Station number of the destination module to
UINT MODE communicate with on the network (e.g., an IP address
UINT SUB_MODE on an Ethernet or a P-link station number on a P-link).
Has no meaning for in-configuration communication.
UINT RPORT_NO
MODULE_TYPE: Identifies the type of the destination communication
UINT SPORT_NO module.
0: Message communication with a module within
the configuration
M_OPEN is an FB(function block) for setting up 1: Message communication with a module outside
Function
2-61
Section 2 Programming Language Original FB
CPU0 (SX station number = 254) CPU1 (SX station number = 253)
M_OPEN M_OPEN
Port Port
UINT#254 MODULE_NO UINT#253 MODULE_NO
1) 10)
UINT#10 RPORT_NO UINT#1 RPORT_NO
UINT#1 SPORT_NO UINT#10 SPORT_NO
M_OPEN M_OPEN
2) 11)
UINT#254 MODULE_NO UINT#253 MODULE_NO
2-62
Section 2 Programming Language Original FB
Configuration A Configuration B
M_OPEN M_OPEN
Port Port
UINT#246 MODULE_NO UINT#246 MODULE_NO
UINT#0 STATION_NO UINT#63 STATION_NO
1) 10)
UINT#10 RPORT_NO UINT#1 RPORT_NO
UINT#1 SPORT_NO UINT#10 SPORT_NO
CPU1 CPU1
M_OPEN M_OPEN
2) 11)
UINT#246 MODULE_NO UINT#246 MODULE_NO
UINT#0 STATION_NO UINT#63 STATION_NO
Only when the general purpose communication mode of Ethernet is selected, one M_OPEN FB can be used for both M_SEND
and M_RECEIVE.
In other cases, prepare an M_OPEN FB for M_SEND and M_RECEIVE respectively.
2-63
Section 2 Programming Language Original FB
<Terminal description>
Name
M_SEND Input
REQ: Send request flag
CON_NO: Number of an open connection
Symbol
SIZE: The size in words of the variable for storing the send data
(Note)
M_SEND Output
BOOL REQ DONE BOOL DONE: Normal completion flag (set to 1 on completion of the send
UINT CON_NO ERROR BOOL and held for one scan period.)
STATUS INT ERROR: Error flag (set to 1 for one scan period when an error
ANY SD SD ANY *1) occurs)
UINT SIZE STATUS: Status
Input/output
SD: Variable for storing the send data.
Note: SIZE must be made equal to the size of the SD variable. Garbage
data will be appended to the end of the send data if the value of
M_SEND sends messages to a destination
Function
2-64
Section 2 Programming Language Original FB
<Terminal description>
Name
M_RECEIVE Input
EN_R: Receive enable
CON_NO: Number of an open connection
Symbol
SIZE: The size of the variable for storing the receive data (in words)
Output
M_RECEIVE NDR: Normal completion flag
BOOL EN_R NDR BOOL ERROR: Error flag
UINT CON_NO ERROR BOOL STATUS: Status
STATUS INT Input/output
ANY RD RD ANY *1) RD: Variable for storing the receive data.
UINT SIZE
<Status (STATUS) summary>
The status codes related to the M_RECEIVE FB are described below.
Refer to page 2-187 for the common status codes for FBs related with
the message transmission.
M_RECEIVE receives messages from a
Function
2-65
Section 2 Programming Language Original FB
<Terminal description>
Name
READ_WORD/READ_BOOL Input
REQ: Read request
SIZE: The size (in words or bits) of GLOBAL_VAR and RD
Symbol
READ_WORD variables
BOOL REQ DONE BOOL Input/output
UINT SIZE ERROR BOOL GLOBAL_VAR: Global variable assigned to the other resource to
STATUS INT be read (Note 7)
ANY *1 GLOBAL_VAR GLOBAL_VAR RD: Variable for storing the read data.
ANY *1 RD RD Output
DONE: Normal completion flag
*1: Any data type except BOOL type ERROR: Error flag
Array of any data type except BOOL type STATUS: Status
READ_BOOL
<Status (STATUS) summary>
BOOL REQ DONE BOOL The status codes related to the READ_WORD and READ_BOOL FBs
UINT SIZE ERROR BOOL are described below. Refer to page 2-187 for the common status codes
STATUS INT for FBs related with the message transmission.
BOOL *2 GLOBAL_VAR GLOBAL_VAR
BOOL *2 RD RD
(1) Global variable error (code: 176)
• The variable declared as GLOBAL_VAR is a variable that is assigned
*2: BOOL type or array of BOOL type
to the local CPU.
read variables from different resources • When an area for storing READ data is out of the memory area.
(CPU, etc). within the same configuration.
Normally, “LD” and “MOVE” are used to read (3) No free port (code: 201)
variables from resources on the same • When it is attempted to open a port exceeding the limit on the number
processor bus (these FBs may also be used). of port for one communication module.
(1) The variable designated by the (Direct read/write module also uses a communication port of the
“GLOBAL_VAR” is read into the variable module.)
area designated by the “RD” on the low to
high (0 to 1) transition of the “REQ.” (The
read does not end within one scan period).
(2) If the read is completed, the “DONE” is set
and held for one scan period.
(3) If the read is unsuccessful, the “ERROR” is
set and held for one scan period and an
error code is output in the “STATUS.”
Notes: Notes:
1) The “GLOBAL_VAR” and “RD” must be of 5) The uniqueness of the read data is guaranteed on a basic data type
the same data type. basis except STRING. The uniqueness of STRING type variables is
2) The “SIZE” to be used in READ_WORD not guaranteed. Access to an array or structure variable is
must be specified in words and that to be guaranteed only on an element or member basis.
used in “READ_BOOL” in bits. 6) If the number of data items specified by the “SIZE” is greater than
3) The “REQ” is active on rising edge. the size of the variable specified by “RD,” the area for other “SIZE”
However, any low to high transition of matches the size of the variable.
“REQ” occurring while data is being read 7) The global variable associated with “GLOBAL_VAR” for the resource
(from the time the “REQ” goes high until the in the mate system must be specified for both self- and mate-party
time the “DONE” or “ERROR” goes high) is resources to have the AT statement declared as a global variable.
invalid. 8) The FB completes processing on receipt of a response from the
4) Do not modify “RD” or “GLOBAL_VAR” destination (e.g., another CPU) of the FB's request. Depending on
during read processing. If one or both are the status of the destination, processing may not be completed
modified, the data that is read cannot be immediately. Therefore, write a program that allows for the time
guaranteed. required for normal or error completion if the next control operation
is performed on completion of the FB.
9) For SPH300, it is not possible to access the high-speed memory
with the direct instruction.
2-66
Section 2 Programming Language Original FB
WRITE_WORD/WRITE_BOOL Input
REQ: Write request
SIZE: The size (in words or bits) of GLOBAL_VAR and SD
Symbol
WRITE_WORD variables
BOOL REQ DONE BOOL Input/output
UINT SIZE ERROR BOOL GLOBAL_VAR: Global variable assigned to the other resource to
STATUS INT be written Note 7)
ANY *1 GLOBAL_VAR GLOBAL_VAR When data is written into the standby CPU in the 1
ANY *1 SD SD to 1 redundant system, the variable assigned to
self-resource
*1: Any data type except BOOL type SD: Variable for storing the data to be written
Array of any data type except BOOL type Output
DONE: Normal completion flag
ERROR: Error flag
WRITE_BOOL
BOOL REQ DONE BOOL
STATUS: Status
UINT SIZE ERROR BOOL
<Status (STATUS) summary>
STATUS INT
The status codes related to the WRITE_WORD and WRITE_BOOL
BOOL *2 GLOBAL_VAR GLOBAL_VAR
FBs are described below. Refer to page 2-187 for the common status
BOOL *2 SD SD codes for FBs related with the message transmission.
*2: BOOL type or array of BOOL type (1) Global variable error (code: 176)
• When the warm standby mode is not used in the 1 to 1 redundant syste
and the variable specified in GLOBAL_VAR has been assigned to the
WRITE_WORD and WRITE_BOOL are used to self-CPU.
Function
write variables of different resources • When the warm standby mode is used in the 1 to 1 redundant system
(CPU, etc.) within the same configuration. and the variable specified for GLOBAL_VAR is assigned to the
These instructions are not required when high-speed memory area of the self-CPU.
writing variables into resources on the same
processor bus (these FBs may also be used). (2) Parameter error (code: 177)
The WRITE_WORD instruction can be used to • A 0 is supplied to the SIZE terminal.
write data into the standby CPU in the warm (3) Transmission interlock error (code: 35)
standby mode in the redundant system. • When the mate-party module is interlocked.
This function equalizes variable data. Transmission interlock occurs when an instance screen opens by
(1) The variable area designated by the “SD” accompanying any operation such as download. In this case, retry it.
is written into the global variable area
(4) No free port (code: 201)
designated by the “GLOBAL_VAR” on the
• When it is attempted to open a port exceeding the limit on the number
low to high (0 to 1) transition of the “REQ.”
of port for one communication module.
(The write does not end within one scan
(Direct read/write module also uses a communication port of the module.)
period.)
(2) If the write is completed, the “DONE” is set
Notes:
and held for one scan period.
5) The uniqueness of the written data is guaranteed on a basic data type
(3) If the write is unsuccessful, the “ERROR” is
basis except STRING. The uniqueness of STRING type variables is not
set and held for one scan period and an guaranteed. Access to an array or structure variable is guaranteed only on
error code is output in the “STATUS.” an element or member basis. To equalize data into the standby CPU,
consistency may be assured until a “SIZE” value reaches 240.
Notes: 6) If the number of data items specified by the “SIZE” is greater than the size
1) The “GLOBAL_VAR” and “SD” must be of the of the variable specified by “GLOBAL_VAR,” the area for other variables
same data type. in the target module may be overridden. Make sure that the value of the
2) The “SIZE” to be used in WRITE_WORD “SIZE” matches the size of the variable.
must be specified in words and that to 7) The global variable associated with “GLOBAL_VAR” for the resource in
beused in “WRITE_BOOL” in bits. the mate system must be specified for both self- and mate-party
3) The “REQ” is active on rising edge. However, resources to have the AT statement declared as a global variable.
any low to high transition of “REQ” occurring 8) The WRITE_BOOL instruction cannot be used for memory in the
while data is being written (from the time the P/PE-link module.
“REQ” goes high until the time the “DONE” or 9) The FB completes processing on receipt of a response from the
“ERROR” goes high) is invalid. destination (e.g., another CPU) of the FB's request. Depending on the
4) Do not modify “SD” or “GLOBAL_VAR” status of the destination, processing may not be completed immediately.
during write processing. If one or both are Therefore, write a program that allows for the time required for normal or
modified, the data that is written cannot be error completion if the next control operation is performed on completion of
guaranteed. the FB.
10) For SPH300, it is not possible to access the high-speed memory with the
direct instruction.
2-67
Section 2 Programming Language Original FB
R_READ Input
REQ: Read request
MODULE_NO: SX bus station number of the communication Module
R_READ CHANNEL_NO: Channel number of the communication module
BOOL REQ DONE BOOL STATION_NO: Network station number of the source station
UINT MODULE_NO ERROR BOOL VAR_TYPE: Variable specification method (Refer to page 2-186.)
UINT CHANNEL_NO STATUS INT SIZE: The size (in words) of variables storing the data to be read
UDINT STATION_NO and the read data
UINT VAR_TYPE
Output
DONE: Normal completion flag
*1) ANY REMOTE_VAR REMOTE_VAR ANY *3)
ERROR: Error flag
UINT SIZE
STATUS: Status
*2) ANY RD RD ANY *3) Input/output
REMOTE_VAR: Read address (Refer to page 2-186.)
*1: Array of any data type except BOOL type RD: Variable for storing the read data.
*2: Any data type except BOOL type
Array of any data type except BOOL type <Status (STATUS) summary>
The status codes related to the R_READ FB are described below.
R_READ reads data in the direct addressing Refer to page 2-187 for the common status codes for FBs related with
Function
2-68
Section 2 Programming Language Original FB
R_WRITE Input
REQ: Write request
MODULE_NO: Communication module number
Symbol
2-69
Section 2 Programming Language Original FB
<VAR_TYPE formats>
* The memory type is the code for identifying standard memory, retain memory, etc., in user memory. It is the second column
value in addressing (AT statement) any other CPU memory.
%MW 1.1.2893
Name Memory type code
Relative address
Standard memory 1
Memory type
Retain memory 3
CPU number
User FB memory 5
System FB memory 9
System memory 10
2-70
Section 2 Programming Language Original FB
2-71
Section 2 Programming Language Original FB
<Function>
F_READ reads a file from a memory module in the configuration or from a PC card interface module containing a memory
card.
(1) The file designated by the “FILE_NAME” is read from the memory module or PC card interface module designated by the
“MODULE_NO” into the variable area designated by the “RD” on a low to high (0 to 1) transition of the “REQ.” (The read
does not end within one scan period.)
(2) If the read is completed, the “DONE” is set and held for one scan period.
(3) If the read is unsuccessful, the “ERROR” is set and held for one scan period and an error code is output in the "STATUS.”
Notes:
1) The “FILE_NAME” must specify a file name in Shift-JIS code.
2) The “REQ” is active on rising edge. However, any low to high transition of “REQ” occurring while the file is being read
(from the time the “REQ” goes high until the time the “DONE” or “ERROR” goes high) is invalid.
3) Do not modify “RD” or “FILE_NAME” during read processing. The integrity of the read data is not guaranteed if the state
of this signal is changed.
4) If the number of data items specified by the “SIZE” is greater than the size of the variable specified by “RD,” the area for
other variables may be overridden. Make sure that the value of the “SIZE” is equal to or smaller than the size of the
variable.
5) Do not use the memory card if the module for storing an application program for the n to 1 redundant mode for file
memory for file data read/write access is from a CPU application program. Prepare another memory card if the module is
for file read/write. If the memory card of module is shared, a contention occurs in accessing, and switching cannot be
performed between the working and standby CPUs in the redundant mode.
6) Be careful so that no compile error will occur even when BOOL type array variable is used for “RD.”
7) The FB completes processing on receipt of a response from the
destination (e.g., another CPU) of the FB's request. Depending on the status of the destination, processing may not be
completed immediately. Therefore, write a program that allows for the time required for normal or error completion if the
next control operation is performed on completion of the FB.
<Programming example>
The sample program shown below reads a file with a file name of “E:\err_log.log” into the 1000-word variable “RD_DT.”
It is assumed that the SX bus station number of the module containing the memory card is “4.”
F_READ_1
F_READ
SW REQ DONE FR_DONE
UINT#4 MODULE_NO ERROR FR_ERR
STATUS FR_STA
F_NAME FILE_NAME FILE_NAME F_NAME
UINT#1000 SIZE F_SIZE FR_SIZE
RD_DT RD RD RD_DT
2-72
Section 2 Programming Language Original FB
2-73
Section 2 Programming Language Original FB
<Function>
F_WRITE writes a file to a memory module in the configuration or to a PC card interface module containing a memory card.
(1) The data designated by the “WD” is written from the memory module or PC card interface module designated by the
“MODULE_NO” into the file designated by the “FILE_NAME” on a low to high (0 to 1) transition of the “REQ.” (The write
does not end within one scan period.)
(2) If the write is completed, the “DONE” is set and held for one scan period.
(3) If the write is unsuccessful, the “ERROR” is set and held for one scan period and an error code is output in the “STATUS.”
Notes:
1) The “FILE_NAME” must specify a file name in Shift-JIS code.
2) The “REQ” is active on rising edge. However, any low to high transition of “REQ” occurring while thefile is being written
(from the time the “REQ” goes high until the time the “DONE” or “ERROR” goes high) is invalid.
3) The state of the “WD” must not be changed while a file is being written. The integrity of the write data is not guaranteed if
the state of this signal is changed.
4) An existing file that has the same name is overwritten.
5) If the number of data items specified by the “SIZE” is greater than the size of the variable specified by “WD,” the extra
data in the unpredictable state is written into the file. Make sure that the value of the “SIZE” is equal to or smaller than the
size of the variable.
6) Do not use the memory card if the module for storing an application program for the n to 1 redundant mode for file memory
for file data read/write access is from a CPU application program. Prepare another memory card if the module is for file
read/write. If the memory card of module is shared, a contention occurs in accessing, and switching cannot be performed
between the working and standby CPUs in the redundant mode.
7) Be careful so that no compile error will occur even when BOOL type array variable is used for “WD.”
8) The FB completes processing on receipt of a response from the destination (e.g., another CPU) of the FB’s request.
Depending on the status of the destination, processing may not be completed immediately. Therefore, write a program
that allows for the time required for normal or error completion if the next control operation is performed on completion of
the FB.
<Programming example>
The sample program shown below writes the contents of “WT_DT” into a file with a file name of “E:\err_log.log.” It is assumed
that the SX bus station number of the module containing the memory card is “4.”
F_WRITE_1
F_WRITE
SW REQ DONE FW_DONE
UINT#4 MODULE_NO ERROR FW_ERR
STATUS FW_STA
F_NAME FILE_NAME FILE_NAME
UINT#1000 SIZE
WT_DT WD WD
2-74
Section 2 Programming Language Original FB
2-75
Section 2 Programming Language Original FB
EXT_T_S Input
REQ: Test & set request
Input/output
Symbol
when the bit variable to be used to implement When this instruction is used for memory in the P/PE-link module.
a semaphore is assigned to the memory of
a module on a different processor bus. <Programming example>
The sample program shown below acquires a semaphore when the
(1) EXT_T_S tests and sets the global bit state of “SEMA_REQ” is changed from 0 to 1. “SEMA_GET” is set to 1
variable area designated by the “IN” on a when the processing is completed. The instruction retries if the
low to high (0 to 1) transition of the “REQ.” processing is unsuccessful. The EXT_T_S releases the semaphore
(This processing does not end within one when the state of “REL_SEMA” is switched from 0 to 1. “SEMA_GET”
scan period.) is set to 0 when the release processing is completed.
(2) If the test & set is completed, the “DONE”
is set and held for one scan period and the <Getting a semaphore>
result is output in the “Q.”
(3) If the test & set is unsuccessful, the EXT_T_S
“ERROR” is set and held for one scan SEMA_REQ REQ DONE T_S_DONE
period and an error code is output in the Q T_S_Q
“STATUS.” ERROR T_S_ERR
STATUS T_S_STA
Notes: SEMA IN IN
1) The WRITE_BOOL instruction must be
used to reset set data.
BOOL#0 SEMA_REQ
2) The “REQ” is active on rising edge.
However, any low to high transition of
T_S_Q T_S_DONE SEMA_REQ
“REQ” occurring during test & set process-
ing (from the time the input “REQ” goes
high until the time the “DONE” or “ERROR” T_S_Q T_S_DONE SEMA_GET
goes high) is invalid. S
3) Use the T_S instruction if the bit variable to
be used to implement a semaphore is
connected to the same processor bus or the <Releasing a semaphore>
local CPU.
4) Do not use this instruction for memory in WRITE_BOOL
the P/PE-link module. The execution REL_SEMA REQ DONE WB_DONE
terminates abnormally with an invalid FB UINT#1 SIZE ERROR WB_ERR
result. STATUS WB__STA
5) In the redundant system, to pass data to the SEMA GLOBAL_VAR GLOBAL_VAR
bit variables used for semaphores at BOOL#0 SD SD
changeover between the working and
standby CPUs:
WB_DONE SEMA_GET
• Assign the bit variables for semaphores
R
to the standard memory area to avoid
equalization. (They are reset to 0 at
changeover.)
• When changeover occurs, make an
attempt to get semaphores again.
2-76
Section 2 Programming Language Original FB
FFST
RE_TRIG FFST
FLAG CLK Q ENABLE ERROR ERR
Symbol
2-77
Section 2 Programming Language Original FB
FIFO
(3) (4) (5) (6)
Symbol
2-78
Section 2 Programming Language Original FB
FILO
Symbol
2-79
Section 2 Programming Language Original FB
FILTER_DINT
FILTER_DINT
INPUT1 RUN XOUT OUTPUT
Symbol
INPUT2 XIN
TIME#50ms TAU
FILTER_DINT
BOOL RUN XOUT DINT
<Operation>
DINT XIN
TIME TAU
INPUT1
INPUT2
(1) FILTER_DINT filters the “XIN” and outputs
Function
2-80
Section 2 Programming Language Original FB
FILTER_REAL
FILTER_REAL
INPUT1 RUN XOUT OUTPUT
Symbol
INPUT2 XIN
TIME#50ms TAU
FILTER_REAL
BOOL RUN XOUT REAL
<Operation>
REAL XIN
TIME TAU
INPUT1
INPUT2
(1) FILTER_REAL filters the “XIN” and
Function
2-81
Section 2 Programming Language Original FB
INT_DINT
INT_DINT
INPUT1 RUN XOUT OUTPUT1
Symbol
INPUT2 R1 Q OUTPUT2
INPUT1
INPUT2
(1) INT_DINT integrates the “XIN” and
Function
2-82
Section 2 Programming Language Original FB
INT_REAL
INT_REAL
INPUT1 RUN XOUT OUTPUT1
Symbol
INPUT2 R1 Q OUTPUT2
INPUT3 XIN
INT_REAL
BOOL RUN XOUT REAL INPUT4 X0
BOOL R1 Q BOOL TIME#50ms I_T
REAL XIN
REAL X0
<Operation>
TIME I_T
INPUT1
INPUT2
(1) INT_REAL integrates the “XIN” and
Function
2-83
Section 2 Programming Language Original FB
DIF_DINT
DIF_DINT
INPUT1 RUN XOUT OUTPUT1
Symbol
INPUT2 XIN
TIME#50ms D_T
DIF_DINT
BOOL RUN XOUT DINT
DINT XIN
<Operation>
TIME D_T
INPUT1
2-84
Section 2 Programming Language Original FB
DIF_REAL
DIF_REAL
INPUT1 RUN XOUT OUTPUT1
Symbol
INPUT2 XIN
TIME#50ms D_T
DIF_REAL
BOOL RUN XOUT REAL
REAL XIN
<Operation>
TIME D_T
INPUT1
2-85
Section 2 Programming Language Original FB
PULSE_CNT
PULSE_CNT
INPUT1 RUN OUT COUNT
Symbol
INPUT1
(1) When a “RUN” is set to “ON,” the pulses INPUT2
Function
PULSE_OUT
PULSE_OUT
INPUT RUN OUT LAMP1
Symbol
INPUT
(1) When the “RUN” is set to on, PULSE_OUT
Function
OUT
outputs as many pulses of “PERIOD” 2s COUNT=4
period as specified by “COUNT.”
CMP
The “CMP” turns on when the pulse is
completed. When the “RUN” is set to off,
the “CMP” is turned off. Notes:
(2) PULSE_OUT stops the generation of 1) The period of “OUT” has an error +0 to +4 in scan time compared
pulses when the “RUN” is set to OFF. with “PERIOD.”
(3) When “COUNT” <= 0, pulses continue to be 2) Specify sufficiently longer time for the preset period “PERIOD”
output while a “RUN” is set to “ON.” compared with the period for instruction execution at two times or
(4) The duty factor of the “OUT” is 1 to 1. more).
2-86
Section 2 Programming Language Original FB
PWM
PWM
INPUT RUN OUT OUTP
Symbol
TIME#3s PERIOD
PWM
BOOL RUN OUT BOOL TIME#1s WIDTH
TIME PERIOD
TIME WIDTH
<Operation>
RUN
(1) PWM outputs pulses of the duration
Function
1s
“WIDTH” at the period “PERIOD” when the OUTP
“RUN” is set to on. The output is stopped
3s
when the “RUN” is set to OFF.
(2) Do not set “PERIOD” <= “WIDTH;”
otherwise, no “OUT” is output. Notes:
Similarly, when "WIDTH” = 0, no “OUT” is 1) Since it processes clocking in the same manner as that for the timer
output. instruction, an error +0 to +2 in scan time occurs.
2) Specify the values that satisfy the following condition for “PERIOD”
and “WIDTH.”
“PERIOD” - “WIDTH” > (a period for one instruction execution)
HW_RTC
HW_RTC
BOOL#1 EN Q OUTPUT1
Symbol
2-87
Section 2 Programming Language Original FB
T_S
T_S
ERROR T_S_ERR
Symbol
T_S INPUT IN IN
ERROR BOOL Q OUTPUT
BOOL IN IN BOOL *1)
Q BOOL
<Operation>
This FB is used when a resource is to be shared by two or more tasks.
Since “INPUT” serves as a semaphore bit for the resource, it needs to
be assigned to a global variable. The flag indicating whether the
(1) T_S sets the variable “IN” (of BOOL type) to resource is obtained successfully is output on “OUTPUT.”
Function
2-88
Section 2 Programming Language Original FB
BANK_CHG Input
REQ: Bank change request flag
MODULE_NO: SX bus station number of the P/PE link module for
Symbol
Notes:
1) Two or more bank change FBs may be
programmed for one CPU. The sequence
of processing from the issuance of a
change request to the verification of the
completion of bank change must be carried
out within a single FB.
2) Install the CPU module and interprocessor
link module, between which the bank is to
be changed, on the same processor bus
(on the same base). When they are not
installed on the same processor bus, an
error occurs during application program
execution if this FB is executed.
2-89
Section 2 Programming Language User ROM card expansion FB
* For the SPH2000 series, these FBs are only supported by CPUs whose software version is V08 or later.
Notes:
Only numbers can be written or read to/from a file. When including characters or spaces, an error occurs.
2-90
Section 2 Programming Language User ROM card expansion FB
2-4-5-2 FB specifications
(1) CSV file write _F_WRITE_CSV_DINT/_F_WRITE_CSV_DINT_LF
These FBs write data in SPH_CPU to the specified file in the specified folder in the user ROM card in CSV format (overwrite).
1) FB format
Parameter Parameter
_F_WRITE_CSV_DINT
Write request (BOOL) REQ DONE (BOOL) Write end
_F_WRITE_CSV_DINT_LF
Write request (BOOL) REQ Note) DONE (BOOL) Write end
2) Operation specifications
(1) At the rising edge of “REQ,” data is written. When the writing is successfully completed, “DONE” is set ON for one scan.
If it is unsuccessfully completed, “ERROR” is set ON for one scan, and the cause of the error is output in “STATUS.”
(2) If the specified folder or file does not exist, a new folder or file is created.
(3) A title can be specified at the head of the CSV file (set in “TITLE”), and a subtitle on the second row (set in “SUB_TITLE”).
(4) Prepare data to write as an array of DINT type. It is written in the CSV file format for the size specified by “ROW” and “COL.”
Notes:
Do not change the value of the I/O variables (“FILE_NAME,” “TITLE,” “SUB_TITLE” and “WD”) during the FB operation.
If changed, the values written to the file cannot be guaranteed.
2-91
Section 2 Programming Language User ROM card expansion FB
Memory capacity
Memory name
_F_WRITE_CSV_DINT _F_WRITE_CSV_DINT_LF
Program memory Approx. 1.1K steps Approx. 1.1K steps
Standard or retain memory Approx. 2600 words Approx. 2670 words
User FB instance memory Approx. 180 words Approx. 180 words
System FB instance memory Approx. 170 words Approx. 170 words
* The memory capacity in the table above includes memory capacity for sub-FBs.
Notes:
For the SPH2000 series CPUs whose software versions are V07 or earlier, a file name can be up to 8 characters plus a
3-character extension. The following characters cannot be used: “ * , / : < = > ? \ |
2-92
Section 2 Programming Language User ROM card expansion FB
5) Sample program
SD
COMPACTFLASH or
FILE NAME
TITLE
SUB_TITLE
Data
2-93
Section 2 Programming Language User ROM card expansion FB
1) FB format
Parameter Parameter
_F_READ_CSV_DINT
Read request (BOOL) REQ DONE (BOOL) Read end
_F_READ_CSV_DINT_LF
Note)
Read request (BOOL) REQ DONE (BOOL) Read end
2) Operation specifications
(1) At the rising edge of “REQ,” data is read. If the reading is successfully completed, “DONE” is set ON for one scan.
If it is unsuccessfully completed, “ERROR” is set ON for one scan, and the cause of the error is output in “STATUS.”
(2) For the read data, specify the row position and the number of columns of data per row (multiple rows cannot be read). The
read data is stored in “RD” in DINT format.
Notes:
Do not change the value of the I/O variables (“FILE_NAME” and “RD”) during the FB operation.
If changed, the values read from the file cannot be guaranteed.
Memory capacity
Memory name
_F_READ_CSV_DINT _F_READ_CSV_DINT_LF
Program memory Approx. 0.7K steps Approx. 0.7K steps
Standard or retain memory Approx. 290 words Approx. 350 words
User FB instance memory Approx. 130 words Approx. 130 words
System FB instance memory Approx. 60 words Approx. 60 words
* The memory capacity in the table above includes memory capacity for sub-FBs.
2-94
Section 2 Programming Language User ROM card expansion FB
Notes:
For the SPH2000 series CPUs whose software versions are V07 or earlier, a file name can be up to 8 characters plus a
3-character extension. The following characters cannot be used: “ * , / : < = > ? \ |
2-95
Section 2 Programming Language User ROM card expansion FB
5) Sample program
2-96
Section 2 Programming Language User ROM card expansion FB
1) FB format
Parameter Parameter
_F_APPEND_CSV_DINT
Append request (BOOL) REQ DONE (BOOL) Append end
No. of columns to append (UINT) COL FILE_BYTE_SIZE (UDINT) File size after append
_F_APPEND_CSV_DINT_LF
Note)
Append request (BOOL) REQ DONE (BOOL) Append end
No. of columns to append (UINT) COL FILE_BYTE_SIZE (UDINT) File size after append
2) Operation specifications
(1) At the rising edge of “REQ,” data is appended. When the writing is successfully completed, “DONE” is set ON for one
scan. If it is unsuccessfully completed, “ERROR” is set ON for one scan.
(2) One row of data that consists of the specified number of columns (specified in “COL”) is appended to the CSV file.
Notes:
Do not change the value of the I/O variables (“FILE_NAME” and “WD”) during the FB operation.
If changed, the values appended to the file cannot be guaranteed.
Memory capacity
Memory name
_F_APPEND_CSV_DINT _F_APPEND_CSV_DINT_LF
Program memory Approx. 0.9K steps Approx. 0.9K steps
Standard or retain memory Approx. 290 words Approx. 350 words
User FB instance memory Approx. 150 words Approx. 150 words
System FB instance memory Approx. 120 words Approx. 120 words
* The memory capacity in the table above includes memory capacity for sub-FBs.
2-97
Section 2 Programming Language User ROM card expansion FB
Notes:
For the SPH2000 series CPUs whose software versions are V07 or earlier, a file name can be up to 8 characters plus a
3-character extension. The following characters cannot be used: “ * , / : < = > ? \ |
2-98
Section 2 Programming Language User ROM card expansion FB
5) Sample program
WA_DATA
WD_DATA(0) 123
WD_DATA(1) 456
WD_DATA(2) 789
| 111
| 222
| 333
SD
COMPACTFLASH or
Final row
2-99
Section 2 Programming Language User ROM card expansion FB
1) FB format
Parameter Parameter
_F_APPEND
Append request (BOOL) REQ DONE (BOOL) Append end
_F_APPEND_LF
Note)
Append request (BOOL) REQ DONE (BOOL) Append end
Append data size (UDINT) SIZE FLE_BYTE_SIZE (UDINT) File size after append
2) Operation specifications
(1) At the rising edge of “REQ,” data is appended. When the append is successfully completed, “DONE” is set ON for one scan.
If it is unsuccessfully completed, “ERROR” is set ON for one scan, and the cause of the error is output in “STATUS.”
(2) If the specified folder or file does not exist, a new folder or file is created.
Notes:
Do not change the value of the I/O variables (“FILE_NAME” and “WD”) during the FB operation.
If changed, the values appended to the file cannot be guaranteed.
Memory capacity
Memory name
_F_APPEND _F_APPEND_LF
Program memory Approx. 0.6K steps Approx. 0.6K steps
Standard or retain memory Approx. 1090 words Approx. 1150 words
User FB instance memory Approx. 90 words Approx. 90 words
System FB instance memory Approx. 80 words Approx. 80 words
* The memory capacity in the table above includes memory capacity for sub-FBs.
2-100
Section 2 Programming Language User ROM card expansion FB
Notes:
For the SPH2000 series CPUs whose software versions are V07 or earlier, a file name can be up to 8 characters plus a
3-character extension. The following characters cannot be used: “ * , / : < = > ? \ |
2-101
Section 2 Programming Language User ROM card expansion FB
1) FB format
Parameter Parameter
_F_DELETE
Delete request (BOOL) REQ DONE (BOOL) Delete end
_F_DELETE_LF
Note)
Delete request (BOOL) REQ DONE (BOOL) Delete end
2) Operation specifications
(1) At the rising edge of “REQ,” the file is deleted. When the deletion is successfully completed, “DONE” is set ON for one scan.
If it is unsuccessfully completed, “ERROR” is set ON for one scan, and the cause of the error is output in “STATUS.”
Notes:
Do not change the value of “FILE_NAME” during the FB operation.
If changed, the values appended to the file cannot be guaranteed.
Memory capacity
Memory name
_F_DELETE _F_DELETE_LF
Program memory Approx. 0.5K steps Approx. 0.5K steps
Standard or retain memory Approx. 80 words Approx. 150 words
User FB instance memory Approx. 50 words Approx. 50 words
System FB instance memory Approx. 50 words Approx. 50 words
* The memory capacity in the table above includes memory capacity for sub-FBs.
2-102
Section 2 Programming Language User ROM card expansion FB
Notes:
For the SPH2000 series CPUs whose software versions are V07 or earlier, a file name can be up to 8 characters plus a
3-character extension. The following characters cannot be used: “ * , / : < = > ? \ |
2-103
Section 2 Programming Language User ROM card expansion FB
1) FB format
Parameter Parameter
_F_OFFSET_READ
Read request (BOOL) REQ DONE (BOOL) Read end
Read start offset (UDINT) BYTE_OFFSET DONE_BYTE_SIZE (UDINT) Read data size
_F_OFFSET_READ_LF
Note)
Read request (BOOL) REQ DONE (BOOL) ead end
Read start offset (UDINT) BYTE_OFFSET DONE_BYTE_SIZE (UDINT) Read data size
2) Operation specifications
(1) At the rising edge of “REQ,” data is read. If the reading is successfully completed, “DONE” is set ON for one scan.
If it is unsuccessfully completed, “ERROR” is set ON for one scan, and the cause of the error is output in “STATUS.”
(2) For the read data, specify the offset position from the head of the data (in bytes) and read size (in words).
(3) The read data is an array of DINT. Upper and lower data are reversed.
Notes:
Do not change the value of the I/O variables (“FILE_NAME” and “RD”) during the FB operation.
If changed, the values read from the file cannot be guaranteed.
Memory capacity
Memory name
_F_OFFSET_READ _F_OFFSET_READ_LF
Program memory Approx. 0.4K steps Approx. 0.4K steps
Standard or retain memory Approx. 1100 words Approx. 1150 words
User FB instance memory Approx. 70 words Approx. 70 words
System FB instance memory Approx. 20 words Approx. 20 words
2-104
Section 2 Programming Language User ROM card expansion FB
Error exit ERROR BOOL Output Set On for one scan if the file read is unsuccessfully completed.
Status STATUS DWORD Output Outputs a status in DWORD that indicates the cause of the error if
the file read is failed, .
* See “9) Error status” for details.
Read data size DONE_ UDINT Output Displays the size of the read data in bytes.
BYTE_SIZE
Notes:
For the SPH2000 series CPUs whose software versions are V07 or earlier, a file name can be up to 8 characters plus a
3-character extension. The following characters cannot be used: “ * , / : < = > ? \ |
2-105
Section 2 Programming Language User ROM card expansion FB
5) Sample program
SD
COMPACTFLASH or
2-106
Section 2 Programming Language User ROM card expansion FB
1) FB format
Parameter Parameter
_F_GET_DRV_SIZE
Read request (BOOL) REQ DONE (BOOL) Read end
2) Operation specifications
(1) At the rising edge of “REQ,” data is read. If the reading is successfully completed, “DONE” is set ON for one scan.
If it is unsuccessfully completed, “ERROR” is set ON for one scan, and the cause of the error is output in “STATUS.”
2-107
Section 2 Programming Language User ROM card expansion FB
1) FB format
Parameter Parameter
_F_CREATE_FILE_NAME
File name Note)
creation request (BOOL) REQ ERROR (BOOL) Creation error
Concatenated Concatenated
character string 1 (STRING) F_NAME_1 F_NAME_1 (STRING) character string 1
(Head)
Concatenated Concatenated
character string 2 (STRING) F_NAME_2 F_NAME_2 (STRING) character string 2
Concatenated Concatenated
character string 3 (STRING) F_NAME_3 F_NAME_3 (STRING) character string 3
Concatenated Concatenated
character string 4 (STRING) F_NAME_4 F_NAME_4 (STRING) character string 4
Concatenated Concatenated
character string 5 (STRING) F_NAME_5 F_NAME_5 (STRING) character string 5
Concatenated Concatenated
character string 6 (STRING) F_NAME_6 F_NAME_6 (STRING) character string 6
(End)
Created file name Created file name
(Including directory (_F_TP_FNAME_LF_DATA) F_NAME_OUT F_NAME_OUT (_F_TP_FNAME_LF_DATA) (Including directory
name) name)
2) Operation specifications
(1) At the rising edge of “REQ,” the inputs of STRING variables connected to the terminals F_NAME1 to F_NAME6 are
concatenated and the file name is output in the WORD array variable “F_NAME_OUT.” If it is unsuccessfully completed,
“ERROR” is set ON for one scan.
Concatenated
character string 6 F_NAME_6
Error exit ERROR BOOL Output Set ON if the number of specified file name exceeds 255
characters and remains ON until the next FB execution is
completed normally.
Created file name F_NAME_OUT _F_TP_FNAME_ I/O Stores the concatenated file name in shift JIS code.
LF_ARRAY
2-108
Section 2 Programming Language User ROM card expansion FB
5) Sample program
An example of a file access program combined with a file name creation FB is given below. Be sure not to change information
(i.e., the file name and write data) that is input into the file access FB while the file is being written.
SEL_UINT
EN END
(*Processing bit creation*) (*Write bit is TRUE for one scan period only*)
Write Name creation Write
004 execution failure In process 003 FALSE execution
/ S
Name creation
Write DONE failure In process
/ R
Write ERR
2-109
Section 2 Programming Language User ROM card expansion FB
2-110
Section 2 Programming Language FCT
Function name
LEFT
STRING STRING Get left sub-string LEFT 10 P2-213
UNIT
SEL_INT
BOOL G INT
INT IN0
INT IN1 Select SEL_INT 8 P2-173
Notes:
1) The number of steps depends on the operands used. Consequently, the number of steps of array variables will be greater
than that of scalar variables.
2) The number of extended inputs is a maximum of 16 (only for SPH).
3) D300win do not check the data type of the terminals associated with functions ANY and ANY_OF_WORD. Be sure to use
the data types appropriate for individual functions, following their detailed descriptions.
2-111
Section 2 Programming Language FCT
1) 1-input function
LD “Input”
SQRT
ST “Area for storing operation result”
2) 2-input function
LD “First input”
LEFT “Second input”
ST “Area for storing operation result”
3) 3-input function
LD “First input”
SEL “Second input,” “Third input”
ST “Area for storing operation result”
Note: You cannot specify, in the IL language, any function that has the same mnemonic as an IL instruction (e.g. ADD).
Instructions such as “ADD” must always have two fixed inputs when they are to be used in the IL language.
ADD LD IN1
IN1 OUT
ADD IN2
IN2
ADD IN3
IN3
ADD IN4
IN4
ADD IN5
IN5
ST OUT
2-112
Section 2 Programming Language FCT
ADD MUL
START EN ENO EN ENO FLAG
IN1 OUT
IN2 IN3
Associate a BOOL type operation condition variable with the EN terminal. When the variable associated with the EN terminal is
TRUE (“1”), arithmetical operations are executed, while when FALSE (“0”), they are not performed. (In the above example, an
OUT value remains unchanged.) A TRUE or FALSE value for the operation is output to the ENO terminal. When ENO is TRUE
(“1”), the operation has been normally done and when FALSE (“0”), an error has occurred in the operation.
<Enabling/disabling EN/ENO>
Execute the “Option” command shown in the D300win extended menu. The “Options” dialog box appears. Click the “Graphic
Editor” tab with the left-mouse button, check the EN/ENO function, and double-click the “OK” button with the left-mouse button,
since any function added is shown with EN/ENO enabled on a worksheet. To disable EN/ENO, use the same procedure.
2-113
Section 2 Programming Language FCT
ADD
START EN ENO FLAG
IN1 OUT
IN2
2) When a variable is associated only with the EN terminal, the number of steps increases by two.
ADD
START EN ENO
IN1 OUT
IN2
3) When a variable is associated only with the ENO terminal, the number of steps increases by two.
ADD
EN ENO FLAG
IN1 OUT
IN2
4) When a variable is associated with neither the EN nor ENO terminal, the number of steps is the same as with EN/ENO
disabled.
ADD
EN ENO
IN1 OUT
IN2
LDE START
ADD ADD
START EN ENO FLAG LD INPUT1 START EN ENO FLAG
IN1 OUT ADD INPUT2 IN1 OUT
Upload ST OUT IL-LD/FBD
IN2 conversion
IN2
STE FLAG
Notes:
To upload functions in D300win V2, connect both of the EN/ENO terminals.
2-114
Section 2 Programming Language FCT
User function
A MOVE
EN ENO
S1 S2
MOVE MOVE
B EN ENO EN ENO
C
S3 S4
MOVE MOVE
B EN ENO EN ENO
S3 S4
MOVE MOVE
B EN ENO EN ENO
S3 S30 S30 S4
2-115
Section 2 Programming Language Type conversion FCT
Arithmetic functions
Selection/comparison functions
String functions
2-116
Section 2 Programming Language Type conversion FCT
2-117
Section 2 Programming Language Type conversion FCT
2-118
Section 2 Programming Language Type conversion FCT
2-119
Section 2 Programming Language Type conversion FCT
2-120
Section 2 Programming Language Arithmetic FCT
2) Arithmetic functions
ADD
ANY_NUM ANY_NUM
ANY_NUM No. of input
• Addition ADD P2-160
•
operands + 1
•
ANY_NUM
2-121
Section 2 Programming Language Arithmetic FCT
SUB
ANY_NUM ANY_NUM Subtraction SUB 3 P2-161
ANY_NUM
MUL
ANY_NUM ANY_NUM
ANY_NUM No. of input
Multiplication MUL P2-161
• operands + 1
•
•
ANY_NUM
DIV
ANY_NUM ANY_NUM Division DIV 3 P2-162
ANY_NUM
MOD
ANY_INT ANY_INT Division remainder MOD 4 P2-162
ANY_INT
EXPT
REAL REAL Exponent EXPT 3 P2-163
REAL
2-122
Section 2 Programming Language Bit string FCT
SHL _WORD
WORD IN WORD Shift left SHL _WORD 3 P2-165
UINT N
SHL _DWORD
DWORD IN DWORD Shift left SHL _DWORD 3 P2-165
UINT N
SHR _WORD
WORD IN WORD Shift right SHR _WORD 3 P2-166
UINT N
SHR _DWORD
DWORD IN DWORD Shift right SHR _DWORD 3 P2-166
UINT N
ROL _WORD
WORD IN WORD Rotate left ROL _WORD 3 P2-167
UINT N
ROL _DWORD
DWORD IN DWORD Rotate left ROL _DWORD 3 P2-167
UINT N
ROR _WORD
WORD IN WORD Rotate right ROR _WORD 3 P2-168
UINT N
ROR _DWORD
DWORD IN DWORD Rotate right ROR _DWORD 3 P2-168
UINT N
AND
ANY_BIT ANY_BIT
ANY_BIT No. of input
Logical product AND P2-169
• operands + 1
•
•
ANY_BIT
OR
ANY_BIT ANY_BIT
ANY_BIT No. of input
Logical add OR P2-169
• operands + 1
•
•
ANY_BIT
2-123
Section 2 Programming Language Bit string FCT
XOR
ANY_BIT ANY_BIT
ANY_BIT No. of input
• Exclusive XOR P2-170
operands + 1
•
•
ANY_BIT
2-124
Section 2 Programming Language Selection/comparison FCT
4) Selection/comparison functions
SEL_BOOL
BOOL G BOOL
Select SEL_BOOL 8 P2-173
BOOL IN0
BOOL IN1
SEL_INT
BOOL G INT
INT IN0
Select SEL_INT
INT IN1
SEL_DINT
BOOL G DINT
Select SEL_DINT
DINT IN0
DINT IN1
SEL_UINT
BOOL G UINT
Select SEL_UINT
UINT IN0
UINT IN1
SEL_UDINT
BOOL G UDINT
Select SEL_UDINT
UDINT IN0
UDINT IN1
SEL_REAL
BOOL G REAL
Select SEL_REAL
REAL IN0
REAL IN1
SEL_WORD
BOOL G WORD
Select SEL_WORD
WORD IN0
WORD IN1
SEL_DWORD
BOOL G DWORD
DWORD IN0
Select SEL_DWORD
DWORD IN1
SEL_TIME
BOOL G TIME
TIME IN0
Select SEL_TIME
TIME IN1
SEL_STRING
BOOL G STRING
STRING IN0 Select SEL_STRING
STRING IN1
2-125
Section 2 Programming Language Selection/comparison FCT
MAX_INT
INT INT Maximum value MAX_INT 3 P2-174
INT
MAX_DINT
DINT DINT Maximum value MAX_DINT
DINT
MAX_UINT
UINT UINT Maximum value MAX_UINT
UINT
MAX_UDINT
UDINT UDINT Maximum value MAX_UDINT
UDINT
MAX_REAL
REAL REAL
Maximum value MAX_REAL
REAL
MIN_INT
INT INT Minimum value MIN_INT 3 P2-174
INT
MIN_DINT
DINT DINT Minimum value MIN_DINT
DINT
MIN_UINT
UINT UINT Minimum value MIN_UINT
UINT
MIN_UDINT
UDINT UDINT Minimum value MIN_UDINT
UDINT
MIN_REAL
REAL REAL
Minimum value MIN_REAL
REAL
2-126
Section 2 Programming Language Selection/comparison FCT
LIMIT_INT
INT MN INT
Limit LIMIT_INT 6 P2-175
INT IN
INT MX
LIMIT_DINT
DINT MN DINT
DINT IN
Limit LIMIT_DINT
DINT MX
LIMIT_UINT
UINT MN UINT
UINT IN Limit LIMIT_UINT
UINT MX
LIMIT_UDINT
UDINT MN UDINT
UDINT IN Limit LIMIT_UDINT
UDINT MX
LIMIT_REAL
REAL MN REAL
REAL IN Limit LIMIT_REAL
REAL MX
2-127
Section 2 Programming Language Selection/comparison FCT
GT
elementary BOOL
elementary
No. of input
•
Comparison (>) GT operands P2-176
• x3 - 1
•
elementary
GE
elementary BOOL
No. of input
elementary
Comparison (>=) GE operands P2-177
•
• x3 - 1
•
elementary
EQ
elementary BOOL
No. of input
elementary
Comparison (=) EQ operands P2-178
•
• x3 - 1
•
elementary
LE
elementary BOOL
No. of input
elementary
Comparison (<=) LE operands P2-179
•
• x3 - 1
•
elementary
LT
elementary BOOL
No. of input
elementary
Comparison (<) LT operands P2-180
•
• x3 - 1
•
elementary
NE
elementary BOOL Comparison (≠) NE 3 P2-181
elementary
Notes:
STRING type data is not available to an “elementary” of GT, GE, EQ, LE, LT or NE.
2-128
Section 2 Programming Language String FCT
5) String functions
LEFT
STRING IN STRING Get left sub-string LEFT 10 P2-213
UINT L
RIGHT
STRING IN STRING Get right sub-string RIGHT 10 P2-214
UINT L
MID
STRING IN STRING
UINT L Get middle sub-string MID 11 P2-214
UINT P
CONCAT
STRING STRING Concatenate CONCAT 11 P2-215
STRING
INSERT
STRING IN1 STRING
STRING IN2
Insert string INSERT 11 P2-215
UINT P
DELETE
STRING IN STRING
UINT L Delete string DELETE 11 P2-216
UINT P
REPLACE
STRING IN1 STRING
STRING IN2 Replace string REPLACE 12 P2-216
UINT L
UINT P
FIND
STRING IN1 INT Find string FIND 4 P2-217
STRING IN2
2-129
Section 2 Programming Language String FCT
GT_STRING
STRING IN1 BOOL Compare string GT_STRING 4 P2-217
STRING IN2
GE_STRING
STRING IN1 BOOL Compare string GE_STRING 4 P2-218
STRING IN2
EQ_STRING
STRING IN1 BOOL Compare string EQ_STRING 4 P2-218
STRING IN2
LE_STRING
STRING IN1 BOOL Compare string LE_STRING 4 P2-219
STRING IN2
LT_STRING
STRING IN1 BOOL Compare string LT_STRING 4 P2-219
STRING IN2
NE_STRING
STRING IN1 BOOL Compare string NE_STRING 4 P2-220
STRING IN2
2-130
Section 2 Programming Language Time type data FCT
ADD_T_T
TIME TIME Add time ADD_T_T 5 P2-221
TIME
ADD_TD_T
TOD TOD Add time ADD_TD_T 8 P2-221
TIME
ADD_DT_T
DT DT Add time ADD_DT_T 8 P2-221
TIME
BUS_T_T
TIME TIME Subtract time SUB_T_T 5 P2-222
TIME
SUB_D_D
DATE TIME Subtract time SUB_D_D 6 P2-222
DATE
SUB_TD_T
TOD TOD Subtract time SUB_TD_T 8 P2-222
TIME
SUB_TD_TD
TOD TIME Subtract time SUB_TD_TD 6 P2-223
TOD
BUS_DT_T
DT DT Subtract time SUB_DT_T 8 P2-223
TIME
BUS_DT_DT
DT TIME Subtract time SUB_DT_DT 6 P2-223
DT
MUL_T_N
TIME TIME Multiply time MUL_T_N 7 P2-224
UDINT
MUL_T_R
TIME TIME Multiply time MUL_T_R 7 P2-224
REAL
DIV_T_N
TIME TIME Divide time DIV_T_N 7 P2-225
UDINT
2-131
Section 2 Programming Language Time type data FCT
DIV_T_R
TIME TIME Divide time DIV_T_R 7 P2-225
REAL
CONCAT_D_D
DATE DT Concatenate time CONCAT_D_D 5 P2-226
TOD
2-132
Section 2 Programming Language Original FCT
SBIT_WORD
WORD IN WORD Set bit SBIT_WORD 3 P2-136
UINT N
SBIT_DWORD
DWORD IN DWORD Set bit SBIT_DWORD 3 P2-136
UINT N
RBIT_WORD
WORD IN WORD Reset bit RBIT_WORD 3 P2-137
UINT N
RBIT_DWORD
DWORD IN DWORD Reset bit RBIT_DWORD 3 P2-137
UINT N
TBIT_WORD
WORD IN WORD Test bit TBIT_WORD 3 P2-138
UINT N
TBIT_DWORD
DWORD IN DWORD Test bit TBIT_DWORD 3 P2-138
UINT N
2-133
Section 2 Programming Language Original FCT
DBAND_INT
INT IN INT Dead band DBAND_INT 5 P2-143
INT DB
DBAND_DINT
DINT IN DINT Dead band DBAND_DINT 5 P2-144
DINT DB
DBAND_REAL
REAL IN REAL Dead band DBAND_REAL 5 P2-144
REAL DB
BIAS_INT
INT IN INT Bias BIAS_INT 5 P2-145
INT DZ
BIAS_DINT
DINT IN DINT Bias BIAS_DINT 5 P2-145
DINT DZ
BIAS_REAL
REAL IN REAL Bias BIAS_REAL 5 P2-146
REAL DZ
SC_COIL
BOOL RUN UINT
Step sequence coil SC_COIL 6 P2-147
UINT STEP
UINT IN
SC
BOOL RUN BOOL
Step sequence bit SC 6 P2-147
UINT STEP
UINT IN
ADC
DINT IN1 DINT
32-bit addition with carry ADC 6 P2-148
DINT IN2
BOOL CYIN
2-134
Section 2 Programming Language Original FCT
ADCO
DINT IN1 BOOL
DINT IN2 Carry after 32-bit addition ADCO 6 P2-148
BOOL CYIN
SBB
DINT IN1 DINT
DINT IN2 32-bit subtraction with borrow SBB 6 P2-149
BOOL BIN
SBBO
DINT IN1 BOOL
DINT IN2 Borrow after 32-bit subtraction SBBO 6 P2-149
BOOL BIN
DIVL
DINT IN1 DINT Lower-order digit in 64-bit division
DINT IN2 6 P2-151
DIVL
DINT IN3
DIVU
DINT IN1 DINT Upper-order digit in 64-bit division
DINT IN2
6 P2-151
DIVU
DINT IN3
SLC
DWORD IN DWORD Shift left 32 bits with carry SLC 5 P2-152
BOOL CYIN
SRC
DWORD IN DWORD Shift right 32 bits with carry SRC 5 P2-153
BOOL CYIN
SRCO
DWORD BOOL Carry after 32 bits shift right SRCO 4 P2-153
2-135
Section 2 Programming Language Original FCT
WORD 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 EN=1
Symbol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SBIT_WORD
WORD IN WORD
UINT N UINT 5
Set
WORD 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 ENO=1
(WORD type) and outputs the resulting
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WORD type data.
(2) Available data type for “IN” is UINT type.
(3) The lowest-order 4 bits of “N” are
significant. For example, bit 0 is set when
N = 16 and bit 1 is set when N = 17.
DWORD EN=1
Symbol
0 0 0 1 1 1 0 1 0 1 0 1 1 0 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
SBIT_DWORD 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DWORD IN DWORD
UINT N
UINT 18
Set
(1) SBIT_DWORD sets the “Nth” bit of “IN”
Function
DWORD ENO=1
(WORD type) and outputs the resulting
DWORD type data. 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
(2) Available data type for “IN” is UINT type. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
(3) The lowest-order 5 bits of “N” are
significant. For example, bit 0 is set when
N = 32 and bit 1 is set when N =33.
2-136
Section 2 Programming Language Original FCT
WORD 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 EN=1
Symbol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RBIT_WORD
WORD IN WORD
UINT N UINT 5
Reset
WORD 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 ENO=1
(WORD type) and outputs the resulting
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WORD type data.
(2) Available data type for “IN” is UINT type.
(3) The lowest-order 4 bits of “N” are
significant. For example, bit 0 is reset
when N = 16 and bit 1 is reset when N =17.
DWORD EN=1
Symbol
0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
RBIT_DWORD 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DWORD IN DWORD
UINT N
UINT 18
Reset
(1) RBIT_DWORD resets the “Nth” bit of “IN”
Function
DWORD ENO=1
(WORD type) and outputs the resulting
DWORD type data. 0 0 0 1 1 1 0 1 0 1 0 1 1 0 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
(2) Available data type for “IN” is UINT type. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
(3) The lowest-order 5 bits of “N” are
significant. For example, bit 0 is reset
when N = 32 and bit 1 is reset when N =33.
2-137
Section 2 Programming Language Original FCT
TBIT_WORD
• When bit “N” is read normally
Symbol
WORD 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 EN=1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TBIT_WORD
WORD IN BOOL
UINT N
UINT 5
Test
(1) TBIT_WORD tests (1 or 0) the “Nth” bit of
Function
TBIT_DWORD
• When bit “N” is read normally
DWORD
Symbol
EN=1
0 0 0 1 1 1 0 1 0 1 0 1 1 0 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
TBIT_DWORD 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DWORD IN BOOL
UINT N
UINT 18
2-138
Section 2 Programming Language Original FCT
DECODE_WORD
UINT 5 EN=1
Symbol
Decode
UINT DECODE_WORD WORD
WORD 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ENO=1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DECODE_DWORD
UINT 18 EN=1
Symbol
Decode
UINT DECODE_DWORD DWORD
DWORD ENO=1
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
(1) DECODE_DWORD outputs DWORD
Function
ENCODE_WORD
WORD 0 0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 EN=1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Symbol
Encode
WORD ENCODE_WORD UINT
UINT 5 ENO=1
2-139
Section 2 Programming Language Original FCT
ENCODE_DWORD
DWORD EN=1
Symbol
0 0 0 1 0 1 0 1 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DWORD ENCODE_DWORD UINT
Encode
UINT 18 ENO=1
(1) ENCODE_DWORD outputs a UINT type
Function
BITCOUNT_WORD
WORD 0 0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 EN=1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Symbol
Count
WORD BITCOUNT_WORD UINT
UINT 5 ENO=1
BITCOUNT_DWORD
DWORD EN=1
Symbol
0 0 0 1 0 1 0 1 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DWORD BITCOUNT_DWORD UINT
Count
UINT 7 ENO=1
(1) BITCOUNT_DWORD outputs a UINT
Function
2-140
Section 2 Programming Language Original FCT
STR_TO_UINT
STRING ‘1234’ EN=1
Symbol
Convert
STRING STR_TO_UINT UINT
UINT 1234 ENO=1
(1) STR_TO_UINT converts STRING type • When the input data contains a non-numeric character
Function
UINT_TO_STR
UINT 1234 EN=1
Symbol
Convert
UINT UINT_TO_STR STRING
STRING ‘1234’ ENO=1
2-141
Section 2 Programming Language Original FCT
SJ_TO_STR
ARRAY OF WORD
A0 82
Symbol
A2 82 STRING
ARRAY OF WORD SJ_TO_STR STRING Convert
A4 82
ENO=1
42 41
60 82
(1) SJ_TO_STR converts Shift-JIS code
Function
00 00
defined as an array of WORD type data
EN=1
to STRING type data.
(2) The Shift-JIS code input must be
terminated by a NULL code (00 or 00 00). Note: No check is made to determine whether the input code is a
(3) If 64 or more Shift-JIS codes are input, sequence of valid Shift-JIS codes.
the first 64 codes are converted to Setting of ENO = 1 remains unchanged and an output is
STRING type data and ENO is set to 0. undefined.
STR_TO_SJ
STRING EN=1
Symbol
Convert
STRING STR_TO_SJ ARRAY OF WORD
ARRAY OF WORD A0 82
A2 82
(1) STR_TO_SJ converts STRING type data
Function
2-142
Section 2 Programming Language Original FCT
BYTE_LEN
STRING EN=1
Symbol
INT 12 ENO=1
indicates the number of bytes of STRING Note: The size of a 1-byte character is 1 and that of a 2-byte character
type data as converted to Shift-JIS code. is 2.
DBAND_INT
“DB”
When INT 3000 ,
Symbol
“IN” (Output)
(1) DBAND_INT processes the input “DB” If INT 2000 , 0
Function
(+)
1000
-6000 -3000
(-) (+)
3000
-3000
(-)
2-143
Section 2 Programming Language Original FCT
DBAND_DINT “DB”
When DINT 3000 ,
Symbol
“IN” (Output)
DBAND_DINT
DINT IN DINT If DINT 4000 , 1000
DINT DB EN=1 ENO=1
“IN” (Output)
If DINT 2000 , 0
(1) DBAND_DINT processes the input “DB” EN=1 ENO=1
Function
(+)
1000
-6000 -3000
(-) (+)
3000
-3000
(-)
DBAND_REAL “DB”
When REAL 3.0E+3 ,
Symbol
“IN” (Output)
DBAND_REAL
REAL IN REAL If REAL 4.0E+3 , 1.0E+3
REAL DB EN=1 ENO=1
“IN” (Output)
If REAL 2.0E+3 , 0.0E+0
(1) DBAND_REAL processes the input “DB” EN=1 ENO=1
Function
1000.0
-6000.0 -3000.0
(-) (+)
3000.0
-3000.0
(-)
2-144
Section 2 Programming Language Original FCT
BIAS_INT “DZ”
When INT 3000 ,
Symbol
“IN” (Output)
BIAS_INT
INT IN INT If INT 4000 , 7000
INT DZ EN=1 ENO=1
“IN” (Output)
If INT 0 , 0
(1) BIAS_INT processes the “DZ” (INT type) EN=1 ENO=1
Function
-9000
[F.Y.I.]
Data range of INT type: -32,768 to 32,767 (-)
BIAS_DINT “DZ”
When DINT 3000 ,
Symbol
“IN” (Output)
BIAS_DINT
DINT IN DINT If DINT 4000 , 7000
DINT DZ EN=1 ENO=1
“IN” (Output)
If DINT 0 , 0
(1) BIAS_DINT processes the “DZ” (DINT EN=1 ENO=1
Function
[F.Y.I.] -9000
Data range of DINT type:
-2,147,483,648 to 2,147,483,647 (-)
2-145
Section 2 Programming Language Original FCT
BIAS_REAL “DZ”
When REAL 3.0E+3 ,
Symbol
“IN” (Output)
BIAS_REAL
REAL IN REAL If REAL 4.0E+3 , 7.0E+3
REAL DZ EN=1 ENO=1
“IN” (Output)
If REAL 0.0E+0 , 0.0E+0
(1) BIAS_REAL processes the “DZ” (REAL EN=1 ENO=1
Function
2-146
Section 2 Programming Language Original FCT
B_2 Q_1
SC_COIL
<Step sequence bit> RUN SC_men
SC_men STEP
SC
BOOL RUN BOOL UINT#2 IN
UINT STEP
UINT IN B_3 Q_2
SC_COIL
RUN SC_men
SC_men STEP
UINT#3 IN
Step sequence controls have four
Function
2-147
Section 2 Programming Language Original FCT
ADC
IN1 C_LOWER
IN2
The ADC and ADCO instructions are used in
Function
CYIN
combination to add together 64-bit or wider
data. These instructions cannot be used
independently. The maximum length of data that can be manipulated in a MICREX-SX
system is 32 bits. Consequently, when adding 64-bit data items, it is
<32-bit addition with carry> necessary to regard each data item as consisting of two 32-bit data
(1) ADC adds DINT type “IN1” and “IN2” with items.
carry “CYIN.” In the above figure, 64-bit data items A and B are added and the result
is output in C. The upper-order 32 bits of A, B, and C are assigned to
<32-bit carry> A_UPPER, B_UPPER, and C_UPPER, respectively, and their lower
(1) ADCO adds DINT type “IN1” and “IN2” order 32 bits are assigned to A_LOWER, B_LOWER, and C_LOWER,
with carry“CYIN” and outputs a carry. respectively. The most significant bit of the lower-order 32 bits is
handled not as a sign but as a numeric value.
[F.Y.I.]
It is recommended, to monitor 64-bit data, that you use the
hexadecimal notation.
2-148
Section 2 Programming Language Original FCT
ADC
IN1 C_LOWER
IN2
The ADC and ADCO instructions are used in
Function
CYIN
combination to add together 64-bit or wider
data. These instructions cannot be used
independently. The maximum length of data that can be manipulated in a MICREX-SX
system is 32 bits. Consequently, when adding 64-bit data items, it is
<32-bit addition with carry> necessary to regard each data item as consisting of two 32-bit data
(1) ADC adds DINT type “IN1” and “IN2” with items.
carry “CYIN.” In the above figure, 64-bit data items A and B are added and the result is
output in C. The upper-order 32 bits of A, B, and C are assigned to
<32-bit carry> A_UPPER, B_UPPER, and C_UPPER, respectively, and their
(1) ADCO adds DINT type “IN1” and “IN2” lowerorder 32 bits are assigned to A_LOWER, B_LOWER, and
with carry“CYIN” and outputs a carry. C_LOWER, respectively. The most significant bit of the lower-order 32
bits is handled not as a sign but as a numeric value.
[F.Y.I.]
It is recommended, to monitor 64-bit data, that you use the hexadecimal
notation.
2-149
Section 2 Programming Language Original FCT
MULL/MULU
MULU
Symbol
A IN1 C_UPPER
<Lower-order digit in 64-bit multiplication>
B IN2
MULL
DINT IN1 DINT
DINT IN2
MULL
IN1 C_LOWER
<Upper-order digit in 64-bit multiplication>
IN2
MULU
DINT IN1 DINT
DINT IN2 In the above figure, multiplication is performed on 32-bit data items A
and B and the result is output in C. The upper-order 32 bits of C are
assigned to C_UPPER and the lower-order 32 bits to C_LOWER.
The most significant bit of the lower-order 32 bits is handled not as a
sign but as a numeric value.
The MULL and MULU instructions are used in
Function
2-150
Section 2 Programming Language Original FCT
DIVL/DIVU
DIVU
Symbol
[F.Y.I.]
combination when performing a division on a
It is recommended, to monitor 64-bit data, that you use the hexadecimal
64-bit data item.
notation.
<Lower-order digit in 64-bit division>
(1) DIVL divides 64-bit data which is divided
into the upper-order part “IN1” of the
dividend and the lower-order part “IN2”
by the divisor “IN3” and outputs the
lower-order 32 bits of the result.
<Common>
(1) If the divisor is 0, the maximum value
with the same sign as the dividend is
output and ENO is set to 0.
2-151
Section 2 Programming Language Original FCT
A_U SLCO
<32-bit shift left with carry>
SLC
DWORD IN DWORD
BOOL CYIN SLC
IN B_U
<32-bit carry> CYIN
A_L SLCO
SLC
(1) SLC shifts DWORD type“IN1” 1 bit to the IN B_L
left with a carry. CYIN
Enter a carry flag data into an “CYIN.”
<32-bit carry>
(1) SLCO adds DWORD type “IN1” 1 bit to
the left and outputs a carry. In the above figure, 64-bit data A is shifted to the left with a carry and the
result is output in B. Since a carry is moved, the operation is equivalent to
a rotation instruction.
Carry flag
A_U 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
B_U 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Carry flag
A_L 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
B_L 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
[F.Y.I.]
It is recommended, to monitor 64-bit data, that you use the hexadecimal
notation.
2-152
Section 2 Programming Language Original FCT
A_U SRCO
<32-bit shift right with carry>
SRC
DWORD IN DWORD
BOOL CYIN SRC
IN B_U
<32-bit carry> CYIN
A_L SRCO
SRC
(1) SLC shifts DWORD type “IN1” 1 bit to IN B_L
the right with a carry. CYIN
Enter a carry flag data into an “CYIN.”
<32-bit carry>
(1) SLCO adds DWORD type “IN1” 1 bit to
the right and outputs a carry. In the above figure, 64-bit data A is shifted to the right with a carry and the
result is output in B. Since a carry is moved, the operation is equivalent to
a rotation instruction.
A_U 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
B_U 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Carry flag
A_L 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
B_L 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Carry flag
[F.Y.I.]
It is recommended, to monitor 64-bit data, that you use the hexadecimal
notation.
2-153
Section 2 Programming Language Arithmetic FCT
ABS_INT
INT Compute INT
-20 20
Symbol
EN=1 ENO=1
EN=1 ENO=0
absolute value of INT type data.
(2) The positive maximum value (32767) of the
output data type is generated if the input
value is “-32768.”
ABS_DINT
DINT Compute DINT
-20 20
Symbol
EN=1 ENO=1
EN=1 ENO=0
absolute value of DINT type data.
(2) The positive maximum value (2147483647)
of the output data type is generated if the
input value is “-2147483648.”
2-154
Section 2 Programming Language Arithmetic FCT
ABS_REAL
REAL Compute REAL
-2.000E+1 2.000E+1
Symbol
EN=1 ENO=1
SQRT
REAL Compute REAL
1.234E+07 3.5128E+03
Symbol
EN=1 ENO=1
type data.
(2) When SPH is used, if the input value is
negative, a 0 is output and ENO is set to 0.
(3) The number of significant digits of the
output is 5.
2-155
Section 2 Programming Language Arithmetic FCT
LN
REAL Compute REAL
1.234E+03 7.118E+00
Symbol
EN=1 ENO=1
REAL LN REAL
y
y=lnX
(1) LN computes the natural logarithm of REAL
Function
LOG
REAL Compute REAL
1.234E+03 3.091E+00
Symbol
EN=1 ENO=1
y=log10X
(1) LOG computes the common logarithm of
Function
2-156
Section 2 Programming Language Arithmetic FCT
EXP
REAL Compute REAL
2.0E+00 7.389E+00
Symbol
EN=1 ENO=1
y=ex
(1) EXP computes the exponent of the input using the
Function
SIN
REAL Compute REAL
3.141E+00 5.926E-04
Symbol
EN=1 ENO=1
y=sin x
1
(1) SIN computes the sine of REAL type data.
Function
2-157
Section 2 Programming Language Arithmetic FCT
COS
REAL Compute REAL
1.047E+00 5.001E-01
Symbol
EN=1 ENO=1
y=cos x
1
(1) COS computes the cosine of REAL type
Function
data.
(2) The input must be given in radians. -p p
x
(3) The number of significant digits of the -2p 0 2p
output is 5 if the input falls within -2p and
2p. (Calculated up to the fourth decimal
place.) If the absolute value of input is -1
greater than or equal to 2p, computation
is carried out but with a large error.
(4) When an (input value) is < -231 or > 231 -1,
an output value = 0 and ENO = 0.
TAN
REAL Compute REAL
7.854E-01 1.000E+00
Symbol
EN=1 ENO=1
data. 1
(2) The input must be given in radians.
(3) The number of significant digits of the
output is 4 if the input falls within -2p and 3 3
x
p -p p 0 p p p
2p. The output has a large error if the 2 2 2 2
absolute value of the input is greater if the
input is approximately an integral multiple -1
of p/2.
If the absolute value of input is greater than
or equal to 2p, computation is carried out
but with a large error. Output error is large. Output error is large.
(4) When an (input value) is < -231 or > 231 -1,
an output value = 0 and ENO = 0.
2-158
Section 2 Programming Language Arithmetic FCT
ASIN
REAL Compute REAL
7.854E-01 9.033E-01
Symbol
EN=1 ENO=1
y=sin-1 x
(1) ASIN computes the arc sine of REAL type
Function
p
data. 2
(2) The output is given in radians.
(3) The input must have a value range of -1.0
to +1.0 and the output must have a value x
-1.0 0 1.0
range of -p/2 to p/2. A 0 is generated and
ENO is set to 0 if the input exceeds this
value range. p
2
(4) The number of significant digits of the
output is as follows:
• 4 digits if | input value | = 1.0 or 0.998999
or less
• The error is large if | input value | = 0.999
and 0.999999
ACOS
REAL Compute REAL
7.854E-01 6.675E-01
Symbol
EN=1 ENO=1
y=cos-1 x
(1) ACOS computes the arc cosine of REAL
Function
p
type data.
(2) The output is given in radians.
(3) The input must have a value range of -1.0 p
2
to +1.0 and the output must have a value
range of p to 0. A 0 is generated and
ENO is set to 0 if the input exceeds this
value range. x
-1.0 0 1.0
(4) The number of significant digits of the
output is as follows:
• 4 digits if | input value | = 1.0 or 0.998999
or less
• The error is large if | input value | = 0.99
and 0.999999
2-159
Section 2 Programming Language Arithmetic FCT
ATAN
REAL Compute REAL
7.854E-01 6.6577E-01
Symbol
EN=1 ENO=1
p
(1) ATAN computes the arc tangent of REAL
Function
2
type data.
(2) The output is given in radians.
(3) The input must have a value range of its x
0
negative maximum value to its positive
maximum value and the output must have
a value range of -p/2 to p/2. p
(4) The number of significant digits of the 2
output is 5.
ADD • When the operation result falls within the valid value range of the
operands
Symbol
-32768 + -32768 0
(2) The data type of the input and output
operands must be the same. EN=1 ENO=0
2-160
Section 2 Programming Language Arithmetic FCT
(15) Subtraction
SUB • When the operation result falls within the valid value range of the
operands
Symbol
-32768 - 50 32718
first input. EN=1 ENO=0
(2) The data type of the input and output
operands must be the same.
(3) Available data type is ANY_NUM type Note: The CPU performs no boundary processing when the result of
(REAL, INT, DINT, UINT, or UDINT). subtracting operands of types other than REAL type exceeds the
(4) ENO is set to 0 if the operation result valid value range of the operands. Make sure that the result of the
exceeds the valid value range of the data subtraction does not exceeds the valid value range of the
type of the operands (only for SPH). operands. The CPU performs boundary processing for REAL type
(5) If a data value is approaching so closely to operands.
0 (zero) that no REAL type data can
represent it, an output value = 1
and ENO = 1 (only for SPH).
MUL • When the operation result falls within the valid value range of the
operands
Symbol
2-161
Section 2 Programming Language Arithmetic FCT
DIV • When the operation result falls within the valid value range of the
operands
Symbol
EN=1 ENO=0
input.
(2) The data type of the input and output
operands must be the same.
(3) ENO is set to 0 if the operation result
exceeds the valid value range of the data
type of the operands.
(4) Available data type is ANY_NUM type
(REAL, INT, DINT, UINT, or UDINT).
(5) If a data value is approaching so closely to
0 (zero) that no REAL type data can
represent it, an output value = 1
and ENO = 1.
(6) If the divisor is 0, the maximum absolute
value with the sign of the dividend is
generated and ENO is set to 0.
MOD • When the operation result falls within the valid value range of the
operands
Symbol
EN=1 ENO=0
input and generates the remainder.
(2) The data type of the input and output
operands must be the same. • When the quotient exceeds the valid value range of the operands
(3) The output is set to 0 and ENO is set to 0 INT INT Compute
if the quotient exceeds the valid value -32768 MOD -1 0
range of the data type of the operands. EN=1 ENO=0
(4) Available data type is ANY_INT type
(INT, DINT, UINT, or UDINT).
(5) If the divisor is 0, a 0 is generated and ENO
is set to 0.
(6) Remainder is calculated using the following
equation:
(Divisor) x (Quotient) + (Remainder)
= (Dividend)
2-162
Section 2 Programming Language Arithmetic FCT
EXPT • When the operation result falls within the valid value range of the
operand
Symbol
MOVE
DINT Output DINT
32767 32767
Symbol
EN=1 ENO=1
2-163
Section 2 Programming Language Arithmetic FCT
NEG
DINT Output DINT
123 -123
Symbol
EN=1 ENO=1
2-164
Section 2 Programming Language Bit string FCT
SHL_WORD
Before execution EN=1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1
Bit addresses 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 “0”
Symbol
WORD IN
SHL_WORD
WORD
After execution ENO=1 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
UINT N
SHL_DWORD
Example of shifting 1 bit position
Before execution EN=1
Symbol
0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 “0”
SHL_DWORD
DWORD IN DWORD
UINT N
0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2-165
Section 2 Programming Language Bit string FCT
SHR_WORD
Example of shifting 1 bit position
Before execution 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1
Symbol
EN=1 “0” 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SHR_WORD
WORD IN WORD
UINT N After execution 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1
ENO=1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SHR_DWORD
Example of shifting 1 bit position
Before execution EN=1
Symbol
0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
“0” 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SHR_DWORD
DWORD IN DWORD
UINT N
0 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2-166
Section 2 Programming Language Bit string FCT
ROL_WORD
Example of rotating 1 bit
Before execution EN=1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1
Bit addresses
Symbol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ROL_WORD
WORD IN WORD
After execution ENO=1 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 0
UINT N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ROL_DWORD
Example of rotating 1 bit position
Before execution EN=1
Symbol
0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ROL_DWORD
DWORD IN DWORD
UINT N
0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2-167
Section 2 Programming Language Bit string FCT
ROR_WORD
Example of rotating 1 bit
Before execution EN=1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1
Symbol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ROR_WORD
WORD IN WORD
After execution ENO=1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1
UINT N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ROR_DWORD
Example of rotating 1 bit position
Before execution EN=1
Symbol
0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ROR_DWORD
DWORD IN DWORD
UINT N
1 0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2-168
Section 2 Programming Language Bit string FCT
AND
Input WORD 0 1 1 0 1 0 0 1 0 1 1 1 1 0 1 0
6 9 7 A
Symbol
AND EN=1
AND
ANY_BIT ANY_BIT
Input WORD 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1
ANY_BIT
.
. 3 D D 9
.
ANY_BIT
of all inputs.
(2) The data type of the input and output
operands must all be the same.
(3) Available data type is ANY_BIT type
(BOOL, WORD, or DWORD).
OR
Input WORD 0 1 0 1 1 1 0 0 0 1 1 1 0 0 1 1
5 C 7 3
Symbol
OR EN=1
OR
ANY_BIT ANY_BIT
Input WORD 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0
ANY_BIT
.
. 8 C C C
.
ANY_BIT
inputs.
(2) The data type of the input and output
operands must all be the same.
(3) Available data type is ANY_BIT type
(BOOL, WORD, or DWORD).
2-169
Section 2 Programming Language Bit string FCT
XOR
Input WORD 0 0 1 1 1 1 0 0 1 1 0 0 0 0 0 0
3 C C 0
Symbol
XOR EN=1
XOR
ANY_BIT ANY_BIT
ANY_BIT
Input WORD 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
.
. 0 F 0 F
.
ANY_BIT
inputs.
(2) The data type of the input and output
operands must all be the same.
(3) Available data type is ANY_BIT type
(BOOL, WORD, or DWORD).
NOT
ANY_BIT NOT ANY_BIT
input.
(2) Available data type is ANY_BIT type
(BOOL, WORD, or DWORD).
2-170
Section 2 Programming Language Bit string FCT
1 0
EN=1 ENO=1
BOOL NOT_BOOL BOOL
• When the input data has a value of “0”
NOT
(1) NOT_BOOL generates an inverted value 0 1
Function
NOT_WORD
Input WORD EN=1 0 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0
Symbol
NOT
data.
2-171
Section 2 Programming Language Bit string FCT
NOT_DWORD
Input DWORD EN=1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Symbol
NOT
DWORD NOT_DWORD DWORD Output DWORD ENO=1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
data.
2-172
Section 2 Programming Language Selection/comparison FCT
SEL_*
SEL_INT
Symbol
FLAG G OUTPUT
SEL_BOOL INDATA1 IN0
BOOL G BOOL
INDATA2 IN1
BOOL IN0
BOOL IN1
<Operation>
SEL_INT • When “FLAG” has a value of “0”
BOOL G INT
INT IN0 INDATA1 12345
INT IN1 OUTPUT 12345
INDATA2 5000
SEL_DINT
BOOL G DINT
DINT IN0 • When “FLAG” has a value of “1”
DINT IN1
INDATA1 12345
OUTPUT 5000
SEL_UINT
BOOL G UINT INDATA2 5000
UINT IN0
UINT IN1
[F.Y.I.]
SEL_UDINT No. of characters of STRING type: 0 to 64 chanarcters
BOOL G UDINT
UDINT IN0
UDINT IN1
SEL_REAL
BOOL G REAL
REAL IN0
REAL IN1
SEL_WORD
BOOL G WORD
WORD IN0
WORD IN1
SEL_DWORD
BOOL G DWORD
DWORD IN0
DWORD IN1
SEL_TIME
BOOL G TIME
TIME IN0
TIME IN1
SEL_STRING
BOOL G STRING
STRING IN0
STRING IN1
2-173
Section 2 Programming Language Selection/comparison FCT
MAX_*
MAX_INT
Symbol
INDATA1 OUTPUT
MAX_INT INDATA2
INT INT
INT
<Operation>
MAX_DINT
DINT DINT
INDATA1 1234
DINT
INDATA2 0 OUTPUT 1234
MAX_UINT
UINT UINT
UINT
MAX_UDINT
UDINT UDINT
UDINT
MAX_REAL
REAL REAL
REAL
inputs.
MIN_*
MIN_INT
Symbol
INDATA1 OUTPUT
MIN_INT INDATA2
INT INT
INT
<Operation>
MIN_DINT
DINT DINT
INDATA1 1234
DINT
INDATA2 5678 OUTPUT 1234
MIN_UINT
UINT UINT
UINT
MIN_UDINT
UDINT UDINT
UDINT
MIN_REAL
REAL REAL
REAL
inputs.
2-174
Section 2 Programming Language Selection/comparison FCT
LIMIT_*
LIMIT_INT
Symbol
MNDATA OUTPUT
LIMIT_INT INDATA
INT MN INT MXDATA
INT IN
INT MX
<Operation>
LIMIT_DINT
• When “INDATA” <= “MNDATA”
DINT MN DINT
DINT IN MNDATA 1000
DINT MX INDATA 0 OUTPUT 1000
MXDATA 5000
LIMIT_UINT
UINT MN UINT
• When “MNDATA” < “INDATA” < “MXDATA”
UINT IN
UINT MX MNDATA 1000
MNDATA 1000
“MN.”
It outputs “MX” if “IN” is greater than
“MX.”
In the other cases, LIMIT_* outputs “IN.”
(2) LIMIT_* outputs “MX” if “MN” is greater than
“MX.”
2-175
Section 2 Programming Language Selection/comparison FCT
GT
GT
Symbol
INDATA1 FLAG
GT INDATA2
elementary BOOL
INDATA3
elementary
INDATA4
INDATA5
elementary
<Operation>
(1) GT outputs a 1 if the conditions first input > • When the input is of INT type
Function
2-176
Section 2 Programming Language Selection/comparison FCT
GE
GE
Symbol
TIME1 FLAG
GE TIME2
elementary BOOL
TIME3
elementary
TIME4
.
. TIME5
.
elementary
(SPH)
<Operation>
(1) GE outputs a 1 if the conditions first input • When the input is of INT type
Function
>= second input >= third input >= ... are met.
GE outputs a 0 if the above conditions are TIME1 10m5s
not met. TIME2 10m5s
(2) The data type of the input operands must
be the same. TIME3 9m10s
(3) Available data types are ANY_NUM type TIME4 20s
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD), TIME5 0s
ANY_DATE type (DT, DATE, or TOD), and
TIME type. This program results in TIME1 >= TIME2 >= TIME3 >= TIME4 >= TIME5,
(4) The maximum number of inputs is 16. which sets a FLAG to 1.
2-177
Section 2 Programming Language Selection/comparison FCT
EQ
EQ
Symbol
DATE1 FLAG
EQ DATE2
elementary BOOL
DATE3
elementary
DATE4
.
. DATE5
.
elementary
<Operation>
(1) EQ outputs a 1 if the conditions first input • When the input is of DATE type
Function
2-178
Section 2 Programming Language Selection/comparison FCT
LE
LE
Symbol
TD1 FLAG
LE TD2
elementary BOOL
TD3
elementary
TD4
.
. TD5
.
elementary
<Operation>
(1) LE outputs a 1 if the conditions first input • When the input is of TOD type
Function
<= second input <= third input <= ... are met.
LE outputs a 0 if the above conditions are TD1 15:36:34
not met. TD2 15:37:50
(2) The data type of the input operands must
be the same. TD3 15:40:00
(3) Available data types are ANY_NUM type TD4 15:50:11
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD), TD5 18:00:20
ANY_DATE type (DT, DATE, or TOD), and
TIME type. This program results in TD1 <= TD2 <= TD3 <= TD4 <= TD5,
(4) The maximum number of inputs is 16. which sets a FLAG to 1.
2-179
Section 2 Programming Language Selection/comparison FCT
LT
LT
Symbol
INDATA1 FLAG
LT INDATA2
elementary BOOL
INDATA3
elementary
INDATA4
.
. INDATA5
.
elementary
<Operation>
(1) LT outputs a 1 if the conditions first input • When the input is of TOD type
Function
< second input < third input < ... are met.
LT outputs a 0 if the above conditions are INDATA1 -12345
not met. INDATA2 -100
(2) The data type of the input operands must
be the same. INDATA3 0
(3) Available data types are ANY_NUM type INDATA4 100
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD), INDATA5 12345
ANY_DATE type (DT, DATE, or TOD), and
TIME type. This program results in
(4) The maximum number of inputs is 16. INDATA1 < INDATA2 < INDATA3 < INDATA4 < INDATA5,
which sets a FLAG to 1.
Note: REAL data generally involves an error.
The error will get larger as computations
are executed.
Accordingly, the result of the REAL type
data comparison operation may differ
from the actual value.
When using this instruction, consider the
presence of this type of error.
2-180
Section 2 Programming Language Selection/comparison FCT
NE
NE
Symbol
INDATA1 FLAG
NE INDATA2
elementary BOOL
elementary
<Operation>
(1) NE outputs a 1 if the condition that the first • When the input is of REAL type
Function
2-181
Section 2 Programming Language Type conversion FCT
DINT_TO_INT • When the operation result falls within the valid value range of the INT
type
Symbol
DINT Convert
INT
32767 32767
DINT DINT_TO_INT INT EN=1 ENO=1
• When the operation result exceeds the valid value range of the INT
type
(1) DINT_TO_INT converts DINT type data to DINT INT
Function
Convert
INT type data. 40000 32767
(2) If the input DINT value exceeds the valid EN=1 ENO=0
range of INT type after type conversion, the
DINT INT
boundary value of INT type is output. Convert
(Boundary value: -32768, 32767) -50000 -32768
EN=1 ENO=0
[F.Y.I.]
Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of INT type: -32,768 to 32,767
UINT_TO_INT • When the operation result falls within the valid value range of the INT
type
Symbol
UINT Convert
INT
32767 32767
UINT UINT_TO_INT INT EN=1 ENO=1
• When the operation result exceeds the valid value range of the INT
type
(1) UINT_TO_INT converts UINT type data to UINT INT
Function
Convert
INT type data. 65535 32767
(2) If the input UINT value exceeds the valid EN=1 ENO=0
range of INT type after type conversion, the
upper limit value (32767) of INT type is
output. [F.Y.I.]
Value range of UINT type: 0 to 65,535
Value range of INT type: -32,768 to 32,767
2-182
Section 2 Programming Language Type conversion FCT
UDINT_TO_INT • When the operation result falls within the valid value range of the INT
type
Symbol
UDINT Convert
INT
32767 32767
UDINT UDINT_TO_INT INT EN=1 ENO=1
• When the operation result exceeds the valid value range of the INT
type
(1) UDINT_TO_INT converts UDINT UDINT INT
Function
Convert
type data to INT type data. 4294967295 32767
(2) If the input UDINT value exceeds the valid EN=1 ENO=0
range of INT type after type conversion, the
upper limit value (32767) of INT type is
[F.Y.I.]
output.
Value range of UDINT type: 0 to 4,294,967,295
Value range of INT type: -32,768 to 32,767
REAL_TO_INT • When the operation result falls within the valid value range of the INT
type
Symbol
REAL Convert
INT
6.789E+02 679
REAL REAL_TO_INT INT EN=1 ENO=1
• When the operation result exceeds the valid value range of the INT
type
(1) REAL_TO_INT converts REAL type data REAL INT
Function
Convert
to INT type data. 4.500E+04 32767
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of INT type after type conversion, the
REAL INT
boundary value of INT type is output. Convert
(3) The fractional part is rounded off. -5.000E+04 -32768
EN=1 ENO=0
[F.Y.I.]
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of INT type: -32,768 to 32,767
2-183
Section 2 Programming Language Type conversion FCT
TIME_TO_INT • When the operation result falls within the valid value range of the INT
type
Symbol
TIME Convert
INT
32s123ms 32123
TIME TIME_TO_INT INT EN=1 ENO=1
• When the operation result exceeds the valid value range of the INT
type
(1) TIME_TO_INT converts TIME type data TIME INT
Function
Convert
to INT type data. 10m10s 32767
(2) When SPH is used, if the input TIME EN=1 ENO=0
value exceeds the valid range of INT type
after type conversion, the upper limit
[F.Y.I.]
value (32767) of INT type is output.
Value range of TIME type: 0 to 4,294,967,295 (ms)
(3) 1 ms is converted to 1.
Value range of INT type: -32,768 to 32,767
WORD_TO_INT
WORD Convert
INT
16#7FFF 32767
Symbol
EN=1 ENO=1
2-184
Section 2 Programming Language Type conversion FCT
INT_TO_DINT
INT Convert
DINT
32767 32767
Symbol
EN=1 ENO=1
UINT_TO_DINT
UINT Convert
DINT
65353 65353
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of UINT type: 0 to 65,535
Value range of DINT type: -2,147,483,648 to 2,147,483,647
(1) UINT_TO_DINT converts UINT type data
Function
2-185
Section 2 Programming Language Type conversion FCT
UDINT_TO_DINT • When the operation result falls within the valid value range of the DINT
type
Symbol
UDINT Convert
DINT
2147483647 2147483647
UDINT UDINT_TO_DINT DINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the DINT
type
(1) UDINT_TO_DINT converts UDINT type UDINT DINT
Function
Convert
data to DINT type data. 4294967295 2147483647
(2) When SPH is used, if the input UDINT EN=1 ENO=0
value exceeds the valid range of DINT
type after type conversion, the upper limit
value (2147483647) of DINT type is [F.Y.I.]
output. Value range of UDINT type: 0 to 4,294,967,295
Value range of DINT type: -2,147,483,648 to 2,147,483,647
REAL_TO_DINT • When the operation result falls within the valid value range of the DINT
type
Symbol
REAL Convert
DINT
6.789E+02 679
REAL REAL_TO_DINT DINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the DINT
type
(1) REAL_TO_DINT converts REAL type data REAL DINT
Function
Convert
to DINT type data. 2.147E+20 2147483647
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of DINT type after type conversion,
REAL DINT
the boundary value of DINT type is output. Convert
(Boundary value: -2.147E+20 -2147483648
-2147483648, 2147483647) EN=1 ENO=0
(3) The fractional part is rounded off.
(4) The number of significant digits after [F.Y.I.]
conversion is 6 digits. Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of DINT type: -2,147,483,648 to 2,147,483,647
2-186
Section 2 Programming Language Type conversion FCT
TIME_TO_DINT • When the operation result falls within the valid value range of the DINT
type
Symbol
TIME Convert
DINT
17h20m10s 62410000
TIME TIME_TO_DINT DINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the DINT
type
(1) TIME_TO_DINT converts TIME type data TIME DINT
Function
Convert
to DINT type data. 25d20h31m23s 2147483647
(2) If the input TIME value exceeds the valid EN=1 ENO=0
range of DINT type after type conversion,
the upper limit value (2147483647) of DINT
type is output. [F.Y.I.]
(3) 1 ms is converted to 1. Value range of TIME type: 0 to 4,294,967,295 (ms)
Value range of DINT type: -2,147,483,648 to 2,147,483,647
DWORD_TO_DINT
DWORD Convert
DINT
16#7FFFFFFF 2147483647
Symbol
EN=1 ENO=1
2-187
Section 2 Programming Language Type conversion FCT
INT_TO_UINT • When the operation result falls within the valid value range of the UINT
type
Symbol
INT Convert
UINT
32767 32767
INT INT_TO_UINT UINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UINT
type
(1) INT_TO_UINT converts INT type data to INT UINT
Function
Convert
UINT type data. -32768 0
(2) If the input INT value exceeds the valid EN=1 ENO=0
range of UINT type after type conversion,
the lower limit value (UINT#0) of UINT type
is output. [F.Y.I.]
Value range of INT type: -32,768 to 32,767
Value range of UINT type: 0 to 65,535
DINT_TO_UINT • When the operation result falls within the valid value range of the UINT
type
Symbol
DINT Convert
UINT
65535 65535
DINT DINT_TO_UINT UINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UINT
type
(1) DINT_TO_UINT converts DINT type data DINT UINT
Function
Convert
to UINT type data. 2147483647 65535
(2) If the input DINT value exceeds the valid EN=1 ENO=0
range of UINT type after type conversion,
DINT UINT
the boundary value of UINT type is output. Convert
(Boundary value: 0, 65535) -2147483648 0
EN=1 ENO=0
[F.Y.I.]
Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of UINT type: 0 to 65,535
2-188
Section 2 Programming Language Type conversion FCT
UDINT_TO_UINT • When the operation result falls within the valid value range of the UINT
type
Symbol
UDINT Convert
UINT
65535 65535
UDINT UDINT_TO_UINT UINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UINT
type
(1) UDINT_TO_UINT converts UDINT type UDINT UINT
Function
Convert
data to UINT type data. 4294967295 65535
(2) If the input UDINT value exceeds the valid EN=1 ENO=0
range of UINT type after type conversion,
the upper limi value (65535) of UINT type
[F.Y.I.]
is output.
Value range of UDINT type: 0 to 4,294,967,295
Value range of UINT type: 0 to 65,535
REAL_TO_UINT • When the operation result falls within the valid value range of the UINT
type
Symbol
REAL Convert
UINT
6.789E+2 679
REAL REAL_TO_UINT UINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UINT
type
(1) REAL_TO_UINT converts REAL REAL UINT
Function
Convert
type data to UINT type data. 1.234E+05 65535
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of UINT type after type conversion,
REAL UINT
the boundary value of UINT type is output. Convert
(3) The fractional part is rounded off. -2.345E+02 0
EN=1 ENO=0
[F.Y.I.]
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of UINT type: 0 to 65,535
2-189
Section 2 Programming Language Type conversion FCT
TIME_TO_UINT • When the operation result falls within the valid value range of the UINT
type
Symbol
TIME Convert
UINT
1m5s123ms 65123
TIME TIME_TO_UINT UINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UINT
type
(1) TIME_TO_UINT converts TIME type data TIME UINT
Function
Convert
to UINT type data. 20h 65535
(2) If the input TIME value exceeds the valid EN=1 ENO=0
range of UINT type after type conversion,
the upper limit value (65535) of UINT type
is output. [F.Y.I.]
(3) 1 ms is converted to 1. Value range of TIME type: 0 to 4,294,967,295 (ms)
Value range of INT type: 0 to 65,535
WORD_TO_UINT
WORD Convert
UINT
16#7FFF 32767
Symbol
EN=1 ENO=1
2-190
Section 2 Programming Language Type conversion FCT
INT_TO_UDINT • When the operation result falls within the valid value range of the UDINT
type
Symbol
INT Convert
UDINT
32767 32767
INT INT_TO_UDINT UDINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UDINT
type
(1) INT_TO_UDINT converts INT type data to INT UDINT
Function
Convert
UDINT type data. -32768 0
(2) If the input INT value exceeds the valid EN=1 ENO=0
range of UDINT type after type conversion,
the lower limit value (UDINT#0) of UDINT
type is output. [F.Y.I.]
Value range of INT type: -32,768 to 32,767
Value range of UDINT type: 0 to 4,294,967,295
DINT_TO_UDINT • When the operation result falls within the valid value range of the UDINT
type
Symbol
DINT Convert
UDINT
2147483647 2147483647
DINT DINT_TO_UDINT UDINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UDINT
type
(1) DINT_TO_UDINT converts DINT type DINT UDINT
Function
Convert
data to UDINT type data. -2147483648 0
(2) If the input DINT value exceeds the valid EN=1 ENO=0
range of UDINT type after type conversion,
the lower limit value (UDINT#0) of UDINT
type is output. [F.Y.I.]
Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of UDINT type: 0 to 4,294,967,295
2-191
Section 2 Programming Language Type conversion FCT
UINT_TO_UDINT
UINT Convert
UDINT
65535 65535
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of UINT type: 0 to 65,535
Value range of UDINT type: 0 to 4,294,967,295
(1) UINT_TO_UDINT converts UINT type
Function
REAL_TO_UDINT • When the operation result falls within the valid value range of the UDINT
type
Symbol
REAL Convert
UDINT
6.789E+02 679
REAL REAL_TO_UDINT UDINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UDINT
type
(1) REAL_TO_UDINT converts REAL type REAL UDINT
Function
Convert
data to UDINT type data. 4.294E+10 4294967295
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of UDINT type after type conversion,
REAL UDINT
the boundary value of UDINT type is output. Convert
(3) The fractional part is rounded off. -3.456E+03 0
(4) The number of significant digits after EN=1 ENO=0
conversion is 6 digits.
[F.Y.I.]
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of UDINT type: 0 to 4,294,967,295
2-192
Section 2 Programming Language Type conversion FCT
TIME_TO_UDINT
TIME Convert
UDINT
5h20m15s 19215000
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of TIME type: 0 to 4,294,967,295 (ms)
Value range of INT type: 0 to 4,294,967,295
(1) TIME_TO_UDINT converts TIME type
Function
DWORD_TO_UDINT
DWORD Convert
UDINT
16#7FFFFFFF 2147483647
Symbol
EN=1 ENO=1
2-193
Section 2 Programming Language Type conversion FCT
DT_TO_UDINT
DT Convert
UDINT
1998-04-01-08:30:15 891419415
Symbol
EN=1 ENO=1
DT DT_TO_UDINT UDINT
DATE_TO_UDINT
DATE Convert
UDINT
1998-04-01 891388800
Symbol
EN=1 ENO=1
2-194
Section 2 Programming Language Type conversion FCT
TOD_TO_UDINT
TOD Convert
UDINT
08:30:15 30615
Symbol
EN=1 ENO=1
INT_TO_REAL
INT Convert
REAL
32767 3.2767E+04
Symbol
EN=1 ENO=1
2-195
Section 2 Programming Language Type conversion FCT
DINT_TO_REAL
DINT Convert
REAL
2147483647 2.1474836E+09
Symbol
EN=1 ENO=1
UINT_TO_REAL
UINT Convert
REAL
65535 6.5535E+04
Symbol
EN=1 ENO=1
2-196
Section 2 Programming Language Type conversion FCT
UDINT_TO_REAL
UDINT Convert
REAL
4294967295 4.2949673E+09
Symbol
EN=1 ENO=1
TIME_TO_REAL
TIME Convert
REAL
5h20m15s 1.92150E+07
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of TIME type: 0 to 4,294,967,295 (ms)
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
(1) TIME_TO_REAL converts TIME type data
Function
2-197
Section 2 Programming Language Type conversion FCT
WORD 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Symbol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EN=1
Convert
WORD WORD_TO_BOOL BOOL BOOL 1
ENO=1
WORD 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0
WORD type data to BOOL type data.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EN=1
Convert
BOOL 0
ENO=1
0 0 1 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 1 1 0 0 1 1 1 0 1 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DWORD DWORD_TO_BOOL BOOL EN=1
Convert
BOOL 1
ENO=1
(1) DWORD_TO_BOOL converts bit 0 of • When bit 0 of DWORD type data is “0”
Function
2-198
Section 2 Programming Language Type conversion FCT
BOOL 1
Symbol
EN=1 Convert
WORD 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ENO=1
DWORD_TO_WORD
DWORD
0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
Symbol
EN=1
Truncated Convert
DWORD DWORD_TO_WORD WORD
WORD 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
ENO=1
2-199
Section 2 Programming Language Type conversion FCT
INT_TO_WORD
INT Convert
WORD
32767 16#7FFF
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of INT type: -32,768 to 32,767
Value range of WORD type: 16#0000 to 16#FFFF
(1) INT_TO_WORD converts INT type data to
Function
UINT_TO_WORD
UINT Convert
WORD
1234 16#04D2
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of UINT type: 0 to 65,535
Value range of WORD type: 16#0000 to 16#FFFF
(1) UINT_TO_WORD converts UINT type
Function
2-200
Section 2 Programming Language Type conversion FCT
BOOL 1
Symbol
EN=1 Convert
DWORD
BOOL BOOL_TO_DWORD DWORD
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ENO=1
WORD_TO_DWORD
WORD 1 0 1 0 0 0 1 1 0 1 0 0 1 0 0 1
EN=1
Symbol
Convert
DWORD
WORD WORD_TO_DWORD DWORD
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 1 0 0 1 0 0 1
ENO=1
The higher-order 16 bits are set to “0.”
2-201
Section 2 Programming Language Type conversion FCT
DINT_TO_DWORD
DINT Convert
DWORD
2147483647 16#7FFFFFFF
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
(1) DINT_TO_DWORD converts DINT type
Function
UDINT_TO_DWORD
UDINT Convert
DWORD
4294967295 16#7FFFFFFF
Symbol
EN=1 ENO=1
[F.Y.I.]
Value range of UDINT type: 0 to 4,294,967,295
Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
(1) UDINT_TO_DWORD converts UDINT
Function
2-202
Section 2 Programming Language Type conversion FCT
INT_TO_TIME • When the operation result falls within the valid value range of the TIME
type
Symbol
INT Convert
TIME
32767 32s767ms
INT INT_TO_TIME TIME EN=1 ENO=1
• When the operation result exceeds the valid value range of the TIME
type
(1) INT_TO_TIME converts INT type INT TIME
Function
Convert
data to TIME type data. -32768 0ms
(2) If the input INT value exceeds the valid EN=1 ENO=0
range of TIME type after type conversion,
the lower limit value (0ms) of TIME type is
output. [F.Y.I.]
(3) 1 is converted to 1ms. Value range of INT type: -32,768 to 32,767
Value range of TIME type: 0 to 4,294,967,295 (ms)
DINT_TO_TIME • When the operation result falls within the valid value range of the TIME
type
Symbol
DINT Convert
TIME
2147483647 24d20h31m23s647ms
DINT DINT_TO_TIME TIME EN=1 ENO=1
• When the operation result exceeds the valid value range of the TIME
type
(1) DINT_TO_TIME converts DINT type DINT TIME
Function
Convert
data to TIME type data. -2147483648 0ms
(2) If the input DINT value exceeds the valid EN=1 ENO=0
range of TIME type after type conversion,
the lower limit value (0ms) of TIME type is
output. [F.Y.I.]
(3) 1 is converted to 1ms. Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of TIME type: 0 to 4,294,967,295 (ms)
2-203
Section 2 Programming Language Type conversion FCT
UINT_TO_TIME
UINT Convert
TIME
65535 1m5s535ms
Symbol
EN=1 ENO=1
UDINT_TO_TIME
UDINT Convert
TIME
4294967295 49d17h2m47s295ms
Symbol
EN=1 ENO=1
2-204
Section 2 Programming Language Type conversion FCT
REAL_TO_TIME • When the operation result falls within the valid value range of the TIME
type
Symbol
REAL Convert
TIME
2.147E+09 24d20h23m20s
REAL REAL_TO_TIME TIME EN=1 ENO=1
• When the operation result exceeds the valid value range of the TIME
type
(1) REAL_TO_TIME converts REAL type REAL TIME
Function
Convert
data to TIME type data. 5.000E+09 49d17h2m47s295ms
(2) The appropriate limit value of the TIME EN=1 ENO=0
type is generated if the result of
REAL TIME
converting the REAL value exceeds the Convert
valid value range of the TIME type. -1.234E+10 0ms
(3) The fractional part is rounded off. EN=1 ENO=0
(4) 1 is converted to 1 ms.
(5) The converted value contains some
[F.Y.I.]
degree of error because the number of
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
significant digits of the REAL type data is
Value range of TIME type: 0 to 4,294,967,295 (ms)
6 digits.
UDINT_TO_DT
UDINT Convert
DT
891419415 1998-04-01-08:30:15
Symbol
EN=1 ENO=1
UDINT UDINT_TO_DT DT
to DT type data.
(2) The UDINT type data is converted to DT
type data which starts from 0:00:00
January 1st, 1970 and is specified in
seconds.
2-205
Section 2 Programming Language Type conversion FCT
UDINT_TO_DATE
UDINT Convert
DATE
891419415 1998-04-01
Symbol
EN=1 ENO=1
UDINT_TO_TOD
UDINT Convert
TOD
891419415 08:30:15
Symbol
EN=1 ENO=1
2-206
Section 2 Programming Language Type conversion FCT
TRUNC_INT • When the operation result falls within the valid value range of the INT
type
Symbol
REAL Convert
INT
6.789E+02 678
REAL TRUNC_INT INT EN=1 ENO=1
• When the operation result exceeds the valid value range of the INT
type
(1) TRUNC_INT converts REAL type data to REAL INT
Function
Convert
INT type data. 4.000E+04 32767
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of INT type after type conversion, the
REAL INT
boundary value of INT type is output. Convert
(3) The fractional part is truncated. -5.000E+04 -32768
EN=1 ENO=0
[F.Y.I.]
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of INT type: -32,768 to 32,767
TRUNC_DINT • When the operation result falls within the valid value range of the DINT
type
Symbol
REAL Convert
DINT
6.789E+02 678
REAL TRUNC_DINT DINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the DINT
type
(1) TRUNC_DINT converts REAL type data to REAL DINT
Function
Convert
DINT type data. 2.147E+10 2147483647
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of DINT type after type conversion,
REAL DINT
the boundary value of DINT type is output. Convert
(3) The fractional part is truncated. -2.147E+10 -2147483648
(4) The number of significant digits after EN=1 ENO=0
conversion is 6 digits.
[F.Y.I.]
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of DINT type: -2,147,483,648 to 2,147,483,647
2-207
Section 2 Programming Language Type conversion FCT
TRUNC_UINT • When the operation result falls within the valid value range of the UINT
type
Symbol
REAL Convert
UINT
6.789E+02 678
REAL TRUNC_UINT UINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UINT
type
(1) TRUNC_UINT converts REAL type data REAL UINT
Function
Convert
to UINT type data. 7.000E+04 65535
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of UINT type after type conversion,
REAL UINT
the boundary value of UINT type is output. Convert
(Boundary value: 0, 65535) -5.000E+04 0
(3) The fractional part is truncated. EN=1 ENO=0
[F.Y.I.]
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of UINT type: 0 to 65,535
TRUNC_UDINT • When the operation result falls within the valid value range of the UDINT
type
Symbol
REAL Convert
UDINT
6.789E+02 678
REAL TRUNC_UDINT UDINT EN=1 ENO=1
• When the operation result exceeds the valid value range of the UDINT
type
(1) TRUNC_UDINT converts REAL type data REAL UDINT
Function
Convert
to UDINT type data. 4.294E+10 4294967295
(2) If the input REAL value exceeds the valid EN=1 ENO=0
range of UDINT type after type conversion,
REAL UDINT
the boundary value of UDINT type is output. Convert
(Boundary value: 0, 4294967295) -50000.0 0
(3) The fractional part is truncated. EN=1 ENO=0
(4) The number of significant digits after
conversion is 6 digits. [F.Y.I.]
Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128
Value range of UDINT type: 0 to 4,294,967,295
2-208
Section 2 Programming Language Type conversion FCT
1234 1234
EN=1 ENO=1
WORD W_BCD_TO_INT INT
• When the input value is not BCD code
WORD Convert
INT
16#23FF 0
(1) W_BCD_TO_INT regards WORD type
Function
EN=1 ENO=0
data as BCD code and converts it to INT
type data.
(2) If the input WORD value is other than BCD [F.Y.I.]
code, “0” is output. Value range of WORD type as interpreted as BCD code
: WORD#0000 to WORD#9999
Value range of INT type : -32,768 to 32,767
D_BCD_TO_INT • When the operation result falls within the valid value range of the INT
type
DWORD INT
Symbol
Convert
32767 32767
EN=1 ENO=1
DWORD D_BCD_TO_INT INT
• When the operation result exceeds the valid value range of the INT
type
DWORD Convert
INT
(1) D_BCD_TO_INT regards DWORD data
Function
99999999 32767
as BCD code and converts it to INT type EN=1 ENO=0
data.
(2) If the input DWORD value exceeds the valid • When the input value is not BCD code.
range of INT type after type conversion, the DWORD INT
upper limit value (32767) of INT type is Convert
16#0000FFFF 0
output.
EN=1 ENO=0
(3) If the input DWORD value is other than
BCD code, “0” is output.
[F.Y.I.]
Value range of DWORD type as interpreted as BCD code
: WORD#00000000 to WORD#99999999
Value range of INT type : -32,768 to 32,767
2-209
Section 2 Programming Language Type conversion FCT
1234 1234
EN=1 ENO=1
WORD W_BCD_TO_DINT DINT
• When the input value is not BCD code
WORD Convert
DINT
16#23FF 0
(1) W_BCD_TO_DINT regards WORD data
Function
EN=1 ENO=0
as BCD code and converts it to DINT type
data.
(2) If the input WORD value is other than BCD [F.Y.I.]
code, “0” is output. Value range of WORD type as interpreted as BCD code
: 16#0000 to 16#9999
Value range of DINT type : -2,147,483,648 to 2,147,483,647
D_BCD_TO_DINT • When the operation result falls within the valid value range of the DINT
type
Symbol
DWORD Convert
DINT
16#99999999 99999999
DWORD D_BCD_TO_DINT DINT EN=1 ENO=1
16#00123FF 0
as BCD code and converts it to DINT type EN=1 ENO=0
data.
(2) A “0” is generated if the input WORD
value is not BCD code. [F.Y.I.]
Value range of DWORD type as interpreted as BCD code
: 16#00000000 to 16#99999999
Value range of DINT type : -2,147,483,648 to 2,147,483,647
2-210
Section 2 Programming Language Type conversion FCT
INT_TO_W_BCD • When the operation result falls within the valid value range of the WORD
type
Symbol
INT Convert
WORD
9999 16#9999
INT INT_TO_W_BCD WORD EN=1 ENO=1
• When the operation result exceeds the valid value range of the WORD
type
(1) INT_TO_W_BCD BCD-converts INT type INT WORD
Function
Convert
data to WORD type data. 32767 16#9999
(2) If the input INT value exceeds the valid EN=1 ENO=0
range of WORD type after type conversion,
INT WORD
the boundary value of WORD type (BCD Convert
code) is output. -32768 16#0000
EN=1 ENO=0
[F.Y.I.]
Value range of INT type : -32,768 to 32,767
Value range of WORD type as interpreted as BCD code
: 16#0000 to 16#9999
DINT_TO_W_BCD • When the operation result falls within the valid value range of the WORD
type
Symbol
DINT Convert
WORD
9999 16#9999
DINT DINT_TO_W_BCD WORD EN=1 ENO=1
• When the operation result exceeds the valid value range of the WORD
type
(1) DINT_TO_W_BCD BCD-converts DINT WORD
Function
Convert
DINT type data to WORD type data. 2147483647 16#9999
(2) If the input DINT value exceeds the valid EN=1 ENO=0
range of WORD type after type conversion,
DINT WORD
the boundary value of WORD type (BCD Convert
code) is output. -2147483648 16#0000
EN=1 ENO=0
DINT WORD
[F.Y.I.]
Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of WORD type as interpreted as BCD code
: 16#0000 to 16#9999
2-211
Section 2 Programming Language Type conversion FCT
INT_TO_D_BCD • When the operation result falls within the valid value range of the
DWORD type
Symbol
INT Convert
DWORD
32767 16#32767
INT INT_TO_D_BCD DWORD
EN=1 ENO=1
• When the operation result exceeds the valid value range of the
DWORD type
(1) INT_TO_D_BCD BCD-converts INT
Function
DINT_TO_D_BCD • When the operation result falls within the valid value range of the
DWORD type
Symbol
DINT Convert
DWORD
99999999 16#99999999
DINT DINT_TO_D_BCD DWORD EN=1 ENO=1
• When the operation result exceeds the valid value range of the
DWORD type
(1) DINT_TO_D_BCD BCD-converts
Function
DINT Convert
DWORD
DINT type data to DWORD type data.
2147483647 16#99999999
(2) If the input DINT value exceeds the valid
EN=1 ENO=0
range of DWORD type after type
conversion, the boundary value of DWORD DINT Convert
DWORD
type (BCD code) is output. -2147483648 16#00000000
EN=1 ENO=0
[F.Y.I.]
Value range of DINT type : -2,147,483,648 to 2,147,483,647
Value range of DWORD type as interpreted as BCD code
: 16#00000000 to 16#99999999
2-212
Section 2 Programming Language String FCT
LEN
STRING ABCDEFGHIJ EN=1
Symbol
Compute
INT 10 ENO=1
the number of characters in the input data No. of characters of STRING type: 0 to 64 chanarcters
of STRING type.
LEFT
STRING ABCDEFGHIJ
Symbol
UINT 5 EN=1
LEFT
STRING IN STRING
UINT L
Extract
2-213
Section 2 Programming Language String FCT
RIGHT
STRING ABCDEFGHIJ EN=1
Symbol
UINT 5
RIGHT
STRING IN STRING
UINT L Extract
MID
STRING ABCDEFGHIJ EN=1
Symbol
2-214
Section 2 Programming Language String FCT
CONCAT EN=1
STRING ABCDEFGHIJ (First input)
Symbol
INSERT EN=1
STRING ABCDEFGHIJ (First input)
Symbol
Insert
(1) INSERT inserts the string designated by
Function
2-215
Section 2 Programming Language String FCT
DELETE EN=1
STRING ABCDEFGHIJ (First input)
Symbol
Delete
(1) DELETE deletes the number of characters
Function
REPLACE EN=1
STRING ABCDEFGHIJ (First input)
Symbol
third input starting from the Pth one (the fourth Replace
input) of the STRING type data in the first input
and inserts the string in the second input.
(2) If the number of replaced characters exceeds 64 STRING ABXYZHIJ ENO=1
characters, the first 64 characters are stored and
ENO is set to 0.
(3) If P >= 65 or P = 0, the output is NULL and ENO is [F.Y.I.]
No. of characters of STRING type: 0 to 64 chanarcters
set to 0.
(4) If the number of characters of the first input < P,
the first input is output and ENO is set to 0.
(5) If L = 0, the second input is inserted starting at the
Pth character position and ENO is set to 1.
2-216
Section 2 Programming Language String FCT
FIND EN=1
STRING ABXYZHIJ (First input)
Symbol
GT_STRING
GT_STRING
INDATA1 IN1 FLAG
Symbol
INDATA2 IN2
GT_STRING
STRING IN1 BOOL
STRING IN2 <Operation>
1-byte character Character code
first input > second input is met. It outputs INDATA2 82A6, [0000], [0000]
a 0 if the above condition is not met.
(2) The result of executing a compare
Consequently,
instruction is BOOL type data (1 or 0).
INDATA1 > INDATA2 holds, and FLAG is set to 1.
(3) Available data type is STRING type.
(4) GT_STRING converts the string into a
Notes:
sequence of character codes and
1) The function regards a 1-byte character as a 16-bit code by placing
compares the character codes as numeric
an 8-bit “00” in the higher-order byte position of the 16-bit code.
data.
2) If the strings to compare have different lengths, “0000” is appended
to the shorter string from the right side.
[F.Y.I.]
No. of characters of STRING type: 0 to 64 chanarcters
2-217
Section 2 Programming Language String FCT
GE_STRING
GE_STRING
String 1 IN1 FLAG
Symbol
String 2 IN2
GE_STRING
STRING IN1 BOOL
STRING IN2 <Operation>
• When the input data is of TIME type
Character code
(1) GE_STRING outputs a 1 if the condition
Function
String 1 82CD82E9
first input ≥ second input is met. It outputs
a 0 if the above condition is not met. String 2 82C882C2
(2) Available data type is STRING type.
(3) GE_STRING converts the string into a Consequently,
sequence of character codes and String 1 >= String 2 holds, and FLAG is set to 1.
compares the character codes as numeric
data.
[F.Y.I.]
No. of characters of STRING type: 0 to 64 chanarcters
EQ_STRING
EQ_STRING
Code 1 IN1 FLAG
Symbol
Code 2 IN2
EQ_STRING
STRING IN1 BOOL
STRING IN2 <Operation>
Code 1 ABCD
(1) EQ_STRING outputs a 1 if the condition
Function
Code 2 ABCD
first input = second input is met. It outputs
a 0 if the above condition is not met.
Consequently,
(2) Available data type is STRING type.
Code 1 = Code 2 holds, and FLAG is set to 1.
(3) GT_STRING converts the string into a
sequence of character codes and
compares the character codes as numeric [F.Y.I.]
data. No. of characters of STRING type: 0 to 64 chanarcters
2-218
Section 2 Programming Language String FCT
LE_STRING
LE_STRING
STR_1 IN1 FLAG
Symbol
STR_2 IN2
LE_STRING
STRING IN1 BOOL
STRING IN2 <Operation>
LT_STRING
LT_STRING
SD1 IN1 FLAG
Symbol
SD2 IN2
LT_STRING
STRING IN1 BOOL
STRING IN2 <Operation>
SD1 D 8263
2-219
Section 2 Programming Language String FCT
NE_STRING
NE_STRING
Message 1 IN1 FLAG
Symbol
Message 2 IN2
NE_STRING
STRING IN1 BOOL
STRING IN2 <Operation>
Message 1 ON Compute
FLAG 1
(1) NE_STRING outputs a 1 if the condition
Function
2-220
Section 2 Programming Language Time type data FCT
ADD_T_T • When the operation results falls within the limit value range of the data
type
TIME TIME TIME
Symbol
Compute
ADD_T_T 2h10m20s123ms + 1h09m50s456ms 3h20m10s579ms
TIME TIME EN=1 ENO=1
TIME
• When the operation result exceeds the limit value range of the data
type
(1) ADD_T_T adds together TIME type data.
Function
TIME TIME
(2) The overflow condition is ignored and ENO
30d2h10m20s123ms + 25d1h09m50s456ms
is set to 0 if the operation result exceeds
the limit value range of the TIME type. EN=1 Compute TIME
5d10h17m23s283ms
ENO=0
[F.Y.I.]
Data range of TIME type: 0 to 4,294,967,295 (ms)
ADD_TD_T • When the operation results falls within the limit value range of the data
type
TOD TIME TOD
Symbol
Compute
ADD_TD_T 17:54:30 + 5m55s123ms 18:00:25
TOD TOD
EN=1 ENO=1
TIME • When the operation result exceeds the limit value range of the data
type
(1) ADD_TD_T adds together TOD type data TOD TIME Compute TOD
Function
ADD_DT_T
DT TIME
1997-06-25-10:10:00 + 7d20h30m40s567ms
Symbol
EN=1 Compute DT
ADD_DT_T
DT DT 1997-07-03-06:40:40
TIME ENO=1
2-221
Section 2 Programming Language Time type data FCT
SUB_T_T • When the operation results falls within the limit value range of the data
type
TIME TIME TIME
Symbol
Compute
2h10m20s123ms - 1h09m50s456ms 1h29s667ms
SUB_T_T
TIME TIME EN=1 ENO=1
TIME
• When the operation result exceeds the limit value range of the data
type
(1) SUB_T_T performs a subtraction on TIME
Function
TIME TIME
type data.
(2) The underflow condition is ignored and 1h09m50s456ms - 2h10m20s123ms
ENO is set to 0 if the operation result EN=1 Compute TIME
exceeds the limit value range of the TIME 49d16h02m17s629ms
type. ENO=0
[F.Y.I.]
(Limit values: 0, 49d17h02m47s295ms) Data range of TIME type: 0 to 4,294,967,295 (ms)
SUB_D_D • When the operation results falls within the limit value range of the data
type
DATE DATE TIME
Symbol
Compute
SUB_D_D 1997-06-25 - 1997-06-20 5d
DATE TIME
EN=1 ENO=1
DATE • When the operation result exceeds the limit value range of the data
type
(1) SUB_D_D performs a subtraction on DATE DATE DATE Compute TIME
Function
type data and outputs TIME type data. 1997-06-25 - 1997-03-20 49d17h02m47s295ms
(2) If the operation result exceeds the positive EN=1 ENO=0
limit value of the data type, the limit value of
the data type is output and ENO is set to 0.
(3) Correct output value is not guaranteed if
the operation result is negative. ENO is
set to 0 in this case.
SUB_TD_T • When the operation results falls within the limit value range of the data
type
TOD TIME TOD
Symbol
Compute
SUB_TD_T 19:30:00 - 1h30m123ms 18:00:00
TOD TOD
EN=1 EN=1
TIME
• When the operation result exceeds the limit value range of the data
type
(1) SUB_TD_T performs a subtraction on TOD TOD TIME Compute TOD
Function
type data and TIME type data and outputs 17:54:30 - 20h5m55s123ms 21:48:35
TOD type data. EN=1 EN=0
(2) The ms fraction of the TIME data is truncated.
(3) If the operation result exceeds the limit value
range of the TOD type, its 24-hour system
equivalent is output and ENO is set to 0.
(Limit values: 00:00:00, 23:59:59)
2-222
Section 2 Programming Language Time type data FCT
SUB_TD_TD
TOD TOD Compute TIME
15:30:15 - 08:15:08 7h15m7s0ms
Symbol
EN=1 ENO=1
SUB_TD_TD
TOD TIME
TOD
SUB_DT_T
DT TIME
1997-06-25-10:10:00 - 7d20h30m40s567ms
Symbol
EN=1 Compute DT
SUB_DT_T
DT DT 1997-06-17-13:39:20
TIME ENO=1
SUB_DT_DT
DT DT
1998-04-02-15:30:15 - 1998-04-01-08:15:08
Symbol
2-223
Section 2 Programming Language Time type data FCT
MUL_T_N • When the operation results falls within the limit value range of the data
type
TIME UDINT TIME
Symbol
Compute
MUL_T_N 5h30m x 2 11h
TIME TIME
EN=1 ENO=1
UDINT
• When the operation result exceeds the limit value range of the data
(1) MUL_T_N multiplies TIME type data by the type
Function
MUL_T_R • When the operation results falls within the limit value range of the data
type
TIME REAL TIME
Symbol
Compute
MUL_T_R 5h30m x 2.5E+0 13h45m
TIME TIME
EN=1 ENO=1
REAL • When the operation result exceeds the limit value range of the data
type
(1) MUL_T_R multiplies TIME type data by the TIME REAL Compute TIME
Function
[F.Y.I.]
Data range of TIME type: 0 to 4,294,967,295 (ms)
2-224
Section 2 Programming Language Time type data FCT
DIV_T_N • When the operation results falls within the limit value range of the data
type
TIME UDINT TIME
Symbol
Compute
DIV_T_N 5h30m / 2 2h45m
TIME TIME
EN=1 ENO=1
UDINT
• When a divider is 0
(1) DIV_T_N performs a division on TIME type TIME UDINT TIME
Function
Compute
data. 5h30m / 2 49d17h02m47s295ms
(2) Any digits in the result less than ms-unit EN=1 ENO=0
digits are truncated.
(3) When a divider is 0, a TIME type of
boundary value is output, resulting in [F.Y.I.]
ENO = 0. Data range of TIME type: 0 to 4,294,967,295 (ms)
DIV_T_R • When the operation results falls within the limit value range of the data
type
TIME REAL TIME
Symbol
Compute
DIV_T_R 5h30m / 2.5E+0 2h12m
TIME TIME
EN=1 ENO=1
REAL
• When the operation result exceeds the limit value range of the data
type
(1) DIV_T_R multiplies TIME type data by the TIME REAL Compute TIME
Function
[F.Y.I.]
Data range of TIME type: 0 to 4,294,967,295 (ms)
2-225
Section 2 Programming Language Time type data FCT
CONCAT_D_D • When the operation results falls within the limit value range of the data
type
DATE TOD DT
Symbol
Compute
CONCAT_D_D 1997-06-25 10:10:00 1997-06-25-10:10:00
DATE DT
EN=1 Concatenate ENO=1
TOD
• When the operation result exceeds the limit value range of the data
(1) CONCAT_D_D concatenates TOD type type
Function
DT_TO_TOD
DT Convert
TOD
1997-06-25-10:10:00 10:10:00.00
Symbol
EN=1 ENO=1
DT DT_TO_TOD TOD
DT_TO_DATE
DT Convert
DATE
1997-06-25-10:10:00 1997-06-25
Symbol
EN=1 ENO=1
DT DT_TO_DATE DATE
2-226
Section 2 Programming Language Double-precision
floating-point calculation FCT
63 62 52 51 0
The double-precision number (DOUBLE) consists of a symbol (S), 11-bit exponential part (Exp), and 52-bit fractional part
(Fraction). If a floating-point number v is expressed as follows:
v = a x 2e x m
a = + 1 (Positive) S is 0 in DOUBLE format notation.
a = - 1 (Negative) S is 1 in DOUBLE format notation.
e = Exp - 1023
(Stored with 1023 added to the exponent, i.e., biased by 1023.)
m = 1 Fraction
(The decimal point comes after 1 in binary, followed by the binary bit-string fractional part.)
Therefore, it is expressed as 1 <= m < 2.
[Reference]
In the above format, the following expressions are possible by combining the exponential and fractional part.
The normalized numbers and 0 are numerical expressions that can always be used. Denormalized numbers are numbers
between 0 and the smallest normalized number in the exponent.
“Not a number” is used to express illegal results and undefined results, such as the square root of a negative number.
Notes:
As explained above, double-precision floating-point numbers enables handling values that are not numbers and denormalized
numbers. The double-precision floating-point numbers used in the SPH2000, however, consist of only 0 and normalized
numbers.
2-227
Section 2 Programming Language Double-precision
floating-point calculation FCT
D_REAL:
STRUCT
LDATA : DWORD;
UDATA : DWORD;
END_STRUCT;
63 62 52 51 32 31 0
UDATA LDATA
Symbol part (S)
DOUBLE_TO_UDINT
D_REAL UDINT
The EN and ENO terminals are used when the graphic notation setting is enabled. (These terminals cannot be used with text
descriptions in ST language.)
Note: The description of each function excludes the interface of the EN and ENO terminals.
The FALSE condition of the ENO terminal is described for each function.
2-228
Section 2 Programming Language Double-precision
floating-point calculation FCT
[F.Y.I.] Rounding
A numerical value may overflow because the value cannot be expressed in the data format of the calculation results, e.g., as
with a value with digits below the decimal point for DOUBLE_TO_DINT. In that case, the value is rounded up or down to the
least significant bit. This is called rounding.
The double-precision decimal calculations of SPH2000/SPH3000 uses the round-to-nearest method.
The round-to-nearest method uses either the rounded-up or rounded-down value, whichever is closer to the original value.
(This is similar to rounding in decimal.)
If the rounded-down value is just as close as the rounded-up value, the original value will be rounded to make the least
significant bit to 0. This is called even-number rounding.
This is because the results of calculation are statistically expressed with larger values if rounding as in decimal is always used.
An example is shown below.
Example of rounding values with two integer digits and two binary digits
2-229
Section 2 Programming Language Double-precision
floating-point calculation FCT
No. of
Types Names Overview Page
steps
Type Converts INT data (16-bit signed integer) to DOUBLE type data
INT_TO_DOUBLE 7 P2-232
conversion (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_INT 3 P2-232
conversion into INT data (16-bit signed integer).
Type Converts UINT type data (16-bit unsigned integer) into DOUBLE
UINT_TO_DOUBLE 7 P2-233
conversion type data (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_UINT 3 P2-233
conversion into UINT type data (16-bit unsigned integer).
Type Converts DINT type data (32-bit signed integer) into DOUBLE type
DINT_TO_DOUBLE 7 P2-234
conversion data (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_DINT 3 P2-234
conversion into DINT type data (32-bit signed integer).
Type Converts UDINT type data (32-bit unsigned integer) into DOUBLE
UDINT_TO_DOUBLE 7 P2-235
conversion type data (double-precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_UDINT 3 P2-235
conversion into UDINT type data (32-bit unsigned integer).
Type Converts REAL data (single-precision floating-point data) into
REAL_TO_DOUBLE 7 P2-236
conversion DOUBLE type data (double- precision floating-point data).
Type Converts DOUBLE type data (double-precision floating-point data)
DOUBLE_TO_REAL 3 P2-236
conversion into REAL data (single- precision floating-point data).
Type
RAD_DOUBLE Converts angles into radians. 7 P2-237
conversion
Type
DEG_DOUBLE Converts radians into angles. 7 P2-237
conversion
Arithmetic ADD_DOUBLE Adds DOUBLE type data (double-precision floating-point data). 8 P2-238
Arithmetic SUB_DOUBLE Subtracts DOUBLE type data (double-precision floating-point data). 8 P2-238
Arithmetic MUL_DOUBLE Multiplies DOUBLE type data (double-precision floating-point data). 8 P2-239
Arithmetic DIV_DOUBLE Divides DOUBLE type data (double-precision floating-point data). 8 P2-239
Calculates the sine of DOUBLE type data (double-precision
Arithmetic SIN_DOUBLE 7 P2-240
floating-point data) (radians).
Calculates the cosine of DOUBLE type data (double-precision
Arithmetic COS_DOUBLE 7 P2-240
floating-point data) (radians).
Calculates the tangent of DOUBLE type data (double-precision
Arithmetic TAN_DOUBLE 7 P2-241
floating-point) (radians).
Calculates the arc sine of DOUBLE type data (double-precision
Arithmetic ASIN_DOUBLE 7 P2-241
floating-point data).
Calculates the arc cosine of DOUBLE type data (double-precision
Arithmetic ACOS_DOUBLE 7 P2-242
floating-point data).
Calculates the arc tangent of DOUBLE type data (double-precision
Arithmetic ATAN_DOUBLE 7 P2-242
floating-point data).
Calculates the square root of DOUBLE type data (double-precision
Arithmetic SQRT_DOUBLE 7 P2-243
floating-point data).
Calculates the exponent of DOUBLE type data (double-precision
Arithmetic EXP_DOUBLE 7 P2-243
floating-point data).
2-230
Section 2 Programming Language Double-precision
floating-point calculation FCT
2-231
Section 2 Programming Language Double-precision
floating-point calculation FCT
INT_TO_DOUBLE
INT type minimum value
Symbol
UDATA LDATA
C0E00000 00000000
UDATA LDATA
40DFFFC0 00000000
DOUBLE_TO_INT
When the operation result falls within the valid value range of the INT
type.
Symbol
UDATA LDATA
00100000 00000000
1) DOUBLE_TO_INT converts DOUBLE type
Function
2-232
Section 2 Programming Language Double-precision
floating-point calculation FCT
UINT_TO_DOUBLE
UINT type minimum value
Symbol
UDATA LDATA
00000000 00000000
UDATA LDATA
40EFFFE0 00000000
DOUBLE_TO_UINT
• When the operation result falls within the valid value range of the UINT
type.
Symbol
UDATA LDATA
00100000 00000000
1) DOUBLE_TO_UINT converts DOUBLE
Function
2-233
Section 2 Programming Language Double-precision
floating-point calculation FCT
DINT_TO_DOUBLE
DINT type minimum value
Symbol
UDATA LDATA
C1E00000 00000000
UDATA LDATA
41DFFFFF FFC00000
DOUBLE_TO_DINT
• When the operation result falls within the valid value range of the DINT
type.
Symbol
UDATA LDATA
00100000 00000000
1) DOUBLE_TO_DINT converts DOUBLE
Function
2-234
Section 2 Programming Language Double-precision
floating-point calculation FCT
UDINT_TO_DOUBLE
UDINT type minimum value
Symbol
UDATA LDATA
00000000 00000000
UDATA LDATA
41EFFFFF FFE00000
DOUBLE_TO_UDINT
• When the operation result falls within the valid value range of the UDINT
type.
Symbol
UDATA LDATA
00100000 00000000
1) DOUBLE_TO_UDINT converts DOUBLE
Function
2-235
Section 2 Programming Language Double-precision
floating-point calculation FCT
REAL_TO_DOUBLE
REAL Convert D_REAL
- 2^126 +8.50705917302346E + 37
Symbol
ENO=1 EN=1
UDATA LDATA
REAL REAL_TO_DOUBLE D_REAL
47D00000 00000000
DOUBLE_TO_REAL
• When the operation result falls within the valid value range of the REAL
type.
Symbol
UDATA LDATA
00100000 00000000
1) DOUBLE_TO_REAL converts DOUBLE
Function
2-236
Section 2 Programming Language Double-precision
floating-point calculation FCT
RAD_DOUBLE
• When the operation result falls within the valid value range of the D_REAL
type.
Symbol
DEG_DOUBLE
• When the operation result falls within the valid value range of the D_REAL
type.
Symbol
2-237
Section 2 Programming Language Double-precision
floating-point calculation FCT
ADD_DOUBLE
• Computation example 1)
Symbol
SUB_DOUBLE
• Computation example 1)
Symbol
2-238
Section 2 Programming Language Double-precision
floating-point calculation FCT
MUL_DOUBLE
• Computation example 1)
Symbol
DIV_DOUBLE
• Computation example 1)
Symbol
2-239
Section 2 Programming Language Double-precision
floating-point calculation FCT
SIN_DOUBLE
• Computation example 1)
Symbol
COS_DOUBLE
• Computation example 1)
Symbol
2-240
Section 2 Programming Language Double-precision
floating-point calculation FCT
TAN_DOUBLE
• Computation example 1)
Symbol
ASIN_DOUBLE
• Computation example 1)
Symbol
2-241
Section 2 Programming Language Double-precision
floating-point calculation FCT
ACOS_DOUBLE
• Computation example 1)
Symbol
ATAN_DOUBLE
• Computation example 1)
Symbol
2-242
Section 2 Programming Language Double-precision
floating-point calculation FCT
SQRT_DOUBLE
• Computation example 1)
Symbol
EXP_DOUBLE
• Computation example 1)
Symbol
2-243
Section 2 Programming Language Double-precision
floating-point calculation FCT
LN_DOUBLE
• Computation example 1)
Symbol
2-244
Section 2 Programming Language Double-precision
floating-point calculation FCT
EQ_DOUBLE
• Computation example 1)
Symbol
NE_DOUBLE
• Computation example 1)
Symbol
2-245
Section 2 Programming Language Double-precision
floating-point calculation FCT
GT_DOUBLE
• Computation example 1)
Symbol
GE_DOUBLE
• Computation example 1)
Symbol
2-246
Section 2 Programming Language Double-precision
floating-point calculation FCT
LT_DOUBLE
• Computation example 1)
Symbol
LE_DOUBLE
• Computation example 1)
Symbol
2-247
Section 2 Programming Language Double-precision
floating-point calculation FCT
2-4-14-6 Restrictions
1) Operation combinations
This appendix describes the operation of a loader that does not support the newly added instructions if the loader uses projects
created by a different loader that supports the newly added instructions. The operation of a loader supporting the newly
added instructions in combination with CPUs (a CPU other than SPH2000, versions not supporting the SPH2000, or versions
supporting the SPH2000) is also described.
(1) Operation of Expert with projects including newly added instructions used on an Expert that does not support the
newly added instructions
(2) Operation of the Expert that supports the newly added instructions and CPUs
Downloading
Target CPU Compiling
Loader User ROM
Other than SPH2000 Compilation error - Model mismatch
Version not supporting Downloading error
Fatal error (undefined FB/FCT)
SPH2000 (Not supporting version error)
Normally
Version supporting
Normally Normally
SPH2000
2-248
Section 2 Programming Language Double-precision
floating-point calculation FCT
1) Program notations
The following restrictions exist when writing programs in the D300win using double-precision floating-point data.
(1) Restriction 1
If double-precision floating-point output is connected to double-precision floating-point input as it is, a compilation error will occur
unless a D_REAL type variable is used in the instance program. In this case, declare the D_REAL type variable in the program.
No D_REAL type
variable exists, resulting
in a compilation error.
(2) Restriction 2
If double-precision floating-point output is connected to double-precision floating-point input as it is, a compilation error will occur
because the format cannot be specified. In that case, connect the output to the D_REAL type variable.
Connect to a D_REAL
type variable.
2-249
Section 2 Programming Language ST language
2-5 ST Language
2-5-1 Structure of ST language
The ST language consists of operators and statements. Operators perform basic operations such as arithmetic or comparison
operations. Statements specify the sequence of program execution and the flow of program control. ST language is a structured
text language that is composed of a combination of these operators and statements.
<Examples of ST language>
Comment
A comment begins with “(*”and ends with“*).”
* Statements, conditional expressions, and executable statements must be separated by at least one space character.
2-5-2 ST operators
2-250
Section 2 Programming Language ST language
2-5-3 ST statements
<Programming examples>
:= • Assigning the average of a, b, and c to v
v := (a + b + c)/3;
(1) The expression on the right-hand side • Assigning numeric value 52 to v
consists of operands, and instructions. v := 52;
The operands may be characters, variables, • Assigning the value of m to v.
function calls, or other expressions. v := m;
(2) The precedence of expression evaluation is
determined by the operators involved; the
operator with the highest precedence is
applied to its operand first. This evaluation
process is repeated until the evaluation
ends. (See the operator summary charts
on the previous pages for the precedence
of the operators.)
(3) The variable on the left-hand side and the
expression on the right-hand side of an
assignment statement must be of the same
data type. When assigning data of a data
type different from that of the target
variable, it is necessary to convert the data
type using a type conversion function.
2-251
Section 2 Programming Language ST language
(2) IF statement
END_IF;
IF The executable statement is executed
Conditional False
when the conditional expression
expression evaluates to be true.
True
Nothing is executed if the conditional
(1) The executable statement is executed if Executable
Function
END_IF;
Conditional False
expression 1
Conditional False
True expression 2
Executable
statement 1 True
Executable Conditional False
statement 2 expression 3
True
Executable
statement 3
2-252
Section 2 Programming Language ST language
CASE statement
CASE <conditional expression> OF
<selection value 1>: <executable statement 1>;
Symbol
<Programming example>
This program assigns 1 to signal when v (an average of a, b, and c)
= 10, 2 when V = 20, 3 when V = any of a range of 21 to 31, and
0 in other cases.
v:= (a + b + c)/ 3 ;
CASE v OF
10: signal :=1;
20: signal :=2;
21..30: signal :=3;
ELSE signal :=0;
END_CASE;
2-253
Section 2 Programming Language ST language
FOR statement
FOR <a:=initial value> TO <final value> BY <incremental value> DO
<executable statement>
Symbol
END FOR;
FOR
Loop variable (initial value)
<Programming example>
The sample program shown below assigns the value of b to array f at
every other index positions starting at a = 1.
(a=1, a=3, a=5, a=7, a=9)
FOR a:=1 TO 10 BY 2 DO
f [a]:=b;
END FOR;
2-254
Section 2 Programming Language ST language
WHILE statement
WHILE <loop condition> DO
<executable statement>;
Symbol
END_WHILE;
WHILE
Loop False
conditional
expression
(1) The WHILE statement performs loop
Function
a:=1;
WHILE b>1 DO
b:=b/2;
f[a]:=b;
a:=a+1;
END_WHILE;
REPEAT statement
REPEAT
<executable statement>;
Symbol
Executable statement
(1) The REPEAT statement performs loop
Function
2-255
Section 2 Programming Language ST language
<Programming example>
Symbol
END_IF ;
and returns control to the statement END_FOR ;
immediately following the loop construction
in which the EXIT statement is used. (* Exiting from a WHILE loop *)
N:=1 ;
WHILE N <= 10 DO ;
M:=M+N ;
IF M > 20 THEN EXIT ;
END_IF ;
N:=N+1;
END_WHILE ;
2-256
Section 2 Programming Language IL language
2-6 IL Language
2-6-1 Structure of IL language
An instruction in the IL language consists of an instruction symbol, a variable name, and a comment specified on a single line.
It is also possible to place a label, as shown on the first line of the figure below. The label serves as the destination of jump
instructions.
Label
A label is identified by the colon (“:”) that follows the
label name.
The label name must be no longer than 30 1-byte
characters or 15 2-byte characters.
Do not enter any operator or operand in the label line .
2-257
Section 2 Programming Language IL language
2-258
Section 2 Programming Language IL language
Notes:
BOOL type cannot be used for GT, GT(, GE or GE(, either.
2-259
Section 2 Programming Language IL language
G Key point:
The number of steps depends on the operand used. The number of steps for a variable that holds an array may be large.
2-260
Section 2 Programming Language IL language
Load Loads the value specified in “INPUT1” and sets it to the operation
result (PC internal register).
LD INPUT1
LD
<Operation>
(1) Starts the calculations in a series of • When the data type of INPUT1 is BOOL type
processes. Loads the value specified in the
operand and sets it to the operation result. INPUT1 1
(2) Available data types are all data types
(ANY type) of MICREX-SX series.
Operation result 1
Operation result 1 2 3 4
Operation result 1 0 0 0 1 0 0 0 1 0 0 1 1 0 1 0
Load not • Loads the inverted value of “INPUT1” and sets it to the operation
result.
LDN INPUT1
LDN
<Operation>
(1) Starts the calculations in a series of
• When the data type of INPUT1 is WORD type
processes. LDN loads the inverted value of
the operand and sets it to the operation INPUT1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1
result.
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). Operation result 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0
2-261
Section 2 Programming Language IL language
(3) Store ST
ST ST OUTPUT
<Operation>
(1) Stores the current operation result into
• When the data type of the operation result is BOOL type
the address specified in the operand.
(2) Available data types are all data types Operation result 1
(ANY type) of MICREX-SX series.
(3) The data type of the operand must be the
same as that of the operation result. OUTPUT 1
OUTPUT 1 2 3 4
OUTPUT 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1 1
Store not Stores the inverted boolean value of the current operation result
(before the STN instruction) in “OUTPUT.”
STN ST OUTPUT
<Operation>
(1) Stores the inverted value of the current • When the data type of the operation result is WORD type
operation result in the address specified in
the operand. Operation result 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type).
(3) The data type of the operand must be the INPUT2 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0
same as that of the operation result.
2-262
Section 2 Programming Language IL language
(5) Set S
S LD INPUT
S OUTPUT
(1) Sets the value of the address specified in
the operand to “TRUE” if the current <Operation>
operation result is “TRUE.” The value in the
Operation result TRUE FALSE “OUTPUT” remains 1
address specified in the operand remains
even when the value
unchanged if the current operation result is
of “INPUT” is changed
“FALSE.”
from 1 to 0.
(2) Available data type is BOOL type.
(6) Reset R
Reset Resets the value of “OUTPUT” which is set by “INPUT1” if the value
of “INPUT2” is 1.
R LD INPUT1
S OUTPUT
(1) Resets the value of the address specified
in the operand to “FALSE” if the current LD INPUT2
operation result is “TRUE.” The value in R OUTPUT
the address specified in the operand
remains unchanged if the current operation <Operation>
result is “FALSE.” Operation result TRUE
(2) Available data type is BOOL type.
OUTPUT FALSE
2-263
Section 2 Programming Language IL language
Logical product Masks the highest-order 2 digits of “INPUT” and sets the result to the
operation result.
AND LD INPUT
AND WORD#16#00FF
(1) Operates the logical product of the current
operation result and the operand value, and
sets the result to the operation result. <Operation>
(2) Available data type is ANY_BIT type INPUT 1 1 0 0 0 1 0 0 1 0 0 1 1 1 0 1
(BOOL type, WORD type, or DWORD type).
AND
Mask pattern 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Operation result 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1
Logical product Operates the logical product of the operation result, obtained by the
logical add of “INPUT1” and “INPUT2,” and the “MASK” data, and sets
the result to the operation result.
AND(
LD MASK
(1) Operates the logical product of the current AND( INPUT1
operation result and the operation result OR INPUT2
specified in parentheses, and sets the result )
to the operation result.
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). <Operation>
INPUT1 0 0 0 0 0 0 0 0 1 0 1 0 1 1 1 0
OR
INPUT2 1 0 0 1 1 1 0 0 0 1 0 0 1 0 1 0
Operation result 1 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0
AND
MASK 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Operation result 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0
2-264
Section 2 Programming Language IL language
Logical inverted product Operates the logical product of the “INPUT” data and the inverted value
of the “MASK,” and sets the result to the operation result.
ANDN LD INPUT
ANDN MASK
(1) Operates the logical product of the current
operation result and the inverted value of
the operand value, and sets the result to <Operation>
the operation result. MASK 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type).
Inverted value of MASK 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
AND
INPUT 1 1 0 0 1 1 0 0 0 1 1 0 0 0 1 1
Operation result 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0
Logical inverted product Operates the logical product of the “INPUT1” and the inverted value of
the operation value obtained by the logical product of “INPUT2” and
“INPUT3,” and sets the result to the operation result.
ANDN(
LD INPUT1
(1) Operates the logical product of the current ANDN( INPUT2
operation result and the inverted value of AND INPUT3
the operand value, and sets the result to )
the operation result.
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). <Operation>
INPUT2 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0
OR
INPUT3 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Inverted value of
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
boolean operation
AND
INPUT1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
Operation result 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0
2-265
Section 2 Programming Language IL language
Logical add Operates the logical add of the “INPUT1” data and the “INPUT2” data,
and sets the result to the operation result.
OR LD INPUT1
OR INPUT2
(1) Operates the logical add of the current
operation result and the value specified in
the operand value, and sets the result to <Operation>
the operation result. INPUT1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). OR
INPUT2 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0
Operation result 1 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1
Logical add Operates the logical add of the “INPUT1” data and the operation result
obtained by the logical product of the “INPUT2” data and the “INPUT3”
data, and sets the result to the operation result.
OR(
LD INPUT1
(1) Operates the logical add of the current OR( INPUT2
operation result and the operation result AND INPUT3
specified in parentheses, and sets the )
result to the operation result.
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). <Operation>
INPUT2 1 1 0 1 1 0 1 0 1 1 0 0 1 0 1 0
AND
INPUT3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Operation result 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0
OR
INPUT1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0
Operation result 1 1 1 0 0 1 1 1 1 1 0 0 1 0 1 0
2-266
Section 2 Programming Language IL language
Logical inverted add Operates the logical add of the “INPUT1” data and the inverted value of
the “INPUT2” data, and sets the result to the operation result.
ORN LD INPUT1
ORN INPUT2
(1) Operates the logical add of the current
operation result and the inverted value of
the operand value, and sets the result to <Operation>
the operation result. INPUT2 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type).
Inverted value of INPUT2 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1
OR
INPUT1 0 0 1 1 0 0 0 0 1 1 0 0 1 0 0 0
Operation result 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1
Logical inverted add Operates the logical add of the “INPUT1” data and the inverted value of
the operation result obtained by the logical product of the “INPUT2” data
and the “INPUT3” data, and sets the result to the operation result.
ORN(
LD INPUT1
(1) Operates the logical add of the current ORN( INPUT2
operation result and the inverted value of AND INPUT3
the operation result specified in )
parentheses, and sets the result to the
operation result.
(2) Available data type is ANY_BIT type <Operation>
(BOOL type, WORD type, or DWORD type). INPUT2 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1
AND
INPUT3 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1
Inverted velue 1 1 1 0 1 1 1 0 1 0 0 0 1 0 0 0
OR
INPUT1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
Operation result 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1
2-267
Section 2 Programming Language IL language
Exclusive OR Operates the exclusive OR of the “INPUT1” data and the “INPUT2” data,
and sets the result to the operation result.
XOR LD INPUT1
XOR INPUT2
(1) Operates the exclusive OR of the current
operation result and the operand value,
and sets the result to the operation result. <Operation>
(2) Available data type is ANY_BIT type INPUT1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 0 0
(BOOL type, WORD type, or DWORD type).
INPUT2 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
XOR
Operation result 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1
Exclusive OR Operates the exclusive OR of the “INPUT1” data and the operation
result obtained by the logical product of the “INPUT2” data and the
“INPUT3” data, and sets the result to the operation result.
XOR(
LD INPUT1
(1) Operates the exclusive OR of the current XOR( INPUT2
operation result and the operation result AND INPUT3
specified in parentheses, and sets the result )
to the operation result.
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). <Operation>
INPUT2 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1
AND
INPUT3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1
XOR
INPUT1 0 0 0 1 0 0 1 1 0 1 1 1 1 1 1 1
Operation result 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0
2-268
Section 2 Programming Language IL language
Exclusive NOR Operates the exclusive NOR of the “INPUT1” data and the inverted
value of the “INPUT2” data, and sets the result to the operation result.
XORN LD INPUT1
XORN INPUT2
(1) Operates the exclusive NOR of the current
operation result and the inverted value of
operand value, and sets the result to the <Operation>
operation result. INPUT2 0 0 1 1 1 1 0 0 1 1 0 0 0 0 0 0
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type).
Inverted value of INPUT2 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1
XOR
INPUT1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Operation result 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 1
Exclusive NOR Operates the exclusive NOR of the “INPUT1” data and the inverted
value of the operation result obtained by the logical product of the
“INPUT2” data and the “INPUT3” data, and sets the result to the
XORN( operation result.
AND
INPUT3 1 0 1 0 1 0 1 0 0 0 1 1 0 0 1 1
Inverted value 1 1 0 1 1 1 0 1 1 1 0 0 1 1 0 0
XOR
INPUT1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Operation result 0 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
2-269
Section 2 Programming Language IL language
Addition Operates the addition of the current operation result and the “ADATA”
data, and sets the result to the operation result.
(1) Operates the addition of the current <Operation> Example of INT type data
operation result and the operand value, and • When the result of operation falls within the valid value range
sets the result to the operation result. Current operation ADATA Operation result
(2) The data type of the operands must be the result Operation
same. 1234 5678 6912
+
(3) Available data type is ANY_NUM type EN=1 ENO=1
(REAL type, INT type, DINT type, UINT type
or UDINT type). • When the result of operation exceeds the valid value range
(4) ENO is set to 0 if the result of operation Operation
exceeds the valid value range of the 32767 + 32767 -2
operands (only for SPH). EN=1 ENO=0
Operation
-32768 + -32768 0
EN=1 ENO=0
Note 1: The CPU performs no boundary processing
when the operation result of operand types
other than REAL exceeds the valid value
range of the operands.
Make sure that the operation result does not
exceeds the valid value range of the
operands. The CPU performs boundary
processing for REAL operands.
Addition Operates the addition of the current operation result and the operation
result obtained by the addition of “INPUT1” and “INPUT2”, and sets the
result to the operation result.
ADD(
ADD( INPUT1
(1) Operates the addition of the current ADD INPUT2
operation result and the operation result )
specified in parentheses, and sets the
result to the operation result. <Operation> Example of INT type data
(2) The data type of the operands must be the • When the result of operation falls within the valid value range
same. Current operation Result of operation Operation result
(3) Available data type is ANY_NUM type result specified in
(REAL type, INT type, DINT type, UINT type parentheses
Operation
or UDINT type).
1234 + 5678 6912
(4) ENO is set to 0 if the result of operation
EN=1 ENO=1
exceeds the valid value range of the
operands (only for SPH). • When the result of execution exceeds the valid value range
Operation
32767 + 32767 -2
EN=1 ENO=0
Note 1: The CPU performs no boundary processing
when the operation result of operand types Operation
other than REAL exceeds the valid value -32768 + -32768 0
range of the operands. EN=1 ENO=0
Make sure that the operation result does not
exceeds the valid value range of the
operands. The CPU performs boundary
processing for REAL operands.
2-270
Section 2 Programming Language IL language
Subtraction Operates the subtraction of the “SDATA” value from the current operation
result, and sets the result to the operation result.
(1) Operates the subtraction of the operand <Operation> Example of INT type data
value from the current operation result, and • When the result of execution falls within the valid value range
sets the result to the operation result. Current operation SDATA Operation result
(2) The data type of the operands must be the result Operation
same. 5678 1234 4444
-
(3) Available data type is ANY_NUM type EN=1 ENO=1
(REAL type, INT type, DINT type, UINT type
or UDINT type). • When the result of operation exceeds the valid value range
(4) ENO is set to 0 if the result of operation Operation
exceeds the valid value range of the -32768 - 50 32718
operands (only for SPH). EN=1 ENO=0
(5) For REAL type data, when the operation
results approaches 0 (zero) and cannot be
expressed by REAL type, output value and
EN0 become “0” and “1,” respectively (only
for SPH).
Note 1: The CPU performs no boundary processing when the operation result of
operand types other than REAL exceeds the valid value range of the
operands. Make sure that the operation result does not exceeds the valid
value range of the operands. The CPU performs boundary processing for
REAL operands.
Subtraction Operates the subtraction of the sum of “INPUT1” and “INPUT2” from the
current operation result, and sets the result to the operation result.
2-271
Section 2 Programming Language IL language
Multiplication Operates the multiplication of the current operation result and the
“MDATA” data, and sets the result to the operation result.
(1) Operates the multiplication of the current <Operation> Example of INT type data
operation result and the operand value, and • When the result of operation falls within the valid value range
sets the result to the operation result. Current operation MDATA Operation result
(2) The data type of the operands must be the result Operation
same. 222 10 2220
x
(3) When the operation result exceeds the valid EN=1 ENO=1
value range of the data type, it is treated as
follows: • When the result of operation exceeds the valid value range
The upper limit value or lower limit value of Operation
the data type is output, and ENO is set to 32767 x 32767 32767
“0.” EN=1 ENO=0
(4) Available data type is ANY_NUM type
(REAL type, INT type, DINT type, UINT type Operation
Multiplication Operates the multiplication of the current operation result and the sum of
the “INPUT1” and “INPUT2,” and sets the result to the operation result.
2-272
Section 2 Programming Language IL language
Division Operates the division of the current operation result by the “DDATA”
data, and sets the result to the operation result.
(1) Operates the division of the current <Operation> Example of INT type data
operation result by the operand value, and • When the result of operation falls within the valid value range
sets the result to the operation result. Current operation DDATA Operation result
(2) The data type of the operands must be the result Operation
same.
3940 ÷ 5 788
(3) When the operation result exceeds the valid EN=1 ENO=1
value range of the data type, it is treated as
follows: • When the divisor is 0
The upper limit value or lower limit value of Operation
the data type is output, and ENO is set to 3940 ÷ 0 32767
“0.” EN=1 ENO=0
(4) Available data type is ANY_NUM type
(REAL type, INT type, DINT type, UINT type
or UDINT type).
(5) If the divisor is 0, the maximum absolute
value with the sign of the dividend is
generated and ENO is set to 0.
Division Operates the division of the current operation result by the sum of the
“INPUT1” value and the “INPUT2” value, and sets the result to the
operation result.
DIV(
DIV( INPUT1
(1) Operates the division of the current ADD INPUT2
operation result by the operation result )
specified in parentheses, and sets the
result to the operation result. <Operation> Example of INT type data
(2) The data type of the operands must be the • When the result of operation falls within the valid value range
same. Current operation Result of operation Operation result
(3) When the operation result exceeds the valid result specified in
value range of the data type, it is treated as parentheses
follows: Operation
The upper limit value or lower limit value of 3940 ÷ 5 788
the data type is output, and ENO is set to EN=1 ENO=1
“0.” • When the divisor is 0
(4) Available data type is ANY_NUM type
Operation
(REAL type, INT type, DINT type, UINT type
3940 ÷ 0 32767
or UDINT type).
EN=1 ENO=0
(5) If the divisor is 0, the maximum absolute
value with the sign of the dividend is
generated and ENO is set to 0.
2-273
Section 2 Programming Language IL language
(27) Comparison GT
Comparison Operates the comparison (>) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the operation
result.
GT
GT NDATA
(1) Operates the comparison of the current
operation result as the left-hand side of the
“>” operator with the operand value as the <Operation> Example of INT type data
right-hand side, and sets the result to the Current operation NDATA Operation result
operation result. result Operation
(2) The type of the operation result is BOOL 1234 > 1111 TRUE
(TRUE or FALSE).
(3) The data type of the operands must be the Operation
same. 1234 > 1234 FALSE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT 1234 > 2000 FALSE
type, or UDINT type), ANY_BIT type
(BOOL type, WORD type, or DWORD type),
ANY_DATE type (DT type, DATE type, or
TOD type), and TIME type (STRING type
cannot be used).
Comparison Operates the comparison (>) of the current operation result with the
sum of the “INPUT1” value and the “INPUT2” value, and sets the result
(TRUE or FALSE) to the operation result.
GT(
GT( INPUT1
(1) Operates the comparison of the current ADD INPUT2
operation result as the left-hand side of the )
“>” operator with the operation result
specified in parentheses as the right-hand
side, and sets the result to the operation <Operation> Example of INT type data
result. Current operation Result of operation Operation result
(2) The type of the operation result is BOOL result specified in
(TRUE or FALSE). parentheses
(3) The data type of the operands must be the Operation
same. 1234 > 1111 TRUE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT 1234 > 1234 FALSE
type, or UDINT type), ANY_BIT type
(BOOL type, WORD type, or DWORD type), Operation
ANY_DATE type (DT type, DATE type, or 1234 > 2000 FALSE
TOD type), and TIME type (STRING type
cannot be used).
2-274
Section 2 Programming Language IL language
(29) Comparison GE
Comparison Operates the comparison (>=) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the operation
result.
GE
GE NDATA
(1) Operates the comparison of the current
operation result as the left-hand side of the
“>=” operator with the operand value as the <Operation> Example of INT type data
right-hand side, and sets the result to the Current operation NDATA Operation result
operation result. result Operation
(2) The type of the operation result is BOOL 1234 >= 1111 TRUE
(TRUE or FALSE).
(3) The data type of the operands must be the Operation
same. 1234 >= 1234 TRUE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 >= 2000 FALSE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).
Comparison Operates the comparison (>=) of the current operation result with the
sum of the “INPUT1” value and the “INPUT2” value, and sets the result
(TRUE or FALSE) to the operation result.
GE(
GE( INPUT1
(1) Operates the comparison of the current ADD INPUT2
operation result as the left-hand side of the )
“>=” operator with the operation result
specified in parentheses as the right-hand
side, and sets the result to the operation <Operation> Example of INT type data
result. Current operation Result of operation Operation result
(2) The type of the operation result is BOOL result specified in
(TRUE or FALSE). parentheses
Operation
(3) The data type of the operands must be the
same. 1234 >= 1111 TRUE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 >= 1234 TRUE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE Operation
type (DT type, DATE type, or TOD type), 1234 >= 2000 FALSE
and TIME type (STRING type cannot be
used).
2-275
Section 2 Programming Language IL language
(31) Comparison EQ
Comparison Operates the comparison (=) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the operation
result.
EQ
EQ NDATA
(1) Operates the comparison of the current
operation result as the left-hand side of the
“=” operator with the operand value as the <Operation> Example of INT type data
right-hand side, and sets the result to the Current operation Operation result
operation result. result Operation
(2) The type of the operation result is BOOL 1234 = 1111 FALSE
(TRUE or FALSE).
(3) The data type of the operands must be the Operation
same. 1234 = 1234 TRUE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 = 2000 FALSE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).
Comparison Operates the comparison (=) of the current operation result with the sum
of the “INPUT1” value and the “INPUT2” value, and sets the result
(TRUE or FALSE) to the operation result.
EQ(
EQ( INPUT1
(1) Operates the comparison of the current ADD INPUT2
operation result as the left-hand side of the )
“=” operator with the operation result
specified in parentheses as the right-hand
side, and sets the result to the operation <Operation> Example of INT type data
result. Current operation Result of operation Operation result
(2) The type of the operation result is BOOL result specified in
(TRUE or FALSE). parentheses
(3) The data type of the operands must be the Operation
same. 1234 = 1111 FALSE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 = 1234 TRUE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE Operation
type (DT type, DATE type, or TOD type), 1234 = 2000 FALSE
and TIME type (STRING type cannot be
used).
2-276
Section 2 Programming Language IL language
(33) Comparison NE
Comparison Operates the comparison (≠) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the
operation result.
NE
NE NDATA
(1) Operates the comparison of the current
operation result as the left-hand side of the
“≠” operator with the operand value as the <Operation> Example of INT type data
right-hand side, and sets the result to the Current operation NDATA Operation result
operation result. result Operation
(2) The type of the operation result is BOOL 1234 ≠ 1111 TRUE
(TRUE or FALSE).
(3) The data type of the operands must be the Operation
same. 1234 ≠ 1234 FALSE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 ≠ 2000 TRUE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).
Comparison Operates the comparison (≠) of the current operation result with the sum
of the “INPUT1” value and the “INPUT2” value, and sets the result
(TRUE or FALSE) to the operation result.
NE(
NE( INPUT1
(1) Operates the comparison of the current ADD INPUT2
operation result as the left-hand side of the )
“≠” operator with the operation result
specified in parentheses as the right-hand
side, and sets the result to the operation <Operation> Example of INT type data
result. Current operation Result of operation Operation result
(2) The type of the operation result is BOOL result specified in
(TRUE or FALSE). parentheses
(3) The data type of the operands must be the Operation
same. 1234 ≠ 1111 TRUE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 ≠ 1234 FALSE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE Operation
type (DT type, DATE type, or TOD type), 1234 ≠ 2000 TRUE
and TIME type (STRING type cannot be
used).
2-277
Section 2 Programming Language IL language
(35) Comparison LE
Comparison Operates the comparison (<=) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the operation
result.
LE
LE NDATA
(1) Operates the comparison of the current
operation result as the left-hand side of the
“<=” operator with the operand value as the <Operation> Example of INT type data
right-hand side, and sets the result to the Current operation NDATA Operation result
operation result. result Operation
(2) The type of the operation result is BOOL 1234 <= 1111 FALSE
(TRUE or FALSE).
(3) The data type of the operands must be the Operation
same. 1234 <= 1234 TRUE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 <= 2000 TRUE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).
Comparison Operates the comparison (<=) of the current operation result with the
sum of the “INPUT1” value and the “INPUT2” value, and sets the
result (TRUE or FALSE) to the operation result.
LE(
LE( INPUT1
(1) Operates the comparison of the current ADD INPUT2
operation result as the left-hand side of the )
“<=” operator with the operation result
specified in parentheses as the right-hand
side, and sets the result to the operation <Operation> Example of INT type data
result. Current operation Result of operation Operation result
(2) The type of the operation result is BOOL result specified in
(TRUE or FALSE). parentheses
(3) The data type of the operands must be the Operation
same. 1234 <= 1111 FALSE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type, 1234 <= 1234 TRUE
or UDINT type), ANY_BIT type (BOOL type,
WORD type, or DWORD type), ANY_DATE Operation
type (DT type, DATE type, or TOD type), 1234 <= 2000 TRUE
and TIME type (STRING type cannot be
used).
2-278
Section 2 Programming Language IL language
(37) Comparison LT
Comparison Operates the comparison (<) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the operation
result.
LT
LT NDATA
(1) Operates the comparison of the current
operation result as the left-hand side of the
“<” operator with the operand value as the <Operation> Example of INT type data
right-hand side, and sets the result to the Current operation NDATA Operation result
operation result. result Operation
(2) The type of the operation result is BOOL 1234 < 1111 FALSE
(TRUE or FALSE).
(3) The data type of the operands must be the Operation
same. 1234 < 1234 FALSE
(4) Available data types are ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT 1234 < 2000 TRUE
type, or UDINT type), ANY_BIT type
(BOOL type, WORD type, or DWORD type),
ANY_DATE type (DT type, DATE type, or
TOD type), and TIME type (STRING type
cannot be used).
Comparison Operates the comparison (<) of the current operation result with the sum
of the “INPUT1” value and the “INPUT2” value, and sets the result
(TRUE or FALSE) to the operation result.
LT(
LT( INPUT1
(1) Operates the comparison of the current ADD INPUT2
operation result as the left-hand side of the )
“<” operator with the operation result
specified in parentheses as the
right-hand side, and sets the result to the <Operation> Example of INT type data
operation result. Current operation Result of operation Operation result
(2) The type of the operation result is BOOL result specified in
(TRUE or FALSE). parentheses
(3) The data type of the operands must be the Operation
2-279
Section 2 Programming Language IL language
Unconditional jump Jumps unconditionally from “JMP END” to the instruction that is labeled
“END.”
JMP Common
processing
block
(1) Jumps to the step specified by the label of
the operand. The instructions following the JMPC ERROR_1
JMP instruction are not executed.
Processing 1
JMP END
ERROR_1: Processing 2
END:
TRUE conditional jump Jumps from “JMPC ERROR” to the instruction that is labeled
“ERROR” if either “INPUT1” or “INPUT2” is TRUE.
2-280
Section 2 Programming Language IL language
FALSE conditional jump Jumps from “JMPCN ERROR” to the instruction that is labeled “ERROR”
if either “INPUT1” or “INPUT2” is FALSE.
JMPCN LD INPUT1
FALSE AND INPUT2
JMPCN ERROR
(1) Jumps to the step specified by the label of ST OUTPUT
the operand when the current operation ERROR:
result is FALSE. The instruction following LD FLAG
this instruction is executed if the current ST STATE
operation result is TRUE.
Unconditional call Executing “CAL FB_1” unconditionally calls the function block “FB_1.”
An instruction that passes a parameter to the input terminal is required
before the CAL instruction, and an instruction that receives a parameter
CAL from the output terminal is required after the CAL instruction.
2-281
Section 2 Programming Language IL language
TRUE conditional call Calls the function block “FB_1” if “FBCALL” is TRUE.
An instruction that passes a parameter to the input terminal is required
before the CAL instruction, and an instruction that receives a parameter
CALC from the output terminal is required after the CAL instruction.
FALSE conditional call Calls the function block “FB_1” if “FBCALL” is FALSE. An instruction that
passes a parameter to the input terminal is required before the CAL
instruction, and an instruction that receives a parameter from the output
CALCN terminal is required after the CAL instruction.
2-282
Section 2 Programming Language IL language
Unconditional return
LD INPUT1
RETC AND PSWICH
ST IN2 User-supplied function block
RET
2-283
Section 2 Programming Language IL language
LD INPUT1
RETCN AND PSWICH
ST IN2 User-supplied function block
RET
2-284
Section 2 Programming Language SFC
For example, the process of painting automobiles can be depicted as shown below in an SFC form.
Start
Move and dry body [Process 3] (STEP3) Note: Up to 24 characters are allowed for SFC step,
(ACT03) action, and transition names.
Initial step
(beginning of processing)
Transition
(condition for moving
to the next step) Start
T1 Actions
(describes the process)
STEP 1 N ACT01
Each action or transition must be assigned to a BOOL variable or programmed using the IL, ST, LD, or FB language.
2-285
Section 2 Programming Language SFC
Initial step
The initial step can be programmed in the middle of the SFC network.
Initial step
2-286
Section 2 Programming Language SFC
As shown in the above figure, one step may be assigned two or more actions. There is no limit to the number of actions that
can be assigned to one step.
Notes:
The state of a step is represented by its status. For example, the flag of “S002” in the above figure is described as “S002.X.”
(3) Jump
A jump is a step whose next sequential step is the destination of the jump within the same worksheet or on another worksheet in
the same POU. Execution never jumps into another POU. No action can be assigned to a jump.
Destination of jump
2-287
Section 2 Programming Language SFC
Termination step
2-288
Section 2 Programming Language SFC
Action qualifier
An action qualifier specifies the timing of execution or suppression of an action according to the active or inactive state of the
step. There are nine types of action qualifiers.
1) N (non-stored)
The action is repeated while the step is active. (Note)
S001
T001
ACT1
2) P (Pulse)
The action is executed only once when the step is activated.
S001
T001
ACT1
1 task
Notes:
IEC standard stipulates, “Action instruction statement or network must finally be executed at the trailing edge of action
qualifier.” Therefore, the action of P qualifier is executed twice when the step becomes active.
To make it executed only once, use “action flag” as an interlock.
Example of increment:
1 INC_DATA
INC_DATA
2-289
Section 2 Programming Language SFC
3) S (Set)
The execution of the action is started when the step is activated, but the action is executed repeatedly when the step is
deactivated. The execution of the step is stopped using the R qualifier.
S001
T001
ACT1
T004
S005
4) R (Overriding reset)
This qualifier is used in combination with the S, SD, DS, or SL qualifier. The action is stopped if a specified action has been
executed in advance by an S, SD, DS, or SL qualifier when this step is activated. If the action is a BOOL variable, the variable is
reset to “0.” No action is taken (equivalent to being assigned no action) if the specified action is not in execution.
S001
T001
ACT1
5) L (Time limited)
The action is started and repeated until a specified time has elapsed once the step is activated. The execution of the action is
stopped after the elapse of the specified time or when the step is deactivated within the specified time.
S001
T001
ACT1 5s
S001
T001
ACT1 5s
2-290
Section 2 Programming Language SFC
6) D (Time delayed)
The action is started after a preset time after the step is activated. The action is executed repeatedly until the step is deactivated.
The action is not executed if the step is deactivated before the preset time is reached.
S001
T001
ACT1
5s
S001
T001
ACT1
5s
S001
T001
ACT1
5s
T004
S005
S001
T001
ACT1
5s
T004
S005
2-291
Section 2 Programming Language SFC
S001
T001
ACT1
5s
T004
S005
S001
T001
S005
5s
S001
T001
ACT1 5s
S001
T001
ACT1
5s
S001
T001
ACT1 5s
T004
S005
2-292
Section 2 Programming Language SFC
(6) Transition
Only one transition is programmed between two adjacent steps and specifies the conditions for making a transition from the
preceding step to the following step. A transition condition is defined by assigning a BOOL variable or programming by either IL,
ST, LD, or FBD language.
Transition to which an
FB is directly assigned
2-293
Section 2 Programming Language SFC
Active Inactive
“1”
Inactive Active
Active
“1”
Inactive Inactive
Active Inactive
Notes:
The left-hand side step “S010” is selected when both “T006” and “T007” are set to 1 at the same time.
2-294
Section 2 Programming Language SFC
Active Inactive
“1”
Inactive
Inactive Inactive
Active
2-295
Section 2 Programming Language SFC
Active
Inactive Inactive
“1”
Active Active
Active Active
“1”
Inactive
Inactive
Active
2-296
Section 2 Programming Language SFC
<Variable representation>
Period
Step flag : step name .x (data type: BOOL; “1” when active, “0” when inactive)
Action flag : Action name .x (data type: BOOL; “1” when active, “0” when inactive)
2-297
Section 2 Programming Language SFC
2-298
Section 2 Programming Language SFC
<Example>
<Countermeasure>
Set the action as a body and use the address of the processor link module in the body program.
<Example>
2-299
Section 2 Programming Language SFC
2) For warm start, if you want to start from the step at which the system was turned off, check “Step/action of SFC is assumed
to be retain variable.”
2-300
Section 3 System Definition
Notes:
1) When configuring or modifying system definitions, be sure to download them to the CPU and reset the SPH system .
2) Refer to the user’s manual for each individual module.
3-1
Section 3 System Definition System configuration
T-link
Notes:
In the multi-CPU system, use the same system configuration definition for every CPU module.
3-2
Section 3 System Definition System configuration
<Setting procedure>
1) Double-click “System_Definition” in the project tree. The system definition screen opens. Initially, the system definition window
shows a power supply module and a CPU module under an 11-slot base board as shown below. Select the CPU module and
click the [Insert] button.
[Insert] button
To mount a module on
this base unit, select To change a base board, right-click here and
here (left-click). select “Properties” from the shortcut menu
to open the “Module properties” dialog box.
Then, select the base unit you want to use.
Set an SX bus
station No.
(Note 2)
Select a module
attribute type.
Select a module
group type.
Notes:
1) To select a module, first select the type of the module to register in the “Module group type” box.
2) To select a unit directly connected to the SX bus (individual type module), select the base board on the definition screen,
and then click the “Insert” button.
3-3
Section 3 System Definition System configuration
3) The module is registered as shown below. Follow the same procedure to register subsequent modules.
SX bus SX bus
Module type Module type
station No. station No.
1 to 238 Direct I/O, I/O master, positioning, function 247 Processor link (CPU No. 7)
239 Processor link (CPU No. 15) 248 Processor link (CPU No. 6)
240 Processor link (CPU No. 14) 249 Processor link (CPU No. 5)
241 Processor link (CPU No. 13) 250 Processor link (CPU No. 4)
242 Processor link (CPU No. 12) (Note 2) 251 Processor link (CPU No. 3)
243 Processor link (CPU No. 11) 252 Processor link (CPU No. 2)
244 Processor link (CPU No. 10) 253 Processor link (CPU No. 1)
245 Processor link (CPU No. 9) 254 Processor link (CPU No. 0)
246 Processor link (CPU No. 8)
Notes:
1) Make sure that the CPU No. set by D300win matches the setting of the CPU No. selection key switch on the module.
2) On the product versions below and later, up to 8 inter-processor link modules can be connected on a single configuration.
(On the earlier versions, a maximum of 2 modules can be connected).
CPU versions
<SPH300>
NP1PS-245R: All versions
NP1PS-32R, NP1PS-74R, NP1PS-117R, NP1PS-117: V26 63 or later
NP1PS-74: V23 63 or later
NP1PS-32: V24 63
<SPH2000>
All versions
<SPH3000>
All versions
<SPH3000>
Max. 2 modules
Loader versions
D300winV2: V.2.2.6.0 or later
D300winV3: V.3.1.4.0 or later
3-4
Section 3 System Definition System running definition
Notes:
1) A 0.5ms tact time may be executed in such conditions as having a single CPU in a SPH300, 256 or less directly-connected
I/Os, and no remote I/O and communication module.
2) V2.2 or later versions of D300win support the feature of setting tact time in 0.5ms steps.
(2) Waiting time for structure check (Setting range: 1s to 180s, Default value: 20s)
At power-on, the CPU module initializes itself. When initialization is completed, a configuration check starts for the modules on
the SX bus according to the system definition settings. When all the modules on the SX bus start up within the “waiting time for
structure check” specified here, the system starts operation. If any of them does not start up within the specified time, the system
operates according to the settings of “system fail-soft operation setting.” (See Section 3-3-3.)
3-5
Section 3 System Definition System running definition
Click “properties.”
3-6
Section 3 System Definition System running definition
3-7
Section 3 System Definition Redundancy setting
Notes:
1) To use the N to 1 redundant mode, the ** 30 or later version of memory card interface module (30 or later version of
firmware) must have been installed. For the powerful CPU modules, the 1030 version or later must have been installed.
2) In the case of N to 1 redundant systems, the maximum program capacity of the NP1PS-245R is 119808 (117K) steps.
3) In the case of N to 1 redundant systems, the maximum program capacity within a single POU is 4096 steps.
3-8
Section 3 System Definition Fail-soft startup
Power supply
CPU0
CPU1
I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O Servo Servo I/O I/O I/O I/O I/O I/O I/O I/O
0 1
In the example above, modules to be partially fail-soft started are the shaded “servo 0,” “servo 1,” and “CPU 1,” I/O
modules on a baseboard with station No. setup function.
1) The fail-soft startup start module is any of a range from the SX bus station No., which has been set as the first one to be
fail-soft started to 253. (Note 1)
Set the Nos. excluding the start No. for the SX bus station Nos. for the module to be fail-soft started.
2) Be sure to assign the SX station Nos. after one is declared as the start No. only to the modules with an SX bus station No.
selection switch. (You do not need to assign consecutive Nos. to them.) (Note 2)
3) When the module to be fail-soft started is turned on after fail-soft startup (in the non-fatal fault state), the module is
activated and the system runs normally (The “RUN” is ON and the “ALM” is OFF).
Notes:
1) The CPU module, PE-link module, and P-link module are fail-soft started as well. Note that CPU0 is excluded.
2) If any module with no SX bus station number setting switch is detected at the initial fail-soft startup station number or
beyond, a system fatal fault (if at initial startup) or nonfatal fault occurs (if at successive startup).
3) Be sure to use the system fail-soft startup mode only in the fail-soft compatible modules (version 20** or later).
If any module incompatible with fail-soft is detected at initial startup or at successive startup, a system fatal fault occurs.
3-9
Section 3 System Definition Fail-soft startup
<Setting procedure>
1) Display the “System Properties” dialog box and click the “Fail-soft operation setting” tab.
2) Select “Partial Fail-soft start up” and enter the “Start Station No. of fail-soft running.”
3) After setting each item, click the “OK” button.
* Click the [Extended setting] button to open display the following setting items: “Fail-soft maintenance operation prohibition,” “Hide
the error display state” and “System start watch time.”
• Fail-soft maintenance operation prohibition mode
When “ON” is selected, successive module connections and module re-connections will not be performed, even if fail-soft
startup is selected and the actual configuration does not match the system definition. This setting can minimize tact time
variance, even if there is a non-communications module in the configuration. When this mode is set, hot maintenance cannot
be performed. Thus, you must restart the system when successively/re-connecting modules (the same applies to swapping
CPUs in redundant systems).
• Hide the error display state
When “ON” is selected, a nonfatal fault does not occur even if there are no modules with fail-soft startup set. When this
function is used in multi-CPU or redundant systems, the hidden information may differ between CPUs if CPUs are individually
started due to replacement and the like. Start all CPUs at once, or start them individually with the same system status.
• System start watch time (SPH300 software version V65 or later)
Use this function when it is necessary to reduce the system startup time of systems in which the main power supply of the
inverter/servo directly connected to the SX bus is turned on using the “degraded startup” function after activating the system.
This setting is 30s by default, and 20s can be reduced in the system startup time by selecting 10s. If the monitoring time is
set to 10s, the system memory (%MW10.256.5) is turned on.
Notes:
Do not set the monitoring time to 10s in multi-CPU systems, redundant systems, and systems using PC card interface
modules (type: NP1F-PC2).
3-10
Section 3 System Definition System digital output definition
<Setting procedure>
1) Select the digital output module for which system output is to be set, and click the [Properties] button.
Click here.
Notes:
1) Bit 0 of the module to be specified as system output cannot be registered in the I/O group definition.
2) A module to be specified as system output cannot be registered in the I/O group definition for any CPU other than CPU0.
3) Neither HOLD mode nor fail-soft can be set for a module that is specified as system output.
4) Bit 0 of the module to be specified as system output cannot be used for an application. The other bits can be used in the
usual way.
3-11
Section 3 System Definition CPU running definition
Operation
System definition setting
RUN TERM
RUN=run / TERM=run Run Run
RUN=run / TERM=preceding state Run Preceding state (Note)
Run=stop / TERM=stop Stop Stop
Notes:
When “Battery less run” is ON: Preceding state
When “Battery less run” is OFF: Run (the preceding state is not held.)
The preceding state is the state of the CPU established before system power is shut off. The state is set to run if the CPU
was running and to stop if it was stopped.
3-12
Section 3 System Definition CPU running definition
Application arithmetic
System
Output
System
process-
ing
processing
2)
2)
(6) User ROM operation (SPH2000/SPH3000 and SPH300 software version V67 or later)
This parameter specifies whether to perform ROM operation using a user ROM card mounted on the CPU module.
* The default setting is “ON.” (The user ROM operation is enabled.)
Notes:
Even if “OFF” is checked, it is possible to read and write data to/from a user ROM card from an application program.
(7) Compulsion setting hold state (SPH300 software version V65 or later)
In this mode, operation is started with compulsion settings for I/O held. By default, the compulsion setting state when powered
on last time is cleared at power on (including resetting) of the CPU module. However, if the “compulsion setting hold state” is set
to ON, the compulsion settings are not cleared and operation is started with the compulsion settings held. When the “compulsion
setting hold state” is set ON, the system memory (%MX10.256.14) is set ON. In addition, when there is a compulsion setting to
hold, the system memory (%MX10.256.15) is set ON.
3-13
Section 3 System Definition CPU running definition
<Setup procedure>
1) Select the target resource icon in the project tree.
(Note)
Click here.
Notes:
The communication settings are used to connect the CPU module and D300win, and
different from the system definition.
For more information on the communication settings, refer to the user’s manual
“SX-Programmer Expert (D300winV3) <Reference>” (FEH257) or “D300winV2 Reference”
(FEH254).
3) The “CPU running definition” dialog box opens. Setting items to be displayed depend on the CPU type.
Specify whether to
perform battery less run.
Select the desired
operation mode.
Set the proportion between application Specify whether to perform user ROM
processing time and other processing operation. Set to “OFF” to not use user
(e.g. loader command processing time) ROM operation.
within a single tact time. The default is “Yes.”
The default is 6 to 4.
(Dialog box
for SPH300)
4) After setting each item, click the [OK] button.
3-14
Section 3 System Definition CPU memory size
SPH300 (NP1PS-74/74R)
SPH300 (NP1PS-117/117R)
SPH300 (NP1PS-245R)
Notes:
The total of the standard memory and retain memory must be 383K or less.
SPH2000 (NP1PM-48R/48E)
3-15
Section 3 System Definition CPU memory size
SPH2000 (NP1PM-256E/256H)
SPH3000 (NP1PU-048E)
Notes:
1) The total size of the retain memory, user FB instance normal memory, and system FB instance memory must be 32K
words or less.
2) The total size must be 160K words or less.
3) The total size must be 256K words or less.
SPH3000 (NP1PU-128E)
Notes:
1) The total size of the retain memory, user FB instance normal memory, and system FB instance memory must be 32K
words o less.
2) The total size must be 160K words or less.
3) The total size must be 1M words or less.
1M = 1024K
1K = 1024
3-16
Section 3 System Definition CPU memory size
SPH3000 (NP1PU-256E)
Notes:
1) The total size of the retain memory, user FB instance normal memory, and system FB instance memory must be 32K
words or less.
2) The total size must be 384K words or less.
3) The total size must be 1M words or less.
1M = 1024K
1K = 1024
SPH200 (NP1PH-16)
SPH200 (NP1PH-08)
3-17
Section 3 System Definition CPU memory size
Click here.
For SPH300, all the remainder after setting the capacities of “Retain memory,” “User
FB memory,” and “System FB memory” becomes the capacity of non-retain memory. Set the reserve area for additional variables
For standard CPU, you can set the capacity of non-retain memory, and the for when rewriting a POU while the CPU is
remainder becomes the memory capacity for initial data. running (patch POU).
Edge detection,
counter, addition timer
and timer can also be
set for system FB. The
remainder becomes
the area for other FBs.
* For SPH200s, the number of initial values varies with settings for non-retain, retain, user FB, and system FB memories.
(The initial value area for the user FB has been automatically calculated.)
Enter the size of each memory in the text box. Click the [Default] button when you want to reset to the default values.
Enter the size of each memory in the text box. Click the [Default] button when you want to reset to default values.
* If inter-CPU memory access is performed using a processor bus in a SPH2000/3000 series multi-CPU system,
Standard memory g memory area must be reserved in multi-CPU non-retain memory.
Retain memory g memory area must be reserved in multi-CPU retain memory.
The reserved memory addresses are as follows.
• Multi-CPU non-retain memory:
Starting at %MWo. 1.98304 (NP1PM-48R/48E)
Starting at %MWo. 1.2097152 (NP1PM-256E/256H)
Starting at %MWo. 1.262144 (NP1PU-048E)
Starting at %MWo. 1.1048576 (NP1PU-128E)
Starting at %MWo. 1.2097152 (NP1PU-256E)
• Multi-CPU retain memory:
Starting at %MWo. 3.32768
* The CPU number is entered in o.
3-19
Section 3 System Definition CPU memory size
To change the number of edge detection, counter, addition timer or timer points, click the [Detail] button. The “Detail of system
FB memory” dialog box appears. By clicking the corresponding tab, display the “Detail of system FB memory” window or “Detail
of system FB normal memory” window.
On this dialog, change the numbers of points of arbitrary items. If the number of points is changed, the word size of the
“Other system FB area” indicated at the bottom of the dialog is also changed. Click the [OK] button to complete the setting.
Enter the size of each memory in the text box. Click the [Default] button when you want to reset to default values.
3-20
Section 3 System Definition CPU memory size
<Note>
With V07 or later software version of NP1PM-256E, the memory arrangement has been changed for high-speed access of the
system FB memory. The combinations of CPU version and loader version with which the system FB memory high-speed access
function can be used are as follows.
In the user FB memory and system FB memory, user FB normal memory and system FB normal memory are accessible at high
speed. When using user FBs, the user FB normal memory and system FB normal memory are used first.
Not supported
V07 or later High-speed access supported
(conventional mode)
When using V6 or earlier software version of NP1PM-256E, check “A CPU before V06 is used.”
If the option is checked ON, the following screen appears.
Notes:
When using V6 or earlier software version of NP1PM-256E, be sure to check this option. Otherwise, programs cannot be
loaded to the CPU.
3-21
Section 3 System Definition CPU memory size
To change the number of edge detection, counter, addition timer or timer points, click the [Detail] button. The “Detail of system
FB memory” dialog box appears. By clicking the corresponding tab, display the “Detail of system FB memory” window or “Detail
of system FB normal memory” window.
On this dialog, change the numbers of points of arbitrary items. If the number of points is changed, the word size of the
“Other system FB area” indicated at the bottom of the dialog is also changed. Click the [OK] button to complete the setting.
Enter the size of each memory in the text box. Click the [Default] button when you want to reset to default values.
3-22
Section 3 System Definition I/O group
Select a task.
You can register each I/O module on the NP1L-RT1 in an I/O group.
Registered module
2) The modules are registered as shown above. After setting each item, click the [OK] button.
Notes:
You cannot assign the same output to multiple CPUs or tasks.
3-23
Section 3 System Definition I/O group
1) Make sure that the Level field is set to “DEFAULT” and click the [Standard Setting] button.
Click here.
2) The input modules are automatically registered in the “Input select” list and the output modules in the “Output select” list as
shown below.
3-24
Section 3 System Definition I/O group
1) Select the output module that is to be registered on a bit basis from the “Output select” list, and click the [Detail...] button.
Click here.
2) The following dialog box opens. Initially, all bits are selected.
3) Click a bit that is not registered in the I/O group to set it off. In the figure below, the bits 8 to 15 are set off.
3-25
Section 3 System Definition I/O group
1) Select an output module and click the [Input for referring output value].
Click here.
2) The following dialog box opens. Initially, all bits are selected.
3) Click a bit whose output is not to be referenced to set it off. In the figure below, the bits 8 to 15 are set off.
* If the output module is registered as “no equipment,” the output value can be referenced, however, the input bit does not
operate on an application program.
3-26
Section 3 System Definition Fail-soft operation setting
2) Module recovery
When the down module is recovered, the system returns to its normal state. Note that if more than one module has been down,
no module can be activated unless all the down modules are recovered.
Notes:
If you want to stop the system running when a fault occurs in the module to which fail-soft is unconditionally applicable,
monitor any configuration fault information in system memory (%MW10.68 to %MW10.83) and set the user fatal fault flag
(%MW10.14 to %MW10.16) to “1.”
The following versions of modules and base boards support the fail-soft function.
• Modules with internal firmware installed 1030
• Modules with no internal firmware installed 10 (for example, a base unit)
When constructing a fail-soft system, the fail-soft function on the SX bus cannot be performed if there is even a single
module whose version is earlier than above. The “SX bus-connected module fail-soft mode” flag (%MW10.0.13) in the
system memory is OFF.
Notes:
Even in a system in which a module that does not support the fail-soft function is connected, the remote I/O fail-soft
function can be used.
3-27
Section 3 System Definition Fail-soft operation setting
Power source
CPU also register them for fail-soft.
I/O I/O I/O CPU I/O I/O I/O
0 1
In CPU1, register I/O (4) and (5)
together as one I/O group and also
(1) (2) (3) (4) (5) (6) register them for fail-soft.
SX bus
Power source
CPU I/O I/O I/O CPU I/O I/O I/O When I/O (6) goes down due to
0 1 a fault, a fatal system fault occurs
in CPU1 because it was not
registered for fail-soft
(1) (2) (3) (4) (5) (6) (RUN is off and ALM is on).
CPU 0 operates normally.
SX bus
If a fault occurs in CPU1 When I/O (4) goes down due to a fault,
(ERROR goes on) or CPU1 a non-fatal system fault occurs in CPU1
goes down, a non-fatal system because it was registered for fail-soft
fault occurs in CPU0 (RUN is on and ALM is on).
(RUN is on and ALM is on). CPU 0 operates normally.
3-28
Section 3 System Definition Fail-soft operation setting
<Setting procedure>
1) Open the “CPU Parameter” dialog box and click the [Fail-soft operation setting] tab.
3-29
Section 3 System Definition IP address
2) Detailed settings
Set the following detailed items related to the Ethernet function communication.
• TCP send/receive timeout value
• Max TCP termination timer value
• Response monitoring timer value
• Loader command monitoring timer value
• Transmission retry interval
• Transmission retry count
• Close processing for TCP transmission timeout
• Close processing for response receive timeout
• Self-port reference No.
• Reference number of communications destination port
<Setting procedure>
Display the “CPU Parameter” dialog box and click the [IP address/Gateway setting] tab. The following tab window opens.
After setting each item, click the [OK] button .
3-30
Section 3 System Definition Input filter
<Setting procedure>
1) On the system definition screen, right-click the digital input module for which you want to set the input filtering time, and select
“Properties” from the shortcut menu. The “Module properties” dialog box opens.
Then, click the [Parameter...] button to display the “Direct I/O parameter setting” dialog box.
3-31
Section 3 System Definition Output hold
<Setting procedure>
1) On the system definition screen, right-click the digital output module for which you want to set the output hold option, and
select “Properties” from the shortcut menu. The “Module properties” dialog box opens.
Then, click the [Parameter...] button to display the “Direct I/O parameter setting” dialog box.
3-32
Section 4 CPU Redundant System
In a control system, you can improve system safety and reliability by duplexing the device to be used. This is called “redundancy.”
In MICREX-SX series, redundancy of power supply modules and CPU modules is available.
This section describes redundancy of SPH300 series CPU modules.
The CPU redundant mode in MICREX-SX series include 1 to 1 and N to 1 types.
* For the redundant functions of SPH2000 (NP1PM-256H), refer to the user’s manual “SPH2000 Redundant Functions (FEH184).”
Power CPU Power CPU Power I/O I/O I/O I/O I/O I/O
supply 0 supply 1 supply
SX bus
G Key point:
• Install the same application on both the working and standby CPUs.
Additionally, all CPUs on a configuration have the same system configuration. If one of the CPUs has a different actual
configuration, a system definition error will be generated for that CPU.
• If all CPUs on a redundant system (SPH300s) have software version V63 or later, it is possible to start up the system
even if CPU 0 is not installed or is powered down. (System non-fatal fault status).
4-1
Section 4 CPU Redundant System N:1 redundancy
Power CPU Power CPU Power CPU Memory I/O I/O I/O
supply 0 supply 1 supply 2 card
if
SX bus
G Key point:
• In a redundant system, a multi-CPU system that uses both SPH300 and SPH2000 cannot be constructed.
• N (the number of working CPUs) application programs need to be stored on the memory card interface module. (create
programs with 4096 steps per POU. N to 1 redundant systems cannot use applications with 8192 steps per POU.
Additionally, the maximum capacity of NP1PS-245R programs is 119808 steps, in the N to 1 redundant systems can
use).
• In the N to 1 redundant mode, only the cold standby method is applicable. No internal data and I/O data are inherited.
• All CPUs on the system have the same system definition. If one of the CPUs has a different actual configuration, a
definition error occurs in it.
• When replacing a faulting CPU, the working CPU must be switched (using the loader).
• In the N to 1 redundant system, program read/write operation by the switches on the front face of the if memory card in
the module is prohibited. Do not use the memory card if module for storing the application programs for the N to 1
redundant system with file memory for file read/write access from the application program running on the CPU. Prepare
another memory card if module for file read/write. If file memory is used with the memory card if module, an access
contention occurs and changeover may not be performed between the working and standby CPU.
• When starting up the system in an N to 1 redundant system, CPU 0 is always required. Note, however, that the system
will start up with a non-fatal error even if one of the default standby or default operational CPU (excluding CPU 0), or
the standby CPU is not mounted.
4-2
Section 4 CPU Redundant System Conditions for changeover
4-2 Conditions for Changeover between Working and Standby CPUs and
Performance
4-2-1 Conditions for changeover
The table below shows the conditions in which changeover occurs between working and standby CPUs. The conditions are the
same for both 1 to 1 and N to 1 modes.
a: changeover, – : no changeover
Notes:
1) Since the SX bus is a common resource for the entire system, changeover cannot be done between working and standby
CPUs when faults occur in both CPUs.
2) An intentional stopping of the CPU is excluded from the conditions for changeover.
Notes:
1) Depends on the quantity of equalized data.
2) If the message-related FB is used directly after changeover from the working CPU to the standby one, the busy status
continues until the message closing process is completed (100-600ms).
4-3
Section 4 CPU Redundant System Multi-CPU relay switch
Power CPU CPU CPU Power CPU CPU CPU Power I/O I/O I/O I/O I/O
supply 0 2 4 supply 1 3 5 supply
Working Working Working Standby Standby Standby
SX bus
Power CPU CPU CPU Power CPU CPU CPU Power I/O I/O I/O I/O I/O
supply 0 2 4 supply 1 3 5 supply
Working Working Standby Working Standby
SX bus
Power CPU CPU CPU Power CPU CPU CPU Power I/O I/O I/O I/O I/O
supply 0 2 4 supply 1 3 5 supply
Standby Standby Working Working Working
SX bus
In the above example, when CPU2 stops running due to a fault, CPU3 starts running instead. (The time for switching is 130ms
max.) Then, CPU3 issues the switch command to CPU0 and CPU4. CPU0 and CPU4, when receiving the command, go into the
standby mode and CPU1 and CPU5 are switched to the working mode. (The time for switching is 130ms max.)
Notes:
1) While CPU2 has a fault in the above system configuration, the system cannot switch to the standby CPU if a fault occurs
in the working CPU. The entire system goes down due to a fatal fault.
2) Relay switching can be done while both the working and standby systems are running normally.
For example, when changeover occurs during initialization (the operation and standby sides are not undefined), even a
CPU with an enabled relay switch may not be switched to another one. This means that both the working and standby
CPUs run simultaneously in the CPU group for which the relay switch has been enabled.
Whether the relay switch has been operating normally can be determined by verifying that the resource running
information (%MW10.48) bit, set to “1,” matches that for the CPU group for which the relay switch has been enabled.
4-4
Section 4 CPU Redundant System Data equalization
Example of
ordinary system
Tact time (2ms) Constant periodic time (8ms)
Constant
periodic task
Default task
Program execution
Default task
When a transmission error occurs while copying data, the copy operation is cancelled as soon as
possible and the next default task is executed. The standby CPU stores the old copied data.
Notes:
If a switching factor occurs while scanning, the standby CPU starts running with equalized data, which has been scanned
previously. Data output stops at the first task point next to the point where the switching factor occurred. Outputs from the I/O
module are not updated until the standby CPU starts running.
= (Scan time of ordinary system) + {1 + (Total number of words for equalization) / 512 words} x Tact time
[Integral multiple of tact time]
Fractions to be rounded
Notes:
The scan time increase when total number of words for equalization increase.
4-5
Section 4 CPU Redundant System Data equalization
Standard memory
(high-speed) Equalization Equalization size Spg
specification 1 AT specification Spg=equalization 1 + equalization 2 + equalization 3
(Note: 1)
Notes:
1) Set the equalization specification area so that it lies in the
Standard memory Equalization
specification 2 AT statement
range specified in the AT statement and also specify the
(Note: 1) variables to be equalized in the AT statement.
Equalization of suffix
specified variable
2) Variables defined for retain among the user FB (User FB instance memory) variables
User FB instance
memory
FB_1 :Variables defined for retain
<Variable size >
• BOOL type variable 1 word
• 16-bit data type variable 1 word
• 32-bit data type variable 2 words
FB_n Notes:
In the 1 to 1 redundant mode, the maximum area which can be defined for retain
in the user FB instance memory is 2048 words.
4-6
Section 4 CPU Redundant System Data equalization
3) Retain attribute area and current timer value area in system FB instance memory
No. of
Equalized system FB Equalized instance element
words
Edge detection(R_TRIG, F_TRIG) Old input value 2
Counter Current counter value
2
(CTU, CTD, CTUD, RCT) Old input value
Timer, totalizing timer Current timer value, old input value,
4
(TP, TON, TOF, MR, TMR) clocking flag
Notes:
When using the SPH300 of 74K or higher in a 1 to 1 redundant mode warm standby system, be sure to define the memory
assignments considering the equalized data. If the default assignments are used, equalization requires 8192 words or more
for system FB instance memory alone.
Use the memory assignment setting dialog for release settings, and appropriately decrease the available number of FBs set
in the system FB memory details.
4-7
Section 4 CPU Redundant System Memory operation
1 to 1 redundant mode N to 1
System status Memory or flag redundant
Cold standby Warm standby mode
Standard memory Cleared
Retain memory Old retained value
System power-on
I/O memory Reset hold specification
(warm running)
Default task start flag ON
Initial flag OFF
Standard memory
Working a standby Retain memory Values are retained during running
I/O memory
An area other than the area to be equalized
Standard memory Cleared is cleared, and the data in the area to be Cleared
equalized is inherited by the working CPU.
Old values are Old values are retained and data in the area to
Retain memory Cleared
retained. be equalized is inherited by the working CPU.
Notes:
When the standby CPU does not run after program download, the initial flag is set to ON.
G Key point:
• In the redundant system, to pass data to the bit variables used for semaphores at changeover between the working and
standby CPUs:
• Assign the bit variables for semaphores to the standard memory area to avoid equalization.
(They are reset to 0 at changeover.)
• When changeover occurs, make an attempt to get semaphores again.
• This is on when the redundant continuous start-up flat goes from standby to working (Does not turn off). Use this flag
when you want to switch from standby to working.
4-8
Section 4 CPU Redundant System LED indication
ONL ON ON OFF ON ON ON ON
ON OFF ON ON ON ON OFF
Contact output
(Running) (Stop) (Running) (Running) (Running) (Running) (Stop)
4-9
Section 4 CPU Redundant System Startup without CPU “0”
Notes:
1) When starting up the system without a CPU 0, configure all CPUs with software version V63 or higher.
2) When turning on the power, after checking for a CPU 0, other CPUs start up as an SX bus master CPU. For this reason,
system startup will take 30 to 40 seconds longer than when there is a CPU 0 upon power-up.
3) If a project configured to start the system without a CPU 0 is downloaded to a CPU with software version below 63 via a
user Rom card (CF card), it will operate in “do not start up system without CPU 0” mode.
4) Startup without CPU 0 is not possible in an N to 1 redundant system.
5) If an error occurs reading system definitions (application ROM error), the system automatically operates in “start up
system without CPU 0” mode.
6) If all CPUs are faulting, it will take up to 60 seconds longer to complete initialization. Additionally, the ALM LED will flicker
during this period.
7) The SX bus is a common resource for the system as a whole. For this reason, the system will not start up when there is a
hardware fault in the SX bus circuit.
8) The SX system operates based on the system definitions. For this reason, the system will not start up if the system
definitions are inconsistent with the actual system (error).
4-10
Section 5 Multi-CPU System
5-1 Overview...................................................................................................5-1
5-1-1 Overview.........................................................................................................5-1
5-1-2 Overview of multi-CPU function......................................................................5-2
5-1-3 Example of multi-CPU project configuration....................................................5-3
5-1 Overview
5-1-1 Overview
• Parallel processing can be performed by a maximum of eight CPUs.
• A distributed multi-CPU configuration enables distributed control.
• When using multiple CPUs, I/O refresh management is automatically executed.
• Distributed multiple CPUs enable higher-speed processing than when performed by a single CPU.
• Larger programs can be processed than when performed by a single CPU. When adding a program or exceeding the
capacity processed by a single CPU, you can manage it easily by using the multi-CPU function. Replacement with a higher
model is not required.
• According to the control contents, programs can be stored in each CPU separately.
• CPUs can be separately used for function modules and processing program.
Max. 8 CPUs
Single CPU
Processing time
5-1
Section 5 Multi-CPU System Overview
Memory for
multi-CPU is reserved.
CPU 0 CPU 1
1) Memory access
The CPUs can read or write each other’s multi-CPU memory (all memories for the SPH300 series).
2) I/O access
Each CPU can read all the inputs.
However, output can only be can only be accessed (read/write) by one CPU. Output can be accessed by the bit.
The other CPU can read (cannot write) the above mentioned output.
5-2
Section 5 Multi-CPU System Project configuration example
Program of CPU 0
Program of CPU 1
Task of CPU 0
Task of CPU 1
5-3
Section 5 Multi-CPU System Limitations
3) Restrictions on memory
In SPH300, all the memories can be used as multi-CPU memories.
In SPH2000 and SPH3000 series, memories that are specified as the multi-CPU memory in the system definition can be used
as multi-CPU memories.
5-4
Section 5 Multi-CPU System Memory map
(SPH200)
(SPH200) 15 0
15 0 %MW3.0
Retain memory Address
%MW1.0
Standard memory (M) representation
(M) for a multi-CPU
NP1PM-48R/48E system
NP1PM-48R/48E Address representation : 8K words
for a multi-CPU system NP1PM-256E/256H CPU No.
: 64K words : 32K words
NP1PM-256E/256H
: 1664K words CPU No. %MW3.32768 Multi-CPU retain memory %MW.3.32768
(SPH3000)
(SPH3000) 15 0
15 0 %MW3.0
Retain memory Address
%MW1.0 representation
Standard memory (M)
for a multi-CPU
(high speed)
NP1PU-048E/128E/256E system
(M)
2K words : 8K words
%MW1.98303 CPU No.
%MW1.98304 Standard memory
(M) %MW3.32768 Multi-CPU retain memory %MW.3.32768
NP1PU-048E
NP1PU-048E : 32K words
: 0 words Address representation NP1PU-128E
NP1PU-128E for a multi-CPU system : 112K words
: 672K words NP1PU-256E
: 224K words
NP1PU-256E CPU No.
: 1568K words
NP1PU-048E NP1PU-048E
%MW.1.262144 Multi-CPU standard memory %MW.1.262144
NP1PU-128E NP1PU-128E
%MW1.1048576 %MW.1.1048576
* 0 word by default
NP1PU-256E NP1PU-256E
%MW.1.2097152 %MW.1.2097152
5-5
Section 5 Multi-CPU System Memory map
I/O I/O
CPU CPU
Power “0” “1”
supply
“254” “253” “1” “2”
CPU0 CPU1
%IX1.0.0 %IX1.0.0
↓ ↓
%IW1.0 %IW1.0
CPU No.
CPU No.
• To access the memory of another CPU, specify the CPU No. of the target CPU as shown above.
• The input and output areas (I and Q) are shared, therefore, the address representation is the same.
Notes:
1) The condition of the address representation above is that both CPUs are connected on the same processor bus.
2) To perform inter-CPU memory access using the processor bus in SPH2000 or SPH3000 series, reserve the memory for
multi-CPU. The reserved memory addresses are as follows.
• Standard memory (for multi-CPU) : From %MWo.1.98304 (NP1PM-48R/48E)
From %MWo.1.2097152 (NP1PM-256E/256H)
From %MWo.1.262144 (NP1PU-048E)
From %MWo.1.1048576 (NP1PU-128E)
From %MWo.1.2097152 (NP1PU-256E)
• Retain memory (for multi-CPU) : From %MWo.3.32768 (SPH2000)
From %MWo.3.32768 (SPH3000)
5-6
Section 5 Multi-CPU System I/O processing
Program Program
CPU 0 Input execution Output Input execution Output
Program Program
CPU 1 Input execution Output Input execution Output
I O I O I O
2) When there is a difference in the program processing time between CPU0 and CPU1
The I/Os of CPU0 and CPU1 are refreshed in the different cycle.
I O I O I O I O
5-7
Section 5 Multi-CPU System System definition setting procedure
5-8
Section 5 Multi-CPU System System definition setting procedure
5-9
Section 5 Multi-CPU System System definition setting procedure
5-10
Section 5 Multi-CPU System I/O assignment
5-11
Section 5 Multi-CPU System I/O assignment
Setting of CPU 0
Setting of CPU 1
5-12
Section 5 Multi-CPU System Memory assignment
Memory of CPU 0
Memory of CPU 1
As shown below, when using the multi-CPU memory in SPH2000 or SPH3000, reserve the multi CPU memory in the memory
allocation setting.
5-13
Section 5 Multi-CPU System Memory assignment
5-14
Section 5 Multi-CPU System Memory assignment
5-9 Others
(1) “Patch POU” (rewriting a POU while the CPU is running) in multi-CPU
In the example below, LADDER is executed by CPU0 and LADDER_2 is executed by CPU1. In this condition, even if “Patch
POU” is collectively executed after both LADDER and LADDER_2 are changed, the changes are not reflected.
In this case, execute “patch POU” for each resource respectively in the following manner.
1) Change the program of LADDER.
2) Execute “patch POU” and confirm that the program of LADDER has been changed.
3) Change the program of LADDER_2.
4) Execute “patch POU” and confirm that the program of LADDER_2 has been changed.
5-15
Section 5 Multi-CPU System Memory assignment
Right-click
5-16
Section 6 I/O Extension Function
6-1 Overview...................................................................................................6-1
6-2 Specifications...........................................................................................6-3
6-2-1 Extendable input/output memory size.............................................................6-3
(1) Maximum extendable input/output memory size............................................6-3
(2) Sizes of input/output memory for I/O directly connected to the SX bus
and for remote I/O master...............................................................................6-3
6-2-2 Tact time..........................................................................................................6-4
(1) SPH300 and SPH300EX series......................................................................6-4
(2) SPH2000/SPH3000 series.............................................................................6-4
6-2-3 System memory related to I/O extension........................................................6-5
6-2-4 Refresh time of I/O memory............................................................................6-5
6-2-5 Special Notes..................................................................................................6-5
Section 6 I/O Extension Function Overview
6-1 Overview
The I/O extension function expands input/output memory for remote I/O systems when there are multiple remote I/O systems (max.
8 systems) in one SPH system (one configuration). This function is useful when units that occupy large number of words for
input/output memory are used on multiple remote I/O systems and the total number of words occupied for input/output memory
by units directly connected to the SX bus and all remote I/O systems on one configuration exceeds 512 words.
512 words
Input/output memory
for SX bus direct 512 words (input/output memory for remote I/O master)
connection
Input/output memory
for remote I/O master
Remote I/O uses largest input/output
memory size in system
I/O extension Remote I/O master 0
50 words
Up to 8 remote
I/O systems
Remote I/O master 7
90 words
* The number of input/output words of a system that occupies the largest number of words among multiple remote I/O systems
used in a SPH system is reserved as “input/output memory for remote I/O master” in the input/output memory (512 words).
(This is automatically calculated by the loader according to a created system definition.)
The “input/output memory for remote I/O master” subtracted from 512 words is the “input/output memory for I/O directly
connected to the SX bus”.
6-1
Section 6 I/O Extension Function Overview
* To use the I/O extension function, CPU modules, remote I/O master module, and D300win supporting it are required.
Models that are not on the list below do not support the function.
* 1 The rules for assigning I/O addresses are the same for both normal and I/O extension modes. Refer to “1-3-2 Rules for
assigning I/O addresses” in this manual for details.
* 2 NP1PS-74D allows I/O extension of the basic CPU part only. The I/O extension function is not available for the expansion
CPU part.
6-2
Section 6 I/O Extension Function Specifications
6-2 Specifications
6-2-1 Extendable input/output memory size
(1) Maximum extendable input/output memory size
(2) Sizes of input/output memory for I/O directly connected to the SX bus and for remote I/O master
When using the I/O extension function, the “input/output memory size for remote I/O master” subtracted from 512 words of input/
output memory is the input/output memory size that can be used by modules and units directly connected to the SX bus.
“Input/output memory size for remote I/O master” is the input/output memory size of a remote I/O system that occupies the
largest number of input/output words among multiple remote I/O systems used in a SPH system.
<Sample calculation of input/output memory size for I/O directly connected to the SX bus>
Memory split structure Image of input/output memory area Max. input/output memory size
Pattern 1 Total = 512 words
(Normal mode)
512 words
Both I/O directly connected to
SX bus and remote I/O exist.
Pattern 2 With remote I/O size of 128 words Total = 384 + 128 x 8
(I/O extension mode) = 1408 words
6-3
Section 6 I/O Extension Function Tact time
Total number of I/O words * SX bus tact time Total number of I/O words * SX bus tact time
1024 words or less 2.0 ms or more 6656 words 6.5 ms or more
2048 words 2.5 ms or more 7158 words 7.0 ms or more
3072 words 3.0 ms or more 7680 words 7.5 ms or more
3584 words 3.5 ms or more 8192 words 8.0 ms or more
4096 words 4.0 ms or more 8704 words 8.5 ms or more
4608 words 4.5 ms or more 9216 words 9.0 ms or more
5120 words 5.0 ms or more 9728 words 9.5 ms or more
5632 words 5.5 ms or more 10240 words 10.0 ms
6144 words 6.0 ms or more
* Total number of input/output words means the total number of input/output words assigned to all the tasks (default task, 0 level
to 3 level) of the SPH system. Because input/output can be assigned to multiple tasks, the total number of input/output words
can exceed 4096 words.
However, the number of input/output words of a module or a unit that is indicated as “no equipment” is not counted.
Notes:
1) Be sure to set the tact time at 2 ms or more. A value less than 2 ms cannot be set. (An error occurs in the loader.)
2) When configuring a system, ensure that the total number of input/output words is 10240 or less. If it exceeds the range
shown in the table above, a system operation definition error (%MX10.22.2 is set to ON) occurs and the system cannot
operate.
3) If a tact cycle monitoring error (%MX10.39.15 is set to ON) occurs even though the total number of input/output words is
within the range shown in the table above, increase the SX bus tact time.
* Max. number of input/output words means the total number of input/output words assigned to all the tasks (default task, 0
level to 3 level) of the SPH system.
However, the number of input/output words of a module or a unit that is indicated as “no equipment” is not counted.
Notes:
1) Be sure to set the tact time at 5 ms or more. A value less than 5 ms cannot be set. (An error occurs in the loader.)
2) When configuring a system, ensure that the total number of input and output words is 3072 or less respectively. If it exceeds
the range shown in the table above, a system operation definition error (%MX10.22.2 is set to ON) occurs and the system
cannot operate.
3) If a tact cycle monitoring error (%MX10.39.15 is set to ON) occurs even though the total number of input/output words is
within the range shown in the table above, increase the SX bus tact time.
4) The table above shows the max. number of I/O words for when the execution bandwidth ratio is set to 6: 4 [application :
system] (default). If the ratio of application is made smaller, the max. number of I/O words is decreased in proportion to the
ratio.
For example, if the ratio is set to 3: 7, the rate of application is half the default value . Therefore, the max. number of I/O
words is halved.
6-4
Section 6 I/O Extension Function System memory
related to I/O extension
%MW10.273
Notes:
1) The above formula is used to calculate the refresh time between the remote I/O master modules and the input/output
memory area in the CPU.
For information on a communications cycle time between a remote I/O master module and a remote I/O slave station, refer
to a user’s manual for each remote I/O master module.
2) On a remote I/O, do not mount a device that requires high-speed input/output responsivity.
3) For the refresh time of input/output of remote I/O masters, only I/O remote masters that are actually connected to the
system are refreshed.
Example 1) A remote I/O master registered as “no equipment” is skipped (not refreshed).
Example 2) If a remote I/O master is disconnected during operation, the disconnected remote I/O master is skipped (not
refreshed). For example, if there are four remote I/O systems, each remote I/O master is refreshed once every
four tasks. However, if one of the remote I/O masters is disconnected, every other remote I/O master is
refreshed once every three tasks. When the disconnected remote I/O master is restored, each remote I/O
master is refreshed once every four tasks as before.
6-5
Appendix 1
Installing USB Driver
App.1-1
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-2
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-3
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-4
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-5
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-6
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-7
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-8
Appendix 1 Instruction Processing Speed Chart SPH2000
App.1-9
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-10
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-11
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-12
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-13
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-14
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-15
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-16
Appendix 1 Instruction Processing Speed Chart SPH2000
All values in μs
App.1-17
Appendix 1 Instruction Processing Speed Chart SPH3000
Processing speed
Language Name
High-speed PG area Standard PG area
IL language Load LD 0.009 to 0.016 Up to 0.081
Load not LDN 0.009 to 0.016 Up to 0.081
Store ST 0.009 to 0.016 Up to 0.081
Store not STN 0.032 to 0.056 Up to 0.265
Set S 0.033 to 0.052 Up to 0.238
Reset R 0.033 to 0.052 Up to 0.238
Logical product AND 0.012 to 0.022 Up to 0.129
Logical product AND( 0.083 to 0.1 Up to 0.465
Logical inverted product ANDN 0.012 to 0.022 Up to 0.129
Logical inverted product ANDN( 0.083 to 0.1 Up to 0.465
Logical add OR 0.012 to 0.022 Up to 0.129
Logical add OR( 0.083 to 0.1 Up to 0.465
Logical inverted add ORN 0.012 to 0.022 Up to 0.129
Logical inverted add ORN( 0.083 to 0.1 Up to 0.465
Exclusive OR XOR 0.012 to 0.022 Up to 0.129
Exclusive OR XOR( 0.083 to 0.1 Up to 0.465
Exclusive NOR XORN 0.012 to 0.022 Up to 0.129
Exclusive NOR XORN( 0.083 to 0.1 Up to 0.465
Addition ADD 0.0054 to 0.022 Up to 0.131
Addition ADD( 0.083 to 0.094 Up to 0.429
Subtraction SUB 0.005 to 0.022 Up to 0.131
Subtraction SUB( 0.083 to 0.094 Up to 0.429
Multiplication MUL 0.009 to 0.03 Up to 0.183
Multiplication MUL( 0.088 to 0.104 Up to 0.491
Division DIV 0.073 to 0.078 Up to 0.214
Division DIV( 0.152 to 0.159 Up to 0.558
Comparison (>) GT 0.01 to 0.025 Up to 0.155
Comparison (>) GT( 0.086 to 0.096 Up to 0.465
Comparison (>=) GE 0.01 to 0.025 Up to 0.155
Comparison (>=) GE( 0.086 to 0.096 Up to 0.465
Comparison (=) EQ 0.01 to 0.025 Up to 0.155
Comparison (=) EQ( 0.086 to 0.096 Up to 0.465
Comparison (≠) NE 0.01 to 0.025 Up to 0.155
Comparison (≠) NE( 0.086 to 0.096 Up to 0.465
Comparison (<=) LE 0.01 to 0.025 Up to 0.155
Comparison (<=) LE( 0.086 to 0.096 Up to 0.465
Comparison (<) LT 0.01 to 0.025 Up to 0.155
Comparison (<) LT( 0.086 to 0.096 Up to 0.465
* The processing speed is the execution speed of the instruction as executed with operands of the data types that are processed
most quickly and stored in areas other than the CPU standard memory area and/or multi-CPU retain memory area.
App.1-18
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
IL language Unconditional jump JMP 0.007 to 0.013 Up to 0.054
TRUE conditional jump JMPC 0.004 to 0.014 Up to 0.081
FALSE conditional jump JMPCN 0.004 to 0.014 Up to 0.081
Label of the destination address - -
Unconditional call CAL 0.103 to 0.109 Up to 0.201
TRUE conditional call CALC 0.011 to 0.036 Up to 0.213
FALSE conditional call CALCN 0.011 to 0.036 Up to 0.213
Unconditional return RET 0.103 to 0.109 Up to 0.201
TRUE conditional return RETC 0.005 to 0.02 Up to 0.104
FALSE conditional return RETCN 0.005 to 0.02 Up to 0.104
ST language Assignment statement := Note:
The processing speed indicates the execution speed of the
IF statement
instruction as executed with operands of the data type that is
CASE statement processed most quickly and stored in the high-speed memory
FOR statement area and/or input/output memory area.
WHILE statement
REPEAT statement
RETURN statement
EXIT statement
LD language Normal open contact (NO contact) 0.009 to 0.016 Up to 0.081
Normal close contact (NC contact) 0.009 to 0.016 Up to 0.081
Coil 0.009 to 0.016 Up to 0.081
Inverted coil 0.032 to 0.056 Up to 0.265
Set 0.033 to 0.052 Up to 0.238
Reset 0.033 to 0.052 Up to 0.238
Connect to/from - -
Jump 0.004 to 0.015 Up to 0.081
Type Type conversion DINT_TO_INT 0.025 to 0.065 Up to 0.368
conversion
Type conversion UINT_TO_INT 0.023 to 0.048 Up to 0.265
function
Type conversion UDINT_TO_INT 0.023 to 0.048 Up to 0.265
Type conversion REAL_TO_INT 0.073 to 0.09 Up to 0.299
Type conversion TIME_TO_INT 0.023 to 0.048 Up to 0.265
Type conversion WORD_TO_INT 0.025 to 0.046 Up to 0.239
Type conversion INT_TO_DINT 0.017 to 0.036 Up to 0.187
Type conversion UINT_TO_DINT 0.017 to 0.036 Up to 0.187
Type conversion UDINT_TO_DINT 0.023 to 0.048 Up to 0.265
Type conversion REAL_TO_DINT 0.073 to 0.09 Up to 0.299
Type conversion TIME_TO_DINT 0.023 to 0.048 Up to 0.265
Type conversion DWORD_TO_DINT 0.017 to 0.036 Up to 0.187
Type conversion INT_TO_UINT 0.023 to 0.048 Up to 0.265
Type conversion DINT_TO_UINT 0.028 to 0.069 Up to 0.392
Type conversion UDINT_TO_UINT 0.023 to 0.048 Up to 0.265
App.1-19
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
Type Type conversion REAL_TO_UINT 0.075 to 0.09 Up to 0.3
conversion
Type conversion TIME_TO_UINT 0.023 to 0.048 Up to 0.265
function
Type conversion WORD_TO_UINT 0.017 to 0.036 Up to 0.187
Type conversion INT_TO_UDINT 0.023 to 0.048 Up to 0.265
Type conversion DINT_TO_UDINT 0.023 to 0.048 Up to 0.265
Type conversion UINT_TO_UDINT 0.017 to 0.036 Up to 0.187
Type conversion REAL_TO_UDINT 0.075 to 0.09 Up to 0.3
Type conversion TIME_TO_UDINT 0.017 to 0.036 Up to 0.187
Type conversion DWORD_TO_UDINT 0.017 to 0.036 Up to 0.187
Type conversion DT_TO_UDINT 0.017 to 0.031 Up to 0.163
Type conversion DATE_TO_UDINT 0.017 to 0.031 Up to 0.163
Type conversion TOD_TO_UDINT 0.017 to 0.031 Up to 0.163
Type conversion INT_TO_REAL 0.067 to 0.08 Up to 0.292
Type conversion DINT_TO_REAL 0.067 to 0.08 Up to 0.292
Type conversion UINT_TO_REAL 0.068 to 0.084 Up to 0.295
Type conversion UDINT_TO_REAL 0.068 to 0.084 Up to 0.295
Type conversion TIME_TO_REAL 0.068 to 0.084 Up to 0.295
Type conversion WORD_TO_BOOL 0.06 to 0.076 Up to 0.287
Type conversion DWORD_TO_BOOL 0.06 to 0.076 Up to 0.287
Type conversion BOOL_TO_WORD 0.023 to 0.044 Up to 0.239
Type conversion DWORD_TO_WORD 0.025 to 0.045 Up to 0.239
Type conversion INT_TO_WORD 0.025 to 0.045 Up to 0.239
Type conversion UINT_TO_WORD 0.017 to 0.036 Up to 0.187
Type conversion BOOL_TO_DWORD 0.023 to 0.044 Up to 0.239
Type conversion WORD_TO_DWORD 0.017 to 0.036 Up to 0.187
Type conversion DINT_TO_DWORD 0.017 to 0.036 Up to 0.187
Type conversion UDINT_TO_DWORD 0.017 to 0.036 Up to 0.187
Type conversion INT_TO_TIME 0.023 to 0.048 Up to 0.264
Type conversion DINT_TO_TIME 0.023 to 0.048 Up to 0.264
Type conversion UINT_TO_TIME 0.017 to 0.036 Up to 0.187
Type conversion UDINT_TO_TIME 0.017 to 0.036 Up to 0.187
Type conversion REAL_TO_TIME 0.075 to 0.09 Up to 0.3
Type conversion UDINT_TO_DT 0.017 to 0.031 Up to 0.162
Type conversion UDINT_TO_DATE 0.103 to 0.136 Up to 0.503
Type conversion UDINT_TO_TOD 0.09 to 0.108 Up to 0.34
Type conversion TRUNC_INT 0.074 to 0.088 Up to 0.3
Type conversion TRUNC_DINT 0.074 to 0.088 Up to 0.3
Type conversion TRUNC_UINT 0.075 to 0.089 Up to 0.3
Type conversion TRUNC_UDINT 0.075 to 0.089 Up to 0.3
Type conversion W_BCD_TO_INT 0.096 to 0.111 Up to 0.318
Type conversion D_BCD_TO_INT 0.136 to 0.153 Up to 0.354
App.1-20
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
Type Type conversion W_BCD_TO_DINT 0.128 to 0.141 Up to 0.34
conversion
Type conversion D_BCD_TO_DINT 0.128 to 0.141 Up to 0.34
function
Type conversion INT_TO_W_BCD 0.092 to 0.108 Up to 0.312
Type conversion DINT_TO_W_BCD 0.092 to 0.108 Up to 0.312
Type conversion INT_TO_D_BCD 0.098 to 0.114 Up to 0.33
Type conversion DINT_TO_D_BCD 0.098 to 0.114 Up to 0.33
Arithmetic Absolute value ABS_INT 0.025 to 0.061 Up to 0.341
function
Absolute value ABS_DINT 0.022 to 0.056 Up to 0.315
Absolute value ABS_REAL 0.017 to 0.04 Up to 0.214
Square root (√) SQRT 0.736 to 0.803 Up to 0.99
Natural logarithm LN 0.761 to 0.816 Up to 0.994
Common logarithm LOG 0.841 to 0.894 Up to 1.102
Exponent EXP 0.285 to 0.299 Up to 0.5
Sine SIN 5.74 to 5.807 Up to 6.004
Cosine COS 5.806 to 5.864 Up to 6.061
Tangent TAN 12.122 to 12.165 Up to 12.357
Arc sine ASIN 6.018 to 6.043 Up to 6.354
Arc cosine ACOS 6.12 to 6.144 Up to 6.363
Arc tangent ATAN 9.744 to 9.817 Up to 10.014
0.020 + (No. of inputs -1) x 0.005 Up to 0.162 + (No. of inputs -1) x
Addition ADD
to 0.032 + (No. of inputs -1) x 0.023 0.131
Subtraction SUB 0.025 to 0.054 Up to 0.294
0.020 + (No. of inputs -1) x 0.009 Up to 0.162 + (No. of inputs -1) x
Multiplication MUL
to 0.032 + (No. of inputs -1) x 0.030 0.183
Division DIV 0.093 to 0.111 Up to 0.362
Addition ADD_REAL 0.11 to 0.129 Up to 0.397
Subtraction SUB_REAL 0.114 to 0.131 Up to 0.399
Multiplication MUL_REAL 0.1 to 0.119 Up to 0.388
Division DIV_REAL 0.124 to 0.144 Up to 0.416
Division remainder MOD 0.093 to 0.111 Up to 0.362
Exponent EXPT 0.253 to 0.272 Up to 0.523
Move MOVE 0.017 to 0.031 Up to 0.16
Negation NEG 0.02 to 0.052 Up to 0.289
Bit string Shift left SHL_WORD 0.027 to 0.055 Up to 0.29
function
Shift left SHL_DWORD 0.027 to 0.055 Up to 0.29
Shift right SHR_WORD 0.027 to 0.055 Up to 0.29
Shift right SHR_DWORD 0.027 to 0.055 Up to 0.29
Rotate left ROL_WORD 0.027 to 0.055 Up to 0.29
Rotate left ROL_DWORD 0.027 to 0.055 Up to 0.29
Rotate right ROR_WORD 0.027 to 0.055 Up to 0.29
Rotate right ROR_DWORD 0.027 to 0.055 Up to 0.29
App.1-21
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
Bit string Logical product AND 0.058 + (No. of inputs -1) x 0.012 to Up to 0.282 + (No. of inputs -1) x
function 0.078 + (No. of inputs -1) x 0.022 0.129
Logical add OR 0.058 + (No. of inputs -1) x 0.012 to Up to 0.282 + (No. of inputs -1) x
0.078 + (No. of inputs -1) x 0.02 0.129
Exclusive XOR 0.058 + (No. of inputs -1) x 0.012 to Up to 0.282 + (No. of inputs -1) x
0.078 + (No. of inputs -1) x 0.02 0.129
Logical negation NOT 0.018 to 0.04 Up to 0.214
Negation NOT_BOOL 0.061 to 0.088 Up to 0.336
Negation NOT_WORD 0.025 to 0.045 Up to 0.239
Negation NOT_DWORD 0.018 to 0.04 Up to 0.214
Selection/ Select SEL_BOOL 0.079 to 0.138 Up to 0.664
comparison
Select SEL_INT 0.034 to 0.088 Up to 0.504
function
Select SEL_DINT 0.034 to 0.088 Up to 0.504
Select SEL_UINT 0.034 to 0.088 Up to 0.504
Select SEL_UDINT 0.034 to 0.088 Up to 0.504
Select SEL_REAL 0.034 to 0.088 Up to 0.504
Select SEL_WORD 0.034 to 0.088 Up to 0.504
Select SEL_DWORD 0.034 to 0.088 Up to 0.504
Select SEL_TIME 0.034 to 0.088 Up to 0.504
Select SEL_STRING 0.771 + 0.038*(No. of characters) to Up to 2.334 + 0.016*(No. of
0.884 + 0.037*(No. of characters) characters)
Maximum value MAX_INT 0.020 + (No. of inputs -1) x 0.005 to Up to 0.164+ (No. of inputs -1) x
0.033 + (No. of inputs -1) x 0.022 0.134
Maximum value MAX_DINT
Maximum value MAX_UINT
Maximum value MAX_UDINT
Maximum value MAX_REAL 0.020 + (No. of inputs -1) x 0.031 to Up to 0.164+ (No. of inputs -1) x
0.033 + (No. of inputs -1) x 0.036 0.167
Minimum value MIN_INT 0.020 + (No. of inputs -1) x 0.005 to Up to 0.164+ (No. of inputs -1) x
0.033 + (No. of inputs -1) x 0.022 0.134
Minimum value MIN_DINT
Minimum value MIN_UINT
Minimum value MIN_UDINT
Minimum value MIN_REAL 0.020 + (No. of inputs -1) x 0.031 to Up to 0.164+ (No. of inputs -1) x
0.033 + (No. of inputs -1) x 0.036 0.167
Limit LIMIT_INT 0.039 to 0.079 Up to 0.43
Limit LIMIT_DINT 0.039 to 0.079 Up to 0.43
Limit LIMIT_UINT 0.039 to 0.079 Up to 0.43
Limit LIMIT_UDINT 0.039 to 0.079 Up to 0.43
Limit LIMIT_REAL 0.08 to 0.11 Up to 0.499
App.1-22
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
Selection/ Comparison (>) GT 0.020 + (No. of inputs -1) x 0.010 to Up to 0.164+ (No. of inputs -1) x 0.129
comparison 0.033 + (No. of inputs -1) x 0.025
Comparison (>=) GE
function
Comparison (=) EQ
Comparison (<=) LE
Comparison (<) LT
Comparison (≠) NE 0.03 to 0.058 Up to 0.319
String Get Length LEN 0.197 + 0.015 x (No. of characters) to Up to 0.698 + 0.015 x (No. of
function 0.235 + 0.015 x (No. of characters) characters)
Get left sub-string LEFT 0.730 + 0.040 x (No. of characters) to Up to 2.1 + 0.040 x (No. of
0.820 + 0.040 x (No. of characters) characters)
Get right sub-string RIGHT 0.725 + 0.020 x (No. of input Up to 2.13 + 0.014 x (No. of input
characters) + 0.036 x (No. of characters) + 0.031 x (No. of
characters to extract) to characters to extract)
0.525 + 0.078 x (No. of input
characters) + 0.038 x (No. of
characters to extract)
Get middle sub-string MID 0.890 + 0.040 x (No. of characters) to Up to 2.447 + 0.007 x (No. of
0.996 + 0.040 x (No. of characters) characters)
Concatenate CONCAT 0.779 + 0.035 x (No. of characters of Up to 2.177 + 0.035 x (No. of
1st input + No. of characters of 2nd characters of first input + No. of
input) to characters of 2nd input)
0.879 + 0.035 x (No. of characters of
first input + No. of characters of 2nd
input)
Insert string INSERT 0.790 + 0.039 x (No. of input strings) Up to 2.224 + 0.039 x (No. of input
+ 0.036 x (No. of characters to insert) strings) + 0.036 x (No. of characters
to to insert)
0.900 + 0.039 x (No. of input strings)
+ 0.036 x (No. of characters to insert)
Delete string DELETE 0.797 + 0.033 x (No. of input strings - Up to 2.198 + 0.041 x (No. of input
No. of characters to delete + 0.017 x strings - No. of characters to delete) +
(No. of characters to delete) to 0.007 x (No. of characters to delete)
0.906 + 0.033 x (No. of input strings -
No. of characters to delete) + 0.017 x
(No. of characters to delete)
Replace string REPLACE 0.856 + 0.037 x (No. of input strings Up to 2.233 + 0.037 x (No. of
- No. of replacement characters) input strings - No. of replacement
+ 0.053 x (No. of replacement characters) + 0.053 x (No. of
characters) to replacement characters)
0.835 + 0.033 x (No. of input strings
- No. of replacement characters)
+ 0.047 x (No. of replacement
characters)
Find String FIND 0.268 + 0.023 x (No. of characters to Up to 0.894 + 0.023 x (No. of
search) to characters to search)
0.336 + 0.023 x (No. of characters to
search)
App.1-23
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
String Comparison String (>) GT_STRING 0.338 + 0.021 x (No. of characters) Up to 0.960 + 0.021 x (No. of
function to characters
Comparison String (>=) GE_STRING
0.360 + 0.021 x (No. of characters)
Comparison String (=) EQ_STRING
Comparison String (<=) LE_STRING
Comparison String (<) LT_STRING
Comparison String (≠) NE_STRING
Time type Add time ADD_T_T 0.025 to 0.055 Up to 0.292
data function
Add time ADD_TD_T 0.256 to 0.316 Up to 1.191
Add time ADD_DT_T 0.17 to 0.204 Up to 0.803
Subtract time SUB_T_T 0.025 to 0.055 Up to 0.292
Subtract time SUB_D_D 0.039 to 0.082 Up to 0.449
Subtract time SUB_TD_T 0.27 to 0.319 Up to 1.101
Subtract time SUB_TD_TD 0.039 to 0.082 Up to 0.449
Subtract time SUB_DT_T 0.17 to 0.204 Up to 0.803
Subtract time SUB_DT_DT 0.04 to 0.083 Up to 0.45
Multiply time MUL_T_N 0.03 to 0.065 Up to 0.347
Multiply time MUL_T_R 0.208 to 0.229 Up to 0.69
Divide time DIV_T_N 0.093 to 0.112 Up to 0.383
Divide time DIV_T_R 0.233 to 0.252 Up to 0.718
Concatenate time CONCAT_D_D 0.025 to 0.056 Up to 0.294
Convert DT to TOD DT_TO_TOD 0.09 to 0.108 Up to 0.34
Convert DT to DATE DT_TO_DATE 0.103 to 0.136 Up to 0.504
Original Set bit SBIT_WORD 0.028 to 0.058 Up to 0.32
function
Set bit SBIT_DWORD 0.028 to 0.058 Up to 0.32
Reset bit RBIT_WORD 0.028 to 0.058 Up to 0.32
Reset bit RBIT_DWORD 0.028 to 0.058 Up to 0.32
Test bit TBIT_WORD 0.07 to 0.098 Up to 0.386
Test bit TBIT_DWORD 0.07 to 0.098 Up to 0.386
Decode DECODE_WORD 0.024 to 0.048 Up to 0.267
Decode DECODE_DWORD 0.022 to 0.052 Up to 0.294
Encode ENCODE_WORD 0.023 to 0.061 Up to 0.345
Encode ENCODE_DWORD 0.03 to 0.077 Up to 0.45
Bit count BITCOUNT_WORD 0.023 to 0.057 Up to 0.319
Bit count BITCOUNT_DWORD 0.022 to 0.056 Up to 0.318
Convert string to number 0.210 + 0.030 x (No. of characters) to Up to 0.700 + 0.030 x (No. of
STR_TO_UINT 0.240 + 0.030 x (No. of characters) characters)
Convert number to string 0.960 + 0.060 x (No. of characters) to Up to 2.150 + 0.140 x (No. of
UINT_TO_STR 0.970 + 0.140 x (No. of characters) characters)
Convert shift-JIS to string 0.730 + 0.054 x (No. of characters) to Up to 2.080 + 0.054 x (No. of
SJ_TO_STR 0.820 + 0.030 x (No. of characters) characters)
Convert string to shift-JIS 0.750 + 0.025 x (No. of characters) to Up to 1.770 + 0.025 x (No. of
STR_TO_SJ 0.825 + 0.025 x (No. of characters) characters)
App.1-24
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
Original Byte length BYTE_LEN 0.210 + 0.025 x (No. of characters) to Up to 0.700 + 0.025 x (No. of
function 0.240 + 0.025 x (No. of characters) characters)
Dead band DBAND_INT 0.304 to 0.336 Up to 0.946
Dead band DBAND_DINT 0.24 to 0.311 Up to 0.937
Dead band DBAND_REAL 0.306 to 0.339 Up to 0.948
Bias BIAS_INT 0.259 to 0.308 Up to 0.867
Bias BIAS_DINT 0.26 to 0.289 Up to 0.856
Bias BIAS_REAL 0.324 to 0.392 Up to 1.023
Step sequence coil SC_COIL 0.31 to 0.353 Up to 1.161
Step sequence SC 0.357 to 0.404 Up to 1.203
32-bit addition with carry ADC 0.273 to 0.351 Up to 1.154
32-bit addition with carry ADCO 0.347 to 0.396 Up to 1.212
32-bit subtraction with borrow SBB 0.275 to 0.353 Up to 1.154
32-bit subtraction with borrow SBBO 0.349 to 0.397 Up to 1.213
64-bit multiplication MULL 0.225 to 0.296 Up to 0.906
64-bit multiplication MULU 0.263 to 0.295 Up to 0.906
64-bit division DIVL 0.405 to 0.473 Up to 1.271
64-bit division DIVU 0.346 to 0.417 Up to 1.202
Shift left 32-bits with carry SLC 0.25 to 0.298 Up to 0.928
Shift left 32-bits with carry SLCO 0.241 to 0.26 Up to 0.757
Shift right 32-bits with carry SRC 0.25 to 0.298 Up to 0.928
Shift right 32-bits with carry SRCO 0.241 to 0.26 Up to 0.757
Standard Set reset flip-flop SR 0.214 to 0.285 Up to 1.123
function
Reset set flip-flop RS 0.214 to 0.285 Up to 1.123
block
Rising edge trigger R_TRIG 0.164 to 0.213 Up to 0.858
Falling edge trigger F_TRIG 0.166 to 0.213 Up to 0.859
Up counter CTU 0.266 to 0.354 Up to 1.49
Down counter CTD 0.266 to 0.353 Up to 1.489
Up down counter CTUD 0.458 to 0.614 Up to 2.409
Pulse TP 0.258 to 0.327 Up to 1.262
On-delay timer TON 0.251 to 0.32 Up to 1.258
Off-delay timer TOF 0.259 to 0.328 Up to 1.264
Real-time clock RTC 0.214 to 0.289 Up to 1.215
Original Ring counter RCT 0.268 to 0.354 Up to 1.489
function
Integrating timer TMR 0.317 to 0.386 Up to 1.596
block
Retriggerable MR 0.258 to 0.326 Up to 1.263
Open channel M_OPEN 0.468 to 0.67 Up to 3.008
Send message M_SEND 0.436 to 0.57 Up to 2.152
Receive message M_RECEIVE 0.417 to 0.572 Up to 2.152
Direct read READ_BOOL 0.455 to 0.616 Up to 2.4
Direct read READ_WORD 0.439 to 0.602 Up to 2.392
App.1-25
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
Original Direct write WRITE_BOOL 0.431 to 0.614 Up to 2.4
function
Direct write WRITE_WORD 0.417 to 0.602 Up to 2.394
block
Remote data read R_READ 0.464 to 0.713 Up to 3.098
Remote data write R_WRITE 0.464 to 0.71 Up to 3.095
File data read F_READ 0.437 to 0.63 Up to 2.823
File data write F_WRITE 0.422 to 0.62 Up to 2.564
Extension test & set EXT_T_S 0.401 to 0.523 Up to 2.068
Sequential file store FFST 0.401 to 0.588 Up to 2.6
Sequential file load first FIFO 0.414 to 0.588 Up to 2.603
Sequential file load last FILO 0.401 to 0.588 Up to 2.598
Filter FILTER_DINT 1.278 to 1.397 Up to 2.155
Filter FILTER_REAL 1.278 to 1.395 Up to 2.131
Integrate INT_DINT 1.417 to 1.581 Up to 2.896
Integrate INT_REAL 1.417 to 1.58 Up to 2.878
Differentiate DIF_DINT 1.277 to 1.39 Up to 2.129
Differentiate DIF_REAL 1.267 to 1.375 Up to 2.12
Pulse count PULSE_CNT 0.296 to 0.382 Up to 1.531
Pulse output PULSE_OUT 0.294 to 0.382 Up to 1.5
Pulse PWM 0.223 to 0.294 Up to 1.245
Hardware RTC (Real-time clock) HW_RTC 0.206 to 0.28 Up to 1.215
Test & set T_S 0.296 to 0.363 Up to 1.342
Change bank BANK_CHG 0.563 to 0.933 Up to 2.206
User ROM Write CSV file _F_WRITE_CSV_DINT 4.204 to 4.47 Up to 7.257
card FB
Write CSV file (LF) _F_WRITE_CSV_DINT_LF 4.207 to 4.51 Up to 7.307
Read CSV file _F_READ_CSV_DINT 1.926 to 2.196 Up to 4.106
Read CSV file (LF) _F_READ_CSV_DINT_LF 2.03 to 2.196 Up to 4.114
Append data to CSV file _F_APPEND_CSV_DINT 3.299 to 3.546 Up to 5.516
Append data to CSV file (LF) _F_APPEND_CSV_DINT_LF 3.314 to 3.574 Up to 5.538
Append data to file _F_APPEND 2.255 to 2.546 Up to 4.464
Append data to file (LF) _F_APPEND_LF 2.276 to 2.564 Up to 4.482
Delete file _F_DELETE 1.548 to 1.6325 Up to 2.933
Delete file (LF) _F_DELETE_LF 1.546 to 1.65 Up to 2.963
Reading of a file with an offset _F_OFFSET_READ 1.637 to 1.948 Up to 4.054
Reading of a file with an offset (LF) _F_OFFSET_READ_LF 1.602 to 1.954 Up to 4.092
Reading of the remaining capacity _F_GET_DRV_SIZE 1.548 to 1.632 Up to 2.884
File name creation _F_CREATE_FILE_NAME 1.007 to 1.265 Up to 4.455
Double- Type conversion INT_TO_DOUBLE 0.877 to 0.947 Up to 1.845
precision
Type conversion DOUBLE_TO_INT 1.175 to 1.229 Up to 1.597
floating-point
calculation Type conversion UINT_TO_DOUBLE 0.881 to 0.949 Up to 1.849
FCTs Type conversion DOUBLE_TO_UINT 1.145 to 1.201 Up to 1.573
Type conversion DINT_TO_DOUBLE 0.876 to 0.946 Up to 1.844
App.1-26
Appendix 1 Instruction Processing Speed Chart SPH3000
All values in μs
Processing speed
Language Name
High-speed PG area Standard PG area
Double- Type conversion DOUBLE_TO_DINT 1.174 to 1.228 Up to 1.596
precision
Type conversion UDINT_TO_DOUBLE 0.881 to 0.949 Up to 1.848
floating-point
calculation Type conversion DOUBLE_TO_UDINT 1.148 to 1.201 Up to 1.571
FCTs Type conversion REAL_TO_DOUBLE 1.373 to 1.413 Up to 2.391
Type conversion DOUBLE_TO_REAL 1.023 to 1.347 Up to 1.684
Type conversion RAD_DOUBLE 2.092 to 2.178 Up to 3.013
Type conversion DEG_DOUBLE 2.091 to 2.178 Up to 3.049
Arithmetic ADD_DOUBLE 1.884 to 1.98 Up to 2.875
Arithmetic SUB_DOUBLE 1.895 to 1.992 Up to 2.917
Arithmetic MUL_DOUBLE 1.925 to 2.004 Up to 2.925
Arithmetic DIV_DOUBLE 2.182 to 2.259 Up to 3.235
Arithmetic SIN_DOUBLE 1.769 to 4.446 Up to 5.311
Arithmetic COS_DOUBLE 1.828 to 4.248 Up to 5.098
Arithmetic TAN_DOUBLE 1.816 to 7.168 Up to 8.014
Arithmetic ASIN_DOUBLE 2.012 to 2.286 Up to 3.124
Arithmetic ACOS_DOUBLE 1.986 to 2.058 Up to 2.887
Arithmetic ATAN_DOUBLE 1.897 to 4.2 Up to 5.038
Arithmetic SQRT_DOUBLE 2.018 to 2.931 Up to 3.78
Arithmetic EXP_DOUBLE 2.215 to 4.502 Up to 5.392
Arithmetic LN_DOUBLE 1.763 to 2.161 Up to 2.977
Comparison EQ_DOUBLE 1.012 to 1.095 Up to 1.59
Comparison NE_DOUBLE 1.012 to 1.095 Up to 1.59
Comparison GT_DOUBLE 1.012 to 1.095 Up to 1.59
Comparison GE_DOUBLE 1.012 to 1.095 Up to 1.59
Comparison LT_DOUBLE 1.012 to 1.095 Up to 1.59
Comparison LE_DOUBLE 1.012 to 1.095 Up to 1.59
Ethernet- Current time acquisition SNTP_CLIENT 0.358 to 0.471 Up to 1.786
related
Connection open FTP_OPEN 0.496 to 0.69 Up to 2.78
F Bs
File store FTP_PUT 0.496 to 0.69 Up to 2.78
File get FTP_GET 0.496 to 0.69 Up to 2.78
Directory create FTP_CREATE_DIR 0.419 to 0.553 Up to 2.153
File delete FTP_DELETE_FILE 0.419 to 0.553 Up to 2.153
Mail send MAIL_SEND 0.713 to 1.04 Up to 4.615
Special WDT_RETRIGGER 0.102 to 0.129 Up to 0.47
control
BAND_TUNE 1.085 to 1.253 Up to 2.463
App.1-27
Appendix 1 Instruction Processing Speed Chart SPH200
App.1-28
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
Closing parenthesis –
ST language Assignment statement := Note:
In the ST language, the number of instructions (steps) of a control
IF statement
group which is made up of statements after compilation, varies from
CASE statement application to application. Consequently, it is difficult to compute
FOR statement the control processing speed from an ST language list. When it is
necessary to grasp processing speed, it is recommended that the
WHILE statement processing speed be measured by using an actual machine.
REPEAT statement
RETURN statement
EXIT statement
LD language Normal open contact (NO contact) 0.07
Normal close contact (NC contact) 0.07
Coil 0.14
Inverted coil 0.14
Set 0.14
Reset 0.14
Connect to/from 0
Jump 0.14 (Non-JMP) /0.21 (JMP)
Type Type conversion DINT_TO_INT 10.42
conversion
Type conversion UINT_TO_INT 7.35
function
Type conversion UDINT_TO_INT 8.42
Type conversion REAL_TO_INT 12.42
Type conversion TIME_TO_INT 8.42
Type conversion WORD_TO_INT 7.35
Type conversion INT_TO_DINT 8.42
Type conversion UINT_TO_DINT 7.42
Type conversion UDINT_TO_DINT 7.49
Type conversion REAL_TO_DINT 23.49
Type conversion TIME_TO_DINT 7.49
Type conversion DWORD_TO_DINT 6.7
Type conversion INT_TO_UINT 8.35
Type conversion DINT_TO_UINT 8.42
Type conversion UDINT_TO_UINT 8.42
Type conversion REAL_TO_UINT 12.42
Type conversion TIME_TO_UINT 8.42
App.1-29
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-30
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-31
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-32
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
Comparison String (<) LT_STRING 99.56 + 2.3 x (Position where comparison result is output) + 0.5 x
Comparison String (≠) NE_STRING (Total numbers of input characters)
App.1-33
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-34
Appendix 1 Instruction Processing Speed Chart SPH200
All values in μs
App.1-35
Appendix 2
Setting SPH300/SPH2000/SPH3000 Tact Cycle
(1) Approximation formulas for calculating the tact cycle from the system
configuration data.....................................................................................App.2-1
(2) Formula for calculating the performance when scanning by the tact cycle
(SPH300)..................................................................................................App.2-2
(3) Sample time calculations (SPH300).........................................................App.2-2
(4) Estimation of the tact cycles in the 1 to 1 warm standby redundant system
(SPH300)..................................................................................................App.2-3
Appendix 2 Setting SPH300/SPH2000/SPH3000 Tact Cycle
On the SX bus, data is exchanged between the CPU and I/O modules in synchronization with the tact cycle. The application
program on the CPU module performs 1) I/O data input updating, 2) arithmetic operations, and 3) I/O data output updating in
execution units called tasks (default task, periodic task, and event task). These operations are carried out concurrently with data
exchange over the SX bus.
This appendix introduces approximation formulas for calculating the scan time for each tact cycle. Basically, the tact cycle of the
SX bus is dependent on the system configuration. In a system that requires a task period which is based on the tact cycle, the
tact cycle depends on the number of steps of the application. To obtain an exact execution time, it is necessary to measure it on
an actual machine.
(1) Approximation formulas for calculating the tact cycle from the system configuration data
Tact cycle T (μs)
1) 1 CPU + direct I/O configuration: T = Tb [Base time (Tb) based on the No. of direct connection input/output points]
The above numbers are based on the assumption that the ratio of I/O input to I/O output is 1 to 1. The more outputs there are,
the longer the base time is, and vice versa. The range of fluctuation is approximately ± 20%.
Notes:
1) 0.5 ms tact period is possible under the condition that there is a single CPU, the number of direct connection I/O points is
256 or less, and no communication module is used.
2) The user can select a tact cycle of 0.5, 1, 1.5, 2, 3, ..., or 10 ms. The user must select the value obtained by rounding up
the corresponding value listed in the above table. The tact period cannot be set to 0.5 ms with the SPH2000/SPH3000.
4) Multi-CPU + remote I/O: [No. of CPUs: n, number of remote I/O master modules: m]
• T= Tb + 340n + 200m + 400 .......... (No. of direct connection input/output points: 2048 or less)
• T= Tb + 405n + 260m + 340 .......... (No. of direct connection input/output points: more than 2048)
5) When communication modules are added to 1 CPU + direct connection I/O (1): [No. of communication module: p]
• T = Tb + 40p + 250
6) When communication modules are added to configurations ((2) to (4)): [No. of communication modules: p]
• T = (Time calculated for ((2) to (4)) + 85p ........... [when there is no remote master module]
• T = (Time calculated for ((2) to (4)) + 128p ......... [when there is a remote master module]
Notes:
3) 2048 points / 1 line is assumed for remote I/O.
App.2-1
Appendix 2 Setting SPH300/SPH2000/SPH3000 Tact Cycle
(2) Formula for calculating the performance when scanning by the tact cycle (SPH300)
Computing time
= [Tact cycle] - [SBM overhead time (200μs)] - [I/O refresh time] - [POU control time]
I/O refresh time = (2n + m + 60)μs [n: number of I/O modules, m: total number of I/O words]
POU control time = PG control time + user FB control time + user FCT control time
= (4a + 6b + 7c)μs
[a: No. of PGs, b: No. of user FB calls, c: No. of user FCT calls]
Computing time = [tact cycle] - (2n + m + 60) - (4a + 6b + 7c)μs
No. of program steps = [computing time / single instruction execution time / 1024 ] k steps
No. of program steps = [computing time / 20.48] k steps [when single instruction execution time = 20ns]
= [computing time / 61.44] k steps [when single instruction execution time = 60ns]
Notes:
1) Refer to Appendix 1, “Instruction Processing Speed Chart,” for the execution time of the individual instructions.
2) The instruction execution time varies depending on the time required to access the memory to which variables to be
processed are assigned. Consequently, it is necessary to add the following access time increments to the instruction
execution time according to the number of variables that the instruction accesses.
The memory access times are calculated as follows:
1. I/O memory and standard memory (high speed): Base time (20ns)
2. Standard memory, retained memory, user FB memory, system FB memory, system memory: Add 40ns.
3. Memory in another CPUs access via the processor bus: 3μs
3) Since processing an operand that has two or more variable elements such as an array, structure, or character string
involves multiple memory accesses, it is necessary to take the time increments associated with the multiple memory
accesses into consideration when computing the execution time of an instruction having such an operand.
Scan time System configuration POU Control Time Program Executable Time
(Tact time) (No. of PGs/FBs/FCTs) (in 20 ns steps)
CPU... 1 module (communication module disabled) 68μs 124μs
0.5ms Direct connection I/O... 256 points (4/4/4) (6k steps)
CPU... 1 module 136μs 412μs
1ms Direct connection I/O... 1024 points (8/8/8) (20k steps)
CPU... 1 module 480μs 876μs
Direct connection I/O... 2048 points (16/32/32) (42k steps)
CPU... 1 module 480μs 876μs
Remote I/O ...1 module... 2048 points (16/32/32) (42k steps)
CPU... 1 module
2ms 480μs 492μs
Remote I/O ...2 modules: 4096 points
(16/32/32) (24k steps)
Direct connection I/O... 2048 points
2) Multi-CPU configuration
Scan time System configuration POU Control Time Program Executable Time
(Tact time) (No. of PGs/FBs/FCTs) (in 20 ns steps)
CPU... 4 modules
480μs 2492μs
Remote I/O ...2 modules: 4096 points
(16/32/32) (484k steps = 121k x 4)
Direct connection I/O... 2048 points
CPU... 4 modules
Remote I/O ...2 modules: 4096 points Direct 480μs 2620μs
4ms connection I/O... 1024 points Communication (16/32/32) (508k steps = 127k x 4)
modules... 2 modules
App.2-2
Appendix 2 Setting SPH300/SPH2000/SPH3000 Tact Cycle
(4) Estimation of the tact cycles in the 1 to 1 warm standby redundant system (SPH300)
In the 1 to 1 warm standby system, the tact time is longer than that in the ordinary multi-CPU system. This is because, in this
system, equalized data should be transferred between the working and standby CPUs. The estimate expression is described
below. In the expression, the large tact times are used for redundant system tact time
1 (TR1) and redundant system tact time 2 (TR2).
Notes:
The usual tact time is the time found by expression (1). The number of CPUs can be calculated using the number of CPU
pairs in the redundant system.
• TCPY = (No. of words for equalized variables in high-speed, standard, retain memory areas) x 0.3
+ (No. of words for user retain variables) x 0.35
+ (No. of edge detection instructions and counter instructions) x 0.3
+ (No. of timer instructions) x 0.45
+ 10 [μs]
App.2-3
Appendix 3
Setting SPH200 Tact Cycle
(1) The tact cycle calculated is based on SX bus performance.....................App.3-1
(2) The necessary tact cycle based on the run time of system software.......App.3-1
Appendix 3 Setting SPH200 Tact Cycle
On the SX bus, data is exchanged between the CPU module and I/O module in synchronization with the tact cycle. For the
application program on the CPU module, I/O data input update, arithmetical operations, and I/O data output update are
performed in each task (process unit) in parallel with data exchange on the SX bus.
The SPH200 divides system software in one tact cycle into the processes executed in every tact cycle as well as those executed
whenever an application is executed or a default task has been done. The loader process is performed in one excessive tact
cycle. The estimate expression of the scan time for each tact cycle is shown below. The tact cycle depends on the system
configuration. Execution of system software also depends on the tact cycle. Thus, the executable tact cycles must be set by
system software.
The times listed above are calculated under the condition that the ratio of I/O input to output = 1 : 1. The time increases with an
increased number of outputs and decreases with a reduced number of outputs. Its fluctuation ranges from + 20% to -20%.
(2) The necessary tact cycle based on the run time of system software
System software processes I/O transmission, tasks, and loader commands. Any of these processes should be done in one
tact cycle. Based on the number of stations simultaneously issuing the loader commands, recommended preset times and
calculation times (the application program processing time) for the tact cycles are shown below.
Notes:
The stations simultaneously issuing loader commands include the loader, PODs, and the modules associated with
message-related instructions (if the module has two ports, they are both counted.)
G Key point:
• To execute the task processes in synchronization with the tact periods, the application program should be written so
that it does not use more than the calculation time listed below.
• Compared with the recommended tact time, even when the number of stations simultaneously issuing the loader
commands is smaller, the calculation time does not vary. (The responsibility to the loader commands improves.)
Compared with the recommended tact time, when the number of stations simultaneously issuing the loader commands
is larger, the calculation time is reduced. (The responsibility to the loader commands deteriorates.)
App.3-1
Appendix 4
Calculating the Size of Arrays and Structures
Appendix 4 Calculating the Size of Arrays and Structures
How to calculate the size of arrays and structures is shown below.
Boundary consideration
The starting address of an array or structure assigned a 2-word boundary.
The boundary of the individual data item varies according to the data type established before the data is defined.
Example 1)
Example 2)
(Note)
Total 6 + 3/16 7 + (1) = 8 words
Notes:
The structure is adjusted so that the total of the sizes is an even-number word.
App.4-1
Appendix 5
Accessing the Processor Bus
Note: Version V1131 or earlier of the SPH200 does not support processor bus access.
Appendix 5 Accessing the Processor Bus
The processor bus is a data bus that is used to read and write memory between CPUs in the multi-CPU system and to read and
write memory between the CPU and the P/PE-link memory.
For example, in the system shown below, the processor bus is usually used to read and write the memory between CPU0 and
CPU1.
CPU0 CPU1
%MW0.1.2048 %MW1.1.2048
60ns
Processor bus
Notes:
1) The high-speed memory area cannot be accessed in any other CPU.
2) The access time through the processor bus.
App.5-1
Appendix 5 Accessing the Processor Bus
<Considerations in reading /writing memory through the processor bus>
The processor bus cannot be accessed simultaneously by more than one CPU. If more than one CPU accesses the processor
bus simultaneously, it can be sequentially used by the CPUs starting from the one with the highest priority assigned. The CPU
with a lower priority waits for a long time. Any such delay affects the CPU processing speed.
x x
Processor bus
Notes:
The priority is determined in the ascending order of numbers, with the highest priority assigned to the smallest one.
(Example)
In the example below, a multi-CPU system consisting of four CPUs is shown. With reference to this example, the relationship
between processor bus access and the CPU scan time is described.
1) When CPU1, CPU2, and CPU3 simultaneously access CPU0 memory, the first CPU1 with the highest priority has initial
access to it. CPU2 and CPU3 are kept waiting.
2) The scan times for CPU2 and CPU3 are delayed by the CPU1 access time.
3) When CPU1 access is complete, the CPU2 with the secondly highest priority tries to gain access to CPU0 memory.
CPU3 must wait further.
4) When CPU2 access is complete, CPU3 starts gaining access to memory.
CPU0
Memory
indicates the processor bus access time.
Access START (1) Access
completion indicates the waiting time when any other CPU is accessing the
CPU1 processor bus memory.
Scan time
Access START (3)
Access WAIT (1)
CPU2
t
(2)
Scan time
Access START (4)
Access WAIT (1)
CPU3
t
(2)
(3)
Scan time
App.5-2
Appendix 5 Accessing the Processor Bus
G Key point:
• In the multi-CPU system and P/PE-link system, design the system to minimize the number of accesses to the processor
bus. The recommended number of accesses is 128/ms.
• To transfer the memory between processor link modules such as a P/PE link or FL-net, the recommended number of
accesses is 128/ms.
• Transferring a variable of basic data type (excl. STRING) from a processor bus to a CPU memory is counted as once
(the number of transfers).
Transferring from a processor bus to a processor bus is counted as twice.
When transferring arrays or structures, the number of elements becomes the number of transfers.
Therefore, when using arrays for processor bus access, the array size must be 128 words or less.
When transferring memory between processor link modules, the array size must be 64 words or less.
App.5-3
Appendix 6
List of Reserved Words
Appendix 6 List of Reserved Words
Reserved words cannot be used for variable and data names. These reserved words include the following, such as function
names and function block names.
App.6-1
Appendix 6 List of Reserved Words
LD ld R r
LDN ldn REAL real
LE le REAL# real#
LE( le( REPEAT repeat
LEFT left REPLACE replace
LEFT( left( REPLACE( replace(
LEN len RESOURSE resourse
LEN( len( RET ret
LIMIT limit RETAIN retain
R
LIMIT( limit( RETC retc
LINT lint RETCN retcn
L
LINT# lint# RETURN return
LN ln RIGHT right
LN( ln( RIGHT( right(
LOG log ROL rol
LOG( log( ROL( rol(
LREAL lreal ROR ror
LREAL# lreal# ROR( ror(
LT lt
LT( lt( S s
LWORD lword SEL sel
LWORD# lword# SEL( sel(
SHL shl
MAX max SHL( shl(
MAX( max( SHR shr
MID mid SHR( shr(
MID( mid( SIN sin
MIN min SIN( sin(
MIN( min( SINT sint
MOD mod SINT# sint#
MOD( mod( S SQRT sqrt
M
MOVE move SQRT( sqrt(
MOVE( move( ST st
MUL mul STN stn
MUL( mul( STRING string
MUL_T_AN mul_t_an STRING# string#
MUL_T_AN( mul_t_an( STRING_HANDLE string_handle
MUX mux STRUCT struct
MUX( mux( SUB sub
SUB( sub(
NE ne SUB_T_T sub_t_t
NE( ne( SUB_T_T( sub_t_t(
N
NOT not
NOT( not( T# t#
TABLE table
OF of
TASK task
OR or
THEN then
O OR( or(
TIME time
ORN orn
TIME# time#
ORN( orn(
T TIME_OF_DAY time_of_day
PDD pdd TIME_OF_DAY# time_of_day#
P TO to
PROGRAM program
TOD tod
TOD# tod#
TRUE true
TYPE type
App.6-2
Appendix 6 List of Reserved Words
UDINT udint
UDINT# udint#
UINT uint
UINT# uint#
U ULINT ulint
ULINT# ulint#
UNTIL until
USINT usint
USINT# usint#
VAR var
VAR_DUPLICATE var_duplicate
VAR_EXTERNAL var_external
VAR_EXTERNAL_FB var_external_fb
VAR_EXTERNAL_PG var_external_pg
V VAR_GLOBAL var_global
VAR_GLOBAL_FB var_global_fb
VAR_GLOBAL_PG var_global_pg
VAR_IN_OUT var_in_out
VAR_INPUT var_input
VAR_OUTPUT var_output
WEIGHT weight
WEIGHT# weight#
W WHILE while
WORD word
WORD# word#
XOR xor
XOR( xor(
X
XORN xorn
XORN( xorn(
App.6-3
Appendix 7
How to Use SPH3000 High-speed Function
Appendix 7-1
How to Execute Programs at High-speed with SPH3000 ..............App.7-1
Appendix 7-2 Using High-speed Data Memory...................................App.7-2
(1) Memory allocation setting.........................................................................App.7-2
(2) Checking memory assignment status.......................................................App.7-3
Appendix 7-3 Using Optimized Compilation Mode............................App.7-4
Appendix 7-4
Programming Limitations in Optimized Compilation Mode...........App.7-5
(1) Connection of circuits using a connector..................................................App.7-5
(2) Feedback circuit........................................................................................App.7-5
Appendix 7-5
How to Check Remaining Capacity of High-speed PG Memory....App.7-6
Appendix 7 How to Use SPH3000 High-speed Function
App.7-1
Appendix 7 How to Use SPH3000 High-speed Function
1)
5)
6)
2)
3)
4)
1)
2)
Variables without AT specification (to which no specific address in the CPU memory is assigned) are preferentially assigned to
the high-speed data memory automatically.
Precedence of
memory automatic assignment
Memory type 1 2
Non-retain memory 1) 5)
Retain memory 2) 6)
User FB memory 3) 6)
System FB memory 4) 6)
App.7-2
Appendix 7 How to Use SPH3000 High-speed Function
(2) Checking memory assignment status
You can check the memory assignment status on the compilation result window.
From 0 to the maximum value set in 2) , the processing is performed in the high-speed memory.
After the above, the low-speed memory is used.
From 0 to the maximum value set in 3) , the processing is performed in the high-speed memory.
After the above, the low-speed memory is used.
App.7-3
Appendix 7 How to Use SPH3000 High-speed Function
Select “valid.”
App.7-4
Appendix 7 How to Use SPH3000 High-speed Function
App.7-5
Appendix 7 How to Use SPH3000 High-speed Function
App.7-6
Appendix 8
Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
Follow the procedure below to change the resource (CPU) in SX-Programmer Expert (D300win).
<Step 7> Reflect the settings of the existing resource to the new resource.
App.8-1
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
In this example, “NP1PS-32R” used in a project of a single CPU system is changed to “NP1PM-48R.”
App.8-2
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
Existing resource
The “Insert” dialog box opens. Enter a desired name in the name box (“R_48R” in this example), select “NP1PM-48R” for the
CPU type, and then click the [OK] button.
App.8-3
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-4
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-5
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
The fixed cycle task (FIXED_CYCLE) of the new resource is reset to the default settings.
Check the task settings of the existing resource and make the same settings to the task of the new resource.
* When an event task exists, make the settings in the same manner.
App.8-6
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-7
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-8
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
In the same manner, take notes on I/O registration of “Level: 0 level” and “Level: 1 level,” and then click the “All cancel” button to
cancel the registration.
App.8-9
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
Click the “Fail-soft operation setting” tab. After taking notes on which I/O is registered in the “I/O selected valid fail-soft operation”
list box, click the “<<” button to cancel the registration.
Click the [OK] button to close the dialog box and return to the “Module properties” dialog box.
Click the [OK] button to close the dialog box again to return to the system definition screen.
App.8-10
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
<Step 6-2> Changing the resource and registering I/O in the new resource
On the system definition screen, right-click the CPU and open the “Module properties” dialog box.
The “Module properties” dialog box opens. Select “R_48R” (new resource name set in the step 3) for the Name [Resource
name] and “NP1PM-48R” from the Outline specification list box.
Then, click the [OK] button to close the dialog box once.
App.8-11
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
On the system definition screen, right-click the CPU and open the “Module properties” dialog box again.
App.8-12
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-13
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
Click the “Fail-soft operation setting” tab. Referring to the notes that you have taken in <Step 6-1>, register the I/Os displayed in
the “I/O list” box on the left in the “I/O selected valid fail-soft operation” list box on the right.
Click the [OK] button to close the dialog box and return to the “Module properties” dialog box.
Click the [OK] button to close the dialog box again to return to the system definition screen.
Click the close button on the upper right corner to close the system definition screen.
App.8-14
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-15
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
<Step 7> Reflecting the settings of the existing resource in the new resource
<Step 7-1> Taking notes on the settings of the existing resource
Right-click the existing resource and select [Settings].
The “Resource setting of MICREX-SX” dialog box opens.
Open the “CPU running definition” dialog box and then “Memory allocation setting” dialog box to take notes on the settings.
App.8-16
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-17
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
<Step 7-2> Reflecting the contents of the notes in the new resource.
Right-click the new resource and select [Settings].
The “Resource setting of MICREX-SX” dialog box opens.
Open the “CPU running definition” dialog box and then “Memory allocation setting” dialog box. Make settings on each dialog box
referring to notes that you have taken in <Step 7-1>.
App.8-18
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
App.8-19
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
<Step 8> Deleting the existing resource
Select the existing resource, and then press the <Delete> key.
The following dialog box appears. Click the [OK] button to delete the resource.
App.8-20
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)
G Tips:
1. The instructions of SPH200, SPH300, SPH2000 and SPH3000 series are compatible.
However, there are differences in the execution speed and the number of program steps among them.
2. The software library offered by Fuji Electric such as expansion FBs are set as follows.
PLC type: MICREX-SX
CPU type: independent
3. As a result of resource change, the memory size of the project may be changed.
For example, if [NP1PM-48E] is changed to [NP1PM-256E], the default setting of “AT range” in “Memory allocation
setting” is changed and the number of program steps of a POU may increase.
In this case, set the memory size and AT range in the “Memory allocation setting” to the same as before the resource
change. The number of program steps may be reduced.
App.8-21
Appendix 9
Memory Access Time of SPH2000/SPH3000 Series
Appendix 9 Memory Access Time of SPH2000/SPH3000 Series
The SPH2000/SPH3000 series have “non-retain memory,” “retain memory,” “user FB memory,” and “system FB memory.”
These memories are divided into several areas according to the memory attribute and memory access.
Each memory area has different access performances, which have an effect on the program execution speed.
For a system that requires a certain speed for the program processing, use an appropriate memory.
SPH2000 SPH3000
Memory type Attribute
Memory access Memory access
Normal non-retain memory Non-retain H *1 H *1
Non-retain memory
Multi-CPU non-retain memory Non-retain M M
Normal retain memory Retain H *1 H *1
Retain memory
Multi-CPU retain memory Retain M M
Normal system FB memory Retain H *1 H *1
System FB memory
System FB memory Retain M L
Normal user FB memory Retain H *1 H *1
User FB memory
User FB memory Retain M L
Processor bus access memory – L LL
The “memory access” indicates a speed at which the memory area is accessed.
SPH2000 H: approx. 10 ns, M: approx. 200 ns, L: approx. 4100 ns
SPH3000 H: approx. 4ns, M: approx. 250 ns, L: approx. 340 to 2720 ns, LL: approx. 3300 ns
*1 These CPUs have a cash memory in the processor part. When the cash memory can be used, each target memory executes
processing approximately three times faster.
When no address is specified in D300win, H area is preferentially used to assign a memory. After H area is fully consumed,
L area is used to assign a memory.
App.9-1
Instruction Index
Instruction Index
A
ABS_DINT......................................................................2-154 C
ABS_INT.........................................................................2-154
Absolute value ABS_DINT............................................2-154 CAL.................................................................................2-281
Absolute value ABS_INT..............................................2-154 CALC..............................................................................2-282
Absolute value ABS_REAL...........................................2-155 CALCN...........................................................................2-282
ABS_REAL.....................................................................2-155 Change bank BANK_CHG.............................................2-89
ACOS.............................................................................2-159 Common logarithm LOG..............................................2-156
ACOS_DOUBLE............................................................2-242 Compare string (=) EQ_STRING..................................2-218
Action/action qualifier (SFC)...........................................2-289 Compare string (>=) GE_STRING...............................2-218
ADC/ADCO.....................................................................2-148 Compare string (>) GT_STRING..................................2-217
ADD.................................................................... 2-160, 2-270 Compare string (<=) LE_STRING................................2-219
ADD(...............................................................................2-270 Compare string (<) LT_STRING...................................2-219
ADD_DOUBLE...............................................................2-238 Compare string (≠) NE_STRING..................................2-220
ADD_DT_T.....................................................................2-221 Comparison EQ............................................................2-276
Addition ADD.................................................... 2-160, 2-270 Comparison EQ(...........................................................2-276
Addition ADD(...............................................................2-270 Comparison (=) EQ......................................................2-178
Addition ADD_DOUBLE...............................................2-238 Comparison EQ_DOUBLE...........................................2-245
ADD_TD_T.....................................................................2-221 Comparison GE............................................................2-275
Add time ADD_DT_T....................................................2-221 Comparison GE(...........................................................2-275
Add time ADD_TD_T....................................................2-221 Comparison (>=) GE....................................................2-177
Add time ADD_T_T.......................................................2-221 Comparison GE_DOUBLE............................................2-246
ADD_T_T........................................................................2-221 Comparison GT............................................................2-274
AND.................................................................... 2-169, 2-264 Comparison GT(...........................................................2-274
AND(...............................................................................2-264 Comparison (>) GT.......................................................2-176
ANDN.............................................................................2-265 Comparison GT_DOUBLE...........................................2-246
ANDN(............................................................................2-265 Comparison LE.............................................................2-278
Arc cosine ACOS..........................................................2-159 Comparison LE(...........................................................2-278
Arc cosine ACOS_DOUBLE.........................................2-242 Comparison (<=) LE.....................................................2-179
Arc sine ASIN...............................................................2-159 Comparison LE_DOUBLE............................................2-247
Arc sine ASIN_DOUBLE..............................................2-241 Comparison LT.............................................................2-279
Arc tangent ATAN.........................................................2-160 Comparison LT(............................................................2-279
Arc tangent ATAN_DOUBLE........................................2-242 Comparison (<) LT........................................................2-180
ASIN...............................................................................2-159 Comparison LT_DOUBLE............................................2-247
ASIN_DOUBLE..............................................................2-241 Comparison NE............................................................2-277
Assignment statement (:=) Comparison NE(...........................................................2-277
ST language (statement).................................. 2-33, 2-251 Comparison (≠) NE.......................................................2-181
ATAN..............................................................................2-160 Comparison NE_DOUBLE...........................................2-245
ATAN_DOUBLE..............................................................2-242 CONCAT.........................................................................2-215
CONCAT_D_D...............................................................2-226
Concatenate CONCAT.................................................2-215
Concatenate time CONCAT_D_D................................2-226
B Connector (LD).................................................................2-39
Convergence of sequence selection (SFC)....................2-295
BANK_CHG......................................................................2-89 Convert DT to DATE DT_TO_DATE............................2-226
Bias BIAS_DINT...........................................................2-145 Convert DT to TOD DT_TO_TOD................................2-226
Bias BIAS_INT..............................................................2-145 Convert number to string UINT_TO_STR....................2-141
Bias BIAS_REAL..........................................................2-146 Convert shift-JIS to string SJ_TO_STR........................2-142
BIAS_DINT.....................................................................2-145 Convert string to number STR_TO_UINT....................2-141
BIAS_INT........................................................................2-145 Convert string to shift-JIS STR_TO_SJ........................2-142
BIAS_REAL....................................................................2-146 COS................................................................................2-158
Index-1
Instruction Index
COS_DOUBLE...............................................................2-240 DT_TO_TOD..................................................................2-226
Cosine COS.................................................................2-158 DT_TO_UDINT...............................................................2-194
Cosine COS_DOUBLE.................................................2-240 DWORD_TO_BOOL.......................................................2-198
CTD..................................................................................2-54 DWORD_TO_DINT........................................................2-187
CTU..................................................................................2-54 DWORD_TO_UDINT......................................................2-193
CTUD................................................................................2-55 DWORD_TO_WORD.....................................................2-199
D E
DATE_TO_UDINT..........................................................2-194 ENCODE_DWORD........................................................2-140
DBAND_DINT.................................................................2-144 Encode ENCODE_DWORD.........................................2-140
DBAND_INT...................................................................2-143 Encode ENCODE_WORD...........................................2-139
DBAND_REAL................................................................2-144 ENCODE_WORD...........................................................2-139
D_BCD_TO_DINT..........................................................2-210 EQ...................................................................... 2-178, 2-276
D_BCD_TO_INT.............................................................2-209 EQ(.................................................................................2-276
Dead band DBAND_DINT............................................2-144 EQ_DOUBLE.................................................................2-245
Dead band DBAND_INT...............................................2-143 EQ_STRING...................................................................2-218
Dead band DBAND_REAL...........................................2-144 Exclusive NOR XORN..................................................2-269
Decode DECODE_DWORD.........................................2-139 Exclusive NOR XORN(.................................................2-269
Decode DECODE_WORD...........................................2-139 Exclusive OR XOR........................................... 2-170, 2-268
DECODE_DWORD........................................................2-139 Exclusive OR XOR(......................................................2-268
DECODE_WORD...........................................................2-139 EXP................................................................................2-157
DEG_DOUBLE...............................................................2-237 EXP_DOUBLE...............................................................2-243
DELETE.........................................................................2-216 Exponent EXP..............................................................2-157
Delete string DELETE..................................................2-216 Exponent EXP_DOUBLE.............................................2-243
DIF_DINT.........................................................................2-84 Exponent EXPT............................................................2-163
Differentiate DIF_DINT...................................................2-84 EXPT..............................................................................2-163
Differentiate DIF_REAL..................................................2-85 Extension test & set EXT_T_S.......................................2-76
DIF_REAL........................................................................2-85 EXT_T_S..........................................................................2-76
DINT_TO_D_BCD..........................................................2-212
DINT_TO_DOUBLE.......................................................2-234
DINT_TO_DWORD........................................................2-202
DINT_TO_INT................................................................2-182 F
DINT_TO_REAL.............................................................2-196
Falling edge trigger F_TRIG...........................................2-53
DINT_TO_TIME..............................................................2-203
FALSE conditional call CALCN....................................2-282
DINT_TO_UDINT...........................................................2-191
FALSE conditional jump JMPCN..................................2-281
DINT_TO_UINT..............................................................2-188
FALSE conditional return RETCN................................2-284
DINT_TO_W_BCD......................................................... 2-211
FFST.................................................................................2-77
Direct read READ_WORD/READ_BOOL......................2-66
FIFO.................................................................................2-78
Direct write WRITE_WORD/WRITE_BOOL...................2-67
File data read F_READ..................................................2-72
DIV_DOUBLE.................................................................2-239
File data write F_WRITE................................................2-74
Divergence of sequence selection (SFC).......................2-294
Divide time DIV_T_N....................................................2-225
Divide time DIV_T_R....................................................2-225
FILO.................................................................................2-79
Division DIV(.................................................................2-273
FILTER_DINT...................................................................2-80
Division DIV (Arithmetic)...............................................2-162
Filter FILTER_DINT........................................................2-80
Division DIV_DOUBLE.................................................2-239
Filter FILTER_REAL.......................................................2-81
Division DIV (IL)...........................................................2-273
FILTER_REAL..................................................................2-81
Division remainder MOD..............................................2-162
FIND...............................................................................2-217
DIVL/DIVU......................................................................2-151
Find string FIND...........................................................2-217
DIV_T_N.........................................................................2-225
F_READ...........................................................................2-72
DIV_T_R.........................................................................2-225
F_TRIG.............................................................................2-53
DOUBLE_TO_DINT.......................................................2-234
F_WRITE..........................................................................2-74
DOUBLE_TO_INT..........................................................2-232
DOUBLE_TO_REAL......................................................2-236
DOUBLE_TO_UDINT.....................................................2-235
DOUBLE_TO_UINT.......................................................2-233
Down counter CTD.........................................................2-54
DT_TO_DATE................................................................2-226
Index-2
Instruction Index
G LE(..................................................................................2-278
LE_DOUBLE..................................................................2-247
GE...................................................................... 2-177, 2-275 LEFT...............................................................................2-213
GE(.................................................................................2-275 LEN................................................................................2-213
GE_DOUBLE.................................................................2-246 LE_STRING...................................................................2-219
GE_STRING...................................................................2-218 LIMIT..............................................................................2-175
Get left sub-string LEFT...............................................2-213 Limit LIMIT....................................................................2-175
Get length LEN.............................................................2-213 LN...................................................................................2-156
Get middle sub-string MID............................................2-214 LN_DOUBLE..................................................................2-244
Get right sub-string RIGHT...........................................2-214 Load LD........................................................................2-261
GT....................................................................... 2-176, 2-274 Load not LDN...............................................................2-261
GT(.................................................................................2-274 LOG................................................................................2-156
GT_DOUBLE..................................................................2-246 Logical add OR.............................................................2-266
GT_STRING...................................................................2-217 Logical add OR(...........................................................2-266
Logical inverted add ORN............................................2-267
Logical inverted add ORN(...........................................2-267
Logical inverted product ANDN....................................2-265
H Logical inverted product ANDN(...................................2-265
Logical negation NOT...................................................2-170
Hardware RTC (Real-time Clock) HW_RTC..................2-87
Logical product AND.....................................................2-264
HW_RTC..........................................................................2-87
Logical product AND(...................................................2-264
LT........................................................................ 2-180, 2-279
LT(..................................................................................2-279
I LT_DOUBLE...................................................................2-247
LT_STRING....................................................................2-219
Initial step (SFC).............................................................2-286
INSERT..........................................................................2-215
Insert string INSERT.....................................................2-215
INT_DINT.........................................................................2-82 M
Integrate INT_DINT........................................................2-82
MAX................................................................................2-174
Integrate INT_REAL.......................................................2-83
Maximum value MAX...................................................2-174
Integrating timer TMR.....................................................2-59
MID.................................................................................2-214
INT_REAL........................................................................2-83
MIN.................................................................................2-174
INT_TO_D_BCD.............................................................2-212
Minimum value MIN......................................................2-174
INT_TO_DINT................................................................2-185
MOD...............................................................................2-162
INT_TO_DOUBLE..........................................................2-232
M_OPEN..........................................................................2-61
INT_TO_REAL...............................................................2-195
MOVE.............................................................................2-163
INT_TO_TIME................................................................2-203
Move MOVE.................................................................2-163
INT_TO_UDINT..............................................................2-191
MR....................................................................................2-60
INT_TO_UINT................................................................2-188
M_RECEIVE.....................................................................2-65
INT_TO_W_BCD............................................................ 2-211
M_SEND..........................................................................2-64
INT_TO_WORD.............................................................2-200
MUL(...............................................................................2-272
Inverted coil (LD)..............................................................2-38
MUL (Arithmetic).............................................................2-161
MUL_DOUBLE...............................................................2-239
MUL (IL)..........................................................................2-272
J MULL/MULU...................................................................2-150
Multiplication MUL(.......................................................2-272
JMP................................................................................2-280 Multiplication MUL (Arithmetic).....................................2-161
JMPC..............................................................................2-280 Multiplication MUL_DOUBLE.......................................2-239
JMPCN...........................................................................2-281 Multiplication MUL (IL)..................................................2-272
Jump (LD).........................................................................2-40 Multiply time MUL_T_N................................................2-224
Jump (SFC)....................................................................2-287 Multiply time MUL_T_R................................................2-224
MUL_T_N.......................................................................2-224
MUL_T_R.......................................................................2-224
L
LD...................................................................................2-261
LDN................................................................................2-261
LE....................................................................... 2-179, 2-278
Index-3
Instruction Index
N REAL_TO_UINT.............................................................2-189
Receive message M_RECEIVE.....................................2-65
Natural logarithm LN....................................................2-156 Remote data read R_READ...........................................2-68
Natural logarithm LN_DOUBLE....................................2-244 Remote data write R_WRITE.........................................2-69
NE...................................................................... 2-181, 2-277 REPLACE.......................................................................2-216
NE(.................................................................................2-277 Replace string REPLACE.............................................2-216
NE_DOUBLE..................................................................2-245 Reset bit RBIT_DWORD..............................................2-137
NEG................................................................................2-164 Reset bit RBIT_WORD.................................................2-137
Negation NEG..............................................................2-164 Reset R........................................................................2-263
Negation NOT_BOOL...................................................2-171 Reset set flip-flop RS......................................................2-52
Negation NOT_DWORD..............................................2-172 RET................................................................................2-283
Negation NOT_WORD.................................................2-171 RETC..............................................................................2-283
NE_STRING...................................................................2-220 RETCN...........................................................................2-284
Normal open contact (NO contact), normal close contact (NC Retriggerable timer MR..................................................2-60
contact), and coil (LD).....................................................2-38 Return (LD).......................................................................2-40
Normal step (SFC)..........................................................2-287 RIGHT............................................................................2-214
NOT................................................................................2-170 Ring counter RCT...........................................................2-58
NOT_BOOL....................................................................2-171 Rising edge trigger R_TRIG...........................................2-53
NOT_DWORD................................................................2-172 ROL_DWORD................................................................2-167
NOT_WORD...................................................................2-171 ROL_WORD...................................................................2-167
ROR_DWORD................................................................2-168
ROR_WORD..................................................................2-168
Rotate left ROL_DWORD.............................................2-167
O Rotate left ROL_WORD...............................................2-167
Rotate right ROR_DWORD..........................................2-168
Off-delay timer TOF........................................................2-57
Rotate right ROR_WORD............................................2-168
On-delay timer TON.......................................................2-56
R_READ...........................................................................2-68
Open channel M_OPEN.................................................2-61
RS....................................................................................2-52
OR...................................................................... 2-169, 2-266
RTC..................................................................................2-57
OR(.................................................................................2-266
R_TRIG............................................................................2-53
ORN................................................................................2-267
R_WRITE.........................................................................2-69
ORN(..............................................................................2-267
P S
S.....................................................................................2-263
Precautions for using a processor link module (SFC)....2-299
SBB/SBBO.....................................................................2-149
Programming a jump in an action/transition (SFC)........2-298
SBIT_DWORD................................................................2-136
PULSE_CNT....................................................................2-86
SBIT_WORD..................................................................2-136
Pulse count PULSE_CNT...............................................2-86
SC_COIL/SC..................................................................2-147
PULSE_OUT....................................................................2-86
SEL.................................................................................2-173
Pulse output PULSE_OUT.............................................2-86
Select SEL....................................................................2-173
Pulse PWM.....................................................................2-87
Send message M_SEND...............................................2-64
Pulse TP.........................................................................2-56
Sequential file load first FIFO.........................................2-78
PWM.................................................................................2-87
Sequential file load last FILO.........................................2-79
Sequential file store FFST..............................................2-77
Set bit SBIT_DWORD..................................................2-136
R Set bit SBIT_WORD.....................................................2-136
Set coil, reset coil (LD).....................................................2-39
R.....................................................................................2-263 Set reset flip-flop SR......................................................2-52
RAD_DOUBLE...............................................................2-237 Set S.............................................................................2-263
RBIT_DWORD...............................................................2-137 Shift left 32 bits with carry SLC/SLCO..........................2-152
RBIT_WORD..................................................................2-137 Shift left SHL_DWORD................................................2-165
RCT..................................................................................2-58 Shift left SHL_WORD...................................................2-165
READ_WORD/READ_BOOL...........................................2-66 Shift right 32 bits with carry SRC/SRCO......................2-153
Real-time clock RTC.......................................................2-57 Shift right SHR_DWORD..............................................2-166
REAL_TO_DOUBLE......................................................2-236 Shift right SHR_WORD................................................2-166
REAL_TO_INT...............................................................2-183 SHL_DWORD.................................................................2-165
REAL_TO_TIME.............................................................2-205 SHL_WORD...................................................................2-165
REAL_TO_UDINT..........................................................2-192 SHR_DWORD................................................................2-166
Index-4
Instruction Index
SHR_WORD...................................................................2-166 TIME_TO_UINT..............................................................2-190
Simultaneous sequences-convergence (SFC)...............2-296 TMR..................................................................................2-59
Simultaneous sequences-divergence (SFC)..................2-296 TOD_TO_UDINT............................................................2-195
SIN.................................................................................2-157 TOF..................................................................................2-57
SIN_DOUBLE.................................................................2-240 TON..................................................................................2-56
Sine SIN.......................................................................2-157 TP.....................................................................................2-56
Sine SIN_DOUBLE......................................................2-240 Transition (SFC).............................................................2-293
Single-flow transition (SFC)............................................2-294 TRUE conditional call CALC........................................2-282
SJ_TO_STR...................................................................2-142 TRUE conditional jump JMPC......................................2-280
SLC/SLCO......................................................................2-152 TRUE conditional return RETC....................................2-283
SQRT..............................................................................2-155 TRUNC_DIN...................................................................2-207
SQRT_DOUBLE.............................................................2-243 TRUNC_INT...................................................................2-207
Square root (√) SQRT...................................................2-155 TRUNC_UDINT..............................................................2-208
Square root SQRT_DOUBLE.......................................2-243 TRUNC_UINT.................................................................2-208
SR....................................................................................2-52 T_S...................................................................................2-88
SRC/SRCO.....................................................................2-153 Type conversion BOOL_TO_DWORD.........................2-201
ST...................................................................................2-262 Type conversion BOOL_TO_WORD............................2-199
Step reset processing (SFC)..........................................2-298 Type conversion DATE_TO_UDINT.............................2-194
Step sequence SC_COIL/SC.......................................2-147 Type conversion D_BCD_TO_DINT.............................2-210
STN................................................................................2-262 Type conversion D_BCD_TO_INT...............................2-209
Store not STN...............................................................2-262 Type conversion DEG_DOUBLE..................................2-237
Store ST.......................................................................2-262 Type conversion DINT_TO_D_BCD.............................2-212
STR_TO_SJ...................................................................2-142 Type conversion DINT_TO_DOUBLE..........................2-234
STR_TO_UINT...............................................................2-141 Type conversion DINT_TO_DWORD...........................2-202
SUB.................................................................... 2-161, 2-271 Type conversion DINT_TO_INT...................................2-182
SUB(...............................................................................2-271 Type conversion DINT_TO_REAL................................2-196
SUB_D_D.......................................................................2-222 Type conversion DINT_TO_TIME................................2-203
SUB_DOUBLE...............................................................2-238 Type conversion DINT_TO_UDINT..............................2-191
SUB_DT_DT...................................................................2-223 Type conversion DINT_TO_UINT.................................2-188
SUB_DT_T.....................................................................2-223 Type conversion DINT_TO_W_BCD............................ 2-211
SUB_TD_T.....................................................................2-222 Type conversion DOUBLE_TO_DINT..........................2-234
SUB_TD_TD..................................................................2-223 Type conversion DOUBLE_TO_INT.............................2-232
Subtraction SUB............................................... 2-161, 2-271 Type conversion DOUBLE_TO_REAL.........................2-236
Subtraction SUB(..........................................................2-271 Type conversion DOUBLE_TO_UDINT........................2-235
Subtraction SUB_DOUBLE..........................................2-238 Type conversion DOUBLE_TO_UINT..........................2-233
Subtract time SUB_D_D...............................................2-222 Type conversion DT_TO_UDINT..................................2-194
Subtract time SUB_DT_DT..........................................2-223 Type conversion DWORD_TO_BOOL.........................2-198
Subtract time SUB_DT_T.............................................2-223 Type conversion DWORD_TO_DINT...........................2-187
Subtract time SUB_TD_T.............................................2-222 Type conversion DWORD_TO_UDINT........................2-193
Subtract time SUB_TD_TD..........................................2-223 Type conversion DWORD_TO_WORD........................2-199
Subtract time SUB_T_T................................................2-222 Type conversion INT_TO_D_BCD...............................2-212
SUB_T_T........................................................................2-222 Type conversion INT_TO_DINT...................................2-185
Type conversion INT_TO_DOUBLE.............................2-232
Type conversion INT_TO_REAL..................................2-195
Type conversion INT_TO_TIME...................................2-203
T Type conversion INT_TO_UDINT.................................2-191
Type conversion INT_TO_UINT...................................2-188
TAN.................................................................................2-158
Type conversion INT_TO_W_BCD............................... 2-211
TAN_DOUBLE................................................................2-241
Type conversion INT_TO_WORD................................2-200
Tangent TAN.................................................................2-158
Type conversion RAD_DOUBLE..................................2-237
Tangent TAN_DOUBLE................................................2-241
Type conversion REAL_TO_DOUBLE.........................2-236
TBIT_DWORD................................................................2-138
Type conversion REAL_TO_INT..................................2-183
TBIT_WORD..................................................................2-138
Type conversion REAL_TO_TIME...............................2-205
Termination step (SFC)..................................................2-288
Type conversion REAL_TO_UDINT.............................2-192
Test bit TBIT_DWORD.................................................2-138
Type conversion REAL_TO_UINT................................2-189
Test bit TBIT_WORD....................................................2-138
Type conversion TIME_TO_DINT................................2-187
Test & set T_S................................................................2-88
Type conversion TIME_TO_INT...................................2-184
TIME_TO_DINT..............................................................2-187
Type conversion TIME_TO_REAL................................2-197
TIME_TO_INT................................................................2-184
Type conversion TIME_TO_UDINT..............................2-193
TIME_TO_REAL.............................................................2-197
Type conversion TIME_TO_UINT................................2-190
TIME_TO_UDINT...........................................................2-193
Index-5
Instruction Index
Type conversion TOD_TO_UDINT...............................2-195 W
Type conversion TRUNC_DINT...................................2-207
Type conversion TRUNC_INT......................................2-207 W_BCD_TO_DINT.........................................................2-210
Type conversion TRUNC_UDINT.................................2-208 W_BCD_TO_INT............................................................2-209
Type conversion TRUNC_UINT...................................2-208 WORD_TO_BOOL.........................................................2-198
Type conversion UDINT_TO_DATE.............................2-206 WORD_TO_DWORD.....................................................2-201
Type conversion UDINT_TO_DOUBLE........................2-235 WORD_TO_INT.............................................................2-184
Type conversion UDINT_TO_DT..................................2-205 WORD_TO_UINT...........................................................2-190
Type conversion UDINT_TO_DWORD........................2-202 WRITE_WORD/WRITE_BOOL........................................2-67
Type conversion UDINT_TO_INT.................................2-183
Type conversion UDINT_TO_REAL.............................2-197
Type conversion UDINT_TO_TIME..............................2-204
Type conversion UDINT_TO_TOD...............................2-206 X
Type conversion UDINT_TO_UINT..............................2-189
XOR.................................................................... 2-170, 2-268
Type conversion UINT_TO_DINT.................................2-185
XOR(...............................................................................2-268
Type conversion UINT_TO_DOUBLE..........................2-233
XORN.............................................................................2-269
Type conversion UINT_TO_INT...................................2-182
XORN(............................................................................2-269
Type conversion UINT_TO_REAL................................2-196
Type conversion UINT_TO_TIME................................2-204
Type conversion UINT_TO_UDINT..............................2-192
Type conversion UINT_TO_WORD..............................2-200
Type conversion W_BCD_TO_DINT............................2-210
Type conversion W_BCD_TO_INT...............................2-209
Type conversion WORD_TO_BOOL............................2-198
Type conversion WORD_TO_DWORD........................2-201
Type conversion WORD_TO_INT................................2-184
Type conversion WORD_TO_UINT..............................2-190
U
UDINT_TO_DATE..........................................................2-206
UDINT_TO_DOUBLE.....................................................2-235
UDINT_TO_DT...............................................................2-205
UDINT_TO_DWORD......................................................2-202
UDINT_TO_INT..............................................................2-183
UDINT_TO_REAL..........................................................2-197
UDINT_TO_TIME...........................................................2-204
UDINT_TO_TOD............................................................2-206
UDINT_TO_UINT...........................................................2-189
UINT_TO_DINT..............................................................2-185
UINT_TO_DOUBLE.......................................................2-233
UINT_TO_INT................................................................2-182
UINT_TO_REAL.............................................................2-196
UINT_TO_STR...............................................................2-141
UINT_TO_TIME..............................................................2-204
UINT_TO_UDINT...........................................................2-192
UINT_TO_WORD...........................................................2-200
Unconditional call CAL.................................................2-281
Unconditional jump JMP...............................................2-280
Unconditional return RET.............................................2-283
Up counter CTU.............................................................2-54
Up down counter CTUD.................................................2-55
Index-6
Fuji Electric Co., Ltd.
Gate City Ohsaki, East Tower,
11-2, Osaki 1-chome, Shinagawa-ku, Tokyo 141-0032, Japan
E-mail: micrex-sx@fujielectric.com
URL: http://www.fujielectric.com/
Materials covered in this document are subject to revision due to the modification of the product.