Professional Documents
Culture Documents
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.
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
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.
Preface
Safety Precautions
Revision
Contents
Page
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
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-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
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
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
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
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
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
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
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
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
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
(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
I/O I/O
CPU0 CPU1
%IX1.0.0 %IX1.0.0
%IW1.0 %IW1.0
CPU number
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
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
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
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).
(SPS)
%MW3.0
Retain memory
(M),
32K words
%MW3.32767
%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
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
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
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.
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
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
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
NP1PH-16:
4608 words
(default)
NP1PH-08:
2304 words
(default)
NP1PH-16:
2560 words
(default)
NP1PH-08:
768 words
(default)
1-18
System memory 1-2 Memory
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
1-21
1-2 Memory System memory
%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
%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
%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
1-24
System memory 1-2 Memory
%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.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
1-26
System memory 1-2 Memory
Note: The system definition error factor includes errors that do not occur during normal operation.
1-27
1-2 Memory System memory
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
(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
1-30
System memory 1-2 Memory
%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
%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
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
1-32
System memory 1-2 Memory
Word Address
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit Address
1-33
1-2 Memory System memory
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
1-34
System memory 1-2 Memory
%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
%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
%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
%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
%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
%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
%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
(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
(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
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
INT#100
1-43
1-2 Memory Temporary
Key-point:
Takt Takt
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
pou3
execution
Task 0
pou2 pou2
Interrupt
execution execution
Task 1
Nesting FCT3
Nesting FCT2
FCT1
Time
Usage of a 1K 2K 3K 2K 1K
temporary area words words words words words
1-45
1-3 Input/output Address Assignment Address assignment
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
Period Period
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-47
1-4 Variables Variables
Key-point:
1-48
Memory assignment 1-4 Variables
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
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.
Global variable
1-49
1-4 Variables Variables
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
Comment
Variable
name Data type Refer to "1-5" for data types.
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
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
1-51
1-4 Variables Variables
Key-point:
1-52
Organization of data types 1-5 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
1-53
1-5 Data Types Basic data types
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
1-55
1-5 Data Types Basic data types
<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.
1-56
Derived data types 1-5 Data Types
1-57
1-5 Data Types Derived data types
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
<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.
<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
<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
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.
Note: When SPS is used, the task of level 3 is given the same priority as default 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
<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
;;
;; : 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
<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
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
Arithmetic
Arithmetic operation
Task start operation start ends Task ends
;;;;;;;; ;;;;;;;;
Task ;;;;;;;; P23 P7 P66 P157 P34 ;;;;;;;;
;;;;;;;; ;;;;;;;;
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
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
User function
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,
User function
User function
User function
1-66
POU 1-7 Program Organization Units (POUs)
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.
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)
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.
2) Left-click the [Calendar/Watch...] Button, and the current value will be displayed.
Set 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
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.
Power
supply
CPU CPU
0 1
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
DC24V check
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)
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
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.
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>
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.
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-3
2-2 IL Language IL language
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
<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
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
<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
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
<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
OUTPUT 1 2 3 4
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
<Programming example>
Store not
Stores the inverted boolean value of the current operation result
(before the STN instruction) in “OUTPUT.”
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>
(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
OUTPUT FALSE
2-8
IL language 2-2 IL Language
<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
Operation result 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1
<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
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
LD INPUT
ANDN ANDN MASK
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
<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
ANDN( LD INPUT1
ANDN( INPUT2
AND INPUT3
)
Function
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
<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
Operation result 1 0 1 0 1 1 0 0 1 1 0 0 1 0 0 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
LD INPUT1
ORN
ORN INPUT2
<Operation>
Function
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
<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
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
<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
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
<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
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
<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
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
<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
(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
<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
(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.
<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.
2-16
IL language 2-2 IL Language
MUL
MUL MDATA
(1) Operates the multiplication of the current
Function
<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.
2-17
2-2 IL Language IL language
<Programming example>
Division Operates the division of the current operation result by the “DDATA”
data, and sets the result to the operation result.
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
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 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).
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
<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(
2-20
IL language 2-2 IL Language
(31) Comparison EQ
Name, Symbol, Function Example
Name Symbol
2-21
2-2 IL Language IL language
(33) Comparison NE
Name, Symbol, Function Example
Name
operation result.
NE
NE NDATA
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).
<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).
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
<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).
2-23
2-2 IL Language IL language
(37) Comparison LT
Name, Symbol, Function Example
Name Symbol Function
<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(
2-24
IL language
<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
Processing 1
JMP END
ERROR_1: Processing 2
END:
<Programming example>
TRUE conditional jump
Jumps from “JMPC ERROR” to the instruction that is labeled
“ERROR” if either “INPUT1” or “INPUT2” is TRUE.
Symbol
ERROR:
LD FLAG
ST STATE
2-25
2-2 IL Language IL language
LD INPUT1
JMPCN
AND INPUT2
FALSE
JMPCN ERROR
ST OUTPUT
ERROR:
Function
<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
2-26
IL language 2-2 IL Language
<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
<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
2-27
2-2 IL Language IL language
LD OUT1
Function
<Programming example>
TRUE conditional return
LD INPUT1
AND PSWICH
RETC ST IN2 User-supplied function block
LD OUT1
Function
RET
2-28
IL language 2-2 IL Language
<Programming example>
FALSE conditional return
LD INPUT1
AND PSWICH
RETCN User-supplied function block
ST IN2
LD OUT1
Function
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.
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.
<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
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
(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
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
2-32
ST language 2-3 ST Language
<Statement construction>
CASE statement
CASE <conditional expression> OF
<selection value 1>: <executable statement 1>;
Symbol
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
<Statement construction>
FOR statement
FOR <a:=initial value> TO <final value> BY <incremental value> DO
Symbol
<executable statement>
END FOR;
FOR
FOR a:=1 TO 10 BY 2 DO
f [a]:=b;
END FOR;
2-34
ST language 2-3 ST Language
<Statement construction>
WHILE statement
WHILE <loop condition> DO
Symbol
<executable statement>;
END_WHILE;
WHILE
Loop False
conditional
expression
Function
<Statement construction>
REPEAT statement
REPEAT
<executable statement>;
UNTIL <final condition>
REPEAT END_REPEAT;
Function
2-35
2-3 ST Language ST language
<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
<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.
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>
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
Coil 1 P2-38
S Set 1 P2-39
R Reset 1 P2-39
2-37
2-4 LD Language LD language
<Programming example>
NO contact, NC contact, coil
Variable representation example
SW4
(1) These symbols denote NO contacts, NC
Function
<Programming example>
Inverted coil
Equivalent
Function
SW2
SW3
SW4
SW5
2-38
LD language 2-4 LD Language
<Programming examples>
Set coil, reset coil
• Reset-prioritized circuit
Timing chart
SW1
SW1 LAMP1
S R S
SW2
SW2 LAMP1
R
LAMP1
Function
(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.
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
2-39
2-4 LD Language LD language
(5) Jump
<Programming example>
Jump
001
010
Condition 1
Jump destination label : Processing 1
(jump destination)
<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
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
SEL_INT
BOOL G INT
INT IN0 Select SEL_INT 8 2-
INT IN1
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
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) 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.
LD IN1
ADD
IN1 OUT ADD IN2
IN2 ADD IN3
IN3 ADD IN4
IN4 ADD IN5
IN5 ST OUT
2-43
2-5 FBD Language
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
2-44
2-5 FBD Language
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
LDE START
ADD ADD
START EN ENO FLAG LD INPUT1 START EN ENO FLAG
Note: To upload functions in D300win V2, connect both of the EN/ENO terminals.
2-45
2-5 FBD Language
MOVE MOVE
B EN ENO EN ENO
C
S3 S4
MOVE
When B is set to "OFF," unchanged.
EN ENO
S5
MOVE MOVE
B EN ENO EN ENO
S3 S4
MOVE
When B is set to "OFF," unchanged.
EN ENO
S5
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
2-47
2-5 FBD Language Type conversion FCT
2-48
Type conversion FCT 2-5 FBD Language
2-49
2-5 FBD Language Type conversion FCT
2-50
2-5 FBD Language
2-51
2-5 FBD Language Arithmetic FCT
2) Arithmetic functions
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
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
2-53
2-5 FBD Language Bit string FCT
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
XOR
ANY_BIT ANY_BIT
ANY_BIT
No. of input
Exclusive XOR P2-123
operands +1
ANY_BIT
2-55
2-5 FBD Language Selection/comparison FCT
4) Selection/comparison functions
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
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
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
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)
2-59
2-5 FBD Language String FCT
5) String functions
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
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
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
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.
2-63
2-5 FBD Language Original FCT
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
2-64
Original FCT 2-5 FBD Language
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
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
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
2-66
FB 2-5 FBD Language
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).
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-68
IEC standard FB 2-5 FBD Language
BOOL RESET
RS_1
RS
BOOL SET Q1 BOOL Reset set flip-flop RS 8 P2-167
BOOL RESET
RESET1
R_TRIG_1
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
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
2-70
Original FB 2-5 FBD Language
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
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
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
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
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
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
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
2-76
Only for SPS FB 2-5 FBD Language
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
<Operation>
DINT_TO_INT • When the operation result falls within the valid value range of the INT type
• When the operation result exceeds the valid value range of the INT type
DINT Convert INT
40000 32767
Function
<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
2-78
Type conversion FCT 2-5 FBD Language
<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
<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
[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
<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
<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
2-80
Type conversion FCT 2-5 FBD Language
<Operation>
INT_TO_DINT INT DINT
Convert
32767 32767
EN=1 ENO=1
[Reference information]
Function
<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
2-81
2-5 FBD Language Type conversion FCT
<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
<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
2-82
Type conversion FCT 2-5 FBD Language
<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
<Operation>
DWORD_TO_DINT DWORD DINT
Convert
16#7FFFFFFF 2147483647
EN=1 ENO=1
[Reference information]
Function
2-83
2-5 FBD Language Type conversion FCT
<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
<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
2-84
Type conversion FCT 2-5 FBD Language
<Operation>
UDINT_TO_UINT • When the operation result falls within the valid value range of the UINT type
• When the operation result exceeds the valid value range of the UINT type
<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
2-85
2-5 FBD Language Type conversion FCT
<Operation>
TIME_TO_UINT • When the operation result falls within the valid value range of the UINT type
• When the operation result exceeds the valid value range of the UINT type
<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
2-86
Type conversion FCT 2-5 FBD Language
<Operation>
INT_TO_UDINT • When the operation result falls within the valid value range of the UDINT type
• When the operation result exceeds the valid value range of the UDINT type
<Operation>
DINT_TO_UDINT • When the operation result falls within the valid value range of the UDINT type
• When the operation result exceeds the valid value range of the UDINT type
2-87
2-5 FBD Language Type conversion FCT
<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
<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
2-88
Type conversion FCT 2-5 FBD Language
<Operation>
TIME_TO_UDINT TIME UDINT
Convert
5h20m15s 19215000
EN=1 ENO=1
[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
<Operation>
DWORD_TO_UDINT DWORD UDINT
Convert
16#7FFFFFFF 2147483647
EN=1 ENO=1
2-89
2-5 FBD Language Type conversion FCT
(25) Type conversion DT_TO_UDINT ( These functions are not supported in SPS.)
<Operation>
DT_TO_UDINT DT UDINT
Convert
1998-04-01-08:30:15 891419415
EN=1 ENO=1
DT DT_TO_UDINT UDINT
Function
(26) Type conversion DATE_TO_UDINT ( These functions are not supported in SPS.)
<Operation>
DATE_TO_UDINT DATE UDINT
Convert
1998-04-01 891388800
EN=1 ENO=1
2-90
Type conversion FCT 2-5 FBD Language
(27) Type conversion TOD_TO_UDINT ( These functions are not supported in SPS.)
<Operation>
TOD_TO_UDINT TOD UDINT
Convert
08:30:15 30615
EN=1 ENO=1
<Operation>
INT_TO_REAL INT REAL
Convert
32767 3.2767E+04
EN=1 ENO=1
[Reference information]
Function
2-91
2-5 FBD Language Type conversion FCT
<Operation>
DINT_TO_REAL DINT REAL
Convert
2147483647 2.1474836E+09
EN=1 ENO=1
[Reference information]
Function
<Operation>
UINT_TO_REAL UINT REAL
Convert
65535 6.5535E+04
EN=1 ENO=1
[Reference information]
Function
2-92
Type conversion FCT 2-5 FBD Language
<Operation>
UDINT_TO_REAL UDINT REAL
Convert
4294967295 4.2949673E+09
EN=1 ENO=1
[Reference information]
Function
<Operation>
TIME_TO_REAL TIME Convert REAL
5h20m15s 1.92150E+07
EN=1 ENO=1
2-93
2-5 FBD Language Type conversion FCT
<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
<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
2-94
Type conversion FCT 2-5 FBD Language
<Operation>
BOOL_TO_WORD • When BOOL data is “1”
BOOL 1
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
<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
2-95
2-5 FBD Language Type conversion FCT
<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
<Operation>
UINT_TO_WORD
UINT Convert WORD
1234 16#04D2
EN=1 ENO=1
2-96
Type conversion FCT 2-5 FBD Language
<Operation>
BOOL_TO_DWORD • When BOOL data is “1”
BOOL 1
EN=1 Convert
<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
2-97
2-5 FBD Language Type conversion FCT
<Operation>
DINT_TO_DWORD DINT Convert DWORD
2147483647 16#7FFFFFFF
Symbol
EN=1 ENO=1
<Operation>
UDINT_TO_DWORD UDINT Convert DWORD
4294967295 16#FFFFFFFF
EN=1 ENO=1
2-98
Type conversion FCT 2-5 FBD Language
<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
<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
2-99
2-5 FBD Language Type conversion FCT
<Operation>
UINT_TO_TIME UINT Convert TIME
65535 1m5s535ms
Symbol
EN=1 ENO=1
[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)
<Operation>
UDINT_TO_TIME
UDINT Convert TIME
4294967295 49d17h2m47s295ms
EN=1 ENO=1
[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
<Operation>
REAL_TO_TIME • When the operation result falls within the valid value range of the TIME type
(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
2-101
2-5 FBD Language Type conversion FCT
(49) Type conversion UDINT_TO_DATE ( These functions are not supported in SPS.)
<Operation>
UDINT_TO_DATE UDINT DATE
Convert
891419415 1998-04-01
EN=1 ENO=1
(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
2-102
Type conversion FCT 2-5 FBD Language
<Operation>
TRUNC_INT • When the operation result falls within the valid value range of the INT type
• When the operation result exceeds the valid value range of the INT type
<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
2-103
2-5 FBD Language Type conversion FCT
<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
<Operation>
TRUNC_UDINT
• When the operation result falls within the valid value range of the UDINT type
• When the operation result exceeds the valid value range of the UDINT type
2-104
Type conversion FCT 2-5 FBD Language
<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
<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
2-105
2-5 FBD Language Type conversion FCT
<Operation>
W_BCD_TO_DINT • When the input value is BCD code
<Operation>
D_BCD_TO_DINT • When the operation result falls within the valid value range of the DINT type
2-106
Type conversion FCT 2-5 FBD Language
<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
[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
<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
2-107
2-5 FBD Language Type conversion FCT
<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
<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
[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
<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
<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
2-109
2-5 FBD Language Arithmetic functions
<Operation>
ABS_REAL
REAL Compute REAL
-2.000E+1 2.000E+1
EN=1 ENO=1
<Operation>
SQRT
REAL Compute REAL
1.234E+07 3.5128E+03
EN=1 ENO=1
2-110
Arithmetic functions 2-5 FBD Language
<Operation>
LN
REAL Compute REAL
1.234E+03 7.118E+00
EN=1 ENO=1
REAL LN REAL
y
y=lnX
Function
<Operation>
LOG
REAL Compute REAL
1.234E+03 3.091E+00
EN=1 ENO=1
y=log10X
Function
2-111
2-5 FBD Language Arithmetic functions
<Operation>
EXP
REAL Compute REAL
2.0E+00 7.389E+00
EN=1 ENO=1
y=eX
Function
<Operation>
SIN
REAL Compute REAL
3.141E+00 5.926E-04
EN=1 ENO=1
y=sin x
1
Function
2-112
Arithmetic functions 2-5 FBD Language
<Operation>
COS
REAL Compute REAL
1.047E+00 5.001E-01
Symbol
EN=1 ENO=1
y=cos x
1
(1) COS computes the cosine of REAL type
Function
data.
-π π
(2) The input must be given in radians. 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.
<Operation>
TAN
REAL Compute REAL
7.854E-01 1.000E+00
EN=1 ENO=1
y
y=tan x
Function
2-113
2-5 FBD Language Arithmetic functions
<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
<Operation>
ACOS Compute
REAL REAL
7.854E-01 6.675E-01
EN=1 ENO=1
2-114
Arithmetic functions 2-5 FBD Language
<Operation>
ATAN
REAL Compute REAL
7.854E-01 6.6577E-01
EN=1 ENO=1
y=tan -1 x y
Function
<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
2-115
2-5 FBD Language Arithmetic functions
<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
<Operation>
MUL • When the operation result falls within the valid value range of the operands
2-116
Arithmetic functions 2-5 FBD Language
<Operation>
DIV • When the operation result falls within the valid value range of the operands
Symbol
(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.
<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
2-117
2-5 FBD Language Arithmetic functions
<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.
<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
2-118
Arithmetic functions 2-5 FBD Language
<Operation>
NEG
DINT Output DINT
123 -123
EN=1 ENO=1
(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
<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
<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
2-120
Bit string FCT 2-5 FBD Language
<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
<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
2-121
2-5 FBD Language Bit string FCT
<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
<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
2-122
Bit string FCT 2-5 FBD Language
<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
<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
2-123
2-5 FBD Language Bit string FCT
<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
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).
<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
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
<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
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).
<Operation>
NOT
In the case of WORD type data
2-125
2-5 FBD Language Bit string FCT
<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
<Operation>
NOT_WORD
Input WORD EN=1 0 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0
NOT
2-126
Bit string FCT 2-5 FBD Language
<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
2-127
2-5 FBD Language Selection/comparison FCT
<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
2-128
Selection/comparison FCT 2-5 FBD Language
<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
<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
2-129
2-5 FBD Language Selection/comparison FCT
<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
2-130
Selection/comparison FCT 2-5 FBD Language
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
2-131
2-5 FBD Language Selection/comparison FCT
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.
2-132
Selection/comparison FCT 2-5 FBD Language
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
2-133
2-5 FBD Language Selection/comparison FCT
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
2-134
Selection/comparison FCT 2-5 FBD Language
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
2-135
2-5 FBD Language Selection/comparison FCT
<Programming example>
NE
NE
INDATA1 FLAG
INDATA2
NE
elementary BOOL
elementary <Operation>
• When the input is of REAL type
INDATA1 2.0E-10
Function
2-136
Character string FCT 2-5 FBD language
<Operation>
LEN
INT 10 ENO=1
Function
<Operation>
LEFT
STRING ABCDEFGHIJ
UINT 5 EN=1
LEFT
STRING IN STRING
UINT L Extract
2-137
2-5 FBD Language Character string FCT
<Operation>
RIGHT
STRING ABCDEFGHIJ EN=1
UINT 5
RIGHT
STRING IN STRING
UINT L
Extract
MID <Operation>
MID
STRING IN STRING UINT 5 (Second input)
UINT L
UINT P (Third input)
UINT 3
Function
2-138
Character string FCT 2-5 FBD Language
<Operation>
CONCAT EN=1
STRING ABCDEFGHIJ (First input)
<Operation>
INSERT EN=1
STRING ABCDEFGHIJ (First input)
Insert
(1) INSERT inserts the string designated by
Function
2-139
2-5 FBD Language Character string FCT
<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
<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
FIND <Operation>
EN=1
STRING ABXYZHIJ (First input)
FIND
STRING IN1 INT
STRING IN2 STRING XYZ (Second input)
Find
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)
<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
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
<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)
<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
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
<Programming example>
LE_STRING
LE_STRING
STR_1 IN1 FLAG
STR_2 IN2
LE_STRING
STRING IN1 BOOL
STRING IN2
<Operation>
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)
<Programming example>
LT_STRING
LT_STRING
SD1 IN1 FLAG
SD2 IN2
LT_STRING
STRING IN1 BOOL
STRING IN2
<Operation>
SD1 D 8263
Function
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
<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
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
<Operation>
ADD_T_T
• When the operation results falls within the limit value range of the data type
• When the operation result exceeds the limit value range of the data type
TIME TIME
Function
(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
TIME
• When the operation result exceeds the limit value range of the data type
(3) Add time ADD_DT_T ( These functions are not supported in SPS.)
<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
2-145
2-5 FBD Language Time type data FCT
<Operation>
SUB_T_T • When the operation results falls within the limit value range of the data type
• When the operation result exceeds the limit value range of the data type
Function
(5) Subtract time SUB_D_D ( These functions are not supported in SPS.)
<Operation>
SUB_D_D • When the operation results falls within the limit value range of the data type
DATE
• When the operation result exceeds the limit value range of the data type
(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
TIME
• When the operation result exceeds the limit value range of the data type
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
(8) Subtract time SUB_DT_T ( These functions are not supported in SPS.)
<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
(9) Subtract time SUB_DT_DT ( These functions are not supported in SPS.)
<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
2-147
2-5 FBD Language Time type data FCT
<Operation>
MUL_T_N
• When the operation results falls within the limit value range of the data type
[Reference information]
Value range of TIME type (SPH) : 0 to 4,294,967,295 (ms)
(SPS) : 0 to 2,147,483,647 (ms)
<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
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
<Operation>
DIV_T_N • When the operation results falls within the limit value range of the data type
<Operation>
DIV_T_R • When the operation results falls within the limit value range of the data type
REAL
• When the operation result exceeds the limit value range of the data type
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.)
<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
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
(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
2-150
Original FCT 2-5 FBD Language
<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
<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
2-151
2-5 FBD Language Original FCT
<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
<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
2-152
Original FCT 2-5 FBD Language
<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
<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
2-153
2-5 FBD Language Original FCT
<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
<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
<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
2-154
Original FCT 2-5 FBD Language
<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
<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
<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
2-155
2-5 FBD Language Original FCT
<Operation>
STR_TO_UINT STRING ’1234 ’ EN=1
Convert
<Operation>
UINT_TO_STR
UINT 1234 EN=1
Convert
UINT UINT_TO_STR STRING
STRING ’1234’ ENO=1
Function
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
(16) Convert string to shift-JIS STR_TO_SJ ( These functions are not supported in SPS.)
<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
2-157
2-5 FBD Language Original FCT
<Operation>
BYTE_LEN
’ ’
STRING EN=1
Convert
STRING BYTE_LEN INT
INT 12 ENO=1
<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
—3000
(-)
2-158
Original FCT 2-5 FBD Language
<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
1000
-6000 -3000
(-) (+)
3000
-3000
(-)
<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
-3000.0
(-)
2-159
2-5 FBD Language Original FCT
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
-9000
(-)
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
-9000
(-)
2-160
Original FCT 2-5 FBD Language
<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
-9000
(-)
2-161
2-5 FBD Language Original FCT
<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
2-162
Original FCT 2-5 FBD Language
<Programming example>
ADC/ADCO
A sample program for adding 64-bit operands is shown below.
<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
[Reference]
It is recommended, to monitor 64-bit data, that you use the hexadecimal
notation.
2-163
2-5 FBD Language Original FCT
<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
<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
2-165
2-5 FBD Language Original FCT
<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
<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
<Programming example>
SLC/SLCO A sample program for rotating 64-bit data is shown below.
SLC
DWORD IN DWORD
BOOL CYIN
SLC
IN B_U
<32-bit carry> CYIN
SLCO
DWORD BOOL
SLCO
A_L
Function
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
<Programming example>
SRC/SRCO A sample program for rotating 64-bit data is shown below.
SRC
DWORD IN DWORD
BOOL CYIN
SRC
IN B_U
<32-bit carry> CYIN
SRCO
DWORD BOOL
SRCO
A_L
Function
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
SR <Programming example>
SR
INPUT1 SET1 Q1 LAMP
INPUT2 RESET
SR
BOOL SET1 Q1 BOOL
Set preference
INPUT1
Function
SET1 RESET Q
1 * 1
0 1 0
0 0 Previous output
<Programming example>
RS
RS
INPUT1 SET Q1 LAMP
INPUT2 RESET
RESET1
RS
BOOL SET Q1 BOOL
RESET
RESET1
<Operation>
BOOL
INPUT1
INPUT2
Function
RESET1 SET Q
1 * 0
0 1 1
0 0 Previous output
2-169
2-5 FBD Language Standard FB
<Programming example>
R_TRIG
R_TRIG
INPUT1 CLK Q LAMP
R_TRIG
BOOL CLK Q BOOL <Operation>
INPUT1
LAMP
Function
Note: 1) The old value for an input “CLK” has a retain attribute assigned.
This means that at start-up (warm start), the retained old value is used.
At initial start-up (cold start) or download, it is reset to 0 (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.
<Programming example>
F_TRIG
F_TRIG
INPUT1 CLK Q LAMP
F_TRIG
BOOL CLK Q BOOL <Operation>
INPUT1
Function
Note: 1) The old value for an input “CLK” has a retain attribute assigned.
This means that at start-up (warm start), the retained old value is used.
At initial start-up (cold start) or download, it is reset to 0 (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
<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
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.
<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
2-171
2-5 FBD Language Standard FB
<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
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
<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
<Programming example>
TON
TON
INPUT1 IN Q LAMP
TON
BOOL IN Q BOOL
TIME#10s PT ET CURRENT
TIME PT ET TIME
<Operation>
Function
2-173
2-5 FBD Language Standard FB
TOF
INPUT1 IN Q LAMP
TIME#10s PT ET CURRENT
TOF
BOOL IN Q BOOL
TIME PT ET TIME
<Operation>
INPUT1
Function
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.)
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
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
<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
2-175
2-5 FBD Language Original FB
<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
2-176
Original FB 2-5 FBD Language
<Programming example>
MR
MR
INPUT1 IN Q LAMP
TIME#10s PT ET CURRENT
MR
BOOL IN Q BOOL
TIME PT ET TIME
<Operation>
Function
2-177
2-5 FBD Language Original FB
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
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
M_OPEN M_OPEN
2) 4)
UINT#253 MODULE_NO UINT#253 MODULE_NO
M_OPEN M_OPEN
Port Port
CPU1 CPU1
2-179
Original FB 2-5 FBD Language
<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
2-180
Original FB 2-5 FBD Language
<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
2-181
2-5 FBD Language Original FB
(7) Direct read READ_WORD / READ_BOOL ( These functions are not supported in SPS.)
<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
2-182
Original FB 2-5 FBD Language
(8) Direct write WRITE_WORD / W RITE_BOOL ( These functions are not supported in SPS.)
<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
2-183
2-5 FBD Language Original FB
<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
<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
2-185
2-5 FBD Language Original FB
<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
- -
- 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
2-186
Original FB 2-5 FBD Language
2-187
2-5 FBD Language Original FB
<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
2-188
Original FB 2-5 FBD Language
<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
2-189
2-5 FBD Language Original FB
(13) Extension test & set EXT_T_S ( These functions are not supported in SPS.)
<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
2-190
Original FB 2-5 FBD Language
<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)
2-191
2-5 FBD Language Original FB
<Operation>
FIFO
(3) (4) (5) (6)
2-192
Original FB 2-5 FBD Language
FILO
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
2-193
2-5 FBD Language Original FB
<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
2-194
Original FB 2-5 FBD Language
<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
2-195
2-5 FBD Language Original FB
<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
2-196
Original FB 2-5 FBD Language
<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
2-197
2-5 FBD Language Original FB
<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
2-198
Original FB 2-5 FBD Language
<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
2-199
2-5 FBD Language Original FB
<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
<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
2-200
Original FB 2-5 FBD Language
<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
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
2-201
2-5 FBD Language Original FB
<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) 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.)
<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
2-203
2-5 FBD Language Dedicated to SPS
<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.
2-204
Dedicated to SPS 2-5 FBD Language
<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
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
<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
2-206
Dedicated to SPS 2-5 FBD Language
<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
(Operation)
File pointer is moved from the top to 4th.
15 0
First
2-207
2-5 FBD Language Dedicated to SPS
<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
<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
2-208
Dedicated to SPS 2-5 FBD Language
<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
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
2-209
2-5 FBD Language Dedicated to SPS
<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:
2-210
Dedicated to SPS 2-5 FBD Language
<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
2-211
2-5 FBD Language Dedicated to SPS
<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:
2-212
Dedicated to SPS 2-5 FBD Language
<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
VALID
RTC
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
Start
T1 Actions
(describes the process)
STEP1 N ACT01
2-214
SFC 2-6 SFC Elements
Initial step
Initial step
2-215
2-6 SFC Elements SFC
(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
2-216
SFC 2-6 SFC Elements
Termination step
2-217
2-6 SFC Elements SFC
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:
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
S001
T001
ACT1
5s
T004
S005
S001
T001
ACT1
5s
T004
S005
2-220
SFC 2-6 SFC Elements
S001
T001
ACT1
5s
T004
S005
S001
T001
S005
5s
S001
T001
ACT1 5s
S001
T001
ACT1
5s
S001
T001
ACT1 5s
T004
S005
2-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
2-222
SFC 2-6 SFC Elements
Active Active
Inactive Inactive
Inactive
Inactive
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
Inactive
Inactive
Inactive
Inactive
Active
2-224
SFC 2-6 SFC Elements
Inactive Inactive
“1”
Active Active
“1”
Inactive
Inactive
Active
2-225
2-6 SFC Elements SFC
<Variable representation>
Period
Step flag: step name.x (data type: BOOL; “1” when active, “0” when inactive)
Action flag: Action name.x (data type: BOOL; “1” when active, “0” when inactive)
2-226
SFC 2-6 SFC Elements
2-227
2-6 SFC Elements SFC
2) For warm start, if you want to start from the step at which the system was turned off, check [Step/action of SFC is
assumed to be retain variable].
2-228
Section 3 System Definitions
Page
3-1 System Definition Summary ................................................................................... 3-1
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.
3-1
3-2 System Configuration Definitions System configuration
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
16 16 16
Power
points points points
supply input output output
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
<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).
3-3
3-2 System Configuration Definitions System configuration
Enter a name.
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.
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
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.
3-5
3-3 System Properties System properties
3-6
System properties 3-3 System Properties
2) When filling out the required fields, click the “OK” button.
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
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
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.
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
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.
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
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-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.
(Note 2)
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
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
Left-click here.
3-17
3-5 CPU Parameters I/O group
Left-click here.
3-18
I/O group 3-5 CPU Parameters
Left-click here.
3-19
3-5 CPU Parameters Fail-soft
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.
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.”
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
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
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.
3-22
Fail-soft 3-5 CPU Parameters
<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.
3-23
3-6 Input/output Parameters Output hold
<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.
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-3 CPU module LEDs and output to display system ................................................. 4-9
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.
Power CPU Power CPU Power I/O I/O I/O I/O I/O I/O
source 0 source 1 source
SX bus
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
Power CPU Power CPU Power CPU Memory I/O I/O I/O
source 0 source 1 source 2 card
if
SX bus
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
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-3
4-2 Conditions for changeover between operating Multi-CPU relay switch
and waiting CPUs and performance
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
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
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
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
Example of
ordinary system
Takt time Constant periodic time
Constant periodic time
Default task
Default task
System operation
on the operating side Equalization (data copy output) Equalization (data copy output)
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 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
Equalization of suffix
specified variable
2) Variables defined for retain among the user FB (User FB instance memory) variables
User FB instance
memory
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
No. of
Equalized system FB Equalized instance element
words
Old input value 2
Edge detection(R_TRIG, F_TRIG)
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
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
4-8
LED indication 4-3 CPU module LEDs and output to display system
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 — — — — — —
4-9
4-4 Application of the duplex system Duplex system
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-10
Appendix 1 Instruction Proces Speed Chart
Page
1-1 High-performance CPU Instruction Processing Speed Chart ..................... App.1-1
App.1-1
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart
App.1-2
High-performance 1-1 High-performance CPU Instruction
Processing Speed Chart
App.1-3
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart
App.1-4
High-performance 1-1 High-performance CPU Instruction
Processing Speed Chart
App.1-5
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart
App.1-6
High-performance 1-1 High-performance CPU Instruction
Processing Speed Chart
App.1-7
1-1 High-performance CPU Instruction High-performance
Processing Speed Chart
App.1-8
Standard 1-2 Standard CPU Instruction Processing Speed Chart
App.1-9
1-1 Standard CPU Instruction Processing Speed Chart Standard
App.1-10
Standard 1-1 Standard CPU Instruction Processing Speed Chart
App.1-11
1-1 Standard CPU Instruction Processing Speed Chart Standard
App.1-12
Standard 1-1 Standard CPU Instruction Processing Speed Chart
App.1-13
1-1 Standard CPU Instruction Processing Speed Chart Standard
App.1-14
Standard 1-1 Standard CPU Instruction Processing Speed Chart
App.1-15
1-1 Standard CPU Instruction Processing Speed Chart Standard
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.
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)
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]
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.
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
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.
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.
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
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
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
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.
Example 1)
Example 2)
(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.
CPU0 CPU1
%MW0.1.2048 %MW1.1.2048
60ns
%MW0.1.2048 %MW1.1.2048.0
3µs
Processor bus
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.
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)
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
App.6-1
List of Reserved Words
App.6-2
List of Reserved Words
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/