You are on page 1of 386

series

USER'S MANUAL

INSTRUCTIONS

FEH200b
Preface

This User’s Manual explains the system configuration, the When using modules or peripheral devices, be sure to read
memory and the language of SPH. Read this manual the corresponding user’s manuals listed below.
carefully to ensure correct operation.

Title Manual No. Contents


User's Manual Hardware, FEH201 Explains the system configuration, the specifications and
MICREX-SX series SPH operations of modules in the MICREX-SX series.
User's Manual P/PE-link modules, MICREX- FEH203 Explains the communication specifications of P/PE-link, the
SX series SPH specifications and operations of the modules.
User's Manual T-link master module / T-link FEH204 Explains the communication specifications of the T-link, the
interface module, MICREX-SX series SPH specifications and operations of the T-link master module /
the T-link interface module.
User's Manual D300win <Introduction>, FEH250 Explains the basic operations of D300win, the programming
MICREX-SX series and monitoring for MICREX-SX series.
User's Manual Software PLC, FEH245 Explains the system configuration, the specifications, and
MICREX-SX series SPH operations (installation, etc.) of the software PLC for
MICREX-SX Series.
User's Manual D300winV2 <Reference>, FEH254 Explains the menu and icon of D300win and all of the
MICREX-SX series operations of D300winV2.

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 Here, the safety precaution items are classified into
using the module. “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 also result in a Both safety instruction categories provide important
serious accident. information. Be sure to strictly observe these instructions.

Warning

◊ Place the emergency stop circuit, interlock circuit or the like for safety outside the PC. A failure of PC 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

*Manual No. is shown on the cover.

Printed on *Manual No. Revision contents

Sep. 1998 FEH200 First edition

Sep. 2000 FEH200a The tentative specifications and description of the processor bus access have
been added.
Standard CPU specification added.
Duplex system and fail-soft specifications added.
High-performance CPU NP1PS-74 specification added.

Jul. 2001 FEH200b Software PLC specifications added.


High-performance CPU NP1PS-117R specifications added.
Contents

Preface
Safety Precautions
Revision
Contents
Page

Section 1 Specifications .................................................................................... 1-1


1-1 Specifications .........................................................................................................................................1-1
1-1-1 High-performance CPU (SPH300) ................................................................................................................ 1-1
1-1-2 Standard CPU (SPH200) .............................................................................................................................. 1-3
1-1-3 Software PLC (SPS) ...................................................................................................................................... 1-5
1-2 Memory ....................................................................................................................................................1-6
1-2-1 Memory map ................................................................................................................................................. 1-6
1-2-2 Input/output memory area (512 words) ....................................................................................................... 1-13
1-2-3 Standard memory area ............................................................................................................................... 1-14
1-2-4 Retain memory area .................................................................................................................................... 1-15
1-2-5 User FB instance memory area .................................................................................................................. 1-16
1-2-6 System FB instance memory area .............................................................................................................. 1-17
1-2-7 Initialization area ......................................................................................................................................... 1-18
1-2-8 System memory area (512 words) .............................................................................................................. 1-19
1-2-9 Temporary areas .......................................................................................................................................... 1-43
1-3 Input/output Address Assignment ..................................................................................................... 1-46
1-3-1 Address assignment example ..................................................................................................................... 1-46
1-3-2 Address assignment conventions ............................................................................................................... 1-46
1-3-3 Assigning input/output addresses to an application program ..................................................................... 1-47
1-4 Variables ................................................................................................................................................1-48
1-4-1 What is a variable? ...................................................................................................................................... 1-48
1-4-2 Memory assignment .................................................................................................................................... 1-49
1-4-3 Local variables and global variables ........................................................................................................... 1-49
1-4-4 Variable declaration ..................................................................................................................................... 1-50
1-5 Data Types .............................................................................................................................................1-53
1-5-1 Organization of data types .......................................................................................................................... 1-53
1-5-2 Basic data types .......................................................................................................................................... 1-54
1-5-3 Derived data types ...................................................................................................................................... 1-57
1-6 Tasks ......................................................................................................................................................1-62
1-6-1 Task specifications ....................................................................................................................................... 1-62
1-6-2 Types and operations of tasks ..................................................................................................................... 1-62
1-6-3 Example of periodic task operation ............................................................................................................. 1-63
1-6-4 Example of event task operation ................................................................................................................. 1-64
1-6-5 Task interrupt processing ............................................................................................................................ 1-65
1-7 Program Organization Units (POUs) .................................................................................................. 1-66
1-8 Calendar Function ................................................................................................................................1-70
1-8-1 Calendar’s value range ................................................................................................................................ 1-70
1-8-2 Calendar accuracy ...................................................................................................................................... 1-70
1-8-3 Monitoring and setting up the calendar clock from the D300win .............................................................. 1-70
1-8-4 Monitoring and setting up the calendar clock from an application program ............................................... 1-71
1-8-5 Time adjustment function ............................................................................................................................ 1-71
1-9 Operating Flowchart ............................................................................................................................1-72
Contents

Section 2 Programming Languages ................................................................. 2-1


2-1 Types of Programming Languages ....................................................................................................... 2-1
2-2 IL Language ............................................................................................................................................2-3
2-2-1 IL instruction summary .................................................................................................................................. 2-3
2-2-2 IL language instructions ................................................................................................................................ 2-6
2-3 ST Language .........................................................................................................................................2-30
2-3-1 ST operators ................................................................................................................................................ 2-30
2-3-2 ST statements ............................................................................................................................................. 2-31
2-3-3 ST language statements ............................................................................................................................. 2-31
2-4 LD Language .........................................................................................................................................2-37
2-4-1 LD language ................................................................................................................................................ 2-37
2-4-2 LD language instructions ............................................................................................................................. 2-38
2-5 FBD Language ......................................................................................................................................2-41
2-5-1 Function summary ....................................................................................................................................... 2-42
2-5-2 Function block summary ............................................................................................................................. 2-67
2-5-3 Type conversion functions ........................................................................................................................... 2-78
2-5-4 Arithmetic functions ................................................................................................................................... 2-109
2-5-5 Bit string functions ..................................................................................................................................... 2-120
2-5-6 Selection/comparison functions ................................................................................................................ 2-128
2-5-7 Character string functions ......................................................................................................................... 2-137
2-5-8 Time type data functions ........................................................................................................................... 2-145
2-5-9 Original FCTs (Functions) ......................................................................................................................... 2-151
2-5-10 Standard FBs (Function Blocks) ............................................................................................................. 2-169
2-5-11 Original FBs (Function Blocks) ............................................................................................................... 2-175
2-5-12 Original FBs dedicated to SPS ............................................................................................................... 2-204
2-6 SFC Elements .....................................................................................................................................2-214
2-6-1 SFC elements ............................................................................................................................................ 2-215
2-6-2 Step transition ........................................................................................................................................... 2-223
2-6-3 Automatically generated SFC variables .................................................................................................... 2-226
2-6-4 SFC programming precautions ................................................................................................................. 2-227
2-6-5 Continuous operation of SFC .................................................................................................................... 2-228

Section 3 System Definitions ........................................................................... 3-1


3-1 System Definition Summary .................................................................................................................3-1
3-2 System Configuration Definitions ........................................................................................................ 3-2
3-3 System Properties ..................................................................................................................................3-5
3-3-1 System operation definitions ......................................................................................................................... 3-5
3-3-2 System duplex mode definition ..................................................................................................................... 3-7
3-3-3 System fail-soft start-up ................................................................................................................................ 3-8
3-4 System Output Definitions .................................................................................................................. 3-10
3-5 CPU Parameters ...................................................................................................................................3-11
3-5-1 CPU operation definitions ........................................................................................................................... 3-11
3-5-2 CPU memory size definition ........................................................................................................................ 3-13
3-5-3 I/O group setup ............................................................................................................................................ 3-16
3-5-4 Fail-soft running ........................................................................................................................................... 3-20
3-6 Input/output Parameters ......................................................................................................................3-22
3-6-1 Input filtering time ........................................................................................................................................ 3-23
3-6-2 Output hold definition .................................................................................................................................. 3-24
Contents

Section 4 CPU Duplex System .......................................................................... 4-1


4-1 System operation in the duplex mode ................................................................................................. 4-1
4-1-1 1 to 1 duplex mode ....................................................................................................................................... 4-1
4-1-2 N to 1 duplex mode ...................................................................................................................................... 4-2
4-2 Conditions for changeover between operating ..................................................................................4-3
4-2-1 Conditions for changeover ........................................................................................................................... 4-3
4-2-2 System performance in the duplex mode and waiting CPUs and performance ........................................... 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 operating and waitin ing and waiting CPUs ............................ 4-8
4-3 CPU module LEDs and output to display system ............................................................................... 4-9
4-4 Application of the duplex system ....................................................................................................... 4-10
4-4-1 Successively start of CPU module ............................................................................................................. 4-10
4-4-2 1 to 1 duplex system .................................................................................................................................. 4-10
4-4-3 N to 1 duplex system .................................................................................................................................. 4-10
4-4-4 System configuration definition .................................................................................................................. 4-10

Appendix 1 Instruction Proces Speed Chart............................................ App.1-1


1-1 High-performance CPU Instruction Processing Speed Chart ................................................... App.1-1
1-2 Standard CPU Instruction Processing Speed Chart................................................................... App.1-9

Appendix 2 Setting High-performance CPU Takt Periods ....................... App.2-1


Appendix 3 Setting Standard CPU Takt Periods ...................................... App.3-1
Appendix 4 Calculating the Size of Arrays and Structures .................... App.4-1
Appendix 5 Accessing the Processor Bus............................................... App.5-1
Appendix 6 List of Reserved Words.......................................................... App.6-1
Section 1 Specifications

Page
1-1 Specifications ........................................................................................................... 1-1
1-1-1 High-performance CPU (SPH300) ..................................................................................... 1-1
1-1-2 Standard CPU (SPH200) ................................................................................................... 1-3
1-1-3 Software PLC (SPS) .......................................................................................................... 1-5

1-2 Memory ..................................................................................................................... 1-6


1-2-1 Memory map ...................................................................................................................... 1-6
(1) NP1PS-32 (High-performance CPU) .................................................................................................. 1-6
(2) NP1PS-74 (High-performance CPU) .................................................................................................. 1-7
(3) NP1PS-117R (High-performance CPU) ............................................................................................. 1-8
(4) NP1PH-16 (Standard CPU) ................................................................................................................ 1-9
(5) NP1PH-08 (Standard CPU) .............................................................................................................. 1-10
(6) NP4P-SPS (Software PLC) ............................................................................................................... 1-11
1-2-2 Input/output memory area (512 words) ............................................................................ 1-13
1-2-3 Standard memory area .................................................................................................... 1-14
1-2-4 Retain memory area ........................................................................................................ 1-15
1-2-5 User FB instance memory area ....................................................................................... 1-16
1-2-6 System FB instance memory area ................................................................................... 1-17
1-2-7 Initialization area .............................................................................................................. 1-18
1-2-8 System memory area (512 words) ................................................................................... 1-19
(1) System memory ................................................................................................................................ 1-19
(2) Resource operating status %MW10.0 (Read only) ........................................................................... 1-21
(3) Resource switch / User ROM state %MW10.1 (Read only) .............................................................. 1-22
(4) Resource fatal fault factor %MW10.2 (Read only) ............................................................................ 1-22
(5) Resource nonfatal fault factor %MW10.4 (Read only) ...................................................................... 1-23
(6) CPU error factor %MW10.6 (Read only) (Not supported by SPS) .................................................... 1-23
(7) Memory error factor %MW10.8, %MW10.9 (Read only) (Not supported by SPS) ........................... 1-24
(8) SX bus error factor %MW10.10, %MW10.11 ................................................................................... 1-24
(9) Application error factor %MW10.12, %MW10.13 (Read only) .......................................................... 1-25
(10) User fatal fault %MW10.14 to %MW10.16 ...................................................................................... 1-25
(11) User nonfatal fault %MW10.18 to %MW10.20 ................................................................................ 1-25
(12) System definition error factor %MW10.22 to %MW10.29 (Read only) ........................................... 1-26
(13) Application program error factor %MW10.38, %MW10.39 ............................................................. 1-28
(14) Annunciator relay %MW10.42, %MW10.43 .................................................................................... 1-29
(15) Duplex annunciator relay %MW10.46, Duplex operation mode
%MW10.47 (Read only) (Not supported by SPH200, and SPS) .................................................... 1-29
(16) Resource configuration/operation information .......................................................................................
%MW10.48, %MW10.49 (Read only) (only for SPH300) ............................................................... 1-30
(17) Resource configuration/fault information %MW10.50, %MW10.51 (Read only) ............................ 1-31
(18) SX bus configuration information %MW10.52 to %MW10.67 (Read only) ..................................... 1-32
(19) SX bus fault information %MW10.68 to %MW10.83 (Read only) ................................................... 1-33
(20) SX bus-connected module fail-soft information %MW10.84 to %MW10.99 (Read only) ................ 1-33
(21) Remote I/O master 0 I/O module configuration/fault information
%MW10.128 to %MW10.143 (Read only) ...................................................................................... 1-34
(22) Remote I/O master 1 I/O module configuration/fault information
%MW10.144 to %MW10.159 (Read only) ...................................................................................... 1-35
(23) Remote I/O master 2 I/O module configuration/fault information
%MW10.160 to %MW10.175 (Read only) ...................................................................................... 1-35
(24) Remote I/O master 3 I/O module configuration/fault information
%MW10.176 to %MW10.191 (Read only) ...................................................................................... 1-36
(25) Remote I/O master 4 I/O module configuration/fault information
%MW10.192 to %MW10.207 (Read only) ...................................................................................... 1-36
(26) Remote I/O master 5 I/O module configuration/fault information
%MW10.208 to %MW10.223 (Read only) ...................................................................................... 1-37
(27) Remote I/O master 6 I/O module configuration/fault information
%MW10.224 to %MW10.239 (Read only) ...................................................................................... 1-37
(28) Remote I/O master 7 I/O module configuration/fault information
%MW10.240 to %MW10.255 (Read only) ...................................................................................... 1-38
(29) Configuration information of all module in the resource
%MW10.300 to %MW10.315 (Read only) (only for SPS) ............................................................... 1-39
(30) Fault information of all module in the resource (Read only)
%MW10.316 to %MW10.331 (Read only) (only for SPS) ............................................................... 1-39
(31) Remote I/O master board 0- I/O module configur ation / fault information
%MW10.360 to %MW10.375 (Read only) (only for SPS) ............................................................... 1-40
(32) Remote I/O master board 1- I/O module configur ation / fault information
%MW10.376 to %MW10.391 (Read only) (only for SPS) ............................................................... 1-41
(33) Remote I/O master board 2- I/O module configur ation / fault information
%MW10.392 to %MW10.407 (Read only) (only for SPS) ............................................................... 1-41
(34) Remote I/O master board 3- I/O module configur ation / fault information
%MW10.408 to %MW10.423 (Read only) (only for SPS) ............................................................... 1-42
(35) SX bus transmission error rate information %MW10.508 to %MW10.511 (Read only) .................. 1-42
1-2-9 Temporary areas .............................................................................................................. 1-43
(1) Using temporary areas ..................................................................................................................... 1-43
(2) Restrictions on a temporary size ...................................................................................................... 1-44
(3) Using a temporary area .................................................................................................................... 1-44

1-3 Input/output Address Assignment ....................................................................... 1-46


1-3-1 Address assignment example .......................................................................................... 1-46
1-3-2 Address assignment conventions .................................................................................... 1-46
1-3-3 Assigning input/output addresses to an application program .......................................... 1-47

1-4 Variables ................................................................................................................. 1-48


1-4-1 What is a variable? ........................................................................................................... 1-48
1-4-2 Memory assignment ......................................................................................................... 1-49
1-4-3 Local variables and global variables ................................................................................ 1-49
1-4-4 Variable declaration .......................................................................................................... 1-50
(1) Types of variable declaration statements .......................................................................................... 1-50
(2) AT specification variables (position variables) ................................................................................... 1-50
(3) Symbolic variables ............................................................................................................................ 1-51
(4) Retain variables ................................................................................................................................ 1-52
(5) Initialization variable .......................................................................................................................... 1-52
(6) Restrictions on variable names ......................................................................................................... 1-52

1-5 Data Types .............................................................................................................. 1-53


1-5-1 Organization of data types ............................................................................................... 1-53
1-5-2 Basic data types ............................................................................................................... 1-54
1-5-3 Derived data types ........................................................................................................... 1-57
(1) Array data types ................................................................................................................................ 1-57
(2) Structured data types ........................................................................................................................ 1-59
(3) Restrictions on derived data types .................................................................................................... 1-61
1-6 Tasks ....................................................................................................................... 1-62
1-6-1 Task specifications ........................................................................................................... 1-62
1-6-2 Types and operations of tasks .......................................................................................... 1-62
1-6-3 Example of periodic task operation .................................................................................. 1-63
1-6-4 Example of event task operation ...................................................................................... 1-64
1-6-5 Task interrupt processing ................................................................................................. 1-65

1-7 Program Organization Units (POUs) .................................................................... 1-66

1-8 Calendar Function ................................................................................................. 1-70


1-8-1 Calendar’s value range .................................................................................................... 1-70
1-8-2 Calendar accuracy ........................................................................................................... 1-70
1-8-3 Monitoring and setting up the calendar clock from the D300win .................................... 1-70
1-8-4 Monitoring and setting up the calendar clock from an application program ..................... 1-71
1-8-5 Time adjustment function ................................................................................................. 1-71

1-9 Operating Flowchart .............................................................................................. 1-72


High-performance CPU
Section 1 Specifications
1-1 Specifications

1-1-1 High-performance CPU (SPH300)


Item Specification
Type NP1PS-32 NP1PS-74 NP1PS-117R
Control system Stored program, Cyclic scanning system (default task), periodic task, event task
Input / Output connection method Direct input / output (SX bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Takt synchronous refresh
I/O control system
Via T-link: 10ms periodic refresh
CPU 32-bit OS processor, 32-bit execution processor
Memory types Program memory, Data memory, Temporary
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
FSC elements (Sequential Function Chart) To IEC 61131-3
Length of instructions Variable length (depending on language)
Sequence 20 to 520ns/instruction
Instruction instruction
execution speed
Applied instruction 40ns or more/instruction
Program memory capacity 32768 steps 75776 steps 119808 steps
Program steps in a POU 4096 steps
No. of I/O points 512 words (Max. 8192 points)
I/O memory (I/Q) 512 words
General memory (M) 8192 words 32768 words 131072 words
Retain memory (M) 4096 words 16384 words 32768 words
Instance memory for User FB 4096 words 16384 words 32768 words
(M)
memory 16384 words 65536 words 65536 words
Timer 512 words 2048 words 2048 words
(Note 1) Instance
memory for Integrating timer 128 words 512 words 512 words
system FB Counter 256 words 1024 words 1024 words
(M)
Edge detection 1024 words 4096 words 4096 words
Others 8192 words 32768 words 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 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
No. of array data type elements 16-bit data type: 4096 32-bit data type: 2048
Default tasks (Cyclic scanning): 1
No. of tasks Periodic tasks: 4
Event tasks: 4 (Total of 4 tasks when Periodic task is used)
Program instance (No. of POUs/resource) 256 (Max. no. of instances allowed in one task=128)
Earlier than D300win version V1.2: 1000 (including POUs in the library)
No. of POUs in program
D300win version 2.0 or later: 2000 (including POUs in the library)

Note: 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) This depends on each instruction.

1-1
1-1 Specifications High-performance CPU

Item Specification
No. of user function blocks 512
Nesting depth of user function blocks Earlier than D300win version V1.2: 124 levels
(Note) D300win version 2.0 or later: 127 levels
No. of user functions 512
Nesting depth of user functions Earlier than D300win version V1.2: 124 levels
(Note) D300win version 2.0 or later: 127 levels
FB instance 620/POU (Up to 620 FBs allowed in one POU)
Earlier than D300win version V1.2: 8000
Global variable
D300win version 2.0 or later: 15000
Variable
Earlier than D300win version V1.2: 8000 (Total for all POUs)
Local variable
D300win version 2.0 or later: 15000/POU
VAR_INPUT : Up to 128
No. of user FB terminals 128 in total
VAR_OUTPUT : Up to 128
No. of registered 16/project
Library libraries
Nesting depth 8 levels
Self-diagnosis (memory check, ROM sum check), System configuration
Diagnostic function
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.
Data memory, calendar IC memory
Primary lithium battery Switching time: within 5 min. (at 25° C)
Battery backup
Durability (at 25° C):
NP1PS-32 5 years NP1PS-74 1.3 years NP1PS-117R 1.3 years
Memory backup by flash ROM Saves application programs, system definitions, ZIP files in flash ROM of the CPU.
(contained in CPU module)
Memory backup by user ROM card Application programs, system definitions, zip files and compressed projects can be
(removable) (only for NP1PS-117R) saved in user ROM card (compact flash card).

Note: Total of nesting levels for user function blocks and user functions.

1-2
Standard CPU 1-1 Specifications

1-1-2 Standard CPU (SPH200)


Item Specification
Type NP1PH-16 NP1PH-08
Control system Stored program, Cyclic scanning system (default task), periodic task, event task
Input / Output connection method Direct input / output (SX bus), remote input / output (T-link, OPCN-1 etc.)
Via SX bus: Takt synchronous refresh
I/O control system
Via T-link: 10ms periodic refresh
CPU 16-bit OS processor, 16-bit execution processor
Memory types Program memory, Data memory, Temporary
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
FSC elements (Sequential Function Chart) To IEC 61131-3
Length of instructions Variable length (depending on language)
Sequence 70ns or more/instruction
Instruction instruction
execution speed
Applied instruction 140ns or more/instruction
Program memory capacity 16384 steps 8192 steps
Program steps in a POU 4096 steps (Note 2)
I/O memory (I/Q) 512 words (Max. 8192 points)
General memory (M) 8192 words (default) 4096 words (default)
Retain memory (M) 4096 words (default) 2048 words (default)
Instance memory for User FB 4096 words (default) 2048 words (default)
Data (M)
memory 8192 words (default) 4096 words (default)
Instance Timer: 256 (8 words/point) Timer: 128 (8 words/point)
memory for Integrating timer: 64 (8 words/point) Integrating timer: 32 (8 words/point)
System FB Counter: 128 (4 words/point) Counter: 64 (4 words/point)
(M) Edge detection: 512 (2 words/point) Edge detection: 256 (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 1)
DWORD
One level (array of arrays, structure of arrays, array of structures, structure of
Data type nesting
structures)
No. of structure data type members 200
The memory area size limits the number allowed. For example, when the standard
No. of array data type elements
memory size is 8192 words, up to 8192 words may be allowed.
Default tasks (Cyclic scanning): 1
No. of tasks Periodic tasks: 4
Event tasks: 4 (Total of 4 tasks when Periodic task is used)
Program instance (No. of POUs/resource) 64 (Max. no. of instances allowed in one task=64)
Earlier than D300win version V1.2: 1000 (including POUs in the library)
No. of POUs in program
D300win version 2.0 or later: 2000 (including POUs in the library)

Note:1) This depends on each instruction.


2) For CPUs earlier than Version **30 or D300win loaders earlier than Version 2.0, 2048 steps/POU

1-3
1-1 Specifications Standrad CPU

Item Specification
No. of user function blocks 256
Nesting depth of user function blocks 64 levels
No. of user functions 256
Nesting depth of user functions 64 levels
FB instance 620/POU (Up to 620 FBs allowed in one POU)
Global variable 8000
Variable
Local variable 8000
VAR_INPUT : Up to 128
No. of user FB terminals
VAR_OUTPUT : Up to 128 128 in total
No. of registered libraries 16/project
Library
Nesting depth 8 levels
Self-diagnosis (memory check, ROM sum check), System configuration
Diagnostic function
supervising, Module fault monitoring
Security function Password
Calendar Up to 31 Dec. 2069 23:59:59 ±27sec/month
Application programs, system definitions, ZIP files, Data memory,
calendar IC memory
Battery backup Primary lithium battery
Switching time: within 5 min. (at 25° C)
Durability: 5 years (at 25° C)
Saves application programs, system definitions, ZIP files in
User ROM (optional)
flash ROM of the CPU.

1-4
Software PLC (SPS) 1-1 Specifications

1-1-3 Software PLC (SPS)


Item Specification
Control system Stored program control system
(ISA bus adapted SX bus master board is necessary.)
Input / Output connection method
(ISA bus adapted OPCN-1 bus master board is necessary.)
CPU Depends on the computer you use. Pentium 233MHz or higher is recommended.
Program memory (Stored in the main memory or hard disk of the computer)
Memory types Data memory (Stored in the main memory (DRAM) of the computer)
Temporary (Stored in the main memory (DRAM) of the computer)
IL language (Instruction List)
ST language (Structured Text)
Programming language LD language (Ladder Diagram)
FBD language (Function Block Diagram)
FSC elements (Sequential Function Chart)
Instruction Sequence 200ns
execution speed instruction
(Note 1) Applied instruction 200ns (when ADD Instruction executed)
Program memory capacity 768K steps (Stored in the main memory or hard disk of the computer)
Program steps in a POU 6K steps
I/O memory (I/Q) 512 words (8192 points)
Memory General memory (M) 256K words
No high-speed memory is available. (Expandable to max. 4882K words)
(Note 2) Retain memory (M) 32K words (Expandable to max. 3309K words) (Note 4)
System memory (M) 512 words
Available basic data type (Note 3) BOOL, INT, DINT, UINT, UDINT, REAL, TIME, STRING, 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
No. of array data type elements 16-bit data type: 4096 32-bit data type: 2048
No. of tasks Default tasks: 1, Periodic tasks: 4
Program instance 128 (Max. No. of instances allowed in one task = 128)
No. of POUs in program 2000 (Including POUs in library)
No. of user function blocks 512 (Max. depth of nesting is 127 levels.)
No. of user functions 512 (Max. depth of nesting is 127 levels.)
FB instance 620/POU (Max. 620 FBs can be created for one POU.)
Global variable 15000
Variable
Local variable 15000/POU
Input 128
No. of user FB
Output 128
terminals
Input / Output 128 Total 128
No. of registered libraries 16/project
Library
Nesting depth 8 levels
Diagnostic function System configuration supervising, Module fault monitoring
Calendar function None
Retain memory data are written in the hard disk while processing to close
Backup of data
WindowsNT.

Note: 1) Depends on the performance of the CPU of the computer you use. Figures shown in this table are for Pentium 75
MHz processor.
2) With the software PLC, you can program without being conscious of the instance memory for FBs.
3) DATE type, DT type and TOD type are unsupported.
4) Written in the hard disk while processing to close WindowsNT.

1-5
1-2 Memory Memory map

1-2-1 Memory map


(1) NP1PS-32 (High-performance CPU)

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


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

User FB instance memory


(M)
4K words
Temporary area
%MW9.0 8K words

System FB instance memory


(M) *1K=1024
16K words

%MW10.0 %MW .10.0


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

Note: 1) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system
FB instance memory may be increased or decreased by the loader settings. In these memories, default values have
been stored. For details refer to “3-5-2 Defining the CPU memory sizes.”
2) When another CPU memory is accessed in a multi-CPU system, the CPU number is specified in the . This is not
necessary to access own memory.
3) The first 2K words of the standard memory (M) are made up of high-speed memory which is accessed at a higher
speed. Another CPU can not access this area as global memory. Its size cannot be altered.
4) For the input/output address assignments, refer to “1-3 Input/output Address Assignments.”

1-6
Memory map 1-2 Memory

(2) NP1PS-74 (High-performance CPU)

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


(Input) (Output)
%I %Q Input/output memory (Note 4)
(I/O)
512 words (8192 points) The CPU number is specified here.
%MW1.0
Standard memory
(high speed) (Note 3)
%MW1.2047
2K words
%MW1.2048 Program memory
%MW .1.2048
Standard memory
(M) 74K steps
32K words
%MW1.32767 %MW .1.32767
%MW3.0 %MW .3.0
Retain memory
(M)
%MW3.16383 16K words %MW .3.16383 (Note 1)
%MW5.0

User FB instance memory


(M)
16K words
Temporary area
%MW9.0 8K words

System FB instance memory


(M) *1K=1024
65K words

%MW10.0 %MW .10.0


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

Note: 1) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system
FB instance memory may be increased or decreased by the loader settings. In these memories, default values have
been stored. For details refer to “3-5-2 Defining the CPU memory sizes.”
2) When another CPU memory is accessed in a multi-CPU system, the CPU number is specified in the . This is not
necessary to access own memory.
3) The first 2K words of the standard memory (M) are made up of high-speed memory which is accessed at a higher
speed. Another CPU can not access this area as global memory. Its size cannot be altered.
4) For the input/output address assignments, refer to “1-3 Input/output Address Assignments.”

1-7
1-2 Memory Memory map

(3) NP1PS-117R (High-performance CPU)

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


(Input) (Output)
%I %Q Input/output memory (Note 4)
(I/Q)
512 words (8192 points) The CPU number is specified here.
%MW1.0
Standard memory
(high speed) (Note 3)
%MW1.2047
2K words
%MW1.2048 Program memory
%MW .1.2048
Standard memory
(M) 117K steps
128K words
%MW1.131071 %MW .1.131071
%MW3.0 %MW .3.0
Retain memory
(M)
%MW3.32767 32K words %MW .3.32767 (Note 1)
%MW5.0

User FB instance memory


(M)
32K words
Temporary area
%MW9.0 8K words

System FB instance memory


(M) *1K=1024
65K words

%MW10.0 %MW .10.0


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

Note: 1) The size of standard memory (excluding high-speed memory), retain memory, user FB instance memory, and system
FB instance memory may be increased or decreased by the loader settings. In these memories, default values have
been stored. For details refer to “3-5-2 Defining the CPU memory sizes.”
2) When another CPU memory is accessed in a multi-CPU system, the CPU number is specified in the . This is not
necessary to access own memory.
3) The first 2K words of the standard memory (M) are made up of high-speed memory which is accessed at a higher
speed. Another CPU can not access this area as global memory. Its size cannot be altered.
4) For the input/output address assignments, refer to “1-3 Input/output Address Assignments.”

1-8
Memory map 1-2 Memory

(4) NP1PH-16 (Standard CPU)

IEC representation

%I %Q Input/output memory
(I/O)
512 words (8192 points)

%MW1.0
Standard memory
(M)
8K words Program memory
%MW1.8191 16K steps

%MW3.0
Retain memory
(M)
4K words
%MW3.4095
%MW5.0

User FB instance memory


(M) (Note 1)
4K words

%MW9.0 Temporary area


4K words
System FB instance memory
(M)
8K words
* 1K=1024
%MW10.0 System memory
(M)
512 words
%MW10.511

Initialization area

Note: 1) The size of standard memory, retain memory, user FB instance memory, system FB instance memory, and Initialization
area may be increased or decreased by the loader settings. In these memories, default values have been stored. For
details refer to “3-5-2 Defining the CPU memory sizes.”
2) No multi-system can be built up using a standard CPU module.
3) For the input/output address assignments, refer to “1-3 Input/output Address Assignments.”

1-9
1-2 Memory Memory map

(5) NP1PH-08 (Standard CPU)

IEC representation

%I %Q Input/output memory
(I/O)
512 words (8192 points)

%MW1.0
Standard memory
(M)
4K words Program memory
%MW1.4095 8K steps

%MW3.0
Retain memory
(M)
2K words
%MW3.2047
%MW5.0

User FB instance memory


(M) (Note 1)
2K words

%MW9.0 Temporary area


4K words
System FB instance memory
(M)
4K words
* 1K=1024
%MW10.0 System memory
(M)
512 words
%MW10.511

Initialization area

Note: 1) The size of standard memory, retain memory, user FB instance memory, system FB instance memory, and
Initialization area may be increased or decreased by the loader settings. In these memories, default values have
been stored. For details refer to “3-5-2 Defining the CPU memory sizes.”
2) No multi-system can be built up using a standard CPU module.
3) For the input/output address assignments, refer to “1-3 Input/output Address Assignments.”

1-10
Memory map 1-2 Memory

(6) NP4P-SPS (Software PLC)

IEC representation

%I %Q
Input/output memory
(I/Q)
512 words (8192 points)

%MW1.0

Standard memory
(M) Program memory
256K words 768K steps

(Note 2)
%MW1.262143 (Max. 4882K words
(Note 4)

%MW1.4999999
%MW3.0 (Note 1)
Retain memory
(M) Variable initial value storage area
32K words Retain memory data storage area

%MW3.32767 (Max. 3309K words


*1K=1024
(Note 4)
%MW3.3388607
%MW10.0
System memory
(M)
512 words
%MW10.511

(Note 6)
FB instance memory
Temporary area

Note: 1) Input/output memory, standard memory, retain memory, system memory, FB instance memory, and temporary memory
areas are allocated in the main memory of the computer.
2) Program memory, variable memory data storage area, and retain memory data storage area are allocated in the hard
disk.
3) You can program without being conscious of the capacity of FB instance memory or temporary memory.
4) When there is enough margin in the capacity of the main memory of the personal computer, standard memory and
retain memory can be expanded to maximum 4882K words and maximum 3309K words, respectively.
5) For software PLC, standard memory has no high-speed memory area.
6) For software PLC, all memories are volatile, including FB instance memory. Therefore, some FBs may function
differently with software PLC from with hardware PLC (SPH300, SPH200). For more information, refer to the
explanation of FB.

1-11
1-2 Memory Memory map

<Address representation for a multi-CPU system>


When CPU modules are installed on the same processor represented as follows:
bus in a multi-CPU system, access to another CPU is

I/O I/O

Power CPU CPU


“0” “1”
supply
“254” “253” “1” “2”

CPU0 CPU1

%IX1.0.0 %IX1.0.0

%IW1.0 %IW1.0

: Access to CPU1 memory

%MX1.2048.8 %MX1.2048.0 %MX1.2048.8 %MX1.2048.0

%MW1.2048 %MW1.2048 : Access to other CPU memory

%IX1.0.0 %MX1.2048.8 %MX0.1.2048.8 %MX1.2048.8

CPU number

%MX1.1.2048.0 %MX1.2048.0 %IX1.0.0 %MX1.2048.0

CPU number

• When another CPU memory is accessed, the CPU for both CPU0 and CPU1, as the I/O areas are common
number must be specified as shown in the figure above. to all the CPUs.
• Representation of the I/O area (I, Q) remains the same
Note: The above address representations are valid only when the CPU modules are installed on the single processor bus.

1-12
Input/output memory 1-2 Memory

1-2-2 Input/output memory area (512 words)


The input/output memory area is a window through which and sensors which send data to the CPU and by output
data is exchanged between the CPU and external devices. devices such as relays, solenoids, and indicators which
It is used by input devices such as pushbuttons, switches, show the results of program executions.

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, refer to “1-3 Input/output
Address Assignments” and “1-4-4 Variable declarations.”
(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.

IEC representation
%I %Q 15 0

Input/output memory

512 words

1-13
1-2 Memory Standard memory

1-2-3 Standard memory area


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

Key-point:

1) In the direct addressing mode, this memory area is specified in he format of %M 1. ..... (replace 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. Refer to "1-4 variables" for details.
2) The specified memory area is reset to (0) zero when self-PC is started.
3) For high-performance CPU, 2K words from the top of the standard memory is the area where data access in the CPU is
processed at high speed. On the other hand, when data is accessed from external device such as POD, single access
operation requires 81 Takts.
4) In the multi-CPU system, the other areas can be accessed as global memory areas from any other CPU (only for
high-performance CPUs and SPS).
5) The sizes of the standard memory areas can be modified taking those of other areas into account. Note that the size of a
fast access memory area is 2K-word fixed in the high-performance CPU and cannot be modified (only for SPH).
Refer to "3-5-2 CPU Memory Size Definition" for modifying memory sizes.
6) For high-performance CPUs, no continuous access is allowed to the fast access memory area and the boundaries between
other areas. For example, an array or structure cannot lie across the boundary.

IEC representation Address representation for a multi-CPU system (only for high-performance CPUs)
(High-performance CPU)
%MW1.0
Standard memory
(high speed)
(M) The CPU number is specified here.
%MW1.2047 2K words
%MW1.2048 %MW .1.2048
Standard memory
(M)

NP1PS-32 (SPS)
:6K words %MW1.0
Standard memory
NP1PS-74
(M)
:30K words
NP1PS-117R
256K words
:126K words

(Standard CPU)
I%MW1.0
Standard memory
(M)

NP1PS-16
:8K words
%MW1.262143
NP1PS-08
:4K words
Max. 4882K words
%MW1.4999999

1-14
Retain memory 1-2 Memory

1-2-4 Retain memory area


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

Key-point:

(1) In the direct addressing mode, this memory area is specified in the format of %M 1. ..... (replace 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. Refer to "1-4 variables" for details.
(2) The following processes are performed at cold or warm start.
Cold Warm
Retain memory Reset to 0 (zero) Retains old values
Initialized retain memory Writes specified initial values Retains old values

(3) When a project is downloaded, you have an option for selecting whether the area is to be cleared at project download.
If you select "clear," the system cold-starts and If "not clear," the system warm-starts.
(4) In the multi-CPU system, the retain memory area can be accessed as a global memory area from any other
CPU (only for high-performance CPUs).
(5) The size of the retain memory area can be modified taking those of other areas into account. Refer to "3-5-2 CPU
Memory Size Definition" for modifying memory sizes (only for SPH).

IEC representation Address representation for a multi-CPU system


(SPH) (only for powerful CPUs)
Retain memory
%MW3.0 (M), %MW .3.0
NP1PS-32
4K words The CPU number is specified here.
NP1PS-74
:16K words
NP1PS-117R
:32K words
NP1PH-16
:4K words
NP1PH-08
:2K words

(SPS)
%MW3.0
Retain memory
(M),

32K words

%MW3.32767

Max. 3309K words

%MW3.3388607

Note: The system cold-starts when initially starting from the D300win while it warm-starts at power-on or when starting from
the D300win.

1-15
1-2 Memory User FB instance memory

1-2-5 User FB instance memory area


The user FB instance memory area is an instance memory
area unique to each user FB used internally in the PC.

Key-point:

(1) Do not read out from and write data into the instance memory area from an application program or the D300win.
If you neglect this advice, the user FB may not operate correctly.
(2) The size of the user FB instance memory area can be modified taking those sizes of other areas into account.
Refer to "3-5-2 CPU Memory Size Definition" for modifying memory sizes.

IEC representation

%MW5.0 User FB instance memory


(M)

NP1PS-32
:4K words
NP1PS-74
:16K words
NP1PS-117R
:32K words
NP1PH-16
:4K words
NP1PH-08
:2K words

Note: With SPS, you can program without being conscious of this area. However, the declaration of FB instance in the local
variable worksheet is necessary.

1-16
System FB instance memory 1-2 Memory

1-2-6 System FB instance memory area


The system FB instance memory area is an instance as timers, counters, and differential instructions, which are
memory area that is unique to each of the system FBs, such used internally in the PC.

Key-point:

(1) Do not read out from and write data into the instance memory area from an application program or the D300win.
If you neglect this advice, the user FB may not operate correctly.
(2) At PC startup, predefined initialization is performed. (the old values are retained or reset to 0s (zeros).
Note that the values, even in the area where old values are usually retained, are reset to 0s (zeros) whenever a project is
downloaded.
Example) The current values for the counters and totalizing timers and the old value for the edge detect instruction counter
are retained, while the current values for the timers (excluding totalizing) are reset to 0s (zeros).
(3) Eight words/timer, four words/counter, and two words/edge detect instruction counter are used.
(4) The size of the system FB instance memory area can be modified taking those of other areas into account.
Refer to "3-5-2 CPU Memory Size Definition" for modifying memory sizes.
(5) By default, the numbers of timers, totalizing timers, counters, and edge detect instruction counters have been preset
per CPU. If necessary, these numbers may be modified.

Timer Total. timer Counter Edge detect Others


NP1PS-32 512 128 256 1024 8192 words
NP1PS-74/117R 2048 512 1024 4096 32768 words
NP1PH-16 256 64 128 512 4096 words
NP1PH-08 128 32 64 256 2048 words

To set the timer, totalizing timer, counter, edge detect, and other system FB areas, the following conditions should 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

IEC representation

%MW9.0 Edge detect


NP1PS-32: 2K words
Note: 1) The numbers of words are default values in the memory map on
NP1PS-74/117R: 8K words
the left side.
NP1PH-16: 1K words
2) With SPS, you can program without being conscious of this area.
NP1PH-08: 0.5K words
However, the declaration of FB instance in the local variable
worksheet is necessary.
Counter
NP1PS-32: 1K words
NP1PS-74/117R: 4K words
NP1PH-16: 0.5K words
NP1PH-08: 0.25K words

Total. timer
NP1PS-32: 1K words
NP1PS-74/117R: 4K words
NP1PH-16: 0.5K words
NP1PH-08: 0.25K words

Timer
NP1PS-32: 4K words
NP1PS-74/117R: 16K words
NP1PH-16: 2K words
NP1PH-08: 1K words

Others
NP1PS-32: 8K words
NP1PS-74/117R: 32K words
NP1PH-16: 4K words
NP1PH-08: 2K words

1-17
1-2 Memory Initialization area

1-2-7 Initialization area


The initialization area assigned only in the standard CPU variables.
stores the initial values for the user function block (FB) and

Key-point:

(1) The sizes of the storing areas are calculated by the following expression.
(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 Initial user FB value Initial variable value
area (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 expressions below.
NP1PH-16: 2560 / 5 =512 (Any digits under the decimal point are truncated) 512
NP1PH-08: 768 / 5 =153 (Any digits under the decimal point are truncated) 153
(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


storing area

NP1PH-16:
4608 words
(default)
NP1PH-08:
2304 words
(default)

Initial variable value


storing area

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

1-18
System memory 1-2 Memory

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


The system memory area is allocated to flags which indicate series. This area is for exclusive use.
the operating status or the error status of the MICREX-SX
A resource is defined as one CPU system that configured
by one CPU module and two or more I/O modules.
(1) System memory
%MW10.0 Resource operating status %MW10.128
Remote I/O master 0
%MW10.1 Resource switch information/User ROM state |
I/O module configuration information
%MW10.135
%MW10.2 Resource fatal fault factor
%MW10.136
%MW10.3 Not used Remote I/O master 0
|
I/O module fault information
%MW10.4 Resource nonfatal fault factor %MW10.143
%MW10.5 Not used %MW10.144
Remote I/O master 1
|
%MW10.6 CPU error factor I/O module configuration information
%MW10.151
%MW10.7 Not used
%MW10.152
%MW10.8, 9 Memory error factor Remote I/O master 1
|
I/O module fault information
%MW10.10 %MW10.159
SX bus error factor %MW10.160
%MW10.11 Remote I/O master 2
|
%MW10.12 Application error factor (fatal fault) I/O module configuration information
%MW10.167
%MW10.13 Application error factor (nonfatal fault) %MW10.168
Remote I/O master 2
%MW10.14 |
User fatal fault I/O module fault information
| %MW10.175
factor 0 - factor 47
%MW10.16 %MW10.176
Remote I/O master 3
%MW10.17 Not used |
I/O module configuration information
%MW10.183
%MW10.18
User nonfatal fault %MW10.184
| Remote I/O master 3
factor 0 - factor 47 |
%MW10.20 I/O module fault information
%MW10.191
%MW10.21 Not used
%MW10.192
%MW10.22 Remote I/O master 4
|
| System definition error factor I/O module configuration information
%MW10.199
%MW10.29
%MW10.200
%MW10.30 Remote I/O master 4
|
| Not used I/O module fault information
%MW10.207
%MW10.37
%MW10.208
%MW10.38 Remote I/O master 5
Application program error factor |
%MW10.39 I/O module configuration information
%MW10.215
%MW10.40 %MW10.216
Not used Remote I/O master 5
%MW10.41 |
%MW10.42 I/O module fault information
Annunciator relay %MW10.223
%MW10.43 %MW10.224
%MW10.44 Remote I/O master 6
Not used |
%MW10.45 I/O module configuration information
%MW10.231
%MW10.46 Duplex master annunciator %MW10.232
Remote I/O master 6
%MW10.47 Duplex operation mode |
I/O module fault information
%MW10.239
%MW10.48, 49 Resource operation/running information
%MW10.240
%MW10.50, 51 Resource configuration/fault information Remote I/O master 7
|
I/O module configuration information
%MW10.52 %MW10.247
SX bus configuration information
| %MW10.248
(configuration information) Remote I/O master 7
%MW10.67 |
I/O module fault information
%MW10.68 %MW10.255
SX bus fault information
| %MW10.256
(configuration information)
%MW10.83 | Not used
%MW10.84 %MW10.299
SX bus-connected module fail-soft
| (Continued on next page)
mode information
%MW10.99
%MW10.100
| Not used
%MW10.127

1-19
1-2 Memory System memory

%MW10.300 %MW10.508
Configuration information of all module SX bus transmission error rate
| |
in the resource (only for SPS) information
%MW10.315 %MW10.511
%MW10.316
Fault information of all module
|
in the resource (only for SPS)
%MW10.331
%MW10.332
| Not used
%MW10.359
%MW10.360 Remote I/O master board 0
| I/O module configuration information
%MW10.367 (only for SPS)
%MW10.368 Remote I/O master board 0
| I/O module fault information
%MW10.375 (only for SPS)
%MW10.376 Remote I/O master board 1
| I/O module configuration information
%MW10.383 (only for SPS)
%MW10.384 Remote I/O master board 1
| I/O module fault information
%MW10.391 (only for SPS)
%MW10.392 Remote I/O master board 2
| I/O module configuration information
%MW10.399 (only for SPS)
%MW10.400 Remote I/O master board 2
| I/O module fault information
%MW10.407 (only for SPS)
%MW10.408 Remote I/O master board 3
| I/O module configuration information
%MW10.415 (only for SPS)
%MW10.416 Remote I/O master board 3
| I/O module fault information
%MW10.423 (only for SPS)
%MW10.424 Remote I/O master board 4
| I/O module configuration information
%MW10.431 (only for SPS)
%MW10.432 Remote I/O master board 4
| I/O module fault information
%MW10.439 (only for SPS)
%MW10.440
| Not used
%MW10.507

1-20
System memory 1-2 Memory

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


The table given below shows the resource (CPU module)
operating status and operating modes.
SPH SPH
Address Name Description 300 200
SPS

%MX10.0.0 Run Set to "ON" while the CPU is running. O O O


%MX10.0.1 Stop Set to "ON" while the CPU is down. O O O
%MX10.0.2 Fatal fault Set to "ON" when a fatal resource error has occurred. O O O
%MX10.0.3 Nonfatal fault Set to "ON" when a non-fatal resource error has occurred. O O O
Set to "ON" when an operating CPU is running in the duplex
%MX10.0.4 Duplex operating station O - -
mode.
%MX10.0.5 Duplex waiting station Set to "ON" when a waiting CPU is running in the duplex mode. O - -
%MX10.0.6 1:1 duplex Set to "ON" when the system is in the 1 to 1 duplex mode. O - -
%MX10.0.7 N:1 duplex Set to "ON" when the system is in the N to 1 duplex mode. O - -
%MX10.0.8 Non-automatic operation mode Set to "ON" while in the non-automatic operation mode. O O O
%MX10.0.9 Automatic operation mode Set to "ON" while in the automatic operation mode. O O O
%MX10.0.10 Preceding state mode Set to "ON" while in the preceding state mode. O O -
%MX10.0.11 Battery-less operation mode Set to "ON" while in the battery-less mode. O O -
%MX10.0.12 Not used - - -
%MX10.0.13 SX bus-connected module fail- Set to "ON" when fail-soft may be performed for all the
O O O
Note) soft mode modulesconnected to the SX bus or individually reset
Set to "ON" when the CPU module is controlling the processor
%MX10.0.14 Processor bus master O O -
bus.
%MX10.0.15 SX bus master Set to "ON" when the CPU module is controlling the SX bus. O O O
O: Supported, -: Not supported

Non-automatic operation mode Battery-less operation mode


The mode in which the CPU will not start operation when the At system power-on, the entire memory is initialized to initial
system power is turned on with the key switch on the CPU values or all zeros. Note that neither battery connection
module front panel set to “RUN” or “TERM.” This is set by check norvoltage check is done. The mode is enabled in the
the system definition for the CPU module. system configuration at power-on. When the preceding state
With SPS, this mode is activated when there is no boot mode is turned on in the battery-less mode, the CPU enters
project. the automatic operation mode. For the standard CPU, this
Automatic operation mode mode is not enabled unless a user ROM card is inserted.
The mode in which the CPU will start operation when the
system power is turned on with the key switch on the CPU Note: <When %MX10.0.13=0 (Fail-soft has been disabled
module front panel set to “RUN” or “TERM.” This is set by for the modules connected to the SX bus)>
the system definition for the CPU module. The mode is For common modules, fail-soft is not performed, and
enabled in the system resource configuration at power-on. for the I/O modules connected to the SX bus, it is not
(The automatic mode is on by default.) performed even if enabled by using the loader
With SPS, this mode is activated when there is a boot (D300win).
project. <When %MX10.0.13=1 (Fail-soft has been enabled
for the modules connected to the SX bus)>
Preceding state mode
For common modules, fail-soft is performed, and for
The mode in which the CPU will start operation when system
the I/O modules connected to the SX bus, it is
power is turned on with the key switch on the CPU module
performed because it has been enabled by using the
front panel set to “RUN”; when system power is turned on
loader (D300win).
with the key switch set to “TERM,” the CPU will enter the
preceding state (running or stopped) that was established
when power was turned off in the preceding run.

1-21
1-2 Memory 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
Address Name Description 300 200
SPS

%MX10.1.0 Indicates the 4-bit number (0-F) set using the CPU number
| CPU number setting switches on the CPU module front panel. A range of O - O
%MX10.1.3 numbers 0-7 is allowed.
%MX10.1.4
Not used - - -
%MX10.1.5
%MX10.1.6 User ROM card connection state 1: connected 0: unconnected O O -
Note 1

1:write-protected 0:write-permitted (enabled when O


%MX10.1.7 User ROM card write protect O -
%MX10.16=1) Note 1

%MX10.1.8 STOP position Set to "ON" when the key switch is in the STOP position. O O -
%MX10.1.9 TERM position (bottom) Set to "ON" when the key switch is in the TERM position (bottom). O O -
%MX10.1.10 TERM position (top) (Note 2, 3) Set to "ON" when the key switch is in the TERM position (top). O O -
%MX10.1.11 RUN position Set to "ON" when the key switch is in the RUN position. O O -
%MX10.1.12
| Not used - - -
%MX10.1.15
Note: 1) User ROM card (compact flash card) adapted models only.
2) The TERM position flag also turns on when the key switch is in an unknown state.
3) With user ROM card adapted high-performance CPU module, this is set to “ON” when the key switch is set to
UR8M_TERM position.
(4) Resource fatal fault factor %MW10.2 (Read only)
This area indicates the factors of fatal faults that will stop the resource (one-CPU system).
SPH SPH
Address Name Description 300 200
SPS

%MX10.2.0 CPU error Set to "ON" when a fatal fault has occurred in the CPU module. O O -
%MX10.2.1 Power supply fault Set to "ON" when a power-off condition has occurred. O O -
Set to "ON" when an error has occurred in the memory in the CPU
%MX10.2.2 Memory error O O -
module.
Set to "ON" when SX bus error occurs, for example, the disconnection
%MX10.2.3 SX bus error O O O
of cable or loop-back plug.
Set to "ON" when an error has been found in an application program or
%MX10.2.4 Application error O O O
system definition.
Set to "ON" when a fault has occurred in any of the I/O modules
controlled by the self-CPU module and fail-soft has been "disabled."
%MX10.2.5 I/O module error O O O
When fail-soft has been "enabled," the entire system continues
operating normally even if a fault has occurred in an I/O module.
Set to "ON" when a fault has occurred in any of the common modules
%MX10.2.6 Common module error O O O
(excluding self-module) connected to the SX bus.
Set to "ON" when relay-switching cannot be performed in the duplex
%MX10.2.7 Relay-switching error O - -
operation mode.
%MX10.2.8
Not used - - -
%MX10.2.9
Remote I/O module Set to "ON" when the system is down due to an error occurred on the
%MX10.2.10 error on remote I/O remote I/O unit or module. - - O
master board
%MX10.2.11 Driver error - - O
%MX10.2.12 Not used - - -
Set to "ON" when an error has occurred in a CPU number selection
%MX10.2.13 Other hardware error O O -
switch.
%MX10.2.14 Not used - - -
Set to "ON" when the user program turns on one of the user fatal fault
%MX10.2.15 User fatal fault O O O
flags (%MX10.14.0 to %MX10.16.15).

1-22
System memory 1-2 Memory

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


This area indicates the factors of faults that allow the resource to continue processing.
SPH SPH
Address Name Description 300 200
SPS

%MX10.4.0
| Not used - - -
%MX10.4.2
Set to "ON" when an error has occurred in the memory of the self-
%MX10.4.2 Memory error O O -
CPU module.
%MX10.4.3 SX bus error Set to "ON" when an error has occurred in the SX bus. O O O
Set to "ON" when an error has been found in an application
%MX10.4.4 Application error O O O
program or system definition.
Set to "ON" when a fault has occurred in any of the I/O modules
%MX10.4.5 I/O module error controlled by the self-CPU module and fail-soft has been enabled. O O O
Note)
Common module error Set to "ON" when a fault has occurred in any of the I/O modules
%MX10.4.6 O O O
(Note *) (excluding self-CPU) connected to the SX bus.
%MX10.4.7
| Not used - - -
%MX10.4.9
Set to "ON" when an error has occurred on the remote I/O unit or
Remote I/O module
%MX10.4.10 module. With SPS, the system is stopped because fail-soft mode is - - O
error
not supported.
%MX10.4.11 Not used - - -
Set to "ON" when the content of user ROM card does not coincide
User ROM card - CPU O
%MX10.4.12 with that of the CPU. Verification targets are system definition, - -
mismatch Note 1
project and password.
Set to "ON" when a fault in any of the key switches or
loader/general-purpose communication selection switch occurs.
The CPU module operates by assuming that "TERM" has been
%MX10.4.13 O O -
Other hardware error enabled if a fault has been detected in the key switch. It assumes
that the loader side has been selected if a fault is detected in the
loader/general-purpose communication selection switch.
Set to "ON" when the voltage of the data backup battery falls below
%MX10.4.14 Battery error O O -
the threshold level or the battery is dead.
Set to "ON" when the user program turns on one of the user non-
%MX10.4.15 User nonfatal fault O O O
fatal fault flags (%MX10.18.~%MX10.20.15).
Note: 1) User ROM card (compact flash card) adapted models only
* The common modules are those connected to the SX bus without occupying an I/O area (for example, a CPU
module, communication module, etc.).
(6) CPU error factor %MW10.6 (Read only) (Not supported by SPS)
Address Name Description
%MX10.6.0 Arithmetic processor error Hardware error in the arithmetic LSI in the CPU module
%MX10.6.1 OS processor error Hardware error in the OS control LSI in the CPU module
%MX10.6.2
| Not used
%MX10.6.15

1-23
1-2 Memory System memory

(7) Memory error factor %MW10.8, %MW10.9 (Read only) (Not supported by SPS)
Address Name Description Level
Set to "ON" when an error has occurred in the system
%MX10.8.0 System ROM error Fatal fault
ROM in the CPU module.
Set to "ON" when an error has occurred in the system
%MX10.8.1 System RAM error Fatal fault
RAM in the CPU module.
Set to "ON" when an error has occurred in the user Fatal fault
%MX10.8.2 Application ROM error
program ROM in the CPU module. (Note 1)
Set to "ON" when an error has occurred in the user
%MX10.8.3 Application RAM error Fatal fault
program RAM in the CPU module.
%MX10.8.4
| Not used
%MX10.8.14
Fatal fault
%MX10.8.15 Memory backup error Set to "ON" when no power-failure-time data is retained.
(Note 2)
%MX10.9.0
| Not used
%MX10.9.14
Set to "ON" when no power-failure-time data is retained.
Nonfatal fault
%MX10.9.15 Memory backup error May clear the error condition by using an application
(Note 2)
program.

Note: 1) Set to “ON” when an error has occurred in the user ROM card.
2) For a high-performance CPU, the bit set to “ON” when a memory backup error has occurred depends on the module
version.
Earlier than V**.25: %MX10.8.15 V10.30 or later: %MX10.9.15
System operation after a memory error has occurred are set to “ON” when a hardware fault has occurred, cycling
Any memory backup error resets the entire user memory the power source may cause a memory error to be repeated.
area to 0 (zero). Note that in most cases, since %MX10.8.~3

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


SPH SPH
Address Name Description Level 300 200
SPS

Set to "ON" when an error has occurred in the LSI


%MX10.10.0 SX bus LSI error Fatal fault O O O
controlling the SX bus.
Set to "ON" when the same SX bus station number has
Station number double-
%MX10.10.1 been assigned to more than one module in the Fatal fault O O O
assignment
configuration.
Set to "ON" when the number of modules connected to
%MX10.10.2 Module count exceeded Fatal fault O O O
the SX bus exceeds 254.
%MX10.10.3
| Not used - - -
%MX10.10.12
SX bus transmission Set to "ON" when an error has occurred in transmission
%MX10.10.13 Fatal fault O O O
error via the SX bus.
Processor bus access Set to "ON" when an error has occurred in accessing
%MX10.10.14 Fatal fault O O -
error the processor bus.
Set to "ON" when the input/output data has not been
%MX10.10.15 I/O refresh slow-down Fatal fault O O O
updated on the SX bus for longer than 128ms.
%MX10.11.0
| Not used - - -
%MX10.11.13
Set to "ON" when an access error has occurred on the
Processor bus access processor bus (the cause of the error is attributable to
%MX10.11.14 Fatal fault O O -
error the accessed module). May clear the error condition by
using an application program
%MX10.11.15 Not used - - -

1-24
System memory 1-2 Memory

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


SPH SPH
Address Name Description Level 300 200
SPS

Set to "ON" when an error has been found in


%MX10.12.0 System definition error Fatal fault O O O
the system definition.
Set to "ON" when an error has been found in
%MX10.12.1 Application program error Fatal fault O O O
the Application program.
%MX10.12.2
| Not used - - -
%MX10.12.15
%MX10.13.0 Not used - - -
Set to "ON" when an error has been found in
%MX10.13.1 Application program error Nonfatal fault O O -
the Application program.
%MX10.13.2
| Not used - - -
%MX10.13.15

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


SPH SPH
Address Name Description 300 200
SPS

%MX10.14.0 User fatal fault factor 0 A fatal error has occurred and the CPU stops when either one
| | of these bits is set to "ON" by an application program.

%MX10.14.15 User fatal fault factor 15


%MX10.15.0 User fatal fault factor 16
| | O
%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
Address Name Description 300 200
SPS

%MX10.18.0 User nonfatal fault factor 0 A non-fatal error has occurred and the CPU continues running
| | when either one of these bits is set to "ON" by an application
program.
%MX10.18.15 User nonfatal fault factor 15 Changing the bit set to "ON" to "OFF" by an application
%MX10.19.0 User nonfatal fault factor 16 program lets the system recover from the non-fatal error
state.
| | O
%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-25
1-2 Memory System memory

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


SPH SPH
Address Name Description Level 300 200
SPS

%MX10.22.0 Not used - - -


Set to "ON" when the contents Fatal fault
of the system configuration
%MX10.22.1 System definition error definition in the CPU module do O O O
not match the actual system
configuration.
Set to "ON" when the Takt Fatal fault
period is set to 0.5ms in a
%MX10.22.2 System operation definition error system in which two or more O O O
common modules are
connected in one configuration.
Set to "ON" when the SX bus Fatal fault
direct-connect module defined
%MX10.22.3 System DO selection error O O O
in system DO (output) is not a
digital output module.
Set to "ON" when an error is Fatal fault
%MX10.22.4 Duplex selection error found in the equivalent value O - -
range specification.
Set to "ON" when fail-soft Fatal fault
startup is enabled if any module
%MX10.22.5 Fail-soft startup selection error O O -
is not applicable to fail-soft in
the system.
%MX10.22.6
| Not used - - -
%MX10.22.9
Set to "ON" when the switch Fatal fault
setting in the CPU module is
%MX10.22.10 CPU operation definition error O O O
different from the CPU number
set in the system definition.
Set to "ON" when the memory Fatal fault
space used by an application
%MX10.22.11 CPU memory boundary definition error O O -
program exceeds the total
memory capacity.
%MX10.22.12
| Not used - - -
%MX10.22.15
%MX10.23.0 CPU I/O group definition error (for default tasks) Set to "ON" when an input Fatal fault
%MX10.23.1 CPU I/O group definition error (for level 0 tasks) module is defined for an output
module.
%MX10.23.2 CPU I/O group definition error (for level 1 tasks) O O O
%MX10.23.3 CPU I/O group definition error (for level 2 tasks)
%MX10.23.4 CPU I/O group definition error (for level 3 tasks)
Set to "ON" when fail-soft is set Fatal fault
%MX10.23.5 Direct I/O connect fail-soft definition error for a module other than the O O O
input/output modules.
%MX10.23.6 Remote I/O master 0 fail-soft definition error Set to "ON" when an error is Fatal fault
%MX10.23.7 Remote I/O master 1 fail-soft definition error found in the fail-soft definition.

%MX10.23.8 Remote I/O master 2 fail-soft definition error


%MX10.23.9 Remote I/O master 3 fail-soft definition error
O O O
%MX10.23.10 Remote I/O master 4 fail-soft definition error
%MX10.23.11 Remote I/O master 5 fail-soft definition error
%MX10.23.12 Remote I/O master 6 fail-soft definition error
%MX10.23.13 Remote I/O master 7 fail-soft definition error
%MX10.23.14
Not used - - -
%MX10.24.15

1-26
System memory 1-2 Memory

Set to "ON" when hold is Fatal fault


defined for a module other than
%MX10.24.0 I/O module hold definition error O O O
output modules or the output
module set for the system DO.
Set to "ON" when an error is Fatal fault
found in the operation setting
%MX10.24.1 I/O initialization error O O O
for the module connected to the
SX bus.
%MX10.24.2
| Not used - - -
%MX10.24.15
%MX10.25.0 Remote I/O master 0 initialization error Set to "ON" when an error is Fatal fault
found in a remote I/O master
%MX10.25.1 Remote I/O master 1 initialization error initialization.
%MX10.25.2 Remote I/O master 2 initialization error
%MX10.25.3 Remote I/O master 3 initialization error
O O O
%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
Set to "ON" when an error is Fatal fault
%MX10.26.0 Processor-link 0 initialization error found in a P/PE-link/FL-net
initialization.
Processor-link 1 corresponds to O O O
the module of link number "9,"
%MX10.26.1 Processor-link 1 initialization error processor-link 0 corresponds to
the module of line number "8."
%MX10.26.2
| Not used - - -
%MX10.29.15

Note: The system definition error factor includes errors that do not occur during normal operation.

1-27
1-2 Memory System memory

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


SPH SPH
Address Name Description Level 300 200
SPS

Set to "ON" when the run time for a default task Fatal fault
%MX10.38.0 Application WDT error O O O
exceeds the preset value of a watchdog timer.
Set to "ON" when an error has occurred during Fatal fault
Application execution
%MX10.38.1 user program execution that causes "temporary O O O
error
size-over."
%MX10.38.2
| Not used - - -
%MX10.38.10
Set to "ON" when the specified storage address is Fatal fault
%MX10.38.11 FB instance setup error O O -
not found.
Set to "ON" when the preset initial value exceeds Fatal fault
%MX10.38.12 Initial setup value error O O -
the defined range of a storage area.
SFM boundary definition Set to "ON" when a size greater than the maximum Fatal fault
%MX10.38.13 O O -
error SFM capacity value has been defined.
Set to "ON" when an error has been found in the Fatal fault
%MX10.38.14 POU instruction error O O -
POU instruction.
Set to "ON" when a task registration error has been Fatal fault
%MX10.38.15 Task registration error O O -
found.
%MX10.39.0 Missing level 0 task Set to "ON" when a task is missing. May clear the Nonfatal fault
%MX10.39.1 Missing level 1 task error condition by using an application program.
O O O
%MX10.39.2 Missing level 2 task
%MX10.39.3 Missing level 3 task
%MX10.39.4 Level 0 task slow-down Set to "ON" when program execution is deferred Nonfatal fault
%MX10.39.5 Level 1 task slow-down and the predefined periodic time is not maintained. (Fatal fault,
in the SPS) O O O
%MX10.39.6 Level 2 task slow-down
%MX10.39.7 Level 3 task slow-down
%MX10.39.8
| Not used - - -
%MX10.39.14
Set to "ON" when the Takt period does not match Nonfatal fault
Takt period monitoring
%MX10.39.15 the system definition. May clear the error condition O O -
error
by using an application program.

Note: The system definition error factor includes errors that do not occur during normal operation because D300win
suppresses them from occurring (for example, compile check).

1-28
System memory 1-2 Memory

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


SPH SPH
Address Name Description 300 200
SPS

Set to "ON" at the first startup after program download and at


%MX10.42.0 Initial flag initial startup (cold start). This flag never is set to "OFF" during O O O
operation.
Set to "ON" when a power-off condition has occurred in the
%MX10.42.1 Power-off flag O O -
preceding session.
%MX10.42.2
| Not used - - -
%MX10.42.13
Set to "ON" when more than one dummy module has been
%MX10.42.14 Dummy module flag O O -
installed in one system.
Processor bus access
%MX10.42.15 Set to "ON" when the processor bus is disabled. O O O
disable flag
%MX10.43.0 Level 0 start flag Set to "ON" during the first execution of level 0 task. O O -
%MX10.43.1 Level 1 start flag Set to "ON" during the first execution of level 1 task. O O -
%MX10.43.2 Level 2 start flag Set to "ON" during the first execution of level 2 task. O O -
%MX10.43.3 Level 3 start flag Set to "ON" during the first execution of level 3 task. O O -
%MX10.43.4
| Not used - - -
%MX10.43.14
%MX10.43.15 Default task start flag Set to "ON" during the first execution of default task. O O -

(15) Duplex annunciator relay %MW10.46, Duplex operation mode %MW10.47 (Read only)
(Not supported by SPH200, and SPS)
Address Name Description
Set to "ON" during operation in the duplex mode and when the operating system
Duplex continuation start
%MX10.46.0 is switched to a waiting one. (The CPU that is changed over from waiting to
flag
running mode)
%MX10.46.1
| Not used
%MX10.46.15
%MX10.47.0 Indicates a 4-bit CPU logical number in the duplex operation mode (0-7). Allows
Duplex logical CPU
| you to recognize the default operating CPU taken over by the waiting CPU. It is
number
%MX10.47.3 undefined in the mode other than as "duplex."
%MX10.47.4
| Not used
%MX10.47.7
Duplex annunciator relay Set to "ON" when an annunciator relay has been enabled for a pair of CPUs 0
%MX10.47.8
mode 0 and 1 during operation in the duplex mode.
Duplex annunciator relay Set to "ON" when an annunciator relay has been enabled for a pair of CPUs 2
%MX10.47.9
mode 1 and 3 during operation in the duplex mode.
Duplex annunciator relay Set to "ON" when an annunciator relay has been enabled for a pair of CPUs 4
%MX10.47.10
mode 2 and 5 during operation in the duplex mode.
Duplex annunciator relay Set to "ON" when an annunciator relay has been enabled for a pair of CPUs 6
%MX10.47.11
mode 3 and 7 during operation in the duplex mode.
%MX10.47.12
| Not used
%MX10.47.15

1-29
1-2 Memory System memory

(16) Resource configuration/operation information


%MW10.48, %MW10.49 (Read only)
(only for SPH300)
The information can be used to recognize the current status in the duplex mode.The types of status listed below are valid
of system (CPU module) operation in the duplex or single when the associated bits (%MW10.50, 51) with resource
mode. Resource configuration information can be used only operation/fault information have been set to “ON.”

< In the duplex mode >


Resource operation information Resource running information Resource status
OFF OFF Waiting CPU stopped
ON OFF Operating CPU stopped
ON ON Operating CPU running
OFF ON Waiting CPU running

< Resource operation information >


Address Name Description
%MX10.48.0 Operating CPU 0 running Set to "ON" when the operating CPU is running in the duplex mode (in a mode
%MX10.48.1 Operating CPU 1 running other than "duplex," undefined).
%MX10.48.2 Operating CPU 2 running
%MX10.48.3 Operating CPU 3 running
%MX10.48.4 Operating CPU 4 running
%MX10.48.5 Operating CPU 5 running
%MX10.48.6 Operating CPU 6 running
%MX10.48.7 Operating CPU 7 running
%MX10.48.8
| Not used
%MX10.48.15

< Resource runnig information >


Address Name Description
%MX10.49.0 CPU 0 running Set to "ON" when the associated CPU module connected to the SX bus is
%MX10.49.1 CPU 1 running 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

1-30
System memory 1-2 Memory

(17) Resource configuration/fault information


%MW10.50, %MW10.51 (Read only)
The information can be used to recognize the status of other
resources (CPU module) by using an application program.
Resource configuration
Resource fault information Resource status
information
OFF OFF Nonexistent
ON OFF Normal (running or stopped)
ON ON Nonfatal fault (running or stopped)
OFF ON Fatal fault (stopped or dropped)

< Resourse configuration information >


SPH SPH
Address Name Description 300 200
SPS

%MX10.50.0 CPU 0 configuration Set to "ON" when the associated CPU module connected to the SX
%MX10.50.1 CPU 1 configuration bus has been found and its resource operation status is "normal" or
"Non-fatal fault."
%MX10.50.2 CPU 2 configuration
%MX10.50.3 CPU 3 configuration Note: For SPH200, only CPU0 is the target. O O O
%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

< Resourse fauit information >


SPH SPH
Address Name Description 300 200
SPS

%MX10.51.0 CPU 0 error Set to "ON" when the associated CPU module connected to the SX
%MX10.51.1 CPU 1 error bus has been found and its resource operation status is "normal" or
"Non-fatal fault."
%MX10.51.2 CPU 2 error
%MX10.51.3 CPU 3 error Note: For SPH200, only CPU0 is the target. O O O
%MX10.51.4 CPU 4 error
%MX10.51.5 CPU 5 error
%MX10.51.6 CPU 6 error
%MX10.51.7 CPU 7 error
%MX10.51.8
| Not used - - -
%MX10.51.15

1-31
1-2 Memory System memory

(18) SX bus configuration information %MW10.52 to


%MW10.67 (Read only)
When a module exists on the SX bus and it is running Whether the module is normal or in a nonfatal fault is
normally or with a nonfatal fault, the SX station number bit identified by the combination of the configuration error
for the module is set to “ON.” information items.

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

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

%MW10.52 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 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-32
System memory 1-2 Memory

(19) SX bus fault information %MW10.68 to %MW10.83


(Read only)
When there is a module on the SX bus and it is subject to a station number of the module is set to “ON.”
fatal or nonfatal fault, the bit corresponding to the SX bus

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

%MW10.68 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 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) SX bus-connected module fail-soft information


%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 SX station number bit for the module is set to “ON.”
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit Address

%MW10.84 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 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-33
1-2 Memory 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 that is under remote I/O master 0 number bit for the pertinent module is set to “ON.”
control and it is normal or in a nonfatal fault, the SX station

Remote configuration
Remote fault information Module status
information
OFF OFF Does not exist
ON OFF Normal
ON ON Nonfatal fault
OFF ON Fatal fault or disconnected

<Configuration information>
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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 that is under remote I/O master 0 corresponding to the remote station number of the module is
control and it is in a fatal or nonfatal fault, the bit set to “ON.”

<Fault information>
%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-34
System memory 1-2 Memory

(22) Remote I/O master 1 I/O module configuration/fault


information %MW10.144 to %MW10.159 (Read only)
<Configuration information>
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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-35
1-2 Memory 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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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-36
System memory 1-2 Memory

(26) Remote I/O master 5 I/O module configuration/fault


information %MW10.208 to %MW10.223 (Read only)
<Configuration information>
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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-37
1-2 Memory 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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 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-38
System memory 1-2 Memory

(29) Configuration information of all module in the resource %MW10.300 to %MW10.315 (Read only)
(only for SPS)
When a module exists on the SX bus and is operating in Normal or Nonfatal Fault condition, the bit that corresponds to the SX
station number of this module is set to “ON.”
The judgment of “Normal” or “Nonfatal error” condition is made by combining with the following error information of all modules
in the resource.
Configuration information of all Fault information of all modules
Module status
modules in a resource in a resource
OFF OFF Does not exist
ON OFF Normal
ON ON Nonfatal fault
OFF ON Fatal fault or disconnected

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

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


%MW10.301 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.302 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.303 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.304 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.305 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.306 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.307 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
%MW10.308 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128
%MW10.309 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144
%MW10.310 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160
%MW10.311 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176
%MW10.312 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192
%MW10.313 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208
%MW10.314 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224
%MW10.315 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240

(30) Fault information of all module in the resource (Read only) %MW10.316 to %MW10.331 (Read only)
(only for SPS)
When a module exists on the SX bus and is in Fatal Fault or Nonfatal Fault condition, the bit that corresponds to the SX station
number of this module is set to “ON.”
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit Address

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


%MW10.317 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.318 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.319 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.320 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.321 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.322 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.323 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
%MW10.324 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128
%MW10.325 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144
%MW10.326 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160
%MW10.327 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176
%MW10.328 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192
%MW10.329 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208
%MW10.330 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224
%MW10.331 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240
1-39
1-2 Memory System memory

(31) Remote I/O master board 0- I/O module configuration / fault information %MW10.360 to %MW10.375 (Read only)
(only for SPS)
When a remote I/O module is under control of remote I/O mater board 0 and is in Normal or Nonfatal Fault condition, the bit
that corresponds to the remote station number of this module is set to “ON.”
Remote I/O configuration
Remote I/O fault information Module status
information
OFF OFF Does not exist
ON OFF Normal
ON ON Nonfatal fault
OFF ON Fatal fault or disconnected

<Configuration information>
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit Address

%MW10.360 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.361 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.362 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.363 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.364 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.365 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.366 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.367 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112

When a remote I/O module is under control of remote I/O mater board 0 and is in Fatal or Nonfatal Fault condition, the bit that
corresponds to the remote station number of this module is set to “ON.”
<Fault information>
%MW10.368 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.369 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.370 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.371 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.372 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.373 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.374 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.375 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112

How to see the information of (31) to (34) is the same as of (21)

1-40
System memory 1-2 Memory

(32) Remote I/O master board 1- I/O module configuration / fault information %MW10.376 to %MW10.391 (Read only)
(only for SPS)
<Configuration information>
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit Address

%MW10.376 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.377 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.378 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.379 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.380 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.381 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.382 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.383 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.384 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.385 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.386 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.387 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.388 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.389 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.390 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.391 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112

(33) Remote I/O master board 2- I/O module configuration / fault information %MW10.392 to %MW10.407 (Read only)
(only for SPS)
<Configuration information>
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit Address

%MW10.392 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.393 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.394 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.395 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.396 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.397 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.398 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.399 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.400 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.401 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.402 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.403 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.404 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.405 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.406 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.407 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112

1-41
1-2 Memory System memory

(34) Remote I/O master board 3- I/O module configuration / fault information %MW10.408 to %MW10.423 (Read only)
(only for SPS)
<Configuration information>
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit Address

%MW10.408 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.409 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.410 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.411 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.412 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.413 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.414 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.415 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112
<Fault information>
%MW10.416 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
%MW10.417 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
%MW10.418 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
%MW10.419 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
%MW10.420 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64
%MW10.421 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80
%MW10.422 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96
%MW10.423 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112

(35) SX bus transmission error rate information %MW10.508 to %MW10.511 (Read only)
Executing 100,000 Takts, the number of the Takts where SX bus error occurred is expressed by the ppm. If, of executed Takts,
even one Takt is erroneous, the value becomes “10.” These data are updated every 100,000 Takts.
Address Name Description
%MX10.508 Maximum value (lower word) Set to the maximum of the error rate values for the SX bus detected by self-CPU
%MX10.509 Maximum value (upper word) module.
%MX10.510 Current value (lower word) Set to the current of the error rate values for the SX bus detected by self-CPU
%MX10.511 Current value (upper word) module.

Note: Various types of system flag information for system memory areas may be referenced from within an application
program. Be sure not to use the information for “event variables,” which start the event tasks of an application program
(otherwise, some variables may not start the associated task).

1-42
Temporary 1-2 Memory

1-2-9 Temporary areas


(1) Using temporary areas
Temporary areas, which are automatically generated by manner described below (the area provides 8K words for a
D300win when a program is compiled, are used in the high-performance CPU and 4K words for a standard CPU).

1) Connecting function (FCT) terminals


As shown in the figure below, the same number of temporary function block (FB) terminals and between function (FCT)
areas as that of terminal data are used for connecting and function block (FB) terminals because instance areas
function terminals. No temporary area is used for connecting are used instead.
(Example)
A 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 areas are used for passing the results of result of summation as an input to multiplication. The amount
calculations. of the temporary area to be used depends on the variable
An expression Y: = (X1 + X2) * X3 is given as a example. In data to be used for a mathematical operation. (Example: INT
this expression, the temporary area is used to output the type = one word, DINT type = two words)

3) Variables in user functions (FCTs)


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

4) Output variables for user functions (FCTs)


The same number of words in the temporary area is used for Declaring, for example, a 1K-word array for a variable allows
the output variable for a function such as that of the variable a 1K-word temporary area to be used.
itself.
(Example)
A 1-word temporary area is used 1)
User function

Input variable ADD WORD_TO_INT Output variable

MASK A 1-word temporary area is used. 4)

A 1-word temporary area is used. 3)

5) Return values from called user functions (FCTs)


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

1-43
1-2 Memory Temporary

(2) Restrictions on a temporary size


Up to 4096 words are allowed for one POU. Up to 8192-word used by the running CPU exceeds the predefined upper
and 4096-word temporary areas can be used limit, an application execution error (%MX10.38.1 set to
simultaneously in one high-performance CPU and standard “ON”) occurs, resulting in CPU shutdown with a fatal fault
CPU, respectively. When the amount of the temporary area (%MX10.2.4 set to “ON”).

Key-point:

To save the usage of a 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 and process it by VAR_IN_OUT.

(3) Using a temporary area


The temporary area is released for the next POU when a completed, the temporary area is not released and the
POU has been processed. The next POU uses the remaining area is used from its top. The temporary area is
temporary area from the top address. If another POU used in the manner described below.
process starts before the current POU process is
1) When POUs have been assigned only to default tasks
Suppose that three POUs (pou1, pou2, pou3), which have executed sequentially as shown in the figure below, the
been assigned to their associated default tasks, use a 3K- maximum amount of temporary area to be used is 3Kwords
word temporary area. Since pou1, pou2, and pou3 are or less.

Takt Takt

pou1 pou2 pou3 pou1 pou2 pou3


process process process process process process
Default task Time

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

1-44
Temporary 1-2 Memory

2) When POUs have been assigned to different tasks


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

pou3
execution
Task 0

pou2 pou2
Interrupt
execution execution
Task 1

pou1 pou1 pou1


execution Interrupt execution Interrupt
Default 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 high-performance CPU),
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- (a nesting structure), the total amount of temporary area
word temporary area. When fct1 calls fct2 and fct2 calls fct3 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-45
1-3 Input/output Address Assignment Address assignment

1-3-1 Address assignment example


This subsection shows an example of address assignment.
The sample system configuration is illustrated below.

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


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

Input/output 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 Address assignment conventions


The following conventions are used to assign input/output
addresses to the MICREX-SX series CPU modules:
1) SX bus direct-connect I/O

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 Word No. Bit address
No.

1-46
Address assignment 1-3 Input/output Address Assignment

1-3-3 Assigning input/output addresses to an


application program
In the MICREX-SX series, input/output addresses are
assigned to variables in the form of variable declarations.
<Example of address assignments>

*Refer to “1-4 Variables” for details.

1-47
1-4 Variables Variables

1-4-1 What is a variable?


To implement application programs in the MICREX-SX the user or automatically by the loader.
Series, it is necessary to assign variables to program code The use of variables enables you to write application
bodies and assign real CPU memory addresses to the programs with a high-reusability software structure.
variables associated with the instruction codes manually by
<Example of a program code body>

<Variable declarations for the above sample code body>

Key-point:

Declare every variable within one line.

1-48
Memory assignment 1-4 Variables

1-4-2 Memory assignment


Variables are assigned to the memory in the CPU when they are declared on a variable worksheet and compiled. You can
assign variables to memory specifying specific addresses such as those in the input/output area (AT specification) or without
specifying an address. Variables without an AT specification are automatically allocated by the loader to real addresses in the
CPU’s internal memory at the time of compilation.

Example of AT specifications
In this example, sensors 1 and 2 are assigned to
input/output memory locations. Normally, the
user does not need to use the AT specification
when allocating memory to a variable that is to
be used as auxiliary memory for a program.

PC Memory

Variables used for input/ Sensor 1 %IX1.0.1


output are allocated by Sensor 2 %IX1.0.2 Input/output area
the user to the input/output
area in the CPU.

Variables (symbolic variables) Condition 1 %MX


that have no assigned real Condition 2 %MX
address are allocated
Internal memory area
automatically by the loader.

To the variables with no address assigned (no AT specification), the loader assigns automatically the CPU memory addresses.
This eliminates the need for managing tedious memory assignment.

1-4-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-49
1-4 Variables Variables

1-4-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 assign an immediate address to a variable.

Note: 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 The following naming conventions are used to specify an AT
to allocate a CPU’s memory location to a variable. specification:
Colon Semicolon

INPUT AT %IX1.0.0 : BOOL ; ( Comment )

Comment
Variable
name Data type Refer to "1-5" for data types.

Address Refer to "1-3" for address assignments.


The variable
name must be
followed by a Memory size
space.
Symbol
1 Size
X BOOL (1 bit)
W Word (16 bits)
D Double word (32 bits)

Prefix

Symbol Meaning
%I Identifies an external input area.
%Q Identifies an external output area.
%M Identifies an internal memory area.

1-50
Variables 1-4 Variables

<Example of an AT specification variable declaration>

Key-point:

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)

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. The D300win will automatically allocate memory to
symbolic variables. A symbolic variable is declared as follows:
<Example of a symbolic variable declaration>
Colon Semicolon

FLAG1 : BOOL ; (* Comment *)

Variable name Data type Comment

1-51
1-4 Variables Variables

(4) Retain variables


Data declared as a retain variable is reset at cold start (at VAR_GLOBAL statement declaring the variable. Variables
initial start from D300win) and retained at warm start (at that are declared as retain variables are automatically
start from D300win or power-on). To declare a retain allocated to the retain area (retain memory) in the PC.
variable, append a RETAIN statement to the VAR or
<Example of a retain variable declaration>

(5) Initialization variable


A variable that is assigned an initial value when the PC assigning an initialization value using the “:=” operator.
application program is started (during the first scan) is called No initialization variable can be specified in the
an initialization variable. A variable is declared as an VAR_EXTERNAL declaration statement (for global
initialization variable and allocated to the PC memory by variables).

<Example of an initialization variable declaration>

Key-point:

Number of initial values assigned to variables


High-performance CPU NP1PS-32/NP1PS-74/NP1PS-117R: up to 3200 (fixed value)
Standard CPU NP1PH-16: 512 (default value)
Standard CPU NP1PH-08: 153 (default value)
For standard CPUs, 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. Refer to "1-2-7 Initialization memory area" for details.

(6) Restrictions on variable names


• Only a symbol “_” (1-bit) may be used for a variable name. • No 2-bit space can be used for a variable name.
Note that no “_” can follow the variable name. • The words reserved for the system (data type names,
• No 1-bit digit can be used at the top of a variable name. instruction names, etc.) cannot be used. Refer to
• Up to 30 1-bit characters (15 2-bit characters) can be “Appendix 6. List of Reserved Words.”
used for a variable name.

1-52
Organization of data types 1-5 Data Types

1-5-1 Organization of data types


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

ANY
elementary
ANY_NUM
ANY_REAL
REAL
ANY_INT
INT DINT UINT , UDINT
, ,
ANY_BIT
BOOL , WORD DWORD
,
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-53
1-5 Data Types Basic data types

1-5-2 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 2,767
3 DINT Double integer 32 -2,147,483,648 to 2,147,483,647
4 UINT Unsigned integer 16 0 to 65,535
Unsigned double
5 UDINT 32 0 to 4,294,967,295
integer
6 REAL Real 32 -2128 <N ≤ -2 -126
, 0, 2 -126
≤ N< 2128 (single-precision floating point)
SPH: 0ms to 4,294,967,295ms (0ms to 49 days, 17:02:47s295ms)
7 TIME Duration 32
SPS: 0ms to 2,147,483,647ms
8 D AT E Date 32 January 1st, 1970 to February 7th, 2106 (Note 1)
9 TOD Time of day 32 0:00:00 to 23:59:59 (Note 1)
10 DT Date and time of day 32 January 1st 0:00:00, 1970 to February 7th 6:28:15, 2106 (Note 1)
Variable-length
11 STRING - -
character string
12 WORD Bit string of length 16 16 16#0000 to 16#FFFF (Note 2)
13 DWORD Bit string of length 32 32 16#00000000 to 16#FFFFFFFF (Note 2)
Note: 1) Not supported by SPS.
2) 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 -2147483648 to 2147483647.
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 4294967295.
Examples: UDINT#100000, UDINT#16#111FFFF
6) REAL (real <single-precision floating point>)
A REAL occupies 32 memory bits and handles real values of
- 2 128 < N <= - 2 -126, 0, - 2 -126 <= N < 2 128
(-3.4028235E+38 to -1.1754945E-38, 0, 1.1754945E-38 to 3.4028235E+38).

Note 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
} May be represented in exponential formats.

Note 2: Real values that are smaller than the minimum representable value (± 2 -126 ) are handled as zeros (0).

1-54
Basic data types 1-5 Data Types

7) TIME (duration)
This deals with the set value or current value of timer. When SPH is used, time data in the range from 0 to 4,294,967,295ms
can be expressed; when SPS is used, in the range from 0 to 2,147,483,647ms. Units are d (day), h (hours), m (minutes), s
(seconds) and ms (milliseconds). You can combine them in various ways.
<Examples>
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) Not supported by SPS.


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) Not supported by SPS.
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) Not supported by SPS.
The DT data type handles date and time (year, month, day, hour, minute, second) data. A TOD occupies 32 memory bits and
can represent date and time data from the calendar years 1970 to 2106. The data type of TIME_AND_DAY is the same as that
of DT.
<Examples for DATE, TOD, and DATA:>
No. Type Example
DATE#1984-06-25
Basic format
date#1984-06-25
1 DATE 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 form
dt#1984-06-25-15:36:55

1-55
1-5 Data Types Basic data types

11) STRING (variable-length character string)


<In the case of SPH>
Character strings are represented in Fuji Electric’s original characters.
code which is based on the Shift JIS coding system. A NULL code (X’0000’) is automatically appended to the end
Whereas Shift JIS strings are mixtures of 8- and 16-bit of each string. Consequently, when a character string is
codes, this coding system extends 8-bit code into 16-bit declared, a memory space equal to the length of the
code so that the length of a single character is fixed at 16 character string plus one character, 65 words, is reserved.
bits. Strings have a variable length and can be as long as 64

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

<In the case of SPS>


Shifted JIS code. Maximum number of characters is 80 when
single-byte characters are used and 40 when double-byte
characters are used.
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. Type Example
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 Value Range
16 bits (WORD) 0 to 9999
32 bits (DWORD) 0 to 99999999

1-56
Derived data types 1-5 Data Types

1-5-3 Derived data types


Derived data types are defined by the user or PC The MICREX-SX series CPU modules support the following
manufacturers. They are defined using “Data Types” in the derived data types:
project tree.
• Array data types • Structured data types
1-dimensional array Structure
2-dimensional array (array of array) 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> Note: To specify a 32-bit array of data type


The data type of variable “file1” is array1. such as DINT or DWORD in the AT
statement, assign even addresses.

1 INT type data


2 INT type data
3 INT type data
4 INT type data
5 INT type data To access this data item, code file 1[15].
6 INT type data
7 INT type data Note: Any attempt to access an item beyond the valid index range
(e.g., file 1[11]) will simply be ignored with no error being flagged.
8 INT type data
9 INT type data
10 INT type data

1-57
1-5 Data Types 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 up of 3 instances of “x_data,” indexed from 1 to 3.
indexed from 1 to 10 and data type “y_data” is made

<Example of a variable declaration>


The data type of variable “file2” is y_data.

1 2 3
1
2
3
4
5 To access this data item, specify file2 [3] [5].
6
7
8
9
10

1-58
Derived data types 1-5 Data Types

(2) Structured data types


A structured data type is made up of two or more similar or single operation. Structured data type may be contained in
different data types. Structured data type is used in situations an array (array of structures) or contain arrays (structures of
where data items of different data types are necessary for a 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>


The data type of variable "hole_pro" is machine.

<Access method>
Variables of a structured data type are accessed in are x_pos, y_pos, depth, and rpm. To access the
the form of <variable name>.<member name>. rotational speed in hole_pro, you specify hole_pro.
Examples of <member name> in the above example rpm.

1-59
1-5 Data Types 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>


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

<Access method>
Structures in an array are accessed in the form of are x_pos, y_pos, depth, and rpm. To access the
<variable name>[<array index>].<member name>. rotational speed of the 5th machine in
Examples of <member name> in the above example num_hole_pro, you specify num_hole_pro [5].rpm.

<Structure of arrays>
Array is defined as an element of a structure.
<Sample data type definition>
The example shown below defines a structure
“machine2” of which the “depth” member is an array
of depths. of depths.

1-60
Derived data types 1-5 Data Types

<Sample variable declaration>


The data type of variable “hole_pro_02” is machine2.

<Access method>
An array in a structure is accessed in the form of
<variable name>.<member name>[<array index>]. are x_pos, y_pos, depth, and rpm. To access the 5th
Examples of <member name> in the above example 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 explicitly initialized in the program (code body).
variable declaration. Structured data type variables must be

<Sample variable declaration>

<Sample initialization program in ST language>

(3) Restrictions on derived data types


• Derived data types, excluding arrays, can be assigned no • No derived data type can contain a STRING.
initial values in their declarations. • If the value for a variable is out of the range of array
• Initialize array/structure data type variables by an elements specified in the data-type definition when array
application program. numbers are specified using variables, data at the
• No derived data type variable can be overwritten. highest or lowest array element number are accessed.
• 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 with the watch list and debug the program
using the watch list.

1-61
1-6 Tasks 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, periodic tasks, and event tasks.
POUs that will always be executed need be assigned to tasks so that their execution sequence can be determined.

1-6-1 Task specifications


Item Specification
Default task (cyclic processing)
Task type Periodic task
Event task
Number of tasks 1 (default) + 4 (periodic and event tasks)
Task priority SPH: 0> 1> 2> 3> default, SPS: 0> 1> 2> 3> ; default (Note)

Note: When SPS is used, the task of level 3 is given the same priority as default task.

1-6-2 Types and operations of tasks


1) Default task
• Always repeat execution in synchronization with Takt. Assign POUs requiring no responsibility and periodicity in arithmetical
operations.
• Two or more POUs may be assigned to the default task.
Note: A user WDT is the timer which monitors the execution time of the default task. It checks the time when execution has be
done. When no default task is used, the CPU processes the tasks equivalent to the default ones to execute internal
processes such as the user WDT check.
2) Periodic task
• A periodic interrupt task is executed once at a predetermined interval (0.5ms, 1ms to 32s). It is assigned to 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.
• A period interrupt task is given a priority of 0 to 3 (0 has the highest priority).
• Multiple POUs can be assigned to one task.
• Two or more POUs can be assigned to a periodic interrupt task (only for SPH).
When SPS is used, fixed cycle task asynchronously interrupts the currently executed task.

Note: A Takt period is an SX bus communication period. For the Tact period, 0.5ms, 1ms, ........., and 10ms may be set. Note
that when a standard CPU is used, 0.5ms cannot be specified. The Takt period depends on the scale of system
configuration (the numbers of I/O points, remote I/O master modules, communication modules, and CPU modules) and
the number of application program executable steps. A 0.5ms Takt period may be executed under the condition of a
powerful single CPU, 256 or less I/O modules connected to the SX bus and no remote I/O and communication modules.
In the standard CPU system, setting a Takt period to 0.5ms causes “system operation definition error” to occur, resulting
in CPU shutdown with a fatal fault.(Refer to the appropriate appendix for calculating a Takt period.)

3) Event task
• An event task is executed once each time a specified BOOL variable turns to “1” It is assigned to a POU that handles
interrupts from a communications module or high-speed counter module.
• Two or more POUs can be assigned to an event task.

1-62
Tasks 1-6 Tasks

1-6-3 Example of periodic task operation


Example of the operation of periodic task when SPH is used is explained under the following operating conditions.
<Operating conditions>
Task priority: Task 0 > Task 1 > Default task (cyclic)
Takt period: 1 ms
Task type: Task 0: Periodic task (1 Takt period)
Task 1: Periodic task (3 Takt periods)
Default task: Asynchronous with the Takt period
Note: The task period of the periodic tasks must be set to an integral multiple of the SX bus Takt period.

<Task operation>

TC0
TE0
TC1
TE1

Takt

; ; ;; ; ; ;; ;; ;; ; ;; ;; ;;
Task 0 ; ; ;; ; ; ;; ;; ;; ; ;; ;; ;;
; ; ;; ; ; ;; ;; ;; ; ;; ;; ;;
;; ; ; ;
Task 1 ;; ; ; ;
;; ;
Interrupt ; ;
Interrupt
Default ; Interrupt
; ;
; ; ;
Interrupt

TED
TCD

Takt processing
time
Takt period Task levels
Task 0 > Task 1 > Default
TE0: Task 0 execution time

TC0: Task 0 execution period

TE1: Task 1 execution time

TC1: Task 1 execution period

TED: Default task execution time

TCD: Default task execution period

: Task activation request

;;
;; : Data input processing
;;
;; : Data output processing
;;

The default tasks run while no periodic task or event task is operating. (They start in synchronization with a Takt period.) Be
sure to adjust the run times to the start periods of upper tasks so that the run times may be reserved for default tasks.
(Otherwise, a user WDTUP or upper task may be delayed.)

1-63
1-6 Tasks Tasks

1-6-4 Example of event task operation


An example of operation of an event task is explained below.
<Operating conditions>
Task priority: Task 0 > Task 1 > Default task (cyclic)
Takt period: 1 ms
Task type: Task 0: Event task
Task 1: Periodic task (1 Takt period)
Default task: Asynchronous with the Takt period

<Task operation>
Takt An event occurs.

Task 0

Task 1

Default
Interrupt Interrupt Interrupt Interrupt

Takt processing
time
Takt period Task 0: Event task
Task 1: Periodic task
: Task activation request Task levels
Task 0 > Task 1 > Default
: Data input processing

: Data output processing

An event task is not started immediately when an event


occurs but at the beginning of the next Takt period after the
event is recognized.

Monitoring the run times and run periods of tasks


The run time and run period of a task may be monitored on the resource information screen displayed from the
"D300win Resource Control" dialog box.
Task run time: The time after input to the task starts until output from the task has been finished.
Task run period: The time after input to the task starts until input to the next task starts.

The task run period appears on the open resource information screen after the task is executed two times. When the
CPU stops/starts or the CPU is switched between the operating and waiting sides in the duplex mode while the
resource information screen is open, measurement stops temporarily and then restarts.
Before the run period can appear on the screen, the task must have been executed two times after the CPU
stopped/started or was switched between the operating and waiting sides.

1-64
Tasks 1-6 Tasks

1-6-5 Task interrupt processing


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

Arithmetic
Arithmetic operation
Task start operation start ends Task ends

;;;;;;;; ;;;;;;;;
Task ;;;;;;;; P23 P7 P66 P157 P34 ;;;;;;;;
;;;;;;;; ;;;;;;;;

Data input operation Arithmetic operation Data output operation

When a Takt interrupt occurs during the arithmetic than the time required to perform the data output operation,
operation, the operation is interrupted as illustrated in the performs the data output processing and terminates the task.
figure below. If the time to the next Takt interrupt is shorter than the time
When a Takt interrupt occurs, the system checks the startup required to perform the data output operation, the system
conditions for a new task. If a task startup request is keeps the task suspended and executes no output operation
present, the system performs the data input operation for for the task. The data output operation is carried out only
that task and starts the task having the highest priority. after the system executes the next Takt processing. Since
Consequently, another task is likely to be executed while the the time up to the next Takt interrupt is computed at the end
current task is suspended as shown in the figure below. of the arithmetic operation, no Takt interrupt can occur
When the arithmetic operation ends, the system checks the during the execution of the data output operation.
time until the next Takt interrupt occurs and, if it is longer

Another task is executed


Takt interrupt during this period.

Task P23 P7 P66 P157 P157 P34

Arithmetic operation
Data input operation suspended. Data output operation

1-65
1-7 Program Organization Units (POUs) POU

The program organization units include functions (FCTs), function blocks may be supplied by the manufacturer or
function blocks (FBs), and programs (PGs). made by the user.
Programs are programmed by the user. Functions and

<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 functions can be called from a function block.
function block can be called from a function. However,

<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

1-66
POU 1-7 Program Organization Units (POUs)

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


High-performance CPU
Program User Function User Function Block
V AR 8000 (Note 1) 4,096 words
VAR_INPUT - 2,048 words
256 words in total
VAR_OUTPUT - -
(Note 2) VAR_IN_OUT - -
VAR_EXTERNAL 8000 (Note 1) - 8000 (Note 1)

Standard CPU
Program User Function User Function Block
V AR 8000 (Note 1) 4,096 words Number of words occupying the
user FB instance area
VAR_INPUT - 1,024 words The default values are shown
Total
VAR_OUTPUT - - below.
NP1PH-16: 4098 words
VAR_IN_OUT - - NP1PH-08: 2048 words
VAR_EXTERNAL 8000 (Note 1) - 8000 (Note 1)

Note: 1) The total of the POUs that are assigned to one resource. This is 8000 (15000 for V2 or later versions of D300win)
irrespective of the data type of variables.
2) One VAR_IN_OUT declaration uses two words.

1-67
1-7 Program Organization Units (POUs) POU

1) Function
A function is a program organization unit that, when executed, generates a single data item (when SPH (Note), including
multiple elements such as an array or structure).
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.

Note: When SPS is used, neither STRING type data nor structure/array type data can be used for input parameters or the
variables in functions.
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);

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.

1-68
POU 1-7 Program Organization Units (POUs)

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


Use Within a Function Block Outside a Function Block
Read an input
x
variable
Write an input
variable
Read an output
variable
Write an output
x
variable

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

Note: 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-69
1-8 Calendar Function Calendar
(These functions are not supported by SPS.)

The MICREX-SX series CPU modules incorporate a clock can be monitored and set from the D300win. They can also
that provides calendar functions. The values of the calendar be monitored and set from an application program.

1-8-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.
Note: One second after December 31, 2069 23:59:59, the date and time will turn back to January 1, 1970.

1-8-2 Calendar accuracy


The accuracy of the calendar (clock) in the CPU is 27
seconds per month (at an ambient temperature of 25°C).
Note: 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-8-3 Monitoring and setting up the calendar clock


from the D300win
1) Left-click the [Control ] Button in the menu bar.
The “CONTROL” dialog box will open.

Left-click this button.

Left-click this button.

2) Left-click the [Calendar/Watch...] Button, and the current value will be displayed.

Current values for date


and time.

Set values
Left-click this button.

After setting values, left-click this


button.

3) Left-click the [Change ...] button, and the “PC time setting” dialog box opened. On this dialog box, you can set any
desired value.

1-70
Calendar 1-8 Calendar Function

1-8-4 Monitoring and setting up the calendar clock


from an application program
1) HW_RTC (Hardware RTC) - Original FB
(These functions are not supported by SPS.)
Use the hardware RTC function block (HW_RTC) to monitor For detailed instructions, refer to the manual for HW_RTC.
and set up the calendar clock from an application program.
Note) 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 unsigned integer in seconds that starts at January 1st,
an external device, it is necessary to convert the input data 00:00:00, 1970.
to the DT type. The DT type data is equivalent to a 32-bit

(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
(These functions are not supported by SPS.)
The IEC standard function block RTC cannot be used to set clock, a relative value is stored in an instance area on which
up the calendar clock. If RTC is used to set up the calendar the calendar clock will run.

1-8-5 Time adjustment function


(These functions are not supported by SPS.)
In a multi-CPU system the MICREX-SX series CPU modules internal clock (real-time clock).
provide a function that automatically adjusts the time of their

Power
supply
CPU CPU
0 1

1) Time adjustment management


The number “0”CPU module adjusts the real-time clock of CPU module is assigned to adjust the real-time clock of the
the other CPU modules. If the CPU0 goes down, another other CPU modules.
2) Timing of time adjustment
• When the system is powered on. Subsequently, it is • When the real-time clock is updated from the D300win or
adjusted at predetermined intervals (every minute). an application program.

1-71
1-9 Operating Flowchart Operating flowchart

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

Power-on

Copies the RAS obtained in the preceding


Note: 1) Do not change the CPU Set RAS history
number switch during session into RAS history.
running.
Read CPU number SW (Note 1)

Transfers the user program from flash memory to the


Transfer user program
RAM area (with sum checking).

Power-on time initialization


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

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

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

Note: 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 has occured.
1-72
Section 2 Programming Languages

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

2-2 IL Language .............................................................................................................. 2-3


2-2-1 IL instruction summary ....................................................................................................... 2-3
2-2-2 IL language instructions ..................................................................................................... 2-6
(1) Load LD ......................................................................................................................................... 2-6
(2) Load not LDN ................................................................................................................................. 2-6
(3) Store ST ......................................................................................................................................... 2-7
(4) Store not STN ................................................................................................................................ 2-7
(5) Set S .............................................................................................................................................. 2-8
(6) Reset R .......................................................................................................................................... 2-8
(7) Logical product AND ...................................................................................................................... 2-9
(8) Logical product AND( ..................................................................................................................... 2-9
(9) Logical inverted product ANDN .................................................................................................... 2-10
(10) Logical inverted product ANDN( ................................................................................................ 2-10
(11) Logical add OR .......................................................................................................................... 2-11
(12) Logical add OR( ......................................................................................................................... 2-11
(13) Logical inverted add ORN .......................................................................................................... 2-12
(14) Logical inverted add ORN( ........................................................................................................ 2-12
(15) Exclusive OR XOR ..................................................................................................................... 2-13
(16) Exclusive OR XOR( ................................................................................................................... 2-13
(17) Exclusive NOR XORN ............................................................................................................... 2-14
(18) Exclusive NOR XORN( .............................................................................................................. 2-14
(19) Addition ADD ............................................................................................................................. 2-15
(20) Addition ADD( ............................................................................................................................ 2-15
(21) Subtraction SUB ........................................................................................................................ 2-16
(22) Subtraction SUB( ....................................................................................................................... 2-16
(23) Multiplication MUL ..................................................................................................................... 2-17
(24) Multiplication MUL( .................................................................................................................... 2-17
(25) Division DIV ............................................................................................................................... 2-18
(26) Division DIV( .............................................................................................................................. 2-18
(27) Comparison GT ......................................................................................................................... 2-19
(28) Comparison GT( ........................................................................................................................ 2-19
(29) Comparison GE ......................................................................................................................... 2-20
(30) Comparison GE( ........................................................................................................................ 2-20
(31) Comparison EQ ......................................................................................................................... 2-21
(32) Comparison EQ( ........................................................................................................................ 2-21
(33) Comparison NE ......................................................................................................................... 2-22
(34) Comparison NE( ........................................................................................................................ 2-22
(35) Comparison LE .......................................................................................................................... 2-23
(36) Comparison LE( ......................................................................................................................... 2-23
(37) Comparison LT ........................................................................................................................... 2-24
(38) Comparison LT( ......................................................................................................................... 2-24
(39) Unconditional jump JMP ............................................................................................................ 2-25
(40) TRUE conditional jump JMPC .................................................................................................... 2-25
(41) FALSE conditional jump JMPCN ............................................................................................... 2-26
(42) Unconditional call CAL ............................................................................................................... 2-26
(43) TRUE conditional call CALC ...................................................................................................... 2-27
(44) FALSE conditional call CALCN .................................................................................................. 2-27
(45) Unconditional return RET .......................................................................................................... 2-28
(46) TRUE conditional return RETC .................................................................................................. 2-28
(47) FALSE conditional return RETCN .............................................................................................. 2-29

2-3 ST Language .......................................................................................................... 2-30


2-3-1 ST operators .................................................................................................................... 2-30
2-3-2 ST statements .................................................................................................................. 2-31
2-3-3 ST language statements .................................................................................................. 2-31
(1) Assignment statement (:=) ................................................................................................................ 2-31
(2) IF statement ...................................................................................................................................... 2-32
(3) CASE statement ............................................................................................................................... 2-33
(4) FOR statement ................................................................................................................................. 2-34
(5) WHILE statement .............................................................................................................................. 2-35
(6) REPEAT statement ........................................................................................................................... 2-35
(7) RETURN statement .......................................................................................................................... 2-36
(8) EXIT statement ................................................................................................................................. 2-36

2-4 LD Language .......................................................................................................... 2-37


2-4-1 LD language ..................................................................................................................... 2-37
2-4-2 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-5 FBD Language ........................................................................................................ 2-41


2-5-1 Function summary ........................................................................................................... 2-42
(1) Symbols used in the function summary ............................................................................................ 2-42
(2) Describing a function in the IL language ........................................................................................... 2-43
(3) Describing a function in the ST language ......................................................................................... 2-43
(4) Specification of enable flags (EN/ENO) (only for SPH) .................................................................... 2-44
(5) Function summary ............................................................................................................................ 2-47
2-5-2 Function block summary .................................................................................................. 2-67
(1) Symbols used in the function block summary ................................................................................... 2-67
(2) Describing a function block in the IL language ................................................................................. 2-68
(3) Describing a function block in the ST language ................................................................................ 2-68
(4) Function block summary ................................................................................................................... 2-69
2-5-3 Type conversion functions ................................................................................................ 2-78
(1) Type conversion DINT_TO_INT ................................................................................................... 2-78
(2) Type conversion UINT_TO_INT ................................................................................................... 2-78
(3) Type conversion UDINT_TO_INT ................................................................................................. 2-79
(4) Type conversion REAL_TO_INT .................................................................................................. 2-79
(5) Type conversion TIME_TO_INT ................................................................................................... 2-80
(6) Type conversion WORD_TO_INT ................................................................................................ 2-80
(7) Type conversion INT_TO_DINT ................................................................................................... 2-81
(8) Type conversion UINT_TO_DINT ................................................................................................. 2-81
(9) Type conversion UDINT_TO_DINT .............................................................................................. 2-82
(10) Type conversion REAL_TO_DINT .............................................................................................. 2-82
(11) Type conversion TIME_TO_DINT ............................................................................................... 2-83
(12) Type conversion DWORD_TO_DINT ......................................................................................... 2-83
(13) Type conversion INT_TO_UINT ................................................................................................. 2-84
(14) Type conversion DINT_TO_UINT ............................................................................................... 2-84
(15) Type conversion UDINT_TO_UINT ............................................................................................ 2-85
(16) Type conversion REAL_TO_UINT .............................................................................................. 2-85
(17) Type conversion TIME_TO_UINT ............................................................................................... 2-86
(18) Type conversion WORD_TO_UINT ............................................................................................ 2-86
(19) Type conversion INT_TO_UDINT ............................................................................................... 2-87
(20) Type conversion DINT_TO_UDINT ............................................................................................ 2-87
(21) Type conversion UINT_TO_UDINT ............................................................................................ 2-88
(22) Type conversion REAL_TO_UDINT ........................................................................................... 2-88
(23) Type conversion TIME_TO_UDINT ............................................................................................ 2-89
(24) Type conversion DWORD_TO_UDINT ....................................................................................... 2-89
(25) Type conversion DT_TO_UDINT ................................................................................................ 2-90
(26) Type conversion DATE_TO_UDINT ........................................................................................... 2-90
(27) Type conversion TOD_TO_UDINT ............................................................................................. 2-91
(28) Type conversion INT_TO_REAL ................................................................................................ 2-91
(29) Type conversion DINT_TO_REAL .............................................................................................. 2-92
(30) Type conversion UINT_TO_REAL .............................................................................................. 2-92
(31) Type conversion UDINT_TO_REAL ........................................................................................... 2-93
(32) Type conversion TIME_TO_REAL .............................................................................................. 2-93
(33) Type conversion WORD_TO_BOOL .......................................................................................... 2-94
(34) Type conversion DWORD_TO_BOOL ........................................................................................ 2-94
(35) Type conversion BOOL_TO_WORD .......................................................................................... 2-95
(36) Type conversion DWORD_TO_WORD ...................................................................................... 2-95
(37) Type conversion INT_TO_WORD .............................................................................................. 2-96
(38) Type conversion UINT_TO_WORD ............................................................................................ 2-96
(39) Type conversion BOOL_TO_DWORD ........................................................................................ 2-97
(40) Type conversion WORD_TO_DWORD ...................................................................................... 2-97
(41) Type conversion DINT_TO_DWORD ......................................................................................... 2-98
(42) Type conversion UDINT_TO_DWORD ....................................................................................... 2-98
(43) Type conversion INT_TO_TIME ................................................................................................. 2-99
(44) Type conversion DINT_TO_TIME .............................................................................................. 2-99
(45) Type conversion UINT_TO_TIME ............................................................................................ 2-100
(46) Type conversion UDINT_TO_TIME .......................................................................................... 2-100
(47) Type conversion REAL_TO_TIME ........................................................................................... 2-101
(48) Type conversion UDINT_TO_DT .............................................................................................. 2-101
(49) Type conversion UDINT_TO_DATE ......................................................................................... 2-102
(50) Type conversion UDINT_TO_TOD ........................................................................................... 2-102
(51) Type conversion TRUNC_INT .................................................................................................. 2-103
(52) Type conversion TRUNC_DINT ................................................................................................ 2-103
(53) Type conversion TRUNC_UINT ................................................................................................ 2-104
(54) Type conversion TRUNC_UDINT ............................................................................................. 2-104
(55) Type conversion W_BCD_TO_INT ........................................................................................... 2-105
(56) Type conversion D_BCD_TO_INT ........................................................................................... 2-105
(57) Type conversion W_BCD_TO_DINT ........................................................................................ 2-106
(58) Type conversion D_BCD_TO_DINT ......................................................................................... 2-106
(59) Type conversion INT_TO_W_BCD ........................................................................................... 2-107
(60) Type conversion DINT_TO_W_BCD ........................................................................................ 2-107
(61) Type conversion INT_TO_D_BCD ........................................................................................... 2-108
(62) Type conversion DINT_TO_D_BCD ......................................................................................... 2-108
2-5-4 Arithmetic functions ........................................................................................................ 2-109
(1) Absolute value ABS_INT ........................................................................................................... 2-109
(2) Absolute value ABS_DINT ......................................................................................................... 2-109
(3) Absolute value ABS_REAL ........................................................................................................ 2-110
(4) Square root SQRT ..................................................................................................................... 2-110
(5) Natural logarithm LN .................................................................................................................. 2-111
(6) Common logarithm LOG ............................................................................................................ 2-111
(7) Exponent EXP ........................................................................................................................... 2-112
(8) Sine SIN ..................................................................................................................................... 2-112
(9) Cosine COS ............................................................................................................................... 2-113
(10) Tangent TAN ............................................................................................................................. 2-113
(11) Arc sine ASIN .......................................................................................................................... 2-114
(12) Arc cosine ACOS ..................................................................................................................... 2-114
(13) Arc tangent ATAN ..................................................................................................................... 2-115
(14) Addition ADD .......................................................................................................................... 2-115
(15) Subtraction SUB ...................................................................................................................... 2-116
(16) Multiplication MUL ................................................................................................................... 2-116
(17) Division DIV ............................................................................................................................. 2-117
(18) Division remainder MOD .......................................................................................................... 2-117
(19) Exponent EXPT ....................................................................................................................... 2-118
(20) Move MOVE ............................................................................................................................ 2-118
(21) Negation NEG .......................................................................................................................... 2-119
2-5-5 Bit string functions .......................................................................................................... 2-120
(1) Shift left SHL_WORD ................................................................................................................. 2-120
(2) Shift left SHL_DWORD .............................................................................................................. 2-120
(3) Shift right SHR_WORD .............................................................................................................. 2-121
(4) Shift right SHR_DWORD ........................................................................................................... 2-121
(5) Rotate left ROL_WORD ............................................................................................................. 2-122
(6) Rotate left ROL_DWORD .......................................................................................................... 2-122
(7) Rotate right ROR_WORD .......................................................................................................... 2-123
(8) Rotate right ROR_DWORD ........................................................................................................ 2-123
(9) Logical product AND .................................................................................................................. 2-124
(10) Logical add OR ........................................................................................................................ 2-124
(11) Exclusive XOR ......................................................................................................................... 2-125
(12) Logical negation NOT .............................................................................................................. 2-125
(13) Negation NOT_BOOL .............................................................................................................. 2-126
(14) Negation NOT_WORD ............................................................................................................. 2-126
(15) Negation NOT_DWORD .......................................................................................................... 2-127
2-5-6 Selection/comparison functions ..................................................................................... 2-128
(1) Select SEL ................................................................................................................................. 2-128
(2) Maximum value MAX ................................................................................................................. 2-129
(3) Minimum value MIN ................................................................................................................... 2-129
(4) Limit LIMIT ................................................................................................................................. 2-130
(5) Comparison (>) GT .................................................................................................................... 2-131
(6) Comparison (≥) GE .................................................................................................................... 2-132
(7) Comparison (=) EQ .................................................................................................................... 2-133
(8) Comparison (≤) LE ..................................................................................................................... 2-134
(9) Comparison (<) LT ..................................................................................................................... 2-135
(10) Comparison (≠) NE .................................................................................................................. 2-136
2-5-7 Character string functions .............................................................................................. 2-137
(1) Get length LEN .......................................................................................................................... 2-137
(2) Get left sub-string LEFT ............................................................................................................. 2-137
(3) Get right sub-string RIGHT ........................................................................................................ 2-138
(4) Get middle sub-string MID ......................................................................................................... 2-138
(5) Concatenate CONCAT ............................................................................................................... 2-139
(6) Insert string INSERT .................................................................................................................. 2-139
(7) Delete string DELETE ................................................................................................................ 2-140
(8) Replace string REPLACE .......................................................................................................... 2-140
(9) Find string FIND ......................................................................................................................... 2-141
(10) Compare string (>) GT_STRING ............................................................................................. 2-141
(11) Compare string (≥) GE_STRING ............................................................................................. 2-142
(12) Compare string (=) EQ_STRING ............................................................................................. 2-142
(13) Compare string (≤) LE_STRING .............................................................................................. 2-143
(14) Compare string (<) LT_STRING .............................................................................................. 2-143
(15) Compare string (≠) NE_STRING ............................................................................................. 2-144
2-5-8 Time type data functions ................................................................................................ 2-145
(1) Add time ADD_T_T .................................................................................................................... 2-145
(2) Add time ADD_TD_T ...................................................................................................................... 2-145
(3) Add time ADD_DT_T ................................................................................................................. 2-145
(4) Subtract time SUB_T_T ............................................................................................................. 2-146
(5) Subtract time SUB_D_D ............................................................................................................ 2-146
(6) Subtract time SUB_TD_T .......................................................................................................... 2-146
(7) Subtract time SUB_TD_TD ........................................................................................................ 2-147
(8) Subtract time SUB_DT_T .......................................................................................................... 2-147
(9) Subtract time SUB_DT_DT ........................................................................................................ 2-147
(10) Multiply time MUL_T_N ........................................................................................................... 2-148
(11) Multiply time MUL_T_R ........................................................................................................... 2-148
(12) Divide time DIV_T_N ............................................................................................................... 2-149
(13) Divide time DIV_T_R ............................................................................................................... 2-149
(14) Concatenate time CONCAT_D_D ............................................................................................ 2-150
(15) Convert DT to TOD DT_TO_TOD ............................................................................................ 2-150
(16) Convert DT to DATE DT_TO_DATE ......................................................................................... 2-150
2-5-9 Original FCTs (Functions) .............................................................................................. 2-151
(1) Set bit SBIT_WORD .................................................................................................................. 2-151
(2) Set bit SBIT_DWORD ................................................................................................................ 2-151
(3) Reset bit RBIT_WORD .............................................................................................................. 2-152
(4) Reset bit RBIT_DWORD ............................................................................................................ 2-152
(5) Test bit TBIT_WORD .................................................................................................................. 2-153
(6) Test bit TBIT_DWORD ............................................................................................................... 2-153
(7) Decode DECODE_WORD ......................................................................................................... 2-154
(8) Decode DECODE_DWORD ...................................................................................................... 2-154
(9) Encode ENCODE_WORD ......................................................................................................... 2-154
(10) Encode ENCODE_DWORD ..................................................................................................... 2-155
(11) Bit count BITCOUNT_WORD .................................................................................................. 2-155
(12) Bit count BITCOUNT_DWORD ................................................................................................ 2-155
(13) Convert string to number STR_TO_UINT ................................................................................ 2-156
(14) Convert number to string UINT_TO_STR ................................................................................ 2-156
(15) Convert shift-JIS to string SJ_TO_STR ................................................................................... 2-157
(16) Convert string to shift-JIS STR_TO_SJ ................................................................................... 2-157
(17) Byte length BYTE_LEN ........................................................................................................... 2-158
(18) Dead band DBAND_INT .......................................................................................................... 2-158
(19) Dead band DBAND_DINT ....................................................................................................... 2-159
(20) Dead band DBAND_REAL ...................................................................................................... 2-159
(21) Bias BIAS_INT ......................................................................................................................... 2-160
(22) Bias BIAS_DINT ...................................................................................................................... 2-160
(23) Bias BIAS_REAL ..................................................................................................................... 2-161
(24) Step sequence SC_COIL/SC .................................................................................................. 2-162
(25) 32-bit addition with carry ADC/ADCO ...................................................................................... 2-163
(26) 32-bit subtraction with borrow SBB/SBBO ............................................................................... 2-164
(27) 64-bit multiplication (MULL/MULU) .......................................................................................... 2-165
(28) 64-bit division (DIVL/DIVU) ...................................................................................................... 2-166
(29) Shift left 32 bits with carry SLC/SLCO ..................................................................................... 2-167
(30) Shift right 32 bits with carry SRC/SRCO .................................................................................. 2-168
2-5-10 Standard FBs (Function Blocks) .................................................................................. 2-169
(1) Set reset flip-flop SR .................................................................................................................. 2-169
(2) Reset set flip-flop RS ................................................................................................................. 2-169
(3) Rising edge trigger R_TRIG ...................................................................................................... 2-170
(4) Falling edge trigger F_TRIG ...................................................................................................... 2-170
(5) Up Counter CTU ........................................................................................................................ 2-171
(6) Down counter CTD .................................................................................................................... 2-171
(7) Up down counter CTUD ............................................................................................................. 2-172
(8) Pulse TP .................................................................................................................................... 2-173
(9) On-delay timer TON ................................................................................................................... 2-173
(10) Off-delay timer TOF .................................................................................................................. 2-174
(11) Real-time clock RTC ................................................................................................................ 2-174
2-5-11 Original FBs (Function Blocks) .................................................................................... 2-175
(1) Ring Counter RCT ..................................................................................................................... 2-175
(2) Integrating timer TMR ................................................................................................................ 2-176
(3) Retriggerable timer MR .............................................................................................................. 2-177
(4) Open channel M_OPEN ............................................................................................................ 2-178
(5) Send message M_SEND ........................................................................................................... 2-180
(6) Receive message M_RECEIVE ................................................................................................. 2-181
(7) Direct read READ_WORD/READ_BOOL .................................................................................. 2-182
(8) Direct write WRITE_WORD/WRITE_BOOL .............................................................................. 2-183
(9) Remote data read R_READ ...................................................................................................... 2-184
(10) Remote data write R_WRITE .................................................................................................. 2-185
(11) File data read F_READ ............................................................................................................ 2-188
(12) File data write F_WRITE .......................................................................................................... 2-189
(13) Extension test & set EXT_T_S ................................................................................................ 2-190
(14) Sequential file store FFST ....................................................................................................... 2-191
(15) Sequential file load first FIFO .................................................................................................. 2-192
(16) Sequential file load last FILO ................................................................................................... 2-193
(17) Filter FILTER_DINT ................................................................................................................. 2-194
(18) Filter FILTER_REAL ................................................................................................................ 2-195
(19) Integrate INT_DINT .................................................................................................................. 2-196
(20) Integrate INT_REAL ................................................................................................................. 2-197
(21) Differentiate DIF_DINT ............................................................................................................ 2-198
(22) Differentiate DIF_REAL ........................................................................................................... 2-199
(23) Pulse count PULSE_CNT ........................................................................................................ 2-200
(24) Pulse output PULSE_OUT ...................................................................................................... 2-200
(25) Pulse PWM .............................................................................................................................. 2-201
(26) Hardware RTC (Real-time Clock) HW_RTC ............................................................................ 2-201
(27) Test & set T_S .......................................................................................................................... 2-202
(28) Change bank BANK_CHG ....................................................................................................... 2-203
2-5-12 Original FBs dedicated to SPS .................................................................................... 2-204
(1) File open FILE_OPEN .................................................................................................................. 2-204
(2) File data write FILE_WRITE ......................................................................................................... 2-205
(3) File data read FILE_READ ............................................................................................................ 2-206
(4) File pointer seek FILE_SEEK ....................................................................................................... 2-207
(5) Shifted JIS code to character string conversion SJ_TO_STRING ................................................ 2-208
(6) Character string to shifted JIS code conversion STRING_TO_SJ ................................................ 2-208
(7) Direct read READ_W .................................................................................................................... 2-209
(8) Direct read READ_B ..................................................................................................................... 2-210
(9) Direct write WRITE_W ................................................................................................................... 2-211
(10) Direct write WRITE_B ................................................................................................................. 2-212
(11) Calendar read RTC_R ................................................................................................................ 2-213

2-6 SFC Elements ....................................................................................................... 2-214


2-6-1 SFC elements ................................................................................................................ 2-215
(1) Initial step ........................................................................................................................................ 2-215
(2) Normal step .................................................................................................................................... 2-216
(3) Jump ............................................................................................................................................... 2-216
(4) Termination step .............................................................................................................................. 2-217
(5) Action/action qualifier ...................................................................................................................... 2-218
(6) Transition ......................................................................................................................................... 2-222
2-6-2 Step transition ................................................................................................................ 2-223
(1) Single-flow transition ....................................................................................................................... 2-223
(2) Divergence of sequence selection .................................................................................................. 2-223
(3) Convergence of sequence selection ............................................................................................... 2-224
(4) Simultaneous sequences-divergence ............................................................................................. 2-225
(5) Simultaneous sequences-convergence .......................................................................................... 2-225
2-6-3 Automatically generated SFC variables ......................................................................... 2-226
2-6-4 SFC programming precautions ...................................................................................... 2-227
2-6-5 Continuous operation of SFC ......................................................................................... 2-228
Types
Section 2 Programming Languages
2-1 Types of Programming Languages

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

Text languages IL language (Instruction List)


ST language (Structured Text)
Graphic languages LD language (Ladder Diagram)
FBD language (Function Block Diagram)
SFC elements (Sequential Function Chart)

Graphic languages can be used for programming in worksheet. The available combinations of languages are
combination with any of the above languages on one listed in the table below.
Language Specified on Sheet (Note 1) Available Combination
LD language LD language, FBD language
FBD language LD language, FBD language
SFC elements LD language, FBD language, SFC elements (Note 2)
Note: 1) The Programming languages are specified by the D300win loader in the “Insert” dialog box of the POU.
<Insert dialog box>

Specify the language here.

Note: 2) In actions and transitions of SFC elements, text languages (IL and ST) are available.
3) When the transfer error occurs in each instruction operation, CPU performs as follows (only for SPH):
1) When a transfer error occurs while reading data from the global memory via the processor bus, ENO is set to 0
(*1) and the operation results are indefinite (*2).
*1: ENO: Is an execution flag in the CPU that is set to “0” when an error occurs.
*2: Indefinite data refers to a value that is defined by the individual CPU hardware (example: “0” or the operation
results executed at that time).
2) When a transfer error occurs while writing the data into the global memory via the processor bus (*3), ENO is set
to 0 and the data storing may be indefinite.
*3: The value in the destination area remains the same unless the write is carried out.

2-1
2-1 Types of Programming Languages Types

Note: 4) 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.
5) EN (enable input) and ENO (enable output) described in the detailed explanations of instructions are the functions for
controlling execution. Note that these functions are not supported in versions earlier than D300winV2.0 and software
PLC (SPS).

2-2
IL language 2-2 IL Language

An instruction in the IL language consists of an instruction instruction symbol of an instruction may be preceded by a
symbol, a variable name, and a comment specified on a label. The label serves as the destination of jump
single line. As shown the first line in the figure below, the instructions.

<Examples of IL language instructions>

Comment
Variable name A comment begins with
“(*“and 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-2-1 IL instruction summary


The IL instructions can be used only in the IL language.
Instruction Name Data Type Description No. of steps Page
LD Load ANY Loads the operand value and sets it to the operation result. 1 P2-6
Loads the inverted value of the operand and sets it to the operation
LDN Load not ANY_BIT 1 P2-6
result.
ST Store ANY Stores the current operation result in the operand. 1 P2-7
STN Store not ANY_BIT Stores the inverted value of the current operation result in the operand. 1 P2-7
S Set BOOL Sets the operand to 1 if the current operation result is 1. 1 P2-8
R Reset BOOL Resets the operand to 0 if the current operation result is 1. 1 P2-8
Operates the logical product of the current operation result and the
AND 1 P2-9
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-9
operation result.
Operates the logical product of the current operation result and the
ANDN inverted value of the operand value, and sets the result to the operation 1 P2-10
Logical 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 sets 1 P2-10
the result to the operation result.
Operates the logical add of the current operation result and the operand
OR 1 P2-11
Logical value, and sets the result to the operation result.
ANY_BIT
add Operates the logical add of the current operation result and the operation
OR( 1 P2-11
result specified in parentheses, and sets the result to the operation result.

2-3
2-2 IL Language IL language

Instruction Name Data Type Description No. of steps Page


Operates the logical add of the current operation result and the inver ted
ORN 1 P2-12
value of the operand value, and sets the result to the operation result.
Logical ANY_BIT Operates the logical add of the current operation result and the inver ted
ORN( inver ted add value of the operation result specified in parentheses, and sets the result 1 P2-12
to the operation result.
Operates the exclusive OR of the current operation result and the
XOR 1 P2-13
operand value, and sets the result to the operation result.
Exclusive OR ANY_BIT Operates the exclusive OR of the current operation result and the
XOR( operation result specified in parentheses, and sets the result to the 1 P2-13
operation result.
Operates the exclusive NOR of the current operation result and the
XORN inver ted value of operand value, and sets the result to the operation 1 P2-14
Exclusive result.
ANY_BIT
NOR Operates the exclusive NOR of the current operation result and the
XORN( inver ted value of the operation result specified in parentheses, and sets 1 P2-14
the result to the operation result.
Operates the addition of the current operation result and the operand
ADD 1 P2-15
value, and sets the result to the operation result.
Addition ANY_NUM Operates the addition of the current operation result and the operation
ADD( result specified in parentheses, and sets the result to the operation 1 P2-15
result.
Operates the subtraction of the operand value from the current operation
SUB 1 P2-16
result, and sets the result to the operation result.
Subtraction ANY_NUM Operates the subtraction of the operation result specified in parentheses
SUB( from the current operation result, and sets the result to the operation 1 P2-16
result.
Operates the multiplication of the current operation result and the
MUL 1 P2-17
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-17
operation result.
Operates the division of the current operation result by the operand
DIV 1 P2-18
value, and sets the result to the operation result.
Division ANY_NUM Operates the division of the current operation result by the operation
DIV( result specified in parentheses, and sets the result to the operation 1 P2-18
result.
Operates the comparison of the current operation result as the left-hand
GT side of the ">" operator with the operand value as the right-hand side, 1 P2-19
elementary and sets the result (BOOL value) to the operation result.
Comparison (excluding
(>) STRING) Operates the comparison of the current operation result as the left-hand
side of the ">" operator with the operation result specified in parentheses
GT( 1 P2-19
(Note) 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-hand
GE elementary side of the "≥ " operator with the operand value as the right-hand side, 1 P2-20
(excluding 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 in parentheses
GE( (Note) 1 P2-20
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-hand
EQ elementary side of the "=" operator with the operand value as the right-hand side, 1 P2-21
(excluding 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 in parentheses
EQ( (Note) 1 P2-21
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-hand
NE elementary side of the "≠ " operator with the operand value as the right-hand side, 1 P2-22
(excluding 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 in
NE( (Note) 1 P2-22
parentheses as the right-hand side, and sets the result (BOOL value) to
the operation result.
Note: When SPS is used, neither STRING type nor ANY_DATE type can be used. BOOL type cannot be used for GT, GT(,
2-4 GE or GE(, either.
IL language 2-2 IL Language

Instruction Name Data Type Description No. of steps Page


Operates the comparison of the current operation result as the left-hand
LE side of the "≤ " operator with the operand value as the right-hand side, 1 P2-23
elementary and sets the result (BOOL value) to the operation result.
(excluding
Comparison Operates the comparison of the current operation result as the left-hand
STRING)
(≤ ) side of the "≤ " operator with the operation result specified in
LE( 1 P2-23
(Note 1) 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-hand
LT side of the "<" operator with the operand value as the right-hand side, 1 P2-24
elementary and sets the result (BOOL value) to the operation result.
Comparison (excluding
(<) STRING) Operates the comparison of the current operation result as the left-hand
side of the "<" operator with the operation result specified in
LT( 1 P2-24
(Note 1) 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-25
jump
TRUE Jumps to the step specified by the label of the operand when the current
JMPC conditional - operation result is TRUE (nonzero). 1 P2-25
jump
FALSE Jumps to the step specified by the label of the operand when the current
JMPCN conditional - operation result is FALSE (zero). 1 P2-26
jump
Label of the Indicates the destination address. (Note 2)
Label_name destination - 0 P2-3
address
Unconditional Calls the function block specified in the operand.
CAL - 1 P2-26
call
TRUE Calls the function block specified in the operand if the current operation
CALC conditional - result is TRUE (nonzero). 1 P2-27
call
FALSE Calls the function block specified in the operand if the current operation
CALCN conditional - result is FALSE (zero). 1 P2-27
call
Unconditional Returns to the calling program.
RET - 1 P2-28
return
TRUE Returns to the calling program if the current operation result is TRUE
RETC conditional - (nonzero). 1 P2-28
return
FALSE Returns to the calling program if the current operation result is FALSE
RETCN conditional - (zero). 1 P2-29
return
Closing Performs the deferred operation.
) - 1 -
Parenthesis
Note: 1) When SPS is used, none of BOOL type, STRING type and ANY_DATE type can be used.
2) When SPS is used, only LD, CAL, JMP or RET instruction can be used just after a label.

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-5
2-2 IL Language IL language

2-2-2 IL language instructions


(1) Load LD

Name, Symbol, Function Example


Name Symbol Function

<Programming example>
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 INPUT1 1
operand and sets it to the operation result.
(2) Available data types are all data types
(ANY type) of MICREX-SX series. Operation result 1
(3) When SPS is used, ANY_DATE type
(DATE type, DT type, TOD type) cannot be • When the data type of INPUT1 is INT type
used.
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
Name Symbol

<Programming example>
Load not
• Loads the inverted value of “INPUT1” and sets it to the operation result.
LDN INPUT1

LDN
<Operation>
• When the data type of INPUT1 is WORD type
Function

(1) Starts the calculations in a series of


processes. LDN loads the inverted
value of the operand and sets it to the INPUT1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1

operation 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-6
IL language 2-2 IL Language

(3) Store ST

Name, Symbol, Function Example


Name Symbol

<Programming example>
Store
Stores the current operation result (before the ST instruction) in “OUTPUT.”

ST OUTPUT
ST
<Operation>
• When the data type of the operation result is BOOL type
Function

(1) Stores the current operation result into


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
OUTPUT 1
same as that of the operation result.
(4) When SPS is used, ANY_DATE type
(DATE type, DT type, TOD type) cannot be • When the data type of the operation result is INT type
used.
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
Name Symbol

<Programming example>
Store not
Stores the inverted boolean value of the current operation result
(before the STN instruction) in “OUTPUT.”

STN STN OUTPUT

(1) Stores the inverted value of the current <Operation>


Function

operation result in the address specified in • When the data type of the operation result is WORD type
the operand.
(2) Available data type is ANY_BIT type Operation result 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1
(BOOL type, WORD type, or DWORD type).
(3) The data type of the operand must be the
same as that of the operation result. INPUT2
1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0

2-7
2-2 IL Language IL language

(5) Set S
Name, Symbol, Function Example
Name Symbol

<Programming example>
Set
Sets the value of “OUTPUT” to “TRUE” if the value of “INPUT” is “TRUE.”

LD INPUT
S OUTPUT
S
<Operation>

Operation result TRUE FALSE “OUTPUT” remains 1


Function

(1) Sets the value of the address specified in


even when the value
the operand to “TRUE” if the current
of “INPUT” is changed
operation result is “TRUE.” The value in the
from 1 to 0.
address specified in the operand remains
unchanged if the current operation result is
“FALSE.”
(2) Available data type is BOOL type. OUTPUT TRUE TRUE

(6) Reset R
Name, Symbol, Function Example
Name Symbol

<Programming example>
Reset
Resets the value of “OUTPUT” which is set by “INPUT1” if the value
of “INPUT2” is 1.
LD INPUT1
S OUTPUT
R
LD INPUT2
R OUTPUT
Function

(1) Resets the value of the address specified


in the operand to “FALSE” if the current <Operation>
operation result is “TRUE.” The value in
the address specified in the operand Operation result TRUE
remains unchanged if the current operation
result is “FALSE.”
(2) Available data type is BOOL type.

OUTPUT FALSE

2-8
IL language 2-2 IL Language

(7) Logical product AND


Name, Symbol, Function Example
Name Symbol

<Programming example>
Logical product
Masks the highest-order 2 digits of “INPUT” and sets the result to the
operation result.

LD INPUT
AND AND WORD#16#00FF

(1) Operates the logical product of the current <Operation>


Function

operation result and the operand value, and


INPUT 1 1 0 0 0 1 0 0 1 0 0 1 1 1 0 1
sets the result to the operation result.
(2) Available data type is ANY_BIT type AND
(BOOL type, WORD type, or DWORD type).
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
Name

<Programming example>
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
Symbol

to the operation result.


AND( LD MASK
AND( INPUT1
OR INPUT2
)
Function

(1) Operates the logical product of the current


operation result and the operation result
specified in parentheses, and sets the result
to the operation result. <Operation>
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). 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-9
2-2 IL Language IL language

(9) Logical inverted product ANDN


Name, Symbol, Function Example
Name Symbol

Logical inverted product <Programming example>


Operates the logical product of the “INPUT” data and the inverted value
of the “MASK,” and sets the result to the operation result.

LD INPUT
ANDN ANDN MASK

(1) Operates the logical product of the current <Operation>


Function

operation result and the inverted value of


MASK 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
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). 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
Name

<Programming example>
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,”
Symbol

and sets the result to the operation result.

ANDN( LD INPUT1
ANDN( INPUT2
AND INPUT3
)
Function

(1) Operates the logical product of the current


operation result and the inverted value of
the operand value, and sets the result to
the operation result. <Operation>
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). INPUT2 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0

AND

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-10
IL language 2-2 IL Language

(11) Logical add OR

Name, Symbol, Function Example


Name Symbol

<Programming example>
Logical add
Operates the logical add of the “INPUT1” data and the “INPUT2” data, and
sets the result to the operation result.

LD INPUT1
OR OR INPUT2

<Operation>
Function

(1) Operates the logical add of the current


operation result and the value specified in
the operand value, and sets the result to INPUT1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1
the operation result. OR
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). 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
Name

Logical add <Programming example>


Operates the logical add of the “INPUT1” data and the operation result
obtained by the logical product of the “INPUT2” data and the “INPUT3”
Symbol

data, and sets the result to the operation result.


OR(
LD INPUT1
OR( INPUT2
AND INPUT3
)
Function

(1) Operates the logical add of the current


operation result and the operation result
specified in parentheses, and sets the <Operation>
result to the operation result. 1 1 0 1 1 0 1 0 1 1 0 0 1 0 1 0
INPUT2
(2) Available data type is ANY_BIT type
INPUT3 AND
(BOOL type, WORD type, or DWORD type).
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-11
2-2 IL Language IL language

(13) Logical inverted add ORN


Name, Symbol, Function Example
Name

Logical inverted add <Programming example>


Operates the logical add of the “INPUT1” data and the inverted value of the
“INPUT2” data, and sets the result to the operation result.
Symbol

LD INPUT1
ORN
ORN INPUT2

<Operation>
Function

(1) Operates the logical add of the current


operation result and the inverted value of
the operand value, and sets the result to INPUT2 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
the operation result.
(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
Name

<Programming example>
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
Symbol

and the “INPUT3” data, and sets the result to the operation result.

ORN( LD INPUT1
ORN( INPUT2
AND INPUT3
)
Function

(1) Operates the logical add of the current


operation result and the inverted value of
the operation result specified in <Operation>
parentheses, and sets the result to the
operation result. INPUT2 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1

(2) Available data type is ANY_BIT type AND


(BOOL type, WORD type, or DWORD type).
INPUT3 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1

Inverted value 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-12
IL language 2-2 IL Language

(15) Exclusive OR XOR


Name, Symbol, Function Example
Name Symbol

<Programming example>
Exclusive OR
Operates the exclusive OR of the “INPUT1” data and the “INPUT2” data,
and sets the result to the operation result.

LD INPUT1
XOR XOR INPUT2
Function

(1) Operates the exclusive OR of the current


operation result and the operand value, <Operation>
and sets the result to the operation result.
INPUT1 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).

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


Name

<Programming example>
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.
Symbol

XOR( LD INPUT1
XOR( INPUT2
AND INPUT3
(1) Operates the exclusive OR of the current )
Function

operation result and the operation result


specified in parentheses, and sets the result <Operation>
to the operation result.
INPUT2 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1
(2) Available data type is ANY_BIT type
(BOOL type, WORD type, or DWORD type). 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-13
2-2 IL Language IL language

(17) Exclusive NOR XORN


Name, Symbol, Function Example
Name

<Programming example>
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.
Symbol

XORN LD INPUT1
XORN INPUT2
(1) Operates the exclusive NOR of the current
Function

operation result and the inverted value of


<Operation>
operand value, and sets the result to the
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
Name

<Programming example>
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
Symbol

and the “INPUT3” data, and sets the result to the operation result.
XORN(
LD INPUT1
XORN( INPUT2
(1) Operates the exclusive NOR of the current
Function

AND INPUT3
operation result and the inverted value of )
the operation result specified in
parentheses, and sets the result to the
operation result. <Operation>
(2) Available data type is ANY_BIT type
(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-14
IL language 2-2 IL Language

(19) Addition ADD


Name, Symbol, Function Example
Name Symbol Function

Addition <Programming example>


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 • When the result of operation exceeds the valid value range
or UDINT type). Operation
(4) ENO is set to 0 if the result of operation 32767 + 32767 -2
exceeds the valid value range of the EN= 1 ENO= 0
operands (only for SPH).
Operation
-32768 + -32768 0
Note: 1) The CPU performs no boundary processing
when the operation result of operand types EN= 1 ENO= 0
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 Note: 2) When SPS is used, no boundary processing is performed even when the
processing for REAL operands. operation result exceeds the valid range of all the data types used.

(20) Addition ADD(

Name, Symbol, Function Example


Name Symbol Function

<Programming example>
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 parentheses
(REAL type, INT type, DINT type, UINT type +
1234 5678 6912
or UDINT type). Operation
EN=1 ENO=1
(4) ENO is set to 0 if the result of operation
exceeds the valid value range of the • When the result of execution exceeds the valid value range
operands (only for SPH). Operation
32767 + 32767 -2
EN=1 ENO=0
Operation
-32768 + -32768 0
Note: 1) The CPU performs no boundary processing EN=1 ENO=0
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 Note: 2) When SPS is used, no boundary processing is performed even when the
processing for REAL operands. operation result exceeds the valid range of all the data types used.

2-15
2-2 IL Language IL language

(21) Subtraction SUB


Name, Symbol, Function Example
Name Symbol Function

Subtraction <Programming example>


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
sets the result to the operation result. • When the result of execution falls within the valid value range
(2) The data type of the operands must be the Current operation SDATA Operation result
same. result Operation
(3) Available data type is ANY_NUM type
5678 - 1234 4444
(REAL type, INT type, DINT type, UINT type
or UDINT type). EN=1 ENO=1
(4) ENO is set to 0 if the result of operation • When the result of execution exceeds the valid value range
exceeds the valid value range of the Operation
operands (only for SPH). -32768 - 50 32718
(5) For REAL type data, when the operation EN=1 ENO=0
results approaches 0 (zero) and cannot be
expressed by REAL type, output value and Note: 1) The CPU performs no boundary processing when the operation result of
EN0 become “0” and “1,” respectively (only operand types other than REAL exceeds the valid value range of the
for SPH). 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) When SPS is used, no boundary processing is performed even when the
operation result exceeds the valid range of all the data types used.

(22) Subtraction SUB(


Name, Symbol, Function Example
Name Symbol Function

<Programming example>
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
to the operation result. <Operation> Example of INT type data
(2) The data type of the operands must be the
same. • When the result of execution falls within the valid value range
(3) Available data type is ANY_NUM type Current operation Result of operation Operation result
(REAL type, INT type, DINT type, UINT type result specified in parentheses
or UDINT type). Operation
(4) ENO is set to 0 if the result of operation 5678 - 1234 4444
exceeds the valid value range of the EN=1 ENO=1
operands (only for SPH).
(5) For REAL type data, when the operation • When the result of execution exceeds the valid value range
Operation
results approaches 0 (zero) and cannot be
expressed by REAL type, output value and -32768 - 50 32718
EN=1 ENO=0
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) When SPS is used, no boundary processing is performed even when the
operation result exceeds the valid range of all the data types used.

2-16
IL language 2-2 IL Language

(23) Multiplication MUL


Name, Symbol, Function Example
Name Symbol

Multiplication <Programming example>


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
Function

operation result and the operand value, and


sets the result to the operation result. <Operation> Example of INT type data
(2) The data type of the operands must be the
same. • When the result of operation falls within the valid value range
(3) When the operation result exceeds the Current operation MDATA Operation result
boundary value of the data type, it is result
treated as follows: Operation
SPH: The boundary value of the data type 222 x 10 2220
is regarded as the operation result, and EN=1 ENO=1
EN0 is set to “0.”
SPS: No boundary processing is performed. • When the result of operation exceeds the valid value range
(4) Available data type is ANY_NUM type Operation
(REAL type, INT type, DINT type, UINT type 32767 x 32767 32767
or UDINT type). EN=1 ENO=0
(5) For REAL type data, when the operation
results approaches 0 (zero) and cannot be Operation
expressed by REAL type, output value and -32768 x 32767 -32768
EN0 become “0” and “1,” respectively (only EN=1 ENO=0
for SPH). Note: When SPS is used, no boundary processing is performed even when the
operation result exceeds the valid range of the data type.

(24) Multiplication MUL(


Name, Symbol, Function Example
Name Symbol

<Programming example>
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
)
Function

(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.
(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 specified in
result
boundary value of the data type, it is parentheses Operation
treated as follows:
222 x 10 2220
SPH: The boundary value of the data type
is regarded as the operation result, and EN=1 ENO=1
EN0 is set to “0.”
• When the result of operation exceeds the valid value range
SPS: No boundary processing is performed. Operation
(4) Available data type is ANY_NUM type
32767 x 32767 32767
(REAL type, INT type, DINT type, UINT type
or UDINT type). EN=1 ENO=0
(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 (only
for SPH). Note: When SPS is used, no boundary processing is performed even when the
operation result exceeds the valid range of the data type.

2-17
2-2 IL Language IL language

(25) Division DIV


Name, Symbol, Function Example
Name

<Programming example>
Division Operates the division of the current operation result by the “DDATA”
data, and sets the result to the operation result.
Symbol

DIV DIV DDATA

(1) Operates the division of the current


Function

<Operation> Example of INT type data


operation result by the operand value, and
sets the 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 DDATA Operation result
same.
result Operation
(3) When the operation result exceeds the
boundary value of the data type, it is 3940 ÷ 5 788
treated as follows: EN= 1 ENO= 1
SPH: The boundary value of the data type
• When the divisor is 0
is regarded as the operation result, and Operation
EN0 is set to “0.” 3940 ÷ 0 32767
SPS: No boundary processing is performed. EN= 1 ENO= 0
(4) Available data type is ANY_NUM type
(REAL type, INT type, DINT type, UINT type
or UDINT type).
(5) When SPH is used, if the divisor is 0, the
maximum absolute value with the sign of
the dividend is generated and ENO is set to
0.
(6) When SPS is used, SPS stops if divisor is 0 (zero) and data type is other than REAL. If data type is REAL, “-NAN” or
“INF” is output.

(26) Division DIV(


Name, Symbol, Function Example
<Programming example>
Name Symbol

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
ADD INPUT2
Function

(1) Operates the division of the current


)
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
same.
• When the result of operation falls within the valid value range
(3) When the operation result exceeds the
boundary value of the data type, it is Current operation Result of operation Operation result
treated as follows: result specified
SPH: The boundary value of the data type in parentheses
Operation
is regarded as the operation result, and
3940 ÷ 5 788
EN0 is set to “0.”
SPS: No boundary processing is performed. EN= 1 ENO= 1
• When the divisor is 0
(4) Available data type is ANY_NUM type
(REAL type, INT type, DINT type, UINT type Operation
or UDINT type). 3940 ÷ 0 32767
(5) If the divisor is 0, the maximum absolute
value with the sign of the dividend is EN= 1 ENO= 0

generated and ENO is set to 0.


(6) When SPS is used, SPS stops if divisor is 0
(zero) and data type is other than REAL. If
data type is REAL, “-NAN” or “INF” is output.

2-18
IL language 2-2 IL Language

(27) Comparison GT
Name, Symbol, Function Example
Name

<Programming example>
Comparison
Operates the comparison (>) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the operation
Symbol

result.
GT
GT NDATA
(1) Operates the comparison of the current
Function

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).
Operation
(3) The data type of the operands must be the
1234 > 1234 FALSE
same.
(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).

Note: When SPS is used, neither BOOL type,


ANY_DATE type nor STRING type can be
used.

(28) Comparison GT(


Name, Symbol, Function Example
Name

Comparison <Programming example>


Operates the comparison (>) of the current operation result with the
sum of the “INPUT1” value and the “INPUT2” value, and sets the result
Symbol

(TRUE or FALSE) to the operation result.


GT(
GT( INPUT1
(1) Operates the comparison of the current ADD INPUT2
Function

)
operation result as the left-hand side of the
“>” operator with the operation result
specified in parentheses as the right-hand
<Operation> Example of INT type data
side, and sets the result to the operation
result.
(2) The type of the operation result is BOOL Current operation Result of operation Operation result
(TRUE or FALSE). result specified
(3) The data type of the operands must be the in parentheses
Operation
same. 1234 > 1111 TRUE
(4) Available data types are ANY_NUM type
(REAL type, INT type, DINT type, UINT Operation
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).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

2-19
2-2 IL Language IL language

(29) Comparison GE
Name, Symbol, Function Example
Name

<Programming example>
Comparison
Operates the comparison (≥) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the operation
Symbol

result.
GE
GE NDATA
(1) Operates the comparison of the current
Function

operation result as the left-hand side of the


<Operation> Example of INT type data
“≥” operator with the operand value as the
right-hand side, and sets the result to the
operation result. Current operation NDATA Operation result
(2) The type of the operation result is BOOL result Operation
(TRUE or FALSE). 1234 ≥ 1111 TRUE
(3) The data type of the operands must be the Operation
same. ≥
1234 1234 TRUE
(4) Available data types are ANY_NUM type
(REAL type, INT type, DINT type, UINT type, Operation
or UDINT type), ANY_BIT type (BOOL type, 1234 ≥ 2000 FALSE
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).

Note: When SPS is used, neither BOOL type,


ANY_DATE type nor STRING type can be
used.

(30) Comparison GE(


Name, Symbol, Function Example
Name Symbol

<Programming example>
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(

(1) Operates the comparison of the current GE( INPUT1


Function

operation result as the left-hand side of the ADD INPUT2


“≥” 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
1234 ≥ 1111 TRUE
same.
(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).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

2-20
IL language 2-2 IL Language

(31) Comparison EQ
Name, Symbol, Function Example
Name Symbol

Comparison <Programming example>


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
Function

(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
operation result. Current operation Operation result
(2) The type of the operation result is BOOL result Operation
(TRUE or FALSE). 1234 = 1111 FALSE
(3) The data type of the operands must be the
same. Operation
1234 = 1234 TRUE
(4) Available data types are ANY_NUM type
(REAL type, INT type, DINT type, UINT type, Operation
or UDINT type), ANY_BIT type (BOOL type, 1234 = 2000 FALSE
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

(32) Comparison EQ(


Name, Symbol, Function Example
Name Symbol

Comparison <Programming example>


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
ADD INPUT2
Function

(1) Operates the comparison of the current


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
1234 = 1111 FALSE
same.
(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).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

2-21
2-2 IL Language IL language

(33) Comparison NE
Name, Symbol, Function Example
Name

Comparison <Programming example>


Operates the comparison (≠) of the current operation result with the
“NDATA” value, and sets the result (TRUE or FALSE) to the
Symbol

operation result.
NE
NE NDATA

(1) Operates the comparison of the current


Function

operation result as the left-hand side of the <Operation> Example of INT type data
“≠” operator with the operand value as the
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).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

(34) Comparison NE(


Name, Symbol, Function Example
Name Symbol

<Programming example>
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
Function

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.
(2) The type of the operation result is BOOL Current operation Result of operation Operation result
(TRUE or FALSE). result specified in
(3) The data type of the operands must be the parentheses Operation
same. ≠
1234 1111 TRUE
(4) Available data types are ANY_NUM type
(REAL type, INT type, DINT type, UINT type, Operation
or UDINT type), ANY_BIT type (BOOL type, 1234 ≠ 1234 FALSE
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).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

2-22
IL language 2-2 IL Language

(35) Comparison LE
Name, Symbol, Function Example
Name Symbol

<Programming example>
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
Function

operation result as the left-hand side of the


<Operation> Example of INT type data
“≤” operator with the operand value as the
right-hand side, and sets the result to the
operation result. Current operation NDATA Operation result
(2) The type of the operation result is BOOL result Operation
(TRUE or FALSE). 1234 ≤ 1111 FALSE
(3) The data type of the operands must be the
Operation
same.
1234 ≤ 1234 TRUE
(4) Available data types are ANY_NUM type
(REAL type, INT type, DINT type, UINT type, Operation
or UDINT type), ANY_BIT type (BOOL type, 1234 ≤ 2000 TRUE
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).

Note: When SPS is used, neither BOOL type,


ANY_DATE type nor STRING type can be
used.

(36) Comparison LE(

Name, Symbol, Function Example


Name Symbol

<Programming example>
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
ADD INPUT2
(1) Operates the comparison of the current
Function

)
operation result as the left-hand side of the
“≤” operator with the operation result
specified in parentheses as the right-hand
<Operation> Example of INT type data
side, and sets the result to the 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 Operation
(3) The data type of the operands must be the ≤
1234 1111 FALSE
same.
(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,
Operation
WORD type, or DWORD type), ANY_DATE
1234 ≤ 2000 TRUE
type (DT type, DATE type, or TOD type),
and TIME type (STRING type cannot be
used).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

2-23
2-2 IL Language IL language

(37) Comparison LT
Name, Symbol, Function Example
Name Symbol Function

Comparison <Programming example>


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
operation result. Current operation NDATA Operationresult
(2) The type of the operation result is BOOL result Operation
(TRUE or FALSE). 1234 < 1111 FALSE
(3) The data type of the operands must be the
same. Operation
(4) Available data types are ANY_NUM type 1234 < 1234 FALSE
(REAL type, INT type, DINT type, UINT Operation
type, or UDINT type), ANY_BIT type 1234 < 2000 TRUE
(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).
Note: When SPS is used, neither BOOL type,
ANY_DATE type nor STRING type can be
used.

(38) Comparison LT(


Name, Symbol, Function Example
Name Symbol

<Programming example>
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(

(1) Operates the comparison of the current LT( INPUT1


Function

operation result as the left-hand side of the ADD INPUT2


“<” operator with the operation result )
specified in parentheses as the
right-hand side, and sets the result to the
operation result. <Operation> Example of INT type data
(2) The type of the operation result is BOOL Current operation Result of operation Operation result
(TRUE or FALSE). result specified in
(3) The data type of the operands must be the parentheses
same. Operation
(4) Available data types are ANY_NUM type 1234 < 1111 FALSE
(REAL type, INT type, DINT type, UINT type,
Operation
or UDINT type), ANY_BIT type (BOOL type,
1234 < 1234 FALSE
WORD type, or DWORD type), ANY_DATE
type (DT type, DATE type, or TOD type), Operation
and TIME type (STRING type cannot be 1234 < 2000 TRUE
used).

Note: When SPS is used, neither ANY_DATE type


nor STRING type can be used.

2-24
IL language

(39) Unconditional jump JMP


Name, Symbol, Function Example
Name

<Programming example>
Unconditional jump
Jumps unconditionally from “JMP END” to the instruction that is labeled
“END.”
Symbol

JMP
Common
(1) Jumps to the step specified by the label of processing
Function

the operand. The instructions following the block


JMP instruction are not executed. JMPC ERROR_1

Processing 1

JMP END

ERROR_1: Processing 2

END:

(40) TRUE conditional jump JMPC


Name, Symbol, Function Example
Name

<Programming example>
TRUE conditional jump
Jumps from “JMPC ERROR” to the instruction that is labeled
“ERROR” if either “INPUT1” or “INPUT2” is TRUE.
Symbol

JMPC Note: “INPUT1” and “INPUT2” are


LD INPUT1 assumed to be BOOL type.
TRUE OR INPUT2
Function

(1) Jumps to the step specified by the label of JMPC ERROR


the operand when the current operation
result is TRUE. The instruction following
this instruction is executed if the current ST OUTPUT
operation result is FALSE. AND XP4

ERROR:
LD FLAG
ST STATE

2-25
2-2 IL Language IL language

(41) FALSE conditional jump JMPCN


Name, Symbol, Function Example
Name Symbol

FALSE conditional jump <Programming example>


Jumps from “JMPCN ERROR” to the instruction that is labeled “ERROR”
if either “INPUT1” or “INPUT2” is FALSE.

LD INPUT1
JMPCN
AND INPUT2
FALSE
JMPCN ERROR
ST OUTPUT
ERROR:
Function

(1) Jumps to the step specified by the label of


the operand when the current operation LD FLAG
ST STATE
result is FALSE. The instruction following
this instruction is executed if the current
operation result is TRUE.
Note: When SPS is used, only LD, CAL, JMP or RET instruction can be used just
after a label.

(42) Unconditional call CAL


Name, Symbol, Functioninsert figure Example
Name Symbol

<Programming example>
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
from the output terminal is required after the CAL instruction.
CAL
LD INPUT1
Call FB_1
ST FB_1.IN1
LD INPUT2 FB
Function

(1) Calls unconditionally the function block


specified in the operand. ST FB_1.IN2 IN1
CAL FB_1 OUT1
LD FB_1.OUT1 IN2
ST OUTPUT1

2-26
IL language 2-2 IL Language

(43) TRUE conditional call CALC


Name, Symbol, Function Example
Name

<Programming example>
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
Symbol

before the CAL instruction, and an instruction that receives a parameter


from the output terminal is required after the CAL instruction.
CALC
LD INPUT1
ST FB_1.IN1
Call FB_1
LD INPUT2
Function

(1) Calls the function block specified in the


operand if the current operation result is ST FB_1.IN2 FB

TRUE. LD FBCALL IN1


CALC FB_1 OUT1
If the current operation result is FALSE, IN2
the function block is not called and the next LD FB_1.OUT1
sequential instruction is executed. ST OUTPUT1

(44) FALSE conditional call CALCN


Name, Symbol, Function Example
Name Symbol

<Programming example>
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
terminal is required after the CAL instruction.
CALCN
LD INPUT1
ST FB_1.IN1
Call FB_1
LD INPUT2
Function

(1) Calls the function block specified in the


operand if the current operation result is ST FB_1.IN2 FB

FALSE. LD FBCALL IN1


OUT1
If the current operation result is TRUE, the CALCN FB_1
IN2
function block is not called and the next LD FB_1.OUT1
sequential instruction is executed. ST OUTPUT1

2-27
2-2 IL Language IL language

(45) Unconditional return RET


Name, Symbol, Function Example
Name Symbol

Unconditional return <Programming example>

LD INPUT1 User-supplied function block


AND PSWICH
RET ST IN2

LD OUT1
Function

(1) Returns unconditionally to the instruction ST OUTPUT1


immediately following the instruction that RET
called the current program (e.g., CAL).

(46) TRUE conditional return RETC


Name, Symbol, Function Example
Name Symbol

<Programming example>
TRUE conditional return

LD INPUT1
AND PSWICH
RETC ST IN2 User-supplied function block

LD OUT1
Function

(1) Returns unconditionally to the instruction


immediately following the instruction that ST OUTPUT1
called the current program (e.g., CAL) if the AND FLAG7
current operation result is TRUE. RETC
The next sequential instruction is executed LD INPUT2
if the current operation result is FALSE.

RET

2-28
IL language 2-2 IL Language

(47) FALSE conditional return RETCN


Name, Symbol, Function Example
Name Symbol

<Programming example>
FALSE conditional return

LD INPUT1
AND PSWICH
RETCN User-supplied function block
ST IN2

LD OUT1
Function

(1) Returns unconditionally to the instruction


immediately following the instruction that ST OUTPUT1
called the current program (e.g., CAL) if the AND FLAG7
current operation result is FALSE. RETCN
The next sequential instruction is executed LD INPUT2
if the current operation result is TRUE.
RET

2-29
2-3 ST Language ST language

The ST language consists of operators and statements. program execution and the flow of program control.
Operators perform basic operations such as arithmetic or ST language is a structured text language that is composed
comparison operations. Statements specify the sequence of of a combination of these operators and statements.

<Examples of ST language>

Comment
A comment begins with “(*”and ends
with“*).”

*: Statements, conditional expressions, and executable statements must be separated by at least one space character.

Statement Statement A control statement, which is made up of


statements, conditional expressions, and
Conditional expression Executable statement executable statements, is terminated by
A conditional expression An executable statement a semicolon (“;”).
consists of variables, an consists of variables,
operator (e.g., >), and operators, and an
immediate values. assignment statement.

2-3-1 ST operators
Sample
No. Operation Operator Data Type Description Precedence
Value
1 Parentheses (expression) (2+3)*(4+5) 45 Highest
2 Function Function name LN(A)
(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
5 Logical not NOT BOOL, WORD, DWORD Logical NOT of 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
11 Comparison <, >, <=, >= Elementary (excluding STRING 4>12 FALSE
type)
12 Equality = Elementary (excluding STRING T#26h =T#1d2h TRUE
type)
13 Inequality <> Elementary (excluding STRING 8<>16 TRUE
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-30
ST language 2-3 ST Language

2-3-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-31
on the left-hand side.
Condition.
IF P2-32
Executes the executable statement if the conditional expression is true.
Condition.
CASE Selects the executable statement to be executed according to the value of the conditional P2-33
expression.
Iteration statement.
FOR Repeatedly executes the executable statement according to the initial value, final value, and P2-34
incremental or decremental value.
Iteration statement.
WHILE P2-35
Repeatedly executes the executable statement while the loop condition is true.
Iteration statement.
REPEAT P2-35
Repeatedly executes the executable statement until the loop condition is true.
Return statement.
RETURN P2-36
Returns control from the called function or function block to the calling POU.
Exit statement.
EXIT P2-36
Used to exit an iteration loop.

2-3-3 ST language statements


(1) Assignment statement (:=)
Name, Symbol, Function Example
Name Symbol

<Statement construction>
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;
• Assigning numeric value 52 to v
Function

(1) The expression on the right-hand side v := 52;


consists of operands, and instructions. • Assigning the value of m to v.
The operands may be characters, variables, v := m;
function calls, or other expressions.
(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-31
2-3 ST Language ST language

(2) IF statement
Name, Symbol, Function Example
Name Symbol

<Statement constructions>
IF statement
(1) IF, THEN construction

IF <conditional expression> THEN <executable statement>;


END_IF;
IF
The executable statement is executed
Conditional False
when the conditional expression
expression evaluates to be true.
True
Nothing is executed if the conditional
Function

(1) The executable statement is executed if the expression evaluates to be false. Executable
statement
conditional expression evaluates to be true.
(2) The conditional expression can contain only (2) IF, ELSE construction
the data that evaluates to BOOL type data.
(3) An IF statement must always be paired with IF <conditional expression> THEN <executable statement 1>;
an END_IF statement. ELSE <executable statement 2>;
(4) A single conditional expression may have END_IF;
two or more executable statements.
(5) The conditional expression may be a The executable statement 1 is executed
variable of type BOOL. when the conditional expression Conditional
False
(6) Up to eight levels of nesting are allowed. evaluates to be true.
expression

Even the FOR and CASE statements in the The executable statement 2 is executed True
IF statement are counted in the nesting when the conditional Executable Executable
depth. expression evaluates to be false. statement 1 statement 2

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

False
Conditional
expression 1
Conditional False
True expression 2
Executable False
statement 1 Conditional
True expression 3
Executable
statement 2 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-32
ST language 2-3 ST Language

(3) CASE statement


Name, Symbol, Function Example
Name

<Statement construction>
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;
Function

(1) The executable statement to be executed is YES


Selection
selected according to the value is executed value 1 ?
if the conditional expression evaluates to be
NO
true. Executable
YES statement 1
(2) Only INT type data is allowed for the Selection
value 2 ?
conditional expression and selection values.
(3) A CASE statement must always be paired NO
Executable
with OF and END_CASE statements. statement 2
(4) A single conditional expression may have
two or more executable statements. YES
Selection
(5) Up to eight levels of nesting are allowed. value m ?
Even the IF and FOR statements in the
NO
CASE statement are counted in the nesting
Executable Executable
depth. statement n statement m
(6) An enum type (example, 1,2,2,...) or range
type (example, 1..10) may be used for the
selection values. <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-33
2-3 ST Language ST language

(4) FOR statement


Name, Symbol, Function Example
Name

<Statement construction>
FOR statement
FOR <a:=initial value> TO <final value> BY <incremental value> DO
Symbol

<executable statement>
END FOR;
FOR

Loop variable (initial value)


Function

(1) The FOR statement performs loop


processing. The loop conditions are given
Loop variable
by the initial value, final value, and ≥final value
True
incremental value.
(2) The type of data that can be used as the False
initial value, final value, and incremental Executable statement
value is ANY_INT type
Loop variable +
(INT, DINT, UNIT, or UDINT). incremental value
(3) A FOR statement must always be paired
with TO, BY, DO, and END_FOR
statements.
(4) Up to eight levels of nesting are allowed.
Even the IF and CASE statements in the <Programming example>
FOR statement are counted in the nesting The sample program shown below assigns the value of b to array f at
depth. 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-34
ST language 2-3 ST Language

(5) WHILE statement


Name, Symbol, Function Example
Name

<Statement construction>
WHILE statement
WHILE <loop condition> DO
Symbol

<executable statement>;
END_WHILE;
WHILE
Loop False
conditional
expression
Function

(1) The WHILE statement performs loop True


processing. It executes the executable Executable statement
statement while its loop condition evaluates
to be true.
(2) A WHILE statement must always be paired
with DO and END_WHILE statements. <Programming example>
The sample program shown below divides the value of b by 2 while
Note) If a repeat condition has been false b > 1 and assigns the result (quotient) to b. The fractional part of the
before the loop processing is executed, quotient is truncated b.
no Execution statement is processed.
a:=1;
WHILE b>1 DO
b:=b/2;
f[a]:=b;
a:=a+1;
END_WHILE;

(6) REPEAT statement

Name, Symbol, Function Example


Name Symbol

<Statement construction>
REPEAT statement
REPEAT
<executable statement>;
UNTIL <final condition>
REPEAT END_REPEAT;
Function

(1) The REPEAT statement performs loop Executable statement


processing. It executes the executable
statement until its loop condition evaluates
to be true. Final condition False
(2) A REPEAT statement must always be expression
paired with UNTIL and END_REPEAT True
statements.

Note) Even if the value for a final condition <Programming example>


has been true before the loop The sample program shown below computes a sum of numbers from
processing is executed, the execution 1 to 10.
statement is always processed more
than one time. a:=1;
total:=0;
REPEAT
total:=total+a;
a:=a+1;
UNTIL a >10
END_REPEAT;

2-35
2-3 ST Language ST language

(7) RETURN statement

Name, Symbol, Function Example


Name Symbol

<Statement construction>
RETURN statement RETURN;

<Programming example>
When returning control to the user function “FUNCT”
RETURN
FUNCT
BOOL IN INT
Function of <FUNCT>
FUNCT returns 500 if IN is true
Function

(1) The RETURN statement returns control


from a user function or usr function block to and 100 if IN is false.
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


Name Symbol

<Statement construction>
EXIT statement
EXIT;

<Programming examples>
The sample program shown below exits the loop when M + N
EXIT becomes greater than 20 where M is the initial value.

(* Exiting from a FOR loop *)


FOR N:=1 TO 10 BY 1 DO
M:=M+N ;
Function

(1) The EXIT statement terminates processing IF M > 20 THEN EXIT ;


and returns control to the statement END_IF ;
immediately following the loop construction END_FOR ;
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-36
LD language 2-4 LD Language

LD language is a graphical language that consists of applications where timers, counters, and applications
contacts and coils that are connected to two vertical bus instructions are to be used.
lines. LD language are used with FBD language in
<Examples of LD language>

Circuit number Comment


Specifies the order in which Comments may appear in any location
the circuit is to be on the worksheet.
processed.

Note: 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-4-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 name” 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
2-4 LD Language LD language

2-4-2 LD language instructions


(1) Normal open contact (NO contact), normal close contact (NC contact), and coil
Name, Symbol, Function Example
Name Symbol

<Programming example>
NO contact, NC contact, coil
Variable representation example

Variable name Variable name

NO contact NC contact coil SW1 SW2 SW3 LAMP

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 column
contacts that can be assigned to the same directions.
address.
(3) Available data type is BOOL type.

(2) Inverted coil

Name, Symbol, Function Example


Name

<Programming example>
Inverted coil

SW1 SW2 SW3 SW4 SW5 FLAG


Symbol

Equivalent
Function

(1) The inverted coil generates the inverted


SW1 FLAG
value of a boolean object.

SW2

SW3

SW4

SW5

The upper and lower circuits are equivalent.

2-38
LD language 2-4 LD Language

(3) Set coil, reset coil


Name, Symbol, Function Example
Name Symbol

<Programming examples>
Set coil, reset coil
• Reset-prioritized circuit

Timing chart
SW1
SW1 LAMP1
S R S
SW2
SW2 LAMP1
R
LAMP1
Function

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


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

(4) Connector
Name, Symbol, Function Example
Name Symbol

<Programming examples>
Connector
• The sample circuit shown below assumes that the source is connected to
the destination.

Output connector Input connector


“connector “connector ABC
name” name”

Connect to Connect from


“connector name” “connector name”

(1) Connectors substitute lines. The output


Function

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

Note: Connectors must be described so that XYZ


they are completed on a single work
sheet. XYZ

2-39
2-4 LD Language LD language

(5) Jump

Name, Symbol, Function Example


Name Symbol

<Programming example>
Jump
001

Jump destination label


(jump source)

010
Condition 1
Jump destination label : Processing 1
(jump destination)

(1) The jump instruction transfers control from 011


Function

the jump source to the jump destination.


(2) The label name of the jump destination can
be up to 30 1-byte characters
(or 15 2-byte 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 Symbol

Return

Programming processing
RETURN
Function

(1) The return instruction returns control from


a user function or user function block to the
calling POU.

RETURN

2-40
FBD language 2-5 FBD Language

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

Comment
Comments may appear in any location
on the worksheet.

Note: 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
2-5 FBD Language

2-5-1 Function summary


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

(1) Symbols used in the function summary

Instruction Symbol Name No. of steps Page


Input data type Output data type

REAL SQRT REAL


Square root SQRT 3 2-
Function name

STRING LEFT STRING


Get left sub-string LEFT 10 2-
UINT

SEL_INT
BOOL G INT
INT IN0 Select SEL_INT 8 2-
INT IN1

Some functions use


terminal names.

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

Data type of the nth input ANY_NUM

Note: 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-42
2-5 FBD Language

(2) Describing a function in the IL language


To describe a function call in the IL language, specify, as the the function call instruction (function name) that specifies the
first input, the current operation result and, as the operator, second and subsequent inputs as operands.
1) 1-input function 3) 3-input function
LD “Input” LD “First input”
SQRT SEL “Second input,” “Third input”
ST “Area for storing operation result" ST “Area for storing operation result”

2) 2-input function
LD “First input”
LEFT “Second 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>

LD IN1
ADD
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 3) 3-input function


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

2-43
2-5 FBD Language

(4) Specification of enable flags (EN/ENO) (only for SPH)


In D300win V2.0 or later, the start operation terminal EN graphic language.
and result terminal ENO can be used for the functions in the
<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 or FALSE value for the operation is output to the ENO
EN terminal. When the variable associated with the EN terminal. When ENO is TRUE (“1”), the operation has been
terminal is TRUE (“1”), arithmetical operations are executed, normally done and when FALSE (“0”), an error has occurred
while when FALSE (“0”), they are not performed. (In the in the operation.
above example, an OUT value remains unchanged.) A TRUE
Note: Refer to the descriptions of functions, for EN/ENO behavior.

<Enabling/disabling EN/ENO>
Execute the “Option” command shown in the D300win left-mouse button, since any function added is shown with
extended menu. The “Options” dialog box appears. Click the EN/ENO enabled on a worksheet. To disable EN/ENO, use
“Graphic Editor” tab with the left-mouse button, check the the same procedure.
EN/ENO function, and double-click the “OK” button with the

Checking here enables EN/ENO for the function newly


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

2-44
2-5 FBD Language

<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/ 3) When a variable is associated only with the ENO
ENO terminals, the number of steps increases by terminal, the number of steps increases by two.
three. ADD
ADD EN ENO FLAG
START EN ENO FLAG IN1 OUT
IN1 OUT IN2
IN2

2) When a variable is associated only with the EN 4) When a variable is associated with neither the EN
terminal, the number of steps increases by two. nor ENO terminal, the number of steps is the
ADD same as with EN/ENO disabled.
START EN ENO ADD
IN1 OUT EN ENO

IN2 IN1 OUT

IN2

<LI language when any function with EN/ENO enabled is


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

LDE START
ADD ADD
START EN ENO FLAG LD INPUT1 START EN ENO FLAG

IN1 OUT ADD INPUT2 IN1 OUT

IN2 Upload IL-LD/FBD IN2


ST OUT conversion
STE FLAG

Note: To upload functions in D300win V2, connect both of the EN/ENO terminals.

2-45
2-5 FBD Language

<Considerations in using functions with EN/ENO enabled>


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

EN1 MOVE User function


EN ENO
S1 S2

2) Using programs and user function blocks


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

MOVE MOVE
B EN ENO EN ENO
C
S3 S4

MOVE
When B is set to "OFF," unchanged.
EN ENO

S5

<Action 1> Connect EN/ENO.

MOVE MOVE
B EN ENO EN ENO

S3 S4

MOVE
When B is set to "OFF," unchanged.
EN ENO

S5

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

MOVE MOVE
B EN ENO EN ENO

S3 S30 S30 S4

MOVE
When B is set to "OFF," unchanged.
EN ENO

S30 S5

2-46
Type conversion FCT 2-5 FBD Language

(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 Symbol Name No. of steps Page

DINT DINT_TO_INT INT Type conversion DINT_TO _INT 3 P2-76

UINT UINT_TO_INT INT Type conversion UINT_TO _INT 3 P2-76

UDINT UDINT_TO_INT INT Type conversion UDINT_TO _INT 3 P2-77

REAL REAL_TO_INT INT Type conversion REAL_TO _INT 3 P2-77

TIME TIME_TO_INT INT Type conversion TIME_TO _INT 3 P2-78

WORD WORD_TO_INT INT Type conversion WORD_TO _INT 3 P2-78

INT INT_TO_DINT DINT Type conversion INT_TO _DINT 3 P2-79

UINT UINT_TO_DINT DINT Type conversion UINT_TO _DINT 3 P2-79

UDINT UDINT_TO_DINT DINT Type conversion UDINT_TO _DINT 3 P2-80

REAL REAL_TO_DINT DINT Type conversion REAL_TO _DINT 3 P2-80

TIME TIME_TO_DINT DINT Type conversion TIME_TO _DINT 3 P2-81

DWORD DWORD_TO_DINT DINT Type conversion DWORD_TO _DINT 3 P2-81

2-47
2-5 FBD Language Type conversion FCT

Instruction Symbol Name No. of steps Page

INT INT_TO_UINT UINT Type conversion INT_TO _UINT 3 P2-82

DINT DINT_TO_UINT UINT Type conversion DINT_TO _UINT 3 P2-82

UDINT UDINT_TO_UINT UINT Type conversion UDINT_TO _UINT 3 P2-83

REAL REAL_TO_UINT UINT Type conversion REAL_TO _UINT 3 P2-83

TIME TIME_TO_UINT UINT Type conversion TIME_TO _UINT 3 P2-84

WORD WORD_TO_UINT UINT Type conversion WORD_TO _UINT 3 P2-84

INT INT_TO_UDINT UDINT Type conversion INT_TO _UDINT 3 P2-85

DINT DINT_TO_UDINT UDINT Type conversion DINT_TO _UDINT 3 P2-85

UINT UINT_TO_UDINT UDINT Type conversion UINT_TO _UDINT 3 P2-86

REAL REAL_TO_UDINT UDINT Type conversion REAL_TO _UDINT 3 P2-86

TIME TIME_TO_UDINT UDINT Type conversion TIME_TO _UDINT 3 P2-87

DWORD DWORD_TO_UDINT UDINT Type conversion DWORD_TO _UDINT 3 P2-87

DT DT_TO_UDINT UDINT Type conversion DT_TO _UDINT 3 P2-88


Note: These functions are not supported in SPS.

DATE DATE_TO_UDINT UDINT Type conversion DATE_TO _UDINT 3 P2-88


Note: These functions are not supported in SPS.

TOD TOD_TO_UDINT UDINT


Type conversion TOD_TO _UDINT 3 P2-89
Note: These functions are not supported in SPS.

INT INT_TO_REAL REAL


Type conversion INT_TO _REAL 3 P2-89

2-48
Type conversion FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

DINT DINT_TO_REAL REAL Type conversion DINT_TO _REAL 3 P2-90

UINT UINT_TO_REAL REAL Type conversion UINT_TO _REAL 3 P2-90

UDINT UDINT_TO_REAL REAL Type conversion UDINT_TO _REAL 3 P2-91

TIME TIME_TO_REAL REAL Type conversion TIME_TO _REAL 3 P2-91

WORD WORD_TO_BOOL BOOL Type conversion WORD_TO _BOOL 3 P2-92

DWORD DWORD_TO_BOOL BOOL Type conversion DWORD_TO _BOOL 3 P2-92

BOOL BOOL_TO_WORD WORD Type conversion BOOL_TO _WORD 3 P2-93

DWORD DWORD_TO_WORD WORD Type conversion DWORD_TO _WORD 3 P2-93

INT INT_TO_WORD WORD Type conversion INT_TO_WORD 3 P2-94

UINT UINT_TO_WORD WORD Type conversion UINT_TO_WORD 3 P2-94

BOOL BOOL_TO_DWORD DWORD Type conversion BOOL_TO _DWORD 3 P2-95

WORD WORD_TO_DWORD DWORD Type conversion WORD_TO _DWORD 3 P2-95

DINT DINT_TO_DWORD DWORD Type conversion DINT_TO _DWORD 3 P2-96

UDINT UDINT_TO_DWORD DWORD Type conversion UDINT_TO _DWORD 3 P2-96

INT INT_TO_TIME TIME Type conversion INT_TO _TIME 3 P2-97

DINT DINT_TO_TIME TIME Type conversion DINT_TO _TIME 3 P2-97

2-49
2-5 FBD Language Type conversion FCT

Instruction Symbol Name No. of steps Page

UINT UINT_TO_TIME TIME Type conversion UINT_TO _TIME 3 P2-98

UDINT UDINT_TO_TIME TIME Type conversion UDINT_TO _TIME 3 P2-98

REAL REAL_TO_TIME TIME Type conversion REAL_TO _TIME 3 P2-99

UDINT UDINT_TO_DT DT Type conversion UDINT_TO _DT 3 P2-99


Note: These functions are not supported in SPS.

UDINT UDINT_TO_DATE DATE Type conversion UDINT_TO _DATE 3 P2-100


Note: These functions are not supported in SPS.

UDINT UDINT_TO_TOD TOD Type conversion UDINT_TO _TOD 3 P2-100


Note: These functions are not supported in SPS.

REAL TRUNC_INT INT Truncation TRUNC_INT 3 P2-101

REAL TRUNC_DINT DINT Truncation TRUNC_DINT 3 P2-101

REAL TRUNC_UINT UINT Truncation TRUNC_UINT 3 P2-102

REAL TRUNC_UDINT UDINT Truncation TRUNC_UDINT 3 P2-102

WORD W_BCD_TO_INT INT BCD conversion W_BCD_TO _INT 3 P2-103

DWORD D_BCD_TO_INT INT BCD conversion D_BCD_TO _INT 3 P2-103

WORD W_BCD_TO_DINT DINT BCD conversion W_BCD_TO _DINT 3 P2-104

DWORD D_BCD_TO_DINT DINT BCD conversion D_BCD_TO _DINT 3 P2-104

INT INT_TO_W_BCD WORD BCD conversion INT_TO _W_BCD 3 P2-105

DINT DINT_TO_W_BCD WORD BCD conversion DINT_TO _W_BCD 3 P2-105

2-50
2-5 FBD Language

Instruction Symbol Name No. of steps Page

INT INT_TO_D_BCD DWORD BCD conversion INT_TO _D_BCD 3 P2-106

DINT DINT_TO_D_BCD DWORD BCD conversion DINT_TO _D_BCD 3 P2-106

2-51
2-5 FBD Language Arithmetic FCT

2) Arithmetic functions

Instruction Symbol Name No. of steps Page

INT ABS_INT INT Absolute value ABS _INT 3 P2-107

DINT ABS_DINT DINT Absolute value ABS _DINT 3 P2-107

REAL ABS_REAL REAL Absolute value ABS _REAL 3 P2-108

REAL SQRT REAL Square root SQRT 3 P2-108

REAL LN REAL Natural logarithm LN 3 P2-109

REAL LOG REAL Common logarithm LOG 3 P2-109

REAL EXP REAL Exponent EXP 3 P2-110

REAL SIN REAL Sine SIN 3 P2-110

REAL COS REAL Cosine COS 3 P2-111

REAL TAN REAL Tangent TAN 3 P2-111

REAL ASIN REAL Arc sine ASIN 3 P2-112

REAL ACOS REAL Arc cosine ACOS 3 P2-112

REAL ATAN REAL Arc tangent ATAN 3 P2-113

ADD
ANY_NUM ANY_NUM
No. of input
ANY_NUM Addition ADD operands +1 P2-113

ANY_NUM

2-52
Arithmetic FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

SUB
ANY_NUM ANY_NUM Subtraction SUB 3 P2-114
ANY_NUM

MUL
ANY_NUM ANY_NUM
ANY_NUM No. of input
Multiplication MUL operands +1 P2-114

ANY_NUM

DIV
ANY_NUM ANY_NUM Division DIV 3 P2-115
ANY_NUM

MOD
ANY_INT ANY_INT Division remainder MOD 4 P2-115
ANY_INT

EXPT
REAL REAL P2-116
Exponent EXPT 3
REAL

ANY MOVE ANY Move MOVE 4 P2-116

ANY_NUM NEG ANY_NUM Negation NEG 3 P2-117

2-53
2-5 FBD Language Bit string FCT

3) Bit string functions


Instruction Symbol Name No. of steps Page

SHL_WORD
WORD IN WORD Shift left SHL _WORD 3 P2-118
UINT N

SHL_DWORD
DWORD IN DWORD Shift left SHL _DWORD 3 P2-118
UINT N

SHR_WORD
WORD IN WORD Shift right SHR _WORD 3 P2-119
UINT N

SHR_DWORD
DWORD IN DWORD Shift right SHR _DWORD 3 P2-119
UINT N

ROL_WORD
WORD IN WORD Rotate left ROL _WORD 3 P2-120
UINT N

ROL_DWORD
DWORD IN DWORD Rotate left ROL _DWORD 3 P2-120
UINT N

ROR_WORD
WORD IN WORD Rotate right ROR _WORD 3 P2-121
UINT N

ROR_DWORD
DWORD IN DWORD Rotate right ROR _DWORD 3 P2-121
UINT N

AND
ANY_BIT ANY_BIT
ANY_BIT No. of input
Logical product AND operands +1 P2-122

ANY_BIT

OR
ANY_BIT ANY_BIT
ANY_BIT
No. of input
Logical add OR operands +1 P2-122

ANY_BIT

2-54
Bit string FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

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

ANY_BIT

ANY_BIT NOT ANY_BIT Logical negation NOT 3 P2-123

BOOL NOT_BOOL BOOL Negation NOT_BOOL 3 P2-124

WORD NOT_WORD WORD Negation NOT_WORD 3 P2-124

DWORD NOT_DWORD DWORD Negation NOT_DWORD 3 P2-125

2-55
2-5 FBD Language Selection/comparison FCT

4) Selection/comparison functions

Instruction Symbol Name No. of steps Page

SEL_BOOL
BOOL G BOOL
BOOL IN0 Select SEL_BOOL 8 P2-126
BOOL IN1

SEL_INT
BOOL G INT
INT IN0 Select SEL_INT
INT IN1

SEL_DINT
BOOL G DINT
DINT IN0 Select SEL_DINT
DINT IN1

SEL_UINT
BOOL G UINT
UINT IN0 Select SEL_UINT
UINT IN1

SEL_UDINT
BOOL G UDINT
UDINT IN0 Select SEL_UDINT
UDINT IN1

SEL_REAL
BOOL G REAL
REAL IN0 Select SEL_REAL
REAL IN1

SEL_WORD
BOOL G WORD
WORD IN0 Select SEL_WORD
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-56
Selection/comparison FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

MAX_INT
INT INT Maximum value MAX_INT 3 P2-127
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-128
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-57
2-5 FBD Language Selection/comparison FCT

Instruction Symbol Name No. of steps Page

LIMIT_INT
INT MN INT
INT IN
Limit LIMIT_INT 6 P2-128
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-58
Selection/comparison FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

GT
elementary BOOL
elementary No. of input
Comparison (>) GT operands P2-129
x 3-1

elementary
(Note 1)

GE
elementary BOOL
elementary No. of input
Comparison (>) GE operands P2-130
x 3-1

elementary
(Note 1)

EQ
elementary BOOL
elementary No. of input
Comparison (=) EQ operands P2-131
x 3-1

elementary
(Note 1)

LE
elementary BOOL
elementary No. of input
Comparison (<) LE operands P2-132
x 3-1

elementary
(Note 1)

LT
elementary BOOL
elementary No. of input
Comparison (<) LT operands P2-133
x 3-1

elementary
(Note 1)

NE
elementary BOOL
Comparison (=) NE 3 P2-134
elementary
(Note 1)

Note: 1) When SPS is used, the input cannot be extended.


2) STRING type data is not available to an “elementary” of GT, GE, EQ, LE, LT or NE.

2-59
2-5 FBD Language String FCT

5) String functions

Instruction Symbol Name No. of steps Page

STRING LEN INT Get length LEN 3 P2-135

LEFT
STRING IN STRING Get left sub-string LEFT 10 P2-135
UINT L

RIGHT
STRING IN STRING Get right sub-string RIGHT 10 P2-136
UINT L

MID
STRING IN STRING
UINT L Get middle sub-string MID 11 P2-136
UINT P

CONCAT
STRING STRING
Concatenate CONCAT 11 P2-137
STRING

INSERT
STRING IN1 STRING
STRING IN2 Insert string INSERT 11 P2-137
UINT P

DELETE
STRING IN STRING
UINT L Delete string DELETE 11 P2-138
UINT P

REPLACE
STRING IN1 STRING
STRING IN2
Replace string REPLACE 12 P2-138
UINT L
UINT P

FIND
STRING IN1 INT
Find string FIND 4 P2-139
STRING IN2

2-60
String FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

GT_STRING
STRING IN1 BOOL Compare string GT_STRING 4 P2-139
STRING IN2

GE_STRING
STRING IN1 BOOL Compare string GE_STRING 4 P2-140
STRING IN2

EQ_STRING
STRING IN1 BOOL Compare string EQ_STRING 4 P2-140
STRING IN2

LE_STRING
STRING IN1 BOOL Compare string LE_STRING 4 P2-141
STRING IN2

LT_STRING
STRING IN1 BOOL Compare string LT_STRING 4 P2-141
STRING IN2

NE_STRING
STRING IN1 BOOL Compare string NE_STRING 4 P2-142
STRING IN2

2-61
2-5 FBD Language Time type data FCT

6) Time type data functions

Instruction Symbol Name No. of steps Page

ADD_T_T
TIME TIME Add time ADD_T_T 5 P2-143
TIME

ADD_TD_T
TOD TOD Add time ADD_TD_T 8 P2-143
TIME
Note: These functions are not supported in SPS.

ADD_DT_T
DT DT Add time ADD_DT_T 8 P2-143
TIME
Note: These functions are not supported in SPS.

SUB_T_T
TIME TIME Subtract time SUB_T_T 5 P2-144
TIME

SUB_D_D
DATE TIME P2-144
Subtract time SUB_D_D 6
DATE
Note: These functions are not supported in SPS.

SUB_TD_T
TOD TOD P2-144
Subtract time SUB_TD_T 8
TIME
Note: These functions are not supported in SPS.

SUB_TD_TD
TOD TIME P2-145
Subtract time SUB_TD_TD 6
TOD
Note: These functions are not supported in SPS.

SUB_DT_T
DT DT P2-145
Subtract time SUB_DT_T 8
TIME
Note: These functions are not supported in SPS.

SUB_DT_DT
DT TIME Subtract time SUB_DT_DT 6 P2-145
DT
Note: These functions are not supported in SPS.

MUL_T_N
TIME TIME
Multiply time MUL_T_N 7 P2-146
UDINT

MUL_T_R
TIME TIME Multiply time MUL_T_R P2-146
7
REAL

DIV_T_N
TIME TIME Divide time DIV_T_N P2-147
7
UDINT

2-62
Time type data FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

DIV_T_R
TIME TIME Divide time DIV_T_R 7 P2-147
REAL

CONCAT_D_D
DATE DT Concatenate time CONCAT_D_D 5 P2-148
TOD
Note: These functions are not supported in SPS.

DT DT_TO_TOD TOD Convert DT to TOD DT_TO_TOD P2-148


5
Note: These functions are not supported in SPS.

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


Note: These functions are not supported in SPS.

2-63
2-5 FBD Language Original FCT

7) Original FCTs (Functions)

Instruction Symbol Name No. of steps Page

SBIT_WORD
WORD IN WORD Set bit SBIT_WORD 3 P2-149
UINT N

SBIT_DWORD
DWORD IN DWORD Set bit SBIT_DWORD 3 P2-149
UINT N

RBIT_WORD
WORD IN WORD Reset bit RBIT_WORD 3 P2-150
UINT N

RBIT_DWORD
DWORD IN DWORD Reset bit RBIT_DWORD 3 P2-150
UINT N

TBIT_WORD
WORD IN BOOL Test bit TBIT_WORD 3 P2-151
UINT N

TBIT_DWORD
DWORD IN BOOL Test bit TBIT_DWORD 3 P2-151
UINT N

UINT DECODE_WORD WORD Decode DECODE_WORD 3 P2-152

UINT DECODE_DWORD DWORD 4 P2-152


Decode DECODE_DWORD

WORD ENCODE_WORD UINT 3 P2-152


Encode ENCODE_WORD

DWORD ENCODE_DWORD UINT 4 P2-153


Encode ENCODE_DWORD

WORD BITCOUNT_WORD UINT 3 P2-153


Bit count BITCOUNT_WORD

DWORD BITCOUNT_DWORD UINT 3 P2-153


Bit count BITCOUNT_DWORD

STRING STR_TO_UINT UINT 3 P2-154


Convert string to number STR_TO_UINT

UINT UINT_TO_STR STRING 3 P2-154


Convert number to string UINT_TO_STR

2-64
Original FCT 2-5 FBD Language

Instruction Symbol Name No. of steps Page

Convert shift-JIS to string


ARRAY OF WORD SJ_TO_STR STRING 10 P2-155
SJ_TO_STR
Note: These functions are not supported in SPS.

Convert string to shift-JIS P2-155


STRING STR_TO_SJ ARRAY OF WORD 10
STR_TO_SJ
Note: These functions are not supported in SPS.

STRING BYTE_LEN INT Byte length BYTE_LEN 3 P2-156

DBAND_INT
INT IN INT Dead band DBAND_INT 5 P2-156
INT DB

DBAND_DINT
DINT IN DINT
Dead band DBAND_DINT 5 P2-157
DINT DB

DBAND_REAL
REAL IN REAL 5 P2-157
Dead band DBAND_REAL
REAL DB

BIAS_INT
INT IN INT 5 P2-158
Bias BIAS_INT
INT DZ

BIAS_DINT
DINT IN DINT 5 P2-158
Bias BIAS_DINT
DINT DZ

BIAS_REAL
REAL IN REAL 5 P2-159
Bias BIAS_REAL
REAL DZ

SC_COIL
BOOL RUN UINT
UINT STEP Step sequence coil SC_COIL 6 P2-160
UINT IN

SC
BOOL RUN BOOL
UINT STEP Step sequence bit SC 6 P2-160
UINT IN

ADC
DINT IN1 DINT
32-bit addition with carry ADC 6 P2-161
DINT IN2
BOOL CYIN

2-65
2-5 FBD Language Original FCT

Instruction Symbol Name No. of steps Page

ADCO
DINT IN1 BOOL
DINT IN2 Carry after 32-bit addition ADCO 6 P2-161
BOOL CYIN

SBB
DINT IN1 DINT
DINT IN2 32-bit subtraction with borrow SBB 6 P2-162
BOOL BIN

SBBO
DINT IN1 BOOL
DINT IN2 Borrow after 32-bit subtraction SBBO 6 P2-162
BOOL BIN

MULL
DINT IN1 DINT 5 P2-163
Lower-order digit in 64-bit multiplication
DINT IN2
MULL

MULU Upper-order digit in 64-bit multiplication


DINT IN1 DINT 5 P2-163
DINT IN2 MULU

DIVL
DINT IN1 DINT Lower-order digit in 64-bit division
DINT IN2 6 P2-164
DIVL
DINT IN3

DIVU
DINT IN1 DINT Upper-order digit in 64-bit division
DINT IN2 6 P2-164
DIVU
DINT IN3

SLC Shift left 32 bits with carry SLC


DWORD IN DWORD 5 P2-165
BOOL CYIN

Carry after 32 bits shift left SLCO


SLCO 4 P2-165
DWORD BOOL

SRC Shift right 32 bits with carry SRC


DWORD IN DWORD 5 P2-166
BOOL CYIN

Carry after 32 bits shift right SRCO


SRCO 4 P2-166
DWORD BOOL

2-66
FB 2-5 FBD Language

2-5-2 Function block summary


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

The notational conventions used in the function block summary function summary charts except the following:
charts are almost the same as those which are used in the
• There are instructions that have two or more output • Both input and output terminals have a predefined
terminals. name (parameter name).
• Edge inputs can be used. • There are instructions that have the IN_OUT
• The number of input terminals is fixed (and cannot be parameter.
extended).

(1) Symbols used in the function block summary (Note 1)


Instruction Symbol Name No. of steps Page
Instance name (Note 2)
Rising edge input
FB name
Input data type Output data type
CTU_1

CTU Q Up counter CTU 12 P 2-


BOOL CU BOOL
BOOL RESET
INT PV CV INT

T_S_1

T_S
ERROR BOOL
BOOL IN IN (Note 6)
Test & set T_S 6 P 2-
Q BOOL

Note: 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 user-
generated FBs and extended FBs supplied by Fuji Electric are “user FBs.” The system FBs use the instance memory
area for user FBs and user FBs use that for user FBs.
4) Use a standard memory area not specified in the AT statement (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.
6) When FBs with IN and OUT terminals are used with SPS, it is necessary to connect same variable to both IN and
OUT.

2-67
2-5 FBD Language FB

(2) Describing a function block in the IL language


When describing a function block call in the IL language, it is instruction (“CAL,” “CALC,” or “CALCN”) as shown below.
necessary to specify input/output parameters and a call
<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-68
IEC standard FB 2-5 FBD Language

(4) Function block summary


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

Function block IEC standard function blocks

Original function blocks


(unique to the MICREX-SX series)

Expanded function blocks


(unique to the MICREX-SX series)

1) IEC standard function blocks

Instruction Symbol Name No. of steps Page


SR_1 Instance name

SR Set reset flip-flop SR 8 P2-167


BOOL SET1 Q1 BOOL

BOOL RESET

RS_1

RS
BOOL SET Q1 BOOL Reset set flip-flop RS 8 P2-167
BOOL RESET
RESET1

R_TRIG_1

R_TRIG Rising edge detection R_TRIG 6 P2-168


BOOL CLK Q BOOL

F_TRIG_1

F_TRIG
Falling edge detection F_TRIG 6 P2-168
BOOL CLK Q BOOL

CTU_1

CTU Q
BOOL CU BOOL 12 P2-169
Up counter CTU
BOOL RESET
INT PV CV INT

CTD_1

CTD Q
BOOL CD BOOL Down counter CTD 12 P2-169
BOOL LOAD
INT PV CV INT

2-69
2-5 FBD Language IEC standard FB

Instruction Symbol Name No. of steps Page

CTUD_1

CTUD
BOOL CU QU BOOL
BOOL CD QD BOOL P2-170
Up down counter CTUD 18
BOOL RESET CV INT
BOOL LOAD
INT PV

TP_1

TP
BOOL IN Q BOOL Pulse TP 10 P2-171
TIME PT ET TIME

TON_1

TON
BOOL IN Q BOOL On-delay timer TON 10 P2-171
TIME PT ET TIME

TOF_1

TOF P2-172
BOOL IN Q BOOL Off-delay timer TOF 10

TIME PT ET TIME

RTC_1

RTC
BOOL EN Q BOOL Real-time clock RTC 10 P2-172

DT PDT CDT DT

Note: These functions are not supported in SPS.

2-70
Original FB 2-5 FBD Language

2) Original FBs (Function blocks)


Instruction Symbol Name No. of steps Page

RCT_1

RCT 12 P2-173
BOOL CU Q BOOL Ring counter RCT
BOOL RESET
INT PV CV INT

TMR_1

TMR
BOOL IN Q BOOL 10 P2-174
Integrating timer TMR
BOOL RESET
TIME PT ET TIME

MR_1

MR Retriggerable timer MR 10 P2-175


BOOL IN Q BOOL
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-176
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-178
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-179
STATUS INT
ANY RD RD ANY
UINT SIZE

2-71
2-5 FBD Language Original FB

Instruction Symbol Name No. of steps Page

READ_WORD_1

READ_WORD
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct read READ_WORD 16 P2-180
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
STATUS INT Direct read READ_BOOL 16
ANY GLOBAL_VAR GLOBAL_VAR ANY Note: These functions are not supported in SPS.
ANY RD RD ANY

WRITE_WORD_1

WRITE_WORD
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct write READ WRITE_WORD 16 P2-181
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
STATUS INT Direct write WRITE_BOOL 16
ANY GLOBAL_VAR GLOBAL_VAR ANY
Note: These functions are not supported in SPS.
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-182
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
UDINT STATION_NO Remote data write R_READ 16 P2-183
UINT VAR_TYPE
ANY REMOTE_VAR REMOTE_VAR ANY
UINT SIZE
ANY SD SD ANY

2-72
Original FB 2-5 FBD Language

Instruction Symbol Name No. of steps Page

F_READ_1

F_READ
BOOL REQ DONE BOOL
UINT MODULE_NO ERROR BOOL P2-186
File data read F_READ 16
STATUS INT
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 16 P2-187
File data write F_WRITE
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 P2-188
14
ERROR BOOL Note: These functions are not supported in SPS.
STATUS INT
ANY IN IN ANY

FFST_1

FFST
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY
Sequential file store FFST 12 P2-189
STRUCT FCB FCB STRUCT
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 Sequential file load first FIFO 12 P2-190
STRUCT FCB FCB STRUCT
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
Sequential file load last FILO 12 P2-191
STRUCT FCB FCB STRUCT
ARRAY OUT OUT ARRAY
UINT X_SIZE
UINT Y_SIZE

2-73
2-5 FBD Language Original FB

Instruction Symbol Name No. of steps Page


FILTER_DINT_1

FILTER_DINT
BOOL RUN XOUT DINT
DINT XIN Filter FILTER_DINT 10 P2-192
TIME TAU

FILTER_REAL_1

FILTER_REAL
BOOL RUN XOUT REAL
REAL XIN
Filter FILTER_REAL 10 P2-193
TIME TAU

INT_DINT_1

INT_DINT
BOOL RUN XOUT DINT
BOOL R1 Q BOOL Integrate INT_DINT 16 P2-194
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-195
REAL XIN
REAL X0
TIME I_T

DIF_DINT_1

DIF_DINT
BOOL RUN XOUT DINT Differentiate DIF_DINT 10 P2-196
DINT XIN
TIME D_T

DIF_REAL_1

DIF_REAL
BOOL RUN XOUT REAL P2-197
Differentiate DIF_REAL 10
REAL XIN
TIME D_T

PULSE_CNT_1

PULSE_CNT
BOOL RUN OUT INT Pulse count PULSE_CNT 12 P2-198
BOOL IN CMP BOOL
TIME DURATION

2-74
Original FB 2-5 FBD Language

Instruction Symbol Name No. of steps Page

PULSE_OUT_1

PULSE_OUT
BOOL RUN OUT BOOL 12 P2-198
Pulse output PULSE_OUT
TIME PERIOD CMP BOOL
INT COUNT

PWM_1

PWM
BOOL RUN OUT BOOL Pulse PWM 10 P2-199
TIME PERIOD
TIME WIDTH

HW_RTC_1

HW_RTC
BOOL EN Q BOOL Hardware RTC (Real-time clock) HW_RTC 10 P2-199
DT PDT CDT DT Note: These functions are not supported in SPS.

T_S_1

T_S
ERROR BOOL P2-200
Test & set T_S 6
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-201
STATUS INT
Note: These functions are not supported in SPS.
BUSY BOOL

2-75
2-5 FBD Language Only for SPS FB

3) Only for SPS FBs (Function blocks)

Instruction Symbol Name Page

FILE_OPEN_1

FILO_OPEN
BOOL EN_C VALID BOOL
STRING FILE_NAME ERROR BOOL File open FILE_OPEN P2-204
STRING MODE STATUS INT
FILE_NO UINT

FILE_WRITE_1

FILE_WRITE
BOOL REQ DONE BOOL
UINT FILE_NO ERROR BOOL File data write FILE_WRITE P2-205
UINT SIZE STATUS INT
ANY WD WD ANY

FILE_READ_1

FILE_READ
BOOL REQ DONE BOOL
UINT FILE_NO ERROR BOOL
File data read FILE_READ P2-206
UINT SIZE STATUS INT
ANY RD RD ANY

FILE_SEEK_1

FILE_SEEK
BOOL REQ DONE BOOL
UINT FILE_NO ERROR BOOL
File pointer seek FILE_SEEK P2-207
DINT OFFSET STATUS INT
INT MODE

SJ_TO_STRING_1

SJ_TO_STRING
Convert shift-JIS to string SJ_TO_STR P2-208
STR STRING
ARRAY OF WORD SJ SJ ARRAY OF WORD

STRING_TO_SJ_1

STRING_TO_SJ Convert string to shift-JIS STR_TO_SJ P2-208


STRING STR
ARRAY OF WORD SJ SJ ARRAY OF WORD

2-76
Only for SPS FB 2-5 FBD Language

Instruction Symbol Name Page

READ_W_1

READ_W
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct read READ_W P2-209
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY RD RD ANY

READ_B_1

READ_B
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct read READ_B P2-210
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY RD RD ANY

WRITE_W_1

WRITE_W
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct write WRITE_W P2-211
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY SD SD ANY

WRITE_B_1

WRITE_B
BOOL REQ DONE BOOL
UINT SIZE ERROR BOOL Direct write WRITE_B P2-212
STATUS INT
ANY GLOBAL_VAR GLOBAL_VAR ANY
ANY SD SD ANY

2-77
2-5 FBD Language Type conversion FCT

2-5-3 Type conversion functions


(1) Type conversion DINT_TO_INT
Name, Symbol, Function Example
Name Symbol

<Operation>
DINT_TO_INT • When the operation result falls within the valid value range of the INT type

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
DINT Convert INT
40000 32767
Function

(1) DINT_TO_INT converts DINT type data to EN=1 ENO=0


INT type data. (SPH)
(2) When SPH is used, if the input DINT value DINT Convert INT
exceeds the valid range of INT type after -50000 -32768
type conversion, the boundary value of EN=1 ENO=0
INT type is output.
(Boundary value: -32768, 32767) DINT Convert
(3) When SPS is used, if the input DINT value 40000 -25536
exceeds the valid range of INT type after EN=1
type conversion, no boundary processing (SPS)
is performed and lower 16 bits are output. DINT Convert
-50000 15536
[Reference information]
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
Name Symbol

<Operation>
UINT_TO_INT • When the operation result falls within the valid value range of the INT type
UINT Convert INT
32767 32767
EN=1 ENO=1
UINT UINT_TO_INT INT
• When the operation result exceeds the valid value range of the INT type
UINT Convert INT
65535 32767 (SPH)
EN=1 ENO=0
Function

(1) UINT_TO_INT converts UINT type data to


INT type data. UINT Convert INT
(2) When SPH is used, if the input UINT value 65535 -1 (SPS)
exceeds the valid range of INT type after
type conversion, the upper limit value
(32767) of INT type is output.
(3) When SPS is used, even if the input UINT
value exceeds the valid range of INT type [Reference information]
after type conversion, no boundary Value range of UINT type: 0 to 65,535
processing is performed. Value range of INT type: -32,768 to 32,767

2-78
Type conversion FCT 2-5 FBD Language

(3) Type conversion UDINT_TO_INT

Name, Symbol, Function Example


Name Symbol

<Operation>
UDINT_TO_INT • When the operation result falls within the valid value range of the INT type
UDINT Convert INT
32767 32767
EN=1 ENO=1
UDINT UDINT_TO_INT INT
• When the operation result exceeds the valid value range of the INT type
UDINT Convert INT
4294967295 32767 (SPH)
EN=1 ENO=0
Function

(1) UDINT_TO_INT converts UDINT


type data to INT type data. UDINT Convert INT
(2) When SPH is used, if the input UDINT 4294967295 -1 (SPS)
value exceeds the valid range of INT type
after type conversion, the upper limit value
(32767) of INT type is output.
(3) When SPS is used, if the input UDINT
value exceeds the valid range of INT type
after type conversion, no boundary [Reference information]
processing is performed and lower 16 bits Value range of UDINT type: 0 to 4,294,967,295
are output. Value range of INT type: -32,768 to 32,767

(4) Type conversion REAL_TO_INT


Name, Symbol, Function Example
Name

<Operation>
REAL_TO_INT • When the operation result falls within the valid value range of the INT type
REAL Convert INT
Symbol

6.789E + 02 679
EN=1 ENO=1
REAL REAL_TO_INT INT
• When the operation result exceeds the valid value range of the INT type
REAL Convert INT
4.500E + 04 32767
EN=1 ENO=0
Function

(1) REAL_TO_INT converts REAL type data (SPH)


to INT type data. REAL Convert INT
(2) When SPH is used, if the input REAL -5.000E + 04 -32768
value exceeds the valid range of INT type EN=1 ENO=0
after type conversion, the boundary value
of INT type is output. REAL Convert INT
(3) The fractional part is rounded off. 4.500E + 04 an indefinite number
(4) When SPS is used, if the input REAL
value exceeds the valid range of INT type (SPS)
after type conversion, an indefinite number REAL Convert INT
is output. -5.000E + 04 an indefinite number

[Reference information]
128 -126 -126 128
Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
Value range of INT type: -32,768 to 32,767

2-79
2-5 FBD Language Type conversion FCT

(5) Type conversion TIME_TO_INT


Name, Symbol, Function Example
Name Symbol

<Operation>
TIME_TO_INT • When the operation result falls within the valid value range of the INT type
TIME Convert INT
32s123ms 32123
EN=1 ENO=1
TIME TIME_TO_INT INT
• When the operation result exceeds the valid value range of the INT type
TIME Convert INT
10m10s 32767
EN=1 ENO=0
Function

(1) TIME_TO_INT converts TIME type data


to INT type data.
[Reference information]
(2) When SPH is used, if the input TIME
Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
value exceeds the valid range of INT type
(SPS): 0 to 2,147,483,647 (ms)
after type conversion, the upper limit
Value range of INT type: -32,768 to 32,767
value (32767) of INT type is output.
(3) 1 ms is converted to 1.
(4) When SPS is used, even if the input TIME
value exceeds the valid range of INT type
after type conversion, no boundary
processing is performed.

(6) Type conversion WORD_TO_INT

Name, Symbol, Function Example


Name Symbol

<Operation>
WORD_TO_INT
WORD INT
Convert
16#7FFF 32767
EN=1 ENO=1
WORD WORD_TO_INT INT
WORD INT
Convert
16#FFFF -1
EN=1 ENO=1
Function

(1) WORD_TO_INT converts WORD type


data to INT type data. [Reference information]
Value range of WORD type: 16#0000 to 16#FFFF
Value range of INT type: -32,768 to 32,767

2-80
Type conversion FCT 2-5 FBD Language

(7) Type conversion INT_TO_DINT

Name, Symbol, Function Example


Name Symbol

<Operation>
INT_TO_DINT INT DINT
Convert
32767 32767
EN=1 ENO=1

INT INT_TO_DINT DINT


INT Convert DINT
-32768 -32768
EN=1 ENO=1

[Reference information]
Function

(1) INT_TO_DINT converts INT type


Value range of INT type: -32,768 to 32,767
data to DINT type data.
Value range of DINT type: -2,147,483,648 to 2,147,483,647

(8) Type conversion UINT_TO_DINT

Name, Symbol, Function Example


Name Symbol

<Operation>
UINT_TO_DINT
UINT Convert DINT
65353 65353
EN=1 ENO=1
UINT UINT_TO_DINT DINT
[Reference information]
Value range of UINT type: 0 to 65,535
Value range of DINT type: -2,147,483,648 to 2,147,483,647
Function

(1) UINT_TO_DINT converts UINT type data


to DINT type data.

2-81
2-5 FBD Language Type conversion FCT

(9) Type conversion UDINT_TO_DINT


Name, Symbol, Function Example
Name Symbol

<Operation>
UDINT_TO_DINT • When the operation result falls within the valid value range of the DINT type
UDINT Convert DINT
2147483647 2147483647
EN=1 ENO=1
UDINT UDINT_TO_DINT DINT
• When the operation result exceeds the valid value range of the DINT type
UDINT Convert DINT
4294967295 2147483647 (SPH)
EN=1 ENO=0
Function

(1) UDINT_TO_DINT converts UDINT type


data to DINT type data. UDINT Convert DINT
(2) When SPH is used, if the input UDINT 4294967295 -1 (SPS)
value exceeds the valid range of DINT
type after type conversion, the upper limit
value (2147483647) of DINT type is
output.
(3) When SPS is used, even if the input
UDINT value exceeds the valid range of [Reference information]
DINT type after type conversion, no Value range of UDINT type: 0 to 4,294,967,295
boundary processing is performed. Value range of DINT type: -2,147,483,648 to 2,147,483,647

(10) Type conversion REAL_TO_DINT


Name, Symbol, Function Example
Name Symbol

<Operation>
REAL_TO_DINT • When the operation result falls within the valid value range of the DINT type
REAL Convert DINT
6.789E+02 679
EN=1 ENO=1
REAL REAL_TO_DINT DINT
• When the operation result exceeds the valid value range of the DINT type
REAL Convert DINT
2.147E+20 2147483647
EN=1 ENO=0
Function

(1) REAL_TO_DINT converts REAL type data


(SPH)
to DINT type data. REAL Convert DINT
(2) When SPH is used, if the input REAL value
-2.147E+20 -2147483648
exceeds the valid range of DINT type after
EN=1 ENO=0
type conversion, the boundary value of
DINT type is output. REAL Convert DINT
(Boundary value: -2.147E+20 an indefinite number (SPS)
-2147483648, 2147483647)
(3) The fractional part is rounded off.
(4) The number of significant digits after
conversion is 6 digits.
(5) When SPS is used, if the input REAL
value exceeds the valid range of DINT type [Reference information]
128 -126 -126 128
after type conversion, an indefinite number Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
is output. Value range of DINT type: -2,147,483,648 to 2,147,483,647

2-82
Type conversion FCT 2-5 FBD Language

(11) Type conversion TIME_TO_DINT


Name, Symbol, Function Example
Name Symbol

<Operation>
TIME_TO_DINT • When the operation result falls within the valid value range of the DINT type
TIME Convert DINT
17h20m10s 62410000
EN=1 ENO=1
TIME TIME_TO_DINT DINT
• When the operation result exceeds the valid value range of the DINT type
TIME Convert DINT
25d20h31m23s 2147483647 (SPH)
EN=1 ENO=0
Function

(1) TIME_TO_DINT converts TIME type data


to DINT type data. TIME Convert DINT
(2) When SPH is used, if the input TIME 25d20h31m23s -2061084296 (SPS)
value exceeds the valid range of DINT
type after type conversion, the upper limit
value (2147483647) of DINT type is
output.
(3) 1 ms is converted to 1.
(4) When SPS is used, even if the input TIME
value exceeds the valid range of DINT [Reference information]
type after type conversion, no boundary Value range of TIME type: 0 to 4,294,967,295 (ms)
processing is performed. Value range of DINT type: -2,147,483,648 to 2,147,483,647

(12) Type conversion DWORD_TO_DINT


Name, Symbol, Function Example
Name Symbol

<Operation>
DWORD_TO_DINT DWORD DINT
Convert
16#7FFFFFFF 2147483647
EN=1 ENO=1

DWORD DWORD_TO_DINT DINT


DWORD Convert DINT
16#FFFFFFFF -1
EN=1 ENO=1

[Reference information]
Function

(1) DWORD_TO_DINT converts DWORD


Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
type data to DINT type data.
Value range of DINT type: -2,147,483,648 to 2,147,483,647

2-83
2-5 FBD Language Type conversion FCT

(13) Type conversion INT_TO_UINT

Name, Symbol, Function Example


Name Symbol

<Operation>
INT_TO_UINT • When the operation result falls within the valid value range of the UINT type
INT Convert UINT
32767 32767
EN=1 ENO=1
INT INT_TO_UINT UINT
• When the operation result exceeds the valid value range of the UINT type
INT Convert UINT
-32768 0 (SPH)
EN=1 ENO=0
Function

(1) INT_TO_UINT converts INT type data to


UINT type data. INT Convert UINT
(2) When SPH is used, if the input INT value -32768 32768 (SPS)
exceeds the valid range of UINT type after
type conversion, the lower limit value
(UINT#0) of UINT type is output.
(3) When SPS is used, even if the input
INT value exceeds the valid range of [Reference information]
UINT type after type conversion, no Value range of INT type: -32,768 to 32,767
boundary processing is performed. Value range of UINT type: 0 to 65,535

(14) Type conversion DINT_TO_UINT


Name, Symbol, Function Example
Name Symbol

<Operation>
DINT_TO_UINT • When the operation result falls within the valid value range of the UINT type

DINT UINT
Convert
65535 65535
DINT DINT_TO_UINT UINT EN=1 ENO=1

• When the operation result exceeds the valid value range of the UINT type

DINT Convert
UINT
Function

(1) DINT_TO_UINT converts DINT type data


to UINT type data. 2147483647 65535
EN=1 ENO=0
(2) When SPH is used, if the input DINT value (SPH)
exceeds the valid range of UINT type after DINT UINT
Convert
type conversion, the boundary value of
-2147483648 0
UINT type is output.
EN=1 ENO=0
(Boundary value: 0, 65535)
(3) When SPS is used, if the input DINT value DINT Convert DINT
exceeds the valid range of UINT type after 65537 1 (SPS)
type conversion, no boundary processing
is performed and lower 16 bits are output. [Reference information]
Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of UINT type: 0 to 65,535

2-84
Type conversion FCT 2-5 FBD Language

(15) Type conversion UDINT_TO_UINT


Name, Symbol, Function Example
Name Symbol

<Operation>
UDINT_TO_UINT • When the operation result falls within the valid value range of the UINT type

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

UDINT Convert UINT


Function

(1) UDINT_TO_UINT converts UDINT type


4294967295 65535 (SPH)
data to UINT type data.
EN=1 ENO=0
(2) When SPH is used, if the input UDINT
value exceeds the valid range of UINT UDINT Convert UINT
type after type conversion, the upper limit (SPS)
4294967295 32768
value (65535) of UINT type is output. EN=1 ENO=0
(3) When SPS is used, if the input UDINT
value exceeds the valid range of UINT
type after type conversion, no boundary [Reference information]
processing is performed and lower 16 bits Value range of UDINT type: 0 to 4,294,967,295
are output. Value range of UINT type: 0 to 65,535

(16) Type conversion REAL_TO_UINT

Name, Symbol, Function Example


Name Symbol

<Operation>
REAL_TO_UINT • When the operation result falls within the valid value range of the UINT type
REAL Convert UINT
6.789E+2 679
EN=1 ENO=1
REAL REAL_TO_UINT UINT
• When the operation result exceeds the valid value range of the UINT type
REAL Convert UINT
1.234E+05 65535
EN=1 ENO=0
Function

(1) REAL_TO_UINT converts REAL (SPH)


type data to UINT type data. REAL Convert UINT
(2) When SPH is used, if the input REAL -2.345E+02 0
value exceeds the valid range of UINT EN=1 ENO=0
type after type conversion, the boundary
value of UINT type is output. REAL Convert UINT
(3) The fractional part is rounded off. 1.234E+05 an indefinite number (SPS)
(4) When SPS is used, if the input REAL
value exceeds the valid range of UINT
type after type conversion, an indefinite
number is output. [Reference information]
128 -126 -126 128
Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
Value range of UINT type: 0 to 65,535

2-85
2-5 FBD Language Type conversion FCT

(17) Type conversion TIME_TO_UINT


Name, Symbol, Function Example
Name Symbol

<Operation>
TIME_TO_UINT • When the operation result falls within the valid value range of the UINT type

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

TIME Convert UINT


Function

(1) TIME_TO_UINT converts TIME type data


20h 65535
to UINT type data.
EN=1 ENO=0
(2) When SPH is used, if the input TIME
value exceeds the valid range of UINT
type after type conversion, the upper limit
value (65535) of UINT type is output.
(3) 1 ms is converted to 1.
(4) When SPS is used, even if the input [Reference information]
TIME value exceeds the valid range of Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
UINT type after type conversion, no (SPS): 0 to 2,147,483,647 (ms)
boundary processing is performed. Value range of UINT type: 0 to 65,535

(18) Type conversion WORD_TO_UINT


Name, Symbol, Function Example
Name Symbol

<Operation>
WORD_TO_UINT
WORD UINT
Convert
16#7FFF 32767
EN=1 ENO=1
WORD WORD_TO_UINT UINT

WORD UINT
Convert
16#FFFF 65535
Function

(1) WORD_TO_UINT converts WORD type EN=1 ENO=1

data to UINT type data.


[Reference information]
Value range of WORD type: 16#0000 to 16#FFFF
Value range of UINT type: 0 to 65,535

2-86
Type conversion FCT 2-5 FBD Language

(19) Type conversion INT_TO_UDINT


Name, Symbol, Function Example
Name Symbol

<Operation>
INT_TO_UDINT • When the operation result falls within the valid value range of the UDINT type

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

INT Convert UDINT


Function

1) INT_TO_UDINT converts INT type data to -32768 0 (SPH)


UDINT type data. EN=1 ENO=0
(2) When SPH is used, if the input INT value
exceeds the valid range of UDINT type INT Convert UDINT
after type conversion, the lower limit value -32768 32768 (SPS)
(UDINT#0) of UDINT type is output.
(3) When SPS is used, even if the input INT
value exceeds the valid range of UDINT [Reference information]
type after type conversion, no boundary Value range of INT type: -32,768 to 32,767
processing is performed. Value range of UDINT type: 0 to 4,294,967,295

(20) Type conversion DINT_TO_UDINT

Name, Symbol, Function Example


Name Symbol

<Operation>
DINT_TO_UDINT • When the operation result falls within the valid value range of the UDINT type

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

DINT Convert UDINT


Function

(1) DINT_TO_UDINT converts DINT type -2147483648 0 (SPH)


data to UDINT type data. EN=1 ENO=0
(2) When SPH is used, if the input DINT value
exceeds the valid range of UDINT type DINT Convert UDINT
after type conversion, the lower limit value -2147483648 4294967295 (SPS)
(UDINT#0) of UDINT type is output.
(3) When SPS is used, even if the input DINT
value exceeds the valid range of UDINT [Reference information]
type after type conversion, no boundary Value range of DINT type: -2,147,483,648 to 2,147,483,647
processing is performed. Value range of UDINT type: 0 to 4,294,967,295

2-87
2-5 FBD Language Type conversion FCT

(21) Type conversion UINT_TO_UDINT

Name, Symbol, Function Example


Name Symbol

<Operation>
UINT_TO_UDINT
UINT Convert UDINT
65535 65535
EN=1 ENO=1
UINT UINT_TO_UDINT UDINT
[Reference information]
Value range of UINT type: 0 to 65,535
Value range of UDINT type: 0 to 4,294,967,295
Function

(1) UINT_TO_UDINT converts UINT type


data to UDINT type data.

(22) Type conversion REAL_TO_UDINT

Name, Symbol, Function Example


Name Symbol

<Operation>
REAL_TO_UDINT • When the operation result falls within the valid value range of the UDINT type
REAL Convert UDINT
6.789E+02 679
EN=1 ENO=1
REAL REAL_TO_UDINT UDINT
• When the operation result exceeds the valid value range of the UDINT type
REAL Convert UDINT
4.294E+10 4294967295
EN=1 ENO=0
Function

(1) REAL_TO_UDINT converts REAL type (SPH)


data to UDINT type data. REAL Convert UDINT
(2) When SPH is used, if the input REAL
-3.456E+03 0
value exceeds the valid range of UDINT
EN=1 ENO=0
type after type conversion, the boundary
value of UDINT type is output. REAL Convert UDINT
(3) The fractional part is rounded off. 4.294E+10 an indefinite number (SPS)
(4) The number of significant digits after
conversion is 6 digits.
(5) When SPS is used, if the input REAL
value exceeds the valid range of UDINT [Reference information]
128 -126 -126 128
type after type conversion, an indefinite Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
number is output. Value range of UDINT type: 0 to 4,294,967,295

2-88
Type conversion FCT 2-5 FBD Language

(23) Type conversion TIME_TO_UDINT

Name, Symbol, Function Example


Name Symbol

<Operation>
TIME_TO_UDINT TIME UDINT
Convert
5h20m15s 19215000
EN=1 ENO=1

TIME TIME_TO_UDINT UDINT

[Reference information]
Function

(1) TIME_TO_UDINT converts TIME type Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
data to UDINT type data. (SPS): 0 to 2,147,483,647 (ms)
(2) 1 ms is converted to 1. Value range of UDINT type: 0 to 4,294,967,295

(24) Type conversion DWORD_TO_UDINT

Name, Symbol, Function Example


Name Symbol

<Operation>
DWORD_TO_UDINT DWORD UDINT
Convert
16#7FFFFFFF 2147483647
EN=1 ENO=1

DWORD DWORD_TO_UDINT UDINT


DWORD Convert UDINT
16#FFFFFFFF 4294967295
EN=1 ENO=1
Function

(1) DWORD_TO_UDINT converts DWORD [Reference information]


type data to UDINT type data. Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
Value range of UDINT type: 0 to 4,294,967,295

2-89
2-5 FBD Language Type conversion FCT

(25) Type conversion DT_TO_UDINT ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
DT_TO_UDINT DT UDINT
Convert
1998-04-01-08:30:15 891419415
EN=1 ENO=1

DT DT_TO_UDINT UDINT
Function

(1) DT_TO_UDINT converts DT type data to


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 ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
DATE_TO_UDINT DATE UDINT
Convert
1998-04-01 891388800
EN=1 ENO=1

DATE DATE_TO_UDINT UDINT


Function

(1) DATE_TO_UDINT converts DATE type


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-90
Type conversion FCT 2-5 FBD Language

(27) Type conversion TOD_TO_UDINT ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
TOD_TO_UDINT TOD UDINT
Convert
08:30:15 30615
EN=1 ENO=1

TOD TOD_TO_UDINT UDINT


Function

(1) TOD_TO_UDINT converts TOD type data


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


Name Symbol

<Operation>
INT_TO_REAL INT REAL
Convert
32767 3.2767E+04
EN=1 ENO=1

INT INT_TO_REAL REAL


INT Convert REAL
-32768 -3.2768E+04
EN=1 ENO=1

[Reference information]
Function

(1) INT_TO_REAL converts INT type data to


Value range of INT type: -32,768 to 32,767
REAL type data. 128 -126 -126 128
(2) The number of significant digits after Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
conversion is 6 digits.

2-91
2-5 FBD Language Type conversion FCT

(29) Type conversion DINT_TO_REAL

Name, Symbol, Function Example


Name Symbol

<Operation>
DINT_TO_REAL DINT REAL
Convert
2147483647 2.1474836E+09
EN=1 ENO=1

DINT DINT_TO_REAL REAL


DINT Convert REAL
-2147483648 -2.1474836E+09
EN=1 ENO=1

[Reference information]
Function

(1) DINT_TO_REAL converts DINT type data


Value range of DINT type: -2,147,483,648 to 2,147,483,647
to REAL type data. 128 -126 -126 128
(2) The number of significant digits after Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
conversion is 6 digits.

(30) Type conversion UINT_TO_REAL

Name, Symbol, Function Example


Name Symbol

<Operation>
UINT_TO_REAL UINT REAL
Convert
65535 6.5535E+04
EN=1 ENO=1

UINT UINT_TO_REAL REAL


UINT Convert REAL
0 0.0E+00
EN=1 ENO=1

[Reference information]
Function

(1) UINT_TO_REAL converts UINT type data


Value range of UINT type: 0 to 65,535
to REAL type data. 128 -126 -126 128
(2) The number of significant digits after Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
conversion is 6 digits.

2-92
Type conversion FCT 2-5 FBD Language

(31) Type conversion UDINT_TO_REAL

Name, Symbol, Function Example


Name Symbol

<Operation>
UDINT_TO_REAL UDINT REAL
Convert
4294967295 4.2949673E+09
EN=1 ENO=1

UDINT UDINT_TO_REAL REAL


UDINT Convert REAL
0 0.0E+00
EN=1 ENO=1

[Reference information]
Function

(1) UDINT_TO_REAL converts UDINT type


Value range of UDINT type: 0 to 4,294,967,295
data to REAL type data. 128 -126 -126 128
Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
(2) The number of significant digits after
conversion is 6 digits.

(32) Type conversion TIME_TO_REAL

Name, Symbol, Function Example


Name Symbol

<Operation>
TIME_TO_REAL TIME Convert REAL
5h20m15s 1.92150E+07
EN=1 ENO=1

TIME TIME_TO_REAL REAL


Function

(1) TIME_TO_REAL converts TIME type data


to REAL type data. [Reference information]
(2) 1 ms is converted to 1. Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
(3) The number of significant digits after (SPS): 0 to 2,147,483,647 (ms)
128 -126 -126 128
conversion is 6 digits. Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2

2-93
2-5 FBD Language Type conversion FCT

(33) Type conversion WORD_TO_BOOL

Name, Symbol, Function Example


Name

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


Function

(1) WORD_TO_BOOL converts bit 0 of


WORD type data to BOOL type data. WORD 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0
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


Name Symbol

<Operation>
DWORD_TO_BOOL • When bit 0 of DWORD type data is “1”
DWORD
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
Function

(1) DWORD_TO_BOOL converts bit 0 of


DWORD type data to BOOL type data. • When bit 0 of DWORD type data is “0”
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-94
Type conversion FCT 2-5 FBD Language

(35) Type conversion BOOL_TO_WORD

Name, Symbol, Function Example


Name Symbol

<Operation>
BOOL_TO_WORD • When BOOL data is “1”

BOOL 1
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
Function

(1) BOOL_TO_WORD converts BOOL type • 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


Name

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

(1) DWORD_TO_WORD converts DWORD [Reference information]


type data to WORD type data. Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
The lower-order 16 bits of the DWORD Value range of WORD type: 16#0000 to 16#FFFF
value are output.

2-95
2-5 FBD Language Type conversion FCT

(37) Type conversion INT_TO_WORD

Name, Symbol, Function Example


Name Symbol

<Operation>
INT_TO_WORD
INT Convert WORD
32767 16#7FFF
EN=1 ENO=1
INT INT_TO_WORD WORD
[Reference information]
Value range of INT type: -32,768 to 32,767
Value range of WORD type: 16#0000 to 16#FFFF
Function

(1) INT_TO_WORD converts INT type data to


WORD type data.

(38) Type conversion UINT_TO_WORD

Name, Symbol, Function Example


Name Symbol

<Operation>
UINT_TO_WORD
UINT Convert WORD
1234 16#04D2
EN=1 ENO=1

UINT UINT_TO_WORD WORD [Reference information]


Value range of UINT type: 0 to 65,535
Value range of WORD type: 16#0000 to 16#FFFF
Function

(1) UINT_TO_WORD converts UINT type


data to WORD type data.

2-96
Type conversion FCT 2-5 FBD Language

(39) Type conversion BOOL_TO_DWORD

Name, Symbol, Function Example


Name Symbol

<Operation>
BOOL_TO_DWORD • When BOOL data is “1”

BOOL 1
EN=1 Convert

BOOL BOOL_TO_DWORD 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
Function

(1) BOOL_TO_DWORD converts BOOL type


data to DWORD type data. Bit 0 of the • When BOOL data is “0”
DWORD type data is loaded with the
BOOL value and the other bits with a “0.” BOOL 0
EN=1 Convert
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


Name Symbol

<Operation>
WORD_TO_DWORD

WORD 1 0 1 0 0 0 1 1 0 1 0 0 1 0 0 1
EN=1

WORD_TO_DWORD DWORD
Convert
WORD
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.”
Function

(1) WORD_TO_DWORD converts WORD


type data to DWORD type data. [Reference information]
The lower-order 16 bits of DWORD type Value range of WORD type: 16#0000 to 16#FFFF
data are loaded with the WORD type data Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
and the higher-order 16 bits with a “0.”

2-97
2-5 FBD Language Type conversion FCT

(41) Type conversion DINT_TO_DWORD

Name, Symbol, Function Example


Name

<Operation>
DINT_TO_DWORD DINT Convert DWORD
2147483647 16#7FFFFFFF
Symbol

EN=1 ENO=1

DINT DINT_TO_DWORD DWORD [Reference information]


Value range of DINT type: -2,147,483,648 to 2,147,483,647
Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
Function

(1) DINT_TO_DWORD converts DINT type


data to DWORD type data.

(42) Type conversion UDINT_TO_DWORD

Name, Symbol, Function Example


Name Symbol

<Operation>
UDINT_TO_DWORD UDINT Convert DWORD
4294967295 16#FFFFFFFF
EN=1 ENO=1

UDINT UDINT_TO_DWORD DWORD [Reference information]


Value range of UDINT type: 0 to 4,294,967,295
Value range of DWORD type: 16#00000000 to 16#FFFFFFFF
Function

(1) UDINT_TO_DWORD converts UDINT


type data to DWORD type data.

2-98
Type conversion FCT 2-5 FBD Language

(43) Type conversion INT_TO_TIME


Name, Symbol, Function Example
Name

<Operation>
INT_TO_TIME • When the operation result falls within the valid value range of the TIME type
INT Convert TIME
Symbol

32767 32s767ms
EN=1 ENO=1
INT INT_TO_TIME TIME
• When the operation result exceeds the valid value range of the TIME type
INT Convert TIME
-32768 0ms
EN=1 ENO=0
Function

(1) INT_TO_TIME converts INT type


data to TIME type data.
(2) When SPH is used, if the input INT value
exceeds the valid range of TIME type after
type conversion, the lower limit value
(0ms) of TIME type is output.
(3) 1 is converted to 1ms.
(4) When SPS is used, even if the input INT [Reference information]
value exceeds the valid range of TIME Value range of INT type: -32,768 to 32,767
type after type conversion, no boundary Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
processing is performed. (SPS): 0 to 2,147,483,647 (ms)

(44) Type conversion DINT_TO_TIME


Name, Symbol, Function Example
Name Symbol

<Operation>
DINT_TO_TIME • When the operation result falls within the valid value range of the TIME type
DINT Convert TIME
2147483647 24d20h31m23s647ms
EN=1 ENO=1
DINT DINT_TO_TIME TIME
• When the operation result exceeds the valid value range of the TIME type
DINT Convert TIME
-2147483648 0ms (SPH)
EN=1 ENO=0
(1) DINT_TO_TIME converts DINT type
Function

data to TIME type data. DINT Convert TIME


(2) When SPH is used, if the input DINT 2147483648 (SPS)
-2147483648
value exceeds the valid range of TIME
type after type conversion, the lower limit
value (0ms) of TIME type is output.
(3) 1 is converted to 1ms.
(4) When SPS is used, even if the input DINT [Reference information]
value exceeds the valid range of TIME Value range of DINT type: -2,147,483,648 to 2,147,483,647
type after type conversion, no boundary Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
processing is performed. (SPS): 0 to 2,147,483,647 (ms)

2-99
2-5 FBD Language Type conversion FCT

(45) Type conversion UINT_TO_TIME

Name, Symbol, Function Example


Name

<Operation>
UINT_TO_TIME UINT Convert TIME
65535 1m5s535ms
Symbol

EN=1 ENO=1

UINT UINT_TO_TIME TIME

[Reference information]
(1) UINT_TO_TIME converts UINT type data Value range of UINT type: 0 to 65,535
Function

to TIME type data. Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
(2) 1 is converted to 1ms. (SPS): 0 to 2,147,483,647 (ms)

(46) Type conversion UDINT_TO_TIME


Name, Symbol, Function Example
Name Symbol

<Operation>
UDINT_TO_TIME
UDINT Convert TIME
4294967295 49d17h2m47s295ms
EN=1 ENO=1

UDINT UDINT_TO_TIME TIME

[Reference information]
Function

(1) UDINT_TO_TIME converts UDINT type Value range of UDINT type: 0 to 4,294,967,295
data to TIME type data. Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
(2) 1 is converted to 1ms. (SPS): 0 to 2,147,483,647 (ms)

2-100
Type conversion FCT 2-5 FBD Language

(47) Type conversion REAL_TO_TIME

Name, Symbol, Function Example


Name Symbol

<Operation>
REAL_TO_TIME • When the operation result falls within the valid value range of the TIME type

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

REAL Convert TIME


5.000E+09 49d17h2m47s295ms
Function

(1) REAL_TO_TIME converts REAL type EN=1 ENO=0


data to TIME type data.
(2) The appropriate limit value of the TIME REAL Convert TIME
type is generated if the result of -1.234E+10 0ms
converting the REAL value exceeds the EN=1 ENO=0
valid value range of the TIME type.
(3) The fractional part is rounded off.
(4) 1 is converted to 1 ms.
(5) The converted value contains some [Reference information]
128 -126 -126 128
degree of error because the number of Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
significant digits of the REAL type data is Value range of TIME type (SPH): 0 to 4,294,967,295 (ms)
6 digits. (SPS): 0 to 2,147,483,647 (ms)

(48) Type conversion UDINT_TO_DT ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
UDINT_TO_DT UDINT DT
Convert
891419415 1998-04-01-08:30:15
EN=1 ENO=1

UDINT UDINT_TO_DT DT
Function

(1) UDINT_TO_DT converts UDINT type data


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-101
2-5 FBD Language Type conversion FCT

(49) Type conversion UDINT_TO_DATE ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
UDINT_TO_DATE UDINT DATE
Convert
891419415 1998-04-01
EN=1 ENO=1

UDINT UDINT_TO_DATE DATE


Function

(1) UDINT_TO_DATE converts UDINT type


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 ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
UDINT_TO_TOD UDINT TOD
Convert
891419415 08:30:15
EN=1 ENO=1

UDINT UDINT_TO_TOD TOD


Function

(1) UDINT_TO_TOD converts UDINT type


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-102
Type conversion FCT 2-5 FBD Language

(51) Type conversion TRUNC_INT

Name, Symbol, Function Example


Name Symbol

<Operation>
TRUNC_INT • When the operation result falls within the valid value range of the INT type

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

REAL Convert INT


Function

(1) TRUNC_INT converts REAL type data to 4.000E+04 32767


INT type data. EN=1 ENO=0
(2) When SPH is used, if the input REAL (SPH)
value exceeds the valid range of INT type REAL Convert INT
after type conversion, the boundary value -5.000E+04 -32768
of INT type is output. EN=1 ENO=0
(3) The fractional part is truncated.
(4) When SPS is used, if the input REAL REAL Convert INT
value exceeds the valid range of INT type 4.000E+04 an indefinite number (SPS)
after type conversion, an indefinite
number is output. [Reference information]
128 -126 -126 128
Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
Value range of INT type: -32,768 to 32,767

(52) Type conversion TRUNC_DINT


Name, Symbol, Function Example
Name Symbol

<Operation>
TRUNC_DINT • When the operation result falls within the valid value range of the DINT type
REAL Convert DINT
6.789E+02 678
EN=1 ENO=1
REAL TRUNC_DINT DINT
• When the operation result exceeds the valid value range of the DINT type
REAL Convert DINT
2.147E+10 2147483647
EN=1 ENO=0
Function

(1) TRUNC_DINT converts REAL type data to


(SPH)
DINT type data. REAL Convert DINT
(2) When SPH is used, if the input REAL -2.147E+10 -2147483648
value exceeds the valid range of DINT EN=1 ENO=0
type after type conversion, the boundary
value of DINT type is output. REAL Convert DINT
(3) The fractional part is truncated. 2.147E+10 an indefinite number (SPS)
(4) The number of significant digits after
conversion is 6 digits.
(5) When SPS is used, if the input REAL
value exceeds the valid range of DINT [Reference information]
128 -126 -126 128
type after type conversion, an indefinite Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
number is output. Value range of DINT type: -2,147,483,648 to 2,147,483,647

2-103
2-5 FBD Language Type conversion FCT

(53) Type conversion TRUNC_UINT

Name, Symbol, Function Example


Name Symbol

<Operation>
TRUNC_UINT • When the operation result falls within the valid value range of the UINT type
REAL Convert UINT
6.789E+02 678
EN=1 ENO=1
REAL TRUNC_UINT UINT
• When the operation result exceeds the valid value range of the UINT type
REAL Convert UINT
7.000E+04 65535
EN=1 ENO=0
Function

(1) TRUNC_UINT converts REAL type data (SPH)


to UINT type data. REAL Convert UINT
(2) When SPH is used, if the input REAL
-5.000E+04 0
value exceeds the valid range of UINT
EN=1 ENO=0
type after type conversion, the boundary
value of UINT type is output. REAL Convert UINT
(Boundary value: 0, 65535) 7.000E+04 an indefinite number (SPS)
(3) The fractional part is truncated.
(4) When SPS is used, if the input REAL
value exceeds the valid range of UINT [Reference information]
128 -126 -126 128
type after type conversion, an indefinite Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
number is output. Value range of UINT type: 0 to 65,535

(54) Type conversion TRUNC_UDINT

Name, Symbol, Function Example


Name Symbol

<Operation>
TRUNC_UDINT
• When the operation result falls within the valid value range of the UDINT type

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

REAL Convert UDINT


Function

(1) TRUNC_UDINT converts REAL type data 4.294E+10 4294967295


to UDINT type data. EN=1 ENO=0
(2) When SPH is used, if the input REAL (SPH)
value exceeds the valid range of UDINT REAL Convert UDINT
type after type conversion, the boundary -50000.0 0
value of UDINT type is output. EN=1 ENO=0
(Boundary value: 0, 4294967295)
(3) The fractional part is truncated. REAL Convert UDINT
(4) The number of significant digits after 4.294E+10 an indefinite number (SPS)
conversion is 6 digits.
(5) When SPS is used, if the input REAL
value exceeds the valid range of UDINT [Reference information]
128 -126 -126 128
type after type conversion, an indefinite Value range of REAL type: -2 < N ≤ -2 , 0, 2 ≤N<2
number is output. Value range of UDINT type: 0 to 4,294,967,295

2-104
Type conversion FCT 2-5 FBD Language

(55) Type conversion W_BCD_TO_INT

Name, Symbol, Function Example


Name Symbol

<Operation>
W_BCD_TO_INT • When the input value is BCD code
WORD Convert INT
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 (SPH)
EN=1 ENO=0
Function

(1) W_BCD_TO_INT regards WORD type


data as BCD code and converts it to INT WORD Convert INT
type data.
16#23FF -1 (SPS)
(2) When SPH is used, if the input WORD
value is other than BCD code, “0” is
output. [Reference information]
(3) When SPS is used, if the input WORD Value range of WORD type as interpreted as BCD code
value is other than BCD code, “-1” is : WORD#0000 to WORD#9999
output. Value range of INT type: -32,768 to 32,767

(56) Type conversion D_BCD_TO_INT


Name, Symbol, Function Example
Name Symbol

<Operation>
D_BCD_TO_INT • When the operation result falls within the valid value range of the INT type
DWORD Convert INT
32767 32767
DWORD D_BCD_TO_INT INT EN=1 ENO=1

• When the operation result exceeds the valid value range of the INT type
DWORD Convert INT
Function

(1) D_BCD_TO_INT regards DWORD data


99999999 32767 (SPH)
as BCD code and converts it to INT type
EN=1 ENO=0
data.
(2) When SPH is used, if the input DWORD DWORD Convert INT
value exceeds the valid range of INT type
99999999 -7937 (SPS)
after type conversion, the upper limit value
(32767) of INT type is output.
(3) When SPH is used, if the input DWORD • When the input value is not BCD code.
value is other than BCD code, “0” is DWORD Convert INT
output.
16#0000FFFF 0 (SPH)
(4) When SPS is used, if the input DWORD
EN=1 ENO=0
value exceeds the valid range of INT type
after type conversion, no boundary DWORD Convert INT
processing is performed and lower 16 bits
are output. 16#0000FFFF -1 (SPS)
(5) When SPS is used, if the input DWORD
value is other than BCD code, “-1” is [Reference information]
output. 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-105
2-5 FBD Language Type conversion FCT

(57) Type conversion W_BCD_TO_DINT

Name, Symbol, Function Example


Name Symbol

<Operation>
W_BCD_TO_DINT • When the input value is BCD code

WORD Convert DINT


1234 1234
WORD W_BCD_TO_DINT DINT EN=1 ENO=1

• When the input value is not BCD code


WORD Convert DINT
16#23FF 0 (SPH)
Function

(1) W_BCD_TO_DINT regards WORD data


EN=1 ENO=0
as BCD code and converts it to DINT type
data. WORD Convert DINT
(2) When SPH is used, if the input WORD 16#23FF -1 (SPS)
value is other than BCD code, “0” is
output. [Reference information]
(3) When SPS is used, if the input WORD Value range of WORD type as interpreted as BCD code
value is other than BCD code, “-1” is : 16#0000 to 16#9999
output. 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


Name Symbol

<Operation>
D_BCD_TO_DINT • When the operation result falls within the valid value range of the DINT type

DWORD Convert DINT


99999999 99999999
DWORD D_BCD_TO_DINT DINT EN=1 ENO=1

• When the input value is not BCD code


DWORD Convert DINT
16#00123FF 0 (SPH)
Function

(1) D_BCD_TO_DINT regards DWORD data


EN=1 ENO=0
as BCD code and converts it to DINT type
data. DWORD Convert DINT
(2) A “0” is generated if the input WORD (SPS)
16#00123FF -1
value is not BCD code.
(3) When SPS is used, if the input DWORD
value is other than BCD code, “-1” is
output. [Reference information]
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-106
Type conversion FCT 2-5 FBD Language

(59) Type conversion INT_TO_W_BCD


Name, Symbol, Function Example
Name Symbol

<Operation>
INT_TO_W_BCD
• When the operation result falls within the valid value range of the WORD
type
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

INT Convert WORD


Function

(1) INT_TO_W_BCD BCD-converts INT type


32767 16#9999
data to WORD type data.
EN=1 ENO=0
(2) When SPH is used, if the input INT value (SPH)
exceeds the valid range of WORD type INT Convert WORD
after type conversion, the boundary value
-32768 16#0000
of WORD type (BCD code) is output.
EN=1 ENO=0
(3) When SPS is used, if the input INT value
exceeds 9999, the lower 4 digits of the INT INT Convert WORD
value are output. If the input INT value is 32767 16#2767
negative, “FFFF” is output.
(SPS)
INT Convert WORD
-32768 16#FFFF

[Reference information]
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


Name Symbol

<Operation>
DINT_TO_W_BCD • When the operation result falls within the valid value range of the WORD
type
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
DINT Convert WORD
2147483647 16#9999
Function

(1) DINT_TO_W_BCD BCD-converts EN=1 ENO=0


DINT type data to WORD type data. (SPH)
(2) When SPH is used, if the input DINT DINT Convert WORD
value exceeds the valid range of WORD -2147483648 16#0000
type after type conversion, the boundary EN=1 ENO=0
value of WORD type (BCD code) is
output. DINT Convert WORD
(3) When SPS is used, if the input DINT value
2147483647 16#FFFF
is in the range from 10000 to 99999999,
the lower 4 digits are output. If the input (SPS)
INT value exceeds 99999999 or is DINT Convert WORD
negative, “16#FFFF” is output.
99991234 16#1234
[Reference information]
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-107
2-5 FBD Language Type conversion FCT

(61) Type conversion INT_TO_D_BCD


Name, Symbol, Function Example
Name Symbol

<Operation>
INT_TO_D_BCD
• When the operation result falls within the valid value range of the DWORD
type
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
INT Convert DWORD
Function

(1) INT_TO_D_BCD BCD-converts INT


-32768 16#00000000 (SPH)
type data to DWORD type data.
EN=1 ENO=0
(2) When SPH is used, if the input INT value
exceeds the valid range of DWORD type INT Convert DWORD
after type conversion, the lower limit value
-32768 16#FFFFFFFF (SPS)
of DWORD type (16#00000000) (BCD
code) is output.
(3) When SPS is used, if the input INT value
is negative, “16#FFFFFFFF” is output. [Reference information]
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


Name Symbol

<Operation>
DINT_TO_D_BCD
• When the operation result falls within the valid value range of the
DWORD type
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
DINT Convert DWORD
Function

(1) DINT_TO_D_BCD BCD-converts 2147483647 16#99999999


DINT type data to DWORD type data. EN=1 ENO=0
(2) When SPH is used, if the input DINT value
exceeds the valid range of DWORD type (SPH)
after type conversion, the boundary value DINT Convert DWORD
of DWORD type (BCD code) is output.
-2147483648 16#00000000
(3) When SPS is used, if the input DINT value
EN=1 ENO=0
exceeds 99999999 or is negative,
“16#FFFFFFFF” is output. DINT Convert DWORD
2147483647 16#FFFFFFFF (SPS)

[Reference information]
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-108
Arithmetic functions 2-5 FBD Language

2-5-4 Arithmetic functions


(1) Absolute value ABS_INT

Name, Symbol, Function Example


Name Symbol

<Operation>
ABS_INT
INT Compute INT
-20 20
EN=1 ENO=1

INT ABS_INT INT • When the input value is a negative maximum value (-32768)
INT Compute INT
-32768 32767
EN=1 ENO=0
Function

(1) ABS_INT computes and returns the


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


Name Symbol

<Operation>
ABS_DINT DINT DINT
Compute
-20 20
EN=1 ENO=1

DINT ABS_DINT DINT • When the input value is a negative maximum value (-2147483648)
DINT Compute DINT
-2147483648 2147483647
EN=1 ENO=0
Function

(1) ABS_DINT computes and returns the


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-109
2-5 FBD Language Arithmetic functions

(3) Absolute value ABS_REAL


Name, Symbol, Function Example
Name Symbol

<Operation>
ABS_REAL
REAL Compute REAL
-2.000E+1 2.000E+1
EN=1 ENO=1

REAL ABS_REAL REAL


Function

(1) ABS_REAL computes the absolute value


of REAL type data.

(4) Square root SQRT


Name, Symbol, Function Example
Name Symbol

<Operation>
SQRT
REAL Compute REAL
1.234E+07 3.5128E+03
EN=1 ENO=1

REAL SQRT REAL • When the input value is negative


REAL Compute REAL
-1.234E+07 0.0E+00 (SPH)
EN=1 ENO=0
Function

(1) SQRT computes the square root of REAL


type data. REAL REAL
(2) When SPH is used, if the input value is -1.234E+07 -NAN (SPS)
negative, a 0 is output and ENO is set to 0.
(3) The number of significant digits of the
output is 5.
(4) When SPS is used, if the input value is
negative, “-NAN” is output.

2-110
Arithmetic functions 2-5 FBD Language

(5) Natural logarithm LN


Name, Symbol, Function Example
Name Symbol

<Operation>
LN
REAL Compute REAL
1.234E+03 7.118E+00
EN=1 ENO=1

REAL LN REAL
y

y=lnX
Function

(1) LN computes the natural logarithm of 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 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.
(5) When SPS is used, if the input value is
negative, “-NAN” is output. If the input
value is 0 (zero), “-INF” is output.

(6) Common logarithm LOG

Name, Symbol, Function Example


Name Symbol

<Operation>
LOG
REAL Compute REAL
1.234E+03 3.091E+00
EN=1 ENO=1

REAL LOG REAL


y

y=log10X
Function

(1) LOG computes the common logarithm of


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.
(5) When SPS is used, if the input value is
negative, “-NAN” is output. If the input
value is 0 (zero), “-INF” is output.

2-111
2-5 FBD Language Arithmetic functions

(7) Exponent EXP

Name, Symbol, Function Example


Name Symbol

<Operation>
EXP
REAL Compute REAL
2.0E+00 7.389E+00
EN=1 ENO=1

REAL EXP REAL

y=eX
Function

(1) EXP computes the exponent of the input using the


base (e) as 2.718281.
1.0
(2) When SPH is used, if the operation result exceeds
the boundary value of REAL type, the boundary value x
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.
(5) When SPS is used, if the operation result exceeds
the boundary value of REAL type, “+INF” is output.

(8) Sine SIN


Name, Symbol, Function Example
Name Symbol

<Operation>
SIN
REAL Compute REAL
3.141E+00 5.926E-04
EN=1 ENO=1

REAL SIN REAL


y

y=sin x
1
Function

(1) SIN computes the sine of REAL type data.


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

2-112
Arithmetic functions 2-5 FBD Language

(9) Cosine COS

Name, Symbol, Function Example


Name

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

(10) Tangent TAN

Name, Symbol, Function Example


Name Symbol

<Operation>
TAN
REAL Compute REAL
7.854E-01 1.000E+00
EN=1 ENO=1

REAL TAN REAL

y
y=tan x
Function

(1) TAN computes the tangent of REAL type


data.
(2) The input must be given in radians. 1
(3) The number of significant digits of the
output is 4 if the input falls within -2π and
2π. The output has a large error if the x
- π π
3 3π
- π -π 0 π
absolute value of the input is greater if the 2 2 2 2
input is approximately an integral multiple
of π/2. -1
If the absolute value of input is greater than
or equal to 2π, computation is carried out
but with a large error.
31 31
(4) When an (input value) is < -2 or > 2 -1, Output error is large. Output error is large
an output value = 0 and ENO = 0.

2-113
2-5 FBD Language Arithmetic functions

(11) Arc sine ASIN

Name, Symbol, Function Example


Name

<Operation>
ASIN
REAL Compute REAL
Symbol

7.854E-01 9.033E-01
EN=1 ENO=1
REAL ASIN REAL
y

y=sin -1 x
Function

(1) ASIN computes the arc sine of REAL type π


2
data.
(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 -π/2 to π/2. A 0 is generated and
ENO is set to 0 if the input exceeds this π
-
value range. 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
(5) When SPS is used, if the input value is
outside the range from -1.0 to 1.0, “-NAN”
is output.

(12) Arc cosine ACOS


Name, Symbol, Function Example
Name Symbol

<Operation>
ACOS Compute
REAL REAL
7.854E-01 6.675E-01
EN=1 ENO=1

REAL ACOS REAL


y
y=cos -1 x
π
Function

(1) ACOS computes the arc cosine of REAL


type data. π
(2) The output is given in radians. 2
(3) The input must have a value range of -1.0
to +1.0 and the output must have a value
range of π to 0. A 0 is generated and
ENO is set to 0 if the input exceeds this x
-1.0 0 1.0
value range.
(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
(5) When SPS is used, if the input value is
outside the range from -1.0 to 1.0, “-NAN”
is output.

2-114
Arithmetic functions 2-5 FBD Language

(13) Arc tangent ATAN

Name, Symbol, Function Example


Name Symbol

<Operation>
ATAN
REAL Compute REAL
7.854E-01 6.6577E-01
EN=1 ENO=1

REAL ATAN REAL

y=tan -1 x y
Function

(1) ATAN computes the arc tangent of REAL π


type data. 2
(2) The output is given in radians.
(3) The input must have a value range of its
negative maximum value to its positive x
0
maximum value and the output must have
a value range of -π/2 to π/2.
(4) The number of significant digits of the -π
2
output is 5.

(14) Addition ADD

Name, Symbol, Function Example


Name Symbol

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

INT INT Compute


-32768 + -32768 0
EN=1 ENO=0
Function

(1) ADD adds the input data together.


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

2-115
2-5 FBD Language Arithmetic functions

(15) Subtraction SUB


Name, Symbol, Function Example
Name Symbol

<Operation>
SUB
• When the operation result falls within the valid value range of the operands
INT INT Compute
5678 - 1234 4444
EN=1 ENO=1
SUB • When the operation result exceeds the valid value range of the operands
ANY_NUM ANY_NUM
ANY_NUM
INT INT Compute
-32768 - 50 32718
EN=1 ENO=0
Function

(1) SUB subtracts the second input from the


first input.
(2) The data type of the input and output
operands must be the same.
(3) Available data type is ANY_NUM type
(REAL, INT, DINT, UINT, or UDINT).
(4) ENO is set to 0 if the operation result
exceeds the valid value range of the data Note: 1) The CPU performs no boundary processing when the result of subtracting
type of the operands (only for SPH). operands of types other than REAL type exceeds the valid value range of the
operands. Make sure that the result of the subtraction does not exceeds the
(5) If a data value is approaching so closely to valid value range of the operands. The CPU performs boundary processing
0 (zero) that no REAL type data can for REAL type operands (only for SPH).
represent it, an output value = 1 Note: 2) When SPS is used, no boundary processing is performed even when the
and ENO = 1 (only for SPH). operation result exceeds the valid range of the data type.

(16) Multiplication MUL


Name, Symbol, Function Example
Name Symbol

<Operation>
MUL • When the operation result falls within the valid value range of the operands

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 (SPH)
EN=1 ENO=0
INT INT Compute
32767 x 32767 1
Function

(1) MUL multiplies the input data together. EN=1 ENO=0


(2) The data type of the input and output Compute (SPS)
INT INT
operands must be the same.
-32768 x 32767 0
(3) ENO is set to 0 if the operation result
EN=1 ENO=0
exceeds the valid value range of the data
type of the operands (only for SPH). INT INT Compute
(4) Available data type is ANY_NUM type -32768 x 32767 -32768 (SPH)
(REAL, INT, DINT, UINT, or UDINT). EN=1 ENO=0
(5) If a data value is approaching so closely to
0 (zero) that no REAL type data can
represent it, an output value = 1 Note: When SPS is used, no boundary processing is performed even when the
and ENO = 1 (only for SPH). operation result exceeds the valid range of the data type.

2-116
Arithmetic functions 2-5 FBD Language

(17) Division DIV


Name, Symbol, Function Example
Name

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

(1) DIV divides the first input by the second 3940 / 0 32767 (SPH)
input. EN=1 ENO=0
(2) The data type of the input and output
operands must be the same. INT INT Compute
(3) ENO is set to 0 if the operation result / The SPS stops (SPS)
3940 0
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.
(6) If the divisor is 0, the maximum absolute
Notes: 1) When SPS is used, if the operation result exceeds the valid range of the
value with the sign of the dividend is data type, the SPS stops operation.
generated and ENO is set to 0 (only for Notes: 2) When SPS is used, if the divisor is 0 (zero) (except REAL type), the SPS
SPH). stops operation. In the case of REAL type, “-NAN” or “±INF” is output.

(18) Division remainder MOD

Name, Symbol, Function Example


Name Symbol

<Operation>
MOD
• When the operation result falls within the valid value range of the operands
INT INT Compute
234 MOD 4 2
EN=1 ENO=1
MOD
ANY_INT ANY_INT
ANY_INT
• When the divisor is 0
INT INT Compute
3940 MOD 0 0 (SPH)
EN=1 ENO=0
Function

(1) MOD divides the first input by the second


input and generates the remainder. INT INT Compute
(2) The data type of the input and output The SPS stops (SPS)
3940 MOD 0
operands must be the same.
(3) The output is set to 0 and ENO is set to 0
if the quotient exceeds the valid value
• When the quotient exceeds the valid value range of the operands
range of the data type of the operands
INT INT Compute
(only for SPH).
(4) Available data type is ANY_INT type -32768 MOD -1 0 (SPH)
(INT, DINT, UINT, or UDINT). EN=1 ENO=0
(5) If the divisor is 0, a 0 is generated and ENO
is set to 0 (only for SPH). INT INT Compute
(6) Remainder is calculated using the following -32768 MOD -1 The SPS stops (SPS)
equation:
(Divisor) x (Quotient) + (Remainder) Note: When SPS is used, if the quotient of the division exceeds the boundary value of
= (Dividend) the data type, or if the divisor is 0 (zero), the SPS stops operation.

2-117
2-5 FBD Language Arithmetic functions

(19) Exponent EXPT

Name, Symbol, Function Example


Name Symbol

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

power (exponent) of the second input. 1.230E+01 EXPT 2.500E+02 3.402E+38 (SPH)
(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 REAL REAL Compute
output. 1.230E+01 EXPT 2.500E+02 +INF (SPS)
(3) When SPH is used, base ≥ 0. If base < 0, EN=1 ENO=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.
(7) When SPS is used, if the operation result exceeds the boundary value of REAL type, “+INF” is output.
(8) When SPS is used, base ≥ 0. If base < 0, “-NAN” is output.

(20) Move MOVE


Name, Symbol, Function Example
Name

<Operation>
MOVE
DINT Output DINT
Symbol

32767 32767
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 number of
accesses. Refer to “Appendix Accessing the Processor Bus.”
Function

(1) MOVE outputs the input as it is.


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

2-118
Arithmetic functions 2-5 FBD Language

(21) Negation NEG


Name, Symbol, Function Example
Name Symbol

<Operation>
NEG
DINT Output DINT
123 -123
EN=1 ENO=1

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

DINT Output DINT


-2147483648 2147483647
Function

(1) NEG outputs the input data with its sign EN=1 ENO=1
negated.
(2) Available data are types INT, DINT, or INT Output INT
REAL. (Neither UINT nor UDINT must be 32767
-32768
specified.) EN=1 ENO=1
(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-119
2-5 FBD Language Bit string FCT

2-5-5 Bit string functions


(1) Shift left SHL_WORD

Name, Symbol, Function Example


Name Symbol

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

SHL_WORD After execution ENO=1 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 0


WORD IN WORD
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
UINT N
Function

(1) SHL_WORD shifts the first input


(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
Name Symbol

<Operation>
SHL_DWORD
Example of shifting 1 bit position
Before execution
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 1918 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 1918 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
After execution ENO=1
Function

(1) SHL_DWORD shifts the first input


(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-120
Bit string FCT 2-5 FBD Language

(3) Shift right SHR_WORD

Name, Symbol, Function Example


Name Symbol

<Operation>
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
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
Name Symbol

<Operation>
SHR_DWORD
Example of shifting 1 bit position
Before execution EN=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 1
“0” 31 30 29 28 27 26 25 24 23 22 21 20 1918 17 16 15 14 13 12 1110 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 1918 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
After execution ENO=1

(1) SHR_DWORD shifts the first input


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-121
2-5 FBD Language Bit string FCT

(5) Rotate left ROL_WORD


Name, Symbol, Function Example
Name Symbol

<Operation>
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 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

ROL_WORD
WORD IN WORD
UINT N
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

(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
Name Symbol

<Operation>
ROL_DWORD
Example of rotating 1 bit position
Before execution EN=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 1
31 30 29 28 27 26 25 24 23 22 21 20 1918 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 1918 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
After execution ENO=1
Function

(1) ROL_DWORD rotates the first input


(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-122
Bit string FCT 2-5 FBD Language

(7) Rotate right ROR_WORD


Name, Symbol, Function Example
Name Symbol

<Operation>
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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

ROR_WORD
WORD IN WORD
UINT N After execution ENO=1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1
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 Function


Name Symbol

<Operation>
ROR_DWORD
Example of rotating 1 bit position
Before execution EN=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 1
31 30 29 28 27 26 25 24 23 22 21 20 1918 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 1918 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

After execution ENO=1


(1) ROR_DWORD rotates the first input
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 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-123
2-5 FBD Language Bit string FCT

(9) Logical product AND

Name, Symbol, Function Example


Name Symbol

<Operation>
AND
Input WORD 0 1 1 0 1 0 0 1 0 1 1 1 1 0 1 0

6 9 7 A

AND EN=1
AND
ANY_BIT ANY_BIT
ANY_BIT Input WORD 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1

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


Name Symbol

<Operation>
OR
Input WORD 0 1 0 1 1 1 0 0 0 1 1 1 0 0 1 1

5 C 7 3

OR EN=1
OR
ANY_BIT ANY_BIT
ANY_BIT Input WORD 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0

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-124
Bit string FCT 2-5 FBD Language

(11) Exclusive XOR

Name, Symbol, Function Example


Name Symbol

<Operation>
XOR
Input WORD 0 0 1 1 1 1 0 0 1 1 0 0 0 0 0 0

3 C C 0

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


Name Symbol

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

ANY_BIT NOT ANY_BIT NOT

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


Function

(1) NOT generates an inverted bit string of the


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

2-125
2-5 FBD Language Bit string FCT

(13) Negation NOT_BOOL

Name, Symbol, Function Example


Name Symbol

<Operation>
NOT_BOOL • When the input data has a value of “1”
NOT
1 0
EN=1 ENO=1
BOOL NOT_BOOL BOOL
• When the input data has a value of “0”
NOT
0 1
EN=1 ENO=1
Function

(1) NOT_BOOL generates an inverted value


of BOOL data.

(14) Negation NOT_WORD


Name, Symbol, Function Example
Name Symbol

<Operation>
NOT_WORD
Input WORD EN=1 0 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0

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


Function

(1) NOT_WORD inverts each bit of WORD


data.

2-126
Bit string FCT 2-5 FBD Language

(15) Negation NOT_DWORD


Name, Symbol, Function Example
Name Symbol

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

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
Function

(1) NOT_DWORD inverts each bit of DWORD


data.

2-127
2-5 FBD Language Selection/comparison FCT

2-5-6 Selection/comparison functions


(1) Select SEL
Name, Symbol, Function Example
Name Symbol

<Programming example>
SEL_*

SEL_INT
FLAG G OUTPUT
SEL_BOOL INDATA1 IN0
BOOL G BOOL
BOOL IN0 INDATA2 IN1
BOOL IN1

SEL_INT
<Operation>
BOOL G INT • When “FLAG” has a value of “0”
INT IN0
INDATA1 12345
INT IN1
OUTPUT 12345

SEL_DINT
INDATA2 5000
BOOL G DINT
DINT IN0
DINT IN1
• When “FLAG” has a value of “1”
INDATA1 12345
SEL_UINT
BOOL G UINT OUTPUT 5000
UINT IN0 INDATA2 5000
UINT IN1

SEL_UDINT Note:
BOOL G UDINT No. of characters for STRING type when SPH is used:
UDINT IN0 0 to 64 (single-byte, double-byte)
UDINT IN1 No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

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
Function

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


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-128
Selection/comparison FCT 2-5 FBD Language

(2) Maximum value MAX

Name, Symbol, Function Example


Name Symbol

<Programming example>
MAX_*

MAX_INT
INDATA1 OUTPUT
MAX_INT
INT INT INDATA2
INT

MAX_DINT
DINT DINT <Operation>
DINT 1234
INDATA1
INDATA2 0 OUTPUT 1234
MAX_UINT
UINT UINT
UINT

MAX_UDINT
UDINT UDINT
UDINT

MAX_REAL
REAL REAL
REAL
Function

(1) MAX_* outputs the maximum value of the


inputs.

(3) Minimum value MIN


Name, Symbol, Function Example
Name Symbol

<Programming example>
MIN_*

MIN_INT
INDATA1 OUTPUT
MIN_INT
INT INT INDATA2
INT

MIN_DINT
DINT DINT <Operation>
DINT
INDATA1 1234
INDATA2 5678 OUTPUT 1234
MIN_UINT
UINT UINT
UINT

MIN_UDINT
UDINT UDINT
UDINT

MIN_REAL
REAL REAL
REAL
Function

(1) MIN_* outputs the minimum value of the


inputs.

2-129
2-5 FBD Language Selection/comparison FCT

(4) Limit LIMIT


Name, Symbol, Function Example
Name Symbol

<Programming example>
LIMIT_*

LIMIT_INT
MNDATA OUTPUT
INDATA
LIMIT_INT MXDATA
INT MN INT
INT IN
INT MX
<Operation>
• When “INDATA” ≤ “MNDATA”
LIMIT_DINT
DINT MN DINT MNDATA 1000
DINT IN
INDATA 0 OUTPUT 1000
DINT MX
MXDATA 5000

LIMIT_UINT • When “MNDATA” < “INDATA” < “MXDATA”


UINT MN UINT
UINT IN MNDATA 1000
UINT MX
INDATA 3000 OUTPUT 3000
MXDATA 5000
LIMIT_UDINT
UDINT MN UDINT
UDINT IN • When “INDATA” ≥ “MXDATA”
UDINT MX
MNDATA 1000
INDATA 5500 OUTPUT 5000
LIMIT_REAL MXDATA
REAL MN REAL 5000
REAL IN
REAL MX
Function

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


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

Note: When SPS is used, if “MN” is greater than


“MX” for LIMIT_UINT or LIMIT_UDINT, “MN”
is output.

2-130
Selection/comparison FCT 2-5 FBD Language

(5) Comparison (>) GT

Name, Symbol, Function Example


Name Symbol

<Programming example> Note: Example of a program for SPH


GT

GT
INDATA1 FLAG
INDATA2
GT INDATA3
elementary BOOL
INDATA4
elementary
INDATA5

elementary
(SPH)
<Operation>
• When the input is of INT type
GT
elementary BOOL
elementary
INDATA1 12345
INDATA2 10000
(SPS) INDATA3 1000
INDATA4 900

(1) GT outputs a 1 if the conditions first input > INDATA5 30


Function

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


GT outputs a 0 if the above conditions are Consequently,
not met. INDATA1 > INDATA2 > INDATA3 > INDATA4 > INDATA5 hold, and
(2) The data type of the input operands must FLAG is set to 1.
be the same.
(3) Available data types are ANY_NUM type
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD),
ANY_DATE type (DT, DATE, or TOD), and
TIME type.
When SPS is used, none of BOOL type and
ANY_DATE type can be used.
(4) The maximum number of inputs is 16 (only
for SPH).
When SPS is used, the input cannot be
extended. Fixed to two inputs.

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-131
2-5 FBD Language Selection/comparison FCT

(6) Comparison (≥) GE

Name, Symbol, Function Example


Name Symbol

<Programming example> Note: Example of a program for SPH


GE

GE
TIME1 FLAG
TIME2
GE TIME3
elementary BOOL
TIME4
elementary
TIME5

elementary
(SPH)
<Operation>
• When the input is of TIME type
GE
elementary BOOL
elementary TIME1 10m5s
TIME2 10m5s
TIME3 9m10s
(SPS)
TIME4 20s
TIME5 0s
(1) GE outputs a 1 if the conditions first input
Function

≥ second input ≥ third input ≥ ... are met. This program results in TIME1 ≥ TIME2 ≥ TIME3 ≥ TIME4 ≥ TIME5,
GE outputs a 0 if the above conditions are which sets a FLAG to 1.
not met.
(2) The data type of the input operands must
be the same.
(3) Available data types are ANY_NUM type
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD),
ANY_DATE type (DT, DATE, or TOD), and
TIME type.
When SPS is used, none of BOOL type and
ANY_DATE type can be used.
(4) The maximum number of inputs is 16 (only
for SPH).
When SPS is used, the input cannot be
extended. Fixed to two inputs.

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-132
Selection/comparison FCT 2-5 FBD Language

(7) Comparison (=) EQ


Name, Symbol, Function Example
Name Symbol

<Programming example> Note: Example of a program for SPH


EQ

EQ
DATE1 FLAG
DATE2
EQ DATE3
elementary BOOL
DATE4
elementary
DATE5
.
.
.
elementary
(SPH)
<Operation>
• When the input is of DATE type
EQ
elementary BOOL
elementary DATE1 1984-06-25
DATE2 1972-02-14
DATE3 1973-09-23
(SPS)
DATE4 1991-08-07
DATE5 1994-06-04
Function

(1) EQ outputs a 1 if the conditions first input


= second input = third input = ... are met. This program results in DATE1 ≠ DATE2 ≠ DATE3 ≠ DATE4 ≠ DATE5,
EQ outputs a 0 if the above conditions are which sets a FLAG to 1.
not met.
(2) The data type of the input operands must
be the same.
(3) Available data types are ANY_NUM type
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD),
ANY_DATE type (DT, DATE, or TOD), and
TIME type.
When SPS is used, none of ANY_DATE
type can be used.
(4) The maximum number of inputs is 16 (only
for SPH).
When SPS is used, the input cannot be
extended. Fixed to two inputs.

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-133
2-5 FBD Language Selection/comparison FCT

(8) Comparison (≤) LE


Name, Symbol, Function Example
Name Symbol

<Programming example> Note: Example of a program for SPH


LE

LE
TD1 FLAG
TD2
LE TD3
elementary BOOL
TD4
elementary
. TD5
.
.
elementary
(SPH)
<Operation>
• When the input is of TOD type
LE
elementary BOOL
elementary TD1 15:36:34
TD2 15:37:50
TD3 15:40:00
(SPS)
TD4 15:50:11
TD5 18:00:20
Function

(1) LE outputs a 1 if the conditions first input


≤ second input ≤ third input ≤ ... are met. This program results in TD1 ≤ TD2 ≤ TD3 ≤ TD4 ≤ TD5,
LE outputs a 0 if the above conditions are which sets a FLAG to 1.
not met.
(2) The data type of the input operands must
be the same.
(3) Available data types are ANY_NUM type
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD),
ANY_DATE type (DT, DATE, or TOD), and
TIME type.
When SPS is used, none of BOOL type and
ANY_DATE type can be used.
(4) The maximum number of inputs is 16 (only
for SPH).
When SPS is used, the input cannot be
extended. Fixed to two inputs.

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-134
Selection/comparison FCT 2-5 FBD Language

(9) Comparison (<) LT

Name, Symbol, Function Example


Name Symbol

<Programming example> Note: Example of a program for SPH


LT

LT
INDATA1 FLAG
INDATA2
LT INDATA3
elementary BOOL
INDATA4
elementary
INDATA5

elementary
(SPH)
<Operation>
• When the input is of INT type
LT
elementary BOOL
elementary INDATA1 -12345
INDATA2 -100
INDATA3 0
(SPS)
INDATA4 100
INDATA5 12345
Function

(1) LT outputs a 1 if the conditions first input


< second input < third input < ... are met. This program results in
LT outputs a 0 if the above conditions are INDATE1 < INDATE2 < INDATE3 < INDATE4 < INDATE5,
not met. which sets a FLAG to 1.
(2) The data type of the input operands must
be the same.
(3) Available data types are ANY_NUM type
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD),
ANY_DATE type (DT, DATE, or TOD), and
TIME type.
When SPS is used, none of BOOL type and
ANY_DATE type can be used.
(4) The maximum number of inputs is 16 (only
for SPH).
When SPS is used, the input cannot be
extended. Fixed to two inputs.

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-135
2-5 FBD Language Selection/comparison FCT

(10) Comparison (≠) NE


Name, Symbol, Function Example
Name Symbol

<Programming example>
NE

NE
INDATA1 FLAG
INDATA2
NE
elementary BOOL
elementary <Operation>
• When the input is of REAL type

INDATA1 2.0E-10
Function

(1) NE outputs a 1 if the condition that the first


input ≠ the second input is met. NE outputs
a 0 if the above condition is not met. INDATA2 2.0E+10
(2) The data type of the input operands must
be the same. This program results in INDATE1 ≠ INDATE2 which sets a FLAG to 1.
(3) Available data types are ANY_NUM type
(REAL, INT, DINT, UINT, UDINT),
ANY_BIT type (BOOL, WORD, DWORD),
ANY_DATE type (DT, DATE, or TOD), and
TIME type.
When SPS is used, none of ANY_DATE
type can be used.

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-136
Character string FCT 2-5 FBD language

2-5-7 Character string functions


(1) Get length LEN

Name, Symbol, Function Example


Name Symbol

<Operation>
LEN

STRING ABCDEFGHIJ EN=1

STRING LEN INT Compute

INT 10 ENO=1
Function

(1) LEN outputs an INT type data that indicates


the number of characters in the input data Note:
of STRING type. No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

(2) Get left sub-string LEFT


Name, Symbol, Function Example
Name Symbol

<Operation>
LEFT
STRING ABCDEFGHIJ

UINT 5 EN=1
LEFT
STRING IN STRING
UINT L Extract

STRING ABCDE ENO=1


Function

(1) LEFT extracts a sub-string of the length


designated by the second input from the
left side of the STRING data designated
by the first input.
(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. Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

2-137
2-5 FBD Language Character string FCT

(3) Get right sub-string RIGHT


Name, Symbol, Function Example
Name Symbol

<Operation>
RIGHT
STRING ABCDEFGHIJ EN=1

UINT 5
RIGHT
STRING IN STRING
UINT L
Extract

STRING FGHIJ ENO=1


Function

(1) RIGHT extracts a sub-string of the length


designated by the second input from the
right side of the STRING type data
designated by the first input.
(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
Note:
and sets ENO to 1.
No. of characters for STRING type when SPH is used:
(3) Only NULL is output and ENO is set to 1 0 to 64 (single-byte, double-byte)
if the number of characters to extract is No. of characters for STRING type when SPS is used:
equal to 0. 0 to 80 (single-byte), 0 to 40 (double-byte)

(4) Get middle sub-string MID


Name, Symbol, Function Example
Name Symbol

MID <Operation>

STRING ABCDEFGHIJ EN=1

MID
STRING IN STRING UINT 5 (Second input)
UINT L
UINT P (Third input)
UINT 3
Function

(1) MID extracts a sub-string of the length Extract


designated by the second input starting
from the Pth character position
(the third input) in the first input of STRING STRING CDEFG ENO=1
type.
(2) When SPH is used, if P≥ 65 or P = 0, only
NULL is output and ENO is set to 0.
(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.
Note:
(5) Only NULL is output and ENO is set to 1 No. of characters for STRING type when SPH is used:
if the number of extracted characters = 0. 0 to 64 (single-byte, double-byte)
(6) When SPS is used, if P ≥ 81 or P=0, only No. of characters for STRING type when SPS is used:
NULL is output. 0 to 80 (single-byte), 0 to 40 (double-byte)

2-138
Character string FCT 2-5 FBD Language

(5) Concatenate CONCAT

Name, Symbol, Function Example


Name Symbol

<Operation>
CONCAT EN=1
STRING ABCDEFGHIJ (First input)

STRING XYZ (Second input)


CONCAT
STRING STRING
STRING
Concatenate

STRING ABCDEFGHIJXYZ ENO=1


Function

(1) CONCAT concatenates the string


designated by the second input to the first
input of STRING type.
(2) When SPH is used, if the number of
characters to be 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
Note:
= 0.
No. of characters for STRING type when SPH is used:
(4) When SPS is used, if the number of 0 to 64 (single-byte, double-byte)
concatenated characters exceeds 80, the No. of characters for STRING type when SPS is used:
first 80 characters are output. 0 to 80 (single-byte), 0 to 40 (double-byte)

(6) Insert string INSERT

Name, Symbol, Function Example


Name Symbol

<Operation>
INSERT EN=1
STRING ABCDEFGHIJ (First input)

STRING XYZ (Second input)


INSERT
STRING IN1 STRING
STRING IN2 UINT 4 (Third input)
UINT P

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) When SPH is used, if the number of
characters to be inserted exceeds 64
characters, only the first 64 characters are
output and ENO is set to 0.
(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
Note:
before the first input and ENO is set to 1.
No. of characters for STRING type when SPH is used:
(5) When SPS is used, if the number of 0 to 64 (single-byte, double-byte)
combined characters exceeds 80, the first No. of characters for STRING type when SPS is used:
80 characters after insertion are output. 0 to 80 (single-byte), 0 to 40 (double-byte)

2-139
2-5 FBD Language Character string FCT

(7) Delete string DELETE


Name, Symbol, Function Example
Name Symbol

<Operation>
DELETE
EN=1
STRING ABCDEFGHIJ (First input)
DELETE
STRING IN STRING
UINT 3 (Second input)
UINT L
UINT P
UINT 5 (Third input)
Function

(1) DELETE deletes the number of characters


designated by the second input from the first input
Delete
of STRING type starting at the Pth position
(third input).
(2) When SPH is used, if P ≥ 65 or P = 0, the output STRING ABCDHIJ ENO=1
is NULL and ENO is set to 0.
(3) If the number of characters of the first input < P,
the first input is output and ENO is set to 0.
(4) When SPH is used, if the output is longer than 65
characters, the first 64 characters are output and
ENO is set to 0.
(5) If L = 0, the first input is output as is and ENO is
set to 1.
Note:
(6) When SPS is used, if P ≥ 81 or P=0, the output
No. of characters for STRING type when SPH is used:
is NULL. 0 to 64 (single-byte, double-byte)
(7) When SPS is used, if 81 characters or more are to No. of characters for STRING type when SPS is used:
be output, only the first 80 characters are output. 0 to 80 (single-byte), 0 to 40 (double-byte)

(8) Replace string REPLACE

Name, Symbol, Function Example


Name Symbol

<Operation>
REPLACE
EN=1
STRING ABCDEFGHIJ (First input)
REPLACE
STRING IN1 STRING
STRING XYZ (Second input)
STRING IN2
UINT L
UINT P UINT 5 (Third input)
Function

(1) Deletes the indicated number of charactersin the UINT 3 (Fourth input)
third input starting from the Pth one (the fourth
input) of the STRING type data in the first input
and inserts the string in the second input. Replace
(2) When SPH is used, if the number of replaced
characters exceeds 64 characters, the first 64
characters are stored and ENO is set to 0. STRING ABXYZHIJ ENO=1
(3) When SPH is used, if P ≥ 65 or P = 0, the output
is NULL and ENO is 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
Note:
Pth character position and ENO is set to 1.
No. of characters for STRING type when SPH is used:
(6) When SPS is used, if the number of characters 0 to 64 (single-byte, double-byte)
exceeds 80 after replacement, only the first 80 No. of characters for STRING type when SPS is used:
characters are output. 0 to 80 (single-byte), 0 to 40 (double-byte)

2-140
Character string FCT 2-5 FBD Language

(9) Find string FIND


Name, Symbol, Function Example
Name Symbol

FIND <Operation>

EN=1
STRING ABXYZHIJ (First input)

FIND
STRING IN1 INT
STRING IN2 STRING XYZ (Second input)

Find

(1) FIND searches the first input of STRING


Function

INT 3 ENO=1
type for the same string designated by the
second input and outputs the position of
the first occurrence of the string.
(2) A “0” is output if no matching string is found. Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

(10) Compare string (>) GT_STRING

Name, Symbol, Function Example


Name Symbol

<Programming example>
GT_STRING

GT_STRING
INDATA1 IN1 FLAG
INDATA2 IN2
GT_STRING
STRING IN1 BOOL
STRING IN2
<Operation>
1-byte character Character code
INDATA1 82A8, 0061, 0062
Function

(1) GT_STRING outputs a 1 if the condition INDATA2 82A6, [0000], [0000]


first input > second input is met. It outputs
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 Note: 1) The function regards a 1-byte character as a 16-bit code by placing
sequence of character codes and an 8-bit “00” in the higher-order byte position of the 16-bit code.
compares the character codes as numeric 2) If the strings to compare have different lengths, “0000” is appended
data. to the shorter string from the right side.
3) The SPS compares characters by shifted JIS code.

Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

2-141
2-5 FBD Language Character string FCT

(11) Compare string (≥) GE_STRING


Name, Symbol, Function Example
Name Symbol

<Programming example>
GE_STRING

GE_STRING
String 1 IN1 FLAG
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
String 2 82C882C2
a 0 if the above condition is not met.
(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.
Note: The SPS compares characters by shifted JIS code.

Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

(12) Compare string (=) EQ_STRING


Name, Symbol, Function Example
Name Symbol

<Programming example>
EQ_STRING

EQ_STRING
Code 1 IN1 FLAG
Code 2 IN2
EQ_STRING
STRING IN1 BOOL
STRING IN2
<Operation>

Code 1 ABCD
Function

(1) EQ_STRING outputs a 1 if the condition 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.
(3) GT_STRING converts the string into a Code 1 = Code 2 holds, and FLAG is set to 1.
sequence of character codes and
compares the character codes as numeric
data.
Note: The SPS compares characters by shifted JIS code.

Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

2-142
Character string FCT 2-5 FBD Language

(13) Compare string (≤) LE_STRING


Name, Symbol, Function Example
Name Symbol

<Programming example>
LE_STRING

LE_STRING
STR_1 IN1 FLAG
STR_2 IN2
LE_STRING
STRING IN1 BOOL
STRING IN2
<Operation>

STR_1 82A0, 82A7


Function

(1) LE_STRING outputs a 1 if the condition STR_2 82A0, 82A9


first input ≤ second input is met. It outputs
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 STR_1 ≤ STR_2 holds, and FLAG is set to 1.
sequence of character codes and
compares the character codes as numeric
data.
Note: The SPS compares characters by shifted JIS code.

Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

(14) Compare string (<) LT_STRING


Name, Symbol, Function Example
Name Symbol

<Programming example>
LT_STRING

LT_STRING
SD1 IN1 FLAG
SD2 IN2
LT_STRING
STRING IN1 BOOL
STRING IN2
<Operation>

SD1 D 8263
Function

(1) LT_STRING outputs a 1 if the condition SD2 E 8264


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.
(3) LT_STRING converts the string into a SD1 < SD2 holds, and FLAG is set to 1.
sequence of character codes and
compares the character codes as numeric
data.
Note: The SPS compares characters by shifted JIS code.

Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

2-143
2-5 FBD Language Character string FCT

(15) Compare string (≠) NE_STRING


Name, Symbol, Function Example
Name Symbol

<Programming example>
NE_STRING

NE_STRING
Message 1 IN1 FLAG
Message 2 IN2
NE_STRING
STRING IN1 BOOL
STRING IN2 <Operation>

Message 1 ON Compute
FLAG 1
Function

(1) NE_STRING outputs a 1 if the condition


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.
Note: The SPS compares characters by shifted JIS code.

Note:
No. of characters for STRING type when SPH is used:
0 to 64 (single-byte, double-byte)
No. of characters for STRING type when SPS is used:
0 to 80 (single-byte), 0 to 40 (double-byte)

2-144
Time type data FCT 2-5 FBD Language

2-5-8 Time type data functions


(1) Add time ADD_T_T
Name, Symbol, Function Example
Name Symbol

<Operation>
ADD_T_T
• When the operation results falls within the limit value range of the data type

TIME TIME Compute TIME


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

(1) ADD_T_T adds together TIME type data.


(2) The overflow condition is ignored and ENO 30d2h10m20s123ms + 25d1h09m50s456ms
is set to 0 if the operation result exceeds EN=1 TIME
Compute
the limit value range of the TIME type.
5d10h17m23s283ms
[Reference information]
Value range of TIME type (SPH) : 0 to 4,294,967,295 (ms) ENO=0
(SPS) : 0 to 2,147,483,647 (ms)

(2) Add time ADD_TD_T ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
ADD_TD_T • When the operation results falls within the limit value range of the data type

TOD TIME Compute TOD


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

TOD TIME Compute TOD


(1) ADD_TD_T adds together TOD type data
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 ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
ADD_DT_T
DT TIME
1997-06-25-10:10:00 + 7d20h30m40s567ms
ADD_DT_T EN=1
DT DT
Compute DT
TIME
1997-07-03-06:40:40
ENO=1
Function

(1) ADD_DT_T adds together DT type data


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-145
2-5 FBD Language Time type data FCT

(4) Subtract time SUB_T_T

Name, Symbol, Function Example


Name Symbol

<Operation>
SUB_T_T • When the operation results falls within the limit value range of the data type

TIME TIME Compute TIME


SUB_T_T 2h10m20s123ms - 1h29s667ms
TIME TIME 1h09m50s456ms
TIME EN=1 ENO=1

• When the operation result exceeds the limit value range of the data type
Function

(1) SUB_T_T performs a subtraction on TIME


type data. TIME TIME
(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. [Reference information]
ENO=0
(Limit values: 0, 49d17h02m47s295ms) Value range of TIME type (SPH) : 0 to 4,294,967,295 (ms)
(SPS) : 0 to 2,147,483,647 (ms)

(5) Subtract time SUB_D_D ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
SUB_D_D • When the operation results falls within the limit value range of the data type

DATE DATE Compute TIME


DATE
SUB_D_D 1997-06-25 - 1997-06-20 5d
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


Function

DATE DATE Compute TIME


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 ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
SUB_TD_T • When the operation results falls within the limit value range of the data type

TOD TIME Compute TOD


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


Function

TOD TIME Compute TOD


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-146
Time type data FCT 2-5 FBD Language

(7) Subtract time SUB_TD_TD ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
SUB_TD_TD
TOD TOD Compute TIME
15:30:15 - 08:15:08 7h15m7s0ms
SUB_TD_TD EN=1 ENO=1
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 ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
SUB_DT_T
DT TIME
1997-06-25-10:10:00 - 7d20h30m40s567ms
SUB_DT_T EN=1
DT DT
TIME Compute DT
1997-06-17-13:39:20
ENO=1
Function

(1) SUB_DT_T performs a subtraction on DT


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 ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
SUB_DT_DT
DT DT
1998-04-02-15:30:15 - 1998-04-01-08:15:08
SUB_DT_DT EN=1
DT TIME
DT Compute TIME
1d7h15m7s0ms
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-147
2-5 FBD Language Time type data FCT

(10) Multiply time MUL_T_N


Name, Symbol, Function Example
Name Symbol

<Operation>
MUL_T_N
• When the operation results falls within the limit value range of the data type

TIME UDINT Compute TIME


5h30m x 2 11h
MUL_T_N EN=1 ENO=1
TIME TIME
UDINT
• When the operation result exceeds the limit value range of the data type

TIME UDINT Compute TIME


Function

(1) MUL_T_N multiplies TIME type data by the 7d20h30m40s567ms x 20 49d17h02m47s295ms


second input data. EN=1 ENO=0
(2) If the operation result exceeds the limit
value range of the data type, the limit value Note: When SPS is used, even if the operation result exceeds the boundary
of the data type is output and ENO is set value of the data type, no boundary processing is performed.
to 0. Be careful so that no overflow will occur.

[Reference information]
Value range of TIME type (SPH) : 0 to 4,294,967,295 (ms)
(SPS) : 0 to 2,147,483,647 (ms)

(11) Multiply time MUL_T_R

Name, Symbol, Function Example


Name Symbol

<Operation>
MUL_T_R • When the operation results falls within the limit value range of the data type
TIME REAL Compute TIME
5h30m x 2.5E+0 13h45m
EN=1 ENO=1
MUL_T_R
TIME TIME
• When the operation result exceeds the limit value range of the data type
REAL
TIME REAL Compute TIME
5h30m x 2.5E+3 49d17h02m47s295ms
EN=1 ENO=0

(1) MUL_T_R multiplies TIME type data by the


Function

second input data. Note: In this multiplication, TIME type data is converted to REAL type data
(2) When the result exceeds the positive data and the result is converted to TIME type again. Consequently, the
type boundary value, a TIME type precision of the operation result is identical to that of REAL type.
boundary value is output, resulting in
ENO = 0.
(3) Correct output value is not guaranteed if
the operation result is negative. ENO is
[Reference information]
set to 0 in this case. Value range of TIME type (SPH) : 0 to 4,294,967,295 (ms)
(SPS) : 0 to 2,147,483,647 (ms)

2-148
Time type data FCT 2-5 FBD Language

(12) Divide time DIV_T_N


Name, Symbol, Function Example
Name Symbol

<Operation>
DIV_T_N • When the operation results falls within the limit value range of the data type

TIME UDINT Compute TIME


5h30m ÷ 2 2h45m
DIV_T_N EN=1 ENO=1
TIME TIME
UDINT
• When a divider is 0

TIME UDINT Compute TIME


÷
Function

(1) DIV_T_N performs a division on TIME type 5h30m 2 49d17h02m47s295ms


data.
(2) Any digits in the result less than ms-unit
digits are truncated.
(3) When a divider is 0, a TIME type of
boundary value is output, resulting in
ENO = 0.
[Reference information]
Note: When SPS is used, if divisor is 0 (zero), Value range of TIME type (SPH) : 0 to 4,294,967,295 (ms)
the SPS stops operation. (SPS) : 0 to 2,147,483,647 (ms)

(13) Divide time DIV_T_R

Name, Symbol, Function Example


Name Symbol

<Operation>
DIV_T_R • When the operation results falls within the limit value range of the data type

TIME REAL Compute TIME


5h30m ÷ 2.5E+0 2h12m
DIV_T_R EN=1 ENO=1
TIME TIME

REAL
• When the operation result exceeds the limit value range of the data type

TIME REAL Compute TIME


5h30m ÷ 1.0E-4 49d17h2m47s295ms
(1) DIV_T_R multiplies TIME type data by the
Function

EN=1 ENO=0
second input data.
(2) If the operation result exceeds the limit Note: In this multiplication, TIME type data is converted to REAL type data
value range of the data type, the limit value and the result is converted to TIME type again. Consequently,
of the data type is output and ENO is set the precision of the operation result is identical to that of REAL type.
to 0.
(Limit value: 49d17h02m47s295ms) • When a divider is 0
(3) Correct output value is not guaranteed if
the operation result is negative. ENO is TIME REAL Compute TIME
set to 0 in this case. 5h30m ÷ 0.0E+0 49d17h2m47s295ms
(4) The ms fraction of the operation result is
rounded off.
(5) When a divider is 0, a TIME type of [Reference information]
boundary value is output, resulting in Value range of TIME type (SPH) : 0 to 4,294,967,295 (ms)
(SPS) : 0 to 2,147,483,647 (ms)
ENO = 0.

2-149
2-5 FBD Language Time type data FCT

(14) Concatenate time CONCAT_D_D ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
CONCAT_D_D
• When the operation results falls within the limit value range of the data type
DATE TOD Compute DT
1997-06-25 10:10:00 1997-06-25-10:10:00
EN=1 Concatenate ENO=1
CONCAT_D_D
DATE DT
TOD • When the operation result exceeds the limit value range of the data type
DATE TOD Compute DT
2106-02-07 10:10:00 Undefined
(1970-01-01-03:41:44)
Function

(1) CONCAT_D_D concatenates TOD type


data to DATE type data and outputs DT An actually output value

type data.
(2) Correct output value is not guaranteed if
the operation result exceeds the limit
value range of the data type.
ENO is set to 0 in this case.

(15) Convert DT to TOD DT_TO_TOD ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
DT_TO_TOD
DT Convert TOD
1997-06-25-10:10:00 10:10:00.00
EN=1 ENO=1

DT DT_TO_TOD TOD
Function

(1) DT_TO_TOD extracts the time part of DT


type data and outputs TOD type data.

(16) Convert DT to DATE DT_TO_DATE ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
DT_TO_DATE
DT Convert DATE
1997-06-25-10:10:00 1997-06-25
EN=1 ENO=1

DT DT_TO_DATE DATE
Function

(1) DT_TO_DATE extracts the date part of DT


type data and outputs DATE type data.

2-150
Original FCT 2-5 FBD Language

2-5-9 Original FCTs (Functions)


(1) Set bit SBIT_WORD
Name, Symbol, Function Example
Name Symbol

<Operation>
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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

SBIT_WORD
WORD IN WORD UINT 5
UINT N
Set
WORD
0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 ENO=1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Function

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


(WORD type) and outputs the resulting
WORD type data.
(2) Available data type for “IN” is UNIT 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


Name Symbol

<Operation>
SBIT_DWORD • When bit “N” is read normally

DWORD 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
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
DWORD ENO=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 1
Function

(1) SBIT_DWORD sets the “Nth” bit of “IN” 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


(WORD type) and outputs the resulting
DWORD type data.
(2) Available data type for “IN” is UNIT type.
(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-151
2-5 FBD Language Original FCT

(3) Reset bit RBIT_WORD


Name, Symbol, Function Example
Name Symbol

<Operation>
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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

RBIT_WORD
WORD IN WORD UINT 5
UINT N
Reset

WORD 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 ENO=1
Function

(1) RBIT_WORD resets the “Nth” bit of “IN” 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0


(WORD type) and outputs the resulting
WORD type data.
(2) Available data type for “IN” is UNIT 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


Name Symbol

<Operation>
RBIT_DWORD • When bit “N” is read normally

DWORD EN=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 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
DWORD ENO=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
Function

(1) RBIT_DWORD resets the “Nth” bit of “IN” 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


(WORD type) and outputs the resulting
DWORD type data.
(2) Available data type for “IN” is UNIT type.
(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-152
Original FCT 2-5 FBD Language

(5) Test bit TBIT_WORD

Name, Symbol, Function Example


Name Symbol

<Operation>
TBIT_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
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

TBIT_WORD
WORD IN BOOL UINT 5
UINT N
Test

BOOL 0 ENO=1
Function

(1) TBIT_WORD tests (1 or 0) the “Nth” bit of


“IN” (WORD type) and outputs a
BOOL type data.
(2) Available data type for “IN” is UNIT 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


Name Symbol

<Operation>
TBIT_DWORD
• When bit “N” is read normally

DWORD 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
Test
BOOL
0 ENO=1
Function

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


of “IN” (DWORD type) and outputs a
BOOL type data.
(2) Available data type for “IN” is UNIT 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-153
2-5 FBD Language Original FCT

(7) Decode DECODE_WORD

Name, Symbol, Function Example


Name Symbol

<Operation>
DECODE_WORD
UINT 5 EN=1

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
Function

(1) DECODE_WORD outputs WORD type


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

<Operation>
DECODE_DWORD
UINT 18 EN=1

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 1615 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Function

(1) DECODE_DWORD outputs DWORD


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

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

Encode
WORD ENCODE_WORD UINT

UINT 5 ENO=1
Function

(1) ENCODE_WORD outputs a UINT type


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-154
Original FCT 2-5 FBD Language

(10) Encode ENCODE_DWORD


Name, Symbol, Function Example
Name Symbol

<Operation>
ENCODE_DWORD

DWORD EN=1
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

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

UINT 18 ENO=1
Function

(1) ENCODE_DWORD outputs a UINT type


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

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

Count
WORD BITCOUNT_WORD UINT

UINT 5 ENO=1
Function

(1) BITCOUNT_WORD outputs a UINT type


data that indicates the number of on bits
in the input (WORD type data).

(12) Bit count BITCOUNT_DWORD

Name, Symbol, Function Example


Name Symbol

<Operation>
BITCOUNT_DWORD

DWORD EN=1
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
DWORD BITCOUNT_DWORD UINT 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

Count

UINT 7 ENO=1
Function

(1) BITCOUNT_DWORD outputs a UINT


type data that indicates the number of on
bits in the input (DWORD type data).

2-155
2-5 FBD Language Original FCT

(13) Convert string to number STR_TO_UINT


Name, Symbol, Function Example
Name Symbol

<Operation>
STR_TO_UINT STRING ’1234 ’ EN=1

Convert

STRING STR_TO_UINT UINT


UINT 1234 ENO=1

• When the input data contains a non-numeric character


STRING ’123F’ EN=1
Function

(1) STR_TO_UINT converts STRING type Convert


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

(14) Convert number to string UINT_TO_STR

Name, Symbol, Function Example


Name Symbol

<Operation>
UINT_TO_STR
UINT 1234 EN=1

Convert
UINT UINT_TO_STR STRING
STRING ’1234’ ENO=1
Function

(1) UINT_TO_STR converts UINT type data


to STRING type data (1-byte numerals).

2-156
Original FCT 2-5 FBD Language

(15) Convert shift-JIS to string SJ_TO_STR ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Operation>
SJ_TO_STR
ARRAY OF WORD
STRING
A0 82
Convert
A2 82
ARRAY OF WORD SJ_TO_STR STRING ’ ABA’ ENO=1
A4 82
42 41
60 82
00 00
Function

(1) SJ_TO_STR converts Shift-JIS code


EN=1
defined as an array of WORD type data
to STRING type data. Note: No check is made to determine whether the input code is a sequence
(2) The Shift-JIS code input must be of valid Shift-JIS codes.
terminated by a NULL code (00 or 00 00). Setting of ENO = 1 remains unchanged and an output is undefined.
(3) If 64 or more Shift-JIS codes are input,
the first 64 codes are converted to
STRING type data and ENO is set to 0.

(16) Convert string to shift-JIS STR_TO_SJ ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Operation>
STR_TO_SJ
STRING ’ ABA’ EN=1

Convert
STRING STR_TO_SJ ARRAY OF WORD
ARRAY OF WORD A0 82
A2 82
A4 82
42 41
Function

(1) STR_TO_SJ converts STRING type data


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

2-157
2-5 FBD Language Original FCT

(17) Byte length BYTE_LEN

Name, Symbol, Function Example


Name Symbol

<Operation>
BYTE_LEN
’ ’
STRING EN=1

Convert
STRING BYTE_LEN INT
INT 12 ENO=1

Note: The size of a 1-byte character is 1 and that of a 2-byte character is 2.


Function

(1) BYTE_LEN outputs an INT type data that


indicates the number of bytes of STRING
type data as converted to Shift-JIS code.

(18) Dead band DBAND_INT

Name, Symbol, Function Example


Name Symbol

<Operation>
DBAND_INT “DB”
When INT 3000

“IN” (Output)
if INT 4000 , 1000
DBAND_INT
INT IN INT EN=1 ENO=1
INT DB if INT “IN” (Output)
2000 , 0
EN=1 ENO=1
if INT “IN” (Output)
,
Function

(1) DBAND_INT processes the input “DB” -6000 -3000


(INT type) as representing a dead band. EN=1 ENO=1
It outputs IN - |DB| if IN > |DB|,
IN + |DB| if IN < -|DB|,
and a “0” in other cases.
(+)

-6000 -3000 1000


(-) (+)
3000

—3000

(-)

2-158
Original FCT 2-5 FBD Language

(19) Dead band DBAND_DINT

Name, Symbol, Function Example


Name Symbol

<Operation>
DBAND_DINT “DB”
When DINT 3000 ,

DBAND_DINT
“IN” (Output)
DINT IN DINT If DINT 4000 , 1000
DINT DB EN=1 ENO=1

“IN” (Output)
If DINT 2000 , 0
Function

(1) DBAND_DINT processes the input “DB” EN=1 ENO=1


(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|, EN=1
(+)
ENO=1
and a “0” in the other cases.

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

-3000

(-)

(20) Dead band DBAND_REAL

Name, Symbol, Function Example


Name Symbol

<Operation>
DBAND_REAL “DB”
When REAL 3.0E+3 ,

DBAND_REAL
“IN” (Output)
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
Function

(1) DBAND_REAL processes the input “DB” EN=1 ENO=1


(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|, EN=1
(+)
ENO=1
and a “0” in the other cases.
(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-159
2-5 FBD Language Original FCT

(21) Bias BIAS_INT

Name, Symbol, Function Example


<Operation>
Name Symbol

BIAS_INT “DZ”
When INT 3000 ,

“IN” (Output)
BIAS_INT If INT 4000 , 7000
INT IN INT
INT DZ EN=1 ENO=1

“IN” (Output)
If INT 0 , 0
EN=1 ENO=1
Function

(1) BIAS_INT processes the “DZ” (INT type)


as representing a bias. It outputs “IN” (Output)
If INT -6000 , -9000
IN + |DZ| if IN > 0,
IN - |DZ| if IN < 0, EN=1 (+) ENO=1
and a “0” in the other cases.
(2) The upper limit value of INT type is 7000
output if the operation result exceeds the
upper limit value of INT type and the
lower limit value is output if the operation 3000
result falls below the lower limit value. 4000
(-) (+)
In these cases, ENO is set to 0. -6000
-3000

-9000

(-)

(22) Bias BIAS_DINT


Name, Symbol, Function Example
<Operation>
Name Symbol

BIAS_DINT “DZ”
When DINT 3000 ,

“IN” (Output)
BIAS_DINT If DINT 4000 , 7000
DINT IN DINT
EN=1 ENO=1
DINT DZ
“IN” (Output)
If DINT 0 , 0
EN=1 ENO=1
Function

(1) BIAS_DINT processes the “DZ” (DINT


type) as representing a bias. “IN” (Output)
If DINT -6000 , -9000
It outputs IN + |DZ| if IN > 0,
IN - |DZ| if IN < 0, EN=1 (+) ENO=1
and a “0” in the other cases.
(2) The upper limit value of DINT type is 7000
output if the operation result exceeds the
upper limit value of DINT type and the
lower limit value is output if the operation 3000
4000
result falls below the lower limit value. (-) (+)
In these cases, ENO is set to 0. -6000
-3000

-9000

(-)

2-160
Original FCT 2-5 FBD Language

(23) Bias BIAS_REAL

Name, Symbol, Function Example


Name Symbol

<Operation>
BIAS_REAL “DZ”
When REAL 3.0E+3 ,

BIAS_REAL
“IN” (Output)
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
Function

(1) BIAS_REAL processes the “DZ” (REAL EN=1 ENO=1


type) as representing a bias.
It outputs IN + |DZ| if IN > 0, “IN” (Output)
IN - |DZ| if IN < 0, If REAL -6.0E+3 , -9.0E+3
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
lower limit value is output if the operation 7000
result falls below the lower limit value.
In these cases, ENO is set to 0.
(3) The output value has an error which is 3000
similar to those which occur during REAL 4000
(-) (+)
data additions or subtractions. -6000
-3000

-9000

(-)

2-161
2-5 FBD Language Original FCT

(24) Step sequence SC_COIL / SC

Name, Symbol, Function Example


Name Symbol

<Programming example>
SC_COIL/SC
An example of creating a sequential circuit is shown below.
Step execution proceeds in the order of Q1, Q2, and Q3.
<Step sequence coil>
B_1
SC_COIL
SC_COIL RUN SC_men
BOOL RUN UINT
SC_men STEP
UINT STEP IN
UINT#1
UINT IN

B_2 Q_1
<Step sequence bit> SC_COIL
RUN SC_men
SC_men STEP
SC UINT#2 IN
BOOL RUN BOOL
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, Q_1


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

2-162
Original FCT 2-5 FBD Language

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

Name, Symbol, Function Example


Name Symbol

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

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

The ADC and ADCO instructions are used in 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
<32-bit addition with carry> system is 32 bits. Consequently, when adding 64-bit data items, it is
(1) ADC adds DINT type “IN1” and “IN2” with necessary to regard each data item as consisting of two 32-bit data
carry “CYIN.” items.
In the above figure, 64-bit data items A and B are added and the result is
<32-bit carry> output in C. The upper-order 32 bits of A, B, and C are assigned to
(1) ADCO adds DINT type “IN1” and “IN2” A_UPPER, B_UPPER, and C_UPPER, respectively, and their lower-
with carry“CYIN” and outputs a carry. order 32 bits are assigned to A_LOWER, B_LOWER, and C_LOWER,
respectively. The most significant bit of the lower-order 32 bits is
handled not as a sign but as a numeric value.

[Reference]
It is recommended, to monitor 64-bit data, that you use the hexadecimal
notation.

2-163
2-5 FBD Language Original FCT

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


Name, Symbol, Function Example
Name Symbol

<Programming example>
SBB/SBBO A sample program for performing a subtraction on 64-bit operands
is shown below.
<32-bit subtraction with borrow>
SBB
A_UPPER IN1 C_UPPER
SBB
DINT IN1 DINT
B_UPPER IN2
DINT IN2 BIN
BOOL BIN

<32-bit borrow>

SBBO SBBO
DINT IN1 BOOL A_LOWER IN1
DINT IN2 B_LOWER IN2
BOOL BIN FALSE BIN

SBB
IN1 C_LOWER
The SBB and SBBO instructions are used in
Function

IN2
combination to perform subtractions on 64-bit BIN
or wider data. These instructions cannot be
used independently.

<32-bit subtraction with borrow> The maximum length of data that can be manipulated in a MICREX-SX
(1) SBB performs a subtraction on DINT system is 32 bits. Consequently, when performing a subtraction 64-bit
type “IN1” and “IN2” with borrow “BIN.” data items, it is necessary to regard each data item as consisting of two
32-bit data items.
<32-bit borrow> In the above figure, a subtraction is performed on 64-bit data items A and
(1) SBBO performs a subtraction on DINT B and the result is output in C. The upper-order 32 bits of A, B, and C are
type “IN1” and “IN2” with borrow “BIN” and assigned to A_UPPER, B_UPPER, and C_UPPER, respectively, and
outputs a borrow. their lower-order 32 bits are assigned to A_LOWER, B_LOWER, and
C_LOWER, respectively. The most significant bit of the lower-order 32
bits is handled not as a sign but as a numeric value.

[Reference]
It is recommended, to monitor 64-bit data, that you use the hexadecimal
notation.

2-164
Original FCT 2-5 FBD Language

(27) 64-bit multiplication (MULL/MULU)

Name, Symbol, Function Example


Name

<Programming example>
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 In the above figure, multiplication is performed on 32-bit data items A and
DINT IN2 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.
Function

The MULL and MULU instructions are used in


combination when performing arithmetic [Reference]
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-165
2-5 FBD Language Original FCT

(28) 64-bit division (DIVL/DIVU)

Name, Symbol, Function Example


Name Symbol

<Programming example>
DIVL/DIVU

DIVU
A_UPPER IN1 C_UPPER
<Lower-order digit in 64-bit division>
A_LOWER IN2
DIVL B IN3
DINT IN1 DINT
DINT IN2
DINT IN3
DIVL
IN1 C_LOWER
<Upper-order digit in 64-bit division> IN2
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 lower-
order 32 bits is handled not as a sign but as a numeric value.
Function

The DIVL and DIVU instructions are used in [Reference]


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-166
Original FCT 2-5 FBD Language

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

Name, Symbol, Function Example


Name Symbol

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

<32-bit shift left with carry> SLCO


A_U

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

SLCO
DWORD BOOL

SLCO
A_L
Function

<32-bit shift left with carry>


(1) SLC shifts DWORD type“IN1” 1 bit to the
left with a carry.
SLC
Enter a carry flag data into an “CYIN.” IN B_L
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 1918 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 1918 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 1918 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 1918 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

[Reference]
It is recommended, to monitor 64-bit data, that you use the
hexadecimal notation.

2-167
2-5 FBD Language Original FCT

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


Name, Symbol, Function Example
Name Symbol

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

<32-bit shift right with carry> SRCO


A_U

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

SRCO
DWORD BOOL

SRCO
A_L
Function

<32-bit shift right with carry>


(1) SLC shifts DWORD type “IN1” 1 bit to the
right with a carry.
SRC
Enter a carry flag data into an “CYIN.” IN B_L
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 1918 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 1918 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 1918 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 1918 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Carry flag

[Reference]
It is recommended, to monitor 64-bit data, that you use the
hexadecimal notation.

2-168
Standard FB 2-5 FBD Language

2-5-10 Standard FBs (Function Blocks)


(1) Set reset flip-flop SR

Name, Symbol, Function Example


Name Symbol

SR <Programming example>

SR
INPUT1 SET1 Q1 LAMP

INPUT2 RESET
SR
BOOL SET1 Q1 BOOL

BOOL RESET <Operation>

Set preference
INPUT1
Function

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


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


Name Symbol

<Programming example>
RS

RS
INPUT1 SET Q1 LAMP

INPUT2 RESET
RESET1
RS
BOOL SET Q1 BOOL

RESET
RESET1
<Operation>
BOOL

INPUT1
INPUT2
Function

(1) RS implements a reset set flip-flop.


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-169
2-5 FBD Language Standard FB

(3) Rising edge trigger R_TRIG


Name, Symbol, Function Example
Name Symbol

<Programming example>
R_TRIG

R_TRIG
INPUT1 CLK Q LAMP

R_TRIG
BOOL CLK Q BOOL <Operation>

INPUT1
LAMP
Function

(1) R_TRIG senses the rising edge of the


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 (only for SPH).
Note: 2) When SPS is used, FB instance memories are all volatile. Therefore, when
started up (warm start) just after the system is turned on, the old value is
kept cleared to zero.

(4) Falling edge trigger F_TRIG


Name, Symbol, Function Example
Name Symbol

<Programming example>
F_TRIG

F_TRIG
INPUT1 CLK Q LAMP

F_TRIG
BOOL CLK Q BOOL <Operation>

INPUT1
Function

(1) F_TRIG senses the falling edge of the


LAMP
input and sets and holds the output at (“1”)
for one scan period. 1 scan

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 (only for SPH).
Note: 2) When SPS is used, FB instance memories are all volatile. Therefore, when
started up (warm start) just after the system is turned on, the old value is
kept cleared to zero.

2-170
Standard FB 2-5 FBD Language

(5) Up Counter CTU

Name, Symbol, Function Example


Name Symbol

<Programming example>
CTU

CTU
INPUT1 CU Q LAMP
CTU Q
BOOL CU BOOL INPUT2 RESET
BOOL RESET INT#5 PV CV CURRENT
INT PV CV INT
<Operation>
Function

(1) CTU increments the current value “CV” by 1


on the rising edge of the count input “CU.” INPUT2
(2) When the current value “CV” exceeds INPUT1 1 2 3 4 5
the preset value “PV,” an “Q” is set to “1.”
INT#5(Preset value)

Reset input
Count input CURRENT
Current value
LAMP
Output
(3) The preset value can take on a value from Note: 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
(4) Counting continues up to the maximum old value. At initial start-up (cold start) or download, it is reset to 0 (only for
value (32767). This value will not be SPH).
exceeded. 2) An “Q” value is the result of a comparison between PV and CV values. When
“RESET” = 0, the counted-up “Q” value is reset to 0 if a “PV” value is modified
(5) It is necessary to initially reset the count
(increased).
value by supplying a RESET signal. 3) When SPS is used, FB instance memories are all volatile. Therefore, when
started up (warm start) just after the system is turned on, the old value is
kept cleared to zero.

(6) Down counter CTD

Name, Symbol, Function Example


Name Symbol

<Programming example>
CTD
CTD Q
INPUT1 CD LAMP
CTD Q INPUT2 LOAD
BOOL CD BOOL
INT#5 PV CV CURRENT
BOOL LOAD
INT PV CV INT
<Operation>
(1) CTD decrements the current value “CV”
Function

INPUT2
by 1 on the falling edge of the count input
“CD.” INPUT1
1 2 3 4 5
(2) The “Q” is turned on when the current value
INT#5
“CV” reaches the preset value “PV.”

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.
This means that at start-up (warm start), counting continues from the retained
value (-32768). This value will not be
old value. At initial start-up (cold start) or download, it is reset to 0 (only for
exceeded in the negative direction. SPH).
(5) It is necessary to initialize the count value 2) When SPS is used, FB instance memories are all volatile. Therefore, when
initially by supplying a LOAD signal. started up (warm start) just after the system is turned on, the old value is
kept cleared to zero.

2-171
2-5 FBD Language Standard FB

(7) Up down counter CTUD

Name, Symbol, Function Example


Name Symbol

<Programming example>
CTUD

CTUD
INPUT1 CU QU LAMP1
INPUT2 CD QD LAMP2
CTUD INPUT3 RESET CV CURRENT
BOOL CU QU BOOL
INPUT4 LOAD
BOOL CD QD BOOL
INT#5 PV
BOOL RESET CV INT
BOOL LOAD
INT PV <Operation>

INPUT3
Function

(1) CTUD increments the current value “CV” INPUT4


by 1 on the rising edge of the count input
“CU” and decrements it by 1 on the rising
INPUT1
edge of the counter input “CD.” 1 2 3 4 5
(2) When the current value “CV” exceeds the
preset value “PV,” a count-up output “QU” INPUT2
1 2 3 4 5
is set to “1.” When the “CV” value is 0, the
count-down output “QD” is set to “1.”
5
INT#5 (Preset value)

Reset input
0
Initialization input CURRENT
Count up input
Count down input
LAMP1
Current value
LAMP2
Up output
Down output

Note: 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
0 to 32767. retained old value. At initial start-up (cold start) or download, it is reset to 0
(4) Count-up continues up to the maximum (only for SPH).
value (32767) and countdown continues 2) The priority of processing is shown below.
down to the minimum value (-32768).
This value range will not be exceeded. RESET > LOAD > CU > CD
(5) It is necessary to reset the current value to
3) An “Q” 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 “Q” value is reset to OFF if a “PV” value
“PV” value by supplying an initialization is modified (increased).
input “LOAD.” 4) When SPS is used, FB instance memories are all volatile. Therefore, when
started up (warm start) just after the system is turned on, the old value is
kept cleared to zero.

2-172
Standard FB 2-5 FBD Language

(8) Pulse TP

Name, Symbol, Function Example


Name Symbol

<Programming example>
TP

TP
INPUT1 IN Q LAMP

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

TIME PT ET TIME
<Operation>

INPUT1
Function

(1) TP starts its timer when “IN” is turned on LAMP


and holds the “Q” on until the preset time
TIME#10s
“PT” is reached. The current time is output
in “ET.” CURRENT
0
Input “IN” 10 seconds
Output “Q”
Preset time “PT”

Current time “ET”

(2) The time base is 1 ms. Note: 1) Precision of timer instructions


When a timer instruction is executed, a +0 to +2 scan time error occurs to
(3) The preset time is as below.
update the elapsed time.
SPH: 0 to 4294967295ms 2) The timer compares between “PT” and “ET” values and outputs the result
SPS: 0 to 2147483647ms into “Q” whenever “IN” is set to “1.” When the “PT” value is modified
(4) The “Q” will not turn on if the preset time is (increased) after time-up, “Q” is set to “1.” The timer continues its operation
set to 0. from the current value.

(9) On-delay timer TON


Name, Symbol, Function Example
Name Symbol

<Programming example>
TON

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

<Operation>
Function

(1) TON starts its on-delay timer when the “IN”


turns on and turns on the “Q” when the
preset time “PT” is reached. INPUT1
The current time is output in “ET.” LAMP
(2) When the “IN” turns off, the current timer TIME#10s
value is set to 0 and the “Q” to OFF.
CURRENT
Input “IN”
10 seconds
Output “Q”
Preset time
(3) The time base is 1ms. Note: 1) Precision of timer instructions
(4) The preset time is as below. When a timer instruction is executed, a +0 to +2 scan time error occurs to
update the elapsed time.
SPH: 0 to 4294967295ms
2) The timer compares between “PT” and “ET” values and outputs the result
SPS: 0 to 2147483647ms into “Q” whenever “IN” is set to “1.” When the “PT” value is modified
(5) If the preset time is set to 0, the “Q” turns (increased) after time-up, “Q” is set to “1.” The timer continues its operation
on immediately when the “IN” turns on. from the current value.

2-173
2-5 FBD Language Standard FB

(10) Off-delay timer TOF

Name, Symbol, Function Example


Name Symbol

TOF <Programming example>

TOF
INPUT1 IN Q LAMP

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

TIME PT ET TIME
<Operation>

INPUT1
Function

(1) TOF turns on its “Q” to reset the current LAMP


value to 0 when the “IN” turns on.
TIME#10s
When the input signal turns off, TOF starts
counting and turns off its output when the
CURRENT
preset time is reached.
10 seconds
Input “IN”
Output “Q”

Preset time
(2) The time base is 1ms.
(3) The preset time is as below.
Note: 1) Precision of timer instructions
SPH: 0 to 4294967295ms
When a timer instruction is executed, a +0 to +2 scan time error occurs to
SPS: 0 to 2147483647ms update the elapsed time.
(4) If the preset time is set to 0, the “Q” turns 2) Under a condition of “IN” = 0, when “PT” exceeds “ET,” “Q” is set to “1,”
off immediately when the “IN” turns off. causing the timer to operate. When “ET” = “PT,” “Q” is set to “0.”

(11) Real-time clock RTC ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

RTC <Programming example>

RTC
INPUT1 EN Q LAMP
RTC DT#1997-06-25 PDT CURRENT
CDT
BOOL EN Q BOOL -10:10:00
DT PDT CDT DT

<Operation>

INPUT1
Function

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


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.”
The same value is output to the “Q” as that CDT
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-174
Original FB 2-5 FBD Language

2-5-11 Original FBs (Function Blocks)


(1) Ring Counter RCT

Name, Symbol, Function Example


Name Symbol

<Programming example>
RCT

RCT
INPUT1 CU Q LAMP
INPUT2 RESET
RCT INT#5 PV CV CURRENT
BOOL CU Q BOOL
BOOL RESET
INT PV CV INT
<Operation>

INPUT2
Function

(1) RCT increments the current value “CV” by 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 INT#5 Preset value
current value “CV” reaches the preset value
“PV.” The current value and output signal
are turned off on the rising edge of the next CURRENT
count input.
LAMP
Reset input
Count input
Current value
Output
Note: 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
0 to 32767. retained old value. At initial start-up (cold start) or download, it is reset to 0
(4) It is necessary to reset the count value (only for SPH).
initially by supplying a RESET signal. 2) When a "PV" value is modified during operation, the output “Q” outputs the
result of comparison between ”PV” and “CV” values.
If the modified “PV” value lowers the “CV” value, “Q” is set to “1” and the
“CV” value is decreased to the “PV” value. Next time a “CU” value is entered,
“CV” is set to 0.
3) When SPS is used, FB instance memories are all volatile. Therefore, when
started up (warm start) just after the system is turned on, the old value is
kept cleared to zero.

2-175
2-5 FBD Language Original FB

(2) Integrating timer TMR

Name, Symbol, Function Example


Name Symbol

<Programming example>
TMR

TMR
INPUT1 IN Q LAMP
INPUT2 RESET
TMR TIME#5s PT ET CURRENT
BOOL IN Q BOOL
BOOL RESET
TIME PT ET TIME
<Operation>

INPUT2
Function

(1) TMR starts counting if an OFF-to-ON INPUT1


transition of input “IN” occurs when 2 seconds 3 seconds

“RESET” is off, and suspends counting TIME#5s


when the input signal turns off. TMR Preset value
resumes counting when the input is turned
on again. CURRENT
(2) The output “Q” is turned on when the
LAMP
current value “ET” reaches the preset
value “PT.”
(3) The time base is 1ms.
(4) The preset time is as below.
SPH: 0 to 4294967295ms
SPS: 0 to 2147483647ms Note: 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
old value. At initial start-up (cold start) or download, it is reset to 0 (only for
SPH).
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.”
4) When SPS is used, FB instance memories are all volatile. Therefore, when
started up (warm start) just after the system is turned on, the old value is kept
cleared to zero.

2-176
Original FB 2-5 FBD Language

(3) Retriggerable timer MR


Name, Symbol, Function Example
Name Symbol

<Programming example>
MR

MR
INPUT1 IN Q LAMP
TIME#10s PT ET CURRENT
MR
BOOL IN Q BOOL
TIME PT ET TIME

<Operation>
Function

(1) The timer starts operation at a rising edge INPUT1


at an “IN” and an “Q” remains set to “1”
until the timer reaches the preset time. TIME#10s Preset value
(2) Counting restarts when the input signal is
turned on again (rising edge) during
counting. CURRENT
(3) The current value “PT,” when reaching the 5 seconds 10 seconds
preset “PT” value, becomes undefined.
(0 or preset value retained) LAMP
(4) The time base is 1ms.
(5) The preset time is as below.
SPH: 0 to 4294967295ms
SPS: 0 to 2147483647ms Note: When a preset value “PT” is modified, the result of comparison between the
modified “PT” and “ET” values is output into an output “Q.”
When the “PT” value is larger 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-177
2-5 FBD Language Original FB

(4) Open channel M_OPEN


Name, Symbol, Function Example
Name Symbol

Normally, M_OPEN is used in combination with M_SEND and M_RECEIVE.


M_OPEN <Terminal description>
Input
EN_C: Requests open processing (a 0 to 1 transition requests open
M_OPEN processing and a 1 to 0 transition requests close processing).
BOOL EN_C VALID BOOL MODULE_NO: SX bus station number of the communication module
UINT MODULE_NO ERROR BOOL through which messages are to be transferred for
UINT CHANNEL_NO STATUS INT
out-of-configuration communication, or the SX bus
station number of the destination CPU with which
UDINT STATION_NO CON_NO UINT messages are to be transferred.
UINT MODULE_TYPE CHANNEL_NO: Channel number within the communication module
UINT MODE (0 if the module has only one channel).
UINT SUB_MODE STATION_NO: Station number of the destination module to
communicate with on the network (e.g., an IP address
UINT RPORT_NO
on an Ethernet or a P-link station number on a P-link).
UINT SPORT_NO Has no meaning for in-configuration communication.
MODULE_TYPE: Identifies the type of the destination communication
M_OPEN is an FB(function block) for setting up module.
Function

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

2-178
Original FB 2-5 FBD Language

<Communication ports (PRORT_NO, SPORT_NO)>


The communication port identifies the receiving port of the MICREX-SX can be used to assign any of numbers 1-127 to
destination module specified in STATION_NO or self-port number.
MODULR_NO, to which a message is sent.
1) Communication ports used in communication within
one configuration
In communication within one configuration, the value for RPORT_NO is the destination port number in the mate
SPORT_NO, an N_OPN input is the self-port number. It is system.
the port receiving the message. The value of an input

CPU0 (SX station number = 254) CPU1 (SX station number = 253)

M_OPEN M_OPEN

Port Port
UINT#253 MODULE_NO 1) 3) UINT#253 MODULE_NO

UINT#10 RPORT_NO UINT#1 RPORT_NO


UINT#1 SPORT_NO UINT#10 SPORT_NO

M_OPEN M_OPEN

2) 4)
UINT#253 MODULE_NO UINT#253 MODULE_NO

UINT#11 RPORT_NO UINT#2 RPORT_NO


UINT#2 SPORT_NO UINT#11 SPORT_NO

2) Communication port in communication out of the


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


UINT#0 STATION_NO UINT#63 STATION_NO

UINT#10 RPORT_NO UINT#1 RPORT_NO


UINT#1 SPORT_NO UINT#10 SPORT_NO

CPU1 CPU1

M_OPEN 2) 11) M_OPEN

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

2-179
Original FB 2-5 FBD Language

(5) Send message M_SEND


Name, Symbol, Function Example
Name Symbol

<Terminal description>
M_SEND
Input
REQ: Send request flag
CON_NO: Number of an open connection
SIZE: The size in words of the variable for storing the send data
M_SEND (Note)
BOOL REQ DONE BOOL Output
UINT CON_NO ERROR BOOL DONE: Normal completion flag (set to 1 on completion of the send
STATUS INT and held for one scan period.)
ANY SD SD ANY *1) ERROR: Error flag (set to 1 for one scan period when an error occurs)
UINT SIZE STATUS: Status
Input/output
*1) When SPS is used, be sure to connect same SD: Variable for storing the send data.
variable to both IN and OUT terminals.
Note: SIZE must be made equal to the size of the SD variable. Garbage
Function

M_SEND sends messages to a destination


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

2-180
Original FB 2-5 FBD Language

(6) Receive message M_RECEIVE


Name, Symbol, Function Example
Name Symbol

<Terminal description>
M_RECEIVE
Input
EN_R: Receive enable
CON_NO: Number of an open connection
SIZE: The size of the variable for storing the receive data (in words)
M_RECEIVE Output
BOOL EN_R NDR BOOL NDR: Normal completion flag
UINT CON_NO ERROR BOOL ERROR: Error flag
STATUS INT STATUS: Status
ANY RD RD ANY *1) Input/output
UINT SIZE RD: Variable for storing the receive data.

*1) When SPS is used, be sure to connect same <Status (STATUS) summary>
variable to both IN and OUT terminals. The status codes related to the M_RECEIVE FB are described below.
M_RECEIVE receives messages from a Refer to page 2-187 for the common status codes for FBs related with the
Function

source module specified in M_OPEN. message transmission.


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

2-181
2-5 FBD Language Original FB

(7) Direct read READ_WORD / READ_BOOL ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Terminal description>
READ_WORD/READ_BOOL
Input
REQ: Read request
SIZE: The size (in words or bits) of GLOBAL_VAR and RD variables
Input/output
READ_WORD
BOOL REQ DONE BOOL
GLOBAL_VAR: Global variable assigned to the other resource to
UINT SIZE ERROR BOOL
be read (Note 7)
RD: Variable for storing the read data.
STATUS INT
Output
ANY*1 GLOBAL_VAR GLOBAL_VAR
DONE: Normal completion flag
ANY*1 RD RD
ERROR: Error flag
*1: Any data type except BOOL type STATUS: Status
Array of any data type except BOOL type
<Status (STATUS) summary>
The status codes related to the READ_WORD and READ_BOOL FBs
READ_BOOL
BOOL REQ BOOL
are described below. Refer to page 2-187 for the common status codes
DONE
UINT SIZE
for FBs related with the message transmission.
ERROR BOOL
STATUS INT
(1) Global variable error (code: 176)
BOOL*2 GLOBAL_VAR GLOBAL_VAR
• The variable declared as GLOBAL_VAR is a variable that is assigned to
BOOL*2 RD RD
the local CPU.
*2: BOOL type or array of BOOL type
(2) Parameter error (code: 177)
• A 0 is supplied to the SIZE terminal.
• When an area for storing READ data is out of the memory area.
Function

READ_WORD and READ_BOOL are used to


read variables from different resources
(CPU, etc). within the same configuration. (3) No free port (code: 201)
Normally, “LD” and “MOVE” are used to read • When it is attempted to open a port exceeding the limit on the number of
variables from resources on the same port for one communication module.
processor bus (these FBs may also be used). (Direct read/write module also uses a communication port of the module.)
(1) The variable designated by the
“GLOBAL_VAR” is read into the variable
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.”

Note: 1) The “GLOBAL_VAR” and “RD” must


be of the same data type.
2) The “SIZE” to be used in
READ_WORD must be specified in Note: 4) The state of the input/output signal “RD” must not be changed while
words and that to be used in read processing is in progress. The integrity of the read data is not
“READ_BOOL” in bits. guaranteed if the state of this signal is changed.
3) The “REQ” is active on rising edge. 5) The uniqueness of the read data is guaranteed on a basic data
However, any low to high transition of type basis except STRING. The uniqueness of STRING type
“REQ” occurring while data is being variables is not guaranteed. Access to an array or structure
read (from the time the “REQ” goes variable is guaranteed only on an element or member basis.
high until the time the “DONE” or 6) If the number of data items specified by the “SIZE” is greater than
“ERROR” goes high) is invalid. the size of the variable specified by “RD,” the area for other “SIZE”
matches the size of the variable.
7) The global variable associated with “GLOBAL_VAR” for the
resource in the mate system must be specified for both self- and
mate-party resources to have the AT statement declared as a
global variable.

2-182
Original FB 2-5 FBD Language

(8) Direct write WRITE_WORD / W RITE_BOOL ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Terminal description>
WRITE_WORD/WRITE_BOOL
Input
REQ: Write request
SIZE: The size (in words or bits) of GLOBAL_VAR and SD variables
Input/output
WRITE_WORD
BOOL REQ DONE BOOL
GLOBAL_VAR: Global variable assigned to the other resource to
UINT SIZE ERROR BOOL
be written Note 7)
When data is written into the waiting CPU in the 1
STATUS INT
*1 to 1 duplex system, the variable assigned to
ANY GLOBAL_VAR GLOBAL_VAR
*1 self-resource
ANY SD SD
SD: Variable for storing the data to be written
*1: Any data type except BOOL type
Output
Array of any data type except BOOL type DONE: Normal completion flag
ERROR: Error flag
STATUS: Status
WRITE_BOOL
BOOL REQ DONE BOOL
UINT SIZE
<Status (STATUS) summary>
ERROR BOOL
The status codes related to the WRITE_WORD and WRITE_BOOL FBs are
STATUS INT
*2 described below. Refer to page 2-187 for the common status codes for FBs
BOOL GLOBAL_VAR GLOBAL_VAR
*2 related with the message transmission.
BOOL SD SD
(1) Global variable error (code: 176)
• When the warm standby mode is not used in the 1 to 1 duplex system and
*2: BOOL type or array of BOOL type
the variable specified in GLOBAL_VAR has been assigned to the self-CPU.
• When the warm standby mode is used in the 1 to 1 duplex system and the
variable specified for GLOBAL_VAR is assigned to the high-speed memory
Function

WRITE_WORD and WRITE_BOOL are used to


write variables of different resources area of the self-CPU.
(CPU, etc.) within the same configuration. (2) Parameter error (code: 177)
These instructions are not required when • A 0 is supplied to the SIZE terminal.
writing variables into resources on the same (3) Transmission interlock error (code: 35)
processor bus (these FBs may also be used). • When the mate-party module is interlocked.
The WRITE_WORD instruction can be used to Transmission interlock occurs when an instance screen opens by
write data into the waiting CPU in the warm accompanying any operation such as download. In this case, retry it.
standby mode in the duplex system. (4) No free port (code: 201)
This function equalizes variable data. • When it is attempted to open a port exceeding the limit on the number of
(1) The variable area designated by the “SD” port for one communication module.
is written into the global variable area (Direct read/write module also uses a communication port of the module.)
designated by the “GLOBAL_VAR” on the
low to high (0 to 1) transition of the “REQ.” 3) The “REQ” is active on rising edge. However, any low to high
(The write does not end within one scan transition of “REQ” occurring while data is being written (from the
period.) time the “REQ” goes high until the time the “DONE” or “ERROR”
(2) If the write is completed, the “DONE” is set goes high) is invalid.
and held for one scan period. 4) The state of the input/output signal “SD” must not be changed while
(3) If the write is unsuccessful, the “ERROR” is write processing is in progress. The integrity of the write data is not
set and held for one scan period and an guaranteed if the state of this signal is changed.
error code is output in the “STATUS.” 5) The uniqueness of the written data is guaranteed on a basic data
type basis except STRING. The uniqueness of STRING type
Note: 1) The “GLOBAL_VAR” and “SD” must variables is not guaranteed. Access to an array or structure variable
be of the same data type. is guaranteed only on an element or member basis. To equalize data
2) The “SIZE” to be used in into the waiting CPU, consistency may be assured until a “SIZE”
WRITE_WORD must be specified in value reaches 240.
words and that to be used in 6) If the number of data items specified by the “SIZE” is greater than the
“WRITE_BOOL” in bits. size of the variable specified by “GLOBAL_VAR,” the area for other
variables in the target module may be overridden. Make sure that the
value of the “SIZE” matches the size of the variable.
7) The global variable associated with “GLOBAL_VAR” for the resource
in the mate system must be specified for both self- and mate-party
resources to have the AT statement declared as a global variable.
8) The WRITE_BOOL instruction cannot be used for memory in the
P/PE-link module.

2-183
2-5 FBD Language Original FB

(9) Remote data read R_READ


Name, Symbol, Function Example
Name Symbol

<Terminal description>
R_READ Input
REQ: Read request
MODULE_NO: SX bus station number of the communication module
CHANNEL_NO: Channel number of the communication module
R_READ STATION_NO: Network station number of the source station
BOOL REQ DONE BOOL VAR_TYPE: Variable specification method (Refer to page 2-186.)
SIZE: The size (in words) of variables storing the data to be read
UINT MODULE_NO ERROR BOOL
and the read 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
Input/output
UINT SIZE REMOTE_VAR: Read address (Refer to page 2-186.)
*2) ANY RD RD ANY *3) RD: Variable for storing the read 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_READ 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
*3: When SPS is used, be sure to connect same message transmission.
variable to both IN and OUT terminals. (1) Channel open error (code: 193)
• When an invalid value has been set for a channel number
R_READ reads data in the direct addressing (2) Message send error (code: 195)
Function

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

2-184
Original FB 2-5 FBD Language

(10) Remote data write R_WRITE

Name, Symbol, Function Example


Name Symbol

<Terminal description>
R_WRITE
Input
REQ: Write request
MODULE_NO: Communication module number
CHANNEL_NO: Channel number
R_WRITE
BOOL REQ DONE BOOL
STATION_NO: Destination network station number
UNIT MODULE_NO ERROR BOOL
VAR_TYPE: Variable specification method (Refer to page 2-186.)
UINT CHANNEL_NO INT
SIZE: The size of write data
STATUS
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
*2: Any data type except BOOL type
Array of any data type except BOOL type
<Status (STATUS) summary>
*3: When SPS is used, be sure to connect same The status codes related to the R_WRITE FB are described below.
variable to both IN and OUT terminals. Refer to page 2-187 for the common status codes for FBs related with the
message transmission.
Function

R_WRITE writes data in the direct addressing


mode into a device that is connected to a
(1) Channel open error (code: 193)
network via a communication module listed
• When an invalid value has been set for a channel number.
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 is
“MODULE_NO,” “CHANNEL_NO,”
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
(5) Internal resource shortage (code: 171)
period.)
• When a shortage occurs in internal resources for executing R_READ and
(2) If the write is completed, the “DONE” is set
R_WRITE
and held for one scan period.
• If more than one R_READ and R_WRITE are started simultaneously, a
(3) If the write is unsuccessful, the “ERROR” is
shortage may occur in internal resources. In this case, wait for a moment
set and held for one scan period and an
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.”
Note: 1) The “VAR_TYPE” must specify the
(Only when 0 is specified in “REMOTE_VAR” does it occur.)
method of specifying the variables to
(7) Memory size over (code: 69)
be written.
• When the address specified in “REMOTE_VAR” + input “SIZE” is out of a
2) The “REQ” is active on rising edge.
range of allowed address for the mate module. In this case, data might
However, any low to high transition of
have been written into the mate module.
“REQ” occurring while data is being
(8) Mate specification error (code: 160)
write (from the time the “REQ” goes
• When VAR_TYPE = 0 and the CPU number in the mate system
high until the time the “DONE” or
specified in REMOTE_VAR is not found.
“ERROR” goes high) is invalid.
(9) Transmission interlock error (code: 35)
3) If the size of data specified by the
• When the mate-party module is interlocked
“SIZE” is greater than the size of the
Transmission interlock occurs when an instance screen opens by
variable specified by “SD,” the extra
accompanying any operation such as download. In this case, retry it.
data is likely to be unpredictable.
Make sure that the value of the “SIZE”
matches the size of the variable. 4) Be careful so that no compile error will occur even when BOOL type
array variable is used for “SD.”

2-185
2-5 FBD Language Original FB

<Variable specification method>


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

VAR_TYPE Variable Specification Method Target of 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 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 OPCN1
3 Character string Device connected to an open standard network such as OPCN1

<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,
In this case, the effective data refer to the manuals for the
is placed in the lower-order 8 communication module through
bits of a 16-bit array. This is which data is to be read or written
because an SPH system and the device to be read from or
cannot handle 8-bit data. written to.

* 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
Relative address Name Memory type code

Memory type Standard memory 1

CPU number Retain memory 3


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-186
Original FB 2-5 FBD Language

<Common status codes>


Error Code Name Cause Countermeasure
Memory access Attempted to access • Check configuration of the module.
66(42h) error uninstalled P/PE-link memory
or FL-net common memory.
No response to No answer command was • Check the condition and wiring of the remote equipment.
162(A2h) command received even when specified
time had elapsed.
Message send The mate system is missing or • Check the input terminal for defining the destination.
164(A4h) error the specified SX station
number has no module.
Message Can't send a message over an • Verify that the mate-party module supports message
receive busy SX bus because the destination communication.
module is busy. • Re-execute the FB at a later time.
165(A5h)
• If this error occurs frequently, it implies that the message
transmission load of the destination module is too high.
Lower the message load.
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
170(AAh)
message is busy. transmission load of the local CPU is too high. Lower the
message load.
Network send Can't perform an inter- • Re-execute the FB at a later time.
busy communication module • If this error occurs frequently, it implies that the message
197(C5h) transmission over a network transmission load of the local CPU is too high. Lower the
because the destination message load.
communication module is busy.

2-187
2-5 FBD Language Original FB

(11) File data read F_READ

Name, Symbol, Function Example


Name Symbol

<Terminal description>
F_READ
Input
REQ: Read request
MODULE_NO: SX bus station number of the module containing a
memory card
F_READ SIZE: The size (in words) of variables connected to RD
BOOL REQ DONE BOOL Output
UINT MODULE_NO ERROR BOOL DONE: Normal completion flag
STATUS INT ERROR: Error flag
*1) ANY FILE_NAME FILE_NAME ANY *2) STATUS: Status
UINT SIZE F_SIZE UINT F_SIZE: The size (in words) of the read file
*1) ANY RD RD ANY *2) Input/output
FILE_NAME: File name (Character code is Shift-JIS.)
RD: Variable for storing the read data.
*1: Array of any data type except BOOL type
*2: When SPS is used, be sure to connect same
variable to both IN and OUT terminals. <Status (STATUS) summary>
The status codes related to the F_READ FB are described below.
Refer to page 2-187 for the common status codes for FBs related with the
Function

F_READ reads a file from a memory module in


the configuration or from a PC card interface message transmission.
module containing a memory card. (1) File name error (code: 65)
• The file with the specified file name is not found.
(1) The file designated by the “FILE_NAME” is (2) File access error (code: 66)
read from the memory module or PC card • A check sum error occurs while reading a file.
interface module designated by the (3) Parameter error (code: 177)
“MODULE_NO” into the variable area • A value greater than the maximum permissible SX bus station number is
designated by the “RD” on a low to high supplied to the “MODULE_NO” terminal.
(0 to 1) transition of the “REQ.” (The read • When a variable for storing read data is out of the memory area
does not end within one scan period.) • When MODULE_NO is the self-SX bus station number
(2) If the read is completed, the “DONE” is set (4) No free port (code: 201)
and held for one scan period. • When it is attempted to open a port exceeding the limit on the number of
(3) If the read is unsuccessful, the “ERROR” is port for one communication module.
set and held for one scan period and an (5) Buffer overflow (code: 206)
error code is output in the "STATUS.” • When received data exceeds the size of the variable associated with RD
(6) Transmission interlock error (code: 35)
Note: 1) The “FILE_NAME” must specify a file • When the module with a memory card inserted is accessed using the
name in Shift-JIS code. file access instruction, the system enters the transmission interlock
2) The “REQ” is active on rising edge. state. If another file access memory makes an attempt to enter the
However, any low to high transition of module, a transmission interlock error occurs. Retry it.
“REQ” occurring while the file is being (7) Channel open error (code: 193) (only for SPS)
read (from the time the “REQ” goes • Internal error
high until the time the “DONE” or
“ERROR” goes high) is invalid. <Programming example>
3) The state of the “RD” must not be The sample program shown below reads a file with a file name of
changed while a file is being read. “E:\err_log.log” into the 1000-word variable “RD_DT.” It is assumed that
The integrity of the read data is not the SX bus station number of the module containing the memory card is “4.”
guaranteed if the state of this signal is STR_TO_SJ
changed. “E: \err_log.log” F_NAME
4) If the number of data items specified
by the “SIZE” is greater than the size F_READ_1
of the variable specified by “RD,” the F_READ
SW REQ DONE FR_DONE
area for other variables may be
UINT#4 MODULE_NO ERROR FR_ERR
overridden. Make sure that the value
STATUS FR_STA
of the “SIZE” is equal to or smaller
F_NAME FILE_NAME FILE_NAME F_NAME
than the size of the variable.
5) Do not use the memory card if the UINT#1000 SIZE F_SIZE FR_SIZE

module for storing an application RD_DT RD RD RD_DT


program for the n to 1 duplex mode for If the memory card of module is shared, a contention occurs in
file memory for file data read/write accessing, and switching cannot be performed between the
access is from a CPU application operating and waiting CPUs in the duplex mode.
program. Prepare another memory 6) Be careful so that no compile error will occur even when BOOL type
card if the module is for file read/write. array variable is used for “RD.”

2-188
Original FB 2-5 FBD Language

(12) File data write F_WRITE


Name, Symbol, Function Example
Name Symbol

<Terminal description>
F_WRITE
Input
REQ: Write request
MODULE_NO: SX bus station number of the module containing a
memory card
F_WRITE SIZE: The size (in words) of write data
BOOL REQ DONE BOOL Output
UINT MODULE_NO ERROR BOOL DONE: Normal completion flag
STATUS INT ERROR: Error flag
*1) ANY FILE_NAME FILE_NAME ANY *2) STATUS: Status
UINT SIZE Input/output
*1) ANY WD WD ANY *2) FILE_NAME: File name (Character code is Shift-JIS.)
WD: Variable for storing the write data.
*1: Array of any data type except BOOL type
*2: When SPS is used, be sure to connect same <Status (STATUS) summary>
variable to both IN and OUT terminals. The status codes related to the F_WRITE FB are described below.
Refer to page 2-187 for the common status codes for FBs related with the
message transmission.
Function

F_WRITE writes a file to a memory module in


(1) File name error (code: 65)
the configuration or to a PC card interface • The directory with the specified file name is not found. If the directory
module containing a memory card. exists but the file does not exist, a new file is created.
(2) File access error (code: 66)
(1) The data designated by the “WD” is written • An error occurred while writing to a memory card.
from the memory module or PC card (3) No free area (code: 69)
interface module designated by the • Unable to write because there is no free space in the memory card.
“MODULE_NO” into the file designated by (4) Parameter error (code: 177)
the “FILE_NAME” on a low to high (0 to 1) • A value greater than the maximum permissible SX bus station number is
transition of the “REQ.” (The write does not supplied to the “MODULE_NO” terminal.
• When a variable for storing written data is out of the memory area
end within one scan period.)
• When MODULE_NO is the self-SX bus station number
(2) If the write is completed, the “DONE” is set
(5) No free port (code: 201)
and held for one scan period.
• When it is attempted to open a port exceeding the limit on the number of
(3) If the write is unsuccessful, the “ERROR” is
port for one communication module.
set and held for one scan period and an
(6) Transmission interlock error (code: 35)
error code is output in the “STATUS.” • When the module with a memory card inserted is accessed using the file
access instruction, the system enters the transmission interlock state.
Note: 1) The “FILE_NAME” must specify a file If another file access memory makes an attempt to enter the module,
name in Shift-JIS code. a transmission interlock error occurs. Retry it.
2) The “REQ” is active on rising edge. (7) Channel open error (code: 193) (only for SPS)
However, any low to high transition of • Internal error
“REQ” occurring while thefile is being
written (from the time the “REQ” goes <Programming example>
high until the time the “DONE” or The sample program shown below writes the contents of “WT_DT” into a
“ERROR” goes high) is invalid. file with a file name of “E:\err_log.log.” It is assumed that the SX bus
3) The state of the “WD” must not be station number of the module containing the memory card is “4.”
changed while a file is being written.
STR_TO_SJ
The integrity of the write data is not “E: \err_log.log” F_NAME
guaranteed if the state of this signal is
changed. F_WRITE_1
4) An existing file that has the same
F_WRITE
name is overwritten. SW REQ DONE FW_DONE
5) If the number of data items specified by UINT#4 MODULE_NO ERROR FW_ERR
the “SIZE” is greater than the size of STATUS FW_STA
the variable specified by “WD,” the FILE_NAME
F_NAME FILE_NAME
extra data in the unpredictable state is
UINT#1000 SIZE
written into the file. Make sure that WD
WT_DT WD
the value of the “SIZE” is equal to or
smaller than the size of the variable. Prepare another memory card if the module is for file read/write.
6) Do not use the memory card if the If the memory card of module is shared, a contention occurs in
module for storing an application accessing, and switching cannot be performed between the
program for the n to 1 duplex mode operating and waiting CPUs in the duplex mode.
for file memory for file data read/write 7) Be careful so that no compile error will occur even when BOOL type
access is from a CPU application program. array variable is used for “WD.”

2-189
2-5 FBD Language Original FB

(13) Extension test & set EXT_T_S ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Terminal description>
EXT_T_S
Input
REQ: Test & set request
Input/output
IN: Global bit variable assigned to another resource
EXT_T_S Output
BOOL REQ DONE BOOL DONE: Normal completion flag
Q BOOL Q: Test & set result
ERROR BOOL 0: Set complete
STATUS INT 1: Set disabled (already set)
*1) ANY IN IN ERROR: Error flag
STATUS: Status
*1: BOOL type
<Status (STATUS) summary>
(1) Global bit variable specification error (code: 170)
Function

EXT_T_S acquires a semaphore. It is used


The variable designated by “IN” is assigned to the local CPU.
when the bit variable to be used to implement
(2) Unsupported instruction detection (code: 32)
a semaphore is assigned to the memory of
When this instruction is used for memory in the P/PE-link module.
a module on a different processor bus.
<Programming example>
(1) EXT_T_S tests and sets the global bit
The sample program shown below acquires a semaphore when the state
variable area designated by the “IN” on a
of “SEMA_REQ” is changed from 0 to 1. “SEMA_GET” is set to 1 when
low to high (0 to 1) transition of the “REQ.”
the processing is completed. The instruction retries if the processing is
(This processing does not end within one
unsuccessful. The EXT_T_S releases the semaphore when the state of
scan period.)
“REL_SEMA” is switched from 0 to 1. “SEMA_GET” is set to 0 when the
(2) If the test & set is completed, the “DONE”
release processing is completed.
is set and held for one scan period and the
result is output in the “Q.”
<Getting a semaphore>
(3) If the test & set is unsuccessful, the
“ERROR” is set and held for one scan
EXT_T_S
period and an error code is output in the SEMA_REQ REQ DONE T_S_DONE
“STATUS.” Q T_S_Q
ERROR T_S_ERR
Note: 1) The WRITE_BOOL instruction must be STATUS T_S_STA
used to reset set data. SEMA IN IN
2) The “REQ” is active on rising edge.
However, any low to high transition of
“REQ” occurring during test & set BOOL#0 SEMA_REQ
processing (from the time the input
“REQ” goes high until the time the
T_S_Q T_S_DONE SEMA_REQ
“DONE” or “ERROR” goes high) is
invalid.
3) Use the T_S instruction if the bit T_S_Q T_S_DONE SEMA_GET
variable to be used to implement a S
semaphore is connected to the same
processor bus or the local CPU.
<Releasing a semaphore>
4) Do not use this instruction for memory
in the P/PE-link module.
The execution terminates abnormally WRITE_BOOL
REL_SEMA REQ DONE WB_DONE
with an invalid FB result.
5) In the duplex system, to pass data to UINT#1 SIZE ERROR WB_ERR
the bit variables used for semaphores STATUS WB__STA
at changeover between the operating SEMA GLOBAL_VAR GLOBAL_VAR
and waiting CPUs: BOOL#0 SD SD
• Assign the bit variables for
semaphores to the standard memory
WB_DONE SEMA_GET
area to avoid equalization.
R
(They are reset to 0 at changeover.)
• When changeover occurs, make an
attempt to get semaphores again.

2-190
Original FB 2-5 FBD Language

(14) Sequential file store FFST

Name, Symbol, Function Example


Name Symbol

<Programming example>
FFST
RE_TRIG FFST
FLAG CLK Q ENABLE ERROR ERR
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*)
*1: When SPS is used, be sure to connect same
variable to both IN and OUT terminals.
FILE1 : ARRAY[1..4] OF ELEMENT1; (*Y_SIZE*)
FCB1 :
Function

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

FCB FCB FCB FCB FCB FCB FCB


A_PNT 0 A_PNT 1 A_PNT 2 A_PNT 3 A_PNT 0 A_PNT 1 A_PNT 2
B_PNT 0 B_PNT 0 B_PNT 0 B_PNT 0 B_PNT 0 B_PNT 1 B_PNT 2
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

2-191
2-5 FBD Language Original FB

(15) Sequential file load first FIFO

Name, Symbol, Function Example


Name Symbol

<Operation>
FIFO
(3) (4) (5) (6)

FIFO Executed FCBs FIFO FIFO FIFO FIFO FIFO


BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY (1) (2) (3) (4) (5) (6)
B
STRUCT FCB FCB STRUCT (5) (5) (5)
B
ARRAY OUT OUT ARRAY *1) (6) (6) (6) (6)
A, B A A A A, B A, B
UINT X_SIZE (3)
B
UINT Y_SIZE (4) (4)

FCB FCB FCB FCB FCB FCB


*1: When SPS is used, be sure to connect same
variable to both IN and OUT terminals. 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
(1) Setting to on the “ENABLE” causes the
Function

N_FE 1 N_FE 1 N_FE 1 N_FE 1 N_FE 0 N_FE 0


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 result of “X_SIZE” and “Y_SIZE”


multiplication is different from
(larger than) the size of the array of
arrays connected to “FILE,” any other
variable area may be overwritten.

2-192
Original FB 2-5 FBD Language

(16) Sequential file load last FILO


Name, Symbol, Function Example
<Operation>
Name Symbol

FILO

(6) (5) (4) (3)

FILO
Executed FCBs FILO FILO FILO FILO FILO
BOOL ENABLE ERROR BOOL
ARRAY OF ARRAY FILE FILE ARRAY OF ARRAY (1) (2) (3) (4) (5) (6)
STRUCT FCB FCB STRUCT A
(5) (5)
ARRAY OUT A
OUT ARRAY *1) (6)
A, B B B B A, B A, B
UINT X_SIZE (3) (3) (3) (6)
UINT Y_SIZE A
(4) (4) (4)

*1: When SPS is used, be sure to connect same FCB FCB FCB FCB FCB FCB
variable to both IN and OUT terminals. 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
(1) Setting to on the “ENABLE” causes the
Function

FF 1 FF 0 FF 0 FF 0 FF 0 FF 0
latest data (at the B_POINTER position in N_FE 1 N_FE 1 N_FE 1 N_FE 1 N_FE 0 N_FE 0

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 result of “X_SIZE” and “Y_SIZE”


multiplication is different from (larger
than) the size of the array of arrays
connected to “FILE,” any other variable
area may be overwritten.

2-193
2-5 FBD Language Original FB

(17) Filter FILTER_DINT

Name, Symbol, Function Example


Name Symbol

<Programming example>
FILTER_DINT

FILTER_DINT
INPUT1 RUN XOUT OUTPUT
INPUT2 XIN
FILTER_DINT
TIME#50ms TAU
BOOL RUN XOUT DINT
DINT XIN
TIME TAU
<Operation>

INPUT1
Function

(1) FILTER_DINT filters the “XIN” and outputs


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

2-194
Original FB 2-5 FBD Language

(18) Filter FILTER_REAL

Name, Symbol, Function Example


Name Symbol

<Programming example>
FILTER_REAL

FILTER_REAL
INPUT1 RUN XOUT OUTPUT
INPUT2 XIN
FILTER_REAL TIME#50ms TAU
BOOL RUN XOUT REAL
REAL XIN
TIME TAU
<Operation>

INPUT1
Function

(1) FILTER_REAL filters the “XIN” and


outputs the result in “XOUT” when the
“RUN” is on. INPUT2
(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 OUTPUT
} Approx. 63%
REAL.
(4) The “TAU” specifies the time constant of
TAU=50ms
the filter. The larger the time constant
value is, the gentler the slope of the
“XOUT” curve is. The “XOUT” involves a <Formulas>
large error if the time constant value is too
small. (XIN - XOUT’) ∆T
XOUT= + XOUT’
(5) The “XOUT” carries the preceding value TAU
when the “RUN” is set on.
(6) When the input “TAU” is set to 0, the XOUT’ denotes the preceding value of XOUT.
“XOUT” carries the value from the “XIN” ∆T is the execution period for this FB.
as is.
(7) The number of significant digits is 6.
(8) The maximum allowable value of the filter Note: This FB is generally used by periodic tasks. The error gets larger as
time constant “TAU” is 24 hours the period becomes shorter.
(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-195
2-5 FBD Language Original FB

(19) Integrate INT_DINT


Name, Symbol, Function Example
Name Symbol

<Programming example>
INT_DINT

INT_DINT
INPUT1 RUN XOUT OUTPUT1
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
TIME I_T

<Operation>
INPUT1
Function

(1) INT_DINT integrates the “XIN” and


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

2-196
Original FB 2-5 FBD Language

(20) Integrate INT_REAL

Name, Symbol, Function Example


Name Symbol

<Programming example>
INT_REAL

INT_REAL
INPUT1 RUN XOUT OUTPUT1
INPUT2 R1 Q OUTPUT2
INT_REAL INPUT3 XIN
BOOL RUN XOUT
INPUT4 X0
BOOL R1 Q
TIME#50ms I_T
REAL XIN
REAL X0
TIME I_T
<Operation>

INPUT1
Function

(1) INT_REAL integrates the “XIN” and


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

2-197
2-5 FBD Language Original FB

(21) Differentiate DIF_DINT

Name, Symbol, Function Example


Name Symbol

<Programming example>
DIF_DINT

DIF_DINT
INPUT1 RUN XOUT OUTPUT1
INPUT2 XIN
DIF_DINT TIME#50ms D_T
BOOL RUN XOUT DINT
DINT XIN
TIME D_T
<Operation>

INPUT1
Function

(1) DIF_DINT computes a differential from the


“XIN” and the input from the output
generated during the preceding execution
and outputs the result in “XOUT” when the
“RUN” is on. a
(2) The “XOUT” carries a “0” when the “RUN” INPUT2
is off.
(3) The “D_T” must specify the derivative time. 50ms
(4) The DIF_DINT computes the variation of (D_T)
the “XIN” and outputs on “XOUT” the
expected variation when the derivative time
a
elapses.
OUTPUT1
(5) The “XOUT” carries the output that is based
on the variation that has been established
since the time “RUN” is turned on. <Formulas>
Consequently, “XOUT” is set to 0 when
“RUN” is turned on. (XIN-XM)D_T
XOUT=
(6) When the “I_T” is set to 0, the “XOUT” ∆T
carries a value of 0. where
(7) The maximum allowable value of the XM is the value of XIN established in the preceding execution.
derivative time “D_T” is 24 hours ∆T is the execution period for this FB.
(86400000 ms).
(8) The valid number of output digits is six. Note: This FB is generally used by periodic tasks. The error gets larger as
(9) If the difference between current XIN and the period (∆T) becomes shorter.
previous XIN is larger than six digits, an For standard CPUs, set a 2ms or greater interval for∆T.
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-198
Original FB 2-5 FBD Language

(22) Differentiate DIF_REAL


Name, Symbol, Function Example
Name Symbol

<Programming example>
DIF_REAL

DIF_REAL
INPUT1 RUN XOUT OUTPUT1
INPUT2 XIN
DIF_REAL TIME#50ms D_T
BOOL RUN XOUT REAL
REAL XIN
TIME D_T
<Operation>

INPUT1
Function

(1) DIF_REAL computes a differential from the


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

2-199
2-5 FBD Language Original FB

(23) Pulse count PULSE_CNT

Name, Symbol, Function Example


Name Symbol

<Programming example>
PULSE_CNT

PULSE_CNT
INPUT1 RUN OUT COUNT
INPUT2 IN CMP FLAG
TIME#10s DURATION
PULSE_CNT
BOOL RUN OUT INT
BOOL IN CMP BOOL
TIME DURATION
<Operation>
INPUT1
INPUT2
(1) When a “RUN” is set to “ON,” the pulses
Function

DURATION DURATION DURATION DURATION


input at “IN,” the time specified in a
“DURATION,” are counted, and INT type 10s 10s DURATION

results are output to “OUT.”


FLAG
If the result exceeds an INT type of
1 scan
boundary value, the INT type of boundary
value is output. When the time specified in
“DURATION” has passed, a “CMP” is set to Count value
“ON” for a period of one scan.
If a “RUN” is set to “ON,” counting is COUNT 0 4 3 0 0 3
resumed.
(2) The “OUT” retains the current value when
the “RUN” is set to off. Note:1) Since “DURATION” processes are clocking in the same manner as
(3) The “OUT” is cleared to zero on the rising that for the timer instruction, an error +0 - +2 in scan time occurs.
edge of the “RUN.”
(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.

(24) Pulse output PULSE_OUT


Name, Symbol, Function Example
Name Symbol

<Programming example>
PULSE_OUT

PULSE_OUT
INPUT RUN OUT LAMP1
TIME#2s PERIOD CMP LAMP2
PULSE_OUT INT#4 COUNT
BOOL RUN OUT BOOL
TIME PERIOD CMP BOOL
INT COUNT
<Operation>
INPUT
OUT
Function

(1) When the “RUN” is set to on, PULSE_OUT 2s COUNT=4


outputs as many pulses of “PERIOD” CMP
period as specified by “COUNT.”
The “CMP” turns on when the pulse is
completed. When the “RUN” is set to off, Note:1) The period of “OUT” has an error +0 to +4 in scan time compared
the “CMP” is turned off. with “PERIOD.”
(2) PULSE_OUT stops the generation of
pulses when the “RUN” is set to OFF. 2) Specify sufficiently longer time for the preset period “PERIOD”
(3) When “COUNT” ≤ 0, pulses continue to be compared with the period for instruction execution at two times
output while a “RUN” is set to “ON.” or more).
(4) The duty factor of the “OUT” is 1 to 1.

2-200
Original FB 2-5 FBD Language

(25) Pulse PWM

Name, Symbol, Function Example


Name Symbol

<Programming example>
PWM

PWM
INPUT RUN OUT OUTP
TIME#3s PERIOD
PWM TIME#1s WIDTH
BOOL RUN OUT BOOL
TIME PERIOD
TIME WIDTH
<Operation>
RUN
1s

(1) PWM outputs pulses of the duration


Function

OUTP
“WIDTH” at the period “PERIOD” when the
3s
“RUN” is set to on. The output is stopped
when the “RUN” is set to OFF. Note :1) Since it processes clocking in the same manner as that for
(2) Do not set “PERIOD” ≤ “WIDTH;” the timer instruction, an error +0 to +2 in scan time occurs.
otherwise, no “OUT” is output. 2) Specify the values that satisfy the following condition for
Similarly, when "WIDTH” = 0, no “OUT” is “PERIOD” and “WIDTH.”
output. “PERIOD” - “WIDTH” > (a period for one instruction execution)

(26) Hardware RTC (Real-time Clock) HW_RTC ( These functions are not supported in SPS.)
Name, Symbol, Function Example
Name Symbol

<Programming example>
HW_RTC

HW_RTC
BOOL#1 EN Q OUTPUT1
HW_RTC
BOOL EN Q BOOL DT#1970-01-01-00:00:00 PDT CDT OUTPUT2
DT PDT CDT DT

<Operation>
(1) HW_RTC writes the set value “PDT” into the
Function

The current calendar value is always output at “OUTPUT2” if the


hardware RTC (clock in the CPU module) program is set up as shown in the above figure
on a low to high (0 to 1) transition of the (preset value = DT#1970-01-01-00:00:00).
“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-201
2-5 FBD Language Original FB

(27) Test & set T_S


Name, Symbol, Function Example
Name Symbol

<Programming example>
T_S

T_S
ERROR T_S_ERR
T_S
ERROR BOOL INPUT IN IN
BOOL IN IN BOOL *1) Q OUTPUT
Q BOOL

*1: When SPS is used, be sure to connect same <Operation>


variable to both IN and OUT terminals. 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
Function

(1) T_S sets the variable “IN” (of BOOL type) to assigned to a global variable. The flag indicating whether the resource is
1 and outputs the result on the “Q.” obtained successfully is output on “OUTPUT.”

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

2-202
Original FB 2-5 FBD Language

(28) Change bank BANK_CHG ( These functions are not supported in SPS.)

Name, Symbol, Function Example


Name Symbol

<Terminal description>
BANK_CHG
Input
REQ: Bank change request flag
MODULE_NO: SX bus station number of the P/PE link module for
BANK_CHG which the bank is to be changed (246 or 245).
BOOL REQ DONE BOOL Output
UINT MODULE_NO ERROR BOOL DONE: Normal completion flag
STATUS INT (held for one scan period on completion)
BUSY BOOL ERROR: Error flag (held for one scan period on an error)
STATUS: Status
BUSY: Held on during processing.
Function

BANK_CHG is used to establish <Status (STATUS) summary>


synchronization between the data in the (1) SX bus station number error (code: 64)
broadcast communications area which is used An SX bus station number which is not for P/PE-link module is specified.
by the P/PE 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 (3) Bank change processing processor bus error (code: 66)
the P/PE link module designated by the An error occurred while accessing the processor bus during bank change
P/PE link module SX station number processing.
“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 P/PE link modules (FEH203) for
request is issued. 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.

Note: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 P/PE-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-203
2-5 FBD Language Dedicated to SPS

2-5-12 Original FBs dedicated to SPS


(1) File open FILE_OPEN

Name, Symbol, Function Example


Name Symbol

<Terminal description>
FILE_OREN
Input EN_C: Request to open file (Request to open at the leading edge of
signal; request to close at the trailing edge of signal.
FILE_NAME: Specify the name of the file to be opened, including drive
name and path name.
FILE_OPEN MODE: Specify file access mode.
BOOL EN_C VALID BOOL
STRING FILE_NAME ERROR BOOL <Mode list>
STRING MODE STATUS INT
FILE_NO UINT ‘r’: Open a file in read mode. If specified file does not exist or cannot be
found, “file open error” occurs.
‘w’: Open a new file in write mode. If specified file already exists, its
content is destroyed.
Function

This FB is used to open data files stored in the ‘a’: This mode is used to write new data by adding it following existing data.
personal computer. This FB is used in ‘r+’: This mode is used to read and write an existing file.
combination with FILE_READ, FILE_WRITE ‘w+’: This mode is used to read and write a new file. If specified file
and FILE_SEEK that are explained in the already exists, its content is destroyed.
following paragraphs. ‘a+’: This mode is used to read and write by adding to existing data.
Maximum 32 files can be opened at the same
time. Output VALID: File open operation is completed successfully (set ON when
(1) When EN_C is set ON, file open operation successful)
is started. (File open operation does not ERROR: File open operation error (Set ON for one scan cycle when
complete within one scan cycle.) unsuccessful)
(2) When file open operation is completed STATUS: Status error
successfully, VALID is set ON and file FILE_NO: Opened file management number (1 to 32)
numbers (1 to 32) are output to FILE_NO.
In this condition, FILE_READ, FILE_WRITE <Status (STATUS) summary>
and FILE_SEEK can be used. (1) File open error (code: 101)
(3) If file open operation ended unsuccessfully, MODE: File open was executed by “r” or “r+,” but specified file could not
ERROR is turned ON for one scan cycle, be found.
and an error code is output to STATUS. (2) Maximum file open (code: 201)
(4) When EN_C is set OFF, file close operation It was attempted to open more than 32 files.
is started. (File close operation does not
complete within one scan cycle.)
When file close operation is completed,
VALID is set OFF.

Note: One FILE_OPEN function block is used


for one file. One FILE_OPEN function
block cannot be used for multiple files.

2-204
Dedicated to SPS 2-5 FBD Language

(2) File data write FILE_WRITE

Name, Symbol, Function Example


Name Symbol

<Terminal description>
FILE_WRITE
Input REQ: Request to write file data
FILE_NO: File No. opened by FILE_OPEN
SIZE: Write data size of WD (in units of word)
Output DONE: Writing is completed successfully (set ON for one scan cycle
FILE_WRITE when completed successfully)
BOOL REQ DONE BOOL ERROR: Error flag (Set ON for one scan cycle when ended
UINT FILE_NO ERROR BOOL
unsuccessfully)
UINT SIZE STATUS INT
ANY WD WD ANY I/O WD: Write data storage variable

<Status (STATUS) summary>


(1) File access error (code: 102)
Function

This function block is used to write data in a file • The file existed when FILE_OPEN was executed but cannot be found when
that is opened by FILE_OPEN. this FB is executed.
(1) When REQ is set ON, the content of WD is • The write data cannot be written due to the shortage in capacity of the file.
written in the file that is specified by • Writing was attempted on the file that is opened by MODE = ‘r.’
FILE_OPEN at the leading edge of the (2) File number error (code: 207)
signal. • A file number is used that is not opened by FILE_OPEN.
This operation does not complete within one
scan cycle. <Programming example>
(2) When data writing operation is completed 10 words of the content of FILE_DATA01 are written in the
successfully, DONE is set ON for one scan “\DATA\DATA01.DAT” file in the C drive of the personal computer.
cycle.
(3) If data writing operation is completed
unsuccessfully, ERROR is set ON for one FILE_OPEN_1
scan cycle, and an error code is output to FILE_OPEN
STATUS. OPEN_SW01 EN_C VALID OPEN_OK01
'C:\DATA\DATA01.DAT' FILE_NAME ERROR
Notes: 1) Maximum 4096 words of data can be (Note) 'r+' MODE STATUS
written at a time by FILE_WRITE. FILE_NO FILE01
2) REQ is the input that takes effect at
the leading edge of the signal, but if
REQ is set ON and then set ON FILE_WRITE_1
again before DONE or ERROR is set 001 OPEN_OK01 WRITE_REQ01 FILE_WRITE
ON (before one writing operation is REQ DONE
completed), the request is ignored. FILE01 FILE_NO ERROR
UINT#10 SIZE STATUS
FILE_DATA01 WD WD FILE_DATA01

Note: When both reading and writing operations are to be executed on one
file, use ‘r+’ mode.

2-205
2-5 FBD Language Dedicated to SPS

(3) File data read FILE_READ


Name, Symbol, Function Example
Name Symbol

<Terminal description>
FILE_READ
Input REQ: Request to read file data
FILE_NO: File No. opened by FILE_OPEN
SIZE: Read data size of RD (in units of word)
Output DONE: Reading is completed successfully (set ON for one scan cycle
FILE_READ when completed successfully)
BOOL REQ DONE BOOL ERROR: Error flag (Set ON for one scan cycle when ended
UINT FILE_NO ERROR BOOL unsuccessfully)
UINT SIZE STATUS INT I/O RD: Read data storage variable
ANY RD RD ANY
<Status (STATUS) summary>
(1) File access error (code: 102)
• The file existed when FILE_OPEN was executed but cannot be found when
this FB is executed. (For example, floppy disk was changed.)
Function

This function block is used to read data from a


file that is opened by FILE_OPEN. • Failed to read data from specified file.
(1) When REQ is set ON, the content of the file • Reading was attempted on the file that is opened by
that is specified by FILE_OPEN starts to be MODE = ‘w’ or ‘a.’
read out at the leading edge of the signal. (2) File number error (code: 207)
This operation does not complete within • A file number is used that is not opened by FILE_OPEN.
one scan cycle.
(2) When file data reading is completed <Programming example>
successfully, DONE is set ON for one scan 10 words of data are read into FILE_DATA01 from the “\DATA\DATA01.DAT”
cycle. file in the C drive of the personal computer.
(3) If file data reading ended unsuccessfully,
ERROR is set ON for one scan cycle, and
an error code is output to STATUS.
FILE_OPEN_1
FILE_OPEN
OPEN_SW01 EN_C VALID OPEN_OK01
Notes: 1) Maximum 4096 words of data can be 'C:\DATA\DATA01.DAT FILE_NAME ERROR
read out at a time by FILE_READ. 'r+' MODE STATUS
2) REQ is the input that takes effect at FILE_NO FILE01
the leading edge of the signal, but if
REQ is set ON and then set ON
again before DONE or ERROR is set FILE_READ_1
ON (before one reading operation is 002 OPEN_OK01 WRITE_REQ01 FILE_READ
completed), the request is ignored. REQ DONE
FILE01 FILE_NO ERROR
UINT#10 SIZE STATUS
FILE_DATA01 RD RD FILE_DATA01

2-206
Dedicated to SPS 2-5 FBD Language

(4) File pointer seek FILE_SEEK


Name, Symbol, Function Example
Name Symbol

<Terminal description>
FILE_SEEK
Input REQ: Request to change file pointer
FILE_NO: File No. opened by FILE_OPEN
OFFSET: Moving length (words)
MODE: Initial position of file pointer
FILE_SEEK
BOOL REQ DONE BOOL
UINT FILE_NO ERROR BOOL <Mode list>
DINT OFFSET STATUS INT 1: Current position of file pointer
INT MODE 2: End of file
3: Top of file

Output DONE: File pointer change is completed successfully (set ON for one
scan cycle when completed successfully)
Function

This function block is used to move the pointer


for object file. In general, file reading and ERROR: Error flag (Set ON for one scan cycle when ended
writing operations are executed from the top of unsuccessfully)
the file, but with this function block, you can STATUS: Status
access arbitrary position in the file.
(1) When REQ is set ON, the pointer for the file <Status (STATUS) summary>
that is specified by FILE_OPEN moves to a (1) File access error (code: 102)
position that is specified by MODE and • The file existed when FILE_OPEN was executed but cannot be found when
OFFSET. File pointer moving operation this FB is executed. (For example, floppy disk was changed.)
does not complete within one scan cycle. (2) File number error (code: 207)
(2) When file pointer moving operation is • A file number is used that is not opened by FILE_OPEN.
completed successfully, DONE is set ON (3) Parameter error (code: 177)
for one scan cycle. • A value other than the constants for MODE was input.
(3) If file pointer moving operation ended
unsuccessfully, ERROR is set ON for one
FILE_OPEN_2
scan cycle, and an error code is output to
STATUS. FILE_OPEN
OPEN_SW02 EN_C VALID OPEN_OK02
'A:\DATA.DAT' FILE_NAME ERROR
Note: REQ is the input that takes effect at the 'r+' MODE STATUS
leading edge of the signal, but if REQ is FILE_NO FILE02
set ON and then set ON again before
DONE or ERROR is set ON (before one
changing operation is completed), the FILE_SEEK_1
request is ignored. OPEN_OK02 SEEK01 FILE_SEEK
REQ DONE SEEK_OK
FILE02 FILE_NO ERROR
DINT#3 OFFSET STATUS
3 MODE

(Operation)
File pointer is moved from the top to 4th.

15 0
First

2-207
2-5 FBD Language Dedicated to SPS

(5) Shifted JIS code to character string conversion SJ_TO_STRING


Name, Symbol, Function Example
Name Symbol

<Operating example>
SJ_TO_STRING
ARRAY OF WORD
A0 82
SJ_TO_STRING Convert STRING
A2 82
STR STRING
A4 82
ARRAY OF WORD SJ SJ ARRAY OF WORD
42 41
60 82
00 00
Function

(1) Convert the shifted JIS code that is defined


as an array of WORD type into the data of
STRING type. Note: If a code that is not included in shifted JIS code is input to SJ, NULL
(2) NULL code (“00” or “00 00”) is necessary at code is output for the part.
the end of shifted JIS code.
(3) When a shifted JIS code that exceeds 80
single-byte characters or 40 double-byte
characters is input to SJ, maximum 80
single-byte characters (40 double-byte
characters) of data are output to STR.

(6) Character string to shifted JIS code conversion STRING_TO_SJ


Name, Symbol, Function Example
Name Symbol

<Operating example>
STRING_TO_SJ
STRING Convert ARRAY OF WORD

A0 82
STRING_TO_SJ
A2 82
STRING STR
A4 82
ARRAY OF WORD SJ SJ ARRAY OF WORD
42 41
60 82
(1) Convert STRING type data that is input to XX 00
Function

STR into the shifted JIS code that is defined XX XX


as an array of WORD type data. NULL XX XX
code is added at the end.
(2) When output array is sufficiently greater in
capacity than input, indefinite data may be
added following NULL code (00). Note: Because NULL code is added at the end, the size of output array must
(3) When output array is smaller in capacity be one word greater than the number of input characters.
than input, other areas are rewritten.

2-208
Dedicated to SPS 2-5 FBD Language

(7) Direct read READ_W

Name, Symbol, Function Example


Name Symbol

<Terminal description>
READ_W Input REQ: Start to read
SIZE: Size of read data (in units of word)
Output DONE: Reading is completed successfully (set ON for one scan cycle
READ_W when completed successfully)
BOOL REQ DONE BOOL ERROR: Error flag (Set ON for one scan cycle when ended
UINT SIZE ERROR BOOL unsuccessfully)
STATUS INT STATUS: Status
ANY GLOBAL_VAR GLOBAL_VAR ANY I/O GLOBAL_VAR: Specify the memory to be accessed in the following
ANY* RD RD ANY format:
15 0
* Data types other than BOOL type, BOOL type array and CPU No.
STRING type
Memory type
INT type array variable of 4 elements
Function

This function block is used to read the memory Low-order address


of a resource (CPU, FL-net, etc.) in same High-order address
configuration
(1) At the leading edge (0 to 1) of REQ, the
data of the memory that is specified by <Status (STATUS) summary>
GLOBAL_VAR is read out to RD. (1) Parameter error (code: 177)
(The reading operation does not complete • When 0 (zero) is input to SIZE.
within one scan cycle.)
(2) When data reading operation is completed <Programming example>
successfully, DONE is set ON for one scan 10 words of data are read from the common memory %MW8.1.256 in the
cycle. FL-net module of CPU No. 8.
(3) If data reading operation ended READ_W_1
unsuccessfully, ERROR is set ON for one
scan cycle, and an error code is output to READ_W
READ_SW REQ DONE OK
STATUS.
UINT#10 SIZE ERROR ERR

Note: If the number of words to be read that is STATUS STA

specified by SIZE is greater than the size ADD01 GLOBAL_VAR GLOBAL_VAR ADD01
of the variable that is connected to RD, FL_DATA RD RD FL_DATA
the content of other variable is rewritten.
Be careful so that the number of words to
15 0 %MW8.1.256
be read which is specified by SIZE does
8 CPU No.
not exceed the size of the variable
connected to RD. 1 Memory type
256 Low-order address
0 High-order address

* FL_DATA must be a variable of array data type that is greater than 10


words.

2-209
2-5 FBD Language Dedicated to SPS

(8) Direct read READ_B

Name, Symbol, Function Example


Name Symbol

<Terminal description>
READ_B Input REQ: Start to read
SIZE: Size of read data (in units of word)
Output DONE: Reading is completed successfully (set ON for one scan cycle
READ_B when completed successfully)
BOOL REQ DONE ERROR: Error flag (Set ON for one scan cycle when ended
UINT SIZE ERROR unsuccessfully)
STATUS STATUS: Status
ANY GLOBAL_VAR GLOBAL_VAR I/O GLOBAL_VAR: Specify the memory (top address) to be accessed in
ANY* RD RD the following format:

* BOOL type, array data type of BOOL type 15 0


CPU No.
Memory type
Function

This function block is used to read the memory


Low-order address INT type array variable of 5 elements
of a resource (CPU, FL-net, etc.) in same
configuration. High-order address
(1) At the leading edge (0 to 1) of REQ, the Bit No. (0 to 15)
data of the memory that is specified by
GLOBAL_VAR is read out to RD. RD: Stores the read data.
(The reading operation does not complete
within one scan cycle.) <Status (STATUS) summary>
(2) When data reading operation is completed (1) Parameter error (code: 177)
successfully, DONE is set ON for one scan • When 0 (zero) is input to SIZE.
cycle. • When a value other than 0 to 15 is input for bit No.
(3) If data reading operation ended
unsuccessfully, ERROR is set ON for one
scan cycle, and an error code is output to
STATUS.

Note: If the quantity of data to be read that is


specified by SIZE is greater than the size
of the variable that is connected to RD,
the content of other variable is rewritten.
Be careful so that the quantity of data to
be read which is specified by SIZE does
not exceed the size of the variable
connected to RD.

2-210
Dedicated to SPS 2-5 FBD Language

(9) Direct write WRITE_W

Name, Symbol, Function Example


Name Symbol

<Terminal description>
WRITE_W Input REQ: Start to write
SIZE: Size of write data (in units of word)
Output DONE: Writing is completed successfully (set ON for one scan cycle
WRITE_W when completed successfully)
BOOL REQ DONE BOOL ERROR: Error flag (Set ON for one scan cycle when ended
UINT SIZE ERROR BOOL unsuccessfully)
STATUS INT STATUS: Status
ANY GLOBAL_VAR GLOBAL_VAR ANY I/O GLOBAL_VAR: Specify the memory (top address) to be accessed in
ANY* SD SD ANY the following format:

* Data types other than BOOL type, BOOL type array CPU No.
and STRING type
Memory type
INT type array variable of 4 elements
Low-order address
Function

This function block is used to write data in the


memory of a resource (CPU, FL-net, etc.) in High-order address
same configuration.
(1) At the leading edge (0 to 1) of REQ, data is SD: Stores the data to be written.
written in the memory that is specified by
GLOBAL_VAR. The data to be written is
prepared in SD. <Status (STATUS) summary>
(2) When data writing operation is completed (1) Parameter error (code: 177)
successfully, DONE is set ON for one scan • When 0 (zero) is input to SIZE.
cycle.
(3) If data writing operation ended
unsuccessfully, ERROR is set ON for one
scan cycle, and an error code is output to
STATUS.

2-211
2-5 FBD Language Dedicated to SPS

(10) Direct write WRITE_B

Name, Symbol, Function Example


Name Symbol

<Terminal description>
WRITE_B Input REQ: Start to write
SIZE: Size of write data (in units of word)
Output DONE: Writing is completed successfully (set ON for one scan cycle
WRITE_B when completed successfully)
BOOL REQ DONE BOOL ERROR: Error flag (Set ON for one scan cycle when ended
UINT SIZE ERROR BOOL unsuccessfully)
STATUS INT STATUS: Status
ANY GLOBAL_VAR GLOBAL_VAR ANY I/O GLOBAL_VAR: Specify the memory (top address) to be accessed in
ANY* SD SD ANY the following format:

* BOOL type, array data type of BOOL type 15 0


CPU No.
Memory type
Function

This function block is used to write data in the


memory of a resource (CPU, FL-net, etc.) in Low-order address INT type array variable of 5 elements
same configuration. High-order address
(1) At the leading edge (0 to 1) of REQ, data is Bit No. (0 to 15)
written in the memory that is specified by
GLOBAL_VAR. The data to be written is SD: Stores the data to be written.
prepared in SD.
(2) When data writing operation is completed <Status (STATUS) summary>
successfully, DONE is set ON for one scan (1) Parameter error (code: 177)
cycle. • When 0 (zero) is input to SIZE.
(3) If data writing operation ended • When a value other than 0 to 15 is input for bit No.
unsuccessfully, ERROR is set ON for one
scan cycle, and an error code is output to
STATUS.

2-212
Dedicated to SPS 2-5 FBD Language

(11) Calendar read RTC_R


Name, Symbol, Function Example
Name Symbol

<Terminal description>
RTC_R
Input EN_C: Request to read calendar data
Output VARID: Reading completed
I/O RTC: Read data storage area
The data type of the variable that is connected to RTC must be a 7-ement
RTC_R array of UNIT type.
BOOL EN_C VARID BOOL
ARRAY OF RTC RTC ARRAY OF
Year
UINT UINT
Month (1 to 12) 0: Sunday
Day (1 to 31) 1: Monday
2: Tuesday
Hours (0 to 24)
3: Wednesday
Minutes (0 to 59)
Function

(1) When EN_C is set ON, the calendar data 4: Thursday


stored in the personal computer is read out Seconds (0 to 59)
5: Friday
to be stored in RTC. When the data storage Day of the week (0 to 6) 6: Saturday
is completed, VARID is set ON.
(2) To change the calendar data that is stored <Operation>
in the personal computer, do on Windows.
EN_C

VALID

RTC

(Calendar data is effective)

2-213
2-6 SFC Elements SFC

An SFC is a program that specifies the operation of a plant or facilitates the programmer to develop programs efficiently
machine in flowchart form. Since it allows the flow of and to grasp the flow of a program as the flow of processes.
processes to be programmed in a natural manner, it

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

Move [Process 1] (STEP1) When represented T1


(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

[Transition condition 3] STEP 3 N ACT03


End of painting (T2)

Note: Up to 24 1-bit characters (12 2-bit characters)


Move and dry body [Process 3] (STEP3)
(ACT03) are allowed for SFC step, action, and transition
names.

The elements of an SFC have the following meanings:


Initial step
(beginning of processing)
Transition
(condition for moving Start
to the next step)

T1 Actions
(describes the process)

STEP1 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.
<Number of elements/POU>
No. of steps 110
No. of transitions 110
No. of actions 165

2-214
SFC 2-6 SFC Elements

2-6-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-215
2-6 SFC Elements SFC

(2) Normal step


A normal step represents one process in the SFC program. normal step is in the active state, it executes actions
A normal step may be in the active or inactive state. When a 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.
Note: 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 into another POU. No action can be assigned to a jump.
destination of the jump within the same worksheet or on
another worksheet in the same POU. Execution never jumps
Destination of jump

The jump name must be the


name of the destination step.

2-216
SFC 2-6 SFC Elements

(4) Termination step


A termination step is one that has no following transition. It step may be assigned an action which can be used for the
is used to mark the end of an SFC program. A termination termination processing of the application.

Termination step

2-217
2-6 SFC Elements SFC

(5) Action/action qualifier


An action is a real program which is assigned to the initial, assign a BOOL variable, or a program in IL, ST, LD, or FBD
normal, and termination steps and which is executed on the language.
object to be controlled. In an action, the programmer can

Action qualifier

An action qualifier specifies the timing of execution or state of the step. There are nine types of action qualifiers.
suppression of an action according to the active or inactive
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

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

ADD * For more information about action flag, refer to 2-6-3


(Automatically generated SFC variables).
ACT1.X EN ENO

1 INC_DATA

INC_DATA

2-218
SFC 2-6 SFC Elements

3) S (Set)
The execution of the action is started when the step is step is deactivated. The execution of the step is stopped
activated, but the action is executed repeatedly when the 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 the variable is reset to “0.” No action is taken (equivalent to
SL qualifier. The action is stopped if a specified action has being assigned no action) if the specified action is not in
been executed in advance by an S, SD, DS, or SL qualifier execution.
when this step is activated. If the action is a BOOL variable,

S001

T001

ACT1

5) L (Time limited)
The action is started and repeated until a specified time has action is stopped after the elapse of the specified time or
elapsed once the step is activated. The execution of the when the step is deactivated within the specified time.

S001

T001

ACT1 5s

S001

T001

ACT1 5s

2-219
2-6 SFC Elements SFC

6) D (Time delayed)
The action is started after a preset time after the step is deactivated. The action is not executed if the step is
activated. The action is executed repeatedly until 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 time. The action repeatedly continues execution until it is
activated. The action is started after the preset time has reset by the R qualifier.
elapsed even when the step is deactivated within the preset

S001

T001

ACT1
5s

T004

S005

S001

T001

ACT1
5s

T004

S005

2-220
SFC 2-6 SFC Elements

8) DS (Delayed and stored)


The action is started only when the step is held active for executed if the step is deactivated before the preset time is
longer than a preset time. The action repeatedly continues reached.
execution until it is reset by the R qualifier. The action is not

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 control is not affected even when the step is deactivated
execution is repeated until a preset time is reached. The (differs from the L qualifier in this respect).
action is stopped when the preset time is reached. This

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-221
2-6 SFC Elements SFC

(6) Transition
Only one transition is programmed between two adjacent condition is defined by assigning a BOOL variable or
steps and specifies the conditions for making a transition programming by either IL, ST, LD, or FBD language.
from the preceding step to the following step. A transition

Transition which an FB
is assigned directly to

Transition which a BOOL


variable is assigned
directly to

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-222
SFC 2-6 SFC Elements

2-6-2 Step transition


The process of transferring the active state from one step to and the transition condition for the next step is turned on, the
another is called “transition.” When the current step is active current step is deactivated and the next step is activated.
(1) Single-flow transition
In the example shown below, a transition to S003 occurs INP1 and INP2 are set to 1.
when S002 is active and both inputs of transition condition

Active Active

Inactive Inactive

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

Inactive
Inactive

A branch to “S010” occurs when “S013”


Inactive
is active and “T006” is set to “1.”

Active
Inactive

Note: The left-hand side step “S010” is selected when both “T006” and “T007” are set to 1 at the same time.

2-223
2-6 SFC Elements 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

Inactive

Control is transferred to “S003” when either “S004” or “S005”


is active and the subsequent transition is set to “1.”

Inactive
Inactive

Inactive

Active

2-224
SFC 2-6 SFC Elements

(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 “S017” is inactive.
Inactive

Inactive

Active

2-225
2-6 SFC Elements SFC

2-6-3 Automatically generated SFC variables


Step flags and action flags variables are automatically step flag and action fiag variables.
generated in SFC. There is no need for the user to declare

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-226
SFC 2-6 SFC Elements

2-6-4 SFC programming precautions


<Step reset processing>
The system does not reset the action program that is active to inactive state. If necessary, such action programs
connected to a step when its state is switched from the 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 “OUT” on state transition, create the following program in the
active state switches from “S018” to “S019.” To turn off action:

Add the S018 of step flag


as an interlock.

<Programming a jump in an action/transition>


When programming a jump in an action or transition, make A jump specified in a program must not go out of the
sure that the jump destination falls within the program. program.

2-227
2-6 SFC Elements SFC

2-6-5 Continuous operation of SFC


When compilation is performed using SFC step or action flag as retain variable with D300Win (V2.2 or newer), 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) When the [Extended setting(A)...] button in the [Memory allocation setting] dialog is left-clicked, the [Extended
setting] dialog is displayed.

[Extended setting] dialog

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-228
Section 3 System Definitions

Page
3-1 System Definition Summary ................................................................................... 3-1

3-2 System Configuration Definitions .......................................................................... 3-2

3-3 System Properties ................................................................................................... 3-5


3-3-1 System operation definitions .............................................................................................. 3-5
(1) SX bus Takt time ................................................................................................................................. 3-5
(2) Configuration check waiting time ........................................................................................................ 3-5
(3) Initialization method ............................................................................................................................ 3-5
3-3-2 System duplex mode definition .......................................................................................... 3-7
3-3-3 System fail-soft start-up ..................................................................................................... 3-8
(1) Fail-soft disabled ................................................................................................................................. 3-8
(2) Partial fail-soft start-up of modules with SX bus station numbers ....................................................... 3-8

3-4 System Output Definitions .................................................................................... 3-10

3-5 CPU Parameters ..................................................................................................... 3-11


3-5-1 CPU operation definitions ................................................................................................ 3-11
(1) Watchdog timer ................................................................................................................................. 3-11
(2) Power-on time operation ................................................................................................................... 3-11
(3) Battery less operation ....................................................................................................................... 3-11
3-5-2 CPU memory size definition ............................................................................................. 3-13
(1) AT range ............................................................................................................................................ 3-15
(2) Retain/equalization setting for automatically generated SFC variables ............................................ 3-15
(3) Assignment of variable equalization by specifying suffix .................................................................. 3-15
(4) Equalization reserve size for each POU ........................................................................................... 3-15
3-5-3 I/O group setup ................................................................................................................ 3-16
3-5-4 Fail-soft running ............................................................................................................... 3-20

3-6 Input/output Parameters ........................................................................................ 3-22


3-6-1 Input filtering time ............................................................................................................. 3-23
3-6-2 Output hold definition ....................................................................................................... 3-24
System definition summary
Section 3 System Definitions
3-1 System Definition Summary

Recognition Timing
Name Definition Reference
High-performance CPU Standard CPU
System configuration Module registration and SX bus station Configuration reset Configuration
3-2
definition number in system configuration Download reset
System operation SX bus Takt period, configuration check Configuration
3-3-1 Configuration reset
definition waiting time, initialization method reset
Duplex mode enabled/disabled, 1 to 1
Duplex mode definition 3-3-2 Configuration reset Not supported
duplex mode, N to 1 duplex mode
System fail-soft enabling The fail-soft start-up start SX bus station
3-3-3 Configuration reset Not supported
definition number
Configuration
System output definition System output module 3-4 Configuration reset
reset
Watchdog timer, battery-less operation, Configuration
CPU operation definition 3-5-1 Configuration reset
operation at power-on reset
CPU memory size Data memory size, AT specification range, Configuration
3-5-2 Configuration reset
definition reserve memory reset Download
Configuration
I/O group I/O group registration 3-5-3 Configuration reset
reset
Fail-soft enabled/disabled for modules (I/O Configuration
Fail-soft setting 3-5-4 Download
module, etc) other than common modules reset
Input filtering time for digital input modules Configuration
Input filtering time 3-6-1 Download
(DC input devices) reset
Configuration
Output hold definition Hold/reset registration for output modules 3-6-2 Download
reset
T-link master module Configuration
Individual output hold station definition (Note 2) Configuration reset
parameter reset
OPCN-1 master module Configuration
Response time definition (Note 2) Configuration reset
parameter reset
DeviceNet master module Individual operation definition, Individual Configuration
(Note 2) Configuration reset
parameter output hold station definition reset
Operation definition, configuration
Configuration
P/PE link parameter registration definition, area setting, bank- (Note 2) Configuration reset
reset
switched CPU operation definition
Operation definition, configuration
FL-net parameter registration definition, area setting, bank- (Note 2) Configuration reset Not supported
switched CPU definition

Note: 1) Reset includes all resets (configuration resets), individual reset (resource reset), and power-on.
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 Master Module FEH234

3-1
3-2 System Configuration Definitions System configuration

It is necessary to register the modules to be used to the


MICREX-SX series system as system configuration
definitions.
<System configuration example>

P-link module T-link master module

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

Power 16 16 32 32 16 16
supply points points points points points points
CPU input input input input output output

P-link T-link

I/O I/O I/O

16 16 16
Power
points points points
supply input output output

<System configuration definition tree window>


The system configuration definition tree for the above
system configuration is as shown below.

On aggregate type I/O of T-link or the like,


baseboard and power supply module are
necessary but need not be registered.

Note: In the multi-CPU system, use the same system configuration definition for every CPU module.

3-2
System configuration 3-2 System Configuration Definitions

<Types of icons>
Icon Description

Defines the system properties such as SX bus Takt time.

Denotes a base board.

Denotes a power supply module.

Denotes a CPU module.

Denotes an input/output module.


Red
Denotes a processor link module.
Green
Denotes a remote I/O master module.
Red
Denotes a remote I/O interface module.
Black
Denotes a positioning control module.
Green
Denotes a function module.

<Setup procedure>
1) Double-click the [System_Definition] icon in the a power supply module and a CPU module under
project tree with the left mouse button to open the an 11-slot base board as shown in the figure
system configuration definition window. Initially, below. Select the CPU module and left-click the
the system configuration definition window shows [Insert] button.
Insertion

To mount a module on
this base unit, select
here (left-click).

To change a base unit, click here with the


right-mouse button and select the
appropriate property from the shortcut
menu to open the “Module Properties”
dialog box. From the dialog box, select
the base unit you want to use.

3-3
3-2 System Configuration Definitions System configuration

2) The “Insert Module” dialog box appears as shown


in the figure below. Select a module type. (Note 2)
Left-click here after setting up
all items.
Set an SX bus station
number.

Enter a name.

Select the module to be


registered (Note 1).

Select a module type.

Note: 1) To select a module, first select the type of the module to register.
2) To select the unit (an individual module) directly connected to the SX bus, click the “Insert” button using the left-
mouse button with Base selected in the “System Configuration Registration” dialog box.

3) The module is registered to the system as shown


below. Follow the same procedure to register
subsequent modules.

A new module is registered.

<Defining an SX bus station number>


It is necessary to assign an SX bus station number to each Module” dialog box which is shown in the figure above.
module (except the power supply module) that is to be (Assign a CPU number when defining a CPU or P/PE link
connected to the SX bus. To assign an SX bus station module.)
number, use the SX bus station number field in the “Insert

SX Bus Station CPU Number SX Bus Station


PIO Number
Number (Note) Number
1 1 0 254
2 2 1 253
. . . .
. . . .
. . . .
238 238 15 239

Note: Make sure that the CPU number set by the D300win matches the CPU number switch settings on the module body.

3-4
System properties 3-3 System Properties

3-3-1 System operation definitions


(1) SX bus Takt time
The SX bus Takt 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. Takt time can be set in the range from 0.5ms to 10.0ms, in 0.5ms steps (when CPU firmware
version is V50 or newer). For older CPU firmware versions, Takt time can be set to 0.5ms, 1.0ms, 2.0ms ..... (in 1ms steps from
1.0ms). Default is 1.0ms.

Note: 1) A 0.5ms Takt period may be executed in such conditions as having a single CPU in a powerful CPU, 256 or less
directly-connected I/Os, and no remote I/O and communication module.
2) For the products whose CPU firmware version is V34 or older or V3A to V3Z, Takt time can be set to max. 20ms, in
1ms steps.
3) V2.2 or newer versions of D300win support the feature of setting Takt time in 0.5ms steps.
(2) Configuration check waiting time
At power-on, the CPU module initializes itself. When initialization has been done, a configuration check starts for the modules in
one configuration. Set the time for configuration check for “configuration check wait time.”
(3) Initialization method
The CPU module initializes itself when the system power is turned on. The user 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.
Note: 1) Memory diagnosis performs device read/write check.
Note: 2) The standard CPU does not support this item. (Device read/write check is not performed.)
<Setup procedure>
1) Double-click the [System_Definition] icon in the project tree with the left mouse button to open the system
configuration definition window.

2) Click system property with the right-mouse button.

Click property with the


left-mouse button.

3-5
3-3 System Properties System properties

2) “System Properties” dialog box appears.

Set an SX bus Takt time.

Set a configuration check


waiting time in
seconds(s).

Set a CPU module initialization method.

3) When filling the required fields, click the left-mouse button.

3-6
System properties 3-3 System Properties

3-3-2 System duplex mode definition


(These functions are not supported in Standard CPU and SPS.)
The mode, in which dual CPUs are used for controlling the system to improve system safety and reliability, is called the CPU
duplex system. (Refer to “Chapter 4 Duplex System” for information on the principle of duplex mode operation.)
<Setting the duplex mode>
1) Call up the “System Properties” dialog box and click the “System Duplex Mode Definition” tab with the left-mouse
button.
Select enabled/disabled.

Set 1 to 1 duplex mode.

Set N to 1 duplex mode.

2) When filling out the required fields, click the “OK” button.

<Fields for setting 1 to 1 duplex mode>


1) Setting a pair of CPUs .................... Set a pair of CPUs in the duplex mode.
2) Setting the stand-by method .......... Set to specify whether the internal data of the operating CPU is to be inherited by
the waiting CPU at start-up (warm/cold) when changeover occurs between
CPUs.
3) Equalization range specification......Set the range of data to be inherited in case of warm stand-by.
4) Setting relay switching .................... Set a relay-switched pair in the system with more than one 1 to 1 duplex pairs.
Check the boxes for all the pairs to be relay-switched.

<Fields for setting N to 1 duplex mode>


1) Setting the operating CPUs ............ Set the operating CPUs for each group. The number of operating CPUs is any of
a range 2-7.
2) Setting the waiting CPU ................. Set only one waiting CPU for each group. The CPU already registered as an
operating CPU cannot be specified.
3) Setting the memory module(s) ....... The N to 1 duplex 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.

Note: To use the N to 1 duplex 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.

3-7
3-3 System Properties fail-soft start-up

3-3-3 System fail-soft start-up


(1) Fail-soft disabled
If all the modules registered in the system configuration definition do not start within the system configuration check waiting
time (a default: 20 sec.), a system error occurs (the CPU ALM goes on).

(2) Partial fail-soft start-up of modules with SX bus station numbers


At MICREX-SX system start-up, if some modules on which power is not turned on are detected, the system is re-started
excluding these modules after the system configuration check waiting time has passed.
The system runs with a non-fatal fault (the CPU module RUN is on and the ALM is on).
<Example of system configuration at fail-soft start-up>
Fail-soft start-up start module
SX station number "100"
Modules with no SX bus station
SX bus station number
number setting switch
"254" "253" SX bus station SX bus station
number number
100 101
Power source

Power source
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
0 1

SX bus

In the above example, the modules to be partially fail-soft started are "servo 0," "servo 1," and "CPU 1" in .

1) The fail-soft start-up start module is any of a range from the SX bus station number, which has been set as the first
one to be fail-soft started to 253. Note 1) Set the numbers excluding the start number for the SX bus station numbers
for the module to be fail-soft started.
2) Be sure to assign the SX station numbers after one is declared as the start number only to the modules with an SX
bus station number setting switch. (You do not need to assign consecutive numbers to them.) Note 2)
3) When the module to be fail-soft started is turned on after fail-soft start-up (in the non-fatal fault state), the module is
activated and the system runs normally (The RUN is on and the ALM is off).

Note: 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, a system fatal fault (at initial start-up) or non-
fatal fault occurs (at successive start-up).
3) Be sure to use the system fail-soft start-up mode only in the fail-soft compatible modules (version 20** or later).
If any module incompatible with fail-soft is detected at initial start-up or at successive start-up, a system fatal fault
occurs.

3-8
fail-soft start-up 3-3 System Properties

<Setting system fail-soft start-up>


1) Call up the “System Properties” dialog box and click the “System Fail-soft Setup Definition” tab with the left-mouse
button.

2) Select Partial fail-soft start-up enabled and enter the fail-soft start number.
3) When filling the field out, click the “OK” button with the left-mouse button.

3-9
3-4 System Output Definitions System output

The user can define a bit, for each configuration, that running normally and set to OFF if the system has an error.
indicates the system operation state regardless of the The bit which can be set is bit 0 of the output module.
application. This bit is set to ON when the entire system is
<Setup procedure>
1) Select the digital output module for which system
output is to be set.

Left-click the [Property] button, or alternatively right-click to


display the shortcut menu and left-click the [Property...] command
in the menu.

2) The “Module Property” dialog box appears.

Click here with the left mouse button.

3) The “Direct I/O Parameter Setting” dialog box appears.

Place a check mark here to turn it on.

Click here with the left mouse button after


setting up the necessary items.

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

3-10
CPU operation definitions 3-5 CPU Parameters

3-5-1 CPU operation definitions


The CPU operation definitions include the watchdog timer,
power-on time operation, and battery less operation.
(1) Watchdog timer
The user can set a watchdog timer preset value from 1 ms to
4,095 ms. The default value is 4,095 ms.
(2) Power-on time operation
This parameter specifies the operation that the CPU module between the CPU module key switch positions and the CPU
is to perform when system power is turned on when the key module operations. A default value is “RUN = Running/
switch on the CPU module front panel is set to RUN or TERM = Running.”
TERM. The table given below shows the relationship
<CPU operations and key switch positions>
Operation
System Definition Setting
RUN TERM
RUN=run/TERM=run run run
preceding state
RUN=run/TERM=preceding state run
(Note)
Run=stop/TERM=stop stop stop

Note: 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 operation
In case of battery-less running, the CPU module, when running disabled. For the standard CPUs, battery-less
activated, initializes its memory to start operation. No data running is not applicable if they have no user ROM card
backup error is detected. The default value is battery-less (MP8PMF-16) inserted.

<Setup procedure>
1) Select the target resource icon under the project tree.

Right-clicking here opens a shortcut menu.


Left-click on [Settings...].

2) The “MICREX-SX Resource Setup” dialog box appears.

Note

Left-click here.

Note: The communications settings are used to connect the CPU module and the D300win. Refer to “User’s Manual D300win
<Reference Book> (FEH251) / D300winV2 <Reference Book> (FEH254)” for information on communication setup.

3-11
3-5 CPU Parameters CPU memory size

3) The “CPU Operation Definition” dialog box


appears.

When specifying a new value,


left-click “Preset (P)” and
enter a time value from 1 to
4095 (ms).

Select the desired


operation mode. Set the presence or absence
of battery less operation.

4) After setting up the necessary items, click the [OK] button with the left mouse button.

3-12
CPU memory size 3-5 CPU Parameters

3-5-2 CPU memory size definition


The user can set the size of the data memory in the CPU module. Although the size of the user memory area is 32K words and
each area is defined by default size, the user can change the size of each area as required. The size of each area may be
changed in 0.5K word increments.
<Allowable memory area size ranges>
The size of the user memory area may be changed in the range shown below. Note that the total number of words for user
memory is fixed. For example, to set 32K words for the standard memory of High-performance CPU (NP1PS-32), specify all 0s
for other memory areas.
High-performance CPU (NP1PS-32)
Minimum Maximum
Memory Type Initial Value
Value Value
Standard memory (non-retained memory) (%MW1) 2K words 8K words 32K words
Retain memory (%MW3) 0K words 4K words 30K words
User FB instance memory (%MW5) 0K words 4K words 14K words
System FB instance memory (%MW9) 0K words 16K words 30K words

High-performance CPU (NP1PS-74)


Minimum Maximum
Memory Type Initial Value
Value Value
Standard memory (non-retained memory) (%MW1) 2K words 32K words 128K words
Retain memory (%MW3) 0K words 16K words 126K words
User FB instance memory (%MW5) 0K words 16K words 113K words
System FB instance memory (%MW9) 0K words 64K words 126K words

High-performance CPU (NP1PS-117R)


Minimum Maximum
Memory Type Initial Value
Value Value
Standard memory (non-retained memory) (%MW1) 2K words 128K words 256K words
Retain memory (%MW3) 0K words 32K words 254K words
User FB instance memory (%MW5) 0K words 32K words 113K words
System FB instance memory (%MW9) 0K words 64K words 254K words

Standard CPU (NP1PH-16)


Minimum Maximum
Memory Type Initial Value
Value Value
Standard memory (non-retained memory) (%MW1) 0K words 8K words 31K words
Retain memory (%MW3) 0K words 4K words 31K words
User FB instance memory (%MW5) 0K words 4K words 14928 words
System FB instance memory (%MW9) 0K words 8K words 31K words
Initial value setup area 0K words 7K words 31K words

Standard CPU (NP1PH-08)


Minimum Maximum
Memory Type Initial Value
Value Value
Standard memory (non-retained memory) (%MW1) 0K words 4K words 15K words
Retain memory (%MW3) 0K words 2K words 15K words
User FB instance memory (%MW5) 0K words 4K words 7216 words
System FB instance memory (%MW9) 0K words 2K words 15K words
Initial value setup area 0K words 3K words 15K words

3-13
3-5 CPU Parameters CPU memory size

<Setup procedure>
1) Click the [CPU Memory Size Definition (M) ...] the left mouse button.
button in the “Select Resource” dialog box with

Left-click here.

2) The “CPU Memory Size Definition” dialog box The size of remaining free memory is assigned to
appears. non-retained memory (%MW). The memory size
Set the sizes of retained memory (R), user FB can be set in 0.5K word increments.
memory (F), and system FB memory (S). Set the area reserved for
additional variables used
for partial compilation and
download.

For powerful CPUs, set Select whether


these three memory variables are to be
areas. The remaining added using the
memory areas are all reserved area at
non-retain areas. partial compilation
or download
(enabled/disabled).
(Note 1)

(Note 2)

After setting the capacity


for every memory area,
click here with the left-
mouse button.

Note: 1) For standard CPUs, the number of initial values varies with settings for non-display, retain, user FB, and system
memories. (The initial value area for the user FB has been automatically calculated.)

3-14
CPU memory size 3-5 CPU Parameters

<Extended setting>
Extended setting for memory allocation includes “AT range setting,” “retain/equalization setting for automatically generated SFC
variables,” “assignment of variable equalization by specifying suffix,” “setting equalization reserve size for each POU.”
(1) AT range
AT range is the memory area for the user to specify the memory allocation for variables. When an area is specified as AT
range, no variable is automatically assigned to it.
(2) Retain/equalization setting for automatically generated SFC variables
Step flag (step_name.X) and action flag (action_name.X) that are automatically generated by SFC are not declared as variable
and therefore cannot be assigned to the equalization area of duplex system. However, when this box is checked, step flag and
action flag can be made retain variables and assigned to equalization area of duples system.
(3) Assignment of variable equalization by specifying suffix
This function assigns specified suffix characters (3 to 8 single-byte characters) to equalization area.
(4) Equalization reserve size for each POU
In performing on-line change (POU change) on a duplex system, this area is used when SFC step flag or action flag is to be
added or when a variable is to be added that corresponds to [Variables have following suffix to be copied].
<Setting procedure>
(1) When the [Extended setting(A)...] button in the [Memory allocation setting] dialog is left-clicked, the [Extended
setting] dialog is displayed.

(2) When setting is completed, left-click the [OK] button, and you will return to the [Memory allocation setting] dialog.

3-15
3-5 CPU Parameters I/O group

3-5-3 I/O group setup


The user can specify which I/O module in a configuration module with no I/O group assigned is found, the CPU can
can be controlled by which task in which CPU module. detect no fault if it occurs.
Be sure to set a CPU I/O group for I/O modules. If any I/O
<Setup procedure (1)>
1) Click the [I/O Group Setting] tab in the “CPU
Parameter” dialog box, and the following window
appears.

Select a module to register and Select a task.


left-click the [>>(>)] 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 to an I/O group.

Registered modules

2) The modules are registered as shown in the items, click the [OK] button with the left mouse
upper right window. After setting the necessary

3-16
I/O group 3-5 CPU Parameters

<Setup procedure (2)>


The user can use the [Standard Settings] button when
registering modules to I/O groups only for the “DEFAULT”
tasks in a single CPU system.
1) Make sure that the Level field is set to
“DEFAULT” and click [Standard Setting] button
with the left mouse button.

Left-click here.

2) The input modules are automatically registered to


the Input Selection (I) and the output modules to
the Output Selection (O) as shown below.

Left-click here after verifying the settings.

3-17
3-5 CPU Parameters I/O group

<Setup procedure (3)>


The user can register the output modules to I/O groups on a
bit basis in a multi-CPU system.
1) Select the output modules that are to be Selection (O) window, and click [Detail...] with the
registered on a bit basis from the Output left mouse button.

Left-click here.

Selected output module

2) The system opens the window shown below. Initially,


all bits are selected.
* A pressed button indicates
that the corresponding bit is
registered to the I/O group.

3) Click a bit that is not registered to the I/O group


with the left mouse button to set it off. In the figure
shown below, bits 8-15 are set off.

After setting the desired bits, left-click here.

3-18
I/O group 3-5 CPU Parameters

<Setup procedure (4)>


The user can register bits of an output module that is used I/O group of the local CPU as “inputs” to an application
by another CPU in a multi-CPU system to the input selection program running on the local CPU.
1) Select an output module and click the [Input for
referring output value] button with the left mouse
button.

Left-click here.

Selected output modules

2) The system opens the window shown below.


Initially, all bits are selected.

* A pressed button indicates that the


corresponding bit is registered to the
I/O group for output reference.

3) For a bit whose output is not to be referenced,


click it with the left mouse button to set it off.
In the figure shown below, bits 8-15 are set off.

After setting the desired bits, left-click here.

3-19
3-5 CPU Parameters Fail-soft

3-5-4 Fail-soft running


Even if a fault occurs in the module with fail-soft enabled
and goes down during system running, 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 the ALM is on). If the module with fail-soft disabled has a
goes down during system running, the CPU continues fault and goes down during system running, the CPU stops
running with a non-fatal system fault (The RUN is On and 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 down, no module can be activated unless all the down
its normal state. Note that if more than one module has been modules are recovered.

3) Modules with fail-soft enabled


Common modules with no I/O CPU, P/PE-link, and general Unconditionally, fail-soft is
area communication modules applicable
Modules with I/O area Digital I/O, analog I/O, and Register the modules with
AS-I master modules fail-soft enabled

Note: 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 module 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.

Considerations in building the fail-soft system

The module and base unit versions, which support fail-soft, are listed below.
• Modules with internal firmware installed 1030
• modules with no internal firmware installed 10 (for example, a base unit)
When any module, of a version earlier than that listed above, has been connected to the SX bus, no fail-soft can
be implemented on it. The SX bus-connected module fail-soft mode flag (%MW10.0.13) is set to "0" in system
memory.

Note: Even in a system in which a module incompatible with fail-soft has been configured, the remote I/O fail-soft
feature can be used.

3-20
Fail-soft 3-5 CPU Parameters

5) Fail-soft registration for the multi-CPU system


For the multi-CPU system, register the modules controlled fail-soft. The system operates as described below in case of
by the self-CPU in the I/O group and also register them for 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 I/O I/O I/O CPU I/O I/O I/O also register them for fail-soft.
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).

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). The CPU1 continues running normally.

3-21
3-6 Input/output Parameters Input filter

<Setup procedure>
1) Open the “CPU Parameter” dialog box and click
the [Fail-soft operation setting] tab with the left mouse button.

Select the module (left click) for


which fail-soft is to be set and left-
click the [>>] 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-22
Fail-soft 3-5 CPU Parameters

3-6-1 Input filtering time


The input filtering time is set for a DC-type digital input 3-3ms (default), 3-10ms, 10-10ms, 30-30ms, 100-100ms,
module. The time is set in the format (OFF-to-ON time) - and no filtering. Only for a fast input module (NP1X3206-A)
(ON-to-OFF time). The user can select a value from 1-1ms, can no filter or a 100-100µs input filtering time be set.

<Setup procedure>
1) From the system configuration definition tree, filtering time is to be set, and open the parameter
select a digital input module for which the input set up dialog box.

2) After specifying a filtering time, click the [OK] button


with the left mouse button.

3-23
3-6 Input/output Parameters Output hold

3-6-2 Output hold definition


The output hold definition is used to preserve the output state established immediately before the CPU is stopped
state established immediately before a system error occurs while the CPU is held stopped.
or a CPU module is shut down or to preserve the output

<Setup procedure>
1) Select, from the system configuration definition hold option is to be set, and open the parameter
tree, a digital output module for which the output set up dialog box.

Left-click “HOLD Mode (H).”

2) After selecting the hold mode, click the [OK] button


with the left mouse button.

Note: For remote I/Os on JPCN-1, output hold cannot be set.

3-24
Section 4 CPU Duplex System

Page
4-1 System operation in the duplex mode ................................................................... 4-1
4-1-1 1 to 1 duplex mode ............................................................................................................ 4-1
(1) System operation ................................................................................................................................ 4-1
(2) Replacing a faulty CPU with a new one .............................................................................................. 4-1
4-1-2 N to 1 duplex mode ........................................................................................................... 4-2
(1) System operation ................................................................................................................................ 4-2
(2) Replacing a faulty CPU with a new one .............................................................................................. 4-2

4-2 Conditions for changeover between operating ..................................................... 4-3


4-2-1 Conditions for changeover ................................................................................................ 4-3
4-2-2 System performance in the duplex mode and waiting CPUs and performance ................. 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 operating and waitin ing and waiting CPUs .. 4-8

4-3 CPU module LEDs and output to display system ................................................. 4-9

4-4 Application of the duplex system ......................................................................... 4-10


4-4-1 Successively start of CPU module .................................................................................. 4-10
4-4-2 1 to 1 duplex system ....................................................................................................... 4-10
(1) Either an operating or waiting CPU has been configured ................................................................. 4-10
(2) If neither an operating nor waiting CPU has been configured .......................................................... 4-10
4-4-3 N to 1 duplex system ....................................................................................................... 4-10
(1) Some operating CPUs or a waiting CPU have not been configured ................................................. 4-10
(2) Some operating CPUs and a waiting CPU have not been configured .............................................. 4-10
4-4-4 System configuration definition ....................................................................................... 4-10

Note: The CPU duplex system cannot be built using the standard CPUs.
1 to 1 duplex mode
Section 4 CPU Duplex System
4-1 System operation in the duplex mode

This is called the duplex mode because dual devices are section, how to build the CPU modules into the duplex
used to improve system safety and reliability in the control system is described.
system. In the MICREX-SX Series, the power modules and Provided with MIXREX-SX, the CPU duplex mode includes 1
CPU modules can be built into the dual systems. In this to 1 and N to 1 types.

4-1-1 1 to 1 duplex mode


In this mode, one operating CPU is associated with one operating and waiting CPUs. In this case, the same
waiting CPU. Combinations CPU0-CPU1, CPU2-CPU3, application program is used.
CPU4-CPU5, and CPU6-CPU7 are established as pairs of
<Example of 1 to 1 duplex system configuration>
Operating CPU Waiting CPU
• Running an application • I/O data input Note: When the cold standby method is used,
• I/O control • Monitoring the operating CPU
equalized data is not inherited.
• Monitoring and controlling the entire system • Inputting equalized data from the operating CPU
• Outputting equalized data to the waiting CPU (Note)
(Note)

Power CPU Power CPU Power I/O I/O I/O I/O I/O I/O
source 0 source 1 source

SX bus

(1) System operation


At system power-on, the system starts running, assuming waiting CPU starts running.
that the CPU modules with even CPU numbers assigned are The 1 to 1 duplex mode includes two types, warm standby in
on the operating side while those with odd CPU numbers are which the waiting CPU inherits data from the operating CPU
on the waiting side. (In the above example, CPU0 is an and cold standby in which the waiting CPU does not do so.
operating CPU and CPU1 is a waiting one.) The data inherited by the waiting CPU is called equalized
When the operating CPU has a fault and goes down, the 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 the power on. A new CPU0 is assumed to be on the waiting
been installed on the base unit with a CPU mounted on it, side.
the CPU0 can be replaced while CPU1 is running instead of When faults occur in both CPUs (on the operating and
the downed CPU0. To replace the CPU0 with a new one, waiting sides), turn off the power on both of the systems and
turn the CPU0 power off, replace it with a new one, and turn then re-start them.

Kay points

• Install the same application on both the operating and waiting CPUs.
• In either case of the warm and cold standby methods, I/O data is inherited.
• The use of the loader allows you to switch between the operating and waiting CPUs.

4-1
4-1 System operation in the duplex mode N to 1 duplex mode

4-1-2 N to 1 duplex mode


In this type of system, more than one (2-7) operating CPUs CPU with the largest CPU number among those in a group is
are associated with one waiting CPU. Up to two sets of N to a waiting CPU.
1 duplex groups can be defined for each configuration. The
<Example of 2 : 1 duplex system configuration>
Operating CPU Waiting CPU
• Running an application • Monitoring operating 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
source 0 source 1 source 2 card
if

SX bus

(1) System operation


At system power-on, the CPU module with the largest CPU CPU1, the waiting CPU downloads the program of the faulty
number in the N to 1 duplex system is assumed to be a CPU from the memory card interface module and starts
waiting CPU. (In the above example, CPU0 and CPU1 are running.
operating CPUs and CPU2 is a waiting CPU.) In the N to 1 duplex mode, only the cold standby method can
When the system goes down due to a fault in CPU0 or be applied. No data is inherited from the operating CPU.
(2) Replacing a faulty CPU with a new one
In the above example, since only the power module has off, replace it with a new one, and turn the power on. A new
been installed on the base unit with a CPU mounted on it, CPU module is assumed to be on the waiting side, and is
the CPU can be replaced while CPU2 is running instead of waiting for a switching instruction from the loader or system
the downed CPU1. power reset. This means that the system is not in the N to 1
To replace the CPU1 with a new one, turn the CPU1 power duplex system.

Key points
• N (the number of operating CPUs) application programs need to be stored on the memory card interface module.
• In the N to 1 duplex mode, only the cold standby method is applicable. No internal data and I/O data are inherited.
• The use of the loader allows you to switch between the operating and waiting CPUs. When the faulty CPU is replaced,
the operating CPU needs to be switched to the waiting one.
• In the N to 1 duplex 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 duplex 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 operating and waiting CPU.

4-2
Conditions for changeover 4-2 Conditions for changeover between operating
and waiting CPUs and performance

4-2-1 Conditions for changeover


The conditions in which changeover occurs between conditions are the same for both 1 to 1 and N to 1 modes.
operating and waiting CPUs are shown below. The
: changeover -: no changeover
• Fault in application operation processor
Fault in CPU
• Fault in OS processor
• Fault in system memory (ROM/RAM)
Fault in memory • Fault in application memory (ROM/RAM)
• Fault in memory battery backup
Fatal fault in
operating CPU • Fault in SX bus control LSI
• Fault in processor bus access (caused by self-module)

Fault in SX bus • Duplicate station number


• Excessive number of connected modules
(Note 1)
• Fault in SX bus transmission
• Delay in I/O refresh
Power failure • Base power shutdown
• User program error
Fatal fault in Application error • Application WDT error
operating • 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 by Changeover between operating and waiting CPUs by loader
loader
Multi-CPU relay In the multi-CPU duplex system (1 to 1 mode), one CPU is switched due
switch to a fault, followed by another CPU.

Note:1) Since the SX bus is a common resource for the entire system, changeover cannot be done between operating and
waiting 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 duplex mode


Switching
Takt time Scan time
time
1 to 1 duplex mode Within 130ms The same Takt 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 duplex mode Within 130ms Takt 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 duplex mode Several tens The same Takt time as in the The same scan time as in the ordinary multi-
cold standby sec. ordinary multi-CPU system CPU system

Note: 1) Depends on the quantity of equalized data.


2) If the message-related FB is used directly after changeover from the operating CPU to the waiting one, the busy
status continues until the message closing process is completed (100-600ms).

4-3
4-2 Conditions for changeover between operating Multi-CPU relay switch
and waiting CPUs and performance

4-2-3 Multi-CPU relay switch


Usually, in the 1 to 1 duplex mode, changeover is done of CPUs following changeover between a pair of operating
between a pair of operating and waiting CPUs. In the multi- and waiting CPUs, set the relay switch mode. This enables
CPU system, when you want to switch between another pair the system to switch between both CPUs automatically.
<Example of three-pair relay switch system configuration in the 1 to 1 duplex mode>

Power CPU CPU CPU Power CPU CPU CPU Power I/O I/O I/O I/O I/O
source 0 2 4 source 1 3 5 source

Operat- Operat- Operat- Waiting Waiting Waiting


ing ing ing

SX bus

Power CPU CPU CPU Power CPU CPU CPU Power I/O I/O I/O I/O I/O
source 0 2 4 source 1 3 5 source

Operat- Operat- Waiting Operat- Waiting


ing ing ing

SX bus

Power CPU CPU CPU Power CPU CPU CPU Power I/O I/O I/O I/O I/O
source 0 2 4 source 1 3 5 source

Waiting Waiting Operat- Operat- Operat-


ing ing ing

SX bus

In the above example, when CPU2 stops running due to a command, go into the waiting mode and CPU1 and CPU5
fault, CPU3 starts running instead. (The time for switching is are switched to the operating mode. (The time for switching
130ms max.) Then, CPU3 issues the switch command to is 130ms max.)
CPU0 and CPU4. CPU0 and CPU4, when receiving the

Note: 1) While CPU2 has a fault in the above system configuration, the system cannot switch to the waiting CPU if a fault
occurs in the operating CPU. The entire system goes down due to a fatal fault.
2) Relay switching can be done while both the operating and waiting systems are running normally.
For example, when changeover occurs during initialization (the operation and waiting sides are not undefined), even a
CPU with an enabled relay switch may not be switched to another one. This means that both the operating and
waiting 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
Data equalization 4-2 Conditions for changeover between operating
and waiting CPUs and performance

4-2-4 Data equalization


In the 1 to 1 duplex mode warm standby system, the internal equalization. The specifications of equalization are
data of the operating CPU and waiting CPU with varying described below.
arithmetical operations may be equalized. This is called
(1) Timing for equalization
Data is equalized at the scan end of the default task same timing as that of the scan end of the default task even
(synchronized with the task). Data can be copied at the if any task shorter than the scan time is executed.

Example of
ordinary system
Takt time Constant periodic time
Constant periodic time

Default task

Scan time Scan time (1-2ms)

Constant periodic task


I/O refresh (output) Default task Default task
I/O refresh (input) I/O refresh (output)

Example of the duplex system to be equalized

Takt time (2ms)


Constant
periodic task

Default task

System operation
on the operating side Equalization (data copy output) Equalization (data copy output)

Several ms -several tens of ms (depends on the quantity of data copied)


Scan time when data is equalized (Note 1)
Default task
I/O refresh (output)

At this point, equalization is complete.

System operation on
the waiting side. Equalization (data copy input) Equalization (data copy input)

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 waiting CPU stores the old copied data.

(Note 2) (Note 2)

Note: 1) When a switching factor occurs during scanning, the waiting CPU starts running with equalized data which has been
scanned previously.
2) Data output stops at the first task point next to the point that a switching factor has occurred. No output from the I/O
module is updated until the waiting CPU starts running.

Scan time for duplex system (outline)

= (Scan time of ordinary system) + {1 + (Total number of words for equalization) / 512 words} x Takt time
[Integral multiple of Takt time] Fractions to be rounded

Note: The scan time increase when total number of words for equalization increase.

4-5
4-2 Conditions for changeover between operating Data equalization
and waiting CPUs and performance

(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 → Standard memory (high-speed), standard memory, and retain memory
• System-equalized area → 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 Equalization Equalization size Spg
(high-speed)
specification 1 AT specification Spg=equalization 1 + equalization 2 + equalization 3
(Note: 1)
Note: 1) Set the equalization specification area so that it lies in the
range specified in the AT statement and also specify the
variables to be equalized in the AT statement.
Standard memory Equalization
specification 2 AT statement
(Note: 1)

Retain memory Equalization


specification 3 AT statement
(Note: 1)

Note: 2) When you use the function that automatically assigns


variables having specified suffix or SFC step/action variables
Range of equalization
AT specification 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 Note) In the 1 to 1 duplex mode, the maximum area which can be
defined for retain in the user FB instance memory is 2048 words.

4-6
Data equalization 4-2 Conditions for changeover between operating
and waiting CPUs and performance

3) Retain attribute area and current timer value area in


system FB instance memory

No. of
Equalized system FB Equalized instance element
words
Old input value 2
Edge detection(R_TRIG, F_TRIG)

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)
Note 1) Includes a totaling timer.
Note 2) The number of equalized instructions indicates the number of instructions available in each FB
defined in the CPU memory size definition 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 duplex system.

8192 ≥ SPG + SUFB + SSFB (words)

Note: To use NP1PS-74 (powerful CPU74K product) in the 1 to 1 duplex mode warm standby system, be sure to define
the memory boundaries considering equalized data. If default boundaries are used, equalization requires 819 words
or more only for system FB instance memory.

4-7
4-2 Conditions for changeover between Memory operation
operating and waiting CPUs and performance

4-2-5 Memory operation at changeover between


operating and waitin ing and waiting CPUs
1 to 1 duplex mode N to 1
System status Memor y or flag duplex
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 Values are retained during running

Operating ==> waiting Retain memory


I/O memory
Cleared An area other than the area to be Cleared
equalized is cleared, and the data
Standard memory
in the area to be equalized is
inherited by the operating CPU.
Old values are Old values are retained and data Cleared
Retain memory retained. in the area to be equalized is
Waiting ==> operating inherited by the operating CPU.
Data remains Data remains unchanged Reset/hold
I/O memory
unchanged
Default task start flag ON ON ON
Initial flag OFF (Note 1) OFF (Note 1) ON
Operating/waiting changeover flag ON ON ON
Standard memory Cleared
Retain memory Cleared
Cold running (at
program download or I/O memory Cleared
initial start-up by loader)
Default task start flag ON
Initial flag ON

Note: 1) When the waiting CPU does not run after program download, the initial flag is set to “1.”
2) In the duplex system, to pass data to the bit variables used for semaphores at changeover between the operating and
waiting CPUs:
• Assign the bit variables for semaphores to the standard memory area to avoid equalization.
(They are reset to 0 atchangeover.)
• When changeover occurs, make an attempt to get semaphores again.

Key points

<System operation at changeover>


• 1 to 1 duplex mode standby system
The system operates in the same manner as the system for single CPU warm running with the exception
that data in I/O memory is inherited.
• 1 to 1 duplex warm standby system
This is the cold standby system with data equalization added.
• N to 1 duplex system
Since the program is downloaded from the memory card interface module, the system uses the cold standby method.

4-8
LED indication 4-3 CPU module LEDs and output to display system

: On, -: Off, : Blinking


Fatal fault in I/O fault (fail-soft II/O fault (fail-soft
Faulty module The entire The entire Fatal fault in Fatal fault in operating enabled) disabled)
system system operating CPU waiting CPU CPU module
operates stops module module Non-fatal fault in Fatal fault in
normally normally Application
Module operating/waiting operating/waiting
error
CPU resource CPU resource
ON —

ERR — — — — — —
LED
indication RUN — — — —
Operating
CPU ALM — —
Normal Normal Fatal fault in Fatal fault in Fatal fault in self Fault in I/O module Fault in I/O module
Flag waiting CPU Non-fatal fault in Fatal fault in
run run self CPU resource resource CPU resource self-CPU resource self-CPU resource
ON —

LED ERR — — — — — —

Waiting indication RUN — — —


CPU
ALM — — —
Normal Normal Fatal fault in Fatal fault in Fatal fault in Fault in I/O module Fault in I/O module
Flag Non-fatal fault in Fatal fault in
run run operating CPU self-CPU operating CPU self-CPU resource self-CPU resource
ON
LED
— — — — — —
System indication ERR
DO System DO — —

Contact ON OFF ON ON ON ON OFF


output (Running) (Stop) (Running) (Running) (Running) (Running) (Stop)

4-9
4-4 Application of the duplex system Duplex system

4-4-1 Successively start of CPU module


In the duplex mode, CPUs other than CPU0 can be Note that CPU0 must be mounted before the system can
successively started without enabling fail-soft. start.
Note: If all the CPU modules have not been configured, download the program to them individually by using the loader.

4-4-2 1 to 1 duplex system


(1) Either an operating or waiting CPU has been
configured
1) Even if non-default waiting CPUs (odd CPU 2) Even if non-default operating CPUs (even CPU
numbers) have been configured, the system can numbers) have been configured, the system can
start with a non-fatal system fault. start with a non-fatal system fault.

Note: In the case of 2), the system starts with all the default operating CPUs, for which the relay switch is enabled, switched to
waiting CPUs.
(2) If neither an operating nor waiting CPU has been
configured
In the 1 to 1 duplex system, the system starts with a non- operating and waiting CPUs have not been configured.
fatal fault using the remaining CPUs, even if both the
Note: With the relay switch enabled, a fatal fault occurs in the system.

4-4-3 N to 1 duplex system


(1) Some operating CPUs or a waiting CPU have not
been configured
1) With a non-default waiting CPU (the CPU with the 2) With some default operating CPUs not
largest number assigned) configured, the system configured, the system starts with a non-fatal
starts with a non-fatal fault. fault.
(2) Some operating CPUs and a waiting CPU have not
been configured
The system starts with the remaining CPUs with a non-
fatal fault.

4-4-4 System configuration definition


1) In the duplex system (1 to 1 and N to 1 ), specify 2) When the actual configuration is different from
the same data for all the CPUs in the system that in the system configuration definition, a
configuration definition. System configuration system definition error occurs in the entire
definition information is transferred to all the system. If some CPUs have information different
CPUs by one download operation. from that for others, a system definition error
occurs only in those CPUs.

4-10
Appendix 1 Instruction Proces Speed Chart

Page
1-1 High-performance CPU Instruction Processing Speed Chart ..................... App.1-1

1-2 Standard CPU Instruction Processing Speed Chart ..................................... App.1-9


High-performance
Appendix 1 Instruction Processing Speed Chart
1-1 High-performance CPU Instruction
Processing Speed Chart

All values in µs.


Language Name Processing Speed (1) Processing Speed (2)
IL language Load LD 0.02 0.06 *Processing speed (1)
indicates the execution
Load not LDN 0.02 0.06 speed of the instruction as
Store ST 0.02 0.06 executed with operands of
the data type that is
Store not STN 0.02 0.06 processed most quickly
Set S 0.04 0.12 and stored in the high-
speed memory area
Reset R 0.04 0.12 and/or input/output
memory area.
Logical product AND 0.02 0.06
Logical product AND( 0.02 0.02 Processing speed (2)
indicates the execution
Logical inverted product ANDN 0.02 0.06 speed of the instruction as
Logical inverted product ANDN( 0.02 0.02 executed with operands of
the data type that is
Logical add OR 0.02 0.06 processed most quickly
and stored in areas other
Logical add OR( 0.02 0.02
than the high-speed
Logical inverted add ORN 0.02 0.06 memory area and/or
input/output memory area.
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
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart

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)
FALSE conditional call CALCN User FB (3.0)

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 instructions (steps) of a
IF statement control group which is made up of statements after
compilation, varies from application to application.
CASE statement Consequently, it is difficult to compute the control processing
FOR statement 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
Rturn statement
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
Type conversion WORD_TO_UINT 0.06 0.14

App.1-2
High-performance 1-1 High-performance CPU Instruction
Processing Speed Chart

All values in µs.


Language Name Processing Speed (1) Processing Speed (2)
Type 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
Type conversion DINT_TO_W_BCD 0.56 0.64
Type conversion INT_TO_D_BCD 0.48 0.56
Type conversion DINT_TO_D_BCD 0.12 0.20

App.1-3
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart

All values in µs.


Language Name Processing Speed (1) Processing Speed (2)
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
High-performance 1-1 High-performance CPU Instruction
Processing Speed Chart

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
Minimum value MIN_INT
Minimum value MIN_DINT
Minimum value MIN_UINT
Minimum value MIN_UDINT
Minimum 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

App.1-5
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart

All values in µs.


Language Name Processing Speed (1) Processing Speed (2)
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 + 048 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 first 2.8 + 0.56 x (No. of characters of first
Concatenate CONCAT input + No. of characters of second input + No. of characters of second
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 + 0.56 x
(No. of characters to insert) (No. of characters to insert)
2.04 + 1.06 x (No. of input characters - 2.16+1.22 x (No. of input characters -
Delete string DELETE No. of characters to delete) + 0.36 x (No. of characters to delete) + 0.56 x
(No. of characters to delete) (No. of characters to delete)
2.42 + 1.06 x (No. of input characters - 2.7 + 1.22 x (No. of input characters -
Replace string REPLACE No. of replacement characters) + 0.6 x (No. of replacement characters) +
(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 characters) 1.32 + 0.66 x (No. of input characters)
Compare String (≥ )
GE_STRING
Compare String (=) EQ_STRING
Compare String (≤ )
LE_STRING
Compare String (≤ ) LT_STRING
Compare String (≠ ) 1.14 + 0.3 x (No. of input characters)
NE_STRING
Time type Add time ADD_T_T 0.12 0.24
data
function Add time ADD_TD_T 3.00 3.18
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 0.12 0.24
CONCAT_D_D
Convert DT to TOD 1.16 1.28
DT_TO_TOD
Convert DT to DATE 1.76 2.06
DT_TO_DATE

App.1-6
High-performance 1-1 High-performance CPU Instruction
Processing Speed Chart

All values in µs.


Language Name Processing Speed (1) Processing Speed (2)
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 DECORD_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
Convert string to number 0.62 + 0.76 x (No. of input characters) 0.66 + 0.80 x (No. of input characters)
STR_TO_UINT
Convert number to string 1.36 + 1.82 x (No. of output characters) 1.36 + 1.94 x (No. of output characters)
UINT_TO_STR
Convert shift-JIS to string 2.76 + 1.98 x (No. of output characters) 3.02 + 2.1 x (No. of output characters)
SJ_TO_STR
Convert string to shift-JIS 1.46 + 0.94 x (No. of input characters) 1.52 + 1.02 x (No. of input characters)
STR_TO_SJ
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 1.12/1.12 1.28/1.28
SC_COIL/SC
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 1.14/1.14 1.26/1.26
MULL/MULU
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
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart

All values in µs.


Language Name Processing Speed (1), (2)
Standard Pulse TP 0.44
function block
On-delay timer TON 0.44
Off-delay timer TOF 0.44
Real-time clock RTC 1.76
Original Ring counter RCT 0.22
function block
Integrating timer TMR 0.44
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 necessary to grasp processing speed, it is recommended
executed. Consequently, it is difficult to discuss the that the processing speed be measured by using an actual
processing speed of SFC elements using only the worksheet machine.
on which the SFC elements are programmed. When it is

App.1-8
Standard 1-2 Standard CPU Instruction Processing Speed Chart

All values in µs.


Language Name Processing Speed
IL language Load LD 0.07 * The processing speed
depends on the data type
Load not LDN 0.07
to be used. The data
Store ST 0.14 types for which operands
Store not STN 0.14 are processed at the
highest speeds are listed
Set S 0.14 in the table.
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
TRUE conditional jump JMPC 0.14 (Non-JMP)
/0.21(JMP)

App.1-9
1-1 Standard CPU Instruction Processing Speed Chart Standard

All values in µs.


Language Name Processing Speed (1)
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
User FB (32.14)
FALSE conditional call CALCN is not executed.
Unconditional return RET The value enclosed in ( ) is the
User FCT (15.14) value when a call is executed.
TRUE conditional return RETC
User FB (18.14) The value is 0.4µs when a call
FALSE conditional return RETCN is not executed.
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
FOR statement 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
Rturn 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
Type conversion WORD_TO_UINT 7.35

App.1-10
Standard 1-1 Standard CPU Instruction Processing Speed Chart

All values in µs.


Language Name Processing Speed
Type 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
Type conversion DINT_TO_W_BCD 14.42
Type conversion INT_TO_D_BCD 13.42
Type conversion DINT_TO_D_BCD 25.49

App.1-11
1-1 Standard CPU Instruction Processing Speed Chart Standard

All values in µs.


Language Name Processing Speed
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

App.1-12
Standard 1-1 Standard CPU Instruction Processing Speed Chart

All values in µs.


Language Name Processing Speed
Selection/ Select SEL_BOOL 1.12
comparison
Select SEL_INT 1.05
function
Select SEL_DINT 1.19
Select SEL_UINT 1.05
Select SEL_UDINT 1.19
Select SEL_REAL 1.19
Select SEL_WORD 1.05
Select SEL_DWORD 1.19
Select SEL_TIME 1.19
87.47 + 0.64 x (Total numbers of
Select SEL_STRING
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

App.1-13
1-1 Standard CPU Instruction Processing Speed Chart Standard

All values in µs.


Language Name Processing Speed
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)
49.19 + 40 x (No. of characters of input) + 0.5 x (Total numbers of input
Concatenate CONCAT 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)
110.76 + 0.5 x (No. of input characters) + (No. of characters to delete) + 0.14
Delete string DELETE
x (No. of output characters)
139.47 + (No. of input characters) + 0.5 x (No. of characters of replacemant -
Replace string REPLACE
No. of replacement characters) + 0.14 x (No. of input characters)
92.63 + 1.5 x (No. of characters of first input + No. of characters of second
Find String FIND
input)
Compare String (>) GT_STRING 99.56 + 2.3 x (Position where comparison result is output) + 0.5 x (Total
numbers of input characters)
Compare String (≥ ) GE_STRING
Compare String (=) EQ_STRING 99.56 + 3.5 x (Position where comparison result is output) + 0.5 x (Total
numbers of input characters)
Compare String (≤ ) LE_STRING
Compare String (≤ ) LT_STRING 99.56 + 2.3 x (Position where comparison result is output) + 0.5 x (Total
numbers of input characters)
Compare String (≠ ) NE_STRING
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 TO DT_TO_TOD 14.91
Convert DT to DATE 39.98
DT_TO_DATE

App.1-14
Standard 1-1 Standard CPU Instruction Processing Speed Chart

All values in µs.


Language Name Processing Speed
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 DECORD_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 63.35 + 6.5 x (No. of input characters)
STR_TO_UINT
Convert number to string 61.77 + 0.14 x (No. of output characters)
UINT_TO_STR
Convert shift-JIS to string 71.98 + 7 x (No. of output characters)
SJ_TO_STR
Convert string to shift-JIS 68.7 + 5 x (No. of input characters)
STR_TO_SJ
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
Bias BIAS_INT 22.7
Bias BIAS_DINT 24.91
Bias BIAS_REAL 28.91
Step sequence coil 18.98/19.05
SC_COIL/SC
32-bit addition with carry 20.19/20.19
ADC/ADCO
32-bit subtraction with borrow 21.19/21.19
SBB/SBBO
64-bit multiplication 31.91/31.91
MULL/MULU
64-bit division DIVL/DIVU 42.26/42.26
Shift left 32-bits with carry 18.84/17.56
SLC/SLCO
Shift right 32-bits with carry 18.84/17.56
SRC/SRCO
Standard Set reset flip-flop SR 30
function
Reset-set flip-flop RS 30
block
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

App.1-15
1-1 Standard CPU Instruction Processing Speed Chart Standard

All values in µs.


Language Name Processing Speed
Standard Pulse TP 33 to 45
function block
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
At request: 168, Response waiting time: 35,
File data read F_READ
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 necessary to grasp processing speed, it is recommended
executed. Consequently, it is difficult to discuss the that the processing speed be measured by using an actual
processing speed of SFC elements using only the worksheet machine.
on which the SFC elements are programmed. When it is

App.1-16
Appendix 2 Setting High-performance CPU
Takt Periods

Page
(1) Approximation formulas for calculating the Takt period from the system configuration data ........ App.2-1
(2) Formula for calculating the performance when scanning by the Takt period ............................... App.2-2
(3) Sample time calculations ............................................................................................................. App.2-2
(4) Estimation of the Takt periods in the 1 to 1 warm standby duplex system ................................... App.2-3
Appendix 2 Setting High-performance CPU Takt
Periods

On the SX bus, data is exchanged between the CPU and I/O This appendix introduces approximation formulas for
modules in synchronization with the Takt period. The calculating the scan time for each takt period. Basically, the
application program on the CPU module performs 1) I/O Takt period of the SX bus is dependent on the system
data input updating, 2) arithmetic operations, and 3) I/O data configuration. In a system that requires a task period which
output updating in execution units called tasks (default task, is based on the Takt period, the Takt period depends on the
periodic task, and event task). These operations are carried number of steps of the application. To obtain an exact
out concurrently with data exchange over the SX bus. execution time, it is necessary to measure it on an actual
machine.

<System configuration that depends on the Takt period>


• Number of I/O points • Number of CPUs
• Number of communication modules • Number of remote I/O master modules
(1) Approximation formulas for calculating the Takt
period from the system configuration data
Takt period T (µ s)
1) 1 CPU + direct I/O configuration: T = Tb [Base time
(Tb) based on the number of direct connection input/
output points]

No. of direct connection I/O


0 32 128 256 512 1024 2048 3072 4096 6144 8192
points (points)
Base time Tb (µs) 418 504 507 510 556 695 1042 1388 1520 1711 1911

The above numbers are based on the assumption that the there are, the longer the base time is, and vice versa. The
ratio of I/O input to I/O output is 1 to 1. The more outputs range of fluctuation is approximately ± 20%.

Note: 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 Takt period from 0.5, 1, 2, 3, ..., 18, 19, and 20 ms. The user should select a value that is
obtained by rounding up the corresponding value listed in the above table.

2) Multi-CPU configuration: [No. of CPUs: n] 5) When communication modules are added to 1 CPU +
• T= Tb + 210n (No. of direct connection input/output direct connection I/O (1): [No. of communication
points: 2048 or less) module: p]
• T= Tb + 200n + 190 (No. of direct connection • T = Tb + 40p + 250
input/output points: more than 2048)
6) When communication modules are added to
3) Single CPU + remote I/O: [No. of remote I/O master configurations
modules: m] ((2) to (4)): [No. of communication modules: p]
• T= Tb + 250n + 430 (No. of direct connection • T = (Time calculated for ((2) to (4)) + 85p [when there is no
input/output points: 2048 or less) remote master module]
• T= Tb + 280n + 730 (No. of direct connection • T = (Time calculated for ((2) to (4)) + 128p [when there is a
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)
remote master module]

Note: 3) 2048 points / 1 line is assumed for remote I/O.

App.2-1
(2) Formula for calculating the performance when
scanning by the Takt period
Computing time
= [Takt period] - [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
= [Takt period] - (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]

Note: 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): 3) Memory in another CPUs access via the
Base time (20ns) processor bus: 3µs
2) Standard memory, retained memory, user FB
memory, system FB memory, system memory:
Add 40ns.

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


1) Single CPU
Scan Time System Configuration POU Control Time Program Executable Time
(Takt Time) (No. of PGs/FBs/FCTs) (in 20 ns steps)
CPU... 1 module (communication module 68µs 124µs
0.5ms disabled) (4/4/4) (6k steps)
Direct connection I/O... 256 points
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
2ms Remote I/O ...1 module... 2048 points (16/32/32) (42k steps)
CPU... 1 module
Remote I/O ...2 modules: 4096 points 480µs 492µs
Direct connection I/O... 2048 points (16/32/32) (24k steps)

App.2-2
2) Multi-CPU configuration
Scan Time System Configuration POU Control Time Program Executable Time
(Takt 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
4ms CPU... 4 modules
Remote I/O ... 2 modules: 4096 points 480µs 2620µs
Direct connection I/O: 1024 points (16/32/32) (508k steps = 127k x 4)
Communication modules... 2 modules

(4) Estimation of the Takt periods in the 1 to 1 warm


standby duplex system
In the 1 to 1 warm standby system, the Takt time is longer described below. In the expression, the large Takt times are
than that in the ordinary multi-CPU system. This is because, used for duplex system Takt time
in this system, equalized data should be transferred between 1 (T R1) and duplex system Tact time 2 (TR2 ).
the operating and waiting CPUs. The estimate expression is

Duplex system Takt time 1: TR1 [µs]


T R1 = Usual Takt time note) + 596 x N + 430 (No. of directly connected I/Os: 2048 or less)
T R1 = Usual Takt time note) + 626 x N + 730 (No. of directly connected I/Os: more than 2048)
N: No. of pairs in the duplex system

Note: The usual Takt time is the time found by expression (1). The number of CPUs can be calculated using the number of
CPU pairs in the duplex system.

Duplex system Takt time 2: TR2 [µs]


T R2 = (I/O refresh time) + T DMA + 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]

T CPY = (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 Standard CPU Takt Periods

Page
(1) The Takt period calculated is based on SX bus performance (No. of I/O modules) ..................... App.3-1
(2) The necessary Takt period based on the run time of system software ........................................ App.3-1
Appendix 3 Setting Standard CPU Takt Periods

On the SX bus, data is exchanged between the CPU module well as those executed whenever an application is executed
and I/O module in synchronization with the Takt period. For or a default task has been done. The loader process is
the application program on the CPU module, I/O data input performed in one excessive Takt period. The estimate
update, arithmetical operations, and I/O data output update expression of the scan time for each Takt period is shown
are performed in each task (process unit) in parallel with below. The Takt period depends on the system configuration.
data exchange on the SX bus. Execution of system software also depends on the Takt
The standard CPU divides system software in one Takt period. Thus, the executable Takt periods must be set by
period into the processes executed in every Takt period as system software.

<System configuration components depending on the


Takt period>
• No. of I/O points
• No. of remote I/O modules
• No. of stations simultaneously issuing loader
command

The Takt period can be selected among 1, 2, 3, ...9, 10ms. period based on the run time of system software, whichever
(1) The Takt period calculated is based on SX bus is larger, is determined by truncation
performance (No. of I/O modules) and (2) the necessary Takt

(1) The Takt period calculated is based on SX bus


performance (No. of I/O modules)
1) One CPU + Connected I/O : T = Tb
No. of connected I/O points 0 32 128 256 512 1024 2048 3072 4096 6144 8192
Base time Tb (µs) 418 504 507 510 556 695 1042 1388 1520 1711 1911

The times listed above are calculated under the condition decreases with a reduced number of outputs. Its fluctuation
that the ratio of I/O input to output = 1 : 1. The time ranges from + 20% to -20%.
increases with an increased number of outputs and

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)
Note: 2048 points/1 line is assumed for remote I/O.
(2) The necessary Takt period based on the run time of
system software
System software processes I/O transmission, tasks, and simultaneously issuing the loader commands, recommended
loader commands. Any of these processes should be done preset times and calculation times (the application program
in one Takt period. Based on the number of stations processing time) for the Takt periods are shown below.

Recommended Takt time (ms) 1 2 3 4 5 6 7 8


No. of stations simultaneously
1 4 16 27 27 27 27 27
issuing loader commands
Calculation time (µs) 409 1209 2009 2809 3609 4409 5209 6009

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

Key-point:

• To execute the task processes in synchronization with the Takt periods, the application program should be written so that it
does not use more than the calculation time listed below.
• Compared with the recommended Takt 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 Takt 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
BOOL 1 word if the bit string is 16 bits or less.
Bi t 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 varies according to the data type established before the data
2-word boundary. The boundary of the individual data item 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 : I NT ; 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

Note: 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: The standard CPU does not support processor bus access.
Appendix 5 Accessing the Processor Bus

The processor bus can be 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.

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


CPU CPU
Power supply "0" "1"

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 (Note 2)
P/PE-link memory 3µs (Note 2)

Note: 1) The high-speed memory area cannot be accessed in any other CPU.
2) The access time through the processor bus.

App.5-1
<Considerations in reading /writing memory through the
processor bus>
The processor bus cannot be accessed simultaneously by the CPUs starting from the one with the highest priority
more than one CPU. If more than one CPU accesses the assigned. The CPU with a lower priority waits for a long time.
processor bus simultaneously, it can be sequentially used by Any such delay affects the CPU processing speed.

CPU0 CPU1 CPU2 CPU3

x x
Processor bus

Note: 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 the relationship between processor bus access and
of four CPUs is shown. With reference to this example, the CPU scan time is described.
1) When CPU1, CPU2, and CPU3 simultaneously 3) When CPU1 access is complete, the CPU2 with
access CPU0 memory, the first CPU1 with the the secondly highest priority tries to gain access
highest priority has initial access to it. CPU2 and to CPU0 memory. CPU3 must wait further.
CPU3 are kept waiting. 4) When CPU2 access is complete, CPU3 starts
2) The scan times for CPU2 and CPU3 are delayed gaining access to memory. (Note)
by the CPU1 access time.

CPU0
Memory indicates the processor bus access time.
Access START (1) Access
completion indicates the waiting time when any other CPU is accessing the
processor bus memory.
CPU1

Scan time
Access START (3)
Access WAIT (1)

CPU2

t
(2)

Note: If CPU1 attempts access


Scan time before CPU3 access to
CPU0 is complete, CPU3
Access START (4) must wait further, resulting
Access WAIT (1) in scan time deferred for
a longer time.

CPU3

t
(2)

(3)

Scan time

App.5-2
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.

App.5-3
Appendix 6 List of Reserved Words
Appendix 6 List of Reserved Words

Reserved words cannot be used for variable and data function names and function block names.
names. These reserved words include the following, such as

Upper case Lower case Upper case Lower case


Symbol ) ELEMENTARY elementary
ELSE else
ABS abs
ELSEIF elseif
ABS( abs( EN en
ACOS acos END_CASE end_case
ACOS( acos( END_FOR end_for
ADD add END_IF end_if
ADD( add( END_PROGRAM end_program
AND and END_REPEAT end_repeat
AND( and( END_STRUCT end_struct
ANDN andn END_TYPE end_type
E
ANDN( andn( END_VAR end_var
A END_WHILE end_while
ANY any
ANY_BIT any_bit ENO eno
ENUM enum
ANY_DATE any_date
EQ eq
ANY_INT any_int
EQ( eq(
ANY_NUM any_num EXIT exit
ANY_REAL any_real EXP exp
ARRAY array EXP( exp(
ASIN asin EXPT expt
AT at EXPT( expt(
ATAN atan
FALSE false
BOOL bool FIND find
BOOL# bool# FIND( find(
F
BOOL8 bool8 FOR for
B FUNCTION function
BY by
BYTE byte FUNCTION_BLOCK function_block
BYTE# byte# GE ge
GE( ge(
CAL cal G
GT gt
CALC calc GT( gt(
CALCN calcn
CASE case IF if
CONCAT concat INSERT insert
C CONCAT( concat( I INSERT( insert(
INT int
CONFIGURATION configuration
INT# int#
CONSTANT constant
COS cos JMP jmp
COS( cos( J JMPC jmpc
CSV csv JMPCN jmpcn
DATE date LD ld
DATE# date# LDN ldn
DATE_AND_TIME date_and_time LE le
LE( le(
DATE_AND_TIME# date_and_time#
LEFT left
DELETE delete LEFT( left(
DELETE( delete( LEN len
DEVICE device LEN( len(
DINT dint LIMIT limit
DINT# dint# LIMIT( limit(
D
DIV div LINT lint
L
DIV( div( LINT# lint#
DIV_T_AN div_t_an LN ln
DIV_T_AN div_t_an LN( ln(
DO do LOG log
DT dt LOG( log(
DT# dt# LREAL lreal
LREAL# lreal#
DWORD dword
LT lt
DWORD# dword# LT( lt(
LWORD lword
LWORD# lword#

App.6-1
List of Reserved Words

Upper case Lower case Upper case Lower case


MAX max S s
MAX( max( SEL sel
MID mid SEL( sel(
MID( mid( SHL shl
MIN min SHL( shl(
MIN( min( SHR shr
MOD mod SHR( shr(
MOD( mod( SIN sin
M
MOVE move SIN( sin(
MOVE( move( SINT sint
MUL mul SINT# sint#
MUL( mul( S SQRT sqrt
MUL_T_AN mul_t_an SQRT( sqrt(
MUL_T_AN( mul_t_an( ST st
MUX mux STN stn
MUX( mux( STRING string
NE ne STRING# string#
NE( ne( STRING_HANDLE string_handle
N STRUCT struct
NOT not
NOT( not( SUB sub
SUB( sub(
OF of SUB_T_T sub_t_t
OR or SUB_T_T( sub_t_t(
O OR( or(
ORN orn T# t#
ORN( orn( TABLE table
TASK task
PDD pdd THEN then
P
PROGRAM program TIME time
R r TIME# time#
REAL real TIME_OF_DAY time_of_day
T
REAL# real# TIME_OF_DAY# time_of_day#
REPEAT repeat TO to
REPLACE replace TOD tod
REPLACE( replace( TOD# tod#
RESOURSE resourse TRUE true
RET ret TYPE type
RETAIN retain
R
RETC retc
RETCN retcn
RETURN return
RIGHT right
RIGHT( right(
ROL rol
ROL( rol(
ROR ror
ROR( ror(

App.6-2
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
ED & C · Drive Systems Company
Gate City Ohsaki, East Tower, 11-2, Osaki 1-chome, Shinagawa-ku, Tokyo, 141-0032, Japan
Phone: +81-3-5435-7135 ~ 8
Fax: +81-3-5435-7456 ~ 9
URL http://www.fujielectric.co.jp/kiki/

Information in this manual is subject to change without notice.

You might also like