Sie sind auf Seite 1von 603

series

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.

Title Manual No. Contents


User’s Manual Hardware, FEH201 Describes the system configuration, hardware specifications and
MICREX-SX series SPH operations of modules in the MICREX-SX series.
User’s Manual P/PE-link Module, FEH203 Describes the communication specifications of P/PE-link, the
MICREX-SX series SPH specifications and operations of the modules.
User’s Manual FEH204 Describes the communication specifications of the T-link, the
T-link master module / T-link interface module, specifications and operations of the T-link master module /
MICREX-SX series SPH T-link interface module.
User’s Manual FEH184 Describes the specifications and operations of the redundant
SPH2000 Redundant Functions, functions of the SPH2000 series CPU (Type: NP1PM-256H).
MICREX-SX series SPH
User’s Manual FEH193 Describes the Ethernet communication functions built in the
SPH2000/3000 Ethernet Communication, SPH2000/3000 series CPUs.
MICREX-SX series SPH
User’s Manual SPH300EX, FEH192 Describes the specifications and operations of the SPH300EX
MICREX-SX series SPF CPU module (Type: NP1PS-74D).
User’s Manual D300winV2 <Reference>, FEH254 Describes the menu and icon of D300winV2 and all of the
MICREX-SX series operations of D300winV2.
User’s Manual D300winV3 <Reference>, FEH257 Describes the menu and icon of D300winV3 and all of the
MICREX-SX series operations of D300winV3.

* In this manual, the SX-Programmer Expert (D300win) is referred to simply as D300win.


* In addition to the above manuals, the following Fuji Electric Co.,Ltd. site offers various manuals and technical
documents associated with MICREX-SX series.
URL http://www.fujielectric.com

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.

Even some items indicated by "Caution" may result in a serious accident.


Both safety instruction categories provide important information. Be sure to strictly observe these instructions.

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.

Printed on * Manual No. Revision contents

Sep. 2016 FEH200 First edition

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.

Jul. 2001 FEH200b Software PLC specifications added.


High-performance CPU NP1PS-117R specifications added.

Sep. 2005 FEH200c High-performance CPU NP1PS-32R/74R/117/245R specifications added.


SPH2000 NP1PM-48R specifications added.

Jan. 2006 FEH200d SPH2000 NP1PM-48E/256E specifications added.

Mar. 2007 FEH200e SPH300EX NP1PS-74D specifications added.


SPH2000 NP1PM-256H specifications added.
SPH2000 Instruction processing speed chart added.
Refined upon.

Mar. 2008 FEH200f Instruction index added.


Some terms unified.
The warning sign modified.

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

Section 2 Programming Language


2-1 Types of Programming Languages.................................................................................................2-1
2-2 Instruction List..................................................................................................................................2-3
2-2-1 LD language...................................................................................................................................................2-3
2-2-2 Function blocks..............................................................................................................................................2-3
2-2-3 Function summary.........................................................................................................................................2-11
2-2-4 ST language...................................................................................................................................................2-33
2-2-5 IL instruction...................................................................................................................................................2-34
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
2-4 FBD Language...................................................................................................................................2-41
2-4-1 Structure of FBD language............................................................................................................................2-41
2-4-2 Function block summary................................................................................................................................2-42
2-4-3 Standard FBs (Function Blocks)....................................................................................................................2-52
2-4-4 Original FBs (Function Blocks)......................................................................................................................2-58
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
2-4-6 Function summary.........................................................................................................................................2-111
2-4-7 Original FCTs (Functions)..............................................................................................................................2-136
2-4-8 Arithmetic functions........................................................................................................................................2-154
2-4-9 Bit string functions..........................................................................................................................................2-165
2-4-10 Selection/comparison functions...................................................................................................................2-173
2-4-11 Type conversion functions...........................................................................................................................2-182
2-4-12 String functions............................................................................................................................................2-213
2-4-13 Time type data functions..............................................................................................................................2-221
2-4-14 Double-precision floating-point calculation functions (FCTs).......................................................................2-227
2-4-14-1 Common Specifications.......................................................................................................................2-227
2-4-14-2 Function of double-precision floating-point calculation FCTs...............................................................2-230
2-4-14-3 Type conversion functions...................................................................................................................2-232
2-4-14-4 Arithmetic operation functions.............................................................................................................2-238
2-4-14-5 Comparison functions..........................................................................................................................2-245
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
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
Contents
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
2-7-2-2 Step transition........................................................................................................................................2-294
2-7-2-3 Automatically generated SFC variables.................................................................................................2-297
2-7-3 SFC programming precautions......................................................................................................................2-298
2-7-4 Continuous operation of SFC.........................................................................................................................2-300

Section 3 System Definition


3-1 System Definition Summary............................................................................................................3-1
3-2 System Configuration Definition.....................................................................................................3-2
3-3 System Properties.............................................................................................................................3-5
3-3-1 System running definition...............................................................................................................................3-5
3-3-2 System redundant mode definition (Not supported by SPH200/SPH3000)...................................................3-8
3-3-3 System fail-soft startup..................................................................................................................................3-9
3-4 System Digital Output Definition.....................................................................................................3-11
3-5 CPU Parameters................................................................................................................................3-12
3-5-1 CPU running definition...................................................................................................................................3-12
3-5-2 CPU memory size definition...........................................................................................................................3-15
3-5-3 I/O group setting............................................................................................................................................3-23
3-5-4 Fail-soft operation setting...............................................................................................................................3-27
3-5-5 IP address, gateway.......................................................................................................................................3-30
3-6 Input/output Parameters...................................................................................................................3-31
3-6-1 Input filtering time...........................................................................................................................................3-31
3-6-2 Output hold definition.....................................................................................................................................3-32

Section 4 CPU Redundant System


4-1 System operation in the redundant mode......................................................................................4-1
4-1-1 1 to 1 redundant mode...................................................................................................................................4-1
4-1-2 N to 1 redundant mode..................................................................................................................................4-2
4-2 Conditions for Changeover between Working and Standby CPUs and Performance................4-3
4-2-1 Conditions for changeover.............................................................................................................................4-3
4-2-2 System performance in the redundant mode.................................................................................................4-3
4-2-3 Multi-CPU relay switch...................................................................................................................................4-4
4-2-4 Data equalization...........................................................................................................................................4-5
4-2-5 Memory operation at changeover between working and standby CPUs.......................................................4-8
4-3 CPU module LEDs and output to display system..........................................................................4-9
4-4 System Startup with no CPU 0 Station...........................................................................................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-2 Limitations on Multi-CPU.................................................................................................................5-4
5-3 Memory Map of Multi-CPU................................................................................................................5-5
5-4 Address Representation for Multi-CPU System.............................................................................5-6
5-5 I/O Processing of Multi-CPU............................................................................................................5-7
5-6 System Definition Setting Procedure..............................................................................................5-8
5-7 I/O Module Assignment in Multi-CPU..............................................................................................5-11
5-8 Memory Assignment.........................................................................................................................5-13
5-9 Others.................................................................................................................................................5-15
Contents

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
6-2-2 Tact time.........................................................................................................................................................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

Appendix 1 Instruction Processing Speed Chart


Appendix 1-1 SPH300 Instruction Processing Speed Chart...............................................................App.1-1
Appendix 1-2 SPH2000 Instruction Processing Speed Chart.............................................................App.1-9
Appendix 1-3 SPM3000 Instruction Processing Speed Chart.............................................................App.1-18
Appendix 1-4 SPH200 Instruction Processing Speed Chart...............................................................App.1-28

Appendix 2 Setting SPH300/SPH2000/SPH3000 Tact Cycle

Appendix 3 Setting SPH200 Tact Cycle

Appendix 4 Calculating the Size of Arrays and Structures

Appendix 5 Accessing the Processor Bus

Appendix 6 List of Reserved Words

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
Appendix 7-3 Using Optimized Compilation Mode..............................................................................App.7-4
Appendix 7-4 Programming Limitations in Optimized Compilation Mode.........................................App.7-5
Appendix 7-5 How to Check Remaining Capacity of High-speed PG Memory..................................App.7-6

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

Appendix 9 Memory Access Time of SPH2000/SPH3000 Series

Instruction Index
Section 1 Specifications

1-1 Operation of MICREX-SX Series.............................................................1-1


1-1-1 SX bus.............................................................................................................1-1
(1) Data exchange between a CPU module and other modules..........................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) Configuration..................................................................................................1-5
(2) Resource........................................................................................................1-5
1-2-3 Representations in programming tool.............................................................1-6
1-2-4 Notes on programming....................................................................................1-7
(1) Ladder/FBD language representation.............................................................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) 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

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) Variables used in user FBs...........................................................................1-95
(2) Instance........................................................................................................1-96
(3) Creating a user function block (FB)..............................................................1-97
(4) Using user FBs.............................................................................................1-99
1-9 Performance Specifications................................................................1-100
1-9-1 SPH300.......................................................................................................1-100
(1) NP1PS-32/32R/74/74R/117/117R...............................................................1-100
(2) NP1PS-245R..............................................................................................1-102
1-9-2 SPH300EX..................................................................................................1-104
1-9-3 SPH2000.....................................................................................................1-106
1-9-4 SPH3000.....................................................................................................1-108
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) Task execution cycle when the POU execution time of the default task
is shorter than the task cycle...................................................................... 1-114
(2) Task execution cycle when the POU execution time of the default task
is longer than the task cycle....................................................................... 1-115
1-11-4 Constant scan........................................................................................... 1-116
(1) Constant scan function............................................................................... 1-116
(2) Execution start timing of constant scan...................................................... 1-116
(3) Supported versions..................................................................................... 1-116
(4) Constant scan accuracy............................................................................. 1-117
(5) Notes on using constant scan with interrupt task (fixed cycle task,
event task).................................................................................................. 1-117
(6) Constant scan setting................................................................................. 1-117
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
(1) Calendar data conversion FB “Y_ZFC002”................................................1-122
(2) Calendar data inverse conversion FB “Y_ZFC003”....................................1-124
Section 1 Specifications SX bus

1-1 Operation of MICREX-SX Series


1-1-1 SX bus
(1) Data exchange between a CPU module and other modules
A CPU module and other modules are connected via a network system called “SX bus.”
The SX bus has a loop structure as shown in the image figure below.

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-1-2 Processor bus


The “processor bus” is provided for data communication between CPU modules or processor link modules (P/PE link, FL-
net) since large amount of data need to be transmitted. The processor bus is a high-speed data bus system with 25Mbps data
transmission speed (eight bus lines) that is connected to a CPU module and P/PE-link module on a main base board. The
processor bus cannot be connected to expansion boards.
A base board has dedicated slots for the processor bus. The number of the dedicated slots changes depending on the base
board model. When selecting a model, check the specifications of the base board.

1-2
Section 1 Specifications Programming

1-2 Programming of MICREX-SX Series


1-2-1 Overview of programming
SX-Programmer Expert (D300win) employs compilation method in programming.
• Creation and management of programs
• Management of memories to be used
• Management of operation method These are independently managed.
(how to operate programs)

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

Operation method Memory

System definition
Program

Compilation
Operation method

Program that runs on SX

1-3
Section 1 Specifications Programming

In this manual, the following terms are used:


Program a Program Organization Unit (POU), Function (FC), Function block (FB)
Memory management a Variable, Data type
Operation method a Task

Variable,
Data type POU, FB, FC

Variable,
Task
Data type

System definition
POU, FB, FC

Compilation
Task

Program that runs on SX

1-4
Section 1 Specifications Basic terms

1-2-2 Other basic terms


(1) Configuration
A configuration consists of modules directly connected to the SX bus and slave and I/O modules connected to a remote I/O
master (such as T-link master and JPCN-1 master). A PLC system that is connected via one SX bus equals one configuration.

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

PW CPU RS2 I/O I/O


2

PW T-link RS2 I/O I/O


master

T-link

POD I/O INV Servo

(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-2-3 Representations in programming tool


The terms described so far are represented in the programming tool as shown below.

This is a program (POU) named “LADDER”.

Variables and data types are stored in this folder.

A program is stored in this folder.

This represents a configuration.

This represents system definition.

This represents a resource.

How to operate tasks and programs


is determined here.

It is indicated that the program “LADDER” is


operated by means of “DEFAULT”.

The framed area represents


one resource.

1-6
Section 1 Specifications Notes on programming

1-2-4 Notes on programming


(1) Ladder/FBD language representation
1) Unit of circuit
A circuit is a group of contacts and coils that are connected together.

2) Program arrangement in a free layout


In the worksheet shown below, you can freely create circuits.

1-7
Section 1 Specifications Notes on programming

3) Execution order of ladder circuits


Generally, the circuits are executed in the following order. However, since you can freely arrange circuits, the execution order is
changed by a slight difference of their positions.

Network No.

Execution
order

A number displayed below a network No. indicates the execution order.


When you move a circuit, the execution order is changed.
Click the [Layout] menu > [Execution Order] to show the execution order.

Execution
order

1-8
Section 1 Specifications Notes on programming

1-2-5 How to calculate the number of steps


You can calculate the number of steps of a program by adding the numbers of steps of each instruction.
For example, in a ladder diagram, a program is represented by combinations of the symbols listed below. One symbol is one
step of a user program.

Instruction Name No. of steps

Normal open contact (NO contact) 1

Normal close contact (NC contact) 1

Coil 1

Inverted coil 1

Set coil 1

Reset coil 1

“Connector name” Connect to “connector name” 1

“Connector name” Connect from “connector name” 1

“Label name” Jump 1

“Label name” Jump label 0

RETURN Return 1

Applied instructions are represented as FBs. Add the number of steps of each FB.

Instruction Name No. of steps


SR_1 Instance name

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-2-6 Using this user’s manual


Page
(1) How to handle memories (I/O, auxiliary memory, data memory)
g
1-3 I/O Address Assignment 1-11
g
1-4 Memory 1-13
g
1-5 Variable, 1-6 Data Type 1-64, 1-70

(2) How to handle program instructions


g
1-8 Program Organization Unit (POU) 1-91
g
Section 2 Programming Language 2-1

(3) How to operate programs


g
1-7
Task 1-87

(4) Specifications of CPUs


g 1-9 Performance Specifications 1-100

(5) Operation and processing time of SX


g
1-10 Operation Flowchart 1-112
g
1-11 SX Series Processing Time 1-113

(6) Redundant systems


g Section 4 CPU Redundant System 4-1

(7) When using I/O area exceeding 512 words


g
Section 6 I/O Extension Function 6-1

(8) Multi-CPU systems


g Section 5 Multi-CPU System 5-1

(9) How to change a CPU in a program


g Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project) App. 8-1

(10) High-speed Function of SPH3000 Series


g
Appendix 7 How to Use SPH3000 High-speed Function App. 7-1

1-10
Section 1 Specifications Address assignment

1-3 Input/Output (I/O) Address Assignment


1-3-1 Address assignment example
This subsection describes address assignment using the system configuration below as an example.

I/O I/O I/O I/O I/O I/O I/O I/O


CPU
Power “0” 16-point 32-point 64-point 6-point 8-point 16-point 32-point 64-point
supply input input input output output output output output SX bus station No.
“254” “1” “2” “3” “4” “5” “6” “7” “8”

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

1-3-2 Rules for assigning I/O addresses


In MICREX-SX series SPH, follow the rules below to assign I/O addresses.

1) I/O directly connected to SX bus

Period Period

Prefix SX bus station No. Word No. Bit address

Input : %IX (bit), %IW (word), %ID (double word)


Output : %QX (bit), %QW (word), %QD (double word)

2) Remote I/O

Period Period Period

Prefix SX bus station No. Remote I/O station No. Word No. Bit address

1-11
Section 1 Specifications Address assignment

1-3-3 Assigning I/O addresses to an application program


In the MICREX-SX series, assign I/O addresses on the variable worksheet.

<Example of a circuit on code worksheet>

<Example of address assignment on variable worksheet for D300win V2>

<Example of address assignment on variable worksheet for D300win V3>

* For details, see “1-5 Variable.”

1-12
Section 1 Specifications Memory map

1-4 Memory
1-4-1 Memory map
(1) NP1PS-32/32R (SPH300)

IEC representation Address representation for a multi-CPU system (Note 2)


(Input) (Output)
%I %Q I/O memory
(I/Q) (Note 4)
512 words (8192 points) The CPU number is specified here.
%MW1.0 Standard memory
(high speed) (Note 3)
2K words
%MW1.2047
Program memory
%MW1.2048 %MWo.1.2048
Standard memory
(M) 32K steps
6K words
%MW1.8191 %MWo.1.8191
%MW3.0 %MWo.3.0
Retain memory
(M)
4K words
%MW3.4095 %MWo.3.4095 (Note 1)

User FB instance memory


(M)
4K words
Temporary area
8K words

System FB instance memory


(M) *1K=1024
16K words

%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

(2) NP1PS-74/74R (SPH300)

IEC representation Address representation for a multi-CPU system (Note 2)


(Input) (Output)
%I %Q I/O memory (Note 4)
(I/Q)
512 words (8192 points)
* Max 1856 words
in I/O extension mode The CPU number is specified here.
%MW1.0 Standard memory
(high speed) (Note 3)
2K words
%MW1.2047
Program memory
%MW1.2048 %MWo.1.2048
Standard memory
(M) 74K steps
30K words
%MW1.32767 %MWo.1.32767
%MW3.0 %MWo.3.0
Retain memory
(M)
16K words
%MW3.16383 %MWo.3.16383 (Note 1)

User FB instance memory


(M)
16K words
Temporary area
8K words

System FB instance memory


(M) *1K=1024
64K words

%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

(3) NP1PS-117/117R (SPH300)

IEC representation Address representation for a multi-CPU system (Note 2)


(Input) (Output)
%I %Q I/O memory (Note 4)
(I/Q)
512 words (8192 points)
* Max 4096 words
in I/O extension mode The CPU number is specified here.
%MW1.0 Standard memory
(high speed) (Note 3)
2K words
%MW1.2047
Program memory
%MW1.2048 %MWo.1.2048
Standard memory
(M) 117K steps
126K words
%MW1.131071 %MWo.1.131071
%MW3.0 %MWo.3.0
Retain memory
(M)
32K words
%MW3.32767 %MWo.3.32767 (Note 1)

User FB instance memory


(M)
32K words
Temporary area
8K words

System FB instance memory


(M) *1K=1024
64K words

%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

(4) NP1PS-245R (SPH300)


IEC representation Address representation for a multi-CPU system (Note 2)
(Input) (Output)
%I %Q I/O memory (Note 4)
(I/Q)
512 words (8192 points)
* Max 4096 words
in I/O extension mode The CPU number is specified here.
%MW1.0 Standard memory
(high speed) (Note 3)
2K words
%MW1.2047
Program memory
%MW1.2048 %MWo.1.2048
Standard memory
(M) 245K steps
254K words
%MW1.262143 %MWo.1.262143
%MW3.0 %MWo.3.0
Retain memory
(M)
127K words
%MW3.130047 %MWo.3.130047 (Note 1)

User FB instance memory


(M)
65K words
Temporary area
8K words

System FB instance memory


(M) *1K=1024
64K words

%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

(5) NP1PS-74D (SPH300EX)

IEC representation IEC representation (Note 1)


Basic CPU Expanded CPU
(Input) (Output) (Input) (Output)
%IW %QW I/O memory I/O memory %IW254.0. %QW254.0.
(I/Q) (I/Q)
512 words (8192 points) 512 words (8192 points)
Address representation * Max 1856 words
for a multi-CPU system in I/O extension mode
(Note 2)
%MW1.0 Standard memory Standard memory %MW254.0.1.0
(Note 4) (high speed) (high speed)
2K words 2K words
%MW1.2047 %MW254.0.1.2047
%MWo.1.2048 %MW1.2048 %MW254.0.1.2048
Standard memory Standard memory
(M) (M)
30K words 30K words
%MWo.1.32767 %MW1.32767 %MW254.0.1.32767
%MWo.3.0 %MW3.0 %MW254.0.3.0
Retain memory Retain memory
(M) (M)
16K words 16K words
%MWo.3.16383 %MW3.16383 %MW254.0.3.16383

User FB instance memory User FB instance memory (Note 3)


(M) (M)
16K words 16K words

System FB instance memory System FB instance memory


(M) (M)
64K words 64K words

%MWo.10.0 %MW10.0 %MW254.0.10.0


System memory System memory
(M) (M)
512 words 512 words
%MWo.10.511 %MW10.511 %MW254.0.10.511

%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

Program memory Program memory


74K steps 74K steps

Temporary area Temporary area


8K words 8K words *1K=1024

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

(6) NP1PM-48R/48E (SPH2000)


IEC representation Address representation for a multi-CPU system (Note 2), (Note 3)
(Input) (Output)
%I %Q
I/O memory
(I/Q) (Note 4)
512 words (8192 points)

The CPU number is specified here.

%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

User FB instance memory


(normal) *1K=1024
(M)
8K words

System FB instance memory


(normal)
(M)
16K 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

(7) NP1PM-256E/256H (SPH2000)


IEC representation Address representation for a multi-CPU system (Note 2), (Note 3)
(Input) (Output)
%I %Q
I/O memory
(I/Q) (Note 4)
512 words (8192 points)
* Max 4096 words
The CPU number is specified here.
in I/O extension mode
%MW1.0
Standard memory
(M) Program memory
1664K words
%MW1.1703935 256K steps
%MW1.2097152 %MW.1.2097152
Standard memory for multi-CPU
(M)
0 word

%MW3.0 Retain memory


(normal) (Note 6)
(M)
%MW3.32767 8K words
%MW3.32768 %MW.3.32768 (Note 1)
Retain memory for multi-CPU
(M)
224K words Temporary area
%MW3.262143 %MW.3.262143 32K words

User FB instance memory


(M) *1K=1024
8K (normal) + 64K words
(Note 6)

System FB instance memory


(M)
16K (normal) + 64K words
(Note 6)

%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

(8) NP1PU-048E (SPH3000)


IEC representation Address representation for a multi-CPU system (Note 2), (Note 3)
(Input) (Output)
I/O memory
%I %Q
(I/Q)
512 words (8192 points)
(Note 4) The CPU number is specified here.
* Max 4096 words
in I/O extension mode
%MW1.0 Standard memory
(Note 5)
(High speed)
96K words (fixed) Program memory
%MW1.98303
48K steps
%MW1.98304
Standard memory
(M)
0 word

High-speed program memory


%MW1.262144 %MWo.1.262144 224K bytes
Standard memory for multi-CPU
(M) (Note 7)
0 word
(Note 6)
%MW3.0
Retain memory
(normal) (Note 8)
(M) (Note 1)
Temporary area
8K words
32K words
%MW3.32768 %MWo.3.32768
Retain memory for multi-CPU
(M) *1K=1024
32K words
(Note 6)

User FB instance memory


(M)
8K (normal) + 32K words
(Note 8)

System FB instance memory


(M)
16K (normal) + 64K words
(Note 8)

%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

(9) NP1PU-128E (SPH3000)


IEC representation Address representation for a multi-CPU system (Note 2), (Note 3)
(Input) (Output)
I/O memory
%I %Q
(I/Q)
512 words (8192 points)
(Note 4) The CPU No. is specified here.
* Max 4096 words
in I/O extension mode
%MW1.0 Standard memory
(Note 5)
(high speed)
96K words (fixed) Program memory
%MW1.98303
256K steps
%MW1.98304
Standard memory
(M)
672K word

High-speed program memory


%MW1.1048576 %MWo.1.1048576 128K bytes
Standard memory for multi-CPU
(M) (Note 7)
0 word
(Note 6)
%MW3.0
Retain memory
(normal) (Note 8)
(M) (Note 1)
Temporary area
8K words
32K words
%MW3.32768 %MWo.3.32768
Retain memory for multi-CPU
(M) *1K=1024
112K words
(Note 6)

User FB instance memory


(M)
8K (normal) + 48K words
(Note 8)

System FB instance memory


(M)
16K (normal) + 64K words
(Note 8)

%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

(10) NP1PU-256E (SPH3000)


IEC representation Address representation for a multi-CPU system (Note 2), (Note 3)
(Input) (Output)
I/O memory
%I %Q
(I/Q)
512 words (8192 points)
(Note 4) The CPU No. is specified here.
* Max 4096 words
in I/O extension mode
%MW1.0 Standard memory
(Note 5)
(High speed)
96K words (fixed) Program memory
%MW1.98303
256K steps
%MW1.98304
Standard memory
(M)
1568K word

High-speed program memory


%MW1.2097152 %MWo.1.2097152 224K bytes
Standard memory for multi-CPU
(M) (Note 7)
0 word
(Note 6)
%MW3.0 Retain memory
(normal) (Note 8)
(M) (Note 1)
Temporary area
8K words
32K words
%MW3.32768 %MWo.3.32768
Retain memory for multi-CPU
(M) *1K=1024
224K words
(Note 6)

User FB instance memory


(M)
8K (normal) + 64K words
(Note 8)

System FB instance memory


(M)
16K (normal) + 64K words
(Note 8)

%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

<High-speed program memory>


SPH3000 series have the “high-speed program memory” area in the program memory.
When a program is stored in this area, the program execution speed becomes approximately three times faster.
Programs can be assigned to the high-speed program area in units of POUs.

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.

Total capacity Used capacity Remaining capacity

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

(11) NP1PH-16 (SPH200)


IEC representation

%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

User FB instance memory


(M)
4K words
(Note 1)

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

(12) NP1PH-08 (SPH200)


IEC representation

%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

User FB instance memory


(M)
2K words

(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

<I/O extension mode>


15 0
%I %Q Note: In I/O extension mode, the number of words of the remote
I/O memory I/O system that occupies the largest I/O registered in a single
SX system (configuration) is reserved.
512 - (Max. number of words
occupied by remote I/O)

Max. number of words


Remote I/O master Remote I/O master
occupied by remote I/O
System 1 System 8
(Note)

Max. 8 remote I/O systems

* For details, see “Section 6 I/O Extension Function.”

1-26
Section 1 Specifications Standard memory

1-4-3 Standard memory area


The standard memory area is used for auxiliary relays that are used internally in the PLC.

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

Cold start Warm start


Standard memory Reset to 0 (zero). Reset to 0 (zero).
Initialized standard memory Writes specified initial values. Writes specified initial values.

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

(SPH300) Address representation (SPH200)


15 0 for a multi-CPU system 15 0
%MW1.0 %MW1.0
Standard memory
(high speed) Standard memory
(M) (M)
2K words CPU No.
%MW1.2047 NP1PS-16
%MW1.2048 %MW.1.2048 : 8K words
Standard memory NP1PS-08
(M) : 4K words

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 Address representation


: 64K words for a multi-CPU system
NP1PM-256E/256H
: 1664K words CPU No.

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

1-4-4 Retain memory area


The retain memory area is used for the auxiliary relays used internally in the PLC.

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

Cold start Warm start


Standard memory Reset to 0 (zero). Retains old values.
Initialized standard memory Writes specified initial values. Retains old values.

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

Address representation for a multi-CPU system


(SPH300, SPH200)
(only for SPH300)
15 0
%MW3.0 %MW.3.0
Retain memory
CPU No. is
(M)
specified here.
NP1PS-32/32R
4K words
NP1PS-74/74R/74D
: 16K words
NP1PS-117/117R
: 32K words
NP1PS-245R
: 127K words
NP1PH-16
: 4K words
NP1PH-08
: 2K words

(SPH2000)
15 0
%MW3.0
Retain memory
(M)

NP1PM-48R/48E Address representation


: 8K words for a multi-CPU system
NP1PM-256E/256H
: 32K words CPU No.

%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/128E/256E Address representation


: 8K words for a multi-CPU system
CPU No.
%MW3.32768 Retain memory
for multi-CPU %MW.3.32768

NP1PU-048E
: 32K words
NP1PU-128E
: 112K words
NP1PU-256E
: 224K words

1-30
Section 1 Specifications User FB instance memory

1-4-5 User FB instance memory area


The user FB memory area is an instance memory area dedicated to each user FB used internally in the PLC.

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

1-4-6 System FB instance memory area


The system FB memory area is a memory area dedicated to the system FBs such as timers, counters, and differential
instructions that are used internally in the PLC.

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

Edge detect Notes:


NP1PS-32/32R: 2K words 1) The numbers of words shown in the left figure
NP1PS-74/74R/74D/117/117R/245R, NP1PM-256E/256H: 8K words are the default values.
NP1PU-048E/256E: 10K words
NP1PM-48R/48E: 2K words
NP1PH-08: 0.5K words, NP1PH-16: 1K words
Counter
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

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

1-4-7 Initialization area


The initialization area stores the initial values for the user function blocks and variables. Only SPH200 (standard CPU) supports
this area.

G Key point:

1) The size of this areas is calculated by the following formula.


(Initialization area) = (No. of words in user FB instance area) x 9/8
+ (No. of variables for which initial values are set) x 5 (words)
2) The default values have been preset as shown below.

Initialization area Initial user FB value Initial variable value


(entire) storing area storing area
NP1PH-16 7K words 4608 words 2560 words
NP1PH-08 3K words 2304 words 768 words

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.

Initial variable value


storing area

NP1PH-16:
2560 words
(default)
NP1PH-08:
768 words
(default)

1-34
Section 1 Specifications System memory

1-4-8 System memory area (512 words)


The use of the system memory is predetermined; the flags to indicate the operating status and error condition of the MICREX-SX
series system are allocated.
A resource is defined as one CPU system that consists of one CPU
module and two or more other modules such as I/O modules.
(1) System memory

%MW10.0 Resource operating status %MW10.128


Remote I/O master 0
|
%MW10.1 Resource switch / User ROM status I/O module configuration information
%MW10.135
%MW10.2 Resource fatal fault factor %MW10.136
Remote I/O master 0
|
%MW10.3 Not used I/O module fault information
%MW10.143
%MW10.4 Resource nonfatal fault factor %MW10.144
Remote I/O master 1
%MW10.5 Not used |
I/O module configuration information
%MW10.151
%MW10.6 CPU error factor
%MW10.152
Remote I/O master 1
%MW10.7 Not used |
I/O module fault information
%MW10.159
%MW10.8, 9 Memory error factor
%MW10.160
%MW10.10 Remote I/O master 2
SX bus error factor |
%MW10.11 I/O module configuration information
%MW10.167
%MW10.12 Application error factor (fatal fault) %MW10.168
Remote I/O master 2
|
%MW10.13 Application error factor (nonfatal fault) I/O module fault information
%MW10.175
%MW10.14 %MW10.176
User fatal fault Remote I/O master 3
| |
factor 0 - factor 47 I/O module configuration information
%MW10.16 %MW10.183
%MW10.17 Not used %MW10.184
Remote I/O master 3
%MW10.18 |
User nonfatal fault I/O module fault information
| %MW10.191
factor 0 - factor 47
%MW10.20 %MW10.192
Remote I/O master 4
%MW10.21 Not used |
I/O module configuration information
%MW10.199
%MW10.22
%MW10.200
| System definition error factor Remote I/O master 4
|
%MW10.29 I/O module fault information
%MW10.207
%MW10.30
%MW10.208
| Not used Remote I/O master 5
|
%MW10.37 I/O module configuration information
%MW10.215
%MW10.38 %MW10.216
Application program error factor Remote I/O master 5
%MW10.39 |
I/O module fault information
%MW10.40 %MW10.223
Not used
%MW10.41 %MW10.224
Remote I/O master 6
%MW10.42 |
Announce relay I/O module configuration information
%MW10.43 %MW10.231
%MW10.44 %MW10.232
Not used Remote I/O master 6
%MW10.45 |
I/O module fault information
%MW10.239
%MW10.46 Redundant announce relay
%MW10.240
Remote I/O master 7
%MW10.47 Redundant operation mode |
I/O module configuration information
%MW10.247
%MW10.48, 49 Resource operation/running information
%MW10.248
%MW10.50, 51 Resource configuration/fault information Remote I/O master 7
|
I/O module fault information
%MW10.52 %MW10.255
SX bus configuration information
| Fail-soft maintenance operation prohibition
(configuration information) %MW10.256
%MW10.67 mode/ Fault status display mask mode, etc.
%MW10.68 %MW10.257
SX bus fault information
| | Fault status display mask station No.
(configuration error information)
%MW10.83 %MW10.272
%MW10.84 %MW10.273 I/O extension mode status display
SX bus-connected module fail-soft mode
|
information %MW10.274
%MW10.99
| Not used
%MW10.100
%MW10.299
| Not used
%MW10.127
(Continued on next page)
1-35
Section 1 Specifications System memory

%MW10.300 * Do not write to areas marked “not used.”


| Not used * For information on the system memory dedicated to
%MW10.439 SPH300EX, refer to the user’s manual “SPH300EX
%MW10.440 (FEH192).”
Ethernet interface parts information
|
(only for CPU with Ethernet function)
%MW10.445
%MW10.446
| Free-run counter information
%MW10.447
%MW10.448
| Not used
%MW10.507
%MW10.508
| SX bus transmission error rate information
%MW10.511

1-36
Section 1 Specifications System memory

(2) Resource operating status %MW10.0 (Read only)


This area indicates the resource (CPU module) operating status and operating modes.

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

ON when the CPU is a standby CPU in the redundant a


%MX10.0.5 Redundancy standby 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

%MX10.0.7 N:1 redundancy ON when the system is in the N-to-1redundant mode. a – –


%MX10.0.8 Non-automatic operation mode ON when in the non-automatic operation mode. a a a
%MX10.0.9 Automatic operation mode ON when in the automatic operation mode. a a a
%MX10.0.10 Preceding state mode ON when in the preceding state mode. a a a
%MX10.0.11 Battery-less run mode ON when in the battery-less run mode. a a a
%MX10.0.12 Not used – – –
%MX10.0.13 SX bus-connected module ON when all the modules connected to the SX bus
a a a
(Note 1) fail-soft mode support fail-soft operation and individual reset.
ON when the CPU module is controlling the processor
%MX10.0.14 Processor bus master a a a
bus.
%MX10.0.15 SX bus master ON when the CPU module is controlling the SX bus. a a a
a: Supported, – : Not supported
Non-automatic operation mode
In this mode, the CPU does not start operation when the system power is turned on with the key switch (on the CPU module
front panel) set to “RUN” or “TERM.” This mode can be set by the “Running specification at power on” option on the CPU
running definition of the resource setting.
Automatic operation mode
In this mode, the CPU starts operation when the system power is turned on with the key switch (on the CPU module front panel)
set to “RUN” or “TERM.” This mode can be set by the “Running specification at power on” option on the CPU running definition
of the resource setting. (The automatic operation mode is set by default.)
Preceding state mode
In this mode, when the system power is turned on with the key switch (on the CPU module front panel) set to “RUN,” the CPU
starts operation, and when system power is turned on with the key switch set to “TERM,” the CPU enters the preceding state
(running or stopped) that was established when the power was turned off in the preceding run.
Battery-less run mode
In this mode, all the memories are initialized to the initial values or reset to 0 at system power-on (RAS history is also reset to 0).
(In the case of SPH3000, the RAS history is not reset to 0. However, if a memory backup error occurs, the RAS history is reset
to 0.) Note that neither battery connection check nor voltage check is performed. This mode can be set by the “Battery less run”
option on the CPU running definition of the resource setting. When the preceding state mode is on in the battery-less mode, the
CPU enters the automatic operation mode. For the standard CPU, this mode is not enabled unless a user ROM card is inserted.

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

(3) Resource switch / User ROM state %MW10.1 (Read only)


This area indicates the state of the CPU module switches that control the resource.

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

(4) Resource fatal fault factor %MW10.2 (Read only)


This area indicates the factors of fatal faults that will cause the resource to stop (one CPU system).

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.

ON when a fault occurs in an I/O module controlled by the


self-CPU module and fail-soft operation is disabled.
%MX10.2.5 I/O module error a a a
When fail-soft operation is enabled for the I/O module that
has a fault, the entire system continues operation.

Common module error ON when a fault occurs in a common module (excluding


%MX10.2.6 a a a
(Note 1) self-CPU module) on the SX bus.
ON when relay-switching cannot be performed in the a
%MX10.2.7 Relay-switching error a –
redundant operation mode. Note 2

%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

(5) Resource nonfatal fault factor %MW10.4 (Read only)


This area indicates the factors of nonfatal faults. Even if any of the following errors occurs, the resource continues operation.

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

(6) CPU error factor %MW10.6 (Read only)

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

(7) Memory error factor %MW10.8, %MW10.9 (Read only)

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.

<System operation after a memory error>


If a memory backup error occurs, the entire user memory area is reset to 0 (or replaced with the initial value if it is preset).
The RAS history is also cleared. When any of the bits %MX10.8.0 to %MX10.8.3 is set to ON, there is a high possibility of a
hardware fault. Therefore, even if the power is turned off and then on again, a fatal fault will recur due to a memory error.

1-41
Section 1 Specifications System memory

(8) SX bus error factor %MW10.10, %MW10.11

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

ON when an access error occurs in the processor


Processor bus access bus (when the cause of the error is attributable to Nonfatal
%MX10.11.15 a a a
error the accessed module). fault
This bit can be set OFF by an application program.

%MX10.11.15 Not used – – –

(9) Application error factor %MW10.12, %MW10.13 (Read only)

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

(10) User fatal fault %MW10.14 to %MW10.16

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

(11) User nonfatal fault %MW10.18 to %MW10.20

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

(12) System definition error factor %MW10.22 to %MW10.29 (Read only)

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

Remote I/O master 4 ON when fail-soft definition contains Fatal a – a


%MX10.23.10
fail-soft definition error an error. fault
Remote I/O master 5
%MX10.23.11
fail-soft definition error
Remote I/O master 6
%MX10.23.12
fail-soft definition error
Remote I/O master 7
%MX10.23.13
fail-soft definition error
ON when the definition of Ethernet
Fatal a
%MX10.23.14 Ethernet initialization error communication built-in the CPU contains – –
fault Note 2
an error.
%MX10.23.15 Not used – – –
ON when “hold” is defined for a module
other than output modules or an Fatal
%MX10.24.0 Direct I/O hold definition error a – a
output module in which the system DO fault
definition is set.
ON when operation setting of the
Fatal
%MX10.24.1 Direct I/O initialization error module directly connected to the SX bus a a a
fault
contains an error.
%MX10.24.2
| Not used – – –
%MX10.24.15
%MX10.25.0 Remote I/O master 0 initialization error ON when the running definition of the Fatal a – a
remote I/O master contains an error. fault
%MX10.25.1 Remote I/O master 1 initialization error
%MX10.25.2 Remote I/O master 2 initialization error
%MX10.25.3 Remote I/O master 3 initialization error
%MX10.25.4 Remote I/O master 4 initialization error
%MX10.25.5 Remote I/O master 5 initialization error
%MX10.25.6 Remote I/O master 6 initialization error
%MX10.25.7 Remote I/O master 7 initialization error
%MX10.25.8
| Not used – – –
%MX10.25.15
%MX10.26.0 Processor-link 0 initialization error ON when the running definition of P-link/ Fatal a – a
PE-link/FL-net contains an error. fault
%MX10.26.1 Processor-link 1 initialization error
%MX10.26.2 Processor-link 2 initialization error
%MX10.26.3 Processor-link 3 initialization error
%MX10.26.4 Processor-link 4 initialization error –
%MX10.26.5 Processor-link 5 initialization error
%MX10.26.6 Processor-link 6 initialization error
%MX10.26.7 Processor-link 7 initialization error
%MX10.26.8
| Not used – – –
%MX10.29.15

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

(13) Application program error factor %MW10.38, %MW10.39

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

(14) Announce relay %MW10.42, %MW10.43

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

%MX10.47.7 Not used – –

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

(16) Resource operation/running information %MW10.48, %MW10.49 (Read only)


(Only for SPH300, NP1PM-256H)
The resource operation/running information enables an application program to recognize the status of the system (CPU module)
in the redundant or single mode. Resource running information is enabled only in the redundant mode.
The types of statuses listed below are valid when the corresponding bits of the resource configuration/fault information
(%MW10.50, 51) are “ON.”

<In the redundant mode>

Resource operation Resource running


Resource status
information information
OFF OFF Standby CPU is stopped.
ON OFF Working CPU is stopped.
ON ON Working CPU is running.
OFF ON Standby CPU is running.

<Resource operation information>

Address Name Description


%MX10.48.0 Working CPU 0 running ON when the working CPU is running in the redundant mode.
(Undefined in a mode than the redundant mode)
%MX10.48.1 Working CPU 1 running
%MX10.48.2 Working CPU 2 running
%MX10.48.3 Working CPU 3 running
%MX10.48.4 Working CPU 4 running
%MX10.48.5 Working CPU 5 running
%MX10.48.6 Working CPU 6 running
%MX10.48.7 Working CPU 7 running
%MX10.48.8
| Not used
%MX10.48.15

<Resource running information>

Address Name Description


%MX10.49.0 CPU 0 running ON when the CPU module of the corresponding No. is connected to the SX bus
and running.
%MX10.49.1 CPU 1 running
%MX10.49.2 CPU 2 running
%MX10.49.3 CPU 3 running
%MX10.49.4 CPU 4 running
%MX10.49.5 CPU 5 running
%MX10.49.6 CPU 6 running
%MX10.49.7 CPU 7 running
%MX10.49.8
| Not used
%MX10.49.15

Notes:
1) The CPU No. means the No. that is selected by the switch.

1-49
Section 1 Specifications System memory

(17) Resource configuration/fault information %MW10.50, %MW10.51 (Read only)


The resource configuration/fault information enables an application program to recognize the status of other resources (CPU
module).

Resource configuration Resource fault


Resource status
information information
OFF OFF Nonexistent
ON OFF Normal (running or stopped)
ON ON Nonfatal fault (running or stopped)
OFF ON Fatal fault (stopped or dropped)

<Resource configuration information>

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

<Resource fault information>

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

(18) Configuration information %MW10.52 to %MW10.67 (Read only)


When a module is connected to the SX bus and running normally or in a nonfatal fault condition, the bit corresponding to the SX
station No. of the module is set ON.
Whether the module is normal or in a nonfatal fault condition is identified by the combination of the SX bus configuration
information and configuration fault information.

Configuration Configuration fault


Module status
information information
OFF OFF Nonexistent
ON OFF Normal
ON ON Nonfatal fault
OFF ON Fatal fault or dropped

Word address
i 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 f Bit address

%MW10.52 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 f Not used

%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

(19) Configuration fault information %MW10.68 to %MW10.83 (Read only)


When a module is connected to the SX bus and in a fatal or nonfatal fault condition, 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.68 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 f Not used

%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.84 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 f Not used

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

Remote I/O configuration Remote I/O fault


Module status
information information
OFF OFF Nonexistent
ON OFF Normal
ON ON Nonfatal fault
OFF ON Fatal fault or dropped

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

• “Hide the error display state” mode


When the SPH system is set in the fail-soft startup mode and a station specified as fail-soft startup does not exist, the SPH
system starts operation in a nonfatal fault condition. At this time, the ALM LED of the CPU status indication LED is turned
ON. Under this condition, even if a station that is set in fail-soft operation mode is dropped, the status of the LED does not
change. The status change of the system cannot be recognized by the status of the LED.
In “Hide the error display state” mode, even if a station specified as fail-soft startup does not exist at system startup, the
system does not go into a nonfatal fault condition. Therefore, a dropout of an existing station can be recognized by the
status of the ALM LED.

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

Address Name Description


%MW10.256.0 Partial fail-soft startup mode ON when the system is in partial fail-soft startup mode.
%MW10.256.1
| Not used
%MW10.256.4
ON: Monitoring time is set to10 s.
%MW10.256.5 System start watch time
OFF: 30 s (default)
Fail-soft maintenance operation ON when the system is in partial fail-soft startup mode, and “fail-soft
%MW10.256.6
prohibition mode maintenance operation prohibition” mode is ON.
Hide the error display state ON when the system is in partial fail-soft startup mode, and “hide the error
%MW10.256.7
mode display state” mode is ON.
%MW10.256.8
|
%MW10.256.13
Compulsion setting hold state ON: Forcible setting for I/O is held at starts up.
%MW10.256.14
mode OFF: Forcible setting for I/O is cleared at starts up.
ON: Forcible setting has been held.
%MW10.256.15 Forcible setting status
OFF: No forcible setting has been held.

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.257 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 f Not used

%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

(31) I/O extension mode status %MW10.273 (Read only)


(Only for SPH300 software version V64 or later, NP1PM-256E/256H software version V08 or later, and SPH3000)

%MW10.273

I/O memory size for remote I/O master (word)

I/O extension function in use

• I/O extension function in use


ON when the target system is operating in the I/O extension mode.

• I/O memory size for remote I/O master


The I/O memory size of a remote I/O system that occupies the largest number of words for I/O memory among multiple
remote I/O systems in an SPH system is indicated in units of words.

1-59
Section 1 Specifications System memory

(32) Ethernet interface information %MW10.440 to %MW10.445 (Read only)


(Only for the models that has built-in Ethernet)
This ares indicates the MAC addresses, IP addresses, and loader command ports in the Ethernet interface part.

Address Name Description


%MW10.440 MAC address (H) Indicates the MAC address set for the Ethernet built in the CPU.
The MAC address (fixed) is set at the factory shipment.
%MW10.441 MAC address (M)
%MW10.442 MAC address (L)

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

(33) Free-run counter information %MD10.446 (Read only)


This is a 32-bit counter that counts up from 0 in units of 1 ms when the CPU stops and then starts up. The counting operation
continues while the CPU is running and stopped.
Range: 0 to 4,294,967,295 (ms), Precision: ±1ms
When the maximum value (4,294,967,295) is exceeded, the counter value is reset to 0 and counting operation continues.
In the following conditions, the counter value is reset to 0.
1) When the power supply is turned ON or application is started
2) When the CPU switches from standby CPU to working CPU in a redundant system

Address Name Description


%MD10.446 Free-run counter information This is a 32-bit free-run counter.

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

Address Name Description


%MW10.508 Maximum value (lower word) Sets the maximum value of the error rate of the SX bus transmission
%MW10.509 Maximum value (upper word) detected by self-CPU module.
%MW10.510 Current value (lower word) Sets the current value of the error rate of the SX bus transmission detected
%MW10.511 Current value (upper word) by self-CPU module.

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

1-4-9 Temporary area


(1) Use of temporary area
Temporary area, which is automatically generated by D300win when an application program is compiled, is used for the
following purposes. (SPH300: 8K words, SPH200: 4K words, SPH2000/SPH3000: 32K words).

1) Connecting function (FCT) terminals


As shown in the figure below, the temporary area for the number of terminal data is used for connecting function terminals.
No temporary area is used for connecting function block (FB) terminals and between function (FCT) and function block (FB)
terminals because the instance area are used instead.
(Example)

1-word temporary area is used.

Input variable WORD_TO_INT ADD Output variable

INT#100

2) Description of polynomials in the ST language


The temporary area is used for passing the results of calculations.
An expression Y: = (X1 + X2) * X3 is given as a example. In this expression, the temporary area is used to output the result of
summation as an input to multiplication. The amount of the temporary area to be used depends on the variable data to be used
for a mathematical operation. (Example: INT type = one word, DINT type = two words)

3) Variables in user functions (FCTs)


Every variable used in the user function (those declared in VAR~END_VAR) uses the temporary for the number of the words.
The variable includes multi-element variables such as arrays and structures. Declaring, for example, a 1K-word array for a
variable allows a 1K word-temporary area to be used.

4) Output variables for user functions (FCTs)


The output variable of a function uses the temporary area for the number of words of the output variable. The variable includes
multi-element variables such as arrays and structures. Declaring, for example, a 1K-word array for a variable allows a 1K-word
temporary area to be used.
(Example)
1-word temporary area is used. 1)
User function

Input variable ADD WORD_TO_INT Output variable

MASK 1-word temporary area is used. 4)

1-word temporary area is used. 3)

5) Return values from called user functions (FCTs)


When the output variables for user functions are multi-element types such as arrays and structures, the program, which returns
the user functions, uses a temporary area. The use of a 1K-word array variable allows a 1K-word temporary area to be used

1-61
Section 1 Specifications Temporary area

(2) Restrictions on a temporary size


Up to 4096 words can be used for one POU with SPH300 and SPH200. Up to 16384 words can be used for SPH2000 and
SPH3000 (4096 words for 48R software version V01). Up to 8192 words and 4096 words temporary areas can be used for
each CPU for SPH300 and SPH200, respectively. Up to 32768 words can be used for each task for SPH2000 and SPH3000.
When the amount of the temporary area used by the CPU during operation exceeds the predefined upper limit, an application
execution error (%MX10.38.1 set to “ON”) occurs, resulting in a CPU shutdown due to a fatal fault (%MX10.2.4 set to “ON”).

G Key point:

To save the usage of the temporary area:


• Avoid the use of large-size multi-element variables in the user function (FCT).
• Avoid the user functions (FCTs), from which outputs are large-size multi-element variables.
• When a large-size multi-element variable is required, use a function block (FB) and process it by VAR_IN_OUT.

(3) Using the temporary area


The temporary area is released for the next POU when a POU has been processed. The next POU uses the temporary area
from the top address. If another POU process starts before the current POU process is completed, the temporary area is not
released and the remaining area is used from its top. The temporary area is used in the manner described below.

1) When POUs have been assigned only to default tasks


Suppose that three POUs (pou1, pou2, pou3), which have been assigned to their associated default tasks, use a 3K-word
temporary area. Since pou1, pou2, and pou3 are executed sequentially as shown in the figure below, the maximum amount of
temporary area to be used is 3Kwords or less.

Tact Tact

pou1 pou2 pou3 pou1 pou2 pou3


process process process process process process
Default task Time

Usage of the temporary area 3K 3K 3K 0 3K 3K 3K


words words words word words words words

1-62
Section 1 Specifications Temporary area

2) When POUs have been assigned to different tasks


Suppose that three POUs, which have been assigned to the default task (pou1), fixed cycle task 1 (pou2) and 2 (pou3), use
a 3Kword temporary area. Since the temporary area is not released if pou2 and pou3 processes are interrupted during pou1
process execution, the total amount of temporary area to be used will be increased.
(Example of a SPH300)

pou3
execution
Task 0

pou2 pou2
Interrupt
execution execution
Task 1

pou1 pou1 pou1


Interrupt Interrupt
execution execution
Dafault task Time

Usage of a temporary area 3K


6K 3K 3K 6K 9K
words

Since, at this point, the usage exceeds


the upper limit of the temporary area
(8192 words for one SPH300),
the CPU stops with a fatal fault.

3) When the user function process has a nesting structure


Suppose that three user functions (fct1, fct2, fct3) use a 1K-word temporary area. When fct1 calls fct2 and fct2 calls fct3 (a
nesting structure), the total amount of temporary area used is increased.

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.

<Example of a circuit on the code worksheet>

<Example of declaration on the variable worksheet for D300winV2>

<Example of declaration on the variable worksheet for D300winV3>

G Key point:

Declare every variable within one line.

1-64
Section 1 Specifications Memory assignment

1-5-2 Memory assignment


Variables are assigned to the memory in the CPU when they are declared on the variable worksheet and compiled. You can
assign a variable to a memory specifying a specific address such as the one in the I/O area (AT specification) or without
specifying an address. A variable not assigned to an address by the user is automatically assigned to a real address in the CPU
internal memory by the loader during compilation.

<For D300winV2>

Example of address declaration


In this example, sensors01 and 02 are assigned to
the I/O memory area.
Normally, the user does not need to assign a variable
used as an auxiliary memory to a memory specifying
a real address (no need for AT specification).

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

1-5-3 Local variables and global variables


The MICREX-SX series CPU modules allow the user to split an application program into functional system blocks. For
modularization purposes, a program (POU) requires variables that are to be used only within that specific program. To maintain
the relationship between programs (POUs), variables that are available globally to those POUs are also required.
In the MICREX-SX series, variables that are available to a POU are called “local variables” and those which are available to all
POUs are called “global variables.”

POU A POU B POU C

Local variable Local variable Local variable

Global variable

1-65
Section 1 Specifications Variables

1-5-4 Variable declaration


To declare a variable, code it on a variable worksheet in the predefined format using a variable declaration statement.

(1) Types of variable declaration statements

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.

(2) AT specification variables (position variables)


An AT specification variable is one which is used by the user to allocate a CPU’s memory location to a variable.
The following naming conventions are used to specify an AT specification:

<For D300winV2>

Colon Semicolon

INPUT AT %IX1.0.0 : BOOL ; (*Auto run*)

Comment
Variable
name Data type Refer to “1-6” for data types.

The variable Address Refer to “1-3” for address assignments.


name must
be followed Memory size Prefix
by a space.
Symbol Size Symbol Meaning
X BOOL (1 bit) %I Identifies an external input area.
W Word (16 bits) %Q Identifies an external output area.
D Double word (32 bits) %M Identifies an internal memory area.

<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

(3) Symbolic variables


Symbol variables have no CPU memory addresses assigned by the user. D300win will automatically allocate memory to
symbolic variables. A symbolic variable is declared as follows:

<For D300winV2>

<For D300winV3>

<Example of a symbolic variable declaration>


Colon Semicolon

FLAG1 : BOOL ; (* Comment *)

Variable name Data type Comment

1-67
Section 1 Specifications Variables

(4) Retain variables


Data declared as a retain variable is reset at cold start (at initial start from D300win) and retained at warm start (at start from
D300win or power-on). To declare a retain variable with D300winV2, append a RETAIN statement to the VAR or VAR_GLOBAL
statement declaring the variable. With D300winV3, declare a retain variable by selecting the retain format checkbox. Variables
that are declared as retain variables are automatically allocated to the retain area (retain memory) in the PLC.

<Example of a retain variable declaration; for D300winV2>

f Retain variables

<Example of a retain variable declaration; for D300winV3>

f Retain variables

(5) Initialization variable


A variable that is assigned an initial value when the PLC application program is started (during the first scan) is called an
initialization variable. With the D300winV2, an initialization variable is created by specifying an initial value for a variable using
the “:=” operator. With D300winV3, an initialization variable is created by entering an initial value in the initial-value field. No
initialization variable can be specified in the VAR_EXTERNAL declaration statement (for global variables).

<Example of an initialization variable declaration; for D300winV2>

f Initialization variables

<Example of an initialization variable declaration; for D300winV3>

f Initialization variables

1-68
Section 1 Specifications Variables

G Key point:

• Number of initial values assigned to variables


SPH300 NP1PS-32/32R/74/74R/117/117R/245R: Max. 3200 (fixed value)
SPH2000 NP1PM-48R/48E/256E/256H: Max. 12800 (fixed value) (Software version V01: 3200)
SPH3000 NP1PU-048E/256E: Max. 12800 (fixed value)
SPH200 NP1PH-16: 512 (default value)
SPH200 NP1PH-08: 153 (default value)
For SPH200, the number of variables to which initial values may be assigned depends on the memory space for setting
initial values in the user memory area. For details, see “1-4-7 Initialization area.”
• Conditions for initialization of initialization variables

Cold start Warm start


Standard memory Replaced by initial value. Replaced by initial value.
Initialized standard memory Replaced by initial value. Retains old values.

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

(6) Restrictions on variable names


• Symbols other than underscores “_” cannot be used for a variable name. Note that no “_” can follow the variable name.
• A variable name must not begin with a digit.
• Up to 30 characters can be used for a variable name.
• No space can be used for a variable name.
• The words reserved for the system (such as data type names and instruction names) cannot be used.
See “Appendix 6 List of Reserved Words.”

1-69
Section 1 Specifications Basic data

1-6 Data type


1-6-1 Basic data
For direct data representation, data are represented by the following format: “%” + “Prefix” + “Memory size.”
You can treat them as data shown in the table below.

Data representation %IX, %QX %IW, %QW %ID, %QD


%MX1, %MW1, %MD1,
Data type
%MX3 %MW3 %MD3

Bit signal (ON/OFF)


(“1” or “0”)
(BOOL)

Signed 16-bit bianry (-32768 to 32767)

Signed 32-bit binary ( -2,147,483,648


2,147,483,647 (
to

Unsigned BCD 4-digit (0 to 9999)

Unsigned BCD 8-digit (0 to 99,999,999)

The bit weight of each bit position is as follows.

(Example 1) When used as 32-bit binary data


Representation range: -2,147,483,648 to 2,147,483,647 (h80000000 to hFFFFFFFF)

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

In the figure above, the data “h00ABCDEF” is stored in %MD3.2.

The numeric value that can be represented in 16-bit and 32-bit area is as follows.

(Example 2) When used as 8-digit BCD data


Representation range: 0 to 99,999,999

8-digit BCD

107 106 105 104 103 102 101 100


Bit weight
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 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 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
7 9 9 9 9 9 9 9
In the figure above, the data “79,999,999” is stored in %MD3.2.

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

+32768 Upper limit overflow


+32767 +7FFF
+32766 +7FFE
Upper limit overflow
+9999 +9999
+9998 +9998

+256
+255 +100
+254 + 99
+ 98

+1 0001 00000001 +1 +0001 +00000001


0 0000 00000000 0 0000 00000000
-1 FFFF 7FFFFFFF
-2 FFFE 7FFFFFFE
-3 FFFD 7FFFFFFD
Range of negative number

-32766 8002
-32767 8001
-32768 8000
-32769 Lower limit overflow

-2147483647 80000001
-2147483648 Min. 80000000

1-71
Section 1 Specifications Organization of data types

1-6-2 Organization of data types


The data types supported by MICREX-SX series can be depicted in a tree form as shown in the figure below.
ANY is a data type that can hold a basic data type or any of derived 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

Derived data types


Array data type
Structured data type

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

1-6-3 Basic data types


Basic data types refer to data whose value range and bit count are defined by IEC 61131-3. The MICREX-SX series CPU
modules support the following basic data types:

No. Keyword Data type No. of bits Value range


1 BOOL Boolean 1 0 or 1
2 INT Integer 16 -32,768 to 32,767
3 DINT Double integer 32 -2,147,483,648 to 2,147,483,647
4 UINT Unsigned integer 16 0 to 65,535
5 UDINT Unsigned double integer 32 0 to 4,294,967,295
6 REAL Real 32 -2128 < N <= -2-126, 0, 2-126 <= N < 2128 (single-precision floating point)
7 TIME Duration 32 0ms to 4,294,967,295ms (0ms to 49 days, 17:02:47s295ms)
8 DATE Date 32 January 1st, 1970 to February 7th, 2106
9 TOD Time of day 30 0:00:00 to 23:59:59
10 DT Data and time of day 32 January 1st 0:00:00, 1970 to February 7th 6:28:15, 2106
Variable-length character
11 STRING – –
string
12 WORD Bit string of length 16 16 16#0000 to 16#FFFF (Note 1)
13 DWORD Bit string of length 32 32 16#00000000 to 16#FFFFFFFF (Note 1)

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

 A contact or coil in LD language is an example of BOOL data.

Examples: BOOL#0, BOOL#1, TRUE, FALSE


2) INT (Integer)
An INT occupies 16 memory bits (1 word) and handles integer values from -32768 to 32767.
Examples: -1000, 0, 12345, INT#1234, INT#16#FF0F
3) DINT (double integer)
A DINT occupies 32 memory bits (1 double word) and handles integer values from -2,147,483,648 to 2,147,483,647.
Examples: DINT#12345678, DINT#16#F000F00F
4) UINT (unsigned integer)
A UINT occupies 16 memory bits (1 word) and handles integer values from 0 to 65535.
Examples: UINT#1000, UINT#16#FFFF
5) UDINT (unsigned double integer)
A UDINT occupies 32 memory bits (1 double word) and handles integer values from -0 to 4,294,967,295.
Examples: UDINT#100000, UDINT#16#111FFFF
6) REAL (real <single-precision floating point>)
A REAL occupies 32 memory bits and handles real values of
- 2128 < N <= - 2-126, 0, 2-126 <= N < 2128
(-3.4028235E+38 to -1.1754945E-38, 0, 1.1754945E-38 to 3.4028235E+38).
Notes:
1) The value range of REAL type data with guaranteed accuracy is basically 6 significant digits. However, this may be
lowered to 5 digits or less in some numeric FCTs. For details, refer to the individual instruction descriptions.
Examples: -10.035, 0.0, 0.2345, REAL#10.0
-1.34E-12, 1.0E+6, 1.234E6
-1.34e-12, 1.0e+6, 1.234e6 f May be represented in exponential formats
2) Real values that are smaller than the minimum representable value (±2-126) are handled as zeros (0).

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>

No. Type Example


1 Basic format TIME#14ms time#14s
Without underscores T#14ms T#14s T#14m T#14h
2 Abbreviated format
t#25h15m t#5d14h12m18s3ms
TIME#25h_15m
3 Basic format
time#5d_14h_12m_18s_3ms
With underscores
t#5d _14h_12m_18s_3ms
4 Abbreviated format
t#25h _15m

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

No. Type Example


DATE#1984-06-25
Basic format
date#1984-06-25
1 Data type
D#1984-06-25
Abbreviated format
d#1984-06-25
TIME_OF_DAY#15:36:55
Basic format
time_of_day#15:36:55
2 TOD type
TOD#15:36:55
Abbreviated format
tod#15:36:55
DATE_AND_TIME#1984-06-25-15:36:55
Basic format
date_and_time#1984-06-25-15:36:55
3 DT type
DT#1984-06-25-15:36:55
Abbreviated format
dt#1984-06-25-15:36:55

1-74
Section 1 Specifications Basic data types

11) STRING (variable-length character string)


Character strings are represented in Fuji Electric’s original code which is based on the Shift JIS coding system. Whereas Shift
JIS strings are mixtures of 8- and 16-bit codes, this coding system extends 8-bit code into 16-bit code so that the length of a
single character is fixed at 16 bits. Strings have a variable length and can be as long as 64 characters.
A NULL code (X’0000’) is automatically appended to the end of each string. Consequently, when a character string is declared,
an extra word of memory space is reserved; i.e., [number of characters + 1] words are reserved.
<Example>

No. Example Description


1 ‘‘ String of length 0 (null string)
2 ‘A’ A string that is made up of one character A.
3 ‘ABC’ A string that contains characters A, B, and C.
4 ‘’ A string that contains one blank character.

12) WORD (bit string of length 16)


A WORD has a size equal to 16 BOOLs (16 bits), each of which represents the ON or OFF state or 1 or 0.
13) DWORD (bit string of length 32)
A WORD has a size equal to 32 BOOLs (32 bits), each of which represents the ON or OFF state or 1 or 0.
<Examples of WORD and WORD:>

No. Example Description


Binary WORD#2#1010111110101111
1
representation DWORD#2#11110000111100001010111110001111
Hexadecimal WORD#16#0F0E
2
representation DWORD#16#FFFF000F

<About BCD data>


BCD is not defined as a data type in IEC. BCDs are represented as an encoding option of WORD or DWORD.
The MICREX-SX series CPU modules handle BCD as unsigned data.

Data length Data range


16 bits (WORD) 0 to 9999
32 bits (DWORD) 0 to 99,999,999

1-75
Section 1 Specifications Representation of constants

1-6-4 Representation of constants


Basically, constants can be represented by the following format.

[Data type] # [Decimal number (binary or hexadecimal)]

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.

No. Data type Example of representation of constants Remark


1 BOOL TRUE, FALSE, BOOL#0, BOOL#1 Usually use “TRUE” or “FALSE.”
2 INT INT#1234, INT#16#FF0F, (-1000, 0, 12345) The data type should be attached
to identify it.
3 DINT DINT#12345678, DINT#16#F000F00F
4 UINT UINT#1000, UINT#16#FFFF
5 UDINT UDINT#1000000, UDINT#16#1111FFFF
6 REAL -10.354, 0.0, 0.234, REAL#10.0, -1.34E-12, -1.34e-12
7 TIME Basic format TIME#14ms, time#25s Unit of time:
Without d (day), h (hour), m (minute),
underscores Abbreviated T#14ms, T#14s, T#14m, T#14h, T#14d
s (second), and ms (millisecond)
format T#25h15m, t#5d14h12m18s3ms
TIME#25h_15m Use uppercase or lowercase
Basic format (Overflow of unit of time is allowed.) characters (case-insensitive).
With time#5d_14h_12m_18s_3ms
underscores
Abbreviated T#5d_14h_12m_18s_3ms
format t#25h_15m
8 DATE DATE#1984-06-25
Basic format
date#1984-06-25
Abbreviated D#1984-06-25
format d#1984-06-25
9 TOD TIME_OF_DAY#15:36:15
Basic format
time_of_day#15:36:15
Abbreviated TOD#15:36:15
format tod#15:36:15
10 DT DATE_AND_TIME#1984-06-05-15:36:17
Basic format
date_and_time#1984-06-05-15:36:17
Abbreviated DT#1984-06-05-15:36:17
format dt#1984-06-05-15:36:17
11 STRING ‘‘ (string of length 0), ‘ ’ (string that contains one blank character)
‘A’, ‘ABC’
12 WORD Binary WORD#2#1010111110101111 The symbol “_” has no meaning
representation WORD#2#1010_1111_1010_1111 itself.
Hexadecimal
WORD#16#AFAF
representation
13 DWORD Binary
DWORD#2#11110000111100001010111110001111
representation
Hexadecimal
DWORD#16#F0F0AF8F
representation

1-76
Section 1 Specifications Derived data types

1-6-5 Derived data types


Derived data types are defined by the user or PLC manufacturer. They are defined using “Data Types” in the project tree.
The MICREX-SX series CPU modules support the following derived data types:
• Array data types
1-dimensional array
2-dimensional array (array of array)
• Structured data types
Structure
Array of structures
Structure of arrays, structure of structures

(1) Array data types


An array is made up of two or more elements of the same data type. Arrays may be either 1- or 2-dimensional arrays.
<Example of using a 1-dimensional array data type>
<Sample data type definition>
Data type “array1” is made up of 10 integers that are indexed from 1 to 10.

Note: Signed integers are legitimate values.


Consequently, negative integers such
as “-10” are allowed.

<Example of a variable declaration; for D300winV2>


The data type of variable “file1” is array1.

Note: To specify a 32-bit array of data


type such as DINT or DWORD in the
AT statement, assign even addresses.

<Example of a variable declaration; for D300winV3>

1 INT type data

2 INT type data

3 INT type data

4 INT type data

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

8 INT type data

9 INT type data

10 INT type data

1-77
Section 1 Specifications Derived data types

<Example of using a 2-dimensional array data type>


<Sample data type definition>
Data type “x_data” is made up of 10 integers that are indexed from 1 to 10 and data type “y_data” is made up of 3 instances
of “x_data,” indexed from 1 to 3.

<Example of a variable declaration; for D300winV2>


The data type of variable “file2” is y_data.

<Example of a variable declaration; for D300winV3>

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

(2) Structured data types


A structured data type is made up of two or more similar or different data types. Structured data type is used in situations where
data items of different data types are necessary for a single operation. Structured data type may be contained in an array (array
of structures) or contain arrays (structures of arrays).
<Examples of using structured data types>
<Sample data type definition>
The structured data type “machine” consists of four data types, namely, x_pos (REAL), y_pos (REAL), depth_pos (INT), and
rpm (INT).

<Sample variable declaration; for D300winV2>


The data type of variable “hole_pro” is machine.

<Sample variable declaration; for D300winV3>

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

<Sample variable declaration; for D300winV2>


The data type of variable “num_hole_pro” is array 3.

<Sample variable declaration; for D300winV3>

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

<Sample variable declaration; for D300winV2>


The data type of variable “hole_pro_02” is machine2.

1-80
Section 1 Specifications Derived data types

<Sample variable declaration; for D300winV3>

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

(3) Restrictions on derived data types


• Initialize array/structure data type variables by an application program.
• Neither array data type variables nor structure data type variables can be monitored on the program. Therefore, when
debugging a program that references array data type or structure data type variables, it is necessary to register them in the
watch list and debug the program using the watch list.
• No derived data type can contain a STRING.
• If the value for a variable is out of the range of array elements specified in the data-type definition when array numbers are
specified using variables, data at the highest or lowest array element number are accessed.
• Basically, do not assign a specific address in the CPU memory (AT specification) to a structure data type variable. If assigned
an address to variable, it is uncertain to which memory of the actual address each structure element is assigned.
However, for AT specification variables (using structure data type) in a multi-CPU system, although memory location of each
member is uncertain, it is possible to access the same member memory as long as variables use same structure data type
• Be aware of the size of the elements when declaring the array data type. The maximum size of the elements depends on the
CPU. For details, see “1-9 Performance Specifications.”

1-81
Section 1 Specifications Notes on structures

1-6-6 Notes on structures


(1) Uniqueness of data when structure data is read or written
When 16-bit data type (such as INT and WORD) used in the structure is read or written as structure data, data written by the
other device (for example, other CPU in multi-CPU system) is never read differently.
In other words, the uniqueness of data is guaranteed.
On the other hand, for 32-bit data type (such as DINT, DWORD, and REAL) used in the structure, the uniqueness of data is
not guaranteed. When data written by the other device is read, the data may be differently read depending on the reading
timing.
(2) Operations in which the uniqueness of data is not guaranteed when structure data is read or written
In the following cases, the uniqueness of 32-bit data type data used in the structure is not guaranteed if the entire structure is
collectively read or written.
1) In the case where structure data is read from or written to the memory in another configuration using the remote read /
remote write instruction (R_READ/R_WRITE)
2) In the case where structure data is read from or written to the memory of another CPU by specifying the CPU No. in a
multi-CPU system
3) In the case where structure data is read from or written to the memory of another CPU using the direct read / direct write
instruction (READ_WORD/WRITE_WORD)
4) In the case where structure data is read from or written to a processor link memory such as P/PE-link and FL-net modules.
(3) Measures
1) Read or write structure data by specifying the element unit (variable name. member name)
When structure data is read or written by specifying the element unit (variable name. member name), the uniqueness of
data is guaranteed even for 32-bit data type.
2) Read or write the entire structure collectively only in the same CPU.
When the entire structure is collectively read form or written to the memory in the same CPU, the uniqueness of data is
guaranteed even for 32-bit data type used in the structure.
3) Perform exclusive control of reading and writing by an application
By performing control so that one CPU reads data after confirming the flag showing the other CPU completes the writing,
the uniqueness of data is guaranteed.

<Example of transfer of structure data>


In this example, the data type is defined as follows.
The data is 32-bit data.

In this example, the variable declaration is as follows.

1-82
Section 1 Specifications Notes on structures

The example of a transfer program of this structure is as follows.

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

1-6-7 Notes on floating-point calculation


(1) About “floating point precision lowering”
An error may occur in a floating-point calculation because calculation is executed by limited number of bits.
Floating-point precision lowering occurs due to the following three reasons: 1) Rounding error, 2) Loss of significant digits, 3)
Loss of trailing digits.
1) A “rounding error” occurs when the calculation result is rounded off to six significant digits of the single precision floating-
point.
2) “Loss of significant digits” error occurs when the significant digits of the result are lost if the difference between two close
numbers is calculated.
(Example) 12.3456 - 12.3453 = 0.0003 The number of significant digits is one.
3) A “Loss of trailing digits” occurs when the information on the small number is completely lost from the operation result if
addition or subtraction of two numbers whose absolute values are greatly different is executed.

(2) Loss of trailing digits


• If there is a difference over 6 digits as a absolute value between two numbers for floating-point addition or subtraction, the
digit of the smaller value is lost during calculation and the information on the larger value only remains.
• Two numbers with different exponents cannot be added as they are. The PLC adjusts the exponent to the larger value before
performing a floating-point calculation.
Example of floating-point calculation: Addition between 500,000 and 0.1
When representing by significant 6 digits and exponent in floating-point format
500,000 = 5.00000 × 105 0.1 = 1.00000 × 10-1

For addition and subtraction, adjust


the number of digits of the smaller
number to the larger one.

5.00000 × 105 5.00000 × 105 5.00000 × 105


+ 1.00000 × 10-1 + 0.00000 1 × 105 + 0.000001 × 105
5.00000 × 105

Significant Loss of
digits trailing digits Since the smaller number becomes 0 in the calculation,
the calculation result is the same as larger number.

(3) Measures against loss of trailing digit


A “Loss of trailing digits” occurs when performing a calculation between small and large numbers in floating-point format.
Therefore, perform a calculation of close numbers first. For example ;
* Change the order of calculations.
* Determine the upper and lower limits of data to prevent loss of trailing digits.
In addition, you can handle the error by detecting it using the floating-point calculation instruction as shown in the next page.

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

A: No “Loss of trailing digits” occurs.


B: No effect although “Loss of trailing digits” occurs.
C: “Loss of trailing digits” occurs and has an effect.

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

2) “Loss of trailing digits” detection sample program


The figure below shows an example of an addition instruction to detect “loss of trailing digits.”

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.

1-7-1 Task specifications

Item Specification Representation in loader (D300win)


Default task (cyclic processing) DEFAULT/Default
Task type Fixed cycle task FIXED-CYCLE/Fixed
Event task (only for SPH) EVENT/Event
Number of tasks 1 (default) + 4 (fixed cycle and event tasks)
Task priority 0 > 1 > 2 > 3 > default

1-7-2 Types and operations of tasks


1) Default task
• The default task is executed cyclically in synchronization with the tact. Assign POUs that require no responsiveness and
periodicity in arithmetic operations.
• You can assign two or more POUs to the default task.
Notes:
The user WDT monitors the execution time of the default task and checks the time when the execution is done. When no
default task is used, the CPU performs processing equivalent to the default to execute internal processing such as the user
WDT check.

2) Fixed cycle task


• The fixed cycle task is executed by the defined cycle. (0.5 ms, 1ms to 32 s). Assign POUs and filters that require high
responsiveness to adjust to the speed of the control target and POUs such as integral instructions which need be executed at
predetermined intervals.
• Set the priority of the tasks from level 0 to 3 (0 has the highest priority).
• You can assign two or more POUs to one task.
• The unit of fixed cycle tasks is “ms.” The task execution cycle must be an integral multiple value of the SX bus tact.
Notes:
The tact cycle is an SX bus communication cycle.
The tact cycle can be set to 0.5 ms, 1 ms, ........., and 10 ms. Note that when SPH2000, SPH3000, or SPH200 is used, 0.5ms
cannot be selected. The tact cycle depends on the scale of system configuration (the numbers of I/O points, remote I/O
master modules, communication modules, and CPU modules).
POUs can be executed at a cycle of 0.5 ms only under a condition that the number of points of I/O modules connected to the
SX bus is 256 or less and no remote I/O and communication modules are connected in a single CPU system of SPH300. If
the tact cycle is set to 0.5 ms in an SPH2000, SPH3000, or SPH200 system, a “system running definition error” occurs and
the CPU stops with a fatal fault. (For the tact cycle calculation of SPH300/SPH2000/SPH3000, see “Appendix 2,” and for
SPH200, see “Appendix 3.”)

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

1-7-3 Example of fixed cycle task operation


An example of fixed cycle task operation when SPH is used is explained under the following operating conditions.

<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

Task 1 Interrupt Interrupt

Default
Interrupt Interrupt

TED
TCD

Tact processing
time
Tact cycle

TE0: Task 0 execution time Task level


Task 0 > Task 1 > Default
TC0: Task 0 execution cycle

TE1: Task 1 execution time

TC1: Task 1 execution cycle

TED: Default task execution time

TCD: Default task execution cycle

: Task start request

: Data input processing

: Data output processing

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

1-7-4 Example of event task operation


An example of event task operation is explained under the following operating conditions.

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

Tact An event occurs.

Task 0

Task 1

Default Interrupt Interrupt Interrupt Interrupt

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

: Data output processing

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.

Monitoring the task execution time and cycle


You can check the task execution time and cycle on the resource information screen displayed from the “Control”
dialog box of D300win.
Task execution time: The time until output from the task finishes after input to the task starts .
Task execution cycle: The time until input to the next task starts after input to the task starts .

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

1-7-5 Task interrupt processing


The processing of a task is divided into data input processing, arithmetic operation, and data output processing as illustrated
below. A task operation sequence is considered to terminate when all of these operations are completed.
Tact interrupts can be generated via the SX bus during the arithmetic and data output operations (no tact interrupt can occur
during the data input operation).

Arithmetic
Arithmetic operation
Task start operation start end Task end

Task P23 P7 P66 P157 P34

Data input operation Arithmetic operation Data output operation

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.

Another task is executed


Tact interrupt during this period.

Task P23 P7 P66 P157 P157 P34

Arithmetic operation
Data input operation suspended. Data output operation

1-90
Section 1 Specifications POU

1-8 Program Organization Unit (POU)


1-8-1 Program organization unit (POU)
The program organization units include functions (FCTs), function blocks (FBs), and programs (PGs).
Programs are programmed by the user. Functions and function blocks are supplied by the manufacturer or made by the user.

<Types of program organization units>

Program organization unit (POU) Program (PG)

Function (FCT) System function

User function

Function block (FB) System function block

User function block

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.

<Types of callable POUs>

Program (PG) System function

User function

System function block

User function block

User function block System function

User function
System function block

User function block

User function System function

User function

<Number of variables that can be used in a POU>


SPH300

Program User User function block


VAR 15000 4069 words
VAR_INPUT – 2048 words
4096 words in total
VAR_OUTPUT – – (Note 2)
(Note 1) VAR_IN_OUT – –
VAR_EXTERNAL 15000 – 15000

SPH2000/3000

Program User User function block


VAR 15000 4069 words
VAR_INPUT – 2048 words
16384 words in total
VAR_OUTPUT – – (Note 3)
(Note 1) VAR_IN_OUT – –
VAR_EXTERNAL 15000 – 15000

1-91
Section 1 Specifications POU

SPH200

Program User User function block


VAR 15000 4069 words Number of words occupying
the user FB instance area
VAR_INPUT – 1024 words
Total The default values are shown below.
VAR_OUTPUT – – NP1PH-16: 4096 words
VAR_IN_OUT – – NP1PH-08: 2048 words

VAR_EXTERNAL 15000 – 15000

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

Input-side external VAR_INPUT VAR_OUPUT Output-side external


variables variables variables variables Data used
1) 100 words 100 words 100 words 100 words 400 words

VAR_IN_OUT
variables 2 words 100 words Data used
2) 100 words 100 words 102 words

Same data area is used.

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.

Function name: AAA

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.

TEMP:=IN1; The variables in FCT are initialized


TEMP:=TEMP+IN2; when FCT is called.
A:=AAA(B,C); AAA:=TEMP; The output value is assigned
RET to the FCT name.

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.

<Uses of input/output variables of a function block>

Use Within a function block Outside a function block


Input variable “read access” Available Not available
Input variable “write access” Not available Available
Output variable “read access” Available Available
Input variable “write access” Available Not available

FB name: AAA

PG Instance name: A_1 FB


VAR_INPUT
VAR IN:INT; VAR_INPUT
A_1:AAA; END_VAR IN:INT;
A_2:AAA; VAR_OUTPUT END_VAR
A:INT; OUT:INT; VAR_OUTPUT
B:INT; END_VAR OUT:INT;
C:INT; END_VAR
D:INT;
END_VAR
Instance name: A_2
OUT:=OUT+IN;
VAR_INPUT RET
IN:INT;
END_VAR
A_1(IN:=B);
VAR_OUTPUT
A:=A_1.OUT;
OUT:INT;
END_VAR
A_2(IN:=D);
C:=A_2.OUT;

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

Example of variable setting

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)

The CPU number is specified here.

%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

For user FB instance memory


This area *1K=1024
(M)
is used.
8K words

For system FB instance memory


(M)
16K words

%MW10.0 %MW.10.0
System memory
(M)
512 words
%MW10.511 %MW.10.511

1-96
Section 1 Specifications User FB

(3) Creating a user function block (FB)


A user function block is a type of POU. Therefore, you can create a user FB in the “Logical POUs” as with other POUs.
In this example, a user FB is added below the POU “LADDER”.”

1) Add “Function Block” under POU “Ladder”.

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.

* The icon design is different between FBs and programs .

3) Create the variable “IN_SIGNAL” (IN terminal of FB).


Create a circuit on the program worksheet (shown in red) of the POU “Overtaking_control.” Name the input signals of the FB
“IN_SIGNAL1” and “IN_SIGNAL2,” specify them as input variables “VAR_INPUT.”

4) Select “VAR” for the usage of the variable that is used in the FB.

5) Create the variable “OUT” (OUT terminal of FB).


Name the output signal of the FB “OUT,” specify them it as an output variable “VAR_OUTPUT.”
Then, click the [OK] button.

6) After creating the circuit, compile the project with the [Make] or [Rebuild Project] command.

1-98
Section 1 Specifications User FB

(4) Using user FBs


User FBs can be used by either of the following two methods.
1) FB exists in the current project (exists under “Logical POUs” tree)
2) FB exists in Library project

This is other project file. By registering other project as “Library”,


it is possible to use FB which is contained in other project file.

This FB belongs to current project file.

1-99
Section 1 Specifications SPH300

1-9 Performance Specifications


1-9-1 SPH300
(1) NP1PS-32/32R/74/74R/117/117R

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)

Instruction execution Sequence instruction 20 ns to 520 ns / instruction


speed Applied instruction 40 ns or more / instruction
Program memory capacity 32768 steps 75776 steps 119808 steps
4096 steps (8192 steps for CPU software version V62 or later, Loader version
Program steps in a POU (POU size)
V3.2 or later)
Max. 512 words (8192 points)
I/O memory (I/Q) * In I/O extension mode:
Max. 4096 words (117/117R), Max. 1856 words (74/74R) . (Note 2)
Standard memory (M) 8192 words 32768 words 131072 words
Retain memory (M) 4096 words 16384 words 32768 words
4096 words (Note 3) 16384 words 32768 words
User FB instance memory (M)
4096 words / user FB 4096 words / user FB 4096 words / user FB
Memory
(Note 1) 16384 words 65536 words 65536 words
Timer 512 points 2048 points 2048 points
System FB
instance Additional timer 128 points 512 points 512 points
memory Counter 256 points 1024 points 1024 points
(M)
Edge detection 1024 points 4096 points 4096 points
Others 8192 words 32768 words 32768 words
System memory (M) 512 words
Temporary area 8192 words

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)

Instruction execution Sequence instruction 20 ns to 520 ns / instruction


speed Applied instruction 40 ns or more / instruction
Program memory capacity (Note 2) 250880 steps
Program steps in a POU (POU size) (Note 2) 8192 steps
Max. 512 words (8192 points)
I/O memory (I/Q)
* Max. 4096 words (65535 points) in I/O extension mode. (Note 3)
Standard memory (M) (Note 3) 262144 words
Retain memory (M) (Note 3) 130048 words
66560 words
User FB instance memory (M)
4096 words / user FB
Memory 65536 words
(Note 1)
Timer 2048 points
System FB
instance Additional timer 512 points
memory Counter 1024 points
(M)
Edge detection 4096 points
Others 32768 words
System memory (M) 512 words
Temporary area 8192 words
BOOL, INT, DINT, UINT, UDINT, REAL,TIME, DATE, TOD, DT, STRING, WORD,
Available basic data type (Note 4)
DWORD
One level
Data type nesting
(array of arrays, structure of arrays, array of structures, structure of structures)

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

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 1) 127 levels
No. of user functions 512
Nesting depth of user functions (Note 1) 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 2)
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 3)
Durability (at 25°C):
When NP8P-BT is used: approx. 0.7 years;
When NP8P-BTS is used: approx. 2 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).

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)

Instruction execution Sequence instruction 20 ns to 520 ns / instruction


speed Applied instruction 40 ns or more / instruction
Program memory capacity 75776 steps
Program steps in a POU (POU size) 8192 steps
Max. 512 words (8192 points) x 2
I/O memory (I/Q)
* Max. 1856 words (29696 points) in I/O extension mode. (Note 2)
Standard memory (M) 32768 words x 2
Retain memory (M) 16384 words x 2
16384 words x 2
User FB instance memory (M)
4096 words / user FB
65536 words x 2
Timer 2048 points x 2
System FB
instance Additional timer 512 points x 2
Memory memory Counter 1024 points x 2
(Note 1) (M) Edge detection 4096 points x 2
Others 32768 words x 2
System memory (M) 512 words x 2

Basic/ Basic CPU write-only


2048 words
expansion area
common Expansion CPU write-
standard 2048 words
only area
memory (M)
Basic/expansion CPU
2048 words
write-enabled area
Temporary area 8192 words x 2

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)

Instruction execution Sequence instruction 30 ns or more / instruction


speed Applied instruction 40 ns or more / instruction
Program memory capacity 49152 steps 262144 steps
Program steps in a POU (POU size) 16384 steps 16384 steps
I/O memory (I/Q) 512 words (Max. 8192 points) (Note 1)
Standard memory (M) 65536 words (default) 1703936 words (default)
Retain memory (M) 8192 words (default) 237568 words (default)
8192 words (default) 73728 words (default)
User FB instance memory (M)
163841 words / user FB 163841 words / user FB
16384 words (default) 81920 words (default)
Timer: Timer:
Memory 512 points (8 words / point) 2560 points (8 words / point)
Additional timer: Additional timer:
128 points (8 words / point) 640 points (8 words / point)
System FB instance memory (M)
Counter: Counter:
256 points (4 words / point) 1280 points (4 words / point)
Edge detection: Edge detection:
1024 points (2 words / point) 5120 points (2 words / point)
Others: 8192 words Others: 40960 words
System memory (M) 512 words
Temporary area 32768 words (per each task)
BOOL, INT, DINT, UINT, UDINT, REAL,TIME, DATE, TOD, DT, STRING, WORD,
Available basic data type (Note 2)
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: 32768, 32-bit data type: 16384

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

Default tasks (Cyclic scanning): 1


* Default task has the constant scan function.
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 1) 127 levels
No. of user functions 512
Nesting depth of user functions (Note 1) 127 levels
Global variable 15000
Variable
Local variable 15000/POU
A total of 12800 for standard memory and retain memory.
No. of initial values set for variables (3200 for software version V01)
(Note 2) 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 Max. 8 units per configuration. * Can be mixed with SPH300 series
Self-diagnosis (memory check, ROM sum check),
Diagnostic function
System configuration supervising, Module fault monitoring
Security function Password
Calendar Up to 31 Dec. 2069 23:59:59 ±27sec/month
Backup recovery range: Data memory, calendar IC memory, RAS area
Battery: Primary lithium battery
Battery backup (Note 3)
Durability (at 25°C): 5 years
Switching time: within 5 min. (at 25°C)

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)

Instruction execution Sequence instruction 9 ns or more / instruction


speed Applied instruction 8 ns or more / instruction
Program memory capacity 49152 steps 131072 steps 262144 steps
Program steps in a POU (POU size) 16384 steps
512 words (Max. 8192 points)
I/O memory (I/Q)
* Max. 4096 words (65535 points) in I/O extension mode.
Standard memory (M) 98304 words (default) 786432 words (default) 1703936 words (default)
Retain memory (M) 40960 words (default) 122880 words (default) 237568 words (default)
40960 words (default) 57344 words (default) 73728 words (default)
User FB instance memory (M)
163841 words / user FB 163841 words / user FB 163841 words / user FB
Memory
81920 words (default)
Timer: 2560 points (8 words / point)
System FB instance memory (M) Additional timer: 640 points (8 words / point)
Counter: 1280 points (4 words / point)
Edge detection: 5120 points (2 words / point)
Others: 40960 words
System memory (M) 512 words
Temporary area 32768 words (per each task)
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: 32768, 32-bit data type: 16384
Default tasks (Cyclic scanning): 1
* Default task has the constant scan function.
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

Notes:
1) The available basic data type depends on the instruction.

1-108
Section 1 Specifications SPH3000

No. of user function blocks 512


Nesting of user function blocks (Note 1) 127 levels
No. of user functions 512
Nesting depth of user functions (Note 1) 127 levels
Global variable 15000
Variable
Local variable 15000/POU
A total of 12800 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 2)
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 Max. 8 units per configuration. * Can be mixed with SPH300/SPH2000 series
Self-diagnosis (memory check, ROM sum check),
Diagnostic function
System configuration supervising, Module fault monitoring
Security function Password
Calendar Up to 31 Dec. 2069 23:59:59 ±27sec/month
Backup recovery range: Data memory, calendar IC memory, RAS area
Battery: Primary lithium battery
Battery backup (Note 3)
Durability (at 25°C): 5 years
Switching time: within 5 min. (at 25°C)
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-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)

Instruction execution Sequence instruction 70 ns or more / instruction


speed Applied instruction 140 ns or more / instruction
Program memory capacity 16384 steps 8192 steps
Program steps in a POU (POU size) 4096 steps (Note 1)
I/O memory (I/Q) 512 words (Max. 8192 points)
Standard memory (M) 8192 words (default) 4096 words (default)
Retain memory (M) 4096 words (default) 2048 words (default)
4096 words (default) 2048 words (default)
User FB instance memory (M)
256 words / user FB 256 words / user FB
8192 words (default) 4096 words (default)
Memory Timer: Timer:
(Note 1) 256 points (8 words / point) 128 points (8 words / point)
Additional timer: Additional timer:
64 points (8 words / point) 32 points (8 words / point)
System FB instance memory (M)
Counter: Counter:
128 points (4 words / point) 64 points (4 words / point)
Edge detection: Edge detection:
512 points (2 words / point) 256 points (2 words / point)
Others: 4096 words Others: 2048 words
System memory (M) 512 words
Temporary area 4096 words
BOOL, INT, DINT, UINT, UDINT, REAL,TIME, DATE, TOD, DT, STRING, WORD,
Available basic data type (Note 2)
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
The memory area size limits the number allowed. For example, when the
Max. No. of elements of array data type
standard memory size is 8192 words, up to 8192 words may be allowed.

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

Default tasks (Cyclic scanning): 1


* Default task has the constant scan function.
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) 64 (Max. no. of instances allowed in one task=64)
No. of POUs in a project 1000
No. of user function blocks 256
Nesting of user function blocks (Note 1) 64 levels
No. of user functions 256
Nesting depth of user functions (Note 1) 64 levels
Global variable 15000
Variable
Local variable 15000/POU
A total of 12800 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
Calendar Up to 31 Dec. 2069 23:59:59 ±27sec/month
Backup recovery range: Application programs, system definitions, zip files, data
memory, calendar IC memory, RAS area
Battery backup (Note 1) Battery: Primary lithium battery
Durability (at 25°C): 5 years
Switching time: within 5 min. (at 25°C)
Application programs, system definitions, and zip files can be saved in a flash
User ROM (optional)
ROM.

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

1-10 Operating Flowchart


The operating flowchart given below shows the power-on sequence of the MICREX-SX series SPH system and the subsequent
operation sequence.

Power-on

Copies the RAS obtained in the preceding


Set RAS history
session into RAS history.

Read CPU No. selection SW (Note 1)

Transfers the user program from flash memory to the

Power-on time initialization


Transfer user program
RAM area (with sum checking).

Initialize SX bus SX bus master only.

Check module configuration Checks system definitions against actual modules.

Initialize modules Initializes the individual modules.

PIO registration processing Registers PIO for I/O refreshing.

Initialize user program processing block Normal system control processing

Loader processing Only when processing is requested by the loader

Message processing Only when message processing is requested

Battery voltage check

System RAS, CPU module RAS processing


SM area flag processing
(RAS flags are reflected in SM area.)

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)

I/O data input processing

User program execution Execute 1 instruction


I/O data output processing
I/O data output processing

Stop user WDT

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

1-11 SX Series Processing Time


1-11-1 Concept of processing time in SX series
1) Base time g Tact cycle time
The SX bus tact cycle is the base time of processing time in SX series. Based on this cycle time, various processing is
executed. The minimum time is defined by the hardware system configuration. Programs are executed under the task where
they are assigned, however, the timing for starting the task is determined by tact cycle.
2) Program processing time g Task cycle time
The program processing time changes depending on the program execution time and operation of the task to which the program
is assigned. The tasks can be prioritized. Therefore, the execution of a task that has low priority may be kept waiting. The actual
program processing time is called “task execution time (task cycle time).”

1-11-2 Basic data transmission processing and time


Data transmission on the SX bus consists of collection of input data (Di), distribution of output data (Do), and transmission of a
message, as shown in the figure below. This processing is cyclically performed on the SX bus.
This cycle is called “Tact cycle.” The CPU internal processing (data input g program execution g data output) is performed in
synchronization with the SX bus tact cycle.
1) I/O refresh processing
I/O refresh processing is cyclically performed on the SX bus.
All the processing of collection of input data and distribution of output data are executed within one tact cycle.
2) Message transmission processing
Message transmission processing is executed in the remaining time after collection of input data and distribution of output
data are completed. Only one message is executed in one tact cycle. Therefore, if there are multiple message request, one
message is executed and other message are kept wait.
Program loader, POD, Communication module such as general purpose communication module or Ethernet module are
considered as message issue device.

Internal processing of CPU module

I/O refresh I/O refresh

Program Program
Output Input Output Input Output
operation operation

SX bus

Data Data Data Data Data


Message Message
collection distribution collection distribution collection

Tact cycle
1, 2, ... 10ms

1-113
Section 1 Specifications Processing time

1-11-3 Relation between task processing and I/O processing time


(1) Task execution cycle when the POU execution time of the default task is shorter than the task cycle
In this case, Task execution cycle (program execution cycle) = One tact cycle.

POU 1, POU 2, and POU 3 are


assigned to the default task.
I/O processing Tact cycle

SX bus tact I O I O I O

Default task POU 1 POU 2 POU 3 0 POU 1 POU 2 POU 3 0

Execution time of
default task

Execution cycle of default task

Task cycle time

: Input processing 0 : Output processing : Task start request

SX bus tact sycle : 1 ms (1000 μs)


The display of Expert (D300Win) is as follows:

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.

I/O processing Tact cycle

SX bus tact I O I O I O

Default task POU 1 POU 2 Interrupt POU 0 POU 1 POU 2 POU 3 0


3

In this case, I/O is


refreshed at this timing. Execution time of
I/O is refreshed default task
every two tact cycle.

Execution cycle of default task

Task cycle time

: Input processing 0 : Output processing : Task start request

SX bus tact sycle : 1 ms (1000 μs)


The display of Expert (D300Win) is as follows:

1-115
Section 1 Specifications Constant scan

1-11-4 Constant scan


(1) Constant scan function
The program execution time of the default task (which is program operation executed by the cyclic processing not by an
interruption) fluctuates depending on the applied instruction or whether an FB is executed or not, for example.
When the program execution time is sufficiently longer than the SX bus tact cycle, program execution cycle may fluctuate (“tact
cycle × n” or tact “cycle × n + 1”) because of fluctuation of the program execution time.
The constant scan function can reduce this fluctuation.
Constant scan function executes program & I/O refresh which is assigned to default task in constant time.
(Only I/Os mounted on SX bus are refreshed in constant time.)
During constant scan operation, program execution cycle is performed at the pre-defined constant cycle.
Since program execution cycle is stabled, the positioning control accuracy will be improved.
In addition, you can create a timer program which use program execution cycle as time base.

I O I O I O I O

POU1 POU3
Interrupt Interrupt

Idle time
POU3
POU2

Program execution time

Constant scan time

(2) Execution start timing of constant scan


The constant scan setting is made in the system definition. Therefore, it cannot be changed while the system is operating. To
start execution of constant scan, download the system definition to the PLC, and then reset it or turn OFF the power and then
ON again.

(3) Supported versions


To use the constant scan function, the following versions are required.
SPH2000/SPH3000 Series: All versions
SX-Programmer Expert (D300win): V3.3 or later

1-116
Section 1 Specifications Constant scan

(4) Constant scan accuracy


Constant scan accuracy is influenced by jitter of SX bus tact. (Jitter time is 100μs or less) Jitter time will not be accumulated.

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

(6) Constant scan setting


To use constant scan, set “Constant scanning setting : Yes”, and set “Scanning time” at below data range.
One tact cycle <= “Constant scanning time” <= 2550 ms (for SPH2000, SPH3000)
One tact cycle <= “Constant scanning time” <= 255 ms (for SPB/SPE, board controller)
Set “Constant scanning time” as integer multiple of SX bus tact cycle

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

1-11-5 Execution band ratio setting


In SPH2000 and SPH3000, “Application program processing” and “System processing” are executed by a single CPU.
Therefore, the system operation changes depending on the ratio of “Application program processing” and “System processing”.
Set the ratio of “Application program processing” and “System processing” in one tact cycle.

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

1) Application arithmetic processing


Input

Application program processing

System
Output

System
process-
processing
ing

2)
2)

A tact time is divided into 10 portions.


Ratio of "System processing" and "Application program processing" can be changed.

1) Application program processing


“Input processing” and “Application program processing” are executed.

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

1-11-6 I/O response time


Example of I/O “SX bus I/O”
I/O modules that are connected to a processor module via the SX bus (including SX bus expansion I/O) are called “SX bus I/O”.
SX bus I/O data exchange with application program is executed faster than remote I/O.

<Configuration example> <Program example>

Output module Input Output


Input module
Processor
module

Input Output device

<Minimum I/O response time>

Task cycle time

Program execution Program execution

Reads input.

Input

Output

Input filter delay Output response delay

Minimum I/O response time = Input filter delay + Task cycle time + Output response delay

<Maximum I/O response time>

Task cycle time Task cycle time

Program execution Program execution

Program already started at this timing.


Input is read at this timing.
Therefore, Input is ignored.

Input

Output

Input filter delay Output response delay

Maximum I/O response time = Input filter delay + (Task cycle time) x 2 + Output response delay

<I/O response time calculation example>


Input module OFF to ON response time = 3 ms
Output module OFF to ON response time = 1 ms
Assuming that the task cycle time is 20 ms,
• Minimum I/O response time = 3 ms + 20 ms x 1 + 1ms = 24 ms
• Maximum I/O response time = 3 ms + 20 ms x 1 + 1ms = 44 ms

1-119
Section 1 Specifications Calendar

1-12 Calendar Function


The MICREX-SX series CPU modules incorporate a clock that provides calendar functions. The values of the calendar can be
monitored and set from the D300win. They can also be monitored and set from an application program.
Notes:
Make the time setting for the calendar even if no calendar value will be used in application programs. The SX series will
use the calendar values to record the time when the system is turned off or a system failure occurs.

1-12-1 Calendar’s value range


The calendar can measure calendar values from January 1st, 00:00:00, 1970 through December 31st, 23:59:59, 2069.
Notes:
One second after December 31, 2069 23:59:59, the date and time will turn back to January 1, 1970.

1-12-2 Calendar accuracy


The accuracy of the calendar (clock) in the CPU is 27 seconds per month (at an ambient temperature of 25°C).
Notes:
The accuracy of the calendar clock varies depending on environmental conditions such as ambient temperature. When
the CPU module is to be used in a system where a high calendar accuracy is required, measure the actual calendar accuracy
and review the inspection (clock calibration) period.

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.

2) Click the [Calendar/Watch] button to display the current value.

Current values for


date and time

Click this button.

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

2) RTC (real-time clock) — IEC standard FB


The IEC standard function block RTC cannot be used to set up the calendar clock. If RTC is used to set up the calendar clock, a
relative value is stored in an instance area on which the calendar clock will run.

1-12-5 Time adjustment function


In a multi-CPU system the MICREX-SX series CPU modules provide a function that automatically adjusts the time of their
internal clock (real-time clock).

Power
supply
CPU CPU
0 1

1) Time adjustment management


The No. “0” CPU module adjusts the real-time clock of the other CPU modules. If the CPU 0 goes down, another CPU module is
assigned to adjust the real-time clock of the other CPU modules.

2) Timing of time adjustment


• When the system is powered on. Subsequently, it is adjusted at predetermined intervals (every minute).
• When the real-time clock is updated from the D300win or an application program.

1-121
Section 1 Specifications Calendar

1-12-6 Example of calendar FB


You can download the following FBs from Fuji Electric Co.,Ltd. site.

(1) Calendar data conversion FB “Y_ZFC002”


1) Description
Usage: This FB splits “DATE_AND_TIME” type data of the SX system into UINT type arrays and converts them into “year,”
“month,” “day,” “hour,” “minute,” “second,” and “day of the week” data. Use this FB to display the calender externally.

Description of the terminals


[INPUT]
<Terminal name> <Data type> <Description>
in DATE_AND_TIME Reads calendar data from PLC.

[IN_OUT]
<Terminal name> <Data type> <Description>
DT_ARY dt_ary The following data are output in each element of the array respectively.

[1] Year (Four digits of Christian year: 1970 to 2069)


[2] Month (1 to 12)
[3] Day (1 to 31)
[4] Hour (0 to 23)
[5] Minute (0 to 59)
[6] Second (0 to 59)
[7] Day of the week (0 to 6: Sunday to Saturday)

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

<F.Y.I. Memory to be used>


Program capacity: 174 steps
User FB instance memory: 36 words
System FB instance memory: 0 word

1-122
Section 1 Specifications Calendar

2) Example

1-123
Section 1 Specifications Calendar

(2) Calendar data inverse conversion FB “Y_ZFC003”


1) Description
Usage: This FB converts “year,” “month,” “day,” “hour,” “minute,” “second,” and “day of the week” data set in UINT type array
into “DATE_AND_TIME” type data of the SX system. Use this FB to adjust the system calender externally.

Description of the terminals


[INPUT]
<Terminal name> <Data type> <Description>
in dt_ary Set the following data in each element of the UINT type array [1...7].

[1] Year (Four digits of Christian year: 1970 to 2069)


[2] Month (1 to 12)
[3] Day (1 to 31)
[4] Hour (0 to 23)
[5] Minute (0 to 59)
[6] Second (0 to 59)
[7] Unused

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.

<F.Y.I.> Memory to be used


Program capacity: 120 steps
User FB instance memory: 36 words
System FB instance memory: 0 word

1-124
Section 1 Specifications Calendar

2) Example

1-125
Section 2 Programming Language

2-1 Types of Programming Languages........................................................2-1


2-2 Instruction List.........................................................................................2-3
2-2-1 LD language....................................................................................................2-3
2-2-2 Function blocks...............................................................................................2-3
2-2-3 Function summary......................................................................................... 2-11
2-2-4 ST language..................................................................................................2-33
(1) ST operators.................................................................................................2-33
(2) ST statements...............................................................................................2-33
2-2-5 IL instruction..................................................................................................2-34

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

2-1 Types of Programming Languages


The MICREX-SX series supports five programing languages that are defined in IEC 61131-3.
These programming languages are classified under two text languages and three graphics languages as shown below.

Graphic languages LD language (Ladder Diagram)


FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart)

Text languages IL language (Instruction List)


ST language (Structured Text)

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.

Language Specified on Sheet (Note 1) Available Combination


LD/FBD V2 compatible LD language, FBD language
LD/FBD language LD language, FBD language, ST language (Note 2)
SFC elements LD language, FBD language, SFC elements (Note 3)

Notes:
1) Specify the programming language on the “Insert” dialog box of the POU in D300win.
<“Insert” dialog box>

Specify the language here.

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)

2-2 Instruction List


2-2-1 LD language

Instruction Name No. of steps Page

Normal open contact (NO contact) 1 P2-38

Normal close contact (NC contact) 1 P2-38

Coil 1 P2-38

Inverted coil 1 P2-38

S Set 1 P2-39

R Reset 1 P2-39

“Connector name” Connect to “connector name” 1 P2-39

“Connector name” Connect from “connector 1 P2-39

“Label name” Source of jump 1 P2-40

“Label name” Label of jump destination 0 P2-40

RETURN Return 1 P2-40

2-2-2 Function blocks


1) IEC standard functions

Instruction Name No. of steps Page

SR_1 Instance name

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

R_TRIG Rising edge detection R_TRIG 6 P2-53


BOOL CLK Q BOOL

F_TRIG_1

F_TRIG Falling edge detection F_TRIG 6 P2-53


BOOL CLK Q BOOL

2-3
Section 2 Programming Language List (IEC standard FB)

Instruction Name No. of steps Page

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)

2) Original FBs (function blocks)

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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)

3) User ROM card expansion FBs


(These expansion FBs support SPH2000 and SPH3000 series.)

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)

2-2-3 Function summary


The functions that are supported by the MICREX-SX series are classified into the following categories:

Function IEC standard functions Type conversion functions

Arithmetic functions

Bit string functions

Selection/comparison functions

String functions

Time type data functions

Original functions (unique to the MICREX-SX series)

1) Type conversion functions

Instruction Name No. of steps Page

DINT DINT_TO_INT INT Type conversion DINT_TO _INT 3 P2-182

UINT UINT_TO_INT INT Type conversion UINT_TO _INT 3 P2-182

UDINT UDINT_TO_INT INT Type conversion UDINT_TO _INT 3 P2-183

REAL REAL_TO_INT INT Type conversion REAL_TO _INT 3 P2-183

TIME TIME_TO_INT INT Type conversion TIME_TO _INT 3 P2-184

WORD WORD_TO_INT INT Type conversion WORD_TO _INT 3 P2-184

INT INT_TO_DINT DINT Type conversion INT_TO _DINT 3 P2-185

UINT UINT_TO_DINT DINT Type conversion UINT_TO _DINT 3 P2-185

UDINT UDINT_TO_DINT DINT Type conversion UDINT_TO _DINT 3 P2-186

REAL REAL_TO_DINT DINT Type conversion REAL_TO _DINT 3 P2-186

TIME TIME_TO_DINT DINT Type conversion TIME_TO _DINT 3 P2-187

DWORD DWORD_TO_DINT DINT Type conversion DWORD_TO _DINT 3 P2-187

2-11
Section 2 Programming Language List (type conversion FCT)

Instruction Name No. of steps Page

INT INT_TO_UINT UINT Type conversion INT_TO _UINT 3 P2-188

DINT DINT_TO_UINT UINT Type conversion DINT_TO _UINT 3 P2-188

UDINT UDINT_TO_UINT UINT Type conversion UDINT_TO _UINT 3 P2-189

REAL REAL_TO_UINT UINT Type conversion REAL_TO _UINT 3 P2-189

TIME TIME_TO_UINT UINT Type conversion TIME_TO _UINT 3 P2-190

WORD WORD_TO_UINT UINT Type conversion WORD_TO _UINT 3 P2-190

INT INT_TO_UDINT UDINT Type conversion INT_TO _UDINT 3 P2-191

DINT DINT_TO_UDINT UDINT Type conversion DINT_TO _UDINT 3 P2-191

UINT UINT_TO_UDINT UDINT Type conversion UINT_TO _UDINT 3 P2-192

REAL REAL_TO_UDINT UDINT Type conversion REAL_TO _UDINT 3 P2-192

TIME TIME_TO_UDINT UDINT Type conversion TIME_TO _UDINT 3 P2-193

DWORD DWORD_TO_UDINT UDINT Type conversion DWORD_TO _UDINT 3 P2-193

DT DT_TO_UDINT UDINT Type conversion DT_TO _UDINT 3 P2-194

DATE DATE_TO_UDINT UDINT Type conversion DATE_TO _UDINT 3 P2-194

TOD TOD_TO_UDINT UDINT Type conversion TOD_TO _UDINT 3 P2-195

INT INT_TO_REAL REAL Type conversion INT_TO _REAL 3 P2-195

2-12
Section 2 Programming Language List (type conversion FCT)

Instruction Name No. of steps Page

DINT DINT_TO_REAL REAL Type conversion DINT_TO _REAL 3 P2-196

UINT UINT_TO_REAL REAL Type conversion UINT_TO _REAL 3 P2-196

UDINT UDINT_TO_REAL REAL Type conversion UDINT_TO _REAL 3 P2-197

TIME TIME_TO_REAL REAL Type conversion TIME_TO _REAL 3 P2-197

WORD WORD_TO _BOOL BOOL Type conversion WORD_TO _BOOL 3 P2-198

DWORD DWORD_TO_BOOL BOOL Type conversion DWORD_TO _BOOL 3 P2-198

BOOL BOOL_TO _WORD WORD Type conversion BOOL_TO _WORD 3 P2-199

DWORD DWORD_TO_WORD WORD Type conversion DWORD_TO _WORD 3 P2-199

INT INT_TO_WORD WORD Type conversion INT_TO_WORD 3 P2-200

UNIT UNIT_TO_WORD WORD Type conversion UINT_TO_WORD 3 P2-200

BOOL BOOL_TO _DWORD DWORD Type conversion BOOL_TO _DWORD 3 P2-201

WORD WORD_TO_DWORD DWORD Type conversion WORD_TO _DWORD 3 P2-201

DINT DINT_TO_DWORD DWORD Type conversion DINT_TO _DWORD 3 P2-202

UDINT UDINT_TO_DWORD DWORD Type conversion UDINT_TO _DWORD 3 P2-202

INT INT_TO_TIME TIME Type conversion INT_TO _TIME 3 P2-203

DINT DINT_TO_TIME TIME Type conversion DINT_TO _TIME 3 P2-203

2-13
Section 2 Programming Language List (type conversion FCT)

Instruction Name No. of steps Page

UINT UINT_TO_TIME TIME Type conversion UINT_TO _TIME 3 P2-204

UDINT UDINT_TO_TIME TIME Type conversion UDINT_TO _TIME 3 P2-204

REAL REAL_TO_TIME TIME Type conversion REAL_TO _TIME 3 P2-205

UDINT UDINT_TO_DT DT Type conversion UDINT_TO _DT 3 P2-205

UDINT UDINT_TO _DATE DATE Type conversion UDINT_TO _DATE 3 P2-206

UDINT UDINT_TO_TOD TOD Type conversion UDINT_TO _TOD 3 P2-206

REAL TRUNC_INT INT Truncation TRUNC_INT 3 P2-207

REAL TRUNC_DINT DINT Truncation TRUNC_DINT 3 P2-207

REAL TRUNC_UINT UINT Truncation TRUNC_UINT 3 P2-208

REAL TRUNC_UDINT UDINT Truncation TRUNC_UDINT 3 P2-208

WORD W_BCD_TO _INT INT BCD conversion W_BCD_TO _INT 3 P2-209

DWORD D_BCD_TO _INT INT BCD conversion D_BCD_TO _INT 3 P2-209

WORD W_BCD_TO _DINT DINT BCD conversion W_BCD_TO _DINT 3 P2-210

DWORD D_BCD_TO _DINT DINT BCD conversion D_BCD_TO _DINT 3 P2-210

INT INT_TO _W_BCD WORD BCD conversion INT_TO _W_BCD 3 P2-211

DINT DINT_TO _W_BCD WORD BCD conversion DINT_TO _W_BCD 3 P2-211

2-14
Section 2 Programming Language List (type conversion FCT)

Instruction Name No. of steps Page

INT INT_TO_DWORD DWORD BCD conversion INT_TO _D_BCD 3 P2-212

DINT DINT_TO_DWORD DWORD BCD conversion DINT_TO _D_BCD 3 P2-212

2-15
Section 2 Programming Language List (arithmetic FCT)

2) Arithmetic functions

Instruction Name No. of steps Page

INT ABS_INT INT Absolute value ABS _INT 3 P2-154

DINT ABS_DINT DINT Absolute value ABS _DINT 3 P2-154

REAL ABS_REAL REAL Absolute value ABS _REAL 3 P2-155

REAL SQRT REAL Square root SQRT 3 P2-155

REAL LN REAL Natural logarithm LN 3 P2-156

REAL LOG REAL Common logarithm LOG 3 P2-155

REAL EXP REAL Exponent EXP 3 P2-157

REAL SIN REAL Sine SIN 3 P2-157

REAL COS REAL Cosine COS 3 P2-158

REAL TAN REAL Tangent TAN 3 P2-158

REAL ASIN REAL Arc sine ASIN 3 P2-159

REAL ACOS REAL Arc cosine ACOS 3 P2-159

REAL ATAN REAL Arc tangent ATAN 3 P2-160

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)

Instruction Name No. of steps Page

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

ANY MOVE ANY Move MOVE 4 P2-163

ANY_NUM NEG ANY_NUM Negation NEG 3 P2-164

2-17
Section 2 Programming Language List (bit string FCT)

3) Bit string functions

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

XOR
ANY_BIT ANY_BIT
ANY_BIT No. of input
• Exclusive XOR P2-170
operands + 1


ANY_BIT

ANY_BIT NOT ANY_BIT Logical negation NOT 3 P2-170

BOOL NOT_BOOL BOOL Negation NOT_BOOL 3 P2-171

WORD NOT_WORD WORD Negation NOT_WORD 3 P2-171

DWORD NOT_DWORD DWORD Negation NOT_DWORD 3 P2-172

2-19
Section 2 Programming Language List (selection/comparison FCT)

4) Selection/comparison functions

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

STRING LEN INT Get length LEN 3 P2-213

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)

Instruction Name No. of steps Page

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)

6) Time type data functions

Instruction Name No. of steps Page

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)

Instruction Name No. of steps Page

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

DT DT_TO_TOD TOD Convert DT to TOD DT_TO_TOD 5 P2-226

DT DT_TO_DATE DATE Convert DT to DATE DT_TO_DATE 6 P2-226

2-27
Section 2 Programming Language List (original FCT)

7) Original FCTs (Functions)

Instruction Name No. of steps Page

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

UINT DECODE_WORD WORD Decode DECODE_WORD 3 P2-139

UINT DECODE_DWORD DWORD Decode DECODE_DWORD 4 P2-139

WORD ENCODE_WORD UINT Encode ENCODE_WORD 3 P2-139

DWORD ENCODE_DWORD UINT Encode ENCODE_DWORD 4 P2-140

WORD BITCOUNT_WORD UINT Bit count BITCOUNT_WORD 3 P2-140

DWORD BITCOUNT_DWORD UINT Bit count BITCOUNT_DWORD 3 P2-140

STRING STR_TO_UINT UINT Convert string to number STR_TO_UINT 3 P2-141

UINT UINT_TO_STR STRING Convert number to string UINT_TO_STR 3 P2-141

2-28
Section 2 Programming Language List (original FCT)

Instruction Name No. of steps Page

ARRAY OF WORD SJ_TO_STR STRING Convert shift-JIS to string SJ_TO_STR 10 P2-142

STRING STR_TO_SJ ARRAY OF WORD Convert string to shift-JIS STR_TO_SJ 10 P2-142

STRING BYTE_LEN INT Byte length BYTE_LEN 3 P2-143

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)

Instruction Name No. of steps Page

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

MULL Lower-order digit in 64-bit multiplication


DINT IN1 DINT 5 P2-150
MULL
DINT IN2

MULU Upper-order digit in 64-bit multiplication


DINT IN1 DINT 5 P2-150
MULU
DINT IN2

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

SLCO Carry after 32 bits shift left SLCO 4 P2-152


DWORD BOOL

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)

8) Double-precision floating-point calculation FCTs


These expansion FBs support SPH2000 and SPH3000 series.

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)

Turns ON the output when the first and second parameters of


Comparison EQ_DOUBLE DOUBLE type data (double- precision floating-point data) are 5 P2-245
equally (=).
Turns ON the output when the first and second parameters of
Comparison NE_DOUBLE DOUBLE type data (double- precision floating-point data) are not 5 P2-245
equally (≠).
Turns ON the output when the first and second parameters of
Comparison GT_DOUBLE DOUBLE type data (double- precision floating-point data) are 5 P2-246
greater than (>).
Turns ON the output when the first and second parameters of
Comparison GE_DOUBLE DOUBLE type data (double- precision floating-point data) are 5 P2-246
greater or equally (>=).
Turns ON the output when the first and second parameters of
Comparison LT_DOUBLE DOUBLE type data (double- precision floating-point data) are lesser 5 P2-247
than (<).
Turns ON the output when the first and second parameters of
Comparison LE_DOUBLE DOUBLE type data (double- precision floating-point data) are lesser 5 P2-247
or equally (<=).

2-32
Section 2 Programming Language List (ST language)

2-2-4 ST language
(1) ST operators

No. Operation Operator Data type Description Sample value Precedence


1 Parentheses (expression) (2+3)*(4+5) 45 Highest

Function name LN(A)


2 Function
(parameter) MAX(X, Y)
3 Exponentiation ** REAL (base, exponent) 3.0**4.0 8.1E+1
4 Sign inversion - INT, DINT, REAL -Voo1 (Voo1=10) -10
Logical NOT of
5 Logical not NOT BOOL, WORD, DWORD FALSE
each list
6 Multiplication * INT, DINT, UINT, UDINT, REAL 10*3 30
7 Division / INT, DINT, UINT, UDINT, REAL 6/2 3
8 Division remainder MOD INT, DINT, UINT, UDINT 17 MOD 10 7
9 Addition + INT, DINT, UINT, UDINT, REAL 2+3 5
10 Subtraction - INT, DINT, UINT, UDINT, REAL 4-2 2
Elementary
11 Comparison <, >, <=, >= 4>12 FALSE
(excluding STRING type)
Elementary
12 Equality = T#26h =T#1d2h TRUE
(excluding STRING type)
Elementary
13 Inequality <> 8<>16 TRUE
(excluding STRING type)
14 Logical product &, AND BOOL, WORD, DWORD TRUE & FALSE FALSE
15 Exclusive or XOR BOOL, WORD, DWORD TRUE XOR FALSE TRUE
16 Logical add OR BOOL, WORD, DWORD TRUE OR FALSE TRUE Lowest

(2) ST statements

Format Description Page


Assignment statement.
:= Assigns the value of the expression, variable, or numeric value on the right-hand side to the variable P2-251
on the left-hand side.
Condition statement.
IF P2-252
Executes the executable statement if the conditional expression is true.
Condition statement.
CASE
Selects the executable statement to be executed according to the value of the conditional expression. P2-253
Iteration statement.
FOR Repeatedly executes the executable statement according to the initial value, final value, and P2-254
incremental or decremental value.
Iteration statement.
WHILE P2-255
Repeatedly executes the executable statement while the loop condition is true.
Iteration statement.
REPEAT P2-255
Repeatedly executes the executable statement until the loop condition is true.
Return statement.
RETURN P2-256
Returns control from the called function or function block to the calling POU.
Exit statement.
EXIT P2-256
Used to exit an iteration loop.

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.

Instruction Name Data type Description No. of


Page
steps
LD Load ANY Loads the operand value and sets it to the operation result. 1 P2-261
Loads the inverted value of the operand and sets it to the operation
LDN Load not ANY_BIT 1 P2-261
result.
ST Store ANY Stores the current operation result in the operand. 1 P2-262
Stores the inverted value of the current operation result in the
STN Store not ANY_BIT 1 P2-262
operand.
S Set BOOL Sets the operand to 1 if the current operation result is 1. 1 P2-263
R Reset BOOL Resets the operand to 0 if the current operation result is 1. 1 P2-263
Operates the logical product of the current operation result and the
AND 1 P2-264
operand value, and sets the result to the operation result.
Logical
ANY_BIT Operates the logical product of the current operation result and the
product
AND( operation result specified in parentheses, and sets the result to the 1 P2-264
operation result.
Operates the logical product of the current operation result and
ANDN the inverted value of the operand value, and sets the result to the 1 P2-265
Logical operation result.
inverted ANY_BIT
product Operates the logical product of the current operation result and the
ANDN( inverted value of the operation value specified in parentheses, and 1 P2-265
sets the result to the operation result.
Operates the logical add of the current operation result and the
OR 1 P2-266
operand value, and sets the result to the operation result.
Logical add ANY_BIT Operates the logical add of the current operation result and the
OR( operation result specified in parentheses, and sets the result to the 1 P2-266
operation result.
Operates the logical add of the current operation result and the
ORN inverted value of the operand value, and sets the result to the 1 P2-267
Logical operation result.
ANY_BIT
inverted add Operates the logical add of the current operation result and the
ORN( inverted value of the operation result specified in parentheses, and 1 P2-267
sets the result to the operation result.
Operates the exclusive OR of the current operation result and the
XOR 1 P2-268
operand value, and sets the result to the operation result.
Exclusive
ANY_BIT Operates the exclusive OR of the current operation result and the
OR
XOR( operation result specified in parentheses, and sets the result to the 1 P2-268
operation result.
Operates the exclusive NOR of the current operation result and the
XORN inverted value of operand value, and sets the result to the operation 1 P2-269
Exclusive result.
ANY_BIT
NOR Operates the exclusive NOR of the current operation result and the
XORN( inverted value of the operation result specified in parentheses, and 1 P2-269
sets the result to the operation result.

2-34
Section 2 Programming Language List (IL language)

Instruction Name Data type Description No. of


Page
steps
Operates the addition of the current operation result and the
ADD 1 P2-270
operand value, and sets the result to the operation result.
Addition ANY_NUM Operates the addition of the current operation result and the
ADD( operation result specified in parentheses, and sets the result to the 1 P2-270
operation result.
Operates the subtraction of the operand value from the current
SUB 1 P2-271
operation result, and sets the result to the operation result.
Subtraction ANY_NUM Operates the subtraction of the operation result specified in
SUB( parentheses from the current operation result, and sets the result 1 P2-271
to the operation result.
Operates the multiplication of the current operation result and the
MUL 1 P2-272
operand value, and sets the result to the operation result.
Multiplication ANY_NUM Operates the multiplication of the current operation result and the
MUL( operation result specified in parentheses, and sets the result to the 1 P2-272
operation result.
Operates the division of the current operation result by the operand
DIV 1 P2-273
value, and sets the result to the operation result.
Division ANY_NUM Operates the division of the current operation result by the
DIV( operation result specified in parentheses, and sets the result to the 1 P2-273
operation result.
Operates the comparison of the current operation result as the left-
GT elementary hand side of the “>” operator with the operand value as the right- 1 P2-274
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(>)
hand side of the “>” operator with the operation result specified
GT( (Note) 1 P2-274
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
GE elementary hand side of the “>= “ operator with the operand value as the right- 1 P2-275
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(>=)
hand side of the “>= “operator with the operation result specified
GE( (Note) 1 P2-275
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
EQ elementary hand side of the “=” operator with the operand value as the right- 1 P2-276
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(=)
hand side of the “=” operator with the operation result specified
EQ( (Note) 1 P2-276
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
NE elementary hand side of the “≠” operator with the operand value as the right- 1 P2-277
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(≠)
hand side of the “≠” operator with the operation result specified
NE( (Note) 1 P2-277
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.

Notes:
BOOL type cannot be used for GT, GT(, GE or GE(, either.

2-35
Section 2 Programming Language List (IL language)

Instruction Name Data type Description No. of


Page
steps
Operates the comparison of the current operation result as the left-
LE hand side of the “<=” operator with the operand value as the right- 1 P2-278
elementary hand side, and sets the result (BOOL value) to the operation result.
Comparison
(excluding Operates the comparison of the current operation result as the left-
(<=)
STRING) hand side of the “<=” operator with the operation result specified
LE( 1 P2-278
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
LT hand side of the “<” operator with the operand value as the right- 1 P2-279
elementary hand side, and sets the result (BOOL value) to the operation result.
Comparison
(excluding Operates the comparison of the current operation result as the left-
(<)
STRING) hand side of the “<” operator with the operation result specified
LT( 1 P2-279
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Unconditional Jumps to the step specified by the label of the operand.
JMP – 1 P2-280
jump
TRUE Jumps to the step specified by the label of the operand when the
JMPC conditional – current operation result is TRUE (nonzero). 1 P2-280
jump
FALSE Jumps to the step specified by the label of the operand when the
JMPCN conditional – current operation result is FALSE (zero). 1 P2-281
jump
Label of the Indicates the destination address.
Label_name destination – 0 P2-40
address
Unconditional Calls the function block specified in the operand.
CAL – 1 P2-281
call
TRUE Calls the function block specified in the operand if the current
CALC conditional – operation result is TRUE (nonzero). 1 P2-282
call
FALSE Calls the function block specified in the operand if the current
CALCN conditional – operation result is FALSE (zero). 1 P2-282
call
Unconditional Returns to the calling program.
RET – 1 P2-283
return
TRUE Returns to the calling program if the current operation result is
RETC conditional – TRUE (nonzero). 1 P2-283
return
FALSE Returns to the calling program if the current operation result is
RETCN conditional – FALSE (zero). 1 P2-284
return
Closing Performs the deferred operation.
) – 1 –
parenthesis

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>

Circuit number Comment


Specifies the order in which Comments may appear in any location
the circuit is to be processed. 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-3-2 LD language

Instruction Name No. of steps Page

Normal open contact (NO contact) 1 P2-38

Normal close contact (NC contact) 1 P2-38

Coil 1 P2-38

Inverted coil 1 P2-38

S Set 1 P2-39

R Reset 1 P2-39

“Connector name” Connect to “connector name” 1 P2-39

“Connector name” Connect from “connector 1 P2-39

“Label name” Source of jump 1 P2-40

“Label name” Label of jump destination 0 P2-40

RETURN Return 1 P2-40

2-37
Section 2 Programming Language LD language

2-3-3 LD language instructions


(1) Normal open contact (NO contact), normal close contact (NC contact), and coil

Name, Symbol, Function Example


<Programming example>
Name

NO contact, NC contact, coil Variable representation example

Variable name Variable name


Symbol

SW1 SW2 SW3 LAMP


NO contact NC contact coil

SW4
(1) These symbols denote NO contacts, NC
Function

contacts, and coils, respectively. Their


address may be designated by variables or
direct addressing representations.
(2) There is no restriction on the number of
* There is no restriction on the number of contacts in both row and
contacts that can be assigned to the same
column directions.
address.
(3) Available data type is BOOL type.

(2) Inverted coil

Name, Symbol, Function Example


<Programming example>
Name

Inverted coil
SW1 SW2 SW3 SW4 SW5 FLAG
Symbol

Equivalent

SW1 FLAG
(1) The inverted coil generates the inverted
Function

value of a boolean object.


SW2

SW3

SW4

SW5

The upper and lower circuits are equivalent.

2-38
Section 2 Programming Language LD language

(3) Set coil, reset coil

Name, Symbol, Function Example


<Programming example>
Name

Set coil, reset coil  Reset-prioritized circuit


Timing chart
Symbol

SW1
SW1 LAMP1
S R S
SW2
SW2 LAMP1
R
LAMP1

(1) The set coil turns on when its set input


Function

goes on and remains on when the set


input goes off. The set coil turns off when  Set-prioritized circuit
its reset input goes on. Timing chart
(2) A pair of set and reset coils are referenced SW3
by the same variable. SW3 LAMP2
R
SW4
SW4 LAMP2
S
LAMP2

(4) Connector

Name, Symbol, Function Example


<Programming example>
Name

Connector • The sample circuit shown below assumes that the source is connected
to the destination.
Symbol

Output connector Input connector


“connector “connector ABC
name” name”
Connect to Connect from
“connector name” “connector name”

(1) Connectors substitute lines. The output


Function

and input connectors must be given the ABC


same name.
(2) There can be one output connector and two
or more input connectors with the same
name. • Example of using one output connector and two input connectors
(3) A connector name must be not longer than having the same name.
30 characters.

Note: Connectors must be described so that XYZ


they are completed on a single work
sheet.
XYZ

XYZ

2-39
Section 2 Programming Language LD language

(5) Jump

Name, Symbol, Function Example


<Programming example>
Name

Jump
001
Symbol

Jump destination label


(jump sourace)

Jump destination label : 010


(jump destination) Condition 1
Processing 1

(1) The jump instruction transfers control from


Function

the jump source to the jump destination.


011
(2) The label name of the jump destination can
be up to 30 characters.

Processing 1:  Jump destination label

012

Note: The source and destination circuits must be described separately.

<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

Name, Symbol, Function Example


Name

Return
Programming processing
Symbol

RETURN

(1) The return instruction returns control from


Function

a user function or user function block to the


calling POU.
RETURN

2-40
Section 2 Programming Language FBD language

2-4 FBD Language


2-4-1 Structure of FBD language
The FBD language allows block diagrams to be used to represent programs. FBD language clearly show the relationship
between arithmetic instructions and input/output and visually show the flow of operation.
For example, the operation “output = (data1 + data2) x data3” can be represented as shown below in FBD language.

<Sample FBD language representation>

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

2-4-2 Function block summary


Function blocks are supported by the IL, ST, LD, and FBD languages. The operation of a function block remains the same for
these languages.

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.

(1) Symbols used in the function block summary


(Note 1)

Instruction Name No. of steps Page

Instance name (Note 2)


Rising edge input
FB name
Input data type CTU_1 Output data type
Up counter CTU 12 P2-54
CTU
BOOL CU Q BOOL
BOOL RESET
INT PV CV INT

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) Describing a function block in the IL language


When describing a function block call in the IL language, it is necessary to specify input/output parameters and a call
instruction (“CAL,” “CALC,” or “CALCN”) as shown below.

<Sample program for calling an up counter FB (CTU_1)>

LD INPUT1 (* Count input *)


ST CTU_1.CU
LD INPUT2 (* Reset input *)
Passes input parameters.
ST CTU_1.RESET
LD SETDATA (* Set value *)
ST CTU_1.PV
CAL CTU_1 (* Read CTU_1 unconditionally *) Calls the function block.
LD CTU_1.Q
ST OUTFLAG (* Up bit *)
Passes output parameters.
LD CTU_1.CV
ST CURRENT (* Current value *)

(3) Describing a function block in the ST language


Specify a function block call in the ST language as shown below.

<Sample program for calling an up counter FB (CTU_1)>

CTU_1(CU: =INPUT1, RESET: =INPUT2, PT: =SETDATA);


OUTFLAG: =CTU_1.Q;
Passes output parameters.
CURRENT: =CTU_1.CV

2-43
Section 2 Programming Language IEC standard FB

(4) Function block summary


The function blocks that are supported by the MICREX-SX series are classified into the following categories.
FBs with at an upper right corner in the name column are not supported by the SPH200s.

Function block IEC standard function blocks

SX original function blocks


(unique to the MICREX-SX series)

Expansion function blocks


(unique to the MICREX-SX series)

1) IEC standard function blocks

Instruction Name No. of steps Page

SR_1 Instance name

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

R_TRIG Rising edge detection R_TRIG 6 P2-53


BOOL CLK Q BOOL

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

Instruction Name No. of steps Page

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

2) Original FBs (Function blocks)

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

3) User ROM Card expansion FBs


The SPH2000/SPH3000 series have expansion FBs for user ROM cards, for reading and writing data between the user ROM
card (CF card / SD card) installed in the CPU module and CPU module-internal application programs.
* The user ROM card expansion FBs are stored on the SX-Programmer Expert (D300win) product CD.

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

2-4-3 Standard FBs (Function Blocks)


(1) Set reset flip-flop SR

Name, Symbol, Function Example


<Programming example>
Name

SR
SR
INPUT1 SET1 Q1 LAMP
Symbol

INPUT2 RESET
SR
BOOL SET1 Q1 BOOL

BOOL RESET <Operation>

Set preference

(1) SR implements a set reset flip-flop. INPUT1


Function

When SET1 and RESET inputs are INPUT2


supplied at the same time, “SET”
LAMP
(Set Input) takes precedence over RESET.

SET1 RESET Q
1 * 1
0 1 0
0 0 Previous output

(2) Reset set flip-flop RS

Name, Symbol, Function Example


<Programming example>
Name

RS
RS
INPUT1 SET Q1 LAMP
Symbol

INPUT2 RESET1
RS
BOOL SET Q1 BOOL

BOOL RESET1 <Operation>

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

(3) Rising edge trigger R_TRIG

Name, Symbol, Function Example


<Programming example>
Name

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.

(4) Falling edge trigger F_TRIG

Name, Symbol, Function Example


<Programming example>
Name

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

input and sets and holds the output at (“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.

2-53
Section 2 Programming Language Standard FB

(5) Up counter CTU

Name, Symbol, Function Example


<Programming example>
Name

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

Current value LAMP

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.

(6) Down counter CTD

Name, Symbol, Function Example


<Programming example>
Name

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

(7) Up down counter CTUD

Name, Symbol, Function Example


<Programming example>
Name

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

by 1 on the rising edge of the count input


INPUT1
“CU” and decrements it by 1 on the rising 1 2 3 4 5
edge of the counter input “CD.”
(2) When the current value “CV” exceeds the INPUT2 1 2 3 4 5
preset value “PV,” a count-up output “QU”
is set to “1.” When the “CV” value is 0, the
count-down output “QD” is set to “1.” INT#5 5
(Preset Value)
Reset input
Initialization input 0
CURRENT
Count up input
Count down input
Current value LAMP1
Up output LAMP2
Down output
Notes:
1) The current value for a count input has a retain attribute assigned.
(3) The preset value can take on a value from
This means that at start-up (warm start), counting continues from the retained
0 to 32767. old value. At initial start-up (cold start) or download, it is reset to 0.
(4) Count-up continues up to the maximum 2) The priority of processing is shown below.
value (32767) and countdown continues
down to the minimum value (-32768). RESET > LOAD > CU > CD
This value range will not be exceeded.
(5) It is necessary to reset the current value to 3) An “QU” value is the result of a comparison between “PV” and “CV” values.
0 by supplying a RESET input, and the When “RESET” = 0, the counted-up “QU” value is reset to OFF if a “PV”
value is modified (increased).
“PV” value by supplying an initialization
input “LOAD.”

2-55
Section 2 Programming Language Standard FB

(8) Pulse TP

Name, Symbol, Function Example


<Programming example>
Name

TP
TP
INPUT1 IN Q LAMP
Symbol

TIME#10s PT ET CURRENT
TP
BOOL IN Q BOOL

TIME PT ET TIME <Operation>

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.

(9) On-delay timer TON

Name, Symbol, Function Example


<Programming example>
Name

TON
TON
INPUT1 IN Q LAMP
Symbol

TIME#10s PT ET CURRENT
TON
BOOL IN Q BOOL

TIME PT ET TIME <Operation>

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

Input “IN” Notes:


Output “Q” 1) Precision of timer instructions
When a timer instruction is executed, a +0 to +2 scan time error occurs to
Preset time
update
the elapsed time.
(3) The time base is 1ms.
2) The timer compares between “PT” and “ET” values and outputs the result into
(4) The preset time is as below. “Q” whenever “IN” is set to “1.” When the “PT” value is modified (increased)
0 to 4294967295ms after time-up, “Q” is set to “1.” The timer continues its operation from the
(5) If the preset time is set to 0, the “Q” turns current value.
on immediately when the “IN” turns on.

2-56
Section 2 Programming Language Standard FB

(10) Off-delay timer TOF

Name, Symbol, Function Example


<Programming example>
Name

TOF
TOF
INPUT IN Q LAMP
Symbol

TIME#10s PT ET CURRENT
TOF
BOOL IN Q BOOL

TIME PT ET TIME <Operation>

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.

(11) Real-time clock RTC

Name, Symbol, Function Example


<Programming example>
Name

RTC
RTC
INPUT1 EN Q LAMP
Symbol

DT#1997-06-25 PDT CDT CURRENT


RTC
-10:10:00
BOOL EN Q BOOL

DT PDT CDT DT <Operation>

INPUT1
(1) Fetches the preset value “PDT” at the rising
Function

edge on an “EN.” The current date and PDT 1997-06-25-10:10:00


time relative to the current value “PDT” is
output into the current value “CDT.” CDT
The same value is output to the “Q” as that
of an input signal. Calendar value counted from Calendar value established
(2) This FB does not set the real-time clock of 1997-06-25-10:10:00 when INPUT1 is set to “0”
the system.
Note: The current value from this FB runs in conjunction with the system's
real-time clock. When the system's real-time clock is advanced by 1
minute, for example, the current value of this FB also advances one
minute.

2-57
Section 2 Programming Language Original FB

2-4-4 Original FBs (Function Blocks)


(1) Ring counter RCT

Name, Symbol, Function Example


<Programming example>
Name

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

(2) Integrating timer TMR

Name, Symbol, Function Example


<Programming example>
Name

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

(3) Retriggerable timer MR

Name, Symbol, Function Example


<Programming example>
Name

MR
MR
INPUT1 IN Q LAMP
Symbol

TIME#10s PT ET CURRENT
MR
BOOL IN Q BOOL
TIME PT ET TIME <Operation>

INPUT1

(1) The timer starts operation at a rising edge


Function

TIME#10s Preset value


at an “IN” and an “Q” remains set to “1”
until the timer reaches the preset time.
(2) Counting restarts when the input signal is
turned on again (rising edge) during CURRENT
5 seconds 10 seconds
counting.
(3) The current value “PT,” when reaching the
preset “PT” value, becomes undefined. LAMP
(0 or preset value retained)
(4) The time base is 1ms. Note: When a preset value “PT” is modified, the result of comparison between the
(5) The preset time is as below. modified “PT” and “ET” values is output into an output “Q.”
0 to 4294967295ms When the “PT” value is smaller than the “ET” value, “Q” is set to 0.
With “IN” set to 1, “ET” is the same value as that for “PT,” and with “IN” set
to 0, it is 0.

2-60
Section 2 Programming Language Original FB

(4) Open channel M_OPEN

Name, Symbol, Function Example


Normally, M_OPEN is used in combination with M_SEND and
Name

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

the destination module with which messages the configuration


are transferred. The settings established by MODE: Communications mode (set in the communication module).
this function block are used in M_SEND For settings, refer to the manual for the communication module.
(Send Message) and M_RECEIVE SUB_MODE: Communications sub-mode (set in the communication
(Receive Message) function blocks which are module). For settings, refer to the manual for the
communication module.
described later. No check is made to verify the
RPORT_NO: Port number of the destination module to communicate (*2).
establishment of connection with the SPORT_NO: The number of the receiving port to be defined on the
destination module. This function block can SX bus for in-configuration communication (*1) and also
establish up to 56 connections. the number of the receiving port to be defined on the
(1) Setting to on the “EN_C” starts open network for out-of-configuration communication (*2).
processing. (A single open process cannot Output
end during one scan.) VALID: Open processing enabled (a 1 indicates the enabled state.)
(2) When open processing is completed, the ERROR: Error reception output (Set and held at 1 during one scan
output “VALID” is turned on and a period when an error occurs.)
connection number is output in the output STATUS: Error status
“CON_NO.” In this state, the M_SEND and CON_NO: Connection number (serial number for a completed open
M_RECEIVE function blocks are available. process).
(3) If open processing terminates abnormally, *1: The user can specify a port number from 1 to 127 on the SX bus with this FB.
the output “ERROR” stays on during one *2: An offset is added to the specified destination port number and network
scan period and an error code is output in port number if the type of the communication module through which
the output “STATUS.” messages are to be transferred in the out-of-configuration
(4) Channel close processing is carried out communications mode is an Ethernet interface module. See your
when the “EN_C” is set to off (close Ethernet interface manual for details.
processing does not end within one scan <Status (STATUS) summary>
period). The status codes related to the M_OPEN FB are described below.
(5) When close processing ends, the output Refer to page 2-187 for the common status codes for FBs related with
“VALID” is turned off (close processing will message transmission.
never terminate abnormally). (1) Parameter error (code: 177)
• When any input is out of the given range.
Notes: • When “MODULE_NO” exceeds the range of SX bus station numbers (1-254).
1) A single M_OPEN function block enables • When the value input to “MODULE_TYPE” is not the predefined type.
both message send and receive processing. • When “MODULE_NO” indicates self station number.
Although messages can be transferred both (2) Channel open error (code: 193)
ways, i.e., sent and received if they are to • An invalid value is specified in “STATION_NO” (the invalid value range varies
be transferred via a T-link, P-link, or PE-link between different communication modules).
communication module, the module cannot • An invalid value is specified in the communications mode (the invalid value
send a message while receiving another range varies between different communication modules).
message or vice versa. • Neither destination station number (IP address) nor PORT_NO exist on the
2) When sending messages via an Ethernet network when the communications mode is set to the active side
interface, make sure that the destination (sending side) (Valid only with Ethernet interface module).
module is already open when executing (3) Port error (code: 200)
M_OPEN on the active side. Consequently, • The value specified in “SPORT_NO” is not within 1 to 127.
it is necessary to complete M_OPEN • A duplicate “SPORT_NO” value is found within the resource.
processing for message receive before • When the same “SPORT_NO” has been specified in the communication module.
executing M_OPEN processing for message (4) Connection number/client port number full (code: 201)
send. • An attempt was made to open more than 56 ports at the same time within a
3) When the M_OPEN process terminates with resource.
an error, it is retried in scanning next time • An attempt was made to open more ports than permitted for a single
when “EN_C” is set to “1.” communication module (varies with the communication module).

2-61
Section 2 Programming Language Original FB

<Communication ports (PRORT_NO, SPORT_NO)>


The communication port identifies the receiving port of the destination module specified in STATION_NO or MODULE_NO, to
which a message is sent.
MICREX-SX can be used to assign the numbers 1 to 127 to the self-port number (SPORT_NO). Do not allow SPORT_NO
values to overlap.
If a number of M_OPEN FBs are used, make sure that there is no SPORT_NO duplication.

1) Communication ports used in communication within one configuration


In communication within one configuration, the value for SPORT_NO, an N_OPN input is the self-port number. It is the port
receiving the message. The value of an input RPORT_NO is the destination port number in the mate system.

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

UINT#11 RPORT_NO UINT#2 RPORT_NO


UINT#2 SPORT_NO UINT#11 SPORT_NO

2-62
Section 2 Programming Language Original FB

2) Communication port in communication out of the configuration


In communication out of the configuration, the value for SPORT_NO, an M_OPEN input, is the self-port number. It is the port
receiving the message in the communication module network. The value for an input RPORT_NO is the destination port number
in the mate system (communication module).
Note that the allowable port numbers are restricted, depending on the network type (TCP/IP), and even using the numbers 1 to
127, ports may not be set. In such a case, the “SPORT_NO” value, to which an offset value is added, is used for the port in the
network. Similarly, an offset value is added to the “RPORT_NO” value. The offset value may be defined in the system definition
parameter setting for the communication module.

Configuration A Configuration B

PE-link module PE-link module


(SX station number=246) (SX station number=246)
CPU0 (PE station number=0) (PE station number=3F) CPU0

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

UINT#11 RPORT_NO UINT#2 RPORT_NO


UINT#2 SPORT_NO UINT#11 SPORT_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

(5) Send message M_SEND

Name, Symbol, Function Example

<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

SIZE is greater than that of SD.


module specified in M_OPEN.
(1) A message is sent using the settings <Status (STATUS) summary>
identified by the connection number The status codes related to the M_SEND FB are described below.
specified in the “CON_NO” on the rising Refer to page 2-187 for the common status codes for FBs related with
edge (0 to 1) of the “REQ.” message transmission.
The send processing does not end within
one scan period. (1) Send message error (code: 195)
(2) If the message send is completed, the • Unable to send a message to the destination communication module.
“DONE” is set and on for one scan period. • No response is received from the destination communication module
(3) If the message send is unsuccessful, (transmission is completed but no ACK is returned).
the “ERROR” is set on for one scan period
and an error code is output in the (2) Channel closed (code: 199)
“STATUS.” • A closed destination module is found during an out-of-configuration
communication.
Notes:
1) The volume of data that can be sent in a (3) Port error (code: 200)
single message send is 2,048 words in the • The destination module is not opened.
in-configuration communications mode.
In the out-of-configuration communications (4) Buffer overflow (code: 206)
mode, the volume of data varies according • The size of the send data exceeds 4,096 bytes.
to the communication module through which • The maximum send data size of the communication module is
data is to be sent. exceeded.
2) Available data types of the “SD” are all data
types except BOOL. (5) Connection number error (code: 207)
3) The“REQ” is active on rising edge. • An unopened connection number is used.
However, any low to high transition of • An attempt was made to send with a connection number that was
“REQ” occurring while a message is being already
sent (from the time the “REQ” goes high in use (this error can occur when two M_SEND FBs are used in
until the time the “DONE” or “ERROR” goes parallel).
high) is invalid.
4) The state of the input/output signal “SD” (6) Parameter error (code: 177)
must not be changed while M_SEND is • A 0 is supplied to the SIZE terminal.
processing a message. • When a variable for storing sent data is out of the memory area.
The integrity of the send data is not
guaranteed if the state of this signal is
changed.
5) If the number of words specified by the
“SIZE” is greater than the size of the
variable specified by “SD,” the value of the
extra words is likely to be unpredictable.
Make sure that the value of the “SIZE”
matches the size of the variable. Notes:
6) Program so that 1 is input to an “REQ” 7) M_SEND terminates if the mate system is out of the onfiguration
when M_OPEN “VARID” is set to “1.” regardless of its M_RECEIVE behavior.
If the mate system is within the same configuration, it terminates
when M_RECEIVE has been executed normally in the mate system.

2-64
Section 2 Programming Language Original FB

(6) Receive message M_RECEIVE

Name, Symbol, Function Example

<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

(1) Channel closed (code: 199)


source module specified in M_OPEN. • A closed source module is found during an out-of-configuration
(1) A message is received using the settings communication.
identified by the connection number
specified in the “CON_NO” when the (2) Port error (code: 200)
“EN_R” is set to 1. The receive processing • The source module is not opened.
does not end within one scan period.
(2) If the message receive is completed, the (3) Parameter error (code: 177)
end of receive “NDR” is set and held for • A 0 is supplied to the SIZE terminal.
one scan period. • When a variable for storing sent data is out of the memory area.
(3) If the message receive is unsuccessful, the
“ERROR” is set and held for one scan period (4) Buffer overflow (code: 206)
and an error code is output in the “STATUS.” • The size of the receive data exceeds the size of the variable for storing
the receive data.
Notes: • In this case, “RD” contains the effective receive data.
1) The volume of data that can be received in
a single message receive is 2,048 words in (5) Connection number error (code: 207)
the in-configuration communications mode. • An unopened connection number is used.
In the out-of-configuration communications • An attempt was made to receive with a connection number that was
mode, the volume of data varies according already being used (this error can occur when two M_RECEIVE FBs
to the communication module through which are used in parallel).
data is to be received.
2) Available data types of the “RD” are all data (6) RECEIVE error terminated (code: 196)
types except BOOL.
3) The “EN_R” must be held at 1 during
message receive processing (from the time
the “EN_R” goes high until the time the
“NDR” or “ERROR” goes high). Setting the
“EN_R” to 0 means the suspension of
receive processing.
4) Receive processing resumes if the “EN_R”
is set high after the suspension of receive
processing.
Receive processing resumes using the old
“CON_NO,” “RD,” and “SIZE” values even if
they are altered during the suspension.
These changes are not reflected in the
subsequent message receive processing.
5) If the “EN_R” remains as 1 in the next scan
following the completion of a message
receive operation, a new message receive Notes:
operation will start. 7) If the number of words specified by the “SIZE” is greater than the
6) The state of the input/output signal “RD” size of the variable specified by “RD,” the area for other variables
must be maintained while M_RECEIVE is may be overridden. Make sure that the value of the input“SIZE”
receiving a message. The integrity of the matches the size of the variable.
receive data is not guaranteed if the state of 8) Program so that 1 is input to an “EN_R” when M_OPEN “VARID”
this signal is changed. is set to “1.”

2-65
Section 2 Programming Language Original FB

(7) Direct read READ_WORD/READ_BOOL

Name, Symbol, Function Example

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

(2) Parameter error (code: 177)


READ_WORD and READ_BOOL are used to • A 0 is supplied to the SIZE terminal.
Function

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

(8) Direct write WRITE_WORD/WRITE_BOOL

Name, Symbol, Function Example


<Terminal description>
Name

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

(9) Remote data read R_READ

Name, Symbol, Function Example


<Terminal description>
Name Symbol

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

mode from a device that is connected to a the message transmission.


network via a communication module listed
below that can be read. (1) Channel open error (code: 193)
• Memory in a CPU of the SPH system via a • When an invalid value has been set for a channel number
network (of any type). (2) Message send error (code: 195)
• Memory in a CPU of the MICREX_F or • When an invalid value has been set for a station number
FLEX-PC via a T-link, P-link, or PE-link. • When an invalid value has been set for a channel number
• Device that is connected to an open • When any other value than type codes has been set for a memory type
standard network such as JPCN-1. (3) No free port (code: 201)
(1) The data designated by the • When you make an attempt to open excessive ports in one
“MODULE_NO,” “CHANNEL_NO,” communication module
“STATION_NO,” and “REMOTE_VAR” is (4) Transfer size over (code: 206)
read into the variable area designated by
• When any other value than “0” is specified for an input “VAR_TYPE”
the input “RD” on a low to high (0 to 1)
and a message data exceeds the size limit for the communication
transition of the “REQ.” (The read does
not end within one scan period.) module through which it will pass
(2) If the read is completed, the “DONE” is (5) Parameter error (code: 177)
set and held for one scan period. • When “0” is input into “SIZE”
(3) If the read is unsuccessful, the “ERROR” • When any other value than specified values is input into “VAR_TYPE”
is set and held for one scan period and an • When a value out of a range of allowed values for an SX bus station
error code is output in the “STATUS.” number is input into “MODULE_NO”
Notes: (For example, MODULE_NO is self SX bus station number.)
1) The “VAR_TYPE” must specify the method of • When a variable for storing READ data is out of the memory area.
specifying the variables to be read. (6) Internal resource shortage (code: 171)
2) The “REQ” is active on rising edge. • When a shortage occurs in internal resources for executing R_READ
However, any low to high transition of “REQ” and R_WRITE.
occurring while data is being read (from the time If more than one R_READ and R_WRITE are started simultaneously,
the input “REQ” goes high until the time the
a shortage may occur in internal resources. In this case, wait for a
“DONE” or “ERROR” goes high) is invalid.
moment and retry it.
3) The state of the input/output signal “RD” must not
be changed while read processing is in progress. (7) Memory address specification error (code: 68)
The integrity of the read data is not guaranteed if • When an invalid address has been specified in “REMOTE_VAR.”
the state of this signal is changed. (Only when 0 is specified in “REMOTE_VAR” does it occur.)
4) There is no restriction on the “SIZE” when the (8) Memory size over (code: 69)
input “VAR_TYPE” is set to 0.
• When the address specified in “REMOTE_VAR” + the input “SIZE”
In the other cases, it is subject to restrictions
depending on the communication module through
value is out of the range of allowed addresses. In this case, an I/O
which data is to be read. value “RD” is not assured.
5) If the number of data items specified by the “SIZE” (9) Mate specification error (code: 160)
is greater than the size of the variable specified • When VAR_TYPE = 0 and the CPU number in the mate system
by “RD,” the area for other variables may be specified in REMOTE_VAR is not found
overridden. Make sure that the value of the “SIZE”
matches the size of the variable. Notes:
6) Under a condition of VAR_TYPE ≠ 0, the entire 8) The FB completes processing on receipt of a response from the destination
read data is stored into an I/O “RD” and the (e.g., another CPU) of the FB's request. Depending on the status of the
operation terminates when the size of data read destination, processing may not be completed immediately.
out from the device is smaller than “SIZE.” Therefore, write a program that allows for the time required for normal
7) Be careful so that no compile error will occur even or error completion if the next control operation is performed on completion
when BOOL type array variable is used for “RD.” of the FB.

2-68
Section 2 Programming Language Original FB

(10) Remote data write R_WRITE

Name, Symbol, Function Example


<Terminal description>
Name

R_WRITE Input
REQ: Write request
MODULE_NO: Communication module number
Symbol

CHANNEL_NO: Channel number


R_WRITE STATION_NO: Destination network station number
BOOL REQ DONE BOOL VAR_TYPE: Variable specification method (Refer to page 2-186.)
UINT MODULE_NO ERROR BOOL SIZE: The size of write data
UINT CHANNEL_NO STATUS INT Output
UDINT STATION_NO DONE: Normal completion flag
UINT VAR_TYPE ERROR: Error flag
*1) ANY REMOTE_VAR REMOTE_VAR ANY *3) STATUS: Status
UINT SIZE Input/output
*2) ANY SD SD ANY *3)
REMOTE_VAR: Variable to be accessed (Refer to page 2-186.)
SD: Variable for storing the write data.
*1: Array of any data type except BOOL type <Status (STATUS) summary>
*2: Any data type except BOOL type The status codes related to the R_WRITE FB are described below.
Array of any data type except BOOL type Refer to page 2-187 for the common status codes for FBs related with
the message transmission.
R_WRITE writes data in the direct addressing
Function

(1) Channel open error (code: 193)


mode into a device that is connected to a
• When an invalid value has been set for a channel number.
network via a communication module listed
below. (2) No free port (code: 201)
• Memory in a CPU of the SPH system via a • An attempt was made to open more ports than permitted in a single
network (of any type). communication module.
• Memory in a CPU of the MICREX_F or (3) Transfer size overflow (code: 206)
FLEX-PC via a T-link, P-link, or PE-link. • The size limit defined for the communication module to be used is
• Device that is connected to an open standard exceeded when the input “VAR_TYPE” is set to a nonzero value.
network such as OPCN-1 and FL-net.
(4) Parameter error (code: 177)
• A 0 is supplied to the SIZE terminal.
(1) The data designated by the “SD” is written • An invalid value is supplied to the “VAR_TYPE” terminal.
into the area designated by the • A value greater than the maximum permissible SX bus station number
“MODULE_NO,” “CHANNEL_NO,” is supplied to the “MODULE_NO” terminal.
“STATION_NO,” and “REMOTE_VAR” on • When a variable for storing written data is out of the memory area.
a low to high (0 to 1) transition of the “REQ.” • When MODULE_NO is the self-SX bus station number.
(The write does not end within one scan
period.) (5) Internal resource shortage (code: 171)
(2) If the write is completed, the “DONE” is set • When a shortage occurs in internal resources for executing R_READ
and R_WRITE
and held for one scan period.
• If more than one R_READ and R_WRITE are started simultaneously,
(3) If the write is unsuccessful, the “ERROR” is
a shortage may occur in internal resources. In this case, wait for a
set and held for one scan period and an moment and retry it.
error code is output in the “STATUS.”
(6) Memory address specification error (code: 68)
• When an invalid address has been specified in “REMOTE_VAR.”
Notes: (Only when 0 is specified in “REMOTE_VAR” does it occur.)
1) The “VAR_TYPE” must specify the method (7) Memory size over (code: 69)
of specifying the variables to be written. • When the address specified in “REMOTE_VAR” + input “SIZE” is out
2) The “REQ” is active on rising edge. of a range of allowed address for the mate module. In this case, data
However, any low to high transition of might have been written into the mate module.
“REQ” occurring while data is being write (8) Mate specification error (code: 160)
(from the time the “REQ” goes high until • When VAR_TYPE = 0 and the CPU number in the mate system
the time the “DONE” or “ERROR” goes specified in REMOTE_VAR is not found.
high) is invalid.
(9) Transmission interlock error (code: 35)
3) If the size of data specified by the “SIZE” is
• When the mate-party module is interlocked
greater than the size of the variable
Transmission interlock occurs when an instance screen opens by
specified by “SD,” the extra data is likely to accompanying any operation such as download. In this case, retry it.
be unpredictable. Make sure that the value
of the “SIZE” matches the size of the Notes:
variable. 5) The FB completes processing on receipt of a response from the
4) Be careful so that no compile error will destination (e.g., another CPU) of the FB's request. Depending on
occur even when BOOL type array variable the status of the destination, processing may not be completed
is used for “SD.” 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.

2-69
Section 2 Programming Language Original FB

<Variable specification method>


The legitimate values of the variable specification method to be specified in the Remote Data Read (R_READ) and Remote
Data Write (R_WRITE) instructions (“VAR_TYPE” and “REMOTE_VAR”) are defined individually for each target of access in the
destination station.

VAR_TYPE Variable specification method Target access


0 SPH address CPU memory in the SPH system via a network (of any type)
1 MICREX-F or FLEX-PC address CPU memory in the MICREX-F or FLEX-PC via a T-link, P-link, or PE-link
2 Sequence of numerals Device connected to an open standard network such as OPCN-1
3 Character string Device connected to an open standard network such as OPCN-1

<VAR_TYPE formats>

 When VAR_TYPE=0  When VAR_TYPE=1


• REMOTE_VAR • REMOTE_VAR
F 0 F 0
CPU No. File No.
Memory type * Word address within file
Address, lower-order
Address, upper-order

 When VAR_TYPE=2  When VAR_TYPE=3


• REMOTE_VAR • REMOTE_VAR
F 0 F 0
Effective size n ASCII character string
- Address 1 The end of a string is represented
by a null code.
- -
- -
- Address n For the “REMOTE_VAR” format,
refer to the manuals for the
In this case, the effective data is
communication module through
placed in the lower-order 8 bits of
which data is to be read or written
a 16-bit array. This is because an
and the device to be read from or
SPH system cannot handle 8-bit
written to.
data.

* 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

Note: Do not specify 1, 3, 5, 9, or 10


for the memory type code.

2-70
Section 2 Programming Language Original FB

<Common status codes>

Error code Name Cause Countermeasure


47 (2Fh) System The mate CPU module was unable • Execute the FB again after the mate CPU finishes
initializing to process the message, because it system initialization.
is initializing its system.
Memory access Attempted to access uninstalled • Check configuration of the module.
66 (42h) error P/PE-link memory or FL-net common
memory.
No responses to No answer command was received • Check the condition and wiring of the remote
162 (A2h) command even when specified time had equipment.
elapsed.
Message send The mate system is missing or the • Check the input terminal for defining the destination.
164 (A4h) error specified SX station number has no
module.
165 (A5h) Message receive Can't send a message over an SX • Verify that the mate-party module supports message
busy bus because the destination module communication.
is busy. • Re-execute the FB at a later time.
• If this error occurs frequently, it implies that the
message transmission load of the destination module is
too high. Lower the message load.
170 (AAh) Message send Can't send a message because • Re-execute the FB at a later time.
busy the CPU resource for sending a • If this error occurs frequently, it implies that the
message is busy. message transmission load of the local CPU is too
high. Lower the message load.
197 (C5h) Network send Can't perform an intercommunication • Re-execute the FB at a later time.
busy module transmission over a • If this error occurs frequently, it implies that the
network because the destination message transmission load of the local CPU is too
communication module is busy. high. Lower the message load.

2-71
Section 2 Programming Language Original FB

(11) File data read F_READ

Name, Symbol, Function Example


<Name> <Terminal description>
F_READ Input
REQ: Read request
MODULE_NO: SX bus station number of the module containing a
<Symbol> memory card
SIZE: The size (in words) of variables connected to RD
F_READ Output
BOOL REQ DONE BOOL DONE: Normal completion flag
UINT MODULE_NO ERROR BOOL ERROR: Error flag
STATUS INT STATUS: Status
*1) ANY FILE_NAME FILE_NAME ANY *2) F_SIZE: The size (in words) of the read file
UINT SIZE F_SIZE UINT Input/output
*1) ANY RD RD ANY *2)
FILE_NAME: File name (Character code is Shift-JIS.)
With SPH2000 software version V08 or later and SPH3000, up to
255 1-bit characters can be used in a ROM card on the local CPU.
*1: Array of any data type except BOOL type With SPH300, 200, or 2000 version V07 or earlier, eight 1-bit
characters plus three extension characters (64, 1-bit alphanumeric
characters for folder specification and the file name) can be used.
RD: Variable for storing the read data.

<Status (STATUS) summary>


For the status codes related to the F_READ FB, refer to the following page.
For the common status codes for FBs related with the message transmission, refer to page 2-70.

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

“E: \err_log.log” STR_TO_SJ F_NAME

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

<F_READ status codes>

Error code Name Cause


35 (23h) Transmission interlock • When the module with a memory card inserted is accessed using the file access
error instruction, the system enters the transmission interlock state. If another file access
memory makes an attempt to enter the module, a transmission interlock error occurs.
Retry it.
65 (41h) File name error • The file with the specified file name is not found.
66 (42h) File access error • A check sum error occurred while reading a file.
• The file was accessed without mounting a user ROM.
(Including when the key switch is not set at the “UROM” position)
78 (4Eh) UROM hardware error Although a user ROM was mounted, an error occurred.
• File system error (the file is not formatted in FAT or FAT32 or the format data is broken.)
• User ROM fault
• While accessing the user ROM, the access failed due to the noise, etc.
177 (B1h) Parameter error • A value greater than the maximum permissible SX bus station number is supplied to the
“MODULE_NO” terminal.
• A variable for storing read data is out of the memory area.
• MODULE_NO is the self-SX bus station number.
201 (C9h) No free port • It is attempted to open a port exceeding the limit on the number of port for one
communication module.
206 (CEh) Buffer overflow • Received data exceeds the size of the variable associated with RD.

2-73
Section 2 Programming Language Original FB

(12) File data write F_WRITE

Name, Symbol, Function Example


<Name> <Terminal description>
F_WRITE Input
REQ: Write request
MODULE_NO: SX bus station number of the module containing a
<Symbol> memory card
SIZE: The size (in words) of write data
F_WRITE Output
BOOL REQ DONE BOOL DONE: Normal completion flag
UINT MODULE_NO ERROR BOOL ERROR: Error flag
STATUS INT STATUS: Status
*1) ANY FILE_NAME FILE_NAME ANY *2) Input/output
UINT SIZE FILE_NAME: File name (Character code is Shift-JIS.)
*1) ANY WD WD ANY *2)
With SPH2000 software version V08 or later and SPH3000, up to
255 1-bit characters can be used in a ROM card on the local CPU.
With SPH300, 200, or 2000 version V07 or earlier, eight 1-bit
*1: Array of any data type except BOOL type characters plus three extension characters (64, 1-bit alphanumeric
characters for folder specification and the file name) can be used.
WD: Variable for storing the write data.

<Status (STATUS) summary>


For the status codes related to the F_WRITE FB, refer to the following page.
For the common status codes for FBs related with the message transmission, refer to page 2-70.

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

“E: \err_log.log” STR_TO_SJ F_NAME

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

<F_WRITE status codes>

Error code Name Cause


35 (23h) Transmission interlock • When the module with a memory card inserted is accessed using the file access
error instruction, the system enters the transmission interlock state. If another file access
memory makes an attempt to enter the module, a transmission interlock error occurs.
Retry it.
65 (41h) File name error • The directory with the specified file name is not found. If the directory exists but the file
does not exist, a new file is created.
66 (42h) File access error • The file was accessed without mounting a user ROM.
(Including when the key switch is not set at the “UROM” position)
69 (45h) No free area • Unable to write because there is no free space in the memory card of the memory card
interface module (Type: NP1F-MM1) or PC card interface module (Type: NP1F-PC2).
78 (4Eh) UROM hardware error Although a user ROM was mounted, an error occurred.
• File system error (the file is not formatted in FAT or FAT32 or the format data is broken.)
• User ROM fault
• While accessing the user ROM, the access failed due to the noise, etc.
79 (4Fh) No free area • Unable to write because there is no free space in the user ROM.
177 (B1h) Parameter error • A value greater than the maximum permissible SX bus station number is supplied to the
“MODULE_NO” terminal.
• A variable for storing read data is out of the memory area.
• MODULE_NO is the self-SX bus station number.
201 (C9h) No free port • It is attempted to open a port exceeding the limit on the number of port for one
communication module.

2-75
Section 2 Programming Language Original FB

(13) Extension test & set EXT_T_S

Name, Symbol, Function Example


<Terminal description>
Name

EXT_T_S Input
REQ: Test & set request
Input/output
Symbol

IN: Global bit variable assigned to another resource


Output
EXT_T_S DONE: Normal completion flag
BOOL REQ DONE BOOL Q: Test & set result
Q BOOL 0: Set complete
ERROR BOOL 1: Set disabled (already set)
STATUS INT ERROR: Error flag
*1) ANY IN IN ANY STATUS: Status

*1: BOOL type <Status (STATUS) summary>


(1) Global bit variable specification error (code: 170)
The variable designated by “IN” is assigned to the local CPU.
EXT_T_S acquires a semaphore. It is used (2) Unsupported instruction detection (code: 32)
Function

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

(14) Sequential file store FFST

Name, Symbol, Function Example


<Programming example>
Name

FFST
RE_TRIG FFST
FLAG CLK Q ENABLE ERROR ERR
Symbol

FILE FILE FILE


FFST CONTROL FCB FCB
BOOL ENABLE ERROR BOOL
INDATA IN IN
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
UINT#6 X_SIZE
STRUCT FCB FCB STRUCT
UINT#4 Y_SIZE
ARRAY IN IN ARRAY *1)
UINT X_SIZE <Sample data type definition>
UINT Y_SIZE TYPE
ELEMENT1 : ARRAY[1..6] OF INT; (*X_SIZE*)
FILE1 : ARRAY[1..4] OF ELEMENT1; (*Y_SIZE*)
FCB1 :
STRUCT
File control block definition
(1) FFST writes the data block designated by A_POINTER : UINT;
Function

The file control block should be defined as


the “IN” into the sequential file area B_POINTER : UINT; shown to the left.
designated by the “FILE” when the N_FE : BOOL; A_POINTER: FFST Write pointer
“ENABLE” is set to on. FF : BOOL; FILO read pointer
(2) The “FCB” specifies the file control block END_STRUCT; B_POINTER: FIFO read pointer
which is used for controlling write N_FE: A “0” indicates that the file is empty
END_TYPE
processing. (Not File Empty).
FF: A “1” indicates that the file is full
(3) Specify the number of elements of the (Examples of variable declarations)
(File Full).
array connected to “IN” for a “X_SIZE” VAR
(one-dimensional size of an array). FILE : FILE1;
Specify the two-dimensional size of the INDATA : ELEMENT1; Note: Use the same data type for “IN”
CONTROL : FCB1; as that of “FILE” (*X_SIZE*).
array for a “Y_SIZE.”
END_VAR
(4) If the file area is already full, the old data is
discarded and the data designated by the <Operation>
“IN” is written. When a FLAG is set, “INDATA” data is stored in “FILE.”
(5) If the write is unsuccessful, the “ERROR” is
set and held for one scan period. INDATA (1) (2) (3) (4) (5) (6)
(6) Available data type of “IN” is an array of any
data type except BOOL type. Normal
operation is not guaranteed if an array of Executed FBs FFST FFST FFST FFST FFST FFST

BOOL type is specified on “FILE.”


(1) (2) (3) (4) (5) (6) (7)
A, B  B B B A, B 
(1) (1) (1) (1) (5) (5)
Note: If the result of “X_SIZE” and “Y_SIZE” A A, B 
(2) (2) (2) (2) (2)
multiplication is different from FILE A A, B 
(larger than) the size of the array of (3) (3) (3) (3)
A
arrays connected to “FILE,” any other (4) (4) (4)
variable area may be overwritten. FCB FCB FCB FCB FCB FCB FCB
For example, the unit of a file data size is A_PNT 0 A_PNT 1 A_PNT 2 A_PNT 3 A_PNT 0 A_PNT 1 A_PNT 2
double word and the data type definition is B_PNT 0 B_PNT 0 B_PNT 0 B_PNT 0 B_PNT 0 B_PNT 1 B_PNT 2
ELEMENT1:ARRAY[1..10] OF DINT; FF 0 FF 0 FF 0 FF 0 FF 1 FF 1 FF 1
N_FE 0 N_FE 1 N_FE 1 N_FE 1 N_FE 1 N_FE 1 N_FE 1
(*X_SIZE*), data set in “X_SIZE” of the
FFST must be counted in word size.
If 10 double word file is defined, double the
value and set “20.”

2-77
Section 2 Programming Language Original FB

(15) Sequential file load first FIFO

Name, Symbol, Function Example


<Operation>
Name

FIFO
(3) (4) (5) (6)
Symbol

Executed FCBs FIFO FIFO FIFO FIFO FIFO


FIFO
BOOL ENABLE ERROR BOOL
(1) (2) (3) (4) (5) (6)
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY B
(5) (5) (5)
STRUCT FCB FCB STRUCT B
(6) (6) (6) (6)
ARRAY OUT OUT ARRAY *1) A, B  A A A A, B  A, B 
(3)
UINT X_SIZE B
(4) (4)
UINT Y_SIZE
FCB FCB FCB FCB FCB FCB
A_PNT 2 A_PNT 2 A_PNT 2 A_PNT 2 A_PNT 2 A_PNT 2
B_PNT 2 B_PNT 3 B_PNT 0 B_PNT 1 B_PNT 2 B_PNT 2
FF 1 FF 0 FF 0 FF 0 FF 0 FF 0
N_FE 1 N_FE 1 N_FE 1 N_FE 1 N_FE 0 N_FE 0
(1) Setting to on the “ENABLE” causes the
Function

oldest data (at the B_POINTER position in


the FCB) to be read from the specified
sequential file area into the area designated
by the “OUT” and the B_POINTER to be
incremented by 1. At this moment, if the FF
flag (File Full) is on, it is set to off.
(2) The N_FE bit is set to off (to notify that the
file has become empty) when B_POINTER
catches up with A_POINTER.
(3) The “FCB” specifies the file control block
which is used for controlling read processing.
(4) Specify the number of elements of the array
connected to “OUT” for a “X_SIZE”
(one-dimensional size of an array).
Specify the two-dimensional size of the
array for a “Y_SIZE.”
(5) Processing is flagged as invalid if an
attempt is made to read an empty file.
(6) If the read is unsuccessful, the “ERROR” is
set and held for one scan period.
(7) Available data type of “OUT” is an array of
any data type except BOOL type. Normal
operation is not guaranteed if an array of
BOOL type is specified on “FILE.”
(8) “OUT” is overwritten when “ENABLE” is
set to “ON” and the file is not empty.

Note: If the “X_SIZE” is larger than the array


connected to “OUT,” other variable
domains will be rewritten.

2-78
Section 2 Programming Language Original FB

(16) Sequential file load last FILO

Name, Symbol, Function Example


<Operation>
Name

FILO
Symbol

Executed FCBs FILO FILO FILO FILO FILO


FILO
BOOL ENABLE ERROR BOOL
(1) (2) (3) (4) (5) (6)
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY A
(5) (5)
STRUCT FCB FCB STRUCT A
(6)
ARRAY OUT OUT ARRAY *1) A, B  B B B A, B  A, B 
(3) (3) (3) (6)
UINT X_SIZE A
(4) (4) (4)
UINT Y_SIZE
FCB FCB FCB FCB FCB FCB
A_PNT 2 A_PNT 1 A_PNT 0 A_PNT 3 A_PNT 2 A_PNT 2
B_PNT 2 B_PNT 2 B_PNT 2 B_PNT 2 B_PNT 2 B_PNT 2
FF 1 FF 0 FF 0 FF 0 FF 0 FF 0
N_FE 1 N_FE 1 N_FE 1 N_FE 1 N_FE 0 N_FE 0
(1) Setting to on the “ENABLE” causes the
Function

latest data (at the B_POINTER position in


the FCB) to be read from the specified
sequential file area into the area designated
by the “OUT” and the A_POINTER to be
decremented by 1. At this moment, if the
FF flag (File Full) is on, it is set to off.
(2) The N_FE bit is set to off (to notify that the
file gets empty) when A_POINTER catches
up with B_POINTER.
(3) The “FCB” specifies the file control block
which is used for controlling read processing.
(4) Specify the number of elements of the array
connected to “OUT” for a “X_SIZE”
(one-dimensional size of an array).
Specify the two-dimensional size of the
array for a “Y_SIZE.”
(5) Processing is flagged as invalid if an
attempt is made to read an empty file.
(6) If the read is unsuccessful, the “ERROR” is
set and held for one scan period.
(7) Available data type of “OUT” is an array of
any data type except BOOL type.
Normal operation is not guaranteed if an
array of BOOL type is specified on “FILE.”
(8) “OUT” is overwritten when “ENABLE” is set
to “ON” and the file is not empty.

Note: If the “X_SIZE” is larger than the array


connected to “OUT,” other variable
domains will be rewritten.

2-79
Section 2 Programming Language Original FB

(17) Filter FILTER_DINT

Name, Symbol, Function Example


<Programming example>
Name

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

the result on “XOUT” when the “RUN” is on.


(2) The data from the “XIN” is transferred to Approx. 63%
OUTPUT
“XOUT” without filtering if the “RUN” is off.
(3) Available data type of “XIN” and “XOUT” is
DINT type. TAU=50ms
(4) The “TAU” specifies the time constant of the
filter. The larger the time constant value is, <Formulas>
the gentler the slope of the “XOUT” curve is.
The “XOUT” involves a large error if the (XIN - XOUT’) ΔT + WORK’
XOUT = + XOUT’
time constant value is too small. TAU
(5) The “XOUT” carries the preceding value (XIN - XOUT’) ΔT + WORK’
when the “RUN” is set on. where WORK is the remainder of
TAU
(6) When the “TAU” is set to 0, the “XOUT”
carries the value from the “XIN” as is.
XOUT’ and WORK’ denote the preceding value of XOUT and
(7) The maximum allowable value of the filter
XWORK, respectively.
time constant “TAU” is 24 hours
ΔT is the execution period for this FB.
(86400000 ms).
(8) Set the filter time constant “TAU” to a value
that is greater than the execution interval of
Note: This FB is generally used by periodic tasks. The error becomes
this FB.
greater as the period (ΔT) becomes shorter.
(9) Enter the value that does not cause an
For SPH200s, set a 2ms or greater interval for ΔT.
overflow during operation or in the result.
If an overflow occurs, the “XOUT” values
may be unexpected.
Note that for SPH300s, no overflow occurs
if conditions 7 and 8 are met.

2-80
Section 2 Programming Language Original FB

(18) Filter FILTER_REAL

Name, Symbol, Function Example


<Programming example>
Name

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

outputs the result in “XOUT” when the


Approx. 63%
“RUN” is on. OUTPUT
(2) The data from the “XIN” is transferred to
“XOUT” without filtering if the “RUN” is off.
(3) Available data type of “XIN” and “XOUT” is TAU=50ms
REAL.
(4) The “TAU” specifies the time constant of <Formulas>
the filter. The larger the time constant value
is, the gentler the slope of the “XOUT” (XIN - XOUT’) ΔT
XOUT = + XOUT’
curve is. The “XOUT” involves a large error TAU
if the time constant value is too small.
(5) The “XOUT” carries the preceding value XOUT’ denotes the preceding value of XOUT.
when the “RUN” is set on. ΔT is the execution period for this FB.
(6) When the input “TAU” is set to 0, the
“XOUT” carries the value from the “XIN” Note: This FB is generally used by periodic tasks. The error gets larger
as is. as the period becomes shorter.
(7) The number of significant digits is 6.
(8) The maximum allowable value of the filter
time constant “TAU” is 24 hours
(86400000 ms).
(9) Set the filter time constant “TAU” to a value
that is greater than the execution interval of
this FB.
(10) Enter the value that does not cause an
overflow during operation or in the result.
If an overflow occurs, the “XOUT” values
may be unexpected.

2-81
Section 2 Programming Language Original FB

(19) Integrate INT_DINT

Name, Symbol, Function Example


<Programming example>
Name

INT_DINT
INT_DINT
INPUT1 RUN XOUT OUTPUT1
Symbol

INPUT2 R1 Q OUTPUT2

INT_DINT INPUT3 XIN


BOOL RUN XOUT DINT INPUT4 X0
BOOL R1 Q BOOL TIME#50ms I_T
DINT XIN
DINT X0
<Operation>
TIME I_T

INPUT1

INPUT2
(1) INT_DINT integrates the “XIN” and
Function

outputs the result in “XOUT” when the


“RUN” is on. a
INPUT3
(2) The value of the “XOUT” is retained if the
“RUN” is off. b
INPUT4
(3) The output is set to the initial value “X0”
when the “R1” turns on.
(4) The “Q” carries the NOT of the “R1.” a
(5) The “X0” must carry the initial value. b
(6) The “XOUT” carries the linear output such OUTPUT1
that it is equal to the value indicated by the
“XIN” when the integration time designated 50ms
by the “I_T” elapses, plus the initial value (I_T)
“X0.” OUTPUT2
(7) The “XOUT” carries the preceding value
when the “RUN” is set on.
(8) When the “I_T” is set to 0, the “XOUT” <Formulas>
carries a value of 0.
(9) The maximum allowable value of the (XINΔT + WORK’)
XOUT = + XOUT’
integration time “I_TU” is 24 hours I_T
(86400000 ms). XINΔT + WORK’
(10) Set the integration time “I_T” to a value where WORK is the remainder of
I_T
that is greater than the execution interval
of this FB. XOUT’ and WORK’ denote the preceding value of XOUT and WORK,
(11) Enter the value that does not cause an respectively.
overflow during operation or in the result. ΔT is the execution period for this FB.
If an overflow occurs, the “XOUT” values
may be unexpected.
Note that for SPH300s, no overflow Note: This FB is generally used by periodic tasks. The error gets larger
occurs if conditions 9 and 10 are met. as the period (ΔT) becomes shorter.
For SPH200s, set a 2ms or greater interval for ΔT.

2-82
Section 2 Programming Language Original FB

(20) Integrate INT_REAL

Name, Symbol, Function Example


<Programming example>
Name

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

outputs the result in “XOUT” when the


“RUN” is on. a
INPUT3
(2) The value of the “XOUT” is retained if the
“RUN” is off. b
INPUT4
(3) The output is set to the initial value “X0”
when the “R1” turns on.
(4) The “Q” carries the NOT of the “R1.” a
(5) The “X0” must carry the initial value. b
(6) The “XOUT” carries the linear output such OUTPUT1
that it is equal to the value indicated by the
“XIN” when the integration time designated 50ms
by the “I_T” elapses, plus the initial value (I_T)
“X0.” OUTPUT2
(7) The “XOUT” carries the preceding value
when the “RUN” is set on.
(8) When the “I_T” is set to 0, the “XOUT” <Formulas>
carries a value of 0.
(9) The number of significant digits is 6. XINΔT
XOUT = + XOUT’
(10) The maximum allowable value of the I_T
integration “I_TU” is 24 hours
(86400000 ms). XOUT’ denotes the preceding value of XOUT.
(11) Set the integration time “I_T” to a value ΔT is the execution period for this FB.
that is greater than the execution interval
of this FB.
(12) Enter the value that does not cause an Note: This FB is generally used by periodic tasks. The error gets larger
overflow during operation or in the result. as the period becomes shorter.
If an overflow occurs, the “XOUT” values
may be unexpected.

2-83
Section 2 Programming Language Original FB

(21) Differentiate DIF_DINT

Name, Symbol, Function Example


<Programming example>
Name

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

(1) DIF_DINT computes a differential from the


Function

“XIN” and the input from the output


a
generated during the preceding execution
and outputs the result in “XOUT” when the INPUT2
“RUN” is on.
(2) The “XOUT” carries a “0” when the “RUN” 50ms
is off. (D_T)
(3) The “D_T” must specify the derivative time.
(4) The DIF_DINT computes the variation of a
the “XIN” and outputs on “XOUT” the OUTPUT1
expected variation when the derivative time
elapses.
<Formulas>
(5) The “XOUT” carries the output that is based
on the variation that has been established (XIN-XM)D_T
since the time “RUN” is turned on. XOUT =
ΔT
Consequently, “XOUT” is set to 0 when
“RUN” is turned on.
(6) When the “I_T” is set to 0, the “XOUT” where
carries a value of 0. XM is the value of XIN established in the preceding execution.
(7) The maximum allowable value of the ΔT is the execution period for this FB.
derivative time “D_T” is 24 hours
(86400000 ms). Note: This FB is generally used by periodic tasks. The error gets larger
(8) The valid number of output digits is six. as the period (ΔT) becomes shorter.
(9) If the difference between current XIN and For SPH200s, set a 2ms or greater interval forΔT.
previous XIN is larger than six digits, an
error may occur in a XOUT.
(10) Enter a value that does not cause an
overflow in D_T during operation (XIN-XM).
If an overflow occurs, the “XOUT” values
may be unexpected.

2-84
Section 2 Programming Language Original FB

(22) Differentiate DIF_REAL

Name, Symbol, Function Example


<Programming example>
Name

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

(1) DIF_REAL computes a differential from the


Function

“XIN” and the input from the output


a
generated during the preceding execution
and outputs the result in “XOUT” when the INPUT2
“RUN” is on.
(2) The “XOUT” carries a “0” when the “RUN” 50ms
is off. (D_T)
(3) The “D_T” must specify the derivative time.
(4) The DIF_REAL computes the variation of a
the “XIN” and outputs, on “XOUT,” the OUTPUT1
expected variation when the derivative time
elapses.
<Formulas>
(5) The “XOUT” carries the output that is based
on the variation that has been established (XIN-XM)D_T
since the time “RUN” is turned on. XOUT =
ΔT
Consequently, “XOUT” is set to 0 when
“RUN” is turned on.
(6) When the “I_T” is set to 0, the “XOUT” where
carries a value of 0. XM is the value of XIN established in the preceding execution.
(7) The number of significant digits is 6. ΔT is the execution period for this FB.
(8) The maximum allowable value of the
derivative time “D_T” is 24 hours Note: This FB is generally used by periodic tasks. The error gets larger
(86400000 ms). as the period becomes shorter.
(9) Enter a value that does not cause an
overflow in D_T during operation (XIN-XM).
If an overflow occurs, the “XOUT” values
may be unexpected.

2-85
Section 2 Programming Language Original FB

(23) Pulse count PULSE_CNT

Name, Symbol, Function Example


<Programming example>
Name

PULSE_CNT
PULSE_CNT
INPUT1 RUN OUT COUNT
Symbol

INPUT2 IN CMP FLAG


PULSE_CNT
BOOL RUN OUT INT TIME#10s DURATION
BOOL IN CMP BOOL
TIME DURATION <Operation>

INPUT1
(1) When a “RUN” is set to “ON,” the pulses INPUT2
Function

input at “IN,” the time specified in a


DURATION DURATION
“DURATION,” are counted, and INT type DURATION DURATION
10s 10s
results are output to “OUT.” DURATION
If the result exceeds an INT type of FLAG
boundary value, the INT type of boundary 1 scan
value is output. When the time specified in
“DURATION” has passed, a “CMP” is set to
“ON” for a period of one scan. Count value
If a “RUN” is set to “ON,” counting is
resumed. COUNT 0 4 3 0 0 3
(2) The “OUT” retains the current value when
the “RUN” is set to off. Notes:
(3) The “OUT” is cleared to zero on the rising 1) Since “DURATION” processes are clocking in the same manner as
edge of the “RUN.” that for the timer instruction, an error +0 - +2 in scan time occurs.
(4) If “DURATION” is set to 0 ms, “CMP” holds 2) The pulses input to “IN” require a pulse width of two times or more
on while “RUN” is on. the period for instruction execution.
[F.Y.I.]
Data range of INT type: -32,768 to 32,767

(24) Pulse output PULSE_OUT

Name, Symbol, Function Example


<Programming example>
Name

PULSE_OUT
PULSE_OUT
INPUT RUN OUT LAMP1
Symbol

TIME#2s PERIOD CMP LAMP2


PULSE_OUT
BOOL RUN OUT BOOL INT#4 COUNT

TIME PERIOD CMP BOOL


INT COUNT
<Operation>

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

(25) Pulse PWM

Name, Symbol, Function Example


<Programming example>
Name

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)

(26) Hardware RTC (Real-time Clock) HW_RTC

Name, Symbol, Function Example


<Programming example>
Name

HW_RTC
HW_RTC
BOOL#1 EN Q OUTPUT1
Symbol

DT#1970-01-01-00:00:00 PDT CDT OUTPUT2


HW_RTC
BOOL EN Q BOOL
DT PDT CDT DT <Operation>
The current calendar value is always output at “OUTPUT2” if the
program is set up as shown in the above figure
(preset value = DT#1970-01-01-00:00:00).
(1) HW_RTC writes the set value “PDT” into the
Function

hardware RTC (clock in the CPU module)


on a low to high (0 to 1) transition of the
“EN.” If the set value is
DT#1970-01-01-00:00:00, the current value
of the hardware RTC is output in “CDT” as
the current value.
(2) The “Q” is set to 1 after the “PDT” value is
written into the hardware RTC in the CPU
module if the “EN” is on. If the set value is
DT#1970-01-01-00:00:00, the “Q” is set to
1 immediately when “EN” is set high.
(3) The value of the hardware RTC is output on
the “CDT” while the “Q” is in the 1 state.
(4) When an input "EN” is set to “ON,” an “CDT”
is not updated. Q is set to 0.

Note: The valid preset value range is from


DT#1970-01-01-00:00:01 to
DT#2069-12-31-23:59:59.

2-87
Section 2 Programming Language Original FB

(27) Test & set T_S

Name, Symbol, Function Example


<Programming example>
Name

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

1 and outputs the result on the “Q.”


Note: In the redundant system, to pass data to the bit variables used for
<Output “Q” state> semaphores at changeover between the working and standby
0: Setting completed CPUs:
1: Setting unsuccessful (already set) • Assign the bit variables for semaphores to the standard memory
(2) The set data need to be reset using the ST area to avoid equalization. (They are reset to 0 at changeover.)
(Store) instruction. • When changeover occurs, make an attempt to get semaphores
(3) If the test & set is unsuccessful, the output again.
“ERROR” is set and held for one scan period.

2-88
Section 2 Programming Language Original FB

(28) Change bank BANK_CHG

Name, Symbol, Function Example


<Terminal description>
Name

BANK_CHG Input
REQ: Bank change request flag
MODULE_NO: SX bus station number of the P/PE link module for
Symbol

which the bank is to be changed (246 or 245).


Output
BANK_CHG
DONE: Normal completion flag
BOOL REQ DONE BOOL
(held for one scan period on completion)
UINT MODULE_NO ERROR BOOL
ERROR: Error flag (held for one scan period on an error)
STATUS INT
STATUS: Status
BUSY BOOL BUSY: Held on during processing.

<Status (STATUS) summary>


(1) SX bus station number error (code: 64)
BANK_CHG is used to synchronize data in the An SX bus station number which is not for P/PE-link module is
Function

broadcast communications area that is used by specified.


inter-processor link modules. (2) Duplicate bank change request (code: 65)
Two or more bank change requests are issued by one CPU.
(1) A request to switch the bank is issued to the (3) Bank change processing processor bus error (code: 66)
P/PE link module specified by the An error occurred while accessing the processor bus during bank
interprocessor link module SX station change processing.
number “MODULE_NO” on the rising edge
of the bank-change request signal “REQ.” <Programming example>
(2) “BUSY” turns on when a bank change Refer to the user's manual for the between processor link modules
request is issued. (FEH203, FEH234, ctc.,) for programming examples.
(3) When bank change processing is
completed, the output “DONE” or “ERROR”
is set and held for one scan period and
“BUSY” is set off.
(4) When accessing the broadcast
communications area in the application
program, it is possible to establish data
synchronization by performing a read or
write after “DONE” is set on.

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

2-4-5 User ROM card expansion FBs


The SPH2000/SPH3000 series have expansion FBs for user ROM cards, for reading and writing data between the user ROM
card (CF card / SD card) installed in the CPU module and CPU module-internal application programs.
* The user ROM card expansion FBs are stored on the SX-Programmer Expert (D300win) product CD.

2-4-5-1 User ROM card expansion FBs


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

ERROR (BOOL) Write error

STATUS (DWORD) Status

FILE_BYTE_SIZE (UDINT) File size after write

File name (_F_TP_FNAME_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_ARRAY) File name

Title (_F_TP_TITLE_ARRAY) TITLE TITLE (_F_TP_TITLE_ARRAY) Title

Subtitle (_F_TP_TITLE_ARRAY) SUB_TITLE SUB_TITLE (_F_TP_TITLE_ARRAY) Subtitle

No. of rows to write (UINT) ROW

No. of columns per row (UINT) COL

Write data (_F_TP_2ARRAY_DATA) WD WD (_F_TP_2ARRAY_DATA) Write data

_F_WRITE_CSV_DINT_LF
Write request (BOOL) REQ Note) DONE (BOOL) Write end

ERROR (BOOL) Write error

STATUS (DWORD) Status

FILE_BYTE_SIZE (UDINT) File size after write

File name (_F_TP_FNAME_LF_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_LF_ARRAY) File name

Title (_F_TP_TITLE_ARRAY) TITLE TITLE (_F_TP_TITLE_ARRAY) Title

Subtitle (_F_TP_TITLE_ARRAY) SUB_TITLE SUB_TITLE (_F_TP_TITLE_ARRAY) Subtitle

No. of rows to write (UINT) ROW

No. of columns per row (UINT) COL

Write data (_F_TP_2ARRAY_DATA) WD WD (_F_TP_2ARRAY_DATA) Write data

* Words in parentheses ( ) are the data format.


Note: CPU software version V08 or later are applicable. (Limitation of SPH2000)

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

3) Memory capacity needed to use the 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.

4) Description of parameters (terminal)

Parameter name Data type Type Description


Write request REQ BOOL Input At the rising edge of this signal, data is written to the file.
File name FILE_NAME _F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
ARRAY The drive name is not needed.
• A file name consists of 64 characters including an extension (in
shift JIS code). (Note)
• Use STR_TO_SJ to create file names.
(See the program example on the following page.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 64
_F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
LF_ARRAY The drive name is not needed.
• A file name consists of 255 characters including an extension (in
shift JIS code)
• Use _F_CREATE_FILE_NAME to create file names.
(See 5) Sample program in (8) File name creation.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 127
Title TITLE _F_TP_TITLE_ I/O Specify the title to write to the first line of the CSV file.
ARRAY * Array data type of WORD type with element Nos. 0 to 250
Subtitle SUB_TITLE _F_TP_TITLE_ I/O Specify the subtitle to write to the second line of the CSV file.
ARRAY * Array data type of WORD type with element Nos. 0 to 250
No. of rows to ROW UINT Input Specify the number of rows of data to write (max. 10).
write
No. of columns COL UINT Input Specify the number of columns of data to write (max. 100).
per row
Write data WD _F_TP_2ARRAY_ I/O Store the data to write here.
DATA * Array data type of DINT type with element Nos. 0 to 999
Write end DONE BOOL Output Set ON for one scan when the file write is successfully completed.
Write error ERROR BOOL Output Set ON for one scan if the file write is unsuccessfully completed.
Status STATUS DWORD Output Outputs a status in DWORD that indicates the cause of the error if
the file write is failed. *For details, see “9) Error status.”
File size after FILE_BYTE UDINT Output Outputs the size of the file after writing, in bytes.
write _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-92
Section 2 Programming Language User ROM card expansion FB

5) Sample program

WD_DATA (DINT) 32-bit 8-digit data


WD_DATA(0) 1
WD_DATA(1) 2
WD_DATA(2) 3
| 4
| 5
| 6
7
8
9

Specify the number


of rows.  (Max. 10 rows)
Specify the number
of colums per row.  (Max. 100 elements)

User ROM card

SD

COMPACTFLASH or

FILE NAME 

TITLE 
SUB_TITLE 

Data 

2-93
Section 2 Programming Language User ROM card expansion FB

(2) CSV file read _F_READ_CSV_DINT/_F_READ_CSV_DINT_LF


These FBs read a CSV-format file from the user ROM card into SPH_CPU.

1) FB format

Parameter Parameter

_F_READ_CSV_DINT
Read request (BOOL) REQ DONE (BOOL) Read end

ERROR (BOOL) Read error

STATUS (DWORD) Status

File name (_F_TP_FNAME_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_ARRAY) File name

Row position to read (UINT) ROW

No. of columns per row (UINT) COL

Read data (_F_TP_1ARRAY_DATA) RD RD (_F_TP_1ARRAY_DATA) Read data

_F_READ_CSV_DINT_LF
Note)
Read request (BOOL) REQ DONE (BOOL) Read end

ERROR (BOOL) Read error

STATUS (DWORD) Status

File name (_F_TP_FNAME_LF_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_LF_ARRAY) File name

Row position to read (UINT) ROW

No. of columns per row (UINT) COL

Read data (_F_TP_1ARRAY_DATA) RD RD (_F_TP_1ARRAY_DATA) Read data

* Words in parentheses ( ) are the data format.


Note: CPU software version V08 or later are applicable. (Limitation of SPH2000)

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.

3) Memory capacity needed to use the FB

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

4) Description of parameters (terminal)

Parameter name Data type Type Description


Read request REQ BOOL Input At the rising edge of this signal, file read is executed.
File name FILE_NAME _F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
ARRAY The drive name is not needed.
• A file name consists of 64 characters including an extension
(in shift JIS code). (Note)
• Use STR_TO_SJ to create file names.
(See the program example on the following page.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 64
_F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
LF_ARRAY The drive name is not needed.
• A file name consists of 255 characters including an extension
(in shift JIS code).
• Use _F_CREATE_FILE_NAME to create file names.
(See 5) Sample program in (8) File name creation.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below..
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 127
Row position to ROW UINT Input Specify the row position to read.
read (Specify after the row position 3 or greater.)
No. of columns COL UINT Input Specify the number of columns of data to read
per row (Max. 100 columns).
Read data RD _F_TP_1ARRAY I/O Converts the read data to DINT type and stores it.
DATA * Array data type of DINT type with the element Nos. 0 to 999
Read end DONE BOOL Output Set ON for one scan when the file read is successfully completed.
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.

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

User ROM card


Row 1 
SD
Row 2 
COMPACTFLASH or
Row 3 
Row 4 
Row 5 
Row 6 

Overwritten for the read data


from the head of “RD.”
Specify the row position. 
RD_DATA
Specify the number
of colums per row.  RD_DATA(0) 10
RD_DATA(1) 11
RD_DATA(2) 12
| *******
| *******
| *******

2-96
Section 2 Programming Language User ROM card expansion FB

(3) CSV file data append _F_APPEND_CSV_DINT/_F_APPEND_CSV_DINT_LF


These FBs append and write one row of data to the existing CSV file. The maximum size of a file is 1MB.

1) FB format

Parameter Parameter

_F_APPEND_CSV_DINT
Append request (BOOL) REQ DONE (BOOL) Append end

ERROR (BOOL) Append error

STATUS (DWORD) Status

File name (_F_TP_FNAME_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_ARRAY) File name

Append data (_F_TP_1ARRAY_DATA) WD WD (_F_TP_1ARRAY_DATA) Append data

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

ERROR (BOOL) Append error

STATUS (DWORD) Status

File name (_F_TP_FNAME_LF_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_LF_ARRAY) File name

Append data (_F_TP_1ARRAY_DATA) WD WD (_F_TP_1ARRAY_DATA) Append data

No. of columns to append (UINT) COL FILE_BYTE_SIZE (UDINT) File size after append

* Words in parentheses ( ) are the data format.


Note: CPU software version V08 or later are applicable. (Limitation of SPH2000)

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.

3) Memory capacity needed to use the FB

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

4) Description of parameters (terminal)

Parameter name Data type Type Description


Append request REQ BOOL Input At the rising edge of this signal, one row of data is appended to
the end of the file in CSV format..
File name FILE_NAME _F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
ARRAY The drive name is not needed.
• A file name consists of 64 characters including an extension (in
shift JIS code). (Note)
• Use STR_TO_SJ to create file names.
(See the program example on the following page.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 64
_F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
LF_ARRAY The drive name is not needed.
• A file name consists of 255 characters including an extension (in
shift JIS code)
• Use _F_CREATE_FILE_NAME to create file names.
(See 5) Sample program in (8) File name creation.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 127
Append data WD _F_TP_1ARRAY_ Input Store the data to append here. (Max. 100 per row)
DATA
No. of columns COL UINT I/O Specify the number of columns of data to append (max. 100).
to append
Append end DONE BOOL Output Set ON for one scan when the append is successfully completed.
Append error ERROR BOOL Output Set ON for one scan if the append is unsuccessfully completed.
Status STATUS DWORD Output Outputs a status in DWORD that indicates the cause of the error if
the file write is failed, .
* See "9) Error status" for details.
File size after FILE_BYTE UDINT Output Outputs the size of the file after append, in bytes.
append _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-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

Specify the number of 


columns to append.

User ROM card

SD

COMPACTFLASH or

Final row 

2-99
Section 2 Programming Language User ROM card expansion FB

(4) CSV file data append _F_APPEND/_F_APPEND_LF


These FBs append data in binary file format to the end of a file in the user ROM card.
The CSV file format is not supported. The maximum size of a file is 1MB.

1) FB format

Parameter Parameter

_F_APPEND
Append request (BOOL) REQ DONE (BOOL) Append end

ERROR (BOOL) Append error

STATUS (DWORD) Status

File name (_F_TP_FNAME_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_ARRAY) File name


Append data size (UDINT) SIZE FLE_BYTE_SIZE (UDINT) File size after append

Append data (_F_TP_APPEND_DATA) WD WD (_F_TP_APPEND_DATA) Append data

_F_APPEND_LF
Note)
Append request (BOOL) REQ DONE (BOOL) Append end

ERROR (BOOL) Append error

STATUS (DWORD) Status

File name (_F_TP_FNAME_LF_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_LF_ARRAY) File name

Append data size (UDINT) SIZE FLE_BYTE_SIZE (UDINT) File size after append

Append data (_F_TP_APPEND_DATA) WDD WD (_F_TP_APPEND_DATA) Append data

* Words in parentheses ( ) are the data format.


Note: CPU software version V08 or later are applicable. (Limitation of SPH2000)

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.

3) Memory capacity needed to use the FB

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

4) Description of parameters (terminal)

Parameter name Data type Type Description


Append request REQ BOOL Input At the rising edge of this signal, data is written to the file.
File name FILE_NAME _F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
ARRAY The drive name is not needed.
• A file name consists of 64 characters including an extension (in
shift JIS code). (Note)
• Use STR_TO_SJ to create file names.
(See the program example on the following page.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 64
_F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
LF_ARRAY The drive name is not needed.
• A file name consists of 255 characters including an extension (in
shift JIS code)
• Use _F_CREATE_FILE_NAME to create file names.
(See 5) Sample program in (8) File name creation.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 127
Append data SIZE UDINT Input Specify the size of data to append in words.
size (Max. 1000 words)
Append data WD _F_TP_APPEND_ I/O Store the data to append as DINT type data.
DATA * Array data type of DINT type with the element Nos. 0 to 499
Append end DONE BOOL Output Set ON for one scan when the append is successfully completed.
Append error ERROR BOOL Output Set ON for one scan if the append is unsuccessfully completed.
Status STATUS DWORD Output Outputs a status in DWORD that indicates the cause of the error if
the append is failed, .
* See "9) Error status" for details.
File size after FILE_BYTE UDINT Output Outputs the size of the file after append, in bytes.
append _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-101
Section 2 Programming Language User ROM card expansion FB

(5) File delete _F_DELETE/_F_DELETE_LF


These FBs delete the specified file on the user ROM card.

1) FB format

Parameter Parameter

_F_DELETE
Delete request (BOOL) REQ DONE (BOOL) Delete end

ERROR (BOOL) Delete error

STATUS (DWORD) Status

File name (_F_TP_FNAME_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_ARRAY) File name

_F_DELETE_LF
Note)
Delete request (BOOL) REQ DONE (BOOL) Delete end

ERROR (BOOL) Delete error

STATUS (DWORD) Status

File name (_F_TP_FNAME_LF_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_LF_ARRAY) File name

* Words in parentheses ( ) are the data format.


Note: CPU software version V08 or later are applicable. (Limitation of SPH2000)

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.

3) Memory capacity needed to use the FB

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

4) Des cription of parameters (terminal)

Parameter name Data type Type Description


Delete request REQ BOOL Input At the rising edge of this signal, the file is deleted.
File name FILE_NAME _F_TP_FNAME_ I/O Specify the file name to be deleted by the folder + file name
ARRAY format. The drive name is not needed.
• A file name consists of 64 characters including an extension (in
shift JIS code). (Note)
• Use STR_TO_SJ to create file names.
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 64
_F_TP_FNAME_ I/O Specify the file name to be deleted by the folder + file name
LF_ARRAY format. The drive name is not needed.
• A file name consists of 255 characters including an extension (in
shift JIS code)
• Use _F_CREATE_FILE_NAME to create file names.
(See 5) Sample program in (8) File name creation.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 127
Delete end DONE BOOL Output Set ON for one scan when the deletion is successfully completed.
Delete error ERROR BOOL Output Set ON for one scan if the deletion is unsuccessfully completed.
Status STATUS DWORD Output Outputs a status in DWORD that indicates the cause of the error if
the append is failed, .
* See "9) Error status" for details.

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

(6) File read with offset _F_OFFSET_READ/_F_OFFSET_READ_LF


These FBs read data from the specified file in the specified folder on the user ROM written by “F_WRITE” FB. Specify the offset
position from the head of the data and read size.

1) FB format

Parameter Parameter

_F_OFFSET_READ
Read request (BOOL) REQ DONE (BOOL) Read end

ERROR (BOOL) Read error

STATUS (DWORD) Status

File name (_F_TP_FNAME_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_ARRAY) File name

Read start offset (UDINT) BYTE_OFFSET DONE_BYTE_SIZE (UDINT) Read data size

Read data size (UDINT) SIZE

Read data (_F_TP_READ_DATA) RD RD (_F_TP_READ_DATA) Read data

_F_OFFSET_READ_LF
Note)
Read request (BOOL) REQ DONE (BOOL) ead end

ERROR (BOOL) Read error

STATUS (DWORD) Status

File name (_F_TP_FNAME_LF_ARRAY) FILE_NAME FILE_NAME (_F_TP_FNAME_LF_ARRAY) File name

Read start offset (UDINT) BYTE_OFFSET DONE_BYTE_SIZE (UDINT) Read data size

Read data size (UDINT) SIZE

Read data (_F_TP_READ_DATA) RD RD (_F_TP_READ_DATA) Read data

* Words in parentheses ( ) are the data format.


Note: CPU software version V08 or later are applicable. (Limitation of SPH2000)

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.

3) Memory capacity needed to use the FB

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

4) Description of parameters (terminal)

Parameter name Data type Type Description


Read request REQ BOOL Input At the rising edge of this signal, file read is executed.
File name FILE_NAME _F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
ARRAY The drive name is not needed.
• A file name consists of 64 characters including an extension
(in shift JIS code). (Note)
• Use STR_TO_SJ to create file names.
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below.
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 64
_F_TP_FNAME_ I/O Specify the destination file name by the folder + file name format.
LF_ARRAY The drive name is not needed.
• A file name consists of 255 characters including an extension
(in shift JIS code).
• Use _F_CREATE_FILE_NAME to create file names.
(See 5) Sample program in (8) File name creation.)
• The following project-operation file is created on the user ROM
card. Do not use the file or folder names below..
File name: PASSWORD.DAT
Folder names: \PROJECT, \OTHER
* Array data type of WORD type with element Nos. 0 to 127
Read start BYTE_ UINT Input Specify the start position of data to be read by the offset position
offset OFFSET from the head of the data (in bytes).
Read size SIZE UINT Input Specify the size of data to read in words.
Read data RD _F_TP_READ_ I/O Stores the read data.
DATA
DONE BOOL Output Set ON for one scan when the file read is successfully completed.
Read end

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

The first character of the title is counted as the byte 0.

Reading start offset



Row 1  0 1 2 3 4 5 6 7 8 9 10
Row 2  Row 1 
Row 3 
Row 2 
Row 3 

A newline is CR or LF (OD or 0A).

User ROM card

SD

COMPACTFLASH or

Specify reading start offset


(byte No. from the head [0]).

Specify No. of words


to be read.

The table below shows the contents of the read arrays


represented in DWORD.

DWORD representation ASCII representation


RD_DATA[0] 0A 0D 41 54 LF CR AM T
RD_DATA[1] 4F 4D 45 44 O M E D
RD_DATA[2] 54 41 44 5F T A D _
RD_DATA[3] 30 0A 0D 41 0 LF CR A
RD_DATA[4] 32 2C 31 2C 2 , 1 ,

Note: The data order (upper and lower) is reversed.

2-106
Section 2 Programming Language User ROM card expansion FB

(7) Free capacity read _F_GET_DRV_SIZE


This FB reads the total capacity and free capacity of the user ROM card mounted on the CPU module in units of 1000 bytes.

1) FB format

Parameter Parameter

_F_GET_DRV_SIZE
Read request (BOOL) REQ DONE (BOOL) Read end

ERROR (BOOL) Read error

STATUS (DWORD) Status

TOTAL_KBYTE_SIZE (UDINT) Total memory capacity

FREE_KBYTE_SIZE (UDINT) Free memory capacity

* Words in parentheses ( ) are the data format.

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

3) Memory capacity needed to use the FB

Memory name Memory capacity


Program memory Approx. 0.4K steps
Standard or retain memory Approx. 20 words
User FB instance memory Approx. 150 words
System FB instance memory Approx. 20 words

4) Description of parameters (terminal)

Parameter name Data type Type Description


Read request REQ BOOL Input At the rising edge of this signal, file read is executed.
Read end DONE BOOL Output Set ON for one scan when the file read is successfully completed.
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.
Total memory TOTAL_ UDINT Output Stores the total memory capacity of the user ROM card in units of
capacity KBYTE_SIZE 1000 bytes.
Free memory FREE_ UDINT Output Stores the free memory capacity of the user ROM card in units of
capacity KBYTE_SIZE 1000 bytes.

2-107
Section 2 Programming Language User ROM card expansion FB

(8) File name create _F_CREATE_FILE_NAME


This FB creates file names (consisting of 255 shift JIS characters) for user ROM card expansion FBs that support long file
names (e.g. _F_WRITE_CSV_DINT_LF and _F_READ_CSV_DINT_LF).

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)

* Words in parentheses ( ) are the data format.


Note: CPU software version V08 or later are applicable. (Limitation of SPH2000)

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.

3) Memory capacity needed to use the FB

Memory name Memory capacity


Program memory Approx. 0.4K steps
Standard or retain memory Approx. 540 words
User FB instance memory Approx. 890 words
System FB instance memory 0 word

4) Description of parameters (terminal)

Parameter name Data type Type Description


File name creation REQ BOOL Input At the rising edge of this signal, character strings are
request concatenated and the file name is created.
Concatenated F_NAME_1 STRING I/O Specify the file name by “folder name” + “file name.”
character string 1
| |

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.

(*Write execution judgment*)


(*No write request is accepted during write processing*)

Write request Write Write request is ignored during


001 IN In process execution file access processing.
/

(*Log number creation for file name creation*)


(*Incremented when a write is executed*)

SEL_UINT
EN END

Write execution C Log number UINT_TO_STR


UINT
ADD Log number EN END
EN END IN0
UINT Log number Log number
Log number UINT STR
IN1
UINT
UINT#1

(*File name creation*)


_F_CREATE_FILE_NAME_1
_F_CREATE_FILE_NAME_
Write execution REQ ERROR File name create error
(*Log file storage folder*) FName_1 F_NAME_1 F_NAME_1
(*Head character of log file name*) FName_2 F_NAME_2 F_NAME_2
File name creation is performed only during
(*Number of log file name part*) Log number STR F_NAME_3 F_NAME_3 write execution so that there will be no
(*Extension part* FName_4 F_NAME_4 F_NAME_4 change while processing the file access FB.
(*NULL*) F_NAME_NULL F_NAME_5 F_NAME_5
(*NULL*) F_NAME_NULL F_NAME_6 F_NAME_6
File name F_NAME_OUT F_NAME_OUT File name

(*File write processing*)


F_WRITE_1
Write Name creation
002 execution failure F_WRITE
/ REQ DONE Write DONE
UINT#254 MODULE_NO ERROR Write ERR
STATUS Status
File name FILE_NAME FILE_NAME
UINT#30 SIZE
Write data WD WD Write data

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

(9) Error status


The statuses of the user ROM card FBs are output in DWORD format. The table below shows the formats of the statuses.

Status Name Cause


Exchange data storage Occurs when not enough area is present when an attempt is made to store the data,
13000001h
area fault changed to DINT format, in CPU memory.
Occurs when file cannot be accessed because another file access FB or loader is
File being accessed
14000001h accessing it.
File access limit Occurs when file cannot be accessed because file access limit (max is 5 files) has been
14000002h
exceeded exceeded.
21000001h Area specification fault Occurs when specified area exceeds memory boundaries.
21000002h File name length fault Occurs when specified file name string is 0 characters, or exceeds 64 characters.
22000001h File name fault Occurs when specified file name string contains illegal characters ( \ / : ; * ? < > | ).
22000002h File name not set Occurs when file name is not set.
22000003h Append size fault Occurs when data to be appended by F_APPEND exceeds 1000 words.
Structure definition
23000001h Occurs when an error code is stored in structure definition data.
error
Occurs when character codes that cannot be converted to CSV (non-Shift JIS Codes)
23000002h CSV conversion fault
are detected.
Matrix specification
23000003h Occurs when there is a fault in specification of the matrix or number of elements.
fault
TITLE character string
23000004h Occurs when length of TITLE or SUB_TITLE character strings exceed 512 bytes.
byte length fault
Occurs when user ROM card is not inserted in the CPU module, or a faulty user ROM
32000002h User ROM card not set
card is inserted.
Read-out data storage
32000003h Occurs when data size is larger than read-out data storage area.
area fault
User ROM card access
32000004h Occurs when a faulty value is detected from the user ROM card while accessing it.
fault
32000005h User ROM write protect Occurs when the target file or folder is set to non-writeable.
During read-out, delete or CSV append operations, occurs when the specified file does
32000006h File specification fault
not exist.
32000008h User ROM card fault Occurs when user ROM card file system is corrupt.
No free space in user Occurs when writing cannot be performed because there is no free space in user ROM
32000009h
ROM card card.
32001001h File size exceeded Occurs when an attempt is made to append to a file over 1Mbyte in size.
Occurs when illegal character codes that cannot be converted to CSV are detected, or
33000002h CSV file fault
when a line in the CSV file exceeds the control value.
CSV/structure definition
33000003h Number of CSV file sequences < Structure definition
mismatch
CSV element
33000004h Occurs when the element specified by the CSV element specification does not exist.
specification fault

2-110
Section 2 Programming Language FCT

2-4-6 Function summary


Functions are supported by the IL, ST, LD, and FBD languages. The operation of a function remains the same for these
languages.

(1) Symbols used in the function summary

Instruction Name No. of steps Page

Input data type Output data type

REAL SQRT REAL Square root SQRT 3 P2-155

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

Some functions use


terminal names.

Data type of ADD


the 1st input ANY_NUM ANY_NUM
Data type of ANY_NUM
the 2nd input
2 x number
Arithmetic addition ADD of input P2-160
Indicates that input
operands
can be extended.
Data type of ANY_NUM
the nth input

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

(2) Describing a function in the IL language


To describe a function call in the IL language, specify, as the first input, the current operation result and, as the operator, the
function call instruction (function name) that specifies the second and subsequent inputs as operands.

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.

<Representation in FBD or LD language> <Representation in IL language>

ADD LD IN1
IN1 OUT
ADD IN2
IN2
ADD IN3
IN3
ADD IN4
IN4
ADD IN5
IN5
ST OUT

(3) Describing a function in the ST language


1) 1-input function
“Area for storing operation result” := SQRT (“Input”);
2) 2-input function
“Area for storing operation result” := LEFT
(“First input,” “Second input”);
3) 3-input function
“Area for storing operation result” := SEL
(“First input,” “Second input,” “Third input”);

2-112
Section 2 Programming Language FCT

(4) Specification of enable flags (EN/ENO)


In D300win V2.0 or later, the start operation terminal EN and result terminal ENO can be used for the functions in the graphic
language.

<Example of a function with EN/ENO>

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.

Note: See the descriptions of functions, for EN/ENO behavior.

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

Checking here enables EN/ENO for the function


newly added. Note that for the existing functions,
EN/ENO remains disabled.

2-113
Section 2 Programming Language FCT

<Numbers of function steps with EN/ENO enabled>


The numbers of function steps with EN/ENO enabled are shown below.
1) When variables are associated with both of EN/ENO terminals, the number of steps increases by three.

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

<IL language when any function with EN/ENO enabled is uploaded>


When a function with EN/ENO enabled is uploaded from the CPU, LDE and STE IL operators are added. Conversion of IL to
LD/FBD returns the function to its original format.

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

<Considerations in using functions with EN/ENO enabled>


1) Using user functions
When the circuitry shown in the diagram below is created by using a user function, S2 is assigned to the temporary area. If
a variable A associated with the EN terminal is set to “OFF,” an S2 value is undefined.

User function
A MOVE
EN ENO
S1 S2

2) Using programs and user function blocks


When the circuitries shown in the diagrams below are created by using a program or user function block, portion C is
assigned to the temporary area. If a variable B associated with the EN terminal is set to “OFF,” C is undefined, resulting in
S4 and S5 being undefined. In any such case, take either one of actions 1 and 2.

MOVE MOVE
B EN ENO EN ENO
C
S3 S4

When B is set to “OFF,” unchanged.


MOVE
EN ENO
S5

<Action 1> Connect EN/ENO.

MOVE MOVE
B EN ENO EN ENO
S3 S4

When B is set to “OFF,” unchanged.


MOVE
EN ENO
S5

<Action 2> Use a variable explicitly for portion C.

MOVE MOVE
B EN ENO EN ENO
S3 S30 S30 S4

When B is set to “OFF,” unchanged.


MOVE
EN ENO
S30 S5

2-115
Section 2 Programming Language Type conversion FCT

(5) Function summary


The functions that are supported by the MICREX-SX series are classified into the following categories:

Function IEC standard functions Type conversion functions

Arithmetic functions

Bit string functions

Selection/comparison functions

String functions

Time type data functions

Original functions (unique to the MICREX-SX series)

1) Type conversion functions

Instruction Name No. of steps Page

DINT DINT_TO_INT INT Type conversion DINT_TO _INT 3 P2-182

UINT UINT_TO_INT INT Type conversion UINT_TO _INT 3 P2-182

UDINT UDINT_TO_INT INT Type conversion UDINT_TO _INT 3 P2-183

REAL REAL_TO_INT INT Type conversion REAL_TO _INT 3 P2-183

TIME TIME_TO_INT INT Type conversion TIME_TO _INT 3 P2-184

WORD WORD_TO_INT INT Type conversion WORD_TO _INT 3 P2-184

INT INT_TO_DINT DINT Type conversion INT_TO _DINT 3 P2-185

UINT UINT_TO_DINT DINT Type conversion UINT_TO _DINT 3 P2-185

UDINT UDINT_TO_DINT DINT Type conversion UDINT_TO _DINT 3 P2-186

REAL REAL_TO_DINT DINT Type conversion REAL_TO _DINT 3 P2-186

TIME TIME_TO_DINT DINT Type conversion TIME_TO _DINT 3 P2-187

DWORD DWORD_TO_DINT DINT Type conversion DWORD_TO _DINT 3 P2-187

2-116
Section 2 Programming Language Type conversion FCT

Instruction Name No. of steps Page

INT INT_TO_UINT UINT Type conversion INT_TO _UINT 3 P2-188

DINT DINT_TO_UINT UINT Type conversion DINT_TO _UINT 3 P2-188

UDINT UDINT_TO_UINT UINT Type conversion UDINT_TO _UINT 3 P2-189

REAL REAL_TO_UINT UINT Type conversion REAL_TO _UINT 3 P2-189

TIME TIME_TO_UINT UINT Type conversion TIME_TO _UINT 3 P2-190

WORD WORD_TO_UINT UINT Type conversion WORD_TO _UINT 3 P2-190

INT INT_TO_UDINT UDINT Type conversion INT_TO _UDINT 3 P2-191

DINT DINT_TO_UDINT UDINT Type conversion DINT_TO _UDINT 3 P2-191

UINT UINT_TO_UDINT UDINT Type conversion UINT_TO _UDINT 3 P2-192

REAL REAL_TO_UDINT UDINT Type conversion REAL_TO _UDINT 3 P2-192

TIME TIME_TO_UDINT UDINT Type conversion TIME_TO _UDINT 3 P2-193

DWORD DWORD_TO_UDINT UDINT Type conversion DWORD_TO _UDINT 3 P2-193

DT DT_TO_UDINT UDINT Type conversion DT_TO _UDINT 3 P2-194

DATE DATE_TO_UDINT UDINT Type conversion DATE_TO _UDINT 3 P2-194

TOD TOD_TO_UDINT UDINT Type conversion TOD_TO _UDINT 3 P2-195

INT INT_TO_REAL REAL Type conversion INT_TO _REAL 3 P2-195

2-117
Section 2 Programming Language Type conversion FCT

Instruction Name No. of steps Page

DINT DINT_TO_REAL REAL Type conversion DINT_TO _REAL 3 P2-196

UINT UINT_TO_REAL REAL Type conversion UINT_TO _REAL 3 P2-196

UDINT UDINT_TO_REAL REAL Type conversion UDINT_TO _REAL 3 P2-197

TIME TIME_TO_REAL REAL Type conversion TIME_TO _REAL 3 P2-197

WORD WORD_TO _BOOL BOOL Type conversion WORD_TO _BOOL 3 P2-198

DWORD DWORD_TO_BOOL BOOL Type conversion DWORD_TO _BOOL 3 P2-198

BOOL BOOL_TO _WORD WORD Type conversion BOOL_TO _WORD 3 P2-199

DWORD DWORD_TO_WORD WORD Type conversion DWORD_TO _WORD 3 P2-199

INT INT_TO_WORD WORD Type conversion INT_TO_WORD 3 P2-200

UNIT UNIT_TO_WORD WORD Type conversion UINT_TO_WORD 3 P2-200

BOOL BOOL_TO _DWORD DWORD Type conversion BOOL_TO _DWORD 3 P2-201

WORD WORD_TO_DWORD DWORD Type conversion WORD_TO _DWORD 3 P2-201

DINT DINT_TO_DWORD DWORD Type conversion DINT_TO _DWORD 3 P2-202

UDINT UDINT_TO_DWORD DWORD Type conversion UDINT_TO _DWORD 3 P2-202

INT INT_TO_TIME TIME Type conversion INT_TO _TIME 3 P2-203

DINT DINT_TO_TIME TIME Type conversion DINT_TO _TIME 3 P2-203

2-118
Section 2 Programming Language Type conversion FCT

Instruction Name No. of steps Page

UINT UINT_TO_TIME TIME Type conversion UINT_TO _TIME 3 P2-204

UDINT UDINT_TO_TIME TIME Type conversion UDINT_TO _TIME 3 P2-204

REAL REAL_TO_TIME TIME Type conversion REAL_TO _TIME 3 P2-205

UDINT UDINT_TO_DT DT Type conversion UDINT_TO _DT 3 P2-205

UDINT UDINT_TO _DATE DATE Type conversion UDINT_TO _DATE 3 P2-206

UDINT UDINT_TO_TOD TOD Type conversion UDINT_TO _TOD 3 P2-206

REAL TRUNC_INT INT Truncation TRUNC_INT 3 P2-207

REAL TRUNC_DINT DINT Truncation TRUNC_DINT 3 P2-207

REAL TRUNC_UINT UINT Truncation TRUNC_UINT 3 P2-208

REAL TRUNC_UDINT UDINT Truncation TRUNC_UDINT 3 P2-208

WORD W_BCD_TO _INT INT BCD conversion W_BCD_TO _INT 3 P2-209

DWORD D_BCD_TO _INT INT BCD conversion D_BCD_TO _INT 3 P2-209

WORD W_BCD_TO _DINT DINT BCD conversion W_BCD_TO _DINT 3 P2-210

DWORD D_BCD_TO _DINT DINT BCD conversion D_BCD_TO _DINT 3 P2-210

INT INT_TO _W_BCD WORD BCD conversion INT_TO _W_BCD 3 P2-211

DINT DINT_TO _W_BCD WORD BCD conversion DINT_TO _W_BCD 3 P2-211

2-119
Section 2 Programming Language Type conversion FCT

Instruction Name No. of steps Page

INT INT_TO_DWORD DWORD BCD conversion INT_TO _D_BCD 3 P2-212

DINT DINT_TO_DWORD DWORD BCD conversion DINT_TO _D_BCD 3 P2-212

2-120
Section 2 Programming Language Arithmetic FCT

2) Arithmetic functions

Instruction Name No. of steps Page

INT ABS_INT INT Absolute value ABS _INT 3 P2-154

DINT ABS_DINT DINT Absolute value ABS _DINT 3 P2-154

REAL ABS_REAL REAL Absolute value ABS _REAL 3 P2-155

REAL SQRT REAL Square root SQRT 3 P2-155

REAL LN REAL Natural logarithm LN 3 P2-156

REAL LOG REAL Common logarithm LOG 3 P2-155

REAL EXP REAL Exponent EXP 3 P2-157

REAL SIN REAL Sine SIN 3 P2-157

REAL COS REAL Cosine COS 3 P2-158

REAL TAN REAL Tangent TAN 3 P2-158

REAL ASIN REAL Arc sine ASIN 3 P2-159

REAL ACOS REAL Arc cosine ACOS 3 P2-159

REAL ATAN REAL Arc tangent ATAN 3 P2-160

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

Instruction Name No. of steps Page

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

ANY MOVE ANY Move MOVE 4 P2-163

ANY_NUM NEG ANY_NUM Negation NEG 3 P2-164

2-122
Section 2 Programming Language Bit string FCT

3) Bit string functions

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

XOR
ANY_BIT ANY_BIT
ANY_BIT No. of input
• Exclusive XOR P2-170
operands + 1


ANY_BIT

ANY_BIT NOT ANY_BIT Logical negation NOT 3 P2-170

BOOL NOT_BOOL BOOL Negation NOT_BOOL 3 P2-171

WORD NOT_WORD WORD Negation NOT_WORD 3 P2-171

DWORD NOT_BOOL DWORD Negation NOT_DWORD 3 P2-172

2-124
Section 2 Programming Language Selection/comparison FCT

4) Selection/comparison functions

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

STRING LEN INT Get length LEN 3 P2-213

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

Instruction Name No. of steps Page

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

6) Time type data functions

Instruction Name No. of steps Page

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

Instruction Name No. of steps Page

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

DT DT_TO_TOD TOD Convert DT to TOD DT_TO_TOD 5 P2-226

DT DT_TO_DATE DATE Convert DT to DATE DT_TO_DATE 6 P2-226

2-132
Section 2 Programming Language Original FCT

7) Original FCTs (Functions)

Instruction Name No. of steps Page

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

UINT DECODE_WORD WORD Decode DECODE_WORD 3 P2-139

UINT DECODE_DWORD DWORD Decode DECODE_DWORD 4 P2-139

WORD ENCODE_WORD UINT Encode ENCODE_WORD 3 P2-139

DWORD ENCODE_DWORD UINT Encode ENCODE_DWORD 4 P2-140

WORD BITCOUNT_WORD UINT Bit count BITCOUNT_WORD 3 P2-140

DWORD BITCOUNT_DWORD UINT Bit count BITCOUNT_DWORD 3 P2-140

STRING STR_TO_UINT UINT Convert string to number STR_TO_UINT 3 P2-141

UINT UINT_TO_STR STRING Convert number to string UINT_TO_STR 3 P2-141

2-133
Section 2 Programming Language Original FCT

Instruction Name No. of steps Page

ARRAY OF WORD SJ_TO_STR STRING Convert shift-JIS to string SJ_TO_STR 10 P2-142

STRING STR_TO_SJ ARRAY OF WORD Convert string to shift-JIS STR_TO_SJ 10 P2-142

STRING BYTE_LEN INT Byte length BYTE_LEN 3 P2-143

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

Instruction Name No. of steps Page

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

MULL Lower-order digit in 64-bit multiplication


DINT IN1 DINT 5 P2-150
MULL
DINT IN2

MULU Upper-order digit in 64-bit multiplication


DINT IN1 DINT 5 P2-150
MULU
DINT IN2

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

SLCO Carry after 32 bits shift left SLCO 4 P2-152


DWORD BOOL

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

2-4-7 Original FCTs (Functions)


(1) Set bit SBIT_WORD

Name, Symbol, Function Example


<Operation>
Name

SBIT_WORD • When bit “N” is read normally

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

(1) SBIT_WORD sets the “Nth” bit of “IN”


Function

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.

(2) Set bit SBIT_DWORD

Name, Symbol, Function Example


<Operation>
Name

SBIT_DWORD • When bit “N” is read normally

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

(3) Reset bit RBIT_WORD

Name, Symbol, Function Example


<Operation>
Name

RBIT_WORD • When bit “N” is read normally

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

(1) RBIT_WORD resets the “Nth” bit of “IN”


Function

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.

(4) Reset bit RBIT_DWORD

Name, Symbol, Function Example


<Operation>
Name

RBIT_DWORD • When bit “N” is read normally

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

(5) Test bit TBIT_WORD

Name, Symbol, Function Example


<Operation>
Name

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

“IN” (WORD type) and outputs a BOOL 0 ENO=1


BOOL 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 tested
when N = 16 and bit 1 is tested when =17.

(6) Test bit TBIT_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) TBIT_DWORD tests (1 or 0) the “Nth” bit Test


Function

of “IN” (DWORD type) and outputs a BOOL


BOOL type data. 0 ENO=1
(2) Available data type for “IN” is UINT type.
(3) The lowest-order 5 bits of “N” are
significant. For example, bit 0 is tested
when N = 32 and bit 1 is tested when N = 33.

2-138
Section 2 Programming Language Original FCT

(7) Decode DECODE_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) DECODE_WORD outputs WORD type


Function

data with the bit position designated by


the input (UINT type data) set on.
(2) The lowest-order 4 bits of input are
significant. For example, bit 0 is set on
when the input is 16 and bit 1 is set on
when the input is 17.

(8) Decode DECODE_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

type data with the bit position designated


by the input (UINT type data) set on.
(2) The lowest-order 5 bits of the input are
significant. For example, bit 0 is set on
when the input is 32 and bit 1 is set on
when the input is 33.

(9) Encode ENCODE_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) ENCODE_WORD outputs a UINT type


Function

data that indicates the lowest-order bit


position of the input (WORD type data)
that is set on.
(2) 16 is output if there is no bit in the input
word that is set on.

2-139
Section 2 Programming Language Original FCT

(10) Encode ENCODE_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

data that indicates the lowest-order bit


position of the input (DWORD type data)
that is set on.
(2) 32 is output if there is no bit in the input
word that is set on.

(11) Bit count BITCOUNT_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) BITCOUNT_WORD outputs a UINT type


Function

data that indicates the number of on bits


in the input (WORD type data).

(12) Bit count BITCOUNT_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

type data that indicates the number of on


bits in the input (DWORD type data).

2-140
Section 2 Programming Language Original FCT

(13) Convert string to number STR_TO_UINT

Name, Symbol, Function Example


<Operation>
Name

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

data to UINT type data.


(2) The STRING type data must be made up STRING ‘123F’ EN=1
of 1-byte numerals from “0” to “9.” A 0 is
output and ENO is set to 0 if the STRING Convert
type data contains a character other than
“0” through “9.” UINT 0 ENO=0
(3) If the conversion result exceeds the limit
value range of the UINT type, the upper • When the input data exceeds the limit value range of UINT type
limit value of the UINT type is output and
ENO is set to 0. STRING ‘123456’ EN=1
(Upper limit value: 65535)
(4) 2-byte characters are not regarded as Convert
numerals. The output is set to 0 and ENO
is set to 0 if a 2-byte numeral is UINT 65535 ENO=0
encountered.

(14) Convert number to string UINT_TO_STR

Name, Symbol, Function Example


<Operation>
Name

UINT_TO_STR
UINT 1234 EN=1
Symbol

Convert
UINT UINT_TO_STR STRING
STRING ‘1234’ ENO=1

(1) UINT_TO_STR converts UINT type data


Function

to STRING type data (1-byte numerals).

2-141
Section 2 Programming Language Original FCT

(15) Convert shift-JIS to string SJ_TO_STR

Name, Symbol, Function Example


<Operation>
Name

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.

(16) Convert string to shift-JIS STR_TO_SJ

Name, Symbol, Function Example


<Operation>
Name

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

to Shift-JIS code which is defined as an A4 82


array of WORD type data. A null code is 42 41
ENO=1
appended to the end of the output. 60 82
(2) The destination array area may contain xx 00
garbage data after the null code if the size
xx xx
of input is smaller than that of the array
xx xx
area.
(3) If the size of the destination array area is xx xx
smaller than that of the input, as many
Shift-JIS codes as fit in the array area are Note: Since a null code is placed at the end of the destination array
output with a null code at the end of the area, the size of the array area needs to be greater than the
array. ENO is also set to 0. number of input characters by 1 word.

2-142
Section 2 Programming Language Original FCT

(17) Byte length BYTE_LEN

Name, Symbol, Function Example


<Operation>
Name

BYTE_LEN
STRING EN=1
Symbol

STRING BYTE_LEN INT


Convert

INT 12 ENO=1

(1) BYTE_LEN outputs an INT type data that


Function

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.

(18) Dead band DBAND_INT

Name, Symbol, Function Example


<Operation>
Name

DBAND_INT
“DB”
When INT 3000 ,
Symbol

DBAND_INT “IN” (Output)


INT IN INT
INT DB
If INT 4000 , 1000
EN=1 ENO=1

“IN” (Output)
(1) DBAND_INT processes the input “DB” If INT 2000 , 0
Function

(INT type) as representing a dead band. EN=1 ENO=1


It outputs IN - |DB| if IN > |DB|, “IN” (Output)
IN + |DB| if IN < -|DB|, If INT -6000 , -3000
and a “0” in other cases.
EN=1 ENO=1

(+)

1000
-6000 -3000
(-) (+)
3000

-3000

(-)

2-143
Section 2 Programming Language Original FCT

(19) Dead band DBAND_DINT

Name, Symbol, Function Example


<Operation>
Name

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

(DINT type) as representing a dead band.


“IN” (Output)
It outputs IN - |DB| if IN > |DB|,
If DINT -6000 , -3000
IN + |DB| if IN < -|DB|,
and a “0” in the other cases. EN=1 ENO=1

(+)

1000
-6000 -3000
(-) (+)
3000

-3000

(-)

(20) Dead band DBAND_REAL

Name, Symbol, Function Example


<Operation>
Name

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

(REAL type) as representing a dead band.


“IN” (Output)
It outputs IN - |DB| if IN > |DB|,
If REAL -6.0E+3 , -3.0E+3
IN + |DB| if IN < -|DB|,
and a “0” in the other cases. EN=1 ENO=1

(2) The output value has an error which is


(+)
similar to those which occur during REAL
data additions or subtractions.

1000.0
-6000.0 -3000.0
(-) (+)
3000.0

-3000.0

(-)

2-144
Section 2 Programming Language Original FCT

(21) Bias BIAS_INT

Name, Symbol, Function Example


<Operation>
Name

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

as representing a bias. It outputs


“IN” (Output)
IN + |DZ| if IN > 0,
If INT -6000 , -9000
IN - |DZ| if IN < 0,
and a “0” in the other cases. EN=1 ENO=1

(2) The upper limit value of INT type is


(+)
output if the operation result exceeds the
upper limit value of INT type and the 7000
lower limit value is output if the operation
result falls below the lower limit value.
3000
In these cases, ENO is set to 0. 4000
(-) (+)
-6000
-3000

-9000
[F.Y.I.]
Data range of INT type: -32,768 to 32,767 (-)

(22) Bias BIAS_DINT

Name, Symbol, Function Example


<Operation>
Name

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

type) as representing a bias.


“IN” (Output)
It outputs IN + |DZ| if IN > 0,
If DINT -6000 , -9000
IN - |DZ| if IN < 0,
and a “0” in the other cases. EN=1 ENO=1

(2) The upper limit value of DINT type is


(+)
output if the operation result exceeds the
upper limit value of DINT type and the 7000
lower limit value is output if the operation
result falls below the lower limit value.
3000
In these cases, ENO is set to 0. 4000
(-) (+)
-6000
-3000

[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

(23) Bias BIAS_REAL

Name, Symbol, Function Example


<Operation>
Name

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

type) as representing a bias.


“IN” (Output)
It outputs IN + |DZ| if IN > 0,
If REAL -6.0E+3 , -9.0E+3
IN - |DZ| if IN < 0,
and a “0” in the other cases. EN=1 ENO=1

(2) The upper limit value of REAL type is


(+)
output if the operation result exceeds the
upper limit value of REAL type and the 7000
lower limit value is output if the operation
result falls below the lower limit value.
3000
In these cases, ENO is set to 0. 4000
(3) The output value has an error which is (-) (+)
-6000
similar to those which occur during REAL -3000
data additions or subtractions.
-9000
[F.Y.I.]
Data range of REAL type: (-)
-2128 < N <= -2-126, 0, 2-126 <= N < 2128

2-146
Section 2 Programming Language Original FCT

(24) Step sequence SC_COIL/SC

Name, Symbol, Function Example


<Programming Example>
Name

SC_COIL/SC An example of creating a sequential circuit is shown below.


Step execution proceeds in the order of Q1, Q2, and Q3.
Symbol

<Step sequence coil>


B_1
SC_COIL
RUN SC_men
SC_COIL
BOOL RUN UINT SC_men STEP
UINT STEP UINT#1 IN
UINT IN

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

characteristics: self holding, interlock,


power-off step retention, and subsequence Q_1
SC
priority. TRUE RUN
SC_men STEP
<Step sequence coil> UINT#1 IN
(1) If “RUN” is 0 the value of “STEP” is output.
If “RUN” is 1, the value of “IN” is output. Q_2
SC
TRUE RUN
<Step sequence bit>
SC_men STEP
(1) If “RUN” is 1, “STEP” and “IN” are matched
UINT#2 IN
and a 1 is output if a match occurs. A 0 is
output if no match occurs.
Q_3
SC
Note: To implement the power-off step TRUE RUN
retention function, it is necessary to SC_men STEP
assign the variable “STEP” to retain UINT#3 IN
memory.

2-147
Section 2 Programming Language Original FCT

(25) 32-bit addition with carry ADC/ADCO

Name, Symbol, Function Example


<Programming Example>
Name

ADC/ADCO A sample program for adding 64-bit operands is shown below.


Symbol

<32-bit addition with carry> ADC


A_UPPER IN1 C_UPPER
B_UPPER IN2
ADC
DINT IN1 DINT CYIN
DINT IN2
BOOL CYIN

<32-bit carry> ADCO


A_LOWER IN1
ADCO B_LOWER IN2
DINT IN1 BOOL
FALSE CYIN
DINT IN2
BOOL CYIN

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

(26) 32-bit subtraction with borrow SBB/SBBO

Name, Symbol, Function Example


<Programming Example>
Name

ADC/ADCO A sample program for adding 64-bit operands is shown below.


Symbol

<32-bit addition with carry> ADC


A_UPPER IN1 C_UPPER
B_UPPER IN2
ADC
DINT IN1 DINT CYIN
DINT IN2
BOOL CYIN

<32-bit carry> ADCO


A_LOWER IN1
ADCO B_LOWER IN2
DINT IN1 BOOL
FALSE CYIN
DINT IN2
BOOL CYIN

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

(27) 64-bit multiplication MULL/MULU

Name, Symbol, Function Example


<Programming Example>
Name

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

combination when performing arithmetic [F.Y.I.]


operations that result in 64-bit data. These It is recommended, to monitor 64-bit data, that you use the hexadecimal
instructions cannot be used independently. notation.

<Lower-order digit in 64-bit multiplication>


(1) MULL performs a multiplication of DINT
type “IN1” by “IN2” and outputs the lower-
order 32 bits of the 64-bit result.

<Upper-order digit in 64-bit multiplication>


(1) MULU performs a multiplication of DINT
type “IN1” by “IN2” and outputs the upper-
order 32 bits of the 64-bit result.

2-150
Section 2 Programming Language Original FCT

(28) 64-bit division DIVL/DIVU

Name, Symbol, Function Example


<Programming Example>
Name

DIVL/DIVU

DIVU
Symbol

A_UPPER IN1 C_UPPER


<Lower-order digit in 64-bit division>
A_LOWER IN2
B IN3
DIVL
DINT IN1 DINT
DINT IN2
DINT IN3 DIVL
IN1 C_LOWER
IN2
<Upper-order digit in 64-bit division>
IN3
DIVU
DINT IN1 DINT
DINT IN2 In the above figure, 64-bit data A is divided by B and the result is output
DINT IN3 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
lowerorder 32 bits is handled not as a sign but as a numeric value.
The DIVL and DIVU instructions are used in
Function

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

<Upper-order digit in 64-bit division>


(1) DIVU 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
upper-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

(29) Shift left 32 bits with carry SLC/SLCO

Name, Symbol, Function Example


<Programming Example>
Name

SLC/SLCO A sample program for rotating 64-bit data is shown below.


Symbol

A_U SLCO
<32-bit shift left with carry>

SLC
DWORD IN DWORD
BOOL CYIN SLC
IN B_U
<32-bit carry> CYIN

DWORD SLCO BOOL

A_L SLCO

<32-bit shift left with carry>


Function

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.

<Operation of the above program>

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

(30) Shift right 32 bits with carry SRC/SRCO

Name, Symbol, Function Example


<Programming Example>
Name

SRC/SRCO A sample program for rotating 64-bit data is shown below.


Symbol

A_U SRCO
<32-bit shift right with carry>

SRC
DWORD IN DWORD
BOOL CYIN SRC
IN B_U
<32-bit carry> CYIN

DWORD SRCO BOOL

A_L SRCO

<32-bit shift right with carry>


Function

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.

<Operation of the above program>

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

2-4-8 Arithmetic functions


(1) Absolute value ABS_INT

Name, Symbol, Function Example


<Operation>
Name

ABS_INT
INT Compute INT
-20 20
Symbol

EN=1 ENO=1

INT ABS_INT INT


 When the input value is a negative maximum value (-32768)
INT Compute INT
-32768 32767
(1) ABS_INT computes and returns the
Function

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

(2) Absolute value ABS_DINT

Name, Symbol, Function Example


<Operation>
Name

ABS_DINT
DINT Compute DINT
-20 20
Symbol

EN=1 ENO=1

DINT ABS_DINT DINT


• When the input value is a negative maximum value (-2147483648)
DINT Compute DINT
-2147483648 2147483647
(1) ABS_DINT computes and returns the
Function

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

(3) Absolute value ABS_REAL

Name, Symbol, Function Example


<Operation>
Name

ABS_REAL
REAL Compute REAL
-2.000E+1 2.000E+1
Symbol

EN=1 ENO=1

REAL ABS_REAL REAL

(1) ABS_REAL computes the absolute value


Function

of REAL type data.

(4) Square root (√) SQRT

Name, Symbol, Function Example


<Operation>
Name

SQRT
REAL Compute REAL
1.234E+07 3.5128E+03
Symbol

EN=1 ENO=1

REAL SQRT REAL • When the input value is negative


REAL Compute REAL
-1.234E+07 0.0E+00
EN=1 ENO=0
(1) SQRT computes the square root of REAL
Function

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

(5) Natural logarithm LN

Name, Symbol, Function Example


<Operation>
Name

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

type data. 1.0


(2) When SPH is used, if the input value is
x
negative, a 0 is output and ENO is set to 0. 0 1.0 e
(3) The output is the negative maximum value
and ENO is set to 0 if the input value is 0.
(4) The number of significant digits of the
output is 4 or less.

(6) Common logarithm LOG

Name, Symbol, Function Example


<Operation>
Name

LOG
REAL Compute REAL
1.234E+03 3.091E+00
Symbol

EN=1 ENO=1

REAL LOG REAL


y

y=log10X
(1) LOG computes the common logarithm of
Function

REAL type data. 1.0


(2) When SPH is used, if the input value is
x
negative, a 0 is output and ENO is set to 0. 0 1.0 10
(3) The output is the negative maximum value
and ENO is set to 0 if the input value is 0.
(4) The number of significant digits of the
output is 4 or less.

2-156
Section 2 Programming Language Arithmetic FCT

(7) Exponent EXP

Name, Symbol, Function Example


<Operation>
Name

EXP
REAL Compute REAL
2.0E+00 7.389E+00
Symbol

EN=1 ENO=1

REAL EXP REAL


y

y=ex
(1) EXP computes the exponent of the input using the
Function

base (e) as 2.718281. 1.0


(2) When SPH is used, if the operation result exceeds
x
the boundary value of REAL type, the boundary value 0 1.0
is output.
(3) The number of significant digits of the output is as
follows:
 4 digits if the input and output fall within -64 to 64.
 In other cases, a large error results.
(4) ENO is set to 0 if the output value exceeds the valid
value range of the REAL type.
If the output value is the REAL type and is so close to
0 that it cannot be expressed, the output is set to 0
and ENO to 1.

(8) Sine SIN

Name, Symbol, Function Example


<Operation>
Name

SIN
REAL Compute REAL
3.141E+00 5.926E-04
Symbol

EN=1 ENO=1

REAL SIN REAL


y

y=sin x
1
(1) SIN computes the sine of REAL type data.
Function

(2) The input must be given in radians (angle x p / 180).


(3) The number of significant digits of the output is 5 if
x
the input falls within -2p and 2p. -2p -p 0 p 2p
(Calculated up to the fourth decimal place.)
If the absolute value of the input is greater than or
equal to 2p, computation is carried out but with a -1
large error.
(4) When an (input value) is < -231 or > 231 -1, an output
value = 0 and ENO = 0.

2-157
Section 2 Programming Language Arithmetic FCT

(9) Cosine COS

Name, Symbol, Function Example


<Operation>
Name

COS
REAL Compute REAL
1.047E+00 5.001E-01
Symbol

EN=1 ENO=1

REAL COS REAL


y

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.

(10) Tangent TAN

Name, Symbol, Function Example


<Operation>
Name

TAN
REAL Compute REAL
7.854E-01 1.000E+00
Symbol

EN=1 ENO=1

REAL TAN REAL


y
y=tan x

(1) TAN computes the tangent of REAL type


Function

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

(11) Arc sine ASIN

Name, Symbol, Function Example


<Operation>
Name

ASIN
REAL Compute REAL
7.854E-01 9.033E-01
Symbol

EN=1 ENO=1

REAL ASIN REAL


y

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

(12) Arc cosine ACOS

Name, Symbol, Function Example


<Operation>
Name

ACOS
REAL Compute REAL
7.854E-01 6.675E-01
Symbol

EN=1 ENO=1

REAL ACOS REAL


y

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

(13) Arc tangent ATAN

Name, Symbol, Function Example


<Operation>
Name

ATAN
REAL Compute REAL
7.854E-01 6.6577E-01
Symbol

EN=1 ENO=1

REAL ATAN REAL


y
y=tan-1 x

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.

(14) Addition ADD

Name, Symbol, Function Example


<Operation>
Name

ADD • When the operation result falls within the valid value range of the
operands
Symbol

INT INT Compute


1234 + 5678 6912
ADD EN=1 ENO=1
ANY_NUM ANY_NUM
ANY_NUM • When the operation result exceeds the valid value range of the
. operands
.
.
INT INT Compute
ANY_NUM
32767 + 32767 -2
EN=1 ENO=0

INT INT Compute


(1) ADD adds the input data together.
Function

-32768 + -32768 0
(2) The data type of the input and output
operands must be the same. EN=1 ENO=0

(3) Available data type is ANY_NUM type


(REAL, INT, DINT, UINT, or UDINT). Note: The CPU performs no boundary processing when the result of
(4) ENO is set to 0 if the operation result adding operands of types other than REAL type exceeds the valid
exceeds the valid value range of the data value rangeof the operands. Make sure that the result of the
type of the operands. addition does not exceed the valid value range of the operands.
(5) If a data value is approaching so closely to The CPU performs boundary processing for REAL type operands
0 (zero) that no REAL type data can (only for SPH).
represent it, an output value = 1 and
ENO = 1 (only for SPH).

2-160
Section 2 Programming Language Arithmetic FCT

(15) Subtraction

Name, Symbol, Function Example


<Operation>
Name

SUB • When the operation result falls within the valid value range of the
operands
Symbol

INT INT Compute


5678 - 1234 4444
SUB EN=1 ENO=1
ANY_NUM ANY_NUM
ANY_NUM
• When the operation result exceeds the valid value range of the
operands
INT INT Compute
(1) SUB subtracts the second input from the
Function

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

(16) Multiplication MUL

Name, Symbol, Function Example


<Operation>
Name

MUL • When the operation result falls within the valid value range of the
operands
Symbol

INT INT Compute


222 x 10 2220
MUL EN=1 ENO=1
ANY_NUM ANY_NUM
ANY_NUM • When the operation result exceeds the valid value range of the
.
. operands
.
INT INT Compute
ANY_NUM
32767 x 32767 32767
EN=1 ENO=0

INT INT Compute


(1) MUL multiplies the input data together.
Function

-32768 x 32767 -32768


(2) The data type of the input and output
EN=1 ENO=0
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 (only for SPH).
(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 (only for SPH).

2-161
Section 2 Programming Language Arithmetic FCT

(17) Division DIV

Name, Symbol, Function Example


<Operation>
Name

DIV • When the operation result falls within the valid value range of the
operands
Symbol

INT INT Compute


3940 / 5 788
DIV EN=1 ENO=1
ANY_NUM ANY_NUM
ANY_NUM
• When the divisor is 0
INT INT Compute
3940 / 0 32767
(1) DIV divides the first input by the second
Function

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.

(18) Division remainder MOD

Name, Symbol, Function Example


<Operation>
Name

MOD • When the operation result falls within the valid value range of the
operands
Symbol

INT INT Compute


234 MOD 4 2
MOD EN=1 ENO=1
ANY_INT ANY_INT
ANY_INT
• When the divisor is 0
INT INT Compute
3940 MOD 0 0
(1) MOD divides the first input by the second
Function

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

(19) Exponent EXPT

Name, Symbol, Function Example


<Operation>
Name

EXPT • When the operation result falls within the valid value range of the
operand
Symbol

REAL REAL Compute


1.230E+01 EXPT 2.500E+00 5.306E+02
EXPT
REAL REAL EN=1 ENO=1
REAL
• When the operation result exceeds the valid value range of the
operand
(1) EXPT computes the first input (base) to the
Function

REAL REAL Compute


power (exponent) of the second input.
1.230E+01 EXPT 2.500E+02 3.402E+38
(2) When SPH is used, if the operation result
EN=1 ENO=0
exceeds the valid value range of the REAL
type, the boundary value of REAL type is
output.
(3) When SPH is used, base >= 0. If base < 0,
the output is set to 0 and ENO to 0.
(4) The number of significant digits of the
output is 4.
(5) ENO is set to 0 if the output value exceeds
the valid value range of the REAL type.
If the output value is the REAL type and is
so close to 0 that it cannot be expressed,
the output is set to 0 and ENO to 1.
(6) When a base = 0 and an exponent = 0
(0°C), an output value = 1 and ENO = 1. [F.Y.I.]
Data range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= 2128

(20) Move MOVE

Name, Symbol, Function Example


<Operation>
Name

MOVE
DINT Output DINT
32767 32767
Symbol

EN=1 ENO=1

ANY MOVE ANY

Note: Since when a variable is a derived data type, transfer is repeated


the same number of times as that of elements. If a variable has
been defined in the processor bus space, pay attention to the
(1) MOVE outputs the input as it is.
Function

number of accesses. Refer to “Appendix 5 Accessing the


(2) Available data type is any data type
Processor Bus.”
(ANY type) of the MICREX-SX series.

2-163
Section 2 Programming Language Arithmetic FCT

(21) Negation NEG

Name, Symbol, Function Example


<Operation>
Name

NEG
DINT Output DINT
123 -123
Symbol

EN=1 ENO=1

ANY_NUM NEG ANY_NUM For a negative value of DINT or INT type


DINT Output DINT
-2147483648 2147483647
EN=1 ENO=0
(1) NEG outputs the input data with its sign
Function

negated. INT Output INT


(2) Available data are types INT, DINT, or -32768 32767
REAL. (Neither UINT nor UDINT must be EN=1 ENO=0
specified.)
(3) ENO is set to 0 if the result of negating an
INT type data or DINT type data exceeds
the valid value range of the respective data
type.

2-164
Section 2 Programming Language Bit string FCT

2-4-9 Bit string functions


(1) Shift left SHL_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) SHL_WORD shifts the first input


Function

(WORD type data) the number of bit


positions designated by the second input
(UINT type data) to the left. Bit 0 is loaded
with a “0” after the shift.
The data in bit 15 is discarded.
(2) The lowest-order 4 bits of the second
input “N” are significant. For example,
SHL_WORD shifts 0 bits when N = 16 and
1 bit when N = 17.

(2) Shift left SHL_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) SHL_DWORD shifts the first input After execution ENO=1


Function

(DWORD type data) the number of bit


positions designated by the second input
(UINT type data) to the left. Bit 0 is loaded
with a “0” after the shift.
The data in bit 31 is discarded.
(2) The lowest-order 5 bits of the second input
“N” are significant. For example,
SHL_DWORD shifts 0 bits when N = 32
and 1 bit when N = 33.

2-165
Section 2 Programming Language Bit string FCT

(3) Shift right SHR_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) SHR_WORD shifts the first input


Function

(WORD type data) the number of bit


positions designated by the second input
(UINT type data) to the right.
Bit 15 is loaded with a “0” after the shift.
The data in bit 0 is discarded.
(2) The lowest-order 4 bits of the second input
“N” are significant. For example,
SHR_WORD shifts 0 bits when N = 16 and
1 bit when N = 17.

(4) Shift right SHR_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) SHR_DWORD shifts the first input After execution ENO=1


Function

(DWORD type data) the number of bit


positions designated by the second input
(UINT type data) to the right.
Bit 31 is loaded with a “0” after the shift.
The data in bit 0 is discarded.
(2) The lowest-order 5 bits of the second input
“N” are significant. For example,
SHR_DWORD shifts 0 bits when N = 32
and 1 bit when N = 33.

2-166
Section 2 Programming Language Bit string FCT

(5) Rotate left ROL_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) ROL_WORD rotates the first input


Function

(WORD type data) the number of bit


positions designated by the second input
(UINT type data) to the left. Bit 0 is loaded
with the data from bit 15.
(2) The lowest-order 4 bits of the second
input “N” are significant. For example,
ROL_WORD rotates 0 bits when N = 16
and 1 bit when N = 17.

(6) Rotate left ROL_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) ROL_DWORD rotates the first input After execution ENO=1


Function

(DWORD type data) the number of bit


positions designated by the second input
(UINT type data) to the left. Bit 0 is loaded
with the data from bit 31.
(2) The lowest-order 5 bits of the second input
“N” are significant. For example,
ROL_DWORD rotates 0 bits when N = 32
and 1 bit when N = 33.

2-167
Section 2 Programming Language Bit string FCT

(7) Rotate right ROR_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) ROR_WORD rotates the first input


Function

(WORD type data) the number of bit


positions designated by the second input
(UINT type data) to the right. Bit 15 is
loaded with the data from bit 0.
(2) The lowest-order 4 bits of the second input
“N” are significant. For example,
ROR_WORD rotates 0 bits when N = 16
and 1 bit when N = 17.

(8) Rotate right ROR_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) ROR_DWORD rotates the first input


Function

(DWORD type data) the number of bit After execution ENO=1

positions designated by the second input


(UINT type data) to the right. Bit 31 is
loaded with the data from bit 0.
(2) The lowest-order 5 bits of the second input
“N” are significant. For example,
ROR_DWORD rotates 0 bits when N = 32
and 1 bit when N = 33.

2-168
Section 2 Programming Language Bit string FCT

(9) Logical product AND

Name, Symbol, Function Example


<Operation>
Name

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

Output WORD 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 0 ENO=1

(1) AND generates the logical product AND 2 9 5 8


Function

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

(10) Logical add OR

Name, Symbol, Function Example


<Operation>
Name

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

Output WORD 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 ENO=1

(1) OR generates the logical add OR of all D C F F


Function

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

(11) Exclusive OR XOR

Name, Symbol, Function Example


<Operation>
Name

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

Output WORD 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 ENO=1

(1) XOR generates the exclusive OR of all 3 3 C F


Function

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

(12) Logical negation NOT

Name, Symbol, Function Example


<Operation>
Name

NOT In the case of WORD type data

Input word EN=1 0 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0


Symbol

NOT
ANY_BIT NOT ANY_BIT

Output word ENO=1 1 0 1 0 0 0 1 0 1 0 0 1 0 1 0 1

(1) NOT generates an inverted bit string of the


Function

input.
(2) Available data type is ANY_BIT type
(BOOL, WORD, or DWORD).

2-170
Section 2 Programming Language Bit string FCT

(13) Negation NOT_BOOL

Name, Symbol, Function Example


<Operation>
Name

NOT_BOOL • When the input data has a value of “1”


NOT
Symbol

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

of BOOL data. EN=1 ENO=1

(14) Negation NOT_WORD

Name, Symbol, Function Example


<Operation>
Name

NOT_WORD
Input WORD EN=1 0 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0
Symbol

NOT

WORD NOT_WORD WORD Output WORD ENO=1 1 0 1 0 0 0 1 0 1 0 0 1 0 1 0 1

(1) NOT_WORD inverts each bit of WORD


Function

data.

2-171
Section 2 Programming Language Bit string FCT

(15) Negation NOT_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) NOT_DWORD inverts each bit of DWORD


Function

data.

2-172
Section 2 Programming Language Selection/comparison FCT

2-4-10 Selection/comparison functions


(1) Select SEL

Name, Symbol, Function Example


<Programming example>
Name

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

(1) The SEL_* outputs the value of the second


Function

input if the value of the first input is 0 and


outputs the value of the third input if the
value of the first input is 1.

2-173
Section 2 Programming Language Selection/comparison FCT

(2) Maximum value MAX

Name, Symbol, Function Example


<Programming example>
Name

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

(1) MAX_* outputs the maximum value of the


Function

inputs.

(3) Minimum value MIN

Name, Symbol, Function Example


<Programming example>
Name

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

(1) MIN_* outputs the minimum value of the


Function

inputs.

2-174
Section 2 Programming Language Selection/comparison FCT

(4) Limit LIMIT

Name, Symbol, Function Example


<Programming example>
Name

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

INDATA 3000 OUTPUT 3000

LIMIT_UDINT MXDATA 5000


UDINT MN UDINT
UDINT IN
UDINT MX • When “INDATA” >= “MXDATA”

MNDATA 1000

LIMIT_REAL INDATA 5500 OUTPUT 5000


REAL MN REAL
MXDATA 5000
REAL IN
REAL MX

(1) LIMIT_* outputs “MN” if “IN” is smaller than


Function

“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

(5) Comparison (>) GT

Name, Symbol, Function Example


<Programming example>
Name

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

second input > third input > ... are met.


GT outputs a 0 if the above conditions are INDATA1 12345
not met. INDATA2 10000
(2) The data type of the input operands must
be the same. INDATA3 1000
(3) Available data types are ANY_NUM type INDATA4 900
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD), INDATA5 30
ANY_DATE type (DT, DATE, or TOD), and
TIME type. Consequently,
(4) The maximum number of inputs is 16. INDATA1 > INDATA2 > INDATA3 > INDATA4 > INDATA5 hold, and
FLAG is set to 1.
Note: REAL type 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-176
Section 2 Programming Language Selection/comparison FCT

(6) Comparison (>=) GE

Name, Symbol, Function Example


<Programming example>
Name

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.

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-177
Section 2 Programming Language Selection/comparison FCT

(7) Comparison (=) EQ

Name, Symbol, Function Example


<Programming example>
Name

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

= second input = third input = ... are met.


EQ outputs a 0 if the above conditions are DATE1 1984-06-25
not met. DATE2 1972-02-14
(2) The data type of the input operands must
be the same. DATE3 1973-09-23
(3) Available data types are ANY_NUM type DATE4 1991-08-07
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD), DATE5 1994-06-04
ANY_DATE type (DT, DATE, or TOD), and
TIME type. This program results in DATE1 ≠ DATE2 ≠ DATE3 ≠ DATE4 ≠ DATE5,
(4) The maximum number of inputs is 16. 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-178
Section 2 Programming Language Selection/comparison FCT

(8) Comparison (<=) LE

Name, Symbol, Function Example


<Programming example>
Name

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.

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-179
Section 2 Programming Language Selection/comparison FCT

(9) Comparison (<) LT

Name, Symbol, Function Example


<Programming example> Note: Example of a program for SPH
Name

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

(10) Comparison (≠) NE

Name, Symbol, Function Example


<Programming example>
Name

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

input ≠ the second input is met. NE outputs


INDATA1 2.0E-10
a 0 if the above condition is not met.
(2) The data type of the input operands must
be the same. INDATA2 2.0E+10
(3) Available data types are ANY_NUM type
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD), This program results in INDATA1 ≠ INDATA2 which sets a FLAG to 1.
ANY_DATE type (DT, DATE, or TOD), and
TIME type.

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-181
Section 2 Programming Language Type conversion FCT

2-4-11 Type conversion functions


(1) Type conversion DINT_TO_INT

Name, Symbol, Function Example


<Operation>
Name

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

(2) Type conversion UINT_TO_INT

Name, Symbol, Function Example


<Operation>
Name

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

(3) Type conversion UDINT_TO_INT

Name, Symbol, Function Example


<Operation>
Name

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

(4) Type conversion REAL_TO_INT

Name, Symbol, Function Example


<Operation>
Name

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

(5) Type conversion TIME_TO_INT

Name, Symbol, Function Example


<Operation>
Name

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

(6) Type conversion WORD_TO_INT

Name, Symbol, Function Example


<Operation>
Name

WORD_TO_INT
WORD Convert
INT
16#7FFF 32767
Symbol

EN=1 ENO=1

WORD WORD_TO_INT INT WORD Convert


INT
16#FFFF -1
EN=1 ENO=1

(1) WORD_TO_INT converts WORD type


Function

data to INT type data. [F.Y.I.]


Value range of WORD type: 16#0000 to 16#FFFF
Value range of INT type: -32,768 to 32,767

2-184
Section 2 Programming Language Type conversion FCT

(7) Type conversion INT_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

INT_TO_DINT
INT Convert
DINT
32767 32767
Symbol

EN=1 ENO=1

INT INT_TO_DINT DINT INT Convert


DINT
-32768 -32768
EN=1 ENO=1

(1) INT_TO_DINT converts INT type


Function

data to DINT type data. [F.Y.I.]


Value range of INT type: -32,768 to 32,767
Value range of DINT type: -2,147,483,648 to 2,147,483,647

(8) Type conversion UINT_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

UINT_TO_DINT
UINT Convert
DINT
65353 65353
Symbol

EN=1 ENO=1

UINT UINT_TO_DINT DINT

[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

to DINT type data.

2-185
Section 2 Programming Language Type conversion FCT

(9) Type conversion UDINT_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

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

(10) Type conversion REAL_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

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

(11) Type conversion TIME_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

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

(12) Type conversion DWORD_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

DWORD_TO_DINT
DWORD Convert
DINT
16#7FFFFFFF 2147483647
Symbol

EN=1 ENO=1

DWORD DWORD_TO_DINT DINT DWORD Convert


DINT
16#FFFFFFFF -1
EN=1 ENO=1

(1) DWORD_TO_DINT converts DWORD


Function

type data to DINT type data. [F.Y.I.]


Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
Value range of DINT type: -2,147,483,648 to 2,147,483,647

2-187
Section 2 Programming Language Type conversion FCT

(13) Type conversion INT_TO_UINT

Name, Symbol, Function Example


<Operation>
Name

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

(14) Type conversion DINT_TO_UINT

Name, Symbol, Function Example


<Operation>
Name

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

(15) Type conversion UDINT_TO_UINT

Name, Symbol, Function Example


<Operation>
Name

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

(16) Type conversion REAL_TO_UINT

Name, Symbol, Function Example


<Operation>
Name

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

(17) Type conversion TIME_TO_UINT

Name, Symbol, Function Example


<Operation>
Name

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

(18) Type conversion WORD_TO_UINT

Name, Symbol, Function Example


<Operation>
Name

WORD_TO_UINT
WORD Convert
UINT
16#7FFF 32767
Symbol

EN=1 ENO=1

WORD WORD_TO_UINT UINT WORD Convert


UINT
16#FFFF 65535
EN=1 ENO=1

(1) WORD_TO_UINT converts WORD type


Function

data to UINT type data. [F.Y.I.]


Value range of WORD type: 16#0000 to 16#FFFF
Value range of UINT type: 0 to 65,535

2-190
Section 2 Programming Language Type conversion FCT

(19) Type conversion INT_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

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

(20) Type conversion DINT_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

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

(21) Type conversion UINT_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

UINT_TO_UDINT
UINT Convert
UDINT
65535 65535
Symbol

EN=1 ENO=1

UINT UINT_TO_UDINT UDINT

[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

data to UDINT type data.

(22) Type conversion REAL_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

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

(23) Type conversion TIME_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

TIME_TO_UDINT
TIME Convert
UDINT
5h20m15s 19215000
Symbol

EN=1 ENO=1

TIME TIME_TO_UDINT UDINT

[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

data to UDINT type data.


(2) 1 ms is converted to 1.

(24) Type conversion DWORD_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

DWORD_TO_UDINT
DWORD Convert
UDINT
16#7FFFFFFF 2147483647
Symbol

EN=1 ENO=1

DWORD DWORD_TO_UDINT UDINT DWORD Convert


UDINT
16#FFFFFFFF 4294967295
EN=1 ENO=1

(1) DWORD_TO_UDINT converts DWORD


Function

type data to UDINT type data. [Reference information]


Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
Value range of UDINT type: 0 to 4,294,967,295

2-193
Section 2 Programming Language Type conversion FCT

(25) Type conversion DT_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

DT_TO_UDINT
DT Convert
UDINT
1998-04-01-08:30:15 891419415
Symbol

EN=1 ENO=1

DT DT_TO_UDINT UDINT

(1) DT_TO_UDINT converts DT type data to


Function

UDINT type data.


(2) The time is measured from 0:00:00
January 1st, 1970 and is specified in
seconds.

(26) Type conversion DATE_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

DATE_TO_UDINT
DATE Convert
UDINT
1998-04-01 891388800
Symbol

EN=1 ENO=1

DATE DATE_TO_UDINT UDINT

(1) DATE_TO_UDINT converts DATE type


Function

data to UDINT type data.


(2) The time is measured from 0:00:00
January 1st, 1970 and is specified in
seconds (an integral multiple of 86400
seconds = 1 day).

2-194
Section 2 Programming Language Type conversion FCT

(27) Type conversion TOD_TO_UDINT

Name, Symbol, Function Example


<Operation>
Name

TOD_TO_UDINT
TOD Convert
UDINT
08:30:15 30615
Symbol

EN=1 ENO=1

TOD TOD_TO_UDINT UDINT

(1) TOD_TO_UDINT converts TOD type data


Function

to UDINT type data.


(2) The time starts from 0:00:00 and is
specified in seconds.

(28) Type conversion INT_TO_REAL

Name, Symbol, Function Example


<Operation>
Name

INT_TO_REAL
INT Convert
REAL
32767 3.2767E+04
Symbol

EN=1 ENO=1

INT INT_TO_REAL REAL INT Convert


REAL
-32768 -3.2768E+04
EN=1 ENO=1

(1) INT_TO_REAL converts INT type data to


Function

REAL type data. [F.Y.I.]


(2) The number of significant digits after Value range of INT type: -32,768 to 32,767
conversion is 6 digits. Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128

2-195
Section 2 Programming Language Type conversion FCT

(29) Type conversion DINT_TO_REAL

Name, Symbol, Function Example


<Operation>
Name

DINT_TO_REAL
DINT Convert
REAL
2147483647 2.1474836E+09
Symbol

EN=1 ENO=1

DINT DINT_TO_REAL REAL DINT Convert


REAL
-2147483648 -2.1474836E+09
EN=1 ENO=1

(1) DINT_TO_REAL converts DINT type data


Function

to REAL type data. [Reference information]


(2) The number of significant digits after Value range of DINT type: -2,147,483,648 to 2,147,483,647
conversion is 6 digits. Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128

(30) Type conversion UINT_TO_REAL

Name, Symbol, Function Example


<Operation>
Name

UINT_TO_REAL
UINT Convert
REAL
65535 6.5535E+04
Symbol

EN=1 ENO=1

UINT UINT_TO_REAL REAL UINT Convert


REAL
0 0.0E+00
EN=1 ENO=1

(1) UINT_TO_REAL converts UINT type data


Function

to REAL type data. [Reference information]


(2) The number of significant digits after Value range of UINT type: 0 to 65,535
conversion is 6 digits. Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128

2-196
Section 2 Programming Language Type conversion FCT

(31) Type conversion UDINT_TO_REAL

Name, Symbol, Function Example


<Operation>
Name

UDINT_TO_REAL
UDINT Convert
REAL
4294967295 4.2949673E+09
Symbol

EN=1 ENO=1

UDINT UDINT_TO_REAL REAL UDINT Convert


REAL
0 0.0E+00
EN=1 ENO=1

(1) UDINT_TO_REAL converts UDINT type


Function

data to REAL type data. [F.Y.I.]


(2) The number of significant digits after Value range of UDINT type: 0 to 4,294,967,295
conversion is 6 digits. Value range of REAL type: -2128 < N <= -2-126, 0, 2-126 <= N < 2128

(32) Type conversion TIME_TO_REAL

Name, Symbol, Function Example


<Operation>
Name

TIME_TO_REAL
TIME Convert
REAL
5h20m15s 1.92150E+07
Symbol

EN=1 ENO=1

TIME TIME_TO_REAL REAL

[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

to REAL type data.


(2) 1 ms is converted to 1.
(3) The number of significant digits after
conversion is 6 digits.

2-197
Section 2 Programming Language Type conversion FCT

(33) Type conversion WORD_TO_BOOL

Name, Symbol, Function Example


<Operation>
Name

WORD_TO_BOOL • When bit 0 of WORD type data is “1”

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

• When bit 0 of WORD type data is “0”


(1) WORD_TO_BOOL converts bit 0 of
Function

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

(34) Type conversion DWORD_TO_BOOL

Name, Symbol, Function Example


<Operation>
Name

DWORD_TO_BOOL • When bit 0 of DWORD type data is “1”


DWORD
Symbol

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

DWORD type data to BOOL type data. DWORD


1 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 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
EN=1
Convert
BOOL 0
ENO=1

2-198
Section 2 Programming Language Type conversion FCT

(35) Type conversion BOOL_TO_WORD

Name, Symbol, Function Example


<Operation>
Name

BOOL_TO_WORD • When BOOL data is “1”

BOOL 1
Symbol

EN=1 Convert

BOOL BOOL_TO_WORD WORD WORD 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ENO=1

(1) BOOL_TO_WORD converts BOOL type


Function

• When BOOL data is “0”


data to WORD type data. Bit 0 of the
WORD data is loaded with the BOOL BOOL 0
value and the other bits with a “0.” 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

(36) Type conversion DWORD_TO_WORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) DWORD_TO_WORD converts DWORD


Function

type data to WORD type data.


The lower-order 16 bits of the DWORD [F.Y.I.]
value are output. Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
Value range of WORD type: 16#0000 to 16#FFFF

2-199
Section 2 Programming Language Type conversion FCT

(37) Type conversion INT_TO_WORD

Name, Symbol, Function Example


<Operation>
Name

INT_TO_WORD
INT Convert
WORD
32767 16#7FFF
Symbol

EN=1 ENO=1

INT INT_TO_WORD WORD

[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

WORD type data.

(38) Type conversion UINT_TO_WORD

Name, Symbol, Function Example


<Operation>
Name

UINT_TO_WORD
UINT Convert
WORD
1234 16#04D2
Symbol

EN=1 ENO=1

UINT UINT_TO_WORD WORD

[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

data to WORD type data.

2-200
Section 2 Programming Language Type conversion FCT

(39) Type conversion BOOL_TO_DWORD

Name, Symbol, Function Example


<Operation>
Name

BOOL_TO_DWORD • When BOOL data is “1”

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

(1) BOOL_TO_DWORD converts BOOL type


Function

• When BOOL data is “0”


data to DWORD type data. Bit 0 of the
DWORD type data is loaded with the BOOL 0
EN=1 Convert
BOOL value and the other bits with a “0.”
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 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
ENO=1

(40) Type conversion WORD_TO_DWORD

Name, Symbol, Function Example


<Operation>
Name

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

(1) WORD_TO_DWORD converts WORD


Function

type data to DWORD type data.


The lower-order 16 bits of DWORD type [F.Y.I.]
data are loaded with the WORD type data Value range of WORD type: 16#0000 to 16#FFFF
and the higher-order 16 bits with a “0.” Value range of DWORD type: 16#00000000 to 16#FFFFFFFF

2-201
Section 2 Programming Language Type conversion FCT

(41) Type conversion DINT_TO_DWORD

Name, Symbol, Function Example


<Operation>
Name

DINT_TO_DWORD
DINT Convert
DWORD
2147483647 16#7FFFFFFF
Symbol

EN=1 ENO=1

DINT DINT_TO_DWORD DWORD

[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

data to DWORD type data.

(42) Type conversion UDINT_TO_DWORD

Name, Symbol, Function Example


<Operation>
Name

UDINT_TO_DWORD
UDINT Convert
DWORD
4294967295 16#7FFFFFFF
Symbol

EN=1 ENO=1

UDINT UDINT_TO_DWORD DWORD

[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

type data to DWORD type data.

2-202
Section 2 Programming Language Type conversion FCT

(43) Type conversion INT_TO_TIME

Name, Symbol, Function Example


<Operation>
Name

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)

(44) Type conversion DINT_TO_TIME

Name, Symbol, Function Example


<Operation>
Name

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

(45) Type conversion UINT_TO_TIME

Name, Symbol, Function Example


<Operation>
Name

UINT_TO_TIME
UINT Convert
TIME
65535 1m5s535ms
Symbol

EN=1 ENO=1

UINT UINT_TO_TIME TIME


[F.Y.I.]
Value range of UINT type: 0 to 65,535
Value range of TIME type : 0 to 4,294,967,295 (ms)

(1) UINT_TO_TIME converts UINT type data


Function

to TIME type data.


(2) 1 is converted to 1ms.

(46) Type conversion UDINT_TO_TIME

Name, Symbol, Function Example


<Operation>
Name

UDINT_TO_TIME
UDINT Convert
TIME
4294967295 49d17h2m47s295ms
Symbol

EN=1 ENO=1

UDINT UDINT_TO_TIME TIME


[F.Y.I.]
Value range of UDINT type: 0 to 4,294,967,295
Value range of TIME type: 0 to 4,294,967,295 (ms)

(1) UDINT_TO_TIME converts UDINT type


Function

data to TIME type data.


(2) 1 is converted to 1ms.

2-204
Section 2 Programming Language Type conversion FCT

(47) Type conversion REAL_TO_TIME

Name, Symbol, Function Example


<Operation>
Name

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.

(48) Type conversion UDINT_TO_DT

Name, Symbol, Function Example


<Operation>
Name

UDINT_TO_DT
UDINT Convert
DT
891419415 1998-04-01-08:30:15
Symbol

EN=1 ENO=1

UDINT UDINT_TO_DT DT

(1) UDINT_TO_DT converts UDINT type data


Function

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

(49) Type conversion UDINT_TO_DATE

Name, Symbol, Function Example


<Operation>
Name

UDINT_TO_DATE
UDINT Convert
DATE
891419415 1998-04-01
Symbol

EN=1 ENO=1

UDINT UDINT_TO_DATE DATE

(1) UDINT_TO_DATE converts UDINT type


Function

data to DATE type data.


(2) The UDINT type data is converted to
DATE type data which starts from January
1st, 1970 and is specified in seconds (an
integral multiple of 86400 seconds = 1
day). The time part of the DATE type data
is truncated.

(50) Type conversion UDINT_TO_TOD

Name, Symbol, Function Example


<Operation>
Name

UDINT_TO_TOD
UDINT Convert
TOD
891419415 08:30:15
Symbol

EN=1 ENO=1

UDINT UDINT_TO_TOD TOD

(1) UDINT_TO_TOD converts UDINT type


Function

data to TOD type data.


(2) The UDINT type data is converted to TOD
type data which starts from 00:00:00 and
is specified in seconds (the part exceeding
24:00:00 is truncated).

2-206
Section 2 Programming Language Type conversion FCT

(51) Type conversion TRUNC_INT

Name, Symbol, Function Example


<Operation>
Name

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

(52) Type conversion TRUNC_DINT

Name, Symbol, Function Example


<Operation>
Name

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

(53) Type conversion TRUNC_UINT

Name, Symbol, Function Example


<Operation>
Name

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

(54) Type conversion TRUNC_UDINT

Name, Symbol, Function Example


<Operation>
Name

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

(55) Type conversion W_BCD_TO_INT

Name, Symbol, Function Example


<Operation>
Name

W_BCD_TO_INT • When the input value is BCD code


WORD Convert
INT
Symbol

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

(56) Type conversion D_BCD_TO_INT

Name, Symbol, Function Example


<Operation>
Name

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

(57) Type conversion W_BCD_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

W_BCD_TO_DINT • When the input value is BCD code


WORD Convert
DINT
Symbol

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

(58) Type conversion D_BCD_TO_DINT

Name, Symbol, Function Example


<Operation>
Name

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

• When the input value is not BCD code


DWORD Convert
DINT
(1) D_BCD_TO_DINT regards DWORD data
Function

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

(59) Type conversion INT_TO_W_BCD

Name, Symbol, Function Example


<Operation>
Name

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

(60) Type conversion DINT_TO_W_BCD

Name, Symbol, Function Example


<Operation>
Name

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

(61) Type conversion INT_TO_D_BCD

Name, Symbol, Function Example


<Operation>
Name

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

type data to DWORD type data. INT Convert


DWORD
(2) If the input INT value exceeds the valid -32768 16#00000000
range of DWORD type after type EN=1 ENO=0
conversion, the lower limit value of DWORD
type (16#00000000) (BCD code) is output.
[F.Y.I.]
Value range of INT type : -32,768 to 32,767
Value range of DWORD type as interpreted as BCD code
: 16#00000000 to 16#99999999

(62) Type conversion DINT_TO_D_BCD

Name, Symbol, Function Example


<Operation>
Name

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

2-4-12 String functions


(1) Get length LEN

Name, Symbol, Function Example


<Operation>
Name

LEN
STRING ABCDEFGHIJ EN=1
Symbol

Compute

STRING LEN INT

INT 10 ENO=1

(1) LEN outputs an INT type data that indicates [F.Y.I.]


Function

the number of characters in the input data No. of characters of STRING type: 0 to 64 chanarcters
of STRING type.

(2) Get left sub-string LEFT

Name, Symbol, Function Example


<Operation>
Name

LEFT
STRING ABCDEFGHIJ
Symbol

UINT 5 EN=1
LEFT
STRING IN STRING
UINT L
Extract

(1) LEFT extracts a sub-string of the length STRING ABCDE ENO=1


Function

designated by the second input from the


left side of the STRING data designated
[F.Y.I.]
by the first input. No. of characters of STRING type: 0 to 64 chanarcters
(2) If the number of characters “L” is greater
than the number of characters in the input
string, LEFT outputs the input string as is
and sets ENO to 1.
(3) Only NULL is output and ENO is set to 1
if the number of characters to extract is
equal to 0.

2-213
Section 2 Programming Language String FCT

(3) Get right sub-string RIGHT

Name, Symbol, Function Example


<Operation>
Name

RIGHT
STRING ABCDEFGHIJ EN=1
Symbol

UINT 5
RIGHT
STRING IN STRING
UINT L Extract

(1) RIGHT extracts a sub-string of the length STRING FGHIJ ENO=1


Function

designated by the second input from the


right side of the STRING type data
[F.Y.I.]
designated by the first input. No. of characters of STRING type: 0 to 64 chanarcters
(2) If the number of characters “L” is greater
than the number of characters in the input
string, RIGHT outputs the input string as is
and sets ENO to 1.
(3) Only NULL is output and ENO is set to 1
if the number of characters to extract is
equal to 0.

(4) Get middle sub-string MID

Name, Symbol, Function Example


<Operation>
Name

MID
STRING ABCDEFGHIJ EN=1
Symbol

MID UINT 5 (Second input)


STRING IN STRING
UINT L
UINT P UINT 3 (Third input)

(1) MID extracts a sub-string of the length Extract


Function

designated by the second input starting


from the Pth character position
STRING CDEFG ENO=1
(the third input) in the first input of STRING
type.
(2) If P >= 65 or P = 0, only NULL is output and [F.Y.I.]
ENO is set to 0. No. of characters of STRING type: 0 to 64 chanarcters
(3) When the number of input characters
is < P and L ≠ 0, only NULL is output,
resulting in ENO = 0.
(4) The string starting at the first character
position until the end of the input string is
output and ENO is set to 1 if the starting
position “P” is smaller than the length of
the string and the sum of the starting
position P and the number of characters “L”
exceeds the length of the input string.
(5) Only NULL is output and ENO is set to 1
if the number of extracted characters = 0.

2-214
Section 2 Programming Language String FCT

(5) Concatenate CONCAT

Name, Symbol, Function Example


<Operation>
Name

CONCAT EN=1
STRING ABCDEFGHIJ (First input)
Symbol

STRING XYZ (Second input)


CONCAT
STRING STRING
STRING Concatenate

(1) CONCAT concatenates the string STRING ABCDEFGHIJXYZ ENO=1


Function

designated by the second input to the first


input of STRING type.
[F.Y.I.]
(2) If the number of characters to be No. of characters of STRING type: 0 to 64 chanarcters
concatenated exceeds 64 characters, only
the first 64 characters are output and ENO
is set to 0.
(3) Only NULL is output and ENO is set to 0
if the number of concatenating characters
= 0.

(6) Insert string INSERT

Name, Symbol, Function Example


<Operation>
Name

INSERT EN=1
STRING ABCDEFGHIJ (First input)
Symbol

INSERT STRING XYZ (Second input)


STRING IN1 STRING
STRING IN2
UINT P UINT 4 (Third input)

Insert
(1) INSERT inserts the string designated by
Function

the second input into the first input of


STRING type at the Pth character position STRING ABCDXYZEFGHIJ ENO=1
designated by the third input.
(2) If the number of characters to be inserted
exceeds 64 characters, only the first 64 [F.Y.I.]
characters are output and ENO is set to 0. No. of characters of STRING type: 0 to 64 chanarcters
(3) The first input is output and ENO is set to
0 if the number of characters of the first
input < P.
(4) If P = 0, the second input is inserted
before the first input and ENO is set to 1.

2-215
Section 2 Programming Language String FCT

(7) Delete string DELETE

Name, Symbol, Function Example


<Operation>
Name

DELETE EN=1
STRING ABCDEFGHIJ (First input)
Symbol

DELETE UINT 3 (Second input)


STRING IN STRING
UINT L
UINT P UINT 5 (Third input)

Delete
(1) DELETE deletes the number of characters
Function

designated by the second input from the first input


of STRING type starting at the Pth position STRING ABCDHIJ ENO=1
(third input).
(2) If P >= 65 or P = 0, the output is NULL and ENO is
set to 0. [F.Y.I.]
(3) If the number of characters of the first input < P, No. of characters of STRING type: 0 to 64 chanarcters
the first input is output and ENO is set to 0.
(4) If the output is longer than 65 characters, the first
64 characters are output and NO is set to 0.
(5) If L = 0, the first input is output as is and ENO is
set to 1.

(8) Replace string REPLACE

Name, Symbol, Function Example


<Operation>
Name

REPLACE EN=1
STRING ABCDEFGHIJ (First input)
Symbol

REPLACE STRING XYZ (Second input)


STRING IN1 STRING
STRING IN2
UINT L UINT 5 (Third input)
UINT P

UINT 3 (Fourth input)


(1) Deletes the indicated number of charactersin the
Function

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

(9) Find string FIND

Name, Symbol, Function Example


<Operation>
Name

FIND EN=1
STRING ABXYZHIJ (First input)
Symbol

STRING XYZ (Second input)


FIND
STRING IN1 INT
STRING IN2 Find

(1) FIND searches the first input of STRING INT 3 ENO=1


Function

type for the same string designated by the


second input and outputs the position of
[F.Y.I.]
the first occurrence of the string.
No. of characters of STRING type: 0 to 64 chanarcters
(2) A “0” is output if no matching string is found.

(10) Compare string (>) GT_STRING

Name, Symbol, Function Example


<Programming example>
Name

GT_STRING
GT_STRING
INDATA1 IN1 FLAG
Symbol

INDATA2 IN2
GT_STRING
STRING IN1 BOOL
STRING IN2 <Operation>
1-byte character Character code

INDATA1 ab 82A8, 0061, 0062


(1) GT_STRING outputs a 1 if the condition
Function

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

(11) Compare string (>=) GE_STRING

Name, Symbol, Function Example


<Programming example>
Name

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

(12) Compare string (=) EQ_STRING

Name, Symbol, Function Example


<Programming example>
Name

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

(13) Compare string (<=) LE_STRING

Name, Symbol, Function Example


<Programming example>
Name

LE_STRING
LE_STRING
STR_1 IN1 FLAG
Symbol

STR_2 IN2
LE_STRING
STRING IN1 BOOL
STRING IN2 <Operation>

STR_1 82A0, 82A7

(1) LE_STRING outputs a 1 if the condition STR_2 82A0, 82A9


Function

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.
STR_1 <= STR_2 holds, and FLAG is set to 1.
(3) LE_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

(14) Compare string (<) LT_STRING

Name, Symbol, Function Example


<Programming example>
Name

LT_STRING
LT_STRING
SD1 IN1 FLAG
Symbol

SD2 IN2
LT_STRING
STRING IN1 BOOL
STRING IN2 <Operation>

SD1 D 8263

(1) LT_STRING outputs a 1 if the condition SD2 E 8264


Function

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.
SD1 < SD2 holds, and FLAG is set to 1.
(3) LT_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-219
Section 2 Programming Language String FCT

(15) Compare string (≠) NE_STRING

Name, Symbol, Function Example


<Programming example>
Name

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

first input ≠ second input is met. It outputs Message 2 OFF


a 0 if the above condition is not met.
(2) Available data type is STRING type. Consequently,
(3) LE_STRING converts the string into a Message 1 ≠ Message 2 holds, and FLAG is set to 1.
sequence of character codes and
compares the character codes as numeric
data. [F.Y.I.]
No. of characters of STRING type: 0 to 64 chanarcters

2-220
Section 2 Programming Language Time type data FCT

2-4-13 Time type data functions


(1) Add time ADD_T_T

Name, Symbol, Function Example


<Operation>
Name

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)

(2) Add time ADD_TD_T

Name, Symbol, Function Example


<Operation>
Name

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

and TIME type data. 17:54:30 + 10h5m55s123ms 4:00:25


(2) The ms fraction of the TIME type data is EN=1 ENO=0
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: 0, 23:59:59)

(3) Add time ADD_DT_T

Name, Symbol, Function Example


<Operation>
Name

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

(1) ADD_DT_T adds together DT type data


Function

and TIME type data.


(2) The ms fraction of the TIME type data is
truncated.
(3) The overflow condition is ignored and ENO
is set to 0 if the operation result exceeds
the limit value range of the DT type.

2-221
Section 2 Programming Language Time type data FCT

(4) Subtract time SUB_T_T

Name, Symbol, Function Example


<Operation>
Name

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)

(5) Subtract time SUB_D_D

Name, Symbol, Function Example


<Operation>
Name

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.

(6) Subtract time SUB_TD_T

Name, Symbol, Function Example


<Operation>
Name

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

(7) Subtract time SUB_TD_TD

Name, Symbol, Function Example


<Operation>
Name

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

(1) SUB_TD_TD performs a subtraction on


Function

TOD type data and outputs TIME type


data.
(2) Correct output value is not guaranteed if
the operation result is negative. ENO is
set to 0 in this case.

(8) Subtract time SUB_DT_T

Name, Symbol, Function Example


<Operation>
Name

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

(1) SUB_DT_T performs a subtraction on DT


Function

type data and TIME type data and outputs


DT type data.
(2) The ms fraction of the TIME data is
truncated.
(3) Correct output value is not guaranteed if
the operation result is negative. ENO is
set to 0 in this case.

(9) Subtract time SUB_DT_DT

Name, Symbol, Function Example


<Operation>
Name

SUB_DT_DT
DT DT
1998-04-02-15:30:15 - 1998-04-01-08:15:08
Symbol

EN=1 Compute TIME


SUB_DT_DT
DT TIME 1d7h15m7s0ms
DT ENO=1

(1) SUB_DT_DT performs a subtraction on


Function

DT type data and outputs TIME type data.


(2) When the result exceeds the positive data
type boundary value, a TIME type
boundary value is output, resulting in
ENO = 0.
(3) Correct output value is not guaranteed if
the operation result is negative. ENO is
set to 0 in this case.

2-223
Section 2 Programming Language Time type data FCT

(10) Multiply time MUL_T_N

Name, Symbol, Function Example


<Operation>
Name

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

second input data. TIME UDINT Compute TIME


(2) If the operation result exceeds the limit 7d20h30m40s567ms x 20 49d17h02m47s295ms
value range of the data type, the limit value EN=1 ENO=0
of the data type is output and ENO is set
to 0.
[F.Y.I.]
Data range of TIME type: 0 to 4,294,967,295 (ms)

(11) Multiply time MUL_T_R

Name, Symbol, Function Example


<Operation>
Name

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

second input data. 5h30m x 2.5E+3 49d17h02m47s295ms


(2) When the result exceeds the positive data EN=1 ENO=0
type boundary value, a TIME type
boundary value is output, resulting in Note: In this multiplication, TIME type data is converted to REAL type
ENO = 0. data and the result is converted to TIME type again.
(3) Correct output value is not guaranteed if Consequently, the precision of the operation result is identical to
the operation result is negative. ENO is that of REAL type.
set to 0 in this case.

[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

(12) Divide time DIV_T_N

Name, Symbol, Function Example


<Operation>
Name

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)

(13) Divide time DIV_T_R

Name, Symbol, Function Example


<Operation>
Name

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

second input data. 5h30m / 1.0E-4 49d17h2m47s295ms


(2) If the operation result exceeds the limit EN=1 ENO=0
value range of the data type, the limit value
of the data type is output and ENO is set Note: In this multiplication, TIME type data is converted to REAL type
to 0. data and the result is converted to TIME type again.
(Limit value: 49d17h02m47s295ms) Consequently, the precision of the operation result is identical to
(3) Correct output value is not guaranteed if that of REAL type.
the operation result is negative. ENO is
set to 0 in this case. • When a divider is 0
(4) The ms fraction of the operation result is
rounded off. TIME REAL Compute TIME
(5) When a divider is 0, a TIME type of 5h30m / 0.0E+0 49d17h2m47s295ms
boundary value is output, resulting in EN=1 ENO=0
ENO = 0.

[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

(14) Concatenate time CONCAT_D_D

Name, Symbol, Function Example


<Operation>
Name

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

data to DATE type data and outputs DT DATE TOD Compute DT


type data. 2106-02-07 10:10:00 Undefined
(2) Correct output value is not guaranteed if Concatenate (1970-01-01-03:41:44)
the operation result exceeds the limit EN=1 ENO=0
value range of the data type. An actually
ENO is set to 0 in this case. output value

(15) Convert DT to TOD DT_TO_TOD

Name, Symbol, Function Example


<Operation>
Name

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

(1) DT_TO_TOD extracts the time part of DT


Function

type data and outputs TOD type data.

(16) Convert DT to DATE DT_TO_DATE

Name, Symbol, Function Example


<Operation>
Name

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

(1) DT_TO_DATE extracts the date part of DT


Function

type data and outputs DATE type data.

2-226
Section 2 Programming Language Double-precision
floating-point calculation FCT

2-4-14 Double-precision floating-point calculation functions (FCTs)


This subsection describes the double-precision floating-point functions of SPH2000/SPH3000.
(For SPH2000, this function is supported by the software version V08 or later.

2-4-14-1 Common Specifications


(1) Double-precision floating-point format
The double-precision floating-point format conforms to IEEE754 standards.
The notation for a double-precision floating-point number is shown below.

The double-precision number (DOUBLE)

63 62 52 51 0

Exponential part (Exp) Fractional part (Fraction)

Symbol part (S)

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.

Types Exponential part (Exp) Fractional part (Fraction)


"0" 0 0
Denormalized numbers 0 Except "0"
Normalized numbers 1 to 2046 Any
Infinity 2047 0
Not a number 2047 Except "0"

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

(2) Double-precision floating-point notation (PLC Applications)


The following structure is defined to express double-precision floating-point (DOUBLE) data.

D_REAL:
STRUCT
LDATA : DWORD;
UDATA : DWORD;
END_STRUCT;

A 64-bit floating-point number is assigned as shown below.

63 62 52 51 32 31 0

Exponential part (Exp) Fractional part (Fraction)

UDATA LDATA
Symbol part (S)

Note: D_REAL cannot be monitored in decimal.

(3) Enable flag (EN/ENO terminal)


Enable flags (EN and ENO terminals) can be connected for functions in the expert loader graphic language.
If the variable connected to the EN input is FALSE (0), the function connected to the EN terminal will not be performed.
If a calculation error occurs as a result of performing the function, the ENO output is FALSE (0).
Function examples connected to the EN and ENO terminals are shown below.

DOUBLE_TO_UDINT

BOOL END ENO BOOL

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.

(4) D_REAL type structure access


SPH2000/SPH3000 incorporate a micro-controller based on 32-bit data. For this reason, D_REAL data is attained by accessing
32-bit data twice.
Usually, when double-precision floating-point calculations are used in the POU, variable data access and the order of calculating
variable data is guaranteed at POU compilation. Therefore, no problem arises. Do not access D_REAL data under the following
conditions.
• When a D_REAL variable on another CPU module is used.
• When accessing a D_REAL variable on a single CPU module if the variable is shared by other tasks.

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

Equivalent when Round-to-nearest


Value to be rounded
rounding in decimal value
01.00 01 01
01.01 01 01
01.10 10 10
01.11 10 10
10.00 10 10
10.01 10 10
10.10 11 10
10.11 11 11
11.00 11 11

2-229
Section 2 Programming Language Double-precision
floating-point calculation FCT

2-4-14-2 Function of double-precision floating-point calculation FCTs


(1) List of double-precision floating-point calculation FCTs
The table below lists the double-precision floating-point calculation FCTs.

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

Calculates the natural logarithm of DOUBLE type data (double-


Arithmetic LN_DOUBLE 7 P2-244
precision floating-point data).
Turns ON the output when the first and second parameters of
Comparison EQ_DOUBLE DOUBLE type data (double- precision floating-point data) are 5 P2-245
equally (=).
Turns ON the output when the first and second parameters of
Comparison NE_DOUBLE DOUBLE type data (double- precision floating-point data) are not 5 P2-245
equally (≠).
Turns ON the output when the first and second parameters of
Comparison GT_DOUBLE DOUBLE type data (double- precision floating-point data) are 5 P2-246
greater than (>).
Turns ON the output when the first and second parameters of
Comparison GE_DOUBLE DOUBLE type data (double- precision floating-point data) are 5 P2-246
greater or equally (>=).
Turns ON the output when the first and second parameters of
Comparison LT_DOUBLE DOUBLE type data (double- precision floating-point data) are lesser 5 P2-247
than (<).
Turns ON the output when the first and second parameters of
Comparison LE_DOUBLE DOUBLE type data (double- precision floating-point data) are lesser 5 P2-247
or equally (<=).

2-231
Section 2 Programming Language Double-precision
floating-point calculation FCT

2-4-14-3 Type conversion functions


(1) Type conversion INT_TO_DOUBLE
Converts INT data (16-bit signed integer) to DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

INT_TO_DOUBLE
INT type minimum value
Symbol

INT Convert D_REAL


-32768 -32768
INT INT_TO_DOUBLE D_REAL ENO=1 EN=1

UDATA LDATA
C0E00000 00000000

1) INT_TO_DOUBLE converts INT data (16- INT type maximum value


Function

bit signed integer) into DOUBLE type data


(double-precision floating-point data). INT Convert D_REAL
2) ENO is always TRUE (1). +32767 +32767
ENO=1 EN=1

UDATA LDATA
40DFFFC0 00000000

(2) Type conversion DOUBLE_TO_INT


Converts DOUBLE type data (double-precision floating-point data) into INT data (16-bit signed integer).

Name, Symbol, Function Example


<Operation>
Name

DOUBLE_TO_INT
 When the operation result falls within the valid value range of the INT
type.
Symbol

D_REAL Convert INT

D_REAL DOUBLE_TO_INT INT 2.2250E - 308 0


EN=1 ENO=1

UDATA LDATA
00100000 00000000
1) DOUBLE_TO_INT converts DOUBLE type
Function

data (double-precision floating-point data)


 When the operation result exceeds the valid value range of the INT
into INT data (16-bit signed integer).
type.
2) Digits below the decimal point are rounded
off. D_REAL Convert INT
3) If the input data exceeds the valid range of 1.7976E + 308 32767
INT type (-32768 to 32767), the boundary EN=1 ENO=0
value of INT type is output. (ENO is set to
FALSE (0) in this case.) UDATA LDATA
7FEFFFFF FFFFFFFF

2-232
Section 2 Programming Language Double-precision
floating-point calculation FCT

(3) Type conversion UINT_TO_DOUBLE


Converts UINT type data (16-bit unsigned integer) into DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

UINT_TO_DOUBLE
UINT type minimum value
Symbol

UINT Convert D_REAL


0 0
UINT UINT_TO_DOUBLE D_REAL ENO=1 EN=1

UDATA LDATA
00000000 00000000

1) UINT_TO_DOUBLE converts UINT type UINT type maximum value


Function

data (16-bit unsigned integer) into


DOUBLE type data (double-precision UINT Convert D_REAL
floating-point data). +65535 +65535
2) ENO is always TRUE (1). ENO=1 EN=1

UDATA LDATA
40EFFFE0 00000000

(4) Type conversion DOUBLE_TO_UINT


Converts DOUBLE type data (double-precision floating-point data) into UINT type data (16-bit unsigned integer).

Name, Symbol, Function Example


<Operation>
Name

DOUBLE_TO_UINT
• When the operation result falls within the valid value range of the UINT
type.
Symbol

D_REAL Convert UINT

D_REAL DOUBLE_TO_UINT UINT 2.2250E - 308 0


EN=1 ENO=1

UDATA LDATA
00100000 00000000
1) DOUBLE_TO_UINT converts DOUBLE
Function

type data (double-precision floating-point


• When the operation result exceeds the valid value range of the UINT
data) into UINT type data (16-bit unsigned
type.
integer).
2) Digits below the decimal point are rounded D_REAL Convert UINT
off. 1.7976E + 308 65535
3) If the input data exceeds the valid range of EN=1 ENO=0
UINT type (0 to 65535), the boundary
value of UINT type is output. (ENO is set to UDATA LDATA
FALSE (0) in this case.) 7FEFFFFF FFFFFFFF

2-233
Section 2 Programming Language Double-precision
floating-point calculation FCT

(5) Type conversion DINT_TO_DOUBLE


Converts DINT type data (32-bit signed integer) into DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

DINT_TO_DOUBLE
DINT type minimum value
Symbol

DINT Convert D_REAL


-2147483648 -2147483648
DINT DINT_TO_DOUBLE D_REAL ENO=1 EN=1

UDATA LDATA
C1E00000 00000000

1) DINT_TO_DOUBLE converts DINT type DINT type maximum value


Function

data (32-bit signed integer) into DOUBLE


type data (double-precision floating-point DINT Convert D_REAL
data). +2147483647 +2147483647
2) ENO is always TRUE (1). ENO=1 EN=1

UDATA LDATA
41DFFFFF FFC00000

(6) Type conversion DOUBLE_TO_DINT


Converts DOUBLE type data (double-precision floating-point data) into DINT type data (32-bit signed integer).

Name, Symbol, Function Example


<Operation>
Name

DOUBLE_TO_DINT
• When the operation result falls within the valid value range of the DINT
type.
Symbol

D_REAL Convert DINT

D_REAL DOUBLE_TO_DINT DINT EN=1 2.2250E - 308 0


ENO=1

UDATA LDATA
00100000 00000000
1) DOUBLE_TO_DINT converts DOUBLE
Function

type data (double-precision floating-point


• When the operation result exceeds the valid value range of the DINT
data) into DINT type data (32-bit unsigned
type.
integer).
2) Digits below the decimal point are rounded D_REAL Convert DINT
off. EN=1
1.7976E + 308 +2147483647
3) If the input data exceeds the valid range of ENO=0
UINT type (-2147483648 to 2147483647),
the boundary value of DINT type is output. UDATA LDATA
(ENO is set to FALSE (0) in this case.) 7FEFFFFF FFFFFFFF

2-234
Section 2 Programming Language Double-precision
floating-point calculation FCT

(7) Type conversion UDINT_TO_DOUBLE


Converts UDINT type data (32-bit unsigned integer) into DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

UDINT_TO_DOUBLE
UDINT type minimum value
Symbol

UDINT Convert D_REAL


0 0
UDINT UDINT_TO_DOUBLE D_REAL ENO=1 EN=1

UDATA LDATA
00000000 00000000

1) UDINT_TO_DOUBLE converts UDINT UDINT type maximum value


Function

type data (32-bit unsigned integer) into


DOUBLE type data (double-precision UDINT Convert D_REAL
floating-point data). +4294967295 +4294967295
2) ENO is always TRUE (1). ENO=1 EN=1

UDATA LDATA
41EFFFFF FFE00000

(8) Type conversion DOUBLE_TO_UDINT


Converts DOUBLE type data (double-precision floating-point data) into UDINT type data (32-bit unsigned integer).

Name, Symbol, Function Example


<Operation>
Name

DOUBLE_TO_UDINT
• When the operation result falls within the valid value range of the UDINT
type.
Symbol

D_REAL Convert UDINT

D_REAL DOUBLE_TO_UDINT UDINT 2.2250E - 308 0


EN=1 ENO=1

UDATA LDATA
00100000 00000000
1) DOUBLE_TO_UDINT converts DOUBLE
Function

type data (double-precision floating-point


• When the operation result exceeds the valid value range of the UDINT
data) into UDINT type data (32-bit
type.
unsigned integer).
2) Digits below the decimal point are rounded D_REAL Convert UDINT
off. 1.7976E + 308 +4294967295
EN=1
3) If the input data exceeds the valid range of ENO=0
UINT type (0 to 4294967295), the
boundary value of UDINT type is output. UDATA LDATA
(ENO is set to FALSE (0) in this case.) 7FEFFFFF FFFFFFFF

2-235
Section 2 Programming Language Double-precision
floating-point calculation FCT

(9) Type conversion REAL_TO_DOUBLE


Converts REAL data (single-precision floating-point data) into DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

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

1) REAL_TO_DOUBLE converts REAL type REAL Convert D_REAL


Function

data (single-precision floating-point data) - 2^ - 126 +1.17549435082229E - 38


into DOUBLE type data (double-precision ENO=1 EN=1
floating-point data).
UDATA LDATA
2) ENO is always TRUE (1).
38100000 00000000

(10) Type conversion DOUBLE_TO_REAL


Converts DOUBLE type data (double-precision floating-point data) into REAL data (single-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

DOUBLE_TO_REAL
• When the operation result falls within the valid value range of the REAL
type.
Symbol

D_REAL Convert REAL

D_REAL DOUBLE_TO_REAL REAL 2.2250E - 308 0.0000000e + 000


EN=1 ENO=1

UDATA LDATA
00100000 00000000
1) DOUBLE_TO_REAL converts DOUBLE
Function

type data (double-precision floating-point


• When the operation result exceeds the valid value range of the REAL
data) into to REAL type data (singleprecision
type.
floating-decimal data).
2) If the input data is of REAL type (-2^128 to D_REAL Convert REAL
-2^-126, 0, or 2^-126 to 2^128), the input 1.7976E + 308 3.4028235e + 038
data is converted into REAL type data and EN=1 ENO=0
output.
3) If the input data exceeds the valid range of UDATA LDATA
REAL type (less than -2^128 or larger than 7FEFFFFF FFFFFFFF
2^128), the REAL type data is output and
ENO is set to FALSE (0).
4) If the input data is too small and cannot be
expressed in REAL type (i.e., -2^-126 to
2^-126), 0 will be output. ENO is still TRUE
(1) in this case.

2-236
Section 2 Programming Language Double-precision
floating-point calculation FCT

(11) Type conversion RAD_DOUBLE


RAD_DOUBLE converts degree notation (i.e., the angle around a circle is given as 360°) into radian notation (i.e., the angle of
around a circle is given as 2 ).

Name, Symbol, Function Example


<Operation>
Name

RAD_DOUBLE
• When the operation result falls within the valid value range of the D_REAL
type.
Symbol

D_REAL Convert D_REAL

D_REAL RAD_DOUBLE D_REAL 45 7.8539819E - 001


EN=1 ENO=1

UDATA LDATA UDATA LDATA


40468000 00000000 3FE921FB 54442D18
1) RAD_DOUBLE converts degree notation
Function

(i.e., the angle around a circle is given as


• When the operation result exceeds the valid value range of the D_REAL
360°) into radian notation (i.e., the angle
type.
around a circle is given as 2p).
2) The following formula is used for D_REAL Convert D_REAL
conversion. 60 1.0471976
OUT = IN * p /180 EN=1 ENO=0
3) If IN * p exceeds the valid range of
D_REAL type (overflows), ENO is set to UDATA LDATA UDATA LDATA
FALSE (0). 404E0000 00000000 3FF0C152 382D7365

(12) Type conversion DEG_DOUBLE


DEG_DOUBLE converts radian notation (i.e., the angle around a circle is given as 2 ) into degree notation (i.e., the angle around
a circle is given as 360°).

Name, Symbol, Function Example


<Operation>
Name

DEG_DOUBLE
• When the operation result falls within the valid value range of the D_REAL
type.
Symbol

D_REAL Convert D_REAL

D_REAL DEG_DOUBLE D_REAL 7.8539819E - 001 45


EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FE921FB 54442D18 40468000 00000000
1) DEG_DOUBLE converts radian notation
Function

(i.e., the angle around a circle is given as


• When the operation result exceeds the valid value range of the D_REAL
2p) into degree notation (i.e., the angle
type.
around a circle is given as 360°).
2) The following formula is used for D_REAL Convert D_REAL
conversion. 1.0471976 60
OUT = IN * 180/p EN=1 ENO=0
3) If the IN * 180 exceeds the valid range of
D_REAL type (overflows), ENO is set to UDATA LDATA UDATA LDATA
FALSE (0). 3FF0C152 382D7365 404DFFFF FFFFFFFF

2-237
Section 2 Programming Language Double-precision
floating-point calculation FCT

2-4-14-4 Arithmetic operation functions


(1) Addition ADD_DOUBLE
Adds DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

ADD_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL


0.1 + 0.011111111111111 0.111111111111111
ADD_DOUBLE
D_REAL D_REAL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA UDATA LDATA
3FB99999 9999999A 3F86C16C 16C16BD7 3FBC71C7 1C71C715

1) The first and second parameters are


Function

added, and the result is output. • Computation example 2)


2) If the result of calculation exceeds the
D_REAL D_REAL Compute D_REAL
valid range of D_REAL type (overflows),
the boundary value of D_REAL type is 2.3 + 0.033333333333333 2.333333333333333

output. (ENO is set to FALSE (0) in this EN=1 ENO=1


case.) UDATA LDATA UDATA LDATA UDATA LDATA
3) If the result of calculation is so close to 0
40026666 66666666 3FA11111 111110E1 4002AAAA AAAAAAAA
that the result cannot be expressed in
D_REAL type, the output is 0. (ENO is
still TRUE (1) in this case.)

(2) Subtraction SUB_DOUBLE


Subtracts DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

SUB_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL


7.777777777777777 - 7.666666666666666 0.111111111111111
SUB_DOUBLE
D_REAL D_REAL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA UDATA LDATA
401F1C71 C71C71C6 401EAAAA AAAAAAA3 3FBC71C7 1C71C8C0

1) The first and second parameters are


Function

subtracted, and the result is output. • Computation example 2)


2) If the result of calculation exceeds the
D_REAL D_REAL Compute D_REAL
valid range of D_REAL type (overflows),
the boundary value of D_REAL type is 0.678967896789 - 0.333333333333 0.3456345634563456
output. (ENO is set to FALSE (0) in this EN=1 ENO=1
case.) UDATA LDATA UDATA LDATA UDATA LDATA
3) If the result of calculation is so close to 0
3FE5BA1A E1F7C3DC 3FD55555 55553DE1 3FD61EE0 6E9A49D7
that the result cannot be expressed in
D_REAL type, the output is 0. (ENO is
still TRUE (1) in this case.)

2-238
Section 2 Programming Language Double-precision
floating-point calculation FCT

(3) Multiplication MUL_DOUBLE


Multiplies DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

MUL_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL


1.79769313486232E+308 x 10 1.79769313486232E+308
MUL_DOUBLE
D_REAL D_REAL EN=1 ENO=0
D_REAL
UDATA LDATA UDATA LDATA UDATA LDATA
7FEFFFFF FFFFFFFF 40240000 00000000 7FEFFFFF FFFFFFFF

1) The first and second parameters are


Function

multiplied, and the result is output. • Computation example 2)


2) If the result of calculation exceeds the
D_REAL D_REAL Compute D_REAL
valid range of D_REAL type (overflows),
the boundary value of D_REAL type is 0.77777777777777 x 0.33333333333333 0.2592592592592540740740740741
output. (ENO is set to FALSE (0) in this EN=1 ENO=1
case.) UDATA LDATA UDATA LDATA UDATA LDATA
3) If the result of calculation is so close to 0
3FE8E38E 38E38DF3 3FD55555 55555519 3FD097B4 25ED091E
that the result cannot be expressed in
D_REAL type, the output is 0. (ENO is
still TRUE (1) in this case.)

(4) Division DIV_DOUBLE


Divides DOUBLE type data (double-precision floating-point data).

Name, Symbol, Function Example


<Operation>
Name

DIV_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL


1 / 0 1.79769313486232E+308
DIV_DOUBLE
D_REAL D_REAL EN=1 ENO=0
D_REAL
UDATA LDATA UDATA LDATA UDATA LDATA
3FF00000 00000000 00000000 00000000 7FEFFFFF FFFFFFFF

1) The first and second parameters are


Function

divided, and the result is output. • Computation example 2)


2) If the result of calculation exceeds the
D_REAL D_REAL Compute D_REAL
valid range of D_REAL type (overflows),
the boundary value of D_REAL type is 384 / 1111 0.34563456345634563456345634563456
output. (ENO is set to FALSE (0) in this EN=1 ENO=1
case.) UDATA LDATA UDATA LDATA UDATA LDATA
3) If the result of calculation is so close to 0
40780000 00000000 40915C00 00000000 3FD61EE0 6E9A6229
that the result cannot be expressed in
D_REAL type, the output is 0. (ENO is
still TRUE (1) in this case.)
4) If the divisor is 0, the boundary value with
the sign of the dividend is generated and
ENO is set to 0.

2-239
Section 2 Programming Language Double-precision
floating-point calculation FCT

(5) Sine SIN_DOUBLE


SIN_DOUBLE computes the sine of input radian data (i.e., the angle around a circle is given as 360°).

Name, Symbol, Function Example


<Operation>
Name

SIN_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


1.0471976 0.8660254
D_REAL SIN_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FF0C152 382D7366 3FEBB67A E8584CAB

1) SIN_DOUBLE calculates the sine of input


Function

radian data (i.e., the angle around a circle • Computation example 2)


is given as 360°).
D_REAL Compute D_REAL
2) The larger the absolute value of the input,
the larger the error in the output. 0.7853982 0.7071068
EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FE921FB 54442D18 3FE6A09E 667F3BCC

(6) Cosine COS_DOUBLE


COS_DOUBLE computes the cosine of input radian data (i.e., the angle around a circle is given as 360°).

Name, Symbol, Function Example


<Operation>
Name

COS_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


1.0471976 0.5
D_REAL COS_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FF0C152 382D7366 3FDFFFFF FFFFFFFF

1) COS_DOUBLE calculates the cosine of


Function

input radian data (i.e., the angle around a • Computation example 2)


circle is given as 360°).
D_REAL Compute D_REAL
2) The larger the absolute value of the input,
the larger the error in the output. 0.7853982 0.7071068
EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FE921FB 54442D18 3FE6A09E 667F3BCC

2-240
Section 2 Programming Language Double-precision
floating-point calculation FCT

(7) Tangent TAN_DOUBLE


TAN_DOUBLE computes the tangent of input radian data (i.e., the angle around a circle is given as 360°).

Name, Symbol, Function Example


<Operation>
Name

TAN_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


1.0471976 1.7320508
D_REAL TAN_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FF0C152 382D7366 3FFBB67A E8584CAC

1) TAN_DOUBLE calculates the tangent of


Function

input radian values (i.e., the angle around • Computation example 2)


a circle is given as 360°).
D_REAL Compute D_REAL
2) The larger the absolute value of the input,
the larger the error in the output. 0.7853982 1
EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FE921FB 54442D18 3FEFFFFF FFFFFFFF

(8) Arc sine ASIN_DOUBLE


ASIN_DOUBLE computes the arc sine of input radian data (i.e., the angle around a circle is given as 360°).

Name, Symbol, Function Example


<Operation>
Name

ASIN_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


0.8660254 1.0471976
D_REAL ASIN_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FEBB67A E8584CAB 3FF0C152 382D7366

1) ASIN_DOUBLE calculates the arc sine of


Function

input radian data (i.e., the angle around a • Computation example 2)


circle is given as 360°).
D_REAL Compute D_REAL
2) The input data range is from 1.0 to 1.0
and the output data range is from -p/2 to 0.7071068 0.7853982

p/2. EN=1 ENO=1


3) If the input exceeds the above range, the UDATA LDATA UDATA LDATA
output is set to 0 and NO is set to FALSE
3FE6A09E 667F3BCC 3FE921FB 54442D17
(0).

2-241
Section 2 Programming Language Double-precision
floating-point calculation FCT

(9) Arc cosine ACOS_DOUBLE


ACOS_DOUBLE computes the arc cosine of the input data.

Name, Symbol, Function Example


<Operation>
Name

ACOS_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


0.5 1.0471976
D_REAL ACOS_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FDFFFFF FFFFFFFF 3FF0C152 382D7366

1) ACOS_DOUBLE calculates the arc cosine


Function

of the input data. • Computation example 2)


2) The input data range is from -1.0 to 1.0
D_REAL Compute D_REAL
and the output data range is from p to 0.
3) If the input exceeds the above range, the 0.7071068 0.7853982

output is set to 0 and ENO is set to FALSE EN=1 ENO=1


(0). UDATA LDATA UDATA LDATA
3FE6A09E 667F3BCD 3FE921FB 54442D18

(10) Arc tangent ATAN_DOUBLE


ATAN_DOUBLE computes the arc tangent of the input data.

Name, Symbol, Function Example


<Operation>
Name

ATAN_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


1.7320508 1.0471976
D_REAL ATAN_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FFBB67A E8584CAC 3FF0C152 382D7366

1) ATAN_DOUBLE calculates the arc tangent


Function

of the input data. • Computation example 2)


2) The input is from the positive maximum
D_REAL Compute D_REAL
value to negative maximum value and the
output data range is from -p/2 to p/2. 1 0.7853982

3) ENO is always TRUE (1). EN=1 ENO=1

UDATA LDATA UDATA LDATA


3FEFFFFF FFFFFFFF 3FE921FB 54442D18

2-242
Section 2 Programming Language Double-precision
floating-point calculation FCT

(11) Square root SQRT_DOUBLE


SQRT_DOUBLE computes the square root (SQRT) of the input data.

Name, Symbol, Function Example


<Operation>
Name

SQRT_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


3 1.73205080756888
D_REAL SQRT_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


40080000 00000000 3FFBB67A E8584CAA

1) SQRT_DOUBLE calculates the square


Function

root (SQRT) of the input data. • Computation example 2)


2) The input data range is D_REAL type data
D_REAL Compute D_REAL
that is 0 or higher.
3) If the input data is negative, the output is 10000 100

set to 0 and ENO is set to FALSE (0). EN=1 ENO=1

UDATA LDATA UDATA LDATA


40C38800 00000000 40590000 00000000

(12) Exponent EXP_DOUBLE


EXP_DOUBLE computes the exponent (EXP) of the input data.

Name, Symbol, Function Example


<Operation>
Name

EXP_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


0.0001 1.00010000500017
D_REAL EXP_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3F1A36E2 EB1C432D 3FF00068 DCE3484E

1) EXP_DOUBLE calculates the exponent


Function

(EXP) of the input data. • Computation example 2)


2) If the result of calculation exceeds the valid
D_REAL Compute D_REAL
range of D_REAL type (overflows), the
boundary value of D_REAL type is output. 100 2.68811714181614E+43

ENO is set to FALSE (0) in this case. EN=1 ENO=1


3) If the result of calculation is so close to 0 UDATA LDATA UDATA LDATA
that the result cannot be expressed in
40590000 00000000 48F3494A 9B171BF5
D_REAL type, the output is 0.

2-243
Section 2 Programming Language Double-precision
floating-point calculation FCT

(13) Natural logarithm LN_DOUBLE


LN_DOUBLE computes the natural logarithm (LN) of the input data.

Name, Symbol, Function Example


<Operation>
Name

LN_DOUBLE
• Computation example 1)
Symbol

D_REAL Compute D_REAL


0.01 - 4.60517018598809
D_REAL LN_DOUBLE D_REAL EN=1 ENO=1

UDATA LDATA UDATA LDATA


3F847AE1 47AE147B C0126BB1 BBB55515

1) LN_DOUBLE calculates the natural


Function

logarithm (LN) of the input data. • Computation example 2)


2) If the result of calculation is so close to 0
D_REAL Compute D_REAL
that the result cannot be expressed in
D_REAL type, the output is 0. 100.0 4.60517018598809

3) If the input value is 0, the output is the EN=1 ENO=1


negative maximum value and ENO is set UDATA LDATA UDATA LDATA
to FALSE (0).
40590000 00000000 40126BB1 BBB55516
4) If the input value is negative, the output is
0 and ENO is set to FALSE (0).

2-244
Section 2 Programming Language Double-precision
floating-point calculation FCT

2-4-14-5 Comparison functions


(1) Comparison EQ_DOUBLE
EQ_DOUBLE compares double-precision floating-point data to see if they are the same.

Name, Symbol, Function Example


<Operation>
Name

EQ_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL

EQ_DOUBLE 1234 = 1111 FALSE


D_REAL BOOL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA
40934800 00000000 40915C00 00000000

1) EQ_DOUBLE compares the first and


Function

second parameters and outputs TRUE (1) • Computation example 2)


if they are the same and outputs FALSE
D_REAL D_REAL Compute D_REAL
(0) otherwise.
1234 = 1234 TRUE
EN=1 ENO=1

UDATA LDATA UDATA LDATA


40934800 00000000 40934800 00000000

(2) Comparison NE_DOUBLE


NE_DOUBLE compares double-precision floating-point data to see if they are different.

Name, Symbol, Function Example


<Operation>
Name

NE_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL

NE_DOUBLE 1234 ≠ 1111 TRUE


D_REAL BOOL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA
40934800 00000000 40915C00 00000000

1) NE_DOUBLE compares the first and


Function

second parameters, and outputs TRUE (1) • Computation example 2)


if they are not the same and outputs
D_REAL D_REAL Compute D_REAL
FALSE (0) otherwise.
1234 ≠ 1234 FALSE
EN=1 ENO=1

UDATA LDATA UDATA LDATA


40934800 00000000 40934800 00000000

2-245
Section 2 Programming Language Double-precision
floating-point calculation FCT

(3) Comparison GT_DOUBLE


GT_DOUBLE compares the size of double-precision floating-point data.

Name, Symbol, Function Example


<Operation>
Name

GT_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL

GT_DOUBLE 1234 > 1111 TRUE


D_REAL BOOL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA
40934800 00000000 40915C00 00000000

1) Compares the first and second


Function

parameters, and outputs TRUE (1) if the • Computation example 2)


first parameter is greater than the second
D_REAL D_REAL Compute D_REAL
parameter and outputs FALSE (0)
otherwise. 1234 > 1234 FALSE
EN=1 ENO=1

UDATA LDATA UDATA LDATA


40934800 00000000 40934800 00000000

(4) Comparison GE_DOUBLE


GE_DOUBLE compares the size of double-precision floating-point data.

Name, Symbol, Function Example


<Operation>
Name

GE_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL

GE_DOUBLE 1234 >= 1234 TRUE


D_REAL BOOL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA
40934800 00000000 40934800 00000000

1) Compares the first and second


Function

parameters, and outputs TRUE (1) if the • Computation example 2)


first parameter is greater than or equally
D_REAL D_REAL Compute D_REAL
the second parameter and outputs FALSE
(0) otherwise. 1234 >= 2000 FALSE
EN=1 ENO=1

UDATA LDATA UDATA LDATA


40934800 00000000 409F4000 00000000

2-246
Section 2 Programming Language Double-precision
floating-point calculation FCT

(5) Comparison LT_DOUBLE


LT_DOUBLE compares the size of double-precision floating-point data.

Name, Symbol, Function Example


<Operation>
Name

LT_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL

LT_DOUBLE 1234 < 1234 FALSE


D_REAL BOOL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA
40934800 00000000 40934800 00000000

1) Compares the first and second


Function

parameters, and outputs TRUE (1) if the • Computation example 2)


first parameter is lesser than the second
D_REAL D_REAL Compute D_REAL
parameter and outputs FALSE (0)
otherwise. 1234 < 2000 TRUE
EN=1 ENO=1

UDATA LDATA UDATA LDATA


40934800 00000000 409F4000 00000000

(6) Comparison LE_DOUBLE


LE_DOUBLE compares the size of double-precision floating-point data.

Name, Symbol, Function Example


<Operation>
Name

LE_DOUBLE
• Computation example 1)
Symbol

D_REAL D_REAL Compute D_REAL

LE_DOUBLE 1234 <= 1111 FALSE


D_REAL BOOL EN=1 ENO=1
D_REAL
UDATA LDATA UDATA LDATA
40934800 00000000 40915C00 00000000

1) Compares the first and second


Function

parameters, and outputs TRUE (1) if the • Computation example 2)


first parameter is lesser than or equally
D_REAL D_REAL Compute D_REAL
the second parameter and outputs FALSE
(0) otherwise. 1234 <= 1234 TRUE
EN=1 ENO=1

UDATA LDATA UDATA LDATA


40934800 00000000 40934800 00000000

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

Project type Opening project Compiling


UROM on PC Possible
UROM on main unit Possible Compilation error
Compression project Possible

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

Declare the D_REAL


type variable.

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

A compilation error will occur


if the program is branched.

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

Statement Statement A control statement, which is made up of


statements, conditional expressions, and
executable statements, is terminated by
Conditional expression Executable statement a semicolon (“;”).
A conditional expression An executable statement
consists of variables, consists of variables,
an operator (e.g., >), operators, and an
and immediate values. assignment statement.

* Statements, conditional expressions, and executable statements must be separated by at least one space character.

2-5-2 ST operators

No. Operation Operator Data type Description Sample value Precedence


1 Parentheses (expression) (2+3)*(4+5) 45 Highest

Function name LN(A)


2 Function
(parameter) MAX(X, Y)
3 Exponentiation ** REAL (base, exponent) 3.0**4.0 8.1E+1
4 Sign inversion - INT, DINT, REAL -Voo1 (Voo1=10) -10
Logical NOT of
5 Logical not NOT BOOL, WORD, DWORD FALSE
each list
6 Multiplication * INT, DINT, UINT, UDINT, REAL 10*3 30
7 Division / INT, DINT, UINT, UDINT, REAL 6/2 3
8 Division remainder MOD INT, DINT, UINT, UDINT 17 MOD 10 7
9 Addition + INT, DINT, UINT, UDINT, REAL 2+3 5
10 Subtraction - INT, DINT, UINT, UDINT, REAL 4-2 2
Elementary
11 Comparison <, >, <=, >= 4>12 FALSE
(excluding STRING type)
Elementary
12 Equality = T#26h =T#1d2h TRUE
(excluding STRING type)
Elementary
13 Inequality <> 8<>16 TRUE
(excluding STRING type)
14 Logical product &, AND BOOL, WORD, DWORD TRUE & FALSE FALSE
15 Exclusive or XOR BOOL, WORD, DWORD TRUE XOR FALSE TRUE
16 Logical add OR BOOL, WORD, DWORD TRUE OR FALSE TRUE Lowest

2-250
Section 2 Programming Language ST language

2-5-3 ST statements

Format Description Page


Assignment statement.
:= Assigns the value of the expression, variable, or numeric value on the right-hand side to the variable P2-251
on the left-hand side.
Condition statement.
IF P2-252
Executes the executable statement if the conditional expression is true.
Condition statement.
CASE
Selects the executable statement to be executed according to the value of the conditional expression. P2-253
Iteration statement.
FOR Repeatedly executes the executable statement according to the initial value, final value, and P2-254
incremental or decremental value.
Iteration statement.
WHILE P2-255
Repeatedly executes the executable statement while the loop condition is true.
Iteration statement.
REPEAT P2-255
Repeatedly executes the executable statement until the loop condition is true.
Return statement.
RETURN P2-256
Returns control from the called function or function block to the calling POU.
Exit statement.
EXIT P2-256
Used to exit an iteration loop.

2-5-4 ST language statements


(1) Assignment statement (:=)

Name, Symbol, Function Example


<Statement construction>
Name Symbol Function

Assignment statement variable := expression, variable, or numeric value;

<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

Name, Symbol, Function Example


<Statement constructions>
Name

IF statement (1) IF, THEN construction

IF <conditional expression> THEN <executable statement>;


Symbol

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

expression evaluates to be false. statement


the conditional expression evaluates to
be true.
(2) IF, ELSE construction
(2) The conditional expression can contain
only the data that evaluates to BOOL
IF <conditional expression> THEN <executable statement 1>;
type data.
ELSE <executable statement 2>;
(3) An IF statement must always be paired
END_IF;
with an END_IF statement.
(4) A single conditional expression may
The executable statement 1 is executed
have two or more executable statements. False
when the conditional expression Conditional
(5) The conditional expression may be a expression
evaluates to be true.
variable of type BOOL.
The executable statement 2 is executed True
(6) Up to 30 levels of nesting are allowed.
when the conditional Executable Executable
statement 1 statement 2
expression evaluates to be false.

(3) IF, ELSIF construction

IF <conditional expression1> THEN <executable statement 1>;


ELSIF <conditional expression2> THEN <executable statement 2>;
ELSIF <conditional expression3> THEN <executable statement 3>;

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

The executable statement 1 is executed when the conditional


expression 1 evaluates to be true.
The executable statement 2 is executed when the conditional
expression 2 evaluates to be true.
The executable statement 3 is executed when the conditional
expression 3 evaluates to be true.
Nothing is executed if none of the conditional expressions evaluate
to be true.
<Programming examples>
The sample program shown below assigns 10 to M if N = 0, 20 to M
if N = 1, 30 to M and 40 to L if N = 2. *
It assigns 123 to M if N has a value other than 0, 1, and 2.

IF N=0 THEN M:= 10;


ELSIF N= 1 THEN M:= 20;
ELSIF N= 2
THEN M:= 30;
L:= 40; * Example of two or more executable
ELSE M:= 123; statements for a single conditional expression:
END_IF;

2-252
Section 2 Programming Language ST language

(3) CASE statement

Name, Symbol, Function Example


<Statement construction>
Name

CASE statement
CASE <conditional expression> OF
<selection value 1>: <executable statement 1>;
Symbol

<selection value 2>: <executable statement 2>;


CASE <selection value m>: <executable statement m>
ELSE <executable statement n>;
END_CASE;

(1) The executable statement to be executed is


Function

selected according to the value is executed Selection YES


if the conditional expression evaluates to be value 1 ?
true.
NO Executable
(2) Only INT type data is allowed for the statement 1
YES
conditional expression and selection values. Selection
value 2 ?
(3) A CASE statement must always be paired
with OF and END_CASE statements. NO
Executable
(4) A single conditional expression may have statement 2
two or more executable statements.
(5) Up to 30 levels of nesting are allowed. YES
Selection
(6) An enum type (example, 1, 2, 3, ...) or value m ?
range type (example, 1..10) may be used
NO
for the selection values.
Executable Executable
statement n statement m

<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

(4) FOR statement

Name, Symbol, Function Example


<Statement construction>
Name

FOR statement
FOR <a:=initial value> TO <final value> BY <incremental value> DO
<executable statement>
Symbol

END FOR;
FOR
Loop variable (initial value)

(1) The FOR statement performs loop


Function

processing. The loop conditions are Loop variable


given by the initial value, final value, and True >= final value
incremental value.
False
(2) The type of data that can be used as the
Executable statement
initial value, final value, and incremental
value is ANY_INT type
Loop variable +
(INT, DINT, UINT, or UDINT). incremental value
(3) A FOR statement must always be paired
with TO, BY, DO, and END_FOR
statements.
(4) Up to 30 levels of nesting are allowed.

<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

(5) WHILE statement

Name, Symbol, Function Example


<Statement construction>
Name

WHILE statement
WHILE <loop condition> DO
<executable statement>;
Symbol

END_WHILE;
WHILE

Loop False
conditional
expression
(1) The WHILE statement performs loop
Function

processing. It executes the executable True


statement while its loop condition evaluates Executable statement
to be true.
(2) A WHILE statement must always be paired
with DO and END_WHILE statements.

Note) If a repeat condition has been false <Programming example>


before the loop processing is executed, The sample program shown below divides the value of b by 2
no Execution statement is processed. while b > 1 and assigns the result (quotient) to b. The fractional
part of the quotient is truncated b.

a:=1;
WHILE b>1 DO
b:=b/2;
f[a]:=b;
a:=a+1;
END_WHILE;

(6) REPEAT statement

Name, Symbol, Function Example


<Statement construction>
Name

REPEAT statement
REPEAT
<executable statement>;
Symbol

UNTIL <final condition>


END_REPEAT;
REPEAT

Executable statement
(1) The REPEAT statement performs loop
Function

processing. It executes the executable Loop


statement until its loop condition evaluates conditional False
to be true. expression
(2) A REPEAT statement must always be
True
paired with UNTIL and END_REPEAT
statements.
<Programming example>
The sample program shown below computes a sum of numbers
Note) Even if the value for a final condition
from 1 to 10.
has been true before the loop
processing is executed, the execution
a:=1;
statement is always processed more
total:=0;
than one time.
REPEAT
total:=total+a;
a:=a+1;
UNTIL a >10
END_REPEAT;

2-255
Section 2 Programming Language ST language

(7) RETURN statement

Name, Symbol, Function Example


<Statement construction>
Name

RETURN statement RETURN;

<Programming example>
Symbol

When returning control to the user function “FUNCT”


RETURN FUNCT
BOOL INT
IN
Function of <FUNCT>
FUNCT returns 500 if IN is true
(1) The RETURN statement returns control and 100 if IN is false.
Function

from a user function or usr function block to


the calling POU.
IF IN=TRUE
THEN FUNCT:=500; (* Sets the return value to 500 *)
RETURN; (* Returns without executing the *)
END_IF; (* following statements *)
FUNCT:=100;
RETURN;

(8) EXIT statement

Name, Symbol, Function Example


<Statement construction>
Name

EXIT statement EXIT;


<Programming examples>
The sample program shown below exits the loop when M + N
Symbol

becomes greater than 20 where M is the initial value.


EXIT (* Exiting from a FOR loop *)
FOR N:=1 TO 10 BY 1 DO
M:=M+N ;
IF M > 20 THEN EXIT ;
(1) The EXIT statement terminates processing
Function

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 ;

(* Exiting from a REPEAT loop *)


N:=1 ;
REPEAT
M:=M+N ;
IF M > 20 THEN EXIT ;
END_IF ;
N:=N+1 ;
UNTIL N > 10
END_REPEAT ;

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.

<Examples of IL language instructions>

Variable name Comment


A comment begins with
“(*“gand ends with”*).”
Instruction symbol
The instruction symbol must be described in uppercase.
The instruction symbol and the variable name must be
separated by at least one blank character.

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-6-2 IL instruction summary


The IL instructions can be used only in the IL language.

Instruction Name Data type Description No. of


Page
steps
LD Load ANY Loads the operand value and sets it to the operation result. 1 P2-261
Loads the inverted value of the operand and sets it to the operation
LDN Load not ANY_BIT 1 P2-261
result.
ST Store ANY Stores the current operation result in the operand. 1 P2-262
Stores the inverted value of the current operation result in the
STN Store not ANY_BIT 1 P2-262
operand.
S Set BOOL Sets the operand to 1 if the current operation result is 1. 1 P2-263
R Reset BOOL Resets the operand to 0 if the current operation result is 1. 1 P2-263
Operates the logical product of the current operation result and the
AND 1 P2-264
operand value, and sets the result to the operation result.
Logical
ANY_BIT Operates the logical product of the current operation result and the
product
AND( operation result specified in parentheses, and sets the result to the 1 P2-264
operation result.
Operates the logical product of the current operation result and
ANDN the inverted value of the operand value, and sets the result to the 1 P2-265
Logical operation result.
inverted ANY_BIT
product Operates the logical product of the current operation result and the
ANDN( inverted value of the operation value specified in parentheses, and 1 P2-265
sets the result to the operation result.
Operates the logical add of the current operation result and the
OR 1 P2-266
operand value, and sets the result to the operation result.
Logical add ANY_BIT Operates the logical add of the current operation result and the
OR( operation result specified in parentheses, and sets the result to the 1 P2-266
operation result.
Operates the logical add of the current operation result and the
ORN inverted value of the operand value, and sets the result to the 1 P2-267
Logical operation result.
ANY_BIT
inverted add Operates the logical add of the current operation result and the
ORN( inverted value of the operation result specified in parentheses, and 1 P2-267
sets the result to the operation result.
Operates the exclusive OR of the current operation result and the
XOR 1 P2-268
operand value, and sets the result to the operation result.
Exclusive
ANY_BIT Operates the exclusive OR of the current operation result and the
OR
XOR( operation result specified in parentheses, and sets the result to the 1 P2-268
operation result.
Operates the exclusive NOR of the current operation result and the
XORN inverted value of operand value, and sets the result to the operation 1 P2-269
Exclusive result.
ANY_BIT
NOR Operates the exclusive NOR of the current operation result and the
XORN( inverted value of the operation result specified in parentheses, and 1 P2-269
sets the result to the operation result.

2-258
Section 2 Programming Language IL language

Instruction Name Data type Description No. of


Page
steps
Operates the addition of the current operation result and the
ADD 1 P2-270
operand value, and sets the result to the operation result.
Addition ANY_NUM Operates the addition of the current operation result and the
ADD( operation result specified in parentheses, and sets the result to the 1 P2-270
operation result.
Operates the subtraction of the operand value from the current
SUB 1 P2-271
operation result, and sets the result to the operation result.
Subtraction ANY_NUM Operates the subtraction of the operation result specified in
SUB( parentheses from the current operation result, and sets the result 1 P2-271
to the operation result.
Operates the multiplication of the current operation result and the
MUL 1 P2-272
operand value, and sets the result to the operation result.
Multiplication ANY_NUM Operates the multiplication of the current operation result and the
MUL( operation result specified in parentheses, and sets the result to the 1 P2-272
operation result.
Operates the division of the current operation result by the operand
DIV 1 P2-273
value, and sets the result to the operation result.
Division ANY_NUM Operates the division of the current operation result by the
DIV( operation result specified in parentheses, and sets the result to the 1 P2-273
operation result.
Operates the comparison of the current operation result as the left-
GT elementary hand side of the “>” operator with the operand value as the right- 1 P2-274
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(>)
hand side of the “>” operator with the operation result specified
GT( (Note) 1 P2-274
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
GE elementary hand side of the “>= “ operator with the operand value as the right- 1 P2-275
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(>=)
hand side of the “>= “operator with the operation result specified
GE( (Note) 1 P2-275
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
EQ elementary hand side of the “=” operator with the operand value as the right- 1 P2-276
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(=)
hand side of the “=” operator with the operation result specified
EQ( (Note) 1 P2-276
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
NE elementary hand side of the “≠” operator with the operand value as the right- 1 P2-277
(excluding hand side, and sets the result (BOOL value) to the operation result.
Comparison
STRING) Operates the comparison of the current operation result as the left-
(≠)
hand side of the “≠” operator with the operation result specified
NE( (Note) 1 P2-277
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.

Notes:
BOOL type cannot be used for GT, GT(, GE or GE(, either.

2-259
Section 2 Programming Language IL language

Instruction Name Data type Description No. of


Page
steps
Operates the comparison of the current operation result as the left-
LE hand side of the “<=” operator with the operand value as the right- 1 P2-278
elementary hand side, and sets the result (BOOL value) to the operation result.
Comparison
(excluding Operates the comparison of the current operation result as the left-
(<=)
STRING) hand side of the “<=” operator with the operation result specified
LE( 1 P2-278
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Operates the comparison of the current operation result as the left-
LT hand side of the “<” operator with the operand value as the right- 1 P2-279
elementary hand side, and sets the result (BOOL value) to the operation result.
Comparison
(excluding Operates the comparison of the current operation result as the left-
(<)
STRING) hand side of the “<” operator with the operation result specified
LT( 1 P2-279
in parentheses as the right-hand side, and sets the result (BOOL
value) to the operation result.
Unconditional Jumps to the step specified by the label of the operand.
JMP – 1 P2-280
jump
TRUE Jumps to the step specified by the label of the operand when the
JMPC conditional – current operation result is TRUE (nonzero). 1 P2-280
jump
FALSE Jumps to the step specified by the label of the operand when the
JMPCN conditional – current operation result is FALSE (zero). 1 P2-281
jump
Label of the Indicates the destination address.
Label_name destination – 0 P2-40
address
Unconditional Calls the function block specified in the operand.
CAL – 1 P2-281
call
TRUE Calls the function block specified in the operand if the current
CALC conditional – operation result is TRUE (nonzero). 1 P2-282
call
FALSE Calls the function block specified in the operand if the current
CALCN conditional – operation result is FALSE (zero). 1 P2-282
call
Unconditional Returns to the calling program.
RET – 1 P2-283
return
TRUE Returns to the calling program if the current operation result is
RETC conditional – TRUE (nonzero). 1 P2-283
return
FALSE Returns to the calling program if the current operation result is
RETCN conditional – FALSE (zero). 1 P2-284
return
Closing Performs the deferred operation.
) – 1 –
parenthesis

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

2-6-3 IL language instructions


(1) Load LD

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

• When the data type of INPUT1 is INT type


INPUT1 1 2 3 4

Operation result 1 2 3 4

• When the data type of INPUT1 is WORD type


INPUT1 1 0 0 0 1 0 0 0 1 0 0 1 1 0 1 0

Operation result 1 0 0 0 1 0 0 0 1 0 0 1 1 0 1 0

(2) Load not LDN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Store Stores the current operation result (before the ST instruction) in


“OUTPUT.”

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

• When the data type of the operation result is INT type


Operation result 1 2 3 4

OUTPUT 1 2 3 4

• When the data type of the operation result is WORD type


Operation result 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1 1

OUTPUT 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1 1

(4) Store not STN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Set Sets the value of “OUTPUT” to “TRUE” if the value of “INPUT” is


“TRUE.”

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.

OUTPUT TRUE  TRUE

(6) Reset R

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(7) Logical product AND

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(8) Logical product AND(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(9) Logical inverted product ANDN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(10) Logical inverted product ANDN(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(11) Logical add OR

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(12) Logical add OR(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(13) Logical inverted add ORN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(14) Logical inverted add ORN(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(15) Exclusive OR XOR

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(16) Exclusive OR XOR(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(17) Exclusive NOR XORN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(18) Exclusive NOR XORN(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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.

(1) Operates the exclusive NOR of the current LD INPUT1


operation result and the inverted value of XORN( INPUT2
the operation result specified in AND INPUT3
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 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1

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

(19) Addition ADD

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Addition Operates the addition of the current operation result and the “ADATA”
data, and sets the result to the operation result.

ADD ADD ADATA

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

(20) Addition ADD(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(21) Subtraction SUB

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Subtraction Operates the subtraction of the “SDATA” value from the current operation
result, and sets the result to the operation result.

SUB SUB SDATA

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

(22) Subtraction SUB(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Subtraction Operates the subtraction of the sum of “INPUT1” and “INPUT2” from the
current operation result, and sets the result to the operation result.

SUB( SUB( INPUT1


ADD INPUT2
(1) Operates the subtraction of the operation )
result specified in parentheses from the
current operation result, and sets the result <Operation> Example of INT type data
to the operation result. • When the result of operation falls within the valid value range
(2) The data type of the operands must be the Current operation Result of operation Operation result
same. result specified in
(3) Available data type is ANY_NUM type parentheses
(REAL type, INT type, DINT type, UINT type Operation
or UDINT type). 5678 - 1234 4444
(4) ENO is set to 0 if the result of operation EN=1 ENO=1
exceeds the valid value range of the • When the result of execution exceeds the valid value range
operands (only for SPH). Operation
(5) For REAL type data, when the operation -32767 - 50 32718
results approaches 0 (zero) and cannot be EN=1 ENO=0
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.

2-271
Section 2 Programming Language IL language

(23) Multiplication MUL

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Multiplication Operates the multiplication of the current operation result and the
“MDATA” data, and sets the result to the operation result.

MUL MUL MDATA

(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

or UDINT type). -32768 x 32767 -32768


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.

(24) Multiplication MUL(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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.

MUL( MUL( INPUT1


ADD INPUT2
(1) Operates the multiplication of the current )
operation result and the operation result
specified in parentheses, and sets the <Operation> Example of INT type data
result to the operation result. • When the result of operation falls within the valid value range
(2) The data type of the operands must be the Current operation Result of operation Operation result
same. result specified in
(3) When the operation result exceeds the valid parentheses
value range of the data type, it is treated as Operation

follows: 222 x 10 2220


EN=1 ENO=1
The upper limit value or lower limit value of
the data type is output, and ENO is set to • When the result of operation exceeds the valid value range
“0.” Operation
(4) Available data type is ANY_NUM type 32767 x 32767 32767
(REAL type, INT type, DINT type, UINT type EN=1 ENO=0
or UDINT type).
(5) For REAL type data, when the operation Operation
results approaches 0 (zero) and cannot be -32768 x 32767 -32768
expressed by REAL type, output value and EN=1 ENO=0
EN0 become “0” and “1,” respectively.

2-272
Section 2 Programming Language IL language

(25) Division DIV

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Division Operates the division of the current operation result by the “DDATA”
data, and sets the result to the operation result.

DIV DIV DDATA

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

(26) Division DIV(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(28) Comparison GT(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(30) Comparison GE(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(32) Comparison EQ(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(34) Comparison NE(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(36) Comparison LE(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

(38) Comparison LT(

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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

same. 1234 < 1111 FALSE


(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-279
Section 2 Programming Language IL language

(39) Unconditional jump JMP

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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:

(40) TRUE conditional jump JMPC

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

TRUE conditional jump Jumps from “JMPC ERROR” to the instruction that is labeled
“ERROR” if either “INPUT1” or “INPUT2” is TRUE.

JMPC Note: “INPUT1” and “INPUT2” are


LD INPUT1
assumed to be BOOL type.
TRUE OR INPUT2
(1) Jumps to the step specified by the label of JMPC ERROR
the operand when the current operation
result is TRUE. The instruction following
ST OUTPUT
this instruction is executed if the current AND XP4
operation result is FALSE.
ERROR:
LD FLAG
ST STATE

2-280
Section 2 Programming Language IL language

(41) FALSE conditional jump JMPCN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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.

(42) Unconditional call CAL

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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.

(1) Calls unconditionally the function block LD INPUT1


ST FB_1.IN1 Call FB_1
specified in the operand.
LD INPUT2 FB
ST FB_1.IN2 IN1
CAL FB_1 OUT1
LD FB_1.OUT1 IN2
ST OUTPUT1

2-281
Section 2 Programming Language IL language

(43) TRUE conditional call CALC

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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.

(1) Calls the function block specified in the LD INPUT1


ST FB_1.IN1
operand if the current operation result is Call FB_1
LD INPUT2
TRUE. ST FB_1.IN2 FB
If the current operation result is FALSE, LD FBCALL IN1
the function block is not called and the next CALC FB_1 OUT1
sequential instruction is executed. LD FB_1.OUT1 IN2
ST OUTPUT1

(44) FALSE conditional call CALCN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

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.

(1) Calls the function block specified in the LD INPUT1


ST FB_1.IN1
operand if the current operation result is Call FB_1
LD INPUT2
FALSE. ST FB_1.IN2 FB
If the current operation result is TRUE, the LD FBCALL IN1
function block is not called and the next CALCN FB_1 OUT1
sequential instruction is executed. LD FB_1.OUT1 IN2
ST OUTPUT1

2-282
Section 2 Programming Language IL language

(45) Unconditional return RET

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

Unconditional return

LD INPUT1 User-supplied function block


RET AND PSWICH
ST IN2

(1) Returns unconditionally to the instruction


immediately following the instruction that LD OUT1
called the current program (e.g., CAL). ST OUTPUT1
RET

(46) TRUE conditional return RETC

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

TRUE conditional return

LD INPUT1
RETC AND PSWICH
ST IN2 User-supplied function block

(1) Returns unconditionally to the instruction


immediately following the instruction that LD OUT1
called the current program (e.g., CAL) if the ST OUTPUT1
current operation result is TRUE. AND FLAG7
RETC
The next sequential instruction is executed
LD INPUT2
if the current operation result is FALSE.

RET

2-283
Section 2 Programming Language IL language

(47) FALSE conditional return RETCN

Name, Symbol, Function Example


<Programming example>
Name Symbol Function

FALSE conditional return

LD INPUT1
RETCN AND PSWICH
ST IN2 User-supplied function block

(1) Returns unconditionally to the instruction


immediately following the instruction that LD OUT1
called the current program (e.g., CAL) if the ST OUTPUT1
current operation result is FALSE. AND FLAG7
RETCN
The next sequential instruction is executed
LD INPUT2
if the current operation result is TRUE.

RET

2-284
Section 2 Programming Language SFC

2-7 SFC Elements


2-7-1 Structure of SFC
An SFC is a program that specifies the operation of a plant or machine in flowchart form. Since it allows the flow of processes
to be programmed in a natural manner, it facilitates the programmer to develop programs efficiently and to grasp the flow of a
program as the flow of processes.

For example, the process of painting automobiles can be depicted as shown below in an SFC form.

Start

Hold body [Transition condition 1] (T1)


Start
When represented T1
Move [Process 1] (STEP1)
(ACT01) in SFC form
STEP 1 N ACT01
Stop at predefined position [Transition condition 2] (T2) T2
STEP 2 N ACT02
Paint [Process 2] (STEP2)
(ACT02)
T3
STEP 3 N ACT03
End of painting [Transition condition 3] (T2)

Move and dry body [Process 3] (STEP3) Note: Up to 24 characters are allowed for SFC step,
(ACT03) action, and transition names.

The elements of an SFC have the following meanings:

Initial step
(beginning of processing)
Transition
(condition for moving
to the next step) Start

T1 Actions
(describes the process)
STEP 1 N ACT01

Step Action qualifier


(segmented elements of a process) (an alphabetic character indicating
the control at which the action is to be taken)

Step flag (connects the step to an action)

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

2-7-2 Description of SFC


2-7-2-1 SFC elements
(1) Initial step
This step activates the SFC network at the beginning of program execution. Only one initial step is required for an SFC network.

Initial step

The initial step can be programmed in the middle of the SFC network.

Initial step

2-286
Section 2 Programming Language SFC

(2) Normal step


A normal step represents one process in the SFC program. A normal step may be in the active or inactive state. When a normal
step is in the active state, it executes actions according to the control of the action qualifiers.

Note: Actions “A002,” “A005,” and “A006


are executed when the step is active.

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

The jump name must be the


name of the destination step.

2-287
Section 2 Programming Language SFC

(4) Termination step


A termination step is one that has no following transition. It is used to mark the end of an SFC program. A termination step may
be assigned an action which can be used for the termination processing of the application.

Termination step

2-288
Section 2 Programming Language SFC

(5) Action/action qualifier


An action is a real program which is assigned to the initial, normal, and termination steps and which is executed on the object to
be controlled. In an action, the programmer can assign a BOOL variable, or a program in IL, ST, LD, or FBD language.

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:

* For more information about action flag, refer to “2-6-3


ADD Automatically generated SFC variables.”
ACT1.X EN ENO

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

7) SD (Stored and time delayed)


The action is started after a preset time after the step is activated. The action is started after the preset time has elapsed even
when the step is deactivated within the preset time. The action repeatedly continues execution until it is reset by the R qualifier.

S001

T001

ACT1
5s
T004

S005

S001

T001

ACT1
5s
T004

S005

2-291
Section 2 Programming Language SFC

8) DS (Delayed and stored)


The action is started only when the step is held active for longer than a preset time. The action repeatedly continues execution
until it is reset by the R qualifier. The action is not executed if the step is deactivated before the preset time is reached.

S001

T001

ACT1
5s
T004

S005

S001

T001

S005
5s

9) SL (Stored and time limited)


When the step is activated, the action is started and its execution is repeated until a preset time is reached. The action is
stopped when the preset time is reached. This control is not affected even when the step is deactivated (differs from the L
qualifier in this respect).
The R qualifier is used to stop the execution of the action within the preset time.

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

Transition to which a BOOL


variable is directly assigned

The user can assign a BOOL variable or FB to a transition as shown in


the above figure. Programming as shown below when programming by
an IL, ST, LD, or FBD language for a transition.

<Sample program of transition condition to transition“T001”>

2-293
Section 2 Programming Language SFC

2-7-2-2 Step transition


The process of transferring the active state from one step to another is called “transition.” When the current step is active and 
the transition condition for the next step is turned on, the current step is deactivated and the next step is activated.

(1) Single-flow transition


In the example shown below, a transition to S003 occurs when S002 is active and both inputs of transition condition INP1 and
INP2 are set to 1.

Active Inactive

“1”

Inactive Active

(2) Divergence of sequence selection


A single step has two or more step branches, one of which is selected for transition. A maximum of 32 branches are allowed.

Active

“1”
Inactive Inactive

A branch to “S010” occurs when “S013”


is active and “T006” is set to “1.” 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

(3) Convergence of sequence selection


Two or more control flows which are implemented by the divergence of sequence selection converge into one.

Active Inactive

“1”

Inactive

Control is transferred to “S003” when either “S004” or “S005”


is active and the subsequent transition is set to “1.”

Inactive Inactive

Active

2-295
Section 2 Programming Language SFC

(4) Simultaneous sequences-divergence


Control is transferred to two or more steps from one step at the same time. A maximum of 32 branches are allowed.

Active

Inactive Inactive
“1”

Control is transferred to “S007” and “S008”


simultaneously when “S009” is active and Inactive
“T004” is set to “1.”

Active Active

(5) Simultaneous sequences-convergence


Two or more control flows which are implemented by the simultaneous sequences-divergence converge into one.

Active Active

“1”
Inactive

Control transfers to “S018” when both “S016”


and “S017” are active and “T005” is set to
“1.” No transition occurs when either “S016” or
Inactive
“S017” is inactive.

Inactive

Active

2-296
Section 2 Programming Language SFC

2-7-2-3 Automatically generated SFC variables


Step flags and action flags variables are automatically generated in SFC. There is no need for the user to declare step flag and
action flag variables.

Each step has a step flag that


indicates its active/inactive state.

<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-7-3 SFC programming precautions


(1) Step reset processing
The system does not reset the action program that is connected to a step when its state is switched from the active to inactive
state. If necessary, such action programs must be reset by the application.

“OUT” remains on regardless of the state of “IN” when a


step transition occurs with “OUT” being in the “ON” state.

<Example of resetting an action program>


In the above example, “OUT” remains on when the step active state switches from “S018” to “S019.” To turn off “OUT” on state
transition, create the following program in the action:

Add the S018 of step flag as an interlock.

(2) Programming a jump in an action/transition


When programming a jump in an action or transition, make sure that the jump destination falls within the program. A jump
specified in a program must not go out of the program.

2-298
Section 2 Programming Language SFC

(3) Precautions for using a processor link module


If a processor link module (e.g., P/PE link or FL-net) is used and actions are assigned to assign processor link module memory
(beginning with %MX8.1.0.0), do not assign the actions directly as action variables. If this is done, the bit may turn OFF on the
network when the assigned variable is turned ON while the corresponding action is being executed depending on the timing.

<Example>

Action variable: A002


Address assignment: %MX8.1.0.0

<Countermeasure>
Set the action as a body and use the address of the processor link module in the body program.

<Example>

Body named A002

Assign address %MX8.1.0.0 to C000.

2-299
Section 2 Programming Language SFC

2-7-4 Continuous operation of SFC


When compilation is performed using SFC step or action flag as retain variable with D300win, SFC step flag or action flag is
assigned to the retain memory.
This operation enables SFC program to continuously run at warm start of the CPU.
<Operation of D300win>
1) On the “Memory allocation setting” dialog box, click the [Extended setting(A)...] button. The “Extended setting” dialog box
opens.

“Extended setting” dialog box

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

3-1 System Definition Summary....................................................................3-1


3-2 System Configuration Definition............................................................3-2
3-3 System Properties....................................................................................3-5
3-3-1 System running definition................................................................................3-5
(1) SX bus tact time..............................................................................................3-5
(2) Waiting time for structure check
(Setting range: 1s to 180s, Default value: 20s)..............................................3-5
(3) Waiting time mode for structure check............................................................3-5
(3) Initialization method........................................................................................3-6
(4) Start up system without CPU “0”.....................................................................3-6
3-3-2 System redundant mode definition (Not supported by SPH200/SPH3000)....3-8
3-3-3 System fail-soft startup....................................................................................3-9
(1) Fail-soft start up none.....................................................................................3-9
(2) Partial fail-soft startup of modules with SX bus station numbers....................3-9
3-4 System Digital Output Definition.......................................................... 3-11
3-5 CPU Parameters.....................................................................................3-12
3-5-1 CPU running definition..................................................................................3-12
(1) Watchdog timer.............................................................................................3-12
(2) Running specification at power on................................................................3-12
(3) Battery less run.............................................................................................3-12
(4) Constant scanning setting (SPH2000/SPH3000).........................................3-12
(5) Execution band ratio setting (SPH2000/SPH3000)......................................3-13
(6) User ROM operation
(SPH2000/SPH3000 and SPH300 software version V67 or later)...............3-13
(7) Compulsion setting hold state (SPH300 software version V65 or later).......3-13
3-5-2 CPU memory size definition..........................................................................3-15
(1) Setting range of each memory type..............................................................3-15
(2) Memory allocation setting.............................................................................3-18
3-5-3 I/O group setting............................................................................................3-23
3-5-4 Fail-soft operation setting..............................................................................3-27
3-5-5 IP address, gateway......................................................................................3-30

3-6 Input/output Parameters........................................................................3-31


3-6-1 Input filtering time..........................................................................................3-31
3-6-2 Output hold definition....................................................................................3-32
Section 3 System Definition System definition list

3-1 System Definition Summary


Name Definition Related section
System definition Module registration and SX bus station No. in system configuration Section 3-2
System running definition SX bus tact time, waiting time for structure check, initialization method Section 3-3-1
System redundancy setting Redundancy ON/OFF, 1 to 1 redundant mode, N to 1 redundant mode Section 3-3-2
System fail-soft operation
Start Station No. of fail-soft running Section 3-3-3
setting
System digital output definition System digital output module setting Section 3-4
Watch Dog timer setting, battery less run, running specification at power
CPU running definition on, constant scanning setting, execution band ratio setting, user ROM Section 3-5-1
run ON/OFF, and compulsion setting hold state
CPU memory allocation setting Size of various data memories, AT range, and reserved area Section 3-5-2
I/O group setting I/O group registration Section 3-5-3
Fail-soft enabled/disabled for modules (I/O module, etc) other than
Fail-soft operation setting Section 3-5-4
common modules
Input filter time Input filter time for digital input modules (DC input models) Section 3-6-1
Output HOLD definition Hold/reset registration for output modules Section 3-6-2
T-link master module parameter Individual output hold station definition Note 2
OPCN-1 master module
Response time definition Note 2
parameter
DeviceNet master module
Running definition and individual output hold station definition Note 2
parameter
Running definition, structure definition, area setting, and definition of
P/PE-link parameter Note 2
bank change
Running definition, structure definition, area setting, and definition of
FL-net parameter Note 2
bank change

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.

Manual name Manual No.


MICREX-SX Series SPH User's Manual for the T-link Master Module FEH204
MICREX-SX Series SPH User's Manual for the OPCN-1 Master Module FEH238
MICREX-SX Series SPH User's Manual for the DeviceNet Master Module FEH232
MICREX-SX Series SPH User's Manual for the P/PE-link Module FEH203
MICREX-SX Series SPH User's Manual for the FL-net Module FEH234

3-1
Section 3 System Definition System configuration

3-2 System Configuration Definition


Register the modules to be used in the MICREX-SX series system as system configuration definition.

<System configuration example>

T-link master module

I/O I/O I/O I/O I/O I/O


16- 16- 32- 32- 16- 16-
Power point point point point point point
supply CPU input input input input output output

T-link

I/O I/O I/O


16- 16- 16-
Power point point point
supply output output output

T-link interface module

<System configuration definition tree screen>


The figure below shows the system configuration definition tree screen for the above system configuration.

On aggregate type I/O of T-link or the like,


baseboard and power supply module are
necessary but need not be registered.

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.

2) The “Module insert” dialog box opens as shown below.

Enter a name. Click here after setting each item.

Set an SX bus
station No.

(Note 2)
Select a module
attribute type.

Select a module
group type.

Select the module to be registered. (Note 1)

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.

A new module is registered.

<Defining an SX bus station No.>


You need to assign an SX bus station No. to each module (except the power supply module) that is to be connected to the SX
bus. To assign an SX bus station No., use the SX bus station No. field in the “Module insert” dialog box shown above. (Assign a
CPU No. for a CPU or a processor link module).

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

3-3 System Properties


3-3-1 System running definition
(1) SX bus tact time
The SX bus tact time is defined as the period at which data is exchanged between the modules (such as input/output modules)
that are connected to the SX bus. The SX bus tact time that can be set are determined by the CPU software version and CPU
model as shown below. The default value is 1 ms.

CPU software version Setting range


SPH300 V34 and earlier and V3A to V3Z 0.5 ms, 1 ms, 2 ms, ....., 20 ms (steps of 1 ms)
Earlier than SPH300 V50 0.5 ms, 1 ms, 2 ms, ....., 10 ms (steps of 1 ms)
SPH300 V50 and later 0.5 ms, 1 ms, 2 ms, ....., 10 ms (steps of 0.5 ms)
SPH2000, SPH3000 1 ms, 1.5 ms, 2 ms, ....., 10 ms (steps of 0.5 ms)
SPH200 1 ms, 2 ms, ....., 20 ms (steps of 1 ms)

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) Waiting time mode for structure check


1) When “Wait structure agreement” is selected
When the modules on the SX bus that have started up match the system definition settings, the system starts operation even
before the specified “waiting time for structure check” elapses. However, if, in a system that uses an I/O master module such as
a T-link master, any remote I/O slave station (slave station of I/O master) does not start up, the system operates as follows:
• If the fail-soft operation is enabled for the remote I/O slave station, the system starts operation in a nonfatal fault condition.
• If the fail-soft operation is not enabled for the remote I/O slave station, the system stops operation in a fatal fault condition.
In other words, once the modules on the SX bus start up, the system goes to the next operation even before the specified “waiting
time for structure check” elapses.
For SPH300 (software version V68 or earlier), SPH200 (software version V44 or earlier), SPH2000, and SPH3000, the system
always operates in this way (fixed to “Wait structure agreement” mode).

2) When “Wait specified time” is selected


The system does not start operation and monitors whether the modules on the SX bus and remote I/O slave stations start up
until the specified “waiting time for structure check” elapses.
If any of the modules on the SX bus does not start up after the specified time, the system operates according to the settings of
“system fail-soft operation setting.”
If any remote I/O slave station does not start up after the specified time, the system operates as follows:
• If the fail-soft operation is enabled for the remote I/O slave station, the system start operation in a nonfatal fault condition.
• If the fail-soft operation is not enabled for the remote I/O slave station, the system stops operation in a fatal fault condition.
In other words, structure check is performed for the specified time. This setting is effective for a system in which the fail-soft
operation is not enabled for remote I/Os and the power of them cannot be turned ON beforehand.
For SPH300 (software version V69 or later) and SPH200 (software version V45 or later), you can chose between 1) “Wait
structure agreement” and 2) “Wait specified time.”
The following versions of D300win support this setting. When using an earlier version, the system performs operation for when
“Wait structure agreement” is selected.

CPU SPH200 SPH300


D300winV2 Not supported Not supported
D300winV3 V3.4.3.0 or later V3.4.5.0 or later

3-5
Section 3 System Definition System running definition

(3) Initialization method


The CPU module initializes itself when the system power is turned on. You can specify whether the CPU is to perform
diagnostics on the internal memory in the CPU.
The CPU initialization time is approximately 4.5s when memory diagnostics are performed and approximately 2.5s when
memory diagnostics are disabled.
Notes:
1) Memory diagnosis performs device read/write check.
2) The SPH200 does not support this item. (Device read/write check is not performed.)

(4) Start up system without CPU “0”


Set whether to start up the system without a CPU 0 station, on redundant systems and the like.
<Setting procedure>
1) Double-click “System_Definition” in the project tree to display the system definition scree. Select the system property, and
click the [Properties] button, or right-click the system property, and then select “Properties” from the shortcut menu.

Click “properties.”

3-6
Section 3 System Definition System running definition

2) The “System properties” dialog box opens.

Set the SX bus tact time.

Set the waiting time for structure


check in seconds(s).

Select the waiting time mode for structure check.

Select the CPU module initialization method.

Set whether to start up


without CPU 0 station.

3) When setting each item, click the [OK] button.

3-7
Section 3 System Definition Redundancy setting

3-3-2 System redundant mode definition (Not supported by SPH200/SPH3000)


The mode, in which dual CPUs are used for controlling the system to improve system safety and reliability, is called the CPU
redundant system. (See “Section 4 Redundant System” for more information on the redundant mode operation.)
* For the definition of the system redundant mode of SPH2000 (NP1PM-256H), refer to the user’s manual “SPH2000 Redundant
Functions (FEH184).”

<Setting the redundant mode>


1) Display the “System properties” dialog box and click the “Redundancy setting” tab.

Set 1 to 1 redundant mode.


Choose between redundancy ON and OFF.

Set N to 1 redundant mode.

2) When setting each item, click the “OK” button.

<Setting items for 1 to 1 redundant mode>


1) Setting a pair of CPUs
Set a pair of CPUs in the redundant mode.
2) Standby mode
Specify whether the internal data of the working CPU is to be inherited by the standby CPU at startup (warm/cold)
when changeover occurs between CPUs.
3) Memory copy range
Set the range of data to be inherited in case of warm stand-by.
4) Switch
Set a relay-switched pair in the system with more than one 1 to 1 redundant pairs. Check the boxes for all the pairs to be
relay-switched.

<Setting items for N to 1 redundant mode>


1) Setting the working CPUs
Set the working CPUs for each group. The number of working CPUs is any of a range 2-7.
2) Setting the standby CPU
Set only one standby CPU for each group. The CPU already registered as an working CPU cannot be specified.
3) Memory module(s) (Note)
The N to 1 redundant system requires at least one memory module for storing programs of N CPUs. Set the SX station
number for the memory card interface module to be used.

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

3-3-3 System fail-soft startup


(1) Fail-soft start up none
If all the modules registered in the system definition do not start within the “waiting time for structure check” (20 sec. by default),
a system error occurs (the CPU ALM is ON).

(2) Partial fail-soft startup of modules with SX bus station numbers


At MICREX-SX system startup, if some modules on which power is not turned on are detected, the system starts up excluding
these modules after the “waiting time for structure check” elapses.
The system starts operation in a non-fatal fault condition (the CPU module’s “RUN” is ON and “ALM” is ON).

<Example of system configuration at fail-soft startup>

Fail-soft startup start module


SX station No. “100”
SX bus station No. Modules with no SX bus Baseboard with station
“254” “253” station No. selection switch No. setup function
SX bus station SX bus station
No.100 No.101 102
Power supply

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

3-4 System Digital Output Definition


You can define a bit, for each configuration, that indicates the system operation state regardless of the application. This bit is set
to ON when the entire system is running normally and set to OFF if the system has an error. The bit which can be set is bit 0 of
the output module.

<Setting procedure>
1) Select the digital output module for which system output is to be set, and click the [Properties] button.

2) The “Module properties” dialog box opens.

Click here.

3) The “Direct I/O parameter setting” dialog box opens.

Check this option.

Click here after setting each item.

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

3-5 CPU Parameters


3-5-1 CPU running definition
The CPU running definition includes the “watchdog timer setting,” “running specification at power on,” “battery less run,”
“constant scanning setting” (SPH2000/SPH3000), “execution band ratio setting” (SPH2000/SPH3000), “user ROM run” (SPH300/
SPH2000/SPH3000), and “Compulsion setting hold state” (SPH300 only).

(1) Watchdog timer


The user watchdog timer (WDT) monitors default task execution time. The check is performed when the default task ends. If no
default task is used, the CPU performs a process equivalent to the default task, and executes user WDT checking and other
internal processing.

(2) Running specification at power on


This parameter specifies the operation that the CPU module is to perform when system power is turned on when the key switch
on the CPU module front panel is set to RUN or TERM. The table given below shows the relationship between the CPU module
key switch positions and the CPU module operations. A default value is “RUN = Running/TERM = Running.”
<CPU operations and key switch positions>

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) Battery less run


When the battery less run is ON, the CPU module, when activated, initializes its memory to start operation. No data backup
error is detected. The default setting is “OFF.” For SPH200, battery less run is not applicable if no user ROM card (NP8PMF-16)
is mounted.

(4) Constant scanning setting (SPH2000/SPH3000)


When “Yes” is selected, the default task scan time (input + arithmetic processing + output) is constantly executed.
The time setting is between 1 tact time and 2550 ms, inclusive, and set as integer multiple of the system tact time.
* The default setting is “No” (constant scan is disabled).
Notes:
Constant scan operates on an integer multiple of the set tact time. If the system cannot operate at the set tact time, the
constant scan will also be unable to operate at the set cycle. Set the Tact time appropriately, in accordance with the system
configuration.

3-12
Section 3 System Definition CPU running definition

(5) Execution band ratio setting (SPH2000/SPH3000)


This parameter specifies the ratio of application processing time to system processing time within a single tact time.
If many message-communication FBs (e.g. M_SEND, M_RECEIVE, R_READ, and R_WRITE) are used in an SPH2000/
SPH3000 system and the processing load of message communications is large, you can change the execution band ratio to
increase the efficiency of message-communication processing.
Setting range:
Ratios of application arithmetic processing to system processing = 1 to 9, 2 to 8, 3 to 7, 4 to 6, 5 to 5, or 6 to 4.
The default setting is 6 to 4.
Tact time

1) Application arithmetic processing


Input

Application arithmetic

System
Output

System
process-
ing
processing

2)
2)

A tact time is divided into 10 portions. The relation of system


processing to application arithmetic processing can be changed.

1) Application arithmetic processing


Input processing and application arithmetic
2) System processing
Output processing, SPH2000/SPH3000 system monitoring, message-communication processing, application arithmetic
monitoring, etc.

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

Right-click here and select “Settings”


from the shortcut menu.

2) The “Resource setting of MICREX-SX” dialog box opens.

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

To specify a new value,


select “Specify” and
enter a time value from
1 to 4095 (ms).

Specify whether to
perform battery less run.
Select the desired
operation mode.

To set constant scan, select


“Yes,” and specify a scan time.

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

3-5-2 CPU memory size definition


You can set the size of the data memory in the CPU module. Although F memory area has a determined default size, it is
possible to change the size of each area as needed. The size of each area may be changed in 0.5K word increments.

(1) Setting range of each memory type


SPH300 (NP1PS-32/32R)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 2K words 8K words 32K words
Retain memory (%MW3) 0K word 4K words 30K words
User FB instance memory 0K word 4K words 14K words
System FB instance memory 0K word 16K words 30K words

SPH300 (NP1PS-74/74R)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 2K words 32K words 128K words
Retain memory (%MW3) 0K word 16K words 126K words
User FB instance memory 0K word 16K words 113K words
System FB instance memory 0K word 64K words 126K words

SPH300 (NP1PS-117/117R)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 2K words 128K words 256K words
Retain memory (%MW3) 0K word 127K words 254K words
User FB instance memory 0K word 65K words 113K words
System FB instance memory 0K word 64K words 254K words

SPH300 (NP1PS-245R)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 2K words 256K words 383K words (Note)
Retain memory (%MW3) 0K word 127K words 381K words (Note)
User FB instance memory 0K word 65K words 113K words
System FB instance memory 0K word 64K words 510K words

Notes:
The total of the standard memory and retain memory must be 383K or less.

SPH2000 (NP1PM-48R/48E)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 64K words 64K words 96K words
Multi-CPU non-retain (%MW1) 0K word 0K word 32K words
Retain memory (%MW3) 0K word 8K words 32K words
Multi-CPU retain memory (%MW3) 0K word 0K word 32K words
User FB instance memory 0K word 8K words 32K words
System FB instance memory 0K word 16K words 32K words

3-15
Section 3 System Definition CPU memory size

SPH2000 (NP1PM-256E/256H)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 1664K words 1664K words 2048K words
Multi-CPU non-retain (%MW1) 0K word 0K word 384K words
Retain memory (%MW3) 0K word 32K words 32K words
Multi-CPU retain memory (%MW3) 0K word 224K word 384K words
User FB instance memory 0K word 64K words 384K words
System FB instance memory 0K word 64K words 384K words

SPH3000 (NP1PU-048E)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 96K words 96K words 256K words
Multi-CPU non-retain (%MW1) 0K word 0K word 160K words
Retain memory (%MW3) 0K word 8K words 32K words
Note
Multi-CPU retain memory (%MW3) 0K word 32K word 160K words Note 3
2
User FB instance memory 0K word 40K words 160K words
System FB instance memory 0K word 80K words 160K words

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)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 768K words 768K words 1M words
Multi-CPU non-retain (%MW1) 0K word 0K word 256K words
Retain memory (%MW3) 0K word 8K words 32K words
Note
Multi-CPU retain memory (%MW3) 0K word 112K word 256K words Note 3
2
User FB instance memory 0K word 56K words 256K words
System FB instance memory 0K word 80K words 256K words

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)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 1664K words 1664K words 2M words
Multi-CPU non-retain (%MW1) 0K word 0K word 384K words
Retain memory (%MW3) 0K word 8K words 32K words
Note
Multi-CPU retain memory (%MW3) 0K word 224K word 384K words Note 3
2
User FB instance memory 0K word 72K words 384K words
System FB instance memory 0K word 80K words 384K words

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)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 0K word 8K words 31K words
Retain memory (%MW3) 0K word 4K words 31K words
User FB instance memory 0K word 4K words 14928 words
System FB instance memory 0K word 8K words 31K words
Initialization area 0K word 7K words 31K words

SPH200 (NP1PH-08)

Memory type Minimum value Initial value Maximum value


Standard memory (non-retain memory) (%MW1) 0K word 4K words 15K words
Retain memory (%MW3) 0K word 2K words 15K words
User FB instance memory 0K word 2K words 7216 words
System FB instance memory 0K word 4K words 15K words
Initialization area 0K word 3K words 15K words

3-17
Section 3 System Definition CPU memory size

(2) Memory allocation setting


1) Click the [Memory allocation setting] button on the “Resource setting of MICREX-SX” dialog box.

Click here.

2) The “Memory allocation setting” dialog box opens.


Set the sizes of the retain memory, user FB memory, and system FB memory. The size of non-retain memory is the
remaining amount of the data memory. The memory size can be set in 0.5K word increments. The contents of the dialog box
differs depending on the series.
<SPH200 and SPH300>

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

Set whether to add


variables using the
reserve area when
rewriting a POU
while the CPU is
* 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.

<Memory allocation for variables>


In D300win, variables that have not been allocated to a memory are automatically allocated to a memory area when a project
is compiled. The memory allocation is performed optimally in the order of variable declarations. Therefore, if compilation is
performed after the allocation is changed, the memory addresses allocated to the variables may change. When you check “Do
not change the address of the variable which has been compiled last time,” the memory allocation is kept unchanged. The scope
where allocated addresses are kept unchanged is as follows:
• The variables that have the same variable names as last time when compiled successfully are allocated to the same
addresses as last time.
• The variables that were allocated to a reserve area by “Patch POU” (rewriting POU while the CPU is running) are allocated to
the same addresses as the last time.
‹‹This function is used when the addresses that were allocated to the variables when compiled last time should not be changed.
To use this function, “reserve” settings and compilation must be completed. When this option is checked, the setting of other
items on this dialog box cannot be changed.
3-18
Section 3 System Definition CPU memory size

<SPH2000 and SPH3000>


1) Memory allocation for NP1PM-48R/48E

If memory other than non-


retain memory is changed,
the non-retain memory and
memory selected via the
automatic calculation button
become a buffer, increasing
or decreasing in size.
*
In the example of the right
figure, when the multi-CPU *
non-retain memory, retain
memory, multi-CPU retain
memory, or user FB memory
is changed, the system FB
memory selected via the
automatic calculation button
automatically grows or
shrinks.
Set whether to make a buffer
when changing each memory.
If the number of edge
detection, counter, or
addition timer points is
changed, the system FB
capacity other than that
grows or shrinks.

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

2) Memory allocation for NP1PM-256E/256H

If memory size is changed,


the non-retain memory and
memory selected via the
automatic calculation button
become a buffer, increasing
or decreasing in size.

In the example of the right


figure, when the multi-CPU
non-retain memory, retain
memory, multi-CPU retain
memory, or user FB memory
is changed, the system FB
memory selected via the
automatic calculation button
automatically grows or
shrinks.

Set whether to make a buffer


when changing each memory.

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

In the example of the right figure,


when the retain memory, or user
FB normal memory is changed,
the system FB normal memory
selected via the automatic
calculation button automatically
grows or shrinks.

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

Software version Loader version


of NP1PM-256E Earlier than V3.3.7.0 V3.3.7.0 or later

Not supported Not supported


V06 or earlier
(conventional mode) (conventional mode)

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.

‹‹Click the [OK] button to complete the setting.

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

3) Memory allocation for NP1PU-048E128E/256E

If memory size is changed,


the non-retain memory and
memory selected via the
automatic calculation button
become a buffer, increasing
or decreasing in size.

In the example of the right


figure, when the multi-CPU
non-retain memory, retain
memory, multi-CPU retain
memory, or user FB memory
is changed, the system FB
memory selected via the
automatic calculation button
automatically grows or
shrinks.

Set whether to make a buffer


when changing each memory.

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

In the example of the right figure,


when the retain memory, or user
FB normal memory is changed,
the system FB normal memory
selected via the automatic
calculation button automatically
grows or shrinks.

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

3-5-3 I/O group setting


You can specify which I/O module in a configuration can be controlled by which task in which CPU module.
Be sure to set a CPU I/O group for I/O modules. If any I/O module with no I/O group assigned is found, the CPU can detect no
fault if it occurs.

<Setting procedure (1)>


1) Click the [I/O Group Setting] tab in the “CPU Parameter” dialog box, and the following window appears.

Select a task.

Select a module to register


and click the [>>(A)] button.

A [+] mark indicates that there


are modules and units that are
connected to this module.
Clicking here displays the
subordinate modules and units
as shown below.

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

<Setting procedure (2)>


When registering modules in I/O groups only for the “DEFAULT” tasks in a single CPU system, you can use the [Standard
Settings] button.

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.

After setting each item, click here.

3-24
Section 3 System Definition I/O group

<Setting procedure (3)>


Output can be registered in units of 1 bit.

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.

Selected output module

2) The following dialog box opens. Initially, all bits are selected.

* A pressed button indicates


that the corresponding bit is
registered in the I/O group.

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.

After setting each item, click here.

3-25
Section 3 System Definition I/O group

<Setting procedure (4)>


You can register bits of an output module that is used by another CPU in a multi-CPU system to the input selection I/O group of
the local CPU as “inputs” to an application program running on the local CPU.

1) Select an output module and click the [Input for referring output value].

Click here.

Selected output module

2) The following dialog box opens. Initially, all bits are selected.

* A pressed button indicates


that the corresponding bit is
registered in the I/O group.

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.

After setting each item, click here.

* 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

3-5-4 Fail-soft operation setting


Even if a fault occurs in the module with fail-soft enabled and goes down during system operation, the entire system can
continue running.

<Fail-soft operation of MICREX-SX system>


1) Module down
Even if the module with fail-soft enabled has a fault and goes down during system running, the CPU continues running with a
non-fatal system fault (The RUN is On and the ALM is on). If the module with fail-soft disabled has a fault and goes down during
system running, the CPU stops with a fatal system fault (RUN is off and ALM is on).

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.

3) Modules with fail-soft enabled

Common modules with CPU, Inter-processor link, and Unconditionally, fail-soft is


no I/O area general communication modules applicable
Digital I/O, analog I/O, and Register the modules with fail-soft
Modules with I/O area
AS-i master modules enabled

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

4) I/O group and fail-soft registration


The CPU does not control a module (having an I/O area assigned) not registered in an I/O group. Even if the module goes
down, the CPU continues running normally.

Notes on constructing a fail-soft system

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

5) Fail-soft operation setting for a multi-CPU system


For a multi-CPU system, register the modules (with an I/O area) controlled by the self-CPU in the I/O group and also register
them for fail-soft. The system operates as described below in case of a fault.

<Example of system configuration>

I/O group registration I/O group registration


In CPU0, register I/O (1), (2),
and (3) together as one I/O group and
Power source

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

In case of a power failure, a non-fatal system


fault occurs in CPU0 (RUN is on and ALM is on).

<System operation with any fault>


Power source

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.

Select the module (click) for


which fail-soft is to be set and
click the [>(A)] button.
You cannot set fail-soft
individually for the I/O modules
on a group-type I/O unit.

2) The modules are registered as shown below.

For a group-type I/O module unit,


all I/O modules on the base board
are registered for fail-soft.

SX bus-connected modules can be


registered for fail-soft individually.

3-29
Section 3 System Definition IP address

3-5-5 IP address, gateway


You can set the parameters of the CPU module with the Ethernet function.
* For more information on specifications of the Ethernet function and how to use it, refer to the user’s manual “SPH2000/3000
Ethernet Communication (FEH193).”

1) IP address, default gateway


Set the IP address, subnet mask, and default gateway of the CPU module are set.

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

3) FTP user registration


CPU modules with the Ethernet function have the FTP server function. Register users who will access the FTP server.

<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

3-6 Input/output Parameters


3-6-1 Input filtering time
You can set the input filtering time for a DC-type digital input module.
The time is set in the format (OFF-to-ON time) - (ON-to-OFF time). Select a value from 1-1ms, 3-3ms (default), 3-10ms, 10-
10ms, 30-30ms, 100-100ms, and no filtering.
Only for a high-speed input module (NP1X3206-A), “no filter” or a “100-100 µs” input filtering time can be set.

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

Click “Setting,” and


input the filtering time.

2) After specifying the filtering time, click the [OK] button.

3-31
Section 3 System Definition Output hold

3-6-2 Output hold definition


The output hold definition is used to preserve the output state established immediately before a system error occurs or a CPU
module is shut down or to preserve the output state established immediately before the CPU is stopped while the CPU is held
stopped.

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

Click “HOLD mode.”

2) After setting the HOLD mode, click the [OK] button.


* Remote I/Os on the T-link can be set in the HOLD mode.

3-32
Section 4 CPU Redundant System

4-1 System operation in the redundant mode.............................................4-1


4-1-1 1 to 1 redundant mode....................................................................................4-1
(1) Basic system operation...................................................................................4-1
(2) Replacing a faulty CPU with a new one..........................................................4-1
4-1-2 N to 1 redundant mode....................................................................................4-2
(1) Basic system operation...................................................................................4-2
(2) Replacing a faulty CPU with a new one..........................................................4-2
4-2 Conditions for Changeover between Working and Standby CPUs
and Performance......................................................................................4-3
4-2-1 Conditions for changeover..............................................................................4-3
4-2-2 System performance in the redundant mode..................................................4-3
4-2-3 Multi-CPU relay switch....................................................................................4-4
4-2-4 Data equalization.............................................................................................4-5
(1) Timing for equalization....................................................................................4-5
(2) Equalized data area........................................................................................4-6
(3) Equalized data size.........................................................................................4-7
4-2-5 Memory operation at changeover between working and standby CPUs.........4-8

4-3 CPU module LEDs and output to display system.................................4-9


4-4 System Startup with no CPU 0 Station.................................................4-10
Section 4 CPU Redundant System 1:1 redundancy

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

4-1 System operation in the redundant mode


4-1-1 1 to 1 redundant mode
In this mode, one working CPU is associated with one standby CPU. Combinations CPU0-CPU1, CPU2-CPU3, CPU4-CPU5,
and CPU6-CPU7 are established as pairs of working and standby CPUs. In this case, the same application program is used.

<Example of 1 to 1 redundant system configuration>

Working CPU Standby CPU


• Executing an application • Inputting I/O data input Note: When the cold standby method is
• Controling I/Os • Monitoring the working CPU used, equalized data is not inherited.
• Monitoring and controlling • Inputting equalized data from the
the entire system working CPU (Note)
• Outputting equalized data to the
standby CPU (Note)

Power CPU Power CPU Power I/O I/O I/O I/O I/O I/O
supply 0 supply 1 supply

SX bus

(1) Basic system operation


At system power-on, the system starts running, assuming that the CPU modules with even CPU numbers assigned are on the
working side while those with odd CPU numbers are on the standby side. (In the above example, CPU0 is an working CPU and
CPU1 is a standby one.) Additionally, on redundant systems, successive startup with CPUs other than CPU 0 is possible even if
fail-soft start-up is configured. When the working CPU has a fault and goes down, the standby CPU starts running.
The 1 to 1 redundant mode includes two types, warm standby in which the standby CPU inherits data from the working CPU and
cold standby in which the standby CPU does not do so. The data inherited by the standby CPU is called equalized data, and its
range is specified in the system definition.

(2) Replacing a faulty CPU with a new one


In the above example, since only the power module has been installed on the base unit with a CPU mounted on it, the CPU0
can be replaced while CPU1 is running instead of the downed CPU0. To replace the CPU0 with a new one, turn the CPU0
power off, replace it with a new one, and turn the power on. A new CPU0 is assumed to be on the standby side.
When faults occur in both CPUs (on the working and standby sides), turn off the power on both of the systems and then restart
them.
* It is possible to build a redundant system with the working CPU and standby CPU mounted to the same base board. When
replacing either of the CPU modules while the system is in operation, use the hot plug base board.

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

4-1-2 N to 1 redundant mode


In this type of system, more than one (2-7) working CPUs are associated with one standby CPU. Up to two sets of N to 1
redundant groups can be defined for each configuration. The CPU with the largest CPU number among those in a group is a
standby CPU.

<Example of 2 to 1 redundant system configuration>

Working CPU Standby CPU


• Running an application • Monitoring working CPU/entire system
• I/O control
• Monitoring and controlling the entire system

Power CPU Power CPU Power CPU Memory I/O I/O I/O
supply 0 supply 1 supply 2 card
if

SX bus

(1) Basic system operation


At system power-on, the CPU module with the largest CPU number in the N to 1 redundant system is assumed to be a standby
CPU. (In the above example, CPU0 and CPU1 are working CPUs and CPU2 is a standby CPU.)
When the system goes down due to a fault in CPU0 or CPU1, the standby CPU downloads the program of the faulty CPU from
the memory card interface module and starts running.
In the N to 1 redundant mode, only the cold standby method can be applied. No data is inherited from the working CPU.

(2) Replacing a faulty CPU with a new one


In the above example, since only the power module has been installed on the base unit with a CPU mounted on it, the CPU can
be replaced while CPU2 is running instead of the downed CPU1.
To replace the CPU1 with a new one, turn the CPU1 power off, replace it with a new one, and turn the power on. A new CPU
module is assumed to be on the standby side, and is waiting for a switching instruction from the loader or system power reset.
This means that the system is not in the N to 1 redundant system.

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

• Fault in application operation processor


Fault in CPU a
• Fault in OS processor
• Fault in system memory (ROM/RAM)
Fault in memory • Fault in application memory (ROM/RAM) a
• Fault in memory battery backup
Fatal fault in working
CPU • Fault in SX bus control LSI
a
• Fault in processor bus access (caused by self-module)

Fault in SX bus • Duplicate station number


• Excessive number of connected modules a
• Fault in SX bus transmission (Note 1)
• Delay in I/O refresh
Power failure • Base power shutdown a
• User program error
Application error • Application WDT error
Fatal fault in working a
• Application run error
resource
• Fault in SX bus-connected I/O controlled by self CPU module
Fault in I/O module –
and remote I/O module (Fail-soft disabled)
User fatal fault • User fatal fault detected –
Changeover instruction
Changeover between working and standby CPUs by loader a
by loader
In the multi-CPU redundant system (1 to 1 mode), one CPU is switched due to a fault,
Multi-CPU relay switch a
followed by another CPU.

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.

4-2-2 System performance in the redundant mode

Switching time Tact time Scan time


1 to 1 redundant mode Within 130ms The same tact time as in the The same scan time as in the ordinary multi-
cold standby (Note 2) ordinary multi-CPU system CPU system
1 to 1 redundant mode Within 130ms Tact time in the ordinary multi-CPU Scan time in the ordinary multi-CPU system +
warm standby (Note 2) system + 1-3ms several ms-several tens of ms
N to 1 redundant mode The same tact time as in the The same scan time as in the ordinary multi-
Several tens sec.
cold standby ordinary multi-CPU system CPU system

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

4-2-3 Multi-CPU relay switch


Usually, in the 1 to 1 redundant mode, changeover is done between a pair of working and standby CPUs. In the multi-CPU
system, when you want to switch between another pair of CPUs following changeover between a pair of working and standby
CPUs, set the relay switch mode. This enables the system to switch between both CPUs automatically.

<Example of three-pair relay switch system configuration in the 1 to 1 redundant mode>

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

4-2-4 Data equalization


In the 1 to 1 redundant mode warm standby system, the internal data of the working CPU and standby CPU with varying
arithmetical operations may be equalized. This is called equalization. The specifications of equalization are described below.

(1) Timing for equalization


Data is equalized at the scan end of the default task (synchronized with the task). Data can be copied at the same timing as that
of the scan end of the default task even if any task shorter than the scan time is executed.

Example of
ordinary system
Tact time (2ms) Constant periodic time (8ms)
Constant
periodic task

Default task

Scan time (2ms) I/O refresh (input) I/O refresh (output)

Program execution

Example of the redundant system to be equalized

Tact time (2ms)


Constant
periodic task

Default task

System operation Equalized data Equalized data


on the working collection
Equalization data copy output collection
Equalization data copy output
side
Several ms -several tens of ms (depends on the quantity of data copied) Default task
I/O refresh (output) Note
Scan time when data is equalized

System operation Equalized data


on the standby
Equalization data copy input collection
Equalization data copy input
side

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 for redundant system (outline)

= (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

(2) Equalized data area


The equalized data area includes the area in which data is equalized by user and the area equalized automatically by the
system.
• User-specified equalized area g Standard memory (high-speed), standard memory, and retain memory
• System-equalized area g Variables defined for retain memory
Area with a retain attribute assigned in the system FB
Current timer value area in the system FB

1) User-specified area (variables used in the program)

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.

Retain memory Equalization


specification 3 AT statement
(Note: 1)

2) When you use the function that automatically assigns


variables having specified suffix or SFC step/action variables
AT specification Range of equalization to the equalization area, the equalization area must be
greater than the AT specified area.
Equalization specified
step or action (SFC)

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

Equalization size SUFB


SUFB= BOOL type variable + 16-bit data type variable + 32-bit data type variable

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

Equalization size SSFB


SSFB = No. of edge detection instructions x 2 + No. of counter instructions x 2 + No. of timer instructions x 4
(Note 1)
Notes:
1) Includes a totaling timer.
2) The number of equalized instructions indicates the number of instructions available in each FB defined in the
memory allocation settings instead of that in the program.

(3) Equalized data size


The size of data to be equalized is up to 8192 words in the 1 to 1 redundant system.

8192 >= SPG + SUFB + SSFB (words)

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

4-2-5 Memory operation at changeover between working and standby CPUs

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.

Standby a working Data remains


I/O memory Data remains unchanged Reset/hold
unchanged
Default task start flag ON ON ON
Initial flag OFF (Note) OFF (Note) ON
Redundant continuation
ON ON ON
start flag %MX10.46.0
Standard memory Cleared
Cold running Retain memory Cleared
(at program download
I/O memory Cleared
or initial start-up by
loader) Default task start flag ON
Initial flag ON

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

4-3 CPU module LEDs and output to display system

Fatal fault in I/O fault I/O fault


Faulty module Entire Entire Fatal fault Fatal fault working (fail-soft enabled) (fail-soft disabled)
system system in working in standby CPU module
operates stops CPU CPU
normally normally module module Application Non-fatal fault in Fatal fault in
Module error working/standby working/standby
CPU resource CPU resource

ONL ON ON OFF ON ON ON ON

LED ERR OFF OFF ON OFF OFF OFF OFF


indication RUN ON OFF OFF ON OFF ON OFF
Working ALM OFF OFF ON ON ON ON ON
CPU
Normal Normal Fatal fault Fatal fault Fatal fault • Fault in I/O • Fault in I/O
run run in self-CPU in standby in self-CPU module module
Flag resource CPU resource • Non-fatal fault • Fatal fault in
resource in self-CPU self-CPU
resource resource
ONL ON ON ON OFF ON ON ON

LED ERR OFF OFF OFF ON OFF OFF OFF


indication RUN Blink OFF ON OFF ON Blink OFF
Standby ALM OFF OFF ON ON OFF ON ON
CPU
Normal Normal Fatal fault Fatal fault Fatal fault in • Fault in I/O • Fault in I/O
run run in working in self-CPU working CPU module module
Flag CPU • Non-fatal fault in • Non-fatal fault in
self-CPU self-CPU
resource resource
ONL ON ON ON ON ON ON ON

LED ERR OFF OFF OFF OFF OFF OFF ON


System indication
System
DO ON OFF ON ON ON ON OFF
DO

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”

4-4 System Startup with no CPU 0 Station


In a 1 to 1 redundant system, you can set whether to start up the system when there is no CPU 0 station at system startup due
to power down, not being mounted, or a fault, etc.
‹‹In the system definition, open the “System properties” dialog box. On the “System running definition” tab window, set “Start
up system without CPU “0” to ON.

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-2 Limitations on Multi-CPU.........................................................................5-4


5-3 Memory Map of Multi-CPU.......................................................................5-5
5-4 Address Representation for Multi-CPU System....................................5-6
5-5 I/O Processing of Multi-CPU....................................................................5-7
5-6 System Definition Setting Procedure.....................................................5-8
5-7 I/O Module Assignment in Multi-CPU................................................... 5-11
5-8 Memory Assignment..............................................................................5-13
5-9 Others......................................................................................................5-15
Section 5 Multi-CPU System Overview

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

CPU 1 CPU 2 CPU 3 CPU 4

Processing time Processing time Processing time Processing time


Processing time of common area

5-1
Section 5 Multi-CPU System Overview

5-1-2 Overview of multi-CPU function

CPU 0 memory CPU 1 memory

Memory for
multi-CPU is reserved.

CPU 0 CPU 1

Input Output Input Output

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

5-1-3 Example of multi-CPU project configuration

Program of CPU 0

Program of CPU 1

Task of CPU 0

Task of CPU 1

With Expert (D300win), a multi-CPU system can be managed in a single project.

5-3
Section 5 Multi-CPU System Limitations

5-2 Limitations on Multi-CPU


1) Models that support multi-CPU
SPH300, SPH2000, and SPH3000 series support the multi-CPU function.
SPH200 does not support it.
SPH3000MM and SPH3000MG support it.

2) Using different series in a multi-CPU system


SPH300, SPH2000, and SPH3000 can be used together in a multi-CPU system.

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

5-3 Memory Map of Multi-CPU


Standard memory Retain memory Address representation
for a multi-CPU system
(for SPH300 only)
IEC (SPH300) IEC (SPH300, SPH200)
representation representation CPU No.
15 0 15 0
%MW1.0 Address representation %MW3.0 Retain memory %MW.3.0
Standard memory
for a multi-CPU system (M)
(high speed)
(M)
CPU No. NP1PS-32/32R
%MW1.2047 2K words
: 4K words
%MW1.2048 %MW.1.2048 NP1PS-74/74R/74D
Standard memory
(M) : 16K words
NP1PS-117/117R
NP1PS-32/32R : 32K words
: 6K words NP1PS-245R
NP1PS-74/74R/74D : 127K words
: 30K words NP1PH-16
NP1PS-117/117R : 4K words
: 126K words NP1PH-08
NP1PS-245R : 2K words
: 254K words

(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

NP1PM-48R/48E NP1PM-48R/48E NP1PM-48R/48E


Multi-CPU standard memory %MW.1.98304 * 0 word by default
%MW.1.98304
NP1PM-256E/256H NP1PM-256E/256H NP1PM-256E/256H
* 0 word by default %MW.1.2097152 : 224K words
%MW.1.2097152

(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

5-4 Address Representation for Multi-CPU System


When CPU modules are connected on the same processor bus in a multi-CPU system as shown below, access to another CPU
memory is performed in the following manner.

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

: Accessing the memory of


self-CPU
%MX1.2048.8     
%MX1.2048.0      %MX1.2048.8     
%MX1.2048.0     
  ↓  ↓   ↓  ↓
: Accessing the memory of
%MW1.2048 %MW1.2048 another CPU

%IX1.0.0 %MX1.2048.8 %MX0.1.2048.8 %MX1.2048.8

CPU No.

%MX1.1.2048.0 %MX1.2048.0 %IX1.0.0 %MX1.2048.0

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

5-5 I/O Processing of Multi-CPU


1) When the tasks of CPU0 and CPU1 are executed within the SX bus tact cycle
The I/Os of CPU0 and CPU1 are refreshed in the same SX bus tact cycle.

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

SX bus tact SX bus tact

Task cycle Task cycle

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.

Program Program Program


CPU 0 Input execution Output Input execution Output Input execution Output

Program Program execution Program


execution execution
CPU 1 Input (POU 1) (POU 2) (POU 3) Output

I O I O I O I O

SX bus tact SX bus tact SX bus tact

CPU 0 task cycle

CPU 1 task cycle

5-7
Section 5 Multi-CPU System System definition setting procedure

5-6 System Definition Setting Procedure


(1) Add a resource.

(2) Name the resource.

5-8
Section 5 Multi-CPU System System definition setting procedure

(3) A new resource is created.

5-9
Section 5 Multi-CPU System System definition setting procedure

(4) Define another CPU on the system definition screen.

(5) Another CPU is defined on the system definition screen.

5-10
Section 5 Multi-CPU System I/O assignment

5-7 I/O Module Assignment in Multi-CPU


System configuration definition

SX bus station No. 4 DO module


SX bus station No. 3 DO module
SX bus station No. 2 DI module
SX bus station No. 1 DI module
CPU 1 NP1PM-48R
CPU 0 NP1PM-256E

5-11
Section 5 Multi-CPU System I/O assignment

Setting of CPU 0

The inputs are set.


The output of CPU 1
is referenced.

The output of CPU 0


is set.

Setting of CPU 1

The inputs are set.


The output of CPU 0
is referenced.

The output of CPU 1


is set.

5-12
Section 5 Multi-CPU System Memory assignment

5-8 Memory Assignment


1) Multi-CPU memory address setting

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

2) Variable declaration of multi-CPU

To access each other’s memory in a multi-CPU system,


the memories need to be set as “Global Variables”

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

(2) Downloading a zip project in multi-CPU


To transfer zip projects to a user ROM (CF/SD card) in a batch, make the settings below.
Zip projects are transferred to the user ROM (CF/SD card) of the selected CPU.
To transfer zip projects to the user ROM (CF/SD card) of either of the CPUs, check “Zip Project -> User ROM” on the [Download
loader -> CPU] dialog box to perform download.
To transfer zip projects to both CPUs, download them to the user ROM (CF/SD card) of each CPU individually.

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.

Input/output memory (normal) Input/output memory (in I/O extension mode)

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

Remote I/O master 1


52 words

Remote I/O master 2


128 words
128 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.

Loader Supported versions


Product Name Type CPU Supported versions
SX-Programmer Expert (D300win)
NP1PM-256H V**08 and later V3.4.0.0 and later
NP1PM-256E V**08 and later V3.3.2.0 and later
SPH2000 series
NP1PM-48E –
NP1PM-48R –
NP1PU-048E V3.5.0.0 and later
SPH3000 series NP1PU-128E Primary version and later
For NP1PU-128E,
NP1PU-256E V3.6.2.24 and later
SPH300EX series NP1PS-74D Primary version and later V3.3.4.1 and later
NP1PS-245R V**64 and later V3.2.1.0 and later
CPU NP1PS-117R V**64 and later V3.2.1.0 and later
NP1PS-117 V**64 and later V3.2.1.0 and later
SPH300 series NP1PS-74R V**64 and later V3.2.1.0 and later
NP1PS-74 V**64 and later V3.2.1.0 and later
NP1PS-32R –
NP1PS-32 –

SPH300 series NP3PS-SX1PCS74 V**66 and later V3.2.1.0 and later


(PCI bus based CPU board) NP3PS-SX1PCS32 –
NP1PH-16 –
SPH200 series
NP1PH-08 –
NP1L-TL1 V**47 and later V3.2.1.0 and later
NP1L-JP1 V**49 and later V3.3.4.1 and later
Remote I/O master module
NP1L-DN1 V**36 and later V3.3.1.0 and later
NP1L-PD1 V**33 and later V3.3.0.0 and later

* 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

Input/output memory Max. I/O memory size per Number of connectable


Type
size remote I/O master remote I/O master modules
NP1PS-74/74R
NP1PS-74D Max. 1856 words Max. 192 words Max. 8
NP3PS-SX1PCS74
NP1PU-048E
NP1PU-128E
NP1PU-256E
NP1PM-256H Max. 4096 words Max. 512 words Max. 8
NP1PM-256E
NP1PS-245R
NP1PS-117/117R

(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

384 words Size of I/O directly


connected to SX bus:
512 words - 128 words
= 384 words
128 words

With remote I/O size of 512 words Total = 0 + 512 x 8


= 4096 words

512 words Size of I/O directly


connected to SX bus:
512 words - 512 words
= 0 word

6-3
Section 6 I/O Extension Function Tact time

6-2-2 Tact time


In systems using the I/O extension function, set the SX bus tact time as follows.

(1) SPH300 and SPH300EX series

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.

(2) SPH2000/SPH3000 series

Max. number of I/O words * SX bus tact time


1024/1024 5.0 ms or more
1536/1536 5.5 ms or more
2048/2048 6.5 ms or more
2560/2560 8.0 ms or more
3072/3072 10.0 ms

* 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

6-2-3 System memory related to I/O extension


The system memory related to the I/O extension function is shown below.

%MW10.273

Input/output memory size for remote I/O master (word)

I/O extension function in use

• I/O extension function in use


ON when the target system is operating in the I/O extension mode.
• I/O memory size for remote I/O master
The I/O memory size of a remote I/O system that occupies the largest number of words for I/O memory among multiple
remote I/O systems in an SPH system is indicated in units of words.

6-2-4 Refresh time of I/O memory


For refresh of input/output of remote I/O masters in a system using the I/O expansion function, one remote I/O system is
refreshed per tact. Therefore, the refresh time is obtained by the following formula.
(Input/output refresh time of remote I/O master) = (SX bus tact time) x (No. of remote I/O masters)
* Input/output memory for I/O directly connected to SX bus is refreshed in every tact.

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-2-5 Special Notes


1) The I/O expansion function is not available in a redundant system and multi-CPU system.
NP1PM-256H, however, allows the use of a single CPU redundant system and I/O extension at the same time, provided that
the remote I/O master supports an I/O redundant system and I/O extension.
2) When using the I/O extension function, apply “processing speed (2)” in “Appendix 1 Instruction Processing Speed Chart” in
this manual for the processing speeds of commands using addresses assigned to remote I/O.
3) It is not possible to contain both a remote I/O system using the I/O extension function and a remote I/O system not using it in
one configuration. (The loader blocks such a mixed configuration from being set.)
Remote I/O masters that do not support the I/O extension function include the following.
• I/O masters in standard mode or extension mode (T-link master, OPCN-1 master, DeviceNet master, and PROFIBUSDP
master with no I/O extension setting)
• Other I/O masters (AS-i, LONWORKS, S-LINK, and remote terminals)
• Slaves (T-link slaves, OPCN-1 slave, DeviceNet slaves, and PROFIBUS-DP slaves)

6-5
Appendix 1
Installing USB Driver

Appendix 1-1 SPH300 Instruction Processing Speed Chart.............App.1-1


Appendix 1-2 SPH2000 Instruction Processing Speed Chart...........App.1-9
Appendix 1-3 SPM3000 Instruction Processing Speed Chart.........App.1-18
Appendix 1-4 SPH200 Instruction Processing Speed Chart...........App.1-28
Appendix 1 Instruction Processing Speed Chart SPH200

Appendix 1-1 SPH300 Instruction Processing Speed Chart


All values in μs
* Processing speed (1)
Language Name Processing speed (1) Processing speed (2)
indicates the execution
IL language Load LD 0.02 0.06 speed of the instruction as
executed with operands
Load not LDN 0.02 0.06 of the data type that is
processed most quickly
Store ST 0.02 0.06
and stored in the high-
Store not STN 0.02 0.06 speed memory area and/or
input/output memory area.
Set S 0.04 0.12
Reset R 0.04 0.12 Processing speed (2)
indicates the execution
Logical product AND 0.02 0.06 speed of the instruction as
executed with operands
Logical product AND( 0.02 0.02 of the data type that is
Logical inverted product ANDN 0.02 0.06 processed most quickly
and stored in areas other
Logical inverted product ANDN( 0.02 0.02 than the high-speed
memory area and/or input/
Logical add OR 0.02 0.06 output memory area.
Logical add OR( 0.02 0.02
Logical inverted add ORN 0.02 0.06
Logical inverted add ORN( 0.02 0.02
Exclusive OR XOR 0.02 0.06
Exclusive OR XOR( 0.02 0.02
Exclusive NOR XORN 0.02 0.06
Exclusive NOR XORN( 0.02 0.02
Addition ADD 0.04 0.08
Addition ADD( 0.04 0.04
Subtraction SUB 0.04 0.08
Subtraction SUB( 0.04 0.04
Multiplication MUL 0.06 0.10
Multiplication MUL( 0.06 0.06
Division DIV 1.08 1.12
Division DIV( 1.08 1.08
Comparison GT (>) 0.04 0.08
Comparison GT( (>) 0.04 0.04
Comparison GE (>=) 0.04 0.08
Comparison GE( (>=) 0.04 0.04
Comparison EQ (=) 0.04 0.08
Comparison EQ( (=) 0.04 0.04
Comparison NE ( ) 0.04 0.08
Comparison NE( ( ) 0.04 0.04
Comparison LE (<=) 0.04 0.08
Comparison LE( (<=) 0.04 0.04
Comparison LT (<) 0.04 0.08
Comparison LT( (<) 0.04 0.04
Unconditional jump JMP 0.08 0.08
TRUE conditional jump JMPC 0.10 0.10

App.1-1
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed (1) Processing Speed (2)


IL language FALSE conditional jump JMPCN 0.10 0.10
Label of the destination address 0.02 0.02
Unconditional call CAL
FCT, FB(0.28)
TRUE conditional call CALC User FCT (3.5)
User FB (3.0)
FALSE conditional call CALCN
Unconditional return RET
User FCT (3.5)
TRUE conditional return RETC
User FB (3.0)
FALSE conditional return RETCN
Closing parenthesis - -
ST language Assignment statement := Note: In the ST language, the number of
IF statement instructions (steps) of a control group
which is made up of statements after
CASE statement compilation, varies from application to
FOR statement application.
Consequently, it is difficult to compute
WHILE statement
the control processing grasp processing
REPEAT statement speed, it is recommended that the
processing speed be measured by using
RETURN statement
an actual machine.
EXIT statement
LD language Normal open contact (NO contact) 0.02 0.06
Normal close contact (NC contact) 0.02 0.06
Coil 0.04 0.12
Inverted coil 0.04 0.12
Set 0.04 0.12
Reset 0.04 0.12
Connect to/from 0 0
Jump 0.06 0.06
Type Type conversion DINT_TO_INT 0.52 0.60
conversion
Type conversion UINT_TO_INT 0.38 0.46
function
Type conversion UDINT_TO_INT 0.38 0.46
Type conversion REAL_TO_INT 0.70 0.78
Type conversion TIME_TO_INT 0.38 0.46
Type conversion WORD_TO_INT 0.06 0.14
Type conversion INT_TO_DINT 0.06 0.14
Type conversion UINT_TO_DINT 0.06 0.14
Type conversion UDINT_TO_DINT 0.40 0.48
Type conversion REAL_TO_DINT 0.10 0.18
Type conversion TIME_TO_DINT 0.40 0.48
Type conversion DWORD_TO_DINT 0.06 0.14
Type conversion INT_TO_UINT 0.42 0.50
Type conversion DINT_TO_UINT 0.52 0.60
Type conversion UDINT_TO_UINT 0.38 0.46
Type conversion REAL_TO_UINT 0.66 0.74
Type conversion TIME_TO_UINT 0.38 0.46

App.1-2
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed (1) Processing Speed (2)


Type Type conversion WORD_TO_UINT 0.06 0.14
conversion
Type conversion INT_TO_UDINT 0.38 0.46
function
Type conversion DINT_TO_UDINT 0.38 0.46
Type conversion UINT_TO_UDINT 0.06 0.14
Type conversion REAL_TO_UDINT 0.76 0.84
Type conversion TIME_TO_UDINT 0.06 0.14
Type conversion DWORD_TO_UDINT 0.06 0.14
Type conversion DT_TO_UDINT 0.06 0.14
Type conversion DATE_TO_UDINT 2.00 2.08
Type conversion TOD_TO_UDINT 0.06 0.14
Type conversion INT_TO_REAL 0.34 0.42
Type conversion DINT_TO_REAL 0.10 0.18
Type conversion UINT_TO_REAL 0.34 0.42
Type conversion UDINT_TO_REAL 0.46 0.54
Type conversion TIME_TO_REAL 0.46 0.54
Type conversion WORD_TO_BOOL 0.06 0.14
Type conversion DWORD_TO_BOOL 0.06 0.14
Type conversion BOOL_TO_WORD 0.06 0.14
Type conversion DWORD_TO_WORD 0.06 0.14
Type conversion INT_TO_WORD 0.06 0.14
Type conversion UINT_TO_WORD 0.06 0.14
Type conversion BOOL_TO_DWORD 0.06 0.14
Type conversion WORD_TO_DWORD 0.06 0.14
Type conversion DINT_TO_DWORD 0.06 0.14
Type conversion UDINT_TO_DWORD 0.06 0.14
Type conversion INT_TO_TIME 0.38 0.46
Type conversion DINT_TO_TIME 0.38 0.46
Type conversion UINT_TO_TIME 0.06 0.14
Type conversion UDINT_TO_TIME 0.06 0.14
Type conversion REAL_TO_TIME 0.76 0.84
Type conversion UDINT_TO_DT 0.06 0.14
Type conversion UDINT_TO_DATE 2.00 2.08
Type conversion UDINT_TO_TOD 2.00 2.08
Type conversion TRUNC_INT 0.70 0.78
Type conversion TRUNC_DINT 0.10 0.18
Type conversion TRUNC_UINT 0.66 0.74
Type conversion TRUNC_UDINT 0.76 0.84
Type conversion W_BCD_TO_INT 0.12 0.20
Type conversion D_BCD_TO_INT 0.58 0.66
Type conversion W_BCD_TO_DINT 0.48 0.56
Type conversion D_BCD_TO_DINT 0.12 0.20
Type conversion INT_TO_W_BCD 0.12 0.20

App.1-3
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed (1) Processing Speed (2)


Type Type conversion DINT_TO_W_BCD 0.56 0.64
conversion
Type conversion INT_TO_D_BCD 0.48 0.56
function
Type conversion DINT_TO_D_BCD 0.12 0.20
Arithmetic Absolute value ABS_INT 0.50 0.50
function
Absolute value ABS_DINT 0.50 0.50
Absolute value ABS_REAL 0.10 0.10
Square root (√) SQRT 4.24 4.32
Natural logarithm LN 5.44 5.52
Common logarithm LOG 5.84 5.92
Exponent EXP 9.64 9.72
Sine SIN 6.24 6.32
Cosine COS 6.24 6.32
Tangent TAN 11.04 11.12
Arc sine ASIN 11.84 11.92
Arc cosine ACOS 11.84 11.92
Arc tangent ATAN 6.84 6.92
Addition ADD 0.08 + (No. of inputs -1) x 0.04 0.16 + (No. of inputs -1) x 0.08
Subtraction SUB 0.08 0.20
Multiplication MUL 0.08 + (No. of inputs -1) x 0.06 0.16 + (No. of inputs -1) x 0.10
Division DIV 1.12 1.24
Division remainder MOD 1.12 1.24
Exponent EXPT 16.86 16.98
Move MOVE 0.08 0.16
Negation NEG 0.06 0.14
Bit string Shift left SHL_WORD 0.08 0.20
function
Shift left SHL_DWORD 0.08 0.20
Shift right SHR_WORD 0.08 0.20
Shift right SHR_DWORD 0.08 0.20
Rotate left ROL_WORD 0.08 0.20
Rotate left ROL_DWORD 0.08 0.20
Rotate right ROR_WORD 0.08 0.20
Rotate right ROR_DWORD 0.08 0.20
Logical product AND 0.08 + (No. of inputs -1) x 0.04 0.16 + (No. of inputs -1) x 0.08
Logical add OR
Exclusive XOR
Logical negation NOT 0.06 0.14
Negation NOT_BOOL 0.06 0.14
Negation NOT_WORD 0.06 0.14
Negation NOT_DWORD 0.06 0.14

App.1-4
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed (1) Processing Speed (2)


Selection/ Select SEL_BOOL 0.30 0.50
comparison
Select SEL_INT 0.30 0.50
function
Select SEL_DINT 0.30 0.50
Select SEL_UINT 0.30 0.50
Select SEL_UDINT 0.30 0.50
Select SEL_REAL 0.30 0.50
Select SEL_WORD 0.30 0.50
Select SEL_DWORD 0.30 0.50
Select SEL_TIME 0.30 0.50
Select SEL_STRING 0.30 0.50
Maximum value MAX_INT 0.04 + (No. of inputs - 1 ) x 0.38 0.12 + (No. of inputs -1) x 0.42
Maximum value MAX_DINT
Maximum value MAX_UINT
Maximum value MAX_UDINT
Maximum value MAX_REAL
Maximum value MIN_INT
Maximum value MIN_DINT
Maximum value MIN_UINT
Maximum value MIN_UDINT
Maximum value MIN_REAL
Limit LIMIT_INT 0.88 1.00
Limit LIMIT_DINT 0.88 1.00
Limit LIMIT_UINT 0.88 1.00
Limit LIMIT_UDINT 0.88 1.00
Limit LIMIT_REAL 0.88 1.00
Comparison (>) GT 0.08 + (No. of inputs - 1) x 0.06 0.14 + (No. of inputs- 1) ) x 0.1
Comparison (>=) GE
Comparison (=) EQ
Comparison (<=) LE
Comparison (<) LT
Comparison (≠) NE 0.08 0.20
String Get Length LEN 0.84 + 0.3 x (No. of characters) 0.84 + 0.34 x (No. of characters)
function 1.44 + 0.48 x (No. of characters to 1.48 + 0.56 x (No. of characters to
Get left sub-string LEFT
extract) extract)
Get right sub-string RIGHT 1.6 + 0.16 x (No. of characters) + 0.18 x (No. of characters to extract)
1.66 + 0.48 x (No. of characters to 1.7 + 0.56 x (No. of characters to
Get middle sub-string MID
extract) extract)
2.8 + 0.48 x (No. of characters of 2.8 + 0.56 x (No. of characters of
Concatenate CONCAT 1st input + No. of characters of 2nd 1st input + No. of characters of 2nd
input) input)
2.04 + 1.06 x (No. of input characters) 2.16 + 1.22 x (No. of input characters)
Insert string INSERT
+ 0.48 x (No. of characters to insert) + 0.56 x (No. of characters to insert)

App.1-5
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed (1) Processing Speed (2)


String 2.04 + 1.06 x (No. of input characters 2.16+1.22 x (No. of input characters
function Delete string DELETE - No. of characters to delete) + 0.36 - (No. of characters to delete) + 0.56
x (No. of characters to delete) x (No. of characters to delete)
2.42 + 1.06 x (No. of input characters 2.7 + 1.22 x (No. of input characters
- No. of replacement characters) + 0.6 - (No. of replacement characters) +
Replace string REPLACE
x (No. of replacement characters) 0.68 x (No. of replacement
characters)
0.96 + (0.26 + 0.54 x (No. of input 0.96 + (0.3 + 0.58 x (No. of input
Find String FIND characters) x (No. of characters to characters) x (No. of characters to
search) search)
Compare String (>) GT_STRING 1.24 + 0.58 x (No. of input 1.32 + 0.66 x (No. of input
characters) characters)
Compare String (>=) GE_STRING
Compare String (=) EQ_STRING
Compare String (<=) LE_STRING
Compare String (<) LT_STRING
Compare String (≠) NE_STRING 1.14 + 0.3 x (No. of input characters)
Time Add time ADD_T_T 0.12 0.24
type data
Add time ADD_TD_T 3.00 3.18
function
Add time ADD_DT_T 1.22 2.06
Subtract time SUB_T_T 0.12 0.24
Subtract time SUB_D_D 0.18 0.34
Subtract time SUB_TD_T 3.00 3.18
Subtract time SUB_TD_TD 0.18 0.34
Subtract time SUB_DT_T 1.22 2.06
Subtract time SUB_DT_DT 0.18 0.34
Multiply time MUL_T_N 0.50 0.62
Multiply time MUL_T_R 0.54 0.66
Divide time DIV_T_N 2.10 2.36
Divide time DIV_T_R 2.10 2.36
Concatenate time CONCAT_D_D 0.12 0.24
Convert DT to TOD DT_TO_TOD 1.16 1.28
Convert DT to DATE DT_TO_DATE 1.76 2.06
Original Set bit SBIT_WORD 0.16 0.28
function
Set bit SBIT_DWORD 0.16 0.28
Reset bit RBIT_WORD 0.16 0.28
Reset bit RBIT_DWORD 0.16 0.28
Test bit TBIT_WORD 0.14 0.26
Test bit TBIT_DWORD 0.14 0.26
Decode DECODE_WORD 0.06 0.14
Decode DECODE_DWORD 0.08 0.16
Encode ENCODE_WORD 0.06 0.14
Encode ENCODE_DWORD 0.08 0.16
Bit count BITCOUNT_WORD 1.82 1.90
Bit count BITCOUNT_DWORD 3.42 3.50

App.1-6
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed (1) Processing Speed (2)


Original Convert string to number 0.62 + 0.76 x (No. of input 0.66 + 0.80 x (No. of input
function STR_TO_UINT characters) characters)
Convert number to string 1.36 + 1.82 x (No. of output 1.36 + 1.94 x (No. of output
UINT_TO_STR characters) characters)
Convert shift-JIS to string 2.76 + 1.98 x (No. of output 3.02 + 2.1 x (No. of output
SJ_TO_STR characters) characters)
Convert string to shift-JIS 1.46 + 0.94 x (No. of input 1.52 + 1.02 x (No. of input
STR_TO_SJ characters) characters)
Byte length BYTE_LEN 0.66 + 0.46 x (No. of input characters) 0.7 + 0.5 x (No. of input characters)
Dead band DBAND_INT 1.34 1.46
Dead band DBAND_DINT 1.34 1.46
Dead band DBAND_REAL 1.46 1.58
Bias BIAS_INT 1.14 1.26
Bias BIAS_DINT 1.14 1.26
Bias BIAS_REAL 1.20 1.32
Step sequence coil SC_COIL/SC 1.12/1.12 1.28/1.28
32-bit addition with carry
1.02/1.16 1.18/1.32
ADC/ADCO
32-bit subtraction with borrow
1.04/1.16 1.20/1.32
SBB/SBBO
64-bit multiplication MULL/MULU 1.14/1.14 1.26/1.26
64-bit division DIVL/DIVU 4.60/4.60 4.76/4.76
Shift left 32-bits with carry
1.14/1.08 1.26/1.16
SLC/SLCO
Shift right 32-bits with carry
1.14/1.08 1.26/1.26
SRC/SRCO
Standard Set reset flip-flop SR 0.16 0.16
function
Reset-set flip-flop RS 0.16 0.16
block
Rising edge trigger R_TRIG 0.16 0.16
Falling edge trigger F_TRIG 0.16 0.16
Up counter CTU 0.22 0.22
Down counter CTD 0.22 0.22
Up down counter CTUD 0.22 0.22

App.1-7
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed (1), (2)


Standard Pulse TP 0.44
function
On-delay timer TON 0.44
block
Off-delay timer TOF 0.44
Real-time clock RTC 1.76
Original Ring counter RCT 0.22
function
Integrating timer TMR 0.44
blobk
Retriggerable MR 0.44
Open channel M_OPEN 1.60
Send message M_SEND 1.76
Receive message M_RECEIVE 1.92
Direct read READ_BOOL 1.50
Direct read READ_WORD 1.50
Direct write WRITE_BOOL 1.30
Direct write WRITE_WORD 1.30
Remote data read R_READ 1.50
Remote data write R_WRITE 1.30
File data read F_READ 1.50
File data write F_WRITE 1.30
Extension test & set EXT_T_S 3.00
Sequential file store FFST 3.08 + (No. of words) x 0.12
Sequential file load first FIFO 2.68 + (No. of words) x 0.12
Sequential file load last FILO 2.68 + (No. of words) x 0.12
Filter FILTER_DINT 4.32
Filter FILTER_REAL 2.98
Integrate INT_DINT 4.60
Integrate INT_REAL 4.02
Differentiate DIF_DINT 3.24
Differentiate DIF_REAL 3.48
Pulse count PULSE_CNT 2.80
Pulse output PULSE_OUT 2.28
Pulse PWM 2.48
Hardware RTC (Real-time clock) HW_RTC 1.20
Test & set T_S 0.86
Change bank BANK_CHG 4.72

Processing speed of <SFC elements>


For SFC elements, only steps that are currently active are executed. Consequently, it is difficult to discuss the processing speed of SFC
elements using only the worksheet on which the SFC elements are programmed. When it is necessary to grasp processing speed, it is
recommended that the processing speed be measured by using an actual machine.

App.1-8
Appendix 1 Instruction Processing Speed Chart SPH2000

Appendix 1-2 SPH2000 Instruction Processing Speed Chart


All values in μs
* The processing speed is the execution speed of the
Language Name Processing Speed
instruction as executed with operands of the data
IL language Load LD 0.02 to 0.11 types that are processed most quickly and stored in
areas other than the CPU standard memory area
Load not LDN 0.03 to 0.18 and/or multi-CPU retain memory area.
Store ST 0.02 to 0.11
Store not STN 0.08 to 0.43
Set S 0.07 to 0.39
Reset R 0.07 to 0.39
Logical product AND 0.03 to 0.18
Logical product AND( 0.21 to 0.69
Logical inverted product ANDN 0.03 to 0.28
Logical inverted product ANDN( 0.21 to 0.69
Logical add OR 0.03 to 0.18
Logical add OR( 0.21 to 0.69
Logical inverted add ORN 0.03 to 0.28
Logical inverted add ORN( 0.21 to 0.73
Exclusive OR XOR 0.03 to 0.18
Exclusive OR XOR( 0.21 to 0.69
Exclusive NOR XORN 0.03 to 0.28
Exclusive NOR XORN( 0.21 to 0.73
Addition ADD 0.03 to 0.18
Addition ADD( 0.2 to 0.66
Subtraction SUB 0.03 to 0.18
Subtraction SUB( 0.2 to 0.66
Multiplication MUL 0.04 to 0.26
Multiplication MUL( 0.21 to 0.73
Division DIV 0.21 to 0.37
Division DIV( 0.4 to 0.84
Comparison GT (>) 0.2 to 0.68
Comparison GT( (>) 0.26 to 0.66
Comparison GE (>=) 0.2 to 0.68
Comparison GE( (>=) 0.26 to 0.66
Comparison EQ (=) 0.2 to 0.68
Comparison EQ( (=) 0.26 to 0.66
Comparison NE (≠) 0.17 to 0.57
Comparison NE( (≠) 0.26 to 0.66
Comparison LE (<=) 0.2 to 0.68
Comparison LE( (<=) 0.26 to 0.65
Comparison LT (<) 0.2 to 0.68
Comparison LT( (<) 0.26 to 0.65
Unconditional jump JMP 0.02 to 0.11
TRUE conditional jump JMPC 0.03 to 0.18

App.1-9
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


IL language FALSE conditional jump JMPCN 0.02 to 0.11
Label of the destination address 0
Unconditional call CAL 0.02 to 0.11
TRUE conditional call CALC 0.03 to 0.18
FALSE conditional call CALCN 0.03 to 0.18
Unconditional return RET 0.02 to 0.11
TRUE conditional return RETC 0.03 to 0.18
FALSE conditional return RETCN 0.03 to 0.18
Closing parenthesis -
ST language Assignment statement := Note: In the ST language, the number of instructions (steps) of a
control group which is made up of statements after
IF statement
compilation, varies from application to application.
CASE statement Consequently, it is difficult to compute the control processing
speed from an ST language list. When it is necessary to grasp
FOR statement
processing speed, it is recommended that the processing
WHILE statement speed be measured by using an actual machine.
REPEAT statement
RETURN statement
EXIT statement
LD language Normal open contact (NO contact) 0.03 to 0.18
Normal close contact (NC contact) 0.03 to 0.18
Coil 0.07 to 0.28
Inverted coil 0.07 to 0.48
Set 0.07 to 0.39
Reset 0.07 to 0.39
Connect to/from 0
Jump 0.02 to 0.11
Type Type conversion DINT_TO_INT 0.07 to 0.51
conversion
Type conversion UINT_TO_INT 0.05 to 0.37
function
Type conversion UDINT_TO_INT 0.05 to 0.37
Type conversion REAL_TO_INT 0.2 to 0.51
Type conversion TIME_TO_INT 0.05 to 0.37
Type conversion WORD_TO_INT 0.06 to 0.33
Type conversion INT_TO_DINT 0.05 to 0.26
Type conversion UINT_TO_DINT 0.05 to 0.26
Type conversion UDINT_TO_DINT 0.05 to 0.37
Type conversion REAL_TO_DINT 0.2 to 0.51
Type conversion TIME_TO_DINT 0.05 to 0.37
Type conversion DWORD_TO_DINT 0.05 to 0.37
Type conversion INT_TO_UINT 0.05 to 0.37
Type conversion DINT_TO_UINT 0.08 to 0.55
Type conversion UDINT_TO_UINT 0.05 to 0.37
Type conversion REAL_TO_UINT 0.2 to 0.51
Type conversion TIME_TO_UINT 0.05 to 0.37

App.1-10
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


Type Type conversion WORD_TO_UINT 0.05 to 0.26
conversion
Type conversion INT_TO_UDINT 0.05 to 0.37
function
Type conversion DINT_TO_UDINT 0.05 to 0.37
Type conversion UINT_TO_UDINT 0.05 to 0.26
Type conversion REAL_TO_UDINT 0.2 to 0.51
Type conversion TIME_TO_UDINT 0.05 to 0.26
Type conversion DWORD_TO_UDINT 0.05 to 0.26
Type conversion DT_TO_UDINT 0.08 to 0.44
Type conversion DATE_TO_UDINT 0.08 to 0.44
Type conversion TOD_TO_UDINT 0.08 to 0.44
Type conversion INT_TO_REAL 0.17 to 0.47
Type conversion DINT_TO_REAL 0.17 to 0.47
Type conversion UINT_TO_REAL 0.19 to 0.47
Type conversion UDINT_TO_REAL 0.19 to 0.47
Type conversion TIME_TO_REAL 0.19 to 0.47
Type conversion WORD_TO_BOOL 0.1 to 0.43
Type conversion DWORD_TO_BOOL 0.1 to 0.43
Type conversion BOOL_TO_WORD 0.05 to 0.26
Type conversion DWORD_TO_WORD 0.06 to 0.23
Type conversion INT_TO_WORD 0.06 to 0.33
Type conversion UINT_TO_WORD 0.05 to 0.26
Type conversion BOOL_TO_DWORD 0.05 to 0.26
Type conversion WORD_TO_DWORD 0.05 to 0.26
Type conversion DINT_TO_DWORD 0.05 to 0.26
Type conversion UDINT_TO_DWORD 0.05 to 0.26
Type conversion INT_TO_TIME 0.05 to 0.37
Type conversion DINT_TO_TIME 0.05 to 0.37
Type conversion UINT_TO_TIME 0.05 to 0.26
Type conversion UDINT_TO_TIME 0.05 to 0.26
Type conversion REAL_TO_TIME 0.2 to 0.51
Type conversion UDINT_TO_DT 0.08 to 0.44
Type conversion UDINT_TO_DATE 0.33 to 0.85
Type conversion UDINT_TO_TOD 0.29 to 0.7
Type conversion TRUNC_INT 0.19 to 0.51
Type conversion TRUNC_DINT 0.19 to 0.51
Type conversion TRUNC_UINT 0.2 to 0.51
Type conversion TRUNC_UDINT 0.2 to 0.51
Type conversion W_BCD_TO_INT 0.33 to 0.57
Type conversion D_BCD_TO_INT 0.33 to 0.57
Type conversion W_BCD_TO_DINT 0.33 to 0.57
Type conversion D_BCD_TO_DINT 0.33 to 0.57
Type conversion INT_TO_W_BCD 0.25 to 0.53

App.1-11
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


Type Type conversion DINT_TO_W_BCD 0.25 to 0.53
conversion Type conversion INT_TO_D_BCD 0.26 to 0.57
function
Type conversion DINT_TO_D_BCD 0.26 to 0.57
Arithmetic Absolute value ABS_INT 0.07 to 0.48
function Absolute value ABS_DINT 0.06 to 0.44
Absolute value ABS_REAL 0.05 to 0.29
Square root (√) SQRT 2.06 to 2.35
Natural logarithm LN 2.09 to 2.46
Common logarithm LOG 2.3 to 2.63
Exponent EXP 0.77 to 1.08
Sine SIN 15.2 to 15.6
Cosine COS 15.2 to 15.7
Tangent TAN 31.2 to 32.3
Arc sine ASIN 16.1 to 16.5
Arc cosine ACOS 16.3 to 16.7
Arc tangent ATAN 24.7 to 26.1
Addition ADD 0.04 + (No. of inputs -1) x 0.03 to 0.22 + (No. of inputs -1) x 0.18
Subtraction SUB 0.07 to 0.4
Multiplication MUL 0.04 + (No. of inputs -1) x 0.04 to 0.22 + (No. of inputs -1) x 0.26
Division DIV 0.25 to 0.59
Addition ADD_REAL 0.29 to 0.62
Subtraction SUB_REAL 0.3 to 0.62
Multiplication MUL_REAL 0.27 to 0.63
Division DIV_REAL 0.34 to 0.67
Division remainder MOD 0.25 to 0.59
Exponent EXPT 0.65 to 1.04
Move MOVE 0.08 to 0.44
Negation NEG 0.05 to 0.29
Bit string Shift left SHL_WORD 0.07 to 0.44
function Shift left SHL_DWORD 0.07 to 0.4
Shift right SHR_WORD 0.07 to 0.4
Shift right SHR_DWORD 0.07 to 0.4
Rotate left ROL_WORD 0.08 to 0.51
Rotate left ROL_DWORD 0.08 to 0.44
Rotate right ROR_WORD 0.08 to 0.48
Rotate right ROR_DWORD 0.07 to 0.4
Logical product AND 0.04 + (No. of inputs -1) x 0.03 to 0.22 + (No. of inputs -1) x 0.18
Logical add OR
Exclusive XOR
Logical negation NOT 0.05 to 0.29
Negation NOT_BOOL 0.11 to 0.85
Negation NOT_WORD 0.06 to 0.33
Negation NOT_DWORD 0.05 to 0.29

App.1-12
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


Selection/ Select SEL_BOOL 0.27 to 1.54
comparison Select SEL_INT 0.15 to 0.84
function
Select SEL_DINT 0.15 to 0.84
Select SEL_UINT 0.15 to 0.84
Select SEL_UDINT 0.15 to 0.84
Select SEL_REAL 0.15 to 0.84
Select SEL_WORD 0.15 to 0.84
Select SEL_DWORD 0.15 to 0.84
Select SEL_TIME 0.15 to 0.84
Select SEL_STRING 1.94 + 0.09 x (No. of characters) to 3.67 + 0.09 x (No. of characters)
Maximum value MAX_INT 0.04 + (No. of inputs -1) x 0.03 to 0.22 + (No. of inputs -1) x 0.18
Maximum value MAX_DINT
Maximum value MAX_UINT
Maximum value MAX_UDINT
Maximum value MAX_REAL
Minimum value MIN_INT
Minimum value MIN_DINT
Minimum value MIN_UINT
Minimum value MIN_UDINT
Minimum value MIN_REAL
Limit LIMIT_INT 0.1 to 0.59
Limit LIMIT_DINT
Limit LIMIT_UINT
Limit LIMIT_UDINT
Limit LIMIT_REAL 0.56 to 0.71
Comparison (>) GT 0.09 + (No. of inputs -1) x 0.11 to 0.5 + (No. of inputs -1) x 0.36
Comparison (>=) GE
Comparison (=) EQ
Comparison (<=) LE
Comparison (<) LT
Comparison (≠) NE 0.17 to 0.59
String Get Length LEN 0.54 + 0.04 x (No. of characters) to 0.97 + 0.04 x (No. of characters)
function 1.8 + 0.11 x (No. of characters to extract) to
Get left sub-string LEFT
2.82 + 0.11 x (No. of characters to extract)
1.97 + 0.04 x (No. of input characters) + 0.1 x (No. of characters to extract) to
Get right sub-string RIGHT
2.98 + 0.04 x (No. of input characters) + 0.1 x (No. of characters to extract)
1.9 + 0.41 x (No. of characters to extract) to
Get middle sub-string MID
3.1 + 0.41 x (No. of characters to extract)
1.9 + 0.09 x (No. of characters of 1st input + No. of characters of 2nd input to
Concatenate CONCAT
3.06 + 0.09 x (No. of characters of first input + No. of characters of 2nd input)
2.41 + 0.09 x (No. of input strings) + 0.01 x (No. of characters to insert) to
Insert string INSERT
3.54 + 0.11 x (No. of input strings) + 0.01 x (No. of characters to insert)
2.0 + 0.09 x (No. of input strings - No. of characters to delete
+ 0.05 x (No. of characters to delete) to
Delete string DELETE
3.7 + 0.09 x (No. of input strings - No. of characters to delete) + 0.05 x (No.
of characters to delete)

App.1-13
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


String 2.15 + 0.094 x (No. of input strings - No. of replacement characters) +
function 0.201 x (No. of replacement characters) to
Replace string REPLACE
4.15 + 0.09 x (No. of input strings - No. of replacement characters) +
0.132 x (No. of replacement characters)
0.73 + 0.05 x (No. of characters to search) to
Find String FIND
1.44 + 0.05 x (No. of characters to search)
Comparison String (>) GT_STRING 0.86 + 0.04 x (No. of characters) to 1.57 + 0.04 x (No. of characters)
Comparison String(>=) GE_STRING
Comparison String(=) EQ_STRING
Comparison String(<=) LE_STRING
Comparison String(<) LT_STRING
Comparison String( ) NE_STRING 0.84 + 0.05 x (No. of characters) to 1.11 + 0.05 x (No. of characters)

Time type Add time ADD_T_T 0.07 to 0.41


data function
Add time ADD_TD_T 0.68 to 1.89
Add time ADD_DT_T 0.44 to 1.19
Subtract time SUB_T_T 0.07 to 0.41
Subtract time SUB_D_D 0.1 to 0.63
Subtract time SUB_TD_T 0.72 to 1.75
Subtract time SUB_TD_TD 0.1 to 0.63
Subtract time SUB_DT_T 0.44 to 1.19
Subtract time SUB_DT_DT 0.1 to 0.63
Multiply time MUL_T_N 0.08 to 0.48
Multiply time MUL_T_R 0.58 to 1.2
Divide time DIV_T_N 0.25 to 0.69
Divide time DIV_T_R 0.65 to 1.27
Concatenate time CONCAT_D_D 0.07 to 0.41
Convert DT to TOD DT_TO_TOD 0.24 to 0.56
Convert DT to DATE DT_TO_DATE 0.27 to 0.78
Original Set bit SBIT_WORD 0.08 to 0.44
function
Set bit SBIT_DWORD 0.08 to 0.44
Reset bit RBIT_WORD 0.08 to 0.44
Reset bit RBIT_DWORD 0.08 to 0.44
Test bit TBIT_WORD 0.12 to 0.4
Test bit TBIT_DWORD 0.12 to 0.4
Decode DECODE_WORD 0.06 to 0.37
Decode DECODE_DWORD 0.06 to 0.4
Encode ENCODE_WORD 0.06 to 0.48
Encode ENCODE_DWORD 0.06 to 0.67
Bit count BITCOUNT_WORD 0.06 to 0.44
Bit count BITCOUNT_DWORD 0.06 to 0.44
Convert string to number STR_TO_UINT 0.55 + 0.09 x (No. of characters) to 0.89 + 0.09 x (No. of characters)
Convert number to string UINT_TO_STR 2.42 + 0.16 x (No. of characters) to 4.05 + 0.16 x (No. of characters)
Convert shift-JIS to string SJ_TO_STR 1.83 + 0.14 x (No. of characters) to 3.5 + 0.14 x (No. of characters)
Convert string to shift-JIS STR_TO_SJ 1.87 + 0.07 x (No. of characters) to 3.34 + 0.07 x (No. of characters)

App.1-14
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


Original Byte length BYTE_LEN 0.53 + 0.07 x (No. of characters) to 1.07 + 0.08 x (No. of characters)
function
Dead band DBAND_INT 0.72 to 1.46
Dead band DBAND_DINT 0.64 to 1.41
Dead band DBAND_REAL 0.71 to 1.46
Bias BIAS_INT 0.7 to 1.44
Bias BIAS_DINT 0.64 to 1.44
Bias BIAS_REAL 0.89 to 1.46
Step sequence coil SC_COIL 0.8 to 2.1
Step sequence SC 0.86 to 2.03
32-bit addition with carry ADC 0.74 to 1.81
32-bit addition with carry ADCO 0.82 to 1.72
32-bit subtraction with borrow SBB 0.74 to 1.82
32-bit subtraction with borrow SBBO 0.83 to 1.73
64-bit multiplication MULL 0.61 to 1.39
64-bit multiplication MULU 0.61 to 1.39
64-bit division DIVL 1.12 to 2.04
64-bit division DIVU 0.95 to 1.88
Shift left 32-bits with carry SLC 0.62 to 1.52
Shift left 32-bits with carry SLCO 0.54 to 0.99
Shift right 32-bits with carry SRC 0.62 to 1.53
Shift right 32-bits with carry SRCO 0.54 to 0.98
Standard Set reset flip-flop SR 0.56 to 1.58
function
Reset set flip-flop RS 0.56 to 1.58
block
Rising edge trigger R_TRIG 0.44 to 1.27
Falling edge trigger F_TRIG 0.45 to 1.27
Up counter CTU 0.7 to 2.11
Down counter CTD 0.69 to 2.11
Up down counter CTUD 1.19 to 3.69
Pulse TP 0.78 to 2
On-delay timer TON 0.78 to 1.99
Off-delay timer TOF 0.67 to 1.91
Real-time clock RTC 10.8 to 12.2
Original Ring counter RCT 0.7 to 2.11
function
Integrating timer TMR 0.8 to 2.27
block
Retriggerable MR 0.79 to 2.01
Open channel M_OPEN 1.15 to 4.34
Send message M_SEND 0.99 to 3.04
Receive message M_RECEIVE 1.01 to 3.18
Direct read READ_BOOL 1.12 to 3.46
Direct read READ_WORD 1.14 to 3.47
Direct write WRITE_BOOL 1.12 to 3.46
Direct write WRITE_WORD 1.14 to 3.48

App.1-15
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


Original Remote data read R_READ 1.25 to 4.45
function
Remote data write R_WRITE 1.26 to 4.5
block
File data read F_READ 1.18 to 3.9
File data write F_WRITE 1.14 to 3.69
Extension test & set EXT_T_S 1.06 to 3.03
Sequential file store FFST 1.7 to 4.44
Sequential file load first FIFO 1.14 to 3.37
Sequential file load last FILO 1.14 to 3.77
Filter FILTER_DINT 2.78 to 3.91
Filter FILTER_REAL 5.8 to 7.05
Integrate INT_DINT 2.28 to 4.25
Integrate INT_REAL 2.28 to 4.25
Differentiate DIF_DINT 3.94 to 4.81
Differentiate DIF_REAL 3.25 to 4.42
Pulse count PULSE_CNT 1.1 to 2.42
Pulse output PULSE_OUT 0.72 to 2.16
Pulse PWM 0.6 to 1.89
Hardware RTC (Real-time clock) HW_RTC 10.7 to 12.1
Test & set T_S 0.77 to 1.94
Change bank BANK_CHG 2.06 to 3.97
User ROM Write CSV file _F_WRITE_CSV_DINT 10.34 to 15.81
card FB
Write CSV file (LF) _F_WRITE_CSV_DINT_LF 10.43 to 15.90
Read CSV file _F_READ_CSV_DINT 4.85 to 8.29
Read CSV file (LF) _F_READ_CSV_DINT_LF 4.86 to 8.31
Append data to CSV file _F_APPEND_CSV_DINT 8.10 to 11.73
Append data to CSV file (LF) _F_APPEND_CSV_DINT_LF 8.15 to 11.77
Append data to file _F_APPEND 5.76 to 9.28
Append data to file (LF) _F_APPEND_LF 5.80 to 9.30
Delete file _F_DELETE 3.80 to 6.01
Delete file (LF) _F_DELETE_LF 3.88 to 6.06
Reading of a file with an offset _F_OFFSET_READ 4.12 to 7.92
Reading of a file with an offset (LF) _F_OFFSET_READ_LF* 4.13 to 7.94
Reading of the remaining capacity _F_GET_DRV_SIZE 3.74 to 5.79
File name creation _F_CREATE_FILE_NAME* 2.71 to 7.88
Double- Type conversion INT_TO_DOUBLE 2.28 to 3.67
precision
Type conversion DOUBLE_TO_INT 2.77 to 3.48
floating-point
calculation Type conversion UINT_TO_DOUBLE 2.29 to 3.67
FCTs Type conversion DOUBLE_TO_UINT 2.76 to 3.43
Type conversion DINT_TO_DOUBLE 2.28 to 3.67
Type conversion DOUBLE_TO_DINT 2.77 to 3.48
Type conversion UDINT_TO_DOUBLE 2.29 to 3.68
Type conversion DOUBLE_TO_UDINT 2.76 to 3.43

App.1-16
Appendix 1 Instruction Processing Speed Chart SPH2000

All values in μs

Language Name Processing Speed


Double- Type conversion REAL_TO_DOUBLE 3.55 to 5.01
precision
Type conversion DOUBLE_TO_REAL 2.65 to 3.94
floating-point
calculation Type conversion RAD_DOUBLE 4.45 to 6.88
FCTs Type conversion DEG_DOUBLE 4.45 to 6.92
Arithmetic ADD_DOUBLE 5.34 to 6.87
Arithmetic SUB_DOUBLE 5.33 to 6.91
Arithmetic MUL_DOUBLE 5.32 to 6.94
Arithmetic DIV_DOUBLE 5.44 to 7.65
Arithmetic SIN_DOUBLE 4.50 to 12.64
Arithmetic COS_DOUBLE 4.47 to 12.08
Arithmetic TAN_DOUBLE 4.59 to 20.18
Arithmetic ASIN_DOUBLE 4.73 to 6.80
Arithmetic ACOS_DOUBLE 4.46 to 5.95
Arithmetic ATAN_DOUBLE 4.57 to 11.96
Arithmetic SQRT_DOUBLE 4.56 to 8.44
Arithmetic EXP_DOUBLE 5.32 to 12.94
Arithmetic LN_DOUBLE 4.36 to 6.30
Comparison EQ_DOUBLE 2.73 to 3.58
Comparison NE_DOUBLE 2.73 to 3.58
Comparison GT_DOUBLE 2.73 to 3.58
Comparison GE_DOUBLE 2.73 to 3.58
Comparison LT_DOUBLE 2.73 to 3.58
Comparison LE_DOUBLE 2.73 to 3.58
Ethernet- Current time acquisition SNTP_CLIENT 1.00 to 2.93
related
Connection open FTP_OPEN 1.36 to 4.66
F Bs
File store FTP_PUT 1.36 to 4.71
File get FTP_GET 1.36 to 4.71
Directory create FTP_CREATE_DIR 1.16 to 3.65
File delete FTP_DELETE_FILE 1.16 to 3.65
Mail send MAIL_SEND 1.93 to 7.68
Special WDT_RETRIGGER 0.28 to 0.89
control
BAND_TUNE 2.95 to 4.95

Processing speed of <SFC elements>


For SFC elements, only steps that are currently active are executed. Consequently, it is difficult to discuss the processing speed of SFC
elements using only the worksheet on which the SFC elements are programmed. When it is necessary to grasp processing speed, it is
recommended that the processing speed be measured by using an actual machine.

App.1-17
Appendix 1 Instruction Processing Speed Chart SPH3000

Appendix 1-3 SPM3000 Instruction Processing Speed Chart


All values in μs

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

Processing speed of <SFC elements>


For SFC elements, only steps that are currently active are executed. Consequently, it is difficult to discuss the processing speed of SFC
elements using only the worksheet on which the SFC elements are programmed. When it is necessary to grasp processing speed, it is
recommended that the processing speed be measured by using an actual machine.

App.1-27
Appendix 1 Instruction Processing Speed Chart SPH200

Appendix 1-4 SPH200 Instruction Processing Speed Chart


All values in μs
* The processing speed depends on the
Language Name Processing Speed
data type to be used. The data types for
IL language Load LD 0.07 which operands are processed at the
highest speeds are listed in the table.
Load not LDN 0.07
Store ST 0.14
Store not STN 0.14
Set S 0.14
Reset R 0.14
Logical product AND 0.07
Logical product AND( 0.07
Logical inverted product ANDN 0.07
Logical inverted product ANDN( 0.07
Logical add OR 0.07
Logical add OR( 0.07
Logical inverted add ORN 0.07
Logical inverted add ORN( 0.07
Exclusive OR XOR 0.07
Exclusive OR XOR( 0.07
Exclusive NOR XORN 0.07
Exclusive NOR XORN( 0.07
Addition ADD 0.21
Addition ADD( 0.21
Subtraction SUB 0.21
Subtraction SUB( 0.21
Multiplication MUL 10.14
Multiplication MUL( 10.14
Division DIV 10.14
Division DIV( 10.14
Comparison GT (>) 0.63
Comparison GT( (>) 0.63
Comparison GE (>=) 0.63
Comparison GE( (>=) 0.63
Comparison EQ (=) 0.63
Comparison EQ( (=) 0.63
Comparison NE (≠) 0.49
Comparison NE( (≠) 0.49
Comparison LE (<=) 0.7
Comparison LE( (<=) 0.7
Comparison LT (<) 0.7
Comparison LT( (<) 0.7
Unconditional jump JMP 0.21
0.14 (Non-JMP)
TRUE conditional jump JMPC
/0.21(JMP)

App.1-28
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed


IL language FALSE conditional jump JMPCN 0.14 (Non-JMP) /0.21 (JMP)
Label of the destination address 0.14
Unconditional call CAL The value enclosed in ( ) is the
FCT(8.14), FB(9.14)
value when a call is executed.
TRUE conditional call CALC User FCT (19.14) The value is 0.4μs when a call is
User FB (32.14) not executed.
FALSE conditional call CALCN
Unconditional return RET The value enclosed in ( ) is the
User FCT (15.14) value when a call is executed.
TRUE conditional return RETC The value is 0.4μs when a call is
User FB (18.14)
FALSE conditional return RETCN not executed.

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

Language Name Processing Speed


Type Type conversion WORD_TO_UINT 7.35
conversion
Type conversion INT_TO_UDINT 8.42
function
Type conversion DINT_TO_UDINT 7.49
Type conversion UINT_TO_UDINT 7.42
Type conversion REAL_TO_UDINT 21.49
Type conversion TIME_TO_UDINT 6.7
Type conversion DWORD_TO_UDINT 6.7
Type conversion DT_TO_UDINT 0.7
Type conversion DATE_TO_UDINT 0.7
Type conversion TOD_TO_UDINT 0.7
Type conversion INT_TO_REAL 14.42
Type conversion DINT_TO_REAL 17.49
Type conversion UINT_TO_REAL 12.42
Type conversion UDINT_TO_REAL 14.49
Type conversion TIME_TO_REAL 14.49
Type conversion WORD_TO_BOOL 0.42
Type conversion DWORD_TO_BOOL 0.49
Type conversion BOOL_TO_WORD 0.35
Type conversion DWORD_TO_WORD 0.42
Type conversion INT_TO_WORD 0.35
Type conversion UINT_TO_WORD 0.35
Type conversion BOOL_TO_DWORD 0.42
Type conversion WORD_TO_DWORD 0.42
Type conversion DINT_TO_DWORD 0.49
Type conversion UDINT_TO_DWORD 0.49
Type conversion INT_TO_TIME 8.42
Type conversion DINT_TO_TIME 7.49
Type conversion UINT_TO_TIME 7.42
Type conversion UDINT_TO_TIME 6.7
Type conversion REAL_TO_TIME 21.49
Type conversion UDINT_TO_DT 0.7
Type conversion UDINT_TO_DATE 34.12
Type conversion UDINT_TO_TOD 14.91
Type conversion TRUNC_INT 12.42
Type conversion TRUNC_DINT 21.49
Type conversion TRUNC_UINT 12.42
Type conversion TRUNC_UDINT 21.49
Type conversion W_BCD_TO_INT 13.35
Type conversion D_BCD_TO_INT 12.42
Type conversion W_BCD_TO_DINT 18.42
Type conversion D_BCD_TO_DINT 21.49
Type conversion INT_TO_W_BCD 12.35

App.1-30
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed


Type Type conversion DINT_TO_W_BCD 14.42
conversion
Type conversion INT_TO_D_BCD 13.42
function
Type conversion DINT_TO_D_BCD 25.49
Arithmetic Absolute value ABS_INT 9.35
function
Absolute value ABS_DINT 11.49
Absolute value ABS_REAL 7.49
Square root (√) SQRT 613.49
Natural logarithm LN 1700.49
Common logarithm LOG 1726.49
Exponent EXP 244.49
Sine SIN 3856.49
Cosine COS 3866.49
Tangent TAN 7606.49
Arc sine ASIN 3606.49
Arc cosine ACOS 3706.49
Arc tangent ATAN 2806.49
Addition ADD 0.35 + (No. of inputs -1) x 0.21
Subtraction SUB 0.20
Multiplication MUL 10.28 + (No. of inputs -1) x 10.14
Division DIV 10.14
Division remainder MOD 10.14
Exponent EXPT 2206.49
Move MOVE 0.56
Negation NEG 7.49
Bit string Shift left SHL_WORD 9.42
function
Shift left SHL_DWORD 9.56
Shift right SHR_WORD 9.42
Shift right SHR_DWORD 9.56
Rotate left ROL_WORD 9.42
Rotate left ROL_DWORD 10.56
Rotate right ROR_WORD 9.42
Rotate right ROR_DWORD 10.56
Logical product AND 0.14 + (No. of inputs -1) x 0.07
Logical add OR
Exclusive XOR
Logical negation NOT 0.35
Negation NOT_BOOL 0.42
Negation NOT_WORD 0.35
Negation NOT_DWORD 0.49
Selection/ Select SEL_BOOL 1.12
comparison
Select SEL_INT 1.05
function
Select SEL_DINT 1.19

App.1-31
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed


Selection/ Select SEL_UINT 1.05
comparison
Select SEL_UDINT 1.19
function
Select SEL_REAL 1.19
Select SEL_WORD 1.05
Select SEL_DWORD 1.19
Select SEL_TIME 1.19
Select SEL_STRING 87.47 + 0.64 x (Total numbers of No.of characters)
Maximum value MAX_INT 0.49 + (No. of inputs -1) x 0.35
Maximum value MAX_DINT 0.7 + (No. of inputs -1) x 0.49
Maximum value MAX_UINT 0.49 + (No. of inputs -1) x 0.35
Maximum value MAX_UDINT 0.7 + (No. of inputs -1) x 0.49
Maximum value MAX_REAL 14.63 + (No. of inputs -1) x 14.42
Minimum value MIN_INT 0.49 + (No. of inputs -1) x 0.35
Minimum value MIN_DINT 0.7 + (No. of inputs -1) x 0.49
Minimum value MIN_UINT 0.49 + (No. of inputs -1) x 0.35
Minimum value MIN_UDINT 0.7 + (No. of inputs -1) x 0.49
Minimum value MIN_REAL 14.63 + (No. of inputs -1) x 14.42
Limit LIMIT_INT 0.98
Limit LIMIT_DINT 1.26
Limit LIMIT_UINT 0.98
Limit LIMIT_UDINT 1.26
Limit LIMIT_REAL 29.12
Comparison (>) GT 0.7 + (No. of inputs -1) x 0.49
Comparison (>=) GE 0.7 + (No. of inputs -1) x 0.49
Comparison (=) EQ 0.7 + (No. of inputs -1) x 0.49
Comparison (<=) LE 0.7 + (No. of inputs -1) x 0.49
Comparison (<) LT 0.7 + (No. of inputs -1) x 0.49
Comparison (≠) NE 0.56 + (No. of inputs -1) x 0.35
String Get Length LEN 53.42 + 0.5 x (No. of characters)
function
Get left sub-string LEFT 83.98 + 0.5 x (No. of characters) + 0.14 x (No. of characters to extract)
Get right sub-string RIGHT 85.98 + 0.5 x (No. of characters) + 0.14 x (No. of characters to extract)
Get middle sub-string MID 87.98 + 0.5 x (No. of characters) + 0.14 x (No. of characters to extract)
Concatenate CONCAT 49.19 + 40 x (No. of characters of input) + 0.5 x (Total numbers of input
characters) x (No. of characters of input) + 0.14 x (No. of characters of
output)
Insert string INSERT 138.19 + 0.64 x (No. of output characters)
Delete string DELETE 110.76 + 0.5 x (No. of input characters) + (No. of characters to delete) +
0.14 x (No. of output characters)
Replace string REPLACE 139.47 + (No. of input characters) + 0.5 x (No. of characters of
replacement - No. of replacement characters) + 0.14 x (No. of input
characters)
Find String FIND 92.63 + 1.5 x (No. of characters of first input + No. of characters of
second input)

App.1-32
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed


String Comparison String (>) GT_STRING 99.56 + 2.3 x (Position where comparison result is output) + 0.5 x
function (Total numbers of input characters)
Comparison String (>=) GE_STRING
Comparison String (=) EQ_STRING 99.56 + 3.5 x (Position where comparison result is output) + 0.5 x
Comparison String (<=) LE_STRING (Total numbers of input characters)

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)

Time type Add time ADD_T_T 0.98


data function
Add time ADD_TD_T 30.68
Add time ADD_DT_T 16.47
Subtract time SUB_T_T 0.48
Subtract time SUB_D_D 19.19
Subtract time SUB_TD_T 30.96
Subtract time SUB_TD_TD 19.19
Subtract time SUB_DT_T 16.47
Subtract time SUB_DT_DT 19.19
Multiply time MUL_T_N 18.91
Multiply time MUL_T_R 81.05
Divide time DIV_T_N 15.91
Divide time DIV_T_R 131.05
Concatenate time CONCAT_D_D 0.98
Convert DT to TOD DT_TO_TOD 14.91
Convert DT to DATE DT_TO_DATE 39.98
Original Set bit SBIT_WORD 0.49
function
Set bit SBIT_DWORD 0.63
Reset bit RBIT_WORD 0.49
Reset bit RBIT_DWORD 0.63
Test bit TBIT_WORD 0.56
Test bit TBIT_DWORD 0.63
Decode DECODE_WORD 8.35
Decode DECODE_DWORD 16.49
Encode ENCODE_WORD 10.35
Encode ENCODE_DWORD 18.49
Bit count BITCOUNT_WORD 10.35
Bit count BITCOUNT_DWORD 13.42
Convert string to number STR_TO_UINT 63.35 + 6.5 x (No. of input characters)
Convert number to string UINT_TO_STR 61.77 + 0.14 x (No. of output characters)
Convert shift-JIS to string SJ_TO_STR 71.98 + 7 x (No. of output characters)
Convert string to shift-JIS STR_TO_SJ 68.7 + 5 x (No. of input characters)
Byte length BYTE_LEN 56.35 + 0.5 x (No. of input characters)
Dead band DBAND_INT 19.7
Dead band DBAND_DINT 21.91
Dead band DBAND_REAL 33.91

App.1-33
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed


Original Bias BIAS_INT 22.7
function
Bias BIAS_DINT 24.91
Bias BIAS_REAL 28.91
Step sequence coil SC_COIL/SC 18.98/19.05
32-bit addition with carry ADC/ADCO 20.19/20.19
32-bit subtraction with borrow SBB/SBBO 21.19/21.19
64-bit multiplication MULL/MULU 31.91/31.91
64-bit division DIVL/DIVU 42.26/42.26
Shift left 32-bits with carry SLC/SLCO 18.84/17.56
Shift right 32-bits with carry SRC/SRCO 18.84/17.56
Standard Set reset flip-flop SR 30
function block
Reset-set flip-flop RS 30
Rising edge trigger R_TRIG 32
Falling edge trigger F_TRIG 32
Up counter CTU 35 to 39
Down counter CTD 35 to 39
Up down counter CTUD 40 to 45
Pulse TP 33 to 45
On-delay timer TON 37 to 42
Off-delay timer TOF 32 to 42
Real-time clock RTC 39
Original Ring counter RCT 36 to 42
function block
Integrating timer TMR 34 to 44
Retriggerable MR 38 to 47
At OPEN request: 210
Response waiting time: 39, Response time: 65
Open channel M_OPEN
At CLOSE request: 192
Response waiting time: 40, Response time: 74
At request: 190 + 0.14 x (No. of send words),
Send message M_SEND
Response waiting time: 35, Response time: 39
At request: 169, Response waiting time: 34,
Receive message M_RECEIVE
Response time: 86 + 0.14 (No. of receive words)
At request: 213 + 4 x (No. of receive request bits),
Direct read READ_BOOL Response waiting time: 35,
Response time: 57 + 10 x (No. of receive bits)
At request: 211 + 3 x (No. of receive request words),
Direct read READ_WORD Response waiting time: 35,
Response time: 60 + 7 x (No. of send words)
At request: 230 + 7 x (No. of send bits),
Direct write WRITE_BOOL
Response waiting time: 37, Response time: 45
At request: 217 + 0.14 x (No. of send words),
Direct write WRITE_WORD
Response waiting time: 37, Response time: 49
At request: 232, Response waiting time: 39,
Remote data read R_READ
Response time: 93 + 0.14 x (No. of receive words)
At request: 251 + 0.14 x (No. of send words),
Remote data write R_WRITE
Response waiting time: 39, Response time: 78

App.1-34
Appendix 1 Instruction Processing Speed Chart SPH200

All values in μs

Language Name Processing Speed


Original At request: 168, Response waiting time: 35,
File data read F_READ
function block Response time: 158 + 0.14 x (No. of receive words)
At request: 278 + 0.14 x (No. of send words),
File data write F_WRITE
Response waiting time: 36, Response time: 59
Extension test & set EXT_T_S -
Sequential file store FFST 81 + 0.14 x (No. of words)
Sequential file load first FIFO 81 + 0.14 x (No. of words)
Sequential file load last FILO 81 + 0.14 x (No. of words)
Filter FILTER_DINT 101 to 217
Filter FILTER_REAL 281
Integrate INT_DINT 102 to 216
Integrate INT_REAL 239
Differentiate DIF_DINT 84
Differentiate DIF_REAL 259
Pulse count PULSE_CNT 46 to 49
Pulse output PULSE_OUT 45 to 57
Pulse PWM 44 to 49
Hardware RTC (Real-time clock) HW_RTC 33 to 75
Test & set T_S 47
Change bank BANK_CHG 61 to 154

<Processing speed of <SFC elements>


For SFC elements, only steps that are currently active are executed. Consequently, it is difficult to discuss the processing
speed of SFC elements using only the worksheet on which the SFC elements are programmed. When it is necessary to grasp
processing speed, it is recommended that the processing speed be measured by using an actual machine.

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.

<System configuration that depends on the tact cycle>


• Number of I/O points
• Number of CPUs
• Number of remote I/O master modules
• Number of communication modules

(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]

No. of direct connection I/O points


0 32 128 256 512 1024 2048 3072 4096 6144 8192
(points)
Base time Tb
418 504 507 510 556 695 1042 1388 1520 1711 1911
(μs)

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.

2) Multi-CPU configuration: [No. of CPUs: n]


• T= Tb + 210n ..................................(No. of direct connection input/output points: 2048 or less)
• T= Tb + 200n + 190 ....................... (No. of direct connection input/output points: more than 2048)

3) Single CPU + remote I/O: [No. of remote I/O master modules: m]


• T= Tb + 250n + 430 ....................... (No. of direct connection input/output points: 2048 or less)
• T= Tb + 280n + 730 ....................... (No. of direct connection input/output points: more than 2048)

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.

(3) Sample time calculations (SPH300)


1) Single CPU configuration

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

Redundant system tact time 1: TR1 [ms]


(Note)
TR1 = Usual tact time + 596 x N + 430 (No. of directly connected I/Os: 2048 or less)
TR1 = Usual tact time + 626 x N + 730 (No. of directly connected I/Os: more than 2048)
N: No. of pairs in the redundant system

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.

Redundant system tact time 2: TR2 [μs]


TR2 = (I/O refresh time) + TDMA + TCPY + 200 [μs]
• I/O refresh time : (2n + m + 60) [μs] [n: No. of I/O modules, m: Total No. of I/O words]
• TDMA = [(No. of SX bus modules excluding CPUs) + (No. of CPU modules) x 2 + (No. of remote master modules x 55)
+ (No. of total words for all connected/remote I/Os) + 512] x 0.5 [μs]

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

<System configuration components depending on the tact cycle>


• No. of I/O points
• No. of remote I/O modules
• No. of communication modules
• No. of stations simultaneously issuing loader command
The tact cycle can be selected among 1, 2, 3, ...19, 20ms. (1) The tact cycle calculated is based on SX bus performance
(No. of I/O modules) and (2) the necessary tact cycle based on the run time of system software, whichever is larger, is
determined by truncation.

(1) The tact cycle calculated is based on SX bus performance


Tact cycle T (μs)
1) One CPU + Connected I/O: T = Tb

No. of direct connection I/O points


0 32 128 256 512 1024 2048 3072 4096 6144 8192
(points)
Base time Tb
418 504 507 510 556 695 1042 1388 1520 1711 1911
(μs)

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) One CPU + remote I/O mater: [No. f remote I/O masters]


• T = Tb + 250 m + 430 (No. of direct connection input/output points: 2048 or less)
• T = Tb + 280 m + 730 (No. of direct connection input/output points: more than 2048)
Notes:
2048 points/1 line is assumed for remote I/O.

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

Recommended tact time (ms) 1 2 3 4 5 6 7 8


No. of stations simultaneously issuing
1 4 16 27 27 27 27 27
loader commands
Calculation time (μs) 409 1209 2009 2809 3609 4409 5209 6009

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.

Size of Data Occupied by the Data Types

Data type Occupied words


1 word if the bit string is 16 bits or less.
Bit BOOL If the bit string is longer than 16 bits, 1 word is occupied for every 16 bits.
Another word is occupied for the remaining bit fragment.
Word INT, UINT, WORD 1 word
DINT, UDINT, REAL, DWORD,
2 words 2 words
TIME, DATE, TOD, DT

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.

Preceding Stage Data


Bit data Word data Double word data
Bit data Within same word Word boundary Word boundary
Current Word data Word boundary Word boundary Word boundary
Double word data Double word boundary Double word boundary Double word boundary

Example 1)

TYPE (No. of occupied words)


a1 : BOOL ; 1/16
a2 : BOOL ; 1/16
a3 : INT ; 1
a4 : DINT ; 2
a5 : WORD ; 1
a6 : BOOL ; 1/16
a7 : INT ; 1
a8 : DWORD ; 2
END_TYPE

Total 7 + 3/16 = 8 words

Example 2)

TYPE (No. of occupied words)


b1 : BOOL ; 1/16
b2 : BOOL ; 1/16
b3 : UINT ; 1
b4 : TIME ; 2
b5 : WORD ; 1
b6 : INT ; 1
b7 : BOOL ; 1/16
b8 : WORD ; 1

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

I/O I/O I/O I/O


CPU CPU
Power “0” “1”
supply

CPU0 CPU1

Standard memory Standard memory

%MW0.1.2048 %MW1.1.2048

60ns

%MW0.1.2048 %MW1.1.2048.0 3μs

Processor bus

<Access time to each memory from an application (CPU)>


The access time to each memory in or out of the CPU is shown below.

Accessed memory Access time (/word)


High-speed memory in self-CPU (%MW1.0 to %MW1.2047) 20ns
Memory other than those in self-CPU 60ns
I/O area (I/Q) 20ns
Memory in any other CPU in a multi-CPU system (Note 1) 3μs (Note2)
P/PE-link memory 3μs (Note2)

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.

CPU0 CPU1 CPU2 CPU3

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.

Upper case Lower case Upper case Lower case


Symbol ) ELEMENTARY elementary
ABS abs ELSE else
ABS( abs( ELSEIF elseif
ACOS acos EN en
ACOS( acos( END_CASE end_case
ADD add END_FOR end_for
ADD( add( END_IF end_if
AND and END_PROGRAM end_program
AND( and( END_REPEAT end_repeat
ANDN andn END_STRUCT end_struct
ANDN( andn( END_TYPE end_type
A E
ANY any END_VAR end_var
ANY_BIT any_bit END_WHILE end_while
ANY_DATE any_date ENO eno
ANY_INT any_int ENUM enum
ANY_NUM any_num EQ eq
ANY_REAL any_real EQ( eq(
ARRAY array EXIT exit
ASIN asin EXP exp
AT at EXP( exp(
ATAN atan EXPT expt
EXPT( expt(
BOOL bool
BOOL# bool# FALSE false
BOOL8 bool8 FIND find
B FIND( find(
BY by F
BYTE byte FOR for
BYTE# byte# FUNCTION function
FUNCTION_BLOCK function_block
CAL cal
CALC calc GE ge
CALCN calcn GE( ge(
G
CASE case GT gt
CONCAT concat GT( gt(
C CONCAT( concat(
CONFIGURATION configuration IF if
CONSTANT constant INSERT insert
COS cos I INSERT( insert(
COS( cos( INT int
CSV csv INT# int#

DATE date JMP jmp


DATE# date# J JMPC jmpc
DATE_AND_TIME date_and_time JMPCN jmpcn
DATE_AND_TIME# date_and_time#
DELETE delete
DELETE( delete(
DEVICE device
DINT dint
DINT# dint#
D
DIV div
DIV( div(
DIV_T_AN div_t_an
DIV_T_AN div_t_an
DO do
DT dt
DT# dt#
DWORD dword
DWORD# dword#

App.6-1
Appendix 6 List of Reserved Words

Upper case Lower case Upper case Lower case

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

Upper case Lower case

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

Appendix 7-1 How to Execute Programs at High-speed with SPH3000


To execute a program at a high-speed with SPH3000, create a program in the following manner.

1. Use the high-speed data memory.


* In a program, use the data memories 1) to 4) shown below.
1) High-speed non-retain memory 96KW
2) Normal retain memory
3) Normal user FB memory Total: 32KW
4) Normal system FB memory
* Minimize the use of memories other than above (normal non-retain memory and multi-CPU memory).

2. Use the optimized compilation mode.


* Set the “Optimize” option to “Valid” for optimized compilation.

App.7-1
Appendix 7 How to Use SPH3000 High-speed Function

Appendix 7-2 Using High-speed Data Memory


(1) Memory allocation setting
On the “Memory Allocation setting” dialog box, adjust the memories so that the high-speed data memory is used.

• Use 1) to 4) that are high-speed memories.


• Avoid using 5) and 6) as much as possible.

1)

5)

6)

2)

3)

4)

1)

2)

Uncheck the options 1) and 2) not to specify the AT range.

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.

Compilation result window


A
C
B

Checking the memory consumption


(1) Non-retain memory
A indicates the sum of 1) (high-speed non-retain memory) and 5) (normal non-retain memory).

From 0 to 96 KW, the processing is performed in the high-speed memory.


After that, the low-speed memory is used.

(2) Retain memory


B indicates the sum of 2) (retain normal memory) and 6) (multi-CPU retain memory).

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.

(3) User FB memory


C indicates the sum of 3) (user FB normal memory) and 6) (user FB memory).

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.

(4) System FB memory


For D , up to the maximum value set in 4) (system FB normal memory), the processing is performed in the high-speed
memory.
For E , up to the maximum value set in 6) (system FB memory), the low-speed memory is used.

App.7-3
Appendix 7 How to Use SPH3000 High-speed Function

Appendix 7-3 Using Optimized Compilation Mode


On the “Compiler setting” dialog box in the “Resource setting of MICREX-SX,” set the “Optimize” option to valid.

“Compiler setting” dialog box

Select “valid.”

You can select You can select


“valid” or “invalid.” “high-speed” or “default.”

About “optimize” option


(1) Advantage of optimized compilation
When the “Optimize” option is set to “valid,” the program execution code is compressed.
Compressing the program execution code provides the following advantages: program execution is speeded up and the number
of programs that can be stored in the high-speed area (high-speed PG memory area) is increased.
In the high-speed PG memory area, application programs are executed at a high-speed. On the above dialog box, you can
assign programs to the high-speed area in units of POUs.
However, the size of the high-speed PG memory area is limited. All the programs may not be able to be assigned to this area.
Therefore, preferentially assign programs that need to be executed at a high-speed to the high-speed PG memory area.

(2) Limitations of optimized compilation


When the “Optimize” option is set to “valid,” the compiling process time becomes 3 to 10 times longer compared with when “invalid”
is selected.
In addition, there are two types of programs that cause a compilation error when the “Optimize” option is “valid” as shown in the
following page.

(3) Default setting of “Optimize” option


The default setting of the “Optimize” option is “Invalid.”
When “invalid” is selected,
• Most frequently called user FB
• Higher priority Task
• Larger size POU
are automatically assigned to the high-speed PG memory area.

App.7-4
Appendix 7 How to Use SPH3000 High-speed Function

Appendix 7-4 Programming Limitations in Optimized Compilation Mode


When the “Optimize” option is set to “valid,” the programs shown below cause a compilation error.
Modify them as shown in the <Counter measure circuits>.
* Or alternatively, disable the optimized compilation to avoid the following compilation errors.

(1) Connection of circuits using a connector


<Circuit causing a compilation error>

<Counter measure circuit>


Do not use a connector. Connect the circuits using a line.

(2) Feedback circuit


<Circuit causing a compilation error>

<Counter measure circuit>


Do not feedback using a line. Feedback using a variable.

App.7-5
Appendix 7 How to Use SPH3000 High-speed Function

Appendix 7-5 How to Check Remaining Capacity of High-speed PG Memory


Check the remaining capacity of the high-speed PG memory area using the following two windows.

Total capacity Used capacity Remaining capacity

Resource information window

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

Appendix 8-1 Overall Procedure


<Step 1> Save an existing project under a different name.

<Step 2> Change the CPU type of the POU to “independent.”

<Step 3> Add a resource (48R).

<Step 4> Copy the contents of the global variables.

<Step 5> Copy the contents of the tasks.

<Step 6> Change the system definition.

<Step 7> Reflect the settings of the existing resource to the new resource.

<Step 8> Delete the existing resource.

App.8-1
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

Appendix 8-2 Detailed Procedure for Changing CPU Type in D300winV3


Project
This subsection describes the operation procedure using D300winV3.6.9.16. (Even for a different version of V3, the operation
procedure is basically the same.)

In this example, “NP1PS-32R” used in a project of a single CPU system is changed to “NP1PM-48R.”

<Step 1> Saving an existing project under a different name


In the [File] menu, click “Save Project As / Zip Project As.” Save the project under a different name.

<Step 2> Changing the CPU type of the POU to “independent”


Open the property of each POU and change the CPU type to “independent.”
* Do not change the PLC type (MICREXSX).

App.8-2
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

<Step 3> Adding a resource (48R)


In the project tree, right-click the existing resource and select [Insert] > [Resource].

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.

The new resource has been added.

App.8-3
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

<Step 4> Copying the contents of the global variables


Open the global variable worksheet and copy the variables. Then, paste them into the global worksheet of the new resource.

Double-click here to open the global


worksheet of the existing resource.

Drag this part to select the variables.


Then, copy them by pressing the
<Ctrl> + <C> keys.

Double-click here to open the global


worksheet of the new resource.

Select this part, and then paste the variables


by pressing the <Ctrl> + <V> keys.

App.8-4
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

<Step 5> Copying the contents of the tasks


Copy the tasks of the existing resource and paste them into the task of the new resource.

Select the existing task.


When two or more tasks exist, select them all by click them
while pressing the <Ctrl> key.
Then, copy them by pressing the <Ctrl> + <C> keys.

Select the “Tasks” folder of the new


resource and paste the copied tasks by
pressing the <Ctrl> + <V> keys.

The following message appears. Click the [OK] button.

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.

<Task settings of the existing resource>

Check the task settings of the existing


resource and make the same settings
to the task of the new resource.

App.8-6
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

<Step 6> Changing the system definition


<Step 6-1> Canceling the I/O registration of the existing resource
Double-click “System_Definition” to open the system definition screen.
Then, right-click the CPU and select “Properties” to open the “Module properties” dialog box.

On the “Module properties” dialog box, click the [Parameter] button.

App.8-7
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

The “CPU parameter” dialog box opens.


Click the “I/O group setting” tab. After taking notes on which I/O is registered in the “Input select” and “Output select” list boxes
of the “Level: DEFAULT,” click the “All cancel” button to cancel the registration.

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.

On the “Module properties” dialog box, click the [Parameter] button.

App.8-12
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

The “CPU parameter” dialog box opens.


Click the “I/O group 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 “Input select” and “Output select” list boxes on the right.
In the same manner, register the I/Os for “Level: 0 level” a “Level: 1 level.”

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)

The following warning message appears.


Click the [Yes] button to close the screen.

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.

[CPU running definition] dialog box

App.8-16
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

[Memory allocation setting] dialog box

Take notes on the memory size settings.

Take notes on the AT range settings.

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

[CPU running definition] dialog box

App.8-18
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

[Memory allocation setting] dialog box

The memory capacity of the new resource may be different


from that of the existing resource.
After changing the CPU type, compile the project again and
adjust the memory size if there is insufficient memory.

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.

The existing resource has been deleted.

App.8-20
Appendix 8 Changing Resource (CPU)
(How to change CPU type in D300winV3 project)

<Step 9> Compiling the project again


In the [Build] menu, click the [Rebuild Project].
If an error is detected (compilation errors are most likely caused by differences in memory allocation settings between the
existing and new resources), check the error contents and review the parameter setting.

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

Numerics Bit count BITCOUNT_DWORD....................................2-140


Bit count BITCOUNT_WORD.......................................2-140
32-bit addition with carry ADC/ADCO...........................2-148 BITCOUNT_DWORD.....................................................2-140
32-bit subtraction with borrow SBB/SBBO...................2-149 BITCOUNT_WORD........................................................2-140
64-bit division DIVL/DIVU.............................................2-151 BOOL_TO_DWORD.......................................................2-201
64-bit multiplication MULL/MULU.................................2-150 BOOL_TO_WORD.........................................................2-199
BYTE_LEN.....................................................................2-143
Byte length BYTE_LEN................................................2-143

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.

Das könnte Ihnen auch gefallen