AH500 Programming Manual(curve) Delta_AH500Program_O_EN_20121109 Delta AH500Program O EN 20121109

User Manual: Delta_AH500Program_O_EN_20121109

Open the PDF directly: View PDF PDF.
Page Count: 748

DownloadAH500-Programming-Manual(curve) Delta_AH500Program_O_EN_20121109 Delta AH500Program O EN 20121109
Open PDF In BrowserView PDF
Chapter 1

Introduction

Table of Contents
1.1
Overview ...................................................................................................1-2
1.1.1
Related Manuals ................................................................................1-2
1.1.2
Model Description...............................................................................1-2
1.2
Software ....................................................................................................1-7
1.2.1
Program Editor ...................................................................................1-7
1.2.2
Program Organization Units and Tasks..............................................1-8

1-1

A H 5 00 Prog r am m ing M an ua l

1.1 Overview
This manual introduces the programming of the AH500 series programmable logic controllers, the
basic instructions, and the applied instructions.

1.1.1

Related Manuals

The related manuals of the AH500 series programmable logic controllers are composed of the
following.
 AH500 Quick Start
It guides users to use the system before they read the related manuals.
 AH500 Programming Manual
It introduces the programming of the AH500 series programmable logic controllers, the basic
instructions, and the applied instructions.
 ISPSoft User Manual
It introduces the use of ISPSoft, the programming languages (ladder diagrams, instruction lists,
sequential function charts, function block diagrams, and structured texts), the concept of POUs,
and the concept of tasks.
 AH500 Hardware Manual
It introduces electrical specifications, appearances, dimensions, and etc.
 AH500 Operation Manual
It introduces functions of CPUs, devices, module tables, troubleshooting, and etc.
 AH500 Module Manual
It introduces the use of special I/O modules. For example, network modules, analog I/O
modules, temperature measurement modules, and etc.
 AH500 Motion Control Module Manual
It introduces the specifications for the motion control modules, the wiring, the instructions, and
the functions.
 PMSoft User Manual
It introduces the use of PMSoft, including the editing mode, the connection, and the password
setting.

1.1.2

Model Description

Classification
Power supply
module

Model Name
AHPS05-5A
AHCPU500-RS2

AHCPU500-EN

CPU module

AHCPU510-RS2

AHCPU510-EN

AHCPU520-RS2

1-2

Description
100~240 V AC
50/60 Hz
It is a basic CPU module with two built-in RS-485 ports, one
built-in USB port, and one built-in SD interface. It supports
768 inputs/outputs. The program capacity is 16 ksteps.
It is a basic CPU module with one built-in Ethernet port, one
built-in RS-485 port, one built-in USB port, and one built-in
SD interface. It supports 768 inputs/outputs. The program
capacity is 16 ksteps.
It is a basic CPU module with two built-in RS-485 ports, one
built-in USB port, and one built-in SD interface. It supports
1280 inputs/outputs. The program capacity is 64 ksteps.
It is a basic CPU module with one built-in Ethernet port, one
built-in RS-485 port, one built-in USB port, and one built-in
SD interface. It supports 1280 inputs/outputs. The program
capacity is 64 ksteps.
It is a basic CPU module with two built-in RS-485 ports, one
built-in USB port, and one built-in SD interface. It supports
2304 inputs/outputs. The program capacity is 128 ksteps.

Ch ap te r 1 In tro duc tio n

Classification

Model Name

AHBP04M1-5A

It is a basic CPU module with one built-in Ethernet port, one
built-in RS-485 port, one built-in USB port, and one built-in
SD interface. It supports 2304 inputs/outputs. The program
capacity is 128 ksteps.
It is a basic CPU module with two built-in RS-485 ports, one
built-in USB port, and one built-in SD interface. It supports
4352 inputs/outputs. The program capacity is 256 ksteps.
It is a basic CPU module with one built-in Ethernet port, one
built-in RS-485 port, one built-in USB port, and one built-in
SD interface. It supports 4352 inputs/outputs. The program
capacity is 256 ksteps.
Four-slot main backplane for a CPU /RTU rack

AHBP06M1-5A

Six-slot main backplane for a CPU/RTU rack

AHBP08M1-5A

Eight-slot main backplane for a CPU/RTU rack

AHBP12M1-5A

Twelve-slot main backplane for a CPU/RTU rack

AHBP06E1-5A

Six-slot extension backplane for a CPU/RTU extension rack
Eight-slot extension backplane for a CPU/RTU extension
rack
24 V DC
5 mA
16 inputs
Terminal block
24 V DC
5 mA
32 inputs
DB37 connector
24 V DC
3.2 mA
64 inputs
Latch connector
100~240 V AC
4.5 mA/9 mA (100 V and 50 Hz)
16 inputs
Terminal block
240 V AC/24 V DC
2A
16 outputs
Relay
Terminal block
12~24 V DC
0.5 A
16 outputs
Sinking output
Terminal block
12~24 V DC
0.5 A
16 outputs
Sourcing output
Terminal block

AHCPU520-EN

CPU module

AHCPU530-RS2

AHCPU530-EN

Main
backplane

Extension
backplane

AHBP08E1-5A

AH16AM10N-5A

AH32AM10N-5B

AH64AM10N-5C

Digital
input/output
module

Description

AH16AM30N-5A

AH16AN01R-5A

AH16AN01T-5A

AH16AN01P-5A

1-3

A H 5 00 Prog r am m ing M an ua l

Classification

Model Name

AH32AN02P-5B

AH32AN02T-5B

AH64AN02T-5C

AH64AN02P-5C

AH16AN01S-5A
Digital
input/output
module

AH16AP11R-5A

AH16AP11P-5A

AH16AP11T-5A

1-4

Description
12~24 V DC
0.1 A
32 outputs
Sinking output
DB37 connector
12~24 V DC
0.1 A
32 outputs
Sourcing output
DB37 connector
12~24 V DC
0.1 A
64 outputs
Sinking output
Latch connector
12~24 V DC
0.1 A
64 outputs
Sourcing output
Latch connector
110/220 V AC
0.5 A
16 outputs
TRIAC
Terminal block
24 V DC
5 mA
8 inputs
240 V AC/24 V DC
2A
8 outputs
Relay
Terminal block
24 V DC
5 mA
8 inputs
12~24 V DC
0.5 A
8 outputs
Sinking output
Terminal block
24 V DC
5 mA
8 inputs
12~24 V DC
0.5 A
8 outputs
Sourcing output
Terminal block

Ch ap te r 1 In tro duc tio n

Classification

Model Name

AH04AD-5A

AH08AD-5B

AH04DA-5A
Analog
input/output
module
AH08DA-5B

AH06XA-5A

AH04PT-5A

Temperature
measurement
module

AH04TC-5A

AH08TC-5A

AH02HC-5A
AH04HC-5A
Motion control
module

AH05PM-5A
AH10PM-5A
AH20MC-5A

Description
Four-channel analog input module
16-bit resolution
0~10 V, 0/1~5 V, -5~+5 V, -10~+10 V, 0/4~20 mA, and
-20~+20 mA
Conversion time: 150 us/channel
Eight-channel analog input module
16-bit resolution
0~10 V, 0/1~5 V, -5~+5 V, and -10~+10 V
Conversion time: 150 us/channel
Four-channel analog output module
16-bit resolution
-10~10 V, and 0/4~20 mA
Conversion time: 150 us/channel
Eight-channel analog output module
16-bit resolution
-10~+10V, 0~10V, -5~+5V, and 0/1~5V
Conversion time: 150 us/channel
Four-channel analog input module
16-bit resolution
0~10 V, 0/1~5 V, -5~+5 V, -10~+10 V, 0/4~20 mA, and
-20~+20 mA
Conversion time: 150 us/channel
Two-channel analog output module
16-bit resolution
-10~10 V, and 0/4~20 mA
Conversion time: 150 us/channel
Four-channel four-wire/three-wire RTD temperature sensor
Sensor type: Pt100/Pt1000/Ni100/Ni1000 sensor, and
0~300 Ω input impedance
16-bit resolution: 0.1 ℃/0.1 ℉
Four-wire conversion time: 150 ms/channel
Three-wire conversion time: 300 ms/channel
Four-channel thermocouple temperature sensor
Sensor type: J, K, R, S, T, E, N, and -150~+150 mV
24-bit resolution: 0.1 ℃/0.1 ℉
Conversion time: 200 ms/channel
Eight-channel thermocouple temperature sensor
Sensor type: J, K, R, S, T, E, N, and -150~+150 mV
24-bit resolution: 0.1 ℃/0.1 ℉
Conversion time: 200 ms/channel
Two-channel high-speed counter module
200 kHz
Four-channel high-speed counter module
200 kHz
Two-axis pulse train motion control module (1 MHz)
Six-axis pulse train motion control module
(Four axes: 1 MHz; Two axes: 200 kHz)
Twelve-axis DMCNET (Delta Motion Control Network)
motion control module (10 Mbps)

1-5

A H 5 00 Prog r am m ing M an ua l

Classification

Model Name

DVPAETB-IO24C

It is an Ethernet master module with two built-in Ethernet
ports, and supports a Modbus TCP master.
It is a serial communication module with two
RS-485/RS-422 ports, and supports Modbus and the UD
link protocol.
There is isolation between two parts of communication, and
there is isolation between two parts of power.
It is a DeviceNet network module. It can function as a
master or a slave. The maximum communication speed is 1
Mbps.
RTU module for DeviceNet
0.6 meter extension cable for connecting an extension
backplane
1.0 meter extension cable for connecting an extension
backplane
1.5 meter extension cable for connecting an extension
backplane
3.0 meter extension cable for connecting an extension
backplane
1.0 meter I/O extension cable (latch connector) for
AH64AM10N-5C
1.0 meter I/O extension cable (latch connector) for
AH64AN02T-5C and AH64AN02P-5C
1.0 meter I/O extension cable (DB37)
1.0 meter I/O extension cable for AH04HC-5A and
AH20MC-5A
1.0 meter I/O extension cable (latch connector) for
AH10PM-5A
I/O external terminal module for AH64AM10N-5C
32 inputs
I/O external terminal module for AH64AN02T-5C
16 relay outputs
I/O external terminal module for AH64AN02P-5C
16 relay outputs
I/O external terminal module for AH32AM10N-5B
32 inputs
I/O external terminal module for AH32AN02T-5B
32 relay outputs
I/O external terminal module for AH32AN02P-5B
32 relay outputs
I/O external terminal module for AH32AN02T-5B and
AH32AN02P-5B
32 relay outputs
I/O external terminal module for AH04HC-5A and
AH20MC-5A
I/O external terminal module for AH10PM-5A

AHASP01-5A

Space module used for an empty I/O slot

AH10EN-5A

Network
module

AH10SCM-5A

AH10DNET-5A
RTU module

AHRTU-DNET-5A
AHACAB06-5A

Extension
cable

AHACAB10-5A
AHACAB15-5A
AHACAB30-5A
DVPACAB7A10
DVPACAB7B10

I/O extension
cable

DVPACAB7C10
DVPACAB7D10
DVPACAB7E10
DVPAETB-ID32A
DVPAETB-OR16A
DVPAETB-OR16B
DVPAETB-ID32B

External
terminal
module

DVPAETB-OR32A
DVPAETB-OR32B
DVPAETB-OT32B
DVPAETB-IO16C

Space module

1-6

Description

Ch ap te r 1 In tro duc tio n

1.2 Software
1.2.1

Program Editor

The outline of program editor ISPSoft:



There are five types of programming languages, including the instruction list, the structure text,
the ladder diagram, the sequential function chart, and the function block diagram.



The use of variables which allows the user to define the variable symbol to replace the device
name of the PLC not only enhances the readability of the program, but also saves the user a lot
of time to allocate the address of the device.

1-7

A H 5 00 Prog r am m ing M an ua l


The introduction of the POU (Program Organization Unit) framework not only divides the main
program into several program units, but also replaces the traditional subroutines with functions
and function blocks. The framework of the program becomes more modular, and is easier to be
managed.



The concept of tasks which is used to manage the execution order of the programs advances
the program development to the level of project management. The large-scale program
development becomes easier to be managed.

1.2.2

Program Organization Units and Tasks

The POUs (Program Organization Units) are the basic elements which constitute the PLC program.
Differing from the traditional PLC program, the character of the program framework introduced by

1-8

Ch ap te r 1 In tro duc tio n
IEC 61131-3 lies in the fact that the large program is divided into several small units. These small
units are called POUs. The POUs can be classified into three types.
1.
Program (PROG): The POU of the program type plays the role of the primary program in the
PLC program. The designer can define the execution of the POU of the program type as the
cyclic scan or the interrupt, and arrange the scan order in the task list for the POUs of the
program type.
2.
Function block (FB): The meaning of the function block (FB) in itself is similar to the subroutine.
The program defined within the function block is executed after the function block is called by
the POU of the program type and the related parameters are entered.
3.
Function (FC): The meaning of the function (FC) in itself is close to the macro instruction. That
is, users can write many operation instructions or functions into the function POU, and then
call them into use in the POU of the program type or the function block.
The task is a function which stipulates that programs are executed in certain order or according to
certain interrupt condition. The meaning of the task lies in the fact that it provides each POU of the
program type with a specific execution task, and specifies the execution order for the POUs of the
program type or the way to enable them.
Basically, not all of the POUs of the program type in a project will take part in the practical execution.
Whether to execute the POU of the program type or not, and how to execute it depend on the
assignment of the task. If the POU of the program type is not assigned the task, it will be saved as
an ordinary source code with the project instead of being compiled as an execution code of the PLC.
In addition, only the POU of the program type needs to be assigned the task. The execution of the
function blocks or functions depends on the superior POU of the program type which calls them.
There are three types of tasks.
1.
Cyclic task: The POUs of the program type assigned to the cyclic task will be scanned
cyclically, and executed in order.
2.
Timed interrupt task: If the time of interrupting is reached, all POUs of the program type
assigned to the timed interrupt task will be executed in order.
3.
Conditional interrupt task: Conditional Interrupts can be divided into several types. For
example, the external interrupts, the I/O interrupts, and etc. Users have to make sure of the
interrupts supported by the PLC before they create a project. If the POU of the program type is
assigned to the conditional interrupt task, the function of the POU of the program type is similar
to the interrupt subroutine. If the interrupt condition is satisfied, e.g. the contact of the external
interrupt is triggered, all POUs of the program type assigned to the task will be executed in
order.

1-9

A H 5 00 Prog r am m ing M an ua l
MEMO

1-10

Chapter 2

Devices

Table of Contents
2.1
Introduction of Devices ..............................................................................2-2
2.1.1
Devise List..........................................................................................2-2
2.1.2
Basic Structure of I/O Storages ..........................................................2-3
2.1.3
Relation between the PLC Action and the Device Type .....................2-3
2.1.4
Latched Areas in the Device Range ...................................................2-3
2.2
Functions of Devices .................................................................................2-4
2.2.1
Values and Constants ........................................................................2-4
2.2.2
Floating-point Numbers ......................................................................2-6
2.2.2.1
Single-precision Floating-point Numbers ....................................2-6
2.2.2.2
Double-precision Floating-point Numbers ...................................2-6
2.2.2.3
Decimal Floating-point Numbers .................................................2-7
2.2.3
Strings ................................................................................................2-8
2.2.4
Input Relays .......................................................................................2-9
2.2.5
Output Relays ....................................................................................2-9
2.2.6
Auxiliary Relays..................................................................................2-9
2.2.7
Special Auxiliary Relays ...................................................................2-10
2.2.8
Refresh Time of Special Auxiliary Relays.........................................2-34
2.2.9
Stepping Relays ...............................................................................2-44
2.2.10 Timers ..............................................................................................2-44
2.2.11 Counters...........................................................................................2-46
2.2.12 32-bit Counters.................................................................................2-47
2.2.13 Data Registers .................................................................................2-49
2.2.14 Special Data Registers.....................................................................2-49
2.2.15 Refresh Time of Special Data Registers ..........................................2-73
2.2.16 Additional Remarks on Special Auxiliary Relays and Special Data
Registers ..........................................................................................2-75
2.2.17 Link Registers ..................................................................................2-88
2.2.18 Index Registers ................................................................................2-88

AH Pro gramming Ma nu al

2.1 Introduction of Devices
This section gives an account of values/strings processed by the PLC. It also describes the
functions of devices which include input/output/auxiliary relays, timers, counters, and data registers.

2.1.1 Devise List
Type

Bit
device

Word
device

Constant*

Device name
Input relay
Output relay

X
Y

Data register

D

Link register

L

Auxiliary relay
Special auxiliary relay
Stepping relay
Timer
Counter
32-bit counter
Input relay
Output relay

M
SM
S
T
C
HC
X
Y

Data register

D

Special data register

SR

Link register

L

Timer
Counter
32-bit counter
Index register

T
C
HC
E

Decimal system

K

Hexadecimal system

16#

Number of devices
Range
8192
X0.0~X511.15
8192
Y0.0~Y511.15
16384 (AHCPU500)
D0.0~D16383.15
32768 (AHCPU510)
D0.0~D32767.15
65536 (AHCPU520/530)
D0.0~D65535.15
16384 (AHCPU500)
L0.0~ L16383.15
32768 (AHCPU510)
L0.0~ L32767.15
65536 (AHCPU520/530)
L0.0~ L65535.15
8192
M0~M8191
2048
SM0~SM2047
2048
S0~S2047
2048
T0~T2047
2048
C0~C2047
64
HC0~HC63
512
X0~X511
512
Y0~Y511
16384 (AHCPU500)
D0~D16383
32768 (AHCPU510)
D0~D32767
65536 (AHCPU520/530)
D0~D65535
2048
SR0~SR2047
16384 (AHCPU500)
L0~L16383
32768 (AHCPU510)
L0~L32767
65536 (AHCPU520/530)
L0~L65535
2048
T0~T2047
2048
C0~C2047
64 (128 words)
HC0~HC63
32
E0~E31
16 bits: -32768~32767
32 bits: -2147483648~2147483647
16 bits: 16#0~16#FFFF
32 bits: 16#0~16#FFFFFFFF

Single-precision
F
32 bits: ±1.17549435-38~±3.40282347+38
floating-point number
64 bits: ±2.2250738585072014-308~
Double-precision
DF
floating-point number
±1.7976931348623157+308
String
“$”
1~31 characters
String*
*1: The decimal forms are notated by K in the device lists in chapters 5 and 6, whereas they are
entered directly in ISPSoft.
*2: The floating-point numbers are notated by F/DF in the device lists in chapters 5 and, whereas
they are represented by decimal points in ISPSoft.
*3: The strings are notated by “$” in chapters 5 and 6, whereas they are represented by “ ” in
ISPSoft.

Ch ap te r 2 De vices

2.1.2 Basic Structure of I/O Storages
Device
X
Y
M
SM
S
T
C
HC
D
SR
L
E

Function
Input relay
Output relay
Auxiliary relay
Special auxiliary
relay
stepping relay
Timer
Counter
32-bit counter
Data register
Special data
register
Link register
Index register

Access of
bits
OK
OK
OK

Access of
words
OK
OK
-

Modification
by ISPSoft
OK
OK
OK

Forcing the bit
ON/OFF
OK
OK
NO

OK

-

OK

NO

OK
OK
OK
OK
OK

OK
OK
OK
OK

OK
OK
OK
OK
OK

NO
NO
NO
NO
NO

-

OK

OK

NO

OK
-

OK
OK

OK
OK

NO
NO

2.1.3 Relation between the PLC Action and the Device Type
Device type

Non-latched
area

Latched
area

Output relay

Cleared

Retained

Cleared

Retained

Retained

Cleared

Retained

Retained

Retained

Retained

Retained

The state of the output
relay returns to that before
the PLC’s stopping.

Cleared

Retained

Cleared

Retained

Retained

Retained

RUN→STOP

Retained

Retained

Retained

SM204 is ON.
(All non-latched areas are cleared.)
SM205 is ON.
(All latched areas are cleared.)
Default value

Cleared

Retained

Cleared

Retained

Cleared

Retained

0

0

0

PLC action
Power: OFF→ON

STOP
↓
RUN

The output relay is cleared.
The state of the output
relay is retained.
The state of the output
relay returns to that before
the PLC’s stopping.
The non-latched area is
cleared.
The state of the latched
area is retained.

2.1.4 Latched Areas in the Device Range
Device
X
Y
M*

Function
Input relay
Output relay
Auxiliary relay

Device range
X0~X511
Y0~Y511
M0~M8191

SM

Special auxiliary
relay

SM0~SM2047

S
T*
C*

Stepping relay
Timer
Counter

S0~S1023
T0~T2047
C0~C2047

Latched area
All devices are non-latched.
All devices are non-latched.
The default range is M0~M8191.
Some devices are latched, and can not be
changed.
Please refer to the function list of SM for
more information.
All devices are non-latched.
The default range is T0~T2047.
The default range is C0~C2047.

2-3

A H 5 00 Prog r am m ing M an ua l

Device
HC*

Function
32-bit counter

Device range
HC0~HC63
D0~D16383
(AHCPU500)
D0~D32767
(AHCPU510)
D0~D65535
(AHCPU520/530)

D*

Data register

SR

Special data register

SR0~SR2047

Latched area
The default range is HC0~HC63.
The default range is D0~D16383.
The default range is D0~D32767.
At most 32768 devices can be latched
areas.
Some are latched, and can not be changed.
Please refer to the function list of SR for
more information.

L0~D16383
(AHCPU500)
L0~D32767
Link register
All devices are non-latched.
L
(AHCPU510)
L0~D65535
(AHCPU520/530)
Index register
E0~E31
All devices are non-latched.
E
*: * indicates that users can set the range of latched areas, and that the device can be set to
Non-latched Area. The range of latched areas can not exceed the device range. Above all, only
32768 data registers at most can be non-latched areas. For example, users can set D50~D32817
or D32768~D65535 to Latched Areas although the default range of latched areas is D0~D32767.

2.2 Functions of Devices
The procedure for processing the program in the PLC:

Regenerating the input signal:
1. Before the program is executed, the state of the
Input ter minal X
external input signal is read into the memory of
the input signal.
R egener ating the input signal
2. When program is executed, the state in the
Device memory
memory of the input signal does not change even
if the input signal changes from ON to OFF or
from OFF to ON. Not until the next scan begins
Proc es s in g th e prog ram
will the input signal be refreshed.

Processing the program:
After the input signal is refreshed, the instructions in
Device memory
the program are executed in order from the start
address of the program, and the results are stored
in the device memories.
Regener ating the output s ignal

Regenerating the state of the output:
and sending it to the output ter minal
After the instruction END is executed, the state in
the device memory is sent to the specified output
terminal.
y
r
o
m
e
m
e
c
i
v
e
D

2.2.1

Values and Constants
Name

Bit
Nibble
Byte
Word

2-4

Description
A bit is the basic unit in the binary system. Its state is either 1 or 0.
A nibble is composed of four consecutive bits (e.g. b3~b0). Nibbles can
be used to represent 0~9 in the decimal system, or 0~F in the
hexadecimal system.
A byte is composed of two consecutive nibbles (i.e. 8 bits, b7~b0).
Bytes can be used to represent 00~FF in the hexadecimal system.
A word is composed of two consecutive bytes (i.e. 16 bits, b15~b0).
Words can be used to represent 0000~FFFF in the hexadecimal
system.

Ch ap te r 2 De vices

Name

Description
A double word is composed of two consecutive words (i.e. 32 bits,
Double word
b31~b0). Double words can be used to represent
00000000~FFFFFFFF in the hexadecimal system.
A quadruple word is composed of four consecutive words (i.e. 64 bits,
b63~b0). Quadruple words can be used to represent
Quadruple word
0000000000000000 – FFFFFFFFFFFFFFFF in the hexadecimal
system.
The relation among bits, nibbles, bytes, words, and double words in the binary system is as follows.
DW

D ouble w ord

W1

W0

BY 3
N B7

B Y2
N B6

N B5

W ord

BY 1
N B4

N B3

BY0
N B2

N B1

B yt e
N B0

b31b30 b29 b28 b27 b26 b25 b24b23 b22 b21 b20b19 b18 b17 b16 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0

N ib ble
B it

The PLC uses four types of values to execute the operation according to different control purposes.
The functions of these values are illustrated as follows:
1.
Binary number (BIN)
The PLC adopts the binary system to operate the values.
2.
Decimal number (DEC)
The decimal number in the PLC is used as
 the setting value of the timer (T) or the setting value of the counter (C/HC). For example,
TMR C0 50 (constant K).
 the device number. For example, M10 and T30 (device number)
 as the number before or after the decimal point. For example, X0.0, Y0.11, and D10.0
(device number).
 the constant K: It is used as the operand in the applied instruction. For example, MOV 123
D0 (constant K).
3.
Binary-coded decimal (BCD)
A decimal value is represented by a nibble or four bits, and therefore sixteen consecutive bits
can represent a four-digit decimal value.
4.
Hexadecimal number (HEX)
The hexadecimal number in the PLC is used as
 the constant 16#: It is used as the operand in the applied instruction. For example, MOV
16#1A2B D0 (hexadecimal constant).
The following is the reference table:
Binary number
Decimal number Binary-coded decimal number Hexadecimal number
(BIN)
(DEC)
(BCD)
(HEX)
Hexadecimal
Internal operation Decimal constant,
Instruction related to the
constant,
binary-code decimal number
in the PLC
device number
device number
0000
0
0000
0
0001
1
0001
1
0010
2
0010
2
0011
3
0011
3
0100
4
0100
4
0101
5
0101
5
0110
6
0110
6
0111
7
0111
7
1000
8
1000
8
1001
9
1001
9

2-5

A H 5 00 Prog r am m ing M an ua l

Binary number
(BIN)
1010
1011
1100
1101
1110
1111
10000
10001

2.2.2

Decimal number
(DEC)
10
11
12
13
14
15
16
17

Binary-coded decimal number Hexadecimal number
(BCD)
(HEX)
A
B
C
D
E
F
0001 0000
10
0001 0001
11

Floating-point Numbers

The floating-point numbers are represented by decimal points in ISPSoft. For example, the
floating-point number of 500 is 500.0.

2.2.2.1 Single-precision Floating-point Numbers
The floating-point number is represented by the 32-bit register. The representation adopts the
IEEE754 standard, and the format is as follows.
8 -b it

S

2 3- bi t
Ma nti ssa

E xpo ne nt

b 31

b0
S ig n b it
0 : Po siti ve
1 : Neg ati ve

Equation:  1  2 E  B  1.M ; B  127
S

The single-precision floating-point numbers range from ±2-126 to ±2+128, and correspond to the range
from ±1.1755×10-38 to ±3.4028×10+38.
The AH500 series PLC uses two consecutive registers to form a 32-bit floating-point number. Take
(D1, D0) for example.
D1 (b 15 ~b 0)
S

2
E7

2
E6

2
E5

b31 b30 b29 b28

2
E1

D0 (b 15 ~b 0)

2
2
2
2
E0 A22 A21 A20

2
A6

2
A5

2
A4

2
A3

2
A2

2
A1

2
A0

b24 b23 b22 b21 b20

b6

b5

b4

b3

b2

b1

b0

E xp on en t ( 8 b its)

Ma nt iss a (2 3b it s)
T he pos ition w here the d eci mal point is hid den

Ma nt iss a s ign b it (0 : Po sit iv e; 1: Ne ga tive)
W hen b 0~ b3 1 a re z eros, t he c on te nt is zero .

2.2.2.2 Double-precision Floating-point Numbers
The floating-point number is represented by the 64-bit register. The representation adopts the
IEEE754 standard, and the format is as follows.
11- bi t

S

E xpo ne nt

b 63

5 2- bi t
Ma nti ssa

b0
S ig n b it
0 : Po siti ve
1 : Neg ati ve

Equation:  1  2 E  B  1.M ; B  1023
S

The double-precision floating-point numbers range from ±2-1022 to ±2+1024, and correspond to the
range from ±2.2250×10-308 to ±1.7976×10+308.
The AH500 series PLC uses four consecutive registers to form a 64-bit floating-point number. Take
(D3, D2, D1, D0) for example.

2-6

Ch ap te r 2 De vices
D1 (b 15 ~b 0)
S

2
2
E10 E9

2
E8

b63 b62 b61 b60

2
E1

D2 ~D0

2
2
2
2
E0 A51 A50 A49

2
A6

2
A5

2
A4

2
A3

2
A2

2
A1

2
A0

b53 b52 b51 b50 b49

b6

b5

b4

b3

b2

b1

b0

Ma nt is sa (5 2 b its )

E xp on en t (11 bit s)

The po si ti on w here the dec im al po int is hidd en

Ma nt issa sign b it (0 : Po sitive; 1 : Neg at ive )
W hen b 0~ b6 3 a re zero s, t he con te nt is zer o.

Example 1:
23 is represented by the single-precision floating-point number.
Step 1: Convert 23 into the binary number, i.e. 23.0=10111.
Step 2: Normalize the binary number, i.e. 10111=1.0111 ×24 (0111 is the mantissa, and 4 is the
exponent.).
Step 3: Get the value of the exponent.
∵E-B=4→E-127=4 ∴E=131=100000112
Step 4: Combine the sign bit, the exponent, and the mantissa to form the floating-point number.
0 10000011 011100000000000000000002=41B8000016
23 is represented by the double-precision floating-point number.
Step 1: Convert 23 into the binary number, i.e. 23.0=10111.
Step 2: Normalize the binary number, i.e. 10111=1.0111 ×24 (0111 is the mantissa, and 4 is the
exponent.).
Step 3: Get the value of the exponent.
∵E-B=4→E-1023=4 ∴E=1027=100000000112
Step 4: Combine the sign bit, the exponent, and the mantissa to form the floating-point number.
0 10000000011 01110000000000000000000000000000000000000000000000002
=40370000000000016
Example 2:
-23 is represented by the single-precision floating-point number.
The steps of converting -23.0 into the floating-point number are the same as those of converting
23.0 into the floating-point number, except that the sign bit is 1.
1 10000011 011100000000000000000002=C1B8000016
-23 is represented by the double-precision floating-point number.
The steps of converting -23.0 into the floating-point number are the same as those of converting
23.0 into the floating-point number, except that the sign bit is 1.
1 10000000011 01110000000000000000000000000000000000000000000000002
=C0370000000000016

2.2.2.3 Decimal Floating-point Numbers




Since single-precision floating-point numbers and double-precision floating-point numbers are
not widely accepted by people, they can be converted into decimal floating-point numbers for
people to make judgement. However, as to the operation of the decimal point, the PLC still
uses single-precision floating-point numbers and double-precision floating-point numbers.
A 32-bibt decimal floating-point number is represented by two consecutive registers. The
constant is stored in the register whose number is smaller while the exponent is stored in the
register whose number is bigger. Take (D1, D0) for example.
[ Ex ponent D1]

D eci mal f lo ati ng -po in t nu mb er=[C on sta nt D 0 ]* 1 0

Base number D0=±1,000~±9,999
Exponent D1=-41~+35
The base number 100 does not exist in D0 because 100 is represented by 1,000×10-1. In
addition, 32-bit decimal floating-point numbers range from ±1175×10-41 to ±402×10+35.

2-7

A H 5 00 Prog r am m ing M an ua l

2.2.3

Strings

What strings can process are ASCII codes (*1). A complete string begins with a start character, and
ends with an ending character (NULL code). If what users enter is a string, they can enter 31
characters at most, and the ending character 16#00 will be added automatically in ISPSoft.
1.
No string (NULL code) is moved.

2.

D0=0 (NULL)
The string is an even number.

3.

D0
16#62 (b)
D1
16#64 (d)
D2
0 (NULL)
The string is an odd number.

D0
D1
D2

16#62 (b)
16#64 (d)
0 (NULL)

16#61 (a)
16#63 (b)

16#61 (a)
16#63 (b)
16#65 (e)

*1: ASCII code chart
Hex

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

ASCII

































Hex

10

11

12

13

14

15

16

17

18

19

1A

1B

1C

1D

1E

1F

ASCII

































Hex

20

21

22

23

24

25

26

27

28

29

2A

2B

2C

2D

2E

2F

ASCII

SP

!

"

#

$

%

&

'

(

)

*

+

,

-

.

/

Hex

30

31

32

33

34

35

36

37

38

39

3A

3B

3C

3D

3E

3F

ASCII

0

1

2

3

4

5

6

7

8

9

:

;

<

=

>

?

Hex

40

41

42

43

44

45

46

47

48

49

4A

4B

4C

4D

4E

4F

ASCII

@

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

Hex

50

51

52

53

54

55

56

57

58

59

5A

5B

5C

5D

5E

5F

ASCII

P

Q

R

S

T

U

V

W

X

Y

Z











Hex

60

61

62

63

64

65

66

67

68

69

6A

6B

6C

6D

6E

6F

ASCII

`

a

b

C

d

e

f

g

h

i

j

k

l

M

n

o

2-8

Ch ap te r 2 De vices

Hex

70

71

72

73

74

75

76

77

78

79

7A

7B

7C

7D

7E

7F

ASCII

p

q

r

s

t

u

v

w

x

y

z

{

|

}

~



Note:  represents an invisible character. Please do not use it.

2.2.4






The function of the input
The input is connected to the input device (e.g. external devices such as button switches,
rotary switches, number switches, and etc.), and the input signal is read into the PLC. Besides,
contact A or contact B of the input can be used several times in the program, and the ON/OFF
state of the input varies with the ON/OFF state of the input device.
The input number (the decimal number):
For the PLC, the input numbers start from X0.0. The number of inputs varies with the number
of inputs on the digital input/output modules, and the inputs are numbered according to the
order in which the digital input/output modules are connected to the CPU module. The
maximum number of inputs on the PLC can reach up to 8192, and the range is between X0.0
and X511.15.
The input type
The inputs are classified into two types.
1.
Regenerated input: Before the program is executed, the data is fed into the PLC
according to the states of the inputs which are regenerated. For
example, LD X0.0.
2.
Direct input: During the execution of the instructions, the data is fed into the PLC
according to the states of the inputs. For example, LD DX0.0.

2.2.5






Input Relays

Output Relays

The function of the output
The task of the output is sending the ON/OFF signal to drive the load connected to the output.
The load can be an external signal lamp, a digital display, or an electromagnetic valve. There
are three types of outputs. They are relays, transistors, and TRIACs (AC thyristors). Contact A
or contact B of the output can be used several times in the program, but the output should be
used only once in the program. Otherwise, according the program-scanning principle of the
PLC, the state of the output depends on the circuit connected to the last output in the program.
The output number (the decimal number)
For the PLC, the input numbers start from X0.0. The number of outputs varies with the number
of outputs on the digital input/output modules, and the outputs are numbered according to the
order in which the digital input/output modules are connected to the PLC. The maximum
number of outputs on the PLC can reach up to 8192, and the range is between Y0.0 and
Y511.15.
The output which is not practically put to use can be used as a general device.
The output type
The outputs are classified into two types.
1.
Regenerated output: Not until the program executes the instruction END is the
information fed out according to the states of the outputs. For
example, OUT Y0.0.
2.
Direct output: When the instructions are executed, the information is fed out according to
the states of the outputs. For example, OUT DY0.0.

2.2.6

Auxiliary Relays

The auxiliary relay has contact A and contact B. It can be used several times in the program. Users
can combine the control loops by means of the auxiliary relay, but can not drive the external load by
means of the auxiliary relay. The auxiliary relays can be divided into two types according to their
attributes.
1.
For general use: If an electric power cut occurs when the PLC is running, the auxiliary relay for
general use will be reset to OFF. When the power supply is restored, the
auxiliary relay for general use is still OFF.

2-9

A H 5 00 Prog r am m ing M an ua l
2.

For latched use: If an electric power cut occurs when the PLC is running, the state of the
auxiliary relay for latched use will be retained. When the power supply is
restored, the state remains the same as that before the power electric cut.

2.2.7

Special Auxiliary Relays

Every special auxiliary relay has its specific function. Please do not use the special auxiliary relays
which are not defined.
The special auxiliary relays and their functions are listed as follows. As to the SM numbers marked
“*”, users can refer to the additional remarks on special auxiliary relays/special data registers. “R” in
the attribute column indicates that the special auxiliary relay can read the data, whereas “R/W” in
the attribute column indicates that it can read and write the data. In addition, the mark “–” indicates
that the status of the special auxiliary relay does not make any change. The mark “#” indicates that
the system will be set according to the status of the PLC, and users can read the setting value and
refer to the related manual for more information.

Function

SM0
SM1
SM5
*SM8
SM9
SM10
*SM22
SM23

Operation error
The operation error is locked.
Instruction/Operand inspection error
Watchdog timer error
System error
I/O bus error
Clearing the error log
Clearing the download log
Clearing the state-changing log of the
PLC
The online-editing processing flag is on
when the online-editing mode starts.
The debugging mode processing flag is
on when the debugging mode starts.
The data is sent through COM1.
The data is sent through COM2.
Waiting to receive the reply through
COM1
Waiting to receive the reply through
COM2
Reception through COM1 is complete.
Reception through COM2 is complete.
An error occurs during the reception of
the data through COM1 by using the
instruction MODRW or the instruction
RS.
An error occurs during the reception of
the data through COM2 by using the
instruction MODRW or the instruction
RS.
No data is received through COM1 after
a specified period of time.
No data is received through COM2 after
a specified period of time.

SM24
SM25
SM26
*SM96
*SM97
*SM98
*SM99
*SM100
*SM101
*SM102

*SM103

*SM104
*SM105

2-10

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○
○
○
○
○
○
○
○

OFF OFF
OFF OFF
OFF OFF
OFF
–
OFF
–
OFF
–
OFF
–
OFF
–

○
○
○
○
○
○
○
○

–
–
–
–
–
–
–
–

R
R
R
R
R
R
R/W
R/W

OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF OFF
○ × OFF OFF

–
–

R/W
R/W

OFF
OFF

○ ○ OFF OFF

–

R

OFF

○ × OFF OFF

–

R

OFF

○ ○ OFF OFF
○ × OFF OFF

–
–

R/W
R/W

OFF
OFF

○ ○ OFF OFF

–

R

OFF

○ × OFF OFF

–

R

OFF

○ ○ OFF OFF

–

R/W

OFF

○ × OFF OFF

–

R/W

OFF

Ch ap te r 2 De vices

*SM106

*SM107

*SM204
*SM205
SM206
*SM209

*SM210

*SM211

*SM212
SM215
SM220
*SM400
*SM401
*SM402
*SM403
*SM404

*SM405

*SM406

*SM407

Function

Choice made by COM1 between the
8-bit processing mode and the 16-bit
processing mode
ON: The 8-bit processing mode
OFF: The 16-bit processing mode
Choice made by COM2 between the
8-bit processing mode and the 16-bit
processing mode
ON: The 8-bit processing mode
OFF: The 16-bit processing mode
All non-latched areas are cleared.
All latched areas are cleared.
Inhibiting all output
The communication protocol of COM1
changes (in accordance with SM210,
SR201, SR209, and SR215).
Choice made by COM1 between the
ASCII mode and the RTU mode
ON: The RTU mode
The communication protocol of COM2
changes (in accordance with SM212,
SR202, SR212, and SR216).
Choice made by COM2 between the
ASCII mode and the RTU mode
ON: The RTU mode
Running state of the PLC
Calibrating the real-time clock within
±30 seconds
Normally-open contact
Normally-closed contact
The pulse is ON at the time when the
PLC runs.
The pulse is OFF at the time when the
PLC runs.
10 millisecond clock pulse during which
the pulse is ON for 5 milliseconds and is
OFF for 5 milliseconds
100 millisecond clock pulse during
which the pulse is ON for 50
milliseconds and is OFF for 50
milliseconds
200 millisecond clock pulse during
which the pulse is ON for 100
milliseconds and is OFF for 100
milliseconds
One second clock pulse during which
the pulse is ON for 500 milliseconds
and is OFF for 500 milliseconds

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R/W

OFF

○ × OFF

–

–

R/W

OFF

○ ○ OFF
○ ○ OFF
○ ○ OFF

–
–
–

–
–
–

R/W
R/W
R/W

OFF
OFF
OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ × OFF

–

–

R/W

OFF

○ × OFF

–

–

R/W

OFF

○ ○ OFF

ON

OFF

R/W

OFF

○ ○ OFF OFF

–

R/W

OFF

○ ○ ON ON
○ ○ OFF OFF

ON
OFF

R
R

ON
OFF

○ ○ OFF

ON

OFF

R

OFF

○ ○ ON

OFF

ON

R

ON

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

2-11

A H 5 00 Prog r am m ing M an ua l

*SM408

*SM409

*SM410

*SM450

*SM451

*SM452

*SM453
SM600
SM601
SM602
SM603

SM604

SM605
SM606
SM607

SM608
SM609

2-12

Function

Two second clock pulse during which
the pulse is ON for one second and is
OFF for one second
2n second clock pulse during which the
pulse is ON for n seconds and is OFF
for n seconds
The interval n is specified by SR409.
2n millisecond clock pulse during which
the pulse is ON for n milliseconds and is
OFF for n milliseconds
The interval n is specified by SR410.
Whether the memory card exists
ON: The memory card exists.
OFF: The memory card does not exist.
Write protection switch on the memory
card
ON: The memory card is write
protected.
OFF: The memory card is not write
protected.
The data in the memory card is being
accessed.
ON: The data in the memory card is
being accessed.
OFF: The data in the memory card is
not accessed.
An error occurs during the operation of
the memory card.
ON: An error occurs.
Zero flag
Borrow flag
Carry flag
The execution of the instruction SORT
is complete.
Setting the working mode of the
instruction SORT.
ON: The descending order
OFF: The ascending order
Designating the working mode of the
instruction SMOV
8-bit or 16-bit working mode
It is the matrix comparison flag.
ON: Comparing the equivalent values
OFF: Comparing the different values
The matrix comparison comes to an
end. When the last bits are compared,
SM608 is ON.
When SM609 is ON, the comparison
starts from bit 0.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF
○ ○ OFF
○ ○ OFF

–
–
–

–
–
–

R
R
R

OFF
OFF
OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

-

-

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

Ch ap te r 2 De vices

SM610

SM611
SM612
SM613
SM614
SM615

SM616

SM617
SM618
SM619
SM620
SM621
SM622
SM623
SM624
SM625
SM626
SM627
SM628
SM629

Function

It is the matrix bit search flag. When the
matching bits are compared, the
comparison stops immediately, and
SM610 is ON.
It is the matrix pointer error flag. When
the value of the pointer exceeds the
comparison range, SM611 is ON.
It is the matrix pointer increasing flag.
The current value of the pointer
increases by one.
It is the matrix pointer clearing flag. The
current value of the pointer is cleared to
zero.
It is the carry flag for the matrix
rotation/shift/output.
It is the borrow flag for the matrix
shift/output.
It is the direction flag for the matrix
rotation/shift. The bits are shifted
leftward when SM616 is OFF, whereas
the bits are shifted rightward when
SM616 is ON.
The bits with the value 0 or 1 are
counted.
It is ON when the matrix counting result
is 0.
It is ON when the instruction EI is
executed.
When the results gotten from the
comparison by using the instruction
CMPT# are that all devices are ON,
SM620 is ON.
It sets the counting mode of HC0. (HC0
counts down when SM621 is ON.)
It sets the counting mode of HC. (HC1
counts down when SM622 is ON.)
It sets the counting mode of HC2. (HC2
counts down when SM623 is ON.)
It sets the counting mode of HC3. (HC3
counts down when SM624 is ON.)
It sets the counting mode of HC4. (HC4
counts down when SM625 is ON.)
It sets the counting mode of HC5. (HC5
counts down when SM626 is ON.)
It sets the counting mode of HC6. (HC6
counts down when SM627 is ON.)
It sets the counting mode of HC7. (HC7
counts down when SM628 is ON.)
It sets the counting mode of HC8. (HC8
counts down when SM629 is ON.)

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF OFF

-

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

2-13

A H 5 00 Prog r am m ing M an ua l

SM630
SM631
SM632
SM633
SM634

SM635
SM636
SM637

SM638
SM639
SM640
SM641

SM642
SM643
SM644

SM645
SM646

2-14

Function

It sets the counting mode of HC9. (HC9
counts down when SM630 is ON.)
It sets the counting mode of HC10.
(HC10 counts down when SM631 is
ON.)
It sets the counting mode of HC11.
(HC11 counts down when SM632 is
ON.)
It sets the counting mode of HC12.
(HC12 counts down when SM633 is
ON.)
It sets the counting mode of HC13.
(HC13 counts down when SM634 is
ON.)
It sets the counting mode of HC14.
(HC14 counts down when SM635 is
ON.)
It sets the counting mode of HC15.
(HC15 counts down when SM636 is
ON.)
It sets the counting mode of HC16.
(HC16 counts down when SM637 is
ON.)
It sets the counting mode of HC17.
(HC17 counts down when SM638 is
ON.)
It sets the counting mode of HC18.
(HC18 counts down when SM639 is
ON.)
It sets the counting mode of HC19.
(HC19 counts down when SM640 is
ON.)
It sets the counting mode of HC20.
(HC20 counts down when SM641 is
ON.)
It sets the counting mode of HC21.
(HC21 counts down when SM642 is
ON.)
It sets the counting mode of HC22.
(HC22 counts down when SM643 is
ON.)
It sets the counting mode of HC23.
(HC23 counts down when SM644 is
ON.)
It sets the counting mode of HC24.
(HC24 counts down when SM645 is
ON.)
It sets the counting mode of HC25.
(HC25 counts down when SM646 is
ON.)

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

-

R/W

OFF

○ ○ OFF

–

-

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

Ch ap te r 2 De vices

SM647

SM648

SM649

SM650

SM651

SM652

SM653

SM654

SM655

SM656

SM657

SM658

SM659

SM660

SM661

SM662

Function

It sets the counting mode of HC26.
(HC26 counts down when SM647 is
ON.)
It sets the counting mode of HC27.
(HC27 counts down when SM648 is
ON.)
It sets the counting mode of HC28.
(HC28 counts down when SM649 is
ON.)
It sets the counting mode of HC29.
(HC29 counts down when SM650 is
ON.)
It sets the counting mode of HC30.
(HC30 counts down when SM651 is
ON.)
It sets the counting mode of HC31.
(HC31 counts down when SM652 is
ON.)
It sets the counting mode of HC32.
(HC32 counts down when SM653 is
ON.)
It sets the counting mode of HC33.
(HC33 counts down when SM653 is
ON.)
It sets the counting mode of HC34.
(HC34 counts down when SM655 is
ON.)
It sets the counting mode of HC35.
(HC35 counts down when SM656 is
ON.)
It sets the counting mode of HC36.
(HC36 counts down when SM657 is
ON.)
It sets the counting mode of HC37.
(HC37 counts down when SM658 is
ON.)
It sets the counting mode of HC38.
(HC38 counts down when SM659 is
ON.)
It sets the counting mode of HC39.
(HC39 counts down when SM660 is
ON.)
It sets the counting mode of HC40.
(HC40 counts down when SM661 is
ON.)
It sets the counting mode of HC41.
(HC41 counts down when SM662 is
ON.)

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

2-15

A H 5 00 Prog r am m ing M an ua l

SM663
SM664

SM665
SM666
SM667
SM668

SM669
SM670
SM671

SM672
SM673
SM674
SM675

SM676
SM677
SM678

2-16

Function

It sets the counting mode of HC42.
(HC42 counts down when SM663 is
ON.)
It sets the counting mode of HC43.
(HC43 counts down when SM664 is
ON.)
It sets the counting mode of HC44.
(HC44 counts down when SM665 is
ON.)
It sets the counting mode of HC45.
(HC45 counts down when SM666 is
ON.)
It sets the counting mode of HC46.
(HC46 counts down when SM667 is
ON.)
It sets the counting mode of HC47.
(HC47 counts down when SM668 is
ON.)
It sets the counting mode of HC48.
(HC48 counts down when SM669 is
ON.)
It sets the counting mode of HC49.
(HC49 counts down when SM670 is
ON.)
It sets the counting mode of HC50.
(HC50 counts down when SM671 is
ON.)
It sets the counting mode of HC51.
(HC51 counts down when SM672 is
ON.)
It sets the counting mode of HC52.
(HC52 counts down when SM673 is
ON.)
It sets the counting mode of HC53.
(HC53 counts down when SM674 is
ON.)
It sets the counting mode of HC54.
(HC54 counts down when SM675 is
ON.)
It sets the counting mode of HC55.
(HC55 counts down when SM676 is
ON.)
It sets the counting mode of HC56.
(HC56 counts down when SM677 is
ON.)
It sets the counting mode of HC57.
(HC57 counts down when SM678 is
ON.)

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

Ch ap te r 2 De vices

SM679
SM680

SM681
SM682
SM683
SM684
SM685
SM686
SM687
SM688
SM690

SM691

SM692
SM693
SM694
SM695

SM1000
SM1090
SM1091

Function

It sets the counting mode of HC58.
(HC58 counts down when SM679 is
ON.)
It sets the counting mode of HC59.
(HC59 counts down when SM680 is
ON.)
It sets the counting mode of HC60.
(HC60 counts down when SM681 is
ON.)
It sets the counting mode of HC61.
(HC61 counts down when SM682 is
ON.)
It sets the counting mode of HC62.
(HC62 counts down when SM683 is
ON.)
It sets the counting mode of HC63.
(HC63 counts down when SM684 is
ON.)
The instruction DSCLP uses the
floating-point operation.
When SM686 is ON, the instruction
RAMP is executed.
The execution of the instruction RAMP
is complete.
The execution of the instruction INCD is
complete.
String control mode
The input mode of the instruction HKY
is the 16-bit mode.
The input is the hexadecimal input if
SM691 is ON, whereas A~F are
function keys if it is OFF.
After the execution of the instruction
HKY is complete, SM692 is ON for a
scan cycle.
After the execution of the instruction
SEGL is complete, SM693 is ON for a
scan cycle.
After the execution of the instruction
DSW is complete, SM694 is ON for a
scan cycle.
It is the radian/degree flag.
ON: The degree
It is the Ethernet setting flag. When
SM1000 is ON, the data in
SR1000~SR1006 is written into the
flash memory.
The TCP connection is busy.
The UDP connection is busy.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R/W

OFF

X ○

–

–

R/W

OFF

–
–

–
–

R
R

OFF
OFF

-

X ○ OFF
X ○ OFF

2-17

A H 5 00 Prog r am m ing M an ua l

SM1106
SM1107
SM1108
SM1109
*SM1112
*SM1113
*SM1116
*SM1117
*SM1118

*SM1119
*SM1120
*SM1121

*SM1122
*SM1123
*SM1124
*SM1125
*SM1126
*SM1127
*SM1128
*SM1129
*SM1130

2-18

Function

Basic management─Ethernet
connection error
Basic management of Ethernet─Basic
setting error
Basic management of Ethernet─Filter
setting error
Basic management of the TCP/UDP
socket─The local port is already used.
Email setting error
Email service error
It is the switch of trigger 1 in the email.
Trigger 1 in the email
When trigger 1 whose status is 0 in the
email is enabled and no mail has been
sent, SM1118 is ON.
When trigger 1 whose status is 1 in the
email is enabled and the last mail has
been sent successfully, SM1119 is ON.
When trigger 1 whose status is 2 in the
email is enabled and the last mail has
been sent in error, SM1120 is ON.
When trigger 1 whose status is 3 in the
email is enabled and the mail has been
sent, SM1121 is ON.
When trigger 1 in the email is enabled
and there is an SMTP server response
timeout, SM1122 is ON.
When trigger 1 in the email is enabled
and there is an SMTP server response
error, SM1123 is ON.
When trigger 1 in the email is enabled
and the size of the attachment exceeds
the limit, SM1124 is ON.
When trigger 1 in the email is enabled
and the attachment is not found,
SM1125 is ON.
It is the switch of trigger 2 in the email.
Trigger 2 in the email
When trigger 2 whose status is 0 in the
email is enabled and no mail has been
sent, SM1128 is ON.
When trigger 2 whose status is 1 in the
email is enabled and the last mail has
been sent successfully, SM1129 is ON.
When trigger 2 whose status is 2 in the
email is enabled and the last mail has
been sent in error, SM1130 is ON.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X
X
X
X

OFF
OFF
OFF
OFF

–
–
–
–

–
–
–
–

R
R
R
R

OFF
OFF
OFF
OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

○
○
○
○

Ch ap te r 2 De vices

Function

When trigger 2 whose status is 3 in the
*SM1131 email is enabled and the mail has been
sent, SM1131 is ON.
When trigger 2 in the email is enabled
*SM1132 and there is an SMTP server response
timeout, SM1132 is ON.
When trigger 2 in the email is enabled
*SM1133 and there is an SMTP server response
error, SM1133 is ON.
When trigger 2 in the email is enabled
*SM1134 and the size of the attachment exceeds
the limit, SM1134 is ON.
When trigger 2 in the email is enabled
*SM1135 and the attachment is not found,
SM1135 is ON.
*SM1136 It is the switch of trigger 3 in the email.
*SM1137 Trigger 3 in the email
When trigger 3 whose status is 0 in the
*SM1138 email is enabled and no mail has been
sent, SM1138 is ON.
When trigger 3 whose status is 1 in the
*SM1139 email is enabled and the last mail has
been sent successfully, SM1139 is ON.
When trigger 3 whose status is 2 in the
*SM1140 email is enabled and the last mail has
been sent in error, SM1140 is ON.
When trigger 3 whose status is 3 in the
*SM1141 email is enabled and the mail has been
sent, SM1141 is ON.
When trigger 3 in the email is enabled
*SM1142 and there is an SMTP server response
timeout, SM1142 is ON.
When trigger 3 in the email is enabled
*SM1143 and there is an SMTP server response
error, SM1143 is ON.
When trigger 3 in the email is enabled
*SM1144 and the size of the attachment exceeds
the limit, SM1144 is ON.
When trigger 3 in the email is enabled
*SM1145 and the attachment is not found,
SM1145 is ON.
*SM1146 It is the switch of trigger 4 in the email.
*SM1147 Trigger 4 in the email
When trigger 4 whose status is 0 in the
*SM1148 email is enabled and no mail has been
sent, SM1148 is ON.
When trigger 4 whose status is 1 in the
*SM1149 email is enabled and the last mail has
been sent successfully, SM1149 is ON.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

2-19

A H 5 00 Prog r am m ing M an ua l

Function

When trigger 4 whose status is 2 in the
*SM1150 email is enabled and the last mail has
been sent in error, SM1150 is ON.
When trigger 4 whose status is 3 in the
*SM1151 email is enabled and the mail has been
sent, SM1151 is ON.
When trigger 4 in the email is enabled
*SM1152 and there is an SMTP server response
timeout, SM1152 is ON.
When trigger 4 in the email is enabled
*SM1153 and there is an SMTP server response
error, SM1153 is ON.
When trigger 4 in the email is enabled
*SM1154 and the size of the attachment exceeds
the limit, SM1154 is ON.
When trigger 4 in the email is enabled
*SM1155 and the attachment is not found,
SM1155 is ON.
*SM1156 It is the switch of trigger 5 in the email.
*SM1157 Trigger 5 in the email
When trigger 5 whose status is 0 in the
*SM1158 email is enabled and no mail has been
sent, SM1158 is ON.
When trigger 5 whose status is 1 in the
*SM1159 email is enabled and the last mail has
been sent successfully, SM1159 is ON.
When trigger 5 whose status is 2 in the
*SM1160 email is enabled and the last mail has
been sent in error, SM1160 is ON.
When trigger 5 whose status is 3 in the
*SM1161 email is enabled and the mail has been
sent, SM1161 is ON.
When trigger 5 in the email is enabled
*SM1162 and there is an SMTP server response
timeout, SM1162 is ON.
When trigger 5 in the email is enabled
*SM1163 and there is an SMTP server response
error, SM1163 is ON.
When trigger 5 in the email is enabled
*SM1164 and the size of the attachment exceeds
the limit, SM1164 is ON.
When trigger 5 in the email is enabled
*SM1165 and the attachment is not found,
SM1165 is ON.
*SM1166 It is the switch of trigger 6 in the email.
*SM1167 Trigger 6 in the email
When trigger 6 whose status is 0 in the
*SM1168 email is enabled and no mail has been
sent, SM1168 is ON.

2-20

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

X ○ OFF

–

–

R

OFF

Ch ap te r 2 De vices

Function

When trigger 6 whose status is 1 in the
*SM1169 email is enabled and the last mail has
been sent successfully, SM1169 is ON.
When trigger 6 whose status is 2 in the
*SM1170 email is enabled and the last mail has
been sent in error, SM1170 is ON.
When trigger 6 whose status is 3 in the
*SM1171 email is enabled and the mail has been
sent, SM1171 is ON.
When trigger 6 in the email is enabled
*SM1172 and there is an SMTP server response
timeout, SM1172 is ON.
When trigger 6 in the email is enabled
*SM1173 and there is an SMTP server response
error, SM1173 is ON.
When trigger 6 in the email is enabled
*SM1174 and the size of the attachment exceeds
the limit, SM1174 is ON.
When trigger 6 in the email is enabled
*SM1175 and the attachment is not found,
SM1175 is ON.
*SM1176 It is the switch of trigger 7 in the email.
*SM1177 Trigger 7 in the email
When trigger 7 whose status is 0 in the
*SM1178 email is enabled and no mail has been
sent, SM1178 is ON.
When trigger 7 whose status is 1 in the
*SM1179 email is enabled and the last mail has
been sent successfully, SM1179 is ON.
When trigger 7 whose status is 2 in the
*SM1180 email is enabled and the last mail has
been sent in error, SM1180 is ON.
When trigger 7 whose status is 3 in the
*SM1181 email is enabled and the mail has been
sent, SM1181 is ON.
When trigger 7 in the email is enabled
*SM1182 and there is an SMTP server response
timeout, SM1182 is ON.
When trigger 7 in the email is enabled
*SM1183 and there is an SMTP server response
error, SM1183 is ON.
When trigger 7 in the email is enabled
*SM1184 and the size of the attachment exceeds
the limit, SM1184 is ON.
When trigger 7 in the email is enabled
*SM1185 and the attachment is not found,
SM1185 is ON.
*SM1186 It is the switch of trigger 8 in the email.
*SM1187 Trigger 8 in the email

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

2-21

A H 5 00 Prog r am m ing M an ua l

Function

When trigger 8 whose status is 0 in the
*SM1188 email is enabled and no mail has been
sent, SM1188 is ON.
When trigger 8 whose status is 1 in the
*SM1189 email is enabled and the last mail has
been sent successfully, SM1189 is ON.
When trigger 8 whose status is 2 in the
*SM1190 email is enabled and the last mail has
been sent in error, SM11290 is ON.
When trigger 8 whose status is 3 in the
*SM1191 email is enabled and the mail has been
sent, SM1191 is ON.
When trigger 8 in the email is enabled
*SM1192 and there is an SMTP server response
timeout, SM1192 is ON.
When trigger 8 in the email is enabled
*SM1193 and there is an SMTP server response
error, SM1193 is ON.
When trigger 8 in the email is enabled
*SM1194 and the size of the attachment exceeds
the limit, SM1194 is ON.
When trigger 8 in the email is enabled
*SM1195 and the attachment is not found,
SM1195 is ON.
*SM1196 Socket configuration error
TCP socket 1─The connection is
*SM1270
successful.
TCP socket 1─The data has been
*SM1271
received.
*SM1272 TCP socket 1─The data has been sent.
TCP socket 1─The connection is being
*SM1273
started.
TCP socket 1─The connection is being
*SM1274
closed.
*SM1275 TCP socket 1─The data is being sent.
TCP socket 1─The data is being
*SM1276
received.
*SM1277 TCP socket 1─Error flag
TCP socket 2─The connection is
*SM1278
successful.
TCP socket 2─The data has been
*SM1279
received.
*SM1280 TCP socket 2─The data has been sent.
TCP socket 2─The connection is being
*SM1281
started.
TCP socket 2─The connection is being
*SM1282
closed.
*SM1283 TCP socket 2─The data is being sent.

2-22

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R/W

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

Ch ap te r 2 De vices

*SM1284
*SM1285
*SM1286
*SM1287
*SM1288
*SM1289
*SM1290
*SM1291
*SM1292
*SM1293
*SM1294
*SM1295
*SM1296
*SM1297
*SM1298
*SM1299
*SM1300
*SM1301
*SM1302
*SM1303
*SM1304
*SM1305
*SM1306
*SM1307
*SM1308
*SM1309
*SM1310
*SM1311
*SM1312

Function

TCP socket 2─The data is being
received.
TCP socket 2─Error flag
TCP socket 3─The connection is
successful.
TCP socket 3─The data has been
received.
TCP socket3─The data has been sent.
TCP socket 3─The connection is being
started.
TCP socket 3─The connection is being
closed.
TCP socket 3─The data is being sent.
TCP socket 3─The data is being
received.
TCP socket 3─Error flag
TCP socket 4─The connection is
successful.
TCP socket 4─The data has been
received.
TCP socket 4─The data has been sent.
TCP socket 4─The connection is being
started.
TCP socket 4─The connection is being
closed.
TCP socket 4─The data is being sent.
TCP socket 4─The data is being
received.
TCP socket 4─Error flag
TCP socket 5─The connection is
successful.
TCP socket 5─The data has been
received.
TCP socket 5─The data has been sent.
TCP socket 5─The connection is being
started.
TCP socket 5─The connection is being
closed.
TCP socket 5─The data is being sent.
TCP socket 5─The data is being
received.
TCP socket 5─Error flag
TCP socket 6─The connection is
successful.
TCP socket 6─The data has been
received.
TCP socket 6─The data has been sent.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

2-23

A H 5 00 Prog r am m ing M an ua l

*SM1313
*SM1314
*SM1315
*SM1316
*SM1317
*SM1318
*SM1319
*SM1320
*SM1321
*SM1322
*SM1323
*SM1324
*SM1325
*SM1326
*SM1327
*SM1328
*SM1329
*SM1330
*SM1331
*SM1332
*SM1333
*SM1334
*SM1335
*SM1336
*SM1337
*SM1338
*SM1339
*SM1340
*SM1341

2-24

Function

TCP socket 6─The connection is being
started.
TCP socket 6─The connection is being
closed.
TCP socket 6─The data is being sent.
TCP socket 6─The data is being
received.
TCP socket 6─Error flag
TCP socket 7─The connection is
successful.
TCP socket 7─The data has been
received.
TCP socket 7─The data has been sent.
TCP socket 7─The connection is being
started.
TCP socket 7─The connection is being
closed.
TCP socket 7─The data is being sent.
TCP socket 7─The data is being
received.
TCP socket7─Error flag
TCP socket 8─The connection is
successful.
TCP socket 8─The data has been
received.
TCP socket 8─The data has been sent.
TCP socket 8─The connection is being
started.
TCP socket 8─The connection is being
closed.
TCP socket 8─The data is being sent.
TCP socket 8─The data is being
received.
TCP socket 1─Error flag
UDP socket 1─The connection has
been started.
UDP socket 1─The data has been
received.
UDP socket 1─The data has been sent.
UDP socket 1─The connection has
been closed.
UDP socket 1─Error flag
UDP socket 2─The connection has
been started.
UDP socket 2─The data has been
received.
UDP socket 2─The data has been sent.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

Ch ap te r 2 De vices

*SM1342
*SM1343
*SM1344
*SM1345
*SM1346
*SM1347
*SM1348
*SM1349
*SM1350
*SM1351
*SM1352
*SM1353
*SM1354
*SM1355
*SM1356
*SM1357
*SM1358
*SM1359
*SM1360
*SM1361
*SM1362
*SM1363
*SM1364
*SM1365
*SM1366
*SM1367
*SM1368
*SM1369
*SM1370
*SM1371

Function

UDP socket 2─The connection has
been closed.
UDP socket 2─Error flag
UDP socket 3─The connection has
been started.
UDP socket 3─The data has been
received.
UDP socket 3─The data has been sent.
UDP socket 3─The connection has
been closed.
UDP socket 3─Error flag
UDP socket 4─The connection has
been started.
UDP socket 4─The data has been
received.
UDP socket 4─The data has been sent.
UDP socket 4─The connection has
been closed.
UDP socket 4─Error flag
UDP socket 5─The connection has
been started.
UDP socket 5─The data has been
received.
UDP socket 5─The data has been sent.
UDP socket 5─The connection has
been closed.
UDP socket 5─Error flag
UDP socket 6─The connection has
been started.
UDP socket 6─The data has been
received.
UDP socket 6─The data has been sent.
UDP socket 6─The connection has
been closed.
UDP socket 6─Error flag
UDP socket 7─The connection has
been started.
UDP socket 7─The data has been
received.
UDP socket 7─The data has been sent.
UDP socket 7─The connection has
been closed.
UDP socket 7─Error flag
UDP socket 8─The connection has
been started.
UDP socket 8─The data has been
received.
UDP socket 8─The data has been sent.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ ON

–

–

R

ON

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

2-25

A H 5 00 Prog r am m ing M an ua l

*SM1372
*SM1373
SM1374
*SM1392
↓
SM1423
*SM1424
↓
SM1455
*SM1456
↓
SM1487
*SM1488
↓
SM1519
*SM1520
↓
SM1551
*SM1552
↓
SM1583
*SM1584
*SM1585
*SM1586
*SM1587
*SM1588
*SM1589
*SM1590
*SM1591
*SM1592

*SM1593

2-26

Function

UDP socket 8─The connection has
been closed.
UDP socket 8─Error flag
Web setting error
PLC Link flag (slave 1)
↓
PLC Link flag (slave 32)
Data exchange in the PLC Link (slave
1)
↓
Data exchange in the PLC Link (slave
32)
A read error in the PLC Link (slave 1)
↓
A read error in the PLC Link (slave 32)
A write error in the PLC Link (slave 1)
↓
A write error in the PLC Link (slave 32)
The data reading in the PLC Link is
complete. (slave 1)
↓
The data reading in the PLC Link is
complete. (slave 32)
The data writing in the PLC Link is
complete. (slave 1)
↓
The data writing in the PLC Link is
complete. (slave 32)
Starting a connection in the PLC Link
Assignment of the slaves by users in
the PLC Link
Automatic mode of the PLC Link
Manual mode of the PLC Link
Detection of the slaves in the PLC Link
PLC Link flag error
Device address error in the PLC Link
PLC Link timeout
The number of polling cycles in the PLC
Link is incorrect.
Standard Modbus communication
protocol is used in the PLC Link when
SM1593 is OFF, whereas AH
communication protocol is used in the
PLC Link when SM1593 is ON.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ ON

–

–

R

ON

X ○ OFF
X ○ OFF

–
–

–
–

R
R

OFF
OFF

○ ○ OFF

–

–

R/W

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R

OFF

○ ○ OFF

–

–

R/W

OFF

○ ○

–

–

–

R/W

OFF

–
–
OFF
OFF
OFF
OFF

–
–
–
–
–
–

–
–
–
–
–
–

R/W
R/W
R
R
R
R

OFF
OFF
OFF
OFF
OFF
OFF

○ ○ OFF

–

–

R

OFF

○ ○

–

–

R/W

OFF

○
○
○
○
○
○

○
○
○
○
○
○

–

Ch ap te r 2 De vices

*SM1594

*SM1595

*SM1596
*SM1597
*SM1598
SM1600
SM1601
SM1602
SM1603
SM1604
SM1605
SM1606
SM1607
SM1608
SM1609
SM1610
SM1611
SM1612
SM1613
SM1614

Function

The slaves are automatically detected
in the PLC Link in the current
environment. Only when the PLC Link is
in the stop mode can SM1594 be used.
OFF: The detection is complete or the
PLC is waiting to detect the slaves.
ON: The PLC is detecting the slaves.
The slave IDs are assigned by users
when SM1595 is ON, whereas they are
assigned automatically when SM1595
is OFF.
There is an operation error in the PLC
Link.
When SM1597 is ON, the extension
port is used in the PLC Link.
When SM1598 is ON, the function of
reading/writing synchronously in the
PLC Link is enabled.
The data is sent by using the instruction
READ 1.
The PLC waits for the data after the
instruction READ 1 is used.
The data is received by using the
instruction READ 1.
An error occurs when the instruction
READ 1 is used.
There is a timeout after the instruction
READ 1 is used.
The data is sent by using the instruction
READ 2.
The PLC waits for the data after the
instruction READ 2 is used.
The data is received by using the
instruction READ 2.
An error occurs when the instruction
READ 1 is used.
There is a timeout after the instruction
READ 2 is used.
The data is sent by using the instruction
READ 3.
The PLC waits for the data after the
instruction READ 3 is used.
The data is received by using the
instruction READ 3.
An error occurs when the instruction
READ 3 is used.
There is a timeout after the instruction
READ 3 is used.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

○ ○ OFF

–

–

R/W

OFF

○ ○

–

–

R/W

OFF

○ ○ OFF

–

–

R

OFF

○ ○

–

–

–

R/W

OFF

○ ○

–

–

–

R/W

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

–

2-27

A H 5 00 Prog r am m ing M an ua l

SM1615
SM1616
SM1617
SM1618
SM1619
SM1620
SM1621
SM1622
SM1623
SM1624
SM1625
SM1626
SM1627
SM1628
SM1629
SM1630
SM1631
SM1632
SM1633
SM1634
SM1635
SM1636
SM1637
SM1638

2-28

Function

The data is sent by using the instruction
READ 4.
The PLC waits for the data after the
instruction READ 4 is used.
The data is received by using the
instruction READ 4.
An error occurs when the instruction
READ 4 is used.
There is a timeout after the instruction
READ 4 is used.
The data is sent by using the instruction
READ 5.
The PLC waits for the data after the
instruction READ 5 is used.
The data is received by using the
instruction READ 5.
An error occurs when the instruction
READ 5 is used.
There is a timeout after the instruction
READ 5 is used.
The data is sent by using the instruction
READ 6.
The PLC waits for the data after the
instruction READ 6 is used.
The data is received by using the
instruction READ 6.
An error occurs when the instruction
READ 6 is used.
There is a timeout after the instruction
READ 6 is used.
The data is sent by using the instruction
READ 7.
The PLC waits for the data after the
instruction READ 7 is used.
The data is received by using the
instruction READ 7.
An error occurs when the instruction
READ 7 is used.
There is a timeout after the instruction
READ 7 is used.
The data is sent by using the instruction
READ 8.
The PLC waits for the data after the
instruction READ 8 is used.
The data is received by using the
instruction READ 8.
An error occurs when the instruction
READ 8 is used.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

Ch ap te r 2 De vices

SM1639
SM1640
SM1641
SM1642
SM1643
SM1644
SM1645
SM1646
SM1647
SM1648
SM1649
SM1650
SM1651
SM1652
SM1653
SM1654
SM1655
SM1656
SM1657
SM1658
SM1659
SM1660
SM1661
SM1662

Function

There is a timeout after the instruction
READ 1 is used.
The data is sent by using the instruction
WRITE 1.
The PLC waits for the data after the
instruction WRITE 1 is used.
The data is received by using the
instruction WRITE 1.
An error occurs when the instruction
WRITE 1 is used.
There is a timeout after the instruction
WRITE 1 is used.
The data is sent by using the instruction
WRITE 2.
The PLC waits for the data after the
instruction WRITE 2 is used.
The data is received by using the
instruction WRITE 2.
An error occurs when the instruction
WRITE 2 is used.
There is a timeout after the instruction
WRITE 2 is used.
The data is sent by using the instruction
WRITE 3.
The PLC waits for the data after the
instruction WRITE 3 is used.
The data is received by using the
instruction WRITE 3.
An error occurs when the instruction
WRITE 3 is used.
There is a timeout after the instruction
WRITE 3 is used.
The data is sent by using the instruction
WRITE 4.
The PLC waits for the data after the
instruction WRITE 4 is used.
The data is received by using the
instruction WRITE 4.
An error occurs when the instruction
WRITE 4 is used.
There is a timeout after the instruction
WRITE 4 is used.
The data is sent by using the instruction
WRITE 5.
The PLC waits for the data after the
instruction WRITE 5 is used.
The data is received by using the
instruction WRITE 5.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

2-29

A H 5 00 Prog r am m ing M an ua l

SM1663
SM1664
SM1665
SM1666
SM1667
SM1668
SM1669
SM1670
SM1671
SM1672
SM1673
SM1674
SM1675
SM1676
SM1677
SM1678
SM1679
SM1680
SM1681
SM1682
SM1683
SM1684
SM1685
SM1686

2-30

Function

An error occurs when the instruction
WRITE 5 is used.
There is a timeout after the instruction
WRITE 5 is used.
The data is sent by using the instruction
WRITE 6.
The PLC waits for the data after the
instruction WRITE 6 is used.
The data is received by using the
instruction WRITE 6.
An error occurs when the instruction
WRITE 6 is used.
There is a timeout after the instruction
WRITE 6 is used.
The data is sent by using the instruction
WRITE 7.
The PLC waits for the data after the
instruction WRITE 7 is used.
The data is received by using the
instruction WRITE 7.
An error occurs when the instruction
WRITE 7 is used.
There is a timeout after the instruction
WRITE 7 is used.
The data is sent by using the instruction
WRITE 8.
The PLC waits for the data after the
instruction WRITE 8 is used.
The data is received by using the
instruction WRITE 8.
An error occurs when the instruction
WRITE 8 is used.
There is a timeout after the instruction
WRITE 8 is used.
The data is sent by using the instruction
RPASS 1.
The PLC waits for the data after the
instruction RPASS 1 is used.
The data is received by using the
instruction RPASS 1.
An error occurs when the instruction
RPASS 1 is used.
There is a timeout after the instruction
RPASS 1 is used.
The data is sent by using the instruction
RPASS 2.
The PLC waits for the data after the
instruction RPASS 2 is used.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

Ch ap te r 2 De vices

SM1687
SM1688
SM1689
SM1690
SM1691
SM1692
SM1693
SM1694
SM1695
SM1696
SM1697
SM1698
SM1699
SM1700
SM1701
SM1702
SM1703
SM1704
SM1705
SM1706
SM1707
SM1708
SM1709
SM1710

Function

The data is received by using the
instruction RPASS 2.
An error occurs when the instruction
RPASS 2 is used.
There is a timeout after the instruction
RPASS 2 is used.
The data is sent by using the instruction
RPASS 3.
The PLC waits for the data after the
instruction RPASS 3 is used.
The data is received by using the
instruction RPASS 3.
An error occurs when the instruction
RPASS 3 is used.
There is a timeout after the instruction
RPASS 3 is used.
The data is sent by using the instruction
RPASS 4.
The PLC waits for the data after the
instruction RPASS 4 is used.
The data is received by using the
instruction RPASS 4.
An error occurs when the instruction
RPASS 4 is used.
There is a timeout after the instruction
RPASS 4 is used.
The data is sent by using the instruction
RPASS 5.
The PLC waits for the data after the
instruction RPASS 5 is used.
The data is received by using the
instruction RPASS 5.
An error occurs when the instruction
RPASS 5 is used.
There is a timeout after the instruction
RPASS 5 is used.
The data is sent by using the instruction
RPASS 6.
The PLC waits for the data after the
instruction RPASS 5 is used.
The data is received by using the
instruction RPASS 5.
An error occurs when the instruction
RPASS 5 is used.
There is a timeout after the instruction
RPASS 5 is used.
The data is sent by using the instruction
RPASS 7.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

2-31

A H 5 00 Prog r am m ing M an ua l

Function

The PLC waits for the data after the
instruction RPASS 7 is used.
The data is received by using the
SM1712
instruction RPASS 7.
An error occurs when the instruction
SM1713
RPASS 7 is used.
There is a timeout after the instruction
SM1714
RPASS 7 is used.
The data is sent by using the instruction
SM1715
RPASS 8.
The PLC waits for the data after the
SM1716
instruction RPASS 7 is used.
The data is received by using the
SM1717
instruction RPASS 7.
An error occurs when the instruction
SM1718
RPASS 7 is used.
There is a timeout after the instruction
SM1719
RPASS 7 is used.
SM1769 Status of the Ether Link
*SM1770 Starting the Ether Link (CPU)
*SM1772 Starting the Ether Link (port 0)
↓
↓
SM1787 Starting the Ether Link (port 15)
SM1711

*SM1788 Ether Link error flag (CPU)
*SM1790
↓
SM1805
*SM1806
*SM1808
↓
SM1823
SM1824
↓
SM1951
*SM2000
*SM2001
*SM2002
*SM2003
*SM2004
*SM2005

2-32

Ether Link error flag (port 0)
↓
Ether Link error flag (port 15)
Status of the Ether Link (CPU)
Status of the Ether Link (port 0)
↓
Status of the Ether Link (port 15)
The data exchange in block 1 in the
Ether Link is active.
↓
The data exchange in block 128 in the
Ether Link is active.
The data is sent by using the instruction
EMDRW 1.
The PLC waits for the data after the
instruction EMDRW 1 is used.
The data is received by using the
instruction EMDRW 1.
An error occurs when the instruction
EMDRW 1 is used.
There is a timeout after the instruction
EMDRW 1 is used.
The connection is closed after the
instruction EMDRW 1 is used.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF
X ○ OFF

–
–

–
–

R
R/W

OFF
OFF

X ○ OFF

–

–

R/W

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF

–

–

R

OFF

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ ON

ON

R

ON

ON

Ch ap te r 2 De vices

*SM2006
*SM2007
*SM2008
*SM2009
*SM2010
*SM2011
*SM2012
*SM2013
*SM2014
*SM2015
*SM2016
*SM2017
*SM2018
*SM2019
*SM2020
*SM2021
*SM2022
*SM2023
*SM2024
*SM2025
*SM2026
*SM2027
*SM2028
*SM2029

Function

The data is sent by using the instruction
EMDRW 2.
The PLC waits for the data after the
instruction EMDRW 2 is used.
The data is received by using the
instruction EMDRW 2.
An error occurs when the instruction
EMDRW 2 is used.
There is a timeout after the instruction
EMDRW 2 is used.
The connection is closed after the
instruction EMDRW 2 is used.
The data is sent by using the instruction
EMDRW 3.
The PLC waits for the data after the
instruction EMDRW 3 is used.
The data is received by using the
instruction EMDRW 3.
An error occurs when the instruction
EMDRW 3 is used.
There is a timeout after the instruction
EMDRW 3 is used.
The connection is closed after the
instruction EMDRW 3 is used.
The data is sent by using the instruction
EMDRW 4.
The PLC waits for the data after the
instruction EMDRW 4 is used.
The data is received by using the
instruction EMDRW 4.
An error occurs when the instruction
EMDRW 4 is used.
There is a timeout after the instruction
EMDRW 4 is used.
The connection is closed after the
instruction EMDRW 4 is used.
The data is sent by using the instruction
EMDRW 5.
The PLC waits for the data after the
instruction EMDRW 5 is used.
The data is received by using the
instruction EMDRW 5.
An error occurs when the instruction
EMDRW 5 is used.
There is a timeout after the instruction
EMDRW 5 is used.
The connection is closed after the
instruction EMDRW 5 is used.

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ ON

ON

ON

R

ON

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ ON

ON

ON

R

ON

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ ON

ON

ON

R

ON

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R/W

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ OFF OFF

OFF

R

OFF

X ○ ON

ON

R

ON

ON

2-33

A H 5 00 Prog r am m ing M an ua l

Function

CPU5X0-EN
CPU5X0-RS2

SM

OFF STOP RUN



Attribute Default
ON RUN STOP

The data is sent by using the instruction
X ○ OFF OFF OFF
R/W
OFF
EMDRW 6.
The PLC waits for the data after the
*SM2031
X ○ OFF OFF OFF
R
OFF
instruction EMDRW 6 is used.
The data is received by using the
*SM2032
X ○ OFF OFF OFF
R/W
OFF
instruction EMDRW 6.
An error occurs when the instruction
*SM2033
X ○ OFF OFF OFF
R
OFF
EMDRW 6 is used.
There is a timeout after the instruction
*SM2034
X ○ OFF OFF OFF
R
OFF
EMDRW 6 is used.
The connection is closed after the
*SM2035
X ○ ON ON
ON
R
ON
instruction EMDRW 6 is used.
The data is sent by using the instruction
*SM2036
X ○ OFF OFF OFF
R/W
OFF
EMDRW 7.
The PLC waits for the data after the
*SM2037
X ○ OFF OFF OFF
R
OFF
instruction EMDRW 7 is use.
The data is received by using the
*SM2038
X ○ OFF OFF OFF
R/W
OFF
instruction EMDRW 7.
An error occurs when the instruction
*SM2039
X ○ OFF OFF OFF
R
OFF
EMDRW 7 is used.
There is a timeout after the instruction
*SM2040
X ○ OFF OFF OFF
R
OFF
EMDRW 7 is used.
The connection is closed after the
*SM2041
X ○ ON ON
ON
R
ON
instruction EMDRW 7 is used.
The data is sent by using the instruction
*SM2042
X ○ OFF OFF OFF
R/W
OFF
EMDRW 8.
The PLC waits for the data after the
*SM2043
X ○ OFF OFF OFF
R
OFF
instruction EMDRW 8 is used.
The data is received by using the
*SM2044
X ○ OFF OFF OFF
R/W
OFF
instruction EMDRW 8.
An error occurs when the instruction
*SM2045
X ○ OFF OFF OFF
R
OFF
EMDRW 8 is used.
There is a timeout after the instruction
*SM2046
X ○ OFF OFF OFF
R
OFF
EMDRW 8 is used.
The connection is closed after the
*SM2047
X ○ ON ON
ON
R
ON
instruction EMDRW 8 is used.
Note: As to the SM numbers marked “*”, users can refer to the additional remarks on special
auxiliary relays/special data registers.
*SM2030

2.2.8

Refresh Time of Special Auxiliary Relays

Special auxiliary relay
SM0~SM1

SM5

2-34

Refresh time
The system automatically sets the flag to ON and resets it to OFF.
The flag is automatically set to ON when there is an operation error.
The system automatically sets SM5 to ON and resets it to OFF.
(1) SM5 is refreshed when the program is rewritten in the PLC.
(2) SM5 is refreshed when the PLC is supplied with power and starts to
run for the first time.

Ch ap te r 2 De vices

Special auxiliary relay
SM8
SM9
SM10
SM22, SM23, and
SM24
SM25~SM26
SM96~SM97
SM98~SM99
SM100~SM101
SM102~SM103
SM104~SM105
SM106~SM107
SM204~SM205
SM206
SM209
SM210
SM211
SM212
SM215
SM220
SM400~SM401
SM402~SM403
SM404
SM405
SM406
SM407

Refresh time
The system automatically sets SM8 to ON and resets it to OFF.
SM8 is automatically set to ON when there is a watchdog timer error.
The system automatically sets SM9 to ON and resets it to OFF.
SM9 is automatically set to ON when there is a system error.
The system automatically sets SM10 to ON and resets it to OFF.
SM10 is automatically set to ON when there is an I/O bus error.
Users set the flag to ON, and the system automatically resets it to OFF.
The log is cleared when the flag is ON.
The system automatically sets the flag to ON and resets it to OFF.
The flag is refreshed every scan cycle.
Users set the flag to ON. After the data is sent, the system automatically
resets the flag to OFF.
The system automatically sets the flag to ON and resets it to OFF.
The flag is automatically set to ON when the command is sent.
The system automatically sets the flag to ON, and users reset it to OFF.
The flag is set to ON when the command is received.
The system automatically sets the flag to ON, and users reset it to OFF.
The flag is automatically set to ON when the command received is wrong.
The system automatically sets the flag to ON, and users reset it to OFF.
The flag is set to ON when there is a receive timeout.
Users set the flag to ON and reset it to OFF.
ON: The 8-bit mode
OFF: The 16-bit mode
Users set the flag to ON, and the system automatically resets it to OFF.
ON: Clearing the non-latched/latched areas
Users set SM206 to ON and reset it to OFF.
ON: Inhibiting all output
Users set SM209 to ON, and the system automatically resets it to OFF.
ON: The communication protocol of COM1 changes.
Users set SM210 to ON and reset it to OFF.
ON: The RTU mode
Users set SM211 to ON, and the system automatically resets it to OFF.
ON: The communication protocol of COM2 changes.
Users set SM212 to ON and reset it to OFF.
ON: The RTU mode
Users set SM215 to ON and reset it to OFF.
ON: The PLC runs.
Users set SM220 to ON and reset it to OFF.
ON: Calibrating the real-time clock within ±30 seconds
The system automatically sets the flag to ON and resets it to OFF.
The flag is refreshed every scan cycle.
The system automatically sets the flag to ON and resets it to OFF.
The flag is refreshed whenever the instruction END is executed.
The system automatically sets the flag to ON and resets it to OFF.
SM404 is refreshed every 5 milliseconds.
The system automatically sets SM405 to ON and resets it to OFF.
SM405 is refreshed every 50 milliseconds.
The system automatically sets SM406 to ON and resets it to OFF.
SM406 is refreshed every 100 milliseconds.
The system automatically sets SM407 to ON and resets it to OFF.
SM407 is refreshed every 500 seconds.

2-35

A H 5 00 Prog r am m ing M an ua l

Special auxiliary relay
SM408
SM409
SM410
SM450
SM451
SM452
SM453
SM600~SM602
SM603
SM604
SM605
SM606
SM607
SM608
SM609
SM610~SM611
SM612~SM613
SM614
SM615~SM617
SM618
SM619
SM620
SM621~SM686
SM687
SM688
SM690~SM691
SM692
SM693
SM694
SM695 and SM1000
SM1090
SM1091
SM1106
SM1107
SM1108
SM1109

2-36

Refresh time
The system automatically sets SM408 to ON and resets it to OFF.
SM408 is refreshed every second.
The system automatically sets SM409 to ON and resets it to OFF.
SM409 is refreshed every n seconds, n is specified by SR409.
The system automatically sets SM410 to ON and resets it to OFF.
SM410 is refreshed every n seconds, and n is specified by SR410.
The system automatically sets SM450 to ON and resets it to OFF.
ON: The memory card is inserted into the PLC.
Users set SM451 to ON and reset it to OFF.
ON: The memory card is write protected.
The system automatically sets SM452 to ON and resets it to OFF.
ON: The data in the memory card is being accessed.
The system automatically sets SM453 to ON and resets it to OFF.
ON: An error occurs during the operation of the memory card.
The system automatically sets the flag to ON and resets it to OFF.
The flag is refreshed when the instruction is executed.
The system automatically sets SM603 to ON and resets it to OFF.
SM603 is refreshed when the instruction SORT is executed.
Users set SM604 to ON and reset it to OFF.
SM604 is refreshed when the instruction SORT whose mode is the
descending order is executed.
Users set SM605 to ON and reset it to OFF.
Users set SM606 to ON and reset it to OFF.
ON: The 8-bit mode
Users set SM607 to ON or OFF.
SM608 is refreshed when the instruction is executed.
Users set the flag to ON or OFF.
The flag is refreshed when the instruction is executed.
Users set the flag to ON or OFF.
SM614 is refreshed when the instruction is executed.
Users set the flag to ON or OFF.
SM618 is refreshed when the instruction is executed.
SM619 is refreshed when EI or DI is executed.
SM620 is refreshed when the instruction CMPT is executed.
Users set the flag to ON or OFF.
SM687 is refreshed when the instruction RAMP is executed.
SM688 is refreshed when the instruction INCD is executed.
Users set the flag to ON or OFF.
SM692 is refreshed when the instruction HKY is executed.
SM693 is refreshed when the instruction SEGL is executed.
SM694 is refreshed when the instruction DSW is executed.
Users set the flag to ON or OFF.
SM1090 is ON when the TCP connection is busy.
SM1091 is ON when the UDP connection is busy.
SM1106 is ON when the PHY initialization fails.
SM1107 is ON when the IP address, the netmask address, and the
gateway address are set incorrectly.
SM1108 is ON when there is a filter setting error.
SM1109 is ON when the function of the socket is enabled and the same
port is used.

Ch ap te r 2 De vices

Special auxiliary relay
SM1112
SM1113
SM1116
SM1117
SM1118
SM1119
SM1120
SM1121
SM1122
SM1123
SM1124
SM1125
SM1126
SM1127
SM1128
SM1129
SM1130
SM1131
SM1132
SM1133
SM1134
SM1135
SM1136
SM1137
SM1138
SM1139
SM1140
SM1141
SM1142
SM1143
SM1144
SM1145
SM1146
SM1147

Refresh time
SM1112 is ON when there is a setting error.
SM1113 is ON when there is a server error.
SM1116 is ON when the trigger of the PLC parameter is enabled.
SM1117 is ON when the trigger of the PLC parameter is triggered.
SM1118 is ON when the trigger is enabled and no mail has been sent.
SM1119 is ON when the trigger is enabled and the last mail has been sent
successfully.
SM1120 is ON when the trigger is enabled and the last mail has been sent
in error.
SM1121 is ON when the trigger is enabled and the mail has been sent.
SM1122 is ON when the trigger is enabled and there is an SMTP server
response timeout.
SM1123 is ON when the trigger is enabled and there is an SMTP server
response error.
SM1124 is ON when the trigger is enabled and the size of the attachment
exceeds the limit.
SM1125 is ON when the trigger is enabled and the attachment is not
found.
SM1126 is ON when the trigger of the PLC parameter is enabled.
SM1127 is ON when the trigger of the PLC parameter is triggered.
SM1128 is ON when the trigger is enabled and no mail has been sent.
SM1129 is ON when the trigger is enabled and the last mail has been sent
successfully.
SM1130 is ON when the trigger is enabled and the last mail has been sent
in error.
SM1131 is ON when the trigger is enabled and the mail has been sent.
SM1132 is ON when the trigger is enabled and there is an SMTP server
response timeout.
SM1133 is ON when the trigger is enabled and there is an SMTP server
response error.
SM1134 is ON when the trigger is enabled and the size of the attachment
exceeds the limit.
SM1135 is ON when the trigger is enabled and the attachment is not
found.
SM1136 is ON when the trigger of the PLC parameter is enabled.
SM1137 is ON when the trigger of the PLC parameter is triggered.
SM1138 is ON when the trigger is enabled and no mail has been sent.
SM1139 is ON when the trigger is enabled and the last mail has been sent
successfully.
SM1140 is ON when the trigger is enabled and the last mail has been sent
in error.
SM1141 is ON when the trigger is enabled and the mail has been sent.
SM1142 is ON when the trigger is enabled and there is an SMTP server
response timeout.
SM1143 is ON when the trigger is enabled and there is an SMTP server
response error.
SM1144 is ON when the trigger is enabled and the size of the attachment
exceeds the limit.
SM1145 is ON when the trigger is enabled and the attachment is not
found.
SM1146 is ON when the trigger of the PLC parameter is enabled.
SM1147 is ON when the trigger of the PLC parameter is triggered.

2-37

A H 5 00 Prog r am m ing M an ua l

Special auxiliary relay
Refresh time
SM1148
SM1148 is ON when the trigger is enabled and no mail has been sent.
SM1149 is ON when the trigger is enabled and the last mail has been sent
SM1149
successfully.
SM1150 is ON when the trigger is enabled and the last mail has been sent
SM1150
in error.
SM1151
SM1151 is ON when the trigger is enabled and the mail has been sent.
SM1152 is ON when the trigger is enabled and there is an SMTP server
SM1152
response timeout.
SM1153 is ON when the trigger is enabled and there is an SMTP server
SM1153
response error.
SM1154 is ON when the trigger is enabled and the size of the attachment
SM1154
exceeds the limit.
SM1155 is ON when the trigger is enabled and the attachment is not
SM1155
found.
SM1156
SM1156 is ON when the trigger of the PLC parameter is enabled.
SM1157
SM1157 is ON when the trigger of the PLC parameter is triggered.
SM1158
SM1158 is ON when the trigger is enabled and no mail has been sent.
SM1159 is ON when the trigger is enabled and the last mail has been sent
SM1159
successfully.
SM1160 is ON when the trigger is enabled and the last mail has been sent
SM1160
in error.
SM1161
SM1161 is ON when the trigger is enabled and the mail has been sent.
SM1162 is ON when the trigger is enabled and there is an SMTP server
SM1162
response timeout.
SM1163 is ON when the trigger is enabled and there is an SMTP server
SM1163
response error.
SM1164 is ON when the trigger is enabled and the size of the attachment
SM1164
exceeds the limit.
SM1165 is ON when the trigger is enabled and the attachment is not
SM1165
found.
SM1166
SM1166 is ON when the trigger of the PLC parameter is enabled.
SM1167
SM1167 is ON when the trigger of the PLC parameter is triggered.
SM1168
SM1168 is ON when the trigger is enabled and no mail has been sent.
SM1169 is ON when the trigger is enabled and the last mail has been sent
SM1169
successfully.
SM1170 is ON when the trigger is enabled and the last mail has been sent
SM1170
in error.
SM1171
SM1171 is ON when the trigger is enabled and the mail has been sent.
SM1172 is ON when the trigger is enabled and there is an SMTP server
SM1172
response timeout.
SM1173 is ON when the trigger is enabled and there is an SMTP server
SM1173
response error.
SM1174 is ON when the trigger is enabled and the size of the attachment
SM1174
exceeds the limit.
SM1175 is ON when the trigger is enabled and the attachment is not
SM1175
found.
SM1176
SM1176 is ON when the trigger of the PLC parameter is enabled.
SM1177
SM1177 is ON when the trigger of the PLC parameter is triggered.
SM1178
SM1178 is ON when the trigger is enabled and no mail has been sent.
SM1179 is ON when the trigger is enabled and the last mail has been sent
SM1179
successfully.

2-38

Ch ap te r 2 De vices

Special auxiliary relay
SM1180
SM1181
SM1182
SM1183
SM1184
SM1185
SM1186
SM1187
SM1188
SM1189
SM1190
SM1191
SM1192
SM1193
SM1194
SM1195
SM1196
SM1270~SM1373
SM1374
SM1392
↓
SM1423

SM1424
↓
SM1455

SM1456
↓
SM1487

SM1488
↓
SM1519

Refresh time
SM1180 is ON when the trigger is enabled and the last mail has been sent
in error.
SM1181 is ON when the trigger is enabled and the mail has been sent.
SM1182 is ON when the trigger is enabled and there is an SMTP server
response timeout.
SM1183 is ON when the trigger is enabled and there is an SMTP server
response error.
SM1184 is ON when the trigger is enabled and the size of the attachment
exceeds the limit.
SM1185 is ON when the trigger is enabled and the attachment is not
found.
SM1186 is ON when the trigger of the PLC parameter is enabled.
SM1187 is ON when the trigger of the PLC parameter is triggered.
SM1188 is ON when the trigger is enabled and no mail has been sent.
SM1189 is ON when the trigger is enabled and the last mail has been sent
successfully.
SM1190 is ON when the trigger is enabled and the last mail has been sent
in error.
SM1191 is ON when the trigger is enabled and the mail has been sent.
SM1192 is ON when the trigger is enabled and there is an SMTP server
response timeout.
SM1193 is ON when the trigger is enabled and there is an SMTP server
response error.
SM1194 is ON when the trigger is enabled and the size of the attachment
exceeds the limit.
SM1195 is ON when the trigger is enabled and the attachment is not
found.
SM1196 is ON when there is a socket configuration error.
The flag is refreshed when the socket function is executed.
Users set SM1374 to ON and reset it to OFF.
SM1392 is ON when the PLC Link is enabled and the master connects to
slave 1.
↓
SM1423 is ON when the PLC Link is enabled and the master connects to
slave 32.
SM1424 is ON when the PLC Link is enabled and the master accesses
the data in slave 1.
↓
SM1455 is ON when the PLC Link is enabled and the master accesses
the data in slave 32.
SM1456 is ON when the PLC Link is enabled and an error occurs in the
reading of the data from slave 1
↓
SM1487 is ON when the PLC Link is enabled and an error occurs in the
reading of the data from slave 32.
SM1488 is ON when the PLC Link is enabled and an error occurs in the
writing of the data into slave 1.
↓
SM1519 is ON when the PLC Link is enabled and an error occurs in the
writing of the data into slave 32.

2-39

A H 5 00 Prog r am m ing M an ua l

Special auxiliary relay

Refresh time
SM1520 is ON when the PLC Link is enabled and the master finishes
SM1520
reading the data from slave 1.
↓
↓
SM1551
SM1551 is ON when the PLC Link is enabled and the master finishes
reading the data from slave 32.
SM1552 is ON when the PLC Link is enabled and the master finishes
SM1552
writing the data into slave 1.
↓
↓
SM1583
SM1583 is ON when the PLC Link is enabled and the master finishes
writing the data into slave 32.
SM1584~SM1587
Users set the flag ON and reset it OFF.
SM1588
SM1588 is ON when the master detects the slaves.
SM1589
SM1589 is ON when an error occurs.
SM1590
SM1590 is ON when there is a device address error.
SM1591
SM1591 is ON when there is a timeout.
SM1592
SM1592 is ON when the number of polling cycles is incorrect.
SM1593~SM1595
Users set the flag to ON and reset it to OFF.
SM1596
SM1596 is ON when there is an operation error in the PLC Link
SM1597~SM1598
Users set the flag to ON and reset it to OFF.
SM1600
Users set SM1600 to ON and reset it to OFF.
SM1601~SM1602
The flag is refreshed when the instruction READ is executed.
SM1603 is refreshed when the instruction READ is executed and an error
SM1603
occurs.
SM1604 is refreshed when the instruction READ is executed and there is
SM1604
a response timeout.
SM1605
Users set SM1605 to ON and reset it to OFF.
SM1606~SM1607
The flag is refreshed when the instruction READ is executed.
SM1608 is refreshed when the instruction READ is executed and an error
SM1608
occurs.
SM1609 is refreshed when the instruction READ is executed and there is
SM1609
a response timeout.
SM1610
Users set SM1610 to ON and reset it to OFF.
SM1611~SM1612
The flag is refreshed when the instruction READ is executed.
SM1613 is refreshed when the instruction READ is executed and an error
SM1613
occurs.
SM1614 is refreshed when the instruction READ is executed and there is
SM1614
a response timeout.
SM1615
Users set SM1615 to ON and reset it to OFF.
SM1616~SM1617
The flag is refreshed when the instruction READ is executed.
SM1618 is refreshed when the instruction READ is executed and an error
SM1618
occurs.
SM1619 is refreshed when the instruction READ is executed and there is
SM1619
a response timeout.
SM1620
Users set SM1620 to ON and reset it to OFF.
SM1621~SM1622
The flag is refreshed when the instruction READ is executed.
SM1623 is refreshed when the instruction READ is executed and an error
SM1623
occurs.
SM1624 is refreshed when the instruction READ is executed and there is
SM1624
a response timeout.
SM1625
Users set SM1625 to ON and reset it to OFF.
SM1626 and SM1627 The flag is refreshed when the instruction READ is executed.

2-40

Ch ap te r 2 De vices

Special auxiliary relay
SM1628
SM1629
SM1630
SM1631~SM1632
SM1633
SM1634
SM1635
SM1636~SM1637
SM1638
SM1639
SM1640
SM1641~SM1642
SM1643
SM1644
SM1645
SM1646~SM1647
SM1648
SM1649
SM1650
SM1651~SM1652
SM1653
SM1654
SM1655
SM1656~SM1657
SM1658
SM1659
SM1660
SM1661~SM1662
SM1663
SM1664
SM1665
SM1666~SM1667
SM1668
SM1669

Refresh time
SM1603 is refreshed when the instruction READ is executed and an error
occurs.
SM1604 is refreshed when the instruction READ is executed and there is
a response timeout.
Users set SM1630 to ON and reset it to OFF.
The flag is refreshed when the instruction READ is executed.
SM1633 is refreshed when the instruction READ is executed and an error
occurs.
SM1634 is refreshed when the instruction READ is executed and there is
a response timeout.
Users set SM1635 to ON and reset it to OFF.
The flag is refreshed when the instruction READ is executed.
SM1638 is refreshed when the instruction READ is executed and an error
occurs.
SM1639 is refreshed when the instruction READ is executed and there is
a response timeout.
Users set SM1640 to ON and reset it to OFF.
The flag is refreshed when the instruction WRITE is executed.
SM1643 is refreshed when the instruction WRITED is executed and an
error occurs.
SM1644 is refreshed when the instruction WRITE is executed and there is
a response timeout.
Users set SM1645 to ON and reset it to OFF.
The flag is refreshed when the instruction WRITE is executed.
SM1648 is refreshed when the instruction WRITE is executed and an
error occurs.
SM1649 is refreshed when the instruction WRITE is executed and there is
a response timeout.
Users set SM1650 to ON and reset it to OFF.
The flag is refreshed when the instruction WRITE is executed.
SM1653 is refreshed when the instruction WRITE is executed and an
error occurs.
SM1654 is refreshed when the instruction WRITE is executed and there is
a response timeout.
Users set SM1655 to ON and reset it to OFF.
The flag is refreshed when the instruction WRITE is executed.
SM1658 is refreshed when the instruction WRITE is executed and an
error occurs.
SM1659 is refreshed when the instruction WRITE is executed and there is
a response timeout.
Users set SM1660 to ON and reset it to OFF.
The flag is refreshed when the instruction WRITE is executed.
SM1663 is refreshed when the instruction WRITE is executed and an
error occurs.
SM1664 is refreshed when the instruction WRITE is executed and there is
a response timeout.
Users set SM1665 to ON and reset it to OFF.
The flag is refreshed when the instruction WRITE is executed.
SM1668 is refreshed when the instruction WRITE is executed and an
error occurs.
SM1669 is refreshed when the instruction WRITE is executed and there is
a response timeout.

2-41

A H 5 00 Prog r am m ing M an ua l

Special auxiliary relay
Refresh time
SM1670
Users set SM1670 to ON and reset it to OFF.
SM1671~SM1672
The flag is refreshed when the instruction WRITE is executed.
SM1673 is refreshed when the instruction WRITE is executed and an
SM1673
error occurs.
SM1674 is refreshed when the instruction WRITE is executed and there is
SM1674
a response timeout.
SM1675
Users set SM1675 to ON and reset it to OFF.
SM1676~SM1677
The flag is refreshed when the instruction WRITE is executed.
SM1678 is refreshed when the instruction WRITE is executed and an
SM1678
error occurs.
SM1679 is refreshed when the instruction WRITE is executed and there is
SM1679
a response timeout.
SM1680
Users set SM1680 to ON and reset it to OFF.
SM1681~SM1682
The flag is refreshed when the instruction RPASS is executed.
SM1683 is refreshed when the instruction RPASS is executed and an
SM1683
error occurs.
SM1684 is refreshed when the instruction RPASS is executed and there
SM1684
is a response timeout.
SM1685
Users set SM1685 to ON and reset it to OFF.
SM1686~SM1687
The flag is refreshed when the instruction RPASS is executed.
SM1688 is refreshed when the instruction RPASS is executed and an
SM1688
error occurs.
SM1689 is refreshed when the instruction RPASS is executed and there
SM1689
is a response timeout.
SM1690
Users set SM1690 to ON and reset it to OFF.
SM1691~SM1692
The flag is refreshed when the instruction RPASS is executed.
SM1693 is refreshed when the instruction RPASS is executed and an
SM1693
error occurs.
SM1694 is refreshed when the instruction RPASS is executed and there
SM1694
is a response timeout.
SM1695
Users set SM1695 to ON and reset it to OFF.
SM1696~SM1697
The flag is refreshed when the instruction RPASS is executed.
SM1698 is refreshed when the instruction RPASS is executed and an
SM1698
error occurs.
SM1699 is refreshed when the instruction RPASS is executed and there
SM1699
is a response timeout.
SM1700
Users set SM1700 to ON and reset it to OFF.
SM1701~SM1702
The flag is refreshed when the instruction RPASS is executed.
SM1703 is refreshed when the instruction RPASS is executed and an
SM1703
error occurs.
SM1704 is refreshed when the instruction RPASS is executed and there
SM1704
is a response timeout.
SM1705
Users set SM1705 to ON and reset it to OFF.
SM1706~SM1707
The flag is refreshed when the instruction RPASS is executed.
SM1708 is refreshed when the instruction RPASS is executed and an
SM1708
error occurs.
SM1709 is refreshed when the instruction RPASS is executed and there
SM1709
is a response timeout.
SM1710
Users set SM1710 to ON and reset it to OFF.
SM1711~SM1712
The flag is refreshed when the instruction RPASS is executed.
SM1713 is refreshed when the instruction RPASS is executed and an
SM1713
error occurs.

2-42

Ch ap te r 2 De vices

Special auxiliary relay
SM1714
SM1715
SM1716~SM1717
SM1718
SM1719
SM1769
SM1770~SM1788
SM1790~SM1805
SM1806~SM1823
SM1824~SM1951
SM2000
SM2001~SM2002
SM2003
SM2004
SM2005
SM2006~SM2007
SM2008
SM2009
SM2010
SM2011~SM2012
SM2013
SM2014
SM2015
SM2016~SM2017
SM2018
SM2019
SM2020
SM2021~SM2022
SM2023
SM2024
SM2025
SM2026~SM2027
SM2028
SM2029
SM2030

Refresh time
SM1714 is refreshed when the instruction RPASS is executed and there
is a response timeout.
Users set SM1715 to ON and reset it to OFF.
The flag is refreshed when the instruction RPASS is executed.
SM1718 is refreshed when the instruction RPASS is executed and an
error occurs.
SM1719 is refreshed when the instruction RPASS is executed and there
is a response timeout.
SM1769 is ON when there is an error in the Ether Link.
Users set the flag to ON and reset it to OFF.
The flag is ON when an error occurs in the corresponding communication
port.
The flag is ON when the Ether Link function of the corresponding
communication port is enabled.
The flag is refreshed every scan cycle.
Users set SM2000 to ON and reset it to OFF.
The flag is refreshed when the instruction EMDRW is executed.
SM2003 is refreshed when the instruction EMDRW is executed and an
error occurs.
SM2004 is refreshed when the instruction EMDRW is executed and there
is a response timeout.
Users set SM2005 to ON and reset it to OFF.
The flag is refreshed when the instruction EMDRW is executed.
SM2008 is refreshed when the instruction EMDRW is executed and an
error occurs.
SM2009 is refreshed when the instruction EMDRW is executed and there
is a response timeout.
Users set SM2010 to ON and reset it to OFF.
The flag is refreshed when the instruction EMDRW is executed.
SM2013 is refreshed when the instruction EMDRW is executed and an
error occurs.
SM2014 is refreshed when the instruction EMDRW is executed and there
is a response timeout.
Users set SM2015 to ON and reset it to OFF.
The flag is refreshed when the instruction EMDRW is executed.
SM2018 is refreshed when the instruction EMDRW is executed and an
error occurs.
SM2019 is refreshed when the instruction EMDRW is executed and there
is a response timeout.
Users set SM2020 to ON and reset it to OFF.
The flag is refreshed when the instruction EMDRW is executed.
SM2023 is refreshed when the instruction EMDRW is executed and an
error occurs.
SM2024 is refreshed when the instruction EMDRW is executed and there
is a response timeout.
Users set SM2025 to ON and reset it to OFF.
The flag is refreshed when the instruction EMDRW is executed.
SM2028 is refreshed when the instruction EMDRW is executed and an
error occurs.
SM2029 is refreshed when the instruction EMDRW is executed and there
is a response timeout.
Users set SM2030 to ON and reset it to OFF.

2-43

A H 5 00 Prog r am m ing M an ua l

Special auxiliary relay
Refresh time
SM2031~SM2032
The flag is refreshed when the instruction EMDRW is executed.
SM2033 is refreshed when the instruction EMDRW is executed and an
SM2033
error occurs.
SM2034 is refreshed when the instruction EMDRW is executed and there
SM2034
is a response timeout.
SM2035
Users set SM2035 to ON and reset it to OFF.
SM2036~SM2037
The flag is refreshed when the instruction EMDRW is executed.
SM2038 is refreshed when the instruction EMDRW is executed and an
SM2038
error occurs.
SM2039 is refreshed when the instruction EMDRW is executed and there
SM2039
is a response timeout.
SM2040
Users set SM2040 to ON and reset it to OFF.
SM2041~SM2042
The flag is refreshed when the instruction EMDRW is executed.
SM2043 is refreshed when the instruction EMDRW is executed and an
SM2043
error occurs.
SM2044 is refreshed when the instruction EMDRW is executed and there
SM2044
is a response timeout.
SM2045
Users set SM2045 to ON and reset it to OFF.
SM2046~SM2047
The flag is refreshed when the instruction EMDRW is executed.

2.2.9

Stepping Relays

The function of the stepping relay:
The stepping relay can be easily used in the industrial automation to set the procedure. It is the most
basic device in the sequential function chart (SFC). Please refer to ISPSoft User Manual for more
information related to sequential function charts.
There are 2048 stepping relays, i.e. S0~S2047. Every stepping relay is like an output relay in that it
has an output coil, contact A, and contact B. It can be used several times in the program, but it can
not directly drive the external load. Besides, the stepping relay can be used as a general auxiliary
relay when it is not used in the sequential function chart.

2.2.10 Timers
1.
2.
3.
4.
5.
6.
7.
8.
9.

2-44

100 millisecond timer: The timer specified by the instruction TMR takes 100 milliseconds as the
timing unit.
1 millisecond timer: The timer specified by the instruction TMRH takes 1 millisecond as the
timing unit.
The timers for the subroutine’s exclusive use are T1920~T2047.
The accumulative timers are ST0~ST2047. If users want to use the device-monitoring function,
they can monitor T0~T2047.
If the same timer is used repeatedly in the program, including in different instructions TMR and
TMRH, the setting value is the one that the value of the timer matches first.
If the same timer is used repeatedly in the program, it is OFF when one of the conditional
contacts is OFF.
If the same timer is used repeatedly in the program as the timer for the subroutine’s exclusive
use and the accumulative timer in the program, it is OFF when one of the conditional contacts
is OFF.
When the timer is switched from ON to OFF and the conditional contact is ON, the timer is reset
and counts again.
When the instruction TMR is executed, the specified timer coil is ON and the timer begins to
count. As the value of the timer matches the setting value, the state of the contact is as follows.
Normally open (NO) contact
ON
Normally closed (NC) contact
OFF

Ch ap te r 2 De vices
A.

The general-purpose timer
When the instruction TMR is executed, the general-purpose timer begins to count. As the value
of the timer matches the setting value, the output coil is ON.
 When X0.0 is ON, the timer T0 takes 100 milliseconds as the timing unit and counts up. As
the current value of the timer matches the setting value 100, the output coil of T0 is ON.
 When X0.0 is OFF or there is a power cut, the current value of the timer is reset to 0 and the
output coil is switched OFF.

B.

The accumulative timer
When the instruction TMR is executed, the accumulative timer begins to count. As the value of
the timer matches the setting value, the output coil is ON. As long as users add the letter S in
front of the letter T, the timer becomes the accumulative timer. When the conditional contact is
OFF, the value of the accumulative timer is not reset. When the conditional contact is ON, the
timer counts from the current value.
 When X0.0 is ON, the timer T250 takes 100 milliseconds as the timing unit and counts up.
As the current value of the timer matches the setting value 100, the output coil of T250 is
ON.
 When X0.0 is OFF or there is a power cut, the timer T250 stops counting and the current
value of the timer remains unchanged. Not until X0.0 is switched ON will the timer counts
again. When the timer counts up from the current value to the setting value 100, the output
coil of T250 is ON.

2-45

A H 5 00 Prog r am m ing M an ua l

C.

The timer used in the function block
T1920~T2047 are the timers which users can use in the functional block or the interrupt.
When the instruction TMR or END is executed, the timer used in the functional block begins to
count. As the value of the timer matches the setting value, the output coil is ON.
If the general-purpose timer is used in the functional block or the interrupt, and the functional is
not executed, the timer can not count correctly.

2.2.11 Counters
The characteristics of the 16-bit counter:
Item
16-bit counter
Type
General type
Number
C0~C2047
Direction
Counting up
Setting value
0~32,767
The setting value can be either the constant or the value in the
Specification of the setting value
data register.
The counter stops counting when the value of the counter
Change of the current value
matches the setting value.
The contact is ON when the value of the counter matches the
Output contact
setting value.
When the instruction RST is executed, the current value is
Reset
cleared to zero, and the contact is reset of OFF.
Action of the contact
After the scan is complete, the contact acts.
The function of the counter:
Each time the input switches from OFF to ON, the value of the counter increases by one increment.
When the value of the counter matches the setting value, the output coil is ON. Users can use either
the decimal constant or the value in the data register as the setting value.
The 16-bit counter:
1.
Setting range: 0~32,767 (The setting values 0 and 1 mean the same thing in that the output
contact is ON when the counter counts for the first time.)
2.
For the general-purpose counter, the current value of the counter is cleared when there is a
power cut. If the counter is the latched one, the current value of the counter and the state of
the contact before the power cut will be retained. The latched counter counts from the current
value when the power supply is restored.
3.
If users use the instruction MOV or ISPSoft to transmit a value bigger than the setting value to
the current value register C0, the contact of the counter C0 will be ON and the current value
will become the same as the setting value next time X0.1 is switched from OFF to ON.
4.
Users can use either the constant or the value in the register as the setting value of the
counter.
5.
The setting value of the counter can be a positive or a negative. If the counter counts up from
32,767, the next current value becomes -32,768.

2-46

Ch ap te r 2 De vices
Example:

1.
2.
3.

When X0.0 is ON, the instruction RST is executed, the current value of the counter C0 is
cleared to zero, and the output contact is reset to OFF.
If X0.1 is switched from OFF to ON, the counter will count up, i.e. the current value will
increase by one.
When the current value of the counter C0 matches the setting value 5, the contact of C0 is ON.
Even if X0.1 is still triggered, C0 does not accept the trigger signal, and the current value
remains 5.
X0 .0

X0 .1

5
4

Current v alue o f C0

3

Sett ing v alue

2
1
0

0

Y0 .0 a nd C0

2.2.12 32-bit Counters
The characteristics of the 32-bit counter:
Item
32-bit counter
Type
General type
Number
HC0~HC63
Direction
Counting up/down
setting value
-2,147,483,648~+2,147,483,647
The setting value can be either the constant or the value
Specification of the setting value
occupying two data registers.
The counter keeps counting after the value of the counter
Change of the current value
matches the setting value.
The contact is ON when the value of the addition counter
matches the setting value.
Output contact
The contact is reset to OFF when the value of the
subtraction counter matches the setting value.
When the instruction RST is executed, the current value is
Reset
cleared to zero, and the contact is reset of OFF.
Action of the contact
After the scan is complete, the contact acts.

2-47

A H 5 00 Prog r am m ing M an ua l
The 32-bit general-purpose addition/subtraction counter:
1.
Setting range: -2,147,483,648~2,147,483,647
2.
The switch between the 32-bit general-purpose addition counters and the 32-bit
general-purpose subtraction counters depends on the states of the special auxiliary relays
SM621~SM684. For example, the counter HC0 is the addition counter when SM621 is OFF,
whereas HC0 is the subtraction counter when SM621 is ON.
3.
Users can use either the constant or the value in the data registers as the setting value of the
counter, and the setting value can be a positive or a negative. If users use the value in the data
registers as the setting value of the counter, the setting value occupies two consecutive
registers.
4.
For the general-purpose counter, the current value of the counter is cleared when there is a
power cut. If the counter is the latched one, the current value of the counter and the state of
the contact before the power cut will be retained. The latched counter counts from the current
value when the power supply is restored.
5.
If the counter counts up from 2,147,483,647, the next current value becomes -2,147,483,648.
If the counter counts down from -2,147,483,648, the next current value becomes
2,147,483,647.
Example:

1.
2.
3.
4.
5.

2-48

X10.0 drives S621 to determine whether the counter HC0 is the addition counter or the
subtraction counter.
When X11.0 is switched from OFF to ON, the instruction RST is executed, the current value of
the counter HC0 is cleared to zero, and the contact is switched OFF.
When X12.0 is switched from OFF to ON, the current value of the counter increases or
decreases by one.
When the current value of the counter HC0 changes from -6 to -5, the contact of HC0 is
switched from OFF to ON. When the current value of the counter HC0 changes from -5 to -6,
the contact of HC0 is switched from ON to OFF.
If users use the instruction MOV or ISPSoft to transmit a value bigger than the setting value to
the current value register HC0, the contact of the counter HC0 will be ON and the current value
will become the same as the setting value next time X12.0 is switched from OFF to ON.

Ch ap te r 2 De vices

2.2.13 Data Registers
The data register stores the 16-bit data. The highest bit represents either a positive sign or a
negative sign, and the values which can be stored in the data registers range from -32,768 to
+32,767. Two 16-bit registers can be combined into a 32-bit register, i.e. (D+1, D) in which the
register whose number is smaller represents the low 16 bits. The highest bit represents either a
positive sign or a negative sign, and the values which can be stored in the data registers range from
-2,147,483,648 to +2,147,483,647. Besides, four 16-bit registers can be combined into a 64-bit
register, i.e. (D+3, D+2, D+1, D) in which the register whose number is smaller represents the lower
16 bits. The highest bit represents either a positive sign or a negative sign, and the values which can
be stored in the data registers range from -9,223,372,036,854,776 to +9,223,372,036,854,775,807.
The data registers also can be used to refresh the values in the control registers in the modules
other than digital I/O modules. Please refer to ISPSoft User Manual for more information regarding
refreshing the values in the control registers.
The registers can be classified into two types according to their properties:
1. General-purpose register: If the PLC begins to run, or is disconnected, the value in the register
will be cleared to zero. If users want to retain the data when the PLC begins to RUN, they can
refer to ISPSoft User Manual for more information. Please notice that the value will still be
cleared to zero if the PLC is disconnected.
2. Latched register: If the PLC is disconnected, the data in the latched register will not be cleared.
In other words, the value before the disconnection is still retained. If users want to clear the data
in the latched area, they can use RST or ZRST.

2.2.14 Special Data Registers
Every special data register has its definition and specific function. The system statuses and the error
messages are stored in the special data registers. Besides, the special data registers can be used
to monitor the system statuses. The special data registers and their functions are listed as follows.
As to the SR numbers marked “*”, users can refer to the additional remarks on special auxiliary
relays/special data registers. The “R” in the attribute column indicates that the special data register
can read the data, whereas the “R/W” in the attribute column indicates that it can read and write the
data. In addition, the mark “–” indicates that the status of the special data register does not make
any change. The mark “#” indicates that the system will be set according to the status of the PLC,
and users can read the setting value and refer to the related manual for more information.

2-49

A H 5 00 Prog r am m ing M an ua l

SR0
SR1
SR2
SR4
SR5
SR6
SR8
*SR40
*SR41
*SR42
*SR43
*SR44
*SR45
*SR46
*SR47
*SR48
*SR49
*SR50
*SR51
*SR52
*SR53
*SR54
*SR55
*SR56
*SR57
*SR58
*SR59
*SR60
*SR61
*SR62
*SR63
*SR64
*SR65
*SR66
SR67
SR68
SR69

2-50

Function

Error-detecting code of the PLC operation
error
The address of the operation error is
locked.
Error-detecting code of the grammar
check error

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

0

0

–

R

0

○ ○
○ ○

0
0

0
0

–
–

R
R

0
0

○ ○

0

0

–

R

0

Address of the instruction/operand check ○ ○
error
○ ○
Step address at which the watchdog timer
○ ○
is ON
Number of error logs
○ ○
Error log pointer
○ ○
Error log 1: The rack number and the slot
○ ○
number
Error log 1: The module ID
○ ○
Error log 1: The error code
○ ○
Error log 1: The year and the month
○ ○
Error log 1: The day and the hour
○ ○
Error log 1: The minute and the second
○ ○
Error log 2: The rack number and the slot
○ ○
number
Error log 2: The module ID
○ ○
Error log 2: The error code
○ ○
Error log 2: The year and the month
○ ○
Error log 2: The day and the hour
○ ○
Error log 2: The minute and the second
○ ○
Error log 3: The rack number and the slot
○ ○
number
Error log 3: The module ID
○ ○
Error log 3: The error code
○ ○
Error log 3: The year and the month
○ ○
Error log 3: The day and the hour
○ ○
Error log 3: The minute and the second
○ ○
Error log 4: The rack number and the slot
○ ○
number
Error log 4: The module ID
○ ○
Error log 4: The error code
○ ○
Error log 4: The year and the month
○ ○
Error log 4: The day and the hour
○ ○
Error log 4: The minute and the second
○ ○
Error log 4: The rack number and the slot
○ ○
number
Error log 5: The rack number and the slot
○ ○
number
Error log 5: The module ID
○ ○
Error log 5: The error code
○ ○

0
0

0
0

–
–

R
R

0
0

0

–

–

R

0

–
–

–
–

–
–

R
R

0
0

–

–

–

R

0

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

–

–

–

R

0

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

–

–

–

R

0

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

–

–

–

R

0

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

–

–

–

R

0

–

–

–

R

0

–
–

–
–

–
–

R
R

0
0

Ch ap te r 2 De vices

Function

SR70
SR71

Error log 5: The year and the month
Error log 5: The day and the hour
Error log 6: The rack number and the slot
number
Error log 6: The module ID
Error log 6: The error code
Error log 6: The year and the month
Error log 6: The day and the hour
Error log 6: The minute and the second
Error log 7: The rack number and the slot
number
Error log 7: The module ID
Error log 7: The error code
Error log 7: The year and the month
Error log 7: The day and the hour
Error log 7: The minute and the second
Error log 8: The rack number and the slot
number
Error log 8: The module ID
Error log 8: The error code
Error log 8: The year and the month
Error log 8: The day and the hour
Error log 8: The minute and the second
Error log 9: The rack number and the slot
number
Error log 9: The module ID
Error log 9: The error code
Error log 9: The year and the month
Error log 9: The day and the hour
Error log 9: The minute and the second
Error log 10: The rack number and the
slot number
Error log 10: The module ID
Error log 10: The error code
Error log 10: The year and the month
Error log 10: The day and the hour
Error log 10: The minute and the second
Error log 11: The rack number and the
slot number
Error log 11: The module ID
Error log 11: The error code
Error log 11: The year and the month
Error log 11: The day and the hour
Error log 11: The minute and the second
Error log 12: The rack number and the
slot number

SR72
*SR73
*SR74
*SR75
*SR76
*SR77
*SR78
*SR79
*SR80
*SR81
*SR82
*SR83
*SR84
*SR85
*SR86
*SR87
*SR88
*SR89
*SR90
*SR91
*SR92
*SR93
*SR94
*SR95
*SR96
*SR97
*SR98
*SR99
*SR100
*SR101
*SR102
*SR103
*SR104
*SR105
*SR106
*SR107
*SR108

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○
○ ○

–
–

–
–

–
–

R
R

0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

2-51

A H 5 00 Prog r am m ing M an ua l

Function

*SR109
*SR110
*SR111
*SR112
*SR113

Error log 12: The module ID
Error log 12: The error code
Error log 12: The year and the month
Error log 12: The day and the hour
Error log 12: The minute and the second
Error log 13: The rack number and the
slot number
Error log 13: The module ID
Error log 13: The error code
Error log 13: The year and the month
Error log 13: The day and the hour
Error log 13: The minute and the second
Error log 13: The rack number and the
slot number
Error log 14: The rack number and the
slot number
Error log 14: The module ID
Error log 14: The error code
Error log 14: The year and the month
Error log 14: The day and the hour
Error log 15: The rack number and the
slot number
Error log 15: The module ID
Error log 15: The error code
Error log 15: The year and the month
Error log 15: The day and the hour
Error log 15: The minute and the second
Error log 16: The rack number and the
slot number
Error log 16: The module ID
Error log 16: The error code
Error log 16: The year and the month
Error log 16: The day and the hour
Error log 16: The minute and the second
Error log 17: The rack number and the
slot number
Error log 17: The module ID
Error log 17: The error code
Error log 17: The year and the month
Error log 17: The day and the hour
Error log 17: The minute and the second
Error log 18: The rack number and the
slot number
Error log 18: The module ID
Error log 18: The error code
Error log 18: The year and the month

*SR114
*SR115
*SR116
*SR117
*SR118
*SR119
*SR120
*SR121
*SR122
*SR123
*SR124
*SR125
*SR126
*SR127
*SR128
*SR129
*SR130
*SR131
*SR132
*SR133
*SR134
*SR135
*SR136
*SR137
*SR138
*SR139
*SR140
*SR141
SR142
*SR143
*SR144
*SR145
*SR146
*SR147

2-52

CPU5X0-EN
CPU5X0-RS2

SR

○
○
○
○
○

OFF STOP RUN


 Attribute Default
ON RUN STOP

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○
○
○
○

○
○
○
○

–
–
–
–

–
–
–
–

–
–
–
–

R
R
R
R

0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

Ch ap te r 2 De vices

Function

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

*SR148 Error log 18: The day and the hour
*SR149 Error log 18: The minute and the second
Error log 19: The rack number and the
*SR150
slot number
*SR151 Error log 19: The module ID
*SR152 Error log 19: The error code
*SR153 Error log 19: The year and the month
*SR154 Error log 19: The day and the hour
*SR155 Error log 19: The minute and the second
Error log 20: The rack number and the
*SR156
slot number
*SR157 Error log 20: The module ID
*SR158 Error log 20: The error code
*SR159 Error log 20: The year and the month
*SR160 Error log 20: The day and the hour
*SR161 Error log 20: The minute and the second
*SR201 Communication address of COM1
*SR202 Communication address of COM2

○ ○
○ ○

–
–

–
–

–
–

R
R

0
0

○ ○

–

–

–

R

0

○
○
○
○
○

○
○
○
○
○

–
–
–
–
–

–
–
–
–
–

–
–
–
–
–

R
R
R
R
R

0
0
0
0
0

○ ○

–

–

–

R

0

○
○
○
○
○
○
○

○
○
○
○
○
○
X

–
–
–
–
–
–
–

–
–
–
–
–
–
–

–
–
–
–
–
–
–

R
R
R
R
R
R/W
R/W

*SR209 Communication protocol of COM1

○ ○

–

–

–

R/W

*SR210 COM1 communication timeout

○ ○

3000
ms

–

–

R/W

0
0
0
0
0
1
3
16#
0024
3000
ms

○ ○

–

–

–

R/W

*SR212 Communication protocol of COM2

○ X

–

–

–

R/W

*SR213 COM2 communication timeout

○ X

3000
ms

–

–

R/W

○ ○

–

–

–

R/W

3

○ ○
○ X

–
–

–
–

–
–

R/W
R/W

0
0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

1

○ ○

–

–

–

R

1

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

1

*SR211

*SR214
*SR215
*SR216
*SR220
*SR221
*SR222
*SR223
*SR224
*SR225
*SR226

Number of times the command is resent
through COM1

Number of times the command is resent
through COM2
Interface code of COM1
Interface code of COM2
Value of the year in the real-time clock
(RTC): 00~99 (A.D.)
Value of the month in the real-time clock
(RTC): 01~12
Value of the day in the real-time clock
(RTC): 1~31
Value of the hour in the real-time clock
(RTC): 00~23
Value of the minute in the real-time clock
(RTC): 00~59
Value of the second in the real-time clock
(RTC): 00~59
Value of the week in the real-time clock
(RTC): 1~7

3
16#
0024
3000
ms

2-53

A H 5 00 Prog r am m ing M an ua l

*SR227
*SR228
*SR229
*SR230
*SR231
*SR232
*SR233
*SR234
*SR235
*SR236
*SR237
*SR238

Function

Number of download logs (The maximum
number is 20.)
Download log pointer
Download log 1: The action number
Download log 1: The year and the month
Download log 1: The day and the hour
Download log 1: The minute and the
second
Download log 2: The action number
Download log 2: The year and the month
Download log 2: The day and the hour
Download log 2: The minute and the
second
Download log 3: The action number
Download log 3: The year and the month

*SR239 Download log 3: The day and the hour
*SR240
*SR241
*SR242
*SR243
*SR244
*SR245
*SR246
*SR247
*SR248
*SR249
*SR250
*SR251
*SR252
*SR253
*SR254
*SR255
*SR256
*SR257
*SR258
*SR259
*SR260
*SR261
*SR262

2-54

Download log 3: The minute and the
second
Download log 4: The action number
Download log 4: The year and the month
Download log 4: The day and the hour
Download log 4: The minute and the
second
Download log 5: The action number
Download log 5: The year and the month
Download log 5: The day and the hour
Download log 5: The minute and the
second
Download log 6: The action number
Download log 6: The year and the month
Download log 6: The day and the hour
Download log 6: The minute and the
second
Download log 7: The action number
Download log 7: The year and the month
Download log 7: The day and the hour
Download log 7: The minute and the
second
Download log 8: The action number
Download log 8: The year and the month
Download log 8: The day and the hour
Download log 8: The minute and the
second
Download log 9: The action number
Download log 9: The year and the month

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

–

–

–

R

0

○
○
○
○

○
○
○
○

–
–
–
–

–
–
–
–

–
–
–
–

R
R
R
R

0
0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○

–
–

–
–

–
–

R
R

0
0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○

–
–

–
–

–
–

R
R

0
0

Ch ap te r 2 De vices

Function

*SR263 Download log 9: The day and the hour
Download log 9: The minute and the
*SR264
second
*SR265 Download log 10: The action number
*SR266 Download log 10: The year and the month
*SR267 Download log 10: The day and the hour
Download log 10: The minute and the
*SR268
second
*SR269 Download log 11: The action number
*SR270 Download log 11: The year and the month
*SR271 Download log 11: The day and the hour
Download log 11: The minute and the
*SR272
second
*SR273 Download log 12: The action number
*SR274 Download log 12: The year and the month
*SR275 Download log 12: The day and the hour
Download log 12: The minute and the
*SR276
second
*SR277 Download log 13: The action number
*SR278 Download log 13: The year and the month
*SR279 Download log 13: The day and the hour
Download log 13: The minute and the
*SR280
second
*SR281 Download log 14: The action number
*SR282 Download log 14: The year and the month
*SR283 Download log 14: The day and the hour
Download log 14: The minute and the
*SR284
second
*SR285 Download log 15: The action number
*SR286 Download log 15: The year and the month
*SR287 Download log 15: The day and the hour
Download log 15: The minute and the
*SR288
second
*SR289 Download log 16: The action number
*SR290 Download log 16: The year and the month
*SR291 Download log 16: The day and the hour
Download log 16: The minute and the
*SR292
second
*SR293 Download log 17: The action number
*SR294 Download log 17: The year and the month
*SR295 Download log 17: The day and the hour
Download log 17: The minute and the
*SR296
second
*SR297 Download log 18: The action number
*SR298 Download log 18: The year and the month
*SR299 Download log 18: The day and the hour

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

2-55

A H 5 00 Prog r am m ing M an ua l

*SR300
*SR301
*SR302
*SR303
*SR304
*SR305
*SR306
*SR307
*SR308
*SR309
*SR310
*SR311
*SR312
*SR313
*SR314
*SR315
*SR316
*SR317
*SR318
*SR319
*SR320
*SR321
*SR322
*SR323
*SR324
*SR325
*SR326

2-56

Function

Download log 18: The minute and the
second
Download log 19: The action number
Download log 19: The year and the month
Download log 19: The day and the hour
Download log 19: The minute and the
second
Download log 20: The action number
Download log 20: The year and the month
Download log 20: The day and the hour
Download log 20: The minute and the
second
Number of PLC status change logs (The
maximum number is 20.)
PLC status change log pointer
PLC status change log 1: The action
number
PLC status change log 1: The year and
the month
PLC status change log 1: The day and
the hour
PLC status change log 1: The minute and
the second
PLC status change log 2: The action
number
PLC status change log 2: The year and
the month
PLC status change log 2: The day and
the hour
PLC status change log 2: The minute and
the second
PLC status change log 3: The action
number
PLC status change log 3: The year and
the month
PLC status change log 3: The day and
the hour
PLC status change log 3: The minute and
the second
PLC status change log 4: The action
number
PLC status change log 4: The year and
the month
PLC status change log 4: The day and
the hour
PLC status change log 4: The minute and
the second

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○
○ ○
○ ○

–
–
–

–
–
–

–
–
–

R
R
R

0
0
0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

Ch ap te r 2 De vices

*SR327
*SR328
*SR329
*SR330
*SR331
*SR332
*SR333
*SR334
*SR335
*SR336
*SR337
*SR338
*SR339
*SR340
*SR341
*SR342
*SR343

*SR344
*SR345
*SR346
*SR347
*SR348
*SR349

Function

PLC status change log 5: The action
number
PLC status change log 5: The year and
the month
PLC status change log 5: The day and
the hour
PLC status change log 5: The minute and
the second
PLC status change log 6: The action
number
PLC status change log 6: The year and
the month
PLC status change log 6: The day and
the hour
PLC status change log 6: The minute and
the second
PLC status change log 7: The action
number
PLC status change log 7: The year and
the month
PLC status change log 7: The day and
the hour
PLC status change log 7: The minute and
the second
PLC status change log 8: The action
number
PLC status change log 8: The year and
the month
PLC status change log 8: The day and
the hour
PLC status change log 8: The minute and
the second
PLC status change log 9: The action
number
PLC status change log 9: The year and
the month
PLC status change log 9: The day and
the hour
PLC status change log 9: The minute and
the second
PLC status change log 10: The action
number
PLC status change log 10: The year and
the month
PLC status change log 10: The day and
the hour

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

2-57

A H 5 00 Prog r am m ing M an ua l

*SR350
*SR351
*SR352
*SR353
*SR354
*SR355
*SR356
*SR357
*SR358
*SR359
*SR360
*SR361
*SR362
*SR363
*SR364
*SR365
*SR366
*SR367
*SR368
*SR369
*SR370
*SR371
*SR372
*SR373

2-58

Function

PLC status change log 10: The minute
and the second
PLC status change log 11: The action
number
PLC status change log 11: The year and
the month
PLC status change log 11: The day and
the hour
PLC status change log 11: The minute
and the second
PLC status change log 12: The action
number
PLC status change log 12: The year and
the month
PLC status change log 12: The day and
the hour
PLC status change log 12: The minute
and the second
PLC status change log 13: The action
number
PLC status change log 13: The year and
the month
PLC status change log 13: The day and
the hour
PLC status change log 13: The minute
and the second
PLC status change log 14: The action
number
PLC status change log 14: The year and
the month
PLC status change log 14: The day and
the hour
PLC status change log 14: The minute
and the second
PLC status change log 15: The action
number
PLC status change log 15: The year and
the month
PLC status change log 15: The day and
the hour
PLC status change log 15: The minute
and the second
PLC status change log 16: The action
number
PLC status change log 16: The year and
the month
PLC status change log 16: The day and
the hour

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

Ch ap te r 2 De vices

*SR374
*SR375
*SR376
*SR377
*SR378
*SR379
*SR380
*SR381
*SR382
*SR383
*SR384
*SR385
*SR386
*SR387
*SR388
*SR389
*SR390
SR391
SR392
SR393
SR394
SR395
SR396
SR397

Function

PLC status change log 16: The minute
and the second
PLC status change log 17: The action
number
PLC status change log 17: The year and
the month
PLC status change log 17: The day and
the hour
PLC status change log 17: The minute
and the second
PLC status change log 18: The action
number
PLC status change log 18: The year and
the month
PLC status change log 18: The day and
the hour
PLC status change log 18: The minute
and the second
PLC status change log 19: The action
number
PLC status change log 19: The year and
the month
PLC status change log 19: The day and
the hour
PLC status change log 19: The minute
and the second
PLC status change log 20: The action
number
PLC status change log 20: The year and
the month
PLC status change log 20: The day and
the hour
PLC status change log 20: The minute
and the second
Value of the year in the real-time clock
(RTC): 00~99 (A.D.)
Value of the month in the real-time clock
(RTC): 01~12
Value of the day in the real-time clock
(RTC): 1~31
Value of the hour in the real-time clock
(RTC): 00~23
Value of the minute in the real-time clock
(RTC): 00~59
Value of the second in the real-time clock
(RTC): 00~59
Value of the week in the real-time clock
(RTC): 1~7

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

1

○ ○

–

–

–

R

1

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R

1

2-59

A H 5 00 Prog r am m ing M an ua l

Function

When the PLC runs, the value in SR407
increases by one every second. SR407
SR407
counts from 0 to 32767, and then from
-32768 to 0.
When the PLC runs, the value in SR408
increases by one every scan cycle.
SR408
SR408 counts from 0 to 32767, and then
from -32768 to 0.
The pulse is ON for n seconds and is OFF
for n seconds during the 2n second clock
*SR409
pulse. The interval n is stored in SR409,
and the setting range is 1~32767.
The pulse is ON for n milliseconds and is
OFF for n milliseconds during the 2n
*SR410
millisecond clock pulse. The interval n is
stored in SR410.
The current scan time is stored in SR411
SR411 and SR412, and the unit of measurement
is 100 microseconds. The value of the
millisecond is stored in SR411. (The
range is 0~65535.) The value of the
microsecond is stored in SR421. (The
SR412 range is 0~900.). For example, 12 is
stored in SR411 and 300 is stored in
SR412 when the current scan time is 12.3
milliseconds.
The maximum scan time is stored in
SR413 SR413 and SR414, and the unit of
measurement is 100 microseconds. The
SR414 value of the millisecond is stored in
SR413.
The maximum scan time is stored in
SR415 SR415 and SR416, and the unit of
measurement is 100 microseconds. The
SR416 value of the millisecond is stored in
SR415.
If an error occurs during the operation of
*SR453 the memory card, the error code will be
recorded.
Interrupt character used in the instruction
SR621
RS (COM1)
Interrupt character used in the instruction
SR622
RS (COM2)
Bit 0~bit 15: The conditions of the
SR623 interrupt programs I0~I15 are set by the
instruction IMASK.
Bit 0~bit 15: The conditions of the
SR624 interrupt programs I16~I31 are set by the
instruction IMASK.

2-60

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

0

0

–

R/W

0

○ ○

0

0

–

R/W

0

○ ○

–

–

–

R/W

30

○ ○

–

–

–

R/W

30

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

–

–

–

R

0

○ ○

–

–

–

R/W

0

○ ○

–

–

–

R/W

0

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

Ch ap te r 2 De vices

Function

Bit 0~bit 15: The conditions of the
interrupt programs I32~I47 are set by the
instruction IMASK.
Bit 0~bit 15: The conditions of the
SR626 interrupt programs I48~I63 are set by the
instruction IMASK.
Bit 0~bit 15: The conditions of the
SR627 interrupt programs I64~I79 are set by the
instruction IMASK.
Bit 0~bit 15: The conditions of the
SR628 interrupt programs I80~I95 are set by the
instruction IMASK.
Bit 0~bit 15: The conditions of the
SR629 interrupt programs I96~I111 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR630 interrupt programs I112~I127 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR631 interrupt programs I128~I143 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR632 interrupt programs I144~I159 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR633 interrupt programs I160~I175 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR634 interrupt programs I176~I191 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR635 interrupt programs I192~I207 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR636 interrupt programs I208~I213 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR637 interrupt programs I214~I229 are set by
the instruction IMASK.
Bit 0~bit 15: The conditions of the
SR638 interrupt programs I230~I255 are set by
the instruction IMASK.
Recording the mapping error occurring in
the module table for rack 1 or the error
*SR655 occurring in the I/O module of rack 1
↓
↓
SR662 Recording the mapping error occurring in
the module table for rack 8 or the error
occurring in the I/O module of rack 8
SR625

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○ FFFF

–

–

R

FFFF

○ ○

–

–

R

0

0

2-61

A H 5 00 Prog r am m ing M an ua l

*SR663
↓
SR674

*SR675
↓
SR682

*SR683
↓
SR690

*SR691
↓
SR698

*SR699
↓
SR706

*SR707
↓
SR714

*SR715
↓
SR722

2-62

Function

Recording the mapping error code
occurring in the module table for rack 1
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 1
whose slot number is 11
Recording the mapping error code
occurring in the module table for rack 2
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 2
whose slot number is 7
Recording the mapping error code
occurring in the module table for rack 3
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 3
whose slot number is 7
Recording the mapping error code
occurring in the module table for rack 4
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 4
whose slot number is 7
Recording the mapping error code
occurring in the module table for rack 5
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 5
whose slot number is 7
Recording the mapping error code
occurring in the module table for rack 6
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 6
whose slot number is 7
Recording the mapping error code
occurring in the module table for rack 7
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 7
whose slot number is 7

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

Ch ap te r 2 De vices

*SR723
↓
SR730

SR731
*SR1000
*SR1001
*SR1002
*SR1003
*SR1004
*SR1005
*SR1006
SR1007
SR1008
SR1100
SR1101
SR1102
SR1103
SR1104
SR1105
SR1106
SR1107
*SR1116
*SR1117
*SR1118
*SR1119
*SR1120

Function

Recording the mapping error code
occurring in the module table for rack 8
whose slot number is 0
↓
Recording the mapping error code
occurring in the module table for rack 8
whose slot number is 7
If the external 24 V voltage is abnormal,
the value of the corresponding bit is 1.
High word in the Ethernet IP address
Low word in the Ethernet IP address
High word in the Ethernet netmask
address
Low word in the Ethernet netmask
address
High word in the Ethernet gateway
address
Low word in the Ethernet gateway
address
Time for which the TCP connection has
been persistent
Ethernet transmission speed
Ethernet transmission mode
High word in the value of the input packet
counter
Low word in the value of the input packet
counter
High word in the value of the input octet
counter
Low word in the value of the input octet
counter
High word in the value of the output
packet counter
Low word in value of the output packet
counter
High word in the value of the output octet
counter
Low word in the value of the output octet
counter
Email counter
Email error counter
TCP Socket 1─The local communication
port
TCP Socket 1─The high word in the
remote IP address
TCP Socket 1─The low word in the
remote IP address

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

○ ○

0

–

–

R

0

○ ○

0

–

–

R

0

X ○
X ○

–
–

–
–

–
–

R/W
R/W

C0A8
0101

X ○

–

–

–

R/W

FFFF

X ○

–

–

–

R/W

FF00

X ○

–

–

–

R/W

C0A8

X ○

–

–

–

R/W

0101

X ○

–

–

–

R/W

0060

X ○
X ○

0
0

–
–

–
–

R
R

0
0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○
X ○

0
0

–
–

–
–

R
R

0
0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

2-63

A H 5 00 Prog r am m ing M an ua l

*SR1121
*SR1122
*SR1123
*SR1124
*SR1125
*SR1126
*SR1127
*SR1128
*SR1129
*SR1130
*SR1131
*SR1132
*SR1133
*SR1134
*SR1135
*SR1136
*SR1137
*SR1138
*SR1139
*SR1140
*SR1141
*SR1142
*SR1143
*SR1144
*SR1145

2-64

Function

TCP Socket 1─The remote
communication port
TCP Socket 1─The length of the data
transmitted
TCP Socket 1─The high word in the
address of the data transmitted
TCP Socket 1─The low word in the
address of the data transmitted
TCP Socket 1─The length of the data
received
TCP Socket 1─The high word in the
address of the data received
TCP Socket 1─The low word in the
address of the data received
TCP Socket 1─The time for which the
connection has been persistent
TCP Socket 1─The received data counter
TCP Socket 1─The transmitted data
counter
TCP Socket 2─The local communication
port
TCP Socket 2─The high word in the
remote IP address
TCP Socket 2─The low word in the
remote IP address
TCP Socket 2─The remote
communication port
TCP Socket 2─The length of the data
transmitted
TCP Socket 2─The high word in the
address of the data transmitted
TCP Socket 2─The low word in the
address of the data transmitted
TCP Socket 2─The length of the data
received
TCP Socket 2─The high word in the
address of the data received
TCP Socket 2─The low word in the
address of the data received
TCP Socket 2─The time for which the
connection has been persistent
TCP Socket 2─The received data counter
TCP Socket 2─The transmitted data
counter
TCP Socket 3─The local communication
port
TCP Socket 3─The high word in the
remote IP address

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

Ch ap te r 2 De vices

*SR1146
*SR1147
*SR1148
*SR1149
*SR1150
*SR1151
*SR1152
*SR1153
*SR1154
*SR1155
*SR1156
*SR1157
*SR1158
*SR1159
*SR1160
*SR1161
*SR1162
*SR1163
*SR1164
*SR1165
*SR1166
*SR1167
*SR1168
*SR1169
*SR1170

Function

TCP Socket 3─The low word in the
remote IP address
TCP Socket 3─The remote
communication port
TCP Socket 3─The length of the data
transmitted
TCP Socket 3─The high word in the
address of the data transmitted
TCP Socket 3─The low word in the
address of the data transmitted
TCP Socket 3─The length of the data
received
TCP Socket 3─The high word in the
address of the data received
TCP Socket 3─The low word in the
address of the data received
TCP Socket 3─The time for which the
connection has been persistent
TCP Socket 3─The received data counter
TCP Socket 3─The transmitted data
counter
TCP Socket 4─The local communication
port
TCP Socket 4─The high word in the
remote IP address
TCP Socket 4─The low word in the
remote IP address
TCP Socket 4─The remote
communication port
TCP Socket 4─The length of the data
transmitted
TCP Socket 4─The high word in the
address of the data transmitted
TCP Socket 4─The low word in the
address of the data transmitted
TCP Socket 4─The length of the data
received
TCP Socket 4─The high word in the
address of the data received
TCP Socket 4─The low word in the
address of the data received
TCP Socket 4─The time for which the
connection has been persistent
TCP Socket 4─The received data counter
TCP Socket 4─The transmitted data
counter
TCP Socket 5─The local communication
port

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

2-65

A H 5 00 Prog r am m ing M an ua l

*SR1171
*SR1172
*SR1173
*SR1174
*SR1175
*SR1176
*SR1177
*SR1178
*SR1179
*SR1180
*SR1181
*SR1182
*SR1183
*SR1184
*SR1185
*SR1186
*SR1187
*SR1188
*SR1189
*SR1190
*SR1191
*SR1192
*SR1193
*SR1194
*SR1195

2-66

Function

TCP Socket 5─The high word in the
remote IP address
TCP Socket 5─The low word in the
remote IP address
TCP Socket 5─The remote
communication port
TCP Socket 5─The length of the data
transmitted
TCP Socket 5─The high word in the
address of the data transmitted
TCP Socket 5─The low word in the
address of the data transmitted
TCP Socket 5─The length of the data
received
TCP Socket 5─The high word in the
address of the data received
TCP Socket 5─The low word in the
address of the data received
TCP Socket 5─The time for which the
connection has been persistent
TCP Socket 5─The received data counter
TCP Socket 5─The transmitted data
counter
TCP Socket 6─The local communication
port
TCP Socket 6─The high word in the
remote IP address
TCP Socket 6─The low word in the
remote IP address
TCP Socket 6─The remote
communication port
TCP Socket 6─The length of the data
transmitted
TCP Socket 6─The high word in the
address of the data transmitted
TCP Socket 6─The low word in the
address of the data transmitted
TCP Socket 6─The length of the data
received
TCP Socket 6─The high word in the
address of the data received
TCP Socket 6─The low word in the
address of the data received
TCP Socket 6─The time for which the
connection has been persistent
TCP Socket 6─The received data counter
TCP Socket 6─The transmitted data
counter

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

X ○

0

–

–

R

0

Ch ap te r 2 De vices

*SR1196
*SR1197
*SR1198
*SR1199
*SR1200
*SR1201
*SR1202
*SR1203
*SR1204
*SR1205
*SR1206
*SR1207
*SR1208
*SR1209
*SR1210
*SR1211
*SR1212
*SR1213
*SR1214
*SR1215
*SR1216
*SR1217
*SR1218
*SR1219
*SR1220

Function

TCP Socket 7─The local communication
port
TCP Socket 7─The high word in the
remote IP address
TCP Socket 7─The low word in the
remote IP address
TCP Socket 7─The remote
communication port
TCP Socket 7─The length of the data
transmitted
TCP Socket 7─The high word in the
address of the data transmitted
TCP Socket 7─The low word in the
address of the data transmitted
TCP Socket 7─The length of the data
received
TCP Socket 7─The high word in the
address of the data received
TCP Socket 7─The low word in the
address of the data received
TCP Socket 7─The time for which the
connection has been persistent
TCP Socket 7─The received data counter
TCP Socket 7─The transmitted data
counter
TCP Socket 8─The local communication
port
TCP Socket 8─The high word in the
remote IP address
TCP Socket 8─The low word in the
remote IP address
TCP Socket 8─The remote
communication port
TCP Socket 8─The length of the data
transmitted
TCP Socket 8─The high word in the
address of the data transmitted
TCP Socket 8─The low word in the
address of the data transmitted
TCP Socket 8─The length of the data
received
TCP Socket 8─The high word in the
address of the data received
TCP Socket 8─The low word in the
address of the data received
TCP Socket 8─The time for which the
connection has been persistent
TCP Socket 8─The received data counter

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0**

X ○

–

–

–

R/W

1000

X ○

0

–

–

R

0

2-67

A H 5 00 Prog r am m ing M an ua l

*SR1221
*SR1222
*SR1223
*SR1224
*SR1225
*SR1226
*SR1227
*SR1228
*SR1229
*SR1230
*SR1231
*SR1232
*SR1233
*SR1234
*SR1235
*SR1236
*SR1237
*SR1238
*SR1239
*SR1240
*SR1241
*SR1242
*SR1243
*SR1244

2-68

Function

TCP Socket 8─The transmitted data
counter
UDP Socket 1─The local communication
port
UDP Socket 1─The high word in the
remote IP address
UDP Socket 1─The low word in the
remote IP address
UDP Socket 1─The remote
communication port
UDP Socket 1─The length of the data
transmitted
UDP Socket 1─The high word in the
address of the data transmitted
UDP Socket 1─The low word in the
address of the data transmitted
UDP Socket 1─The length of the data
received
UDP Socket 1─The high word in the
address of the data received
UDP Socket 1─The low word in the
address of the data received
UDP Socket 1─The received data
counter
UDP Socket 1─The transmitted data
counter
UDP Socket 2─The local communication
port
UDP Socket 2─The high word in the
remote IP address
UDP Socket 2─The low word in the
remote IP address
UDP Socket 2─The remote
communication port
UDP Socket 2─The length of the data
transmitted
UDP Socket 2─The high word in the
address of the data transmitted
UDP Socket 2─The low word in the
address of the data transmitted
UDP Socket 2─The length of the data
received
UDP Socket 2─The high word in the
address of the data received
UDP Socket 2─The low word in the
address of the data received
UDP Socket 2─The received data
counter

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

Ch ap te r 2 De vices

*SR1245
*SR1246
*SR1247
*SR1248
*SR1249
*SR1250
*SR1251
*SR1252
*SR1253
*SR1254
*SR1255
*SR1256
*SR1257
*SR1258
*SR1259
*SR1260
*SR1261
*SR1262
*SR1263
*SR1264
*SR1265
*SR1266
*SR1267
*SR1268

Function

UDP Socket 2─The transmitted data
counter
UDP Socket 3─The local communication
port
UDP Socket 3─The high word in the
remote IP address
UDP Socket 3─The low word in the
remote IP address
UDP Socket 3─The remote
communication port
UDP Socket 3─The length of the data
transmitted
UDP Socket 3─The high word in the
address of the data transmitted
UDP Socket 3─The low word in the
address of the data transmitted
UDP Socket 3─The length of the data
received
UDP Socket 3─The high word in the
address of the data received
UDP Socket 3─The low word in the
address of the data received
UDP Socket 3─The received data
counter
UDP Socket 3─The transmitted data
counter
UDP Socket 4─The local communication
port
UDP Socket 4─The high word in the
remote IP address
UDP Socket 4─The low word in the
remote IP address
UDP Socket 4─The remote
communication port
UDP Socket 4─The length of the data
transmitted
UDP Socket 4─The high word in the
address of the data transmitted
UDP Socket 4─The low word in the
address of the data transmitted
UDP Socket 4─The length of the data
received
UDP Socket 4─The high word in the
address of the data received
UDP Socket 4─The low word in the
address of the data received
UDP Socket 4─The received data
counter

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

2-69

A H 5 00 Prog r am m ing M an ua l

*SR1269
*SR1270
*SR1271
*SR1272
*SR1273
*SR1274
*SR1275
*SR1276
*SR1277
*SR1278
*SR1279
*SR1280
*SR1281
*SR1282
*SR1283
*SR1284
*SR1285
*SR1286
*SR1287
*SR1288
*SR1289
*SR1290
*SR1291
*SR1292

2-70

Function

UDP Socket 4─The transmitted data
counter
UDP Socket 5─The local communication
port
UDP Socket 5─The high word in the
remote IP address
UDP Socket 5─The low word in the
remote IP address
UDP Socket 5─The remote
communication port
UDP Socket 5─The length of the data
transmitted
UDP Socket 5─The high word in the
address of the data transmitted
UDP Socket 5─The low word in the
address of the data transmitted
UDP Socket 5─The length of the data
received
UDP Socket 5─The high word in the
address of the data received
UDP Socket 5─The low word in the
address of the data received
UDP Socket 5─The received data
counter
UDP Socket 5─The transmitted data
counter
UDP Socket 6─The local communication
port
UDP Socket 6─The high word in the
remote IP address
UDP Socket 6─The low word in the
remote IP address
UDP Socket 6─The remote
communication port
UDP Socket 6─The length of the data
transmitted
UDP Socket 6─The high word in the
address of the data transmitted
UDP Socket 6─The low word in the
address of the data transmitted
UDP Socket 6─The length of the data
received
UDP Socket 6─The high word in the
address of the data received
UDP Socket 6─The low word in the
address of the data received
UDP Socket 6─The received data
counter

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

Ch ap te r 2 De vices

*SR1293
*SR1294
*SR1295
*SR1296
*SR1297
*SR1298
*SR1299
*SR1300
*SR1301
*SR1302
*SR1303
*SR1304
*SR1305
*SR1306
*SR1307
*SR1308
*SR1309
*SR1310
*SR1311
*SR1312
*SR1313
*SR1314
*SR1315
*SR1316

Function

UDP Socket 6─The transmitted data
counter
UDP Socket 7─The local communication
port
UDP Socket 7─The high word in the
remote IP address
UDP Socket 7─The low word in the
remote IP address
UDP Socket 7─The remote
communication port
UDP Socket 7─The length of the data
transmitted
UDP Socket 7─The high word in the
address of the data transmitted
UDP Socket 7─The low word in the
address of the data transmitted
UDP Socket 7─The length of the data
received
UDP Socket 7─The high word in the
address of the data received
UDP Socket 7─The low word in the
address of the data received
UDP Socket 7─The received data
counter
UDP Socket 7─The transmitted data
counter
UDP Socket 8─The local communication
port
UDP Socket 8─The high word in the
remote IP address
UDP Socket 8─The low word in the
remote IP address
UDP Socket 8─The remote
communication port
UDP Socket 8─The length of the data
transmitted
UDP Socket 8─The high word in the
address of the data transmitted
UDP Socket 8─The low word in the
address of the data transmitted
UDP Socket 8─The length of the data
received
UDP Socket 8─The high word in the
address of the data received
UDP Socket 8─The low word in the
address of the data received
UDP Socket 8─The received data
counter

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

X ○

0

–

–

R

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

–

–

–

R/W

0

X ○

0

–

–

R

0

2-71

A H 5 00 Prog r am m ing M an ua l

Function

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

UDP Socket 8─The transmitted data
counter
*SR1318 Socket input counter

X ○

0

–

–

R

0

X ○

0

–

–

R

0

*SR1319 Socket output counter

X ○

0

–

–

R

0

*SR1320 Socket error counter

X ○

0

–

–

R

0

*SR1329 Main backplane ID

○ ○

–

–

–

R/W

0

*SR1330 Main slot number

○ ○

–

–

–

R/W

0

*SR1331 RTU number

○ ○

–

–

–

R/W

0

*SR1332 Extension backplane ID

○ ○

–

–

–

R/W

0

*SR1333 Extension slot number

○ ○

–

–

–

R/W

0

*SR1334 Port number

○ ○

–

–

–

R/W

0

*SR1335 PLC Link cycle

○ ○

–

–

–

R

0

*SR1336 Number of slaves linked in the PLC Link
Time for which the data has been
*SR1337
exchanged in the PLC Link
Restricted time of the PLC Link which is
*SR1338
defined by users
Interval of sending the command in the
*SR1339
PLC Link
Device type in slave 1 from which the
data is read in the PLC Link
*SR1340
↓(0: register; 1: output coil; others: not
↓
support)
SR1371
Device type in slave 32 from which the
data is read in the PLC Link
Device type in slave 1 into which the data
is written in the PLC Link
*SR1372
↓(0: register; 1: output coil; others: not
↓
support)
SR1403
Device type in slave 32 into which the
data is written in the PLC Link
Device address into which the data is
read from slave 1 in the PLC Link
*SR1404 (SR1404 and SR1405)
↓
↓
SR1467 Device address into which the data is
read from slave 32 in the PLC Link
(SR1466 and SR1467)
Device address from which the data is
written into slave 1 in the PLC Link
*SR1468 (SR1468 and SR1469)
↓
↓
SR1531 Device address from which the data is
written into slave 32 in the PLC Link
(SR1530 and SR1531)

○ ○

–

–

–

R

0

○ ○

–

–

–

R/W

0

○ ○

–

–

–

R/W

0

○ ○

–

–

–

R/W

1

○ ○

–

–

–

R/W

0

○ ○

–

–

–

R/W

0

○ ○

–

–

–

R/W

0

○ ○

–

–

–

R/W

0

*SR1317

2-72

Ch ap te r 2 De vices

Function

CPU5X0-EN
CPU5X0-RS2

SR

OFF STOP RUN


 Attribute Default
ON RUN STOP

Device address in slave 1 from which the
data is read in the PLC Link (SR1532 and
*SR1532 SR1533)
○ ○
–
–
–
R/W
0
↓
↓
SR1595 Device address in slave 32 from which
the data is read in the PLC Link (SR1594
and SR1595)
Device address in slave 1 into which the
data is written in the PLC Link (SR1596
*SR1596 and SR1597)
↓
○ ○
–
–
–
R/W
0
↓
SR1659 Device address in slave 32 into which the
data is written in the PLC Link (SR1658
and SR1659)
Number of data which is read from slave
*SR1660 1 in the PLC Link
↓
○ ○
–
–
–
R/W
0
↓
SR1691 Number of data which is read from slave
32 in the PLC Link
Number of data which is written into slave
*SR1692 1 in the PLC Link
↓
↓
○ ○
–
–
–
R/W
0
SR1723 Number of data which is written into slave
32 in the PLC Link
*SR1724 Type of slave 1 in the PLC Link
↓
○ ○
–
–
–
R/W
0
↓
SR1755 Type of slave 32 in the PLC Link
*SR1756 Address of slave 1 in the PLC Link
1
○ ○
–
–
–
R/W
↓
↓
↓
SR1787 Address of slave 32 in the PLC Link
32
IP address of block 1 in the Ether Link
*SR1792 (SR1792 and SR1793)
↓
↓
X ○
–
–
–
R
0
SR2047 IP address of block 128 in the Ether Link
(SR2046 and SR2047)
Note: As to the SR numbers marked “*”, users can refer to the additional remarks on special
auxiliary relays/special data registers.

2.2.15 Refresh Time of Special Data Registers
Special data register
Refresh time
SR0~SR2
The register is refreshed when the program is executed in error.
SR4
SR4 is refreshed when there is a grammar check error
The register is refreshed when the program is downloaded to the PLC, or
SR5~SR6
when the PLC is suppied with power and starts to run for the first time.
SR8
SR8 is refreshed when there is a watchdog timer error.
SR40~SR161
The register is refreshed when an error occurs.
SR201~SR216
Users set the value and clear it.
SR220~SR226
The register is refreshed every scan cycle.

2-73

A H 5 00 Prog r am m ing M an ua l

Special data register
SR227~SR308
SR309~SR390
SR391~SR397
SR407
SR408
SR409~SR410
SR411~SR416
SR453
SR621~SR622
SR623~SR638
SR655~SR730
SR1000~SR1006
SR1007
SR1008
SR1100~SR1117
SR1118~SR1128
SR1129~SR1130
SR1131~SR1141
SR1142~SR1143
SR1144~SR1154
SR1155~SR1156
SR1157~SR1167
SR1168~SR1169
SR1170~SR1180
SR1181~SR1182
SR1183~SR1193
SR1194~SR1195
SR1196~SR1206
SR1207~SR1208
SR1209~SR1219
SR1220~SR1221
SR1222~SR1231
SR1232~SR1233
SR1234~SR1243
SR1244~SR1245
SR1246~SR1255
SR1256~SR1257
SR1258~SR1267
SR1268~SR1269

2-74

Refresh time
The register is refreshed when the program is downloaded to the PLC.
The register is refreshed when the status of the PLC changes.
The register is refreshed every scan cycle.
SR407 is refreshed every second.
SR408 is refreshed whenever the instruction END is executed.
Users set the value and clear it.
The register is refreshed whenever the instruction END is executed.
SR453 is refreshed when an error occurs.
Users set the value and clear it.
The register is refreshed when the instruction IMASK is executed.
The register is refreshed when an error occurs in the I/O module.
Users set the value and clear it.
Ethernet transmission speed
Ethernet transmission mode
The register is refreshed every scan cycle.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
or when the PLC is supplied with power.

Ch ap te r 2 De vices

Special data register
Refresh time
SR1270~SR1279
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
SR1280~SR1281
or when the PLC is supplied with power.
SR1282~SR1291
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
SR1292~SR1293
or when the PLC is supplied with power.
SR1294~SR1303
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
SR1304~SR1305
or when the PLC is supplied with power.
SR1306~SR1315
The register is refreshed when the parameter is downloaded to the PLC.
The register is refreshed when the parameter is downloaded to the PLC,
SR1316~SR1320
or when the PLC is supplied with power.
SR1329~SR1334
Users set the value and clear it.
SR1335~SR1336
The register is refreshed every scan cycle when the PLC Link is enabled.
SR1337~SR1787
Users set the value and clear it.
SR1792~SR2047
The register is refreshed every scan cycle.

2.2.16 Additional Remarks on Special Auxiliary Relays and
Special Data Registers
1.

2.

3.

The scan timeout timer
 SM8/SR8
When a scan timeout occurs during the execution of the program, the error LED indicator on
the PLC is ON all the time, and SM8 is ON.
The content of SR8 is the step address at which the watchdog timer is ON.
Clearing the warning light
 SM22
If SM22 is ON, the error log and the warning light will be cleared.
The real-time clock
 SM220, SR220~SR226, and SR391~SR397
SM220: Calibrating the real-time clock within ±30 seconds
When SM220 is switched from OFF to ON, the real-time clock is calibrated.
If the value of the second in the real-time clock is within the range between 0 and
29, the value of the minute is fixed, and the value of the second is cleared to zero.
If the value of the second in the real-time clock is within the range between 30 and
59, the value of the minute increases by one, and the value of the second is cleared
to zero.
The corresponding functions and values of SR220~SR226 and SR391~SR397 are as
follows.
Device
Function
Value
Binary-coded
Decimal
decimal system system
SR220
SR391
Year
00~99 (A.D.)
SR221
SR392
Month
1~12
SR222
SR393
Day
1~31
SR223
SR394
Hour
0~23
SR224
SR395
Minute
0~59
SR225
SR396
Second
0~59
SR226
SR397
Week
1~7
SR391~SR397 correspond to SR220~ SR226. The difference between SR220~ SR226 and
SR391~SR397 lies in the fact that the former adopts the binary-coded decimal while the
latter adopts the decimal system. For example, December is represented as 12 in SR392
while it is represented as 12 in the binary-coded decimal.

2-75

A H 5 00 Prog r am m ing M an ua l

4.

5.

2-76

Please refer to section 6.17 for more information related to the real-time clock.
The functions related to communication
 SM96~SM107, SM209~SM212, SR201~SR202, and SR209~SR216
SR215 and SR216 are used to record the interface code of the communication port on the
PLC. The functions represented by the interface codes are as follows.
0
1
2
Code
RS232
RS485
RS422
Function
When the interface of the communication port on the PLC is RS485, RS232, or RS422,
SR209 records the communication format of COM1 on the PLC, and SR212 records the
communication format of COM2 on the PLC. The setting values of the communication
protocols are shown in the following table. Please refer to section 6.19 for more information
related to the communication instructions.
Data length
7 (value=0)
8 (value=1)
b0
00
: None
b1
Parity bits
01
: Odd parity bits
b2
10
: Even parity bits
Stop bit
1 bit (value=0)
2 bits (value=1)
b3
0001 (16#1) : 4800
b4
b5
0010 (16#2) : 9600
b6
0011 (16#3) : 19200
b7
0100 (16#4) : 38400
0101 (16#5) : 57600
0110 (16#6) : 115200
RS-232 does not
0111 (16#7) : 260400
support the baud rate.
RS-232 does not
1000 (16#8) : 520800
support the baud rate.
RS-232 does not
1001 (16#9) : 1041600
support the baud rate.
b8~b15 Undefined (reserved)
Clearing the contents of the device
 SM204/SM205
Device number
Device which is cleared
The non-latched areas in the input relays, the output relays, the
stepping relays, the auxiliary relays, and the link registers are
cleared.
SM204
The non-latched areas in the timers, the counters, and the
All non-latched areas are 32-bit counters are cleared.
cleared.
The non-latched areas in the data registers and the index
registers are cleared.
It takes 530 milliseconds to clear the device. The watchdog
timer does not act during this period of time.
The latched areas in the timers, counters, and 32-bit counters
are cleared.
SM205
The latched auxiliary relays are cleared.
All latched areas are
The latched data registers are cleared.
cleared.
It takes 30 milliseconds to clear the device. The watchdog timer
does not act during this period of time.
Please refer to section 2.1.4 for more information related to the latched areas in the device
range.

Ch ap te r 2 De vices

6.

The error log in the PLC
 SR40~SR161
SR40: The maximum number of error logs which are stored in SR40 is 20. Every error log
occupies 6 registers.
SR41: The error log pointer points to the latest error log. When an error occurs, the value of
the error log pointer increases by one. The range of pointer values is 0~19. For
example, the error log pointer points to the fourth error log when the value in SR41 is
3.
The time when the errors occur and the positions where the errors occur are recorded in
SR42~SR161. The corresponding functions of these data registers are as follows.
Time when the error occurs
Module Error
Number
Rack
Slot
ID
code
Year
Month
Day
Hour Minute Second
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

7.

SR42

SR42

High byte

Low byte

SR48

SR48

High byte

Low byte

SR54

SR54

High byte

Low byte

SR60

SR60

High byte

Low byte

SR66

SR66

High byte

Low byte

SR72

SR72

High byte

Low byte

SR78

SR78

High byte

Low byte

SR84

SR84

High byte

Low byte

SR90

SR90

High byte

Low byte

SR96

SR96

High byte

Low byte

SR102

SR102

High byte

Low byte

SR108

SR108

High byte

Low byte

SR114

SR114

High byte

Low byte

SR120

SR120

High byte

Low byte

SR126

SR126

High byte

Low byte

SR132

SR132

High byte

Low byte

SR138

SR138

High byte

Low byte

SR144

SR144

High byte

Low byte

SR150

SR150

High byte

Low byte

SR156

SR156

High byte

Low byte

SR43

SR44

SR49

SR50

SR55

SR56

SR61

SR62

SR67

SR68

SR73

SR74

SR79

SR80

SR85

SR86

SR91

SR92

SR97

SR98

SR103 SR104
SR109 SR110
SR115 SR116
SR121 SR122
SR127 SR128
SR133 SR134
SR139 SR140
SR145 SR146
SR151 SR152
SR157 SR158

SR45

SR45

SR46

SR46

SR47

SR47

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR51

SR51

SR52

SR52

SR53

SR53

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR57

SR57

SR58

SR58

SR59

SR59

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR63

SR63

SR64

SR64

SR65

SR65

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR69

SR69

SR70

SR70

SR71

SR71

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR75

SR75

SR76

SR76

SR77

SR77

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR81

SR81

SR82

SR82

SR83

SR83

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR87

SR87

SR88

SR88

SR89

SR89

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR93

SR93

SR94

SR94

SR95

SR95

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR99

SR99

SR100

SR100

SR101

SR101

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR105

SR105

SR106

SR106

SR107

SR107

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR111

SR111

SR112

SR112

SR113

SR113

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR117

SR117

SR118

SR118

SR119

SR119

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR123

SR123

SR124

SR124

SR125

SR125

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR129

SR129

SR130

SR130

SR131

SR131

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR135

SR135

SR136

SR136

SR137

SR137

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR141

SR141

SR142

SR142

SR143

SR143

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR147

SR147

SR148

SR148

SR149

SR149

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR153

SR153

SR154

SR154

SR155

SR155

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR159

SR159

SR160

SR160

SR161

SR161

High byte

Low byte

High byte

Low byte

High byte

Low byte

The download log in the PLC
 SR227~SR308
SR227: The maximum number of download logs which are stored in SR227 is 20. Every
download log occupies 4 registers. The download actions which are recorded are
numbered, as shown in the following table.
Download action
Number
Downloading the program
1
Downloading the setting of the PLC
2

2-77

A H 5 00 Prog r am m ing M an ua l

Download action
Number
Downloading the module table
3
SR228: The download log pointer points to the latest download log. When a download
action is executed, the value of the download log pointer increases by one. The
range of pointer values is 0~19. For example, the download log pointer points to the
fourth download log when the value in SR228 is 3.
The time when the downloading actions occur and the action numbers are recorded in
SR229~SR30. The corresponding functions of these data registers are as follows.
*Time when the download action occurs
Action
Number
number
Year
Month
Day
Hour
Minute
Second
SR230
SR231
SR231
SR232
SR232
SR230
1
SR229
High byte

2

SR233

3

SR237

4

SR241

5

SR245

6

SR249

7

SR253

8

SR257

9

SR261

10

SR265

11

SR269

12

SR273

13

SR277

14

SR281

15

SR285

16

SR289

17

SR293

18

SR297

19

SR301

20

SR305

Low byte

High byte

Low byte

High byte

SR234

SR234

SR235

SR235

SR236

SR236

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR238

SR238

SR239

SR239

SR240

SR240

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR242

SR242

SR243

SR243

SR244

SR244

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR246

SR246

SR247

SR247

SR248

SR248

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR250

SR250

SR251

SR251

SR252

SR252

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR254

SR254

SR255

SR255

SR256

SR256

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR258

SR258

SR259

SR259

SR260

SR260

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR262

SR262

SR263

SR263

SR264

SR264

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR266

SR266

SR267

SR267

SR268

SR268

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR270

SR270

SR271

SR271

SR272

SR272

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR274

SR274

SR275

SR275

SR276

SR276

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR278

SR278

SR279

SR279

SR280

SR280

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR282

SR282

SR283

SR283

SR284

SR284

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR286

SR286

SR287

SR287

SR288

SR288

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR290

SR290

SR291

SR291

SR292

SR292

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR294

SR294

SR295

SR295

SR296

SR296

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR298

SR298

SR299

SR299

SR300

SR300

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR302

SR302

SR303

SR303

SR304

SR304

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR306

SR306

SR307

SR307

SR308

SR308

High byte

Low byte

High byte

Low byte

High byte

Low byte

*Time when the download action occurs: The data is stored as the values in the
binary-coded decimal. The range of values is as follows.
Function
Value
Year
00~99 (A.D.)
Month
01~12
Day
01~31

2-78

Low byte

Ch ap te r 2 De vices

Function
Hour
Minute
Second
8.

Value
00~23
00~59
00~59

The PLC status change log
 SR309~SR390
SR309: The maximum number of PLC status change logs which are stored in SR309 is 20.
Every PLC status change log occupies 4 registers. The PLC status change actions
which are recorded are numbered, as shown in the following table.
PLC status change
Number

The PLC is supplied with power.
1
The PLC is disconnected.
2
The PLC starts to run.
3
The PLC stops running.
4
Default setting of the PLC
5
(1. RST button; 2. Communication command)
Pressing the CLR button on the PLC
6
(Clearing the data in the latched device)
SR310: The PLC status change log pointer points to the latest PLC status change log.
When the PLC status is changed once, the value of the PLC status change log
pointer increases by one. The range of pointer values is 0~19. For example, the
PLC status change log pointer points to the fourth PLC status change log when the
value in SR310 is 3.
The time when the PLC status change actions occur is recorded in SR311~SR390. The
corresponding functions of these data registers are as follows.
Action
*Time when the PLC status change action occurs
Number
number
Year
Month
Day
Hour
Minute
Second
SR312
SR313
SR313
SR314
SR314
SR312
1
SR311
2

SR315

3

SR319

4

SR323

5

SR327

6

SR331

7

SR335

8

SR339

9

SR343

10

SR347

11

SR351

12

SR355

13

SR359

High byte

Low byte

High byte

Low byte

High byte

SR316

SR316

SR317

SR317

SR318

Low byte

SR318

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR320

SR320

SR321

SR321

SR322

SR322

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR324

SR324

SR325

SR325

SR326

SR326

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR328

SR328

SR329

SR329

SR330

SR330

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR332

SR332

SR333

SR333

SR334

SR334

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR336

SR336

SR337

SR337

SR338

SR338

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR340

SR340

SR341

SR341

SR342

SR342

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR344

SR344

SR345

SR345

SR346

SR346

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR348

SR348

SR349

SR349

SR350

SR350

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR352

SR352

SR353

SR353

SR354

SR354

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR356

SR356

SR357

SR357

SR358

SR358

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR360

SR360

SR361

SR361

SR362

SR362

High byte

Low byte

High byte

Low byte

High byte

Low byte

2-79

A H 5 00 Prog r am m ing M an ua l

Number

Action
number

14

SR363

15

SR367

16

SR371

17

SR375

18

SR379

19

SR383

20

SR387

Year
SR364

*Time when the PLC status change action occurs
Month
Day
Hour
Minute
Second
SR364
SR365
SR365
SR366
SR366

High byte

Low byte

High byte

Low byte

High byte

SR368

SR368

SR369

SR369

SR370

Low byte

SR370

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR372

SR372

SR373

SR373

SR374

SR374

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR376

SR376

SR377

SR377

SR378

SR378

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR380

SR380

SR381

SR381

SR382

SR382

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR384

SR384

SR385

SR385

SR386

SR386

High byte

Low byte

High byte

Low byte

High byte

Low byte

SR388

SR388

SR389

SR389

SR390

SR390

High byte

Low byte

High byte

Low byte

High byte

Low byte

*Time when the PLC status change action occurs: The data is stored as the values in the
binary-coded decimal. The range of values is as follows.
Function
Value
Year
00~99 (A.D.)
Month
01~12
Day
01~31
Hour
00~23
Minute
00~59
Second
00~59
9.

The PLC operation flag
 SM400~SM403
SM400: The normally-open contact

SM401: The normally-closed contact
SM402: SM402 is ON during the first scan time, and then is switched OFF. The pulse width
equals one scan time. Users can use this contact to do the initial setting.
SM403: SM403 is OFF during the first scan time, and then is switched ON. That is, the
negative pulse is generated the moment the PLC runs.
T he PLC r uns .
SM400
SM401
SM402
SM403
Scan ti me

2-80

Ch ap te r 2 De vices

10. The initial clock pulse
 SM404~SM410, and SR409~SR410
The PLC provides seven types of clock pulses. When the PLC is supplied with power, the
seven types of clock pulses act automatically. Users can set the interval of the clock pulse in
SM409 and SM410.
Device
Function
10 millisecond clock pulse during which the pulse is ON for 5 milliseconds and is
SM404
OFF for 5 milliseconds
100 millisecond clock pulse during which the pulse is ON for 50 milliseconds
SM405
and is OFF for 50 milliseconds
200 millisecond clock pulse during which the pulse is ON for 100 milliseconds
SM406
and is OFF for 100 milliseconds
One second clock pulse during which the pulse is ON for 500 milliseconds and
SM407
is OFF for 500 milliseconds
Two second clock pulse during which the pulse is ON for one second and is
SM408
OFF for one second
2n second clock pulse during which the pulse is ON for n seconds and is OFF
SM409 for n seconds
The interval n is specified by SR409.
2n millisecond clock pulse during which the pulse is ON for n milliseconds and is
SM410 OFF for n milliseconds
The interval n is specified by SR410.
The clock pulses are illustrated as follows.
10 ms
100 Hz

SM404 (10 ms)
5 ms
100 ms

10 Hz

SM405 (100 ms)
50 ms
200 ms

5 Hz

SM406 (200 ms)
100 ms
1 sec

1 Hz

SM407 (1 sec)
500 ms

2-81

A H 5 00 Prog r am m ing M an ua l

2 sec
0.5 Hz
SM408 (2 sec)
1 sec
2n sec
1/2n Hz
SM409 (2n sec)
n sec

2n ms
SM410 (2n ms)

n ms

11. The flags related to the memory card
 SM450~SM453, and SR453
The memory card is used to backup the data in the PLC. The corresponding functions of
these special auxiliary relays and the corresponding function of SR453 are as follows.
Device
Function
Whether the memory card exists
SM450 ON: The memory card exists.
OFF: The memory card does not exist.
Write protection switch on the memory card
SM451 ON: The memory card is write protected.
OFF: The memory card is not write protected.
The data in the memory card is being accessed.
SM452 ON: The data in the memory card is being accessed.
OFF: The data in the memory card is not accessed.
An error occurs during the operation of the memory card.
SM453
ON: An error occurs.
If an error occurs during the operation of the memory card, the error code
SR453
will be recorded.
12. The flags related to the I/O module
 SR655~SR730 record the mapping error occurring in the module table or the error occurring
in the I/O module.
SR655~SR730 record the mapping error occurring in the module table.
If the mapping error occurs in the module table, the corresponding bit in the special data
register belonging to this module will be ON. Users can read the value in the special data
register to get the information about the position where the error occurs. For example, when
bit 5 in SR655 is ON, users can get the information that the error occurs at slot 5 in
backplane 1.
Main
Extension backplane
backplane
Description
Backplane Backplane Backplane Backplane Backplane Backplane Backplane Backplane
1
2
3
4
5
6
7
8

2-82

Device

SR655

SR656

SR657

SR658

SR659

SR660

SR661

SR662

Slot 0

Bit0

Bit0

Bit0

Bit0

Bit0

Bit0

Bit0

Bit0

Slot 1

Bit1

Bit1

Bit1

Bit1

Bit1

Bit1

Bit1

Bit1

Ch ap te r 2 De vices

Description

Main
Extension backplane
backplane
Backplane Backplane Backplane Backplane Backplane Backplane Backplane Backplane
1
2
3
4
5
6
7
8

Slot 2

Bit2

Bit2

Bit2

Bit2

Bit2

Bit2

Bit2

Bit2

Slot 3

Bit3

Bit3

Bit3

Bit3

Bit3

Bit3

Bit3

Bit3

Slot 4

Bit4

Bit4

Bit4

Bit4

Bit4

Bit4

Bit4

Bit4

Slot 5

Bit5

Bit5

Bit5

Bit5

Bit5

Bit5

Bit5

Bit5

Slot 6

Bit6

Bit6

Bit6

Bit6

Bit6

Bit6

Bit6

Bit6

Slot 7

Bit7

Bit7

Bit7

Bit7

Bit7

Bit7

Bit7

Bit7

Slot 8

Bit8

-

-

-

-

-

-

-

Slot 9

Bit9

-

-

-

-

-

-

-

Slot 10

Bit10

-

-

-

-

-

-

-

Slot 11

Bit11

-

-

-

-

-

-

-

SR663~SR730 record the mapping error code occurring in the module table.
If the mapping error occurs in the module table, the special data register belonging to this
module will record the error code. Users can read the error code in the special data register
to get the information about the error.
Main

Extension backplane

Description backplane
Backplane

Slot

Backplane Backplane Backplane Backplane Backplane Backplane Backplane Backplane
1
2
3
4
5
6
7
8

Slot 0

SR663

SR675

SR683

SR691

SR699

SR707

SR715

SR723

Slot 1

SR664

SR676

SR684

SR692

SR700

SR708

SR716

SR724

Slot 2

SR665

SR677

SR685

SR693

SR701

SR709

SR717

SR725

Slot 3

SR666

SR678

SR686

SR694

SR702

SR710

SR718

SR726

Slot 4

SR667

SR679

SR687

SR695

SR703

SR711

SR719

SR727

Slot 5

SR668

SR680

SR688

SR696

SR704

SR712

SR720

SR728

Slot 6

SR669

SR681

SR689

SR697

SR705

SR713

SR721

SR729

Slot 7

SR670

SR682

SR690

SR698

SR706

SR714

SR722

SR730

Slot 8

SR671

-

-

-

-

-

-

-

Slot 9

SR672

-

-

-

-

-

-

-

Slot 10

SR673

-

-

-

-

-

-

-

Slot 11

SR674

-

-

-

-

-

-

-

13. The flags related to the Ethernet
 SM1090, SM1091, and SM1106~SM1109
SM
Description
number
SM1090 The TCP connection is busy.
SM1091 The UDP connection is busy.

Function
ON: TCP connection timeout
ON: UDP connection timeout

2-83

A H 5 00 Prog r am m ing M an ua l

SM
number

Description

SM1106

Ethernet connection error

SM1107

Basic setting error

SM1108

Filter setting error

Function
OFF: The Ethernet auto-negotiation
succeeds.
ON: The Ethernet auto-negotiation fails.
OFF: The basic setting is correct.
ON: The basic setting is incorrect.
OFF: The filter setting is correct.
ON: The filter setting is incorrect.

Basic management of the
TCP/UDP socket─The local port The flag is ON when the same port is used.
is already used.
Please refer to section 12.2 in AH500 Operation Manual for more information about the LED
indicators and the error codes.
14. The setting of the email sending
 SM1112~SM1113, and SM1116~SM1195
Before sending the email, users have to set the related parameters in the email. If the
setting fails, SM1112 will be set to ON. Besides, SM1113 will be set to ON if the sending of
the email fails.
The triggers (trigger1~trigger8) and the flags (SM1116~SM1195) are described below.
Trigger Trigger Trigger Trigger Trigger Trigger Trigger Trigger
Item
Function
1
2
3
4
5
6
7
8
Email
SM1116 SM1126 SM1136 SM1146 SM1156 SM1166 SM1176 SM1186
SM1109

trigger
switch
Email
trigger

Email
trigger
status 0
Email
trigger
status 1
Email
trigger
status 2
Email
trigger
status 3
SMTP
server
response
timeout
SMTP
server
response
error

When the basic setting is incorrect, the flag is set to ON.
SM1117 SM1127 SM1137 SM1147 SM1157 SM1167
When the filter setting is incorrect, the flag is set to ON.
SM1118 SM1128 SM1138 SM1148 SM1158 SM1168

SM1177

SM1187

SM1178

SM1188

When the trigger is enabled and no mail has been sent, the flag is ON.
SM1119 SM1129 SM1139 SM1149 SM1159 SM1169 SM1179 SM1189
When the trigger is enabled and the last mail has been sent successfully, the flag is
ON.
SM1120 SM1130 SM1140 SM1150 SM1160 SM1170 SM1180 SM1190
When the trigger is enabled and the last mail has been sent in error, the flag is ON.
SM1121

SM1131

SM1141

SM1151

SM1161

SM1171

SM1181

SM1191

When the trigger is enabled and the mail has been sent, the flag is ON.
SM1122

SM1132

SM1142

SM1152

SM1162

SM1172

SM1182

SM1192

When the trigger is enabled and there is an SMTP server response timeout, the flag
is ON.
SM1123

SM1133

SM1143

SM1153

SM1163

SM1173

SM1183

SM1193

When the trigger is enabled and there is an SMTP server response error, the flag is
ON.
SM1124

SM1134

SM1144

SM1154

SM1164

SM1174

SM1184

SM1194

Attachment
size error When the trigger is enabled and the size of the attachment exceeds the limit, the flag

is ON.

Nonexistent SM1125 SM1135 SM1145 SM1155 SM1165 SM1175 SM1185 SM1195
attachment When the trigger is enabled and the attachment is not found, the flag is ON.

Please refer to section 12.2 in AH500 Operation Manual for more information about the LED
indicators and the error codes.

2-84

Ch ap te r 2 De vices

15. Setting the TCP/UDP socket
 SR1118-SR1320
The TCP/UDP sockets are set in SR1118-SR1320, and eight TCP/UDP sockets at most can
be set. Users can set the sockets which uses the TCP protocol to execute the data
exchange in SR1118~SR1221.
Socket
Number

1

2

3

4

5

6

7

8

SR1118

SR1131

SR1144

SR1157

SR1170

SR1183

SR1196

SR1209

SR1119

SR1132

SR1145

SR1158

SR1171

SR1184

SR1197

SR1210

SR1120

SR1133

SR1146

SR1159

SR1172

SR1185

SR1198

SR1211

SR1121

SR1134

SR1147

SR1160

SR1173

SR1186

SR1199

SR1212

SR1122

SR1135

SR1148

SR1161

SR1174

SR1187

SR1200

SR1213

SR1123

SR1136

SR1149

SR1162

SR1175

SR1188

SR1201

SR1214

SR1124

SR1137

SR1150

SR1163

SR1176

SR1189

SR1202

SR1215

SR1125

SR1138

SR1151

SR1164

SR1177

SR1190

SR1203

SR1216

SR1126

SR1139

SR1152

SR1165

SR1178

SR1191

SR1204

SR1217

SR1127

SR1140

SR1153

SR1166

SR1179

SR1192

SR1205

SR1218

SR1128

SR1141

SR1154

SR1167

SR1180

SR1193

SR1206

SR1219

SR1129

SR1142

SR1155

SR1168

SR1181

SR1194

SR1207

SR1220

SR1130

SR1143

SR1156

SR1169

SR1182

SR1195

SR1208

SR1221

Item

Local
communication
port
Remote IP
address
(high word)
Remote IP
address
(low word)
Remote
communication
port
Transmitted
data length
Transmitted
data address
(high word)
Transmitted
data address
(low word)
Received data
length
Received data
address
(high word)
Received data
address
(low word)
Persistent
connection
time
Transmitted
data counter
Received data
counter

Users can set the sockets which uses the UDP protocol to execute the data exchange in
SR1222~SR1317.
Socket
Number

1

2

3

4

5

6

7

8

SR1222

SR1234

SR1246

SR1258

SR1270

SR1282

SR1294

SR1306

SR1223

SR1235

SR1247

SR1259

SR1271

SR1283

SR1295

SR1317

SR1224

SR1236

SR1248

SR1260

SR1272

SR1284

SR1296

SR1318

SR1225

SR1237

SR1249

SR1261

SR1273

SR1285

SR1297

SR1309

SR1226

SR1238

SR1250

SR1262

SR1274

SR1286

SR1298

SR1310

SR1227

SR1239

SR1251

SR1263

SR1275

SR1287

SR1299

SR1311

Item

Local
communication
port
Remote IP
address
(high word)
Remote IP
address
(low word)
Remote
communication
port
Transmitted
data length
Transmitted
data address
(high word)

2-85

A H 5 00 Prog r am m ing M an ua l

Socket
Number

1

2

3

4

5

6

7

8

SR1228

SR1240

SR1252

SR1264

SR1276

SR1288

SR1300

SR1312

SR1229

SR1241

SR1253

SR1265

SR1277

SR1289

SR1301

SR1313

SR1230

SR1242

SR1254

SR1266

SR1278

SR1290

SR1302

SR1314

SR1231

SR1243

SR1255

SR1267

SR1279

SR1291

SR1303

SR1315

SR1232

SR1244

SR1256

SR1268

SR1280

SR1292

SR1304

SR1316

SR1233

SR1245

SR1257

SR1269

SR1281

SR1293

SR1305

SR1317

Item

Transmitted
data address
(low word)
Received data
length
Received data
address
(high word)
Received data
address
(low word)
Transmitted
data counter
Received data
counter

Please refer to section 6.22 for more information related to the Ethernet control instructions.
16. The functions related to the PLC Link
 SM1392~SM1598, and SR1329~SR1787
The PLC Link supports COM1 on the PLC. At most 32 slaves can be connected. When the
master connects to the AH500 series programmable logic controllers, at most 450 words or
7200 bits can be read from the AH500 series programmable logic controllers and written
into them. When the master connects to other models which support the standard Modbus,
at most 100 words or 1600 bits can be read from these models and written into them.
Master
Slave 1
Read

Latched area
2-86

Slave 2
Write

Read

Write

Address in
Address in
the master:
the master:
The device
The device
address into
address from
which the
which the
data is read
data is written
(SR1404 and (SR1468 and
SR1405)
SR1469)
Address in
Address in
the slave:
the slave:
The device
The device
address from address into
which the
which the
data is read
data is written
(SR1532 and (SR1596 and
SR1533)
SR1597)
Number of
Number of
data which is
data which is
read from the written into
slave
the slave
(SR1660)
(SR1692)
Device type
Device type
(SR1340)
(SR1372)
Type of slave 1 (SR1724)

Address in
Address in
the master:
the master:
The device
The device
address into
address from
which the
which the
data is read
data is written
(SR1406 and
(SR1470 and
SR1407)
SR1471)
Address in
Address in
the slave:
the slave:
The device
The device
address from
address into
which the
which the
data is read
data is written
(SR1534 and
(SR1598 and
SR1535)
SR1599)
Number of
Number of
data which is
data which is
read from the written into
slave
the slave
(SR1661)
(SR1693)
Device type
Device type
(SR1341)
(SR1373)
Type of slave 2 (SR1725)

Address of slave 1 (SR1756)

Address of slave 2 (SR1757)

…
…

…

…

…

…

Slave 32
Read
Write
Address in
Address in
the master:
the master:
The device
The device
address into
address from
which the
which the
data is read
data is written
(SR1466 and (SR1530 and
SR1467)
SR1531)
Address in
Address in
the slave:
the slave:
The device
The device
address from address into
which the
which the
data is read
data is written
(SR1594 and (SR1658 and
SR1595)
SR1659)
Number of
Number of
data which is
data which is
read from the written into
slave
the slave
(SR1691)
(SR1723)
Device type
Device type
(SR1371)
(SR1340)
Type of slave 32 (SR1755)

…
… Address of slave 32 (SR1787)

Ch ap te r 2 De vices

Master
Slave 1
Read

Slave 2

Write

Non-latched area

PLC Link flag (SM1392)
Data exchange flag (SM1424)
Read error
Write error
flag
flag
(SM1456)
(SM1488)
The data reading is complete.
(ON->OFF) (SM1520)
The data writing in the PLC
Link is complete. (ON->OFF)
(SM1552)

…
Slave 32
…
Read
Write
PLC Link flag (SM1393)
… PLC Link flag (SM1423)
Data exchange flag (SM1425) … Data exchange flag (SM1455)
Read

Write

Read error
Write error
flag
flag
(SM1457)
(SM1489)
The data reading is complete.
(ON->OFF) (SM1521)
The data writing in the PLC
Link is complete. (ON->OFF)
(SM1553)

Read error

Write error
flag
(SM1487)
(SM1519)
The data reading is complete.
… (ON->OFF) (SM1551)
The data writing in the PLC
… Link is complete. (ON->OFF)
(SM1583)

… flag

….

Please refer to section 11.1 in AH500 Operation Manual for more information related to the
PLC Link.
17. The functions related to the Ether Link
Starting the Ether Link
Ether Link error flag
Status of the Ether Link
Port
OFF: Stop
OFF: Incorrect
OFF: Stop
ON: Start
ON: Correct
ON: Run
CPU
SM1770
SM1788
SM1806
Port 0
SM1772
SM1790
SM1808
Port 1
SM1773
SM1791
SM1809
Port 2
SM1774
SM1792
SM1810
Port 3
SM1775
SM1793
SM1811
Port 4
SM1776
SM1794
SM1812
Port 5
SM1777
SM1795
SM1813
Port 6
SM1778
SM1796
SM1814
Port 7
SM1779
SM1797
SM1815
Port 8
SM1780
SM1798
SM1816
Port 9
SM1781
SM1799
SM1817
Port 10
SM1782
SM1800
SM1818
Port 11
SM1783
SM1801
SM1819
Port 12
SM1784
SM1802
SM1820
Port 13
SM1785
SM1803
SM1821
Port 14
SM1786
SM1804
SM1822
Port 15
SM1787
SM1805
SM1823
Please refer to section 11.2 in AH500 Operation Manual for more information related to the
Ether Link.
18. Setting the IP address
 SR1792~SR2047
Device
Function
Description
High eight bits in the IP address of block 1
IP address of
SR1792
Example: If the remote IP address is 192.168.1.100, the
block 1
value in the register is 16#C0A8.
Low eight bits in the IP address of block 1
IP address of
SR1793
Example: If the remote IP address is 192.168.1.100, the
block 1
value in the register is 16#0164.

SR2046

IP address of
block 128

High eight bits in the IP address of block 128
Example: If the remote IP address is 192.168.1.100, the
value in the register is 16#C0A8.

2-87

A H 5 00 Prog r am m ing M an ua l

Device

Function

Description
Low eight bits in the IP address of block 128
IP address of
SR2047
Example: If the remote IP address is 192.168.1.100, the
block 128
value in the register is 16#0164.
Please refer to section 11.2 in AH500 Operation Manual for more information related to the
Ether Link.

2.2.17 Link Registers
The link register is mainly used in the PLC Link or the Ether Link. When the data exchange occurs
between the AH500 series programmable logic controllers, the link register can be used as the
buffer. Please refer to chapter 12 in AH500 Operation Manual for more information.
The link registers L0~L65535 add up to 65536 words. Besides, the link register can be used as the
general auxiliary register.

2.2.18 Index Registers
The index register is the 16-bit data register. It is like the general register in that the data can be
read from it and written into it. However, it is mainly used as the index register. The range of index
registers is E0~E13. Please refer to section 4.3 for more information related to the index register.

2-88

Chapter 3

Instruction Tables

Table of Contents
3.1
3.1.1
3.1.2
3.2
3.2.1
3.2.2
3.2.3
3.2.4
3.3
3.4
3.4.1
3.4.2

Instructions.............................................................................................3-2
Basic Instructions ...............................................................................3-2
Applied Instructions ............................................................................3-2
Instruction Tables ...................................................................................3-3
Basic Instructions ...............................................................................3-3
Applied Instructions ............................................................................3-4
Applied Instructions (Sorted Alphabetically) .......................................3-5
Device Tables ....................................................................................3-6
Lists of Basic Instructions.......................................................................3-7
Lists of Applied Instructions....................................................................3-9
Applied Instructions ............................................................................3-9
Applied Instructions (Sorted Alphabetically) .....................................3-35

AH Pro gramming Ma nu al

3.1 Instructions
Instructions used in the AH500 series PLC include basic instructions and applied instructions.

3.1.1 Basic Instructions
Classification
Contact instructions
Connection instructions
Output instructions
Master control
Instructions
Rising-edge/Falling-edge
detection contact
instructions
Rising-edge/Falling-edge
output instructions
Other instructions

Description
Loading the contact, connecting the contact in series, connecting
the contact in parallel, and etc.
Storing and reading the operation result
Bit device output; pulse output
Setting and resetting the master control
Triggering the instructions that load the contact, connect the
contacts in series, and connect the contacts in parallel
Bit device output
Other instructions

3.1.2 Applied Instructions
API
0000~0065

Classification
Comparison instructions

0100~0116

Arithmetic instructions

0200~0219

Data conversion
instructions

0300~0310
0400~0402

0600

Data transfer instructions
Jump instructions
Program execution
instructions
I/O refreshing instructions

0700~0707

Convenience instructions

0800~0817

Logic instructions

0900~0904
1000~1004
1100~1115

Rotation instructions
Basic instructions
Shift instructions
Data processing
instructions
Structure creation
instructions

0500~0502

1200~1223
1300~1302
1400~1401
1500~1524
1600~1606
1700~1704
1800~1811
1900~1905

Module instructions

Description
Comparisons such as =, <>, >, >=, <, <=, and etc.
Using binary numbers or binary-coded decimal
numbers to add, subtract, multiply, or divide.
Converting the binary-coded decimal number into
the binary number, and converting the binary
number into the binary-coded decimal number
Transfer the specified data
The program jumps.
Enabling or disabling the interrupt
Refreshing the I/O.
Instructions which are applied to the counters, the
teaching timers, the special timers, and etc.
Logical operations such as logical addition, logical
multiplication, and etc.
Rotating/Shifting the specified data
Timer instructions and counter instructions
Shifting the specified data
16-bit data processing such as decoding and
encoding.
Nested loops
Reading the data from the special module and
writing the data into the special module

Floating-point number
instructions
Real-time clock
instructions
Peripheral instructions
Communication
instructions

Reading/Writing, adding/subtracting and comparing
the time
I/O points connected to the peripheral

Other instructions

Instructions which are different from those
mentioned above

Floating-point number operations

Controlling the peripheral though communication

Ch ap te r 3 Inst ru ct ion T ab les
API

Classification

2100~2121

String processing
instructions

2200~2207

Ethernet instructions

2300~2302

Memory card instructions

2400~2401

Task control instructions

Description
Conversion between binary/binary-coded decimal
numbers and ASCII codes; conversion between
binary numbers and strings; conversion between
floating-point numbers and strings; string
processing
Controlling the Ethernet data exchange
Reading the data from the memory card and writing
the data into the memory card
Controlling the task in the program

3.2 Instruction Tables
3.2.1 Basic Instructions

The descriptions:

: The instruction name
: The symbol used in the ladder diagram in ISPSoft
: The function
: The operands supported by the instruction

3-3

A H 5 00 Prog r am m ing M an ua l

3.2.2 Applied Instructions

The descriptions:

: The applied instruction number
: The instruction name
: If the 16-bit instruction can be used as the 32-bit instruction, a D is added in front of the 16-bit
instruction to form the 32-bit instruction.

:  indicates that the instruction can be used as the pulse instruction, whereas ─ indicates that it
can not.
If users want to use the pulse instruction, they only need to add a P in back of the instruction.

: The symbol used in the ladder diagram in ISPSoft
: The function
: If the 32-bit floating-point number instruction can be used as the 64-bit floating-point number
instruction, a D is added in front of the 32-bit floating-point number instruction to form the 64-bit
floating-point number instruction.

3-4

Ch ap te r 3 Inst ru ct ion T ab les

3.2.3 Applied Instructions (Sorted Alphabetically)

The descriptions:

: The initial of the instruction name
: The applied instruction number
~: The instruction names
If the 16-bit instruction can be used as the 32-bit instruction, a D is added in front of the
16-bit instruction to form the 32-bit instruction.
If the 32-bit floating-point number instruction can be used as the 64-bit floating-point
number instruction, a D is added in front of the 32-bit floating-point number instruction to
form the 64-bit floating-point number instruction.

:  indicates that the instruction can be used as the pulse instruction, whereas ─ indicates that it
can not.
If users want to use the pulse instruction, they only need to add a P in back of the instruction
name.

: The function

3-5

A H 5 00 Prog r am m ing M an ua l

3.2.4 Device Tables

The descriptions:

: The applied instruction number
: The instruction name
If the 16-bit instruction can be used as the 32-bit instruction, a D is added in front of the 16-bit
instruction to form the 32-bit instruction.
If the 32-bit floating-point number instruction can be used as the 64-bit floating-point number
instruction, a D is added in front of the 32-bit floating-point number instruction to form the 64-bit
floating-point number instruction.
If the instruction can be used as the pulse instruction, a P is added in back of the instruction.

: The operand
: The function
: The devices which are supported by the operand
1. The decimal forms are notated by K, but they are entered directly in ISPSoft. For example,
the decimal number 30 is entered directly in ISPSoft.
2. The hexadecimal forms are notated by 16#. For example, the decimal number 30 is
represented by 16#1E in the hexadecimal system.
3. The floating-point numbers are notated by F/DF, but they are represented by decimal points
in ISPSoft. For example, the floating-point number F500 is represented by 500.0 in ISPSoft.
4. The strings are notated by “$”, but they are represented by “ ” in ISPSoft. For example, the
string 1234 is represented by “1234” in ISPSoft.
5. ○: The hollow circle
The device can not be modified by an index register.
6. ●: The solid circle
The device can not be modified by an index register.

3-6

Ch ap te r 3 Inst ru ct ion T ab les

: The ladder diagram
: The unit of the operand
: The format of the instruction
It indicates whether the instruction can be used as the pulse instruction, the 16-bit instruction,
the 32-bit instruction, or the 64-bit instruction, and the number of steps.

3.3 Lists of Basic Instructions


Contact instructions
Instruction
Symbol
code

Function

Operand

LD
AND

Loading contact
A/Connecting contact A in
series/Connecting contact
A in parallel

DX, X, Y, M, S, T, C, HC,
D, L, SM, and PR

Loading contact
B/Connecting contact B in
series/Connecting contact
B in parallel

DX, X, Y, M, S, T, C, HC,
D, L, SM, and PR

OR
LDI
ANI
ORI


Connection instructions
Instruction
Symbol
code

Function

Operand

ANB

Connecting the loop blocks
in series

─

ORB

Connecting the loop blocks
in parallel

─

MPS

─

MRD

─

MPP

─

Storing the data in the
stack
Reading the data from the
stack
Popping the data from the
stack

─
─
─

3-7

A H 5 00 Prog r am m ing M an ua l




Output instructions
Instruction
Symbol
code

Operand

OUT

Driving the coil

DY, X, Y, M, S, T, C, HC,
D, L, SM, and PR

SET

Keeping the device on

DY, X, Y, M, S, T, C, HC,
D, L, SM, and PR

Master control instructions
Instruction
Symbol
code
MC

MCR



Execution
condition

Function

Function

Operand

Setting the master control

N

Resetting the master control

N

Rising-edge/Falling-edge detection contact instructions
Instruction
Execution
Symbol
Function
code
condition

Operand

LDP
PED
ANDP
APED
ORP

Starting the rising-edge
detection/Connecting
the rising-edge
detection in
series/Connecting the
rising-edge detection in
parallel

DX, X, Y, M, S, T, C, HC,
D, L, SM, and PR

Starting the
falling-edge
detection/Connecting
the falling-edge
detection in
series/Connecting the
falling-edge detection
in parallel

DX, X, Y, M, S, T, C, HC,
D, W, L, SM, and PR

OPED
LDF
NED
ANDF
ANED
ORF
ONED


Rising-edge/Falling-edge output instructions
Instruction
Symbol
Function
code
PLS

3-8

Rising-edge output

Execution
condition

Operand
DY, X, Y, M, S, T, C, HC,
D, L, SM, and PR

Ch ap te r 3 Inst ru ct ion T ab les
Instruction
code

Symbol

Execution
condition

Other instructions
Instruction
Symbol
code

Operand
DY, X, Y, M, S, T, C, HC,
D, L, SM, and PR

Falling-edge output

PLF



Function

Function

Operand

Inverting the logical operation result

–

No operation

–

Stopping executing the PLC
program

–

NP

The circuit is rising edge-triggered.

–

PN

The circuit is falling edge-triggered.

–

FB_NP

The circuit is rising edge-triggered.

S

FB_PN

The circuit is falling edge-triggered.

S

INV
NOP

–

PSTOP

3.4 Lists of Applied Instructions
3.4.1 Applied Instructions
Comparison instructions
Instruction code
Pulse
API
16-bit
32-bit Instruction



Symbol

Function
Comparing the values

0000

0001

LD=

LD<>

DLD=

DLD<>

–

ON: S1=S2

–

OFF: S1≠S2
Comparing the values
ON: S1≠S2
OFF: S1=S2
Comparing the values

0002

LD>

DLD>

–

ON: S1>S2
OFF: S1≦S2
Comparing the values

0003

LD>=

DLD>=

–

ON: S1≧S2
OFF: S1<S2
Comparing the values

0004

LD<

DLD<

–

ON: S1<S2
OFF: S1≧S2

3-9

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
16-bit
32-bit

Pulse
Instruction

Symbol

Function
Comparing the values

0005

LD<=

DLD<=

–

ON: S1≦S2
OFF: S1>S2
Comparing the values

0006

AND=

0007 AND<>

DAND=

DAND<>

–

ON: S1=S2

–

OFF: S1≠S2
Comparing the values
ON: S1≠S2
OFF: S1=S2
Comparing the values

0008

AND>

DAND>

–

ON: S1>S2
OFF: S1≦S2
Comparing the values

0009 AND>=

DAND>=

–

ON: S1≧S2
OFF: S1<S2
Comparing the values

0010

AND<

DAND<

–

ON: S1<S2
OFF: S1≧S2
Comparing the values

0011 AND<=

DAND<=

–

ON: S1≦S2
OFF: S1>S2
Comparing the values

0012

0013

OR=

OR<>

DOR=

DOR<>

–

ON: S1=S2

–

OFF: S1≠S2
Comparing the values
ON: S1≠S2
OFF: S1=S2
Comparing the values

0014

OR>

DOR>

–

ON: S1>S2
OFF: S1≦S2
Comparing the values

0015

OR>=

DOR>=

–

ON: S1≧S2
OFF: S1<S2
Comparing the values

0016

OR<

DOR<

–

ON: S1<S2
OFF: S1≧S2
Comparing the values

0017

OR<=

DOR<=

–

ON: S1≦S2
OFF: S1>S2

3-10

Ch ap te r 3 Inst ru ct ion T ab les

API

0018

Instruction code
32-bit
64-bit
FLD=

0019 FLD<>

DFLD=

DFLD<>

Pulse
Instruction
–

–

Symbol

Function
Comparing the floating-point
numbers
ON: S1=S2
OFF: S1≠S2
Comparing the floating-point
numbers
ON: S11≠S2
OFF: S1=S2
Comparing the floating-point
numbers

0020

FLD>

DFLD>

–

ON: S1>S2
OFF: S1≦S2
Comparing the floating-point
numbers

0021 FLD>=

DFLD>=

–

ON: S1≧S2
OFF: S1<S2
Comparing the floating-point
numbers

0022

FLD<

DFLD<

–

ON: S1<S2
OFF: S1≧S2
Comparing the floating-point
numbers

0023 FLD<=

DFLD<=

–

ON: S1≦S2
OFF: S1>S2

0024 FAND=

DFAND=

0025 FAND<> DFAND<>

–

–

Comparing the floating-point
numbers
ON: S1=S2
OFF: S1≠S2
Comparing the floating-point
numbers
ON: S1≠S2
OFF: S1=S2

0026 FAND>

DFAND>

0027 FAND>= DFAND>=

–

–

Comparing the floating-point
numbers
ON: S1>S2
OFF: S1≦S2
Comparing the floating-point
numbers
ON: S1≧S2
OFF: S1<S2

0028 FAND<

DFAND<

–

Comparing the floating-point
numbers
ON: S1<S2
OFF: S1≧S2

3-11

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
32-bit
64-bit

0029 FAND<= DFAND<=

Pulse
Instruction
–

Symbol

Function
Comparing the floating-point
numbers
ON: S1≦S2
OFF: S1>S2

0030

FOR=

0031 FOR<>

DFOR=

DFOR<>

–

–

Comparing the floating-point
numbers
ON: S1=S2
OFF: S1≠S2
Comparing the floating-point
numbers
ON: S1≠S2
OFF: S1=S2

0032

FOR>

0033 FOR>=

DFOR>

DFOR>=

–

–

Comparing the floating-point
numbers
ON: S1>S2
OFF: S1≦S2
Comparing the floating-point
numbers
ON: S1≧S2
OFF: S1<S2

0034

FOR<

0035 FOR<=

DFOR<

DFOR<=

–

–

Comparing the floating-point
numbers
ON: S1<S2
OFF: S1≧S2
Comparing the floating-point
numbers
ON: S1≦S2
OFF: S1>S2
Comparing the strings

0036

LD$=

0037 LD$<>

–

–

–

ON: S1=S2

–

ON: S1≠S2
Comparing the strings
ON: S1≠S2
OFF: S1=S2
Comparing the strings

0038

LD$>

0039 LD$>=

–

–

–

ON: S1>S2

–

OFF: S1≦S2
Comparing the strings
ON: S1≧S2
OFF: S1<S2
Comparing the strings

0040

LD$<

–

–

ON: S1<S2
OFF: S1≧S2

3-12

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
32-bit
64-bit

0041 LD$<=

–

Pulse
Instruction
–

Symbol

Function
Comparing the strings
ON: S1≦S2
OFF: S1>S2
Comparing the strings

0042 AND$=

0043 AND$<>

–

–

–

ON: S1=S2

–

OFF S1≠S2
Comparing the strings
ON: S1≠S2
OFF: S1=S2
Comparing the strings

0044 AND$>

0045 AND$>=

–

–

–

ON: S1>S2

–

OFF: S1≦S2
Comparing the strings
ON: S1≧S2
OFF: S1<S2
Comparing the strings

0046 AND$<

0047 AND$<=

–

–

–

ON: S1<S2

–

OFF: S1≧S2
Comparing the strings
ON: S1≦S2
OFF: S1>S2
Comparing the strings

0048

OR$=

0049 OR$<>

–

–

–

ON: S1=S2

–

OFF: S1≠S2
Comparing the strings
ON: S1≠S2
OFF: S1=S2
Comparing the strings

0050

OR$>

0051 OR$>=

–

–

–

ON: S1>S2

–

OFF: S1≦S2
Comparing the strings
ON: S1≧S2
OFF: S1<S2
Comparing the strings

0052

OR$<

0053 OR$<=

–

–

–

ON: S1<S2

–

OFF: S1≧S2
Comparing the strings
ON: S1≦S2
OFF: S1>S2

3-13

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
32-bit
64-bit

0054

CMP

DCMP



Comparing the values

0055

ZCP

DZCP



Zone comparison

0056

–

FCMP



Comparing the floating-point
numbers

0057

–

FZCP



Floating-point zone comparison

0058 MCMP

–



Matrix comparison

0059 CMPT=

–



Comparing the tables
ON: =

0060 CMPT<>

–



Comparing the tables
ON: ≠

0061 CMPT>

–



Comparing the tables
ON: >

0062 CMPT>=

–



Comparing the tables
ON: ≧

0063 CMPT<

–



Comparing the tables
ON: <

0064 CMPT<=

–



Comparing the tables
ON: ≦

3-14

Pulse
Instruction

Symbol

Function

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
32-bit
64-bit

0065 CHKADR

–

Pulse
Instruction

Symbol

Function
Checking the address of the contact
type of pointer register

–



Arithmetic instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

0100

+

D+



Addition of binary numbers
S1+S2=D

0101

-

D-



Subtraction of binary numbers
S1-S2=D

0102

*

D*



Multiplication of binary numbers
S1*S2=D

0103

/

D/



Division of binary numbers
S1/S2=D

API

Instruction code
Pulse
32-bit
64-bit instruction

Symbol

Function

0104

F+

DF+



Addition of floating-point numbers
S1+S2=D

0105

F-

DF-



Subtraction of floating-point
numbers
S1-S2=D

3-15

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
Pulse
32-bit
64-bit instruction

Symbol

Function

0106

F*

DF*



Multiplication of floating-point
numbers
S1*S2=D

0107

F/

DF/



Division of floating-point numbers
S1/S2=D

0108

B+

DB+



Addition of binary-coded decimal
numbers
S1+S2=D

0109

B-

DB-



Subtraction of binary-coded
decimal numbers
S1-S2=D

0110

B*

DB*



Multiplication of binary-coded
decimal numbers
S1*S2=D

0111

B/

DB/



Division of binary-coded decimal
numbers
S1/S2=D

0112

BK+

–



Addition of binary numbers in
blocks

0113

BK-

–



Subtraction of binary numbers in
blocks

0114

$+

–



Linking the strings

3-16

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
Pulse
32-bit
64-bit instruction

Symbol

Function

0115

INC

DINC



Adding one to the binary number

0116

DEC

DDEC



Subtracting one from the binary
number



Data conversion instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

0200

BCD

DBCD



Converting the binary number into
the binary-coded decimal number

0201

BIN

DBIN



Converting the binary-coded
decimal number into the binary
number

0202

FLT

DFLT



Converting the binary integer into
the binary floating-point number

0203

FLTD

DFLTD



Converting the binary integer into
the 64-bit floating-point number

0204

INT

DINT



Converting the 32-bit floating-point
number into the binary integer

API

Instruction code
Pulse
32-bit
64-bit instruction

0205

DFINT

DFINT

API

Instruction code
16-bit
32-bit

0206

MMOV

–

Symbol

Converting the 64-bit floating-point
number into the binary integer



Pulse
instruction


Function

Symbol

Function
Converting the 16-bit value into
the 32-bit value

3-17

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
16-bit
32-bit

0207

RMOV

–



Converting the 32-bit value into
the 16-bit value

0208

GRY

DGRY



Converting the binary number into
the Gray code

0209

GBIN

DGBIN



Converting the Gray code into the
binary number

0210

NEG

DNEG



Two’s complement

0211

–

FNEG



Reversing the sign of the 32-bit
floating-point number

0212

–

FBCD



0213

–

FBIN



0214

BKBCD

–



0215

BKBIN

–



Converting the binary numbers in
blocks into the binary-coded
decimal numbers in blocks

0216

SCAL

–



Scale value operation

0217

SCLP

DSCLP



Parameter type of scale value
operation

0218

LINE

DLINE



Converting a column of data into a
line of data

3-18

Pulse
instruction

Symbol

Function

Converting the binary
floating-point number into the
decimal floating-point number
Converting the decimal
floating-point number into the
binary floating-point number
Converting the binary numbers in
blocks into the binary-coded
decimal numbers in blocks

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
16-bit
32-bit

0219

COLM

DCOLM

Pulse
instruction

Symbol

Function

Converting a line of data into a
column of data





Data transfer instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

0300

API
0301

MOV

DMOV

Instruction code
32-bit
64-bit
–

DFMOV

Symbol



Pulse
instruction

Transferring the data

Symbol

Function
Transferring the 64-bit
floating-point number



Pulse
instruction

Function

API

Instruction code
16-bit
32-bit

0302

$MOV

–



Transferring the string

0303

CML

DCML



Inverting the data

0304

BMOV

–



Transferring all data

0305

NMOV

DNMOV



Transferring the data to several
devices

0306

XCH

DXCH



Exchanging the data

0307

BXCH

–



Exchanging all data

Symbol

Function

3-19

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
16-bit
32-bit

Pulse
instruction

0308

SWAP

DSWAP



Exchange the high byte with the
low byte

0309

SMOV

–



Transferring the digits

0310

MOVB

–



Transferring several bits

Symbol

Function



Jump instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

0400

CJ

–



Conditional jump

0401

JMP

–

–

Unconditional jump

–

–

Jumping to END

0402 GOEND



Program execution instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

0500

DI

–

–

Disabling the interrupt

0501

EI

–

–

Enabling the interrupt

–

–

Controlling the interrupt

0502 IMASK



I/O refreshing instructions
Instruction code
Pulse
API
instruction
16-bit
32-bit

0600

REF

─

Symbol



Function
Refreshing the I/O



Convenience instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

0700

ALT

0701 TTMR

3-20

Symbol

Function

─



Alternating between ON and
OFF

─

─

Teaching timer

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
Pulse
16-bit
32-bit instruction

Symbol

Function

0702 STMR

─

─

Special timer

0703 RAMP

─

─

Ramp signal

0704

─

─

Matrix input

DABSD

─

Absolute drum sequencer

MTR

0705 ABSD

0706

INCD

─

─

Incremental drum sequencer

0707

PID

DPID

─

PID algorithm



Logic instructions
Instruction code
API
16-bit
32-bit

Pulse
instruction

Symbol

Function

0800

WAND

DAND



Logical AND operation

0801

MAND

─



Matrix AND operation

0802

WOR

DOR



Logical OR operation

0803

MOR

─



Matrix OR operation

3-21

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
16-bit
32-bit

0804

WXOR

DXOR



Logical exclusive OR operation

0805

MXOR

─



Matrix exclusive OR operation

0806

WXNR

DXNR



Logical exclusive NOR operation

0807

MXNR

─



Matrix exclusive NOR operation

0809

LD&

DLD&

─

ON: S1&S2  0
OFF: S1&S2=0

0810

LD|

DLD|

─

ON: S1|S2  0
OFF: S1|S2=0

0811

LD^

DLD^

─

ON: S1^S2  0
OFF: S1^S2=0

0812

AND&

DAND&

─

ON: S1&S2  0
OFF: S1&S2=0

0813

AND|

DAND|

–

ON: S1|S2  0
OFF: S1|S2=0

0814

AND^

DAND^

–

ON: S1^S2  0
OFF: S1^S2=0

0815

OR&

DOR&

–

ON: S1&S2  0
OFF: S1&S2=0

0816

OR|

DOR|

–

ON: S1|S2  0
OFF: S1|S2=0

0817

OR^

DOR^

–

ON: S1^S2  0
OFF: S1^S2=0

3-22

Pulse
instruction

Symbol

Function

Ch ap te r 3 Inst ru ct ion T ab les



Rotation instructions
Instruction code
API
16-bit
32-bit

Pulse
instruction

Symbol

Function

0900

ROR

DROR



Rotating to the right

0901

RCR

DRCR



Rotating to the right with the carry
flag

0902

ROL

DROL



Rotating to the left

0903

RCL

DRCL



Rotating to the left with the carry
flag

0904

MBR

–



Rotating the matrix bits



Basic instructions
Instruction code
API
16-bit
32-bit

Pulse
instruction

Symbol

Function

1000

RST

─

─

Resetting the contact or clearing
the register

1001

TMR

─

─

16-bit timer

1002

TMRH

─

─

16-bit timer

1003

CNT

─

─

16-bit counter

1004

─

DCNT

─

32-bit counter

3-23

A H 5 00 Prog r am m ing M an ua l



Shift instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

1100

SFTR

─



Shifting the states of the devices to
the right

1101

SFTL

─



Shifting the states of the devices to
the left

1102 WSFR

─



Shifting the data in the word
devices to the right

1103

WSFL

─



Shifting the data in the word
devices to the left

1104 SFWR

─



Shifting the data and writing it into
the word device

1105

SFRD

─



Shifting the data and reading it
from the word device

1106

SFPO

─



Reading the latest data from the
data list

1107 SFDEL

─



Deleting the data from the data list

1108 SFINS

─



Inserting the data into the data list

1109

MBS

─



Shifting the matrix bits

1110

SFR

─



Shifting the values of the bits in the
16-bit registers by n bits to the right

1111

SFL

─



Shifting the values of the bits in the
16-bit registers by n bits to the left

1112

BSFR

─



Shifting the states of the n bit
devices by one bit to the right

1113

BSFL

─



Shifting the states of the n bit
devices by one bit to the left

1114

NSFR

─



Shifting n registers to the right

1115

NSFL

─



Shifting n registers to the left

3-24

Ch ap te r 3 Inst ru ct ion T ab les



Data processing instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

1200

SER

DSER



Searching the data

1201

SUM

DSUM



Number of bits whose states are
ON

1202

DECO

─



Decoder

1203

ENCO

─



Encoder

1204

SEGD

─



Seven-segment decoding

1205

SORT

DSORT

-

Sorting the data

1206

ZRST

─



Resetting the zone

1207

BON

DBON



Checking the state of the bit

1208

MEAN

DMEAN



Mean

1209

CCD

─



Sum check

3-25

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
Pulse
16-bit
32-bit instruction

Symbol

Function

1210

ABS

DABS

1211

MINV

─

Inverting the matrix bits

1212

MBRD

─

Reading the matrix bit

1213 MBWR

─

Writing the matrix bit

1214

MBC

─

Counting the bits with the value 0 or
1

1215

DIS

─

Disuniting the 16-bit data

1216

UNI

─

Uniting the 16-bit data

1217 WSUM

DWSUM

Absolute value

Getting the sum

1218

BSET

─

Setting the bit in the word device to
ON

1219

BRST

─

Resetting the bit in the word device

─

Resetting the specified zone

DLIMIT

Confining the value within the
bounds

1220 BKRST

1221

3-26

LIMIT

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
Pulse
16-bit
32-bit instruction

1222

BAND

DBAND



Deadband control

1223

ZONE

DZONE



Controlling the zone

Symbol

Function



Structure creation instructions
Instruction code
Pulse
API
instruction
16-bit
32-bit

Symbol

Function

1300

FOR

─

─

Start of the nested loop

1301

NEXT

─

─

End of the nested loop

─



Terminating the FOR-NEXT loop

1302 BREAK



Module instructions
Instruction code
API
16-bit
32-bit

Pulse
instruction

Symbol

Function

1400

FROM

DFROM



Reading the data from the control
register in the special module

1401

TO

DTO



Writing the data into the control
register in the special module

3-27

A H 5 00 Prog r am m ing M an ua l



Floating-point number instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

1500

─

FSIN



Sine of the floating-point number

1501

─

FCOS



Cosine of the floating-point
number

1502

─

FTAN



Tangent of the floating-point
number

1503

─

FASIN



Arcsine of the floating-point
number

1504

─

FACOS



Arccosine of the floating-point
number

1505

─

FATAN



Arctangent of the floating-point
number

1506

─

FSINH



Hyperbolic sine of the
floating-point number

1507

─

FCOSH



Hyperbolic cosine of the
floating-point number

1508

─

FTANH



Hyperbolic tangent of the
floating-point number

1509

─

FRAD



Converting the degree to the
radian

1510

─

FDEG



Converting the radian to the
degree

1511

SQR

DSQR



Square root of the binary number

1512

─

FSQR



Square root of the floating-point
number

1513

─

FEXP



An exponent of the floating-point
number

1514

─

FLOG



Logarithm of the floating-point
number

1515

─

FLN



Natural logarithm of the binary
floating-point number

1516

─

FPOW



A power of the floating-point
number

3-28

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
16-bit
32-bit

Pulse
instruction

1517

RAND

─



Random number

1518

BSQR

DBSQR



Square root of the binary-coded
decimal number

1519

─

BSIN



Sine of the binary-coded decimal
number

1520

─

BCOS



Cosine of the binary-coded
decimal number

1521

─

BTAN



Tangent of the binary-coded
decimal number

1522

─

BASIN



Arcsine of the binary-coded
decimal number

1523

─

BACOS



Arccosine of the binary-coded
decimal number

1524

─

BATAN



Arctangent of the binary-coded
decimal number

Symbol

Function



Real-time clock instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

1600

TRD

─



Reading the time

1601

TWR

─



Writing the time

1602

T+

─



Adding the time

1603

T-

─



Subtracting the time

1604

HOUR

DHOUR

─

Running-time meter

1605

TCMP

─



Comparing the time

1606

TZCP

─



Time zone comparison

3-29

A H 5 00 Prog r am m ing M an ua l



Peripheral instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

1700

TKY

DTKY

─

Ten-key keypad

1701

HKY

DHKY

─

Sixteen-key keypad

1702

DSW

─

─

DIP switch

1703 ARWS

─

─

Arrow keys

1704

─

─

Seven-segment display with
latches

SEGL



Communication instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

1800

RS

─

─

Transmitting the user-defined
communication command

1801

FWD

─

─

The AC motor drive runs
clockwise.

1802

REV

─

─

The AC motor drive runs
counterclockwise.

1803

STOP

─

─

The AC motor drive stops.

1804

RDST

─

─

Reading the statuses of the AC
motor drives

1805

RSTEF

─

─

Resetting the abnormal AC
motor drives

1806

LRC

─



Longitudinal parity check

1807

CRC

─



Cyclic Redundancy Check

3-30

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
16-bit
32-bit

Pulse
instruction

Symbol

Function

1808

MODRW

─

─

Reading/Writing the Modbus
data

1809

READ

─

─

Reading the data from the
remote device through routing

1810

WRITE

─

─

Writing the data into the remote
device through routing

1811

RPASS

─

─

Passing the packet to the
remote device through routing



Other instructions
Instruction code
Pulse
API
instruction
16-bit
32-bit

Symbol

Function

─



Watchdog timer

1901 DELAY

─



Delaying the execution of the
program

1902 GPWM

─

─

General pulse width
modulation

1903 TIMCHK

─

─

Checking time

1904 EPUSH

─



Storing the contents of the
index registers

1905

─



Reading the data into the index
registers

1900

WDT

EPOP



String processing instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

2100

BINDA

DBINDA



Symbol

Function

Converting the singed
decimal number into the
ASCII code

3-31

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
16-bit
32-bit

Pulse
instruction

Symbol

Function



Converting the binary
hexadecimal number into
the hexadecimal ASCII
code



Converting the
binary-coded decimal
number into the ASCII
code



Converting the signed
decimal ASCII code into
the signed decimal
binary number



Converting the
hexadecimal ASCII code
into the hexadecimal
binary number

2105 DABCD DDABCD



Converting the ASCII
code into the
binary-coded decimal
number

2106

$LEN

─



Calculating the length of
the string

2107

$STR

$DSTR



Converting the binary
number into the string

2108

$VAL

$DVAL



Converting the string into
the binary number

2109 $FSTR

─



Converting the
floating-point number
into the string

2110

─



Converting the string into
the floating-point number

2101

BINHA

DBINHA

2102 BCDDA DBCDDA

2103

2104

3-32

DABIN

HABIN

$FVAL

DDABIN

DHABIN

Ch ap te r 3 Inst ru ct ion T ab les

API

Instruction code
16-bit
32-bit

Pulse
instruction

Symbol

Function

2111 $RIGHT

─



The retrieve of the
characters in the string
begins from the right.

2112

$LEFT

─



The retrieve of the
characters in the string
begins from the left.

2113 $MIDR

─



Retrieving a part of the
string

2114 $MIDW

─



Replacing a part of the
string

2115

─



Searching the string

2116 $RPLC

─



Replacing the characters
in the string

2117

$DEL

─



Deleting the characters
in the string

2118

$CLR

─



Clearing the string

2119

$INS

─



Inserting the string

$SER

2120 $FMOD

─



2121 $FREXP

─



Converting the
floating-point number
into the binary-coded
decimal floating-point
number
Converting the
Binary-coded decimal
floating-point number
into the floating-point
number



Ethernet instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

2200

SOPEN

─



Symbol

Function

Opening the socket

3-33

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
16-bit
32-bit

2201

SSEND

─



Sending the data through
the socket

2202

SRCVD

─



Receiving the data
through the socket

2203 SCLOSE

─



Closing the socket

2204

MSEND

─



Sending the email

2205 EMDRW

─



Reading/Writing the
Modbus TCP data

Pulse
instruction

2206

─

DINTOA



2207

─

DIATON



Symbol

Function

Converting the IP address
of the integer type into the
IP address of the string
type
Converting the IP address
of the string type into the
IP address of the integer
type



Memory card instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

Symbol

Function

2300

MWRIT

─



Writing the data from the
PLC into the memory card

2301

MREAD

─



Reading the data from the
memory card into the PLC

2302 MTWRIT

─



Writing the string into the
memory card

3-34

Ch ap te r 3 Inst ru ct ion T ab les



Task control instructions
Instruction code
Pulse
API
16-bit
32-bit instruction

2400

Symbol

Function

TKON

─



Enabling the cyclic task

2401 TKOFF

─



Disabling the cyclic task

3.4.2 Applied Instructions (Sorted Alphabetically)
Classification

Symbol

A

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

Function

─



Subtraction of binary
numbers

─

─



Linking the strings

$CLR

─

─



Clearing the string

2117

$DEL

─

─



2109

$FSTR

─

─



2110

$FVAL

─

─



2119

$INS

─

─



2112

$LEFT

─

─



2106

$LEN

─

─



2113

$MIDR

─

─



2114

$MIDW

─

─



0302

$MOV

─

─



2111

$RIGHT

─

─



2116

$RPLC

─

─



2115

$SER

─

─



2107

$STR

D$STR

─



2108

$VAL

D$VAL

─



0102

*

D*

─



0103

/

D/

─



0100

+

D+

─



1210

ABS

DABS

─



0101

-

0114

$+

2118

D-

Deleting the characters in
the string
Converting the
floating-point number into
the string
Converting the string into
the floating-point number
Inserting the string
The retrieve of the
characters in the string
begins from the left.
Calculating the length of
the string
Retrieving a part of the
string
Replacing a part of the
string
Transferring the string
The retrieve of the
characters in the string
begins from the right.
Replacing the characters
in the string
Searching the string
Converting the binary
number into the string
Converting the string into
the binary number
Multiplication of binary
numbers
Division of binary
numbers
Addition of binary
numbers
Absolute value

3-35

A H 5 00 Prog r am m ing M an ua l

Classification

API

16-bit

0705

ABSD

0700

ALT

0046

AND$<

0047

AND$<=

Instruction code
32-bit
64-bit
DABSD

Pulse
instruction

Function
Absolute drum
sequencer
Alternating between ON
and OFF
Comparing the strings

─

─

─

─



─

─

─

ON: S1<S2

─

OFF: S1≧S2
Comparing the strings
ON: S1≦S2

─

─

OFF: S1>S2
0043

AND$<>

─

─

─

Comparing the strings
ON: S1≠S2
OFF: S1=S2
Comparing the strings

0042

AND$=

─

─

─

ON: S1=S2
OFF S1≠S2
Comparing the strings

0044

0045

AND$>

AND$>=

─

─

─

─

─

ON: S1>S2

─

OFF: S1≦S2
Comparing the strings
ON: S1≧S2
OFF: S1<S2

A

0812

AND&

DAND&

─

─

0814

AND^

DAND^

─

─

0813

AND|

DAND|

─

─

0010

AND<

DAND<

─

─

ON: S1&S2  0
OFF: S1&S2=0
ON: S1^S2  0
OFF: S1^S2=0
ON: S1|S2  0
OFF: S1|S2=0
Comparing the values
ON: S1<S2
OFF: S1≧S2
Comparing the values

0011

AND<=

DAND<=

─

─

ON: S1≦S2
OFF: S1>S2

0007

AND<>

DAND<>

─

─

Comparing the values
ON: S1≠S2
OFF: S1=S2
Comparing the values

0006

AND=

DAND=

─

─

ON: S1=S2
OFF: S1≠S2
Comparing the values

0008

AND>

DAND>

─

─

ON: S1>S2
OFF: S1≦S22

3-36

Ch ap te r 3 Inst ru ct ion T ab les

Classification

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

Function
Comparing the values

A

0009

AND>=

DAND>=

─

─

ON: S1≧S2
OFF: S1<S2

1703

ARWS

0109

B-

0110

─

─

─

DB-

─



B*

DB*

─



0111

B/

DB/

─



0108

B+

DB+

─



1523

BACOS

─



1222

BAND

─



1522

BASIN

─

─



1524

BATAN

─

─



0200

BCD

DBCD

─



2102

BCDDA

DBCDDA

─



1520

BCOS

─



0201

BIN

DBIN

─



2100

BINDA

DBINDA

─



2101

BINHA

DBINHA

─



0113

BK-

─



─
DBAND

B

─

─

Arrow key input
Subtraction of
binary-coded decimal
numbers
S1-S2=D
Multiplication of
binary-coded decimal
numbers
S1*S2=D
Division of binary-coded
decimal numbers
S1/S2=D
Addition of binary-coded
decimal numbers
S1+S2=D
Arccosine of the
binary-coded decimal
number
Deadband control
Arcsine of the
binary-coded decimal
number
Arctangent of the
binary-coded decimal
number
Converting the binary
number into the
binary-coded decimal
number
Converting the
binary-coded decimal
number into the ASCII
code
Cosine of the
binary-coded decimal
number
Converting the
binary-coded decimal
number into the binary
number
Converting the singed
decimal number into the
ASCII code
Converting the binary
hexadecimal number into
the hexadecimal ASCII
code
Subtraction of binary
numbers in blocks

3-37

A H 5 00 Prog r am m ing M an ua l

Classification

B

C

3-38

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

Function
Addition of binary
numbers in blocks
Converting the binary
numbers in blocks into
the binary-coded decimal
numbers in blocks
Converting the binary
numbers in blocks into
the binary-coded decimal
numbers in blocks
Resetting the specified
zone

0112

BK+

─

─



0214

BKBCD

─

─



0215

BKBIN

─

─



1220

BKRST

─

─



0304

BMOV

─

─



1207

BON

DBON

─



1302

BREAK

─

─



1219

BRST

─

─



1218

BSET

─

─



1113

BSFL

─

─



1112

BSFR

─

─



1519

BSIN

─

─



1518

BSQR

─



1521

BTAN

─

─



0307

BXCH

─

─



Exchanging all data

1209

CCD

─

─



0065

CHKADR

─

─

─

0400
0303
0054

CJ
CML
CMP

─
DCML
DCMP

─
─
─





0063

CMPT<

─

─



0064

CMPT<=

─

─



0060

CMPT<>

─

─



0059

CMPT=

─

─



Sum check
Checking the address of
the contact type of
pointer register
Conditional jump
Inverting the data
Comparing the values
Comparing the tables
ON: <
Comparing the tables
ON: ≦
Comparing the tables
ON: ≠
Comparing the tables
ON: =

DBSQR

Transferring all data
Checking the state of the
bit
Terminating the
FOR-NEXT loop
Resetting the bit in the
word device
Setting the bit in the word
device to ON
Shifting the states of the
n bit devices by one bit to
the left
Shifting the states of the
n bit devices by one bit to
the right
Sine of the binary-coded
decimal number
Square root of the
binary-coded decimal
number
Tangent of the
binary-coded decimal
number

Ch ap te r 3 Inst ru ct ion T ab les

Classification

C

D

E

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

Function
Comparing the tables
ON: >
Comparing the tables
ON: ≧

0061

CMPT>

─

─



0062

CMPT>=

─

─



1003

CNT

─

─

─

0219

COLM

─



1807

CRC

─

─

2105

DABCD

DDABCD

─



2103

DABIN

DDABIN

─



1004

DCNT

─

─

–

0116

DEC

DDEC

─



1202

DECO

─

─



1901

DELAY

─

─



0301

─

─

0500

DI

─

─

─

2207

DIATON

─

─



2206

DINTOA

─

─



1215

DIS

─

─



Disuniting the 16-bit data

1702

DSW

─

─

─

Digital switch input

0501

EI

─

─

─

2205

EMDRW

─

─



Enabling the interrupt
Reading/Writing the
Modbus TCP data

1203

ENCO

─

─



1905

EPOP

─

─



1904

EPUSH

─

─



DCOLM
─

DFMOV



0105

─

F-

DF-



0106

─

F*

DF*



F

16-bit counter
Converting a line of data
into a column of data
Cyclic Redundancy
Check
Converting the ASCII
code into the
binary-coded decimal
number
Converting the signed
decimal ASCII code into
the signed decimal binary
number
32-bit counter
Subtracting one from the
binary number
Decoder
Delaying the execution of
the program
Transferring the 64-bit
floating-point number
Disabling the interrupt
Converting the IP
address of the string type
into the IP address of the
integer type
Converting the IP
address of the integer
type into the IP address
of the string type

Encoder
Reading the data into the
index registers
Storing the contents of
the index registers
Subtraction of
floating-point numbers
S1-S2=D
Multiplication of
floating-point numbers
S1*S2=D

3-39

A H 5 00 Prog r am m ing M an ua l

Classification

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

0107

─

F/

DF/



0104

─

F+

DF+



1504

─

FACOS

─



0028

─

FAND<

DFAND<

─

0029

─

FAND<=

DFAND<=

─

Function
Division of floating-point
numbers
S1/S2=D
Addition of floating-point
numbers
S1+S2=D
Arccosine of the
floating-point number
Comparing the
floating-point numbers
ON: S1<S2
OFF: S1≧S2
Comparing the
floating-point numbers
ON: S1≦S2
OFF: S1>S2

0025

─

FAND<>

DFAND<>

─

Comparing the
floating-point numbers
ON: S1≠S2
OFF: S1=S2

0024

─

FAND=

DFAND=

─

F
0026

0027

─

─

FAND>

FAND>=

DFAND>

DFAND>=

─

─

Comparing the
floating-point numbers
ON: S1=S2
OFF: S1≠S2
Comparing the
floating-point numbers
ON: S1>S2
OFF: S1≦S2
Comparing the
floating-point numbers
ON: S1≧S2
OFF: S1<S2

3-40

1503

─

FASIN

─



1505

─

FATAN

─



0212

─

FBCD

─



0213

─

FBIN

─



0056

─

FCMP

─



1501

─

FCOS

─



1507

─

FCOSH

─



Arcsine of the
floating-point number
Arctangent of the
floating-point number
Converting the binary
floating-point number into
the decimal floating-point
number
Converting the decimal
floating-point number into
the binary floating-point
number
Comparing the
floating-point numbers
Cosine of the
floating-point number
Hyperbolic cosine of the
floating-point number

Ch ap te r 3 Inst ru ct ion T ab les

Classification

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

1510

─

FDEG

─



1513

─

FEXP

─



0205

─

FINT

DFINT



0022

─

FLD<

DFLD<

─

Function
Converting the radian to
the degree
An exponent of the
floating-point number
Converting the 64-bit
floating-point number into
the binary integer
Comparing the
floating-point numbers
ON: S1<S2
OFF: S1≧S2
Comparing the
floating-point numbers

0023

─

FLD<=

DFLD<=

─

ON: S1≦S2
OFF: S1>S2

0019

─

FLD<>

DFLD<>

─

Comparing the
floating-point numbers
ON: S1≠S2
OFF: S1=S2

0018

─

FLD=

DFLD=

─

F

Comparing the
floating-point numbers
ON: S1=S2
OFF: S1≠S2
Comparing the
floating-point numbers

0020

─

FLD>

DFLD>

─

ON: S1>S2
OFF: S1≦S2
Comparing the
floating-point numbers

0021

─

FLD>=

DFLD>=

─

ON: S1≧S2
OFF: S1<S2

1515

─

FLN

─



1514

─

FLOG

─



0202

FLT

DFLT

─



0203

FLTD

DFLTD

─



2120

FMOD

─



─

Natural logarithm of the
binary floating-point
number
Logarithm of the
floating-point number
Converting the binary
integer into the binary
floating-point number
Converting the binary
integer into the 64-bit
floating-point number
Converting the
floating-point number into
the binary-coded decimal
floating-point number

3-41

A H 5 00 Prog r am m ing M an ua l

Classification

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

0211

FNEG

─

─



1300

FOR

─

─

─

FOR<

DFOR<

─

0034

0035

─

─

FOR<=

DFOR<=

─

Function
Reversing the sign of the
32-bit floating-point
number
Start of the nested loop
Comparing the
floating-point numbers
ON: S1<S2
OFF: S1≧S2
Comparing the
floating-point numbers
ON: S1≦S2
OFF: S1>S2

0031

─

FOR<>

DFOR<>

─

Comparing the
floating-point numbers
ON: S1≠S2
OFF: S1=S2

0030

0032

─

─

FOR=

FOR>

DFOR=

DFOR>

─

─

F
0033

─

FOR>=

DFOR>=

─

Comparing the
floating-point numbers
ON: S1=S2
OFF: S1≠S2
Comparing the
floating-point numbers
ON: S1>S2
OFF: S1≦S2
Comparing the
floating-point numbers
ON: S1≧S2
OFF: S1<S2

3-42

1516

─

FPOW

─



1509

─

FRAD

─



─

─



DFROM

─



2121

FREXP

1400

FROM

1500

─

FSIN

─



1506

─

FSINH

─



1512

─

FSQR

─



1502

─

FTAN

─



1508

─

FTANH

─



A power of the
floating-point number
Converting the degree to
the radian
Converting the
Binary-coded decimal
floating-point number into
the floating-point number
Reading the data from
the control register in the
special module
Sine of the floating-point
number
Hyperbolic sine of the
floating-point number
Square root of the
floating-point number
Tangent of the
floating-point number
Hyperbolic tangent of the
floating-point number

Ch ap te r 3 Inst ru ct ion T ab les

Classification

API
1801

16-bit
FWD

Instruction code
32-bit
64-bit

Pulse
instruction

─

─

─

FZCP

─



DGBIN

─



F
0057

G

─

J

The AC motor drive runs
clockwise.
Floating-point zone
comparison
Converting the Gray
code into the binary
number

0209

GBIN

0402

GOEND

─

─

─

1902

GPWM

─

─

─

0208

GRY

DGRY

─



2104

HABIN

DHABIN

─



1701

HKY

DHKY

─

─

Hexadecimal key input

1604

HOUR

DHOUR

─

─

Running-time meter

0502

IMASK

─

─

0115

INC

─



0706

INCD

─

─

0204

INT

─



Controlling the interrupt
Adding one to the binary
number
Incremental drum
sequencer
Converting the 32-bit
floating-point number into
the binary integer

0401

JMP

─

─

H

I

Function

─
DINC
─
DINT
─

Jumping to END
General pulse width
modulation
Converting the binary
number into the Gray
code
Converting the
hexadecimal ASCII code
into the hexadecimal
binary number

Unconditional jump
Comparing the strings

0040

0041

LD$<

LD$<=

─

─

─

─

─

ON: S1<S2

─

OFF: S1≧S2
Comparing the strings
ON: S1≦S2
OFF: S1>S2

0037

LD$<>

─

─

─

Comparing the strings
ON: S1≠S2
OFF: S1=S2

L

Comparing the strings
0036

LD$=

─

─

─

ON: S1=S2
ON: S1≠S2
Comparing the strings

0038

0039

LD$>

LD$>=

─

─

─

─

─

ON: S1>S2

─

OFF: S1≦S2
Comparing the strings
ON: S1≧S2
OFF: S1<S2

0809

LD&

DLD&

─

─

ON: S1&S2  0
OFF: S1&S2=0

3-43

A H 5 00 Prog r am m ing M an ua l

Classification

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

0811

LD^

DLD^

─

─

0810

LD|

DLD|

─

─

0004

LD<

DLD<

─

─

Function
ON: S1^S2  0
OFF: S1^S2=0
ON: S1|S2  0
OFF: S1|S2=0
Comparing the values
ON: S1<S2
OFF: S1≧S2
Comparing the values

0005

LD<=

DLD<=

─

─

ON: S1≦S2
OFF: S1>S2

0001

LD<>

DLD<>

─

─

Comparing the values
ON: S1≠S2
OFF: S1=S2

L

Comparing the values
0000

LD=

DLD=

─

─

ON: S1=S2
OFF: S1≠S2
Comparing the values

0002

LD>

DLD>

─

─

ON: S1>S2
OFF: S1≦S2
Comparing the values

0003

LD>=

DLD>=

─

─

ON: S1≧S2
OFF: S1<S2

M

3-44

1221

LIMIT

DLIMIT

─



0218

LINE

DLINE

─



1806

LRC

─

─

─

Confining the value
within the bounds
Converting a column of
data into a line of data
Longitudinal parity check

0801

MAND

─

─



Matrix AND operation

1214

MBC

─

─



0904
1212

MBR
MBRD

─
─

─
─




Counting the bits with the
value 0 or 1
Rotating the matrix bits
Reading the matrix bit

1109

MBS

─

─



Shifting the matrix bits

1213

MBWR

─

─



Writing the matrix bit

0058

MCMP

─

─



Matrix comparison

1208

MEAN

─



Mean

1211

MINV

─

─



Inverting the matrix bits

0206

MMOV

─

─



1808

MODRW

─

─

─

0803

MOR

─

─



Converting the 16-bit
value into the 32-bit
value
Reading/Writing the
Modbus data
Matrix OR operation

0300

MOV

DMOV

─



Transferring the data

DMEAN

Ch ap te r 3 Inst ru ct ion T ab les

Classification

M

N

API

Instruction code
32-bit
64-bit
─
─

Pulse
instruction

Function



Transferring several bits

0310

16-bit
MOVB

2301

MREAD

─

─

─

Reading the data from
the memory card into the
PLC

2204

MSEND

─

─



Sending the email

0704

MTR

─

─

─

2302

MTWRIT

─

─

─

2300

MWRIT

─

─

─

0807

MXNR

─

─



0805

MXOR

─

─



0210
1301

NEG
NEXT

DNEG
─

─
─


─

0305

NMOV

DNMOV

─



1115

NSFL

─

─



1114

NSFR

─

─



Matrix input
Writing the string into the
memory card
Writing the data from the
PLC into the memory
card
Matrix exclusive NOR
operation
Matrix exclusive OR
operation
Two’s complement
End of the nested loop
Transferring the data to
several devices
Shifting n registers to the
left
Shifting n registers to the
right
Comparing the strings

0052

OR$<

─

─

─

ON: S1<S2

─

OFF: S1≧S2
Comparing the strings
ON: S1≦S2

0053

OR$<=

─

─

OFF: S1>S2
0049

OR$<>

─

─

─

Comparing the strings
ON: S1≠S2
OFF: S1=S2
Comparing the strings

0048

OR$=

─

─

─

ON: S1=S2
OFF: S1≠S2
Comparing the strings

O
0050

0051

OR$>

OR$>=

─

─

─

─

─

ON: S1>S2

─

OFF: S1≦S2
Comparing the strings
ON: S1≧S2
OFF: S11<S22

0815

OR&

DOR&

─

─

0817

OR^

DOR^

─

─

0816

OR|

DOR|

─

─

ON: S1&S2  0
OFF: S1&S22=0
ON: S1^S2  0
OFF: S1^S2=0
ON: S1|S2  0
OFF: S1|S2=0

3-45

A H 5 00 Prog r am m ing M an ua l

Classification

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

Function
Comparing the values

0016

OR<

DOR<

─

─

ON: S1<S2
OFF: S1≧S2
Comparing the values

0017

OR<=

DOR<=

─

─

ON: S1≦S2
OFF: S1>S2

0013

OR<>

DOR<>

─

─

Comparing the values
ON: S1≠S2
OFF: S1=S2

O

Comparing the values
0012

OR=

DOR=

─

─

ON: S1=S2
OFF: S1≠S2
Comparing the values

0014

OR>

DOR>

─

─

ON: S1>S2
OFF: S1≦S2
Comparing the values

0015

OR>=

DOR>=

─

─

ON: S1≧S2
OFF: S11<S2

P

R

3-46

0707
0703

PID
RAMP

─
─

─
─

─
─

PID algorithm
Ramp signal

1517

RAND

─

─



0903

RCL

DRCL

─



0901

RCR

DRCR

─



1804

RDST

─

─

─

1809

READ

─

─

─

0600

REF

─

─



1802

REV

─

─

─

0207

RMOV

─

─



Random number
Rotating to the left with
the carry flag
Rotating to the right with
the carry flag
Reading the statuses of
the AC motor drives
Reading the data from
the remote device
through routing
Refreshing the I/O
The AC motor drive runs
counterclockwise.
Converting the 32-bit
value into the 16-bit
value

0902

ROL

DROL

─



Rotating to the left

0900

ROR

DROR

─



1811

RPASS

─

─

─

1800

RS

─

─

─

Rotating to the right
Passing the packet to the
remote device through
routing
Transmitting the
user-defined
communication
command

Ch ap te r 3 Inst ru ct ion T ab les

Classification

API

16-bit

Instruction code
32-bit
64-bit

Pulse
instruction

Resetting the contact or
clearing the register
Resetting the abnormal
AC motor drives

1000

RST

─

─

─

1805

RSTEF

─

─

─

0216

SCAL

─

─



Scale value operation

2203

SCLOSE

─

─



Closing the socket

0217

SCLP

─



1204

SEGD

─

─



1704

SEGL

─

─

─

1200

SER

DSER

─



R

S

Function

DSCLP

Parameter type of scale
value operation
Seven-segment
decoding
Seven-segment display
with latches
Searching the data

1107

SFDEL

─

─



1108

SFINS

─

─



1111

SFL

─

─



1106

SFPO

─

─



1110

SFR

─

─



1105

SFRD

─

─



1101

SFTL

─

─



1100

SFTR

─

─



1104

SFWR

─

─



0309

SMOV

─

─



Deleting the data from
the data list
Inserting the data into the
data list
Shifting the values of the
bits in the 16-bit registers
by n bits to the left
Reading the latest data
from the data list
Shifting the values of the
bits in the 16-bit registers
by n bits to the right
Shifting the data and
reading it from the word
device
Shifting the states of the
devices to the left
Shifting the states of the
devices to the right
Shifting the data and
writing it into the word
device
Transferring the digits

2200

SOPEN

─

─



Opening the socket

1205

SORT

DSORT

─

─

1511

SQR

DSQR

─



2202

SRCVD

─

─



2201

SSEND

─

─



0702

STMR

─

─

─

1803

STOP

─

─

─

1201

SUM

DSUM

─



0308

SWAP

DSWAP

─



Sorting the data
Square root of the binary
number
Receiving the data
through the socket
Sending the data through
the socket
Special timer
The AC motor drive
stops.
Number of bits whose
states are ON
Exchange the high byte
with the low byte

3-47

A H 5 00 Prog r am m ing M an ua l

Classification

T

U

API

16-bit

1603

T-

1602

T+

1605
1903
2401
2400
1700
1001
1002

Instruction code
32-bit
64-bit
─
─

Pulse
instruction


Subtracting the time

─

─



Adding the time

TCMP
TIMCHK
TKOFF
TKON
TKY
TMR
TMRH

─
─
─
─
DTKY
─
─

─
─
─
─
─
─
─


─


─
─
─

1401

TO

DTO

Comparing the time
Checking time
Disabling the cyclic task
Enabling the cyclic task
Ten key input
16-bit timer
16-bit timer
Writing the data into the
control register in the
special module

1600

TRD

─

─



Reading the time

0701
1601

TTMR
TWR

─
─

─
─

─


Teaching timer
Writing the time

1606

TZCP

─

─



Time zone comparison

1216
0800
1900
0802

UNI
WAND
WDT
WOR

─
DAND
─
DOR

─
─
─
─






1103

WSFL

─

─



1102

WSFR

─

─



1810

WRITE

─

─

─

1217

WSUM

DWSUM

─



0806

WXNR

DXNR

─



0804

WXOR

DXOR

─



Uniting the 16-bit data
Logical AND operation
Watchdog timer
Logical OR operation
Shifting the data in the
word devices to the left
Shifting the data in the
word devices to the right
Writing the data into the
remote device through
routing
Getting the sum
Logical exclusive NOR
operation
Logical exclusive OR
operation

0306

XCH

DXCH

─



Exchanging the data

0055

ZCP

DZCP

─



Zone comparison

1223
1206

ZONE
ZRST

DZONE
─

─
─




Controlling the zone
Resetting the zone



W

X
Z

3-48

Function

Chapter 4

Instruction Structure

Table of Contents
4.1
4.2
4.3
4.4
4.5
4.6
4.7

Composition of Applied Instructions ........................................................4-2
Restrictions on the Use of the Instructions ..............................................4-5
Index Registers .......................................................................................4-6
Pointer Registers.....................................................................................4-7
Pointer Registers of Timers .....................................................................4-9
Pointer Registers of 16-bit Counters .....................................................4-10
Pointer Registers of 32-bit Counters .....................................................4-11

AH Pro gramming Ma nu al

4.1 Composition of Applied Instructions
Every instruction has its own instruction code and API number. The API number of the instruction in
the following table is 0300, and the instruction code is MOV, whose function is transferring the data.
API
0300

Instruction code
D

MOV

Device

X

Y

S
D

●
●

●
●

Operand

Function

S, D

Transferring the data

P
M

S

T

C

HC

D

L

●
●

●
●

●
●

●
●

●
●

SM SR
●
●

E

PR

K

○
○

●
●

●

16# “$”
●

DF
○

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S

: Data source

Word/Double word

D

: Data destination

Word/Double word

The devices used by the instruction are listed in the operand column. S, D, n, and m are used
as the operands according to their functions. When more than one operand is used, and these
operands share the same function, they are suffixed with numbers. For example, S1, S2, and
etc.
2.
If the instruction can be used as the pulse instruction, the letter P is added in back of the
instruction. If the 16-bit instruction can be used as the 32-bit instruction, the letter D is added in
front of the 16-bit instruction to form the 32-bit instruction. For example, “D***P” in which “***” is
an instruction code.
3.
Among the operands, the device PR is the pointer register Please refer to ISPSoft User
Manual and section 4.4 for more information about the pointer register.
4.
If users want to use an instruction in the function block, and the timer, the 16-bit counter, and
the 32-bit counter are supported among the operands, users have to use the pointer register of
the timer, the pointer register of the 16-bit counter, and the pointer register of the 32-bit counter.
Please refer to sections 4.5~4.7 for more information.
5.
Among the operands, the 32-bit single-precision floating-point numbers are notated by F,
whereas the 64-bit double-precision floating-point numbers are notated by DF.
6.
The solid circle ● indicates that the device can be modified by an index register, and the hollow
circle ○ indicates that the device can not be modified by an index register. For example, the
data register designated by the operand S can be modified by an index register.
7.
The applicable model is indicated in the table. Users can check whether the instruction can be
used as the pulse instruction, the 16-bit instruction, the 32-bit instruction, or the 64-bit
instruction according to the information in the table.
8.
The description of the symbols representing the instruction MOV in ISPSoft:
MOV, MOVP, DMOV, and DMOVP: Instruction codes
En: Enable
S: The data source (The applicable format of the operand is a word/double word.)
D: The data destination (The applicable format of the operand is a word/double word.)
The composition of applied instructions:
Some applied instructions are composed of instruction codes. For example, the instructions EI, DI,
WDT, and etc. however, most applied instructions consist of instruction codes and several
1.

Chapter 4 Ins truc tion Struc ture
operands.
Every applied instruction has its own API number and instruction code. For example, the instruction
code of API0300 is MOV (transferring the data).
Entering the instruction directly: Users can enter the instruction by means of ISPSoft. For the
instruction MOV, users only need to enter the instruction name and
the operands to designate “MOV D0 D1”.

Entering the instruction by dragging: Users can drag the instruction MOV from APIs in ISPSoft to
the area where the ladder diagram can be edited.
Entering the instruction by the toolbar: Users can click API/FB Selection on the toolbar in ISPSoft,
and then choose API. Finally, they can choose the
instruction MOV in Data Transfer. The operands are extra
designated.

Source operand
If there is more than one source operand, these source operands are represented by S1,
S2, and etc.
Destination operand
D
If there is more than one destination operand, these destination operand is represented
by D1, D2, and etc.
If the operand only can designate the constant K/H or the register, it is represented by m, m1, m2,
n, n1, or n2.
S

The length of the operand (the 16-bit instruction, the 32-bit instruction, or the floating-point
number instruction):
The 16-bit instruction or the 32-bit instruction
The values of the operands can be divided into the 16-bit values and the 32-bit values. Accordingly,
in order to process data of difference lengths, the instructions are divided into the 16-bit instructions
and the 32-bit instructions. To separate the 32-bit instruction from the 16-bit one, a D is added in
front of the 16-bit instruction.
16-bit instruction MOV
When M1 is ON, the data in
D0 is transferred to D1.

32-bit instruction DMOV
When M1 is ON, the data in
(D1, D0) is transferred to (D3,
D2).
The floating-point number instruction
The floating-point number instructions can be divided into the 32-bit floating-point number
instructions and the 64-bit floating-point number instructions, which correspond to the
single-precision floating-point number instructions and the double-precision floating-point number
instructions respectively. Users can refer to chapter 2 for more information about the floating-point
numbers.

4-3

AH Pro gramming Ma nu al
The values of the operands used in the instructions can be divided into the 32-bit values and the
64-bit values. Accordingly, in order to process data of difference lengths, the instructions are divided
into the 32-bit instructions and the 64-bit instructions. To separate the 64-bit instruction from the
32-bit one, a D is added in front of the 32-bit instruction.
32-bit single-precision floating-point number instruction F+
When X0.0 is ON, the data in
(D11, D10) and (D21, D20) is
transferred to (D31, D30).

64-bit double-precision floating-point number instruction DF+
When X0.0 is ON, the data in
(D13, D12, D11, D10) and
(D23, D22, D21, D20) is
transferred to (D33, D32, D31,
D30).
The continuous execution of the instruction and the pulse execution of the instruction:
1.
The execution of the instructions can be divided into the continuous execution and the pulse
execution. When the instruction is not executed, the time needed to execute the program is
shorter. Therefore, using the pulse instruction in the program can lessen the scan cycle.
2.
The pulse function allows the related instruction to enable the rising edge-triggered control
input. The instruction is ON within one scan cycle.
3.
If the control input stays ON, and the related instruction is not executed, the control input has
to be switched from OFF to ON again in order to execute the instruction.
4.
The pulse instruction:
Pulse execution
When M1 is switched from
OFF to ON, the instruction
MOVP is executed once. The
instruction is not executed
any more within the scan
cycle. Therefore, it is called
the pulse instruction.
Continuous execution
Whenever M1 is ON during
the scan cycle, the instruction
MOV is executed once.
Therefore, the instruction is
called the continuous
instruction.
When the conditonal contact M1 is OFF, the instruction is not executed, and the value in the
destination operand D does not change.
The objects that the operands designate:
1.
Input relay: X0.0~X511.15 or X0~X511
2.
Output relay: Y0.0~Y511.15 or Y0~Y511
3.
Internal relay: M0~M8191
4.
Stepping relay: S0~S2047
5.
Timer: T0~T2047
6.
16-bit counter: C0~C2047
7.
32-bit counter: HC0~HC63
8.
Data register: D0~D65535 or D0.0~D65535.15
9.
Link register: L0~L65535 or L0.0~D65535.15
10. Special auxiliary flag: SM0~SM2047
11. Special data register: SR0~SR2047
12. Index register: E0~E31

4-4

Chapter 4 Ins truc tion Struc ture
13.
14.
15.
16.
17.
18.
19.
20.
21.

Pointer register: PR0~PR15
Pointer register of the timer: TR0~TR7
Pointer register of the 16-bit counter: CR0~CR7
Pointer register of the 32-bit counter: HCR0~HCR7
Constant: The decimal constants are notated by K, and the hexadecimal constants are notated
by 16#.
String: “$”
Floating-point number: The single-precision floating-point numbers are notated by F, and the
double-precision floating-point numbers are notated by DF.
The length of the data in one register is generally 16 bits. If users want to store the 32-bit data
in the register, they have to designate two consecutive registers.
If the operand used in the 32-bit instruction designates D0, the 32-bit data register composed
of (D1, D0) is occupied. D1 represents the higher 16 bits, and D0 represents the lower 16 bits.

The same rule applies to the timer and the 16-bit counter.。
When the 32-bit counter HC is used as the data register, it is only can be designated by the
operand used in the 32-bit instruction.
PS. Please refer to chapter 2 for more information about devices.

22.

4.2 Restrictions on the Use of the Instructions
The instructions which only can be used in the function blocks
API0065 CHKADR, FB_NP, FB_PN, NED, ANED, ONED, PED, APED, and OPED
The instructions which can not be used in the interrupt tasks
z
GOEND
z
The instructions which are not supported in the function blocks
LDP, ANDP, ORP, LDF, ANDF, ORF, PLS, PLF, NP, PN, MC/MCR, GOEND, and all pulse
instructions in applied commands
If users want to use some of the instructions mentioned above, they can use the substitute
instructions.
Instruction which can not be used in the
Substitute instruction in the function
function block
block
LDP/ANDP/ORP
PED/APED/OPED
LDF/ANDF/ORF
NED/ANED/ONED
PLS
PLF
NP
FB_NP
PN
FB_PN
MC
MCR
All pulse instructions in applied commands
Note 1
Note 1: Pulse instructions can not be used in the function blocks. If users want to get the
function of the pulse instruction in the function block, they can refer to the following
example.
Example:
1.
First, declare 10 bit variables tempBit[10] used in the system.
2.
When StartBit1 is switched from ON to OFF, network 1 executes the instruction MOV once.
3.
When StartBit1 is switched from OFF to ON, network 2 executes the instruction MOV once.
4.
The variable tempBit used in the system can not be used repeatedly.
z

4-5

AH Pro gramming Ma nu al

4.3 Index Registers
The index register is the 16-bit data register. It is like the general register in that the data can be
read from it and written into it. However, it is mainly used as the index register. The range of index
registers is E0~E13.
The index register is used as follows.
1.
Using the register name to modify the device
When M0 is ON, E0=10, D0@E0=D (0+10)=D10, and D1=D10.

When M0 is ON, E0=10, E1=17, D1@E0=D (1+10)=D11, and the bit part 1@E1=(1+17)=18.
However, the maximum bit number is 15. Since m=18/16=1 and n=18%16=2 (getting the
remainder), the last modification result is D (11+m).n=D12.2. D12.2 is ON.

4-6

Chapter 4 Ins truc tion Struc ture
When M0 is ON, E0=10, and M1@E0=M (1+10)=M11. M11 is ON.

2.

Declaring the variables first, and then modifying the device
Declare the three variables StartBit, Var1, and Var2 in ISPSoft.
z
The type of StartBit is the Boolean array, and its size is 2 bits. The range is from
StartBit[0] to StartBit[1].
The type of Var1 is the word array, and its size is 11 words. The range is from Var1[0] to
Var1[10].
The type of Var2 is the word, and its size is one word.

z

When StartBit[0] is ON, E0=10, E1=1, Var1[0]@E0=Var1[10], Var2=Var1[10], and
StrartBit[0]@E1=StartBit[1]. StartBit[1] is ON.

Additional remark: When users declare the variables in ISPSoft, and the variables are added
to the contents of the registers to form the addresses to the actual data,
users must note the addresses to prevent the program from being executed
wrongly.

4.4 Pointer Registers
z

ISPSoft supports the function blocks. When the variable declaration type is VAR_IN_OUT, and
the data type is POINTER, the variable is the pointer register. The value in the pointer register
can refer directly to the value stored in the device X, Y, D, or L, and the pointer register can
point to the address associated with the variable set automatically in ISPSoft.

4-7

AH Pro gramming Ma nu al
Users can declare 16 pointer registers in every function block. The range is PR0~PR15, or
PR0.0~PR15.15.
Example:
1.
Establish a program organization unit (POU) in ISPSoft first.
2.
Establish a function block which is called FB0.
z

3.

The program in the function block FB0

4.

Declare the varaible in the function block FB0.
Choose VAR_IN_OUT as the declaration type, Point1 as the identifier, POINTER as the data
type. The variable is the pointer register.

5.

Declare the variable in the program organization unit (POU).

6.
7.

Call the function block FB0 in the program organization unit (POU).
The program in the program organization unit (POU)
Network 1: When StartBit[0] is ON, the address of D0 is transmitted to Point 1 in FB0.

When VarBit1 in FB0 is ON, E0=1, Var1=D0, Point1@E0=D (0+1)=D1, and
Var2=D1.

4-8

Chapter 4 Ins truc tion Struc ture
Network 2: When StartBit[1] is ON, the address of CVar1[0] is transmitted to Point1 in FB0.

When VarBit1 in FB0 is ON, E0=1, Var1=CVar1[0], Point1@E0=CVar1
(0+1)=Cvar1[1], and Var2=CVar1[1].

4.5 Pointer Registers of Timers
ISPSoft supports the function blocks. If users want to use the timer in the function block, they
have to declare a pointer register of the timer in the function block. The address of the timer is
transmitted to the pointer register of the timer when the function block is called.
z
When the variable declaration type is VAR_IN_OUT, and the data type is T_POINTER, the
variable is the pointer register of the timer. The value in the pointer register of the timer can
refer directly to the value stored in the device T or in the variable which is the timer in ISPSoft.
z
Users can declare 8 pointer registers of the timers in every function block. The range is
TR0~TR7.
z
If users want to use an instruction in the function block, and the timer is supported among the
operands, users have to use the pointer register of the timer.
Example:
1.
Establish a program organization unit (POU) in ISPSoft first.
2.
Establish a function block which is called FB0.
z

3.

Declare the varaible in the function block FB0.
Choose VAR_IN_OUT as the declaration type, TPoint1 as the identifier, T_POINTER as the
data type. The variable is the pointer register of the timer.

4.

The program in the function block FB0

5.

Declare the variable in the program organization unit (POU).
The data type of CVar1 should be TIMER.

4-9

AH Pro gramming Ma nu al

6.
7.

Call the function block FB0 in the program organization unit (POU).
The program in the program organization unit (POU)
Network 1: When StartBit[0] is ON, the address of T1920 is transmitted to TPoint1 in FB0.

When VarBit1 in the FB0 is ON, the instruction TMR is executed, and TPoint1
(T1920) starts counting. When the value of TPoint1 matches the setting value,
VarOut is ON.
Network 2: When StartBit[1] is ON, the address of CVar1[0] is transmitted to TPoint1 in FB0.

When VarBit1 in FB0 is ON, the instruction TMR is executed, and TPoint (CVar1)
starts counting. When the value of TPoint1 matches the setting value, VarOut is
ON.

4.6 Pointer Registers of 16-bit Counters
ISPSoft supports the function blocks. If users want to use the 16-bit counter in the function
block, they have to declare a pointer register of the 16-bit counter in the function block. The
address of the 16-bit counter is transmitted to the pointer register of the 16-bit counter when
the function block is called.
z
When the variable declaration type is VAR_IN_OUT, and the data type is C_POINTE, the
variable is the pointer register of the 16-bit counter. The value in the pointer register of the
16-bit counter can refer directly to the value stored in the device T or in the variable which is
the counter in ISPSoft.
z
Users can declare 8 pointer registers of the 16-bit counters in every function block. The range
is CR0~CR7.
z
If users want to use an instruction in the function block, and the counter is supported among
the operands, users have to use the pointer register of the 16-bit counter.
Example:
1.
Establish a program organization unit (POU) in ISPSoft first.
2.
Establish a function block which is called FB0.
z

3.

4-10

Declare the varaible in the function block FB0.
Choose VAR_IN_OUT as the declaration type, CPoint1 as the identifier, C_POINTER as the
data type. The variable is the pointer register of the 16-bit counter.

Chapter 4 Ins truc tion Struc ture

4.

The program in the function block FB0

5.

Declare the variable in the program organization unit (POU).
The data type of CVar1 should be COUNTER.

6.
7.

Call the function block FB0 in the program organization unit (POU).
The program in the program organization unit (POU)
Network 1: When StartBit[0] is ON, the address of C0 is transmitted to CPoint1 in FB0.

When VarBit1 in FB0 is ON, CPoint1 (C0) is ON.
Network 2: When StartBit[1] is ON, the address of CVar1 is transmitted to CPoint1 in FB0.

When VarBit1 in FB0 is ON, CPoint1 (CVar1) is ON.

4.7 Pointer Registers of 32-bit Counters
ISPSoft supports the function blocks. If users want to use the 32-bit counter in the function
block, they have to declare a pointer register of the 32-bit counter in the function block. The
address of the 32-bit counter is transmitted to the pointer register of the 32-bit counter when
the function block is called.
z
When the variable declaration type is VAR_IN_OUT, and the data type is HC_POINTER, the
variable is the pointer register of the 32-bit counter. The value in the pointer register of the
32-bit counter can refer directly to the value stored in the device HC or in the variable which is
the counter in ISPSoft.
z
Users can declare 8 pointer registers of the 32-bit counters in every function block. The range
is HCR0~HCR7.
z
If users want to use an instruction in the function block, and the 32-bit counter is supported
among the operands, users have to use the pointer register of the 32-bit counter.
Example:
1.
Establish a program organization unit (POU) in ISPSoft first.
z

4 - 11

AH Pro gramming Ma nu al
2.

Establish a function block which is called FB0.

3.

Declare the varaible in the function block FB0.
Choose VAR_IN_OUT as the declaration type, HCPoint1 as the identifier, HC_POINTER as
the data type. The variable is the pointer register of the 32-bit counter.

4.

The program in the function block FB0

5.

Declare the variable in the program organization unit (POU).
The data type of CVar1 should be COUNTER, and users have to fill in the address column with
the practical address of the 32-bit counter.

6.
7.

Call the function block FB0 in the program organization unit (POU).
The program in the program organization unit (POU)
Network 1: When StartBit[0] is ON, the address of HC0 is transmitted to HCPoint1 in FB0.

When VarBit1 in FB0 is ON, HCPoint1 (HC0) is ON.
Network: When StartBit[1] is ON, the address of CVar1 is transmitted to HCPoint1 in FB0.

When VarBit1 in FB0 is ON, HCPoint1 (CVar1) is ON.

4-12

Chapter 5

Basic Instructions

Table of Contents
5.1
5.2

List of Basic Instructions ..........................................................................5-2
Basic Instructions ....................................................................................5-4

5-1

AH Pro gramming Ma nu al

5.1 List of Basic Instructions
Instruction code
LD/AND/OR
LDI/ANI/ORI
ANB/ORB
MPS/MRD/MPP

Function
Loading contact A/Connecting
contact A in series/Connecting
contact A in parallel
Loading contact B/Connecting
contact B in series/Connecting
contact B in parallel
Connecting the loop blocks in
series/parallel
Storing the data in the
stack/Reading the data from
the stack/Popping the data
from the stack

OUT

Driving the coil

SET

Keeping the device on

MC/MCR

LDP/ANDP/ORP

LDF/ANDF/ORF

PED/APED/OPED

NED/ANED/ONED

Setting/Resetting the master
control
Starting the rising-edge
detection/Connecting the
rising-edge detection in
series/Connecting the
rising-edge detection in parallel
Starting the falling-edge
detection/Connecting the
falling-edge detection in
series/Connecting the
falling-edge detection in
parallel
Starting the rising-edge
detection/Connecting the rising
edge-detection in
series/Connecting the
rising-edge detection in parallel
Starting the falling-edge
detection/Connecting the
falling-edge detection in
series/Connecting the
falling-edge detection in
parallel

PLS

Rising-edge output

PLF

Falling-edge output

INV
NOP
NP
PN

5-2

Inverting the logical operation
result
No operation
The circuit is rising
edge-triggered.
The circuit is falling
edge-triggered.

Operand

Step

Page
number

DX, X, Y, M, SM, S, T,
C, HC, D, L, and PR

1-2

5-4

DX, X, Y, M, SM, S, T,
C, HC, D, L, and PR

1-2

5-5

–

1

5-6

–

1

5-7

1-2

5-8

1-2

5-9

N

1

5-10

DX, X, Y, M, SM, S, T,
C, HC, D, L, and PR

1-2

5-12

DX, X, Y, M, SM, S, T,
C, HC, D, L, and PR

1-2

5-13

X, Y, M, SM, S, T, C,
HC, D, L, and PR

5

5-14

X, Y, M, SM, S, T, C,
HC, D, L, and PR

5

5-16

1-2

5-18

1-2

5-19

–

1

5-20

–

1

5-21

–

1

5-22

–

1

5-23

DY, X, Y, M, SM, S, T,
C, HC, D, L, and PR
DY, X, Y, M, SM, S, T,
C, HC, D, L, and PR

DY, X, Y, M, SM, S, T,
C, HC, D, L, and PR
DY, X, Y, M, SM, S, T,
C, HC, D, L, and PR

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code
FB_NP
FB_PN
PSTOP

Function
The circuit is rising
edge-triggered.
The circuit is falling
edge-triggered.
Stopping executing the
program in the PLC

Operand
X, Y, M, SM, S, T, C,
HC, D, L, and PR
X, Y, M, SM, S, T, C,
HC, D, L, and PR
–

Step

Page
number

1-2

5-24

1-2

5-25

1

5-26

5-3

AH Pro gramming Ma nu al

5.2 Basic Instructions
Instruction code

Operand

LD/AND/OR
Device

DX

S

●

Function
Loading contact A/Connecting
contact A in series/Connecting
contact A in parallel

S
DY

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

Symbol:
LD

S : Specified device

Bit

AND

OR
Explanation:
1.
The instruction LD applies to contact A which starts from the mother line or contact A which is
the start of a contact circuit. It functions to reserve the current contents, and store the contact
state which is acquired in the accumulative register.
2.
The instruction AND is used to connect contact A in series. It functions to read the state of the
contact which is specified to be connected in series, and perform the AND operation with the
previous logical operation result. The final result is stored in the accumulative register.
3.
The instruction OR is used to connect contact A in parallel. It functions to read the state of the
contact which is specified to be connected in parallel, and perform the OR operation with the
previous logical operation result. The final result is stored in the accumulative register.
Example:
1.
Contact A of X0.0 is loaded, contact A of X0.1 is connected in series, contact A of X0.2 is
connected in parallel, and the coil Y0.0 is driven.
2.
When both X0.0 and X0.1 are ON, or when X0.2 is ON, Y0.0 is ON.

5-4

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

LDI/ANI/ORI

S

Device

DX

S

●

DY

Function
Loading contact B/Connecting
contact B in series/Connecting
contact B in parallel

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

Symbol:
LDI

S : Specified device

Bit

ANI

ORI
Explanation:
1.
The instruction LDI applies to contact B which starts from the mother line or contact B which is
the start of a contact circuit. It functions to reserve the current contents, and store the contact
state which is acquired in the accumulative register.
2.
The instruction ANI is used to connect contact B in series. It functions to read the state of the
contact which is specified to be connected in series, and perform the AND operation with the
previous logical operation result. The final result is stored in the accumulative register.
3.
The instruction ORI is used to connect contact B in parallel. It functions to read the state of the
contact which is specified to be connected in parallel, and perform the OR operation with the
previous logical operation result. The final result is stored in the accumulative register.
Example:
1.
Contact B of X0.0 is loaded, contact B of X0.1 is connected in series, contact B of X0.2 is
connected in parallel, and the coil Y0.0 is driven.
2.
When both X0.0 and X0.1 are ON, or when X0.2 is ON, Y0.0 is ON.

5-5

AH Pro gramming Ma nu al

Instruction code

Operand

ANB/ORB

-

Function
Connecting the circuit blocks in
series/parallel

Symbol:

ANB

ORB

Explanation:
1.
The instruction ANB is used to perform the AND operation between the reserved logical
operation result and the contents of the accumulative register.
2.
The instruction ANB is used to perform the OR operation between the reserved logical
operation result and the contents of the accumulative register.
Example:
Contact A of X0.0 is loaded, contact A of X0.2 is connected in parallel, contact B of X0.1 is
1.
loaded, contact B of X0.3 is connected in parallel, the circuit blocks are connected in series,
and the coil Y0.0 is driven.

2.

5-6

Contact A of X0.0 is loaded, contact B of X0.1 is connected in series, contact A of X0.2 is
loaded, contact B of X0.3 is connected in series, the circuit blocks are connected in parallel,
and the coil Y0.0 is driven.

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

Function

MPS/MRD/MPP

-

Storing the data in the stack/Reading
the data from the stack/Popping the
data from the stack

Explanation:
1.
The instruction MPS is used to store the data in the accumulative register in the stack (the
value of the stack pointer increases by one).
2.
The instruction MRD is used to read the data from the stack and store it in the accumulative
register (the value of the stack pointer remains the same).
3.
The instruction MPP is used to pop the previous logical operation result from the stack, and
store it in the accumulative register (the value of the stack pointer decreases by one).
Example:
1.
Contact A of X0 is loaded, and the data in the accumulative register is stored in the stack.
2.
Contact A of X1 is connected in series, the coil Y1 is driven, and the data is read from the stack
(the value of the stack pointer remains the same).
3.
Contact A of X2 is connected in series, the coil M0 is driven, and the previous logical operation
result is popped from the stack.
Instruction:
Operation:
LD X0
Contact A of X0 is loaded.
MPS
The data in the accumulative register is stored in the stack.
AND X1
Contact A of X1 is connected in series.
OUT Y1
The coil Y1 is driven.
MRD
The data is read from the stack.
Contact A of X2 is connected in series.
AND X2
OUT M0
The coil M0 is driven.
MPP
The previous logical operation result is popped from the stack.
OUT Y2
The coil Y2 is driven.
END
The program ends.
Note:
1.
The number of MPS instructions must be equal to that of MPP instructions.
2.
The instruction MPS can be used at most 31 times.

5-7

AH Pro gramming Ma nu al

Instruction code

Operand

Function

OUT

S

Driving the coil

Device
S

DX

DY

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

●

Symbol:
S : Specified device

Bit

Explanation:
1.
The logical operation result prior to the application of the instruction OUT is output into the
specified device.
2.
The action of the coil contact:
OUT
Contact
Operation
result
Coil
Contact A
Contact B
(normally open)
(normally closed)
False
OFF
OFF
ON
True
ON
ON
OFF
Example:
1.
Contact B of X0.0 is loaded, contact A of X0.1 is connected in series, and the coil Y0.0 is
driven.
2.
When X0.0 is OFF, and X0.1 is ON, Y0.0 is ON.

5-8

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

Function

SET

S

Keeping the device on

Device
S

DX

DY

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

●

Symbol:
S : Specified device

Bit

Explanation:
When the instruction SET is driven, the specified device is set to ON. No matter the instruction SET
is still driven, the specified device keeps ON. Users can set the specified device to OFF by means of
the instruction RST.
Example:
1.
Contact B of X0.0 is loaded, contact A of Y0.0 is connected in series, and Y0.1 keeps ON.
2.
When X0.0 is OFF, and Y0.0 is ON, Y0.1 is ON. Even if the operation result changes, Y0.1 still
keeps ON.

5-9

AH Pro gramming Ma nu al

Instruction code

Operand

MC/MCR

N

Function
Setting/Resetting the master
control

Symbol:
MC

N:

Level of the nested
program structure

N0~N31

MCR
Explanation:
1.
The instruction MCR is used to set the master control. When the instruction MC is executed,
the instructions between MC and MCR are executed as usual. When the instruction MC is OFF,
the actions of the instructions between MC and MCR are as follows.
Instruction type
Description
The timer value is reset to zero. The coil and the
General-purpose timer
contact are OFF.
The timer value is reset to zero. The coil and the
Timer used in the function block
contact are OFF.
The coil is OFF. The timer value and the state of the
Accumulative timer
contact remains the same.
The coil is OFF. The timer value and the state of the
Counter
contact remains the same.
Coils driven by OUT
All coils are OFF.
Devices driven by SET and RST
The states of the devices remain the same.
All applied instructions are not executed. The
FOR/NEXT loop is still repeated N times, but the
Applied instruction
actions of the instructions inside the FOR/NEXT loop
follow those of the instructions between MC and MR.
2.
The instruction MCR is used to reset the master control, and is placed at the end of the master
control program. There should not be any contact instruction before MCR.
3.
MC/MCR supports the nested program structure. There are at most 32 levels of nested
program structures (N0~N31). Please refer to the example below.

5-10

Ch ap te r 5 Bas ic Ins truc tio ns

Example:

5 - 11

AH Pro gramming Ma nu al

Instruction code

Operand

LDP/ANDP/ORP

Device

DX

S

●

DY

Function
Starting the rising-edge
detection/Connecting the rising-edge
detection in series/Connecting the
rising-edge detection in parallel

S

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

Symbol:
LDP

S : Specified device

Bit

ANDP

ORP
Explanation:
1.
The instruction LDP functions to reserve the current contents, and store the rising-edge
detection of the contact in the accumulative register.
2.
The instruction ANDP is used to connect the rising-edge detection of the contact in series.
3.
The instruction ORP is used to connect the rising-edge detection of the contact in parallel.
4.
Only when LDP/ANDP/ORP is scanned can the state of the device be gotten, and not until
LDP/ANDP/ORP is scanned next time can whether the state of the device changes be judged.
5.
Please use the instructions PED, APED, and OPED in the subroutine.
Example:
1.
The rising-edge detection of X0.0 starts, the rising-edge detection of X0.1 is connected in
series, the rising-edge detection of X0.2 is connected in parallel, and the coil Y0.0 is driven.
2.
When both X0.0 and X0.1 are switched from OFF to ON, or when X0.2 is switched from OFF
to ON, Y0.0 is ON for a scan cycle.

5-12

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

Function

S

Starting the falling-edge
detection/Connecting the
falling-edge detection in
series/Connecting the falling-edge
detection in parallel

LDF/ANDF/ORF

Device

DX

S

●

DY

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

Symbol:
LDF

S : Specified device

Bit

ANDF

ORF
Explanation:
1.
The instruction LDF functions to reserve the current contents, and store the falling-edge
detection of the contact in the accumulative register.
2.
The instruction ANDF is used to connect the falling-edge detection of the contact in series.
3.
The instruction ORP is used to connect the falling-edge detection of the contact in parallel.
4.
Only when LDF/ANDF/ORF is scanned can the state of the device be gotten, and not until
LDF/ANDF/ORF is scanned next time can whether the state of the device changes be judged.
5.
Please use the instructions NED, ANED, and ONED in the subroutine.
Example:
1.
The falling-edge detection of X0.0 starts, the falling-edge detection of X0.1 is connected in
series, the falling-edge detection of X0.2 is connected in parallel, and the coil Y0.0 is driven.
2.
When both X0.0 and X0.1 are switched from OFF to ON, or when X0.2 is switched from OFF
to ON, Y0.0 is ON for a scan cycle.

5-13

AH Pro gramming Ma nu al

Instruction code

Operand

PED/APED/OPED

Device
S1
S2

DX

DY

Function
Starting the rising-edge
detection/Connecting the rising
edge-detection in series/Connecting the
rising-edge detection in parallel

S1, S2

X

Y

M

SM

S

T

C

HC

D

L

PR

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

Symbol:

PED

S1 : Specified device

Bit

APED

S2 : For internal use

Bit

OPED

Explanation:
1.
PED/APED/OPED corresponds to LDP/ANDP/ORP. The only difference between
PED/APED/OPED and LDP/ANDP/ORP lies in the fact that users need to specify the bit
device S2 in which the previous state of the contact is stored when PED/APED/OPED is
executed. Please do not use the device S2 repeatedly in the program. Otherwise, the wrong
execution result will appear.
2.
The instruction APED is used to connect the rising-edge detection of the contact in series.
3.
The instruction OPED is used to connect the rising-edge detection of the contact in parallel.
4.
Only when PED/APED/OPED is scanned can the state of the device be gotten, and not until
PED/APED/OPED is scanned next time can whether the state of the device changes be
judged.
5.
PED/APED/OPED only can be used in the function block.
Example:
1.
The rising-edge detection of X0.0 starts, the rising-edge detection of X0.1 is connected in
series, the rising-edge detection of X0.2 is connected in parallel, and the coil Y0.0 is driven.
2.
When both X0.0 and X0.1 are switched from OFF to ON, or when X0.2 is switched from OFF
to ON, Y0.0 is ON for a scan cycle.

5-14

Ch ap te r 5 Bas ic Ins truc tio ns

5-15

AH Pro gramming Ma nu al

Instruction code

Operand

NED/ANED/ONED

Device
S1
S2

DX

DY

Function
Starting the falling-edge
detection/Connecting the falling-edge
detection in series/Connecting the
falling-edge detection in parallel

S1, S2

X

Y

M

SM

S

T

C

HC

D

L

PR

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

●
●

Symbol:

NED

S1 : Specified device

Bit

ANED

S2 : For internal use

Bit

ONED

Explanation:
1.
NED/ANED/ONED corresponds to LDF/ANDF/ORF. The only difference between
NED/ANED/ONED and LDF/ANDF/ORF lies in the fact that users need to specify the bit
device S2 in which the previous state of the contact is stored when NED/ANED/ONED is
executed. Please do not use the device S2 repeatedly in the program. Otherwise, the wrong
execution result will appear.
2.
The instruction ANED is used to connect the falling-edge detection of the contact in series.
3.
The instruction ONED is used to connect the falling-edge detection of the contact in parallel.
4.
Only when NED/ANED/ONED is scanned can the state of the device be gotten, and not until
NED/ANED/ONED is scanned next time can whether the state of the device changes be
judged.
5.
NED/ANED/ONED only can be used in the function block.
Example:
1.
The falling -edge detection of X0.0 starts, the falling -edge detection of X0.1 is connected in
series, the falling -edge detection of X0.2 is connected in parallel, and the coil Y0.0 is driven.
2.
When both X0.0 and X0.1 are switched from OFF to ON, or when X0.2 is switched from OFF
to ON, Y0.0 is ON for a scan cycle.

5-16

Ch ap te r 5 Bas ic Ins truc tio ns

5-17

AH Pro gramming Ma nu al

Instruction code

Operand

Function

PLS

D

Rising-edge output

Device

DX

D

DY

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

●

Symbol:
PLS

D : Specified device

Bit

Explanation:
1.
When the conditional contact is switched from OFF to ON, the instruction PLS is executed, and
the device D sends out a pulse for a scan cycle.
2.
Please do not use the instruction PLS in the function block.
Example:
When X0.0 is ON, M0 is ON for a pulse time. When M0 is ON, Y0.0 is set to ON.

Timing diagram:

X0
M0
Y0

5-18

One scan cycle

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

Function

PLF

D

Falling-edge output

Device

DX

D

DY

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

●

Symbol:
PLF

D : Specified device

Bit

Explanation:
1.
When the conditional contact is switched from ON to OFF, the instruction PLF is executed, and
the device D sends out a pulse for a scan cycle.
2.
Please do not use the instruction PLS in the function block.
Example:
When X0.0 is ON, M0 is ON for a pulse time. When M0 is ON, Y0.0 is set to ON.

Timing chart:
X0 .0

M0

One scan c ycle

Y0 .0

5-19

AH Pro gramming Ma nu al

Instruction code

Operand

INV

-

Function
Inverting the logical operation
result

Symbol:

Explanation:
The logical operation result preceding the instruction INV is inverted, and the inversion result stored
in the accumulative register.
Example:
When X0.0 is ON, Y0.0 is OFF. When X0.0 is OFF, Y0.0 is ON.

5-20

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

Function

NOP

-

No operation

Symbol: None
Explanation:
The instruction NOP does not perform any operation in the program. Therefore, the original logical
operation result is retained after NOP is executed. If users want to delete a certain instruction
without changing the length of the program, they can use NOP instead.
The instruction NOP only supports the instruction list in ISPSoft. It does not support ladder
diagrams.
Example:
The instruction list in ISPSoft:
Instruction:
Operation:
LD
X0.0
Contact A of X0 is loaded.
NOP
No action
OUT
Y1.0
The coil Y1.0 is driven.

5-21

AH Pro gramming Ma nu al

Instruction code

Operand

Function

NP

-

The circuit is rising edge-triggered.

Symbol:

Explanation:
1.
When the value in the accumulative register turns from 0 to 1, the instruction NP keeps the
value 1 in the accumulative register for a scan cycle. After the second scan cycle is finished,
the value in the accumulative register changes to 0.
2.
Please use the instruction FB_NP in the function block.
Example:

Instruction:
LD
M0
M1
AND
NP
OUT
Y0.0

Operation:
Contact A of M0 is loaded.
Contact A of M1 is connected in series.
The circuit is rising edge-triggered.
The coil Y0.0 is driven.

Timing diagram:

M0
M1
One scan c ycle

Y0 .0

5-22

One scan c ycle

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

Function

PN

-

The circuit is falling edge-triggered.

Symbol:

Explanation:
1.
When the value in the accumulative register turns from 1 to 0, the instruction PN keeps the
value 1 in the accumulative register for a scan cycle. After the second scan cycle is finished,
the value in the accumulative register changes to 0.
2.
Please use the instruction FB_ PN in the function block.
Example:

Instruction:

Operation::

LD
AND
PN
OUT

Contact A of M0 is loaded.
Contact A of M1 is connected in series.
The circuit is falling edge-triggered.
The coil Y0.0 is driven.

M0
M1
Y0.0

Timing diagram:
M0
M1
One scan cycle

One scan cycle

Y0 .0

5-23

AH Pro gramming Ma nu al

Instruction code

Operand

Function

FB_NP

S

The circuit is rising edge-triggered.

Device

DX

DY

S

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

Symbol:
S : For internal use

Bit

Explanation:
1.
When the value in the accumulative register turns from 0 to 1, the instruction FB_NP keeps the
value 1 in the accumulative register for a scan cycle. After the second scan cycle is finished,
the value in the accumulative register changes to 0.
2.
The previous state of the contact is stored in the bit device S. Please do not use S repeatedly
in the program. Otherwise, the wrong execution result will appear.
3.
The instruction FB_NP only can be used in the function block.
Example:

Instruction:
LD
M0
AND
M1
D0.0
FB_NP
OUT
Y0.0

Operation:
Contact A of M0 is loaded.
Contact A of M1 is connected in series.
The circuit is rising edge-triggered.
The coil Y0.0 is driven.

Timing diagram:

M0
M1
One scan cycl e

Y0 .0

5-24

One scan cycl e

Ch ap te r 5 Bas ic Ins truc tio ns

Instruction code

Operand

Function

FB_PN

S

The circuit is falling edge-triggered.

Device

DX

DY

S

X

Y

M

SM

S

T

C

HC

D

L

PR

●

●

●

●

●

●

●

●

●

●

●

Symbol:
S :For internal use

Bit

Explanation:
1.
When the value in the accumulative register turns from 1 to 0, the instruction FB_PN keeps the
value 1 in the accumulative register for a scan cycle. After the second scan cycle is finished,
the value in the accumulative register changes to 0.
2.
The previous state of the contact is stored in the bit device S. Please do not use S repeatedly
in the program. Otherwise, the wrong execution result will appear.
3.
The instruction FB_PN only can be used in the function block.
Example:

Instruction:
LD
M0
AND
M1
D0.0
FB_PN
OUT
Y0.0

Operation:
Contact A of M0 is loaded.
Contact A of M1 is connected in series.
The circuit is falling edge-triggered.
The coil Y0.0 is driven.

Timing diagram:

M0
M1
One scan cycle

One scan cycle

Y0 .0

5-25

AH Pro gramming Ma nu al

Instruction code

Operand

Function

PSTOP

-

Stopping executing the program in
the PLC

Symbol:

Explanation:
When the conditional contact is enabled, the instruction PSTOP stops the execution of the program,
and the PLC stops running.
Example:
When X0.0 is ON, Y0.0 is set to ON, Y0.1 remains OFF, and the PLC stops running.

5-26

Chapter 6

Applied Instructions

Table of Contents
6.1
Comparison Instructions ............................................................................6-3
6.1.1
List of Comparison Instructions .........................................................6-3
6.1.2
Explanation of Comparison Instructions ............................................6-5
6.2
Arithmetic Instructions .............................................................................6-36
6.2.1
List of Arithmetic Instructions...........................................................6-36
6.2.2
Explanation of Arithmetic Instructions .............................................6-37
6.3
Data Conversion Instructions...................................................................6-69
6.3.1
List of Data Conversion Instructions................................................6-69
6.3.2
Explanation of Data Conversion Instructions...................................6-71
6.4
Data Transfer Instructions......................................................................6-108
6.4.1
List of Data Transfer Instructions...................................................6-108
6.4.2
Explanation of Data Transfer Instructions......................................6-109
6.5
Jump Instructions ..................................................................................6-131
6.5.1
List of Jump Instructions ...............................................................6-131
6.5.2
Explanation of Jump Instructions ..................................................6-132
6.6
Program Execution Instructions.............................................................6-140
6.6.1
List of Program Execution Instructions..........................................6-140
6.6.2
Explanation of Program Execution Instructions.............................6-141
6.7
I/O Refreshing Instructions ....................................................................6-148
6.7.1
List of I/O Refreshing Instructions .................................................6-148
6.7.2
Explanation of I/O Refreshing Instructions ....................................6-149
6.8
Convenience Instructions ......................................................................6-151
6.8.1
List of Convenience Instructions ...................................................6-151
6.8.2
Explanation of Convenience Instructions ......................................6-152
6.9
Logic Instructions...................................................................................6-542
6.9.1
List of Logic Instructions................................................................6-542
6.9.2
Explanation of Logic Instructions...................................................6-543
6.10 Rotation Instructions ..............................................................................6-201
6.10.1
List of Rotation Instructions ...........................................................6-201
6.10.2
Explanation of Rotation Instructions..............................................6-202
6.11 Basic Instructions ..................................................................................6-212
6.11.1
List of Basic Instructions ...............................................................6-212
6.11.2
Explanation of Basic Instructions ..................................................6-213
6.12 Shift Instructions ....................................................................................6-220
6.12.1
List of Shift Instructions .................................................................6-220
6.12.2
Explanation of Shift Instructions ....................................................6-221
6.13 Data Processing Instructions .................................................................6-246
6.13.1
List of Data Processing Instructions ..............................................6-246
6.13.2
Explanation of Data Processing Instructions .................................6-247
6.14 Structure Creation Instructions ..............................................................6-293
6.14.1
List of Structure Creation Instructions ...........................................6-293
6.14.2
Explanation of Structure Creation Instructions ..............................6-294
6.15 Module Instructions ...............................................................................6-301
6.15.1
List of Module Instructions.............................................................6-301

6-1

6.15.2
Explanation of Module Instructions ............................................... 6-302
6.16 Floating-point Number Instructions ....................................................... 6-307
6.16.1
List of Floating-point Number Instructions..................................... 6-307
6.16.2
Explanation of Floating-point Number Instructions ....................... 6-308
6.17 Real-time Clock Instructions.................................................................. 6-348
6.17.1
List of Real-time Clock Instructions............................................... 6-348
6.17.2
Explanation of Real-time Clock Instructions.................................. 6-349
6.18 Peripheral Instructions........................................................................... 6-362
6.18.1
List of Peripheral Instructions........................................................ 6-362
6.18.2
Explanation of Peripheral Instructions........................................... 6-363
6.19 Communication Instructions .................................................................. 6-377
6.19.1
List of Communication Instructions ............................................... 6-377
6.19.2
Explanation of Communication Instructions .................................. 6-378
6.20 Other Instructions ..................................................................................6-432
6.20.1
List of Other Instructions ............................................................... 6-432
6.20.2
Explanation of Other Instructions.................................................. 6-433
6.21 String Processing Instructions ............................................................... 6-442
6.21.1
List of String Processing Instructions ............................................ 6-442
6.21.2
Explanation of String Processing Instructions ............................... 6-444
6.22 Ethernet Instructions ............................................................................. 6-505
6.22.1
List of Ethernet Instructions .......................................................... 6-505
6.22.2
Explanation of Ethernet Instructions ............................................. 6-506
6.23 Memory Card Instructions ..................................................................... 6-530
6.23.1
List of Memory Card Instructions .................................................. 6-530
6.23.2
Explanation of Memory Card Instructions ..................................... 6-531
6.24 Task Control Instructions ....................................................................... 6-542
6.24.1
List of Task Control Instructions .................................................... 6-542
6.24.2
Explanation of Task Control Instructions ....................................... 6-543

6-2

A H 5 00 Prog r am m ing M an ua l

6.1 Comparison Instructions
6.1.1 List of Comparison Instructions
API

Instruction code
16-bit
32-bit
64-bit

Pulse
instruction

Function

Step

Page
number

0000 LD=

DLD=

–

–

S1=S2

5

6-5

0001 LD<>

DLD<>

–

–

S1≠S2

5

6-5

0002 LD>

DLD>

–

–

S1>S2

5

6-5

0003 LD>=

DLD>=

–

–

S1≧S2

5

6-5

0004 LD<

DLD<

–

–

S1<S2

5

6-5

0005 LD<=

DLD<=

–

–

S1≦S2

5

6-5

0006 AND=

DAND=

–

–

S1=S2

5

6-7

0007 AND<>

DAND<>

–

–

S1≠S2

5

6-7

0008 AND>

DAND>

–

–

S1>S2

5

6-7

0009 AND>=

DAND>=

–

–

S1≧S2

5

6-7

0010 AND<

DAND<

–

–

S1<S2

5

6-7

0011 AND<=

DAND<=

–

–

S1≦S2

5

6-7

0012 OR=

DOR=

–

–

S1=S2

5

6-9

0013 OR<>

DOR<>

–

–

S1≠S2

5

6-9

0014 OR>

DOR>

–

–

S1>S2

5

6-9

0015 OR>=

DOR>=

–

–

S11≧S2

5

6-9

0016 OR<

DOR<

–

–

S1<S2

5

6-9

0017 OR<=

DOR<=

–

–

S1≦S2

5

6-9

0018

–

FLD=

DFLD=

–

S1=S2

5-7

6-11

0019

–

FLD<>

DFLD<>

–

S1≠S2

5-7

6-11

0020

–

FLD>

DFLD>

–

S1>S2

5-7

6-11

0021

–

FLD>=

DFLD>=

–

S1≧S2

5-7

6-11

0022

–

FLD<

DFLD<

–

S1<S2

5-7

6-11

0023

–

FLD<=

DFLD<=

–

S1≦S2

5-7

6-11

0024

–

FAND=

DFAND=

–

S1=S2

5-7

6-12

0025

–

FAND<> DFAND<>

–

S1≠S2

5-7

6-12

0026

–

FAND>

–

S1>S2

5-7

6-12

0027

–

FAND>= DFAND>=

–

S1≧S2

5-7

6-12

0028

–

FAND<

–

S1<S2

5-7

6-12

0029

–

FAND<= DFAND<=

–

S1≦S2

5-7

6-12

0030

–

FOR=

DFOR=

–

S1=S2

5-7

6-13

0031

–

FOR<>

DFOR<>

–

S1≠S2

5-7

6-13

0032

–

FOR>

DFOR>

–

S1>S2

5-7

6-13

0033

–

FOR>=

DFOR>=

–

S1≧S2

5-7

6-13

6-3

DFAND>
DFAND<

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code
16-bit
32-bit
64-bit

Pulse
instruction

Function

Step

Page
number

0034

–

FOR<

DFOR<

–

S1<S2

5-7

6-13

0035

–

FOR<=

DFOR<=

–

S1≦S2

5-7

6-13

0036 LD$=

–

–

–

S1=S2

5-17

6-15

0037 LD$<>

–

–

–

S1≠S2

5-17

6-15

0038 LD$>

–

–

–

S1>S2

5-17

6-15

0039 LD$>=

–

–

–

S1≧S2

5-17

6-15

0040 LD$<

–

–

–

S1<S2

5-17

6-15

0041 LD$<=

–

–

–

S1≦S2

5-17

6-15

0042 AND$=

–

–

–

S1=S2

5-17

6-18

0043 AND$<>

–

–

–

S1≠S2

5-17

6-18

0044 AND$>

–

–

–

S1>S2

5-17

6-18

0045 AND$>=

–

–

–

S1≧S2

5-17

6-18

0046 AND$<

–

–

–

S1<S2

5-17

6-18

0047 AND$<=

–

–

–

S1≦S2

5-17

6-18

0048 OR$=

–

–

–

S1=S2

5-17

6-20

0049 OR$<>

–

–

–

S1≠S2

5-17

6-20

0050 OR$>

–

–

–

S1>S2

5-17

6-20

0051 OR$>=

–

–

–

S1≧S2

5-17

6-20

0052 OR$<

–

–

–

S1<S2

5-17

6-20

0053 OR$<=

–

–

–

S1≦S2

5-17

6-20

Comparing the values
Zone comparison
Comparing the
floating-point numbers
Floating-point zone
comparison

7
9

6-22
6-24

7-9

6-26

9-12

6-27

9

6-29

9

6-31

9

6-31

9

6-31

9

6-31

9

6-31

9

6-31

7

6-33

0054 CMP
0055 ZCP

DCMP
DZCP

–
–




0056

–

FCMP

–



0057

–

FZCP

–



–



0058 MCMP

–

0059 CMPT=

–

–



0060 CMPT<>

–

–



0061 CMPT>

–

–



0062 CMPT>=

–

–



0063 CMPT<

–

–



0064 CMPT<=

–

–



0065 CHKADR

–

–

–

6-4

Matrix comparison
Comparing the tables
ON: =
Comparing the tables
ON: ≠
Comparing the tables
ON: >
Comparing the tables
ON: ≧
Comparing the tables
ON: <
Comparing the tables
ON: ≦
Checking the address of
the contact type of pointer
register

A H 5 00 Prog r am m ing M an ua l

6.1.2 Explanation of Comparison Instructions
API

Instruction code

0000~

D

0005

Operand

Function

S1, S2

Comparing the values

LD※

Device

X

Y

S1
S2







M

S

T

C

HC

D

L

SM SR

E

PR

K




























16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
-

AH

AH

Symbol:

Taking LD= and DLD= for example

S1 : Data source 1

WordDouble word

S2 : Data source 2

WordDouble word

Explanation:
1.

2.

The instructions are used to compare the value in S1 with that in S2. Take the instruction LD=
for example. When the comparison result is that the value in S1 is equal to that in S2, the
condition of the instruction is met. When the comparison result is that the value in S1 is not
equal to that in S2, the condition of the instruction is not met.
Only the 32-bit instruction can use the 32-bit counter.
Comparison operation result
API
16-bit
32-bit
number
instruction
instruction
ON
OFF
0000

LD=

DLD=

S1=S2

S1≠S2

0001

LD<>

DLD<>

S1≠S2

S1=S2

0002

LD>

DLD>

S1>S2

S1≦S2

0003

LD>=

DLD>=

S1≧S2

S1<S2

0004

LD<

DLD<

S1<S2

S1≧S2

0005

LD<=

DLD<=

S1≦S2

S1>S2

Example:
1.
2.
3.

When the value in C10 is equal to 200, Y0.10 is ON.
When the value in D200 is greater than -30, Y0.11 keeps ON.
When the value in (C201, C200) is less than 678,493, or when M3 is ON, M50 is ON.

6-5

Ch ap te r 6 Ap plie d Instruc tions

6-6

A H 5 00 Prog r am m ing M an ua l

API
0006~
0011

Instruction code
D

AND※

Device X

Y







S1
S2

M

S

Operand

Function

S1, S2

Comparing the values

T

C

HC

D

L

SM SR

E

PR

K




























16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
-

AH

AH

Symbol:

Taking AND= and DAND= for example

S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

Explanation:
1.
The instructions are used to compare the value in S1 with that in S2. Take the instruction
AND= for example. When the comparison result is that the value in S1 is equal to that in S2,
the condition of the instruction is met. When the comparison result is that the value in S1 is
not equal to that in S2, the condition of the instruction is not met.
2.
Only the 32-bit instruction can use the 32-bit counter.
Comparison operation result
API
16-bit
32-bit
number
instruction
instruction
ON
OFF
0006

AND=

DAND=

S1=S2

S1≠S2

0007

AND<>

DAND<>

S1≠S2

S1=S2

0008

AND>

DAND>

S1>S2

S1≦S2

0009

AND>=

DAND>=

S1≧S2

S1<S2

0010

AND<

DAND<

S1<S2

S1≧S2

0011

AND<=

DAND<=

S1≦S2

S1>S2

Example:
1.
2.

When X0.0 is ON and the current value in C10 is equal to 100, Y0.10 is ON.
When X0.1 is OFF and the value in D0 is not equal to -10, Y0.11 keeps ON.

3.

When X0.2 is ON and the value in (D11, D10) is less than 678,493, or when M3 is ON, M50
is ON.

6-7

Ch ap te r 6 Ap plie d Instruc tions

6-8

A H 5 00 Prog r am m ing M an ua l

API
0012~
0017

Instruction code
D

Function

S1, S2

Comparing the values

OR※

Device X

Y







S1
S2

Operand

M

S

T

C

HC

D

L
















SM

SR

E

PR

K













16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
-

AH

AH

Symbol:

Taking OR= and DOR= for example

S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

Explanation:
1.

2.

The instructions are used to compare the value in S1 with that in S2. Take the instruction OR=
for example. When the comparison result is that the value in S1 is equal to that in S2, the
condition of the instruction is met. When the comparison result is that the value in S1 is not
equal to that in S2, the condition of the instruction is not met.
Only the 32-bit instruction can use the 32-bit counter.
Comparison operation result
API
16-bit
32-bit
number
instruction
instruction
ON
OFF
0012

OR=

DOR=

S1=S2

S1≠S2

0013

OR<>

DOR<>

S1≠S2

S1=S2

0014

OR>

DOR>

S1>S2

S1≦S2

0015

OR>=

DOR>=

S1≧S2

S1<S2

0016

OR<

DOR<

S1<S2

S1≧S2

0017

OR<=

DOR<=

S1≦S2

S1>S2

Example:
1.
2.

When X0.1 is ON, or when the current value in C10 is equal to 100, Y0.10 is ON.
When both X0.2 and M30 are ON, or when the value in (D101, D100) is greater than or equal
to 1000,000, M60 is ON.

6-9

Ch ap te r 6 Ap plie d Instruc tions

6-10

A H 5 00 Prog r am m ing M an ua l

API
0018~

Instruction code
D

FLD※

Device

X

Y

S1
S2







0023

M

Function

Operand

Comparing the floating-point
numbers

S1, S2
S

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF



Pulse instruction 32-bit instruction (5-7 steps) 64-bit instruction (5-7 steps)
-

AH

AH

Symbol:
S1 : Data source 1

Double word/Long word

S2 : Data source 2

Double word/Long word

Taking FLD= and DFLD= for example
Explanation:
1.

The instructions are used to compare the value in S1 with that in S2, and the values
compared are floating-point numbers. Take the instruction FLD= for example. When the
comparison result is that the value in S1 is equal to that in S2, the condition of the instruction
is met. When the comparison result is that the value in S1 is not equal to that in S2, the
condition of the instruction is not met.
Comparison operation result
API
32-bit
64-bit
number
instruction
instruction
ON
OFF
0018

FLD=

DFLD=

S1=S2

S1≠S2

0019

FLD<>

DFLD<>

S1≠S2

S1=S2

0020

FLD>

DFLD>

S1>S2

S1≦S2

0021

FLD>=

DFLD>=

S1≧S2

S1<S2

0022

FLD<

DFLD<

S1<S2

S1≧S2

0023

FLD<=

DFLD<=

S1≦S2

S1>S2

Example:
Take the instruction FLD= for example. When the value in D0 is equal to that in D2, Y0.0 is ON.

Additional remark:
1.

If the value in S1 or S2 exceeds the range of values which can be represented by the
floating-point numbers, the contact is OFF, SM is ON, and the error code in SR0 is 16#2013.

6 - 11

Ch ap te r 6 Ap plie d Instruc tions

API
0024~
0029

Instruction code
D

FAND※

Device X

Y







S1
S2

M

Function

Operand

Comparing the floating-point
numbers

S1, S2
S

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF



Pulse instruction 32-bit instruction (5-7 steps) 64-bit instruction (5-7 steps)
-

AH

AH

Symbol:
S1 : Data source 1

Double word/Long word

S2 : Data source 2

Double word/Long word

Taking FAND= and DFAND= for example
Explanation:
1.

The instructions are used to compare the value in S1 with that in S2, and the values
compared are floating-point numbers. Take the instruction FAND= for example. When the
comparison result is that the value in S1 is equal to that in S2, the condition of the instruction
is met. When the comparison result is that the value in S1 is not equal to that in S2, the
condition of the instruction is not met.
Comparison operation result
API
32-bit
64-bit
number
instruction
instruction
ON
OFF
0024

FAND=

DFAND=

S1=S2

S1≠S2

0025

FAND<>

DFAND<>

S1≠S2

S1=S2

0026

FAND>

DFAND>

S1>S2

S1≦S2

0027

FAND>=

DFAND>=

S1≧S2

S1<S2

0028

FAND<

DFAND<

S1<S2

S1≧S2

0029

FAND<=

DFAND<=

S1≦S2

S1>S2

Example:
Take the instruction FAND= for example. When X1.0 is ON and the value in D1 is equal to that in
D2, Y1.0 is ON.

Additional remark:
1.

6-12

If the value in S1 or S2 exceeds the range of values which can be represented by the
floating-point numbers, the contact is OFF, SM is ON, and the error code in SR0 is 16#2013.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0030~

D

0035

FOR※

Device

X

Y

S1
S2







M

Function

Operand

Comparing the floating-point
numbers

S1, S2
S

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF



Pulse instruction 32-bit instruction (5-7 steps) 64-bit instruction (5-7 steps)
-

AH

AH

Symbol:
S1 : Data source 1

Double word/Long word

S2 : Data source 2

Double word/Long word

Taking FOR= and DFOR= for example
Explanation:
1.

The instructions are used to compare the value in S1 with that in S2, and the values
compared are floating-point numbers. Take the instruction FOR= for example. When the
comparison result is that the value in S1 is equal to that in S2, the condition of the instruction
is met. When the comparison result is that the value in S1 is not equal to that in S2, the
condition of the instruction is not met.
Comparison operation result
API
32-bit
64-bit
number
instruction
instruction
ON
OFF
0030

FOR=

DFOR=

S1=S2

S1≠S2

0031

FOR<>

DFOR<>

S1≠S2

S1=S2

0032

FOR>

DFOR>

S1>S2

S1≦S2

0033

FOR>=

DFOR>=

S1≧S2

S1<S2

0034

FOR<

DFOR<

S1<S2

S1≧S2

0035

FOR<=

DFOR<=

S1≦S2

S1>S2

Example:
When X1.0 is ON, or when the value in D1 is equal to that in D2, Y1.0 is ON.

6-13

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

6-14

If the value in S1 or S2 exceeds the range of values which can be represented by the
floating-point numbers, the contact is OFF, SM is ON, and the error code in SR0 is 16#2013.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

LD$※

S1, S2

Comparing the strings

0036~
0041
Device X

Y







S1
S2

M

S

T

C







HC

D

L

SM SR

E

PR
















K

Pulse instruction 16-bit instruction (5-17 steps)
-

16# “$”

DF



32-bit instruction

AH

-

Symbol:
S1 : Data source 1

String

S2 : Data source 2

String

Taking LD$= for example
Explanation:
1.

2.

The instructions are used to compare the data in S1 with that in S2, and the data compared is
strings. Take the instruction LD$= for example. When the comparison result is that the data in
S1 is equal to that in S2, the condition of the contact is met. When the comparison result is
that the data in S1 is not equal to that in S2, the condition of the contact is not met.
Comparison operation result
API
Instruction
number
ON
OFF
0036

LD$=

S1=S2

S1≠S2

0037

LD$<>

S1≠S2

S1=S2

0038

LD$>

S1>S2

S1≦S2

0039

LD$>=

S1≧S2

S1<S2

0040

LD$<

S1<S2

S1≧S2

0041

LD$<=

S1≦S2

S1>S2
th

Only when the data in S~S+n (n indicates the n device) includes 16#00 can the data be
judged as a complete string.
b 15

b0

b8 b7

S

16#32( 2)

16#31( 1)

S+1

16#34( 4)

16#33( 3)

S+2

16#00

16#35( 5)

" 12345 "

3.

When two strings are the same, the corresponding comparison operation results of the
instructions are listed below.
b 15

b0

b8 b7

S1

16#42(B)

16#41(A)

S 1 +1

16#44(D)

16#43(C)

S 1 +2

16#00

16#45(E)

" ABCD E "

b 15

Comparison sign

b0

b8 b7

S2

16#42(B)

16#41(A)

S 2 +1

16#44(D)

16#43(C)

S 2 +2

16#00

16#45(E)

" ABCDE "

6-15

Ch ap te r 6 Ap plie d Instruc tions

4.

Comparison symbol

Comparison operation result

$=

ON

$<>

OFF

$>

OFF

$>=

ON

$<

OFF

$<=

ON

When the lengths of the strings are the same, but their contents are different, the first
different values (ASCII codes) met in the strings are compared. For example, the string in S1
is “ABCDF”, and the string in S1 is “ABCDE”. The first different values met in the strings are
“F” (16#46) and “E” (16#45). Owing to the fact that 16#46 is greater than 16#45, the string in
S1 is greater than that in S1. The corresponding comparison operation results of the
instructions are listed below.
b 15

b0

b8 b7

S1

16#42( B)

16#41( A)

S 1 +1

16#44( D)

16#43( C)

16#00

S 1 +2

b 15

Compar ison sign

16#46( F)

16#42( B)

16#41( A)

S 2 +1

16#44( D)

16#43( C)

S 2 +2

16#00

" ABCDF"

5.

16#45( E)

" ABCDE "

Comparison symbol

Comparison operation result

$=

OFF

$<>

ON

$>

ON

$>=

ON

$<

OFF

$<=

OFF

When the lengths of the strings are different, the string whose length is longer is greater than
the string whose length is shorter. For example, the string in S1 is “1234567”, and the string
in S2 is “99999””. Owing to the fact that the string in S1 is composed of 7 characters, and the
string in S2 is composed of 5 characters, the string in S1 is greater than the string in S2. The
corresponding comparison operation results of the instructions are listed below.
b 15

b0

b8 b7

b 15

b0

b8 b7

S1

16#32(2)

16#31(1)

S2

16#39(9)

16#39(9)

S 1 +1

16#34(4)

16#33(3)

S 2 +1

16#39(9)

16#39(9)

S 1 +2

16#36(6)

16#35(5)

S 2 +2

S 1 +3

16#00

Comparison sign

16#00

16#37(7)

16#39(9)

" 99999 "

" 1234567 "

6-16

b0

b8 b7

S2

Comparison symbol

Comparison operation result

$=

OFF

$<>

ON

$>

ON

$>=

ON

A H 5 00 Prog r am m ing M an ua l

Comparison symbol

Comparison operation result

$<

OFF

$<=

OFF

Example:
When the string starting with the data in D0 is equal to the string staring with D2, Y0.0 is ON.

Additional remark:
1.

If the string does not end with 16#00, the instruction is not executed, SM is ON, and the error
code in SR0 is 16#200E.

6-17

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

AND$※

S1, S2

Comparing the strings

0042~
0047
Device X

Y







S1
S2

M

S

T

C

HC







D

L

SM SR

E

PR
















K

16# “$”

DF




Pulse instruction 16-bit instruction (5-17 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Data source 1

String

S2 : Data source 2

String

Taking AND$= for example
Explanation:
1.

2.
3.

The instructions are used to compare the data in S1 with that in S2, and the data compared is
strings. Take the instruction AND$= for example. When the comparison result is that the data
in S1 is equal to that in S2, the condition of the contact is met. When the comparison result is
that the data in S1 is not equal to that in S2, the condition of the contact is not met.
Only when the data in S~S+n (n indicates the nth device) includes 16#00 can the data be
judged as a complete string.
When the strings are completely the same, the corresponding comparison operation results
of the instructions are listed below.
b 15

b0

b8 b7

S1

16#42( B)

16#41( A)

S 1 +1

16#44( D)

16#43( C)

S 1 +2

16#00

b 15

Compar ison sign

16#45( E)

S2

16#42( B)

16#41( A)

S 2 +1

16#44( D)

16#43( C)

S 2 +2

16#00

" ABCDE "

4.

6-18

b0

b8 b7

16#45( E)

" ABCDE "

Comparison symbol

Comparison operation result

$=

ON

$<>

OFF

$>

OFF

$>=

ON

$<

OFF

$<=

ON

When the lengths of the strings are the same, but their contents are different, the first
different values (ASCII codes) met in the strings are compared. For example, the string in S1
is “ABCDF”, and the string in S1 is “ABCDE”. The first different values met in the strings are
“F” (16#46) and “E” (16#45). Owing to the fact that 16#46 is greater than 16#45, the string in
S1 is greater than that in S1. The corresponding comparison operation results of the
instructions are listed below.

A H 5 00 Prog r am m ing M an ua l
b 15

b0

b8 b7

S1

16#42( B)

16#41( A)

S 1 +1

16#44( D)

16#43( C)

16#00

S 1 +2

b 15

Compar ison sign

16#46( F)

16#42( B)

16#41( A)

S 2 +1

16#44( D)

16#43( C)

S 2 +2

16#00

" ABCDF"

5.

b0

b8 b7

S2

16#45( E)

" ABCDE "

Comparison symbol

Comparison operation result

$=

OFF

$<>

ON

$>

ON

$>=

ON

$<

OFF

$<=

OFF

When the lengths of the strings are different, the string whose length is longer is greater than
the string whose length is shorter. For example, the string in S1 is “1234567”, and the string
in S2 is “99999””. Owing to the fact that the string in S1 is composed of 7 characters, and the
string in S2 is composed of 5 characters, the string in S1 is greater than the string in S2. The
corresponding comparison operation results of the instructions are listed below.
b 15

b0

b8 b7

16#32(2)

16#31(1)

S 1 +1

16#34(4)

16#33(3)

S 1 +2

16#36(6)

16#35(5)

S1

S 1 +3

16#00

b 15

Comparison sign

b0

b8 b7

S2

16#39(9)

16#39(9)

S 2 +1

16#39(9)

16#39(9)

S 2 +2

16#00

16#37(7)

16#39(9)

" 99999 "

" 1234567 "

Comparison symbol

Comparison operation result

$=

OFF

$<>

ON

$>

ON

$>=

ON

$<

OFF

$<=

OFF

Example:
When M0 is ON and the string starting with the data in D0 is equal to the string staring with D2,
Y0.0 is ON.

6-19

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

OR$※

S1, S2

Comparing the strings

0048~
0053
Device

X

Y

S1
S2







M

S

T

C







HC

D

L

SM SR

E

PR
















K

16# “$”

DF




Pulse instruction 16-bit instruction (5-17 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Data source 1

String

S2 : Data source 2

String

Taking OR$= for example
Explanation:
1.

2.
3.

The instructions are used to compare the data in S1 with that in S2, and the data compared is
strings. Take the instruction OR$= for example. When the comparison result is that the data
in S1 is equal to that in S2, the condition of the contact is met. When the comparison result is
that the data in S1 is not equal to that in S2, the condition of the contact is not met.
Only when the data in S~S+n (n indicates the nth device) includes 16#00 can the data be
judged as a complete string.
When the strings are completely the same, the corresponding comparison operation results
of the instructions are listed below.
b 15

b0

b8 b7

S1

16#42( B)

16#41( A)

S 1 +1

16#44( D)

16#43( C)

S 1 +2

16#00

b 15

Compar ison sign

16#45( E)

S2

16#42( B)

16#41( A)

S 2 +1

16#44( D)

16#43( C)

S 2 +2

16#00

" ABCDE "

4.

6-20

b0

b8 b7

16#45( E)

" ABCD E "

Comparison symbol

Comparison operation result

$=

ON

$<>

OFF

$>

OFF

$>=

ON

$<

OFF

$<=

ON

When the lengths of the strings are the same, but their contents are different, the first
different values (ASCII codes) met in the strings are compared. For example, the string in S1
is “ABCDF”, and the string in S1 is “ABCDE”. The first different values met in the strings are
“F” (16#46) and “E” (16#45). Owing to the fact that 16#46 is greater than 16#45, the string in
S1 is greater than that in S1. The corresponding comparison operation results of the
instructions are listed below.

A H 5 00 Prog r am m ing M an ua l
b 15

b0

b8 b7

S1

16#42( B)

16#41( A)

S 1 +1

16#44( D)

16#43( C)

16#00

S 1 +2

b 15

Compar ison sign

16#46( F)

16#42( B)

16#41( A)

S 2 +1

16#44( D)

16#43( C)

S 2 +2

16#00

" ABCDF"

5.

b0

b8 b7

S2

16#45( E)

" ABCDE "

Comparison symbol

Comparison operation result

$=

OFF

$<>

ON

$>

ON

$>=

ON

$<

OFF

$<=

OFF

When the lengths of the strings are different, the string whose length is longer is greater than
the string whose length is shorter. For example, the string in S1 is “1234567”, and the string
in S2 is “99999””. Owing to the fact that the string in S1 is composed of 7 characters, and the
string in S2 is composed of 5 characters, the string in S1 is greater than the string in S2. The
corresponding comparison operation results of the instructions are listed below.
b 15

b0

b8 b7

S1

16#32(2)

16#31(1)

S 1 +1

16#34(4)

16#33(3)

S 1 +2

16#36(6)

16#35(5)

S 1 +3

16#00

b 15

Comparison sign

b0

b8 b7

S2

16#39(9)

16#39(9)

S 2 +1

16#39(9)

16#39(9)

S 2 +2

16#00

16#37(7)

16#39(9)

" 99999 "

" 1234567 "

Comparison symbol

Comparison operation result

$=

OFF

$<>

ON

$>

ON

$>=

ON

$<

OFF

$<=

OFF

Example:
When M0 is ON, or when the string starting with the data in D0 is equal to the string staring with D2,
Y0.0 is ON.

6-21

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

0054

D

CMP

P

S1, S2, D

Comparing the values

Device

X

Y

S

S1
S2
D









M



T

C

HC

D

L

SM SR

E

PR

K



































16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S1 : Comparison value 1

Word/Double word

S2 : Comparison value 2

Word/Double word

D : Comparison result

Bit

Explanation:
1.
2.

3.

The instruction is used to compare the value in S1 with that in S2, and the values compared
are singed decimal numbers. The comparison results are stored in D.
The operand D occupies three consecutive devices. The comparison results are stored in D,
D+1, and D+2. If the comparison value in S1 is greater than the comparison value in S2, D will
be ON. If the comparison value in S1 is equal to the comparison value in S2, D+1 is ON. If the
comparison value in S1 is less than the comparison value in S2, D+2 will be ON.
Only the instructions DCMP and DCMPP can use the 32-bit counter.

Example:
1.
2.

If the operand D is M0, the comparison results will be stored in M0, M1 and M2, as shown
below.
When X0.0 is ON, the instruction CMP is executed. M0, M1, or M2 is ON. When X0.0 is OFF,
the execution of the instruction CMP stops. The state of M0, the state of M1, and the state of
M1 remain unchanged.

3.

If users want to clear the comparison result, they can use the instruction RST or ZRST.

6-22

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.

If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-23

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0055

D

ZCP

Device

X

Y

S1
S2
S
D











P
M



S

Operand

Function

S1, S2, S, D

Zone comparison

T

C

HC

D

L

SM SR

E

PR

K












































16# “$”

DF





Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
AH

AH

AH

Symbol:
S1 :

Minimum value of the zone
comparison

Word/Double word

S2 :

Maximum value of the zone
comparison

Word/Double word

S : Comparison value

Word/Double word

D : Comparison result

Bit

Explanation:
1.

2.
3.

4.

The instruction is used to compare the value in S with that in S1, and compare the value in S
with that in S2. The values compared are singed decimal numbers, and the comparison
results are stored in D.
The value in S1 must be less than that in S2. If the value in S1 is larger than that in S2, S1 will
be taken as the maximum/minimum value during the execution of the instruction ZCP.
The operand D occupies three consecutive devices. The comparison results are stored in D,
D+1, and D+2. If the comparison value in S1 is less than the comparison value in S, D will be
ON. If the comparison value in S is within the range between the value in S1 and the value in
S2, D+1 will ON. If the comparison value in S is greater than the value in S2, D+2 will be ON.
Only the instructions DZCP and DZCPP can use the 32-bit counter.

Example:
1.
2.

If the operand D is M0, the comparison results will be stored in M0, M1 and M2, as shown
below.
When X0.0 is ON, the instruction ZCP is executed. M0, M1, or M2 is ON. When X0.0 is OFF,
the instruction ZCP is not executed. The state of M0, the state of M1, and the state of M2
remain the same as those before X0.0’s being OFF.

3.

If users want to clear the comparison result, they can use the instruction RST or ZRST.

6-24

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.

If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-25

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

0056

FCMP

P

S1, S2, D

S

Device

X

Y

S1
S2
D









M





Function
Comparing the floating-point
numbers

T

C

HC

D

L

SM SR

E

PR






























K

16# “$”

DF



Pulse instruction 32-bit instruction (7-9 steps) 64-bit instruction
AH

AH

-

Symbol:
S1 : Floating-point number 1

Double word

S2 : Floating-point number 2

Double word

D : Comparison result

Bit

Explanation:
1.
2.

The instruction FCMP is used to compare the floating-point number in S1 with the
floating-point number in S2. The comparison results are stored in D.
The operand D occupies three consecutive devices. The comparison results are stored in D,
D+1, and D+2. If the comparison value in S1 is greater than the comparison value in S1, D will
be ON. If the comparison value in S1 is equal to the value in S2, D+1 will ON. If the
comparison value in S1 is less than the value in S2, D+2 will be ON.

Example:
1.
2.

3.
4.

If the operand D is M10, the comparison results will be stored in M10, M11 and M12, as
shown below.
When X0.0 is ON, the instruction FCMP is executed. M10, M11, or M12 is ON. When X0.0 is
OFF, the instruction FCMP is not executed. The state of M10, the state of M11, and the state
of M12 remain the same as those before X0.0’s being OFF.
If users want to get the comparison result ≧, ≦, or ≠, they can connect M10~M12 is series or
in parallel.
If users want to clear the comparison result, they can use the instruction RST or ZRST.

Additional remark:
1.
2.
3.

6-26

If the value in S1 or S2 exceeds the range of values which can be represented by the
floating-point numbers, the contact is OFF, SM is ON, and the error code in SR0 is 16#2013.
If users declare the operand D in ISPSoft, the data type will ARRAY [3] of BOOL.
If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0057

FZCP

S1, S2, S, D

Floating-point zone comparison

Device X

Y











S1
S2
S
D

M



P
S

T

C

HC

D

W

L






























Bm SM SR









E

PR












Pulse instruction 32-bit instruction (9-12 steps)
AH

K

16# “$“ DF




64-bit instruction
-

AH

Symbol:
S1 :

Double word

S2

Minimum value of the zone
comparison
Maximum value of the zone
:
comparison

Double word

S

: Comparison value

D : Comparison result

Double word
Bit

Explanation:
1.

2.
3.

The instruction is used to compare the value in S with that in S1, and compare the value in S
with that in S2. The values compared are floating-point numbers, and the comparison results
are stored in D.
The value in S1 must be less than that in S2. If the value in S1 is larger than that in S2, S1 will
be taken as the maximum/minimum value during the execution of the instruction FZCP.
The operand D occupies three consecutive devices. The comparison results are stored in D,
D+1, and D+2. If the comparison value in S1 is greater than the comparison value in S, D will
be ON. If the comparison value in S is within the range between the value in S1 and the value
in S2, D+1 will be ON. If the comparison value in S2 is less than the value in S, D+2 will be
ON.

Example:
1.
2.

3.

If the operand D is M0, the comparison results will be stored in M0, M1 and M2.
When X0.0 is ON, the instruction FZCP is executed. M0, M1, or M2 is ON. When X0.0 is OFF,
the instruction FZCP is not executed. The state of M0, the state of M1, and the state of M2
remain the same as those before X0.0’s being OFF.
If users want to clear the comparison result, they can use the instruction RST or ZRST.

Additional remark:
1.
2.

If the value in S1 or S2 or S exceeds the range of values which can be represented by the
floating-point numbers, the contact is OFF, SM is ON, and the error code in SR0 is 16#2013.
If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
6-27

Ch ap te r 6 Ap plie d Instruc tions
3.

6-28

If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0058

MCMP

P

S1, S2, n, D

Matrix comparison

Device X

Y

S











S1
S2
n
D

M

T

C











HC

D

L

SM SR
















E

PR





K



16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

-

AH

Symbol:
S1 : Matrix source device 1

Word

S2 : Matrix source device 2

Word

n : Length of the array

Word

D : Pointer

Word

Explanation:
1.

2.
3.

4.

5.

The search for the bits whose states are different starts from the bits specified by the number
gotten from the addition of one to the current value in D. After the bits whose states are
different are found, the bit number is stored in D, and the comparison is finished.
The operand n should be within the range between 1 and 256.
When SM607 is ON, the equivalent values are compared. When SM607 is OFF, the different
values are compared. When the matching bits are compared, the comparison stops
immediately, and SM610 is ON. When the last bits are compared, SM608 is ON, and the bit
number is stored in D. The comparison starts from the 0th bits in the next scan cycle, and
SM609 is ON. When the value in D exceeds the range, SM611 is ON.
When the instruction MCMP is executed, users need a 16-bit register to specify a certain bit
among the 16n bits in the matrix for the operation. The register is called the pointer, and is
specified by users. The value in the register is within the range between 0 and 16n-1, and
corresponds to the bit within the range between b0 and b16n-1. During the operation, users
should be prevented from altering the value of the pointer in case the search for the matching
bits is affected. If the value of the pointer exceeds the range, SM611 will be ON, and the
instruction MCMP will not be executed.
If SM608 and SM610 occur simultaneously, they will be ON simultaneously.

Example:
1.

2.

When X0.0 is switched from OFF to ON, SM609 is OFF. The search for the bits whose states
are different (SM607 is OFF) starts from the bits specified by the number gotten from the
addition of one to the current value of the pointer.
Suppose the current value in D20 is 2. When X0.0 is switched from OFF to ON four times,
users can get the following execution results.

The value in D20 is 5, SM610 is ON, and SM608 is OFF.

The value in D20 is 45, SM610 is ON, and SM608 is OFF.

The value in D20 is 47, SM610 is OFF, and SM608 is ON.

The value in D20 is 1, SM610 is ON, and SM608 is OFF.

6-29

Ch ap te r 6 Ap plie d Instruc tions

2
b0
S1

Pointer

D20

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

b47
MCMP
b0
S2

0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1

b47

Additional remark:
1.

2.

6-30

The description of the operation error code:
If the devices S1+n-1 and S2+n-1 exceed the range, the instruction MCMP is not executed,
SM is ON, and the error code in SR0 is 16#2003.
If the value in the operand n is not within the range between 1 and 256, the instruction
MCMP is not executed, SM is ON, and the error code in SR0 is 16#200B.
The description of the flags:
It is the matrix comparison flag.
SM607:
ON: Comparing the equivalent values
OFF: Comparing the different values
The matrix comparison comes to an end. When the last bits are compared,
SM608:
SM608 is ON.
SM609:
When SM609 is ON, the comparison starts from bit 0.
It is the matrix bit search flag. When the matching bits are compared, the
SM610:
comparison stops immediately, and SM610 is ON.
It is the matrix pointer error flag. When the value of the pointer exceeds
SM611:
the comparison range, SM611 is ON.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0059~
0064

CMPT※

Device X

Y











S1
S2
n
D

M



P

S

T

C









Operand

Function

S1, S2, n, D

Comparing the tables

HC



D

L

SM SR

E

PR

K


































16# “$”

DF

Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

-

AH

Symbol:
S1 : Source device 1

Word

S2 : Source device 2

Word

n : Data length

Word

D : Comparison result

Bit

Explanation:
1.

The instruction is used to compare n pieces of data in devices starting from S1 with those in
devices starting from S2. The values compared are signed decimal numbers, and the
comparison results are stored in D.
The operand n should be within the range between 1 and 256.
The value which is written into the operand D is a one-bit value.
When the results gotten from the comparison by using the instruction CMPT# are that all
devices are ON, SM620 is ON. Otherwise, SM620 is OFF.
If the operand S1 is a device, the comparison will be as shown below.

2.
3.
4.
5.

Compar ison result
S1
S 1 +1
S 1 +2
S 1 +3

1234(BIN)
5678(BIN)
5000(BIN)
1000(BIN)

S2
S 2 +1

Compar ison sign
n

S 2 +2

>

S 2 +3

n

S 2 +( N- 2)
S 2 +( N- 1)

D

+1

D

+2
+3

D

~

10(BIN)
90(BIN)

1
1
1
0

D

~

~
S 1 +( N- 2)
S 1 +( N- 1)

6.

1111(B IN)
2222(BIN)
3333(BIN)
4444(BIN)
8888(BIN)
9999(BIN)

D
D

0
0

+( N- 2)
+( N- 1)

If the operand S1 is a constant within the range between -32768 and 32767, the comparison
will be as shown below.
Compar ison result
S2

C ompar iosn sign
S1

3333(BIN)

=

S 2 +1
S 2 +2
S 2 +3

1111(B IN)
2222(BIN)
3333(BIN)
4444(BIN)

D

n

D

+2
+3

0
0
1
0

~

7.

+1

D

~
S 2 +( N- 2)
S 2 +( N- 1)

D

8888(BIN)
9999(BIN)

D
D

+( N- 2)
+( N- 1)

0
0

The corresponding comparison operation results of the instructions are listed below.
6-31

Ch ap te r 6 Ap plie d Instruc tions

API
number

16-bit
instruction

Comparison operation result
ON
OFF

0059

CMPT=

S1=S2

S1≠S2

0060

CMPT<>

S1≠S2

S1=S2

0061

CMPT>

S1>S2

S1≦S2

0062

CMPT>=

S1≧S2

S1<S2

0063

CMPT<

S1<S2

S1≧S2

0064

CMPT<=

S1≦S2

S1>S2

Example:
The data in D0~D3 are compared with that in D10~D13. If the comparison result is that the data in
D0~D3 is the same as that in D10~D13, Y0.1~Y0.4 will be ON.

Comparison result
1

D0

1000

Comparison sign

D10

1000

Y0.1

D1

2000

=

D11

1000

Y0.2

0

D2

3000

D3

4000

D12

1000

Y0.3

0

D13

1000

Y0.4

0

Additional remark:
1.
2.

6-32

If the value in the operand n is not within the range between 1 and 256, the instruction is not
executed, SM is ON, and the error code in SR0 is 16#200B.
If the number of devices specified by S1~S1+n, S2~S2+n, or D is insufficient, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#2003.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0065

CHKADR

S, n, D

Checking the address of the contact
type of pointer register

Device

X

Y

S
n
D







M



S

T

C





HC



D

L

SM SR

E

PR

K



















16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
-

AH

-

Symbol:

n : Number of devices

POINTER/T_POINTER/
C_POINTER/HC_POINTER
Word

D : Check result

Bit

S : Pointer register

Explanation:
1.

2.
3.
4.

The instruction CHKADR is used to check whether the value in S and (the value in S)+n-1
exceed the device range. If the check result is that the value in S and (the value in S)+n-1 do
not exceed the device range, the device D will be ON. Otherwise, it will be OFF.
S supports the pointer registers PR, TR, CR, and HCR.
The operand n should be within the range between 1 and 1024.
The instruction CHKADR only can be used in the function block.

Example:
1.

Establish a program and a function block in ISPSoft.

Declare two variables in the program.

2.

Declare VarPR1, VarTR1, VarCR1, and VarHCR1 in the function block, and assign the data
types POINTER, T_POINTER, C_POINTER, and HC_POINTER to them respectively.

6-33

Ch ap te r 6 Ap plie d Instruc tions

3.

Call the function block FB0 in the program, and assign D65535, T0, C2047, and HC50 to
VarPR1, VarTR1, VarCR1, and VarHCR1 in FB0 respectively.

4.

Use the instruction CHKADR to check whether VarPR1, VarTR1, VarCR1, and VarHCR1
exceed the range.
When chkPR is ON, the practical device represented by VarPR1 is D65535. Since the legal
range of devices is from D0 to D65535, and D65535+10-1=D65544, which exceeds the
range, PR_ChkBit is OFF.

5.

6.

When chkTR is ON, the practical device represented by VarTR1 is T0. Since the legal range
of devices is from T0 to T2047, and T0+10-1=T9, which does not exceed the range,
TR_ChkBit is ON.

7.

When chkCR is ON, the practical device represented by C2047. Since the legal range of
devices is from C0 to C2047, and C2047+10-1=C2056, which exceeds the range,
CR_ChkBit is OFF.

6-34

A H 5 00 Prog r am m ing M an ua l

8.

When chkHCR is ON, the practical device represented by HC50 is VarHCR1. Since the legal
range of deices is from HC0 to HC63, and HC50+10-1=HC59, which does not exceed the
range, HCR_ChkBit is ON.

Additional remark:
1.
2.

If the value (the practical device address) in S exceeds the device range, the instruction
CHKADR is not executed, SM is ON, and the error code in SR0 is 16#2003.
If the value in the operand n is not within the range between 1 and 1024, the instruction
CHKADR is not executed, SM is ON, and the error code in SR0 is 16#200B.

6-35

Ch ap te r 6 Ap plie d Instruc tions

6.2 Arithmetic Instructions
6.2.1 List of Arithmetic Instructions
API

Instruction code
Pulse
16-bit 32-bit 64-bit instruction

0100

+

D+

–



0101

-

D-

–



0102

*

D*

–



0103

/

D/

–



0104

–

F+

DF+



0105

–

F-

DF-



F*

DF*



F/

DF/



–



–

0106

–

0107
0108

B+

DB+

0109

B-

DB-

0110

B*

DB*

0111

B/

DB/

0112

BK+

0113

BK-

0114

–

–

–



–

–



–

–



$+

–



0115

INC

DINC

–
–

0116

DEC

DDEC

–



6-36



Function
Addition of binary
numbers
Subtraction of binary
numbers
Multiplication of binary
numbers
Division of binary
numbers
Addition of floating-point
numbers
Subtraction of
floating-point numbers
Multiplication of
floating-point numbers
Division of floating-point
numbers
Addition of binary-coded
decimal numbers
Subtraction of
binary-coded decimal
numbers
Multiplication of
binary-coded decimal
numbers
Division of binary-coded
decimal numbers
Binary number block
addition
Binary number block
subtraction
Linking the strings
Adding one to the binary
number
Subtracting one from the
binary number

Step

Page
number

7

6-37

7

6-39

7

6-41

7

6-43

7-9

6-45

7-9

6-47

7-9

6-49

7-9

6-51

7

6-53

7

6-55

7

6-57

7

6-59

9

6-61

9

6-63

7-19

6-65

3

6-67

3

6-68

A H 5 00 Prog r am m ing M an ua l

6.2.2 Explanation of Arithmetic Instructions
API

Instruction code

Operand

Function

0100

D

S1, S2, D

Addition of binary numbers

Device

X

Y

S1
S2
D









+

P
M

S

T

C

HC

D

L

SM SR

E

PR

K




































16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction 7 steps)
AH

AH

AH

Symbol:
S1 : Augend

Word/Double word

S2 : Addend

Word/Double word

D : Sum

Word/Double word

Explanation:
The binary value in S2 is added to the binary value in S1, and the sum is stored in D.
Only the 32-bit instructions can use the 32-bit counter.
The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the operation result is zero, SM600 is ON. Otherwise, it is OFF.
The addition of 16-bit binary values:
When the operation result exceeds the range of 16-bit binary values, SM602 is ON. Otherwise,
it is OFF.
6. The addition of 32-bit binary values:
When the operation result exceeds the range of 32-bit binary values, SM602 is ON. Otherwise,
it is OFF.
1.
2.
3.
4.
5.

Example 1:
The addition of 16-bit binary values: When X0.0 is ON, the addend in D10 is added to the augend in
D0, and sum is stored in D20.




When the values in D0 and D10 are 100 and 10 respectively, D0 plus D10 equals 110, and 110
is stored in D20.
When the values in D0 and D10 are 16#7FFF and 16#1 respectively, D0 plus D10 equals
16#8000, and 16#8000 is stored in D20.
6-37

Ch ap te r 6 Ap plie d Instruc tions


When the values in D0 and D10 are 16#FFFF and 16#1 respectively, D0 plus D10 equals
16#10000. Since the operation result exceeds the range of 16-bit binary values, SM602 is ON,
and the value stored in D20 is 16#0. Besides, since the operation result is 16#0, SM600 is ON.

Example 2:
The addition of 32-bit binary values: When X0.0 is ON, the addend in (D41, D40) is added to the
augend in (D31, D30), and sum is stored in (D51, D50). (The data in D30, D40, and D50 is the lower
16-bit data, whereas the data in D31, D41, and D51 is the higher 16-bit data).




When the values in (D31, D30) and (D41, D40) are 11111111 and 44444444 respectively,
(D31, D30) plus (D41, D40) equals 55555555, and 55555555 is stored in (D51, D50).
When the values in (D31, D30) and (D41, D40) are 16#80000000 and 16#FFFFFFFF
respectively, (D31, D30) plus (D41, D40) equals 16#17FFFFFFF. Since the operation result
exceeds the range of 32-bit binary values, SM602 is ON, and the value stored in (D51, D50) is
16#7FFFFFFF.

Flag:
The 16-bit instruction:
1.
If the operation result is zero, SM600 will be set to ON.
2.
If the operation result exceeds 65,535, SM602 will be set to ON.
The 32-bit instruction:
1.
If the operation result is zero, SM600 will be set to ON.
2.
If the operation result exceeds 4,294,967,295, SM602 will be set to ON.
The 16-bit instruction:
Zero flag
Zero flag

65,535、0、1

65,535、0、1
Borrow flag

The 32-bit instruction:

Zero flag

4,294,967,295 、0、1

Zero flag

4,294,967,295 、0、1

Borrow flag

6-38

Zero flag

65,535、0、1 、2

Carry flag

Zero flag

4,294,967,295 、0、1、2

Carry flag

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0101

D

S1, S2, D

Subtraction of binary numbers

-

Device X

Y









S1
S2
D

P
M

S

T

C

HC

D

L

SM SR

E

PR

K




































Pulse instruction

16# “$”

DF




16-bit instruction (7 steps) 32-bit instruction (7 steps)

AH

AH

AH

Symbol:
S1 : Minuend

Word/Double word

S2 : Subtrahend

Word/Double word

D : Difference

Word/Double word

Explanation:
1.
2.
3.
4.
5.

The binary value in S2 is subtracted from the binary value in S1, and the difference is stored in
D.
Only the 32-bit instructions can use the 32-bit counter.
The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the operation result is zero, SM600 is ON. Otherwise, it is OFF.
When a borrow occurs during the arithmetic, SM601 is ON. Otherwise, it is OFF.

Example 1:
The subtraction of 16-bit binary values: When X0.0 is ON, the subtrahend in D10 is subtracted from
the minuend in D0, and the difference is stored in D20.







When the values in D0 and D10 are 100 and 10 respectively, D0 minus D10 leaves 90, and 90
is stored in D20.
When the values in D0 and D10 are 16#8000 and 16#1 respectively, D0 minus D10 leaves
16#7FFF, and 16#7FFF is stored in D20.
When the values in D0 and D10 are 16#1 and 16#2 respectively, D0 minus D10 leaves
16#FFFF. Since the borrow occurs during the arithmetic, SM601 is ON, and the value stored in
D20 is 16#FFFF.
When the values in D0 and D10 are 16#0 and 16#FFFF respectively, D0 minus D10 leaves
16#F0001. Since the borrow occurs during the arithmetic, SM601 is ON, and the value stored
in D20 is 16#1.

6-39

Ch ap te r 6 Ap plie d Instruc tions

Example 2::
The addition of 32-bit binary values: When X0.0 is ON, the subtrahend in (D41, D40) is subtracted
from the minuend in (D31, D30), and sum is stored in (D51, D50). (The data in D30, D40, and D50 is
the lower 16-bit data, whereas the data in D31, D41, and D51 is the higher 16-bit data).




6-40

When the values in (D31, D30) and (D41, D40) are 55555555 and 11111111 respectively,
(D31, D30) minus (D41, D40) D10 leaves 44444444, and 44444444 is stored in (D51, D50).
When the values in (D31, D30) and (D41, D40) are 16#80000000 and 16#FFFFFFFF
respectively, (D31, D30) minus (D41, D40) leaves 16#F80000001. Since the borrow occurs
during the arithmetic, SM601 is ON, and the value stored in (D51, D50) is 16#80000001.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0102

D

S1, S2, D

*

Device X

Y









S1
S2
D

P
M

S

Function
Multiplication of binary numbers

T

C

HC

D

L





















SM

SR

E

PR

K
















16# “$” DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:

S1

: Multiplicand

Word/Double word

S2

: Multiplier

Word/Double word

D

: Product

Double word/Long word

Explanation:
1.
2.
3.

The signed binary value in S1 is multiplied by the singed binary value in S2, and the product is
stored in D.
Only the instruction D* can use the 32-bit counter.
The multiplication of 16-bit binary values:
S1

S2

b15..............b0

b15..............b0

D +1

b31.........b16 b15...........b0

* b15 is the si gn bit.=

b15 is the si gn bit.

4.

D

b31, i.e. b15 in D+ 1, is the sign bit.

The product is a 32-bit value, and is stored in the register (D+1, D), which is composed of 32
bits. When the sign bit b31 is 0, the product is a positive value. When the sign bit b31 is 1, the
product is a negative value.
The multiplication of 32-bit binary values:
S 1 +1

S 2 +1

S1

b31...b16 b15...b0

S2

D +3

D +1

D

b63...b48 b47...b32 b31...b16 b15...b0

b31...b16 b15...b0

*

D +2

=

b31 is the si gn bit. b31 is the si gn bit.

b63, i.e. b15 in D+3, is the sign bit.

The product is a 64-bit value, and is stored in the register (D+3, D+2, D+1, D0), which is
composed of 64 bits. When the sign bit b63 is 0, the product is a positive value. When the sign
bit b63 is 1, the product is a negative value.
Example:
The 16-bit value in D0 is multiplied by the 16-bit value in D10, and the 32-bit product is stored in
(D21, D20). The data in D21 is the higher 16-bit data, whereas the data in D20 is the lower 16-bit
data. Whether the result is a positive value or a negative value depends on the state of the highest
bit b31. When b31 is OFF, the result is a positive value. When b31 is ON, the result is a negative
6-41

Ch ap te r 6 Ap plie d Instruc tions
value.

D0D10(D21, D20)
16-bit value16-bit value32-bit value

6-42

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0103

D

S1, S2, D

Division of binary numbers

/

Device X

Y









S1
S2
D

P
M

S

T

C

HC

D

L

SM SR

E

PR

K




































16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S1 : Dividend

Word/Double word

S2 : Divisor

Word/Double word

D : Quotient; remainder

Word/Double word

Explanation:
1.
2.
3.
4.

The singed binary value in S1 is divided by the signed binary value in S2. The quotient and the
remainder are stored in D.
Only the 32-bit instructions can use the 32-bit counter.
When the sign bit is 0, the value is a positive one. When the sign bit is 1, the value is a
negative one.
The division of 16-bit values:
S1

S2

b15..............b0

b15..............b0

/
5.

Quotient

Remainder

D

D+1

b15..............b0 b15..............b0

=

The operand D occupies two consecutive devices. The quotient is stored in D, and the
remainder is stored in D+1.
The division of 32-bit values:
Remainder
Quotient
S 1 +1

S 2 +1

S1

b15.....b0 b15.....b0

S2

D+1

b15.....b0 b15.....b0

/

D

D+3

D+2

b15.....b0 b15.....b0 b15.....b0 b15.....b0

=

The operand D occupies two devices. The quotient is stored in (D+1, D), and the remainder is
stored in (D+3, D+2).
Example:
When X0.0 is ON, the dividend in D0 is divided by the divisor in D10, the quotient is stored in D20,
and the remainder is stored in D21. Whether the result is a positive value or a negative value
depends on the state of the highest bit.

6-43

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.
3.
4.

6-44

If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If the divisor is 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2012.
If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of DWORD/DINT.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0104

D

S1, S2, D

Device

X

Y

S1
S2
D









F+

P
M

S

Function
Addition of floating-point numbers

T

C

HC

D

L

SM SR

E

PR

































Pulse instruction

K

16# “$”

DF



32-bit instruction (7-9 steps) 64-bit instruction (7-9 steps)

AH

AH

AH

Symbol:
S1 : Augend

Double word/Long word

S2 : Addend

Double word/Long word

D : Sum

Double word/Long word

Explanation:
1.
2.

3.

The floating-point number in S2 is added to the floating-point number in S1, and the sum is
stored in D.
The addition of 32-bit single-precision floating-point numbers:

When the operation result is zero, SM600 is ON.

When the absolute value of the operation result is less than the value which can be
represented by the minimum floating-point number, the value in D is 16#FF7FFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is 16#7F7FFFFF.
The addition of 64-bit double-precision floating-point numbers:

When the operation result is zero, SM600 is ON.

When the absolute value of the operation result is less than the value which can be
represented by the minimum floating-point number, the value in D is
16#FFEFFFFFFFFFFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is
16#7FEFFFFFFFFFFFFF.

Example:
The addition of single-precision floating-point numbers: When X0.0 is ON, the addend
16#4046B852 in (D21, D20) is added to the augend 16#3FB9999A in (D11, D10), and the sum
16#4091C28F is stored in (D31, D30). 16#4046B852, 16#3FB9999A, and 16#4091C28F represent
the floating point numbers 3.105, 1.450, and 4.555 respectively.

6-45

Ch ap te r 6 Ap plie d Instruc tions

The addition of double-precision floating-point numbers: When X0.0 is ON, the addend
16#4008D70A3D70A3D7 in (D23, D22, D21, D20) is added to the augend 16#3FF7333333333333
in (D13, D12, D11, D10), and the sum 16# 40123851EB851EB8 is stored in (D33, D32, D31, D30).

Additional remark:
If the value in S1 or the value in S2 exceeds the range of values which can be represented by the
floating-point numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2013.

6-46

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0105

D

S1, S2, D

F-

Device

X

Y

S1
S2
D









M

P
S

Function
Subtraction of floating-point
numbers

T

C

HC

D

L

SM SR

E

PR

































K

16# “$”

DF



Pulse instruction 32-bit instruction (7-9 steps) 64-bit instruction (7-9 steps)
AH

AH

AH

Symbol:
S1 : Minuend

Double word/Long word

S2 : Subtrahend

Double word/Long word

D : Difference

Double word/Long word

Explanation:
1.
2.
3.

The floating-point number in S2 is subtracted from the floating-point number in S1, and the
difference is store in D.
When the operation result is zero, SM600 is ON.
The subtraction of 32-bit single-precision floating-point numbers:

When the absolute value of the operation result is less than the value which can be
represented by the minimum floating-point number, the value in D is 16#FF7FFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is 16#7F7FFFFF.
S 1 +1

b31.........b16 b15...........b0

4.

S 2 +1

S1

-

S2

D+1

b31.........b16 b15...........b0

D

b31.........b16 b15...........b0

=

The subtraction of 64-bit double-precision floating-point numbers:

When the absolute value of the operation result is less than the value which can be
represented by the minimum floating-point number, the value in D is
16#FFEFFFFFFFFFFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is
16#7FEFFFFFFFFFFFFF.

6-47

Ch ap te r 6 Ap plie d Instruc tions

S 1 +3

S 1 +2

S 1+1

S1

b63...b48 b47...b32 b31...b16 b15...b0
D+3

S 2 +3

S 2 +2

=
S 2 +1

D+2

D+1

D

b63...b48 b47...b32 b31...b16 b15...b0

S2

b63...b48 b47...b32 b31...b16 b15...b0

Example:
The subtraction of 32-bit single-precision floating-point numbers: When X0.0 is ON, the subtrahend
in (D21, D20) is subtracted from the minuend in (D21, D20), and the difference is stored in (D31,
D30).

The subtraction of 64-bit double-precision floating-point numbers: When X0.0 is ON, the subtrahend
in (D23, D22, D21, D20) is subtracted from the minuend in (D13, D12, D11, D10), and the difference
is stored in (D33, D32, D31, D30).

Additional remark:
If the value in S1 or the value in S2 exceeds the range of values which can be represented by the
floating-point numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2013.

6-48

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0106

D

S1, S2, D

F*

Device X

Y









S1
S2
D

M

P
S

Function
Multiplication of floating-point
numbers

T

C

HC

D

L

SM SR

E

PR

































K

16# “$”

DF



Pulse instruction 32-bit instruction (7-9 steps) 64-bit instruction (7-9 steps)
AH

AH

AH

Symbol:
S1 : Multiplicand

Double word/Long word

S2 : Multiplier

Double word/Long word

D : Product

Double word/Long word

Explanation:
1.
2.
3.

The floating-point number in S1 is multiplied by the floating-point number in S2, and the product
is stored in D.
When the operation result is zero, SM600 is ON.
The multiplication of 32-bit single-precision floating-point numbers:

When the absolute value of the operation result is less than value which can be
represented by the minimum floating-point number, the value in D is 16#FF7FFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is 16#7F7FFFFF.
S 1 +1

b31.........b16 b15...........b0

4.

S 2 +1

S1

*

S2

D+1

b31.........b16 b15...........b0

D

b31.........b16 b15...........b0

=

The multiplication of 64-bit double-precision floating-point numbers:

When the absolute value of the operation result is less than the value which can be
represented by the minimum floating-point number, the value in D is
16#FFEFFFFFFFFFFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is
16#7FEFFFFFFFFFFFFF.

6-49

Ch ap te r 6 Ap plie d Instruc tions

S 1 +3

S 1 +1

S 1 +2

S1

b63...b48 b47...b32 b31...b16 b15...b0
D+3

*
S 2 +3

S 2 +2

=
S 2 +1

D+2

D+1

D

b63...b48 b47...b32 b31...b16 b15...b0

S2

b63...b48 b47...b32 b31...b16 b15...b0

Example:
The multiplication of 32-bit single-precision floating-point numbers: When X0.0 is ON, the
multiplicand 32.5 is multiplied by the multiplier in (D1, D0), and the product is stored in (D11, D10).

The multiplication of 64-bit double-precision floating-point numbers: When X0.0 is ON, the
multiplicand in (D13, D12, D11, D10) is multiplied by the multiplier in (D23, D22, D21, D20), and the
product is stored in (D33, D32, D31, D30).

Additional remark:
If the value in S1 or the value in S2 exceeds the range of values which can be represented by the
floating-point numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2013.

6-50

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0107

D

S1, S2, D

Division of floating-point numbers

F/

Device X

Y









S1
S2
D

M

P
S

T

C

HC

D

L

SM SR

E

PR

































K

16# “$” DF



Pulse instruction 32-bit instruction (7-9 steps) 64-bit instruction (7-9 steps)
AH

AH

AH

Symbol:
S1 : Dividend

Double word/Long word

S2 : Divisor

Double word/Long word

D : Quotient

Double word/Long word

Explanation:
1.
2.
3.

The single-precision floating-point number in S1 is divided by the single-precision flaoting-point
number in S2. The quotient is stored in D.
When the operation result is zero, SM600 is ON.
The division of 32-bit single-precision floating-point numbers:

When the absolute value of the operation result is less than the value which can be
represented by the minimum floating-point number, the value in D is 16#FF7FFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is 16#7F7FFFFF.
S 1 +1

S 2 +1

S1

b31.........b16 b15...........b0

D +1

b31.........b16 b15...........b0

/
4.

S2

D

b31.........b16 b15...........b0

=

The division of 64-bit double-precision floating-point numbers:

When the absolute value of the operation result is less than the value which can be
represented by the minimum floating-point number, the value in D is
16#FFEFFFFFFFFFFFFF.

When the absolute value of the operation result is larger than the value which can be
represented by the maximum floating-point number, the value in D is
16#7FEFFFFFFFFFFFFF.

6-51

Ch ap te r 6 Ap plie d Instruc tions

S 1 +3

S 1 +1

S 1 +2

S1

b63...b48 b47...b32 b31...b16 b15...b0
D+3

/
S 2 +3

S 2 +2

=
S 2 +1

D+2

D+1

D

b63...b48 b47...b32 b31...b16 b15...b0

S2

b63...b48 b47...b32 b31...b16 b15...b0

Example:
The division of 32-bit single-precision floating-point numbers: When X0.0 is ON, the dividend in (D1,
D0) is divided by the divisor 100.7, and the quotient is stored in (D11, D10).

The division of 64-bit double-precision floating-point numbers: When X0.0 is ON, the dividend in (D3,
D2, D1, D0) is divided by the divisor in (D23, D22, D21, D20), and the quotient is stored in (D13,
D12, D11, D10).

Additional remark:
1.
2.

6-52

If the divisor is 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2012.
If the value in S1 or the value in S2 exceeds the range of values which can be represented by
the floating-point numbers, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2013.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0108

D

S1, S2, D

Addition of binary-coded decimal
numbers

B+

Device X

Y









S1
S2
D

M

P
S

T

C

HC

D

L

SM SR

E

PR

K




































16# “$” DF



Pulse instruction

16-bit instruction (7 steps)

32-bit instruction (7 steps)

AH

AH

AH

Symbol:
S1 : Augend

Word/Double word

S2 : Addend

Word/Double word

D : Sum

Word/Double word

Explanation:
1.
2.
3.
4.

5.

The binary-coded decimal value in S2 is added to the binary-coded decimal value in S1, and
the sum is stored in D.
Only the instruction DB+ can use the 32-bit counter.
The binary-coded decimal value is represented by the hexadecimal number, and every digit is
within the range between 0 and 9.
The addition of 16-bit binary-coded decimal values:
When the binary-coded decimal values in S1 and S2 are 9999 and 0002 respectively, S1 plus
S2 equals the binary-coded decimal value 10001. Since the carry is ignored, the binary
coded-decimal value stored in D is 0001.
The addition of 32-bit binary-coded decimal values:
When the binary-coded decimal values in S1 and S2 are 99999999 and 00000002 respectively,
S1 plus S2 equals the binary-coded decimal value 100000001. Since the carry is ignored, the
binary coded-decimal value stored in D is 00000001.

Example:
When X0.0 is ON, the constants 1234 and 5678 are converted into the binary-coded decimal values
which are stored in D0 and D1 respectively. The binary-coded decimal value in D1 is added to the
binary-coded decimal value in D0, and the sum is stored in D10.

6-53

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

2.

3.

6-54

If the value in S1 or the value in S2 exceeds the range of values which can be represented by
the binary-coded decimal values, i.e. 0~9999, the instruction B+ is not executed, SM0 is ON,
and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by the
hexadecimal number, but one of digits is not within the range between 0 and 9.).
If the value in S1 or the value in S2 exceeds the range of values which can be represented by
the binary-coded decimal values, i.e. 0~99999999, the instruction DB+ is not executed, SM0 is
ON, and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by
the hexadecimal number, but one of digits is not within the range between 0 and 9.).
The instruction does not support SM600, SM601 and SM602.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0109

D

S1, S2, D

B-

Device X

Y









S1
S2
D

M

P
S

Function
Subtraction of binary-coded
decimal numbers

T

C

HC

D

L

SM SR

E

PR

K




































Pulse instruction

16# “$” DF



16-bit instruction (7 steps) 32-bit instruction (7 steps)

AH

AH

AH

Symbol:
S1 : Minuend

Word/Double word

S2 : Subtrahend

Word/Double word

D : Difference

Word/Double word

Explanation:
1.
2.
3.
4.

5.

The binary-coded decimal value in S2 is subtracted from the binary-coded decimal value in S1,
and the difference is stored in D.
Only the instruction DB- can use the 32-bit counter.
The binary-coded decimal value is represented by the hexadecimal number, and every digit is
within the range between 0 and 9.
The subtraction of 16-bit binary-coded decimal values:

When the binary-coded decimal values in S1 and S2 are 9999 and 9998 respectively, S1
minus S2 leaves the binary-coded decimal value 0001, and 0001 is stored in D.

When the binary-coded decimal values in S1 and S2 are 0001 and 9999 respectively, S1
minus S2 leaves the binary-coded decimal value -9998, and the binary-coded decimal
value 0002 is stored in D.

When the binary-coded decimal values in S1 and S2 are 0001 and 0004 respectively, S1
minus S2 leaves the binary-coded decimal value -0003, and the binary-coded decimal
value 9997 is stored in D.
The subtraction of 32-bit binary-coded decimal values:

When the binary-coded decimal values in S1 and S2 are 99999999 and 99999998
respectively, S1 minus S2 leaves the binary-coded decimal value 00000001, and
00000001 is stored in D.
 When the binary-coded decimal values in S1 and S2 are 00000001 and 99999999
respectively, S1 minus S2 leaves the binary-coded decimal value -99999998, and the
binary-coded decimal value 00000002 is stored in D.

When the binary-coded decimal values in S1 and S2 are 00000001 and 00000004
respectively, S1 minus S2 leaves the binary-coded decimal value -00000003, and the
binary-coded decimal value 99999997 is stored in D.

6-55

Ch ap te r 6 Ap plie d Instruc tions

Example:
When X0.0 is ON, the constants 1111 and 100 are converted into the binary-coded decimal values
which are stored in D0 and D1 respectively. The binary-coded decimal value in D1 is subtracted
from the binary-coded decimal value in D0, and the difference is stored in D10.

Additional remark:
1.

2.

3.

6-56

If the value in S1 or the value in S2 exceeds the range of values which can be represented by
the binary-coded decimal values, i.e. 0~9999, the instruction B- is not executed, SM0 is ON,
and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by the
hexadecimal number, but one of digits is not within the range between 0 and 9.).
If the value in S1 or the value in S2 exceeds the range of values which can be represented by
the binary-coded decimal values, i.e. 0~99999999, the instruction DB- is not executed, SM0 is
ON, and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by
the hexadecimal number, but one of digits is not within the range between 0 and 9.).
The instruction does not support SM600, SM601 and SM602.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0110

D

S1, S2, D

B*

Device X

Y









S1
S2
D

P

M

S

Function
Multiplication of binary-coded
decimal numbers

T

C

HC

D

L

SM SR

E

PR

K




































Pulse instruction

16# “$” DF



16-bit instruction (7 steps) 32-bit instruction (7 steps)

AH

AH

AH

Symbol:
S1 : Multiplicand

Word/Double word

S2 : Multiplier

Word/Double word

D : Product

Double word/Long word

Explanation:
1.
2.
3.
4.

The binary-coded decimal value in S1 is multiplied by the binary-coded decimal value in S2,
and the product is stored in D.
Only the instruction DB* can use the 32-bit counter.
The binary-coded decimal value is represented by the hexadecimal number, and every digit is
within the range between 0 and 9.
The multiplication of 16-bit binary-coded decimal values:

When the binary-coded decimal values in S1 and S2 are 1234 and 5678 respectively, the
binary-coded decimal value in D is 07006652.

=

*

5.

D

D +1

S2

S1

The product is a 32-bit value, and is stored in the register (D+1, D), which is composed of
32 bits.
The multiplication of 32-bit binary-coded decimal values:

When the binary-coded decimal values in S1 and S2 are 99999999 and 99999998
respectively, the binary-coded decimal value in D is 9999999700000002.
S 1 +1

S1

S 2 +1

S2

*
=
D +3

D +2

D +1

D

The product is a 64-bit value, and is stored in the register (D+3, D+2, D+1, D), which is
composed of 64 bits.

6-57

Ch ap te r 6 Ap plie d Instruc tions

Example:
When X0.0 is ON, the constants 100 and 200 are converted into the binary-coded decimal values
which are stored in D0 and D1 respectively. The binary-coded decimal value in D0 is multiplied by
the binary-coded decimal value in D1, and the product is stored in D10.

Additional remark:
1.

2.

3.

6-58

When the value in S1 or the value in S2 exceeds the range of values which can be represented
by the binary-coded decimal values, i.e. 0~9999, the instruction B* is not executed, SM0 is ON,
and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by the
hexadecimal number, but one of digits is not within the range between 0 and 9.).
When the value in S1 or the value in S2 exceeds the range of values which can be represented
by the binary-coded decimal values, i.e. 0~99999999, the instruction DB* is not executed, SM0
is ON, and the error code in SR0 is 16#200D (The binary-coded decimal value is represented
by the hexadecimal number, but one of digits is not within the range between 0 and 9.).
The instruction does not support SM600, SM601 and SM602.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0111

D

S1, S2, D

B/

Device X

Y









S1
S2
D

M

P
S

Function
Division of binary-coded decimal
numbers

T

C

HC

D

L

SM SR

E

PR

K




































Pulse instruction

16# “$” DF



16-bit instruction (7 steps) 32-bit instruction (7 steps)

AH

AH

AH

Symbol:
S1 : Dividend

Word/Double word

S2 : Divisor

Word/Double word

D : Quotient; remainder

Word/Double word

Explanation:
1.
2.
3.
4.

The binary-coded decimal value in S1 is divided by the binary-coded decimal value in S2, and
the quotient is stored in D.
Only the instruction DB/ can use the 32-bit counter.
The binary-coded decimal value is represented by the hexadecimal number, and every digit is
within the range between 0 and 9.
The division of 16-bit binary-coded decimal values:

When the binary-coded decimal values in S1 and S2 are 1234 and 5678 respectively, the
binary-coded decimal values in D and D+1 are 0004 and 0742 respectively.

S1

S2

/
5.

Quotient

Remainder

D

D +1

=

The operand D occupies two consecutive devices. The quotient is stored in D, and the
remainder is stored in D+1.
The division of 32-bit binary-coded decimal values:

When the binary-coded decimal values in S1 and S2 are 87654321 and 12345678
respectively, the binary-coded decimal values in (D+1, D) and (D+3, D+2) are 00000007
and 01234575 respectively.

6-59

Ch ap te r 6 Ap plie d Instruc tions

S 1 +1

S1

S 2 +1

S2

/
=
D

D +1

Quotient

D +3

D +2

Remainder

The operand D occupies two devices. The quotient is stored in (D+1, D), and the
remainder is stored in (D+3, D+2).
Example:
When X0.0 is ON, the constants 5000 and 200 are converted into the binary-coded decimal values
which are stored in D0 and D1 respectively. The binary-coded decimal value in D0 is divided by the
binary-coded decimal value in D1. The quotient and the remainder are stored in D10 and D11
respectively.

Additional remark:
1.
2.

3.

4.
5.
6.

6-60

If the divisor is 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2012.
If the value in S1 or the value in S2 exceeds the range of values which can be represented by
the binary-coded decimal values, i.e. 0~9999, the instruction B/ is not executed, SM0 is ON,
and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by the
hexadecimal number, but one of digits is not within the range between 0 and 9.).
If the value in S1 or the value in S2 exceeds the range of values which can be represented by
the binary-coded decimal values, i.e. 0~99999999, the instruction DB/ is not executed, SM0 is
ON, and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by
the hexadecimal number, but one of digits is not within the range between 0 and 9.).
The instruction does not support SM600, SM601 and SM602.
If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0112

BK+

P

S1, S2, n, D

M

S

Device X

Y











S1
S2
n
D

Function
Addition of binary numbers in
blocks

T

C

HC

D

L

SM SR

E

PR

K












































16# “$” DF



Pulse instruction

16-bit instruction (9 steps)

32-bit instruction

AH

AH

-

Symbol:
S1 : Augend

Word

S2 : Addend

Word

n : Data length

Word

D : Sum

Word

Explanation:
1.
2.
3.
4.
5.
6.

n pieces of data in devices starting from S2 are added to those in devices starting from S1. The
augends and the addends are binary numbers, and the sums are stored in D.
The operand n should be within the range between 1 and 256.
When the operation result is zero, SM600 is ON.
When the operation result is less than –32,768, SM601 is ON.
When the operation result is larger than 32,767, SM602 is ON.
When the operand S2 is a device (not a constant or a hexadecimal value):
S1

1

S 1 +1

2

.
.
.
.
.

.
.
.
.

S1 +n- 1

7.

5

}
}

+

S2

1

S 2 +1

2

.
.
.
.
.

n

.
.
.
.

S2 +n- 1

5

}
}

=

D

1 + 1= 2

D +1

2 + 2= 4

.
.
.
.
.

n

.
.

.
.

D +n- 1 5 + 5= 1 0

When the operand S2 is a constant or a hexadecimal value:
S1

1

S 1 +1

2

.
.
.
.
.

S1 +n-1

.
.
.
.

5

n

+

S2

10

S2

10

.
.
.
.
.

S2

.
.
.
.

10

n

}
}

n

=

D

1+ 10 =1 1

D +1

2+ 10 =1 2

.
.
.
.
.

.
.

.
.

D +n-1 5+ 10 =1 5

n

Example 1:
When X0.0 is ON, the binary values in D10~D14 are added to the binary values in D0~D4, and the
sums are stored in D100~D104.

6-61

Ch ap te r 6 Ap plie d Instruc tions

Execution result
D0

1

D1

2

D2

3

D10

10

D100

11

D11

11

D101

13

D12

12

D102

15

D3

4

D13

13

D103

17

D4

5

D14

14

D104

19

+

Example 2:
When X0.0 is ON, the addend 10 is added to the binary values in D0~D4, and the sums are stored
in D100~D104.

Execution result
D0

1

10

D100

11

D1

2

10

D101

12

D2

3

10

D102

13

D3

4

10

D103

14

D4

5

10

D104

15

+

Additional remark:
1.
2.
3.
4.
5.

6-62

If the devices S1~S1+n-1, S2~S2+n-1, or D~D+n-1 exceed the device range, the instruction is
not executed, SM is ON, and the error code in SR0 is 16#2003.
If n<1 or n>256, the instruction is not executed, SM0 is ON,and the error code in SR0 is
16#200B.
If S1~S1+n-1 overlap D~D+n-1, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#200C.
If S2~S2+n-1 overlap D~D+n-1, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#200C.
If S1~S1+n-1 overlap S2~S2+n-1, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200C.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0113

BK-

P

S1, S2, n, D

M

S

Device X

Y











S1
S2
N
D

Function
Subtraction of binary numbers in
blocks

T

C

HC

D

L

SM SR

E

PR

K












































16# “$” DF



Pulse instruction

16-bit instruction (9 steps)

32-bit instruction

AH

AH

-

Symbol:
S1 : Minuend

Word

S2 : Subtrahend

Word

n : Data length

Word

D : Difference

Word

Explanation:
1.

2.
3.
4.
5.
6.

n pieces of data in devices starting from S2 are subtracted from those in devices starting from
S1. The minuends and the subtrahends are binary numbers, and the differences are stored in
D.
The operand n should be within the range between 1 and 256.
When the operation result is zero, SM600 is ON.
When the operation result is less than –32,768, SM601 is ON.
When the operation result is larger than 32,767, SM602 is ON.
When the operand S2 is a device (not a constant or a hexadecimal value):
S1
S 1 +1
.
.
.
.
.

S1 +
1 n- 1

7.

5
4
.
.
.
.

1

}

-

S2

1

S 2 +1

2

.
.
.
.
.

n

.
.
.
.

5

S2 +
1 n- 1

}

=

D

5 - 1= 4

D +1

4 - 2= 2

.
.
.
.
.

n

.
.

.
.

D +
1 n- 1 1 - 5= - 4

}

n

When the operand S2 is a constant or a hexadecimal value:
S1
S 1 +1
.
.
.
.
.

S1 +n-1

5
4
.
.
.
.

1

}

n

-

S2

1

S2

1

.
.
.
.
.

S2

.
.
.
.

1

}

n

=

D

5 - 1= 4

D +1

4 - 1= 3

.
.
.
.
.

.
.

.
.

D +n-1 1 - 1= 0

}

n

Example 1:
When X0.0 is ON, the binary values in D10~D14 are subtracted from the binary values in D0~D4,
and the differences are stored in D100~D104.

6-63

Ch ap te r 6 Ap plie d Instruc tions

Execution result
D0

5

D1

4

D2

3

D3
D4

D10

1

D100

4

1

D11

2

D101

2

SM6 00

D12

3

D102

0

2

D13

4

D103

-2

1

D14

5

D104

-4

-

Example 2:
When X0.0 is ON, the subtrahend 1 is subtracted from the binary values in D0~D4, and the
differences are stored in D100~D104.

Execution result
D0

10

1

D100

9

D1

9

1

D101

8

D2

8

1

D102

7

D3

7

1

D103

6

D4

6

1

D104

5

-

Additional remark:
1.
2.
3.
4.
5.

6-64

If the devices S1~S1+n-1, S2~S2+n-1, or D~D+n-1 exceed the device range, the instruction is
not executed, SM is ON, and the error code in SR0 is 16#2003.
If n<1 or n>256, the instruction is not executed, SM0 is ON,and the error code in SR0 is
16#200B.
If S1~S1+n-1 overlap D~D+n-1, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#200C.
If S2~S2+n-1 overlap D~D+n-1, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#200C.
If S1~S1+n-1 overlap S2~S2+n-1, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200C.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0114

$+

S1, S2, D

Linking the strings

Device X

Y









S1
S2
D

M

P
S

T

C









HC

D

L

SM SR

E

PR





















K




Pulse instruction 16-bit instruction (7-19 steps)
AH

16# “$” DF

32-bit instruction
-

AH

Symbol:
S1 : String 1

Word

S2 : String 2

Word

D : Device in which the string is stored

Word

Explanation:
1.

When the instruction is executed, the string starting with the data in the device specified by S1
(exclusive of 16#00), and the string starting with the data in the device specified by S2
(exclusive of 16#00) are linked and moved to the operand D. Besides, the code 16#00 is
added to the end of the linked string in the operand D. When the instruction is not executed,
the data in D is unchanged.
The string in the operand S1 and the string in the operand S2 are linked and moved to the
operand D, as illustrated below.

2.

S1

B (1 6# 62 ) A (1 6# 61 )

S2

S 1 +1

D( 16 #6 4) C( 16 #6 3)

S2 +1 D( 16 #4 4) C( 16 #4 3)

S 1 +2

( 16 #0 0)

E (1 6# 65 )

B (1 6# 42 ) A (1 6# 41 )

S2 +
1 2 (1 6# 00 )

(1 6# 00 )

B (1 6# 62 )

A (1 6# 61 )

= D +1
D +2

D( 16 #6 4)

C( 16 #6 3)

A (1 6# 41 )

E (1 6# 65 )

D +3

C( 16 #4 3)

B (1 6# 42 )

D +
14

(1 6# 00 )

D( 16 #4 4)

D

T ur ning into 16#00 automati cally
S1

B (1 6# 62 ) A (1 6# 61 )

S2

B (1 6# 42 ) A (1 6# 41 )

S 1 +1

D( 16 #6 4) C( 16 #6 3)

S2 +1 D( 16 #4 4) C( 16 #4 3)

S 1 +2

E (1 6# 65 ) ( 16 #0 0)

S2 +2
1

(1 6# 00 )

(1 6# 00 )

D

d (1 6# 62 )

a (1 6# 61 )

= D +1
D +2

d (1 6# 64 )

c( 16 #6 3)

B (1 6# 42 )

A (1 6# 41 )

D +3

D( 16 #4 4)

C( 16 #4 3)

D +
14

(1 6# 00 )

( 16 #0 0)

T ur ning into 16#00 automatic ally

3.
4.

When S1 or S2 is not a string, the code 16#00 should be added to the end of the data which is
moved.
Suppose S1 or S2 is not a string. When the instruction is executed and the first character is the
code 16#00, 16#00 is still linked and moved.

Example:
Suppose S1 is the string “ab” and S2 is the string “c”. After the conditional contact M0 is enabled, the
data in D65534 is 16#4241, and the data in D65535 is 16#0043.

6-65

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

2.
3.
4.

6-66

If S1 or S2 is a string, at most 31 characters can be moved. For a string, the number of
steps=1+(the number of characters +1)/4 (The value will be rounded up to the nearest whole
digit if (the number of characters +1) is not divisible by 4.).
1~3
4~7
8~11 12~15 16~19 20~23 24~27 28~31
Number of characters
2
3
4
5
6
7
8
9
Number of steps
Example: For $+“ABCDE” D0 D100, the number of steps= 1 (instruction)+3 (string)+2 (D0)+2
(D100)=8.
If D is not sufficient to contain the string composed of the strings in S1 and S2, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S1 or S2 overlaps D, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200C.
If the string in S1 or S2 does not end with 16#00, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#200E.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0115

D

INC

Device

X

Y

D





M

Operand

Function

D

Adding one to the binary number

P
S

T

C

HC

D

L

SM SR

E

PR

















Pulse instruction

K

16# “$”

DF

16-bit instruction (3 steps) 32-bit instruction (3 steps)

AH

AH

AH

Symbol:

D : Destination device

Word/Double word

Explanation:
1.
2.
3.

One is added to the value in D.
Only the instruction DINC can use the 32-bit counter.
When the 16-bit operation is performed, 32,767 plus 1 equals -32,768. When the 32-bit
operation is performed, 2,147,483,647 plus 1 equals -2,147,483,648.

Example:
When X0.0 is switched from OFF to ON, the value in D0 increases by one.

6-67

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0116

D

DEC

P

M

S

Device X

Y





D

Operand

Function
Subtracting one from the binary
number

D
T

C

HC

D

L

SM SR

E

PR

















Pulse instruction

K

16# “$” DF

16-bit instruction (3 steps) 32-bit instruction (3 steps)

AH

AH

AH

Symbol:

D : Destination device

Word/Double word

Explanation:
1.
2.
3.

One is subtracted from the value in D.
Only the instruction DDEC can use the 32-bit counter.
When the 16-bit operation is performed, -32,768 minus 1 leaves 32,767. When the 32-bit
operation is performed, -2,147,483,648 minus 1 leaves 2,147,483,647.

Example:
When X0.0 is switched from OFF to ON, the value in D0 decreases by one.

6-68

A H 5 00 Prog r am m ing M an ua l

6.3 Data Conversion Instructions
6.3.1 List of Data Conversion Instructions
API

0200

Instruction code
Pulse
16-bit 32-bit 64-bit instruction
BCD

DBCD

–



–
0201

BIN

DBIN

0202

FLT

DFLT

–



0203

FLTD

DFLTD

–



0204

INT

DINT

–



FINT

DFINT





0205

–

0206

MMOV

0207

RMOV

0208

GRY

DGRY

0209

GBIN

DGBIN

0210

NEG

DNEG

–



0211

–

FNEG

–



0212

–

FBCD

–



0213

–

FBIN

–



–

–

0214

–

–

–

–
–
–

BKBCD

BKBIN

0216

SCAL






–

0215



–


–

–



Function
Converting the binary
number into the
binary-coded decimal
number
Converting the
binary-coded decimal
number into the binary
number
Converting the binary
integer into the binary
floating-point number
Converting the binary
integer into the 64-bit
floating-point number
Converting the 32-bit
floating-point number into
the binary integer
Converting the 64-bit
floating-point number into
the binary integer
Converting the 16-bit value
into the 32-bit value
Converting the 32-bit value
into the 16-bit value
Converting the binary
number into the Gray code
Converting the Gray code
into the binary number
Two’s complement
Reversing the sign of the
32-bit floating-point
number
Converting the binary
floating-point number into
the decimal floating-point
number
Converting the decimal
floating-point number into
the binary floating-point
number
Converting the binary
numbers in blocks into the
binary-coded decimal
numbers in blocks
Converting the binary
numbers in blocks into the
binary-coded decimal
numbers in blocks
Scale value operation

Step

Page
number

5

6-71

5

6-72

5

6-74

5

6-77

5

6-79

5

6-81

5

6-83

5

6-84

5

6-85

5

6-86

3

6-87

3

6-89

5

6-90

5

6-91

7

6-93

7

6-94

9

6-95

6-69

Ch ap te r 6 Ap plie d Instruc tions

API
0217
0218
0219

6-70

Instruction code
Pulse
Function
instruction
16-bit 32-bit 64-bit
–
Parameter type of scale

SCLP DSCLP
value operation
–
Converting a column of

LINE
DLINE
data into a line of data
Converting a line of data

COLM DCOLM
–
into a column of data

Step

Page
number

9

6-98

7

6-104

7

6-106

A H 5 00 Prog r am m ing M an ua l

6.3.2 Explanation of Data Conversion Instructions
API

Instruction code

0200

D

BCD

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the binary number
into the binary-coded decimal
number

P
S

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Conversion result

Word/Double word

Explanation:
1.
2.
3.

The binary value in S is converted into the binary-coded decimal value, and the conversion
result is stored in D.
Only the instruction DBCD can use the 32-bit counter.
The four fundamental operations of arithmetic in the PLC, the instruction INC, and the
instruction DEC all involve binary numbers. To show the decimal value on the display, users
can use the instruction BCD to convert the binary value into the binary-coded decimal value

Example:
1.

When X0.0 is ON, the binary value in D10 is converted into the binary-code decimal value, and
the conversion result is stored in D100.

2.

If D10=16#04D2=1234, the conversion result will be that D100=16#1234.

Additional remark:
1.

2.

If the conversion result exceeds the range between 0 and 9,999, the instruction BCD is not
executed, SM0 is ON, and the error code in SR0 is 16#200D (The binary-coded decimal value
is represented by the hexadecimal value, but one of digits is not within the range between 0
and 9.).
If the conversion result exceeds the range between 0 and 99,999,999, the instruction DBCD is
not executed, SM0 is ON, and the error code in SR0 is 16#200D (The binary-coded decimal
value is represented by the hexadecimal value, but one of digits is not within the range
between 0 and 9.).

6-71

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0201

D

BIN

Device

X

Y

S
D







M

Operand

P
S

Function
Converting the binary-coded
decimal number into the binary
number

S, D
T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Conversion result

Word/Double word

Explanation:
1.
2.

3.
4.

The binary-coded decimal value in S is converted into the binary value, and the conversion
result is stored in D.
The 16-bit binary-coded decimal value in S should be within the range between 0 and 9,999,
and the 32-bit binary-coded decimal value in S should be within the range between 0 and
99,999,999.
Only the 32-bit instructions can use the 32-bit counter.
Constants and hexadecimal values are converted into binary values automatically. Therefore,
users do not need to use the instruction.

Example:
When X0.0 is ON, the binary-coded decimal value in D0 is converted into the binary value, and the
conversion result is stored in D10.

Additional remark:
1.

2.

6-72

If the value in S is not the binary-coded decimal value, the operation error occurs, SM0 is ON,
and the error code in SR0 is 16#200D (The binary-coded decimal value is represented by the
hexadecimal value, but one of digits is not within the range between 0 and 9.).
The application of the instructions BCD and BIN:

Before the value of the binary-coded decimal type of DIP switch is read into the PLC,
users have to use the instruction BIN to convert the data into the binary value and store
the conversion result in the PLC.

If users want to display the data stored inside the PLC in a seven-segment display of the
binary-coded decimal type, they have to use the instruction BCD to convert the data into
the binary-coded decimal value before the data is sent to the seven-segment display.
 When X1.0 is ON, the binary-coded decimal value in X0.0~X0.15 is converted into the

A H 5 00 Prog r am m ing M an ua l
binary value, and the conversion result is stored in D100. Subsequently, the binary value
in D100 is converted into the binary-coded decimal value, and the conversion result is
stored in Y0.0~Y0.15.

3

8

2

1

0

10

10

10

10

6

6

4

2

1 8

1 8

1 8

F our -digit binary -coded
decimal ty pe of DIP s witch
1

X0.15
X0.0
F our -digit binary -coded deci mal value
T he instruction B IN is us ed to store
the binary value in D100.
T he instruction B CD is us ed to conver t
the value in D100 into the four- di gi t
binary- coded decimal value.
Y0.15

Y0.0
F our -digit binary -coded deci mal type
of sev en- segment display

6-73

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0202

D

FLT

Device

X

Y

S
D







M

Operand

P
S

Function
Converting the binary integer into
the binary floating-point number

S, D
T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Conversion result

Double word

Explanation:
1.
2.
3.
4.

The instruction is used to convert the binary integer into the single-precision floating-point
number.
The operand S used in the instruction FLT can not be the 32-bit counter.
The source device S used in the instruction FLT occupies one register, and D used in FLT
occupies two registers.
The source device S used in the instruction DFLT occupies two registers, and D used in DFLT
also occupies two registers.

When the absolute value of the conversion result is larger than the value which can be
represented by the maximum floating-point number, SM602 is ON, and the maximum
floating-point number is stored in D.

When the absolute value of the conversion result is less than the value which can be
represented by the minimum floating-point number, SM601 is ON, and the minimum
floating-point number is stored in D.

When the conversion result is zero, SM600 is ON.

Example 1:
1.
2.
3.

4.

6-74

When X0.0 is ON, the binary integer in D0 is converted into the single-precision floating-point
number, and the conversion result is stored in (D13, D12).
When X0.1 is ON, the binary integer in (D1, D0) is converted into the single-precision
floating-point number, and the conversion result is stored in (D21, D20).
Suppose the value in D0 is 10. When X0.0 is ON, 10 is converted into the single-precision
floating-point number 16#41200000, and 16#41200000 is stored in the 32-bit register (D13,
D12).
Suppose the value in the 32-bit register (D1, D0) is 100,000. When X0.1 is ON, 100,000 is
converted into the single-precision floating-point number 16#47C35000, 16#47C35000 is
stored in the 32-bit register (D21, D20).

A H 5 00 Prog r am m ing M an ua l

Example 2:
Users can use the applied instructions to perform the following calculation.

The binary integer in D10 is converted into the single-precision floating-point number,
and the conversion result is stored in (D101, D100).

The binary-coded decimal value in X0.0~X0.15 is converted into the binary value, and
the conversion result is stored in D200.

The binary integer in D200 is converted into the single-precision floating-point number,
and the conversion result is stored in (D203, D202).

The constant 615 is divided by the constant 10, and the quotient which is the
single-precision floating-point number is stored in (D301, D300).

The single-precision floating-point number in (D101, D100) is divided by the
single-precision floating-point number in (D203, D202), and the quotient which is the
single-precision floating-point number is stored in (D401, D400).

The single-precision floating-point number in (D401, D400) is multiplied by the
single-precision floating-point number in (D301, D300), and the product which is the
single-precision floating-point number is stored in (D21, D20).

The single-precision floating-point number in (D21, D20) is converted into the decimal
floating-point number, and the conversion result is stored in (D31, D30).

The single-precision floating-point number in (D21, D20) is converted into the binary
integer, and the conversion result is stored in (D41, D40).
(D1 0 )

1

K6 1.5

(X0.0 ~X0 .15 )

16-b it binary
numbe r

fo ur-digit
binary -c oded
dec imal nu mber

2

5

(D1 0 1,D 1 00 ) (D2 0 0) BIN

(D2 1 ,D2 0 ) Single- pr ecisi on

4

(D3 0 1,D 3 00 )
Single- pr ecisi on
floati ng- point number

Single- pr ecisi on 3
floati ng- point number

floati ng- point number

6

7

8

(D3 1 ,D3 0 )
D eci mal f lo ati ng -po in t nu mb er
(D4 1 ,D4 0 )
3 2-b it in te ge r

(D2 0 3,D 2 02 )
Single- pr ecisi on
floati ng- point number

(D4 0 1,D 4 00 )
Single- pr ecisi on
floati ng- point number

6-75

Ch ap te r 6 Ap plie d Instruc tions

6-76

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0203

D

FLTD

Device X

Y







S
D

M

Operand

P
S

Function
Converting the binary integer into
the 64-bit floating-point number

S, D
T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Conversion result

Long word

Explanation:
1.
2.
3.
4.
5.

6.

7.

When the instruction is executed, the binary integer is converted into the double-precision
floating-point number.
The operand S used in the instruction FLTD can not be the 32-bit counter.
The source device S used in the instruction FLTD occupies one register, and D used in FLTD
occupies four registers.
The source device S used in the instruction DFLTD occupies two registers, and D used in
DFLTD occupies four registers.
When the absolute value of the conversion result is larger than the value which can be
represented by the maximum floating-point number, SM602 is ON, and the maximum
floating-point number is stored in D.
When the absolute value of the conversion result is less than the value which can be
represented by the minimum floating-point number, SM601 is ON, and the minimum
floating-point number is stored in D.
When the conversion result is zero, SM600 is ON.

Example:
1. When X0.0 is ON, the 16-bit binary integer in D0 is converted into the double-precision
floating-point number, and the conversion result is stored in (D15, D14, D13, D12).
2. When X0.1 is ON, the 32-bit binary integer in (D1, D0) is converted into the double-precision
floating-point number, and the conversion result is stored in (D23, D22, D21, D20).
3. Suppose the 16-bit binary integer in D0 is 10. When X0.0 is ON, 10 is converted into
16#4024000000000000, and 16#4024000000000000 is stored in the 64-bit register (D15, D14,
D13, D12).
4. Suppose the 32-bit binary integer in (D1, D0) is 100,000. When X0.1 is ON, 100,000 is
converted into 16#40F86A0000000000, and 16#40F86A0000000000 is stored in the 64-bit
register (D23, D22, D21, D20).

6-77

Ch ap te r 6 Ap plie d Instruc tions

6-78

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0204

D

INT

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the 32-bit floating-point
number into the binary integer

P
S

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Double word

D : Conversion result

Word/Double word

Explanation:
1.

2.
3.
4.
5.
6.
7.
8.
9.
10.

The single-precision floating-point number in the register specified by S is converted into the
binary integer. The binary floating-point number is rounded down to the nearest whole digit,
and becomes the bianry integer. The binary integer is stored in the register specified by D.
The source device S used in the instruction INT occupies two registers, and D used in INT
occupies one register.
The source device S used in the instruction DINT occupies two registers, and D used in DINT
also occupies two registers.
The operand D used in the instruction INT can not be the 32-bit counter.
The instruction INT is the opposite of the instruction FLT.
When the conversion result is zero, SM600 is ON.
During the conversion, if the floating-point number is rounded down to the nearest whole digit,
SM601 will be ON.
When the conversion result exceeds the range, SM602 is ON.
For the 16-bit instruction, the range of conversion results is between -32,768 and 32,767.
For the 32-bit instruction, the range of conversion results is between -2,147,483,648 and
2,147,483,647.

Example:
1.

2.

When X0.0 is ON, the single-precision floating-point number in (D1, D0) is converted into the
binary integer, and the conversion result is stored in D10. The binay floating-point number is
rounded down to the nearest whole digit.
When X0.1 is ON, the single-precision floating-point number in (D21, D20) is converted into
the binary integer, and the conversion result is stored in (D31, D30). The binary floating-point
number is rounded down to the nearest whole digit.

6-79

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-80

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0205

D

FINT

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the 64-bit floating-point
number into the binary integer

P
S

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 32-bit instruction (5 steps) 64-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Long word

D : Conversion result

Word/Double word

Explanation:
1.

2.
3.
4.
5.
6.
7.
8.

The double-precision floating-point number in the register specified by S is converted into the
binary integer. The binary floating-point number is rounded down to the nearest whole digit,
and becomes the bianry integer. The binary integer is stored in the register specified by D.
The source device S used in the instruction FINT occupies four registers, and D used in FINT
occupies one register.
The source device S used in the instruction DFINT occupies four registers, and D used in
DFINT occupies two registers.
The operand D used in the instructions FINT and FLTP can not be the 32-bit counter.
The instruction FINT is the opposite of the instruction FLTD.
When the conversion result is zero, SM600 is ON.
During the conversion, if the floating-point number is rounded down to the nearest whole digit,
SM601 will be ON.
When the conversion result exceeds the range, SM602 is ON.
For the 32-bit instruction, the range of conversion results is between -32,768 and 32,767.
For the 64-bit instruction, the range of conversion results is between -2,147,483,648 and
2,147,483,647.

Example:
1. When X0.0 is ON, the double-precision floating-point number in (D3, D2, D1, D0) is converted
into the binary integer, and the conversion result is stored in D10. The binay floating-point
number is rounded down to the nearest whole digit.
2. When X0.1 is ON, the double-precision floating-point number in (D23, D22, D21, D20) is
converted into the binary integer, and the conversion result is stored in (D31, D30). The binay
floating-point number is rounded down to the nearest whole digit.

6-81

Ch ap te r 6 Ap plie d Instruc tions

6-82

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0206

MMOV

P
S

Device

X

Y

M

S
D







T

C







Operand

Function

S, D

Converting the 16-bit value into the
32-bit value

HC

D

L

SM SR

E

PR

K




















Pulse instruction 16-bit instruction (5 steps)
AH

16# “$”

DF


32-bit instruction
-

AH

Symbol:
S : Source device

Word

D : Conversion result

Double word

Explanation:
The data in the 16-bit device S is transmitted to the 32-bit device D. The sing bit which is specified is
copied repeatedly to the destination.
Example:
When X0.0 is ON, the value of b15 in D4 is transmitted to b15~b31 in (D7, D6). The data in (D7, D6)
becomes a negative value.

Plus sign

0
1

Minus sign

b 15

b0

1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D4

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D7, D6
b 31

b 16 b 15

b0

6-83

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0207

RMOV

P
S

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the 32-bit value into the
16-bit value

T

C

HC

D

L

SM SR

E

PR

K


























Pulse instruction 16-bit instruction (5 steps)
AH

16# “$”

DF


32-bit instruction
-

AH

Symbol:
S : Source device

Double word

D : Conversion result

Word

Explanation:
The data in the 32-bit device S is transmitted to the 16-bit device D. The sing bit which is specified is
retained.
Example:
When X0.0 is ON, the value of b31 in D7 is transmitted to b15 in D4, the values of b0~b14 are
transmitted to the corresponding bits, and the values of b15~b30 are ignored.

b31

b16 b15

b0

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D7, D6

1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D4
b15

6-84

b0

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0208

D

GRY

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the binary number into
the Gray code

P
S

T

C

HC

D

L

SM SR

E

PR

K



























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Conversion result

Word/Double word

Explanation:
1.
2.
3.

The binary value in the device specified by S is converted into the Gray code, and the
conversion result is stored in the device specified by D.
Only the instruction DGRY can use the 32-counter.
The value in the operand S should be within the available range.
The value in the operand S used in the 16-bit instruction should be within the range between 0
and 32,767.
The value in the operand S used in the 32-bit instruction should be within the range between 0
and 2,147,483,647.

Example:
When X0.0 is ON, the constant 6513 is converted into the Gray code, and the conversion result is
stored in Y1.0~Y1.15.

b0

b15

K6513=H1971 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1

Y1.0

Y1.15
GRAY 6513

0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1

Y1
Additional remark:
If the value in S is less than 0, the operation error occurs, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.

6-85

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0209

D

GBIN

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the Gray code into the
binary number

P
S

T

C

HC

D

L

SM SR

E

PR

K



























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Conversion result

Word/Double word

Explanation:
1.
2.

3.

The Gray code in the device specified by S is converted into the binary value, and the
conversion result is stored in the device specified by D.
The instruction is used to convert the Gary code in the absolute position encoder which is
connected to the input terminal of the PLC to the binary value, and the conversion result is
stored in the register which is specified.
The value in the operand S should be within the available range.
The value in the operand S used in the 16-bit instruction should be within the range between 0
and 32,767.
The value in the operand S used in the 32-bit instruction should be within the range between 0
and 2,147,483,647.

Example:
When X0.0 is ON, the Gary code in the absolute position encoder which is connected to the inputs
X0.0~X0.15 is converted into the binary value, and the conversion result is stored in D10.

X0.15

X0

X0.0

GRAY CODE 6513 0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1

b15

b0

H1971=K6513 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1

Additional remark:
If the value in S is less than 0, the operation error occurs, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.

6-86

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0210

D

NEG

P

M

S

Device

X

Y

D





Operand

Function

D

Two’s complement

T

C

HC

D

L

SM SR

E

PR

















K

16# “$”

DF

Pulse instruction 16-bit instruction (3 steps) 32-bit instruction (3 steps)
AH

AH

AH

Symbol:

D :

Device in which the two’s
complement is stored

Word/Double word

Explanation:
1.
2.
3.

The instruction is used to convert the negative binary value into the absolute value.
Only the instruction DNEG can use the 32-bit counter.
Generally, the pulse instructions NEGP and DNEGP are used.

Example 1:
When X0.0 is switched from OFF to ON, all bits in D0 are inverted (0 becomes 1, and 1 becomes 0),
and 1 is added to the result. The final value is stored in the original register D10.

Example 2:
The absolute value of the negative value:
1.
When the value of the 15th bit in D0 is 1, M0 is ON. (The value in D0 is a negative value.)
2.
When M0 is ON, the instruction NEG is used to obtain the two’s complement of the negative
value in D0. (The corresponding positive value is obtained.)

6-87

Ch ap te r 6 Ap plie d Instruc tions

Example 3:
The absolute value of the difference between two values:
Suppose X0.0 is ON.
1.
When the value in D0 is greater than that in D2, M0 is ON.
2.
When the value in D0 is equal to that in D2, M1 is ON.
3.
When the value in D0 is less than that in D2, M2 is ON.
4.
The value in D4 is a positive value.

Additional remark:
The representation of the value and its absolute value:
1.
Whether the data is a positive value or a negative value depends on the value of the highest bit
in the register. If the value of the highest in the register is 0, the data is a positive value. If it is 1,
the data is a negative value.
2.
The negative value can be converted into its absolute value by means of the instruction NEG.
(D0)=2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
(D0)=1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
(D0)=0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

6-88

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0211

FNEG

Device

X

Y

D





M

Operand

P
S

Function
Reversing the sign of the 32-bit
floating-point number

D
T

C

HC

D

L

SM SR

E

PR

















K

16# “$”

DF

Pulse instruction 32-bit instruction (3 steps) 64-bit instruction
AH

AH

-

Symbol:

D :

Device in which the sign of the
value is reversed

Double word

Explanation:
The sign of the single-precision floating-point number in the device D is reversed.
Example:
Before the instruction is executed, the value in (D1, D0) is the negative value 16#AE0F9000. When
X0.0 is switched from OFF to ON, the sign of the single-precision floating-point number in (D1, D0)
is reversed. In other words, after the instruction is executed, the value in (D1, D0) is the positive
value 16#2E0F9000.
Before the instruction is executed, the value in (D1, D0) is the positive value 16#2E0F9000. When
X0.0 is switched from OFF to ON, the sign of the single-precision floating-point number in (D1, D0)
is reversed. In other words, after the instruction is executed, the value in (D1, D0) is the negative
value 16#AE0F9000.

6-89

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0212

FBCD

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the binary floating-point
number into the decimal
floating-point number

P
S

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 32-bit instruction (5 steps) 64-bit instruction
AH

AH

-

Symbol:
S : Data source

Double word

D : Conversion result

Double word

Explanation:
1.

2.

3.

The single-precision floating-point number in the register specified by S is converted into the
decimal floating-point number, and the conversion result is stored in the register specified by
D.
The floating-point operation in the PLC is based on the single-precision floating-point numbers,
and the instruction FBCD is used to convert the single-precision floating-point number into the
decimal floating-point number.
The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the absolute value of the conversion result is larger than the value which can be
represented by the maximum floating-point number, SM602 is ON.
When the absolute value of the conversion result is less than the value which can be
represented by the minimum floating-point number, SM601 is ON.
When the conversion result is zero, SM600 is ON.

Example:
When X0.0 is ON, the single-precision floating-point number in (D1, D0) is converted into the
decimal floating-point number, and the conversion result is stored in (D3, D2).

Binary floating-point number

D1

Exponent
Decimal fl oating-point number

D3

D0

Real number: 23 bits; Ex ponent: 8 bi ts ; sign: 1 bit

Real number
Mathem atic al form

D2

[D2] X 10

[D 3]

Additional remark:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-90

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0213

FBIN

Device

X

Y

S
D







M

Operand

P
S

Function
Converting the decimal
floating-point number into the
binary floating-point number

S, D
T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 32-bit instruction (5 steps) 64-bit instruction
AH

AH

-

Symbol:
S : Data source

Double word

D : Conversion result

Double word

Explanation:
1.

2.
3.
4.
5.

The decimal floating-point number in the register specified by S is converted into the
single-precision floating-point number, and the conversion result is stored in the register
specified by D.
Suppose the value in S is 1234, and the value in S+1 is 3. The value in S is converted into
1.234x106.
The value in D should be a single-precision floating-point number, and the values in S and S+1
represent the decimal real number and the decimal exponent respectively.
The instruction FBIN is used to convert the decimal floating-point number into the
single-precision floating-point number.
The real number of decimal floating-point numbers range from -9,999 to +9,999, the exponents
of decimal floating-point numbers range from -41 to +35, and the practical range of decimal
floating-point numbers in PLC is between ±1175×10-41 and ±3402×10+35. When the
operation result is zero, SM600 is ON.

Example 1:
When X0.0 is ON, the decimal floating-point number in the register in (D1, D0) is converted into the
single-precision floating-point number, and the conversion result is stored in (D3, D2).

Exponent

Real number
[D 1]

Decimal fl oating-point number

D1

D0

Mathematic al form

Binary floating-point number

D3

D2

Real number: 23 bits; Ex ponent: 8 bits ; sign: 1 bit

[D0] X 10

Example 2:
1.

Before the floating-point operation is performed, users have to use the instruction FLT to
convert the binary integer into the single-precision floating-point number. The premise of the

6-91

Ch ap te r 6 Ap plie d Instruc tions

2.

conversion is that the value converted in the binary integer. However, the instruction FBIN can
be used to convert the floating-point number into the single-precision floating-point number.
When X0.0 is ON, K314 and K-2 are moved to D0 and D1 respectively, and combine into the
decimal floating-point number (3.14=314×10-2).

Additional remark:
If the real number of the decimal floating-point number in the operand S is not within the range
between -9,999 and +9,999, or if the exponent of the decimal floating-point number in the operand S
is not within the range between -41 and +35, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2013.

6-92

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

0214

BKBCD

P

S, n, D

Device X

Y

S









S
n
D

M

T

C









HC

Function
Converting the binary numbers in
blocks into the binary-coded
decimal numbers in blocks

D

L

SM SR

E

PR

K























16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Data source

Word

n : Data length

Word

D : Conversion result

Word

Explanation:
1.
2.

n pieces of data (the binary values) in devices starting from S are converted into the
binary-coded decimal values, and the conversion results are stored in D.
The operand n should be within the range between 1 and 256.

Example:
When M1 is ON, the binary values in D0 and D1 are converted into the binary-coded decimal values,
and the conversion results are stored in D4 and D5.

Additional remark:
1.
2.
3.

4.

If n is less than 1, or when n is larger than 256, the instruction is not execute, SM0 is ON, and
the error code in SR0 is 16#200B.
If the devices specified by S+n-1 and D+n-1 exceed the range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the conversion result is not within the range between 0 and 9,999, the instruction is not
executed, and the error code in SR0 is 16#200D (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0
and 9.).
If S~S+n-1 overlap D~D+n-1, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#200C.

6-93

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

0215

BKBIN

S, n, D

Device X

Y









S
n
D

M

P
S

T

C









HC

Function
Converting the binary numbers in
blocks into the binary-coded
decimal numbers in blocks

D

L

SM SR

E

PR

K













○
○
○







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Data source

Word

n : Data length

Word

D : Conversion result

Word

Explanation:
1.
2.
3.

n pieces of data (the binary-coded decimal values) in devices starting from S are converted
into the binary values, and the conversion results are stored in D.
The binary-coded decimal value in S should be within the range between 0 and 9,999.
The operand n should be within the rang between 1 and 256.

Example:
When M1 is ON, the binary-code decimal values in D0 and D1 are converted into the binary values,
and the conversion results are stored in D4 and D5.

Additional remark:
1.
2.
3.

4.

6-94

If n is less than 1, or when n is larger than 256, the instruction is not execute, SM0 is ON, and
the error code in SR0 is 16#200B.
If the devices specified by S+n-1 and D+n-1 exceed the range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the data in S is not the binary-coded decimal, the instruction is not executed, and the error
code in SR0 is 16#200D (The binary-coded decimal value is represented by the hexadecimal
number, but one of digits is not within the range between 0 and 9.).
If S~S+n-1 overlap D~D+n-1, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#200C.

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0216

SCAL

P

S1, S2, S3, D

Scale value operation

M

S

Device X

Y











S1
S2
S3
D

T

C











HC

D

L

SM SR

E

PR

K






























16# “$”

DF





Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Data source

Word

S2 : Slope

Word

S3 : Offset

Word

D : Destination device

Word

Explanation:
1.
2.

The operation equation in the instruction: D=(S1×S2)÷1,000+S3
To obtain the values in S2 and S3, users have to use the slope equation and the offset equation
below first, and then round off the results to the nearest whole digit. The final 16-bit values are
entered into S2 and S3.
The slope equation: S2=[(Maximum destination value–Minimum destination value)÷(Maximum
source value–Minimum source value)]×1,000
The offset equation: S3=Minimum destination value–Minimum source value×S2÷1,000
The output curve is as shown below:

Example 1:
1.

Suppose the values in S1, S2, and S3 are 500, 168, and -4 respectively. When X0.0 is ON, the
instruction SCAL is executed, and the scale value is stored in D0.

6-95

Ch ap te r 6 Ap plie d Instruc tions
2.

The operation equation: D0=(500×168)÷1,000+(-4)=80

Destination value

D
Offset=-4

0

Slope=168

S 1=500

Sourc e value

Example 2:
1.
2.

Suppose the values in S1, S2, and S3 are 500, -168, and 534 respectively. When X0.0 is ON,
the instruction SCAL is executed, and the scale value is stored in D10.
The operation equation: D10=(500×-168)÷1,000+534=450

Additional remark:
1.

6-96

Only when the slope and the offset are known can the instruction SCAL be used. If the slope
and the offset are unknown, users are suggested to use the instruction SCLP to perform the

A H 5 00 Prog r am m ing M an ua l

2.
3.

4.

operation.
The value entered into S2 should be within the range between –32,768 and 32,767. (The
practical value is within the range between –32,768 and 32,767.
When users use the slope equation, they have to notice that the maximum source value
should be larger than the minimum source value. However, the maximum destination value is
not necessarily larger than the minimum destination value.
If the value in D is larger than 32,767, the value stored in D will be 32,767. If the value in D is
less than -32,768, the value stored in D will be -32,768.

6-97

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

0217

D

S1, S2, D

SCLP

P

M

S

Device X

Y









S1
S2
D

Function
Parameter type of scale value
operation

T

C

HC

D

L

SM SR

E

PR

K




































16# “$”

DF




Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
AH

AH

AH

Symbol:
S1 : Data source

Word/Double word

S2 : Parameter

Word/Double word

D : Destination device

Word/Double word

Explanation:
1.
2.

3.
4.

5.
6.
7.

8.

6-98

Only the 32-bit instructions can use the 32-bit counter.
The operand S2 used in the 16-bit instruction is set as follows.
Device number
Parameter
Setting range
Maximum source value
-32,768~32,767
S2
S2+1
Minimum source value
-32,768~32,767
S2+2
Maximum destination value
-32,768~32,767
S2+3
Minimum destination value
-32,768~32,767
The operand S2 used in the 16-bit instruction occupies four devices.
The operand S2 used in the 32-bit instruction is set as follows.
Setting range
Device
Parameter
Floating-point
number
Integer
number
S2, S2+1
Maximum source value
-2,147,483,648~
S2+2, S2+3
Minimum source value
The range of 32-bit
floating-point numbers
2,147,483,647
S2+4, S2+5
Maximum destination value
S2+6, S2+7
Minimum destination value
The operand S2 used in the 32-bit instruction occupies eight devices.
If the values used in the 32-bit instruction are floating-point numbers, SM658 can be set to ON.
If the values are decimal integers, SM685 can be set to OFF.
The operation equation in the instruction: D=[(S1–Minimum source value)×(Maximum
destination value–Minimum destination value)]÷(Maximum source value)+Minimum
destination value
The operational relation between the source value and the destination value:
y=kx+b
y=Destination value (D)
k=Slope=(Maximum destination value–Minimum destination value)÷(Maximum source
value–Minimum source value)

A H 5 00 Prog r am m ing M an ua l
x=Source value (S1)
b=Offset =Minimum destination value–Minimum source value×Slope
The parameters above are being substituted for y, k, x, and b in the equation y=kx+b, and the
operation equation in the instruction is obtained.
y=kx+b=D=kS1+b=Slope×S1+Offset=Slope×S1+Minimum destination value–Minimum
source value×Slope=Slope×(S1–Minimum source value)+Minimum destination value
=(S1–Minimum source value)×(Maximum destination value–Minimum destination
value)÷(Maximum source value–Minimum source value)+Minimum destination value
9.

If S1 is larger than the maximum source value, the maximum source value will be the value in
S1. If S1 is less than the minimum source value, the minimum source value will be the value in
S1. After the input values and the parameters are set, the output curve is as shown below.

Example 1:
1.

2.

Suppose the value in S1 is 500, the maximum source value in D0 is 3,000, the minimum
source value in D1 is 200, the maximum destination value in D2 is 500, and the minimum
destination value in D3 is 30. When X0.0 is ON, the instruction SCLP is executed, and the
scale value is stored in D10.
The operation equation: D10=[(500–200)×(500–30)]÷(3,000–200)+30=80.35
80.35 is rounded off to the nearest whole digit, and becomes 80. 80 is stored in D10.

6-99

Ch ap te r 6 Ap plie d Instruc tions

Destinati on value

Maximum destination
value =500
D
Minimum des ti nation
value =30

S 1=500

0 Minimum
sourc e value =200

Sourc e value
Maximum
sourc e value =3000

Example 2:
1.

2.

Suppose the value in S1 is 500, the maximum source value in D0 is 3,000, the minimum
source value in D1 is 200, the maximum destination value in D2 is 30, and the minimum
destination value in D3 is 500. When X0.0 is ON, the instruction SCLP is executed, and the
scale value is stored in D10.
The operation equation: D10=[(500–200)×(30–500)]÷(3,000–200)+500=449.64
449.64 is rounded off to the nearest whole digit, and becomes 450. 450 is stored in D10.

6-100

A H 5 00 Prog r am m ing M an ua l

Example 3:
1.

2.

Suppose the value in S1 is 500.0, the maximum source value in D0 is 3000.0, the minimum
source value in D2 is 200.0, the maximum destination value in D4 is 500.0, and the minimum
destination value in D6 is 30.0. When X0.0 is ON, SM685 is set to ON, the instruction DSCLP
is executed, and the scale value is stored in D10.
The operation equation: D10=[(500.0–200.0)×(500.0–30.0)]÷(3000.0–200.0)+30.0=80.35
80.35 is rounded off to the nearest whole digit, and becomes 80.0. 80.0 is stored in D10.

6-101

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

2.

3.

The value in S2 which is used in the 16-bit instruction should be within the range between the
minimum source value and the maximum source value, i.e. between -32,768 and 32,767. If the
value exceeds the boundary value, the boundary value is used in the operation.
The integer in S1 which is used in the 32-bit instruction should be within the range between the
minimum source value and the maximum source value, i.e. between -2,147,483,648 and
2,147,483,647. If the integer exceeds the boundary value, the boundary value is used in the
operation.
The floating-point number in S1 which is used in the 32-bit instruction should be within the
range between the minimum source value and the maximum source value, i.e. within the
range of floating-point numbers. If the floating-point number exceeds the boundary value, the
boundary value is used in the operation.

6-102

A H 5 00 Prog r am m ing M an ua l
4.

5.
6.

When users use the instruction, they have to notice that the maximum source value should be
larger than the minimum source value. However, the maximum destination value is not
necessarily larger than the minimum destination value.
If the operand S2 used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [4] of WORD.
If the operand S2 used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [4] of DWORD.

6-103

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0218

D

Device X

Y









S
n
D

LINE

P

M

S

Operand

Function

S, n, D

Converting a column of data into a
line of data

T

C

HC

D

L

SM SR

E

PR

K



































16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S : Data source

Word/Double word

n : Number of bits

Word/Double word

D : Data destination

Word/Double word

Explanation:
1.
2.
3.

4.
5.
6.
7.

The operand S used in the 16-bit instruction occupies sixteen 16-bit registers, i.e. S~S+15.
The operand S used in the 32-bit instruction occupies thirty-two 32-bit registers, i.e. S~S+31.
The operand n indicates that the value of the nth bit in every piece of data in the operand S is
retrieved. Besides, the operand n used in the 16-bit instruction should be within the range
between 0 and 15, and the operand n used in the 32-bit instruction should be within the range
between 0 and 31.
The operand n used in the 16-bit instruction indicates that the values of the nth bits in S~S+15
are retrieved, and the values of the nth bits are stored in the operand D in order.
The operand n used in the 32-bit instruction indicates that the values of the nth bits in S~S+31
are retrieved, and the values of the nth bits are stored in the operand D in order.
Only the 32-bit instructions can use the 32-bit counter.
Take the 16-bit instruction for example.
N
b15
S
S+1
S+2

. .
. .
. .

S+13
S+14
S+15

b0

.
.
.

1
0
1

0
1
0

.
.
.

b15
D 0

6-104

b0

1

0

. . .. . . . . 1 0 1

A H 5 00 Prog r am m ing M an ua l
8.

Take the 32-bit instruction for example.

N

b31
S
S+1
S+2 . .
. .
. .
S+29
S+30
S+31

.
.
.

.
.
.

1
0
1
0
1
0

b0

.
.
.
b31
b0
D 0 1 0 ...... 1 0 1

Example:
When M0 is ON, the values of the 15th bits in D0~D14 are stored in b0~b15 in D100.

Additional remark:
1.
2.
3.

If the device S+15 used in the 16-bit instruction exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the device S+31 used in the 32-bit instruction exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.

6-105

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0219

D

COLM

Device X

Y









S
n
D

M

Operand

P
S

Function
Converting a line of data into a
column of data

S, n, D
T

C

HC

D

L

SM SR

E

PR

K




































16# “$” DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S : Data source

Word/Double word

n : Number of bits

Word/Double word

D : Data destination

Word/Double word

Explanation:
1.
2.
3.

4.
5.
6.
7.

The operand D used in the 16-bit instruction occupies sixteen 16-bit registers, i.e. D~D+15.
The operand D used in the 32-bit instruction occupies thirty-two 32-bit registers, i.e. D~D+31.
The operand n indicates that the values of the bits in the operand S are stored in the nth bits in
the operand D. Besides, the operand n used in the 16-bit instruction should be within the
range between 0 and 15, and the operand n used in the 32-bit instruction should be within the
range between 0 and 31.
The operand n used in the 16-bit instruction indicates that the values of the bits in S are stored
in the nth bits in D~D+15 in order.
The operand n used in the 32-bit instruction indicates that the values of the bits in S are stored
in the nth bits in D~D+31 in order.
Only the 32-bit instructions can use the 32-bit counter.
Take the 16-bit instruction for example.
S

b 15
0 1

0

. .. . . . . .

1

0

b0
1

N
b 15
D
D+1
D+2
. .
. .
. .
D+1 3
D+1 4
D+1 5

6-106

b0

.
.
.

1
0
1

0
1
0

.
.
.

A H 5 00 Prog r am m ing M an ua l
8.

Take the 32-bit instruction for example.
S

b 31
0 1

0

. . .. . . . . . . .. . . . . . . .. . . . .

1

0

b0
1

N
b 31
D
D+1
D+2
. .
. .
. .
D+2 9
D+3 0
D+3 1

b0

.
.
.

.
.
.

.
.
.

1
0
1

.
.
.

0
1
0

Example:
Suppose the value in D30 is 3. When M0 is ON, the values of the bits in D20 are stored in the third
bits in D0~D15 in order.

Additional remark:
1.
2.
3.

If the device D+15 used in the 16-bit instruction exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the device D+31 used in the 32-bit instruction exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.

6-107

Ch ap te r 6 Ap plie d Instruc tions

6.4 Data Transfer Instructions
6.4.1 List of Data Transfer Instructions
API
0300
0301

Instruction code
16-bit 32-bit
64-bit
MOV DMOV
–
–

–

0302
0303
0304

$MOV
–
CML DCML
BMOV
–

0305

NMOV DNMOV

0306
0307

XCH DXCH
BXCH
–

0308

SWAP DSWAP

0309
0310

SMOV
MOVB

6-108

–
–

Pulse
instruction


DFMOV



–
–
–
–





–
–
–




–
–








Function
Transferring the data
Transferring the 64-bit
floating-point number
Transferring the string
Inverting the data
Transferring all data
Transferring the data to
several devices
Exchanging the data
Exchanging all data
Exchange the high byte
with the low byte
Transferring the digits
Transferring several bits

Step

Page
number

5

6-109

5-6

6-111

5-11
5
7

6-112
6-116
6-118

7

6-120

5
7

6-122
6-123

3

6-125

11
7

6-126
6-130

A H 5 00 Prog r am m ing M an ua l

6.4.2 Explanation of Data Transfer Instructions
API

Instruction code

0300

D

Device

X

Y

S
D







MOV
M

Operand

Function

S, D

Transferring the data

P
S

T

C

HC

D

L

SM SR

E

PR

K



























16# “$”


F


Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Data source

WordDouble word

D : Data destination

WordDouble word

Explanation:
1.
2.
3.

When the instruction is executed, the data in S is transferred to D. When the instruction is not
executed, the data in D is unchanged.
Only the data in S which is used in the 32-bit instruction can be the floating-point number.
Only the 32-bit instructions can use the 32-bit counter.

Example:
1.

2.

3.

To transfer the 16-bit data, users should use the instruction MOV.

When X0.0 is OFF, the data in D0 is unchanged. When X0.0 is ON, the value 10 is
transferred to the data register D0.

When X0.1 is OFF, the data in D10 is unchanged. When X0.1 is ON, the current value of
T0 is transferred to the data register D10.
To transfer the 32-bit data, users should use the instruction DMOV.

When X0.0 is OFF, the data in (D31, D30) and (D41, D40) is unchanged. When X0.2 is
ON, the current value in (D21, D20) is transferred to (D31, D30), and the current value of
HC0 is transferred to (D41, D40).
To transfer the floating-point number, users should use the instruction DMOV.

When X0.3 is OFF, the data in (D51, D50) is unchanged. When X0.3 is ON, the
floating-point number 3.450 is converted into the binary floating-point number, and the
conversion result is transferred to (D51, D50).

6-109

Ch ap te r 6 Ap plie d Instruc tions

6 - 11 0

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0301

D

FMOV

Device

X

Y

S
D







M

Operand

P
S

Function
Transferring the 64-bit
floating-point number

S, D
T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF


Pulse instruction 32-bit instruction 64-bit instruction (5-6 steps)
AH

-

AH

Symbol:
S : Data source

Long word

D : Data destination

Double word/Long word

Explanation:
1.
2.
3.

When the instruction is executed, the data in S is transferred to D. When the instruction is not
executed, the data in D is unchanged.
Only the 64-bit instructions are supported.
The instrucitons DFMOV and DFMOVP are double-precision data transfer instructions.

Example:
When M0 is ON, the values in D0~D3 are transferred to D4~D7.

6 - 111

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0302

$MOV

Device

X

Y

S
D







M

Operand

Function

S, D

Transferring the string

P
S

T

C







HC

D

L

SM SR

E

PR
















K

16# “$”

DF



Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction
AH

-

AH

Symbol:
S : Data source

String

D : Data destination

String

Explanation:
1.

2.
3.
4.

5.
6.

If the operand S is a string, at most 31 characters can be moved. For a string, the number of
steps=1+(the number of characters +1)/4 (The value will be rounded up to the nearest whole
digit if (the number of characters +1) is not divisible by 4.).
1~3
4~7
8~11 12~15 16~19 20~23 24~27 28~31
Number of characters
2
3
4
5
6
7
8
9
Number of steps
When the operand S is a string and the insturction is executed, the string is transferred to D,
and the code 16#00 is added to the end of the data
When the operand S is not a string, the code 16#00 should be added to the end of the data
transferred.
When the the operand S is not a string and the instruction is executed, the string starting with
the data in the device specified by S (including 16#00) is transferred to D. When the instruction
is not executed, the data in D is unchanged.
Suppose the operand S is not a string. When the instruction is executed and the first character
is the code 16#00, 16#00 is still transferred to D.
When 16#00 appears in the low byte, the execution of the instruction is as follows.
Before the instr uction is executed:
b15~b8 b7~b0

B15~b8 b7~b0

S

16#31

16#30

D

16#38

16#39

S+1

16#33

16#32

D+1

16#36

16#37

S+2

16#35

16#34

D+2 16#34

16#35

S+3

16#30

16#00

D+3 16#32

16#33

After the instruction is executed:
b15~b8 b7~b0
S

b15~b8 b7~b0

16#31

16#30

D

16#31

16#30

S+1

16#33

16#32

D+1

16#33

16#32

S+2

16#35

16#34

D+2 16#35

16#34

S+3

16#30

16#00

D+3 16#00

16#00

16#30 in t he high byte
is not tr ansfer red.

6 - 11 2

16#32 in t he high byte
turns int o 16#00.

A H 5 00 Prog r am m ing M an ua l
7.

When 16#00 appears in the high byte, the execution of the instruction is as follows.
Before the instr uction is executed:
b15~b8 b7~b0
S

b15~b8 b7~b0

16#31

16#30

D

16#38

16#39

S+ 1 16#33
S+ 2 16#00

16#32

D+1

16#36

16#37

16#34

D+2 16#34

16#35

S+ 3 16#37

16#36

D+3 16#32

16#33

After the instr uction is executed:
b15~b8 b7~b0

8.

b15~b8 b7~b0

S

16#31

16#30

D

16#31

16#30

S+ 1

16#33

16#32

D+1

16#33

16#32

S+ 2 16#00

16#34

D+2 16#00

16#34

S+ 3 16#37

16#36

D+3 16#32

16#33

When S overlaps D and the device number of S is less than the device number of D, the
transfer of the data to D starts form the ending code 16#00.
Before the instruction is executed:
b15~b8 b7~b0

b15~b8 b7~b0

D0

16#31

16#30

D1

16#33

16#32

D1

16#33

16#32

D2

16#35

16#34

D2

16#35

16#34

D3

16#30

16#00

D3

16#30

16#00

D4

16#38

16#37

After the instruction is executed:
b15~b8 b7~b0
D0

b15~b8 b7~b0

16#31

16#30

D1

D1

16#33

16#32

D2

16#35

16#34

D3

16#30

16#00

16#31

16#30

D2

16#33

16#32

D3

16#35

16#34

D4

16#00

16#00

Example 1:
Suppose the operand S is the even string “1234”. When the conditional contact X0.0 is enabled, the
data in D0~D3 is as follows.

The operand S:
String
Hexadecimal value

‘1’

‘2’

‘3’

‘4’

16#31

16#32

16#33

16#34

6 - 11 3

Ch ap te r 6 Ap plie d Instruc tions
After the instruction is executed, the data in the operand D is as follows.
Device
High byte
Low byte
Note
D0
16#32
16#31
‘1’=16#31; ‘2’=16#32
D1
16#34
16#33
‘3’=16#33; ‘4’=16#34
The ending code 16#00 is in the low byte.
D2
16#00
16#00
16#00 is automatically added in the high byte.
D3
Unchanged
Unchanged
Example 2:
Suppose the operand S is the odd string “12345”. When the conditional contact X0.0 is enabled, the
data in D0~D3 is as follows.

The operand S:
‘1’
‘2’
‘3’
‘4’
‘5’
String
16#31
16#32
16#33
16#34
16#35
Hexadecimal value
After the instruction is executed, the data in the operand D is as follows.
Device
High byte
Low byte
Note
D0
16#32
16#31
‘1’=16#31; ‘2’=16#32
D1
16#34
16#33
‘3’=16#33; ‘4’=16#34
D2
16#00
16#35
The ending code 16#00 is in the high byte.
D3
Unchanged Unchanged
Example 3:
When the operand S is not a string and the ending code 16#00 appears in the low byte, the
execution of the instruction is as follows.

The operand S:
Device
High byte
Low byte
Note
D100
16#31
16#30
‘1’=16#31; ‘0’=16#30
D101
16#33
16#32
‘3’=16#33; ‘2’=16#32
D102
16#35
16#34
‘5’=16#35; ‘4’=16#34
D103
16#30
16#00
‘0’=16#30; 16#00 is the ending code.
After the instruction is executed, the data in the operand D is as follows.
Device
High byte
Low byte
Note
D0
16#31
16#30
‘1’=16#31; ‘0’=16#30
D1
16#33
16#32
‘3’=16#33; ‘2’=16#32
D2
16#35
16#34
‘5’=16#35; ‘4’=16#34
The ending code 16#00 is in the low byte.
D3
16#00
16#00
16#00 is automatically added in the high byte.
D4
Unchanged Unchanged
Example 4:
When the operand S is not a string and the ending code 16#00 appears in the high byte, the
execution of the instruction is as follows.

6 - 11 4

A H 5 00 Prog r am m ing M an ua l

The operand S:
Device
High byte
Low byte
Note
D100
16#31
16#30
‘1’=16#31; ‘0’=16#30
D101
16#33
16#32
‘3’=16#33; ‘2’=16#32
D102
16#00
16#34
16#00 is the ending code. ‘4’=16#34
D103
16#37
16#36
‘7’=16#37; ‘6’=16#36
After the instruction is executed, the data in the operand D is as follows.
Device
High byte
Low byte
Note
D0
16#31
16#30
‘1’=16#31; ‘0’=16#30
D1
16#33
16#32
‘3’=16#33; ‘2’=16#32
D2
16#00
16#34
16#00 is the ending code. ‘4’=16#34
D3
Unchanged Unchanged
Example 5:
When S overlaps D, and the device number of S is less than the device number of D, the transfer of
the data to D starts form the ending code 16#00.

The operand S:
Device
High byte Low byte
Note
D0
16#31
16#30
‘1’=16#31; ‘0’=16#30
D1
16#33
16#32
‘3’=16#33; ‘2’=16#32
D2
16#35
16#34
‘5’=16#35; ‘4’=16#34
D3
16#30
16#00
‘0’=16#30; 16#00 is the ending code.
D4
16#38
16#37
‘8’=16#38; ‘7’=16#37
After the instruction is executed, the data in the operand D is as follows.
Device
High byte Low byte
Note
D1
16#31
16#30
‘1’=16#31; ‘0’=16#30
D2
16#33
16#32
‘3’=16#33; ‘2’=16#32
D3
16#35
16#34
‘5’=16#35; ‘4’=16#34
The ending code 16#00 is in the low byte.
D4
16#00
16#00
16#00 is automatically added in the high byte.
D5
Unchanged Unchanged
Additional remark:
1.
2.

If the string in S does not end with 16#00, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200E.
If the capacity of the device D is not sufficient to contain the string in S, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.

6 - 11 5

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0303

D

CML

P

M

S

Device

X

Y

S
D







Operand

Function

S, D

Inverting the data

T

C

HC

D

L

SM SR

E

PR

K



























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Data source

Word/Double word

D : Data destination

Word/Double word

Explanation:
1.

2.

The instruction is used to invert all bits in S, i.e. 0 becomes 1, and 1 becomes 0. The inversion
result is stored in D. If the data in S is the constant, the constant will be converted into the
binary value.
Only the 32-bit instructions can use the 32-bit counter.

Example 1:
When X0.0 is ON, all bit in D1 are inverted, and the conversion result is stored in Y0.0~Y0.15.

D1

b 15
1

0

1

0

1

0

1

0

1

0

1

0

b3
1

b2
0

b1
1

b0
0

1

0

1

0

1

0

1

Sign bi t (0: P os itive s ign; 1: Negativ e si gn)
Y0

0

1

0

1

0

1

0

1

0

Inversi on resul t

6 - 11 6

A H 5 00 Prog r am m ing M an ua l

Example 2:
The circuits below can be represented by means of the instruction CML.

6 - 11 7

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0304

BMOV

P
S

Device

X

Y

S
D
n









M

T

C









Operand

Function

S, D, n

Transferring all data

HC

D

L

SM SR

E

PR

K























16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

-

AH

Symbol:
S : Data source

Word

D : Data destination

Word

n : Data length

Word

Explanation:
1.
2.
3.

n pieces of data in devices starting from the device specified by S are transferred to the
devices starting from the device specified by D.
The operand n should be within the range between 1 and 256.
In order to prevent the error which results from the overlap between the source devices and
the destination devices, the data is transferred in the following way.
When the device number of S is larger than the device number of D, the data is transferred in
the order from  to .
D 20
D 21
D 22

1
2
3

D 19
D 20
D 21

When the device number of S is less than the device number of D, the data is transferred in
the order from  to .
D 19
D 20
D 21

1
2
3

D 20
D 21
D 22

Example 1:
When X0.0 is ON, the data in D0~D3 is transferred to D20~D23.

6 - 11 8

A H 5 00 Prog r am m ing M an ua l

D0

D20

D1

D21

D2

D22

D3

D23

N=4

Example 2:
In order to prevent the error which results from the overlap between the source devices and the
destination devices, the data is transferred in the following way.
1.
When the device number of S is larger than the device number of D, the data is transferred in
the order from  to .

D20
D21
D22

2.

1
2
3

D19
D20
D21

When the device number of S is less than the device number of D, the data is transferred in
the order from  to .

D10
D11
D12

1
2
3

D11
D12
D13

Additional remark:
1.
2.
3.

If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is larger than 256, or if n is less than 1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6 - 11 9

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0305

D

NMOV

P
S

Device

X

Y

S
D
n









M

Operand

Function
Transferring the data to several
devices

S, D, n
T

C

HC

D

L

SM SR

E

PR

K

16# “$”








































DF

Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S : Data source

Word/Double word

D : Data destination

Word/Double word

n : Data length

Word/Double word

Explanation:
1.
2.
3.

When the instruciton is executed, the data in S is transferred to the n devices starting from the
device specified by D. When the instruction is not executed, the data in D is unchanged.
Only the 32-bit instructions can use the 32-bit counter.
The operand n used in the instruction NMOV should be within the range between 1 and 256,
and the operand n used in the instruction DNMOV should be within the range between 1 and
128.
S

S

D

S

D+1

S

D+2

S

D+3

S

D+4

Example:
When M0 is ON, 100 is transferred to D0~D9.

6-120

N=5

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.
3.

If D~D+n-1 exceed the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the operand n used in the 16-bit instruciton is larger than 256 or less than 1, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#200B.
If the operand n used in the 32-bit instruciton is larger than 128 or less than 1, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#200B.

6-121

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0306

D

XCH

Device

X

Y

S1
S2







M

P
S

Operand

Function

S1, S2

Exchanging the data

T

C

HC

D

L

SM SR

E

PR

























K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S1 :

Data which will be
exchanged

Word/Double word

S2 :

Data which will be
exchanged

Word/Double word

Explanation:
1.
2.

The data in the device specified by S1 is exchanged with the data in the device specified by S2.
Only the 32-bit instructions can use the 32-bit counter.

Example 1:
When X0.0 is switched from OFF to ON, the data in D20 is exchanged with the data in D40.
Before the instruction
is executed:

After the instruction
is executed:

D 20

1 20

40

D 20

D 40

40

1 20

D 40

Example 2:
When X0.0 is switched from OFF to ON, the data in D100 is exchanged with the data in D200.
Before the instruction
is executed:

6-122

After the instruction
is executed:

D 10 0

9

8

D 10 0

D 10 1

20

40

D 10 1

D 20 0

8

9

D 20 0

D 20 1

40

20

D 20 1

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0307

BXCH

Device

X

Y

M

S1
S2
n









P
S

T

C









Operand

Function

S1, S2, n

Exchanging all data

HC

D

L

SM SR

E

PR

K























16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

-

AH

Symbol:
S1 :

Data which will be
exchanged

Word/Double word

S2 :

Data which will be
exchanged

Word/Double word

n : Data length

Word/Double word

Explanation:
1.
2.

The data in the devices specified by S1~S1+n-1 is exchnaged with the data in the devices
specified by S2~S2+n-1.
The operand n used in the instruction should be within the range between 1 and 256.
S1

S1 +1

S1 +2

....

S1 +n- 1

S2

S2 +1

S2 +2

....

S2 +n- 1

S1

S1 +1

S1 +2

....

S1 +n- 1

S2

S2 +1

S2 +2

....

S2 +n- 1

Example:
When X0.0 is ON, the data in D10~D14 is exchanged with the data in D100~D104.
D10
1

D11

D12

D13

2

3

4

D14
5

D100
16

D101

D102

D103

D104

17

18

19

20

D101

D102

D103

D104

2

3

4

5

After the i nstruction is executed

D10
16

D11

D12

D13

D14

D100

17

18

19

20

1

6-123

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.
3.

If S1+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If S2+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the operand n used in the instruciton is larger than 256 or less than 1, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.

6-124

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0308

D

SWAP

Device

X

Y

S





M

Operand

P
S

Function
Exchange the high byte with the
low byte

S
T

C

HC

D

L

SM SR

E

PR

















K

16# “$”

DF

Pulse instruction 16-bit instruction (3 steps) 32-bit instruction (3 steps)
AH

AH

AH

Symbol:

S : Data source

Word/Double word

Explanation:
1.
2.

3.

When the 16-bit instruction is executed, the data in the low byte in S is exchanged with the
data in the high byte in S.
When the 32-bit instruction is executed, the data in the low byte of the high word in S is
exchanged with the data in the high byte of the high word in S, and the data in the low byte of
the low word in S is exchanged with the data in the high byte of the low word in S.
Only the 32-bit instructions can use the 32-bit counter.

Example 1:
When X0.0 is ON, the data in the low byte in D0 is exchanged with the data in the high byte in D0.

D0
High byte

Low byte

Example 2:
When X0.0 is ON, the data in the low byte in D11 is exchanged with the data in the high byte in D11,
and the data in the low byte in D10 is exchanged with the data in the high byte in D10.

D11
High byte

Low byte

D10
High byte

Low byte

6-125

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0309

SMOV

P
S

Device

X

Y

S
m1
m2
D
n













M

T

C













Operand

Function

S, m1, m2, D, n

Transferring the digits

HC

D

L

SM SR

E

PR

K

16# “$”











































DF

Pulse instruction 16-bit instruction (11 steps) 32-bit instruction
AH

-

AH

Symbol:
S : Data source
Start digit which will be transferred
from the source device
Number of digits which will be
m2 :
transferred

m1 :

D : Data destination
n :

Start digit where the source data is
stored in the destination device

Word
Word
Word
Word
Word

Explanation:
1.

2.

3.

The instruction can be used to allocate and combine the data. When the instruction is
executed, the m2 digits of the number which start from the m1th digit of the number in S are
transferred to the m2 digits of the number which starts from the nth digit of the number in D.
The operand m1 should be within the range between 1 and 4. The operand m2 should be
within the range between 1 and m1. The operand n should be within the range between m2
and 4. (Four bits are regarded as a unit.)
When SM605 is OFF, the data involved in the instruction is binary-coded decimal numbers.
D10 (16- bit binary number)
Conversi on
3

10

2

10

1

10

Unchanged
3

10

0

10

Unchanged
2

10

1

10

0

10

D10 (4- digit binary -coded deci mal)
T ransferri ng the digits
D20 ( 4- digit binary -coded deci mal )
Conversi on
D20 ( 16- bit binary number )

4.

Suppose the number in S is K1234, and the number in D is K5678. After the instruction is
executed, the number in S is 1234, and the number in D is 5128.
When SM605 is ON, the data involved in the instruction is binary numbers.

6-126

A H 5 00 Prog r am m ing M an ua l

th

rd

nd

st

4 digit 3 digit 2 digit 1 digit
D10 (16- bit binary number )
T ransferring the digits
D20 (16- bit binary number )
th

rd

nd

st

4 digit 3 digit 2 digit 1 digit
Unchanged
U nchanged

Suppose the number in S is 16#1234, and the number in D is 16#5678. After the instruction is
executed, the number in S is 16#1234, and the number in D is 16#5128.
Example 1:
1.

2.

When SM605 is OFF, the data involved in the instruction is binary-coded decimal numbers.
When X0.0 is ON, the two digits of the decimal number which start from the fourth digit of the
decimal number (the digit in the thousands place of the decimal number) in D10 are
transferred to the two digits of the decimal number which start from the third digit of the
decimal number (the digit in the hundreds place of the decimal number) in D20. After the
instruction is executed, the digits in the thousands place of the decimal number (103) and the
ones place of the decimal number (100) in D20 are unchanged.
When the binary-code decimal number exceeds the range between 0 and 9,999, the operation
error occurs, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200D.

D10 (16- bit binary number)
Conversi on
3

10

2

10

1

10

Unchanged
3

10

0

10

Unchanged
2

10

1

10

0

10

D10 (4- digit binary -coded deci mal)
T ransferri ng the digits
D20 ( 4- digit binary -coded deci mal )
Conversi on
D20 ( 16- bit binary number )

Suppose the number in D10 is 1234, and the number in D20 is 5678. After the instruction is
executed, the number in D10 is unchanged, and the number in D20 is 5128.
Example 2:
When SM605 is ON, the data involved in the instruction is binary numbers. When the instruction
SMOV is executed, the binary numbers in D10 and D20 are not trasnformed into the binary-coded

6-127

Ch ap te r 6 Ap plie d Instruc tions
decimal numbers, and the digit which is transferred is composed of four bits.

th

rd

nd

st

4 digit 3 digit 2 digit 1 digit
D10 (16- bit binary number )
T ransferring the digits
D20 (16- bit binary number )
th

rd

nd

st

4 digit 3 digit 2 digit 1 digit
Unchanged
U nchanged

Suppose the number in D10 is 16#1234, and the number in D20 is 16#5678. After the
instruction is executed, the number in D10 is unchanged, and the number in D20 is 16#5128.
Example 3:
1.
2.

3.

The instruction can be used to combine the values of the DIP switches which are connected to
the input terminals whose numbers are not consecutive.
The two digits of the value of the DIP switch at the right are transferred to the the two digits of
the number which start from the second digit of the number in D2, and the one digit of the
value of the DIP switch at the left is transferred to the the first digit of the number in D1.
The instruction SMOV can be used to transfer the first digit of the number in D1 to the third
digit of the number in D2. In other words, the two DIP switches can be combined into one DIP
switch by means of the instruction SMOV.
2

8

1

0

10

10

10

6

4

2

1

8

1
8

X0.3~X0.0

X1.15~X1.0

PLC

6-128

1

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.

2.
3.
4.

Suppose the data involved in the instruction is binary-coded decimal numbers. If the number in
S is not within the range between 0 and 9999, or if the number in D is not within the range
between 0 and 9999, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200D.
If m1 is less than 1, or if m1 is larger than 4, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
If m2 is less than 1, or if m2 is larger than m1, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.
If n is less than m2, or if n is larger than 4, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-129

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0310

MOVB

P

Operand

Function

S, n, D

Transferring several bits

Device

X

Y

M

S

T

C

HC

D

L

SM SR

S
n
D









































E

PR

K









16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

-

AH

Symbol:
S : Data source

Bit

n : Data length

Word

D : Data destination

Bit

Explanation:
1.
2.
3.

When the instruciton is executed, n pieces of data in devices starting from the device specified
by S are transferred to the devices starting from the device specified by D.
When S or D is T, C or HC, only the state of the device is transferred, and the current value of
the device is not transferred.
The operand n should be within the range between 1 and 256. When n is less than 1, or when
n is larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200B.

Example:
When X0.0 is ON, the data in D0.8~D0.13 is transferred to D1.2~D1.7.

Additional remark:
1.

If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

2.

If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-130

A H 5 00 Prog r am m ing M an ua l

6.5 Jump Instructions
6.5.1 List of Jump Instructions

0400
0401

Instruction code
16-bit
32-bit
CJ
–
JMP
–

0402

GOEND

API

–

Pulse
instruction

–
–

Function
Conditional jump
Unconditional jump
Jumping to the end of the
program

Step

Page
number

3
3

6-132
6-138

1

6-139

6-131

Ch ap te r 6 Ap plie d Instruc tions

6.5.2 Explanation of Jump Instructions
API

Instruction code

Operand

Function

0400

CJ

S

Conditional jump

Device

X

Y

P
M

S

T

C

HC

D

L

SM SR

E

PR

K

16# “$”

DF

S
Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

-

Symbol:

S : Jump destination

Explanation:
1.

2.
3.
4.

When some part of the program in the PLC does not need to be executed, users can use CJ or
CJP to shorten the scan time. Besides, when a dual output is used, users also can use CJ or
CJP.
If the program specified by the label is prior to the instruction CJ, the watchdog timer error will
occur, and the PLC will stop running. Please use the instruction carefully.
The instruction CJ can specify the same label repeatedly.
When the instruction is executed, the actions of the devices are as follows.

The state of Y, the state of M, and the state of S remain the same as those before the
execution of the jump.

The timer stops counting.

If the instruction which is used to reset the timer is driven before the jump is executed,
the timer will still be in the condition of being reset during the execution of the jump.

The general applied instructions are not executed.

Example 1:
1.
2.

When X0.0 is ON, the execution of the program jumps from address 0 to address N
(LABEL1:).
When X0.0 is OFF, the execution of the program starts from address 0, and the instruction CJ
is not executed.

6-132

A H 5 00 Prog r am m ing M an ua l

Example 2:
1.

2.

The instruction CJ between the instruction MC and the instruction MCR can be used in the five
conditions below.
(a) The execution of the program jumps from the part of the program outside one MC/MCR
loop to the part of the program outside another MC/MCR loop.
(b) The execution of the program jumps from the part of the program outside the MC/MCR
loop to the part of the program inside the MC/MCR loop.
(c) The execution of the program jumps from the part of the program inside the MC/MCR
loop to the part of the program inside the MC/MCR loop.
(d) The execution of the program jumps from the part of the program inside the MC/MCR
loop to the part of the program outside the MC/MCR loop.
(e) The execution of the program jumps from the part of the program inside one the
MC/MCR loop to the part of the program inside another the MC/MCR loop.
When the instruction MC is executed, the previous state of the switch contact is put onto the
top of the stack inside the PLC. The stack is controlled by the PLC, and can not be changed by
users. When the instruction MCR is executed, the previous state of the switch contact is
popped from the top of the stack. Under the conditions listed in (b), (d), and (e) above, the
number of times the items are pushed onto the stack may be different from the number of
times the items are popped from the stack. When this situation occurs, at most 32 items can
be pushed onto the stack, and the items can be popped form the stack until the stack is empty.
Therefore, when CJ or CJP is used with MC and MCR, users have to be careful of the pushing
of the item onto the stack and the popping of the item from the stack.

6-133

Ch ap te r 6 Ap plie d Instruc tions

6-134

A H 5 00 Prog r am m ing M an ua l

Example 3:
The states of the devices are listed below.
State of the
State of the contact during
Device
contact before the
the execution of CJ
execution of CJ
M1, M2, and M3
M1, M2, and M3 are
are OFF.
switched from OFF to ON.
Y, M, and S
M1, M2, and M3
M1, M2, and M3 are
are ON.
switched from ON to OFF.
M4 is switched from OFF
M4 is OFF.
to ON.

Counter

Y0.1*1, M20, and S1 are OFF.
Y0.1*1, M20, and S1 are ON.
The timer is not enabled.

M4 is ON.

M4 is switched from ON to
OFF

The timer stops counting
immediately. When M0 is
switched from ON to OFF, the
timer is reset to 0.

M6 is OFF.

M6 is switched from OFF
to ON.

ST1 is not enabled.

M6 is ON.

M6 is switched from ON to
OFF.

If the instruction CJ is
executed after the
accumulative timer is enabled,
the accumulative timer stops
counting.

M7 and M10 are
OFF.

M10 is ON/OFF.

The counter is not enabled.

Timer

Accumulative
timer

State of the output coil during
the execution of CJ

C0 stops counting. When M0 is
switched OFF, C0 keeps
counting.
M11 is switched from OFF The applied instruction is not
M11 is OFF.
to ON
executed.
Applied
instruction
M11 is switched from ON
The applied instruction which
M11 is ON.
to OFF
is skipped is not executed.
*1:Y0.1 is a dual output. When M0 is OFF, Y0.1 is controlled by M1. When M0 is ON, Y0.1 is
controlled by M12.
M7 is OFF. M10 is
ON/OFF.

M10 is ON/OFF.

6-135

Ch ap te r 6 Ap plie d Instruc tions

6-136

A H 5 00 Prog r am m ing M an ua l

Additional remark:
Please refer to ISPSoft User Manual for more information about the use of the label.

6-137

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0401
Device

Operand

Function

S

Unconditional jump

JMP
X

Y

M

S

T

C

HC

D

L

SM SR

E

PR

K

16# “$”

DF

S
Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
-

AH

-

Symbol:

S : Jump destination

Explanation:
1.
2.
3.

The execution of the program jumps to the part of the program specified by the pointer without
any condition.
If the program specified by the label is prior to the instruction JMP, the watchdog timer error will
occur, and the PLC will stop running. Please use the instruction carefully.
When the instruction is executed, the actions of the devices are as follows.

The state of Y, the state of M, and the state of S remain the same as those before the
execution of the jump.

The timer stops counting.

If the instruction which is used to reset the timer is driven before the jump is executed,
the timer will still be in the condition of being reset during the execution of the jump.

The general applied instructions are not executed.

6-138

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0402

GOEND

─

Jumping to END

Pulse instruction 16-bit instruction (1 step) 32-bit instruction
-

AH

-

Symbol:

Explanation:
1.
2.
3.

When the condition is met, the execution of the program jumps to END in the program.
Function blocks and interrupt tasks do not support the instruction. Besides, the instruction can
not be between the instruction FOR and the instruction NEXT.
When the instruction GOEND is executed, the instructions skipped are not executed, the data
in all devices is unchanged, and the states of all devices are also unchanged.

6-139

Ch ap te r 6 Ap plie d Instruc tions

6.6 Program Execution Instructions
6.6.1 List of Program Execution Instructions
API
0500
0501
0502

6-140

Instruction code
16-bit
32-bit
DI
–
EI
–
IMASK
–

Pulse
instruction
–
–
–

Function
Disabling the interrupt
Enabling the interrupt
Controlling the interrupt

Step

Page
number

1
1
3

6-141
6-142
6-146

A H 5 00 Prog r am m ing M an ua l

6.6.2 Explanation of Program Execution Instructions
API

Instruction code

Operand

Function

0500

DI

-

Disabling the interrupt

Pulse instruction
-

16-bit instruction (1 step) 32-bit instruction
AH

-

Symbol:

6-141

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

0501

EI

-

Enabling the interrupt

Pulse instruction 16-bit instruction (1 step) 32-bit instruction
-

AH

-

Symbol:

Explanation:
1.

2.

3.

4.

5.

6.

The use of the instruction EI indicates that the interrupt task is allowed to be used in the
program. (Please refer to section 6.6 in AH500 Operation Manual for more information about
task I0~task I255.)
The interrupt task is allowed to be used between the instruction EI and the instruction DI in the
program. When there is no part of the program in which the interrupt is disabled, users can
choose not to use the instruction DI.
During the execution of one interrupt task, other interrupts generated will not be executed, but
will be memorized. Not until the execution of the present interrupt task is complete will the next
interrupt task be executed.
When several interrupts occur, the interrupt task which should be executed first has higher
priority. When several interrupts occur simultaneously, the interrupt task whose pointer number
is smaller is executed first.
When the interrupt task occurring between DI and EI can not be executed immediately, the
interrupt request is memorized once, and the interrupt task is executed in the part of the
program in which the execution of the interrupt task is allowed.
When the immediate I/O signal is required in the execution of the interrupt task, users can use
the instruction REF in the program to refresh the state of the I/O.

Example:
If the PLC runs and the part of the program Cyclic_0 between the instruction EI and the instruction
DI is scanned, the interrupt task is executed when it is enabled. When the execution of the interrupt
task is complete, the main program is executed.

6-142

A H 5 00 Prog r am m ing M an ua l
The program Cyclic_0:

The interrupt task:

Additional remark:
There are 256 interrupt tasks, i.e. task I0~task I255.
1. The I/O interrupts (I0~I31)
The I/O interrupts are used by the special high-speed module. The interrupt conditions and the
interrupt numbers are set in HWCONFIG in ISPSoft, and the interrupt programs are
downloaded to the PLC. If the interrupt conditions are satisfied when the PLC runs, the
corresponding interrupt programs will be executed.
2. The communication interrupts (I32 and I33)
The communication interrupt can be used as the instruction RS, that is, the receiving of the
specific character triggers the interrupt, or can be used as the general interrupt.
Please refer to the explanation of the instruction RS for more information.
COM1: I32
COM2: I33
3. 24 V low voltage interrupt
Whether the external 24 V voltage is normal can be checked by the terminals VS+ and VS- on
AHPS05-5A. If the external 24 V voltage is abnormal, users can execute the corresponding
program by means of the interrupt subroutine I34.
Note: If the external 24 V voltage of a backplane is abnormal, the corresponding bit in SR731
will be set to ON. After the external 24 V voltage of the backplane returns to normal, the
bit will be set to OFF. The high 8 bits in SR731 are reserved bits.
SR731

Bit 15 ~8
Reserved bits

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit2 Bit1 Bit0
For the backplanes

For example:
(a) If the external 24 V voltage of the local main backplane is abnormal, bit 0 in SR731 will be

6-143

Ch ap te r 6 Ap plie d Instruc tions
set to ON.
(b) If the external 24 V voltage of the first local extension backplane is abnormal, bit 1 in SR731
will be set to ON.
4. The external interrupts (I40~I251)
If a peripheral device, e.g. a special I/O module, sends an interrupt request, the PLC will
execute the specific interrupt task.
5. The timed interrupts (I252~I255)
Timed interrupt 0 (I252): The default value is 100 milliseconds (1~1000 milliseconds).
Timed interrupt 1 (I253): The default value is 40 milliseconds (1~1000 milliseconds).
Timed interrupt 2 (I254): The default value is 20 milliseconds (1~1000 milliseconds).
Timed interrupt 3 (I255): The default value is 10 milliseconds (1~1000 milliseconds).
The timed interrupt task is executed every specific period of time. For example, the timed
interrupt task is executed every 10 milliseconds.
 The priority order is a follows.
Interrupt number
Description
Priority order
I0
I/O interrupt 0
1
I1
I/O interrupt 1
2
I2
I/O interrupt 2
3
I3
I/O interrupt 3
4
I4
I/O interrupt 4
5
I5
I/O interrupt 5
6
I6
I/O interrupt 6
7
I7
I/O interrupt 7
8
I8
I/O interrupt 8
9
I9
I/O interrupt 9
10
I10
I/O interrupt 10
11
I11
I/O interrupt 11
12
I12
I/O interrupt 12
13
I13
I/O interrupt 13
14
I14
I/O interrupt 14
15
I15
I/O interrupt 15
16
I16
I/O interrupt 16
17
I17
I/O interrupt 17
18
I18
I/O interrupt 18
19
I19
I/O interrupt 19
20
I20
I/O interrupt 20
21
I21
I/O interrupt 21
22
I22
I/O interrupt 22
23
I23
I/O interrupt 23
24
I24
I/O interrupt 24
25
I25
I/O interrupt 25
26
I26
I/O interrupt 26
27
I27
I/O interrupt 27
28
I28
I/O interrupt 28
29
I29
I/O interrupt 29
30
I30
I/O interrupt 30
31
I31
I/O interrupt 31
32
Communication interrupt
33
I32
(COM1)

6-144

A H 5 00 Prog r am m ing M an ua l

Interrupt number
I33

I34

I35~I39
I40~I251
I252
I253
I254
I255

Description
Priority order
Communication interrupt
34
(COM2)
24 V low voltage interrupt
Whether the external 24 V voltage is normal
can be checked by the terminals VS+ and
35
VS- on AHPS05-5A. If the external 24 V
voltage is abnormal, users can execute the
corresponding program by means of the
interrupt subroutine I34.
Reserved
36~40
External interrupt
41~252
Timed interrupt 0
253
Default value: 100 ms (1~1000 ms)
Timed interrupt 1
254
Default value: 40 ms (1~1000 ms)
Timed interrupt 2
255
Default value: 20 ms (1~1000 ms)
Timed interrupt 3
256
Default value: 10 ms(1~1000 ms)

6-145

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0502

Function

S

Controlling the interrupt

IMASK

Device X

Y





S

Operand

M

S

T

C

HC

D

L

SM SR













E

PR

K

16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
-

-

AH

Symbol:

S : Data source

Word

Explanation:
1.

2.
3.

The values of the bits in S~S+15 determine whether the interrupts are enabled or disabled.
When the value of the bit is 1 and the instruction EI is executed, the corresponding interrupt is
executed. When the value of the bit is 0, the corresponding interrupt can not be executed.
When the instruction is executed, the values in S~S+15 are transferred to SR623~SR638.
When the instruction is not executed, the values of the bits in SR623~SR638 determine
whether the interrupts are enabled or disabled.

6-146

I7

I6

I5

I4

I3

I2

I1

I0

S

I15 I14 I13 I12

S +1

I31 I30 I29 I28 I27

I26 I25 I24 I23 I22

I21 I20 I19 I18 I17 I16

S +2

I47 I46 I45 I44 I43

I42 I41 I40 I39 I38

I37 I36 I35 I34 I33 I32

S +3

I63 I62 I61 I60 I59

I58 I57 I56 I55 I54

I53 I52 I51 I50 I49 I48

S +4

I79 I78 I77 I76 I75

I74 I73 I72 I71 I70

I69 I68 I67 I66 I65 I64

S +5

I95 I94 I93 I92 I91

I90 I89 I88 I87 I86

I85 I84 I83 I82 I81 I80

S +6

I111 I110 I109 I108 I107 I106 I105 I104 I103 I102 I101 I100 I99 I98 I97 I96

S +7

I127 I126 I125 I124 I123 I122 I121 I120 I119 I118 I117 I116 I115 I114 I113 I112

S +8

I143 I142 I141 I140 I139 I138 I137 I136 I135 I134 I133 I132 I131 I130 I129 I128

S +9

I159 I158 I157 I156 I155 I154 I153 I152 I151 I150 I149 I148 I147 I146 I145 I144

S +10

I175 I174 I173 I172 I171 I170 I169 I168 I167 I166 I165 I164 I163 I162 I161 I160

S +11

I191 I190 I189 I188 I187 I186 I185 I184 I183 I182 I181 I180 I179 I178 I177 I176

S +12

I207 I206 I205 I204 I203 I202 I201 I200 I199 I198 I197 I196 I195 I194 I193 I192

S +13

I223 I222 I221 I220 I219 I218 I217 I216 I215 I214 I213 I212 I211 I210 I209 I208

S +14

I239 I238 I237 I236 I235 I234 I233 I232 I231 I230 I229 I228 I227 I226 I225 I224

S +15

I255 I254 I253 I252 I251 I250 I249 I248 I247 I246 I245 I244 I243 I242 I241 I240

I11 I10

I9

I8

A H 5 00 Prog r am m ing M an ua l

Additional remark:
If S~S+15 exceed the device range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.

6-147

Ch ap te r 6 Ap plie d Instruc tions

6.7 I/O Refreshing Instructions
6.7.1 List of I/O Refreshing Instructions
API
0600

6-148

Instruction code
16-bit
32-bit
REF
–

Pulse
instruction


Function
Refreshing the I/O

Step

Page
number

5

6-149

A H 5 00 Prog r am m ing M an ua l

6.7.2 Explanation of I/O Refreshing Instructions
API

Instruction code

Operand

Function

0600

REF

D, n

Refreshing the I/O

Device

X

Y

D
n







M

P
S

T

C

HC

D

L






SM SR

E



PR

K






16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

-

AH

Symbol:
D : I/O point whose state is refreshed
n :

Number of I/O points whose states
are refreshed

Bit

1~256

Explanation:
The I/O states are not refreshed until the instruction END is executed. When the scanning of the
program starts, the states of the external inputs are read and stored in the memory. After the
instruction END is executed, the states of the outputs in the memory is sent to the output terminals.
Therefore, users can use this instruction when they need the latest I/O data in the operation
process.
Example 1:
When X0.0 is ON, the PLC reads the states of the inputs X0.0~X0.15 immediately. The input signals
are refreshed without any delay.

Example 2:
When X0.0 is ON, the output signals from Y0.0~Y0.7 are sent to the output terminals. The output
signals are refreshed immediately without the need to wait for the execution of the instruction END.

Additional remark:
1.

If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-149

Ch ap te r 6 Ap plie d Instruc tions
2.

If n is larger than 256, or if n is less than 1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-150

A H 5 00 Prog r am m ing M an ua l

6.8 Convenience Instructions
6.8.1 The List of Convenience Instructions
API

Instruction code
16-bit
32-bit

0700

ALT

0701
0702
0703
0704
0705
0706
0707

TTMR
STMR
RAMP
MTR
ABSD
INCD
–

Pulse
instruction

–



–
–
–
–
DABSD
–
DPID

–
–
–
–
–
–
–

Function
Alternating between ON and
OFF
Teaching timer
Special timer
Ramp signal
Matrix input
Absolute drum sequencer
Incremental drum sequencer
PID algorithm

Step

Page
number

3

6-152

5
7
9
9
9
9
35

6-154
6-156
6-158
6-160
6-162
6-165
6-167

6-151

Ch ap te r 6 Ap plie d Instruc tions

6.8.2 Explanation of Convenience Instructions
API

Instruction code

Operand

0700

ALT

D

P

Device

X

Y

M

S

D









T

C

HC

Function
Alternating between ON and
OFF

D

L

SM SR







E

PR

K

16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

-

AH

Symbol:

D : Destination device

Bit

Explanation:
1.
2.

When the instruction ALT is executed, the state of the device specified by D alternate between
ON and OFF.
Generally, the pulse instruction ALTP is used.

Example 1:
When X0.0 is switched from OFF to ON for the first time, Y0.0 is ON. When X0.0 is switched from
OFF to ON for the second time, Y0.0 is OFF.

Example 2:
In the beginning, M0 is OFF. Therefore, Y0.0 is ON, and Y0.1 is OFF. When X0.0 is switched from
OFF to ON for the firs time, M0 is ON. Therefore, Y0.1 is ON, and Y0.0 is OFF. When X0.0 is
switched from OFF to ON for the second time, M0 is OFF. Therefore, Y0.0 is ON, and Y0.1 is OFF.

6-152

A H 5 00 Prog r am m ing M an ua l

Example 3:
When X0.0 is ON, T0 generates a pulse every two seconds. The output Y0.0 alternates between
ON and OFF according to the pulses generated by T0.

6-153

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

0701

TTMR

D, n

Teaching timer

Device X

Y







D
n

M

S

T

C

HC

D

L

SM SR










E

PR

K






16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
-

-

AH

Symbol:
D : Device in which the time is stored

Word

n :Multiplier

Word

Explanation:
1.

2.
3.

4.
5.

A second is taken as the timing unit. The time for which the button switch has been turned ON
is multiplied by n, and the product is stored in D. D+1 is for system use only. When the
instruction is executed, the value in D+1 can not be altered. Otherwise, the time will be
counted incorrectly.
When the conditional contact is ON, D is reset to 0.
Setting the multiplier: When n is 0, D takes a second as the timing unit. When n is 1, the time
for which the button switch has been turned ON is multiplied by 10, and D takes 100
milliseconds as the timing unit. When n is 2, the time for which the button switch has been
turned ON is multiplied by 100, and D takes 10 milliseconds as the timing unit.
n
D
K0 (unit: 1 second)
1×T
K1 (unit: 100 milliseconds)
10×T
K2 (unit: 10 milliseonds)
100×T
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.
The operand n should be within the range between 0 and 2.

Example 1:
1.
2.

The time for which the button switch X0.0 has been turned ON is multiplied by n, and the
product is stored in D0.
When X0.0 is switched OFF, the value in D0 is unchanged.

6-154

A H 5 00 Prog r am m ing M an ua l

X0.0

D0
D0
T
The time for whic h
the button switc h is
turned on.
(Unit: Second)

T
The time for whic h
the button switc h is
turned on.
(Unit: Second)

Additional remark:
1.
2.
3.

If D+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 0, or if n is larger than 2, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.

6-155

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0702
Device

STMR
X

Y

M

S

T

C

Operand

Function

S, m, D

Special timer

HC

D

L

SM SR









E

PR

K






16# “$”

DF



S
m
D















Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
-

-

AH

Symbol:
S : Timer number

T0~T2047

m : Setting value of the timer

Word

D : Output device

Bit

Explanation:
1.
2.
3.
4.
5.
6.

7.
8.

The instruction STMR is used to generate the off-delay relay, the one-shot circuit, and the
flashing circuit.
The timer specified by the instruction TMR takes 100 milliseconds as the timing unit.
The timer specified by the instruction STMR can not be used repeatedly.
D occupies four consecutive devices.
Before the instruction is executed, please reset D~D+3.
When the conditional contact is not enabled and the value of the device meets one of the two
conditions mentioned below, D, D+1, and D+3 are ON for m seconds before they are switched
OFF. When the conditional contact is not enabled and the value of the device does not meet
either of the two conditions mentioned below, D~D+3 keep OFF.
 The value of the timer is less than or equal to m, D is ON, and D+1 is OFF.
 The value of the timer is less than m, D +2 is OFF, and D, D+1, and D+3 are ON.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.
The operand m should be within the range between 1 and 32767.

Example:
1.
2.
3.
4.
5.

When X0.0 is ON, the instruction STMR specifies the timer T0, and the setting value of T0 is
five seconds.
Y0.0 is the off-delay contact. When X0.0 is switched from OFF to ON, Y0.0 is ON. Five
minutes after X0.0 is switched from ON to OFF, Y0.0 is OFF.
When X0.0 is switched from ON to OFF, Y0.0 is ON for five seconds.
When X0.0 is switched from OFF to ON, Y0.2 is ON for five seconds.
Five seconds after X0.0 is switched from OFF to ON, Y0.3 is ON. Five seconds after X0.0 is
switched from ON to OFF, Y0.3 is OFF.

6-156

A H 5 00 Prog r am m ing M an ua l

X0.0

Y0.0
5 s econds

5 s econds

5 s econds

5 s econds

5 s econds

5 s econds

Y0.1

Y0.2
5 s econds
Y0.3
5 s econds

6.

When the conditional contact X0.0 is followed by the normally-closed contact Y0.0, the flashing
currents pass through Y0.1 and Y0.2. When X0.0 is switched OFF, Y0.0, Y0.1, and Y0.3 are
switched OFF, and T10 is reset to 0.

X0.0
Y0.3
5 s econds
Y0.0
5 s econds

Additional remark:
1.
2.
3.

If D+3 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If m is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200B.
If users declare the operand D in ISPSoft, the data type will be ARRAY [4] of BOOL.

6-157

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

0703

RAMP

S1, S2, D, n

Ramp signal

Device X

Y











S1
S2
D
n

M

S

T

C

HC

D

L

SM SR
















E

PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
-

-

AH

Symbol:
S1 : Initial value of the ramp signal

Word

S2 : Final value of the ramp signal

Word

D : Duration of the ramp signal

Word

n : Number of scan cycles

Word

Explanation:
1.
2.

3.
4.
5.
6.

The instruction is used to get the slope. The slope is linear, and has an absolute relationship
with the scan time.
The initial value of the ramp signal and the final value of the ramp signal are written into D10
and D11 respectively in advance. When X0.0 is ON, the value in D12 increases from the
setting value in D10 to the setting value in D11. The number of scan cycles is stored in D13.
When the value in D12 is equal to that in D11, or when the value on D13 is equal to n, SM687
is ON.
When the conditional contact is not enabled, the value in D12 is 0, the value in D13 is 0, and
SM687 is OFF.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.
Please refer to ISPSoft User Manual for more information related to the fixing of the scan time.
The operand n should be within the range between 1 and 32767.

Example:
When the instruction is used with the analog signal output, the action of cushioning the start/stop
can be executed.
1.
Suppose the instruction is being executed. When X0.0 is switched OFF, the execution of the
instruction stops. When X0.0 is ON again, SM687 is OFF, D12 is reset to the setting value in
D10, D13 is reset to 0, and the calculation is restarted.
2.
When SM686 is OFF, SM687 is ON, D12 is reset to the setting value in D10, and D13 is reset
to 0.

6-158

A H 5 00 Prog r am m ing M an ua l
D11

D10

D12

D12

D11
D10

The number of scan cycl e i s n.
D10< D11

The number of scan cycl e i s n.
D10> D11

The number of scan cycl e i s st ored i n D13.

Additional remark:
1.
2.
3.
4.

If D+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200B.
If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
When SM686 is ON/OFF, the value in D12 changes as follows.
SM686=O N

X0.0

SM686=O FF

X0.0
T he signal is enabled.

D11

D11
D10
SM687

T he signal is enabled.

D12

D10

D12

SM687

6-159

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0704

MTR

Device X

Y

M

S











T

C

Operand

Function

S, D1, D2, n

Matrix input

HC

D

L







SM SR

E

PR

K






16# “$”

DF



S
D1
D2
n








Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
-

AH

-

Symbol:
S : Initial input device in the matrix scan

Bit

D1 : Initial output device in the matrix scan

Bit

D2 :

Initial corresponding device in the matrix
scan

n : Number of rows which are scanned

Bit
Word

Explanation:
1.
2.
3.
4.

5.
6.

7.
8.

S specifies the initial input device in the matrix scan. The eight devices starting from the device
specified by S are the input devices in the matrix scan.
D1 specifies the transistor output device Y as the initial device in the matrix scan. When the
conditional contact is OFF, the states of the n devices starting from D1 are OFF.
One row of inputs is refreshed every scan cycle. There are 16 inputs in a row, and the scan
starts from the first row to the nth row.
The eight input devices starting from the device specified by S are connected to the n output
devices starting from the device specified by D1 to form the n rows of switches. The states of
the n rows of switches are read in the matrix scan, and stored in the devices starting from the
device specified by D2.
When the instruction is used, users can connect at most 8 rows of input switches in parallel to
get 64 inputs (8×8=64).
The interval between the time when the instruction is executed and the next time when it is
executed should be longer than the time it takes for the states of the I/O points on the module
to be refreshed. Otherwise, the correct states of the inputs can not be read.
Generally, the conditional contact used in the instruction is the normally-open contact SM400.
The operand n should be within the range between 2 and 8.

Example 1:
1.

When M0 is ON, the instruction MTR is executed. The states of the two rows of switches are
read in order, and stored in the internal relays M10~M17 and M20~M27 respectively.

2.

The diagram below is the external wiring diagram of the 2-by-8 matrix input circuit which is

6-160

A H 5 00 Prog r am m ing M an ua l
composed of X0.0~X0.7 and Y0.0~Y0.7. The corresponding internal relays of the 16 switches
are M10~M17 and M20~M27.

M20

M21

M22

M23

M24

M25

M26

M27

Y0.1
Y0.0
X0.1

M10

X0.2

M11

X0.3

M12

X0.4

M13

X0.5

M14

X0.6

M15

X0.7

M16

M17

X0.0 X0.1 X0.2 X0.3 X0.4 X0.5 X0.6 X0.7

3.

The eight input devices starting from X0.0 are connected to the two output devices starting
from Y0.0 to form the two rows of switches. The states of the two rows of switches are read in
the matrix scan, and stored in the devices starting from M10 specified by D2. That is, the states
of the first row of switches are stored in M10~M17, and the states of the second row of
switches are stored in M20~M27.
T he first row of i nput s ignals ar e r ead.

Y0.0 1

3

T he second r ow of input s ignal s ar e read.

Y0.1

2

4

Additional remark:
1.
2.
3.

If S+7, D1+n-1, or D2+(n*8)-1 exceeds the device range, the instruction is not executed, SM0 is
ON, and the error code in SR0 is 16#2003.
If n is less than 2, or if n is larger than 8, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
If users declare the operand S in ISPSoft, the data type will be ARRAY [8] of BOOL.

6-161

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0705

D

ABSD

Device

X

Y

S1
S2
D
n











M



S

Operand

Function

S1, S2, D, n

Absolute drum sequencer

T

C

HC

D

L

SM SR

























E




PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
-

AH

AH

Symbol:
Initial device in the
comparison

Word/Double word

S2 : Comparison value

Word/Double word

D : Comparison result

Bit

S1 :

n :

Number of comparison
groups

Word/Double word

Explanation:
1.
2.
3.

The instruction ABSD is used to generate multiple pulses corresponding to the current values
of the counter.
Only the instruction DABSD can use the 32-bit counter.
When the instruction ABSD is used, n should be within the range between 1 and 256. When
the instruction DABSD is used, n should be within the range between 1 and 128.

Example 1:
1.

2.
3.

Before the instruction ABSD is executed, the instruction MOV is used to write the setting
values in D100~D107. The values in the even devices are minimum values, and the values in
the odd devices are maximum values.
When X0.0 is ON, the current value of the counter C10 is compared with the maximum values
and the minimum values in D100~D107, and the comparison results are stored in M10~M13.
When X0.0 is OFF, the original states of M10~M13 are unchanged.

6-162

A H 5 00 Prog r am m ing M an ua l

4.

5.

When the current value of C10 is within the range between the minimum value and the
maximum value, M10~M13 are ON. Otherwise, M10~M13 are OFF.
Minimum value
Maximum value
Current value of C10
Output
D100=40

D101=100

40≦C10≦100

M10=ON

D102=120

D103=210

120≦C10≦210

M11=ON

D104=140

D105=170

140≦C10≦170

M12=ON

D106=150

D107=390

150≦C10≦390

M13=ON

Suppose the minimum value is larger than the maximum value. When the current value of C10
is less than the maximum value (C10<60), or when the current value of C10 is larger than the
minimum value (C10>140), M12 is ON. Otherwise, M12 is OFF.
Minimum value

Maximum value

Current value of C10

Output

D100=40

D101=100

40≦C10≦100

M10=ON

D102=120

D103=210

120≦C10≦210

M11=ON

D104=140

D105=60

60≦C10≦140

M12=OFF

D106=150

D107=390

150≦C10≦390

M13=ON

40

100

M10
120

210

M11
60

140

M12
150

390

M13

0

200

400

6-163

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.
3.
4.
5.
6.

If S+2*n-1 used in the instruction ABSD exceeds the device range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S+4*n-1 used in the instruction DABSD exceeds the device range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If D+n-1 used in the instruction ABSD exceeds the device range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If D+2*n-1 used in the instruction DABSD exceeds the device range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If n used in the instruction ABSD is less than 1 or larger than 256, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.
If n used in the instruction DABSD is less than 1 or larger than 128, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.

6-164

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0706

INCD

Device

X

Y

S1
S2
D
n











M



S

T

C







Operand

Function

S1, S2, n, D

Incremental drum sequencer

HC



D

L

SM SR














E




PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
-

-

AH

Symbol:
Initial device in the
comparison

S1

:

S2

: Counter number

Word

D

: Comparison result

Bit

n

:

Number of comparison
groups

Word

Word

Explanation:
1.
2.

3.
4.
5.
6.

The instruction INCD is used to generate multiple pulses for a pair of counters.
The current value of S2 is compared with the setting value in S1. When the current value
matches the setting value, the current value of S2 is rest to 0, and the current comparison
group number is stored in S2+1.
After the comparison between the current values of S2 and the n groups of values is complete,
SM688 is ON for a scan cycle.
When the conditional contact is not enabled, the value in S2 is 0, the value in S2+1 is 0,
D~D+n-1 are OFF, and SM688 is OFF.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.
The operand n should be within the range between 1 and 256.

Example:
1.
2.
3.
4.
5.
6.

Before the instruction INCD is executed, the instruction MOV is used to write the setting values
in D100~D104. The values in D100~D104 are 15, 30, 10, 40, and 25 respectively.
The current values of C10 is compared with the setting values in D100~D104. When the
current value matches the setting value, C10 is rest to 0, and counts again.
The current comparison group number is stored in C11.
When the value in C11 changes by one, M10~M14 act correspondingly. Please refer to the
timing diagram below.
When the comparison between the current values of C10 and the values in D100~D104 is
complete, SM688 is ON for a scan cycle.
When X0.0 is switched from ON to OFF, C10 and C11 are reset to 0, and M10~M14 are
switched OFF. When X0.0 is ON again, the execution of the instruction starts from the
beginning.

6-165

Ch ap te r 6 Ap plie d Instruc tions

X0.0
40
30
C10
Current v alue

15

C11
Current v alue 0

15

10

1

2

30

25

3

15

4
0

1

0

1

M10

M11

M12

M13

M14

SM688

Additional remark:
1.
2.
3.
4.
5.

If S2+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If S1+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
If users declare the operand S2 in ISPSoft, the data type will be ARRAY [2] of WORD/INT.

6-166

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0707

D

PID

Device

X

Y

M

PID_RUN







S

Operand

Function

S1, S2, S3, D

PID algorithm

T

C

HC

SV

D

L









SM SR

E



PR



PV







PID_MODE













PID_MAN
MOUT_AUTO
















CYCLE







Kp







Ki







Kd













MV_MAX







MV_MIN







MOUT







PID_DIR
ERR_DBW







K 16# “$” DF






I_MV







MV







Pulse instruction 16-bit instruction 32-bit instruction (35 steps)
-

-

AH

Symbol:
: Enabling the PID algorithm

Bit

SV

: Target value (SV)

Double word

PV

: Process value (PV)

Double word

: PID control mode

Double word/
Double integer

: PID A/M mode (PID_MAN)

Bit

: MOUT_AUTO

Bit

: Sampling time (CYCLE)

Double word/
Double integer

Kp

: Proportional gain (Kp)

Double word

Ki

: Integral gain (Ki)

Double word

Kd

: Derivative gain (Kd)

Double word

PID_RUN

PID_MODE
PID_MAN
MOUT_AUTO
CYCLE

PID_DIR
ERR_DBW
MV_MAX

PID forward/reverse direction
(PID_DIR)
Range within which the error
: value is count as 0
(ERR_DBW)
Maximum output value
:
(MV_MAX)
:

Bit
Double word
Double word

6-167

Ch ap te r 6 Ap plie d Instruc tions

MV_MIN
MOUT
I_MV
MV

:

Minimum output value
(MV_MIN)

Double word

: Manual output value (MOUT)

Double word

Accumulated integral value
(I_MV)

Double word

:

: Output value (MV)

Double word

Explanation:
1.

2.

The instruction is used to implement the PID algorithm. After the sampling time is reached, the
PID algorithm is implemented. PID stands for Proportional, Integral, Derivative. The PID
control is widely applied to mechanical equipments, pneumatic equipments, and electronic
equipments.
The setting of the parameters is as follows.
Device number
Function
Setting range
Description
True: The PID algorithm is implemented.
Enabling the PID
PID_RUN
False: The output value (MV) is reset to 0, and
algorithm
the PID algorithm is not implemented.
Range of
single-precision
SV
Target value
SV
floating-point
numbers
Range of
single-precision
PV
Process value
PV
floating-point
numbers
0: Automatic control
When PID_MAN is switched from ON to OFF,
the output value (MV) then is involved in the
automatic algorithm.
1: The parameters are tuned automatically for
the temperature control.
When the tuning of the parameters is
complete, the device is automatically set to 0,
PID control mode
PID_MODE
and is filled in with appropriate parameters KP,
KI, and KD.
2: Automatic control
When PID_MAN is switched from ON to OFF,
the MV involved in the internal algorithm is
involved in the automatic algorithm.
If the setting value exceeds the range, it will be
counts as 0.
True: Manual
The MV is output according to the MOUT,
but it is still within the range between the
MV_MIN and the MV_MAX. When
PID_MODE is set to 1, the setting is
ineffective.
PID A/M mode
PID_MAN
False: Automatic
The MV is output according to the PID
algorithm, and the output value is within
the range between MV_MIN and
MV_MAX.

6-168

A H 5 00 Prog r am m ing M an ua l

Device number
MOUT_AUTO

Cycle

Function
MOUT automatic
change mode

Sampling time (TS)

Kp

Proportional gain (Kp)

Ki

Integral gain (Ki)

Kd

Derivative gain (Kd)

PID_DIR

PID forward/reverse
direction

ERR_DBW

Range within which
the error value is
count as 0

MV_MAX

Maximum output
value

MV_MIN

Minimum output
value

Setting range
Description
True: Automatic
The MOUT varies with the MV.
False: Normal
The MOUT deos not vary with the MV.
When the instruction is
scanned, the PID algorithm is
implmented according to the
sampling time, and the MV is
refreshed. If TS is less than 1,
it
will be count as 1. If TS is
1~2,000
larger than 2000, it will be
(unit: 10ms)
count as 2000. When the
instruction PID is used in the
interval interrupt task, the
sampling time is the same as
the interval between the
timed interrupt tasks.
It is the magnified
Range of
proportional value of the error
positive
between the SV and the PV.
single-precision
If the magnified proportional
floating-point
value of the error is less than
numbers
0, the Kp will be count as 0.
Range of
It is the integral gain (Ki). If
the integral gain is less than
positive
0, the Ki will be count as 0.
single-precision
floating-point
numbers
Range of
It is the derivative gain (Kd). If
the derivative gain is less
positive
than 0, the Kd will be count as
single-precision
0.
floating-point
numbers
True: Reverse action (E=SV-PV)
False: Forward action (E=PV-SV)
The error value (E) is the
difference between the SV
Range of
and the PV. When the setting
single-precisio
value is 0, the function is not
n floating-point
enabled. For example, the E
numbers
within the range between -5
and 5 will be count as 0 if the
setting value is 5 or -5.
Suppose MV_MAX is set to
1,000. When the MV is larger
Range of
than 1,000, 1,000 is output.
single-precisio
The value in MV_MAX should
n floating-point
be larger than that in
numbers
MV_MIN. Otherwise, the
maximum MV and the
minimum MV will be reversed.
Range of
Suppose MV_MIN is set to
single-precisio
-1,000. When the MV is less
n floating-point
than -1,000, -1,000 is output.
numbers

6-169

Ch ap te r 6 Ap plie d Instruc tions

Device number
MOUT

I_MV (It
occupies six
consecutive
32-bit
devices.)

Function
Manual output value

I_MV

The
accumulate
d integral
value is
temporarily
stored in it.

I_MV+1

The
previous PV
is
temporarily
stored in it.

Setting range
Description
It is used with the PID_MAN mode. Users set the
MV directly.
The accumulated integral
value is only for reference. It
still can be cleared or modified
Range of
according to users’ need.
single-precisio
When the MV is larger than
n floating-point
the MV_MAX, or when the MV
numbers
is less than MV_MIN, the
accumulated integral value in
I_MV is unchanged.
The previous PV is only for reference. It still can
be modified according to users’ need.

~

I_MV+2
For system use only

I_MV+5
MV

MV

The MV is withing the range between the
MV_MIN and the MV_MAX.

Example:
1.
2.

Before the instruction PID is executed, the setting of the parameters should be complete.
When X0.0 is ON, the instruction is executed. When M1 is ON, the PID algorithm is
implemented. When M1 is OFF, the MV is 0, and the MV is stored in D200. When X0.0 is
switched OFF, the instruction is not executed, and the previous data is unchanged.

Additional remark:
1.
2.

The instruction can be used several times, but the registers specified by I_MV~I_MV+5 can
not be the same.
I_MV occupies 12 registers. I_MV used in the instruction PID in the above example occupies
D122~D133.

6-170

A H 5 00 Prog r am m ing M an ua l
3.

4.

5.

The instruction PID only can be used in the cyclic task and the interval interrupt task. When the
instruction PID is used in the interval interrupt task, the sampling time is the same as the
interval between the timed interrupt tasks.
When the instruction is scanned, the PID algorithm is implmented according to the sampling
time, and the MV is refreshed. When the instruction is used in the interrupt task, the sampling
time is the same as the interval between the timed interrupt tasks. The PID algorithm is
implemented according to the interval between the timed interrupt tasks.
Before the PID algorithm is implemented, the process value used in the instruction PID has to
be a stable value. When users need the input value in the module to implement the PID
algorithm, they have to notice the time it takes for the analog input to be converted into the
digital input.

The PID algorithm:
1.
2.

When PID_MODE is set to 0 or 2, the PID control mode is the automatic control mode.
When PID_MODE is set to 1, the PID control mode is the automatic tuning mode. After the
tuning of the parameter is complete, PID_MODE is set to 0. The PID control mode becomes
the automatic control mode.
a)
The PID algorithm includes the forward action and the reverse action. Whether the action
is the forward one or the reverse one depends on the setting of PID_DIR.
The PID algorithm is as follows.
t

MV  K P E t   K I  E (t )dt  K D *
0

dE (t )
dt

E(t)S represents the derivative value of E(t), and E(t )

1
represents the integral value of
S

E(t ) .

Action direction
Forward action

E t   SV t  - PV t 

Reverse action


E t   PVt  - SVt 

PID algorithm

Control diagram: S represents the derivative action, and is defined as (Current
E(t)-previous E(t))/Sampling time. 1/S represents the integral action, and is defined as
(Previous integral value+Error value)×Sampling time. G(S) represents the plant.
T he instruction PID is inside the dotted line.

1/S

1/K I
+

+
-

1/KP

G(s)

+

S



+

KD

The symbols:
MV : Output value
E t  : Error value

Forward action E t   PV  SV

Reverse action E t   SV  PV

K P : Proportional gain

PV : Process value
SV : Target value

6-171

Ch ap te r 6 Ap plie d Instruc tions

K D : Derivative gain

K I : Integral gain
Suggestion:
1.

2.

3.

4.

Owing to the fact that the instruction PID can be used in a lot of controlled environments,
users have to choose the control function appropriately. For example, to prevent the
improper control from occurring, PID_MODE can not be used in the motor controlled
environment when it is set to 1.
When users tune the parameters KP, KI, and KD (PID_MODE is set to 0 or 2), they have to
tune the KP first (according to the experience), and then set set the KI and the KD to 0. When
users can handle the control, they can increase the KI and the KD, as illustrated in example
four below. When the KP is 100, it means that the proportional gain is 100%. That is, the error
value is increased by a factor of one. When the proportional gain is less than 100%, the error
value is decreased. When th proportional gain is larger than 100%, the error value is
increased.
To prevent the parameters which have been tuned automatically from disappearing after a
power cut, users have to store the parameters in the latched data registers when is
PID_MODE set to 1. The parameters which have been tuned automatically are not
necessarily suitable for every controlled environment. Therefore, users can modify the
parameters which have been tuned automatically. However, it is suggested that users only
modify the KI or the KD.
The instruction should be used with many parameters. To prevent the improper control from
occurring, please do not set the parameters randomly.

Example 1: The use of the instruction PID in the position control (PID_MODE is set to 0 or 2.)
Po si tio n co mma nd (SV)

PID

MV

Pla n t

En co d er

PV

Example 2: The instruction PID is used with the AC motor drives. (PID_MODE is set to 0 or 2.)
Speed c ommand (S)

+

S+MV

AC motor
driv es

+
Acc eleration/Deceler ation
output (MV)
Acc eleration/Deceler ation
command ( SV)

Speed
detec tor ( P)

PID
Actual ac celeration/
deceleration
(P V=S-P )

Example 3: The use of the instruction PID in the temperature control (PID_MODE is set to 0 or 2.)

6-172

A H 5 00 Prog r am m ing M an ua l

Heating (MV)

T emper atur e command ( SV)

PID

Actual temperature (PV)

Heater

T emper atur e
detec tor

Example 4: The steps of tuning the parameters used with the instruction PID
b
, the SV is 1, the
s+a
sampling time Ts is 10 milliseconds. It is suggested that the steps of tuning the parameters are as
follows.
Step 1: First, set the KI and the KD to 0. Next, set the KP to 5, 10, 20 and 40 successively, and record
the target values and the process values. The results are shown in the diagram below.

Suppose that the transfer function of the plant is the first-order function G(s) =

1.5
K P =40

SV= 1

K P =20

K P =10

1

K P =5
0.5

0

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

1 T ime (s ec)

Step 2: When the KP is 40, there is overreaction. Thus, the KP is not chosen. When the KP is 20, the
reaction curve of the PV is close to the SV, and there is no overreaction. However, due to
the fast start-up, the transient output value (MV) is big. The KP is not chosen, either. When
the KP is 10, the reaction curve of the PV approaches the SV smoothly. Therefore, the KP is
chosen. When the KP is 5, the reaction is slow. Thus, the KP is not chosen.
Step 3: After the KP is set to 10, increase the KI. For example, the KI is set to 1, 2, 4, and 8
successively. The KI should not be larger than the KP. Then, increase the KD. For example,
the KD is set to 0.01, 0.05, 0.1, and 0.2 successively. The KD should not be larger than ten
percent of the KP. Finally, the relation between the PV and the SV is present in the following
diagram.
1 .5

PV= SV
1

0 .5

0

K P =10,KI = 8,K D=0.2

0 .1

0 .2

0 .3

0 .4

0 .5

0 .6

0 .7

0 .8

0 .9

1

T ime (s ec)

6-173

Ch ap te r 6 Ap plie d Instruc tions
Note: The example is only for reference. Users have to tune the parameters properly according to
the practical condition of the control system.
Sample 1: Using the automatic tuning function to control the temperature
Purpose: Using the automatic tuning function to calcaulte the most appropriate parameters for the
PID temperature control
Explanation:
Due to the fact that users may not be familiar with the characteristics of the temperature
environment which is controlled for the first time, they can use the automatic tuning function to make
an initial adjustment (PID_MODE is set to 1). After the tuning of the parameter is complete,
PID_MODE is set to 0. The controlled environment in this sample is an oven. The program example
is as below.

The experimental result of the automatic tuning function is shown below.

6-174

A H 5 00 Prog r am m ing M an ua l

The experimental result of using the parameters which have been tuned to control the
temperature is shown below.

As the diagam above shows, after the parameters are tuned automatically, users can get a good
temperature control result. It only takes about twenty minutes to control the temperature. When the
target temperature changes from 80°C to 100°C, the result is as below.

6-175

Ch ap te r 6 Ap plie d Instruc tions

As the diagam above shows, when the target temperature changes from 80°C to 100°C, the
parameters tuned previously still can be used to control the temperature. Besides, it does not take
much time to control the temperature.

6-176

A H 5 00 Prog r am m ing M an ua l

6.9 Logic Instructions
6.9.1 List of Logic Instructions

0800
0801
0802
0803

Instruction code
16-bit
32-bit
WAND
DAND
MAND
–
WOR
DOR
MOR
–

0804

WXOR

0805

MXOR

0806

WXNR

0807

MXNR

–



0809
0810
0811
0812
0813
0814
0815
0816
0817

LD&
LD|
LD^
AND&
AND|
AND^
OR&
OR|
OR^

DLD&
DLD|
DLD^
DAND&
DAND|
DAND^
DOR&
DOR|
DOR^

–
–
–
–
–
–
–
–
–

API

DXOR
–
DXNR

Pulse
instruction








Function

Step

Page
number

Logical AND operation
Matrix AND operation
Logical OR operation
Matrix OR operation
Logical exclusive OR
operation
Matrix exclusive OR operation
Logical exclusive NOR
operation
Matrix exclusive NOR
operation
S1&S2
S1|S2
S1^S2
S1&S2
S1|S2
S1^S2
S1&S2
S1|S2
S1^S2

7
9
7
9

6-178
6-180
6-183
6-185

7

6-187

9

6-189

7

6-191

9

6-193

5
5
5
5
5
5
5
5
5

6-195
6-195
6-195
6-197
6-197
6-197
6-199
6-199
6-199

6-177

Ch ap te r 6 Ap plie d Instruc tions

6.9.2 Explanation of Logic Instructions
API
0800

Instruction code
W
D

AND

Device

X

Y

S1
S2
D









M

Operand

Function

S1, S2, D

Logical AND operation

P
S

T

C

HC

D

L

SM SR

E

PR

K




































16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

D : Operation result

Word/Double word

Explanation:
1.
2.
3.

The logical operator AND takes the binary representations in S1 and S2, and performs the
logical AND operation on each pair of corresponding bits. The operation result is stored in D.
Only the instruction DAND can use the 32-bit counter.
The result in each position is 1 if the first bit is 1 and the second bit is 1. Otherwise, the result is
0.

Example 1:
When X0.0 is ON, the logical operator AND takes the data in the 16-bit device Y0 and the 16-bit
device Y2, and performs the logical AND operation on each pair of corresponding bits. The
operation result is stored in Y4.

6-178

A H 5 00 Prog r am m ing M an ua l

Example 2:
When X0.0 is ON, the logical operator AND takes the data in the 32-bit device (Y11, Y10) and the
32-bit device (Y21, Y20), and performs the logical AND operation on each pair of corresponding bits.
The operation result is stored in (Y41, Y40).

S1

Before the instruction
is executed

b31

Y11 Y1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
S2

DA ND

Y2 1 Y2 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
After the instruction
is executed

b15
b0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

D

Y4 1 Y4 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0

0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0

6-179

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0801

MAND

P
S

Device

X

Y

S1
S2
D
n











M

Operand

Function

S1, S2, D, n

Matrix AND operation

T

C

HC

D

L

SM SR





























E



PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

-

AH

Symbol:
S1 : Matrix source 1

Word

S2 : Matrix source 2

Word

D : Operation result

Word

n : Length of the array

Word

Explanation:
1.

2.
3.

The operator AND takes the n rows of binary representations in S1 and the n rows of binary
representations in S2, and performs the matrix AND operation on each pair of corresponding
bits. The operation result is stored in D.
The result in each position is 1 if the first bit is 1 and the second bit is 1. Otherwise, the result is
0.
The operand n should be within the range between 1 and 256.

Example:
When X0.0 is ON, the operator AND takes the data in the 16-bit devices Y0~Y2 and the data in
16-bit devices Y10~Y12, and performs the matrix AND operation on each pair of corresponding bits.
The operation result is stored in the 16-bit devices Y20~Y22.

6-180

A H 5 00 Prog r am m ing M an ua l

S1

b0
b15
Y0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
Y1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1

Before the instruction
is executed

Y2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
S2

b0
b15
Y10 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
Y11 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
Y12 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

D
After the instruction
is executed

b0
b15
Y20 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
Y21 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
Y22 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0

Additional remark:

2.
3.

If S1+n-1, S2+n-1, or D+n-1 exceeds the device range, the instruction is not executed, SM0 is
ON, and the error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
Explanation of matrix instructions:

A matrix is composed of more than one 16-bit register. The number of registers in a
matrix is the length of the array n. There are 16×n bits in a matrix, and the matrix
operation is performed on one bit at a time.

The matrix instruction takes the 16×n bits in a matrix as a string of bits, rather than takes
them as values. The matrix operation is performed on one specified bit.

The matrix instruction mainly processes the one-to-many status or the many-to-many
status, such as the moving, the copying, the comparing, and the searching. It is a handy
and important applied instruction.

When the matrix instruction is executed, users need a 16-bit register to specify a certain
bit among the 16n bits in the matrix for the operation. The 16-bit register is called the
pointer, and is specified by users. The value in the register is within the range between 0
and 16n-1, and corresponds to the bit within the range between b0 and b16n-1.

The shift of the specified data, or the rotation of the specified data can be involved in the
matrix operation. Besides, the bit number decreases from the left to the right, as
illustrated below.
Left

Width: 16 bits

Right

Y0

b15 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 b0

Y1

b31 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 b16

Y2

b47 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 b32

0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

n
:
h
t
g
n
e
L

1.

Mn-1 b16n- 1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0




The width of the matrix (C) is 16 bits.
Pr represents the pointer. When the value in Pr is 15, b15 is specified.
Example: The following matrix is composed of the three 16-bit devices Y0, Y1, and Y2.
The data in Y0 is 16#AAAA, the data in Y1 is 16#5555, and the data in Y2 is
16#AAFF.

6-181

Ch ap te r 6 Ap plie d Instruc tions

C15 C14 C13 C12 C11 C10 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0 Y0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1 Y1
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1 Y2
Example: The following matrix is composed of the three 16-bit devices X 0, X 1, and X 2.
The data in X 0 is 16#37, the data in X 1 is 16#68, and the data in X 2 is 16#45.
C15 C14 C13 C12 C11 C10 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
1 X0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0 X1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1 X2

6-182

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0802

W
D

OR

Device

X

Y

S1
S2
D









M

P
S

運算元

Function

S1, S2, D

Logical OR operation

T

C

HC

D

L

SM SR

E

PR

K




































16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

D

: Operation result

Word/Double word

Explanation:
1.
2.
3.

The logical operator OR takes the binary representations in S1 and S2, and performs the logical
inclusive OR operation on each pair of corresponding bits. The operation result is stored in D.
Only the instruction DOR can use the 32-bit counter.
The result in each position is 1 if the first bit is 1, the second bit is 1, or both bits are 1.
Otherwise, the result is 0.

Example 1:
When X0.0 is ON, the logical operator OR takes the data in the 16-bit device Y0 and the 16-bit
device Y2, and performs the logical inclusive OR operation on each pair of corresponding bits. The
operation result is stored in Y4.

Before the instruction
is executed

After the instruction
is executed

S1

b0
b15
Y0 011 0 1 0 1 0 1 0 1 0 1 0 1 0 1

S2

Y2 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1

D

b0
b15
Y4 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1

6-183

Ch ap te r 6 Ap plie d Instruc tions

Example 2:
When X0.1 is ON, the logical operator OR takes the data in the 32-bit device (Y11, Y10) and the
32-bit device (Y21, Y20), and performs the logical inclusive OR operation on each pair of
corresponding bits. The operation result is stored in (Y41, Y40).

S1

Before the instruction
is executed

Y11 Y1 0
S2

Y2 1 Y2 0
After the instruction
is executed

6-184

b31
b15
b0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1
DO R

0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1

1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1

D

Y4 1 Y4 0

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0803

MOR

S1, S2, D, n

Matrix OR operation

Device X

Y











S1
S2
D
n

M

P
S

T

C

HC

D

L

SM SR





























E



PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Matrix source 1

Word

S2 : Matrix source 2

Word

D : Operation result

Word

n : Length of the array

Word

Explanation:
1.

2.
3.

The operator OR takes the n rows of binary representations in S1 and the n rows of binary
representations in S2, and performs the matrix OR operation on each pair of corresponding bits.
The operation result is stored in D.
The result in each position is 1 if the first bit is 1, the second bit is 1, or both bits are 1.
Otherwise, the result is 0.
The operand n should be within the range between 1 and 256.

Example:
When X0.0 is ON, the operator OR takes the data in the 16-bit devices Y0~Y2 and the data in 16-bit
devices Y10~Y12, and performs the matrix OR operation on each pair of corresponding bits. The
operation result is stored in the 16-bit devices Y20~Y22.

S1

b0
b15
Y0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Y1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Before the
instruc tion
is executed

Y2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
S2

MOR
b0
b15
Y10 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1
Y11 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1

After the
instruc tion
is executed

D

b0
b15
Y20 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
Y21 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
Y22 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1

Y12 0 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1

6-185

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.

If S1+n-1, S2+n-1, or D+n-1 exceeds the device range, the instruction is not executed, SM0 is
ON, and the error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-186

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0804

W
D

S1, S2, D

Logical exclusive OR operation

XOR

P

M

S

Device X

Y









S1
S2
D

T

C

HC

D

L

SM SR

E

PR

K




































16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

D : Operation result

Word/Double word

Explanation:
1.

2.
3.

The logical operator XOR takes the binary representations in S1 and S2, and performs the
logical exclusive OR operation on each pair of corresponding bits. The operation result is
stored in D.
Only the instruction DXOR can use the 32-bit counter.
The result in each position is 1 if the two bits are different, and 0 if they are the same.

Example 1:
When X0.0 is ON, the logical operator XOR takes the data in the 16-bit device Y0 and the 16-bit
device Y2, and performs the exclusive OR operation on each pair of corresponding bits. The
operation result is stored in Y4.

Before the instruction
is executed

After the i nstruction
is executed

S1

b0
b15
Y0 011 0 1 0 1 0 1 0 1 0 1 0 1 0 1

S2

Y2 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1

D

b0
b15
Y4 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0

6-187

Ch ap te r 6 Ap plie d Instruc tions

Example 2:
When X0.1 is ON, the logical operator XOR takes the data in the 32-bit device (Y11, Y10) and the
32-bit device (Y21, Y20), and performs the logical exclusive OR operation on each pair of
corresponding bits. The operation result is stored in (Y41, Y40).

6-188

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0805

MXOR

P
S

Device

X

Y

S1
S2
D
n











M

Operand

Function

S1, S2, D, n

Matrix exclusive OR operation

T

C

HC

D

L

SM SR





























E



PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Matrix source 1

Word

S2 : Matrix source 2

Word

D : Operation result

Word

n : Length of the array

Word

Explanation:
1.

2.
3.

The operator XOR takes the n rows of binary representations in S1 and the n rows of binary
representations in of S2, and performs the matrix exclusive OR operation on each pair of
corresponding bits. The operation result is stored in D.
The result in each position is 1 if the two bits are different, and 0 if they are the same.
The operand n should be within the range between 1 and 256.

Example:
When X0.0 is ON, the operator XOR takes the data in the 16-bit devices Y0~Y2 and the data in
16-bit devices Y10~Y12, and performs the matrix exclusive OR operation on each pair of
corresponding bits. The operation result is stored in the 16-bit devices Y20~Y22.

S1

b0
b15
Y0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Y1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Before the
instruc tion
is executed

Y2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
S2

MXO R

b0
b15
Y10 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1
Y11 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1

After the
instruc tion
is executed

D
b0
b15
Y20 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0
Y21 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0
Y22 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0

Y12 0 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1

Additional remark:
1.

If S1+n-1, S2+n-1, or D+n-1 exceeds the device range, the instruction is not executed, SM0 is

6-189

Ch ap te r 6 Ap plie d Instruc tions

2.

ON, and the error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-190

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

0806

W
D

S1, S2, D

Logical exclusive NOR operation

XNR

P

M

S

Device

X

Y

S1
S2
D









T

C

HC

D

L

SM SR

E

PR

K




































16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

D : Operation result

Word/Double word

Explanation:
1.

2.
3.

The logical operator XNR takes the binary representations in S1 and S2, and performs the
logical exclusive NOR operation on each pair of corresponding bits. The operation result is
stored in D.
Only the instruction DXNR can use the 32-bit counter.
The result in each position is 1 if the two bits are the same, and 0 if they are different.

Example 1:
When X0.0 is ON, the logical operator XNR takes the data in the 16-bit device Y0 and the 16-bit
device Y2, and performs the logical exclusive NOR operation on each pair of corresponding bits.
The operation result is stored in Y4.

Example 2:
When X0.0 is ON, the logical operator XNR takes the data in the 32-bit device (Y11, Y10) and the
32-bit device (Y21, Y20), and performs the logical exclusive NOR operation on each pair of
corresponding bits. The operation result is stored in (Y41, Y40).

6-191

Ch ap te r 6 Ap plie d Instruc tions

6-192

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0807

MXNR

Device

X

Y

S1
S2
D
n











M

P
S

Operand

Function

S1, S2, D, n

Matrix exclusive NOR operation

T

C

HC

D

L

SM SR





























E



PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

-

AH

Symbol:
S1 : Matrix source 1

Word

S2 : Matrix source 2

Word

D : Operation result

Word

n : Length of the array

Word

Explanation:
1.

2.
3.

The operator XNR takes the n rows of binary representations in S1 and the n rows binary
representations in of S2, and performs the matrix exclusive NOR operation on each pair of
corresponding bits. The operation result is stored in D.
The result in each position is 1 if the two bits are the same, and 0 if they are different.
The operand n should be within the range between 1 and 256.

Example:
When X0.0 is ON, the operator XNR takes the data in the 16-bit devices Y0~Y2 and the data in
16-bit devices Y10~Y12, and performs the matrix exclusive NOR operation on each pair of
corresponding bits. The operation result is stored in the 16-bit devices Y20~Y22.

S1

b0
b15
Y0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Y1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Before the
instruc ti on
is executed

Y2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
S2

MXNR

b0
b15
Y10 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1
Y11 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1

After the
instruc ti on
is executed

D
b0
b15
Y20 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1
Y21 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1
Y22 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1

Y12 0 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1

Additional remark:
1.

If S1+n-1, S2+n-1, or D+n-1 exceeds the device range, the instruction is not executed, SM0 is

6-193

Ch ap te r 6 Ap plie d Instruc tions

2.

ON, and the error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-194

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0809~
0811

D

LD#

Device X

Y







S1
S2

M

S

T

Operand

Function

S1, S2

Contact type of logical operation LD#

C

HC

D

L

SM SR

E

PR

K

























16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
-

AH

AH

Symbol:
S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

Taking LD& and DLD& for example
Explanation:
1.

The instruction is used to compare the data in S1 with that in S2. When the comparison result is
not 0, the condition of the instruction is met. When the comparison result is 0, the condition of
the instruction is not met.

2.

Only the instruction DLD# can use the 32-bit counter.

3.

The instruction LD# can be connected to the mother line directly.
API No.

4.
5.
6.

16-bit instruction

32-bit instruction

0809

LD&

DLD&

0810

LD|

DLD|

0811
LD^
&: Logical AND operation
|: Logical OR operation
^: Logical exclusive OR operation

DLD^

Comparison operation result
ON
OFF

S1&S2  0
S1&S2 0
S1|S2  0

S1^S2  0

S1|S2  0

S1^S2  0

Example:
1.
2.

3.

The logical operator AND takes the data in C0 and C1, and performs the logical AND operation
on each pair of corresponding bits. When the operation result is not 0, Y1.0 is ON.
The logical operator OR takes the data in D200 and D300, and performs the logical OR
operation on each pair of corresponding bits. When the operation result is not 0 and X1.0 is ON,
Y1.1 is ON.
The logical operator XOR takes the data in C201 and C200, and performs the logical exclusive
OR operation on each pair of corresponding bits. When the operation result is not 0, or when
X1.1 is ON, Y1.2 is ON.

6-195

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
If S1 or S2 is illegal, the condition of the instruction is not met, SM0 is ON, and the error in SR0 is
16#2003.

6-196

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0812~
0814

D

AND#

Device

X

Y

S1
S2







M

S

T

Operand

Function

S1, S2

Contact type of logical operation AND#

C

HC

D

L

SM SR

E

PR

K

























16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
-

AH

AH

Symbol:
S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

Taking AND& and DAND& for example
Explanation:
1.

The instruction is used to compare the data in S1 with that in S2. When the comparison result is
not 0, the condition of the instruction is met. When the comparison result is 0, the condition of
the instruction is not met.

2.

Only the instruction DAND# can use the 32-bit counter.

3.

The instruction AND# and the contact are connected is series.

4.
5.
6.

API No.

16-bit instruction

32-bit instruction

0812

AND&

DAND&

0813

AND|

DAND|

0814
AND^
&: Logical AND operation
|: Logical OR operation
^: Logical exclusive OR operation

DAND^

Comparison operation result
ON
OFF

S1&S2  0
S1&S2 0
S1|S  0

S1^S2  0

S1|S2  0
S1^S  0

Example:
1.

2.

3.

When X0.0 is ON, the logical operator AND takes the data in C0 and C10, and performs the
logical AND operation on each pair of corresponding bits. When the operation result is not 0,
Y1.0 is ON.
When X0.1 is OFF, the logical operator OR takes the data in D10 and D0, and performs the
logical OR operation on each pair of corresponding bits. When the operation result is not 0,
Y1.1 keeps ON.
When X0.2 is ON, the logical operator XOR takes the data in C201 and C200, and performs the
logical exclusive OR operation on each pair of corresponding bits. When the operation result is
not 0, or when X0.3 is ON, Y1.2 is ON.

6-197

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
If S1 or S2 is illegal, the condition of the instruction is not met, SM0 is ON, and the error in SR0 is
16#2003.

6-198

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

0815~
0817

D

Y







M

Function

S1, S2

OR#

Device X
S1
S2

Operand

S

T

Contact type of logical operation OR#

C

HC

D

L

SM SR

E

PR

K

























16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
-

AH

AH

Symbol:
S1 : Data source 1

Word/Double word

S2 : Data source 2

Word/Double word

Taking OR& and DOR& for example
Explanation:
1.

The instruction is used to compare the data in S1 with that in S2. When the comparison result is
not 0, the condition of the instruction is met. When the comparison result is 0, the condition of
the instruction is not met.

2.

Only the instruction DOR# can use the 32-bit counter.

3.

The instruction OR# and the contact are connected in parallel.

4.
5.
6.

API No.

16-bit instruction

32-bit instruction

0815

OR&

DOR&

0816

OR|

DOR|

0817
OR^
&: Logical AND operation
|: Logical OR operation
^: Logical exclusive OR operation

DOR^

Comparison operation result
ON
OFF

S1&S2  0
S1&S2 0
S1|S2  0

S1^S2  0

S1|S2  0

S1^S2  0

Example:
1.

2.

When X0.1 is ON, Y0.0 is ON. Besides, when the logical operator AND performs the logical
AND operation on each pair of corresponding bits in C0 and C10 and the operation result is not
0, Y0.0 is ON.
When X0.2 and X0.3 are ON, Y0.1 is ON. When the logical operator OR performs the logical
OR operation on each pair of corresponding bits in the 32-bit register (D11, D10) and the 32-bit
register (D21, D20) and the operation result is not 0, Y0.1 is ON. Besides, when the logical
operator XOR performs the logical exclusive OR operation on each pair of corresponding bits in
the 32-bit counter HC0 and the 32-bit register (D201, D200) and the operation result is not 0,
Y0.1 is ON.

6-199

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
If S1 or S2 is illegal, the condition of the instruction is not met, SM0 is ON, and the error in SR0 is
16#2003.

6-200

A H 5 00 Prog r am m ing M an ua l

6.10 Rotation Instructions
6.10.1 List of Rotation Instructions
API
0900
0901
0902
0903
0904

Instruction code
Pulse
Function
16-bit
32-bit instruction

ROR
DROR
Rotating to the right
Rotating to the right with the

RCR
DRCR
carry flag

ROL
DROL
Rotating to the left
Rotating to the left with the

RCL
DRCL
carry flag

MBR
–
Rotating the matrix bits

Step

Page
number

5

6-202

5

6-204

5

6-206

5

6-208

7

6-210

6-201

Ch ap te r 6 Ap plie d Instruc tions

6.10.2 Explanation of Rotation Instructions
API

Instruction code

0900

D

ROR

Device

X

Y

D
n







M

Operand

Function

D, n

Rotating to the right

P
S

T

C

HC

D

L

SM SR

E

PR

K























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

D : Device which is rotated

n :

Number of bits forming a
group

Word/Double word

Word/Double word

Explanation:
1.
2.
3.
4.

The values of the bits in the device specified by D are divided into groups (n bits as a group),
and these groups are rotated to the right.
Only the instruction DROR can use the 32-bit counter.
The operand n used in the 16-bit instruction should be within the range between 1 and 16. The
operand n used in the 32-bit instruction should be within the range between 1 and 32.
Generally, the pulse instructions RORP and DRORP are used.

Example:
When X0.0 is switched from OFF to ON, the values of the bits in D10 are divided into groups (four
bits as a group), and these groups are rotated to the right. (The value of the bit marked ※ is
transmitted to the carry flag SM602.)

6-202

A H 5 00 Prog r am m ing M an ua l

b 15

Carry flag
※
b0
0 1 1 1 1 0 1 1 0 1 0 0 0 1 0 1
After the rotation is ex ecuted

b0

b 15

0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0

Carry flag
0

Additional remark:
1.
2.

If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.

6-203

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0901

D

RCR

P

M

S

Device

X

Y

D
n







Operand

Function

D, n

Rotating to the right with the carry
flag

T

C

HC

D

L

SM SR

E

PR

K























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH
AH
AH
Symbol:

D : Device which is rotated

n :

Word/Double word

Number of bits forming a
group

Word/Double word

Explanation:
1.
2.
3.
4.

The values of the bits in the device specified by D are divided into groups (n bits as a group),
and these groups are rotated to the right with the carry flag SM602.
Only the 32-bit instructions can use the 32-bit counter.
The operand n used in the 16-bit instruction should be within the range between 1 and 16. The
operand n used in the 32-bit instruction should be within the range between 1 and 32.
Generally, the pulse instructions RCRP and DRCRP are used.

Example:
When X0.0 is switched from OFF to ON, the values of the bits in D10 are divided into groups (four
bits as a group), and these groups are rotated to the right with the carry flag SM602. (The value of
the bit marked ※ is transmitted to the carry flag SM602.)

b 15

※
b0
0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0
After the rotation is executed

Carry flag
0

6-204

b0

b 15

1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0

Carry flag
1

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.

If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.

6-205

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0902

D

ROL

Device

X

Y

D
n







M

Operand

Function

D, n

Rotating to the left

P
S

T

C

HC

D

L

SM SR

E

PR

K























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

D : Device which is rotated

n :

Number of bits forming a
group

Word/Double word

Word/Double word

Explanation:
1.
2.
3.
4.

The values of the bits in the device specified by D are divided into groups (n bits as a group),
and these groups are rotated to the left.
Only the 32-bit instructions can use the 32-bit counter.
The operand n used in the 16-bit instruction should be within the range between 1 and 16. The
operand n used in the 32-bit instruction should be within the range between 1 and 32.
Generally, the pulse instructions ROLP and DROLP are used.

Example:
When X0.0 is switched from OFF to ON, the values of the bits in D10 are divided into groups (four
bits as a group), and these groups are rotated to the left. (The value of the bit marked ※ is
transmitted to the carry flag SM602.)

Carry flag b 15

※
b0
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
After the rotation is executed

Carry flag
1

6-206

b0

b 15

1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.

If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.

6-207

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

0903

D

RCL

Device

X

Y

D
n







M

P
S

Function

Operand

Rotating to the left with the carry
flag

D, n
T

C

HC

D

L

SM SR

E

PR

K























16# “$”

DF



Pulse instruction 32-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

D : Device which is rotated

n :

Word/Double word

Number of bits forming a
group

Word/Double word

Explanation:
1.
2.
3.
4.

The values of the bits in the device specified by D are divided into groups (n bits as a group),
and these groups are rotated to the left with the carry flag SM602.
Only the 32-bit instructions can use the 32-bit counter.
The operand n used in the 16-bit instruction should be within the range between 1 and 16. The
operand n used in the 32-bit instruction should be within the range between 1 and 32.
Generally, the pulse instructions RCLP and DRCLP are used.

Example:
When X0.0 is switched from OFF to ON, the values of the bits in D10 are divided into groups (four
bits as a group), and these groups are rotated to the left with the carry flag SM602. (The value of the
bit marked ※ is transmitted to the carry flag SM602.)

Carry flag

b 15

0

※
b0
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
After the r otation is ex ec uted

b0

b 15

1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1

6-208

Carry flag
1

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.

If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.

6-209

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

0904

MBR

S, D, n

Rotating the matrix bits

Device

X

Y

S
D
n









M

P
S

T

C









HC

D

L

SM SR











E



PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

-

AH

Symbol:
S : Matrix source

Word

D : Operation result

Word

n : Length of the array

Word

Explanation:
1.

2.
3.

The values of the n rows of bits in S are rotated to the right or to the left. When SM616 is OFF,
the values of the bits are rotated to the left. When SM616 is ON, the values of the bits are
rotated to the right. The vacancy resulting from the rotation is filled by the value of the bit
rotated last, and the operation result is stored in D. The value of the bit rotated last not only fills
the vacancy, but also is transmitted to the carry flag SM614.
The operand n should be within the range between 1 and 256.
Generally, the pulse instruction MBRP is used.

Example 1:
When X0.0 is ON, SM616 is OFF. The values of the bits in the 16-bit registers D0~D2 are rotated to
the left, and the operation result is stored in the 16-bit registers D20~D22. The value of the bit
marked ※ is transmitted to the carry flag SM614.

6-210

A H 5 00 Prog r am m ing M an ua l

S

Before the rotation
is executed

b15
b0
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 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

Carry flag

S M614

※

D0
D1
D2

After MB R is executed

D

SM616=0
After the rotation
to the left is executed

b15

b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Carry flag 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
S M614
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1

D20
D21
D22

Example 2:
When X0.0 is ON, SM616 is ON. The values of the bits in the 16-bit registers D0~D2 are rotated to
the right, and the operation result is stored in the 16-bit registers D20~D22. The value of the bit
marked ※ is transmitted to the carry flag SM614.

Before the rotation
is executed

S
D0
D1
D2

b15
※ b0
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 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

Carry flag

SM614

MBR
SM616=0
After the rotation
to the left is exec uted

D

b15
D20
D21
D22

b0
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
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Carry flag

0
SM614

Additional remark:
1.
2.
3.

If S+n-1 or D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
The flags:
SM614: It is the carry flag for the matrix rotation/shift/output.
SM616: It is the direction flag for the matrix rotation/shift.

6 - 2 11

Ch ap te r 6 Ap plie d Instruc tions

6.11 Basic Instructions
6.11.1 List of Basic Instructions
API

Instruction code
16-bit
32-bit

1000

RST

1001
1002
1003
1004

TMR
TMRH
CNT
–

6-212

–
–
–
–
DCNT

Pulse
instruction
–
–
–
–
–

Function
Resetting the contact or
clearing the register
16-bit timer
16-bit timer
16-bit counter
32-bit counter

Step

Page
number

3

6-213

5
5
5
5

6-214
6-215
6-217
6-218

A H 5 00 Prog r am m ing M an ua l

6.11.2 Explanation of Basic Instructions
API

Instruction code

Operand

1000

RST

D

Function
Resetting the contact or
clearing the register

Device

X

Y

M

S

T

C

HC

D

L

SM SR

E

PR

D



























K

16#

“$”

DF

Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
-

AH

D :Device which is reset

Bit/Word

-

Symbol:

Explanation:
1.

2.
3.

When the instruction RST is driven, the action of the device specified is as follows.
Device
status
Bit
The coil and the contact are set to OFF.
The timer and the counter are reset to 0, and the coil and the contact are set
T, C, and HC
to OFF.
Word
The value is cleared to 0.
If the instruction RST is not executed, the status of the device specified is unchanged.
The instruction supports the direct output.

Example:
When X0.0 is ON, Y0.5 is set to OFF.

6-213

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

1001

TMR

S1, S2

16-bit timer

Device
S1
S2

X

Y

M

S

T

C

HC

D

L

SM SR







E

PR

K





16# “$”

DF








Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
-

AH

Symbol:
S2 : Timer number

Word

S2 : Setting value of the timer

Word

Explanation:
Please refer to the explanation of the instruction TMRH for more information.

6-214

-

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1002

TMRH

S1, S2

16-bit timer

Device

X

Y

M

S

T

C

HC

D

L

SM SR







E

PR

K





16# “$”

DF

○

S1
S2







Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Timer number

Word

S2 : Setting value of the timer

Word

Explanation:
1.
2.
3.
4.
5.

6.
7.
8.
9.

The timer used in the instruction TMR takes 100 milliseconds as the timing unit, and the timer
used in the instruction TMRH takes 1 millisecond as the timing unit.
The timers for the subroutine’s exclusive use are T1920~T2047.
The values of the timers used in TMR and TMRH should be within the range between 0 and
32767.
If the same timer is used repeatedly in the program, including in the different instructions TMR
and TMRH, the setting value is the one that the value of the timer matches first.
As long as users add the letter S in front of the device T, the timer used in the instruction TMR
becomes the accumulative timer. When the conditional contact is OFF, the accumulative timer
value is not reset. When the conditional contact is ON, the timer counts from the current value.
If the same timer is used repeatedly in the program, it is OFF when one of the conditional
contacts is OFF.
If the same timer is used repeatedly as the timer for the subroutine’s exclusive use and the
accumulative timer in the program, it is OFF when one of the conditional contacts is OFF.
When the timer is switched from ON to OFF and the conditional contact is ON, the timer is
reset and counts again.
When the instruction TMR is executed, the specified timer coil is ON and the timer begins to
count. As the value of the timer matches the setting value, the state of the contact is as follows.
Normally open (NO) contact
ON
Normally closed (NC) contact
OFF

Example 1:
When X0.0 is ON, the setting value 50 is loaded to the timer T0. When the value of T0 matches 50,
the contact of T0 is ON.

Example 2:
When X0.0 is ON, the setting value 50 is loaded to the timer T0. When the value of T0 is 25 and

6-215

Ch ap te r 6 Ap plie d Instruc tions
X0.0 is switched from OFF to ON, T0 counts up from 25 to 50, and the contact of T0 is ON.

Example 3:
When X0.0 is ON, the setting value 1000 is loaded to the timer T5. When the value of T5 ,matches
1000, the contact of T5 is ON.

Example 4:
When X0.0 is ON, the setting value 1000 is loaded to the timer T5. When the value of T5 is 500 and
X0.0 is switched from OFF to ON, T0 counts up from 50 to 1000, and the contact of T5 is ON.

6-216

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1003

CNT

S1, S2

16-bit counter

Device X

Y

M

S

T

C

HC

D

L

SM SR







E

PR

K





16# “$”

DF



S1
S2







Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Counter number

Word

S2 : Setting value of the counter

Word

Explanation:
1.

2.

When the instruction CNT is executed, the coil of the counter is ON, and the value of the
counter increases by one. When the value of the counter matches the setting value, the state
of the contact is as follows.
Normally open (NO) contact
ON
Normally closed (NC) contact
OFF
After the value of the counter matches the setting value, if there is still a pulse input signal of
the counter, the state of the contact and the value of the counter remain unchanged. If users
want to clear the value of the counter, they can use the instruction RST.

Example:
When SM408 is ON for the first time, the setting value 10 is loaded to the counter C0, and C0 begins
to count. After SM408 is switched from OFF to ON ten times, the value of C0 is 10, and the contact
of C0 is ON.
After the contact of C0 is ON, the value of C0 does not increase although SM408 still truns from
OFF to ON.

6-217

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1004
Device

Operand

Function

S1, S2

32-bit counter

DCNT
X

Y

M

S

T

C

HC

D

L

SM SR







E

PR

K





16# “$”

DF



S1
S2







Pulse instruction 16-bit instruction 32-bit instruction (5 steps)
-

AH

Symbol:
S1 : Counter value

Double word

S2 : Setting value of the counter

Double word

Explanation:
1.
2.

3.

The instruction DCNT can be used to enable the 32-bit counter within the range between HC0
and HC63.
When the instruction DCNT is executed, the switch between the 32-bit general-purpose
addition counters and the 32-bit general-purpose subtraction counters depends on states of
the special auxiliary relays SM621~SM684.
When the instruction DCNT is not executed, the counter stops counting, and the original value
of the counter is not cleared. Users can use the instruction RST to clear the value of the
counter and reset the contact.

Example:
When the PLC runs, SM621 is OFF, and the value of HC0 is cleared. When SM408 is ON for the
first time, the setting value 10 is loaded to HC0, and HC0 begins to count up.
After SM408 is switched from OFF to ON ten times, the value of HC0 is 10, and the contact of HC0
is ON.
After HC0 is ON, the value of HC0 keeps increasing because SM408 is still switched from OFF to
ON.
When the value of HC0 is 20, SM621 is ON. After SM408 is switched from OFF to ON ten times, the
contact of HC0 is OFF.
After the contact of HC0 is OFF, the value of HC0 keeps decreasing because SM408 is still switched
from OFF to ON.

6-218

A H 5 00 Prog r am m ing M an ua l

Additional remark:
Please refer to the usage of 32-bit counters in chapter 2 for more information related to
SM621~SM684.

6-219

Ch ap te r 6 Ap plie d Instruc tions

6.12 Shift Instructions
6.12.1 The List of Shift Instructions
API

Instruction code
Pulse
16-bit
32-bit instruction

1100

SFTR

–



1101

SFTL

–



1102

WSFR

–



1103

WSFL

–



1104

SFWR

–



1105

SFRD

–



1106

SFPO

–



1107

SFDEL

–



1108

SFINS

–



1109

MBS

–



1110

SFR

–



1111

SFL

–



1112

BSFR

–



1113

BSFL

–



1114
1115

NSFR
NSFL

–
–




6-220

Function
Shifting the states of the devices
to the right
Shifting the states of the devices
to the left
Shifting the data in the word
devices to the right
Shifting the data in the word
devices to the left
Shifting the data and writing it
into the word device
Shifting the data and reading it
from the word device
Reading the latest data from the
data list
Deleting the data from the data
list
Inserting the data into the data
list
Shifting the matrix bits
Shifting the values of the bits in
the 16-bit registers by n bits to
the right
Shifting the values of the bits in
the 16-bit registers by n bits to
the left
Shifting the states of the n bit
devices by one bit to the right
Shifting the states of the n bit
devices by one bit to the left
Shifting n registers to the right
Shifting n registers to the left

Step

Page
number

9

6-221

9

6-223

9

6-225

9

6-227

7

6-229

7

6-231

5

6-233

7

6-234

7

6-236

7

6-238

5

6-240

5

6-241

5

6-242

5

6-243

5
5

6-244
6-245

A H 5 00 Prog r am m ing M an ua l

6.12.2 Explanation of Shift Instructions
API

Instruction code

Operand

1100

SFTR

S, D, n1, n2

P

Device

X

Y

M

S

S
D
n1
n2

















T

C

HC

Function
Shifting the states of the
devices to the right

D

L

SM SR














E




PR

K









16# “$”

DF




Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

-

AH

Symbol:
S : Initial device in which the value is shifted

Bit

D : Initial device in which the value is shifted

Bit

n1 : Length of the data which is shifted

Word

n2 : Number of bits forming a group

Word

Explanation:
1.

2.
3.

The states of the n1 bit devices starting from D are divided into groups (n2 bits as a group), and
these groups are shifted to the right. The states of the n2 bit devices starting from S are shifted
to the devices starting from D to fill the vacancy.
Generally, the pulse instruction SFTRP is used.
The operand n1 should be within the range between 1 and 1024. The operand n2 should be
within the range between 1 and n1.

Example 1:
1.
2.

When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0
are divided into groups (four bits as a group), and these groups are shifted to the right.
The shift of the states of the bit devices to the right during a scan is illustrated as follows.
→ Being carried
 M3~M0

 M7~M4
 M11~M8
 M15~M12
 X0.3~X0.0

→ M3~M0
→ M7~M4
→ M11~M8
→ M15~M12

6-221

Ch ap te r 6 Ap plie d Instruc tions

F our bits as a group ar e shifted to the r ight.
X 0.3 X 0.2 X 0.1 X 0.0
5
M1 5 M1 4 M1 3 M1 2 M11 M1 0

M9

M8

4

M7

M6

M5

M4

3

M3

M2

M1

M0

2

1

Example 2:
1.
2.

When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0
are divided into groups (five bits as a group), and these groups are shifted to the right.
The shift of the states of the bit devices to the right during a scan is illustrated as follows.
 M0
→ Being carried
 M5
→ M0
 M10~M6
→ M5~M1
 M15~M11
→ M10~M6
 X0.4~X0.0
→ M15~M11

F ive bits as a group is s hifted to the right.
X 0.4 X 0.3 X 0.2 X 0.1 X 0.0
5
M1 5 M1 4 M1 3 M1 2 M11 M1 0

4

M9

M8

M7

M6

M5

3

M4

M3

M2

M1

M0

2

1

Additional remark:
1.
2.
3.

If S+n2-1 or D+n1-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
If n1 is less than 1, or if n1 is larger than 1024, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.
If n2 is less than 1, or if n2 is larger than n1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-222

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1101

SFTL

Operand

P

Device

X

Y

M

S

S
D
n1
n2

















Function
Shifting the states of the
devices to the left

S, D, n1, n2
T

C

HC

D

L

SM SR














E




PR

K









16# “$”

DF




Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Initial device in which the value is shifted

Bit

D : Initial device in which the value is shifted

Bit

n1 : Length of the data which is shifted

Word

n2 : Number of bits forming a group

Word

Explanation:
1.

2.
3.

The states of the n1 bit devices starting from D are divided into groups (n2 bits as a group), and
these groups are shifted to the left. The states of the n2 bit devices starting from S are shifted
to the devices starting from D to fill the vacancy.
Generally, the pulse instruction SFTLP is used.
The operand n1 should be within the range between 1 and 1024. The operand n2 should be
within the range between 1 and n1.

Example 1:
1.
2.

When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0
are divided into groups (four bits as a group), and these groups are shifted to the left.
The shift of the states of the bit devices to the left during a scan is illustrated as follows.
→ Being carried
 M15~M12

 M11~M8
 M7~M4
 M3~M0
 X0.3~X0.0

→ M15~M12
→ M11~M8
→ M7~M4
→ M3~M0

6-223

Ch ap te r 6 Ap plie d Instruc tions

F our bits as a group ar e shifted to the left
X 0.3 X 0.2 X 0.1 X 0.0
5

Being c arri ed

M11 M1 0

M1 5 M1 4 M1 3 M1 2

1

M9

M8

2

M7

M6

M5

M4

3

M3

M2

M1

M0

4

Example 2:
1.
2.

When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0
are divided into groups (five bits as a group), and these groups are shifted to the left.
The shift of the states of the bit devices to the left during a scan is illustrated as follows.
 M15
→ Being carried
 M10
→ M15
 M9~M5
→ M14~M10
 M4~M0
→ M9~M5
 X0.4~X0.0
→ M4~M0

F ive bits as a group ar e shifted to the left.
X 0.4 X 0.3 X 0.2 X 0.1 X 0.0
5

Being c arri ed

M1 5 M1 4 M1 3 M1 2

1

2

M11 M1 0

M9

3

M8

M7

M6

M5

M4

M3

M2

M1

M0

4

Additional remark:
1.
2.
3.

If S+n2-1 or D+n1-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
If n1 is less than 1, or if n1 is larger than 1024, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.
If n2 is less than 1, or if n2 is larger than n1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-224

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1102

WSFR

P
S

Device

X

Y

S
D
n1
n2











M

Operand

Function
Shifting the data in the word
devices to the right

S, D, n1, n2
T

C







HC

D

L

SM SR
















E

PR

K









16# “$”

DF




Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Initial device in which the value is shifted

Word

D : Initial device in which the value is shifted

Word

n1 : Length of the data which is shifted

Word

n2 : Number of bits forming a group

Word

Explanation:
1.

2.
3.

The data in the n1 word devices starting from D is divided into groups (n2 words as a group),
and these groups are shifted to the right. The data in the n2 word devices starting from S are
shifted to the devices starting from D to fill the vacancy.
Generally, the pulse instruction WSFRP is used.
The operand n1 should be within the range between 1 and 512. The operand n2 should be
within the range between 1 and n1.

Example 1:
1.
2.

When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20
is divided into groups (four words as a group), and these groups are shifted to the right.
The shift of the data in the word devices to the right during a scan is illustrated as follows.
 D23~D20
→ Being carried
 D27~D24
→ D23~D20
 D31~D28
→ D27~D24
 D35~D32
→ D31~D28
 D13~D10
→ D35~D32

6-225

Ch ap te r 6 Ap plie d Instruc tions

F our r egi ster s as a group are shifted to the r ight.
D1 3

D1 2

D11

D1 0

D3 5

D3 4

D3 3

D3 2

5
D3 1

D3 0

D2 9

4

D2 8 D2 7

D2 6

D2 5 D2 4

3

D2 3

D2 2 D2 1

Being c arri ed

D2 0

2

1

Example 2:
1.
When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20
is divided into groups (five words as a group), and these groups are shifted to the right.
2.
The shift of the data in the word devices to the right during a scan is illustrated as follows.
 D20
→ Being carried
 D25
→ D20
 D30~D26
→ D25~D21
 D35~D31
→ D30~D26
 D14~D10
→ D35~D31

F ive r egi sters as a group ar e shifter to the right.
D1 4

D1 3

D1 2

D11

D1 0

D3 5

D3 4

D3 3

D3 2

D3 1

5
D3 0

4

D2 9

D2 8 D2 7

D2 6

D2 5 D2 4

3

D2 3

D2 2 D2 1

2

Being c arri ed

D2 0

1

Additional remark:
1.
If S+n2-1 or D+n1-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
2.
If n1 is less than 1, or if n1 is larger than 512, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.
3.
If n2 is less than 1, or if n2 is larger than n1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-226

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1103

WSFL

Device

X

Y

S
D
n1
n2











M

Operand

P
S

Function
Shifting the data in the word
devices to the left

S, D, n1, n2
T

C







HC

D

L

SM SR
















E

PR

K









16# “$”

DF




Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Initial device in which the value is shifted

Word

D : Initial device in which the value is shifted

Word

n1 : Length of the data which is shifted

Word

n2 : Number of bits forming a group

Word

Explanation:
1.

2.
3.

The data in the n1 word devices starting from D is divided into groups (n2 words as a group),
and these groups are shifted to the left. The data in the n2 word devices starting from S are
shifted to the devices starting from D to fill the vacancy.
Generally, the pulse instruction WSFLP is used.
The operand n1 should be within the range between 1 and 512. The operand n2 should be
within the range between 1 and n1.

Example 1:
1.
2.

When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20
is divided into groups (four words as a group), and these groups are shifted to the left.
The shift of the data in the word devices to the left during a scan is illustrated as follows.
 D35~D32
→ Being carried
 D31~D28
→ D35~D32
 D27~D24
→ D31~D28
 D23~D20
→ D27~D24
 D13~D10
→ D23~D20

6-227

Ch ap te r 6 Ap plie d Instruc tions

F our r egi ster s as a group ar e shifted to the l eft.
D1 3

D1 2

D11

D2 3

D2 2 D2 1

D1 0
5

Being carri ed

D3 5

D3 4

D3 3

D3 2

1

D3 1

D3 0

D2 9

D2 8 D2 7

D2 6

D2 5 D2 4

4

3

2

D2 0

Example 2:
1.
2.

When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20
is divided into groups (five words as a group), and these groups are shifted to the left.
The shift of the data in the word devices to the left during a scan is illustrated as follows.
 D35
→ Being carried
 D30
→ D35
 D29~D25
→ D34~D30
 D24~D20
→ D29~D25
 D14~D10
→ D24~D20

F ive r egi sters as a group ar e shifted to the left.
D1 4

D1 3

D1 2

D11

D1 0

D2 5 D2 4

D2 3

D2 2 D2 1

D2 0

5

Being c arri ed

D3 5

1

D3 4

2

D3 3

D3 2

D3 1

D3 0

D2 9

3

D2 8 D2 7

D2 6

4

Additional remark:
1.
2.
3.

If S+n2-1 or D+n1-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
If n1 is less than 1, or if n1 is larger than 512, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.
If n2 is less than 1, or if n2 is larger than n1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-228

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1104

SFWR

P
S

Device

X

Y

S
D
n









M

Operand

Function
Shifting the data and writing it into
the word device

S, D, n
T

C







HC

D

L

SM SR

E

PR

K

16# “$”



























DF

Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Device in which the data is shifted

Word

D : Initial device

Word

n : Data length

Word

Explanation:
1.

2.
3.

The data in the n word devices starting from the device specified by D is defined as a first in,
first out data type, and the device specified by D is taken as a pointer. When the instruction is
executed, the value of the pointer increases by one, and the data in the device specified by S
is written into the device specified by the pointer. When the value of the pointer is larger than or
equal to n-1, the instruction does not process the writing of the data, and the carry flag SM602
is ON.
Generally, the pulse instruction SFWRP is used.
The operand n should be within the range between 2 and 512.

Example:
1.

2.

The value of the pointer D0 is cleared to 0 first. When X0.0 is switched from OFF to ON, the
data in D20 is written into D1, and the value in D0 becomes 1. When X0.0 is switched from
OFF to ON again, the data in D20 is written to D2, and the value in D0 becomes 2.
The data in the word device is shifted and written in the following way.

The data in D20 is written into D1.

The value in D0 becomes 1.

6-229

Ch ap te r 6 Ap plie d Instruc tions

n=10
Sourc e
D20

D9

D8

D7

D6

D5

D4

D3
D0=3

D2
2

D1
1

D0
Pointer

Additional remark:
1.
2.
3.
4.

If the value in D is less than 0, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If D+n-1 exceeds the device range, the instruction is not executed. SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 2, or if n is larger than 512, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
The instruction SFWR can be used with the instruction SFRD to write and read the data.

6-230

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1105

SFRD

Device X

Y









S
D
n

M

P
S

T

C







Operand

Function

S, D, n

Shifting the data and reading it from
the word device

HC

D

L

SM SR













E

PR

K

16# “$”










DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Initial device

Word

D : Device in which the data is shifted

Word

n : Data length

Word

Explanation:
1.

2.
3.

The data in the n word devices starting from the device specified by S is defined as a first in,
first out data type, and the device specified by S is taken as a pointer. When the instruction is
executed, the value in the device specified by S decreases by one, the data in the device
specified by S+1 is written into the device specified by D, the data in the devices specified by
S+n-1~S+2 is shifted to the right, and the data in the device specified by S+n-1 is unchanged.
When the value in the device specified by S is equal to 0, the instruction does not process the
reading of the data, and the zero flag SM600 is ON.
Generally, the pulse instruction SFRDP is used.
The operand n should be within the range between 2 and 512.

Example:
1.

2.

When X0.0 is switched from OFF to ON, the data in D21 is written into D0, the data in
D29~D22 is shifted to the right, the data in D29 is unchanged, and the value in D20 decreases
by one.
The data in the word device is shifted and read in the following way.

The data in D21 is read and shifted to D0.

The data in D29~D22 is shifted to the right.

The value in D20 decreases by one.

n=10
D0

D29

D28

D27

D26

D 25

D24

D23

D 22

D21

D 20
Pointer

T he data is read.

6-231

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.
3.
4.

If the value in S is less than 0, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 2, or if n is larger than 512, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
The instruction SFWR can be used with the instruction SFRD to write and read the data.

6-232

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1106

SFPO

Device X

Y







S
D

M

Operand

P
S

Function
Reading the latest data from the
data list

S, D
T

C







HC

D

L

SM SR










E

PR






K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Initial device

Word

D : Device in which the data is stored

Word

Explanation:
1.

2.

The device specified by S is taken as a pointer. When the instruction is executed, the data in
the device specified by the value of the pointer is written into the device specified by D and
cleared to 0, and the value in the device specified by S decreases by one. When the value in
the device specified by S is equal to 0, the instruction does not process the reading of the data,
and the zero flag SM600 is ON.
Generally, the pulse instruction SFPOP is used.

Example:
When X0.0 is ON, the data in the device specified by the value in D0 is written into D10. After the
data is shifted, the data in the device specified by the value in D0 is cleared to 0, and the value in D0
increases by one.

D
D10

S
D9

D8

D7
1000

D6

D5

D4

D3

D2

D1

D3

D2

D1

T he data is read.

D10
1000

D9

D8

D7
0

D6

D5

D4

D0
7
Pointer

D0
6
Pointer

Additional remark:
1.
2.

If the value in S is less than 0, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If S+(The value in S) exceeds the device range, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.

6-233

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1107

SFDEL

Device

X

Y

S
D
n









Operand

P

M

S

Function
Deleting the data from the data list

S, D, n
T

C









HC

D

L

SM SR













E

PR

K











16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S :Initial device

Word

D :Device in which the data is stored

Word

n :Device in which the data is deleted

Word

Explanation:
1.

2.
3.

The value in the device specified by S indicates the length of the data, and the data is in the
devices specified by S+1~S+(The value in S). When the instruction is executed, the data in the
device specified by S+n is stored in D and deleted, the data in the devices specified by
S+n+1~S+(The value in S) is shifted to the right, the data in the device specified by S+(The
value in S) is cleared to 0, and the value in the device specified by S decreases by one. When
the value in the device specified by S is equal to 0, the instruction does not process the
deleting of the data, and the zero flag SM600 is ON.
Generally, the pulse instruction SFDELP is used.
The operand n should be within the range between 1 and 32767.

Example:
Suppose the value in D0 is 9, and n is 4. When X0.0 is ON, the data in D4 is stored in D20. After the
data in D4 is deleted, the data in D5~D9 is shifted to the right, and the value in D0 decreases by
one.

D
D20

D9
4712

D8
857

D7
123

D6
100

D5
111

n=4
D4
22

S
D3
48

D2
5

D1
799

D3
48

D2
5

D1
799

T he data is deleted.

D20
22

D9

D8

D7

D6

D5

D4

0

4712

857

123

100

111

D0
9
T he length of the data

D0
8
T he length of the data

6-234

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.
3.
4.
5.

If the value in S is less than 0, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If S+n exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If S+(The value in S) exceeds the device range, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
If n is larger than the value in S, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#200B.
If n is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200B.

6-235

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1108

SFINS

P
S

Device

X

Y

S
D
n









M

Operand

Function
Inserting the data into the data list

S, D, n
T

C









HC

D

L

SM SR













E

PR

K











16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Initial device

Word

D : Data which is inserted

Word

n : Device into which the data is inserted

Word

Explanation:
1.

2.
3.

The value in the device specified by S indicates the length of the data, and the data is in the
devices specified by S+1~S+(The value in S). When the instruction is executed, the data in D
is inserted into S+n, the original data in the devices specified by S+n~S+(The value in S) is
shifted to the left, and the value in the device specified by S increases by one. When the value
in the device specified by S is equal to 32767, the instruction does not process the writing of
the data, the value in the device specified by S does not increase, and the carry flag SM602 is
ON.
Generally, the pulse instruction SFINSP is used.
The operand n should be within the range between 1 and 32767.

Example:
Suppose the value in D0 is 8, and n is 4. When X0.0 is ON, the data in D200 is inserted into D4, the
original data in D4~D8 is shifted to D5~D9, and the value in D0 increases by one.

D
D200

D8

D7

D6

D5

n=4
D4

22

4712

857

123

100

111

D3
48

D2
5

D1
799

T he length of the data

T he data is inserted.

D200
22

D9
4712

D8
857

D7
123

D6
100

D5
111

D4
22

S
D0
8

D3
48

D2
5

D1
799

D0
9
T he length of the data

6-236

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.
3.
4.
5.

If the value in S is less than 0, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If S+n exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003
If S+(The value in S)+1 exceeds the device range, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
If n is larger than the value in S, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#200B.
If n is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200B.

6-237

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

1109

MBS

P

S, D, n

Shifting the matrix bits

M

S

Device

X

Y

S
D
n









T

C

HC

D

L

SM SR























E



PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Matrix source

Word

D : Operation result

Word

n : Length of the array

Word

Explanation:
1.

2.
3.

The values of the n rows of bits in S are shifted to the right or to the left. When SM616 is OFF,
the values of the bits are shifted to the left. When SM616 is ON, the values of the bits are
shifted to the right. The vacancy resulting from the shift is filled by the state of the borrow flag
SM615, the value of the bit shifted last is transmitted to the carry flag SM614, and the
operation result is stored in D.
The operand n should be within the range between 1 and 256.
Generally, the pulse instruction MBSP is used.

Example 1:
When X0.0 is ON, SM616 is OFF. The values of the bits are shifted to the left. Suppose SM615 is
OFF. After the values of the bits in the 16-bit registers D0~D2 are shifted to the left, the operation
result is stored in the 16-bit registers D20~D22, and SM614 is ON.

6-238

A H 5 00 Prog r am m ing M an ua l

b 15

Carry flag

b0

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

D0
D1
D2

Borr ow flag
0

After the s hift

b0

b 15

Carry flag
1

D20
D21
D22

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

Borr ow flag
0

Example 2:
When X0.0 is ON, SM616 is ON. The values of the bits are shifted to the right. Suppose SM615 is
ON. After the values of the bits in the 16-bit registers D0~D2 are rotated to the right, the operation
result is stored in the 16-bit registers D20~D22, and SM614 is OFF.

b 15

b0

Carry flag

b0

Carry flag

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

D0
Borr ow flag D1
D2

After the s hift

b 15

D20
Borr ow flag D21
D22
1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0

Additional remark:
1.
2.
3.

If S+n-1 or D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
The flags:
SM614: It is the carry flag for the matrix rotation/shift/output.
SM615: It is the borrow flag for the matrix shift/output.
SM616: It is the direction flag for the matrix rotation/shift.

6-239

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1110

SFR

Device X

Y







D
n

M

P
S

T

C







Operand

Function

D, n

Shifting the values of the bits in the
16-bit registers by n bits to the right

HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D : Device involved in the shift

Word

n : Number of bits

Word

Explanation:
1.
2.
3.

The values of the bits in D are shifted by n bits to the right. The vacancies (b15~b15-n+1)
resulting from the shift is filled by 0, and the value of bn-1 is transmitted to SM602.
The operand n should be within the range between 1 and 16.
Generally, the pulse instruction SFRP is used.

Example:
When X0.0 is ON, the values of b0~b15 in D0 are shifted by 6 bits to the right, and the value of b5 is
transmitted to SM602. The values of b10~b15 are cleared to 0 after the shift.
The shift of the values of the bits to the right during a scan is illustrated as follows.
→ Being carried (The value of b5 is transmitted to SM602.)
 b5~b0

 b15~b6
0

→ b9~b0
→ b15~b10

b 15

※
b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Carry flag

After the shift

b0

b 15

0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1

Carry flag
0

Being fil led by 0

Additional remark:
If n is less than 0, or if n is larger than 16, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200B.

6-240

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1111

SFL

Device

X

Y

D
n







M

P
S

T

C







Operand

Function

D, n

Shifting the values of the bits in the
16-bit registers by n bits to the left

HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D : Device involved in the shift

Word

n : Number of bits

Word

Explanation:
1.
2.
3.

The values of the bits in D are shifted by n bits to the left. The vacancies (b0~bn-1) resulting
from the shift is filled by 0, and the value of b16-n is transmitted to SM602.
The operand n should be within the range between 1 and 16.
Generally, the pulse instruction SFLP is used.

Example:
When X0.0 is ON, the values of b0~b15 in D0 are shifted by 6 bits to the right, and the value of b10
is transmitted to SM602. The values of b0~b5 are cleared to 0 after the shift.
The shift of the values of the bits to the left during a scan is illustrated as follows.
→ Being carried (The value of b10 is transmitted to SM602.
 b15~b10

 b9~b0
0

→ b15~b6
→ b5~b0

b 15

※
b0
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

Carry flag

After the s hift

b0

b 15

1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0

Carry flag
1

Being fill ed by 0

Additional remark:
If n is less than 0, or if n is larger than 16, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200B.

6-241

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1112

BSFR

P

Device

X

Y

M

S

D
n











Operand

Function
Shifting the states of the n bit
devices by one bit to the right

D, n
T


C

HC



D

L

SM SR










E

PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D : Initial device involve in the shift

Bit

n : Data length

Word

Explanation:
1.
2.
3.

The states of the n bit devices starting from D are shifted by one bit to the right. The state of
D+n-1 is cleared to 0, and the state of D is transmitted to the carry flag SM602.
Generally, the pulse instruction BSFRP is used.
The operand n should be within the range between 1 and 1024.

Example:
When X0.0 is ON, the states of M0~M5 are shifted by one bit to the right, the state of M5 is cleared
to 0, and the state of M0 is transmitted to the carry flag SM602.

M5
0

M4
0

M3
0

M2
1

M1
0

M0
1

Carry flag

M2
0

M1
1

M0
0

Carry flag

After the shift

M5
0

M4
0

M3
0

1

Being c leared to 0

Additional remark:
1.
2.

If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 1024, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.

6-242

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1113

BSFL

P

Device X

Y

M

S











D
n

Operand

Function
Shifting the states of the n bit
devices by one bit to the left

D, n
T

C



HC



D

L

SM SR










E

PR

K








16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D : Initial device involve in the shift

Bit

n : Data length

Word

Explanation:
1.
2.
3.

The states of the n bit devices starting from D are shifted by one bit to the left. The state of D is
cleared to 0, and the state of D+n-1 is transmitted to the carry flag SM602.
Generally, the pulse instruction BSFLP is used.
The operand n should be within the range between 1 and 1024.

Example:
When X0.0 is ON, the states of M0~M5 are shifted by one bit to the left, the state of M0 is cleared to
0, and the state of M5 is transmitted to the carry flag SM602.

M5
0

M4
0

M3
0

M2
1

M1
0

M0
1

Carry flag

M0
0

Carry flag

After the s hift

M5
0

M4
0

M3
1

M2
0

M1
1

0

Being c leared to 0

Additional remark:
1.
2.

If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 1024, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.

6-243

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1114

NSFR

P
S

Device

X

Y

D
n







M

T

C







Operand

Function

D, n

Shifting n registers to the right

HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D : Initial device involve in the shift

Word

n : Data length

Word

Explanation:
1.
2.
3.

The data in the n registers starting from D is shifted to the right, and the data in D+n-1 is
cleared to 0.
Generally, the pulse instruction NSFRP is used.
The operand n should be within the range between 1 and 512.

Example:
When X0.0 is ON, the data in D1~D6 is shifted to the right, and the data in D6 is cleared to 0.

D6
D5
D4
D3
30 2235 9578 754

D2
28

D1
423

D0
11

D1
28

D0
423

After the shift

D6
0

D5
D4
D3
D2
30 2235 9578 754

Being cleared to 0

Additional remark:
1.
2.

If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 512, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-244

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1115

NSFL

P
S

Device

X

Y

D
n







M

T

C







Operand

Function

D, n

Shifting n registers to the left

HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D : Initial device involve in the shift

Word

n : Data length

Word

Explanation:
1.
2.
3.

The data in the n registers starting from D is shifted to the left, and the data in D is cleared to 0.
Generally, the pulse instruction NSFLP is used.
The operand n should be within the range between 1 and 512.

Example:
When X0.0 is ON, the data in D0~D5 is shifted to the left, and the data in D0 is cleared to 0.

D6
D5
D4
D3
30 2235 9578 754

D2
28

D1
423

D0
11

D1
11

D0
0

After the shift

D6
D5
D4
2235 9578 754

D3
28

D2
423

Being c leared to 0

Additional remark:
1.
2.

If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 512, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-245

Ch ap te r 6 Ap plie d Instruc tions

6.13 Data Processing Instructions
6.13.1 List of Data Processing Instructions

1202
1203
1204
1205
1206
1207
1208
1209

Instruction code
Pulse
Function
16-bit
32-bit instruction

SER
DSER
Searching the data
Number of bits whose states are

SUM
DSUM
ON

DECO
–
Decoder

ENCO
–
Encoder

SEGD
–
Seven-segment decoding
SORT DSORT
–
Sorting the data

ZRST
–
Resetting the zone

BON
DBON
Checking the state of the bit

MEAN DMEAN
Mean

CCD
–
Sum check

1210

ABS

1211
1212
1213

MINV
MBRD
MBWR

1214

MBC

1215
1216
1217

API
1200
1201

Step

Page
number

9

6-247

5

6-249

7
7
5
11
5
7
7
7

6-250
6-252
6-254
6-256
6-259
6-261
6-263
6-265



Absolute value

3

6-268

–
–
–
–





7
7
7

6-269
6-270
6-272

7

6-274

DIS
UNI
WSUM

–
–
DWSUM





7
7
7

6-275
6-277
6-279

1218

BSET

–



5

6-281

1219

BRST

–



5

6-282

1220

BKRST

–



5

6-283

1221

LIMIT

DLIMIT



9

6-285

1222
1223

BAND
ZONE

DBAND
DZONE




Inverting the matrix bits
Reading the matrix bit
Writing the matrix bit
Counting the bits with the value
0 or 1
Disuniting the 16-bit data
Uniting the 16-bit data
Getting the sum
Setting the bit in the word device
to ON
Resetting the bit in the word
device
Resetting the specified zone
Confining the value within the
bounds
Deadband control
Controlling the zone

9
9

6-287
6-290

6-246

DABS



A H 5 00 Prog r am m ing M an ua l

6.13.2 Explanation of Data Processing Instructions
API

Operand

Function

S1, S2, D, n

Searching the data

Instruction code

1200

D

SER

Device

X

Y

S1
S2
D
n











M

P
S

T

C

HC

D

L

SM SR

E



































PR





K

16# “$”









DF

Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
AH

AH

AH

Symbol:
S1 :

Initial device involved in the
comparison

S2 : Compared data

D :

Initial device in which the
comparison result is stored

n : Data length

Word/Double word

Word/Double word

Word/Double word

Word/Double word

Explanation:
1.

2.
3.

n singed decimal values in the registers starting from the register specified by S1 are
compared with the singed decimal value in the register specified by S2, and the comparison
results are stored in the registers D~D+4.
Device
Description
Number of equal values
D
Data number of the first equal
D+1
value
Data number of the last equal
D+2
value
Data number of the minimum
D+3
value
Data number of the maximum
D+4
value
The operand n used in the 16-bit instruction should be within the range between 1 and 256.
The operand n used in the 32-bit instruction should be within the range between 1 and 128.
Only the 32-bit instructions can use the 32-bit counter.

Example:
1.

2.

When X0.0 is ON, the values in D10~D19 are compared with the value in D0, and the
comparison results are stored in D50~D54. When the equal value does not exist, the values in
D50~D52 are 0.
The data number of the minimum value is stored in D53, and the data number of the maximum

6-247

Ch ap te r 6 Ap plie d Instruc tions
value is stored in D54. If there is more than one minimum value or maximum value, the data
number which is bigger is stored.

S1 Value

n

Compared Data
data
number
0

Result

D

Value

Description

D50

4

D51

1

Number of equal values
Data number of the first
equal value
Data number of the last
equal value
Data number of the
minimum value
Data number of the
maximum value

D10

88

D11

100

1

D12

110

2

D52

8

3

D53

7

D54

9

D13 150
D14 100
D15
D16
D17
D18
D19

300
100
5
100
500

S2
D0=100

Equal

4

Equal

5
6
7
8
9

Equal
Minimum
Equal
Maximum

Additional remark:
1.
2.
3.
4.
5.

If S1+n-1 or D+4 exceeds the device range, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If the operand n used in the 16-bit instruction is less than 1 or larger than 256, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#200B.
If the operand n used in the 32-bit instruction is less than 1 or larger than 128, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#200B.
If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [5] of WORD/INT.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [5] of DWORD/DINT.

6-248

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1201

D

SUM

P

M

S

Device

X

Y

S
D







Operand

Function
Number of bits whose states are
ON

S, D
T

C

HC

D

L

SM SR

E

PR

K



























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Destination device

Word/Double word

Explanation:
1.
2.
3.

The number of bits whose values are 1 in S is stored in D.
When the values of the bits in the source device specified by S are 0, the zero flag SM600 is
ON.
Only the 32-bit instructions can use the 32-bit counter.

Example:
When X0.0 is ON, the number of bits whose values are 1 in D0 is stored in D2.

b0

b15

0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0

D0

3

D2

Additional remark:
If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.

6-249

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1202

DECO

P

Device X

Y

M

S

T

C























S
D
n

Operand

Function

S, D, n

Decoder

HC

D

L

SM SR
















E

PR

K

16# “$”

















DF

Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source device
D:

Bit/Word

Device in which the decoded values are
stored

n : Number of bits whose values are decoded

Bit/Word
Word

Explanation:
1.
2.

3.
4.

The values of the lower n bits in the source device specified by S are decoded as the values of
the lower 2n bits in D.
When D is a bit device, n is within the range between 1 and 8. When n is 8, the values of the 8
bits is decoded as the values of the 256 bits. (Please note that the devices in which the
decoded values are stored can not be used repeatedly.)
When D is a word device, n is within the range between 1 and 4. When n is 4, the values of the
4 bits is decoded as the values of the 16 bits.
Generally, the pulse instruction DECOP is used.

Example 1:
1.
2.
3.

When Y0.0 is switched from OFF to ON, the instruction DECO decodes the values of the 3 bits
in X0.0~X0.2 as the values of the 8 bits in M100~M107.
After the values of the 3 bits in X0.0~X0.2 are added up, the value 3 is gotten. The third bit in
M10~M1007, that is, the bit in M103, is set to 1.
After the instruction DECO is executed and Y0.0 is switched OFF, the values of the 8 bits in
M100~M107 are unchanged.

X0.2 X0.1

7
0

6
0

5
0

0

1

1

4

2

1

4
0

3
3
1

2
0

1
0

0
0

M107 M106 M105 M104 M103 M102 M101 M100

6-250

A H 5 00 Prog r am m ing M an ua l

Example 2:
1.
2.
3.

When X0.0 is switched from OFF to ON, the instruction DECO decodes the values of b2~b0 in
D10 as the values of b7~b0 in D20, and the values of b15~b8 in D10 become 0.
The values of the lower 3 bits in D10 is decoded as the values of the lower 8 bits in D20. The
values of the higher 8 bits are 0.
After the instruction DECO is executed and X0.0 is switched OFF, the data in D20 is
unchanged.

b15
0

b0

D10
1

0

1

0

1

0

1

0

1

0

1

0

0

1

1

4

2

1

T he values of b15~b8
in D10 bec ome 0.
0
b15

0

0

0

0

0

0

0

7

6

5

4

3

2

1

0

0

0

0

0

1

0

0

0

D20

b0

Additional remark:
1.
2.
3.
4.

Suppose D is a bit device. If n is less than 1, or if n is larger than 8, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.
Suppose D is a word device. If n is less than 1, or if n is larger than 4, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.
Suppose S is a bit device. If S+n-1 exceeds the device range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
Suppose D is a bit device. If D+(2^n)-1 exceeds the device range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.

6-251

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1203

ENCO

P

Device

X

Y

M

S

T

C

S
D
n





















Operand

Function

S, D, n

Encoder

HC

D

L









SM SR





E

PR

K











16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source device

Bit/Word

Device in which the encoded values
are stored
Number of bits whose values are
n:
encoded

D:

Word
Word

Explanation:
1.
2.
3.
4.
5.

The values of the lower 2n bits in the source device specified by S are encoded as the values
of the lower n bits in D.
If there are many bits whose values are 1 in the source device specified by S, the first bit with
the value 1 from the left is processed.
When S is a bit device, n is within the range between 1 and 8. When n is 8, the values of the
256 bits is encoded as the values of the 8 bits.
When S is a word device, n is within the range between 1 and 4. When n is 4, the values of the
16 bits is encoded as the values of the 4 bits.
Generally, the pulse instruction ENCOP is used.

Example 1:
1.
2.

When X0.0 is switched from OFF to ON, the instruction ENCO encodes the values of the 8 bits
in M0~M7 as the values of the lower 3 bits in D0, and the values of b15~b3 in D0 become 0.
After the instruction ENCO is executed and X0.0 is switched OFF, the data in D is unchanged.

M7

M6

M5

M4

M3

M2

M1

M0

0

0

0

0

1

0

0

0

7

6

5

4

3

2

1

0

b15
0

D0
0

0

0

0

0

0

0

0

0

0

0

0

4

2

0

1

1
1
b0

T he values of b15~b3 in D0 become 0.

6-252

A H 5 00 Prog r am m ing M an ua l

Example 2:
1.

2.

When X0.0 is switched from OFF to ON, the instruction ENCO encodes the values of b0~b7 in
D10 as the values of b2~b0 in D20, and the values of b15~b3 in D20 become 0. (The values of
b8~b18 in D10 are invalid data.)
After the instruction ENCO is executed and X0.0 is switched OFF, the data in D is unchanged.

b15
0

b0

D10
1

0

1

0

1

0

1

0

0

0

0

1

0

0

0

7

6

5

4

3

2

1

0

0

0

0

0

0

1

1

T he values of b8~b18 in D10 are invalid data.
b15
0

D20
0

0

0

0

0

0

0

0

b0
T he values of b15~b3 in D20 become 0.

Additional remark:
1.
2.
3.
4.
5.

If there is no bit whose value is 1 in the source device specified by S, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
Suppose S is a bit device. If n is less than 1, or if n is larger than 8, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.
Suppose S is a word device. If n is less than 1, or if n is larger than 4, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.
Suppose S is a bit device. If S+(2^n)-1 exceeds the device range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
Suppose D is a bit device. If D+n-1 exceeds the device range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.

6-253

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1204

SEGD

P
S

Device

X

Y

S
D







M

T

C







Operand

Function

S, D

Seven-segment decoding

HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S :Source device
D:

Device in which the seven-segment data is
stored

Word
Word

Explanation:
The values of the lower 4 bits (b0~b3) in the source device specified by S are decoded as the
seven-segment data stored in D.
Example:
When X0.0 is ON, the values of b0~b3 in D0 are decoded as the seven-segment data stored in
Y0.0~Y0.15. If the data in the source device exceeds four bits, the values of the lower 4 bits are
decoded.

The relation between the seven-segment data and the bit pattern of source data is presented in the
following table.

6-254

A H 5 00 Prog r am m ing M an ua l

Hex

Bi t
pattern

Assi gnment
of s egments

Segment s tate
Dis play
B0(a) B1(b)

B2(c)

B3(d)

B4(e)

B5(f)

B6(g)

0

0000

ON

ON

ON

ON

ON

ON

O FF

1

0001

OFF

ON

ON

O FF

O FF

OFF

O FF

2

0010

ON

ON

OFF

ON

ON

O FF

ON

3

0011

ON

ON

ON

ON

O FF

O FF

ON

4

0100

O FF

ON

ON

O FF

O FF

ON

ON

5

0101

ON

OFF

ON

ON

O FF

ON

ON

6

0110

ON

OFF

ON

ON

ON

ON

ON

7

0111

f

b

ON

ON

ON

O FF

O FF

ON

O FF

8

1000

e

c

ON

ON

ON

ON

ON

ON

ON

ON

ON

ON

ON

O FF

ON

ON

a
g

d

9

1001

A

1010

ON

ON

ON

O FF

ON

ON

ON

B

1011

OFF

O FF

ON

ON

ON

ON

ON

C

1100

ON

O FF

O FF

ON

ON

ON

O FF

D

1101

O FF

ON

ON

ON

ON

O FF

ON

E

1110

ON

O FF

O FF

ON

ON

ON

ON

F

1111

ON

O FF

O FF

O FF

ON

ON

ON

6-255

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1205

D

SORT

Device

X

Y

S
m1
m2
D
n













M

S

Operand

Function

S, m1, m2, D, n

Sorting the data

T

C

HC

D

L

SM SR

E










































PR






K

16# “$”











DF

Pulse instruction 16-bit instruction (11 steps) 32-bit instruction (11 steps)
-

AH

AH

Symbol:
S :

Initial device in which the original
data is stored

Word/Double word

m1 : Number of rows of data

Word/Double word

m2 : Number of columns of data

Word/Double word

Initial device in which the sorted
data is stored
Reference value involved in the
n :
sorting of the data

D :

Word/Double word
Word/Double word

Explanation:
1.

2.

3.
4.
5.
6.
7.

The data which is sorted is stored in the m1×m2 registers starting from the register specified
by D. If S and D specify the same register, the sorted data is the same as the original data in
the register specified by S.
The operand m1 should be within the range between 1 and 32. The operand m2 should be
within the range between 1 and 6. The operand n should be within the range between 1 and
m2.
It is better that the rightmost number of the device number of the register specified by S is 0
If the value in n is altered during the execution of the instruction, the data is sorted according to
the new value.
When SM604 is OFF, the data is sorted in ascending order. When SM604 is ON, the data is
sorted in descending order.
To prevent the data from being sorted repeatedly, it is suggested that users use the pulse
instruction.
Only the 32-bit instruction can use the 32-bit counter.

Example:
1.

Suppose SM604 is OFF. When X0.0 is switched from OFF to ON, the data is sorted in
ascending order. When the sorting of the data is complete, SM603 is ON.

6-256

A H 5 00 Prog r am m ing M an ua l
2.

The data which will be sorted is shown below.
m2 columns of data
Column
Row

m1 rows of data
3.

1
Student
number

2

Column
3

4

5

Chinese

English

Math

Physics

1

(D0) 1

(D5) 90

(D10) 75

(D15) 66

(D20) 79

2

(D1) 2

(D6) 55

(D11) 65

(D16) 54

(D21) 63

3

(D2) 3

(D7) 80

(D12) 98

(D17) 89

(D22) 90

4

(D3) 4

(D8) 70

(D13) 60

(D18) 99

(D23) 50

5

(D4) 5

(D9) 95

(D14) 79

(D19) 75

(D24) 69

When the value in D100 is 3, the data is sorted as follows.
m2 columns of data
Column
Column
1
2
3
4
Student
Chinese
English
Math
number
Row

5
Physics

m1 rows of data

1

(D50) 4

(D55) 70

(D60) 60

(D65) 99

(D70) 50

2

(D51) 2

(D56) 55

(D61) 65

(D66) 54

(D71) 63

3

(D52) 1

(D57) 90

(D62) 75

(D67) 66

(D72) 79

4

(D53) 5

(D58) 95

(D63) 79

(D68) 75

(D73) 69

5

(D54) 3

(D59) 80

(D64) 98

(D69) 89

(D74) 90

6-257

Ch ap te r 6 Ap plie d Instruc tions
4.

When the value in D100 is 5, the data is sorted as follows.
m2 columns of data
Column
Column
1
2
3
4
Student
Chinese
English
Math
number
Row

5
Physics

m1 rows of data

1

(D50) 4

(D55) 70

(D60) 60

(D65) 99

(D70) 50

2

(D51) 2

(D56) 55

(D61) 65

(D66) 54

(D71) 63

3

(D52) 5

(D57) 95

(D62) 79

(D67) 75

(D72) 69

4

(D53) 1

(D58) 90

(D63) 75

(D68) 66

(D73) 79

5

(D54) 3

(D59) 80

(D64) 98

(D69) 89

(D74) 90

Additional remark:
1.
2.

If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If m1, m2, or n exceeds the range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200B.

6-258

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1206

ZRST

D1, D2

Resetting the zone

P

Device

X

Y

M

S

T

C

HC

D

L

D1
D2




























SM SR



E

PR

K

16# “$” DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D1 : Initial device which is reset

Bit/Word

D2 : Final device which is reset

Bit/Word

Explanation:
1.
2.

When the instruction is executed, the values in D1~D2 are cleared.
When the device number of D1 is larger than the device number of D2, only D2 is reset.

Example:
1.
2.
3.
4.
5.
6.

When X0.0 is ON, the auxiliary relays M300~M399 are reset to OFF.
When X1.0 is ON, the 16-bit counters C0~C127 are reset. (The values of C0~C127 are
cleared to 0, and the contact and the coil are reset to OFF.)
When X5.0 is ON, the timers T0~T127 are reset. (The values of T0~T127 are cleared to 0. and
the contact and the coil are reset to OFF.)
When X2.0 is ON, the stepping relays S0~S127 are reset to OFF.
When X3.0 is ON, the output relays Y0.0~Y1.15 are reset to OFF.
When X4.0 is ON, the 32-bit counters HC0~HC63 are reset. (The values of HC0~HC63 are
cleared to 0, and the contact and the coil are reset to OFF.)

6-259

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.

If D1 and D2 are different types of devices, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2007.
If D1 and D2 contain different formats of data, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2007.

6-260

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1207

D

Operand

Function

S, D, n

Checking the state of the bit

BON

P

M

S

T

C

HC

D

L

SM SR

E





























Device

X

Y

S
D
n















PR

K

16# “$”









DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S :Source device

D :

Word/Double word

Device in which the check result is
stored

n :Bit whose state is judged

Bit

Word/Double word

Explanation:
1.
2.
3.

The state of the nth bit in S is checked, and the result is stored in D.
The operand n used in the 16-bit instruction should be within the range between 0 and 15, and
the operand n used in the 32-bit instruction should be within the range between 0 and 31.
Only the 32-bit instructions can use the 32-bit counter.

Example:
1.

When X0.0 is ON, Y0.1 is ON if the value of the 15th bit in D0 is 1. When X0.0 is ON, Y0.1 is
OFF if the value of the 15th bit in D0 is 0.

2.

When X0.0 is switched OFF, the state of Y0.1 remains the same as that before X0.0’s being
OFF.

b0

b15

0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0

Y0.1=OF F

D0
b0

b15

1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0

Y0.1=ON

D0

6-261

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200B.

6-262

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1208

D

MEAN

P

Device X

Y

S









S
D
n

M

Operand

Function

S, D, n

Mean

T

C

HC

D

L

SM SR

























E

PR

K










16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction(7 steps)
AH

AH

AH

Symbol:
S : Initial device

D :

Word/Double word

Device in which the mean is
stored

n : Number of devices

Word/Double word

Word/Double word

Explanation:
1.
2.
3.
4.

After the values in the n devices starting from the device specified by S are added up, the
mean of the sum is stored in D.
If a remainder appears in the calculation, it is left out.
The operand n used in the 16-bit instruction should be within the range between 1 and 256,
and the operand n used in the 32-bit instruction should be within the range between 1 and 128.
Only the 32-bit instructions can use the 32-bit counter.

Example:
When X0.0 is ON, the values in the three registers starting from D0 are added up. After the values
are added up, the sum is divided by 3. The quotient is stored in D10, and the remainder is left out.

D10

(D 0+D 1+D2)/3
D0

100

D1

113

D2

125

After the instruction
is executed

D10

112

T he quotient 2 is left out.

6-263

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.

3.

If the operand n used in the 16-bit instruction is less than 1 or larger than 256, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#200B.
If the operand n used in the 32-bit instruction is less than 1 or larger than 128, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#200B.
If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-264

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1209

CCD

Device

X

Y

S
D
n









M

P
S

T

C









Operand

Function

S, D, n

Sum check

HC

D

L

SM SR













E

PR

K









16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Initial device
D:

Device in which the sum is
stored

n : Number of pieces of data

Word
Word
Word

Explanation:
1.

2.

3.

4.

In communication, the sum check is used to compare checksums on the same data on
different occasions or on different representations of the data in order to verify the data
integrity.
The 16-bit conversion mode: When SM606 is OFF, the working mode of the instruction is the
16-bit conversion mode. The n pieces of data in the registers starting from the register
specified by S (eight bits as a group) are added up. The sum is stored in the register specified
by D, and the values of the parity bits are stored in D+1.
The 8-bit conversion mode: When SM606 is ON, the working mode of the instruction is the
8-bit conversion mode. The n pieces of data in the registers starting from the register specified
by S (Eight bits forms a group, and only low eight bits are valid.) are added up. The sum is
stored in the register specified by D, and the values of the parity bits are stored in D+1.
The operand n should be within the range between 1 and 256.

Example 1:
1.
2.

When SM606 is OFF, the working mode of the instruction is the 16-bit conversion mode.
When X0.0 is ON, the six pieces of data in D0~D2 (eight bits as a group) are added up. The
sum is stored in D100, and the values of the parity bits are stored in D101.

6-265

Ch ap te r 6 Ap plie d Instruc tions

Data

S

D0 Low 100 = 0 1 1 0 0 1 0 0
D0 High 111 = 0 1 1 0 1 1 1 1
D1 Low 120 = 0 1 1 1 1 0 0 0
D1 High 202 = 1 1 0 0 1 0 1 0
D2 Low 123 = 0 1 1 1 1 0 1 1
D2 High 211 = 1 1 0 1 0 0 1 1
D100

Sum

867

D101

00 01 000 1
T he parity bit is set to 1 if the number of ones i s odd.
T he parity bit is set to 0 if the number of ones i s even.

D100 0 0

0

0

0

0

1

1

0

1

1

0

0

0

1

1

D101 0 0

0

0

0

0

0

0

0

0

0

1

0

0

0

1

Pari ty bits

Example 2:
1.
2.

When SM606 is ON, the working mode of the instruction is the 8-bit conversion mode.
When X0.0 is ON, the six pieces of data in D0~D5 (eight bits as a group) are added up. The
sum is stored in D100, and the values of the parity bits are stored in D101.

Data

S
D0 Low

100 = 0 1 1 0 0 1 0 0

D1 Low

111 = 0 1 1 0 1 1 1 1

D2 Low

120 = 0 1 1 1 1 0 0 0

D3 Low

202 = 1 1 0 0 1 0 1 0

D4 Low

123 = 0 1 1 1 1 0 1 1

D5 Low
D100

211 = 1 1 0 1 0 0 1 1
Sum

867

D101

00 01 000 1
T he parity bit is set to 1 if the number of ones is odd.
T he parity bit is set to 0 if the number of ones is even.

D100 0 0

0

0

0

0

1

1

0

1

1

0

0

0

1

1

D101 0 0

0

0

0

0

0

0

0

0

0

1

0

0

0

1

Pari ty bits

Additional remark:
1.
2.

Suppose SM606 is ON. If S+n-1 exceeds the device range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
Suppose SM606 is OFF. If S+n/2-1 exceeds the device range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.

6-266

A H 5 00 Prog r am m ing M an ua l
3.
4.

If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.

6-267

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1210

D

ABS

Device

X

Y

D





M

Operand

Function

D

Absolute value

P
S

T

C

HC

D

L

SM SR

E

PR

















K

16# “$”

DF

Pulse instruction 16-bit instruction (3 steps) 32-bit instruction (3 steps)
AH

AH

AH

Symbol:

D:

Device involved in the getting of the
absolute value

Word/Double word

Explanation:
1.
2.
3.

When the instruction ABS is executed, the absolute value of the value in the device specified
by D is gotten.
Generally, the pulse instruction ABSP is used.
Only the 32-bit instructions can use the 32-bit counter.

Example:
Suppose the value in D0 before the execution of the instruction is -1234. When X0.0 is switched
from OFF to ON, the absolute value of -1234 in D0 is gotten. That is, the value in D0 becomes 1234
after the instruction is executed.

6-268

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1211

MINV

S, D, n

Inverting the matrix bits

Device

X

Y

S
D
n









M

P
S

T

C









HC

D

L

SM SR











E



PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Matrix source

Word

D : Operation result

Word

n : Length of the array

Word

Explanation:
1.
2.

The bits in the n devices starting from the device specified by S are inverted, and the inversion
result is stored in D.
The operand n should be within the range between 1 and 256.

Example:
When X0.0 is ON, the bits in the three 16-bit registers D0~D2 are inverted, and the inversion result
is stored in the 16-bit registers D20~D22.

b0
b15
D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
After the i nstruction is executed
b0
b15
D20 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
D21 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
D22 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

Additional remark:
1.
2.

If S+n-1 or D+n-1 exceeds the device range, the instruction is not execute, SM0 is ON, and
the error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-269

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

1212

MBRD

S, n, D

Reading the matrix bit

Device

X

Y

S
n
D









M

P
S

T

C









HC

D

L

SM SR













E

PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Matrix source

Word

n : Length of the array

Word

D : Pointer

Word

Explanation:
1.

2.
3.
4.

When the instruction is executed, the state of SM613 is checked. If SM613 is ON, the value of
the pointer D is cleared to 0. The value of the bit specified by the value of the pointer D is read
into SM614. After the value of the bit is read, the state of SM612 is checked. If SM612 is ON,
the value of the pointer D increases by one.
When the value of the last bit is read, SM608 is ON, and the bit number is recorded in the
pointer D.
The operand n should be within the range between 1 and 256.
The value of the pointer is specified by users. The values range from 0 to 16n1, and
correspond to the range from b0 to b16n1. If the value of the pointer exceeds the range,
SM611 is set to 1, and the instruction is not executed.

Example:
1.
2.

Suppose SM613 is OFF and SM612 is ON when X0.0 is switched from OFF to ON.
Suppose the current value in D20 is 45. When X0.0 is switched from OFF to ON three times,
users can get the following execution results.
 The value in D20 is 46, SM614 is OFF, and SM608 is OFF.

 The value in D20 is 47, SM614 is ON, and SM608 is OFF.
 The value in D20 is 47, SM614 is OFF, and SM608 is ON.

b0
b15
D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

45

D20

6-270

Ptr

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.
3.

If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
The flags:
SM608: The matrix comparison comes to an end. When the last bits are compared,
SM608 is ON.
SM611: It is the matrix pointer error flag. When the value of the pointer exceeds the
comparison range, SM611 is ON.
SM612: It is the matrix pointer increasing flag. The current value of the pointer
increases by one.
SM613: It is the matrix pointer clearing flag. The current value of the pointer is cleared
to zero.
SM614: It is the carry flag for the matrix rotation/shift/output.

6-271

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

1213

MBWR

P

S, n, D

Writing the matrix bit

S

Device

X

Y

S
n
D









M

T

C









HC

D

L









SM SR

E




PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Matrix source

Word

n : Length of the array

Word

D : Pointer

Word

Explanation:
1.

2.
3.
4.

When the instruction is executed, the state of SM613 is checked. If SM613 is ON, the value of
the pointer D is cleared to 0. The state of SM615 is written into the bit specified by the value of
the pointer D. After the state of SM615 is written into the bit, the state of SM612 is checked. If
SM612 is ON, the value in the pointer D increases by one.
When the state of SM615 is written into the last bit, SM608 is ON, and the bit number is
recorded in the pointer D. If value of the pointer D exceeds the range, SM611 is ON.
The operand n should be within the range between 1 and 256.
The value of the pointer is specified by users. The values range from 0 to 16n1, and
correspond to the range from b0 to b16n1. If the value of the pointer exceeds the range,
SM611 is set to 1, and the instruction is not executed.

Example:
1.
2.

Suppose SM613 is OFF and SM612 is ON when X0.0 is switched from OFF to ON.
Suppose the current value in D20 is 45. When X0.0 is switched from OFF to ON one time,
users can get the execution result shown below. When the value in D20 is 45, SM615 is OFF,
and SM608 is OFF.

6-272

A H 5 00 Prog r am m ing M an ua l

b0
b15
D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

1

SM 615

D1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

45

After the instruction i s exec uted

Ptr

D20

b0
b15
D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

1

SM 615

D1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D2 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1

46

Ptr

D20

Additional remark:
1.
2.
3.

If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
The flags:
SM608: The matrix comparison comes to an end. When the last bits are compared, SM608 is
ON.
SM611: It is the matrix pointer error flag. When the value of the pointer exceeds the
comparison range, SM611 is ON.
SM612: It is the matrix pointer increasing flag. The current value of the pointer increases by
one.
SM613: It is the matrix pointer clearing flag. The current value of the pointer is cleared to zero.
SM615: It is the borrow flag for the matrix shift/output.

6-273

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1214

MBC

Device X

Y









S
n
D

M

Operand

P
S

Function
Counting the bits with the value 0
or 1

S, n, D
T

C









HC

D

L

SM SR













E

PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Matrix source

Word

n : Length of the array

Word

D : Operation result

Word

Explanation:
1.
2.
3.

The instruction is used to count the bits with the value 1 or 0 in the n devices starting from the
device specified by S. The operation result is stored in D.
When SM617 is ON, the bits with the value 1 is counted. When SM617 is OFF, the bits with the
value 0 is counted. When the operation result is 0, SM618 is ON.
The operand n should be within the range between 1 and 256.

Example:
Suppose SM617 is ON. When X0.0 is ON, the bits with the value 1 are counted, and the operation
result is stored in D20. Suppose SM617 is OFF. When X0.0 is ON, the bits with the value 0 are
counted, and the operation result is stored in D20.

b0
b15
0
D0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
SM
617
D1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1

12

D20

D2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
1

36

SM 617

D20

Additional remark:
1.
2.
3.

If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.
The flags:
SM617: The bits with the value 0 or 1 are counted.
SM618: It is ON when the matrix counting result is 0.

6-274

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1215

DIS

S, n, D

Disuniting the 16-bit data

Device

X

Y

S
n
D









M

P
S

T

C









HC

D

L

SM SR












E

PR

K









16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Data source

Word

n : Number of devices

Word

D : Operation result

Word

Explanation:
1.

The 16-bit value in the register specified by S is divided into four groups (four bits as a group),
and these groups are stored in the low four bits in every register (The registers range from D to
D+(n-1).).
b15

S

b12 b11

b8 b7

b4 b3

b15

b0

b4 b3

b0

D
D +1

n

D +2
D +3

All becomes 0. T he positions i n whcih
the data is stored.

2.

The operand n should be within the range between 1 and 4.

Example:
Suppose the value in D0 is 16#1234. When M0 is enabled, the instruction DIS is executed. The
value in D0 is divided into four groups (four bits as a group), and these groups are stored in the low
four bits in every register (The registers range from D10 to D13.).

6-275

Ch ap te r 6 Ap plie d Instruc tions

b15

D0

b12 b11

1

b8 b7

2

b4 b3

3

b4 b3

b15

b0

b0

4

4
4

All becomes 0.

D1 0

3

D11

2

D1 2

1

D1 3

T he positions in whcih
the data is stored.

Additional remark:
1.
2.

If D~D+(n-1) exceed the device range, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 4, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-276

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1216

UNI

Device

X

Y

S
n
D









P
M

S

T

C









Operand

Function

S, n, D

Uniting the 16-bit data

HC

D

L

SM SR













E

PR

K









16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Data source

Word

n : Data length

Word

D : Operation result

Word

Explanation:
1.

The 16-bit values in the registers specified by S~S+(n-1) are divided into groups (four bits as a
group), and every group which is composed of b0~b3 is stored in the register specified by D.
b4 b3

b15

b0

S
S +1
S +2
S +3

D
b15

Being i gnor ed

2.

b12 b11

b8 b7

b4 b3

b0

T he data whic h
is stored

The operand n should be within the range between 1 and 4.

Example:
Suppose the values in D0~D3 are 16#1234, 16#5678, 16#8765, and 16#4321 respectively. When
M0 is enabled, the instruction UNI is executed. The values in D0~D3 are divided into groups (four
bits as a group), and every group which is composed of b0~b3 is stored in D10.

6-277

Ch ap te r 6 Ap plie d Instruc tions

b4 b3

b15

b0

D0

1

2

3

4
8

D1

5

6

7

D2

8

7

6

5

D3

4

3

2

1

1
b15

5
b12 b11

8
b8 b7

4
b4 b3

D1 0
b0

Additional remark:
1.
2.

If S~S+(n-1) exceed the device range, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If n is less than 1, or if n is larger than 4, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200B.

6-278

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1217

D

WSUM

P

Device X

Y

S









S
n
D

M

Operand

Function

S, n, D

Getting the sum

T

C

HC

D

L

SM SR

























E

PR

K









16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S : Data source

Word/Double word

n : Data length

Word/Double word

D : Operation result

Double word/Long word

Explanation:
1.

The signed decimal values in S~S+n-1 are added up, and the sum is stored in the register
specified by D.
S
S +1
B in ar y val ue s

D +1

S +2

D

n

S +3
S +4

B in ar y val ue

S +5
S

S +1

S +3

S +2

S +5

S +4
n

B in ar y val ue s
S +7

S +6

S +9

S +8

D +1

D

D +3

D +2

B in ar y val ue

2.
3.

The operand n used in the 16-bit instruction should be within the range between 1 and 256,
and the operand n used in the 32-bit instruction should be within the range between 1 and 128.
Only the 32-bit instructions can use the 32-bit counter.

Example:
When the instruction WSUM is executed, the values in D0~D2 are added up, and the sum is stored
in D10.

6-279

Ch ap te r 6 Ap plie d Instruc tions

(D0+D1+D2)
D0

100

D1

113

D2

125

D10

After the instruction
D10
is executed

338

Additional remark:
1.
2.
3.

If n used in the 16-bit instruction is less than 1 or larger than 256, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.
If n used in the 32-bit instruction is less than 1 or larger than 128, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#200B.
If S+n-1 or D exceeds the device range, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.

6-280

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1218

BSET

P
S

Device

X

Y

D
n







M

T

C







Operand

Function

D, n

Setting the bit in the word device to
ON

HC

D

L

SM SR

E

PR

K

















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

D : Device number

Word

n : Bit number

Word

-

Symbol:

Explanation:
1.
2.

3.

The instruction is used to set the nth bit in the register specified by D to 1.
When the instruction BSET is driven, the specified bit is set to ON. No matter the instruction
BSET is still driven or not, the bit keeps ON. Users can use the instruction BRST to set the bit
OFF.
The operand n should be within the range between 0 and 15.

Example:
When X0.0 is ON, the fifth bit in D10 is set to 1.

b15

D10

b0

1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1

After the i nstruction
is executed
b15

D10

b0

1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1

Additional remark:
If n is less than 0, or if n is larger than 15, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200B.

6-281

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1219

BRST

P
S

Device

X

Y

D
n







M

T

C







Operand

Function

D, n

Resetting the bit in the word device

HC

D

L

SM SR

E

PR

K

















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

D : Device number

Word

n : Bit number

Word

-

Symbol:

Explanation:
1.
2.
3.

The instruction is used to set the nth bit in the register specified by D to 0.
When the instruction BRST is driven, the specified bit is set to OFF.
The operand n should be within the range between 0 and 15.

Example:
When X0.0 is ON, the ninth bit in D10 is set to 0.

b15

D10

b0

1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1

After the instruction
is executed
b15

D10

b0

1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1

Additional remark:
If n is less than 0, or if n is larger than 15, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200B.

6-282

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1220

BKRST

P

Device X

Y

S

T

C















D
n

M


Operand

Function

D, n

Resetting the specified zone

HC

D

L









SM SR




E

PR

K









16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
D : Device number

Bit/Word

n : Length

Word

Explanation:
1.
2.

The instruction is used to clear the values in D~D+(n-1).
The operand n should be within the range between 1 and 1024.

Example:
1.
2.
3.
4.
5.
6.

When X0.0 is ON, the auxiliary relays M300~M399 are reset to OFF.
When X0.1 is ON, the counters C0~C127 are reset. (The values of C0~C127 are cleared to 0,
and the contact and the coil are reset to OFF.)
When X0.2 is ON, the timers T0~T127 are reset. (The values of T0~T127 are cleared to 0. and
the contact and the coil are reset to OFF.)
When X0.3 is ON, the stepping relays S0~S127 are reset to OFF.
When X0.4 is ON, the output relays Y0.0~Y1.15 are reset to OFF.
When X0.5 is ON, the counters HC0~HC63 are reset. (The values of HC0~HC63 are cleared
to 0, and the contact and the coil are reset to OFF.)

6-283

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.

If D~D+(n-1) exceed the device range, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If n is less than 0, or if n is larger than 1024, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#200B.

6-284

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1221

D

LIMIT

Device

X

Y

S1
S2
S3
D











M

Operand

P
S

Function
Confining the value within the
bounds

S1, S2, S3, D
T

C

HC

D

L

SM SR

E

PR

K













































16# “$”

DF





Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
AH

AH

AH

Symbol:
S1 : Minimum output value

Word/Double word

S2 : Maximum output value

Word/Double word

S3 : Input value

Word/Double word

D : Output value

Word/Double word

Explanation:
1.

2.

The input value in S3 is compared with the minimum output value in S1 and the maximum
output value in S2, and the comparison result is stored in D.
If the minimum output value in S1 is larger than the input value in S3, the output value stored in
D is equal to the minimum output value in S1.
If the maximum output value in S2 is less than the input value in S3, the output value stored in
D is equal to the maximum output value in S2.
If the input value in S3 is within the range between the minimum output value in S1 and the
maximum output value in S2, the output value stored in D is equal to the input value in S3.
If the minimum output value in S1 is larger than the maximum output value in S2, the instruction
is not executed.
Only the 32-bit instructions can use the 32-bit counter.

Example:


When X0.0 is ON, the state of X1 is converted into the binary value, and the conversion result
is stored in D0. Besides, the value stored in D0 is compared with 500 and 5000, and the
comparison result is stored in D1.

6-285

Ch ap te r 6 Ap plie d Instruc tions

Minimum output Maximum output Output value in
value
value
D0
499
5001
500
5000
600

Function
D0<500
D0>5000
500≦D0≦5000

Output value in
D1
500
5000
600

Additional remark:
If the minimum output value in S1 is larger than the maximum output value in S2, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#2003.

6-286

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1222

D

BAND

P
S

Device

X

Y

S1
S2
S3











D

M

Operand

Function

S1, S2, S3, D

Deadband control

T

C

HC

D

L

SM SR

E

PR

K













































16# “$”

DF





Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
AH

AH

AH

Symbol:
S1 :

Minimum value of the
deadband

Word/Double word

S2 :

Maximum value of the
deadband

Word/Double word

S3 : Input value

Word/Double word

D : Output value

Word/Double word

Explanation:
1.

2.

The minimum value of the deadband in S1 or the maximum value of the deadband in S2 is
subtracted from the input value in S3, and the difference is stored in D.
If the minimum value of the deadband in S1 is larger than the input value in
S3, the minimum value of the deadband in S1 is subtracted from the input
value in S3, and the difference is stored in D.
If the maximum value of the deadband in S2 is less than the input value in S3,
the maximum value of the deadband in S2 is subtracted from the input value
in S3, and the difference is stored in D.
If the input value in S3 is within the range between the minimum of the
deadband in S1 and the maximum value of the deadband in S2, the output
value stored in D is 0.
If the minimum value of the deadband in S1 is larger than the maximum value
of the deadband in S2, the instruction is not executed.
Only the 32-bit instructions can use the 32-bit counter.

6-287

Ch ap te r 6 Ap plie d Instruc tions
3.

The figures:
BAND is not exec uted.

BAND is exec uted.
Output value

Output value

T he lower l imit value
of the deadband
Input value

Input value

T he upper li mit value
of the deadband

4.

The minimum value of the deadband in S1, the maximum value of the deadband in S2, the
input value in S3, and the output value in D should be within the range described below.

If the instruction BAND is executed, the minimum value of the deadband in S1, the
maximum value of the deadband in S2, the input value in S3, and the output value in D is
within the range between -32768 and 32767. Suppose the minimum value of the
deadband in S1 is 10 and the maximum value of the deadband in S3 is -32768. The
output value in D is calculated as follows.
Output value in D=-32768-10=16#8000-16#000A=16#7FF6=32758

If the instruction DBAND is executed, the minimum value of the deadband in S1, the
maximum value of the deadband in S2, the input value in S3, and the output value in D is
within the range between -2147483648 and 2147483647. Suppose the minimum value of
the deadband in (S1+1, S1) is 1000 and the maximum value of the deadband in (S3+1, S3)
is -2147483648. The output value in (D+1, D) is calculated as follows.
Output value in (D+1, D)
=-2147483648-1000=16#80000000-16#000003E8=16#7FFFFC18
=2147482648

Example 1:
When X0.0 is ON, -1000 or 1000 is subtracted from the binary-coded decimal value in X1, and the
difference is stored in D1.

The execution results:
Minimum
Maximum
value of the
value of the
deadband
deadband
-1000

6-288

1000

Input value in
D0

Function

Output value
in D1

-1200
1200

D0<-1000=>D1=D0-(-1000)
D0>1000=>D1=D0-1000

-200
200

500

-1000≦D0≦1000=>D0=0

0

A H 5 00 Prog r am m ing M an ua l

Example 2:
When X0.0 is ON, -10000 or 10000 is subtracted from the binary-coded decimal value in (X2, X1),
and the difference is stored in (D11, D10).

The execution results:
Minimum
Maximum
value of the
value of the
deadband
deadband

Input value in
(D1, D0)
-12000

-10000

10000

12000

5000

Function
(D1, D0)<-10000
=>(D11,D10)
=(D1, D0)-(-10000)
(D1, D0)>10000
=>(D11, D10)
=(D1, D0)-10000
-10000≦(D1, D0)≦10000

Output value in
(D11, D10)
-2000

2000

0

=>(D1, D0)=0
Additional remark:
If the minimum value of the deadband in S1 is larger than the maximum value of the deadband in S2,
the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.

6-289

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1223

D

ZONE

P
S

Device

X

Y

S1
S2
S3
D











M

Operand

Function

S1, S2, S3, D

Controlling the zone

T

C

HC

D

L


























SM SR

E

PR

K















16# “$”

DF





Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
AH

AH

AH

Symbol:
S1 : Negative deviation

Word/Double word

S2 : Positive deviation

Word/Double word

S3 : Input value

Word/Double word

D : Output value

Word/Double word

Explanation:
1.

2.

The negative deviation in S1 or the positive deviation in S2 is added to the input value in S3,
and the sum is stored in D.
If the input value in S3 is less than 0, the negative deviation in S1 is added to
the input value in S3, and the sum is stored in D.
If the input value in S3 is larger than 0, the positive deviation in S2 is added to
the input value in S3, and the sum is stored in D.
If the input value in S3 is equal to 0, the output value stored in D is 0.
The figures:
Z ONE is not ex ec uted.

Z ONE is exec uted.
Output value

Output value
Positiv e deviation

Input value

Input value

Negativ e deviation

3.
4.

Only the 32-bit instructions can use the 32-bit counter.
The negative deviation in S1, the positive deviation in S2, the input value in S3, and the output

6-290

A H 5 00 Prog r am m ing M an ua l
value in D should be within the range described below.

If the instruction ZONE is executed, the negative deviation in S1, the positive deviation in
S2, the input value in S3, and the output value in D is within the range between -32768
and 32767. Suppose the negative deviation in S1 is -100 and the input value in S3 is
-32768. The output value in D is calculated as follows.
Output value in D=(-32768)+(-100)=16#8000+16#FF9C=16#7F9C=32668

If the instruction DZONE is executed, the negative deviation in S1, the positive deviation
in S2, the input value in S3, and the output value in D is within the range between
-2147483648 and 2147483647. Suppose the negative deviation in (S1+1, S1) is -1000
and the input value in (S3+1, S3) is -2147483648. The output value in (D+1, D) is
calculated as follows.
Output value in (D+1, D)
=-2147483648+(-1000)=16#80000000+16#FFFFFC18=16#7FFFFC18=2147482648
Example 1:
When X0.0 is ON, -100 or 100 is added to the binary-coded decimal value in X1, and the sum is
stored in D10.

The execution results:
Negative
Positive
deviation
deviation
-100

100

Input value in
D0
-10
0
50

Function
D0<0=>D10=(-10)+(-100)
D0=0=>D10=0
D0>0=>D10=50+100

Output value in
D10
-110
0
150

Example 2:
When X0.0 is ON, -10000 or 10000 is added to the binary-coded decimal value in (X2, X1), and the
sum is stored in (D11, D10).

6-291

Ch ap te r 6 Ap plie d Instruc tions

Negative
deviation

Positive
deviation

Input value in
(D1, D0)
-10

-10000

10000

0
50

6-292

Function
(D1, D0)<0
=>(D11, D10)
=(-10)+(-10000)
(D1, D0)=0
=>(D11, D10)=0
(D1, D0)>0
=>(D11, D10)=50+10000

Output value in
(D11, D10)
-10010
0
10050

A H 5 00 Prog r am m ing M an ua l

6.14 Structure Creation Instructions
6.14.1 List of Structure Creation Instructions
API
1300
1301
1302

Instruction code
16-bit
32-bit
FOR
–
NEXT
–
BREAK
–

Pulse
instruction

Function

Step

Page
number

–
–


Start of the nested loop
End of the nested loop
Terminating the FOR-NEXT loop

3
1
5

6-294
6-295
6-299

6-293

Ch ap te r 6 Ap plie d Instruc tions

6.14.2 Explanation of Structure Creation Instructions
API

Instruction code

Operand

Function

1300

FOR

S

Start of the nested loop

Device

X

Y

S





M

S

T

C





HC

D

L

SM SR

E

PR

K













16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
-

-

AH

Symbol:

S

6-294

:

Number of times the loop is executed
repeatedly

Word

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1301

NEXT

-

End of the nested loop

Pulse instruction 16-bit instruction (1 step) 32-bit instruction
-

AH

-

Symbol:

Explanation:
1.

2.
3.
4.

5.

The program between FOR and NEXT is executed N times. After the program between FOR
and NEXT is executed N times, the program follows NEXT is executed. The instruction FOR
specifies the number of times the program between FOR and NEXT is executed.
N should be within the range between 1 and 32,767. If N is less than 1, it is count as 1.
If the program between FOR and NEXT is not executed, it can be skipped by the use of the
instruction CJ.
The following conditions result in errors.

The instruction NEXT is prior to the instruction FOR.

The instruction FOR exists, but the instruction NEXT does not exist.

The instruction NEXT follows the instruction FEND or END.

The number of times the instruction FOR is used is different from the number of times the
instruction NEXT is used.
FOR/NEXT supports the nested program structure. There are at most 32 levels of nested
program structures. If the loop is executed many times, it takes more time for the program in
the PLC to be scanned, and the watchdog timer error will occur. Users can use the instruction
WDT to resolve the problem.

Example 1:
After program A is executed three times, the program follows the instruction NEXT is executed.
Program B is executed four times every time program is executed. Therefore, program B is
executed twelve times in total.

6-295

Ch ap te r 6 Ap plie d Instruc tions

Example 2:
When X0.0 is OFF, the program between FOR and NEXT is executed. When X0.0 is ON, the
instruction CJ is executed. The execution of the program jumps to LABEL 1:, i.e. network 6, and
network 4~network 5 are not executed.

Example 3:
If the program between FOR and NEXT is not executed, it can be skipped by the use of the
instruction CJ. When X0.1 in network 8 is ON, the instruction CJ is executed. The execution of the
program jumps to LABEL 1:, i.e. network 12, and network 9~network 11 are not executed.

6-296

A H 5 00 Prog r am m ing M an ua l

6-297

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
Please refer to ISPSoft User Manual for more information related to the usage of the label.

6-298

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1302

BREAK

Device

X

Y

D
P





M

Operand

Function

D, P

Terminating the FOR-NEXT loop

P
S

T

C





HC

D

L

SM SR

E

PR











K

16# “$”

DF

Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

-

Symbol:
Device in which the remaining
D : number of times the loop can be
executed is stored

Word

P : Pointer

Pointer

Explanation:
1.

2.

The instruction BREAK is used to terminate the FOR/NEXT loop. The remaining number of
times the FOR/NEXT loop can be repeated is stored in D, and the execution of the program
jumps to the part of program specified by the pointer
When the instruction BREAK is executed, the remaining number of times the FOR/NEXT loop
can be repeated is stored in D, including this time the instruction BREAK is executed.

Example:
When the FOR/NEXT loop is executed, 1 is added to the value in D0. When the value in D0 is equal
to 30, the FOR/NEXT loop is terminated, and the remaining number of times the FOR/NEXT loop
can be repeated, i.e. 71, is stored in D10. The execution of the program jumps to LABEL 1:, i.e.
network 6, and 1 is added to the value in D2.

6-299

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

2.
3.

If the part of the program specified by the pointer in the instruction BREAK does not exist, the
operation error occurs, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2004.
If the instruction BREAK is outside the FOR/NEXT loop, the operation error occurs, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2017.
Please refer to ISPSoft User Manual for more information related to the usage of the label.

6-300

A H 5 00 Prog r am m ing M an ua l

6.15 Module Instructions
6.15.1 List of Module Instructions
API

Instruction code
Pulse
16-bit
32-bit instruction

1400

FROM

DFROM



1401

TO

DTO



Function
Reading the data from the
control register in the special
module
Writing the data into the control
register in the special module

Step

Page
number

13

6-302

13

6-304

6-301

Ch ap te r 6 Ap plie d Instruc tions

6.15.2 Explanation of Module Instructions
API
1400

D

FROM

Device

X

Y















m1
m2
m3

D1
D2
n

Operand

Function

m1, m2, m3, D1, D2, n

Reading the data from the control
register in the special module

Instruction code

M

P
S

T

C

HC

D

L




































SM SR

E

PR

K

16# “$”




















DF

Pulse instruction 16-bit instruction (13 steps) 32-bit instruction (13 steps)
AH

AH

AH

Symbol:
m1 : Rack code

Word/Double word

m2 : Slot code

Word/Double word

m3 : Control register number

Word/Double word

D1 :

Device in which the data is
stored

Word/Double word

D2 :

Device in which the error
code is stored

Word/Double word

n : Data length

Word/Double word

Explanation:
1.
2.
3.

4.
5.
6.
7.
8.
9.

Users can use this instruction to read the data from the control register in the special module
into the AH500 series PLC.
The operand m1 should be within the range between 1 and 8. 1 represents a main rack, and
2~8 represent extension racks.
The operand m2 should be within the range between 0 and 11. If the rack code is 1, the slot
code should be within the range between 0 and 11. If the rack code is within the range
between 2 and 8, the slot code should be within the range between 0 and 7.
The operand m3 specifies the control register number.
When the instruction FROM is executed, D2 is set to 0. When an error occurs, D2 is not set to 0.
Please refer to the additional remark below for more information about the error codes.
The operand n used in the 16-bit instruction should be within the range between 1 and 256,
and the operand n used in the 32-bit instruction should be within the range between 1 and 128.
Only the 32-bit instructions can use the 32-bit counter.
Please refer to the regulation of the operands in the instruction TO for more information about
the numbering of the special modules.
Special modules include analog I/O modules, network I/O modules, and position I/O modules.

Example:
Suppose the first special module at the right side of the CPU module is AH10SCM-A5. When X0.0 is

6-302

A H 5 00 Prog r am m ing M an ua l
switched from OFF to ON, the instruction FROM is executed. The mode of the data exchange
through COM1 on AH10SCM-5A stored in CR#7 is read into D100. Owing to the fact that no error
occurs, the code stored in D110 is 16#0000.

The use of the parameters:






The module is placed on the main rack. Therefore, the rack code stored in D40 is 16#0001.
The module is inserted in the first slot. Therefore, the slot code stored in D41 is 16#0000.
The mode of the data exchange through COM1 is stored in CR#7. Therefore, the control
register number stored in D42 is 16#0007.
Owing to the fact that the mode of the data exchange through COM1 occupies one register,
the value in D43 is 1.
The data which is read from CR#7 is stored in D100.

Additional remark:
1.
2.
3.
4.
5.

If the values in m1 and m2 exceed the range, the operation error occurs, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If D1~D1+n-1 exceed the device range, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If the value in n exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#200B.
Due to the fact that the use of the instruction FROM decreases the execution efficiency of the
CPU module and that of the I/O module, users should use it less often.
The descriptions of the error codes:
Error code
Description
Please refer to point 1 and point 2 in the
16#2003
additional remark.
Please refer to point 3 in the additional
16#200B
remark.
An error occurs when the data is accessed
16#1400
through the auxiliary processor.
An error occurs when the data in the I/O
16#1401
module is accessed.
The arrangement of the I/O modules is not
16#1402
consistent with the module table.
A communication error occurs when the
16#1407
data is accessed through the auxiliary
processor.

6-303

Ch ap te r 6 Ap plie d Instruc tions

Instruction
code

API
1401

D

TO

Device

X

Y

m1



m2



m3
S
D
n

M

Operand
P
S

Function
Writing the data into the control
register in the special module

m1, m2, m3, S, D, n
T

C

HC

D

L



















































SM SR

E

PR

K

16# “$”















































DF

Pulse instruction 16-bit instruction (13 steps) 32-bit instruction (13 steps)
AH

AH

AH

Symbol:
m1 : Rack code

Word/Double word

m2 : Slot code

Word/Double word

m3 : Control register number

Word/Double word

S :

Data which is written into the
Word/Double word
control register

D :

Device in which the error
code is stored

n : Data length

Word/Double word
Word/Double word

Explanation:
1.
2.
3.

4.
5.
6.
7.
8.
9.

6-304

Users can use this instruction to write the data in the AH500 series PLC into the control
register in the special module.
The operand m1 should be within the range between 1 and 8. 1 represents a main rack, and
2~8 represent extension racks.
The operand m2 should be within the range between 0 and 11. If the rack code is 1, the slot
code should be within the range between 0 and 11. If the rack code is within the range
between 2 and 8, the slot code should be within the range between 0 and 7.
The operand m3 specifies the control register number.
When the instruction TO is executed, D is set to 0. When an error occurs, D is not set to 0.
Please refer to the additional remark below for more information about the error codes.
The operand n used in the 16-bit instruction should be within the range between 1 and 256,
and the operand n used in the 32-bit instruction should be within the range between 1 and 128.
Only the 32-bit instructions can use the 32-bit counter.
Special modules include analog I/O modules, network I/O modules, and position I/O modules.
When S is a decimal value or a hexadecimal value, n decimal values or n hexadecimal values
are transmitted to the I/O module. Suppose S is 16#0001 and n is 3. Three 16#0001s are
transmitted to the I/O module.

A H 5 00 Prog r am m ing M an ua l

Example:
Suppose the first special module at the right side of the CPU module is AH10SCM-A5. When X1.1 is
switched from OFF to ON, the instruction TO is executed. The mode of the data exchange through
COM1 on AH10SCM-5A stored in CR#7 changes from being disabled to being enabled. Owing to
the fact that no error occurs, the code stored in D110 is 16#0000.

The use of the parameters:






The module is placed on the main rack. Therefore, the rack code stored in D40 is 16#0001.
The module is inserted in the first slot. Therefore, the slot code stored in D41 is 16#0000.
The mode of the data exchange through COM1 is stored in CR#7. Therefore, the control
register number stored in D42 is 16#0007.
Owing to the fact that the mode of the data exchange through COM1 occupies one register,
the value in D2 is 1.
The data which is written into CR#7 is stored in D100. Therefore, the value in D100 is
16#0002.

The regulation of the operands in the instruction:








The operand m1 specifies the rack code. It should be within the range between 1 and 8. 1
represents a main rack, and 2~8 represent extension racks.
The operand m2 specifies the slot code. It should be within the range between 0 and 11. If the
rack code is 1, the slot code should be within the range between 0 and 11. If the rack code is
within the range between 2 and 8, the slot code should be within the range between 0 and 7.
The operand m3 specifies the control register number. The 16-bit memories built in the special
modules are called the control registers. The control register numbers are decimal numbers
#0~#N, and the number of control registers varies with the module. The operating conditions of
the special module and the setting values are stored in the control registers.
At most 68 special modules can be placed on the rack, and they do not occupy inputs/outputs.
If the instruction FROM/TO is used, one control register is taken as a unit for the
reading/writing of the data. If the instruction DFROM/DTO is used, two control registers are
taken as a unit for the reading/writing of the data.

6-305

Ch ap te r 6 Ap plie d Instruc tions



The n which is 2 in the 16-bit instruction has the same meaning as the n which is 1 in the 32-bit
instruction.
Specified
device

Specified
control register

Specified
device

Specified
control register

D0

CR #5

D0

CR #5

D1

CR #6

D1

CR #6

D2

CR #7

D2

CR #7

D3
D4

CR #8
CR #9

D3
D4

CR #8
CR #9

D5

CR #10

D5

CR #10

16 - bit instruction: n= 6

32-bit i ns tr uction: n=3

Additional remark:
1. If the values in m1 and m2 exceed the range, the operation error occurs, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. If S~S+n-1 exceed the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
3. If the value in n exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#200B.
4. Due to the fact that the use of the instruction TO decreases the execution efficiency of the CPU
module and that of the I/O module, users should use it less often.
5. The descriptions of the error codes:
Error code
Description
Please refer to point 1 and point 2 in the
16#2003
additional remark.
Please refer to point 3 in the additional
16#200B
remark.
An error occurs when the data is
16#1400
accessed through the auxiliary
processor.
An error occurs when the data in the I/O
16#1401
module is accessed.
The arrangement of the I/O modules is
16#1402
not consistent with the module table.
A communication error occurs when the
16#1407
data is accessed through the auxiliary
processor.

6-306

A H 5 00 Prog r am m ing M an ua l

6.16 Floating-point Number Instructions
6.16.1 List of Floating-point Number Instructions
API
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516

Instruction code
Pulse
Function
16-bit
32-bit instruction

–
FSIN
Sine of the floating-point number
Cosine of the floating-point

–
FCOS
number
Tangent of the floating-point

–
FTAN
number
Arcsine of the floating-point

–
FASIN
number
Arccosine of the floating-point

–
FACOS
number
Arctangent of the floating-point

–
FATAN
number
Hyperbolic sine of the

–
FSINH
floating-point number
Hyperbolic cosine of the

–
FCOSH
floating-point number
Hyperbolic tangent of the

–
FTANH
floating-point number
Converting the degree to the

–
FRAD
radian
Converting the radian to the

–
FDEG
degree

SQR
DSQR
Square root of the binary number
Square root of the floating-point

–
FSQR
number
Exponent of the floating-point

–
FEXP
number
Logarithm of the floating-point

–
FLOG
number
Natural logarithm of the binary

–
FLN
floating-point number
Power of the floating-point

–
FPOW
number

1517

RAND

1518

BSQR



Random number

DBSQR



Square root of the binary-coded
decimal number
Sine of the binary-coded decimal
number
Cosine of the binary-coded
decimal number
Tangent of the binary-coded
decimal number
Arcsine of the binary-coded
decimal number
Arccosine of the binary-coded
decimal number
Arctangent e of the binary-coded
decimal number

–

1519

–

BSIN



1520

–

BCOS



1521

–

BTAN



1522

–

BASIN



1523

–

BACOS



1524

–

BATAN



Step

Page
number

5-6

6-308

5-6

6-310

5-6

6-312

5-6

6-314

5-6

6-316

5-6

6-318

5-6

6-320

5-6

6-321

5-6

6-322

5-6

6-323

5-6

6-324

5

6-325

5-6

6-326

5-6

6-327

7-9

6-328

5-6

6-330

7-9

6-331

7

6-333

5

6-334

5

6-336

5

6-338

5

6-340

5

6-342

5

6-344

5

6-346

6-307

Ch ap te r 6 Ap plie d Instruc tions

6.16.2 Explanation of Floating-point Number Instructions
API

Instruction code

Operand

1500

FSIN

S, D

Device

X

Y

S
D







M

P
S

Function
Sine of the floating-point
number

T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Sine value

Double word

Explanation:
1.

Whether the source value specified by S is a radian or a degree depends on the state of
SM695.

2.

If SM695 is OFF, the source value specified by S is a radian. Radian=Degree×π/180.

3.

If SM695 is ON, the source value specified by S is a degree.
Degree=Radian×180/π. (0o≦Degree≦3600)

4.
5.
6.

If the conversion result is 0, SM600 is ON.
The sine of the source value specified by S is stored in the register specified by D.
The relation between radians and sine values are shown below.

Example:
When X0.0 is ON, the binary-coded decimal value in X1.15~X1.0 is converted into the binary value,
and the conversion result is stored in D0. The binary value in D0 is converted into the floating-point
number, and the conversion result is stored in (D11, D10). The floating-point number in (D11, D10) is
converted into the radian, and the conversion result is stored in (D21, D20). The sine of the radian in
(D21, D20) is stored in (D31, D30), and the sine value is the floating-point number.

6-308

A H 5 00 Prog r am m ing M an ua l

BIN

X1.15~X1.0
0 0 9 0
Binary -coded
decimal value
F RAD

F LT

D0
90
Binary val ue

D21~D20
R1.570796
F loating- point
number

F SIN

D11~D10
R90
F loating- point
number
D31~D30
R1
F loating- point
number

Additional remark:
1.
2.

If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.
If SM695 is ON, and the value in S is less than 0 or larger than 360, the instruction is not
executed, SM0 is ON, and the error code is 16#2003.

6-309

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1501

FCOS

Device

X

Y

S
D







M

Operand

Function

S, D

Cosine of the floating-point number

P
S

T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Cosine value

Double word

Explanation:
1.

Whether the source value specified by S is a radian or a degree depends on the state of
SM695.

2.

If SM695 is OFF, the source value specified by S is a radian. Radian=Degree×π/180.

3.

If SM695 is ON, the source value specified by S is a degree.
Degree=Radian×180/π. (0o≦Degree≦3600)

4.
5.
6.

If the conversion result is 0, SM600 is ON.
The cosine of the source value specified by S is stored in the register specified by D.
The relation between radians and cosine values are shown below.

Example:
When X0.0 is ON, the binary-coded decimal value in X1.15~X1.0 is converted into the binary value,
and the conversion result is stored in D0. The binary value in D0 is converted into the floating-point
number, and the conversion result is stored in (D11, D10). The floating-point number in (D11, D10) is
converted into the radian, and the conversion result is stored in (D21, D20). The cosine of the radian
in (D21, D20) is stored in (D31, D30), and the cosine value is the floating-point number.

6-310

A H 5 00 Prog r am m ing M an ua l

BIN

X1.15~X1.0
0 3 6 0
Binary -coded
decimal value
F RAD

F LT

D0
360
Binary value

D21~D20
R6.283185
F loating-point
number

F CO S

D11~D10
R360
F loating-point
number
D31~D30
R1
F loating-point
number

Additional remark:
1.
2.

If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.
If SM695 is ON, and the value in S is less than 0 or larger than 360, the instruction is not
executed, SM0 is ON, and the error code is 16#2003.

6 - 3 11

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1502

FTAN

Device X

Y







S
D

M

P
S

Function

Operand

Tangent of the floating-point
number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Tangent value

Double word

Explanation:
1.

Whether the source value specified by S is a radian or a degree depends on the state of
SM695.

2.

If SM695 is OFF, the source value specified by S is a radian. Radian=Degree×π/180.

3.

If SM695 is ON, the source value specified by S is a degree.
Degree=Radian×180/π. (0o≦Degree≦3600)

4.
5.
6.

If the conversion result is 0, SM600 is ON.
The tangent of the source value specified by S is stored in the register specified by D.
The relation between radians and tangent values are shown below.

Example:
When X0.0 is ON, the binary-coded decimal value in X1.15~X1.0 is converted into the binary value,
and the conversion result is stored in D0. The binary value in D0 is converted into the floating-point
number, and the conversion result is stored in (D11, D10). The floating-point number in (D11, D10) is
converted into the radian, and the conversion result is stored in (D21, D20). The tangent of the
radian in (D21, D20) is stored in (D31, D30), and the tangent value is the floating-point number.

6-312

A H 5 00 Prog r am m ing M an ua l

BIN

X1.15~X1.0
0 0 4 5
Binary -coded
decimal value
F RAD

F LT

D0
45
Binary val ue

D21~D20
R0.785398
F loating- point
number

F TAN

D11~D10
R56
F loating- point
number
D31~D30
R1
F loating- point
number

Additional remark:
1.
2.

If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.
If SM695 is ON, and the value in S is less than 0 or larger than 360, the instruction is not
executed, SM0 is ON, and the error code is 16#2003.

6-313

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1503

FASIN

Device

X

Y

S
D







M

P
S

Function

Operand

Arcsine of the floating-point
number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Arcsine value

Double word

Explanation:
1.

Arcsine value=sin-1
The relation between sine values and arcsine values are shown below.

2.

If the conversion result is 0, SM600 is ON.

Example:
When X0.0 is ON, the arcsine of the floating-point number in (D1, D0) is stored in (D11, D10). The
arcsine value in (D11, D10) is converted into the degree, and the conversion result is stored in (D21,
D20). The degree in (D21, D20) is converted into the integer, and the conversion result is stored in
(D31, D30). The integer in (D31, D30) is converted into the binary-coded decimal value, and the
conversion result is stored in Y0.15~Y0.0.

6-314

A H 5 00 Prog r am m ing M an ua l

D0
R1

F ASIN

F loating- point
number

DINT

D31~D30
90

D11~D10
R1.570796
F loating- point
number
BCD

Binary v al ue

F DEG

D21~D20
R45
F loating- point
number

Y1.15~Y1.0
0 0 4 5
Binary -coded
decimal value

Additional remark:
1.

2.

The floating-point number specified by the operand S should be within the range between –1.0
and +1.0. If the floating-point number is not within the range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-315

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1504

FACOS

P

Device X

Y

S







S
D

M

Function

Operand

Arccosine of the floating-point
number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Arccosine value

Double word

Explanation:
1.

Arccosine value=cos-1
The relation between cosine values and arccosine values are shown below.

2.

If the absolute value of the conversion result is larger than the value which can be represented
by the maximum floating-point number, SM602 is ON.
If the absolute value of the conversion result is less than the value which can be represented
by the minimum floating-point number, SM601 is ON.
If the conversion result is 0, SM600 is ON.

3.
4.

Example:
When X0.0 is ON, the arccosine of the floating-point number in (D1, D0) is stored in (D11, D10). The
arccosine value in (D11, D10) is converted into the degree, and the conversion result is stored in
(D21, D20). The degree in (D21, D20) is converted into the integer, and the conversion result is
stored in (D31, D30). The integer in (D31, D30) is converted into the binary-coded decimal value,
and the conversion result is stored in Y0.15~Y0.0.

6-316

A H 5 00 Prog r am m ing M an ua l

D0
R1

F ACO S

F loating- point
number
DINT

D11~D10
R3.141592

F DEG

F loating- point
number

D31~D30
180
Binary v al ue

BCD

D21~D20
R180
F loating- point
number

Y1.15~Y1.0
0 1 8 0
Binary -coded
decimal value

Additional remark:
1.

2.

The floating-point number specified by the operand S should be within the range between –1.0
and +1.0. If the floating-point number is not within the range, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-317

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1505

FATAN

P

Device X

Y

S







S
D

M

Function

Operand

Arctangent of the floating-point
number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Arctangent value

Double word

Explanation:
1.
2.

Arctangent value=tan-1
The relation between tangent values and arctangent values are shown below.

3.

If the conversion result is 0, SM600 is ON.

Example:
When X0.0 is ON, the arctangent of the floating-point number in (D1, D0) is stored in (D11, D10).
The arctangent value in (D11, D10) is converted into the degree, and the conversion result is stored
in (D21, D20). The degree in (D21, D20) is converted into the integer, and the conversion result is
stored in (D31, D30). The integer in (D31, D30) is converted into the binary-coded decimal value,
and the conversion result is stored in Y0.15~Y0.0.

6-318

A H 5 00 Prog r am m ing M an ua l

D0
R1

F ATAN

F loating- point
number
DINT

D11~D10
R0.785398
F loating- point
number

D31~D30
45
Binary v al ue

BCD

F DEG

D21~D20
R45
F loating- point
number

Y1.15~Y1.0
0 0 4 5
Binary -coded
decimal value

Additional remark:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-319

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1506

FSINH

P

Device X

Y

S







S
D

M

Operand

Function

S, D

Hyperbolic sine of the floating-point
number

T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : hyperbolic sine value

Double word

Explanation:
1.
2.
3.
4.

Hyperbolic sine value=(es-e-s)/2.
If the absolute value of the conversion result is larger than the value which can be represented
by the maximum floating-point number, the value in D is 16#7F800000, and SM602 is ON.
If the absolute value of the conversion result is less than the value which can be represented
by the minimum floating-point number, the value in D is 16#7F800000, and SM601 is ON.
If the conversion result is 0, SM600 is ON.

Example:
1.

2.
3.
4.

When X0.0 is ON, the hyperbolic sine of the floating-point number in (D1, D0) is stored in (D11,
D10). The hyperbolic sine value in (D11, D10) is the floating-point number.

S

D1

D0

Single-pr ecision
floati ng- poi nt number

D

D11

D10

Hyperbolic sine value

If the absolute value of the conversion result is larger than the value which can be represented
by the maximum floating-point number, SM602 is ON.
If the absolute value of the conversion result is less than the value which can be represented
by the minimum floating-point number, SM601 is ON.
If the conversion result is 0, SM600 is ON.

Additional result:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-320

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1507

FCOSH

P
S

Device

X

Y

S
D







M

Function

Operand

Hyperbolic cosine of the
floating-point number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Hyperbolic cosine value

Double word

Explanation:
1.
2.
3.
4.

Hyperbolic cosine value=(es+e-s)/2.
If the absolute value of the conversion result is larger than the value which can be represented
by the maximum floating-point number, the value in D is 16#7F800000, and SM602 is ON.
If the absolute value of the conversion result is less than the value which can be represented
by the minimum floating-point number, the value in D is 16#FF800000, and SM601 is ON.
If the conversion result is 0, SM600 is ON.

Example:
1.

2.
3.
4.

When X0.0 is ON, the hyperbolic cosine of the floating-point number in (D1, D0) is stored in
(D11, D10). The hyperbolic cosine value in (D11, D10) is the floating-point number.

S

D1

D0

Single-pr ecision
floati ng- point number

D

D11

D10

Hyperbolic cosi ne value

If the absolute value of the conversion result is larger than the value which can be represented
by the maximum floating-point number, SM602 is ON.
If the absolute value of the conversion result is less than the value which can be represented
by the minimum floating-point number, SM601 is ON.
If the conversion result is 0, SM600 is ON.

Additional remark:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-321

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1508

FTANH

P

Device X

Y

S







S
D

M

Function

Operand

Hyperbolic tangent of the
floating-point number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Double word

D : Hyperbolic tangent value

Double word

Explanation:
1.
2.

Hyperbolic tangent value=(es-e-s)/(es+e-s).
If the conversion result is 0, SM600 is ON.

Example:
1.

2.

When X0.0 is ON, the hyperbolic tangent of the floating-point number in (D1, D0) is stored in
(D11, D10). The hyperbolic tangent value in (D11, D10) is the floating-point number.

S

D1

D0

D

D11

D10

Single- pr ecision
floati ng- point number

Hyperbolic tangent value

If the conversion result is 0, SM600 is ON.

Additional remark:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-322

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1509

FRAD

Device

X

Y

S
D







M

P
S

Operand

Function

S, D

Converting the degree to the radian

T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Data source (degree)

Double word

D : Conversion result (radian)

Double word

Explanation:
1.

The equation below is used to convert degrees into radians.

2.

Radian=Degree×(π/180).

3.

If the conversion result is 0, SM600 is ON.

Example:
When X0.0 is ON, the degree in (D1, D0) is converted into the radian, and the conversion result is
stored in (D11, D10). The radian in (D11, D10) is the floating-point number.

S

D1

D0

Degree
F loating- point number

D

D11

D10

Radian (Degree ×π/180 )
F loating- point number

Additional remark:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-323

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1510

FDEG

Device X

Y







S
D

M

P
S

Operand

Function

S, D

Converting the radian to the degree

T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Data source (radian)

Double word

D : Conversion result (Degree)

Double word

Explanation:
1.

The equation below is used to convert radians into degrees.

2.

Degree=Radian×(180/π).

3.

If the absolute value of the conversion result is larger than the value which can be represented
by the maximum floating-point number, the value in D is 16#7F7F0000.
If the absolute value of the conversion result is less than the value which can be represented
by the minimum floating-point number, the value in D is 16#FF7F0000.
If the conversion result is 0, SM600 is ON.

4.
5.

Example:
When X0.0 is ON, the radian in (D1, D0) is converted into the degree, and the conversion result is
stored in (D11, D10). The degree in (D11, D10) is the floating-point number.

S

D

D1

D0

Radian
Fl oating-point number

D11

D10

Degree ( Radian×180 /π )
Fl oating-point number

Additional remark:
If the value in S exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.

6-324

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1511

D

SQR

P

M

S

Device

X

Y

S
D







Function

Operand

Square root of the binary number

S, D
T

C

HC

D

L

SM SR



















E

PR

K






16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source device

Word/Double word

D : Device in which the result is stored

Word/Double word

Explanation:
1.
2.
3.

The square root of the value in the device specified by S is calculated, and the result is stored
in the device specified by D.
The operation result stored in D is an integer. If the floating-point number is rounded down to
the nearest whole digit, SM601 is ON.
If the operation result stored in D is 0, SM600 is ON.

Example:
When X0.0 is ON, the square root of the value in D0 is calculated, and the result is stored in D10.

Additional remark:
1.

The value in the device specified by S only can be a positive value. If the value in the device
specified by S is a negative value, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.

6-325

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1512

FSQR

Device

X

Y

S
D







M

P
S

Function

Operand

Square root of the floating-point
number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”

DF






Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source device

Double word

D : Device in which the result is stored

Double word

Explanation:
1.
2.

The square root of the floating-point number in the register specified by S is calculated, and
the result is stored in the register specified by D.
If the operation result stored in D is 0, SM600 is ON.

Example 1:
When X0.0 is ON, the square root of the floating-point number in (D1, D0) is calculated, and the
result is stored in (D11, D10).

Additional remark:
1.

The value in the device specified by S only can be a positive value. If the value in the device
specified by S is a negative value, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.

6-326

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1513

FEXP

Device

X

Y

S
D







M

P
S

Function

Operand

An exponent of the floating-point
number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source device
D:

Device in which the operation result is
stored

Double word
Double word

Explanation:
1.
2.
3.

4.
5.

6.

Exponentiation involves two numbers, the base e which represents 2.71828, and the exponent
in the device specified by S.
EXP[D+1, D]=[S+1, S].
The number in the device specified by S can be a positive number or a negative number. The
register specified by D should be a 32-bit register, and the number in the device specified by S
should be a floating-point number.
The value in the register specified by D is eS. (e is 2.71828, and S represents the source data.)
If the absolute value of the conversion result is larger than the value which can be represented
by the maximum floating-point number, the value in the register specified by D is 16#7F800000,
and SM602 is ON.
If the operation result stored in D is 0, SM600 is ON.

Example:
1.
2.

When X0.0 is ON, the value in (D1, D0) is converted into the floating-point number, and the
conversion result is stored in (D11, D10).
When X0.1 is ON, the exponentiation with the value in (D11, D10) as the exponent is
performed. The result is a floating-point number, and is stored in (D21, D20).

6-327

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1514

FLOG

Device

X

Y

S1
S2
D









M

P
S

Function

Operand

Logarithm of the floating-point
number

S1, S2, D
T

C

HC

D

L

SM SR

























E

PR

K

16# “$”





DF



Pulse instruction 16-bit instruction (7-9 steps) 32-bit instruction
AH

AH

-

S1 : Device in which the base is stored

Double word

S2 : Source device

Double word

Symbol:

D :

Device in which the operation result is
stored

Double word

Explanation:
1.
2.

The logarithm of the value in S2 with respect to the value in S1 is calculated, and the operation
result is stored in D.
The values in S1 and S2 only can be positive values. The register specified by D should be a
32-bit register, and the values in S1 and S2 should be floating-point numbers.

3.

S1D=S2.→D=LogS1S2.

4.

Example: Suppose the values in S1 and S2 are 5 and 125 respectively. Find log5125.

5.

S1D=S2.→5D=125.→D=log5125=3.

6.

If the operation result stored in D is 0, SM600 is ON.

Example:
1.
2.

When X0.0 is ON, the values in (D1, D0) and (D3, D2) are converted into the floating-point
numbers, and the conversion results are stored in (D11, D10) and (D13, D12) respectively.
When X0.1 is ON, the logarithm of the floating-point number in (D13, D12) with respect to the
floating-point number in (D11, D10) is calculated, and the operation result is stored in (D21,
D20).

6-328

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.

If the value in S1 is less than or equal to 1, or if the value in S2 is less or equal to 0, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.

6-329

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1515

FLN

Device

X

Y

S
D







M

P
S

Function

Operand

Natural logarithm of the binary
floating-point number

S, D
T

C

HC

D

L

SM SR



















E

PR

K

16# “$”




DF


Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source device

Double word

D : Device in which the operation result is stored

Double word

Explanation:
1.
2.
3.

The natural logarithm of the operand S is calculated.
LN[S+1, S]=[S+1, D]
The value in S only can be a positive value. The register specified by D should be a 32-bit
register, and the value in S should be a floating-point number.

4.

eD=S.→The value in D=lnS. (S represents the source data.)

5.

If the operation result stored in D is 0, SM600 is ON.

Example:
1.
2.

When X0.0 is ON, the value in (D1, D0) is converted into the floating-point number, and the
conversion result is stored in (D11, D10).
When X0.1 is ON, the natural logarithm of the floating-point number in (D11, D10) is calculated,
and the operation result is stored in (D21, D20).

Additional remark:
1.

If the value in S is less than or equal to 0, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.

6-330

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1516

FPOW

P

Device X

Y

S









S1
S2
D

M

Function

Operand

A power of the floating-point
number

S1, S2, D
T

C

HC

D

L

SM SR

























E

PR

K

16# “$”





DF



Pulse instruction 16-bit instruction (7-9 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Device in which the base is stored

Double word

S2 : Device in which the power is stored

Double word

D :

Device in which the operation result is
stored

Double word

Explanation:
1.
2.
3.

4.
5.
6.
7.
8.
9.
10.

The single-precision floating-point number in S1 is raised to the power of the value in S2, and
the operation result is stored in D.
D=POW[S1+1, S1][S2+1, S2]
The value in S1 only can be a positive value, whereas the value in S2 can be a positive value or
a negative value. The register specified by D should be a 32-bit register, and the values in S1
and S2 should be floating-point numbers.
S1S2=D
Suppose the values in S1 and S2 are 5 and 3 respectively. D=53=125.
If the absolute value of the operation result is large than the value which can be represented
by the maximum floating-point number, SM602 is ON.
If the absolute value of the operation result is less than the value which can be represented by
the minimum floating-point number, SM601 is ON.
If the absolute value of the conversion result is large than the value which can be represented
by the maximum floating-point number, the value in D is 16#7F7F0000.
If the absolute value of the conversion result is less than the value which can be represented
by the minimum floating-point number, the value in D is 16#FF7F0000.
If the operation result stored in D is 0, SM600 is ON.

Example:
1.
2.
3.

When X0.0 is ON, the values in (D1, D0) and (D3, D2) are converted into the floating-point
numbers, and the conversion results are stored in (D11, D10) and (D13, D12) respectively.
When X0.1 is ON, the floating-point number in (D11, D10) is raised to the power of the
floating-point number in (D13, D12), and the operation result is stored in (D21, D20).
When X0.2 is ON, the binary floating-point number in (D21, D20) is converted into the
binary-coded decimal floating-point number, and the conversion result is stored in (D31, D30).

6-331

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

If the value in S1 is less than 0, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.

6-332

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1517

RAND

P

Device X

Y

S









S1
S2
D

M

T

C









Operand

Function

S1, S2, D

Random number

HC

D

L

SM SR

E

PR

K
























16# “$”

DF




Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Minimum value

Word

S2 : Maximum value

Word

D : Device in which the result is stored

Word

Explanation:
1.
2.

The instruction is used to generate the random number within the range between the minimum
value in S1 and the maximum value in S2, and the result is stored in D.
If the value in S1 is larger than the value in S2, the values in S1 and S2 are taken as the
maximum value and the minimum value respectively when the instruction is executed.

Example:
When X0.0 is ON, the random number within the range between the minimum value in D0 and the
maximum value in D10 is generated, and the result is stored in D20.

Additional remark:
The values in S1 and S2 should be within the range between 0 and 0~32767. If the value in S1 or S2
exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2003.

6-333

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1518

D

BSQR

P

Device X

Y

S







S
D

M

Function

Operand

Square root of the binary-coded
decimal number

S, D
T

C

HC

D

L

SM SR

E

PR

K



























16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:
S : Source device

Word/Double word

D : Device in which the result is stored

Word/Double word

Explanation:
1.

2.
3.
4.
5.

After the square root of the value in the device specified by S is calculated, the integer part is
stored in the device specified by D, and the fractional part is stored in the device specified by
D+1.
The 16-bit value in S should be within the range between 0 and 9,999, and the 32-bit value in
S should be within the range between 0 and 99,999,999.
If the instruction BSQR is used, the square root is rounded down to the fourth decimal place.
If the instruction DBSQR is used, the square root is rounded down to the eighth decimal place.
If the operation result stored in D is 0, SM600 is ON.

Example 1:
After the square root of the value in D0 is calculated, the integer part is stored in Y0, and the
fractional part is stored in Y1.

1 MOV
16#1234

2 BSQ R
D0
1 2 3 4
Binary -coded
decimal value

Y0
0 0 3 5 Integer part
Binary -coded
decimal value
Y1
1 2 8 3

F ractional part

Binary -coded
decimal value

Example 2:
After the square root of the value in D0 is calculated, the integer part is stored in Y0, and the
fractional part is stored in Y1.

6-334

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
If the value in S is not a binary-coded decimal value (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0
and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
2.
If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.
3.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of DWORD/DINT.

6-335

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1519

BSIN

Device

X

Y

S
D







M

P
S

Function

Operand

Sine of the binary-coded decimal
number

S, D
T

C







HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Word

D : Result

Word

Explanation:
1.

The source value specified by S is a degree, and the instruction is used to get the sine of the
source value specified by S. After the sine value is gotten, the sign is stored in D, the integer
part is stored in D+1, and the fractional part is stored in D+2.

2.

The range of degrees: 0°≦Degree<360°

3.
4.

The operation result is rounded off to the fifth decimal place.
If the conversion result is 0, SM600 is ON.

Example:
The instruction is used to get the sine of the value in D0. After the sine value is gotten, the sign is
stored in D10, the integer part is stored in D11, and the fractional part is stored in D12.

BSIN
D0
0 0 6 0
Binary -coded
decimal value

D10
0 0 0 0
Binary -coded
decimal value
D11
0 0 0 0
Binary -coded
decimal value
D12
8 6 6 0
Binary -coded
decimal value

Additional remark:
1.

If the value in S is not a binary-coded decimal value (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0

6-336

A H 5 00 Prog r am m ing M an ua l

2.
3.

and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
If the value in S is not within the range between 0° and 360°, the operation error occurs, SM0
is ON, and the error code in SR0 is 16#2003.
If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-337

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1520

BCOS

Device

X

Y

S







D

M

Operand

Function

S, D

Cosine of the binary-coded decimal
number

P
S

T

C







HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Word

D : Result

Word

Explanation:
1.

The source value specified by S is a degree, and the instruction is used to get the cosine of the
source value specified by S. After the cosine value is gotten, the sign is stored in D, the integer
part is stored in D+1, and the fractional part is stored in D+2.

2.

The range of degrees: 0°≦Degree<360°

3.
4.

The operation result is rounded off to the fifth decimal place.
If the conversion result is 0, SM600 is ON.

Example:
The instruction is used to get the cosine of the value in D0. After the cosine value is gotten, the sign
is stored in D10, the integer part is stored in D11, and the fractional part is stored in D12.

BCOS
D0
0 0 6 0
Binary -coded
decimal value

D 10
0 0 0 0
Binary -coded
decimal value
D 11
0 0 0 0
Binary -coded
decimal value
D12
5 0 0 0
Binary -coded
decimal value

Additional remark:
1.

If the value in S is not a binary-coded decimal value (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0

6-338

A H 5 00 Prog r am m ing M an ua l

2.
3.

and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
If the value in S is not within the range between 0° and 360°, the operation error occurs, SM0
is ON, and the error code in SR0 is 16#2003.
If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-339

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1521

BTAN

Device X

Y







S
D

M

P
S

Function

Operand

Tangent of the binary-coded
decimal number

S, D
T

C







HC

D

L

SM SR

E

PR

K


















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Word

D : Result

Word

Explanation:
1.

The source value specified by S is a degree, and the instruction is used to get the tangent of
the source value specified by S. After the tangent value is gotten, the sign is stored in D, the
integer part is stored in D+1, and the fractional part is stored in D+2.

2.

The range of degrees: 0°≦Degree<360°

3.
4.

The operation result is rounded off to the fifth decimal place.
If the conversion result is 0, SM600 is ON.

Example:
The instruction is used to get the tangent of the value in D0. After the tangent value is gotten, the
sign is stored in D10, the integer part is stored in D11, and the fractional part is stored in D12.

BTAN
D0
0 0 6 0
Binary -coded
decimal value

D10
0 0 0 0
Binary -coded
decimal value
D11
0 0 0 1
Binary -coded
decimal value
D12
7 3 2 0
Binary -coded
decimal value

Additional remark:
1.

If the value in S is not a binary-coded decimal value (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0

6-340

A H 5 00 Prog r am m ing M an ua l

2.
3.
4.

and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
If the value in S is not within the range between 0° and 360°, the operation error occurs, SM0
is ON, and the error code in SR0 is 16#2003.
If the value in S is equal to 90° or 270°, the operation error occurs, SM0 is ON, and the error
code in SR0 is 16#2003.
If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-341

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1522

BASIN

P
S

Device

X

Y

S
D







M

Function

Operand

Arcsine of the binary-coded
decimal number

S, D
T

C







HC

D

L

SM SR

E

PR
















K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Word

D : Arcsine value

Word

Explanation:
1.

2.
3.
4.

The source value specified by S is a binary-coded decimal value, and the instruction is used to
get the arcsine of the source value specified by S. The operation result (the degree) is stored
in D.
The value in S represents the sign, i.e. 0 represents the positive sign, and 1 represents the
negative sign. The integer part is stored in S+1, and the fractional part is stored in S+2.
The operation result is rounded off to the nearest whole digit.
The operation result is a binary-coded decimal value (the degree) wiithin the range between 0°
and 90°, or within the range between 270° and 360°.

Example:
The value in D0 represents the sign, the integer part is stored in D1, and the fractional part is stored
in D2. After the instruction BASIN is executed, the arcsine value is rounded off to the nearest whole
digit, and the result is stored in D10.

D0
0 0 0 0
Binary -coded
decimal value
D1
0 0 0 0
Binary -coded
decimal value

BASIN
D10
0 0 6 0
Binary -coded
decimal value

D2
8 6 6 0
Binary -coded
decimal value

Additional remark:
1.

Take 0.5 for example. When it is entered, users need to enter 0, 0, and 16#5000 into S, S+1,

6-342

A H 5 00 Prog r am m ing M an ua l

2.

3.

4.

S+2 respectively.
If the value in S is not a binary-coded decimal value (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0
and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
The value specified by the operand S should be within the range between –1.0 and +1.0. If the
value specified by the operand S is not within the range, the instruction is not executed, SM0 is
ON, and the error code in SR0 is 16#2003.
If users declare the operand S in ISPSoft, the data type will be ARRAY [3] of WORD/IN.

6-343

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1523

BACOS

P
S

Device

X

Y

S
D







M

Function

Operand

Arccosine of the binary-coded
decimal number

S, D
T

C







HC

D

L

SM SR

E

PR
















K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Word

D : Arccosine value

Word

Explanation:
1.

2.
3.
4.

The source value specified by S is a binary-coded decimal value, and the instruction is used to
get the arccosine of the source value specified by S. The operation result (the degree) is
stored in D.
The value in S represents the sign, i.e. 0 represents the positive sign, and 1 represents the
negative sign. The integer part is stored in S+1, and the fractional part is stored in S+2.
The operation result is rounded off to the nearest whole digit.
The operation result is a binary-coded decimal value (the degree) wiithin the range between 0°
and 180°.

Example:
The value in D0 represents the sign, the integer part is stored in D1, and the fractional part is stored
in D2. After the instruction BACOS is executed, the arccosine value is rounded off to the nearest
whole digit, and the result is stored in D10.

D0
0 0 0 0
Binary -coded
decimal value
D1
0 0 0 0
Binary -coded
decimal value

BACOS
D10
0 0 3 0
Binary -coded
decimal value

D2
8 6 6 0
Binary -coded
decimal value

Additional remark:
1.

Take 0.5 for example. When it is entered, users need to enter 0, 0, and 16#5000 into S, S+1,

6-344

A H 5 00 Prog r am m ing M an ua l

2.

3.

4.

S+2 respectively.
If the value in S is not a binary-coded decimal value (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0
and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
The value specified by the operand S should be within the range between –1.0 and +1.0. If the
value specified by the operand S is not within the range, the instruction is not executed, SM0 is
ON, and the error code in SR0 is 16#2003.
If users declare the operand S in ISPSoft, the data type will be ARRAY [3] of WORD/IN.

6-345

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1524

BATAN

P
S

Device

X

Y

S
D







M

Function

Operand

Arctangent of the binary-coded
decimal number

S, D
T

C







HC

D

L

SM SR

E

PR
















K

16# “$”

DF

Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value

Word

D : Arctangent value

Word

Explanation:
1.

2.
3.
4.

The source value specified by S is a binary-coded decimal value, and the instruction is used to
get the arctangent of the source value specified by S. The operation result (the degree) is
stored in D.
The value in S represents the sign, i.e. 0 represents the positive sign, and 1 represents the
negative sign. The integer part is stored in S+1, and the fractional part is stored in S+2.
The operation result is rounded off to the nearest whole digit.
The operation result is a binary-coded decimal value (the degree) wiithin the range between 0°
and 90°, or within the range between 270° and 360°.

Example:
The value in D0 represents the sign, the integer part is stored in D1, and the fractional part is stored
in D2. After the instruction BATAN is executed, the arctangent value is rounded off to the nearest
whole digit, and the result is stored in D10.

D0
0 0 0 0
Binary -coded
decimal value
D1
0 0 0 1
Binary -coded
decimal value

BATAN
D10
0 0 6 0
Binary -coded
decimal value

D2
7 3 2 0
Binary -coded
decimal value

Additional remark:
1.

Take 0.5 for example. When it is entered, users need to enter 0, 0, and 16#5000 into S, S+1,

6-346

A H 5 00 Prog r am m ing M an ua l

2.

3.

S+2 respectively.
If the value in S is not a binary-coded decimal value (The binary-coded decimal value is
represented by the hexadecimal number, but one of digits is not within the range between 0
and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
If users declare the operand S in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-347

Ch ap te r 6 Ap plie d Instruc tions

6.17 Real-time Clock Instructions
6.17.1 List of Real-time Clock Instructions
API
1600
1601
1602
1603
1604
1605
1606

6-348

Instruction code
Pulse
Function
16-bit
32-bit instruction

TRD
–
Reading the time

TWR
–
Writing the time

T+
–
Adding the time

T–
Subtracting the time
HOUR DHOUR
–
Running-time meter

–
TCMP
Comparing the time

–
TZCP
Time zone comparison

Step

Page
number

3
3
7
7
7
11
9

6-349
6-351
6-352
6-354
6-356
6-358
6-360

A H 5 00 Prog r am m ing M an ua l

6.17.2 Explanation of Real-time Clock Instructions
API

Instruction code

Operand

Function

1600

TRD

D

Reading the time

Device

X

Y

D





M

P
S

T

C





HC

D

L

SM SR

E

PR











K

16# “$”

DF

Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

-

Symbol:

D : Device in which the result

Word

Explanation:
1.
2.
3.

4.

D: The device in which the current time is stored
The operand D occupies seven consecutive devices.
The built-in real-time clock in the CPU module provides the data relating to the year, the week,
the moth, the day, the minute, and the second. The data is stored in SR391~SR397. The
instruction TRD is used to read the current time into the seven registers.
The first two digits of the year number for A.D. from the right are stored in SR391.

Example:
When M0 is ON, the current time is read from the real-time clock into D0~D6. The value 1 in SR397
represents Monday, the value 2 represents Tuesday, and by analogy, the value 7 represents
Sunday.

Special data
Item
register
SR391
Year (A.D.)
SR392
Month
SR393
Day
SR394
Hour
SR395
Minute
SR396
Second
SR397
Week

Value
00~99
1~12
1~31
0~23
0~59
0~59
1~7

General data
Item
register
D0
Year (A.D.)
D1
Month
D2
Day
D3
Hour
D4
Minute
D5
Second
D6
Week

Additional remark:
1.

If D+6 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

2.

When SM220 is ON, the real-time clock is calibrated within ±30 seconds. If the value of the
second in the real-time clock is within the range between 0 and 29, the value of the second is
cleared to zero. If the value of the second in the real-time clock is within the range between 30

6-349

Ch ap te r 6 Ap plie d Instruc tions

3.

and 59, the value of the minute increases by one, and the value of the second is cleared to
zero.
If users declare the operand D in ISPSoft, the data type will be ARRAY [7] of WORD/INT.

6-350

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

1601

TWR

Device

X

Y

S





M

Operand

Function

S

Writing the time

P
S

T

C





HC

D

L

SM SR

E

PR











K

16# “$”

DF

Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

-

Symbol:

S :Data source

Word

Explanation:
1.
2.
3.
4.

S: The device into which the setting value is written
The operand S occupies seven consecutive devices.
When users want to adjust the built-in real-time clock in the CPU module, they can use the
instruction to write the correct current time into the built-in real-time clock.
When the instruction is executed, the new setting time is instantly written into the real-time
clock in the PLC. Therefore, when the instruction is executed, users have to make sure that
the new setting time is consistent with the time when the new setting time is written into the
real-time clock.

Example:
When M0 is ON, the correct current time is written into the built-in real-time clock in the PLC.

Value
00~99
1~12
1~31
0~23
0~59
0~59
1~7

Special data
Item
register
SR391
Year (A.D.)
SR392
Month
SR393
Day
SR394
Hour
SR395
Minute
SR396
Second
SR397
Week

Real time clock

New setting time

General data
Item
register
D20
Year (A.D.)
D21
Month
D22
Day
D23
Hour
D24
Minute
D25
Second
D26
Week

Additional remark:
1.
2.
3.

If the value in S exceeds the range, the operation error occurs, the instruction is not executed,
SM is ON, and the error code in SR is 16#2003.
If S+6 exceeds the device range, the operation error occurs, the instruction is not executed,
SM is ON, and the error code in SR is 16#2003.
If users declare the operand S in ISPSoft, the data type will be ARRAY [7] of WORD/INT.

6-351

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

1602

T+

S1, S2, D

Adding the time

Device X

Y









S1
S2
D

M

P
S

T

C









HC

D

L

SM SR

E

PR





















K

16# “$”

DF

Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Source device

Word

S2 : Source device

Word

D : Device in which the result is stored

Word

Explanation:
1.

2.
3.
4.

The value of the hour, the value of the minute, and the value of the second in the real-time
clock specified by S2 are added to the value of the hour, the value of the minute, and the value
of the second in the real-time clock specified by S1, and the sum is stored in the register
specified by D.
The operands S1, S2, and D each occupy three consecutive devices.
If the sum is larger than or equal to 24 hours, SM602 is ON, and the result gotten from the
subtraction of 24 hours from the sum is stored in D.
If the sum is 0 (0 hour 0 minute 0 second), SM600 is ON.

Example:
When M0 is ON, the instruction T+ is executed. The alue of the hour, the value of the minute, and
the value of the second in D10~D12 are added to the value of the hour, the value of the minute, and
the value of the second in D0~D2, and the sum is stored in D20~D22.

D0 8 ( Hour )
D1 10 ( Minute)
D2 20 ( Second)
8 hour 10 minute 20 second

+

D10 6 ( Hour )
D11 40 ( Minute )
D12 6 ( Second )

D20 14 ( Hour )
D21 50 ( Minute )
D22 26 ( Second )

6 hour 40 minute 6 second 14 hour 50 minute 26 second

Additional remark:
1.
2.
3.
4.

If the value in S1 or S2 exceeds the range, the operation error occurs, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S1+2, S2+2, or D+2 exceeds the device range, the operation error occurs, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If users declare the operand S1 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.
If users declare the operand S2 in ISPSoft, the data type will be ARRAY [3] of WORD/IN.

6-352

A H 5 00 Prog r am m ing M an ua l
5.

If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-353

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

1603

T-

S1, S2, D

Subtracting the time

Device X

Y









S1
S2
D

M

P
S

T

C









HC

D

L

SM SR

E

PR





















K

16# “$”

DF

Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Source device

Word

S2 : Source device

Word

D : Device in which the result is stored

Word

Explanation:
1.

2.
3.
4.

The value of the hour, the value of the minute, and the value of the second in the real-time
clock specified by S2 are subtracted from the value of the hour, the value of the minute, and the
value of the second in the real-time clock specified by S1, and the difference is stored in the
register specified by D.
The operands S1, S2, and D all occupy three consecutive devices.
If the difference is a negative, SM601 is ON, and the result gotten from the addition of 24 hours
to the difference is stored in D.
If the difference is 0 (0 hour 0 minute 0 second), SM600 is ON.

Example:
1.

When M0 is ON, the instruction T- is executed. The value of the hour, the value of the minute,
and the value of the second in D10~D12 are subtracted from the value of the hour, the value of
the minute, and the value of the second in D0~D2, and the difference is stored in D20~D22.
D0 20 ( Hour )
D1 20 ( Minute)
D2 5 ( Second)

-

20 hour 20 minute 50 second

2.

D10 14 ( Hour )
D11 30 ( Minute )
D12 8 ( Second )

14 hour 30 minute 8 second

D20 5 ( Hour )
D21 49 ( Minute )
D22 57 ( Second )
5 hour 49 minute 57 second

If the difference is a negative, SM601 is ON.
5 ( Hour )
20 ( Minute)
30 ( Second)
5 hour 20 minute 30 second

-

19 ( Hour )
11 ( Minute)
15 ( Second )

10 ( Hour )
9 ( Minute)
15 ( Second )

19 hour 11 mi nute 15 second 10 hour 9 minute 15 second

Additional remark:
1.

If the value in S1 or S2 exceeds the range, the operation error occurs, the instruction is not

6-354

A H 5 00 Prog r am m ing M an ua l

3.
4.

executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S1+2, S2+2, or D+2 exceeds the device range, the operation error occurs, the instruction is
not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If users declare the operand S1 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.
If users declare the operand S2 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

5.

If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

2.

6-355

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

1604

D

S, D1, D2

Running-time meter

HOUR

Device X

Y









S
D1
D2

M



S

T

C

HC

D

L

SM SR

E

PR

K































16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
-

AH

AH

Symbol:
S :

Time after which the output
device is ON

Word/Double word

D1 : Current time

Word/Double word

D2 : Output device

Bit

Explanation:
1.

2.

3.

4.

5.

6.
7.

S: The time after which the output device is ON (Unit: Hour)
D1: The current time (Unit: Hour)
D2: The output device
S: The time after which the output device is ON (Unit: Hour)
The operand S used in the 16-bit instruction should be within the range between 1 and 32,767.
The operand S used in the 32-bit instruction should be within the range between 1 and
2,147,483,647.
The instruction HOUR:
D1: The current time (Unit: Hour)
The value in D1 should be within the range between 0 and 32,767.
D1+1: The current time which is less than one hour (Unit: Second)
The value in D1+1 should be within the range between 0 and 3,599.
D1+2 is for system use only. The value in it can not be altered when the instruction is executed.
Otherwise, an error will occur.
When the current time is 32,767 hour 3,599 second, the timer stops counting. After the values
in D1 and D1+1 are cleared to 0, the timer starts to count again.
The instruction DHOUR:
(D1+1, D1): The current time (Unit: Hour)
The value in (D1+1, D1) should be within the range between 0 and 2,147,483,647.
D1+2: The current time which is less than one hour (Unit: Second)
The value in D1+1 should be within the range between 0 and 3,599.
D1+3 is for system use only. The value in it can not be altered when the instruction is executed.
Otherwise, an error will occur.
When the current time is 2,147,483,647 hour 3,599 second, the timer stops counting. After the
values in D1, D1+1, and D1+2 are cleared to 0, the timer starts to count again.
When the time for which the input contact has been ON reaches the setting time, the ouput
device is ON. When the time for which the input contact has been ON does not reach the
setting time, the ouput device is not ON. This function allows users to manage the running time
of the machine and the maintenance.
After the output device is ON, the timer countinues to count.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.

6-356

A H 5 00 Prog r am m ing M an ua l

Example 1:
The 16-bit instruction HOUR: When X0.0 is ON, the timer starts to count. When the time for which
X0.0 has been ON reaches 100 hours, Y0.0 is ON. The current time is recorded in D0, and the
current time which is less than one hour is recorded in D1. D2 is for system use. The value in it can
not be altered. Otherwise, an error will occur.

Example 2:
The 32-bit instruction DHOUR: When X0.0 is ON, the timer starts to count. When the time for which
X0.0 has been ON reaches 4000 hours, Y0.0 is ON. The current time is recorded in (D1, D0), and
the current time which is less than one hour is recorded in D2. D3 is for system use. The value in it
can not be altered. Otherwise, an error will occur.

Additional remark:
1.
2.
3.
4.
5.
6.
7.

When S is less than or equal to 0, the instruction is not executed, and the state of the output
device is unchanged.
If the value in D1 used in the instruction HOUR is less than 0, the state of the output device is
unchanged.
If D1+2 used in the instruction HOUR exceeds the device range, the operation error occurs, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the value in (D1+1, D1) used in the instruction DHOUR is less than 0, the state of the output
device is unchanged.
If D1+3 used in the instruction DHOUR exceeds the device range, the operation error occurs,
the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the operand D1 used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [3] of WORD/INT.
If the operand D1 used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of DWORD/DINT.

6-357

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1605

TCMP

Device

X

Y

S1
S2
S3
S
D













M



P
S



T

C











Operand

Function

S1, S2, S3, S, D

Comparing the time

HC

D

L

SM SR

E

PR

K



































16# “$”

DF





Pulse instruction 16-bit instruction (11 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Hour of the setting time

Word

S2 : Minute of the setting time

Word

S3 : Second of the setting time

Word

S : Current time

Word

D : Comparison result

Bit

Explanation:
1.

2.

3.
4.
5.
6.
7.

The value of the hour, the value of the minute, and the value of the second specified by S1~S3
are compared with the value of the hour, the value of the minute, and the value of the second
in the devices starting from the device specified by S, and the comparison result is stored in D.
The hour of the current time is in the device specified by S, and the value of the hour should be
within the range between 0 and 23. The minute of the current time is in the device specified by
S+1, and the value of the minute should be within the range between 0 and 59. The second of
the current time is in the device specified by S+2, and the value of the second should be within
the range between 0 and 59.
The operand D occupies three consecutive devices. The comparison result is stored in D, D+1,
and D+2.
Users generally use the instruction TRD to read the current time from the real-time clock first,
and then they use the instruction TCMP to compare the time.
If the setting time in S1~S3 is larger than the current time in S, D is ON, D+1 is OFF, and D+2 is
OFF.
If the setting time in S1~S3 is equal to the current time in S, D is OFF, D+1 is ON, and D+2 is
OFF.
If the setting time in S1~S3 is less than the current time in S, D is OFF, D+1 is OFF, and D+2 is
ON.

Example:
1.

When X0.0 is ON, the instruction is executed. The setting time 12 hour 20 minute 45 second is
compared with the current time in D20~D22, and the comparison result is stored in M10~M12.
When X0.0 is switched from ON to OFF, the instruction is not executed. Besides, the state of
M10, the state of M11, and the state of M12 remain the same as those before X0.0’s being ON.

2.

If users want to get the comparison result ≧, ≦, or ≠, they can connect M10~M12 is series or in
parallel.

6-358

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.
3.
4.
5.

If S+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the value in S exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the values in S1~S3 exceed the range, the operation error occurs, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.

6-359

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1606

TZCP

Device

X

Y

S1
S2
S
D











M



P
S



T

C









Operand

Function

S1, S2, S, D

Time zone comparison

HC

D

L

SM SR

E

PR


























K

16# “$”

DF

Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Lower limit time

Word

S2 : Upper limit time

Word

S : Current time

Word

D : Comparison result

Bit

Explanation:
1.

2.

3.

4.

5.

6.
7.

The instruction is used to compare the current time specified by S with the lower limit time
specified by S1, and compare the current time specified by S with the upper limit time specified
by S2, and the comparison result is stored in D.
The hour of the lower limit time is in the device specified by S1, the minute of the lower limit
time e is in the device specified by S1+1, and the second of the lower limit time is in the device
specified by S1+2.
The hour of the upper limit time is in the device specified by S2, the minute of the upper limit
time e is in the device specified by S2+1, and the second of the upper limit time is in the device
specified by S2+2.
The hour of the current time is in the device specified by S, the minute of the current time e is
in the device specified by S+1, and the second of the current time is in the device specified by
S+2.
The time in the device specified by S1 must be less than the time in the device specified by S2.
If the time in the device specified by S1 is larger than the time in the device specified by S2, the
time in the device specified by S1 will be taken as the upper/lower limit time during the
execution of the instruction TZCP.
Users generally use the instruction TRD to read the current time from the real-time clock first,
and then they use the instruction TZCP to compare the time.
If the current time in the device specified by S is less than the lower limit time in the device
specified by S1, and is less than the upper limit time in the device specified by S2, D is ON. If
the current time in the device specified by S is larger than the lower limit time in the device
specified by S1, and is larger than the upper limit time in the device specified by S2, D+2 is ON.
In other conditions, D+1 is ON.

Example:
When X0.0 is ON, the instruction TZCP is executed. M10, M11, or M12 is ON. When X0.0 is OFF,
the instruction TZCP is not executed, the state of M10, the state of M11, and the state of M12 remain
the same as those before X0.0’s being ON.

6-360

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1. If S1+2, S2+2, S+2, or D+2 exceeds the device range, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
2. If the values in S1, S2, and S exceed the range, the operation error occurs, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003
3. If users declare the operand S1 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.
4. If users declare the operand S2 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.
5. If users declare the operand S in ISPSoft, the data type will be ARRAY [3] of WORD/INT.
6. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-361

Ch ap te r 6 Ap plie d Instruc tions

6.18 Peripheral Instructions
6.18.1 List of Peripheral Instructions

1700
1701
1702
1703

Instruction code
16-bit
32-bit
TKY
DTKY
HKY
DHKY
DSW
–
ARWS
–

1704

SEGL

API

6-362

–

Pulse
instruction
–
–
–
–
–

Function

Step

Page
number

Ten-key keypad
Sixteen-key keypad
DIP switch
Arrow keys
Seven-segment display with
latches

7
9
9
9

6-363
6-366
6-369
6-371

7

6-373

A H 5 00 Prog r am m ing M an ua l

6.18.2 Explanation of Peripheral Instructions
API

Instruction code

1700

D

TKY

Device

X

Y

M

S

S
D1
D2












T




C

Operand

Function

S, D1, D2

Ten-key keypad

HC





D

L









SM SR


E

PR







K

16# “$”

DF

Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
-

AH

AH

Symbol:
S : Initial device
D1 :

Device in which the value is
stored

D2 : Output signal

Bit
Word/Double word
Bit

Explanation:
1.

2.
3.
4.
5.

The ten external inputs starting from the input specified by S represents 0~9 in the decimal
system. They are connected to ten keys. Users can enter a four-digit decimal value or an
eight-digit decimal value by pressing the keys in order. The decimal value is stored in D1, and
the output signals are stored in D2.
The operand S occupies ten bits.
The operand D2 occupies eleven bits. Please do not change the states of the bits during the
execution of the instruction.
When the conditional contact is not enabled, the eleven bits starting from the bit specified by
D2 is OFF.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.

Example:
1.

The ten external inputs starting from X0.0 is connected to ten keys which represent 0~9 in the
decimal system. When M0 is ON, the instruction is executed. The value that users enter is
stored as a binary value in D0, and the output signals are stored in M10~M19.

6-363

Ch ap te r 6 Ap plie d Instruc tions

0

1

2

3

4

5

6

7

8

9

24VDC

X0.0

X0.1

X0.2

X0.3

X0.5

X0.4

X0.6

X0.7

X0.8

X0.9

S/S

Note: The digital input module AH16AM10N-5A is used in this example.

0

2

1

3

4

5

6

7

8

9

One- di gi t binary- coded
decimal code

Binary -coded
decimal value

Ov erflowi ng

3

10

2

10

1

10

Numeric keys

0

10

Binary -coded
decimal value
Binary
value

2.

3.
4.
5.
6.

D0

If the keys connected to X0.5, X0.3, X0.0, and X0.1 are pressed in the order shown in the
timing chart, the result 5,301 is stored in D0. The maximum value which can be stored in D0 is
9,999. If the value exceeds four digits, the first digit from the left overflows.
After the key connected to the X0.2 is pressed and before other keys are pressed, M12 is ON.
The same applies to other keys.
When a key connected to the input within the range between X0.0 and X0.9 is pressed, the
corresponding output within the range between M10 and M19 is ON.
When one of the keys is pressed, M20 is ON.
When the conditional contact M0 is switched OFF, the value which was stored in D0 is
unchanged. However, M10~M20 are switched OFF.

6-364

A H 5 00 Prog r am m ing M an ua l

X0.0

3
4

X0.1
2

X0.3
X0.5

1

M10
M11
M13
M15

Output si gnal
M20

1

2

3

4

Additional remark:
1.
2.

If users declare the operand S in ISPSoft, the data type will be ARRAY [10] of BOOL.
If users declare the operand D2 in ISPSoft, the data type will be ARRAY [11] of BOOL.

6-365

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

1701

D

Device X



S1
S2
D1
D2
D3



HKY
Y





M



S

T

C




Operand

Function

S, D1, D2, D3

Sixteen-key keypad

HC

D

L

















SM SR

E

PR

K

16# “$”

DF









Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps)
-

AH

AH

Symbol:
S1 : Initial input device

Bit

S2 : For system use only

Word

D1 : Initial output device

Bit

D2 :

Device in which the value is
stored

D3 : Output signal

Word/Double word
Bit

Explanation:
1.

2.

3.

The four external inputs starting from the input specified by S are connected to the four
external outputs starting from the output specified by D1 to form a 16-key keypad. The value
that users enter by pressing the keys is stored in D2, and the output signals are stored in D3. If
several keys are pressed simultaneously, the value which is smaller is stored.
The value that users enter by pressing the keys is temporarily stored in D2. If the 16-bit
instruction HKY is executed, the maximum value which can be stored in D2 is 9,999. If the
value exceeds four digits, the first digit from the left overflows. If the 32-bit instruction DHKY is
executed, the maximum value which can be stored in D2 is 9,999. If the value exceeds eight
digits, the first digit from the left overflows.
After the execution of the instruction is complete, SM692 is ON. That is to say, SM692 is ON
for a scan cycle after the execution of the matrix scan is complete.

Example:
1.

The four external inputs X0.0~X0.3 are connected to the four external outputs Y0.0~Y0.3 to
form a 16-key keypad. When X1.0 is ON, the instruction is executed. The value that users
enter is stored as a binary value in D0, and the output signals are stored in M0~M7.

The function of SM691:
 If SM691 is ON, 0~F are taken as hexadecimal values in the execution of the instruction
HKY.

6-366

A H 5 00 Prog r am m ing M an ua l


Numeric keys:
0

1

2

3

4

5

3

Ov erflowi ng

6

7

2

16

8

9

1

16

B C

A

D E

F

Kyes

0

16

16

D0



If SM691 is OFF, A~F are taken as function keys in the execution of the instruction HKY.

Numeric keys:
0

2

1

3

4

5

6

7

Bina ry-coded
decimal value

3

Ov erflowi ng

2

10

10

1

10

8

Numeric keys

9

One- di gi t binary- coded
decimal code
0

10

Bina ry-coded
decimal value

Binary
value



2.

3.

D0

Function keys:
 When A is pressed, M0 keeps ON. When D is pressed, M0 is switched OFF,
and M3 keeps ON.
 If several function keys are pressed, the key which is pressed first has
priority.
F

E

D

C

B

A

M5

M4

M3

M2

M1

M0

Output signals:

When a key within the range between A and F is pressed, M6 is ON.

When a key within the range between 0 and 9 is pressed, M7 is ON.
When the conditional contact X1.0 is switched OFF, the value which was stored in D0 is
unchanged. However, M0~M7 are switched OFF.

6-367

Ch ap te r 6 Ap plie d Instruc tions
4.

The external wiring:
C

D

E

F

8

9

A

B

4

5

6

7

0

1

2

3

X0.0 X0.1 X0.2 X0.3

S/S

24VDC
+
Y0.0 Y0.1 Y0.2 Y0.3

UP

ZP

Note: The transistor output module AH16AP11T-5A is used in this example.

Additional remark:
1.
2.
3.

If users declare the operand S in ISPSoft, the data type will be ARRAY [4] of BOOL.
If users declare the operand D1 in ISPSoft, the data type will be ARRAY [4] of BOOL.
If users declare the operand D3 in ISPSoft, the data type will be ARRAY [8] of BOOL.

6-368

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1702

DSW

S, D1, D2, n

DIP switch

Device

X

S1
S2
D1
D2
n






Y

M

S






T

C




HC

D

L















SM SR

E

PR

K

16# “$”

DF











Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Initial input device

Bit

S2 : For system use only

Word

D1 : Initial output device

Bit

D2 : Device in which the value is stored

Word

n

: Number of DIP switches

Word

Explanation:
1.

2.
3.
4.
5.
6.

The four or eight external inputs starting from the input specified by S1 are connected to the
four external outputs starting from the output specified by D1 to form a four-digit DIP switch or
two four-digit DIP switches. The value that users enter by pressing the DIP switch is stored in
D2. Whether there is one four-digit DIP switch or two four-digit DIP switches depends on n.
If n is 1, the operand D2 occupies one register. If n is 2, the operand D2 occupies two registers.
S2 and S2+1, which are for system use only, occupy two devices. Please do not alter the
values in these devices.
After the execution of the instruction is complete, SM694 is ON for a scan cycle.
When the conditional contact is not enabled, the four external outputs starting from the output
specified by D1 keep OFF.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.

Example:
1.

X0.0~X0.3 are connected to Y0.0~Y0.3 to form the first DIP switch, and X0.4~X0.7 are
connected to Y0.0~Y0.3 to form the second DIP switch. When X1.0 is ON, the instruction is
executed. The value that users enter by pressing the first DIP switch is converted into the
binary value, and the conversion result is stored in D20. The value that users enter by pressing
the second DIP switch is converted into the binary value, and the conversion result is stored in
D21.

2.

When X1.0 is ON, Y0.0~Y0.3 are ON cyclically. After the execution of the instruction is

6-369

Ch ap te r 6 Ap plie d Instruc tions

3.

complete, SM694 is ON for a scan cycle.
The outputs Y0.0~Y0.3 must be transistors.
X1.0

Cycli c ac tion
0.1s

Y0.0
Y0.1

0.1s
0.1s

Y0.2

Inter ruption

0.1s

Y0.3
SM694

4.

0.1s

0.1s
T he execution of the
insturc iton is complete.

The DIP switches:
0

1

10

2

10

3

10

10

Binary-coded decimal
wiring of DIP switches
A diode (1N4148) must
be connected in series.

+
1
X0.0

2
X0.1

4
X0.2

8
X0.3

First DIP switch

1
X0.4

2
X0.5

4
X0.6

0

10

8
X0.7

S/S

Y0.0

1

10
Y0.1

2

10
Y0.2

3

10
Y0.3

UP

ZP

Second DIP swtich

Note: The transistor output module AH16AP11T-5A is used in this example.

Additional remark:
1.
2.

If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.
If users declare the operand D1 in ISPSoft, the data type will be ARRAY [4] of BOOL.

6-370

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1703

ARWS

S, D1, D2, n

Arrow keys

Device X

Y

M

S















S1
S2
D1
D2
n



T



C



HC

D

L













SM SR

E

PR











K



16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Initial input device

Bit

S2 : For system use only

Word

D1 : Device in which the setting value is stored

Word

D2 : Initial output device

Bit

n : Positive/Negative logic

Word

Explanation:
1.

2.
3.
4.
5.
6.
7.

If the instruction is executed, S1 is defined as the down arrow, S1+1 is defined as the up arrow,
S1+2 is defined as the right arrow, and S1+3 is defined as the left arrow. The setting value is
stored in D1, and it should be within the range between 0 and 9,999.
The operand S1 occupies four consecutive bit devices.
S2 is for system use only. Please do not alter the value in it.
The operand D2 occupies eight consecutive bit devices.
When the conditional contact is not enabled, the eight bit devices starting from the bit device
specified by D2 keep OFF.
The operand n should be within the range between 0 and 3. Please refer to the additional
remark on the instruction SEGL for more information.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.

Example:
1.

2.
3.

4.

If the instruction is executed, X0.0 is defined as the down arrow, X0.1 is defined as the up
arrow, X0.2 is defined as the right arrow, and X0.3 is defined as the left arrow. The setting
value is stored in D20, and it should be within the range between 0 and 9,999.
When X1.0 is ON, the digit in the place 103 is selected. If the left arrow is pressed, the places
are selected in sequence (103→100→101→102→103→100).
If the right arrow is pressed, the places are selected in sequence
(103→102→101→100→103→102). The LED indicators with the corresponding places are
connected to Y0.4~Y0.7. When the digits in the places are selected in sequence, the LED
indicators are ON in sequence.
If the up arrow is pressed, the digit in the place selected changes (0→1→2→…8→9→0→1). If
the down arrow is pressed, the digit in the place selected changes (0→9→8→…1→0→9). The
new digit is shown on seven-segment display.

6-371

Ch ap te r 6 Ap plie d Instruc tions

Up arr ow
Y 0.4
Y0 .5

X 0.1

Y 0.6

LED indic ators

Y 0.7
3

10
Y 0.0
Y 0.1
Y 0.2
Y 0.3

2

10

1

10

Left arrow

X 0.3

X 0.2

Right arr ow

0

10

1
2
4
8

Four -digit sev en- segment display

X 0.0

Down arrow
T he four key s ar e used to select
the place and change the digit

Additional remark:
1.
2.
3.

If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.
If users declare the operand S1 in ISPSoft, the data type will be ARRAY [4] of BOOL.
If users declare the operand D2 in ISPSoft, the data type will be ARRAY [8] of BOOLL.

6-372

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1704

SEGL

S, D, n

Seven-segment display with latches

Device X

Y









S1
S2
D
n



M

S

T

C







HC

D

L

SM SR

E

PR






















K



16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Source device

Word

S2 : For system use only

Word

D : Initial output device

Bit

n : Positive/Negative logic

Word

Explanation:
1.

2.
3.
4.
5.

6.
7.

8.

The eight external outputs starting from the output specified by D are connected to a four-digit
seven-segment display, or the twelve external outputs starting from the output specified by D
are connected to two four-digit seven-segment displays. Every place is equipped with a driver
which converts a binary-coded decimal value into seven-segment data, and every driver is
equipped with a latch which can be used to store state information.
The value in S1 is the value which will be shown on first seven-segment display, and the value
in S1+1 is the value which will be shown on second seven-segment display.
S2 is for system use only. Please do not alter the value in it.
The operand n should be within the range between 0 and 7. Please refer to the additional
remark for more information.
Whether there is one four-digit seven-segment display or two four-digit seven-segment
displays, and whether an output is a positive logic output or a negative logic output depend on
n.
If there is one four-digit seven-segment display, eight outputs are occupied. If there are two
four-digit seven-segment displays, twelve outputs are occupied.
When the instruction is executed, the outputs are ON cyclically. If the conditional contact is
switched from OFF to ON during the execution of the instruction, the outputs are ON cyclically
again.
After the execution of the instruction is complete, SM693 is ON for a scan cycle.

Example:
1.

When X1.0 is ON, the instruction is executed. Y0.0~Y0.4 form a circuit. The value in D10 is
converted into the binary-coded decimal value, and the conversion result is shown on first
seven-segment display. The value in D11 is converted into the binary-coded decimal value,
and the conversion result is shown on second seven-segment display. If the value in D10 or
D11 exceeds 9,999, the operation error occurs.

6-373

Ch ap te r 6 Ap plie d Instruc tions

2.
3.

4.

5.

When X1.0 is ON, Y0.4~Y0.7 are ON cyclically. It takes twelve scan cycles for Y0.4~Y0.7 to be
ON. After the execution of the instruction is complete, SM693 is ON for a scan cycle.
If there is on four-digit seven-segment display, n is within the range between 0 and 3.

After the pins 1, 2, 4, and 8 are connected in parallel, they are connected to Y0.0~Y0.3
on the PLC, and the latches are connected to Y0.4~Y0.7 on the PLC.

When X1.0 is ON, the instruction is executed. Y0.4~Y0.7 are ON cyclically, and the value
in D10 is shown on seven-segment display.
If there are two four-digit seven-segment displays, n is within the range between 4 and 7.

After the pins 1, 2, 4, and 8 are connected in parallel, they are connected to Y0.8~Y0.11
on the PLC, and the latches are connected to Y0.4~Y0.7 on the PLC.

The value in D10 is shown on first seven-segment display, and the value in D11 is shown
on second seven-segment display. If the values in D10 and D11 are 1234 and 4321
respectively, 1234 is shown on second seven-segment display.
The wiring:
1

2

4

8

10

0

10

1

10

2

ZP

UP

Y0.0 Y0.1 Y0.2 Y0.3 Y0.4 Y0.5 Y0.6 Y0.7 Y0.8 Y0.9 Y0.10 Y0.11
3

+

10

24VDC

10

3

10

2

10

1

10

0

1
2
4
8

10

V+

First 7-segment display

3

10

2

10

1

10

0

V+

1
2
4
8

Second 7-segment display

Note: The transistor output module AH16AN01T-5A is used in this example.

Additional remark:
1.
2.

Whether an output is a positive output or a negative output, and whether there is one four-digit
seven-segment display or two four-digit seven-segment displays depend on n.
The outputs on the PLC should be NPN transistors whose collectors are open collectors.
Besides, an output has to connect a pull-up resistor to the DC power supply (less than 30 V
DC). Therefore, when an output is ON, a signal of low potential is output.



The positive logic:
Binary-coded
decimal value
b3
0

6-374

b2
0

b1
0

b0
0

Output
(Binary-coded
decimal code)
8
4
2
1
0
0
0
0

Signal
A
1

B
1

C
1

D
1

A H 5 00 Prog r am m ing M an ua l

8
0
0
0
0
0
0
0
1
1

Output
(Binary-coded
decimal code)
4
2
0
0
0
1
0
1
1
0
1
0
1
1
1
1
0
0
0
0

8
1
1
1
1
1
1
1
1
0
0

Output
(Binary-coded
decimal code)
4
2
1
1
1
1
1
0
1
0
0
1
0
1
0
0
0
0
1
1
1
1

Binary-coded
decimal value
b3
0
0
0
0
0
0
0
1
1


b2
0
0
0
1
1
1
1
0
0

b1
0
1
1
0
0
1
1
0
0

b0
1
0
1
0
1
0
1
0
1

b3
0
0
0
0
0
0
0
0
1
1

b2
0
0
0
0
1
1
1
1
0
0

b1
0
0
1
1
0
0
1
1
0
0

b0
0
1
0
1
0
1
0
1
0
1

A
1
1
1
1
1
1
1
0
0

B
1
1
1
0
0
0
0
1
1

C
1
0
0
1
1
0
0
1
1

D
0
1
0
1
0
1
0
1
0

Signal
1
1
0
1
0
1
0
1
0
1
0

A
0
0
0
0
0
0
0
0
1
1

B
0
0
0
0
1
1
1
1
0
0

C
0
0
1
1
0
0
1
1
0
0

D
0
1
0
1
0
1
0
1
0
1

The latch:
Positive logic
Latch
Signal
1
0



1
1
0
1
0
1
0
1
0
1

The negative logic:
Binary-coded
decimal value



Signal

Negative logic
Latch
Signal
0
1

The setting value of the parameter n:
Number of
seven-segment displays
Output
(Binary-coded
+
decimal code)

One

Two
-

+

-

Latch

+

-

+

-

+

-

+

-

n

0

1

2

3

4

5

6

7

‘+’: Positive logic
‘-’: Negative logic

6-375

Ch ap te r 6 Ap plie d Instruc tions



The connection of the common-anode four-digit seven-segment display with IC 7447 is
as follows.
8

4

2

3

10

1

1K

5VDC

1

0

10 10

120
Vcc

B

+

2

10

C

f

LT

g

RBO

a

RBI

b

D

c

A

d

GND

e

3 a

f 2 1 b

e d c h

g 0

IC7447
ZP

6-376

A H 5 00 Prog r am m ing M an ua l

6.19 Communication Instructions
6.19.1 List of Communication Instructions
API

Instruction code
16-bit
32-bit

Pulse
instruction

1800

RS

–

–

1801

FWD

–

–

1802

REV

–

–

1803

STOP

–

–

1804

RDST

–

–

1805

RSTEF

–

–

1806
1807

LRC
CRC

–
–




1808

MODRW

–

–

1809

READ

–

–

1810

WRITE

–

–

1811

RPASS

–

–

Function
Transmitting the user-defined
communication command
The AC motor drive runs
clockwise.
The AC motor drive runs
counterclockwise.
The AC motor drive stops.
Reading the statuses of the AC
motor drives
Resetting the abnormal AC
motor drives
Longitudinal parity check
Cyclic Redundancy Check
Reading/Writing the Modbus
data
Reading the data from the
remote device through routing
Writing the data into the remote
device through routing
Passing the packet to the
remote device through routing

Step

Page
number

9

6-378

7

6-391

7

6-392

3

6-393

5

6-397

3

6-400

7
7

6-403
6-406

11

6-409

9

6-422

9

6-426

7

6-429

6-377

C h ap te r 6 A p pl ie d Ins t r uc t i on

6.19.2 Explanation of Communication Instructions
API

Instruction code

Operand

1800

RS

S, m, D, n

Device

X

Y

S
m
D
n











M

S

T

C











HC

Function

D

L











Transmitting the user-defined
communication command
SM SR

E

PR





K

16# “$”









DF

Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
-

AH

-

Symbol:
: Initial transmission device

Word

m : Number of data which is sent

Word

D : Initial reception device

Word

S

n

: Number of data which is received

Word

Explanation:
1.

2.
3.
4.
5.

6.
7.
8.
9.

The instruction is for the CPU module equipped with RS-485 or RS-232. Data has to be stored
in m data registers starting from the data register specified by S, and users need to set n data
registers starting from the data register specified by D. If S and D are modified by the index
registers, please do not alter the values in the index registers during the execution of the
instruction. Otherwise, a read error or a write error will occur.
If there is no need for the data to be sent, m can be 0. If there is no need for the data to be
received, n can be 0.
The instruction can be used several times in the program, but one instruction is executed at a
time.
During the execution of the instruction RS, the alteration of the data which is sent is invalid.
If the peripheral device is equipped with RS-485 or RS-232, and the communication protocol
used with the device is openly published, users can use the instruction RS to transmit the data
between the PLC and the peripheral device.
If the communication protocol used with the device is consistent with Modbus, users can use
the instruction MODRW.
Please refer to the additional remark below for more information about SM96~SM105, which
are related to RS485 or RS-232.
m: The size of the data which is sent (0~1000 bytes)
n: The size of the data which is received (0~1000 bytes)

Example 1:
8-bit mode (SM106/SM107 is ON.)/16-bit mode (SM106/SM107 is OFF.):
1.
8-bit mode: The command which is edited is stored in the initial transmission device, and the
command which will be sent include the head code and the tail code. The 16-bit data is divided
into the high 8-bit data and the low 8-bit data. The high 8-bit data is ignored, and the low 8-bit
data can be sent or received. (Take standard Modbus for example.)
Sending the data: (PLC→External equipment)

6-378

A H 5 00 Prog r am m ing M an ua l

Receiving the data: (External equipment→PLC)

2.

The command which is edited is stored in the initial transmission device, and the command
which will be sent include the head code and the tail code. The 16-bit data is divided into the
high 8-bit data and the low 8-bit data.
Sending the data: (PLC→External equipment)

Receiving the data: (External equipment→PLC)

The data which the PLC receives from the external equipment includes the head and the tail
code. Therefore, users have to be aware of the setting of n.
Example 2:
1.
2.

3.

Write the data which will be sent into the registers starting from D10, and then set SM96 to ON.
When X0.1 and X0.3 are ON, the instruction RS is executed. The data in the n registers
starting from D10 is sent. After the sending of the data is complete, SM96 is reset to OFF
automatically. (Please do not use the instruction RST to reset SM96.) If there is data which
needs to be received, the data is stored in the registers starting from D100.
After the receiving of the data is complete, SM100 is ON. Besides, SM100 has to be reset to
OFF after the data which has been received is processed. Please do not execute the

6-379

C h ap te r 6 A p pl ie d Ins t r uc t i on

4.

instruction RST continuously.
If the command which the PLC receives includes a special character, I32 will be triggered. The
value in D30 will increase by one.
The main program:

The interrupt task (I32):

16-bit mode:
PLCExternal equipment
The AH500 series PLC sends “:00 03 1000 0002 EB CR LF”.
External equipmentPLC
The AH500 series PLC receives “:00 03 04 0E34 04E6 CD CR LF”.
The transmission registers in the PLC:
(The PLC sends the message.)
Register
Data
D10
16#3A
STX
‘:’
Low 8 bits
D10
‘0’
16#30
ADR 0
High 8 bits
D11
‘0’
16#30
ADR 0
Low 8 bits
D11
‘0’
16#30
CMD 0
High 8 bits
D12
‘3’
16#33
CMD 3
Low 8 bits

6-380

Description

ADR (00) is the station address of the
external equipment.

CMD (03) is the command code.

A H 5 00 Prog r am m ing M an ua l

Register
Data
Description
D12
‘1’
16#31
High 8 bits
D13
‘0’
16#30
Low 8 bits
Initial data address
D13
‘0’
16#30
High 8 bits
D14
‘0’
16#30
Low 8 bits
D14
‘0’
16#30
High 8 bits
D15
‘0’
16#30
Low 8 bits
Number of data (counted by the word)
D15
‘0’
16#30
High 8 bits
D16
‘2’
16#32
Low 8 bits
D16
‘E’
16#45
LRC CHK 1
High 8 bits
LRC CHK (01) is the error
checking
code.
D17
‘B’
16#42
LRC CHK 0
Low 8 bits
D17
CR
16#0D
High 8 bits
END
D18
LF
16#0A
Low 8 bits
The reception registers in the PLC
(The external equipment responds with the message.)
Register
Data
Description
D100
16#3A
STX
‘:’
Low 8 bits
D100
‘0’
16#30
ADR 0
High 8 bits
D101
‘0’
16#30
ADR 0
Low 8 bits
D101
‘0’
16#30
CMD 1
High 8 bits
D102
‘3’
16#33
CMD 0
Low 8 bits
D102
‘0’
16#30
High 8 bits
Number of data (counted by the byte)
D103
‘4’
16#34
Low 8 bits
D103
‘0’
16#30
High 8 bits
D104
‘E’
16#45
Low 8 bits
Data in the device at address 16#1000
D104
‘3’
16#33
High 8 bits
D105
‘4’
16#34
Low 8 bits

6-381

C h ap te r 6 A p pl ie d Ins t r uc t i on

Register
Data
D105
‘0’
16#30
High 8 bits
D106
‘4’
16#34
Low 8 bits
D106
‘E’
16#45
High 8 bits
D107
‘6’
16#36
Low 8 bits
D107
‘C’
16#43
High 8 bits
D108
‘D’
16#44
Low 8 bits
D108
CR
16#0D
High 8 bits
D109
LF
16#0A
Low 8 bits
8-bit mode:
PLCExternal equipment

Description

Data in the device at address 16#1001

LRC CHK 1
LRC CHK 0

END

The PLC sends “:00 03 1000 0003 EA CR LF”.
External equipmentPLC
The PLC receives “:00 03 06 1234 5678 95A5 A9 CR LF”.
The transmission registers in the PLC:
(The PLC sends the message.)
Register
Data
D10
16#3A
STX
‘:’
Low 8 bits
D11
‘0’
16#30
ADR 0
Low 8 bits
D12
‘0’
16#30
ADR 0
Low 8 bits
D13
‘0’
16#30
CMD 0
Low 8 bits
D14
‘3’
16#33
CMD 3
Low 8 bits
D15
‘1’
16#31
Low 8 bits
D16
‘0’
16#30
Low 8 bits
Initial data address
D17
‘0’
16#30
Low 8 bits
D18
‘0’
16#30
Low 8 bits

6-382

Description

ADR (00) is the station address
of the external equipment.

CMD (03) is the command code.

A H 5 00 Prog r am m ing M an ua l

Register
Data
Description
D19
‘0’
16#30
Low 8 bits
D20
‘0’
16#30
Low 8 bits
Number of data (counted by the word)
D21
‘0’
16#30
Low 8 bits
D22
‘3’
16#33
Low 8 bits
D23
‘E’
16#45
LRC CHK 1
Low 8 bits
LRC CHK (01) is the error
checking code.
D24
‘A’
16#41
LRC CHK 0
Low 8 bits
D25
CR
16#0D
Low 8 bits
END
D26
LF
16#0A
Low 8 bits
The reception registers in the PLC
(The external equipment responds with the message.)
Register
Data
Description
D100
16#3A
STX
‘:’
Low 8 bits
D101
‘0’
16#30
ADR 0
Low 8 bits
D102
‘0’
16#30
ADR 0
Low 8 bits
D103
‘0’
16#30
CMD 0
Low 8 bits
D104
‘3’
16#33
CMD 3
Low 8 bits
D105
‘0’
16#30
Low 8 bits
Number of data (counted by the byte)
D106
‘6’
16#36
Low 8 bits
D107
‘1’
16#31
Low 8 bits
D108
‘2’
16#32
Low 8 bits
Data in the device at address 16#1000
D109
‘3’
16#33
Low 8 bits
D110
‘4’
16#34
Low 8 bits
D111
‘5’
16#35
Low 8 bits
D112
‘6’
16#36
Low 8 bits
Data in the device at address 16#1001
D113
‘7’
16#37
Low 8 bits
D114
‘8’
16#38
Low 8 bits

6-383

C h ap te r 6 A p pl ie d Ins t r uc t i on

Register
D115
Low 8 bits
D116
Low 8 bits
D117
Low 8 bits
D118
Low 8 bits
D119
Low 8 bits
D120
Low 8 bits
D121
Low 8 bits
D122
Low 8 bits

Data
‘9’

16#39

‘5’

16#35

Description

Data in the device at address 16#1002
‘A’

16#41

‘5’

16#35

‘A’

16#41

LRC CHK 1

‘9’

16#39

LRC CHK 0

CR

16#0D
END

LF

16#0A

Additional remark:
1.

If the value in m exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#200B.
2.
If the value in n exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#200B.
3.
The flags related to the instruction RS/MODRW:
Flag
Description
Action
COM1 COM2
The communication protocol changes in accordance with the setting
values in SR201, SR202, SR209, SR210, SR211, SR212, SR213,
SR214, SR215, SR216, SM210, and SM212. If SM209/SM211 is
SM209 SM211 set to ON, the communication protocol of COM1/COM2 changes in Users set the
accordance with the setting values in SR201, SR202, SR209,
flag to ON,
SR210, SR211, SR212, SR213, SR214, SR215, SR216, SM210,
and the
and SM212. Besides, the system automatically resets
system
SM209/SM211 to OFF.
automatically
The data is sent through COM1/COM2. If users want to use the
resets it to
instruction RS/MODRW to send and receive the data, they have to OFF.
use the pulse instruction to set SM96/SM97 to ON. When the
SM96 SM97
instruction is executed, the PLC sends and receives the data. After
the sending of the data is complete, the system automatically resets
SM96/SM97 to OFF.
The system
Reception through COM1/COM2 is complete. After the receiving of
automatically
the data is complete, the system automatically sets SM100/SM101
sets the flag
SM100 SM101 to ON. When SM100 is ON, the data received can be processed.
to ON, and
After the processing of the data received is complete, users have to
users reset it
reset SM100/SM101 to OFF.
to OFF.
The system
automatically
sets the flag
SM98 SM99 When SM98/SM99 is ON, the PLC is waiting to receive the data.
to ON and
resets it to
OFF.

6-384

A H 5 00 Prog r am m ing M an ua l

Flag
COM1 COM2

Description

If users set the communication timeout (in SR210, SR211/SR213,
and SR214) and no data is received after the timeout period, the flag
SM104 SM105
is ON. After the problem is solved, users have to reset
SM104/SM105 to OFF.

An error occurs during the reception of the data by using the
SM102 SM103 instruction MODRW or the instruction RS. The error codes are
recorded in the error logs.

Action
The system
automatically
sets the flag
to ON, and
users reset it
to OFF.
The system
automatically
sets the flag
to ON, and
users reset it
to OFF.

The choice between the ASCII mode and the RTU mode (used with
the instruction MODRW)
SM210 SM212
ON: The RTU mode
Users set the
OFF: The ASCII mode
flag to ON
and reset it
The choice between the 8-bit processing mode and the 16-bit
to OFF.
processing mode
SM106 SM107
ON: The 8-bit processing mode
OFF: The 16-bit processing mode
4.
The special data registers related to the instruction RS/MODRW:
Special data
register
Description
COM1 COM2
SR201 SR202 The communication address of COM1/COM2 on the PLC as a slave
Communication timeout
Suppose the setting value is larger than 0. When the instruction RS/MODRW is
SR210 SR213 executed, SM104/SM105 is set to ON if no data is received after the timeout
period or the time intervening two characters exceeds the setting value. After the
problem is solved, users have to reset SM104/SM105 to OFF.
Number of times the command is resent
If the communication timeout occurs, the communication command is resent to
SR211 SR214 the slave several times. If the number of times the command is resent reaches
the number of times which is set, the command will not be resent, and the
communication timeout will occur in the slave.
The interrupt character used in the instruction RS
SR621
X
If the character received is the low 8-bit data in SR621, I32 will be triggered. If n
is 0, the interrupt task will not be triggered.
The interrupt character used in the instruction RS
X
SR622 If the character received is the low 8-bit data in SR622, I33 will be triggered. If n
is 0, the interrupt task will not be triggered.

6-385

C h ap te r 6 A p pl ie d Ins t r uc t i on
5.

6.

SR209 and SR212: The setting values of the communication protocols are shown in the
following table.
Data length
7 (value=0)
8 (value=1)
b0
00
: None
b1
: Odd parity bits
Parity bits
01
b2
10
: Even parity bits
Stop bit
1 bit (value=0)
2 bits (value=1)
b3
b4
0001 (16#1) : 4800
b5
0010 (16#2) : 9600
b6
b7
0011 (16#3) : 19200
0100

(16#4) :

38400

0101

(16#5) :

57600

0110

(16#6) :

115200

0111

(16#7) :

260400

1000

(16#8) :

520800

1001

(16#9) :

1041600

RS-232 does not support the
baud rate.
RS-232 does not support the
baud rate.
RS-232 does not support the
baud rate.

b8~b15 Undefined (reserved)
The example of the communication format:
The communication format: Baud rate 9600 7, N, 2
After checking the table, users can get the communication format 16#0028. Write 16#0028
into SR209.

SM210/SM212:The choice between the ASCII mode and the RTU mode
ON: The RTU mode
OFF: The ASCII mode
Take the standard Modbus format for example.

6-386

A H 5 00 Prog r am m ing M an ua l
The ASCII mode (SM210/SM212 is OFF):
STX

The start-of-text character is ‘:’ (16#3A).

Communication address:
Address Hi
The 8-bit address is composed of two ASCII codes.
Address Lo
Function code:
Function Hi
The 8-bit function code is composed of two ASCII codes.
Function Lo
Data (n-1)
Data:
…….
The n×8-bit data is composed of 2n ASCII codes.
Data 0
LRC check code:
LRC CHK Hi
The 8-bit check code is composed of two ASCII codes.
LRC CHK Lo
End-of-text character:
END Hi
END Hi=CR (16#0D), END Lo=LF (16#0A)
END Lo
The communication protocol in the Modbus ASCII mode: Every byte is composed of two ASCII
characters. For example, the value 16#64 is represented by ‘64’, which consists of the ASCII
characters ‘6’ (16#36) and ‘4’ (16#34). Every hexadecimal value corresponds to an ASCII
code.
‘0’
‘1’
‘2’
‘3’
‘4’
‘5’
‘6’
‘7’
Character
16#30
16#31
16#32
16#33
16#34
16#35
16#36
16#37
ASCII code
Character
ASCII code

‘8’
16#38

‘9’
16#39

‘A’
16#41

‘B’
16#42

‘C’
16#43

‘D’
16#44

‘E’
16#45

‘F’
16#46

Start-of-text character (STX):The start-of-text character is fixed to be ‘:’ (16#3A).
Communication address:
‘0’ ‘0’: Broadcasting to all drives
‘0’ ‘1’: Broadcasting to the drive at address 01
‘0’ ‘F’: Broadcasting to the drive at address 15
‘1’ ‘0’: Broadcasting to the drive at address 16
…
‘F’ ‘F’: Broadcasting to the drive at address 255
Function code:
‘0’ ‘3’: Reading the data from several registers
‘0’ ‘6’: Writing the one-bit data into the register
‘1’ ‘0’: Writing the data into several registers
Data: The data which users send
LRC check code: The values starting from the communication address to the data are added
up. The two’s complement of the sum gotten is the LRC check code.
Example:
16#01+16#03+16#21+16#02+16#00+16#02=16#29
The two’s complement of 16#29 is 16#D7.
End-of-text character: The end-of-text character is composed of CR (16#0D) and LF (16#0A).

6-387

C h ap te r 6 A p pl ie d Ins t r uc t i on
Example: Reading the data from the two registers in the drive at address 16#01
The initial register address is 16#2102.
Inquiry message:
Response message:
STX
Address
Function

Initial register address

Number of data
(counted by the word)
LRC check code
END

‘:’
‘0’
‘1’
‘0’
‘3’
‘2’
‘1’
‘0’
‘2’
‘0’
‘0’
‘0’
‘2’
‘D’
‘7’
CR
LF

STX
Address
Function
Number of data
(counted by the byte)
Contents of the register
at address
16#2102
Contents of the register
at address
16#2103
LRC check code
END

‘:’
‘0’
‘1’
‘0’
‘3’
‘0’
‘4’
‘1’
‘7’
‘7’
‘0’
‘0’
‘0’
‘0’
‘0’
‘7’
‘1’
CR
LF

The RTU mode (SM210/SM212 is ON):
Please refer to the explanation below.
Start
Communication address: 8-bit binary address
Address
Function code: 8-bit binary function code
Function
DATA (n-1)
Data:
…….
n×8-bit data
DATA 0
CRC check code:
CRC CHK Low
The 16-bit check code is composed of two 8-bit codes.
CRC CHK High
Please refer to the explanation below.
END
Communication address:
16#00: Broadcasting to all drives
16#01: Broadcasting to the drive at address 01
16#0F: Broadcasting to the drive at address 15
16#10: Broadcasting to the drive at address 16
…
16#FE: Broadcasting to the drive at address 247
Function code:
16#03: Reading the data from several registers
16#06: Writing the one-bit data into the register
16#10: Writing the data into several registers
Data: The data which users send
CRC check code: The operations are performed on the communication address and the data.
The operation rule is as follows.
Step 1: Suppose the data in the 16-bit register (the register in which the CRC check code is
stored) is 16#FFFF.
Step 2: The logical operator XOR takes the first 8-bit message and the low 8-bit data in the

6-388

A H 5 00 Prog r am m ing M an ua l
16-bit register, and performs the logical exclusive OR operation on each pair of
corresponding bits. The operation result is stored in the 16-bit register.
Step 3: The values of the bits in the 16-bit registers are shifted by one bit to the right. The value
of the highest bit becomes 0.
Step 4: If the value of the right-most bit which is shifted to the right is 0, the data gotten from
step 3 is stored in the 16-bit register. Otherwise, the logical operator XOR takes
16#A001 and the data in the 16-bit register, and performs the logical exclusive OR
operation on each pair of corresponding bits. The operation result is stored in the 16-bit
register.
Step 5: Repeat step 3 and step 4, and perform the operation on the 8-bit message.
Step 6: Repeat step 2~step 5, and get the next 8-bit message. Perform the operations on all
messages. The final result in the 16-bit register is the CRC check code. Notice that the
low 8-bit data in the 16-bit register is interchanged with the high 8-bit data in the 16-bit
register before the CRC check code is put into the check code of the message.
Start/End:
The data transmission speed is as follows.
Baud rate (bps) RTU timeout Timer (ms) Baud rate (bps) RTU timeout timer (ms)
4800
9
115200
1
9600
5
260400
1
19200
3
520800
1
38400
2
1041600
1
57600
1
Example: Reading the data from the two registers in the drive at address 16#01
The initial register address is 16#2102.
Inquiry message:
Response message:
16#01
16#01
Address
Address
16#03
16#03
Function
Function
16#21
Number of data
16#04
Initial register address
(counted by the byte)
16#02
16#00
16#17
Contents of the register
Number of data
at address
(counted by the word)
16#70
16#02
16#2102
16#6F
16#00
CRC CHK Low
Contents of the register
at address
16#00
16#F7
CRC CHK High
16#2103
16#FE
CRC CHK Low
16#5C
CRC CHK High

6-389

C h ap te r 6 A p pl ie d Ins t r uc t i on
7.

The timing diagram of the communication flags:

6-390

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1801

FWD

S1, S2, n

The AC motor drive runs clockwise.

Device

X

Y

M

S

T

C

HC

S1
S2
n

D

L









SM SR

E

PR

K









16# “$”

DF





Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Unit address

Word

S2 : Operation frequency of the AC motor drives

Word

n : Mode

Word

6-391

C h ap te r 6 A p pl ie d Ins t r uc t i on

API

Instruction code

Operand

Function

1802

REV

S1, S2, n

The AC motor drive runs counterclockwise.

Device

X

Y

M

S

T

C

HC

S1
S2
n

D

L









SM SR

E

PR

K









16# “$”

DF





Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
-

AH

-

Symbol:

6-392

S1 : Unit address

Word

S2 : Operation frequency of the AC motor drives

Word

n : Mode

Word

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1803

STOP

S1

The AC motor drive stops.

Device

X

S1

Y

M

S

T

C

HC

D

L





SM SR

E

PR

K





16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

-

-

Symbol:

S1 : Unit address

Word

Explanation:
1.
2.
3.
4.

5.

The instruction FWD/REV/STOP is for the Delta VFD series AC motor drives.
FWD/REV/STOP has to be used with SR210 or SR213.
The operand S1 should be within the range between 0 and 255. If the station address is 0, it
indicates that the PLC broadcasts to all AC motor drives.
Please refer to AC Motor Drives User Manual for more information about the setting of S2.
There is no S2 in the instruction STOP.
FWD: Clockwise running mode
n=0: General clockwise running mode
n=1: Jog clockwise running mode
FWD does not support n if n is neither 0 nor 1.
REV: Counterclockwise running mode
n=0: General counterclockwise running mode
n=1: Jog counterclockwise running mode
REV does not support n if n is neither 0 nor 1.
STOP: None
If the clockwise running mode is the jog clockwise running mode, S2 is ineffective. Users can
refer to AC Motor Drives User Manual for more information about the modification of the jog
frequency.

Example:
1.

The PLC is connected to the VFD series AC motor drive. If the communication timeout occurs
or an error occurs during the reception of the data, the PLC retries the sending of the
command.

6-393

C h ap te r 6 A p pl ie d Ins t r uc t i on

PLCVFD
The PLC sends “:01 10 2000 0002 04 0012 01F4 C2 CR LF”.
VFDPLC
The PLC receives “:01 10 2000 0002 CD CR LF”.

6-394

A H 5 00 Prog r am m ing M an ua l
The PLC sends the data.
Data
‘0’
16#30
ADR 1
‘1’
16#31
ADR 0
‘1’
16#31
CMD 1
‘0’
16#30
CMD 0
‘2’
16#32
‘0’
16#30
Data address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’

Description
ADR (10) is the station address of the AC motor
drive.
CMD (10) is the command code.

16#30

Data
‘0’
16#30
‘2’
16#32
‘0’
16#30
Number of bytes
‘4’
16#34
‘0’
16#30
‘0’
16#30
Data 1
16#12: The AC motor drive runs clockwise.
‘1’
16#31
‘2’
16#32
‘0’
16#30
‘1’
16#31
Data 2
Operation frequency=K500Hz 16#01F4
‘F’
16#46
‘4’
16#34
‘C’
16#43
LRC CHK 1
LRC CHK (01) is the error checking code.
‘2’
16#32
LRC CHK 0
The PLC receives the data.
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the AC motor
drive.
‘1’
16#31
ADR 0
‘1’
16#31
CMD 1
CMD (10) is the command code.
‘0’
16#30
CMD 0
‘2’
16#32
‘0’
16#30
Data address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’
16#30
Number of Registers
‘0’
16#30
‘2’
16#32
‘C’
16#43
LRC CHK 1
‘D’
16#44
LRC CHK 0
Additional remark:
1.
2.
3.

Please refer to the additional remark on the instruction RS for more information about the
related flags and the special registers.
The instructions FWD, REV, STOP, RDST, and RSTEF can be used several times in the
program, but one instruction is executed at a time.
If the value in S1 exceeds the range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-395

C h ap te r 6 A p pl ie d Ins t r uc t i on
4.
5.

If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.
The instructions FWD, REV, STOP, RDST, and RSTEF are consistent with the Modbus
communication format.

6-396

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

1804

RDST

S, D

Device

X

Y

M

S

T

C

Function
Reading the statuses of the AC motor
drives

HC

S
D

D

L







SM SR

E

PR

K






16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
-

AH

-

Symbol:
S : Unit address

Word

D : Initial device in which the data is stored

Word

Explanation:
1.
2.
3.

4.

The operand S should be within the range between 1 and 255. It can not be 0.
D: The data which the PLC receives from the AC motor drives is stored in the device specified
by users.
The instruction is used to read the states of the devices at the addresses 16#2100~16#2104 in
the AC motor drive. (Please refer to AC Motor Drive User Manual for more information about
the states of the devices.) The data which is received is stored in the device specified by D.
However, the data in D can not be altered if the communication timeout occurs or an error
occurs during the reception of the data. Therefore, make sure of the setting of SM100/SM101
before the PLC reads the states of the devices in the AC motor drive.
The operand D occupies five registers, i.e. Dn, Dn+1, Dn+2, Dn+3, and Dn+4.

Example:
1.
2.

The PLC is connected to the VFD series AC motor drive (ASCII mode: SM210 and SM212 are
OFF). If the communication timeout occurs, the PLC retries the sending of the command.
The PLC reads the states of the devices at the addresses 16#2100~16#2104 in the AC motor
drive. The data which is received is stored in D100~D104.

6-397

C h ap te r 6 A p pl ie d Ins t r uc t i on

PLCVFD
The PLC sends “:01 03 2100 0005 D6 CR LF” (ASCII).
VFDPLC
The PLC receives “:01 03 0A 0000 0500 01F4 0000 0000 F8 CR LF” (ASCII).
The PLC sends the data.
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the AC motor drive.
‘1’
16#31
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘3’
16#33
CMD 0
2’
16#32
‘1’
16#31
Initial data address
‘0’
16#30

6-398

‘0’

16#30

‘0’
‘0’
‘0’
‘5’
‘D’
‘6’

16#30
16#30
16#30
16#35
16#44
16#36

Number of data (counted by the word)
LRC CHK 1
LRC CHK 0

LRC CHK (01) is the error checking code.

A H 5 00 Prog r am m ing M an ua l
The PLC receives the data.
Data
Description
‘0’
16#30
ADR 1
‘1’
16#31
ADR 0
‘0’
16#30
CMD 1
‘3’
16#33
CMD 0
‘0’
16#30
Number of data (counted by the byte)
‘A’
16#41
‘0’
16#30
The PLC automatically converts the ASCII
‘0’
16#30
Data in the device at
character into the value 16#0000, and 16#0000
address 16#2100
‘0’
16#30
is stored in D100.
‘0’
16#30
‘0’
16#30
The PLC automatically converts the ASCII
‘5’
16#35
Data in the device at
character into the value 16#0500, and 16#0500
address 16#2101
‘0’
16#30
is stored in D101.
‘0’
16#30
‘0’
16#33
The PLC automatically converts the ASCII
‘1’
16#45
Data in the device at
character into the value 16#01F4, and 16#01F4
address 16#2102
‘F’
16#30
is stored in D1072.
‘4’
16#30
‘0’
16#30
The PLC automatically converts the ASCII
‘0’
16#30
Data in the device at
character into the value 16#0000, and 16#0000
address 16#2103
‘0’
16#30
is stored in D1073.
‘0’
16#30
‘0’
16#30
The PLC automatically converts the ASCII
‘0’
16#30
Data in the device at
character into the value 16#0000, and 16#0000
address 16#2104
‘0’
16#30
is stored in D1074.
‘0’
16#30
‘2’
16#32
LRC CHK 1
‘A’
16#41
LRC CHK 0
Additional remark:
1.
2.
3.
4.
5.

Please refer to the additional remark on the instruction RS for more information about the
related flags and the special registers.
The instructions FWD, REV, STOP, RDST, and RSTEF can be used several times in the
program, but one instruction is executed at a time.
If the value in S exceeds the range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If D+4 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If users declare the operand D in ISPSoft, the data type will be ARRAY [5] of WORD/INT.

6-399

C h ap te r 6 A p pl ie d Ins t r uc t i on

API

Instruction code

Operand

Function

1805

RSTEF

S

Resetting the abnormal AC motor drives

Device

X

Y

M

S

T

C

HC

S

D

L





SM SR

E

PR

K





16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
-

AH

-

Symbol:

S : Unit address

Word

Explanation:
1.

The operand S should be within the range between 0 and 255. If the station address is 0, it
indicates that the PLC broadcasts to all AC motor drives.

Example: COM2 (RS-485)
The PLC is connected to the VFD series AC motor drive (ASCII mode: SM210 and SM212 are OFF.).
If the communication timeout occurs, the PLC retries the sending of the command.

6-400

A H 5 00 Prog r am m ing M an ua l

PLCVFD
The PLC sends “:01 06 2002 0002 D5 CR LF” (ASCII).
VFDPLC
The PLC receives “:01 06 2002 0002 D5 CR LF” (ASCII).
The PLC sends the data.
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the AC motor drive.
‘1’
16#31
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘6’
16#36
CMD 0
‘2’
16#32
‘0’
16#30
Data address
‘0’
16#30
‘2’
16#32
‘0’
16#30
‘0’
16#30
Data
‘0’
16#30
‘2’
16#32
‘D’
16#44
LRC CHK 1
LRC CHK (01) is the error checking code.
‘5’
16#35
LRC CHK 0

6-401

C h ap te r 6 A p pl ie d Ins t r uc t i on
The PLC receives the data.
Data
‘0’
16#30
ADR 1
‘1’
16#31
ADR 0
‘0’
16#30
CMD 1
‘6’
16#36
CMD 0
‘2’
16#32
‘0’
16#30
Data address
‘0’
16#30
‘2’
16#32
‘0’
16#30
‘0’
16#30
Number of registers
‘0’
16#30
‘2’
16#32
‘D’
16#44
LRC CHK 1
‘5’
16#35
LRC CHK 0

Description

Additional remark:
1.
2.
3.

Please refer to the additional remark on the instruction RS for more information about the
related flags and the special registers.
The instructions FWD, REV, STOP, RDST, and RSTEF can be used several times in the
program, but one instruction is executed at a time.
If the value in S exceeds the range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-402

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1806

LRC

S, n, D

Longitudinal parity check

Device

X

Y

S
n
D









M

S

T

C









HC

D

L









SM SR

E

PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
-

AH

-

Symbol:
S : Initial device to which the LRC is applied

Word

n : Number of bytes

Word

D : Initial device in which the operation result is stored

Word

Explanation:
1.
2.

3.

4.

Please refer to the additional remark on the instruction LRC for more information about the
LRC check code.
The operand n should be an even number, and should be within the range between 1 and
1000. If n is not within the range, the operation error occurs, the instruction is not executed,
SM0 and SM1 are ON, and the error code in SR0 is 16#200B.
The 16-bit conversion mode: When SM606 is OFF, the hexadecimal data in the device
specified by S is divided into the high 8-bit data and the low 8-bit data. The LRC is applied to
every byte, and the operation result is stored in the high 8-bit and the low 8-bit in the device
specified by D. The number of bytes depends on n.
The 8-bit conversion mode: When SM606 is ON, the hexadecimal data in the device specified
by S is divided into the high 8-bit data (invalid data) and the low 8-bit data. The LRC is applied
to every byte, and the operation result is stored in the low 8-bit in the two registers. The
number of bytes depends on n. (The values of the high 8 bits in the two registers are 0.)

Example:
1.

The PLC is connected to the VFD-S series AC motor drive (ASCII mode: SM210 is OFF; 8-bit
mode: SM606 is ON.). The PLC sends the command, and reads the data in the six devices at
the addresses starting from 16#2101 in the VFD-S series AC motor drive.
PLCVFD-S
The PLC sends “:01 03 2101 0006 D4 CR LF”.

6-403

C h ap te r 6 A p pl ie d Ins t r uc t i on
The PLC sends the data.
Register
Data
Description
D100
16#3A STX
‘:’
Low 8 bits
D101
‘0’
16#30 ADR 1
Low 8 bits
AD (1, 0) is the station address
of the AC motor drive.
D102
‘1’
16#31 ADR 0
Low 8 bits
D103
‘0’
16#30 CMD 1
Low 8 bits
CMD (10) is the command
code.
D104
‘3’
16#33 CMD 0
Low 8 bits
D105
‘2’
16#32
Low 8 bits
D106
‘1’
16#31
Low 8 bits
Initial data address
D107
‘0’
16#30
Low 8 bits
D108
‘1’
16#31
Low 8 bits
D109
‘0’
16#30
Low 8 bits
D110
‘0’
16#30
Low 8 bits
Number of data (counted by the word)
D111
‘0’
16#30
Low 8 bits
D112
‘6’
16#36
Low 8 bits
D113
‘D’
16#44 LRC CHK 0
Low 8 bits
LRC CHK (01) is the error
checking code.
D114
‘4’
16#34 LRC CHK 1
Low 8 bits
D115
CR
16#0D
Low 8 bits
END
D116
LF
16#0A
Low 8 bits
LRC CHK (01) above is the error checking code. It can be calculated by means of the
instruction LRC. (8-bit mode: SM606 is ON.)

LRC check code: 16#01+16#03+16#21+16#01+16#00+16#06=16#2C
The two’s complement of 16#2C is 16#D4. ‘D’ (16#44) is stored in the low
8-bit in D113, and ‘4’ (16#34) is stored in the low 8-bit in D114.
Additional remark:
1.

The format of the communication data in the ASCII mode:

6-404

A H 5 00 Prog r am m ing M an ua l

STX

‘:’

The start-of-text character is ‘:’ (16#3A).

Address Hi
Address Lo
Function Hi
Function Lo

Communication address:
The 8-bit address is composed of two ASCII codes.
Function code:
The 8-bit function code is composed of two ASCII codes.

LRC CHK Hi
LRC CHK Lo
END Hi

‘0’
‘1’
‘0’
‘3’
‘2’
‘1’
‘0’
‘2’
‘0’
‘0’
‘0’
‘2’
‘D’
‘7’
CR

LRC check code:
The 8-bit check code is composed of two ASCII codes.
End-of-text character:

END Lo

LF

END Hi=CR(16#0D),END Lo=LF(16#0A)

DATA (n-1)
…….
DATA 0

2.

Data: The n×8-bit data is composed of 2n ASCII codes.

LRC check code: The values starting from the communication address to the data are added
up. The two’s complement of the sum gotten is the LRC check code.
Example:
16#01+16#03+16#21+16#02+16#00+16#02=16#29
The two’s complement of 16#29 is 16#D7.

6-405

C h ap te r 6 A p pl ie d Ins t r uc t i on

API

Instruction code

Operand

Function

1807

CRC

S, n, D

Cyclic Redundancy Check

Device

X

Y

S
n
D









M

S

T

C









HC

D

L









SM SR

E

PR

K







16# “$” DF


Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
-

AH

-

Symbol:
S : Initial device to which the CRC is applied

Word

n : Number of bytes

Word

D : Initial device in which the operation result is stored

Word

Explanation:
1.
2.

3.

4.

Please refer to the additional remark on the instruction CRC for more information about the
CRC check code.
The operand n should be within the range between 1 and 1000. If n is not within the range, the
operation error occurs, the instruction is not executed, SM0 and SM1 are ON, and the error
code in SR0 is 16#200B.
The 16-bit conversion mode: When SM606 is OFF, the hexadecimal data in the device
specified by S is divided into the high 8-bit data and the low 8-bit data. The CRC is applied to
every byte, and the operation result is stored in the high 8-bit and the low 8-bit in the device
specified by D. The number of bytes depends on n.
The 8-bit conversion mode: When SM606 is ON, the hexadecimal data in the device specified
by S is divided into the high 8-bit data (invalid data) and the low 8-bit data. The CRC is applied
to every byte, and the operation result is stored in the low 8-bit in the two registers. The
number of bytes depends on n.

Example:
1.

The PLC is connected to the VFD-S series AC motor drive (RTU mode: SM210 is ON; 16-bit
mode: SM606 is ON.). The value 16#12, which will be written into the device at 16#2000 in the
VFD-S series AC motor drive, is written into the device in the PLC first.
PLCVFD-S
The PLC sends 01 06 2000 0012 02 07.

6-406

A H 5 00 Prog r am m ing M an ua l
The PLC sends the data.
Register
Data
Description
D100
16#01
Address
Low 8 bits
D101
16#06
Function
Low 8 bits
D102
16#20
Low 8 bits
Data address
D103
16#00
Low 8 bits
D104
16#00
Low 8 bits
Data
D105
16#12
Low 8 bits
D106
16#02
CRC CHK 0
Low 8 bits
D107
16#07
CRC CHK 1
Low 8 bits
CRC CHK (01) above is the error checking code. It can be calculated by means of the
instruction CRC. (8-bit mode: SM606 is ON.)

CRC check code: 16#02 is stored in the low 8-bit in D106, and 16#07 is stored in the low 8-bit
in D107.
Additional remark:
1.

2.

The format of the communication data in the RTU mode:
Time interval
START
Communication address: 8-bit binary address
Address
Function code: 8-bit binary code
Function
DATA (n-1)
Data: n×8-bit data
…….
DATA 0
CRC check code:
CRC CHK Low
The 16-bit check code is composed of two 8-bit binary codes.
CRC CHK High
Time interval
END
CRC check code: The check code starts from the address to the data. The operation rule is as
follows.
Step 1: Suppose the data in the 16-bit register (the register in which the CRC check code is
stored) is 16#FFFF.
Step 2: The logical operator XOR takes the first 8-bit message and the low 8-bit data in the
16-bit register, and performs the logical exclusive OR operation on each pair of
corresponding bits. The operation result is stored in the 16-bit register.
Step 3: The values of the bits in the 16-bit registers are shifted by one bit to the right. The
value of the highest bit becomes 0.

6-407

C h ap te r 6 A p pl ie d Ins t r uc t i on
Step 4: If the value of the right-most bit which is shifted to the right is 0, the data gotten from
step 3 is stored in the 16-bit register. Otherwise, the logical operator XOR takes
16#A001 and the data in the 16-bit register, and performs the logical exclusive OR
operation on each pair of corresponding bits. The operation result is stored in the
16-bit register.
Step 5: Repeat step 3 and step 4, and perform the operation on the 8-bit message.
Step 6: Repeat step 2~step 5, and get the next 8-bit message. Perform the operations on all
messages. The final result in the 16-bit register is the CRC check code. Notice that
the low 8-bit data in the 16-bit register is interchanged with the high 8-bit data in the
16-bit register before the CRC check code is put into the check code of the message

6-408

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1808

MODRW

S1, S2, S3, S, n

Reading/Writing the Modbus data

Device

X

Y

S1
S2
S3
S
n













M

S

T

C













HC

D

L













SM SR

E

PR

K

16# “$”



















DF

Pulse instruction 16-bit instruction (11 steps) 32-bit instruction
-

AH

-

Symbol:
S1 : Unit address

Word

S2 : Function code

Word

S3 : Device address

Word

S : Register involved in the reading/writing of the data

Bit/Word

n : Data length

Word

Explanation:
1.
2.

3.
4.

5.

The operand S1 should be within the range between 0 and 255.
S2: The function code
For example:
1 (16#01): The AH500 series PLC reads the data from several bit devices which are not
discrete input devices.
2 (16#02): The AH500 series PLC reads the data from several bit devices which are discrete
input devices.
3 (16#03): The AH500 series PLC reads the data from several word devices which are not
input registers.
4 (16#04): The AH500 series PLC reads the data from several word devices which are input
registers.
5 (16#05): The AH500 series PLC writes the state into a bit device.
6 (16#06): The AH500 series PLC writes the data into a word device.
15 (16#0F): The AH500 series PLC writes the states into several bit devices.
16 (16#10): The AH500 series PLC writes the data into several word devices.
Only the function codes mentioned above are supported, and other function codes can not be
executed. Please refer to the examples below.
S3: The device address
If the device address is illegal, the error occurs. The error code is stored in the error log.
S: The register involved in the reading/writing of the data
The data which will be written into the external equipment is stored in the register in advance.
The data which is read from the external equipment is stored in the register.
n: The length of the data
The size of the data can not be larger than 240 bytes. For the communication commands
related to the coils, the unit of the data is the bit, and n should be within the range between 1
and 1920. For the communication commands related to the registers, the unit of the data is the

6-409

C h ap te r 6 A p pl ie d Ins t r uc t i on

6.
7.

word, and n should be within the range between 1 and 120.
The instruction can be used several times in the program, but one instruction is executed at a
time.
If the communication timeout occurs, SM104 and SM105 are ON. After the problem is solved,
users have to reset SM104 and SM105 to OFF.

Example 1:
1.

2.

Function code 01 (16#01): The AH500 series PLC reads the data from several bit devices
which are not discrete input devices.
The AH500 series PLC is connected to the ES2 series PLC. (ASCII mode: SM210 is OFF.)
The AH500 series PLC is connected to the ES2 series PLC. (RTU mode: SM210 is ON.)
ASCII Mode: The AH500 series PLC is connected to the ES2 series PLC.
When SM96 and X0.0 are on, the AH500 series PLC sends and receives the following
commands.
AHES2
The AH500 series PLC sends “:00 01 0500 0010 EA CR LF”.
ES2AH
The AH500 series PLC receives “:00 01 02 D2 04 27 CR LF”.
The data which the AH500 series PLC receives from the ES2 series PLC is stored in
D10.0~D10.15.
The communication command which the AH500 series PLC sends:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘1’
16#31
CMD 0
‘0’
16#30
‘5’
16#35
Initial Data Address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’
16#30
Number of data (counted by the word)
‘1’
16#31
‘0’
16#30
‘E’
16#45
LRC CHK 1
LRC CHK (01) is the error checking code.
‘A’
16#41
LRC CHK 0
The communication command which the AH500 series PLC receives:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘1’
16#33
CMD 0
‘0’
16#30
Number of data (counted by the byte)
‘2’
16#32
‘D’
16#44
Data (byte 1)
‘2’
16#32
Data (byte 2)
‘0’
16#30
Data (byte 3)
‘4’
16#34
Data (byte 4)
‘2’
16#32
LRC CHK 1
LRC CHK (01) is the error checking code.
‘7’
16#37
LRC CHK 0

6-410

A H 5 00 Prog r am m ing M an ua l
3.

4.
5.
6.

In the ASCII mode, the data which is received is stored as the ASCII character in the internal
register. The AH500 series PLC automatically converts the data into the hexadecimal value,
and the conversion result is stored in S.
In the RTU mode, the data which is received is stored as the hexadecimal values in S.
After the receiving of the data from the ES2 series PLC is complete, SM100 is ON if no error
occurs.
The data which is received from the ES2 series PLC is stored in the device specified by users.
After the receiving of the data is complete, the AH500 series PLC automatically checks
whether the data which is received is correct. If an error occurs, SM102 is ON.

Example 2:
1.

2.

Function code 03 (16#03): The AH500 series PLC reads the data from several word devices
which are not input registers.
The AH500 series PLC is connected to the ES2 series PLC. (ASCII mode: SM210 is OFF.)
The AH500 series PLC is connected to the ES2 series PLC. (RTU mode: SM210 is ON.)
ASCII Mode: The AH500 series PLC is connected to the ES2 series PLC.
When SM96 and X0.0 are on, the AH500 series PLC sends and receives the following
commands.
AHES2
The AH500 series PLC sends “:00 03 1000 0001 EC CR LF”.
ES2AH
The AH500 series PLC receives “:00 03 02 04D2 25 CR LF”.
The data which the AH500 series PLC receives from the ES2 series PLC is stored in D10.

6 - 4 11

C h ap te r 6 A p pl ie d Ins t r uc t i on

3.
4.

5.

6.

The communication command which the AH500 series PLC sends:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘3’
16#33
CMD 0
‘1’
16#31
‘0’
16#30
Initial data address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’
16#30
Number of data (counted by the word)
‘0’
16#30
‘1’
16#31
‘E’
16#45
LRC CHK 1
LRC CHK (01) is the error checking code.
‘C’
16#43
LRC CHK 0
The communication command which the AH500 series PLC receives:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘3’
16#33
CMD 0
‘0’
16#30
Number of data (counted by the byte)
‘2’
16#32
‘0’
16#30
Data (byte 1)
‘4’
16#34
Data (byte 2)
‘D’
16#44
Data (byte 3)
‘2’
16#32
Data (byte 4)
‘D’
16#44
LRC CHK 1
LRC CHK (01) is the error checking code.
‘C’
16#43
LRC CHK 0
After the receiving of the data from the ES2 series PLC is complete, SM100 is ON if no error
occurs.
The data which is received from the ES2 series PLC is stored in the device specified by users.
After the receiving of the data is complete, the AH500 series PLC automatically checks
whether the data which is received is correct. If an error occurs, SM102 is ON.
In the ASCII mode, the data which is received is stored as the ASCII character in the internal
register. The AH500 series PLC automatically converts the data into the hexadecimal value,
and the conversion result is stored in S.
In the RTU mode, the data which is received is stored as the hexadecimal values in S.

6-412

A H 5 00 Prog r am m ing M an ua l

Example 3:
1.

2.

Function code 06 (16#06): The AH500 series PLC writes the data into a word device in the
ES2 series PLC.
The AH500 series PLC is connected to the ES2 series PLC. (ASCII mode: SM210 is OFF.)
The AH500 series PLC is connected to the ES2 series PLC. (RTU mode: SM210 is ON.)
ASCII Mode: The AH500 series PLC is connected to the ES2 series PLC.
When SM96 and X0.0 are on, the AH500 series PLC sends and receives the following
commands.
AHES2
The AH500 series PLC sends “:00 06 1000 1234 A4 CR LF”.
ES2AH
The AH500 series PLC receives “:00 06 1000 1234 A4 CR LF”.
The data which the AH500 series PLC receives from the ES2 series PLC is stored in D10.

6-413

C h ap te r 6 A p pl ie d Ins t r uc t i on

3.
4.

5.

6.

The communication command which the AH500 series PLC sends:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘6’
16#36
CMD 0
1’
16#31
‘0’
16#30
Initial data address
‘0’
16#30
‘0’
16#30
‘1’
16#31
‘2’
16#32
Value in the register
‘3’
16#33
‘4’
16#34
‘A’
16#41
LRC CHK 1
LRC CHK (01) is the error checking code.
‘4’
16#34
LRC CHK 0
The communication command which the AH500 series PLC receives:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘6’
16#36
CMD 0
1’
16#31
‘0’
16#30
Initial data address
‘0’
16#30
‘0’
16#30
‘1’
16#31
‘2’
16#32
Value in the register
‘3’
16#33
‘4’
16#34
‘A’
16#41
LRC CHK 1
LRC CHK (01) is the error checking code.
‘4’
16#34
LRC CHK 0
After the receiving of the data from the ES2 series PLC is complete, SM100 is ON if no error
occurs.
The data which is received from the ES2 series PLC is stored in the device specified by users.
After the receiving of the data is complete, the AH500 series PLC automatically checks
whether the data which is received is correct. If an error occurs, SM102 is ON.
In the ASCII mode, the data which is received is stored as the ASCII character in the internal
register. The AH500 series PLC automatically converts the data into the hexadecimal value,
and the conversion result is stored in S.
In the RTU mode, the data which is received is stored as the hexadecimal values in S.

6-414

A H 5 00 Prog r am m ing M an ua l

Example 4:
1.

2.

Function code 05 (16#05): The AH500 series PLC writes the state into a bit device in the ES2
series PLC.
The AH500 series PLC is connected to the ES2 series PLC. (ASCII mode: SM210 is OFF.)
The AH500 series PLC is connected to the ES2 series PLC. (RTU mode: SM210 is ON.)
ASCII Mode: The AH500 series PLC is connected to the ES2 series PLC.
When SM96 and X0.0 are on, the AH500 series PLC sends and receives the following
commands.
AHES2
The AH500 series PLC sends “:00 05 0500 FF00 F7 CR LF”.
ES2AH
The AH500 series PLC receives “:00 05 0500 FF00 F7 CR LF”.
The communication command which the AH500 series PLC sends:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘5’
16#35
CMD 0
0’
16#30
‘5’
16#35
Initial data address
‘0’
16#30
‘0’
16#30
‘F’
16#46
‘F’
16#46
Output value
‘0’
16#30
‘0’
16#30
‘F’
16#46
LRC CHK 1
LRC CHK (01) is the error checking code.
‘7’
16#37
LRC CHK 0

6-415

C h ap te r 6 A p pl ie d Ins t r uc t i on

3.
4.

5.

The communication command which the AH500 series PLC receives:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘5’
16#35
CMD 0
0’
16#30
‘5’
16#35
Initial data address
‘0’
16#30
‘0’
16#30
‘F’
16#46
‘F’
16#46
Output value
‘0’
16#30
‘0’
16#30
‘F’
16#46
LRC CHK 1
LRC CHK (01) is the error checking code.
‘7’
16#37
LRC CHK 0
After the receiving of the data from the ES2 series PLC is complete, SM100 is ON if no error
occurs.
The data which is received from the ES2 series PLC is stored in the device specified by users.
After the receiving of the data is complete, the AH500 series PLC automatically checks
whether the data which is received is correct. If an error occurs, SM102 is ON.
When the ES2 series PLC receives the communication command, Y0.0 is ON.

Example 5:
1.

2.

Function code 15 (16#0F): The AH500 series PLC writes the states into several bit devices in
the ES2 series PLC.
The AH500 series PLC is connected to the ES2 series PLC. (ASCII mode: SM210 is OFF.)
The AH500 series PLC is connected to the ES2 series PLC. (RTU mode: SM210 is ON.)
ASCII Mode: The AH500 series PLC is connected to the ES2 series PLC.
When SM96 and X0.0 are on, the AH500 series PLC sends and receives the following
commands.
AHES2

6-416

A H 5 00 Prog r am m ing M an ua l

The AH500 series PLC sends “:00 0F 0500 0010 02 FFFF DC CR LF”.
ES2AH
The AH500 series PLC receives “:00 0F 0500 0010 DC CR LF”.

3.
4.

5.

The communication command which the AH500 series PLC sends:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘F’
16#46
CMD 0
0’
16#30
‘5’
16#35
Initial data address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’
16#30
Number of data (counted by the word)
‘1’
16#31
‘0’
16#30
‘0’
16#30
Number of data (counted by the byte)
‘2’
16#32
‘F’
16#46
Data (byte 1)
‘F’
16#46
Data (byte 2)
‘F’
16#46
Data (byte 3)
‘F’
16#46
Data (byte 4)
‘D’
16#44
LRC CHK 1
LRC CHK (01) is the error checking code.
‘C’
16#43
LRC CHK 0
The communication command which the AH500 series PLC receives:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘0’
16#30
CMD 1
CMD (10) is the command code.
‘F’
16#46
CMD 0
0’
16#30
‘5’
16#35
Initial data address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’
16#30
Number of Data (counted by the word)
‘1’
16#31
‘0’
16#30
‘D’
16#44
LRC CHK 1
LRC CHK (01) is the error checking code.
‘C’
16#43
LRC CHK 0
After the receiving of the data from the ES2 series PLC is complete, SM100 is ON if no error
occurs.
The data which is received from the ES2 series PLC is stored in the device specified by users.
After the receiving of the data is complete, the AH500 series PLC automatically checks
whether the data which is received is correct. If an error occurs, SM102 is ON.
When the ES2 series PLC receives the communication command, Y0.0~Y0.15 are ON.

6-417

C h ap te r 6 A p pl ie d Ins t r uc t i on

Example 6:
1.

2.

Function code 16 (16#10): The AH500 series PLC writes the data into several word devices in
the ES2 series PLC.
The AH500 series PLC is connected to the ES2 series PLC. (ASCII mode: SM210 is OFF.)
The AH500 series PLC is connected to the ES2 series PLC. (RTU mode: SM210 is ON.)
ASCII Mode: The AH500 series PLC is connected to the ES2 series PLC.
When SM96 and X0.0 are on, the AH500 series PLC sends and receives the following
commands.
AHES2
The AH500 series PLC sends “:00 10 1000 0002 04 0E34 04E6 AE CR LF”.
ES2AH
The AH500 series PLC receives “:00 10 1000 0002 DE CR LF”.

6-418

A H 5 00 Prog r am m ing M an ua l

3.
4.

5.

The communication command which the AH500 series PLC sends:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘1’
16#31
CMD 1
CMD (10) is the command code.
‘0’
16#30
CMD 0
1’
16#31
‘0’
16#30
Initial data address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’
16#30
Number of data (counted by the word)
‘0’
16#30
‘2’
16#32
‘0’
16#30
Number of data (counted by the byte)
‘4’
16#34
‘0’
16#30
Data (byte 1)
‘E’
16#45
Data (byte 2)
‘3’
16#33
Data (byte 3)
‘4’
16#34
Data (byte 4)
‘0’
16#30
Data (byte 5)
‘4’
16#34
Data (byte 6)
‘E’
16#45
Data (byte 7)
‘6’
16#36
Data (byte 8)
‘A’
16#41
LRC CHK 1
LRC CHK (01) is the error checking code.
‘E’
16#45
LRC CHK 0
The communication command which the AH500 series PLC receives:
Data
Description
‘0’
16#30
ADR 1
ADR (10) is the station address of the slave.
‘0’
16#30
ADR 0
‘1’
16#31
CMD 1
CMD (10) is the command code.
‘0’
16#30
CMD 0
1’
16#31
‘0’
16#30
Initial data address
‘0’
16#30
‘0’
16#30
‘0’
16#30
‘0’
16#30
Number of data (counted by the word)
‘0’
16#30
‘2’
16#32
‘D’
16#44
LRC CHK 1
LRC CHK (01) is the error checking code.
‘E’
16#45
LRC CHK 0
After the receiving of the data from the ES2 series PLC is complete, SM100 is ON if no error
occurs.
The data which is received from the ES2 series PLC is stored in the device specified by users.
After the receiving of the data is complete, the AH500 series PLC automatically checks
whether the data which is received is correct. If an error occurs, SM102 is ON.
When the ES2 series PLC receives the communication command, 16#03E4 and 16#04E6 are
written into D0 and D1.

6-419

C h ap te r 6 A p pl ie d Ins t r uc t i on

Additional remark:
1.
2.
3.
4.
5.

6.

7.
8.
9.
10.
11.

12.

If the value in S1 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S2 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the device specified by S is not sufficient to contain the n pieces of data, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If n exceeds the range, the operation error occurs, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#200B.
If the function code specified by S2 is related to the bit device, the device specified by S has to
be the bit device. Otherwise, the operation error occurs, the instruction is not executed, and
the error code in SR0 is 16#2003.
If the function code specified by S2 is related to the word device, the device specified by S has
to be the word device. Otherwise, the operation error occurs, the instruction is not executed,
and the error code in SR0 is 16#2003.
If the communication command is 0x05 or 0x06, n does not work. The state or the data is
written into one bit device or one word device.
If SM96 and SM97 are not ON, the instruction MODRW is not executed.
If the communication timeout occurs, SM104 and SM105 are ON, and SM98 and SM99 are
OFF.
If the error occurs during the reception of the data, SM102 and SM103 are ON, and SM98 and
SM99 are OFF.
If the function code specified by S2 is related to the word device, the device in the external
equipment with which the AH500 series PLC communicates has to be the word device. If the
function code specified by S2 is related to the bit device, the device in the external equipment
with which the AH500 series PLC communicates has to be the bit device.
The flags related to the instruction MODRW:
Flag
Function
COM1
COM2
The communication protocol of COM1/COM2
SM209
SM211
changes
SM96
SM97
The data is sent through COM1/COM2.
SM98
SM99
Waiting to receive the reply through COM1/COM2
SM100
SM101
Reception through COM1/COM2 is complete.

6-420

A H 5 00 Prog r am m ing M an ua l

Flag
COM1

COM2

Function

An error occurs during the reception of the data
through COM1/COM2
No data is received through COM1/COM2 after a
SM104
SM105
specified period of time.
Please refer to the explanation of the instruction RS for more information about the functions of
the flags.
SM102

SM103

6-421

C h ap te r 6 A p pl ie d Ins t r uc t i on

API

Instruction code

Operand

1809

READ

S, S1, n, D

Device

X

Y

M

S

T

C

S
S1
n
D

Function
Reading the data from the remote device
through routing

HC

D

L













SM SR

E

PR

K









16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
─

─

AH

Symbol:
S

: Device in which the parameter is stored
Remote device from which the data is
read

S1 :

Word
Double word

n

: Data length

Word

D

: Local device into which the data is read

Bit/Word/Double word

Explanation:
1.

Before using the instruction, users need to complete the network configuration in NWCONFIG
in ISPSoft, and download the routing information to the devices. Please refer to the acual
setting in NWCONFIG in ISPSoft for more information related to S.
Bit15
S

S+1

S+2

Bit7

Netwr ok number

Unit number

Bit0
N ode number

Number of times
the sending of
the command
is retried

Inter val of retryi ng the
sending of the command

S+3
Station address
S+4

The setting ranges for the parameters are as follows.
Item
Network number

1-247

Node number

1-247
0: PLC
252: COM1
253: COM2
254: Ethernet

Unit number

6-422

Setting Range

A H 5 00 Prog r am m ing M an ua l

Item

Setting Range

Number of times the sending of the
command is retried
Interval of retrying the sending of the
command

0-15
1-65535 (Unit: 100 ms)

0: PLC
1-247: COM1/COM2
IP address: Ethernet
The operand S1 specifies a remote device in the inferior PLC which is connected. If the remote
device is illegal, the inferior PLC which is connected replies with an error message, and the
error code is stored in the superior PLC.
The operand n specifies the length of the data. If D is a bit device, the length of the data can
not be larger than 7200 bits. If D is a 16-bit register, the length of the data can not be larger
than 450 words. If D is a 32-bit register, the length of the data can not be larger than 64 words.
If the remote device from which the data is read is a bit device, D must be a bit device. If the
remote device from which the data is read is a register, D must be a register. For example, if
the remote device is a 32-bit register, D must be a 32-bit counter.
The instruction can be used several times in the program, but only eight instructions are
executed at a time. Before the instruction is executed, users need to set the corresponding
request flag to ON. If the system does not detect the corresponding flag, an error occurs.
The corresponding flags are listed below.
READ
1
2
3
4
5
6
7
8
Station address

2.

3.

4.

5.

6.

Flag
Request flag
Wait flag
Reception flag
Error flag
Timeout flag

SM1600
SM1601
SM1602
SM1603
SM1604

SM1605
SM1606
SM1607
SM1608
SM1609

SM1610
SM1611
SM1612
SM1613
SM1614

SM1615
SM1616
SM1617
SM1618
SM1619

SM1620
SM1621
SM1622
SM1623
SM1624

SM1625
SM1626
SM1627
SM1628
SM1629

SM1630
SM1631
SM1632
SM1633
SM1634

SM1635
SM1636
SM1637
SM1638
SM1639

Example:
1. The network location of the bit device from which the data is read is 1-1-0 (network
number-node number-unit number), the bit device address is 16#00000000, and the length of
the data is 10 bits.
(1) Users need to set the parameters in the corresponding registers.
(2) The interval of retrying the sending of the command is three seconds, and the number of
times the sending of the command is retried is three.

6-423

C h ap te r 6 A p pl ie d Ins t r uc t i on

2. SM1600 is set to ON, and the instruction is executed.
3. After the execution of the instruction is complete, Y0.0 will be set to ON.

Additional remark:
1.
2.
3.
4.

5.

If the value in S, the value in n, or the value in D exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S+3 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If a request flag is ON, and the corresponding wait flag is ON, the system will automatically
search for the flags which are ON and OFF respectively to execute the instruction. If there are
no flags which are ON and OFF respectively, the instruction is not executed.
If the network number set by users does not exist, the error code is 16#8F02. If the node
number set by users does not exist, the error code is 16#8F03. If the station address set by
users does not exist, the error code is 16#8F04.

6-424

A H 5 00 Prog r am m ing M an ua l
6.
7.

If the remote device specified by S1 is illegal, the AH500 series PLC will receive the error code
16#8F06.
If users declare the operand S in ISPSoft, the data type will be ARRAY [5] of WORD.

6-425

C h ap te r 6 A p pl ie d Ins t r uc t i on

API

Instruction code

Operand

1810

WRITE

S, S1 , n, D

Device

X

Y

M

S

T

C

S
S1
n
D

Function
Writing the data into the remote device
through routing

HC

D

L













SM SR

E

PR

K









16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
─

AH

─

Symbol:
Device in which the parameter is
stored
Local device from which the data is
S1 :
written

S :

n : Data length

Word
Double word
Word

Remote device into which the data is
Bit/Word/Double word
written

D :
Explanation:
1.

Before using the instruction, users need to complete the network configuration in NWCONFIG
in ISPSoft, and download the routing information to the devices. Please refer to the actual
setting in NWCONFIG in ISPSoft for more information related to S.
Bit15
S

S+1

S+2

Bit7

Netwr ok number

Unit number

Bit0
N ode number

Number of times
the sending of
the command
is retried

Inter val of retryi ng the
sending of the command

S+3
Station address
S+4

The setting ranges for the parameters are as follows.
Item

6-426

Network number

1-247

Node number

1-247

Unit number

0: PLC
252: COM1
253: COM2
254: Ethernet

Setting Range

A H 5 00 Prog r am m ing M an ua l

Item

Setting Range

Number of times the sending of the
command is retried
Interval of retrying the sending of the
command

0-15
1-65535 (Unit: 100 ms)

0: PLC
1-247: COM1/COM2
IP address: Ethernet
The operand D specifies a remote device in the inferior PLC which is connected. If the remote
device is illegal, the inferior PLC which is connected replies with an error message, and the
error code is stored in the superior PLC.
The operand n specifies the length of the data. If S1 is a bit device, the length of the data can
not be larger than 7200 bits. If S1 is a 16-bit register, the length of the data can not be larger
than 450 words. If S1 is a 32-bit register, the length of the data can not be larger than 64 words.
If the remote device into which the data is written is a bit device, S1 must be a bit device. If the
remote device into which the data is written is a register, S1 must be a register. For example, if
the remote device is a 32-bit register, S1 must be a 32-bit counter.
The corresponding flags are listed below.
WRITE
1
2
3
4
5
6
7
8
Station address

2.

3.

4.

5.

Flag
Request flag
Wait flag
Reception flag
Error flag
Timeout flag

SM1640
SM1641
SM1642
SM1643
SM1644

SM1645
SM1646
SM1647
SM1648
SM1649

SM1650
SM1651
SM1652
SM1653
SM1654

SM1655
SM1656
SM1657
SM1658
SM1659

SM1660
SM1661
SM1662
SM1663
SM1664

SM1665
SM1666
SM1667
SM1668
SM1669

SM1670
SM1671
SM1672
SM1673
SM1674

SM1675
SM1676
SM1677
SM1678
SM1679

Example:
1. The network location of the register into which the data is written is 1-1-0 (network number-node
number-unit number), the register L0, and the length of the data is 10 words.
(1) Users need to set the parameters in the corresponding registers.
(2) The interval of retrying the sending of the command is three seconds, and the number of
times the sending of the command is retried is three.

6-427

C h ap te r 6 A p pl ie d Ins t r uc t i on
2. SM1640 is set to ON, and the instruction is executed.
3. After the execution of the instruction is complete, Y0.0 will be set to ON.

Additional remark:
1.
2.
3.
4.

5.

6.
7.

If the value in S, the value in n, or the value in D exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S+3 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If a request flag is ON, and the corresponding wait flag is ON, the system will automatically
search for the flags which are ON and OFF respectively to execute the instruction. If there are
no flags which are ON and OFF respectively, the instruction is not executed.
If the network number set by users does not exist, the error code is 16#8F02. If the node
number set by users does not exist, the error code is 16#8F03. If the station address set by
users does not exist, the error code is 16#8F04.
If the remote device specified D is illegal, the AH500 series PLC will receive the error code
16#8F06.
If users declare the operand S in ISPSoft, the data type will be ARRAY [5] of WORD.

6-428

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

1811

RPASS

S, S1, n

Device

X

Y

M

S

T

C

Function
Passing the packet to the remote device
through routing

HC D

L









S
S1
n

SM SR

E

PR

K







16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
─

─

AH

Symbol:
S : Device in which the parameter is stored

Word

S1 : Register in which the data is stored

Word

n

: Data length

Word

Explanation:
1.

Before using the instruction, users need to complete the network configuration in NWCONFIG
in ISPSoft, and download the routing information to the devices. Please refer to the actual
setting in NWCONFIG in ISPSoft for more information related to S.
Bit15
S

S+1

S+2

Bit7

Netwr ok number

Unit number

Bit0
N ode number

Number of times
the sending of
the command
is retried

Inter val of retryi ng the
sending of the command

S+3
Station address
S+4

The setting ranges for the parameters are as follows.
Item
Network number
Node number
Unit number
Number of times the sending of the
command is retried

Setting Range

1-247
1-247
0: PLC
252: COM1
253: COM2
254: Ethernet
0-15

6-429

C h ap te r 6 A p pl ie d Ins t r uc t i on

Item

2.
3.

Setting Range

Interval of retrying the sending of the
command

1-65535 (Unit: 100 ms)

Station address

0: PLC
1-247: COM1/COM2
IP address: Ethernet

When the instruction is executed, the data in the register specified by S1 is transmitted to the
remote device.
The length of the data can not be larger than 450 words.
RPASS
1
2
3
4
5
6
7
8

Flag
Request flag
Wait flag
Reception flag
Error flag
Timeout flag

SM1680
SM1681
SM1682
SM1683
SM1684

SM1685
SM1686
SM1687
SM1688
SM1689

SM1690
SM1691
SM1692
SM1693
SM1694

SM1695
SM1696
SM1697
SM1698
SM1699

SM1700
SM1701
SM1702
SM1703
SM1704

SM1705
SM1706
SM1707
SM1708
SM1709

SM1710
SM1711
SM1712
SM1713
SM1714

SM1715
SM1716
SM1717
SM1718
SM1719

Example:
1. The data in L100 in the superior PLC is transmitted to a remote device in an inferior PLC. The
network location of the remote device is 2-3 (network number-node number), the IP address of
the remote device is 192.168.1.1, and the inferior PLC is connected to the superior PLC through
Ethernet.
(1) The length of the data is 100 bytes.
(2) The interval of retrying the sending of the command is three seconds, and the number of
times the sending of the command is retried is three.

6-430

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.
3.
4.

5.

6.
7.

If the value in S, the value in n, or the value in D exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S+3 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If S1+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If a request flag is ON, and the corresponding wait flag is ON, the system will automatically
search for the flags which are ON and OFF respectively to execute the instruction. If there are
no flags which are ON and OFF respectively, the instruction is not executed.
If the network number set by users does not exist, the error code is 16#8F02. If the node
number set by users does not exist, the error code is 16#8F03. If the station address set by
users does not exist, the error code is 16#8F04.
If the remote device specified by S1 is illegal, the AH500 series PLC will receive the error code
16#8F06.
If users declare the operand S in ISPSoft, the data type will be ARRAY [5] of WORD.

6-431

Ch ap te r 6 Ap plie d Instruc tions

6.20 Other Instructions
6.20.1 List of Other Instructions

1900

Instruction code
16-bit
32-bit
WDT
–

1901

DELAY

–



1902

GPWM

–

–

1903

TIMCHK

–

–

1904

EPUSH

–



1905

EPOP

–



API

6-432

Pulse
instruction


Function
Watchdog timer
Delaying the execution of
the program
General pulse width
modulation
Checking time
Storing the contents of the
index registers
Reading the data into the
index registers

Step

Page
number

1

6-433

3

6-434

7

6-435

7

6-437

3

6-438

3

6-440

A H 5 00 Prog r am m ing M an ua l

6.20.2 Explanation of Other Instructions
API

Instruction code

Operand

Function

1900

WDT

─

Watchdog timer

P

Pulse instruction 16-bit instruction (1 step) 32-bit instruction
─

AH

─

Symbol:

Explanation:
1.
2.
3.

In the AH500 series PLC, there is a watchdog timer which is used to monitor the operation of
the system.
The instruction WDT is used to reset the watchdog timer in the PLC. If the program scanning
time exceeds 200 milliseconds, the error LED indicator is ON, and the PLC stops running.
The particular point when the watchdog timer acts:

The system is abnormal.

The execution of the program takes much time, and therefore the scam time is larger
than the setting value of the watchdog timer. There are two way users can use to improve
the situation.
1.
Using the instruction WDT
STEP0

t1

2.

END

WDT
t2

Please refer to ISPSoft User Manual for more information about changing the
setting value of the watchdog timer.

Example:
Suppose the program scanning time is 300 milliseconds. After the program is divided into two parts,
and the instruction WDT is inserted between these two parts, the time it takes to scan either the first
part of the program or the second part of the program is less than 200 milliseconds.

Additional remark:
Please refer to ISPSoft User Manual for more information related to the setting of the watchdog
timer.

6-433

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

1901

DELAY

S

Device

X

Y

S





M

P
S

T

C





HC

Function
Delaying the execution of the
program

D

L

SM SR







E

PR

K





16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

─

Symbol:

S : Delay

Word

Explanation:
After the instruction DELAY is executed, the execution of the program following the DELAY is
delayed for a period of time specified by users.
The unit of S is 0.1 milliseconds.
Example:
When X0.0 is ON, the instruction DELAY is executed. The execution of the program following
DELAY is delayed for two milliseconds. That is, Y0.0 is ON and the states of Y0.0~Y0.15 are
refreshed two milliseconds after the instruction DELAY is executed.

Input X0.0
Out put Y0.0
T =2ms

Additional remark:
1.
2.
3.
4.

If S I less than 0, there is no delay.
If S is larger than 1000, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#2003.
Users can adjust the delay according to the practical condition.
The delay will increase due to the communication or other influences.

6-434

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1902

GPWM

S1, S2, D

General pulse width modulation

Device X

Y








S1
S2
D

M



S

T

C







HC



D

L

SM SR











E

PR

K

16# “$”

DF





Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
─

AH

─

Symbol:
S1 : Pulse width

Word

S2 : Pulse cycle

Word

D : Output device

Bit

Explanation:
1.
2.
3.
4.
5.
6.
7.
8.

When the instruction GPWM is executed, every pulse with a width specified by S1 and with a
cycle specified by S2 is output from the device specified by D.
The pulse width specified by S1 is t. t should be within the range between 0 and 3276
milliseconds.
The pulse cycle specified by S2 is T. T should be within the range between 1 and 32767
milliseconds, and S1 should be less than S2.
S2+1 and S2+2 are parameters for system use. Please do not occupy them.
If S1 is less than 0, there is no pulse output. If S1 is larger than S2, the output device keeps ON.
S1 and S2 can be altered during the execution of the instruction GPWM.
If the conditional contact is not enabled, there is no pulse output.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.

Example:
When the program is executed, the values in D0 and D2 are 1000 and 2000 respectively. When
X0.0 is ON, the pulses illustrated below are output from Y0.0. When X0.0 is OFF, Y0.0 is OFF.

6-435

Ch ap te r 6 Ap plie d Instruc tions

t =1000ms

Y0.0
T= 2000ms

Additional remark:
1.

2.
3.

The instruction counts by the scan cycle. Therefore, the maximum error is one scan cycle.
Besides, S1, S2, and (S2-S1) should be larger than the scan cycle. Otherwise, an error occurs
when the instruction GPWM is executed.
If the instruction is used in the function block or the interrupt task, the inaccurate pulse output
will occur.
If users declare the operand S2 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-436

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

1903

TIMCHK

S1, S2, D

Checking time

Device X

Y









S1
S2
D

M



S

T

C







HC



D

L









SM SR


E

PR

K









16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
─

AH

─

Symbol:
S1 : Time which passes

Word

S2 : Setting value

Word

D : Output device

Bit

Explanation:
1.

2.
3.
4.
5.

When the conditional contact is ON, S1 starts to count. D is not ON until the value in S1 is larger
than or equal to the value in S2. Even if the conditional contact is switched OFF later, the value
in S1 is unchanged, and D is still ON.
If the conditional contact is switched from OFF to ON, S is cleared to 0, and D is OFF.
S1 takes 100 milliseconds as the timing unit.
S1+1 and S1+2 are parameters for system use. Please do not occupy them.
When the on-line editing is used, please reset the conditional contact to initialize the
instruction.

Example:
When M0 is ON, D0 starts to count. Y0.0 is not ON until the value in D0 is larger than or equal to 50
(5 seconds). Even if the conditional contact is switched OFF later, the value in D0 is unchanged, and
Y0.0 is still ON.

Additional remark:
1.
2.

If S exceeds the device range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If users declare the operand S1 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-437

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

1904

EPUSH

D

Device

X

Y

D





M

P
S

T

C





HC

Function
Storing the contents of the index
registers

D

L





SM SR

E

PR

K

16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

─

Symbol:

D:

Device in which the value in the
index register is stored

Word

Explanation:
1.
2.

3.

4.

The values in E0~E31 are stored in the devices specified by the value in D.
The execution of the instruction involves thirty-four devices, and the last two devices are for
system use. If the instruction is executed and the number of times the data is stored is n, which
is the value in D, the data in E0~E31 is stored in D+34*n+1~D+34*n+32, and the value in D
becomes n+1.
If the instruction EPUSH is executed several times, the data in E0~E31 is stored several times
in the devices specified by the changeable value in D. Therefore, the range of devices should
be wide enough.
If the instruction is used with the instruction EPOP, the value which is stored last in the device
specified by the value in D is read first.

D
D +1
D +2

Th e n umb er of ti mes
th e d ata is sto re d

E0
E1

......

......

D +32
D +33
D +34

E31
F or s ystem use

D +35
D +36

E0
E1

D +37

E2
......

......

Example:
Suppose the value in D0 is 0. When X0.0 is ON for the first time, the data in E0~E31 is transmitted
to D1~D32, and the value in D0 becomes 1. When X0.0 is switched from OFF to ON for the second
time, the data in E0~E31 is transmitted to D35~D66, and the value in D0 becomes 2. When X0.0 is
switched from OFF to ON for the nth time, the data in E0~E31 is transmitted to D+(the value in
D0)*34+1~D+(the value in D0)*34+32.

6-438

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.

If the value in D is less than 0, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If D+((the value in D)+1)*34-1 exceeds the device range, the instruction is not executed, SM0
is ON, and the error code in SR0 is 16#2003.

6-439

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

1905

EPOP

D

Device X

Y





D

M

P
S

T

C

HC





Function
Reading the data into the index
registers

D

L





SM SR

E

PR

K

16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

─

Symbol:

D:

Device from which the value is
read

Word

Explanation:
1.
2.

3.

The values in the devices specified by the value in D are read into E0~E31, and the value in D
decreases by one.
The execution of the instruction involves thirty-four devices, and the last two devices are for
system use. If the instruction is executed and the number of times the data is stored is n, which
is the value in D, the data in D+34*(n-1)+1~D+34*(n-1)+32 is read into E0~E31, and the value
in D becomes n-1.
The value which is stored last in the device specified by the value in D is read first.

D
D +1
D +2

The nu mbe r o f time s
the da ta i s stor ed

E0
E1

......

......

D +32
D +33
D +34

E31
For sy stem use

D +35
D +36

E0
E1

D +37

E2
......

......

Example:
When X0.0 is ON, the value in D0 is set to 0, and the values in E0~E31 are transmitted to D1~D32.
After the execution of FB0 is complete, the values in D1~D32 are read into D1~D32.

6-440

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.

If the value in D is less than or equal to 0, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If D+(the value in D)*34-1 exceeds the device range, the instruction is not executed, SM0 is
ON, and the error code in SR0 is 16#2003.

6-441

Ch ap te r 6 Ap plie d Instruc tions

6.21 String Processing Instructions
6.21.1 List of String Processing Instructions
API

Instruction code
16-bit
32-bit
64-bit

Pulse
instruction

2100

BINDA

DBINDA

–



2101

BINHA

DBINHA

–



2102

BCDDA DBCDDA

–



2103

DABIN

DDABIN

–



2104

HABIN

DHABIN

–



2105

DABCD DDABCD

–



2106

$LEN

–



2107

$STR

$DSTR

–



2108

$VAL

$DVAL

–



2109

$FSTR

–



2110

$FVAL

–



2111

$RIGHT

–



2112

$LEFT

–



2113

$MIDR

–

–



2114

$MIDW

–

–



2115

$SER

–

–



2116

$RPLC

–

–



2117

$DEL

–

–



2118
2119

$CLR
$INS

–
–

–
–




–

–
–
–

–

6-442

Function
Converting the singed
decimal number into the
ASCII code
Converting the binary
hexadecimal number into
the hexadecimal ASCII code
Converting the binary-coded
decimal number into the
ASCII code
Converting the signed
decimal ASCII code into the
signed decimal binary
number
Converting the hexadecimal
ASCII code into the
hexadecimal binary number
Converting the ASCII code
into the binary-coded
decimal number
Calculating the length of the
string
Converting the binary
number into the string
Converting the string into
the binary number
Converting the floating-point
number into the string
Converting the string into
the floating-point number
The retrieve of the
characters in the string
begins from the right.
The retrieve of the
characters in the string
begins from the left.
Retrieving a part of the
string
Replacing a part of the
string
Searching the string
Replacing the characters in
the string
Deleting the characters in
the string
Clearing the string
Inserting the string

Step

Page
number

5

6-444

5

6-447

5

6-450

5-11

6-453

5-11

6-456

5-11

6-459

5-11

6-462

7

6-464

7-13

6-468

7-8

6-472

5-11

6-477

7-13

6-480

7-13

6-482

7-13

6-484

7-13

6-486

9-21

6-489

11-17

6-491

9

6-494

3
9-15

6-497
6-498

A H 5 00 Prog r am m ing M an ua l

API

Instruction code
16-bit
32-bit
64-bit

2120

–

2121

FREXP

FMOD

–

Pulse
instruction

–



–



Function
Converting the floating-point
number into the
binary-coded decimal
floating-point number
Converting the Binary-coded
decimal floating-point
number into the
floating-point number

Step

Page
number

7-8

6-500

7

6-503

6-443

Ch ap te r 6 Ap plie d Instruc tions

6.21.2 Explanation of String Processing Instructions
API

Instruction code

2100

D

BINDA

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the singed decimal
number into the ASCII code

P
S

T

C

HC







D

L

SM SR

E

PR

K
















16# “$”

DF



Pulse instruction

16-bit instruction (5 steps)

32-bit instruction (5 steps)

AH

AH

AH

Symbol:

S : Source value

D:

Word/Double word

Device in which the conversion
result is stored

Word

Explanation:
1.
2.
3.

The signed decimal binary number in S is converted into the ASCII code, and the conversion
result is stored in D.
The instruction supports SM690, which controls the ending character.
The value in S used in the 16-bit instruction should be within the range between -32768 and
32767, and should be a six-digit binary number. The operand D occupies four word devices.
The data is converted as follows.
b15

b8 b7
b0
b15
ASCII code in the
Sign (±)
D
ten thousands plac e
ASCII code in
ASCII code in
D +1
the hundreds place the thousands plac e
ASCII code in
ASCII code in
D +2
the units pl ace
the tens plac e

b0

S

16-bit bi nar y number

Ending c har acter (16#00 or unchanged)

D +3

If SM690 is OFF, 16#0000 is stored in D+3. If SM690 is ON, the value in D+3 is unchanged.
Besides, if the value in S is a positive value, the sign character in D is 16#20. If the value in S
is a negative value, the sign character in D is 16#2D. For example, if the value in S is -12345
and SM690 is OFF, the conversion result is as follows.
b15
b15
S

b0

-12345

b8 b7

16#2D(-)

D

16#33(3)

16#32(2)

D +1

16#34(4)
16#0000

D +2

16#35(5)

16-bit binar y number

4.

b0

16#31(1)

D +3

The value in S used in the 32-bit instruction should be within the range between -2147483648
and 2147483647, and should be an eleven-digit binary number. The operand D occupies six
word devices. The data is converted as follows.

6-444

A H 5 00 Prog r am m ing M an ua l

b8
ASCII code in
the billi ons place
ASCII code in
the ten mill ions plac e
ASCII code in the hundred
thous ands plac e
ASCII code in
the thousands plac e
ASCII code in
the tens plac e
Ending c har acter
(16#00 or 16#20)

b15

S

High 16 bi ts

Low 16 bits

32-bit bi nar y number

b7

b0

Sign (±)

D

ASCII code in the
hundred mil lions plac e
ASCII code in
the mill ions place
ASCII code in the
ten thousands plac e
ASCII code in
the hundreds place
ASCII code in
the units pl ac e

D +1
D +2
D +3

D +4
D +5

If SM690 is OFF, 16#0000 is stored in the high 8 bits in D+5. If SM690 is ON, 16#20 is stored
in the high 8 bits in D+5. Besides, if the value in S is a positive value, the sign character in D is
16#20. If the value in S is a negative value, the sign character in D is 16#2D. For example, if
the value in S is -12345678, the conversion result is as follows.
b15

S

-1234

S +1
5678

D

16#31( 1)

16#20( )

D +1

16#33( 3)

16#32( 2)

D +2

16#35( 5)

16#34( 4)

D +3

16#37( 7)

16#36( 6)

D +4

16#38( 8)

D +5

16#00或1 6#20

32-bit binar y number

5.

b8 b7
b0
16#20( )
16#2D(-)

Take the 32-bit binary number -12345678 in S for example. The digit in the hundred millions
place of the number and the digit in the billions place of the number are 0. When the instruction
is executed, 16#20 is stored in the low 8 bits in D+1 and the high 8 bits in D.
b15

b8 b7
b0
16#20( )
16#2D(-)

16#31( 1)
S

-1234

S +1
5678

32-bit binar y number

00 123 4 5678
Becoming 16#20

Signifi cant digits

16#20( )

D
D +1

16#33( 3)

16#32( 2)

D +2

16#35( 5)

16#34( 4)

D +3

16#37( 7)

16#36( 6)

D +4

16#00或1 6#20

16#38( 8)

D +5

16#20 is stored.

Example 1:
Suppose the value in L0 is 5126 and SM690 is OFF. When the PLC runs, the values in D0, D1, D2,
and D3 are 16#2020, 16#3135, 16#3135, and 16#0000 respectively.

6-445

Ch ap te r 6 Ap plie d Instruc tions

b15

W0

b8 b7

16#20( )

b0
16#20( )

5126

16#31(1)

16#35(5)

BIN

16#36(6)

16#32(2)

16#00

Example 2:
Suppose the value in L10 is -3842563 and SM690 is OFF. When the PLC runs, the values in D0, D1,
D2, D3, D4, and D5 are 16#202D, 16#2020, 16#3833, 16#3234, 16#3635, and 16#0033
respectively.

b8 b7
b15
b0
16#20( )
16# 2D(-)
16# 20( )

16# 20( )

W0

W1

16#38( 8)

16#33( 3)

-384

2563

16#32( 2)

16#34( 4)

16#36( 6)

16#35( 5)

16#00

16#33( 3)

BIN

Additional remark:
1.
2.
3.
4.

If D+3 used in the 16-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If D+5 used in the 32-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [4] of WORD/INT.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [6] of WORD/INT.

6-446

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

2101

D

BINHA

Device

X

Y

S
D







M

P
S

T

C







Operand

Function

S, D

Converting the binary hexadecimal
number into the hexadecimal ASCII code

HC

D

L

SM SR

E

PR

K
















16# “$”

DF



Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps)
AH

AH

AH

Symbol:

S : Source value

D :

Word/Double word

Device in which the conversion
result is stored

Word

Explanation:
1.
2.
3.

The hexadecimal binary number in S is converted into the ASCII code, and the conversion
result is stored in D.
The instruction supports SM690, which controls the ending character.
The value in S used in the 16-bit instruction should be within the range between 16#0000 and
16#FFFF, and should be a four-digit binary number. The operand D occupies three word
devices. The data is converted as follows.
b0

b0

b8 b7

b15

b15

T hi rd AS CII c ode F our th ASCII code

S

D

F irst ASCII code Second ASCII code D +1
Ending c har acter
D+2
(16#0000 or unchanged)

16-bit binar y number

If SM690 is OFF, 16#0000 is stored in D+2. If SM690 is ON, the value in D+2 is unchanged.
For example, if the value in S is 16#02A6 and SM690 is OFF, the conversion result is as
follows.

b15

b0
16#02A 6

S

b0

b8 b7

b15

16#32( 2)

16#30( 0)

16#36( 6)

16#41( A)
16#0000

4.

The value in S used in the 32-bit instruction should be within the range between 16#00000000
and 16#FFFFFFFF, and should be an eight-digit binary number. The operand D occupies five
word devices. The data is converted as follows.
b8 b7
b0
b15
Seventh AS CII c ode Eighth ASCII c ode

S +1
High 16 bits

S

Low 16 bits

32-bit binar y number

F ifth ASCII code

Six th ASCII code

T hi rd AS CII c ode F our th ASCII code
F irst ASC II code Second A SCII code
Ending c har acter
(16#0000 or unchanged)

D
D +1
D +2
D +3

D +4

6-447

Ch ap te r 6 Ap plie d Instruc tions
If SM690 is OFF, 16#0000 is stored in D+4. If SM690 is ON, the value in D+4 is unchanged.
For example, if the value in S is 16#03AC625E and SM690 is OFF, the conversion result is as
follows.
b15

S +1
03AC

b8 b7
b0
16#33( 3)
16#30( 0)

D

S

16#43( C)

625E

16#32( 2)

16#36( 6)

D +2

16#45( E)

16#36( 6)

D +3

16#41( A)

16#0000

D +1

D +4

Example 1:
Suppose the value in L0 is 16#9C06 and SM690 is OFF. When PLC runs, the values in D0, D1, and
D2, are 16#2020, 16#3135, 16#3135, and 16#0000 respectively.

L0

16#9C06

b0

b8 b7

b15
16#42( C)

16#39( 9)

D0

16#36( 6)

16#30( 0)

D1
D2

16#0000

Example 2:
Suppose the value in L10 is 16#7B3C581F and SM690 is OFF. When the PLC runs, the values in
D0, D1, D2, D3, and D4 are 16#4237, 16#4333, 16#3835, 16#4631, and 16#0000 respectively.

b15

b0
b8 b7
16#42( B)
16#37( 7)
D0

16#33( 3)

D1

16#38( 8)

16#35( 5)

D2

16#46( F)

16#31( 1)

D3

L11

L10

16#43( C)

7B3C

581F

16#0000

6-448

D4

A H 5 00 Prog r am m ing M an ua l

Additional remark:
1.
2.
3.
4.

If D+2 used in the 16-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If D+4 used in the 32-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [3] of WORD/INT.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [5] of WORD/INT.

6-449

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

2102

D

BCDDA

Device X

Y







S
D

M

P
S

Function

Operand

Converting the binary-coded decimal
number into the ASCII code

S, D
T

C







HC

D

L

SM SR

E

PR

K
















Pulse instruction

16# “$”

DF



16-bit instruction (5 steps) 32-bit instruction (5 steps)

AH

AH

AH

Symbol:

S : Source value

D:

Word/Double word

Device in which the conversion
result is stored

Word

Explanation:
1.
2.
3.

The binary-coded decimal number in S is converted into the ASCII code, and the conversion
result is stored in D.
The instruction supports SM690, which controls the ending character.
The binary-coded decimal value in S used in the 16-bit instruction should be within the range
between 0 and 9999, and should be a four-digit binary-coded decimal value. The operand D
occupies three word devices. The data is converted as follows.

b1 5

b1 2 b11

b4 b3

b8 b7

b0

S
Thousands
place

If SM690 is OFF, 16#0000 is stored in D+2. If SM690 is ON, the value in D+2 is unchanged.
The binary-coded decimal value in S used in the 32-bit instruction should be within the range
between 0 and 99999999, and should be an eight-digit binary-coded decimal value. The
operand D occupies five word devices. The data is converted as follows.

S

S +1

e
c
a
l
p
s
d
e
r
d
n
u
H

e
c
a
l
p
s
d
n
a
s
u
o
h
T

e
c
a
l
p
s
d
n
a
s
u
o
h
t
n
e
T

e
c
a
l
p
s
d
n
a
s
u
o
h
t
d
e
r
d
n
u
H

e
c
a
l
p
s
n
o
i
l
l
i
M

e
c
a
l
p
s
n
o
i
l
l
i
m
n
e
T

5.

b0 b15 b12b11 b8b7 b4 b3

e
c
a
l
p
s
n
e
T

b15 b12b11 b8b7 b4 b3

b0

e
c
a
l
p
s
t
i
n
U

4.

Hundreds Tens place Units place
place

b0
b8 b7
b15
ASCII code in
ASCII code in
D
the hundreds place
the thousands place
ASCII code in
D +1
ASCII code in
the tens plac e
the units pl ac e
D +2
Ending c har acter (16#0000 or unc hanged)

b8 b7
b15
b0
ASCII code in
ASCII code in
the milli ons place
the ten mill ions place
ASCII code in the hundred
ASCII code in the
ten thous ands plac e thous ands place
ASCII code in
ASCII code in
the thous ands place
the hundreds pl ac e

ASCII code in
the units pl ac e

ASCII code in
the tens plac e

Ending c har acter ( 16#0000 or unchanged)

D
D +1
D +2
D +3

D +4

If SM690 is OFF, 16#0000 is stored in D+5. If SM690 is ON, the value in D+5 is unchanged.
Take the binary-coded decimal number 12098 in S for example. The digit in the hundred
thousands place of the number, the digit in the millions place of the number, and the digit in the

6-450

A H 5 00 Prog r am m ing M an ua l
ten millions place of the number are 0. When the instruction is executed, 16#20 is stored in the
low 8 bits in D+1, the high 8 bits in D, and the low 8 bits in D.
b8 b7

b15

0 0 01 20 9 8
Siginificant di gi ts

b0

16#20( )

16#20( )

D

16#31( 1)

16#20( )

D +1

16#30( 0)

16#32( 2)

D +2

16#38( 8)

16#39( 9)

D +3

Becoming 16#20

D +4

16#00

Example 1:
Suppose the binary-coded decimal value in L0 is 1295 and SM690 is OFF. When PLC runs, the
values in D0, D1, and D2 are 16#3231, 16#3539, 16#3135, and 16#0000 respectively.

L0

1

2

9

5

b0

b8 b7

b15
16#32( 2)

16#31( 1)

D0

16#35( 5)

16#39( 9)

D1

16#0000

D2

Example 2:
Suppose the binary-coded decimal value in L10 is 34578352 and SM690 is OFF. When the PLC
runs, the values in D0, D1, D2, D3, and D4 are 16#3433, 16#3735, 16#3338, 16#3235, and
16#0000 respectively.

b15
L11

3

4

7

8

3

5

16#35( 5)

D1

16#33( 3)

16#38( 8)

D2

16#32( 2)

16#35( 5)

D3

16#37( 7)

L10

5

b0
b8 b7
16#34( 4)
16#33( 3)
D0

2

16#0000

D4

6-451

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

2.

3.
4.
5.
6.

If the value in S used in the 16-bit instruction is not within the range between 0 and 9999, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200D. (The
binary-coded decimal value is represented by the hexadecimal number, but one of digits is not
within the range between 0 and 9.)
If the value in S used in the 32-bit instruction is not within the range between 0 and 99999999,
the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200D. (The
binary-coded decimal value is represented by the hexadecimal number, but one of digits is not
within the range between 0 and 9.)
If D+2 used in the 16-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If D+4 used in the 32-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [3] of WORD/INT.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [5] of WORD/INT.

6-452

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

2103

D

DABIN

Device X

Y







S
D

M

Operand

Function

S, D

Converting the signed decimal
ASCII code into the signed decimal
binary number

P
S

T

C







HC

D

L

SM SR










E

PR






K

16# “$”

DF



Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction (5-11 steps)
AH

AH

AH

Symbol:

S : Source value

D:

Word

Device in which the conversion
result is stored

Word/Double word

Explanation:
1.
2.

The signed decimal ASCII code in S is converted into the signed decimal binary number, and
the conversion result is stored in D.
The operand S used in the 16-bit instruction occupies three word devices, and the decimal
ASCII code in S should be within the range between -32768 and 32767. If S is a string, the
string should be within the range between “-32768” and “32767”.
S

S+1
S+2

3.

b8 b7
b15
b0
ASCII code in the
Sign
ten thousands plac e
ASCII code in
ASCII code in
the thousands plac e
the hundreds place
ASCII code in
ASCII code in
the units pl ac e
the tens plac e

b15

b0
D

16-bit bi nar y number

If S used in the 16-bit instruction is a string and the number of characters contained in the
string is less than 6, the characters which the string lacks are regarded as 0. The first
character is a sign character. If the first character is “ ” (a space), the sign is a positive sign. If
the first character is “-”, the sign is a negative sign. Take the string “1234” for example.
S

S+1
S+2

b15
" 1"

b8 b7

"3"
" " (Ignored)

b0
" " (Space)

"2"

b15

b0
12340

D

"4"

16-bit binar y number

4.

The operand S used in the 32-bit instruction occupies six word devices, and the decimal ASCII
code in S should be within the range between -2147483648 and 2147483647. If S is a string,
the string should be within the range between “-2147483648” and “2147483647”.

6-453

Ch ap te r 6 Ap plie d Instruc tions
b15

b8 b7

b0

ASC II code in
the billi ons place
ASC II code in
the ten mill ions plac e

Sign

S

ASCII code in the
hundred mil lions pl ac e
ASC II code in
ASCII code in the hundred
the mill ions place
thous ands plac e
ASC II code in
the thousands plac e
ASC II code in
the tens plac e

ASCII code in the
ten thousands plac e
ASCII code in
the hundreds place
ASCII code in
the units pl ace

Ignor ed

5.

b8 b7

"-"

" 0"

(D+1, D)

S+1

32-bit bi nar y number

S+2
S+3
S+4
S+5

b0

S

" 2"

"1"

S+1

" 4"

" 3"

S+2

"6"

"5"

"8"

"7"
"9"

" "(Ignored)

8.

b0

b16 b15

If S used in the 32-bit instruction is a string and the number of characters contained in the
string is less than 11, the characters which the string lacks are regarded as 0. The first
character is a sign character. If the first character is “ ” (a space), the sign is a positive sign. If
the first character is “-”, the sign is a negative sign. Take the string “-0123456789” for example.
b15

6.
7.

b31

b31

S+3

b0

b16 b15
-123456789

(D+1,D0)

32-bit bi nar y number

S+4
S+5

If the value in S is 16#20 or 16#00, the value is processed as 16#30.
If the sign character is 16#20, the conversion result is a positive value. If the sign character is
16#2D, the conversion result is a negative value.
If S used in the 16-bit instruction is a string, the number of characters contained in the string
should be within the range between 1 and 6. If S used in the 32-bit instruction is a string, the
number of characters contained in the string should be within the range between 1 and 11.

Example 1:
Suppose the values in D20, D21, and D22 are 16#202D, 16#3220, and 16#3736. When the PLC
runs, the value in D0 is -267.

b15

b0

b8 b7

D20

16#20( )

16#2D( -)

D0

D21

16#32( 2)

16#20( 0)

- 267

D22

16# 37(7)

16#36( 6)

(Regarded as - 00267)

Example 2:
Suppose the values in D20, D21, D22, D23, D24 and D25 are 16#2020, 16#2020, and 16#3933,
16#3836, 16#3733, and 16#3330. When the PLC runs, the value in D0 is 3968370.

6-454

A H 5 00 Prog r am m ing M an ua l

b15
D20

b0

b8 b7

16#20( )

16#20( )

D21

16#20( )

16#20( )

D22

16# 39(9)

16#33( 3)

D23

16#38( 8)

16#36( 6)

D24

16#37( 7)

16#33( 3)

D25

3968370

(D1, D 0)

(Regarded as +0003968370)

16#30( 0)

Example 3:
Suppose S is the string “1”. The first character is “ ”. Since the number of characters contained in the
string is less than 6, the string is regarded as “10000”. When the PLC runs, the value in D10 is
10000.

Example 4:
Suppose S is the string “-00001”. The first character is “ ”. Since the number of characters contained
in the string is less than 11, the string is regarded as “-0000100000”. When the PLC runs, the value
in (D11, D10) is -100000.

Additional remark:
1.
2.
3.
4.
5.
6.
7.

If the sign character in S is neither 16#20 nor 16#2D, the operation error occurs, the instruction
is executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the ASCII code in S is not 16#20, 16#0, or within the range between 16#30 and 16#39, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S exceeds the device range, the operation error occurs, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S+2 used in the 16-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If S+5 used in the 32-bit instruction exceeds the device range, SM0 is ON, and the error code
in SR0 is 16#2003.
If the operand S used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [3] of WORD/INT.
If the operand S used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [6] of WORD/INT.

6-455

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

2104

D

HABIN

Device X

Y







S
D

M

P
S

T

C







Operand

Function

S, D

Converting the hexadecimal ASCII code
into the hexadecimal binary number

HC

D

L

SM SR










E

PR






K

16# “$”

DF



Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction (5-11 steps)
AH

AH

AH

Symbol:

S :Source value

D:

Word

Device in which the conversion
Word/Double word
result is stored

Explanation:
1.
2.

The hexadecimal ASCII code in S is converted into the hexadecimal binary number, and the
conversion result is stored in D.
The operand S used in the 16-bit instruction occupies two word devices, and the hexadecimal
ASCII code in S should be within the range between 0000 and FFFF. If S is a string, the string
should be within the range between “0” and “FFFF”.
b15

b0

b8 b7

b15

T hi rd AS CII c ode F our th ASCII code

S
S +1

b0
D

F irst ASCII code Second A SCII code

16-bit binar y number

If the ASCII code in S~S+1 is 5A8D, the conversion result is as follows.
b15

3.

b0

b8 b7

S

16#41(A)

16# 35(5)

S +1

16#44(D)

16# 38(8)

b15

b0
16# 5A8D

D

The operand S used in the 32-bit instruction occupies four word devices, and the hexadecimal
ASCII code in S should be within the range between 00000000 and FFFFFFFF. If S is a string,
the string should be within the range between “0” and “FFFFFFFF”.
S

b15
b0
b8 b7
Seventh AS CII c ode Eighth AS CII c ode

S +1

F ifth ASCII code

Six th ASCII code

S +2

T hi rd AS CII c ode

F our th ASCII code

S +3

F irst ASCII code

Second ASCII code

D

D +1

32-bit binar y number

If the ASCII code in S~S+3 is 5CB807E1, the conversion result is as follows.
b15

6-456

S

16#43(C)

b0
16# 35(5)

S +1

16# 38(8)

16# 42(B)

S +2

16#37(7)

16# 30(0)

S +3

16#31(1)

16#45(E)

b8 b7

D+1
16# 5CB8

D
16# 07E1

A H 5 00 Prog r am m ing M an ua l
4.

If S used in the 16-bit instruction is a string, the number of characters contained in the string
should be within the range between 1 and 4. If S used in the 32-bit instruction is a string, the
number of characters contained in the string should be within the range between 1 and 8.

Example 1:
Suppose the values in D20 and D21 are 16#3641 and 16#4633 respectively. When the PLC runs,
the value in D0 is -22977.

b15
D20

16#36(6)

b0
16# 41(A)

D21

16# 46(F )

16# 33(3)

b8 b7

D0
- 22977
Conversion result= 16# A63F= -22977

Example 2:
Suppose the values in D20, D21, D22, and D23 are 16#4634, 16#3244, 16#3738, and 16#3035
respectively. When the PLC runs, the value in (D1, D0) is 1339197264.

b15
D20

b0
b8 b7
16#34(4)
16#46(F )

D21

16#32(2)

16#44(D)

D22

16#37(7)

16#38(8)

D24

16#30(0)

16#35(5)

( D1,D0)
13391972649724
Conversi on result=16# 4F D28750 =1339197264

Example 3:
Suppose S is the string “A”. Since the number of characters contained in the string is less than 4, the
string is regarded as “A000”. When the PLC runs, the value in D20 is -24576.

Example 4:
Suppose S is the string “0000000A”. When the PLC runs, the value in (D21, D20) is 10.

6-457

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.

2.
3.

If the ASCII code in S is not within the range between 16#30 and 16#39, or within the range
between 16#41 and 16#46, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If the operand S used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.
If the operand S used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [4] of WORD/INT.

6-458

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

2105

D

DABCD

Device X

Y







S
D

M

Operand

Function

S, D

Converting the ASCII code into the
binary-coded decimal number

P
S

T

C







HC

D

L

SM SR










E

PR






K

16# “$”

DF



Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction (5-11 steps)
AH

AH

AH

Symbol:

S : Source value

D:

Word/Double word

Device in which the
conversion result is stored

Word/Double word

Explanation:

b15
b8 b7
b0
ASCII code in
ASCII code in
the hundreds place the thousands place
S+1
ASCII code in
ASCII code in
the units pl ac e
the tens plac e

b1 5

S

b1 2 b11

b8 b7

b4 b3

b0

D
e
c
a
l
p
s
n
e
T

e
c
a
l
p
s
d
e
r
d
n
u
H

2.

The ASCII code in S is converted into the binary-coded decimal number, and the conversion
result is stored in D.
The operand S used in the 16-bit instruction occupies two word devices, and the ASCII code in
S should be within the range between 0000 and 9999. If S is a string, the string should be
within the range between “0” and “9999”.

e
c
a
l
p
s
t
i
n
U

1.

e
c
a
l
p
s
d
n
a
s
u
o
h
T

If the ASCII code in S~S+1 is 8765, the conversion result is as follows.
b15

3.

b8 b7

b0

S

16#37(7)

16#38(8)

S+ 1

16#35(5)

16#36(6)

b1 2 b11

b1 5

8

b4 b3

b8 b7

7

6

b0

5

D

The operand S used in the 32-bit instruction occupies four word devices, and the ASCII code
in S should be within the range between 0000000 and 99999999. If S is a string, the string
should be within the range between “0” and “99999999”.

6-459

Ch ap te r 6 Ap plie d Instruc tions

e
c
a
l
p
s
d
n
a
s
u
o
h
t
n
e
T

e
c
a
l
p
s
d
n
a
s
u
o
h
t
d
e
r
d
n
u
H

e
c
a
l
p
s
n
o
i
l
l
i
m
n
e
T

e
c
a
l
p
s
n
o
i
l
l
i
M

ASC II c ode i n
the un its pl ac e

S+ 3

e
c
a
l
p
s
d
n
a
s
u
o
h
T

S+2

b0 b15 b12b11 b8b7 b4 b3

e
c
a
l
p
s
d
e
r
d
n
u
H

ASCII code in the
t en thousa n ds p la c e
ASC I I cod e in
the h undred s p lac e

S+1

D

D+1
b15 b12b11 b8b7 b4 b3

e
c
a
l
p
s
n
e
T

S

b0
b8 b7
ASC II code in
th e ten mill ions p lace
ASCII code in the hundred
th ous ands p lac e
ASC II cod e in
the tho usa nds pl ac e
AS C II co de in
the tens plac e

b0

e
c
a
l
p
s
t
i
n
U

b15
ASCII c ode in
the mil li ons place

If the ASCII code in S~S+3 is 87654321, the conversion result is as follows.
b15

4.
5.

b0

b8 b7

S+1

16#35(5)

16#36(6)

S+2

16#33(3)

16#34(4)

S+3

16#31(1)

16#32(2)

D

D+1

16#38(8)

16#37(7)

S

8

7

5

6

b0

b0 b15 b12b11 b8b7 b4 b3

b15 b12b11 b8b7 b4 b3

4

3

1

2

If the value in S is 16#20 or 16#00, the value is processed as 16#30.
If S used in the 16-bit instruction is a string, the number of characters contained in the string
should be within the range between 1 and 4. If S used in the 32-bit instruction is a string, the
number of characters contained in the string should be within the range between 1 and 8.

Example 1:
Suppose the values in D20 and D21 are 16#3420 and 16#3439 respectively. When the PLC runs,
the value in Y0 is 16#494.

b15

b8 b7

b0

D20

16#34(4)

16#20( )

D21

16#34(4)

16#39(9)

b1 5

b1 2 b11

b4 b3

b8 b7

4

9

b0

4

Y0

Example 2:
Suppose the values in D20, D21, D22, and D23 are 16#3738, 16#3536, 16#3334, and 16#3132
respectively. When the PLC runs, the value in (D11, D10) is 16#87654321.

b15

6-460

b0

b8 b7

D20

16#37(7)

16# 38(8)

D21

16# 35(5)

16# 36(6)

D22

16# 33(3)

16# 34(4)

D23

16# 31(1)

16# 32(2)

D10

D11

8

7

6

b0

b0 b15 b12b11 b8b7 b4 b3

b15 b12b11 b8b7 b4 b3

5

4

3

2

1

A H 5 00 Prog r am m ing M an ua l

Example 3:
Suppose S is the string “1”. Since the number of characters contained in the string is less than 4, the
string is regarded as “1000”. When the PLC runs, the value in D20 is 16#1000.

Example 4:
Suppose S is the string “0001”. Since the number of characters contained in the string is less than 8,
the string is regarded as “00010000”. When the PLC runs, the value in
(D21, D20) is 16#10000.

Additional remark:
1.
2.
3.
4.

If the ASCII code in S is not within the range between 16#30 and 16#39, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If S is a string and the number of characters contained in the string exceeds the range, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the operand S used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.
If the operand S used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [4] of WORD/INT.

6-461

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2106

$LEN

S, D

Calculating the length of the string

Device X

Y







S
D

M

P
S

T

C







HC

D

L

SM SR










E

PR






K

16# “$”

DF



Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction
AH

AH

-

Symbol:
S : String

Word/Double word

D : Length of the string

Word/Double word

Explanation:
1.
2.

The length of the string in S is calculated, exclusive of 16#00 with which the string ends. The
length of the string is stored in D.
The value stored in D should be within the range between 0 and 65535.
If the number of characters contained in the string is 65536, which is equal to 16#10000, the
value in D is 0.
If the number of characters contained in the string is 65537, which is equal to 16#10001, the
value in D is 0.
S

b0
b8 b7
b15
Second c haracter F irst character

S+1

F our th character T hi rd c har acter

S+2

Six th character

S+n

( End ind c haracte r )

16#00

b15

F ifth character

b0

n

D

Length of the string

n charac ter
th

If the data in S~S+4 is ABCDEFGHI, the calculation result is as follows.
S

b8 b7
b0
16#42( B)
16#41( A)

S+1

16#44( D)

16#43( C)

S+2

16#46( F)

16#45( E)

S+3

16#48( H)

16#47( G)

b15

S+4

16#00

ABCDEF GHI

b15

b0
9

16#49( I)

( En di ng cha ra cter )

Example 1:
Suppose S is the string “DELTA”. When the PLC runs, the value in D0 is 5.

6-462

D

A H 5 00 Prog r am m ing M an ua l

Example 2:
Suppose the data in D0~D2 is as follows. When the PLC runs, the value in L0 is 5.
D0
16#45 (E)
16#44 (D)
D1
16#54 (T)
16#4C (L)
D2
16#00 (Ending character) 16#44 (A)

Additional remark:
If the string does not end with 16#00, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#200E.

6-463

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2107

D

S1, S2, D

Converting the binary number into
the string

$STR

Device

X

Y

S1
S2
D









M

P
S

T

C









HC

D

L

SM SR

E

PR

K





















16# “$”

DF



Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps)
AH

AH

AH

Symbol:
S1 :

Initial device in which the
Word/Double word
number of characters is stored

S2 : Value which is converted

D :

Word/Double word

Initial device in which the
conversion result is stored

Word

Explanation:
1.

A decimal point is added to the value in S2, the value in S1+1 indicates the number of decimal
places, and the value in S1 indicates the number of characters. The conversion result is stored
in D.
$STR:
The value in S1 should be within the range between 2 and 8.
The value in S1+1 should be within the range between 0 and 5, and should be less than or
equal to the value in S1 minus 3.
The value in S2 should be within the range between -32768 and 32767.

2.

Number of characters

S1

b15

S1+1 Number of dec imal pl ac es

.
Sign

b8 b7

F irst ASCII code

b0

Sign

D

T hi rd A SCII c ode

Second ASCII code

F ifth ASCII code

F our th ASCII code

D+2

Seventh AS CII c ode Six th ASCII code

D+3

16#00 ( Ending char ac ter )

D+1

D+4

Automati cally stored at the end of the s tr ing
S2

Binar y number

Suppose the number of characters is 5, the number of decimal places is 1, and the value is
-123. The conversion result is as follows.

6-464

A H 5 00 Prog r am m ing M an ua l

S1

5

S1+1

1
b15
-

.

1 2

3

S ign

16 # 2D( -)

D

1 6#2E(.)

16 # 32 (2 )

D+ 1

16#00 (Ending c har ac ter )

1 6# 33(3 )

D+ 2

- 123

S2

3.

b0

b8 b7
16 # 31(1 )

D$STR:
The value in S1 should be within the range between 2 and 13.
The value in S1+1 should be within the range between 0 and 10, and should be less than or
equal to the value in S1 minus 3.
The value in S2 should be within the range between -2147483648 and 2147483647.
( S1+1, S1)
Number of characters

b8 b7
b15
F irst ASCII code

.
Sign

Elevnth A SCII code T enth A SCII code D+5
16#00 ( Ending chara cter) T welfth AS CII c ode D+6

S2

S2+1

b0

Sign

D
T hi rd AS CII c ode Se cond A SCII code D+1
F ifth ASCII code F our th ASCII code
D +2
Seventh AS CII c ode Si x th ASCII code D+3
Ninth ASCII code
Eigh th A S CII c ode D+4

( S1+2, S1+3)
Number of dec imal plac es

High word Low w ord
32-bit bi nar y number

Automati cally stored at the end of the str ing

Suppose the number of characters is 8, the number of decimal places is 3, and the value is
-654321. The conversion result is as follows.
( S1+1,S 1)
8
b15

( S1+3, S1+2)
3

-

6

5

4

.

3

2

1

b8 b7

b0

16#36(6)

16 # 2D( -)

D

16#34(4)

16# 35(5)

D+1

16#33(3)

16# 2E(.)

D +2

16#31(1)

16# 32(2)

D+3

16#00 ( Endi ng charac ter )

D+4

( S2+1, S2)
- 654321
32-bit bi nar y number

4.
5.
6.

If the value in S2 is a positive value, the sign code in D is 16#20. If the value in S2 is a negative
value, the sign code in D is 16#2D.
The code in D which represents the decimal point is 16#2E.
If the value in S1+1 is larger than the number of digits in S2, the missing digits are replaced by
0.
Number of characters

13

Number of dec imal places

10

Binary number

7.

54321

0.0000054321
T he missi ng digits ar e r epl ac ed by 0.

If the value in S1 is larger than the number of digits in S2 plus the number of characters which
include the decimal point and the sign, the missing digits are replaced by 0.

6-465

Ch ap te r 6 Ap plie d Instruc tions

Number of characters

13

Number of dec imal plac es

2

Binary number

54321

000000543.21
T he sign code is 16#20, and the mis sing
digits are r eplaced by 16#30 ("0") .

Example 1:

D10
D1
D2

b8 b7
b0
b15
D 20
16#31( 1)
16#20( )

12345
6
0

“ 12345”

16#33( 3)

16#32( 2)

D 21

16#35( 5)

16#34( 4)

D 22

16# 00

Example 2:

6-466

D 23

A H 5 00 Prog r am m ing M an ua l

b8 b7
b0
b15
D20
16#30( 0)
16#20( )
( D11, D10)
12345678
( D1, D0)
12
( D2, D3)
9

“ 0.012345678”

16#30( 0)

16#2E(.)

D21

16#32( 2)

16#31( 1)

D22

16#34( 4)

16#33( 3)

D23

16#36( 6)

16#35( 5)

D24

16#38( 8)

16#37( 7)

D25

16#00

D26

Additional remark:
1.
2.
3.
4.

5.
6.

If the value in S1 exceeds the range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the value in S1+1 exceeds the range, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
The value in S1+1 should be less than or equal to the value in S1 minus 3. Otherwise, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S1 is less than the number of digits in S2 plus the number of characters which
include the decimal point and the sign, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If the operand S1 used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.
If the operand S1 used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of DWORD/DINT.

6-467

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2108

D

S, D1, D2

Converting the string into the binary
number

$VAL

Device X

Y









S
D1
D2

M

P
S

T

C








i

Pulse
t ti
AH

HC

D

L

SM SR












E

PR







K

16# “$”

DF



16-bit instruction (7-13 steps) 32-bit instruction (7-13 steps)
AH

AH

Symbol:
S : Source value

Word

D1 :

Device in which the number
of characters is stored

Word/Double word

D2 :

Device in which the binary
number is stored

Word/Double word

Explanation:

2.

S
S+ 1

The string in S is converted into binary number. The number of characters is stored in D1, the
number of decimal places is stored in D1+1, and the binary number is stored in D2.
$VAL:
The operand S occupies five word devices at most.
The number of characters contained in the string in S should be within the range between 2
and 8.
If there is a decimal point in the string in S, 16#2E should be stored between the first character
after the sign character and the last character.
b15
F irst ASCII code

b8 b7

T hi rd A SCII c ode

Second ASCII code

Binar y number

F our th ASCII code

S+3 Seventh AS CII c ode

Six th ASCII code

.

1 6#00

e
d
o
c
I
I
C
S
A
t n
s
r
g
i
i
F S

6-468

D1

Number of dec imal pl ac es D1+1

Sign

S+ 2 F ifth ASCII code
S+ 4

Number of characters

b0

... .... .... .... .... .

e
d
o
c
I
I
C
S
A
h
t
n
e
v
e
S

1.

D2

A H 5 00 Prog r am m ing M an ua l
If the data in S~S+3 is -123.45, the calculation is as follows.
b15

b8 b7

b0

7

D1
D1 +1

S

16#31(1)

16# 2D( -)

2

S+1

16 # 33(3 )

16 # 32(2 )

- 123 4 5

S+2

1 6 # 34( 4)

16 # 2E(. )

S+3

16# 00

16 # 35(5 )
-

1

2 3

.

4

D2

5

If there is 16#20 or 16#30 between the sign character and the first value which is not 0 in the
string, 16#20 or 16#30 is ignored when the string is converted into the binary number.
- 123.45

3.

Number of characters

2

N umber of dec imal places

-12345

Ignor ed

Sign

8

Binary number

7

Number of characters

0.0012

4

Number of dec imal pl ac es

Ignored

12

Binar y number

If 16#2E, which represents the decimal point, is ignored, the string in S should be within the
range between -32768 and 32767. For example, if the string is “1235.3”, users have to check
whether “12353” is within the range.
D$VAL:
The operand S occupies seven word devices at most.
The number of characters contained in the string in S should be within the range between 2
and 13.
If there is a decimal point in the string in S, 16#2E should be stored between the first character
after the sign character and the last character.
(D1+1,D1)
Number of characters
(D1+3,D1+2)

S

b15
F irst ASCII code

S+ 1

T hi rd AS CII c ode

Second A SCII code

F ifth ASCII code

F our th ASCII code

Sign

Six th ASCII code

S+ 4
S+ 5

Ninth ASCII code

Eighth AS CII c ode

Elevnth A SCII code

T enth A SCII code

S+ 6

16#00

T welfth AS CII c ode

e
d
o
c
I
I
C
S
A
t n
s
g
r
i
i
F S

Seventh AS CII c ode

Number of dec imal plac es

b0

... .... .... .... .... ..... .... .... .... .... ..... .... .
(D2+1,D2)
Binary number

e
d
o
c
I
I
C
S
A
h
t
f
l
e
w
T

S+ 2
S+ 3

b8 b7

6-469

Ch ap te r 6 Ap plie d Instruc tions
If the data in S~S+5 is -12345.678, the calculation is as follows.
(D1+ 1,D1)

10
(D1+ 3,D1+ 2)

b15

b8 b7

3

b0

S

16#31(1)

16# 2D(-)

(D2+ 1,D2)

S +1

16# 33(3)

16# 32(2)

- 12345678

S +2

16# 35(5)

16#34 (4)

S +3

16# 36(6)

16# 2E(.)

S +4

16#38( 8)

16# 37(7)

S +5

-

1

2

3

4

5

.

6

7

8

16# 00

If there is 16#20 or 16#30 between the sign character and the first value which is not 0 in the
string in S, 16#20 or 16#30 is ignored when the string is converted into the binary number.
-

1234.56

0.00012345

4.
5.

Number of c haracters

2

Number of dec imal places

-123456 Binary number

Ignor ed

Sign

12

11

Number of characters

8

Number of dec imal plac es

12345

Ignor ed

Binary number

If 16#2E, which represents the decimal point, is ignored, the string in S should be within the
range between -2147483648 and 2147483647. For example, if the string is “1234567.8”, users
have to check whether “12345678” is within the range.
If the sign code in S is 16#20, the conversion result is a positive value. If the sign code in S is
16#2D, the conversion result is a negative value.
In the string in S, except for the sign code, the code representing the decimal point, and the
code which can be ignored, i.e. 16#20 or 16#30, the other codes have to be within the range
between 16#30 and 16#39.

Example 1:

b15

b8 b7

b0

D20

16#31(1)

16# 2D( -)

D 21

16# 2E(.)

16# 32(2)

D22

16# 34(4)

16# 33(3)

D 23

6-470

16# 00

6

D 10 ( Number of charac ter s )

2

D 11 ( N umber of decimal places )

- 1234

D0

A H 5 00 Prog r am m ing M an ua l

Example 2:

b15
D20

b8 b7
16#31(1)

b0
16#20( )

D21

16#33(3)

16#32(2)

D22

16#35(5)

16#34(4)

D 23

16#36(6)

16#2E(.)

D24

16#38(8)

16#37(7)

D25

( D11,D10)
10

Number of characters

(D13,D12)
3

Number of dec imal plac es

(D1,D0)
12345678

16#00

Additional remark:
1.
2.
3.

4.
5.

6.
7.

If the number of characters contained in the string in S exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the sign code in S is neither 16#20 nor 16#2D, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
If the decimal point in the string in S is not stored between the first character after the sign
character and the last character, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If the binary number converted from the string in S exceeds the range, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
In the string in S, except for the sign code, the code representing the decimal point, and the
code which can be ignored, i.e. 16#20 or 16#30, the other codes have to be within the range
between 16#30 and 16#39. If the other codes are not within the range between 16#30 and
16#39, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the operand D1 used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.
If the operand D1 used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of DWORD/DINT.

6-471

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

2109

$FSTR

S1, S2, D

Device X

Y









S1
S2
D

M

P
S

T

C









HC

Function
Converting the floating-point
number into the string

D

L

SM SR












E

PR

K

16# “$”





DF


Pulse instruction 16-bit instruction (7-8 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Source value

Double word

Initial device in which the
format is stored
Initial device in which the
D :
conversion result is stored

S2 :

Word
Word

Explanation:
1.
2.
3.

The floating-point number in S1 is converted into the string in accordance with the setting of S2,
and the conversion result is stored in D.
The conversion result varies with the setting of S2.
The value in S2+1 should be within the range between 2 and 24.
S2

4.

0: Decimal for mat
1: Ex ponential

S2 +1

N umber of characters

S2 +2

Number of dec imal plac es

Decimal format
Dec imal fo ra mt

S2

Numbe r of ch arac ters

S 2 +1

Nu mbe r o f de cima l p la ces

S 2 +2

b15
b8 b7
F irst ASCII code

D

D

T hi rd AS CII c ode
+2 F our th ASCII code

D

+3

D

+4

D

.

Sign

( S1 +1 , S1 )

F loating- poi nt number

6-472

+1

Six th ASCII code

b0

Sign

Second ASCII code
Decimal poi nt (.)

F ifth ASCII code

16#00 ( Ending charac ter )

Automati cally stored at the end of the s tr ing

A H 5 00 Prog r am m ing M an ua l
Suppose the number of characters is 8, the number of decimal places is 2, and the value is
-1.23456. The calculation is as follows.
0

S2

8

S 2 +1

3

S 2 +2

b15
D

1

-

.

2

3

5

b8 b7

b0

16#20( )

16 # 2D( - )

D

+1

16# 31(1 )

16# 20( )

D

+2

16# 32(2 )

16#2E(. )

D

+3

16# 35(5)

16# 3 3(3)

D

+4

16#00 ( End ing charac ter )

Sign
Automati cally stored at the end of the str ing
( S1 +1 , S1 )

-1.23456










The value in S2+1:
If the value in S2+2 is 0, the value in S2+1 should be within the range between 2 and 24,
and the number of characters which the integer part contains should be less than or
equal to 23.
If the value in S2+2 is not 0, the value in S2+1 should be within the range between the
value in S2+2 plus 3 and 24, and the number of characters which the integer part
contains should be less than or equal to 22 minus the value in S2+2.
The value in S2+2 should be within the range between 0 and 7. If the value in S2+2 is not
0, it should be less than or equal to the value in S2+1 minus 3.
If the floating-point number in S1 is a positive number, the sign code in D is 16#20. If the
floating-point number in S1 is a negative number, the sign code in D is 16#2D.
If the length of the floating-point number is larger than the value in S2+1, the floating-point
number is rounded off, and the redundant characters are deleted.
If the value in S2+2 is larger than 0, 16#2E (“.”) is stored in front of the specified character
automatically.
If the length of the conversion result is less than the value in S2+1, the codes between the
sign character and the real number are 16#20.
The conversion result ends with 16#00.

0 (De cima l fo ra mt)

S2

8 (Nu mbe r o f cha ra cter s) S 2 +1
3 (Number of deci mal plac es) S 2 +2
( S1 +1 , S1 )

B eco min g 1 6# 20

1

.

2

3

4

5 6

A uto mati cal ly sto re d

Th e fl oa tin g- po in t nu mbe r i s ro un d ed off,
a nd the re du nd an t cha ra cter s a re de le ted .

-1.23456

6-473

Ch ap te r 6 Ap plie d Instruc tions
5.

Exponential format
Expon ential format

S2
S 2 +1

Numbe r of cha ract ers

S 2 +2

Numbe r of dec im al plac es

b0
b8 b7
b15
F irst ASCII code
Sign (Integer)

D

.

E

D+1

Decimal poi nt (.)

Second A SCII code

D+2

F our th ASCII code

D+3

Six th ASCII code

D+4

Sign (Exponent)

n
g
i
S

n
g
i
S

︵

︵

Second A SCII code

D+5

T hi rd AS CII c ode
F ifth ASCII code
16#45(E)

F irst ASCII code

16#00

D+6

r
e
g
e
t
n
I

t
n
e
n
o
p
x
E

︶

Automati cally stored at the end of the stri ng

︶

( S1 +1 , S1 )

F loating- point number

Suppose the number of characters is 12, the number of decimal places is 4, and the value is
-12.34567. The calculation is as follows.
S2

1

S 2 +1

12

S 2 +2

4

b15
D

-

1

.

2

3

4

6

E

+

0

1

D

+1

D

+2

D

b8 b7

b0

16#20( )

16# 2D( -)

16#2E(.)

16# 31(1)

n
g
i
S

n
g
i
S

︵

︵

16#33(3)

16# 32(2)

+3

16#35(5)

16# 34(4)

D

+4

16#2B(+)

16# 45(E)

D

+5

16#31(1)

D

+6

16# 30(0)
16#00

r
e
g
e
t
n
I

t
n
e
n
o
p
x
E

︶

Automati cally stored at the end of the str ing

︶

( S1 +1 ,S1 )

- 12.34567












6-474

The value in S2+1:
If the value in S2+2 is 0, the value in S2+1 should be within the range between 6 and 24.
If the value in S2+2 is not 0, the value in S2+1 should be within the range between the
value in S2+2 plus 7 and 24.
The value in S2+2 should be within the range between 0 and 7. If the value in S2+2 is not
0, it should be less than or equal to the value in S2+1 minus 7.
If the floating-point number in S1 is a positive number, the sign code in D is 16#20. If the
floating-point number in S1 is a negative number, the sign code in D is 16#2D.
The integer part contains one character. To fulfill the number of characters, the codes
between the sign code and the integer part are 16#20.
If the value in S2+2 is larger than 0, 16#2E (“.”) is stored in front of the specified character
automatically.
If the exponent is a positive number, the sign code in D is 16#2B. If the exponent is a
negative number, the sign code in D is 16#2D.
The exponent part contains two characters. If there is only one character, the other
character is “0” (16#30).
The conversion result ends with 16#00.

A H 5 00 Prog r am m ing M an ua l

S2

2

3

4

5 6 7

E

+

0

n
g
i
S
r
e
g
e
t
n
I

︶

︶

0
2
#
6
1
g
n
i
m
o
c
e
B

︵

︵

d
e
r
o
t
s
y
l
l
a
c
i
t
a
m
o
t
u
A

- 12.34567

.

1

t
n
e
n
o
p
x
E

-

( S1+1,S1)

.
d
e
t
e
l
e
d
e
r
a

S 2 +2

es
hr
t
e
t
dc
na
ar
,a
f
fh
o
c
dt
en
da
nd
un
ou
rd
e
sr
i

4

r
e
b
m
u
n
t
n
i
o
p
g
n
i
t
a
o
l
f
e
h
T

S 2 +1

n
g
i
S

12

1
s
r
e
t
c
a
r
a
h
c
o
w
T

1

Example 1:
Suppose the value in D4 is 0. The floating-point number in (D1, D0) is converted into the decimal
format of the string.

0

D4

Dec imal fo rm at

7

D5

Numbe r of ch arac ters

3

b15

Numbe r of dec imal plac es

D6

0

.

0

2

3

b0

b8 b7
16#20( )

16# 20( )

D10

16# 2E(.)

16# 30(0)

D11

16# 33(3)

16#30(0)

D12

16# 00

16# 33(3)

D13

( D1,D0)
Automati cally stored at the end of the s tr ing

0.0327457

Example 2:
Suppose the value in D4 is 1. The floating-point number in (D1, D0) is converted into the
exponential format of the string.
b15

D6

4

Exponential foramt

16# 2E(.)

16# 33(3)

Number of characters

D12

16# 37(7)

16# 32(2)

D13

16# 36(6)

16# 34(4)

D14

16# 2D( -)

16# 45(E)

D15

16# 32(2)

Number of dec imal plac es
D1

D0

.

2

7

4

6

E

-

0

︵

︵

0.0327457

3

2

D16

16# 30(0)
16# 00

Automati cally stored at the end of the str i ng

︶

r
e
g
e
t
n
I

︶

t
n
e
n
o
p
x
E

12

16# 20( )

n
g
i
S

1

D5

b0

16#20( )

n
g
i
S

D4

b8 b7

D10
D11

Additional remark:
1.
2.
3.

If the value in S1 exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.
If the value in S2 is neither 0 nor 1, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the value in S2+1 exceeds the range below, the instruction is not executed, SM0 is ON, and

6-475

Ch ap te r 6 Ap plie d Instruc tions

4.

5.

the error code in SR0 is 16#2003.
 The decimal format:
If the value in S2+2 is 0, the value in S2+1 should be within the range between 2 and 24,
and the number of characters which the integer part contains should be less than or
equal to 23.
If the value in S2+2 is not 0, the value in S2+1 should be within the range between the
value in S2+2 plus 3 and 24, and the number of characters which the integer part
contains should be less than or equal to 22 minus the value in S2+2
 The exponential format:
If the value in S2+2 is 0, the value in S2+1 should be within the range between 6 and 24.
If the value in S2+2 is not 0, the value in S2+1 should be within the range between the
value in S2+2 plus 7 and 24.
If the value in S2+2 exceeds the range below, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
 The decimal format:
The value in S2+2 should be within the range between 0 and 7. Besides, it should be less
than or equal to the value in S2+1 minus 3.
 The exponential format:
The value in S2+2 should be within the range between 0 and 7. Besides, it should be less
than or equal to the value in S2+1 minus 7.
If users declare the operand S2 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.

6-476

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

2110

$FVAL

S, D

Device

X

Y

S
D







P

M

S

T

C







HC

Function
Converting the string into the
floating-point number

D

L

SM SR










E

PR

K

16# “$”




DF



Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction
AH

AH

-

Symbol:
S : Source value
D:

Word

Device in which the conversion
result is stored

Double word

Explanation:
1.

The string in S is converted into the floating-point number, and the conversion result is stored
in D.
b8 b7
b15
F irst ASCII code

S
S +1
S +2

b0

Sign

T hi rd AS CII c ode

Second A SCII code

F ifth ASCII code

F our th ASCII code

Seventh AS CII c ode Six th ASCII code
......
......

S +3
S +4

......

(D+1, D)

F loating- point number

16#00

S +. ..

T he end of the s tr ing

2.

The string in S can be the decimal format of the string or the exponential format of the string.
 The decimal format:
b15
S

b0
b8 b7
16# 2D(-)
16#31H( 1)

S +1

16# 30(0)

16# 2E(.)

(D+1, D)

S +2

16# 38(8)

16# 37(7)

HBF 89F FD4

S +3

16# 32(2)

16# 31(1)

Floating-point number - 1.07812

16#00

S +4



.

1

-

0

7

1

8

2

The exponential format:
b15
S

16#20( )

b0
16# 2D(-)

S +1

16#2E(.)

16# 31(1)

(D+1, D)

S +2

16# 32(2)

16# 33(3)

16#D 044B 5D 1

S +3

16# 31(1)

16# 30(0)

S +4

16# 2B(+ )

16# 45(E)

S +5

16# 30(0)

16# 31(1)

b8 b7

16#00

S +6

-

F loating- poi nt number -1.3201E +10

1

.

3

2

0

1

E +

1

0

6-477

Ch ap te r 6 Ap plie d Instruc tions
3.
4.

If the sign code in S is 16#20, the conversion result is a positive value. If the sign code in S1 is
16#2D, the conversion result is a negative value.
16#20 or 16#30 is ignored during the conversion, as the example below shows.
b15

b0

b8 b7

S

16#20( )

16 # 2D (-)

S +1

16 # 31(1 )

16 #30 (0 )

S +2

16 # 32(2 )

16 #2E ( .)

S +3

16# 31(1)

16# 33(3)

( D+1 , D )

16#BF 9D 91 68
F loating- poi nt number - 1.231

16#00

S +4

1

0

-

.

3

2

1

Ignor ed

5.

24 characters at most can be contained in the string.

Example 1:

b15
D0

16#20( )

b0
16# 2D(-)

D1

16# 31(1)

16# 30(0)

D2

16# 32(2)

16# 2E(.)

D3

16# 34(4)

16# 33(3)

D4

16# 32(2)

16# 35(5)

D5

16#00

16#31(1)

-

b8 b7

0

Ignor ed

Example 2:

6-478

1

.

2

3

4

5

( D11, D10)
16#BF 9E 04C7
F loating- poi nt number -1.234521

2

1

A H 5 00 Prog r am m ing M an ua l

b15

b0

b8 b7

D10

16#20( )

16# 20( )

D11

16# 2E(.)

16# 31(1)

( D 101, D100)

D12

16# 33(3)

16# 32(2)

16#3C4A42AD

D13

16# 35(5)

16# 34(4)

F loating-point number 1.2345E-2

D14

16# 2D (-)

16# 45(E)

D15

16#32(2)

16#30(0)

D16

16#00
1

Ignor ed

.

2

3

4

5

E

-

0

2

Ignor ed

Additional remark:
1.
2.
3.
4.

5.

6.

7.

If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If the length of the string in S exceeds the range, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
If the sign code in S is neither 16#20 nor 16#2D, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
If there is more than one 16#2E (“.”), 16#2B (“+”), or 16#2D (“-”) in the string in S, exclusive of
16#2D (“-”) with which the string starts, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.
If the characters which constitute the integer part and the characters which constitute the
fractional part in the string in S are not within the range between 16#30 (“0”) and 16#39 (“9”),
the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
The character in the exponent part in the string in S only can be “E” (16#45), “+” (16#2B), “-”
(16#2D), or the number between “0” (16#30) and “9” (16#39). Otherwise, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the conversion result exceeds the range of values which can be represented by the
floating-point numbers, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#2013.

6-479

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2111

$RIGHT

S, n, D

The retrieve of the characters in the
string begins from the right.

Device X

Y









S
n
D

P

M

S

T

C

HC









D

L

SM SR












E

PR







K

16# “$”

DF






Pulse instruction 16-bit instruction (7-13 steps) 32-bit instruction
AH

AH

-

Symbol:
S : String

Word

Number of characters which are
retrieved
Device in which the characters
D:
retrieved are stored
n:

Word
Word

Explanation:
1.
2.

The instruction is used to retrieve n characters in the string in S from the right, and the
characters which are retrieved are stored in D.
If n is 0, the value in D is 0.
b15
S

b8 b7
b0
Second A SCII code
F irst ASCII code

S +1

F our th ASCII code

T hi rd AS CII c ode

~

.. ... ... ... ... ... ... .

n-1
n-3

th

th

A SCII c ode from the last

n

A SCII c ode from the last

ASCII code fr om the las t

th

n-2

th

A SCII c ode from the last

~
Second ASCII code from the last T hi rd AS CII c ode from the l as t
F irst ASC II code from the last

16#00

n-1

D

th

n

A SCII c ode from the last

D +1

n-3

.....................

Second ASC II code from the last

th

A SCII c ode from the last

th

n-2

ASCII code fr om the las t
th

A SCII c ode from the last

~

16#00

T hi rd AS CII c ode from the l as t
F irst ASC II code from the last

If the data in S is ABCDEF12345 and n is 5, five characters in the string in S are retrieved from
the right. The conversion result is as follows.
b15

ABCDE F12345

6-480

b0
16#41(A)

b15

S

b8 b7
16#42(B)

b8 b7
16# 32(2)

S +1

16# 44(D)

16# 43(C )

16# 34(4)

16# 33(3)

D +1

S +2

16# 46(F )

16# 45(E)

16#00

16# 35(5)

D +2

S +3

16# 32(2)

16# 31(1)

S +4

16# 34(4)

16# 33(3)

S +5

16# 00

16# 35(5)

T he fifth charac ter from the last

b0
D
16#31(1)

A H 5 00 Prog r am m ing M an ua l

Example:

b15

b8 b7

b0

b15

b8 b7

b0

D0

16#42(B)

16#41( A)

16# 46(F )

16#45( E)

D10

D1

16# 44(D)

16#43( C)

16# 48(H)

16# 47(G)

D11

D2

16# 46(F )

16# 45(E)

D3

16#48( H)

16#47( G)

D4

16# 00

D12

T he fourth char ac ter from the last

16# 00

Additional remark:
1.
2.
3.

If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If n is less than 0, or if n is larger than the length of the string in S, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If D is not sufficient to contain n characters, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.

6-481

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2112

$LEFT

S, n, D

The retrieve of the characters in the
string begins from the left.

Device

X

Y

S
n
D









P

M

S

T

C









HC

D

L

SM SR












E

PR







K

16# “$”

DF






Pulse instruction

16-bit instruction (7-13 steps)

32-bit instruction

AH

AH

-

Symbol:
S : String

Word

Number of characters which are
retrieved
Device in which the characters
D:
retrieved are stored
n:

Word
Word

Explanation:
1.
2.

The instruction is used to retrieve n characters in the string in S from the left, and the
characters which are retrieved are stored in D.
If n is 0, the value in D is 0.
b8 b7

b15
S
S +1

b0

Second ASC II code

F irst ASC II code

F our th ASC II code

T hi rd A SCII c ode

b15

b8 b7
Second ASCII code

D +1

...........

th

D

T hi rd A SCII c ode

~

th

F irst ASCII code

F our th ASC II code

~
A SC II code from the last

n-2

th

A SCII code from the last

AS CII c ode from the last

n

th

ASCII c ode from the l as t

n-1

th

A SCII code from the last

n-2

th

A SCII code from the last

n

th

ASC II c ode from the l as t

16#00

~

.................... .

n-1

n+1

b0

Last A SCII c ode

16#00

If the data in S is ABCDEF12345 and n is 7, seven characters in the string in S are retrieved
from the left. The conversion result is as follows.
b15

ABCDEF 12345

b8 b7

b0

b15

b8 b7

b0

S

16#42(B)

16#41( A)

16# 42(B)

16#41( A)

S +1

16# 44(D)

16# 43(C)

16# 44(D)

16# 43(C)

D

+1

S +2

16# 46(F )

16# 45(E)

16# 46(F )

16# 45(E)

D

+2

S +3

16# 32(2)

16# 31(1)

16# 00

16# 31(1)

D

+3

S +4

16# 34(4)

16# 33(3)

S +5

16# 00

16# 35(5)

D

Seventh c haracter

Example:
When M0 is ON, the instruction $LEFT is executed. The six characters starting from the character in
D100 are retrieved, and stored in D10~D12.

6-482

A H 5 00 Prog r am m ing M an ua l

b15
D0

6

Six th char ac te r

b8 b7

b0

b15

b8 b7

b0

D100

16 #42(B)

1 6#41( A)

16# 42(B)

16#41( A)

D10

D101

16 # 44(D)

16# 43(C)

16# 44(D)

16# 43(C )

D11

D102

16# 46(F )

16# 45(E)

16# 46(F )

16# 45(E)

D12

D103

1 6# 48(H )

D1 0 4

16# 4 7( G )

1 6 # 00

D13

16# 00

Additional remark:
1.
2.
3.

If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If n is less than 0, or if n is larger than the length of the string in S, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If D is not sufficient to contain n characters, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#2003.

6-483

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2113

$MIDR

S1, S2, D

Retrieving a part of the string

Device

X

Y

S1
S2
D









P

M

S

T

C









HC

D

L

SM SR












Pulse instruction

E

PR







K

16# “$”

DF



16-bit instruction (7-13 steps) 32-bit instruction

AH

AH

-

Symbol:
S1 : String

Word

Part of the string which is
retrieved
Device in which the characters
D :
retrieved are stored

S2 :

Word
Word

Explanation:
1.

Suppose the values in S2 and S2+1 are n and m respectively. The m characters starting from
the nth character in the string in S1 are retrieved, and stored in D.
b0

b8 b7

b15
S1
S1+1

Se con d AS CII co de

First ASCI I code

Fourt h AS CII cod e

Third A SCII co de

n+ 1

th

AS CII co de f rom th e last

n+ 3 t h AS CII co de f rom th e last

th

A SCII code from t he last

D

n+ 2 t h AS CII co de f rom th e las t

th

A SCII code from t he last

th

AS CII co de f rom th e last n+ m-3 t h AS CII co de f rom t he las t
16#0 0

n+ m-1 t h AS CII co de f rom th e las t

D +1

.. .. .. .. ...

n

n+ 2 t h AS CII co de f rom th e last

AS CII co de f rom th e last

n

~

~

. .. .. .. . .. .. .. . .. .. ..

n+ m-2

n+ 1 t h AS CII co de f rom th e last
n+ 3

th

b0

b8 b7

b15

~

n+ m

th

ASCI I code fro m the las t n+ m-1

th

AS CII co de f rom th e last

~
Las t ASCI I code

16#0 0

2.

If the data in S1 is ABCDEFGHIJK, the value in S2 is 3, and the value in S2+1 is 7, the seven
characters starting from the third characters in the string are retrieved from the left. The
conversion result is as follows.
b15

3.
4.
5.

b15

b0

b8 b7

S1

16#42(B)

16#41(A)

S1 +1

16# 44(D)

16# 43(C )

S1 +2

16# 46(F )

16# 45(E)

S1+3

16# 48(H)

16# 47(G)

S1 +4

16# 4A(J )

16# 49(I)

S1+5

16# 00

16# 4B(K)

16# 43(C)

D

16# 46(F )

16#45(E)

D+1

16# 48(H)

16# 47(G)

16# 00

16# 49(I)

D+2
D+3

16# 44(D)
S2
Thi rd cha ra cter

b0

b8 b7

Se ven th ch ar acte r

If the value in S2+1 is 0, the instruction is not executed.
If the value in S2+1 is -1, the characters in S1 starting from the character indicated by the value
in S2 to the last character in S1 are retrieved.
If the data in S1 is ABCDEFGHIJK, the value in S2 is 5, and the value in S2+1 is -1, the
conversion result is as follows.

6-484

A H 5 00 Prog r am m ing M an ua l

b15

b15

b0

b8 b 7

b0

b8 b7

S1

16#42 (B)

S1 +1

1 6# 4 4(D)

1 6# 43(C)

16# 48(H)

16# 47(G)

D +1

S1 +2

16# 46( F )

1 6 # 45 (E )

16# 4A (J )

16# 4 9(I)

D +2

S1+3

16 # 48 (H )

16 # 47( G )

16# 00

16# 4 B(K)

S1 +4

1 6 # 4A (J )

16 # 49(I)

S1+5

16# 00

16 # 4B(K )

16 #41( A)

16# 46(F )

Fifth c harac te r

16#45( E)

D

Example:

b15
D 10

b8 b7
16#32(2)

b0

b15

b8 b7

16#31( 1)

16# 34(4 )
16# 36(6)

D11

16# 34( 4)

16# 33(3)

D1 2

16#36( 6)

16# 35(5)

D13

16# 00

16# 37(7)

D 20

3

D21

4

b0
16#33( 3)
16# 35(5)

16# 00

D0
D1
D2

Additional remark:
1.
2.
3.
4.
5.

If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If the value in S2 is less than or equal to 0, or if the value in S2+1 is less than -1, SM0 is ON,
and the error code in SR0 is 16#2003.
If the value in S2 is larger than the length of the string in S1, SM0 is ON, and the error code in
SR0 is 16#2003.
If the value in S2+1 is larger than the number of characters which can be retrieved from the
string in S1, SM0 is ON, and the error code in SR0 is 16#2003.
If the operand S2 used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.

6-485

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2114

$MIDW

S1, S2, D

Replacing a part of the string

Device X

Y









S1
S2
D

M

P
S

T

C









HC

D

L

SM SR












E

PR







K

16# “$”

DF



Pulse instruction 16-bit instruction (7-13 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : String
S2 :

Word

Part of the string which is
replaced

Word

D : String which is replaced

Word

Explanation:
1.

S2: The initial character in D which is replaced
S2+1: The number of characters which are retrieved from S1
The retrieve of the characters in the string in S1 begins from the first character, and the value in
S2+1 indicates the number of characters which are retrieved from the string in S1. The
characters which are retrieved from the string in S1 replace the characters in D starting from
the character indicated by the value in S2.

2.

b15

3.
4.

b0

b8 b7

S1

16#32(2)

S1 +1

16# 34(4)

S1 +2

16# 36(6)

S1+3

16# 38(8)

S1 +4

16# 00

b15

b0

b8 b7
16# 46(F )

16#45(E)

D

16# 33(3)

16# 48(H )

16# 47(G)

D +1

16# 35(5)

16# 4A(J )

16# 49(I)

D +2

16# 37(7)

16# 4C(L)

16# 4B(K)

D +3

16# 39(9)

16# 00

16# 4D (M)

D +4

16#31(1)

S2

3

In iti al cha ra cter in D whi ch is r ep la ced

S2 +1

6

Nu mbe r o f cha ra cter s whi ch
a re re tri eve d fr om S 1

Af ter the in st ruct ion is execute d

b15

b8 b7

b0

16# 46(F )

16#45(E)

D

16# 32(2)

16#31(1)

D +1

16# 34(4)

16# 33(3)

D +2

16# 36(6)

16# 35(5)

D +3

16# 00

16# 4D(M)

D +4

If the value in S2+1 is 0, the instruction is not executed.
If the value in S2+1 is larger than the length of the string in D, the characters in D which are
replaced start from the character indicated by the value in S2 to the last character in D.

6-486

A H 5 00 Prog r am m ing M an ua l

b15
S1

b8 b7
1 6# 32(2)

b0
1 6#H31( 1)

b15

b0

b8 b 7
16# 46(F )

16#45(E)

D

S1 +1

1 6# 34(4)

16# 33 (3)

16# 48(H )

16# 47(G)

D +1

S1 +2

16 # 36(6 )

16 # 35(5 )

1 6 # 4A( J )

16 # 49( I)

D +2

S1+3

16 # 38( 8 )

16# 37(7 )

16 # 4C (L )

16# 4B( K)

D +3

16# 00

16 # 39(9 )

16 # 0 0

16# 4D( M)

D +4

S1 +4
S2

5

In iti al c ha ra cter in D w hi c h is r ep la ced

S2 +1

8

Nu m be r o f cha ra cter s whi ch
a re re tri eve d fr om S 1

A f ter the in st ru ct io n i s ex ec ute d

b15

b8 b7

b0

1 6# 46(F )

16#45(E)

D

16# 48(H)

1 6# 47(G)

D +1

16# 32(2)

16#31(1)

D +2

16# 34(4)

16# 33(3)

D +3

16 # 00

16# 35(5)

D +4

If the value in S2+1 is -1, all characters in S1 are retrieved.

5.

b15
S1

b8 b7
16#32(2)

b0
16#31(1)

S1 +1

16# 34(4)

S1 +2

b15

b8 b 7
16# 46(F )

b0
D
16 #45(E)

16# 33(3)

16# 48(H)

16# 47(G)

D +1

16# 36(6)

16# 35(5)

16# 4A(J )

16# 49(I)

D +2

S1+3

16# 38(8)

16# 37(3)

16# 4C(L)

16# 4B(K)

D +3

S1 +4

16# 00

16# 39(9)

16# 00

16# 4D(M)

D +4

S2

2

In iti al cha ra cter in D whi ch is r ep la ced

S2 +1

-1

Nu mbe r o f cha ra cter s wh ich
a re re tri eve d fr om S 1

Af ter the in st ruct ion is exec ute d

b15

b8 b7
16# 46(F )

b0
D
16#45(E)

16# 32(2)

16#31(1)

D +1

16# 34(4)

16# 33(3)

D +2

16# 36(6)

16# 35(5)

D +3

16# 00

16# 37(7)

D +4

Example:

6-487

Ch ap te r 6 Ap plie d Instruc tions

b15

b8 b7

b0

b15

b8 b7

b0

D0

16#42(B)

16#41( A)

16# 32(2)

16#31( 1)

D100

D1

16# 44(D)

16# 43(C)

16# 34(4)

16# 33(3)

D101

D2

16# 46(F)

16# 45(E)

16# 36(6)

16# 35(5)

D102

16# 38(8)

16# 37(7)

D103

16# 00

D3

D104

16# 00
D10
D11

3
4

Af ter t he in st ruct ion is exec uted

In iti al cha ra cter in D whi ch i s re pl ac ed
Nu mbe r o f cha ra cter s whi ch
a re re tri eve d fr om S 1

b15

b8 b7

b0

16# 32(2)

16#31( 1)

D100

16# 42(B)

16#41( A)

D101

16# 44(D)

16# 43(C)

D102

16# 38(8)

16# 37(7)

D103

16# 00

D104

Additional remark:
1.
2.
3.
4.

5.

If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If the string in D does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S2 is less than or equal to 0, or if the value in S2 is larger than the length of the
string in D, SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S2+1 is less than -1, or if the value in S2+1 is larger than the number of
characters which can be retrieved from the string in S1, SM0 is ON, and the error code in SR0
is 16#2003.
If the operand S2 used during the execution of the 16-bit instruction is declared in ISPSoft, the
data type will be ARRAY [2] of WORD/INT.

6-488

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

2115

$SER

S1, S2, n, D

Searching the string

Device X

Y











S1
S2
n
D

M

P
S

T

C

HC











D

L

SM SR
















E

PR









K

16# “$”

DF







Pulse instruction 16-bit instruction (9-21 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : String which is searched

Word

S2 : String which is searched for

Word

n :

nth character in S2 from which the
search begins

D : Search result

Word
Word

Explanation:
1.
2.

The instruction is used to search the string from the nth character in S2 for the string which is
the same as the string in S1, and the search result is stored in D.
Suppose the string in S2 is “ABCDEFGHIJK”, the string in S1 is “EFGH”, and n is 3. The search
begins from the third character in S2, and the value in D is 5.
b15

b8 b7

b0

b15

b8 b7

b0

S1

16#46(F)

16#45( E)

16# 42(B)

16#41( A)

S2

S1 +1

16# 48(H )

16# 47(G)

16# 44(D)

16# 43(C)

S2 +1

Searc hing the str ing from the thir d c har acter

S1 +2

忽略

16# 00

16# 46(F)

16#45( E)

S2+2

Matching c har acter

16# 48(H )

16# 47(G)

S2+3

16# 4A(J)

16# 49(I)

S2+4

16# 00

16# 4B(K)

S2+5

After the instruction is ex ecuted
5

D

Example:

6-489

Ch ap te r 6 Ap plie d Instruc tions

b15
AB

b0

b8 b7
16#3 2( 2)

16#3 1( 1)

D0

16# 44 (D )

16# 4 3(C)

D1

16# 42 (B )

16# 4 1( A)

D2

16# 48 (H )

16 # 47 (G )

D3

I gn ore d

16# 00

Searc hing the str ing from the thi rd c har acter
M atchi n g c h ar act er

Af ter th e i nstr uct ion is e x ecu ted
5

D100

Additional remark:
1.
2.
3.

If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If the string in S2 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#2003.
If n is less than or equal to 0, or if n is larger than the length of the string in S2, SM0 is ON, and
the error code in SR0 is 16#2003

6-490

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

2116

$RPLC

S1, S2, S3, S4, D

Replacing the characters in the string

Device X

Y













S1
S2
S3
S4
D

M

P
S

T

C

HC













D

L

SM SR
























E

PR











K

16# “$”

DF








Pulse instruction 16-bit instruction (11-17 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : String which is replaced

Word

S2 : New string

Word

Number of characters in S1 which are
replaced

Word

The characters in S1 starting from the
S4 : character indicated by the value in S4
are replaced.

Word

S3 :

D :

Device in which the execution result is
stored

Word

Explanation:
1.

2.

The characters in S1 starting from the character indicated by the value in S4 are replaced by
the characters in S2, the number of characters which are replaced is indicated by the value in
S3, and the result is stored in D.
The four characters starting from the sixth character in the string “1234567890” are replaced
by “MN”, and the result is “12345MN0”.
b15
S1
S1+1

3.
4.

b8 b7

b0

b15

b8 b7

b0

16#32(2)

16#31( 1)

16# 32(2)

16#31( 1)

16# 34(4)

16#33( 3)

16# 34(4)

16# 33(3)

D
D+1

16# 4D(M)

16# 35(5)

D+2

16# 4E(N)

D+3

S1+2

16# 36(6)

16# 35(5)

S1+3

16# 38(8)

16# 37(7)

S1+4

16# 30(0)

16# 39(9)

S1+5

Ignored

16# 00

S2

16# 4E(N)

16#4D( M)

S2+1

Ignored

16# 00

After the instruction
is executed

16# 30(0)

16# 0000

S3

4

Number of characters which are r eplaced

S4

6

Character which i s r eplaced

D+4

If the string in S2 is 16#00, the instruction has the function of deleting the characters.
If the value in S3 is larger than the number of characters which can be replaced in the string in
S1, the characters in S1 starting from the character indicated by the value in S4 to the last
character in S1 are replaced.

6-491

Ch ap te r 6 Ap plie d Instruc tions
5.

If the value in S3 is equal to 0, the instruction is not executed.

Example:
When M0 is ON, the data in D0~D7 is “1234ABAB1234AB”, and the data in D10~D11 is “CDEF”.
When the instruction $RPLC is executed, the characters in D0~D7 starting from the character
indicated by the value in D51 are replaced by the characters in D10~D11. The number of characters
which are replaced is indicated by the value in D50, and the result is stored in D20~D27.

If the values in D50 and D51 are 3 and 4 respectively, the execution result is as follows.
b15

6-492

b8 b7

b15

b0

b8 b7

b0
D2 0

D0

16#32(2)

16#31( 1)

16# 32(2)

16#31( 1)

D1

16# 34(4)

16# 33(3)

16# 43(C)

16# 33(3)

D21

D2

16# 42(B)

16# 41(A)

16# 45(E)

16# 44(D )

D22

D3

16# 42(B)

16# 41(A)

16# 42(B)

16# 46(F)

D 23

D4

16# 32(2)

16# 31(1)

16#32 (2)

16#31 (1)

D 24

D5

16# 34(4)

16# 33(3)

16# 34(4)

16# 33(3)

D 25

D6

16# 42(B)

16# 41(A)

16# 42(B)

16#41 (A)

D 26

D7

Ignored

16#00

D10

16# 44(D)

16# 43(C)

D11

16# 45(F)

16# 45(E)

D12

Ignored

16#00

After the instruction
is executed

16# 0000

D 50

4

Number of characters which are r eplaced

D 51

4

Character w hi ch is r epl ac ed

D 27

A H 5 00 Prog r am m ing M an ua l
If the values in D50 and D51 are 4 and 4 respectively, the execution result is as follows.
b15

b8 b7

b15

b0

b8 b7

b0
D20

D0

16#32(2)

16#31( 1)

16# 32(2)

16#31( 1)

D1

16# 34(4)

16# 33(3)

16# 43(C)

16# 33(3)

D21

D2

16# 42(B)

16# 41(A)

16# 45(E)

16# 44(D)

D22

D3

16# 42(B)

16# 41(A)

16# 42(B)

16# 46(F )

D23

D4

16# 32(2)

16# 31(1)

16#32 (2)

16#31 (1)

D24

D5

16# 34(4)

16# 33(3)

16# 34(4)

16# 33(3)

D25

D6

16# 42(B)

16# 41(A)

16# 42(B)

16#41 (A)

D26

D7

Ignored

16#00

D10

16# 44(D)

16# 43(C)

D11

16# 45(F )

16# 45(E)

D12

Ignored

16#00

After the instruction
is executed

16# 0000

D50

4

Number of characters which are r eplaced

D51

4

Character which is r epl ac ed

D27

If the values in D50 and D51 are 20 and 4 respectively, the execution result is as follows.
b15
D0

b8 b7
16#32(2)

b0
16#31(1)

D1

16# 34(4)

D2

b15

b8 b7

b0
D20

16# 32(2)

16#31(1)

16# 33(3)

16# 43(C)

16# 33(3)

D21

16# 42(B)

16# 41(A)

16# 45(E)

16# 44(D)

D22

D3

16# 42(B)

16# 41(A)

16# 00

16# 46(F )

D23

D4

16# 32(2)

16# 31(1)

D5

16# 34(4)

16# 33(3)

D6

16# 42(B)

16# 41(A)

D7

Ignored

16# 00

D10

16# 44(D)

16# 43(C)

D11

16# 45(F )

16# 45(E)

D12

Ignored

16# 00

After the instruction
is executed

D50

20

Number of characters which are replaced

D51

4

Character which i s r eplaced

If the values in D50, D51, and D10 are 3, 4, and 16#00 respectively, the execution result is as
follows. The three characters in D0~D7 starting from the fourth character are deleted.
b15

b8 b7

b15

b0

b8 b7

b0
D20

D0

16#32(2)

16#31(1)

16# 32(2)

16#31(1)

D1

16# 34(4)

16# 33(3)

16# 41(A)

16# 33(3)

D21

D2

16# 42(B)

16# 41(A)

16# 31(1)

16# 42(B)

D 22

D3

16# 42(B)

16# 41(A)

D4

16# 32(2)

16# 31(1)

D5

16# 34(4)

16# 33(3)

D6

16# 42(B)

16# 41(A)

D7

16# 00

D10

16# 00

After the instruction
is executed

16# 33(3)

16# 32(2)

D 23

16# 41(A)

16# 34(4)

D24

16# 00

16#42(B)

D25

D50

3

Number of character s which are replaced

D51

4

Character which i s r eplaced

Additional remark:
1.

If the string in S1 does not end with -S1, SM0 is ON, and the error code in SR0 is 16#2003.

6-493

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

2117

$DEL

Device

X

Y

S1
S2
S3
D











P

M

S

T

C











Operand

Function

S1, S2, S3, D

Deleting the characters in the string

HC

D

L

SM SR















E

PR

K












16# “$”

DF




Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : String

Word

S2 : Number of characters which are deleted

Word

The characters in S1 starting from the
S3 : character indicated by the value in S3 are
deleted.

Word

D :

Device in which the execution result is
stored

Word

Explanation:
1.

2.

The characters in S1 starting from the character indicated by the value in S3 are deleted, the
number of characters which are deleted is indicated by the value in S2, and the result is stored
in D.
The four characters starting from the third character in the string “1234567890” in S1 are
deleted, and the result “127890” is stored in D.
b15

3.

S1

b8 b7
16#32(2)

b0
16#31( 1)

S1 +1

16# 34(4)

b15

b8 b7

b0

16# 32(2)

16#31( 1)

D

16# 33(3)

16# 38(8)

16# 37(7 )

D +1

16# 30(0)

16# 39(9)

D +2

S1 +2

16# 36(6)

16# 35(5)

S1+3

16# 38(8)

16# 37(7)

S1 +4

16# 30(0)

16# 39(9)

S1 +5

Ignored

After the instruction
is executed

16# 0000

D +2

16# 00

S2

4

S3

3

If the value in S2 is larger than the number of characters which can be deleted in the string in
S1, the characters in S1 starting from the character indicated by the value in S3 to the last
character in S1 are deleted, and 16#00 is stored in D.

6-494

A H 5 00 Prog r am m ing M an ua l

b15

4.

S1

b8 b7
16#32(2)

b0
16#31(1)

S1 +1

16# 34(4)

16# 33(3)

S1 +2

16# 36(6)

16# 35(5)

S 1+3

16 # 38( 8)

16 # 37 (7)

S 1 +4

16 # 30(0)

16# 39( 9)

S 1 +5

Ign ored

16#00

S2

10

S3

3

b15

b8 b7

b0

1 6# 32(2)
Afte r th e i nstru cti on
is ex ec ute d

D

16#31(1)

D +1

16 # 0 000

Larger tha n t he numbe r of c ha rac ter s
w h ich can be del eted i n the str ing i n S 1

If the value in S2 is equal to 0, the instruction is not executed.

Example:
When M0 is ON, the data in D0~D3 is “1234567”. When the instruction $DEL is executed, the
characters in D0~D3 starting from the character indicated by the value in D11 are deleted. The
number of characters which are deleted is indicated by the value in D10, and the result is stored in
D20~D22.

If the values in D10 and D11 are 3 and 4 respectively, the execution result is as follows.
b15

b8 b7

b0

D0

16#32(2)

16#31( 1)

D1

16# 34(4)

16# 33(3)

16# 32(2)

16#31( 1)

D2

16# 36(6)

16# 35(5)

16# 37(7)

16# 33(3)

D3

16# 37(7)

16# 00

D10

3

D11

4

b15

b8 b7

b0
D21
D22

16# 00

After the instruction
is executed

D20

If the values in D10 and D11 are 5 and 4 respectively, the execution result is as follows. Owing to the
fact that the number of characters which are deleted exceeds the range, the characters in D0~D3
starting from the fourth character to the last character are deleted.
b15

b0

b8 b7

D0

16#32(2)

16#31( 1)

D1

16# 34(4)

16# 33(3)

D2

16# 36(6)

16# 35(5)

D3

16# 00

16# 37(7)

D10

5

D11

4

b15

b8 b7

b0

16# 32(2)

16#31( 1)

D20

16# 00

16# 33(3)

D21

After the instruction
is executed
Ex ceeding the range

6-495

Ch ap te r 6 Ap plie d Instruc tions
If the values in D10 and D11 are 5 and 1 respectively, the execution result is as follows.
b15

b8 b7

b0

D0

16#32(2)

16#31(1)

D1

16# 34(4)

16# 33(3)

D2

16# 36(6)

16# 35(5)

D3

16# 00

16# 37(7)

D10

5

D11

1

b15

b8 b7
16# 37(7)

b0
16#36(6)

16# 00

D20
D21

After the instruction
is executed

Additional remark:
1.
2.

If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If the value in S2 is less than 0, the value in S3 is less than or equal to 0, or the value in S3 is
larger than the length of the string in S1, SM0 is ON, and the error code in SR0 is 16#2003.

6-496

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

2118

$CLR

P

S

Clearing the string

M

S

Device

X

Y

S





T

C





HC

D

L





SM SR

E

PR

K

16# “$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

-

Symbol:

S : String which is cleared

Word

Explanation:
1.

The string in S is cleared.
b15
S

b8 b7
16#31(1)

16# 2D(-)

b0
S

16# 0000

S +1

16# 33(3)

16# 32(2)

S +1

16# 0000

S +2

16# 34(4)

16# 35(5)

S +2

16# 0000

S +3

16# 36(6)

16# 2E(.)

S +3

16# 0000

S +4

16# 38(8)

16# 37(7)

S +4

16# 0000

S +5

16# 0000

S +5

16# 00

After the instruction
is executed

Example:
The string in D0 is cleared, as illustrated below.

b15

b8 b7

b0

D0

16#32(2)

16#31(1)

16# 0000

D1

16# 34(4)

16# 33(3)

16# 0000

D1

D2

16# 36(6)

16# 35(5)

16# 0000

D2

D3

16# 00

16# 37(7)

16# 0000

D3

After the instruction
is executed

D0

Additional remark:
1.

If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.

6-497

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2119

$INS

S1, S2, S3, D

Inserting the string

Device X

Y











S1
S2
S3
D

P

M

S

T

C











HC

D

L

SM SR















E

PR








K

16# “$”

DF






Pulse instruction 16-bit instruction (9-15 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : String

Word

S2 : String which is inserted

Word

The string is inserted into S1 after the
character indicated by the value in S3.
Device in which the execution result is
D :
stored

S3 :

Word
Word

Explanation:
1.
2.
3.

The string in S2 is inserted into the string in S1 after the character indicated by the value in S3,
and the result is stored in D.
If the string in either S1 or S2 is a null string, the other string which is not a null string is stored
in D.
If the strings in S1 and S2 are null strings, 16#0000 is stored in D.
b15

b8 b7

b15

b0

b8 b7

b0

S1

16#32(2)

16#31( 1)

16# 32(2)

16#31( 1)

D

S1 +1

16# 34(4)

16# 33(3)

16# 34(4)

16# 33(3)

D +1

S1 +2

16# 36(6)

16# 35(5)

16# 36(6)

16# 35(5)

D +2

S1+3

16# 38(8)

16# 37(7)

16# 4E(N)

16# 4D( M)

D +3

S1 +4

16# 30(0)

16# 39(9)

16# 38(8)

16# 37(7)

D +4

16# 30(0)

16# 39(9)

D +5

S1 +5

16# 00

After the instruction
is executed

16# 00
S2
S2 +1
S3

16# 4E(N)

D +6

16# 4D( M)

16# 00
6

Example:
When M0 is ON, the data in D0~D3 is “1234567”, and the data in D10 is “AB”. When the instruction
$INS is executed, “AB” is inserted into the string in D0~D3 after the character indicated by the value
in D30. The result is stored in D20~D24.

6-498

A H 5 00 Prog r am m ing M an ua l

If the value in D30 is 1, the execution result is as follows.
b15

b8 b7

b15

b0

b8 b7

b0

D0

16#32(2)

16#31( 1)

16# 41(A)

16#31( 1)

D1

16# 34(4)

16# 33(3)

16# 32(2)

16# 42(B)

D2 1

D2

16# 36(6)

16# 35(5)

16# 34(4)

16# 33(3)

D22

D3

16# 00

16# 37(7)

16# 36(6)

16# 35(5)

D23

16# 00

16# 37(7)

D24

D10

16# 42(B)

16# 41(A)

D11

Ignored

16# 0 0

After the instruction
is executed

D2 0

1

D30

If the value in D30 is 0, the execution result is as follows.
b15

b8 b7

b15

b0

b8 b7

b0

D0

16#32(2)

16#31( 1)

16# 42(B)

16#41( A)

D1

16# 34(4)

16# 33(3)

16# 32(2)

16# 31(1)

D21

D2

16# 36(6)

16# 35(5)

16# 34(4)

16# 33(3)

D22

D3

16# 00

16# 37(7)

16# 36(6)

16# 35(5)

D23

16# 00

16# 37(7)

D24

D10

16# 42(B)

16# 41(A)

D11

Ignored

16# 00

W0

After the instruction
is executed

D20

0

Additional remark:
1.
2.
3.

If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If the string in S2 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
If the value in S3 is less than 0, or if the value in S3 is larger than the length of the string in S1,
SM0 is ON, and the error code in SR0 is 16#2003.

6-499

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

2120

FMOD

P

S1, S2, D

Device X

Y

S









S1
S2
D

M

T

C









HC

Function
Converting the floating-point
number into the binary-coded
decimal floating-point number

D

L

SM SR












E

PR







K

16# “$”

DF






Pulse instruction 32-bit instruction (7-8 steps) 64-bit instruction
AH

AH

-

S1 : Floating-point number

Double word

S2 : Number of places

Word

D : Conversion result

Word

Symbol:

Explanation:
1.

The decimal point in the floating-point number in S1 is moved to the right in accordance with
the setting of S2 first, and then the result is converted into the binary-coded decimal
floating-point number. The final conversion result is stored in D.
S 1 +1

S1

Sign
F loating-point number
S2

S eve n- di gi t
b in ar y-co de d
d eci mal nu mbe r

Binary -coded deci mal
floati ng- point number

D
D +1
D +2

S ig n ( Exp on en t) D +3

Exponent

Number of pl ac es

D +4

The binary-coded decimal floating-point number format:
S2: The number of places
The value in S2 should be within the range between 0 and 7.
D: If the floating-point number in S1 is a positive number, the value in D is 0. If the floating-point
number in S1 is a negative number, the value in D is 1.
(D+2, D+1): The seven-digit binary-coded decimal number converted from the floating-point
number
D+3: If the exponent is a positive number, the value in D+3 is 0. If the exponent is a negative
number, the value in D+3 is 1.
D+4: The exponent
If the floating-point number in S1 is -0.03225547 and the value in S2 is 4, the conversion result
is as follows.
(S 1+1 ,S1)

1

0.03225547

D
D +1

16 #3 22 55 50
D +2

S2
4

Number of pl ac es

1

D +3

4

D +4

Since the value in S2 is 4, the decimal point in the floating-point number in S1 is moved to the
right by four decimal places. The floating-point number in S1 becomes -322.5547.
-322.5547 is equal to -3225547E-4. The binary-coded decimal floating-point number format is

6-500

A H 5 00 Prog r am m ing M an ua l
as follows.
The value in D is 1 because the floating-point number in S1 is a negative number.
The value stored in (D+2, D+1) is 16#3225550. (The floating-point number is converted into
the seven-digit binary-coded decimal number, and the seven-digit binary-coded decimal
number is rounded off).
The value in D+3 is 1 because the exponent is a negative number.
The value in D+4 is 4.
If the floating-point number in S1 is -1.32165E+2 and the value in S2 is 3, the conversion result
is as follows.
( S1 +1 ,S1 )

1

D

- 1.3 21 65 E+2

D +1
1 6# 13 21 65 0
D +2

S2
3

Number of plac es

1

D +3

1

D +4

-1.32165E+2 is equal to 132.165. Since the value in S2 is 3, the decimal point in the
floating-point number in S1 is moved to the right by three decimal places. The floating-point
number in S1 becomes -132165.
-132165 is equal to -1321650E-1. The binary-coded decimal floating-point number format is as
follows.
The value in D is 1 because the floating-point number in S1 is a negative number.
The value stored in (D+2, D+1) is 16#1321650. (The floating-point number is converted into
the seven-digit binary-coded decimal number, and the seven-digit binary-coded decimal
number is rounded off).
The value in D+3 is 1 because the exponent is a negative number.
The value in D+4 is 4.
Example:

(D1,D0)

0

1 .96 38 52 74 1
1 6# 19 63 85 0

D11
D 12

D4
3

D10

Number of pl ac es

1

D13

3

D14

Since the value in D4 is 3, the decimal point in 1.963852741 in (D1, D0) is moved to the right by
three decimal places. The floating-point number in (D1, D0) becomes 1963.852741.
The value in D10 is 0 because the floating-point number in S1 is a positive number.
1963.852741 is equal to 1963852E-3. The binary-coded decimal floating-point number format is as
follows.
The value stored in (D12, D11) is 16#1963850. (The floating-point number is converted into the
seven-digit binary-coded decimal number, and the seven-digit binary-coded decimal number is
rounded off).
The value in D13 is 1 because the exponent is a negative number.
The value in D14 is 3.

6-501

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.
3.

If the value in S1 exceeds the range of values which can be represented by the floating-point
numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.
If the value in S2 exceeds the range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [5] of WORD/INT.

6-502

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

2121

FREXP

P

S1, S2, D

Device X

Y

S









S1
S2
D

M

T

C









HC

Function
Converting the Binary-coded
decimal floating-point number into
the floating-point number

D

L

SM SR













E

PR

K









Pulse instruction 16-bit instruction (7 steps)
AH

16# “$”

DF



32-bit instruction

AH

-

Symbol:
S1 :

Binary-coded decimal
floating-point number

Word

S2 : Number of places

Word

D : Conversion result

Double word

Explanation:
The binary-coded decimal floating-point number in S1 is converted into the floating-point number
first, and then the decimal point in the floating-point number is moved to the left in accordance with
the setting of S2. The final result is stored in D.
Sign
Binary -coded deci mal
floati ng- point number

S eve n- di gi t
b in ar y-co de d
d eci mal nu mbe r
S ig n ( Exp on en t)

Exponent

S1
S 1+1

D +1

D

S 1+2
S 1+3
S 1+4

F loating-point number

N umber of pl ac es S 2

The binary-coded decimal floating-point number format:
1.
If the binary-coded decimal floating-point number is a positive number, the value in S1 is 0. If
the binary-coded decimal floating-point number is a negative number, the value in S1 is 1.
2.
The seven-digit binary-coded decimal number is stored in (S1+2, S1+1).
3.
If the exponent is a positive number, the value in S1+3 is 0. If the exponent is a negative
number, the value in S1+3 is 1.
4.
S1+4: The exponent
The value in S1+4 should be within the range between 0 and 38.
5.
S2: The number of places
The value in S2 should be within the range between 0 and 7.
Example:
When the conditional contact MO is ON, the binary-coded decimal floating-point number is
converted into the floating-point number.

6-503

Ch ap te r 6 Ap plie d Instruc tions

0
1 6# 12 34 57 0

D0
D1
D2

1

D3

3

D4

3

D1 0

D12

D11
1 .23 45 7

The value in D0 is 0 because the binary-coded decimal floating-point number is a positive number.
16#1234570 is stored in (D2, D1).
The value in D3 is 1 because the exponent is a negative number.
The value in D4 is 3.
1234570E-3, the binary-coded decimal floating-point number in D0~D4, is converted into the
1234.57.
Since the value in D10 is 3, the decimal point in 1234.57 in is moved to the left by three places. The
result is 1.23457, and is stored in (D12, D11).
Additional remark:
1.
2.
3.

4.
5.
6.
7.

If the value in S1 is neither 0 nor 1, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the number of digits in (S1+2, S1+1) is larger than 7, the instruction is not executed, SM0 is
ON, and the error code in SR0 is 16#2003.
If the value in (S1+2, S1+1) is not a binary-coded decimal value (The value is represented by
the hexadecimal number, but one of digits is not within the range between 0 and 9.), the
operation error occurs, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#200D.
If the value in S1+3 is neither 0 nor 1, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the value in S1+4 is less than 0 or larger than 38, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003
If the value in S2 is less than 0 or larger than 7, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
If the operand S1 used during the execution of the 32-bit instruction is declared in ISPSoft, the
data type will be ARRAY [5] of WORD/INTT.

6-504

AH Pro gramming Ma nu al

6.22 Ethernet Instructions
6.22.1 List of Ethernet Instructions

2200

Instruction code
16-bit
32-bit
SOPEN
–

2201

SSEND

–



2202

SRCVD

–



2203
2204

SCLOSE
MSEND

–
–




2205

EMDRW

–



2206

–

DINTOA



2207

–

DIATON



API

Pulse
instruction


Function

Step

Page
number

Opening the socket
Sending the data through the
socket
Receiving the data through the
socket
Closing the socket
Sending the email
Reading/Writing the Modbus TCP
data
Converting the IP address of the
integer type into the IP address of
the string type
Converting the IP address of the
string type into the IP address of
the integer type

7

6-506

5

6-514

5

6-516

5
9

6-518
6-520

11

6-522

5

6-525

5-11

6-527

6-505

Ch ap te r 6 Ap plie d Instruc tions

6.22.2 Explanation of Ethernet Instructions
API

Instruction code

Operand

Function

2200

SOPEN

S1, S2, S3

Opening the socket

Device

X

Y

S1
S2
S3









M

P
S

T

C









HC

D

L









SM SR

E

PR

K













16# “$”

DF





Pulse instruction 16-bit instruction (7 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Socket mode

Word

S2 : Socket number

Word

S3 : Start mode

Word

Explanation:
1.

2.
3.

S1 is 1 if users want to open the TCP socket, and S1 is 0 if users want to open the UDP socket.
S2 is the socket number. The AH500 series PLC as the client sends the TCP connection
request to the server if S3 is 1, and the AH500 series PLC as the sever waits for the TCP
connection request from the client if S3 is 0. If users want to start the UDP connection, S3 can
be 0 or 1.
The operand S1 should be either 0 or 1; the operand S2 should be within the range between 1
and 8; the operand S3 should be either 0 or 1.
Before using the instruction, users have to accomplish the following setting in ISPSoft.


PLC Parameter Setting→Ethernet-Basic→Setting the IP addres and the netmask address



PLC Parameter Setting→Ethernet-Advance→Socket→Enable Socket Function



4.

PLC Parameter Setting→Ethernet-Advance→Socket→TCP/UDP Socket Connection→
Setting the sockets which are used, or using the instruction MOV to transfer the data
related to the sockets to the corresponding special data registers
Users can set the sockets which uses the TCP protocol to execute the data exchange in
SR1118~SR1221. The values in all registers can be altered except that the transmitted data
counter and the received data counter are read-only counters.
Socket
Number

1

2

3

4

5

6

7

8

SR1118

SR1131

SR1144

SR1157

SR1170

SR1183

SR1196

SR1209

SR1119

SR1132

SR1145

SR1158

SR1171

SR1184

SR1197

SR1210

SR1120

SR1133

SR1146

SR1159

SR1172

SR1185

SR1198

SR1211

SR1121

SR1134

SR1147

SR1160

SR1173

SR1186

SR1199

SR1212

Item

Local
communication
port
Remote IP
address
(high word)
Remote IP
address
(low word)
Remote
communication

6-506

AH Pro gramming Ma nu al
Socket
Number

1

2

3

4

5

6

7

8

SR1122

SR1135

SR1148

SR1161

SR1174

SR1187

SR1200

SR1213

SR1123

SR1136

SR1149

SR1162

SR1175

SR1188

SR1201

SR1214

SR1124

SR1137

SR1150

SR1163

SR1176

SR1189

SR1202

SR1215

SR1125

SR1138

SR1151

SR1164

SR1177

SR1190

SR1203

SR1216

SR1126

SR1139

SR1152

SR1165

SR1178

SR1191

SR1204

SR1217

SR1127

SR1140

SR1153

SR1166

SR1179

SR1192

SR1205

SR1218

SR1128

SR1141

SR1154

SR1167

SR1180

SR1193

SR1206

SR1219

SR1129

SR1142

SR1155

SR1168

SR1181

SR1194

SR1207

SR1220

SR1130

SR1143

SR1156

SR1169

SR1182

SR1195

SR1208

SR1221

Item

port
Transmitted
data length
Transmitted
data
address
(high word)
Transmitted
data
address
(low word)
Received
data length
Received
data
address
(high word)
Received
data
address
(low word)
Persistent
connection
time
Transmitted
data
counter
Received
data
counter

5.

Users can set the sockets which uses the UDP protocol to execute the data exchange in
SR1222~SR1317. The values in all registers can be altered except that the transmitted data
counter and the received data counter are read-only counters.
Socket
Number

1

2

3

4

5

6

7

8

SR1222

SR1234

SR1246

SR1258

SR1270

SR1282

SR1294

SR1306

SR1223

SR1235

SR1247

SR1259

SR1271

SR1283

SR1295

SR1317

SR1224

SR1236

SR1248

SR1260

SR1272

SR1284

SR1296

SR1318

SR1225

SR1237

SR1249

SR1261

SR1273

SR1285

SR1297

SR1309

SR1226

SR1238

SR1250

SR1262

SR1274

SR1286

SR1298

SR1310

SR1227

SR1239

SR1251

SR1263

SR1275

SR1287

SR1299

SR1311

SR1228

SR1240

SR1252

SR1264

SR1276

SR1288

SR1300

SR1312

SR1229

SR1241

SR1253

SR1265

SR1277

SR1289

SR1301

SR1313

SR1230

SR1242

SR1254

SR1266

SR1278

SR1290

SR1302

SR1314

Item

Local
communication
port
Remote IP
address
(high word)
Remote IP
address
(low word)
Remote
communication
port
Transmitted
data length
Transmitted
data address
(high word)
Transmitted
data address
(low word)
Received data
length
Received data
address

6-507

Ch ap te r 6 Ap plie d Instruc tions
Socket
Number

1

2

3

4

5

6

7

8

SR1231

SR1243

SR1255

SR1267

SR1279

SR1291

SR1303

SR1315

SR1232

SR1244

SR1256

SR1268

SR1280

SR1292

SR1304

SR1316

SR1233

SR1245

SR1257

SR1269

SR1281

SR1293

SR1305

SR1317

Item

(high word)
Received data
address
(low word)
Transmitted
data counter
Received data
counter

6.

7.

When the TCP socket is opened, the remote IP address and the communication ports can be
set as follows.
Local
Remote
Remote IP
Description
communication communication
address
port
port
0.0.0.0
0
0
Illegal
Only applied to the server
1. The connection request from the same
local communication port is accepted.
0.0.0.0
Not equal to 0
0
2. The packet sent from any device is
received through the local
communication port.
3. The data can not be sent.
0.0.0.0
0
Not equal to 0 Illegal
Specific
0
0
Illegal
IP
address
Only applied to the server
1. The connection requests from the local
communication port and the specific IP
Specific
address are received.
IP
Not equal to 0
0
2.
The packet is received from the specific
address
IP address through the local
communication port.
3. The data can not be sent.
Only applied to the client
1. If the data is sent from the server, the
system will specify an unused
Specific
communication port as the local
IP
0
Not equal to 0
communication port.
address
2. The data is sent to the specific IP
address through the remote
communication port.
1. The connection requests from the local
communication port, the remote
communication port, and the specific IP
address are received.
Specific
2. The data is sent to the specific IP
IP
Not equal to 0
Not equal to 0
address through the remote
address
communication port.
3. The packet is received from the specific
IP address through the local
communication port.
If the TCP socket is opened, and no error occurs after the instruction is executed, the PLC is
connected to the remote device, and the flag related to the connection’s being started is ON. If

6-508

AH Pro gramming Ma nu al

8.

9.

the connection is successful, the flag related to the connection’s being successful is ON, and
the flag related to the connection’s being started is OFF. If an error occurs, the error flag is ON.
TCP socket
Being starting
Successful
Error flag
the connection
connection
number
1
SM1273
SM1270
SM1277
2
SM1281
SM1278
SM1285
3
SM1289
SM1286
SM1293
4
SM1297
SM1294
SM1301
5
SM1305
SM1302
SM1309
6
SM1313
SM1310
SM1317
7
SM1321
SM1318
SM1325
8
SM1329
SM1326
SM1333
If the UDP socket is opened, and no error occurs after the instruction is executed, the flag
related to the connection’s having been started is ON. If an error occurs, the error flag is ON.
UDP socket number
Having started the connection
Error flag
1
SM1334
SM1338
2
SM1339
SM1343
3
SM1344
SM1348
4
SM1349
SM1353
5
SM1354
SM1358
6
SM1359
SM1363
7
SM1364
SM1368
8
SM1369
SM1373
Generally, the pulse instruction SOPENP is used.

Example 1:
1.

The system framework below illustrates how to establish the TCP connection between a
computer as the client and an AH500 series PLC as the server.

2.

When X0.0 is ON, the data related to the TCP socket 1 is transferred to the corresponding
special data registers. Users also can set the TCP socket 1 in ISPSoft.
When M0 is ON, whether the socket is closed, has been connected, or is being connected is
checked. If the socket is not closed, has not been connected, or is not being connected, the
connection procedure is performed. After the socket has been connected, M0 will is switched
OFF.
When M1 is ON, whether the socket has been connected and no data is being sent is checked.
If the socket has been connected, and no data is being sent, the data will be sent. If the socket

3.

4.

6-509

Ch ap te r 6 Ap plie d Instruc tions
has not been connected, the instruction is not executed. After the sending of the data is
complete, M1 will be switched OFF.

5.
6.

When M2 is ON, whether the socket has been connected and no data is being received is
checked. If the socket has been connected, and no data is being received, the data will be
received. If the socket has not been connected, the instruction is not executed.
When M3 is ON, whether the socket has been connected is checked. If the socket has been
connected, the connection will be closed. If the socket has not been connected, the instruction
is not executed. After the connection is closed, M2 and M3 will be switched OFF.

6-510

AH Pro gramming Ma nu al

Example 2:
1.
2.

3.

4.

The example illustrates how to establish the UDP connection between a computer and an
AH500 series PLC.
When M0 is ON, whether the socket has been connected is checked. If the socket has not
been connected, the connection procedure is performed. After the socket has been connected,
M0 will be switched OFF.
When M1 is ON, the data is sent. After the sending of the data is complete, M1 will be switched
OFF.
When M2 is ON, whether the socket has been connected and no data is being received is
checked. If the socket has been connected, and no data is being received, the data will be
received. If the socket has not been connected, the instruction is not executed.

6 - 5 11

Ch ap te r 6 Ap plie d Instruc tions
5.

When M3 is ON, whether the socket has been connected is checked. If the socket has been
connected, the connection will be closed. If the socket has not been connected, the instruction
is not executed. After the connection is closed, M2 and M3 will be switched OFF.

Additional remark:
1.

If S1, S2, or S3 exceeds the range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.

6-512

AH Pro gramming Ma nu al
2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

When the AH500 series PLC as the server starts the TCP connection, if the number of servers
which can be connected reaches the upper limit, the error occurs, the corresponding error flag
is ON, the error code is 16#600A, and the instruction is not executed.
When the AH500 series PLC as the server starts the TCP connection, if the remote
communication port number is 0, the error occurs, the corresponding error flag is ON, the error
code is 16#6202, and the instruction is not executed.
When the UDP connection is started, if the number of servers which can be connected
reaches the upper limit, or there has been a connection, the error occurs, the corresponding
error flag is ON, the error code is 16#600B, and the instruction is not executed.
When the AH500 series PLC is the client and the TCP connection is started, if the local
communication port has been used, the error occurs, the corresponding error flag is ON, the
error code is 16#600C, and the instruction is not executed. When the AH500 series PLC is the
client and the TCP connection is started, if the local communication port number is 0, the error
occurs, the corresponding error flag is ON, the error code is 16#6201, and the instruction is not
executed.
When the UDP connection is started, if the local communication port has been used, the error
occurs, the corresponding error flag is ON, the error code is 16#600C, and the instruction is
not executed.
When the TCP connection is started, if the value in the high word of the remote IP address is 0,
127, or the value larger than 223, the error occurs, the corresponding error flag is ON, the error
code is 16#6200, and the instruction is not executed.
When the UDP connection is started, if the value in the high word of the remote IP address is 0,
127, or the value larger than 223, the error occurs, and the corresponding error flag is ON, the
error code is 16#6209, and the instruction is not executed.
When the UPD connection is started, if the local communication port number and the remote
communication port number are 0, the error occurs, the corresponding error flag is ON, the
error code is 16#620A, and the instruction is not executed.
When the TCP connection is started, if the socket has been connected or is been connected,
the error occurs, the corresponding error flag is ON, the error code is 16#6217, and the
instruction is not executed. When the TCP connection is started, if the socket is being closed,
the error occurs, the corresponding error flag is ON, the error code is 116#621A, and the
instruction is not executed.
During the connection, if the computer as the client abandons the connection, the error occurs,
the corresponding error flag is ON, and the error code is 16#6214. During the connection, if
there is a response timeout, the error occurs, the corresponding error flag is ON, and the error
code is 16#6212.

6-513

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2201

SSEND

S1, S2

Sending the data through the socket

Device

X

Y

S1
S2







M

P
S

T

C







HC

D

L







SM SR

E

PR

K










16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Socket mode

Word

S2 : Socket number

Word

Explanation:
1. S1 is 1 if users want to open the TCP socket, and S1 is 0 if users want to open the UDP socket.
S2 is the socket number.
2. The operand S1 should be either 0 or 1, and the operand S2 should be within the range between
1 and 8.
3. Before using this instruction, users need to use the instruction SOPEN to open the socket. If the
flag related to the connection’s being successful is ON, or the flag related to the connection’s
having been started is ON, this instruction can be used.
4. If the data is sent through the TCP socket, and no error occurs after the instruction is executed,
the data is sent, and the flag related to the data’s being sent is ON. If the data is sent
successfully, the flag related to the data’s having been sent is ON, and the flag related to the
data’s being sent is OFF. If an error occurs, the error flag is ON.
TCP socket number Being sending the data Having sent the data
Error flag
1
SM1275
SM1272
SM1277
2
SM1283
SM1280
SM1285
3
SM1291
SM1288
SM1293
4
SM1299
SM1296
SM1301
5
SM1307
SM1304
SM1309
6
SM1315
SM1312
SM1317
7
SM1323
SM1320
SM1325
8
SM1331
SM1328
SM1333
5. If the data is sent through the UDP socket, and no error occurs after the instruction is executed,
the flag related to the data’s having been sent is ON. If an error occurs, the error flag is ON.
UDP socket number
Having sent the data
Error flag
1
SM1336
SM1338
2
SM1341
SM1343
3
SM1346
SM1348
4
SM1351
SM1353
5
SM1356
SM1358
6
SM1361
SM1363
7
SM1366
SM1368
8
SM1371
SM1373
6. Generally, the pulse instruction SSENDP is used.

6-514

AH Pro gramming Ma nu al

Example:
Please refer to the example of the execution of SOPEN.
Additional remark:
1.
2.

3.

4.

5.

If S1 or S2 exceeds the range, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
If the data is sent through the TCP socket, and the device from which the data is read is not the
device permitted by the socket, the error occurs, the corresponding error flag is ON, the error
code is 16#6203, and the instruction is not executed. If the number of data sent is larger than
1000, the error occurs, the corresponding error flag is ON, the error code is 16#6204, and the
instruction is not executed. If the devices from which the data is read exceed the device range,
the error occurs, the corresponding error flag is ON, the error code is 16#6205, and the
instruction is not executed.
If the data is sent through the UDP socket, and the device from which the data is read is not
the device permitted by the socket, the error occurs, the corresponding error flag is ON, the
error code is 16#620C, and the instruction is not executed. If the number of data sent is larger
than 1000, the error occurs, the corresponding error flag is ON, the error code is 16#620D, and
the instruction is not executed. If the devices from which the data is read exceed the device
range, the error occurs, the corresponding error flag is ON, the error code is 16#620E, and the
instruction is not executed.
If the data is sent through the UPD socket, and the remote communication port number is 0,
the error occurs, the corresponding error flag is ON, the error code is 16#620B, and the
instruction is not executed.
During the transmission, if the computer as the client abandons the connection, the error
occurs, the corresponding error flag is ON, and the error code is 16#6214. During the
transmission, if there is a response timeout, the error occurs, the corresponding error flag is
ON, and the error code is 16#6212.

6-515

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2202

SRCVD

P

S1, S2

Receiving the data through the socket

Device X

Y

S







S1
S2

M

T

C







HC

D

L







SM SR

E

PR

K










16# “$”

DF




Pulse instruction 16-bit instruction (5 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Socket mode

Word

S2 : Socket number

Word

Explanation:
1. S1 is 1 if users want to open the TCP socket, and S1 is 0 if users want to open the UDP socket.
S2 is the socket number.
2. The operand S1 should be either 0 or 1, and the operand S2 should be within the range between
1 and 8.
3. Before using this instruction, users need to use the instruction SOPEN to open the socket. If the
flag related to the connection’s being successful is ON, or the flag related to the connection’s
having been started is ON, this instruction can be used.
4. If the data is received through the TCP socket, and no error occurs after the instruction is
executed, the data is received, and the flag related to the data’s being received is ON. If the data
is received successfully, the flag related to the data’s having been received is ON, and the flag
related to the data’s being received is OFF. If an error occurs, the error flag is ON.
Being receiving the Having received the
TCP socket number
Error flag
data
data
1
SM1276
SM1271
SM1277
2
SM1284
SM1279
SM1285
3
SM1292
SM1287
SM1293
4
SM1300
SM1295
SM1301
5
SM1308
SM1303
SM1309
6
SM1316
SM1311
SM1317
7
SM1324
SM1319
SM1325
8
SM1332
SM1327
SM1333
5. If the data is received through the UDP socket, and no error occurs after the instruction is
executed, the flag related to the data’s being received is ON. After the data is received, the flag
related to the data’s having been received is ON. If an error occurs, the error flag is ON.
Being receiving the Having received the
UDP socket number
Error flag
data
data
1
SM1337
SM1335
SM1338
2
SM1342
SM1340
SM1343
3
SM1347
SM1345
SM1348
4
SM1352
SM1350
SM1353
5
SM1357
SM1355
SM1358
6
SM1362
SM1360
SM1363
7
SM1367
SM1365
SM1368

6-516

AH Pro gramming Ma nu al

Being receiving the Having received the
data
data
8
SM1372
SM1370
6. Generally, the pulse instruction SRCVDP is used.
UDP socket number

Error flag
SM1373

Example:
Please refer to the example of the execution of SOPEN.
Additional remark:
1.
2.

3.

4.

5.

If S1, or S2 exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
If the data is received through the TCP socket, and the device into which the data is written is
not the device permitted by the socket, the error occurs, the corresponding error flag is ON, the
error code is 16#6206, and the instruction is not executed. If the number of data received is
larger than 1000, the error occurs, the corresponding error flag is ON, the error code is
16#6207, and the instruction is not executed. If the devices into which the data is written
exceed the device range, the error occurs, the corresponding error flag is ON, the error code is
16#6208, and the instruction is not executed.
If the data is received through the UDP socket, and the device into which the data is written is
not the device permitted by the socket, the error occurs, the corresponding error flag is ON, the
error code is 16#620F, and the instruction is not executed. If the number of data received is
larger than 1000, the error occurs, the corresponding error flag is ON, the error code is
16#6210, and the instruction is not executed. If the devices into which the data is written
exceed the device range, the error occurs, the corresponding error flag is ON, the error code is
16#6211, and the instruction is not executed.
If the length of the data actually received is larger than the length of data which is needed, only
the data which is needed is stored, the redundant data is ignored, the error occurs, the
corresponding error flag is ON, and the error code is 16#6213.
During the reception, if the computer as the client abandons the connection, the error occurs,
the corresponding error flag is ON, and the error code is 16#6214. During the transmission, if
there is a response timeout, the error occurs, the corresponding error flag is ON, and the error
code is 16#6212.

6-517

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

2203

SCLOSE P

Device X

Y







S1
S2

M

S

T

C







Operand

Function

S1, S2

Closing the socket

HC

D

L







SM SR

E

PR

K










16# “$”

DF




Pulse instruction 16-bit instruction (5 Steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Socket mode

Word

S2 : Socket number

Word

Explanation:
1. S1 is 1 if users want to close the TCP socket, and S1 is 0 if users want to close the UDP socket.
S2 is the socket number.
2. The operand S1 should be either 0 or 1, and the operand S2 should be within the range between
1 and 8.
3. Before closing the socket, users need to make sure that the socket has been connected.
Otherwise, the instruction is not executed.
4. If the TCP socket is closed by the server, the client continues to be connected to the local
communication port. If the TCP socket is closed is by the client, the client is not connected to the
local communication port. After the instruction is executed to close the TCP socket, the
corresponding flag is OFF.
5. After the instruction is executed to close the UDP socket, the corresponding flag is OFF.
6. If the TCP socket is closed, and no error occurs after the instruction is executed, the PLC is not
connected to the remote device, and the flag related to the connection’s being closed is ON. If
the connection is closed successfully, the flag related to the connection’s being closed is OFF. If
an error occurs, the error flag is ON.
Being closing the
Socket number
Error flag
connection
1
SM1274
SM1277
2
SM1282
SM1285
3
SM1290
SM1293
4
SM1298
SM1301
5
SM1306
SM1309
6
SM1314
SM1317
7
SM1322
SM1325
8
SM1330
SM1333
7. If the UDP socket is close, and no error occurs after the instruction is executed, the flag related
to the connection’s having been started is OFF. If an error occurs, the error flag is ON.
Socket number
Error flag
1
SM1338
2
SM1343
3
SM1348
4
SM1353
5
SM1358

6-518

AH Pro gramming Ma nu al

Socket number
6
7
8
8. Generally, the pulse instruction SCLOSEP is used.

Error flag
SM1363
SM1368
SM1373

Example:
Please refer to the example of the execution of SOPEN.
Additional remark:
1.
2.

If S1, or S2 exceeds the range, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
During the closing of the connection, if the computer as the client abandons the connection,
the error occurs, the corresponding error flag is ON, and the error code is 16#6214. During the
connection, if there is a response timeout, the error occurs, the corresponding error flag is ON,
and the error code is 16#6212.

6-519

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2204

MSEND

S1, S2, S3, D

Sending the email

Device X

Y











S1
S2
S3
D

M



P
S



T

C









HC

D

L











SM SR

E

PR

K












16# “$”

DF



Pulse instruction 16-bit instruction (9 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Remote email address

Word

S2 : Email subject

Word

S3 : Email body

Word

D : Completion of the instruction

Bit

Explanation:
1.
2.

Users can send an email by setting S1, S2, and S3.
Before using the instruction, users have to accomplish the following setting in ISPSoft.



PLC Parameter Setting→Ethernet-Basic→Setting the IP addres and the netmask address



PLC Parameter Setting→Ethernet-Advance→Email→Setting the SMTP server, the port,
the local email address, and the SMTP subject



PLC Parameter Setting→Ethernet-Advance→Email and Trigger Configuration→Setting
the email address
If the account identification is required,



3.

4.

PLC Parameter Setting→Ethernet-Advance→Email→Setting the user name and the
password
The email is set as follows.
Operand
Description
Setting range
The value in S1 should be within the range between 1 and
256.
The values of bit0~bit7 set in ISPSoft indicate the remote
email addresses. (Users can set eight email addresses in
Remote email
S1
ISPSoft.) The remote email address is 1 if the value of bit0 is
address
1, the remote email address is 2 if the value of bit1 is 1, and by
analogy, the remote email address is 8 if the value of bit7 is 1.
If users want to send an email, they have to set the values of
bit0~bit7 in ISPSoft.
Email subject
The size of the email subject can be up to 16 words.
S2
Email body
The size of the email body can be up to 64 words.
S3
After the execution of the instruction is complete, the bit is ON.
Completion of
D
If the execution of the instruction is abnormal, the next bit is
the instruction
ON.
Generally, the pulse instruction MSENDP is used.

Example:

6-520

AH Pro gramming Ma nu al
Suppose the value in D0 is 00010100. When X0.0 is ON, the email is sent to remote email address
3, and remote email address 5. After the communication with the SMTP sever is complete, M20 is
ON. If no error occurs during the communication, M21 is OFF, and Y0.0 is ON.

Additional remark:
1.
2.
3.
4.
5.

6.
7.
8.

If D+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#200A.
If the remote mail address is less than 1, or if the remote mail address is larger than 256, the
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the length of the string in S2 or S3 is larger than the maximum value, the length of the string in
S2 or S3 will be count equal to the maximum value.
When the instruction is executed, if the number of systems which can be connected to the
SMTP server reaches the upper limit, the error occurs, and the error code is 16#6100.
If the account identification is required, and the account identification information is judged
invalid by the SMTP server, the error occurs, and the error is is 16#6108. If the password is
incorrect, the error code is 16#6109.
If the remote email address is judged invalid by the SMTP server, the error occurs, and the
error code is 16#6111.
During the sending of the email, if there is an SMTP server response timeout, the error occurs,
the error code is 16#6107, and the sending of the email is cancelled.
If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.

6-521

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

2205

EMDRW

P

S1, S2, S3, S, n

S

Device

X

Y

S1
S2
S3
S
n













M



T

C













HC

Function

D

L













Reading/Writing the Modbus TCP
data
SM SR

E

PR













K

16# “$”











DF

Pulse instruction 16-bit instruction (11 steps) 32-bit instruction
AH

AH

-

Symbol:
S1 : Unit address

Word

S2 : Function code

Word

S3 : Device address

Word

S :

Register involved in the
reading/writing of the data

n : Data length

Bit/Word
Word

Explanation:
1.

Before using the instruction, users have to accomplish the following setting in ISPSoft.


2.

PLC Parameter Setting→Ethernet-Basic→Setting the IP addres and the netmask address

Setting S1 :
Operand
S1
S1+1
S1+2

S1+3

Description
Station address

Setting range
The station address should be within the range between
0 and 255.

Remote IP address
(high word)
Remote IP address
(low word)

Example: The remote IP address is 172.16.144.230.
S1+1=16#AC10
S1+2=16#90E6

Whether to close the
connection

0: The connection is closed after the execution of the
instruction is complete.
1: The connection is persistent. (The closing of the
connection depends on the setting of the TCP
keepalive timer.)

S2: Function code
For example:
1 (16#01): The AH500 series PLC reads the data from several bit devices which are not
discrete input devices.
2 (16#02): The AH500 series PLC reads the data from several bit devices which are discrete
input devices.
3 (16#03): The AH500 series PLC reads the data from several word devices which are not
input registers.
4 (16#04): The AH500 series PLC reads the data from several word devices which are input
registers.
5 (16#05): The AH500 series PLC writes the state into a bit device.

6-522

AH Pro gramming Ma nu al

3.
4.

5.

6.
7.
8.

6 (16#06): The AH500 series PLC writes the data into a word device.
15 (16#0F): The AH500 series PLC writes the states into several bit devices.
16 (16#10): The AH500 series PLC writes the data into several word devices.
Only the function codes mentioned above are supported, and other function codes can not be
executed. Please refer to the examples below.
S3: The device address
S: The register involved in the reading/writing of the data
The data which will be written into the external equipment is stored in the register in advance.
The data which is read from the external equipment is stored in the register.
n: The length of the data
The size of the data can not be larger than 240 bytes. For the communication commands
related to the coils, the unit of the data is the bit, and n should be within the range between 1
and 1920. For the communication commands related to the registers, the unit of the data is the
word, and n should be within the range between 1 and 120.
Flag
Having
Having
Sending Waiting for
Timeout
received
closed the
Error flag
the data the data
flag
the data
connection
EMDRW
1
SM2000 SM2001
SM2002
SM2003
SM2004
SM2005
2
SM2006 SM2007
SM2008
SM2009
SM2010
SM2011
3
SM2012 SM2013
SM2014
SM2015
SM2016
SM2017
4
SM2018 SM2019
SM2020
SM2021
SM2022
SM2023
5
SM2024 SM2025
SM2026
SM2027
SM2028
SM2029
6
SM2030 SM2031
SM2032
SM2033
SM2034
SM2035
7
SM2036 SM2037
SM2038
SM2039
SM2040
SM2041
8
SM2042 SM2043
SM2044
SM2045
SM2046
SM2047
The instruction can be used several times in the program, but only eight instructions are
executed at a time.
If several flags which are related to the sending of the data are ON simultaneously, the data
indicated by the flag whose number is the smallest is sent first.
Generally, the pulse instruction EMDRWP is used.

Example:
1.

The remote station address is set to 3.

6-523

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
1.
2.
3.
4.
5.

6.

7.
8.

9.

10.
11.
12.

13.
14.

If the value in S1, S2, or S exceeds the range, the instruction is not executed, SM0 is ON, and
the error code in SR0 is 16#2003.
If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0
is 16#200B.
If the device specified by S1+3 exceeds the device range, the instruction is not executed, SM0
is ON, and the error code in SR0 is 16#2003.
If the device specified by S is not sufficient to contain the n pieces of data, the instruction is not
executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the function code specified by S2 is related to the bit device, the device specified by S has to
be the bit device. Otherwise, the operation error occurs, the instruction is not executed, and
the error code in SR0 is 16#2003.
If the function code specified by S2 is related to the word device, the device specified by S has
to be the word device. Otherwise, the operation error occurs, the instruction is not executed,
and the error code in SR0 is 16#2003.
If the communication command is 0x05 or 0x06, n does not work. The state or the data is
written into one bit device or one word device.
If a flag related to the sending of the data is ON, and the corresponding flag related to the
connection’s having been closed is not ON, the system will search for the flags which both are
ON to execute the instruction. If there are no flags which both are ON, the instruction is not
executed.
During the connection, if the value in the high word of the remote IP address is 0, 127, or the
value larger than 225, the error occurs, and the corresponding error flag is ON, and the error
code is 16#6403.
During the connection, if the remote machine is disconnected, the error code is 16#6401. If
there is a connection timeout, the error code is 16#6402.
If the remote machine is disconnected when the command is sent, the error code is 16#6401.
If there is an ACK timeout, the error code is 16#6402.
If the function code is incorrect when the command is received, the error code is 16#6404. If
the length of the data is incorrect, the error code is 16#6405. If there is a response timeout, the
error code is 16#6402.
If the remote machine is disconnected when the connection is closed, the error code is
16#6401. If there is a connection timeout, the error code is 16#6402.
If users declare the operand S1 in ISPSoft, the data type will be ARRAY [4] of WORD/INT.

6-524

AH Pro gramming Ma nu al

API

Instruction code

2206

D

INTOA

Device X

Y







S
D

M

P
S

T

C







Operand

Function

S, D

Converting the IP address of the integer
type into the IP address of the string type

HC

D

L

SM SR









E

PR

K






16# “$”

DF



Pulse instruction 16-bit instruction 32-bit instruction (5 steps)
AH

-

AH

Symbol:
S : Source value

Double word

D : Conversion result

Word

Explanation:
1.
2.

The IP address of the integer type in S is converted into the IP address of the string type, and
the conversion result is stored in D.
The operand D occupies eight devices.

Example 1:

Example 2:

6-525

Ch ap te r 6 Ap plie d Instruc tions

Additional remark:
If users declare the operand D in ISPSoft, the data type will be ARRAY [8] of WORD/INT.

6-526

AH Pro gramming Ma nu al

API

Instruction code

2207

D

IATON

Device

X

Y

S
D







M

Operand

Function

S, D

Converting the IP address of the string
type into the IP address of the integer type

P
S

T

C







HC

D

L

SM SR









E

PR

K

16# “$”




DF



Pulse instruction 16-bit instruction 32-bit instruction (5-11 steps)
AH

-

AH

Symbol:
S : Source value

String

D : Conversion result

Double word

Explanation:
1.
2.

3.
4.
5.

The IP address of the string type in S is converted into the IP address of the integer type, and
the conversion result is stored in D.
The operand S occupies eight devices.

The IP address of the string type in S is divided into four sections. These sections are
separated by “.” (16#2E), and there are three characters in every section.
The value converted from the characters in every section of the IP address of the string type in
S can not be larger than 255.
If S is a string, there are not necessarily three characters in every section of the IP address of
the string type. For example, users can enter “192.168.0.1” instead of “192.168.000.001”.

Example 1:

6-527

Ch ap te r 6 Ap plie d Instruc tions

Example 2:

Additional remark:
1.
2.

3.
4.
5.

6.
7.

If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
In the string in S, except for the code representing the decimal point, the other binary codes
have to be within the range between 16#30 and 16#39. If the other binary codes are not within
the range between 16#30 and 16#39, the instruction is not executed, SM0 is ON, and the error
code in SR0 is 16#2003.
If the fourth character, the eighth character, and the twelfth character in the string in S are not
16#2E, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If the number of decimals in the string in S is not equal to 3, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value converted from the characters in any section of the IP address of the string type in
S is larger than 255, the instruction is not executed, SM0 is ON, and the error code in SR0 is
16#2003.
If the number of characters in any section of the IP address of the string type in S is larger than
3, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
If users declare the operand S in ISPSoft, the data type will be ARRAY [8] of WORD/INT.

6-528

Ch ap te r 6 Ap plie d Instruc tions

6.23 Memory Card Instructions
6.23.1 List of Memory Card Instructions
API

Instruction code
16-bit
32-bit

Pulse
instruction

2300

MWRIT

–

–

2301

MREAD

–

–

2302

MTWRIT

–

–

6-530

Function
Writing the data from the PLC
into the memory card
Reading the data from the
memory card into the PLC
Writing the string into the
memory card

Step

Page
number

13

6-531

13

6-535

11

6-539

A H 5 00 Prog r am m ing M an ua l

6.23.2 Explanation of Memory Card Instructions
Function

API

Instruction code

Operand

2300

MWRIT

C, S, S1, S2, S3, S4

Device

X

Y

M

P
S

T

C

C
S
S1
S2
S3
S4

HC

D

L















Writing the data from the PLC into the
memory card
SM SR

E

PR

K

16# “$”






















DF

Pulse instruction 16-bit instruction (13 steps) 32-bit instruction
AH

AH

-

Symbol:
C

: Control parameter

Word

S

: Data source

Word

S1 : Data length

Double word

S2 : Line advance

Word

S3 : File name

Word

S4 : Data address in the file

Double word

Explanation:
1.

The description of the operands:

C: The control parameter

Item

Code
0

File format
1

2

Description
Binary value
Default value
The file name extension is .dmd.
The unit of the value is the word.
The values are separated by a comma.
The unit of the value is the word.
The file name extension is .cvs.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are separated by a comma.
The unit of the value is the double word.

6-531

Ch ap te r 6 Ap plie d Instruc tions

Item

Code
2

3

4
File format

5

6

0
Function option
1




Reserved
S: The data source
S1: The length of the data which is written into the file
If the value in S1 is 0, the data is not written into the file.
Item
Value unit
Parameter unit

Length of the data




6-532

Description
The file name extension is .cvs.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are separated by a tab.
The unit of the value is the word.
The file name extension is .txt.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are separated by a tab.
The unit of the value is the double word.
The file name extension is .txt.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are not separated by any mark.
The unit of the value is the word.
The file name extension is .txt.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are not separated by any mark.
The unit of the value is the double word.
The file name extension is .txt.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
Appending
The data which is written into the memory card is added after
the last value in the file.
Default value
If the file does not exist, it is created automatically.
Overwriting
The data which is written into the memory card replaces the
values in the file starting from the value indicated by the value
in S4.
If the file does not exist, it is created automatically.
The values of bit8~bit15 are 0.

Description
If the file format is 0, 1, 3, or 5, the unit of the value is the word. If
the file format is 2, 4, or 6, the unit of the value is the double word.
Double word
The devices in which the data is stored can not exceed the device
range, and the size of the data which is written into the file can
not be more than four gigabytes.
(Please refer to chapter 2 for more information about the
devices.)

S2: The line advance
The value in S2 should be within the range between 0 and 256.
S3~S3+4: S3 occupies five devices. Nine characters at most constitute a file name,
including 16#00. If the string does not end with 16#00, the error occurs. If the

A H 5 00 Prog r am m ing M an ua l
ending character is read, the reading of the characters stops, and whether the
file name is legal is checked. The characters which can be used to constitute a
file name are A~Z, a~z, and 0~9. Besides, the file name extension depends on
the file format. The file which is created is in the default folder. If the file name is
“Test1”, the characters are written into the devices as follows.



2.

3.

4.

The default folder path:
Model name
Folder path
AHCPU530-RS2
PLC CARD\AH500\UserProg
AHCPU530-EN

S4: The value in the file which is overwritten is indicated by the value in S4.
Item
Description
If the file format is 0, 1, 3, or 5, the unit of the value is the word. If the
Value unit
file format is 2, 4, or 6, the unit of the value is the double word.
Parameter unit The parameter unit is the double word.
If the function option is 0, S4 is not used.
If the function option is 1, the data which is written into the memory
card replaces the values in the file starting from the value indicated by
Usage
the value in S4.
The value in S4 should indicate the value in the file.
If the value in S4 is 0, the first value in the file is overwritten.
The related flags:
Flag
Description
SM450
If the memory card is in the CPU module, the flag is ON.
The write protection switch on the memory card
SM451
ON: The memory card is write protected.
OFF: The memory card is not write protected.
The data is being written from the PLC to the memory card, or the
SM452
data is being read from the memory card into the PLC.
If an error occurs during the operation of the memory card, the flag is
SM453
ON. If the flag is ON, users have to reset it to OFF. The error code is
stored in SR453.
The related error codes:
Error code
Description
16#005E
An error occurs when the memory card is initialized.
16#005F
The path is incorrect, or the file does not exist.
16#0060
The default folder can not be created.
16#0061
The memory space is insufficient.
16#0062
The memory card is write protected.
16#0063
An error occurs when the data is written into the file.
16#0064
The data can not be read from the memory card.
16#0065
The file is a read-only file.
If the format of the file into which the data is written is 0, the format of the file from which the
data is read is 0. Otherwise, the data can not be read, and SM453 is ON. The same applies to
the other file formats.

6-533

Ch ap te r 6 Ap plie d Instruc tions

Example:
SM450 is ON when the memory card is inserted into the CPU module; SM452 is ON when MWRIT
is executed; SM452 is OFF when the execution of MWRIT is complete.

Operand

Setting value

D0

16#0011

D1

-

D10, D11

16#00000030

D300

16#000A
D20=16#6554
D21=16#7473
D22=16#0031

D20
D30、D31

16#00000000

Description
The file into which the data is written
The file format:
The values are separated by a comma.
The unit of the value is the word.
The file name extension is .cvs.
The ASCII codes are adopted.
The data which is written into the file
The size of the data which is written into the file is 48
words.
Ten values are written into every line.
The file name is “Test1”.
The data which is written into the memory card replaces
the values in the file starting from the first value.

Additional remark:
1.
2.
3.
4.

If the value in C exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S1 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S2 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S3 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.

6-534

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

2301

MREAD

P

C, S, S1, S2, S3, D

Reading the data from the memory
card into the PLC

Y

S

Device

X

M

T

C

C
S
S1
S2
S3
D

HC

D

L















Pulse instruction

SM SR

E

PR

K

16# “$”




















DF

16-bit instruction (13 steps) 32-bit instruction

AH

AH

-

Symbol:
C

: Control parameter

Word

S

: File name

Word

S1 : Data address in the file

Double word

S2 : Line advance

Word

S3 : Data length

Double word

D

: Data destination

Word

Explanation:
1.

The description of the operands:

C: The control parameter

Item

Code
0

1
File format

2

3

Description
Binary value
The default value is 0.
The file name extension is .dmd.
The unit of the value is the word.
The values are separated by a comma.
The unit of the value is the word.
The file name extension is .cvs.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are separated by a comma.
The unit of the value is the double word.
The file name extension is .cvs.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are separated by a tab.

6-535

Ch ap te r 6 Ap plie d Instruc tions

Item





6-536

Code

Description
The unit of the value is the word.
The file name extension is .txt.
3
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are separated by a tab.
The unit of the value is the double word.
4
The file name extension is .txt.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
File format
The values are not separated by any mark.
The unit of the value is the word.
5
The file name extension is .txt.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values are not separated by any mark.
The unit of the value is the double word.
6
The file name extension is .txt.
The ASCII codes are adopted.
The value which is stored is a hexadecimal value.
The values in the file starting from the value indicated by the
value in S1. are read.
0
The default value is 0.
Function option
The number of values is stored in D and D+1.
If
the file format is 0, 1, 3, or 5, the unit of the value is the
1
word. If the file format is 2, 4, or 6, the unit of the value is the
double word.
Reserved
The values of bit8~bit15 are 0.
S~S+4: S occupies five devices. Nine characters at most constitute a file name, including
16#00. If the string does not end with 16#00, the error occurs. If the ending
character is read, the reading of the characters stops, and whether the file name
is legal is checked. The characters which can be used to constitute a file name
are A~Z, a~z, and 0~9. Besides, the file name extension depends on the file
format. The file which is created is in the default folder. If the file name is “Test1”,
the characters are written into the devices as follows.

The default folder path:
Model name
Folder path
AHCPU530-RS2
PLC CARD\AH500\UserProg
AHCPU530-EN

A H 5 00 Prog r am m ing M an ua l


2.

3.

4.

S1: The value in the file which is read is indicated by the value in S1.
Item
Description
If the file format is 0, 1, 3, or 5, the unit of the value is the word. If the
Value unit
file format is 2, 4, or 6, the unit of the value is the double word.
Parameter unit The parameter unit is the double word.
The value in S1 should indicate the value in the file.
Usage
If the value in S1 is 0, the first value in the file is read.

S2: The line advance
The value in S2 should be within the range between 0 and 256. If the value in S2 is 2,
and there is 8-word or 8-double word data in every line in the file, two values in the file
are read. If the value in S2 is 8, and there is 4-word or 4-double word data in every
line in the file, four values in the file are read.

S3: The length of the data which is read from the file
The devices in which the data is stored can not exceed the device range. If the value
in S3 is larger than the number of values in the file, the length of the data read from
the file is the number of values in the file. The unit S3 is the double word.

D: The initial device in which the data is stored.
The related flags:
Flag
Description
SM450
If the memory card is in the CPU module, the flag is ON.
The write protection switch on the memory card
SM451
ON: The memory card is write protected.
OFF: The memory card is not write protected.
The data is being written from the PLC to the memory card, or the data
SM452
is being read from the memory card into the PLC.
If an error occurs during the operation of the memory card, the flag is
SM453
ON. If the flag is ON, users have to reset it to OFF. The error code is
stored in SR453.
The related error codes:
Error code
Description
16#005E
An error occurs when the memory card is initialized.
16#005F
The path is incorrect, or the file does not exist.
16#0060
The default folder can not be created.
16#0061
The memory space is insufficient.
16#0062
The memory card is write protected.
16#0063
An error occurs when the data is written into the file.
16#0064
The data can not be read from the memory card.
If the format of the file into which the data is written is 0, the format of the file from which the
data is read is 0. Otherwise, the data can not be read, and SM453 is ON. The same applies to
the other file formats.

Example:
SM450 is ON when the memory card is inserted into the CPU module; SM452 is ON when MREAD
is executed; SM452 is OFF when the execution of MREAD is complete.

6-537

Ch ap te r 6 Ap plie d Instruc tions

Operand

Setting value

D0

16#0011

D300
D10, D11
D1
D30、D31

Description
The file from which the data is read
The file format:
The values are separated by a comma.
The unit of the value is the word.
The file name extension is .cvs.
The ASCII codes are adopted.

D300=16#6554
D301=16#7473 The file name is “Test1”.
D302=16#0031
16#00000000 The values in the file starting from the first value are read.
16#000A
Ten values are read from every line.
16#00000020 The size of the data which is read from the file is 32 words.

D20

-

The data which is read is stored in D20.

Additional remark:
1.
2.
3.
4.

If the value in C exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S2 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S3 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in D exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.

6-538

A H 5 00 Prog r am m ing M an ua l

API

Instruction code

Operand

Function

2302

MTWRIT

C, S, S1, S2, S3

Writing the string into the memory
card

Device

X

C
S
S1
S2
S3

Y

M

P
S

T

C

HC

D

L













SM SR

E

PR

K

16# “$”

















DF

Pulse instruction 16-bit instruction (11 steps) 32-bit instruction
AH

AH

-

Symbol:
C : Control parameter

Word

S : Data source

Word

S1 : Data length

Word

S2 : Separation mark

Word

S3 : File name

Word

Explanation:
1.

The description of the operands:

C: The control parameter
Parameter
Description
value
If the file exists, the data which is written into the memory card is added
0
after the last byte in the file.
(Appending)
If the file does not exist, it is created automatically.
If the file exists, the new data which is written into the memory card
replaces the old data in the file. The size of the file is the size of the new
1
(Overwriting) data.
If the file does not exist, it is created automatically.

S: The data source
If the string which is written into the file is “12345”, the characters are stored in the
devices as follows. Owing to the fact that a byte is taken as the basic unit, the first
character is stored in the low byte in D300, the second character is stored in the high
byte in D300. The same applies to the other characters. “16#00” is stored in the high
byte in D300+2, and indicates the end of the string.



S1: The length of the data which is written into the memory card
A byte is taken as the basic unit. The devices in which the data is stored can not
exceed the device range, and the length of the data which is written into the memory
card can not be more than 255 bytes.

6-539

Ch ap te r 6 Ap plie d Instruc tions






2.

3.

S2: The separation mark
If the value in S1 is 6, the value in S2 is written into the memory card as follows.
S2
Description
High byte Low byte
16#00 or
16#00
The 6-byte data is written into the file.
not 16#00
The 7-byte data is written into the file. The value in the high byte
Not 16#00
16#00
in S2 is the value in the seventh byte.
The 8-byte data is written into the file. The value in the high byte
Not 16#00 Not 16#00 in S2 is the value in the seventh byte, and the value in low byte
in S2 is the value in the eighth byte.
S3~S3+4: S3 occupies five devices. Nine characters at most constitute a file name,
including 16#00. If the string does not end with 16#00, the error occurs. If the
ending character is read, the reading of the characters stops, and whether the
file name is legal is checked. The characters which can be used to constitute a
file name are A~Z, a~z, and 0~9. Besides, the file name extension depends on
the file format. The file which is created is in the default folder. If the file name is
“Test1”, the characters are written into the devices as follows.

The default folder path
Model name
Folder path
AHCPU530-RS2
PLC CARD\AH500\UserProg
AHCPU530-EN
The related flags:
Flag
Description
SM450
If the memory card is in the CPU module, the flag is ON.
The write protection switch on the memory card
SM451
ON: The memory card is write protected.
OFF: The memory card is not write protected.
The data is being written from the PLC to the memory card, or the
SM452
data is being read from the memory card into the PLC.
If an error occurs during the operation of the memory card, the
SM453
flag is ON. If the flag is ON, users have to reset it to OFF. The
error code is stored in SR453.
The related error codes:
Error code
Description
16#005E
An error occurs when the memory card is initialized.
16#005F
The path is incorrect, or the file does not exist.
16#0060
The default folder can not be created.
16#0061
The memory space is insufficient.
16#0062
The memory card is write protected.
16#0063
An error occurs when the data is written into the file.
16#0064
The data can not be read from the memory card.
16#0065
The file is a read-only file.

6-540

A H 5 00 Prog r am m ing M an ua l

Example:
SM450 is ON when the memory card is inserted into the CPU module; SM452 is ON when MTWRIT
is executed; SM452 is OFF when the execution of MTWRIT is complete.

Operand

Setting value

D0

16#0001

D300

-

D10

16#000A

D1

16#0A00

D30

D30=16#6554
D31=16#7473
D32=16#0031

Description
The file into which the data is written
The file format:
The unit of the character is the byte.
The file name extension is .txt.
The ASCII codes are adopted.
The data in D300 is written into the file.
The data which is written into the file
The size of the string which is written into the file is 32
bytes.
After the data is written into the file, the separation mark is
added after the last byte in the file.
The file name is “Test1”.

Additional remark:
1.
2.
3.

If the value in C exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S1 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.
If the value in S3 exceeds the range, the operation error occurs, the instruction is not executed,
SM0 is ON, and the error code in SR0 is 16#2003.

6-541

Ch ap te r 6 Ap plie d Instruc tions

6.24 Task Control Instructions
6.24.1 List of Task Control Instructions
API
2400
2401

6-542

Instruction code
Pulse
Function
16-bit
32-bit instruction

TKON
–
Enabling the cyclic task

TKOFF
–
Disabling the cyclic task

Step

Page
number

3
3

6-543
6-544

A H 5 00 Prog r am m ing M an ua l

6.24.2 Explanation of Task Control Instructions
API

Instruction code

Operand

Function

2400

TKON

P

S

Enabling the cyclic task

S

Device

X

Y

S





M

T

C

HC

D

L





Pulse instruction
AH

SM

SR

E



K

16#

“$”

DF



16-bit instruction (3 steps) 32-bit instruction
AH

-

Symbol:

S : Task number

Word

Explanation:
1.
2.
3.

The cyclic task specified by S is enabled.
When the PLC runs, the execution of the cyclic tasks depends on the setting of the cyclic tasks
in ISPSoft.
The description of the operands:

The operand S should be within the range between 0 and 31.

Please refer to ISPSoft User Manual for more information about creating and enabling
the tasks.

Example:
When the PLC runs, cyclic task (0) is enabled. Since the instruction TKON in cyclic task (0) is
executed, cyclic task (1) is enabled, and Y0.0 is ON.
The two cyclic tasks are created in ISPSoft. Cyclic task (0) is enabled when the PLC runs, and cyclic
task (1) is not enabled when the PLC runs.
Cyclic task (1) is enabled by the execution of the instruction TKON in cyclic task (0).

Cyclic task (1) is executed.

Additional remark:
Please refer to ISPSoft User Manual for more information related to tasks.

6-543

Ch ap te r 6 Ap plie d Instruc tions

API

Instruction code

Operand

Function

2401

TKOFF

S

Disabling the cyclic task

Device

X

Y

S





M

P
S

T

C

HC

D

L





SM

SR

E



K

16#

“$”

DF



Pulse instruction 16-bit instruction (3 steps) 32-bit instruction
AH

AH

-

Symbol:

S : Task number

Word

Explanation:
1.
2.
3.

The cyclic task specified by S is disabled.
When the PLC runs, the execution of the cyclic tasks depends on the setting of the cyclic tasks
in ISPSoft.
The description of the operands:

The operand S should be within the range between 0 and 31.

Please refer to ISPSoft User Manual for more information about creating and enabling
the tasks.

Example:
When the PLC runs, cyclic task (0) and cyclic task (1) are enabled. Since the instruction TKOOFF in
cyclic task (0) is executed, cyclic task (1) is disabled, and Y0.0 is OFF.
The two cyclic tasks are created in ISPSoft. Cyclic task (0) and cyclic task (1) are enabled when the
PLC runs, and cyclic task (1) is disabled when the instruction TKOFF in cyclic task (0) is executed.
Cyclic task (1) is disabled by the execution of the instruction TKOFF in cyclic task (0).

Cyclic task (1) is not executed.

Additional remark:
Please refer to ISPSoft User Manual for more information related to tasks.

6-544

Chapter 7

Error Codes

Table of Contents
7.1
Error Codes and LED Indicators................................................................7-2
7.1.1
CPU Modules .....................................................................................7-2
7.1.2
Analog I/O Modules and Temperature Measurement Modules ........7-14
7.1.3
AH02HC-5A/AH04HC-5A.................................................................7-15
7.1.4
AH10PM-5A .....................................................................................7-16
7.1.5
AH20MC-5A .....................................................................................7-17
7.1.6
AH10EN-5A......................................................................................7-18
7.1.7
AH10SCM-5A...................................................................................7-19
7.1.8
AH10DNET-5A .................................................................................7-19

AH Pro gramming Ma nu al

7.1 Error Codes and LED Indicators


Columns
a. Error code: If the error occurs in the system, the error code is generated.
b. Description: The description of the error
c. CPU status: If the error occurs, the CPU stops running, keeps running, or in the status defined
by users.
 Stop: The CPU stops running when the error occurs.
 Keep: The CPU keeps running when the error occurs.
 Self-defined: The status of the CPU can be defined by users. Please refer to section 8.2.1 in
Operation Manual for more information.
d. LED indicator status: If the error occurs, the LED indicator is ON, OFF, or blinks.
 ERROR: The system error
 BUS FAULT: The I/O bus error
 Module ERROR: The module error

LED indicators
LED indicator
Description
The status of the CPU
ON: A serious error occurs in the system.
ERROR
OFF: The system is normal.
Blink: A slight error occurs in the system.
CPU
The status of the I/O bus
ON: A serious error occurs in the I/O bus.
BUS FAULT
OFF: The I/O bus is normal.
Blink: A slight error occurs in the I/O bus.
The status of the module
ON: A serious error occurs in the module.
ERROR
Module
OFF: The module is normal.
Blink: A slight error occurs in the module.

7.1.1

CPU Modules

Error code

16#000A
16#000B
16#000C
16#000D
16#000E
16#000F
16#0010
16#0011
16#0012
16#0013
16#0014
16#0015

Description
Scan timeout
(SM8: The watchdog timer error)
The program in the PLC is damaged.
The program downloaded to the PLC is
incorrect.
The CPU parameter is damaged.
The program or the parameter is being
downloaded, and therefore the PLC can not
run.
The original program in the PLC is damaged.
The access to the memory in the CPU is
denied.
The PLC ID is incorrect. (SM9)
The PLC password is incorrect.
The I/O module can not run/stop. (SM10)
The procedure of restoring the system can not
be executed. (SM9)
The module table is incorrect. (SM10)

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Stop

Blink

OFF

Stop

ON

OFF

Stop

Blink

OFF

Stop

ON

OFF

Stop

Blink

OFF

Keep

OFF

OFF

Stop

ON

OFF

Keep
Keep
Stop

ON
ON
OFF

OFF
OFF
ON

Stop

ON

ON

Stop

ON

OFF

Ch ap te r 7 E rr or Cod es

Error code

Description

16#0016

The module setting is incorrect. (SM10)
The device which is associated with the data
register is incorrect. (SM10)
The serial port is abnormal. (SM9)
The USB is abnormal. (SM9)
Timed interrupt 0 is set incorrectly.
Timed interrupt 1 is set incorrectly.
Timed interrupt 2 is set incorrectly.
Timed interrupt 3 is set incorrectly.
The watchdog timer is set incorrectly.
The setting of the fixed scan time is incorrect.
The setting of the fixed scan time is incorrect.
The CPU parameter downloaded to the PLC is
incorrect.
The communication setting of COM1 is
incorrect. (SM9)
The setting of the station address of COM1 is
incorrect. (SM9)
The setting of the communication type of COM1
is incorrect. (SM9)
The interval of retrying the sending of the
command through COM1 is set
incorrectly.(SM9)
The number of times the sending of the
command through COM1 is retried is set
incorrectly. (SM9)
The communication setting of COM2 is
incorrect. (SM9)
The setting of the station address of COM2 is
incorrect. (SM9)
The setting of the communication type of COM2
is incorrect. (SM9)
The interval of retrying the sending of the
command through COM2 is set
incorrectly.(SM9)
The number of times the sending of the
command through COM2 is retried is set
incorrectly. (SM9)
The memories in the latched special auxiliary
relays are abnormal.
The latched special data registers are
abnormal.
The memories in the latched auxiliary relays are
abnormal.
The latched timers are abnormal.
The latched counters are abnormal.
The latched 32-bit counters are abnormal.
The memories in the latched timers are
abnormal.

16#0017
16#0018
16#0019
16#001B
16#001C
16#001D
16#001E
16#001F
16#0020
16#0021
16#0022
16#0033
16#0034
16#0035
16#0036

16#0037
16#0038
16#0039
16#003A
16#003B

16#003C
16#0050
16#0051
16#0052
16#0053
16#0054
16#0055
16#0056

CPU
Status
Stop

LED indicator
status
BUS
ERROR
FAULT
ON
OFF

Stop

ON

OFF

Keep
Keep
Stop
Stop
Stop
Stop
Stop
Stop
Stop

Blink
Blink
ON
ON
ON
ON
ON
ON
ON

OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF

Stop

ON

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Stop

ON

OFF

Stop

ON

OFF

Stop

ON

OFF

Stop
Stop
Stop

ON
ON
ON

OFF
OFF
OFF

Stop

ON

OFF

7-3

A H 5 00 Prog r am m ing M an ua l

Error code

16#0057
16#0058
16#0059
16#005A
16#005E
16#005F
16#0060
16#0061
16#0062
16#0063
16#0064
16#0065
16#0066
16#1400
16#1401
16#1402
16#1403
16#1404
16#1405
16#1406
16#1407
16#1408
16#1409
16#140A
16#140B
16#2000
16#2002

7-4

Description
The memories in the latched counters are
abnormal.
The memories in the latched 32-bit counters are
abnormal.
The latched data registers are abnormal.
The latched working registers are abnormal.
The memory card is initialized incorrectly.
(SM453)
The data is read from the inexistent file in the
memory card, or the data is written into the
inexistent file in the memory card. (SM453)
The default folder can not be created in the
CPU module. (SM453)
The capacity of the memory card is not large
enough. (SM453)
The memory card is write protected. (SM453)
An error occurs when the data is written into the
memory card. (SM453)
The file in the memory card can not be read.
(SM453)
The file in the memory card is a read-only file.
(SM453)
An error occurs when the system is backupped.
An error occurs when the data is accessed
through the auxiliary processor. (SM9)
An error occurs when the data in the I/O module
is accessed. (SM9)
The actual arrangement of the I/O modules is
not consistent with the module table. (SM9)
An error occurs when the data is read from the
module. (SM9)
A watchdog timer error occurs in the module.
(SM9)
The setting parameter of the module is not
found. (SM9)
A communication error occurs when the data is
accessed through the main processor. (SM9)
A communication error occurs when the data is
accessed through the auxiliary processor.
(SM9)
The communication with the module is
incorrect. (SM9)
The extension backplane is disconnected.
(SM9)
The communication with the extension
backplane is incorrect. (SM9)
The number of network modules exceeds the
limit. (SM9)
There is no END in the program in the PLC.
(SM5)
GOEND is used incorrectly. (SM5)

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Stop

ON

OFF

Stop

ON

OFF

Stop
Stop

ON
ON

OFF
OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

OFF

ON

Stop

Blink

OFF

Stop

Blink

OFF

Ch ap te r 7 E rr or Cod es

Error code

16#2003
16#2004

16#2005

16#2006
16#2007
16#200A
16#200B
16#200C
16#200D
16#200E
16#200F

16#2010
16#2011
16#2012
16#2013
16#2014
16#2015
16#2016
16#2017
16#2018
16#2019
16#201A
16#201B
16#201C

Description
The devices used in the program exceed the
range. (SM0/SM5)
The part of the program specified by the label
used in CJ/JMP is incorrect, or the label is used
repeatedly. (SM0/SM5)
The N value used in MC is not the same as the
corresponding N value used in MCR, or the
number of N values used in MC is not the same
as the number of N values used in MCR. (SM5)
The N values used in MC do not start from 0, or
the N values used in MC are not continuous.
(SM5)
The operands used in ZRST are not used
properly. (SM5)
Invalid instruction (SM5)
The operand n or the other constant operands
exceed the range. (SM0/SM5)
The operands overlap. (SM0/SM5)
An error occurs when the binary number is
converted into the binary-coded decimal
number. (SM0/SM5)
The string does not end with 0x00. (SM0/SM5)
The instruction does not support the
modification by an index register. (SM5)
1. The instruction does not support the device.
2. Encoding error
3. The instruction is a 16-bit instruction, but the
constant operand is a 32-bit code. (SM5)
The number of operands is incorrect. (SM5)
Incorrect division operation (SM0/SM5).
The value exceeds the range of values which
can be represented by the floating-point
numbers. (SM0/SM5)
The task designated by TKON/YKOFF is
incorrect, or exceeds the range. (SM5)
There are more than 32 levels of nested
program structures supported by CALL. (SM0)
There are more than 32 levels of nested
program structures supported by FOR/NEXT.
(SM0/SM5)
The number of times FOR is used is different
from the number of times NEXT is used. (SM5)
There is a label after FEND, but there is no
SRET.
There is SRET, but there is no label. (SM5)
The interrupt task is not after FEND. (SM5)
IRET/SRET is not after FEND. (SM5)
There is an interrupt task, but there is no IRET.
There is IRET, but there is not interrupt task.
(SM5)
End is not at the end of the program. (SM5)

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Self-defined

Blink

OFF

Stop

Blink

OFF

Stop

Blink

OFF

Stop

Blink

OFF

Stop

Blink

OFF

Stop

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Stop

Blink

OFF

Stop

Blink

OFF

Stop
Self-defined

Blink
Blink

OFF
OFF

Self-defined

Blink

OFF

Stop

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Stop

Blink

OFF

Stop

Blink

OFF

Stop
Stop

Blink
Blink

OFF
OFF

Stop

Blink

OFF

Stop

Blink

OFF

7-5

A H 5 00 Prog r am m ing M an ua l

Error code

Description

16#201D

There is CALL, but there is no MAR. (SM5)
The function code used in MODRW is incorrect.
(SM102/SM103)
The length of the data set in MODRW is
incorrect. (SM102/SM103)
The communication command received by
using MODRW is incorrect. (SM102/SM103)
The checksum of the command received is
incorrect. (SM102/SM103)
The format of the command used in MODRW
does not conform to the ASCII format.
(SM102/SM103)
There is a communication timeout when
MODRW is executed. (SM120/SM103)
The setting value of the communication timeout
is invalid. (SM120/SM103)
There is a communication timeout when RS is
executed. (SM120/SM103)
The interrupt number used in RS is incorrect.
Ethernet connection error (SM1106)
Illegal IP address (SM1107)
Illegal netmask address (SM1107)
Illegal gateway mask (SM1107)
The IP address filter is set incorrectly. (SM1108)
The static ARP table is set incorrectly. (SM1108)
Illegal network number (SM1107)
Illegal node number (SM1107)
TCP connection failure (SM1090)
UDP connection failure (SM1091)
The TCP socket has been used. (SM1109)
The RJ45 port is not connected.
The email connection is busy. (SM1113)
The trigger in the email is set incorrectly.
(SM1112)
The interval of sending the email is set
incorrectly. (SM1112)
The device containing the data specified as the
attachment exceeds the device range.
(SM1112)
The attachment in the email does not exist.
(SM1113)
The attachment in the email is oversized.
(SM1113)
The SMTP server address is incorrect.
(SM1112)
There is an SMTP server response timeout.
(SM1113)
SMTP authentication error (SM1112)
The SMTP server needs to be authenticated.
(SM1112)

16#201E
16#201F
16#2020
16#2021
16#2022
16#2023
16#2024
16#2025
16#2026
16#6000
16#6001
16#6002
16#6003
16#6004
16#6006
16#6008
16#6009
16#600A
16#600B
16#600C
16#600D
16#6100
16#6101
16#6102
16#6103
16#6104
16#6105
16#6106
16#6107
16#6108
16#6110

7-6

CPU
Status
Stop

LED indicator
status
BUS
ERROR
FAULT
Blink
OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined

Blink

OFF

Self-defined
Keep
Keep
Keep
Keep
Keep
Keep
Keep
Keep
Keep
Keep
Keep
Keep
Keep

OFF
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
OFF
OFF
OFF
OFF
OFF

OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF
OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

Blink

OFF

Keep

OFF

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Ch ap te r 7 E rr or Cod es

Error code

16#6111
16#6200
16#6201
16#6202
16#6203
16#6204
16#6205
16#6206
16#6207
16#6208
16#6209
16#620A
16#620B
16#620C
16#620D
16#620E
16#620F
16#6210
16#6211
16#6212
16#6213
16#6214
16#6215
16#6217
16#6218
16#6219
16#621A
16#6300
16#6301

Description
The specified email address does not exist.
(SM1112)
The remote IP address set in the TCP socket
function is illegal. (SM1196)
The local communication port set in the TCP
socket function is illegal.
The remote communication port set in the TCP
socket function is illegal.
The device from which the data is sent in the
TCP socket function is illegal.
The transmitted data length set in the TCP
socket function is illegal.
The data which is sent through the TCP socket
exceeds the device range.
The device which receives the data in the TCP
socket function is illegal.
The received data length set in the TCP socket
function is illegal.
The data which is received through the TCP
socket exceeds the device range.
The remote IP address set in the UDP socket
function is illegal. (SM1196)
The local communication port set in the UDP
socket function is illegal.
The remote communication port set in the UDP
socket function is illegal.
The device from which the data is sent in the
UDP socket function is illegal.
The transmitted data length set in the UDP
socket function is illegal.
The data which is sent through the UDP socket
exceeds the device range.
The device which receives the data in the UDP
socket function is illegal.
The received data length set in the UDP socket
function is illegal.
The data which is received through the UDP
socket exceeds the device range.
There is no response from the remote device
after the timeout period.
The data received exceeds the limit.
The remote device refuses the connection.
The socket is not opened.
The socket is opened.
The data has been sent through the socket.
The data has been received through the socket.
The socket is closed.
Only auxiliary relays, data registers, and link
registers can be used in the Ether Link.
The device used in the Ether Link exceeds the
device range.

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Keep

Blink

OFF

Keep

Blink

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

Blink

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep
Keep
Keep
Keep
Keep
Keep
Keep

OFF
OFF
OFF
OFF
OFF
OFF
OFF

OFF
OFF
OFF
OFF
OFF
OFF
OFF

Keep

Blink

OFF

Keep

Blink

OFF

7-7

A H 5 00 Prog r am m ing M an ua l

Error code

16#6302
16#6303
16#6304
16#6305
16#6309
16#630A
16#630B

16#6400
16#6401
16#6402
16#6403
16#6404
16#6405
16#6600
16#6601
16#6602
16#6603
16#6604
16#6605
16#6606
16#8F0A
16#8F0B
16#8F02
16#8F03
16#8F04
16#8F06
16#8F07

7-8

Description
The length of the data exchanged in the Ether
Link exceeds the limit.
The remote device in the Ether Link aborts the
connection.
The connection in the Ether Link is busy.
The node used in the communication command
is different from the local node.
The remote device in the Ether Link does not
respond after the timeout period.
The module ID or the setting of the module is
different from the setting in the Ether Link.
The setting of the netmask address for the CPU
or the module is different from the setting in the
Ether Link.
The number of TCP connections reaches the
upper limit, or the flag which is related to the
sending of the data is not set to ON.
The remote device aborts the connection.
There is no response from the remote device
after the timeout period.
The remote IP address used in the applied
instruction is illegal.
The Modbus function code not supported is
received.
The number of data which will be received is not
consistent with the actual length of the data.
The network number which receives the
command exceeds the range.
The network is undefined in the network
configuration parameter.
The node number exceeds the limit. (SM1598)
The device is undefined. (SM1599)
The number of routing connections reaches the
upper limit.
The unexpected packet is received.
There is a routing response timeout.
Routing instruction error: The length of the
packet exceeds the range
Routing instruction error: The sending of the
packet fails.
Routing instruction error: The network number
is undefined.
Routing instruction error: The node number is
undefined.
Routing instruction error: The IP address of the
node is illegal or undefined.
Routing instruction error: The remote device
address is incorrect.
Routing instruction error: The number of
devices exceeds the range.

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Keep

Blink

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

Blink

OFF

Keep

OFF

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep
Keep

Blink
Blink

OFF
OFF

Keep

OFF

OFF

Keep
Keep

OFF
OFF

OFF
OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Ch ap te r 7 E rr or Cod es

Error code

16#8F08
16#8F09
16#8105

16#8106

16#8107

16#820E

16#820F

16#8210

16#8211

16#8212

16#8215

16#8216

16#8217

16#8218
16#8219
16#821A
16#821B

Description
Routing instruction error: There is a response
timeout.
Routing instruction error: The number of routing
connections reaches the upper limit.
The contents of the program downloaded are
incorrect.
The program syntax is incorrect.
The contents of the program downloaded are
incorrect.
The length of the execution code exceeds the
limit.
The contents of the program downloaded are
incorrect.
The length of the source code exceeds the limit.
The communication port parameter downloaded
is incorrect.
The communication protocol is incorrect.
The communication port parameter downloaded
is incorrect.
The setting of the station address is incorrect.
The communication port parameter downloaded
is incorrect.
The choice among RS-232, RS-485, and
SR-422 is incorrect.
The communication port parameter downloaded
is incorrect.
The interval of retrying the sending of the
command is set incorrectly.
The communication port parameter downloaded
is incorrect.
The number of times the sending of the
command is retried is set incorrectly.
The CPU parameter downloaded is incorrect.
The interval of executing interrupt 0 is set
incorrectly.
The CPU parameter downloaded is incorrect.
The interval of executing interrupt 1 is set
incorrectly.
The CPU parameter downloaded is incorrect.
The interval of executing interrupt 2 is set
incorrectly.
The CPU parameter downloaded is incorrect.
The interval of executing interrupt 3 is set
incorrectly.
The CPU parameter downloaded is incorrect.
The watchdog timer is set incorrectly.
The CPU parameter downloaded is incorrect.
The setting of the scan time is incorrect.
The CPU parameter downloaded is incorrect.
The setting of the remote execution function is
incorrect.

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

7-9

A H 5 00 Prog r am m ing M an ua l

Error code

16#821D
16#8230
16#8231
16#8232
16#8233
16#8235
16#8237
16#8238
16#8239
16#823A
16#823B
16#823C
16#823E
16#9A01
16#9A02
16#9A03
16#9A04
16#9A05
16#9A06
16#9A07
16#9A08
16#9A09
16#9A0A
16#9A0B
16#9A0C

7-10

Description
The CPU parameter downloaded is incorrect.
An error occurs in the latched area.
The CPU parameter downloaded is incorrect.
The IP address is illegal.
The CPU parameter downloaded is incorrect.
The netmask address is illegal.
The CPU parameter downloaded is incorrect.
The gateway address is illegal.
The CPU parameter downloaded is incorrect.
The IP address filter is set incorrectly.
The CPU parameter downloaded is incorrect.
The static ARP table is set incorrectly.
The CPU parameter downloaded is incorrect.
The network number is illegal.
The CPU parameter downloaded is incorrect.
The node number is illegal.
The CPU parameter downloaded is incorrect.
The email is set incorrectly.
The CPU parameter downloaded is incorrect.
The trigger in the email is set incorrectly.
The CPU parameter downloaded is incorrect.
The TCP socket is set incorrectly.
The CPU parameter downloaded is incorrect.
The UDP socket is set incorrectly.
The CPU parameter downloaded is incorrect.
The web is set incorrectly.
The setting of the data exchange for slave 1 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 2 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 3 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 4 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 5 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 6 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 7 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 8 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 9 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 10 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 11 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 12 in
the PLC Link is incorrect. (SM1590)

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Keep

OFF

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

Blink

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Ch ap te r 7 E rr or Cod es

Error code

16#9A0D
16#9A0E
16#9A0F
16#9A10
16#9A11
16#9A12
16#9A13
16#9A14
16#9A15
16#9A16
16#9A17
16#9A18
16#9A19
16#9A1A
16#9A1B
16#9A1C
16#9A1D
16#9A1E
16#9A1F
16#9A20
16#9A21
16#9A22
16#9A23
16#9A24
16#9A25

Description
The setting of the data exchange for slave 13 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 14 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 15 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 16 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 17 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 18 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 19 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 20 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 21 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 22 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 23 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 24 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 25 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 26 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 27 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 28 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 29 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 30 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 31 in
the PLC Link is incorrect. (SM1590)
The setting of the data exchange for slave 32 in
the PLC Link is incorrect. (SM1590)
An error occurs when the master communicates
with slave 1 in the PLC Link. (SM SM1591)
An error occurs when the master communicates
with slave 2 in the PLC Link. (SM SM1591)
An error occurs when the master communicates
with slave 3 in the PLC Link. (SM SM1591)
An error occurs when the master communicates
with slave 4 in the PLC Link. (SM SM1591)
An error occurs when the master communicates
with slave 5 in the PLC Link. (SM1591)

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

7 - 11

A H 5 00 Prog r am m ing M an ua l

Error code

16#9A26
16#9A27
16#9A28
16#9A29
16#9A2A
16#9A2B
16#9A2C
16#9A2D
16#9A2E
16#9A2F
16#9A30
16#9A31
16#9A32
16#9A33
16#9A34
16#9A35
16#9A36
16#9A37
16#9A38
16#9A39
16#9A3A
16#9A3B
16#9A3C
16#9A3D
16#9A3E

7-12

Description
An error occurs when the master communicates
with slave 6 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 7 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 8 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 9 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 10 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 11 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 12 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 13 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 14 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 15 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 16 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 17 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 18 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 19 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 20 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 21 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 22 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 23 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 24 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 25 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 26 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 27 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 28 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 29 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 30 in the PLC Link. (SM1591)

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Ch ap te r 7 E rr or Cod es

Error code

16#9A3F
16#9A40
16#9A41
16#9A42
16#9A43
16#9A44
16#9A45
16#9A46
16#9A47
16#9A48
16#9A49
16#9A4A
16#9A4B
16#9A4C
16#9A4D
16#9A4E
16#9A4F
16#9A50
16#9A51
16#9A52
16#9A53
16#9A54
16#9A55
16#9A56
16#9A57

Description
An error occurs when the master communicates
with slave 31 in the PLC Link. (SM1591)
An error occurs when the master communicates
with slave 32 in the PLC Link. (SM1591)
There is no response from slave 1 in the PLC
Link. (SM1592)
There is no response from slave 2 in the PLC
Link. (SM1592)
There is no response from slave 3 in the PLC
Link. (SM1592)
There is no response from slave 4 in the PLC
Link. (SM1592)
There is no response from slave 5 in the PLC
Link. (SM1592)
There is no response from slave 6 in the PLC
Link. (SM1592)
There is no response from slave 7 in the PLC
Link. (SM1592)
There is no response from slave 8 in the PLC
Link. (SM1592)
There is no response from slave 9 in the PLC
Link. (SM1592)
There is no response from slave 10 in the PLC
Link. (SM1592)
There is no response from slave 11 in the PLC
Link. (SM1592)
There is no response from slave 12 in the PLC
Link. (SM1592)
There is no response from slave 13 in the PLC
Link. (SM1592)
There is no response from slave 14 in the PLC
Link. (SM1592)
There is no response from slave 15 in the PLC
Link. (SM1592)
There is no response from slave 16 in the PLC
Link. (SM1592)
There is no response from slave 17 in the PLC
Link. (SM1592)
There is no response from slave 18 in the PLC
Link. (SM1592)
There is no response from slave 19 in the PLC
Link. (SM1592)
There is no response from slave 20 in the PLC
Link. (SM1592)
There is no response from slave 21 in the PLC
Link. (SM1592)
There is no response from slave 22 in the PLC
Link. (SM1592)
There is no response from slave 23 in the PLC
Link. (SM1592)

CPU
Status

LED indicator
status
BUS
ERROR
FAULT

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

7-13

A H 5 00 Prog r am m ing M an ua l

Error code

16#9A58
16#9A59
16#9A5A
16#9A5B
16#9A5C
16#9A5D
16#9A5E
16#9A5F
16#9A60
16#9A61
16#9A62
16#9A63
16#9A64

7.1.2

There is no response from slave 24 in the PLC
Link. (SM1592)
There is no response from slave 25 in the PLC
Link. (SM1592)
There is no response from slave 26 in the PLC
Link. (SM1592)
There is no response from slave 27 in the PLC
Link. (SM1592)
There is no response from slave 28 in the PLC
Link. (SM1592)
There is no response from slave 29 in the PLC
Link. (SM1592)
There is no response from slave 30 in the PLC
Link. (SM1592)
There is no response from slave 31 in the PLC
Link. (SM1592)
There is no response from slave 32 in the PLC
Link. (SM1592)
The setting of the PLC Link mode is incorrect.
(SM1589)
The number of polling cycles in the PLC Link is
incorrect. (SM1592)
There is a handshaking timeout when the CPU
module establishes a connection with the
network module. (SM1596)
There is no network module parameter in the
CPU module. (SM1596)

LED indicator
status
BUS
ERROR
FAULT

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Keep

OFF

OFF

Analog I/O Modules and Temperature Measurement
Modules

Error code

16#A000
16#A001
16#A002
16#A003
16#A004
16#A005
16#A006
16#A007

7-14

Description

CPU
Status

Description
The signal received by channel 0 exceeds the range of
inputs which can be received by the hardware.
The signal received by channel 1 exceeds the range of
inputs which can be received by the hardware.
The signal received by channel 2 exceeds the range of
inputs which can be received by the hardware.
The signal received by channel 3 exceeds the range of
inputs which can be received by the hardware.
The signal received by channel 4 exceeds the range of
inputs which can be received by the hardware.
The signal received by channel 5 exceeds the range of
inputs which can be received by the hardware.
The signal received by channel 6 exceeds the range of
inputs which can be received by the hardware.
The signal received by channel 7 exceeds the range of
inputs which can be received by the hardware.

LED indicator status
CPU
Module
BUS
ERROR
FAULT
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink

Ch ap te r 7 E rr or Cod es

Error code

Description

LED indicator status
CPU
Module
BUS
ERROR
FAULT

The signal received by channel 0 exceeds the range of
ON
inputs which can be received by the hardware.
The signal received by channel 1 exceeds the range of
16#A401
ON
inputs which can be received by the hardware.
The signal received by channel 2 exceeds the range of
16#A402
ON
inputs which can be received by the hardware.
The signal received by channel 3 exceeds the range of
16#A403
ON
inputs which can be received by the hardware.
The signal received by channel 4 exceeds the range of
16#A404
ON
inputs which can be received by the hardware.
The signal received by channel 5 exceeds the range of
16#A405
ON
inputs which can be received by the hardware.
The signal received by channel 6 exceeds the range of
16#A406
ON
inputs which can be received by the hardware.
The signal received by channel 7 exceeds the range of
16#A407
ON
inputs which can be received by the hardware.
16#A600
Hardware failure
ON
16#A601
The external voltage is abnormal.
ON
Internal error
16#A602
ON
The CJC is abnormal.
Internal error
16#A603
ON
The factory correction is abnormal.
The signal received by channel 0 exceeds the range of
16#A800
OFF
inputs which can be received by the hardware.
The signal received by channel 1 exceeds the range of
16#A801
OFF
inputs which can be received by the hardware.
The signal received by channel 2 exceeds the range of
16#A802
OFF
inputs which can be received by the hardware.
The signal received by channel 3 exceeds the range of
16#A803
OFF
inputs which can be received by the hardware.
The signal received by channel 4 exceeds the range of
16#A804
OFF
inputs which can be received by the hardware.
The signal received by channel 5 exceeds the range of
16#A805
OFF
inputs which can be received by the hardware.
The signal received by channel 6 exceeds the range of
16#A806
OFF
inputs which can be received by the hardware.
The signal received by channel 7 exceeds the range of
16#A807
OFF
inputs which can be received by the hardware.
*With regard to the errors related to the input signals’ exceeding the range of inputs which can be
received by the hardware and the conversion values’ exceeding the limits, whether the error code
generated is within the range between 16#A000 and 16#A00F, within the range between 16#A400
and 16#A40F, or within the range between 16#A800~16#A80F depends on the LED indicator
status defined by users.
16#A400

7.1.3

AH02HC-5A/AH04HC-5A

Error code

16#A001

Description
The linear accumulation in channel 1 exceeds the
range.

LED indicator status
CPU
Module
BUS
ERROR
FAULT
Blink

7-15

A H 5 00 Prog r am m ing M an ua l

Error code

Description

16#A002
16#A003
16#A004

The prescale value for channel 1 exceeds the range.
The moving average for channel 1 exceeds the range.
The comparison value for channel 1 exceeds the range.
The limit value of the alarm output for channel 1 is
incorrect.
The interrupt number for channel 1 exceeds the range.
The linear accumulation in channel 2 exceeds the
range.
The prescale value for channel 2 exceeds the range.
The moving average for channel 2 exceeds the range.
The comparison value for channel 2 exceeds the range.
The limit value of the alarm output for channel 2 is
incorrect.
The interrupt number for channel 2 exceeds the range.
The linear accumulation in channel 3 exceeds the
range.
The prescale value for channel 3 exceeds the range.
The moving average for channel 3 exceeds the range.
The comparison value for channel 3 exceeds the range.
The limit value of the alarm output for channel 3 is
incorrect.
The interrupt number for channel 3 exceeds the range.
The linear accumulation in channel 4 exceeds the
range.
The prescale value for channel 4 exceeds the range.
The moving average for channel 4 exceeds the range.
The comparison value for channel 4 exceeds the range.
The limit value of the alarm output for channel 4 is
incorrect.
The interrupt number for channel 4 exceeds the range.

16#A005
16#A006
16#A011
16#A012
16#A013
16#A014
16#A015
16#A016
16#A021
16#A022
16#A023
16#A024
16#A025
16#A026
16#A031
16#A032
16#A033
16#A034
16#A035
16#A036

7.1.4

Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink

AH10PM-5A

Error code

Description

16#A002
16#A003
16#A004
16#A005
16#A006
16#A007

The subroutine has no data.
CJ, CJN, and JMP have no matching pointers.
There is a subroutine pointer in the main program.
Lack of the subroutine
The pointer is used repeatedly in the same program.
The subroutine pointer is used repeatedly.
The pointer used in JMP is used repeatedly in different
subroutines.
The pointer used in JMP is the same as the pointer
used in CALL.
Target position (I) of the single speed is incorrect.
Target position (II) of the single-axis motion is
incorrect.

16#A008
16#A009
16#A00B
16#A00C

7-16

LED indicator status
CPU
Module
BUS
ERROR
FAULT
Blink
Blink
Blink

LED indicator status
CPU
Module
BUS
Error
FAULT
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink

Ch ap te r 7 E rr or Cod es

Error code

16#A00D
16#A00E
16#A00F
16#A010
16#A011
16#A012
16#A013
16#A014
16#A015
16#A017
16#A018
16#A019
16#A01A
16#A01B
16#A01C
16#A01D
16#A01E
16#A01F
16#A020

7.1.5

Description
The setting of speed (I) of the single-axis motion is
incorrect.
The setting of speed (II) of the single-axis motion is
incorrect.
The setting of the speed (VRT) of returning to zero is
incorrect.
The setting of the deceleration (VCR) of returning to
zero is incorrect.
The setting of the JOG speed is incorrect.
The positive pulses generated by the single-axis
clockwise motion are inhibited.
The negative pulses generated by the single-axis
counterclockwise motion are inhibited.
The limit switch is reached.
The device which is used exceeds the device range.
An error occurs when the device is modified by a
16-bit index register/32-bit index register.
The conversion into the floating-point number is
incorrect.
The conversion into the binary-coded decimal number
is incorrect.
Incorrect division operation (The divisor is 0.)
General program error
LD/LDI has been used more than nine times.
There is more than one level of nested program
structure supported by RPT/RPE.
SRET is used between RPT and RPE.
There is no M102 in the main program, or there is no
M2 in the motion program.
The wrong instruction is used, or the device used
exceeds the range.

LED indicator status
CPU
Module
BUS
Error
FAULT
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink

AH20MC-5A

Error code

Description

16#A002
16#A003
16#A004
16#A005
16#A006
16#A007

The subroutine has no data.
CJ, CJN, and JMP have no matching pointers.
There is a subroutine pointer in the main program.
Lack of the subroutine
The pointer is used repeatedly in the same program.
The subroutine pointer is used repeatedly.
The pointer used in JMP is used repeatedly in different
subroutines.
The pointer used in JMP is the same as the pointer
used in CALL.
Target position (I) of the single speed is incorrect.
Target position (II) of the single-axis motion is
incorrect.

16#A008
16#A009
16#A00B
16#A00C

LED indicator status
CPU
Module
BUS
ERROR
FAULT
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink

7-17

A H 5 00 Prog r am m ing M an ua l

Error code

16#A00D
16#A00E
16#A00F
16#A010
16#A011
16#A012
16#A013
16#A014
16#A015
16#A017
16#A018
16#A019
16#A01A
16#A01B
16#A01C
16#A01D
16#A01E
16#A01F
16#A020

7.1.6

The setting of speed (I) of the single-axis motion is
incorrect.
The setting of speed (II) of the single-axis motion is
incorrect.
The setting of the speed (VRT) of returning to zero is
incorrect.
The setting of the deceleration (VCR) of returning to
zero is incorrect.
The setting of the JOG speed is incorrect.
The positive pulses generated by the single-axis
clockwise motion are inhibited.
The negative pulses generated by the single-axis
counterclockwise motion are inhibited.
The limit switch is reached.
The device which is used exceeds the device range.
An error occurs when the device is modified by a 16-bit
index register/32-bit index register.
The conversion into the floating-point number is
incorrect.
The conversion into the binary-coded decimal number
is incorrect.
Incorrect division operation (The divisor is 0.)
General program error
LD/LDI has been used more than nine times.
There is more than one level of nested program
structure supported by RPT/RPE.
SRET is used between RPT and RPE.
Incorrect division operation (The divisor is 0.)
The wrong instruction is used, or the device used
exceeds the range.

Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink
Blink

AH10EN-5A

Error code

16#A001
16#A002
16#A003
16#A004
16#A401
16#A402

7-18

Description

LED indicator status
CPU
Module
BUS
ERROR
FAULT

Description
The IP address of host 1 conflicts with another system
on the network.
The IP address of host 2 conflicts with another system
on the network.
DHCP for host 1 fails.
DHCP for host 2 fails.
Hardware error
The initialization of the system fails.

LED indicator status
CPU
Module
BUS
Error
FAULT
Blink
Blink
Blink
Blink
ON
ON

Ch ap te r 7 E rr or Cod es

7.1.7

AH10SCM-5A

Error code

16#A002
16#A401
16#A804
16#A808

7.1.8

LED indicator status
CPU
Module
BUS
ERROR
FAULT

Description
The setting of the UD Link is incorrect, or the
communication fails.
Hardware error
The communication through the communication port is
incorrect.
Modbus communication error

Blink
ON
OFF
OFF

AH10DNET-5A

Error code
16#A080
16#A0F1

16#A0E2

16#A0E7

16#A0E8
16#A0F0
16#A0F2
16#A0F3
16#A0F4
16#A0F5

16#A0F6
16#A0F7
16#A0F8

Description
AH10DNET-5A stops running.

LED indicator status
CPU
Module
BUS FAULT
MS
NS
The green The green
The red light blinks.
light is ON. light is ON.
The green The green
The red light blinks.
light blinks. light is ON.

No slave is put in the scan list of
AH10DNET-5A.
AH10DNET-5A functions as a
The red light blinks.
master. The slave in the scan list
is disconnected or does not exist.
AH10DNET-5A as a slave does
not connect to the I/O module as a The red light blinks.
master.
AH10DNET-5A is checking
whether its node ID is the same
The red light blinks.
as the node ID of other device on
the network.
AH10DNET-5A is being initialized.
The node ID of AH10DNET-5A is
the same as other node ID on the
network, or exceeds the range.
The working voltage of
AH10DNET-5A is low.
AH10DNET-5A enters the test
mode.
The bus of AH10DNET-5A is
switched OFF.
AH10DNET-5A detects that there
is no network power supply to the
DeviceNet.
Something is wrong with the
internal memory of
AH10DNET-5A.
Something is wrong with the data
exchange unit of AH10DNET-5A.
The product ID of AH10DNET-5A
is incorrect.

The red light The green
blinks.
light is ON.
The green The red light
light blinks.
blinks.
The green
light blinks.

OFF

The red light blinks.

The green The green
light blinks. light blinks.

The red light blinks.

The green The red light
light blinks.
is ON.

The red light The red light
blinks.
blinks.
The orange The orange
The red light blinks.
light is ON. light is ON.
The green The red light
The red light blinks.
light is ON.
is ON.
The red light blinks.

The red light blinks.

The red light The red light
blinks.
is ON.

The red light blinks.

The red light The green
is ON.
light blinks.

The red light
is ON.
The red light
The red light blinks.
is ON.
The red light blinks.

The green
light blinks.
The green
light blinks.

7-19

A H 5 00 Prog r am m ing M an ua l

Error code

16#A0F9

16#A0FA

7-20

Description

LED indicator status
CPU
Module
BUS FAULT
MS
NS

An error occurs when the data is
read from AH10DNET-5A, or when
The red light The red light
The red light blinks.
the data is written into
is ON.
is ON.
AH10DNET-5A.
The node ID of AH10DNET-5A is
The green The red light
the same as that of the slave set in The red light blinks.
light is ON.
is ON.
the scan list.



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : Yes
XMP Toolkit                     : Adobe XMP Core 5.2-c001 63.139439, 2010/09/27-13:37:26
Modify Date                     : 2012:11:07 13:05:12+08:00
Create Date                     : 2012:11:07 11:32:20+08:00
Metadata Date                   : 2012:11:07 13:05:12+08:00
Creator Tool                    : CorelDRAW 版本 12.0
Format                          : application/pdf
Title                           : AH500-Programming-Manual(curve).cdr
Creator                         : Delta
Document ID                     : uuid:8098d0ab-c12d-4f5d-a257-5e3eea2df3e8
Instance ID                     : uuid:d8b86fad-a8d8-4969-a67b-b607f46d1b00
Producer                        : Corel PDF Engine Version 1.0.0.536
Page Count                      : 748
Author                          : Delta
EXIF Metadata provided by EXIF.tools

Navigation menu