AS300 Programming Manual
AS300 Programming Manual
Asia
Delta Electronics (Jiangsu) Ltd.
Wujiang Plant 3
1688 Jiangxing East Road,
Wujiang Economic Development Zone
Wujiang City, Jiang Su Province, P.R.C. 215200
TEL: 86-512-6340-3008 / FAX: 86-769-6340-7290
AS Series
Geumcheon-gu, Seoul, Korea, 153-704
TEL: 82-2-515-5303 / FAX: 82-2-515-5302
Programming Manual
4 Kaki Bukit Ave 1, #05-05, Singapore 417939
TEL: 65-6747-5155 / FAX: 65-6744-9228
Americas
Delta Products Corporation (USA)
Raleigh Office
P.O. Box 12173,5101 Davis Drive,
Research Triangle Park, NC 27709, U.S.A.
TEL: 1-919-767-3800 / FAX: 1-919-767-8080
Europe
Delta Electronics (Netherlands) B.V.
Eindhoven Office
De Witbogt 20, 5652 AG Eindhoven, The Netherlands
TEL : +31 (0)40-8003800 / FAX : +31 (0)40-8003898
AS-0249720-01
*We reserve the right to change the information in this manual without prior notice.
2016/11/30 www.deltaww.com
AS Series Programming Manual
Revision History
Ve r s i o n Revision Date
st
1 The first version was published. 2 0 1 6 / 11 / 3 0
AS Series Programming Manual
Table of Contents
Chapter 1 Introduction
Chapter 2 Devices
i
Chapter 3 Instruction Tables
ii
6.1.1 List of Comparison Instructions ............................................................ 6-4
6.1.2 Explanation of Comparison Instructions ................................................. 6-7
iii
6.13.2 Explanation of Data Processing Instructions ...................................... 6-324
iv
6.25.2 Explanation of SFC Instructions ...................................................... 6-666
Chapter 7 Troubleshooting
7.4 Error Codes and LED Indicators for CPU Modules ............................ 7-18
7.4.1 Error Codes and LED Indicators for CPU Modules ............................. 7-18
7.4.2 Error Codes and LED Indicators for Analog/Temperature Modules....... 7-23
7.4.3 Error Codes and LED Indicators for Load Cell Module AS02LC ............ 7-24
v
7.4.4 Error Codes and LED Indicators for Module AS00SCM as a Communication
Module ...................................................................................... 7-25
7.4.5 Error Codes and LED Indicators for Module AS00SCM as a Remote
Module ...................................................................................... 7-25
vi
1
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-1
A S S er i es Pr og r am m ing M an u a l
1.1 Overview
_1 This manual introduces the programming of the AS series programmable logic controllers, the basic instructions, and the
applied instructions.
It guides users to use the system before they read the related manuals.
It introduces the programming of the AS series programmable logic controllers, the basic instructions, and the applied
instructions.
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.
It introduces the use of special I/O modules. For example, network modules, analog I/O modules, temperature
measurement modules, and etc.
1-2
C ha pt er 1 I ntr o duc t i on
1-3
A S S er i es Pr og r am m ing M an u a l
1-4
C ha pt er 1 I ntr o duc t i on
1-5
A S S er i es Pr og r am m ing M an u a l
1.2 Software
1.2.1 Program Editor
The outline of program editor ISPSoft:
There are four types of programming languages, including the structure text (ST), the ladder diagram (LD), the
sequential function chart (SFC), and the Continuous Function Chart (CFC).
NOTE: the CFC programming is only available for ISPSoft with version 3.01 or higher.
1-6
C ha pt er 1 I ntr o duc t i on
The use of variables which allows the user to define the variable symbol to replace the device name of the PLC not
1_
only enhances the readability of the program, but also saves the user a lot of time to allocate the address of the
device.
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-7
A S S er i es Pr og r am m ing M an u a l
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-8
2
Chapter 2 Devices
Table of Contents
2.1 Introduction of Devices ......................................................................... 2-2
2.1.1 Device Table ................................................................................. 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-4
2-1
A S S er i es Pr og r am m ing M an u a l
D 30000 D0~D29999
Data register
4
W 30000 W0~W29999 *
1 16 bits: -32768~32767
Constant* Decimal system K
32 bits: -2147483648~2147483647
16 bits: 16#0~16#FFFF
Hexadecimal system 16#
2 32 bits: 16#0~16#FFFFFFFF
Constant*
Single-precision -38 + 38
F 32 bits: ±1.17549435 ~±3.40282347
floating-point number
3
String* String “$” 1~31 characters
*1: The decimal forms are notated by K in the device lists in Chapter 5 and Chapter 6 in AS Series Programming Manual.
For example a K50 in the AS programming manual, only the number 50 should be inputted in ISPSoft.
*2: The floating-point numbers are notated by F/DF in the device lists in Chapter 5 and Chapter 6 in AS Series
Programming Manual, whereas they are represented by decimal points in ISPSoft; for the floating-point F500, one
should input 500.0.
*3: The strings are notated by “$” in Chapter 5 and Chapter 6 in AS Series Programming Manual, whereas they are
represented by “ ” in ISPSoft; for the string of 1234, one should input “1234”in ISPSoft.
2-2
C ha pt er 2 D e v ic es
2.1.3 Relation Between the PLC Action and the Device Type
Device type Non-latched area Latched area
PLC action Device Y Other devices File register Other devices
Power: OFF→ON Cleared Cleared Retained Retained
Restore to defaults Cleared Cleared Cleared Cleared
The non-latched
Cleared Cleared Retained Retained
STOP area is cleared.
↓ The state of the
1
RUN* non-latched area is Retained Retained Retained Retained
retained.
The state of device
RUN Cleared Retained Retained Retained
Y is cleared.
↓
1 The state of device
STOP* Retained Retained Retained Retained
Y is retained.
SM204 is ON.
(All non-latched areas are Cleared Cleared Retained Retained
cleared.)
SM205 is ON.
(All latched areas are Retained Retained Retained Cleared
cleared.)
*1: For the setups of the states, please go to HWCONFIG in ISPSoft. The default of PLC STOP->RUN is “cleared
not-latched area”. The default of PLC RUN->STOP is “cleared the state of device Y”.
2-3
A S S er i es Pr og r am m ing M an u a l
1
M* Auxiliary relay M0~M8191 The default range is M6000~M8191.
_2
Some devices are latched, and cannot be
changed.
SM Special auxiliary relay SM0~SM2047
Please refer to the list of special auxiliary relays
for more information.
1
S* Stepping relay S0~S1023 The default range is S512~S1023
*1: For the setups of the latched area, please go to HWCONFIG in ISPSoft. Set the latched area and the other areas will
be seen as non-latched areas. The range of latched areas cannot exceed the device range. For example, set the
M600~M7000 as the latched areas and that makes M0~M5999 and M7001~M8191 as the non-latched areas.
2-4
C ha pt er 2 D e v ic es
W1 W0
W ord
BY3 BY2 BY1 BY0 B yt e
N B7 N B6 N B5 N B4 N B3 N B2 N B1 N B0
N ib ble
b31 b30 b29 b28 b27 b26 b25 b24b23 b22 b21 b20 b19 b18 b17 b16 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 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:
2-5
A S S er i es Pr og r am m ing M an u a l
the setting value of the timer (T) or the setting value of the counter (C/HC). For example, TMR C0 50
_2 (constant K).
the device number. For example, M10 and T30 (device number)
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).
A decimal value is represented by a nibble or four bits, and therefore sixteen consecutive bits can represent a
four-digit decimal value.
the constant 16#: It is used as the operand in the applied instruction. For example, MOV 16#1A2B D0
(hexadecimal constant).
Corresponding values:
2-6
C ha pt er 2 D e v ic es
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.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 2 3- bi t
b 31 b0
S ig n b it
0 : Po siti ve
1 : Neg ati ve
Equation:
(− 1)S × 2 E − B × 1.M ; B = 127
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 AS series PLC uses two consecutive registers to form a 32-bit floating-point number. Take (D1, D0) for example.
D1 (b 15 ~b 0) D0 (b 15 ~b 0)
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
S E7 E6 E5 E1 E0 A22 A21 A20 A6 A5 A4 A3 A2 A1 A0
b31 b30 b29 b28 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
Example 1:
Step 2: Normalize the binary number, i.e. 10111=1.0111 ×24 (0111 is the mantissa, and 4 is 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
Example 2:
2-7
A S S er i es Pr og r am m ing M an u a l
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
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
Exponent D1=-41~+35
-1
The base number 100 does not exist in D0 because 100 is represented by 1,000×10 . In addition, 32-bit decimal
-41 +35
floating-point numbers range from ±1175×10 to ±402×10 .
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 you enter is a string, you can enter 31 characters at most, and the ending character 16#00
will be added automatically in ISPSoft.
D0=0 (NULL)
D2 0 (NULL)
2-8
C ha pt er 2 D e v ic es
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
Hex 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
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
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.
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.
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
2-9
A S S er i es Pr og r am m ing M an u a l
Input type
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 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.
The output which is not practically put to use can be used as a general device.
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.
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. 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-10
C ha pt er 2 D e v ic es
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
2_
to the related manual for more information.
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2 - 11
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
instruction RS.
_2 SM84
No data is received through Function Card 1 after a specified
○ OFF OFF – N R/W OFF
period of time.
No data is received through Function Card 2 after a specified
SM85 ○ OFF OFF – N R/W OFF
period of time.
Choice made by Function Card 1 between the 8-bit
processing mode and the 16-bit processing mode
SM86 ○ OFF – – N R/W OFF
ON: The 8-bit processing mode
OFF: The 16-bit processing mode
Choice made by Function Card 2 between the 8-bit
processing mode and the 16-bit processing mode
SM87 ○ OFF – – N R/W OFF
ON: The 8-bit processing mode
OFF: The 16-bit processing mode
SM90 The communication protocol of Function Card 1 changes ○ OFF – – N R/W OFF
SM91 The communication protocol of Function Card 2 changes ○ OFF – – N R/W OFF
SM94 Change of the LED lighting control in COM1 ○ – – – H R/W OFF
SM95 Change of the LED lighting control in COM2 ○ – – – H R/W OFF
*SM96 The data is sent through COM1. ○ OFF OFF – N R/W OFF
*SM97 The data is sent through COM2. ○ OFF OFF – N R/W OFF
*SM98 Waiting to receive the reply through COM1 ○ OFF OFF – N R OFF
*SM99 Waiting to receive the reply through COM2 ○ OFF OFF – N R OFF
*SM100 Reception through COM1 is complete. ○ OFF OFF – N R/W OFF
*SM101 Reception through COM2 is complete. ○ OFF OFF – N R/W OFF
An error occurs during the reception of the data through
*SM102 COM1 by using the instruction MODRW or the instruction ○ OFF OFF – N R/W OFF
RS.
An error occurs during the reception of the data through
*SM103 COM2 by using the instruction MODRW or the instruction ○ OFF OFF – N R/W OFF
RS.
No data is received through COM1 after a specified period of
*SM104 ○ OFF OFF – N R/W OFF
time.
No data is received through COM2 after a specified period of
*SM105 ○ OFF OFF – N R/W OFF
time.
Choice made by COM1 between the 8-bit processing mode
and the 16-bit processing mode
*SM106 ○ OFF – – N R/W OFF
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
*SM107 ○ OFF – – N R/W OFF
ON: The 8-bit processing mode
OFF: The 16-bit processing mode
SM166 VR0 has been started (need to work with SR166) ○ OFF – – N R/W OFF
SM167 VR1 has been started (need to work with SR167) ○ OFF – – N R/W OFF
SM168 The connection for Function Card 1 has been established. ○ – – – N R OFF
2-12
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-13
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-14
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-15
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-16
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
SM462 Reversing the output direction of axis 1 (Y0.1) ○ OFF OFF – N R/W OFF
*SM463 Stopping the output of Y0.0/axis 1 (Y0.0/Y0.1) ○ OFF OFF – N R/W OFF 2_
SM464 Enabling the positive maximum value for axis 1 (Y0.0/Y0.1) ○ – – – Y R/W OFF
SM465 The alarm of the positive limit for axis 1 (Y0.0/Y0.1) ○ OFF OFF – N R/W OFF
SM466 Enabling the negative maximum value for axis 1 (Y0.0/Y0.1) ○ – – – Y R/W OFF
SM467 The alarm of the negative limit for axis 1 (Y0.0/Y0.1) ○ OFF OFF – N R/W OFF
*SM468 Enabling the S curve ramp-up/down for axis 1 (Y0.0/Y0.1) ○ OFF OFF – N R/W OFF
SM469 Enabling fixed slope ramp-up/down for axis 1 (Y0.0/Y0.1) ○ OFF OFF – N R/W OFF
SM470 Output completion auto-reset for Y0.0/axis 1 (Y0.0/Y0.1) ○ OFF OFF – N R/W OFF
Executing an interrupt I500 when pulse output ends for axis
SM471 ○ OFF OFF – N R/W OFF
1 (Y0.0/Y0.1)
SM472 Y0.1 is outputting. ○ OFF OFF – N R OFF
SM473 The outputting of Y0.1 is complete. ○ OFF OFF – N R/W OFF
*SM474 Stopping the output of Y0.1. ○ OFF OFF – N R/W OFF
SM475 Output completion auto-reset for Y0.1 ○ OFF OFF – N R/W OFF
The output immediately stops when the instruction is
*SM476 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.0/axis 1 (Y0.0/Y0.1)
The output immediately stops when the instruction is
*SM477 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.1
SM480 Y0.2/axis 2 (Y0.2/Y0.3) is outputting. ○ OFF OFF – N R OFF
SM481 The outputting of Y0.2/axis 2 (Y0.2/Y0.3) is complete. ○ OFF OFF – N R/W OFF
SM482 Reversing the output direction of axis 2 (Y0.3) ○ OFF OFF – N R/W OFF
*SM483 Stopping the output of Y0.2/axis 2 (Y0.2/Y0.3) ○ OFF OFF – N R/W OFF
SM484 Enabling the positive maximum value for axis 2 (Y0.2/Y0.3) ○ – – – Y R/W OFF
SM485 The alarm of the positive limit for axis 2 (Y0.2/Y0.3) ○ OFF OFF – N R/W OFF
SM486 Enabling the negative maximum value for axis 2 (Y0.2/Y0.3) ○ – – – Y R/W OFF
SM487 The alarm of the negative limit for axis 2 (Y0.2/Y0.3) ○ OFF OFF – N R/W OFF
*SM488 Enabling the S curve ramp-up/down for axis 2 (Y0.2/Y0.3) ○ OFF OFF – N R/W OFF
SM489 Enabling fixed slope ramp-up/down for axis 2 (Y0.2/Y0.3) ○ OFF OFF – N R/W OFF
SM490 Output completion auto-reset for Y0.2/axis 2 (Y0.2/Y0.3) ○ OFF OFF – N R/W OFF
Executing an interrupt I501 when pulse output ends for axis
SM491 ○ OFF OFF – N R/W OFF
2 (Y0.2/Y0.3)
SM492 Y0.3 is outputting. ○ OFF OFF – N R OFF
SM493 The outputting of Y0.3 is complete. ○ OFF OFF – N R/W OFF
*SM494 Stopping the output of Y0.3. ○ OFF OFF – N R/W OFF
SM495 Output completion auto-reset for Y0.3 ○ OFF OFF – N R/W OFF
The output immediately stops when the instruction is
*SM496 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.2/axis 2 (Y0.2/Y0.3)
The output immediately stops when the instruction is
*SM497 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.3.
SM500 Y0.4/axis 3 (Y0.4/Y0.5) is outputting. ○ OFF OFF – N R OFF
SM501 The outputting of Y0.4/axis 3 (Y0.4/Y0.5) is complete. ○ OFF OFF – N R/W OFF
2-17
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
SM502 Reversing the output direction of axis 3 (Y0.5) ○ OFF OFF – N R/W OFF
_2 *SM503 Stopping the output of Y0.4/axis 3 (Y0.4/Y0.5) ○ OFF OFF – N R/W OFF
SM504 Enabling the positive maximum value for axis 3 (Y0.4/Y0.5) ○ – – – Y R/W OFF
SM505 The alarm of the positive limit for axis 3 (Y0.4/Y0.5) ○ OFF OFF – N R/W OFF
SM506 Enabling the negative maximum value for axis 3 (Y0.4/Y0.5) ○ – – – Y R/W OFF
SM507 The alarm of the negative limit for axis 3 (Y0.4/Y0.5) ○ OFF OFF – N R/W OFF
*SM508 Enabling the S curve ramp-up/down for axis 3 (Y0.4/Y0.5) ○ OFF OFF – N R/W OFF
SM509 Enabling fixed slope ramp-up/down for axis 3 (Y0.4/Y0.5) ○ OFF OFF – N R/W OFF
SM510 Output completion auto-reset for Y0.4/axis 3 (Y0.4/Y0.5) ○ OFF OFF – N R/W OFF
Executing an interrupt I502 when pulse output ends for axis
SM511 ○ OFF OFF – N R/W OFF
3 (Y0.4/Y0.5)
SM512 Y0.5 is outputting. ○ OFF OFF – N R OFF
SM513 The outputting of Y0.5 is complete. ○ OFF OFF – N R/W OFF
*SM514 Stopping the output of Y0.5. ○ OFF OFF – N R/W OFF
SM515 Output completion auto-reset for Y0.5 ○ OFF OFF – N R/W OFF
The output immediately stops when the instruction is
*SM516 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.4/axis 3 (Y0.4/Y0.5)
The output immediately stops when the instruction is
*SM517 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.5
SM520 Y0.6/axis 4 (Y0.6/Y0.7) is outputting. ○ OFF OFF – N R OFF
SM521 The outputting of Y0.6/axis 4 (Y0.6/Y0.7) is complete. ○ OFF OFF – N R/W OFF
SM522 Reversing the output direction of axis 4 (Y0.7) ○ OFF OFF – N R/W OFF
*SM523 Stopping the output of Y0.6/axis 4 (Y0.6/Y0.7) ○ OFF OFF – N R/W OFF
SM524 Enabling the positive maximum value for axis 4 (Y0.6/Y0.7) ○ – – – Y R/W OFF
SM525 The alarm of the positive limit for axis 4 (Y0.6/Y0.7) ○ OFF OFF – N R/W OFF
SM526 Enabling the negative maximum value for axis 4 (Y0.6/Y0.7) ○ – – – Y R/W OFF
SM527 The alarm of the negative limit for axis 4 (Y0.6/Y0.7) ○ OFF OFF – N R/W OFF
*SM528 Enabling the S curve ramp-up/down for axis 4 (Y0.6/Y0.7) ○ OFF OFF – N R/W OFF
SM529 Enabling fixed slope ramp-up/down for axis 4 (Y0.6/Y0.7) ○ OFF OFF – N R/W OFF
SM530 Output completion auto-reset for Y0.6/axis 4 (Y0.6/Y0.7) ○ OFF OFF – N R/W OFF
Executing an interrupt I503 when pulse output ends for axis
SM531 ○ OFF OFF – N R/W OFF
4 (Y0.6/Y0.7)
SM532 Y0.7 is outputting. ○ OFF OFF – N R OFF
SM533 The outputting of Y0.7 is complete. ○ OFF OFF – N R/W OFF
*SM534 Stopping the output of Y0.7. ○ OFF OFF – N R/W OFF
SM535 Output completion auto-reset for Y0.7 ○ OFF OFF – N R/W OFF
The output immediately stops when the instruction is
*SM536 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.6/axis 4 (Y0.6/Y0.7)
The output immediately stops when the instruction is
*SM537 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.7
SM540 Y0.8/axis 5 (Y0.8/Y0.9) is outputting. ○ OFF OFF – N R OFF
SM541 The outputting of Y0.8/axis 5 (Y0.8/Y0.9) is complete. ○ OFF OFF – N R/W OFF
2-18
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
SM542 Reversing the output direction of axis 5 (Y0.9) ○ OFF OFF – N R/W OFF
*SM543 Stopping the output of Y0.8/axis 5 (Y0.8/Y0.9) ○ OFF OFF – N R/W OFF 2_
SM544 Enabling the positive maximum value for axis 5 (Y0.8/Y0.9) ○ – – – Y R/W OFF
SM545 The alarm of the positive limit for axis 5 (Y0.8/Y0.9) ○ OFF OFF – N R/W OFF
SM546 Enabling the negative maximum value for axis 5 (Y0.8/Y0.9) ○ – – – Y R/W OFF
SM547 The alarm of the negative limit for axis 5 (Y0.8/Y0.9) ○ OFF OFF – N R/W OFF
*SM548 Enabling the S curve ramp-up/down for axis 5 (Y0.8/Y0.9) ○ OFF OFF – N R/W OFF
SM549 Enabling fixed slope ramp-up/down for axis 5 (Y0.8/Y0.9) ○ OFF OFF – N R/W OFF
SM550 Output completion auto-reset for Y0.8/axis 5 (Y0.8/Y0.9) ○ OFF OFF – N R/W OFF
Executing an interrupt I504 when pulse output ends for axis
SM551 ○ OFF OFF – N R/W OFF
5 (Y0.8/Y0.9)
SM552 Y0.9 is outputting. ○ OFF OFF – N R OFF
SM553 The outputting of Y0.9 is complete. ○ OFF OFF – N R/W OFF
*SM554 Stopping the output of Y0.9. ○ OFF OFF – N R/W OFF
SM555 Output completion auto-reset for Y0.9 ○ OFF OFF – N R/W OFF
The output immediately stops when the instruction is
*SM556 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.8/axis 5 (Y0.8/Y0.9)
The output immediately stops when the instruction is
*SM557 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.9
SM560 Y0.10/axis 6 (Y0.10/Y0.11) is outputting. ○ OFF OFF – N R OFF
SM561 The outputting of Y0.10/axis 6 (Y0.10/Y0.11) is complete. ○ OFF OFF – N R/W OFF
SM562 Reversing the output direction of axis 6 (Y0.11) ○ OFF OFF – N R/W OFF
*SM563 Stopping the output of Y0.10/axis 6 (Y0.10/Y0.11) ○ OFF OFF – N R/W OFF
Enabling the positive maximum value for axis 6
SM564 ○ – – – Y R/W OFF
(Y0.10/Y0.11)
SM565 The alarm of the positive limit for axis 6 (Y0.10/Y0.11) ○ OFF OFF – N R/W OFF
Enabling the negative maximum value for axis 6
SM566 ○ – – – Y R/W OFF
(Y0.10/Y0.11)
SM567 The alarm of the negative limit for axis 6 (Y0.10/Y0.11) ○ OFF OFF – N R/W OFF
*SM568 Enabling the S curve ramp-up/down for axis 6 (Y0.10/Y0.11) ○ OFF OFF – N R/W OFF
SM569 Enabling fixed slope ramp-up/down for axis 6 (Y0.10/Y0.11) ○ OFF OFF – N R/W OFF
SM570 Output completion auto-reset for Y0.10/axis 6 (Y0.10/Y0.11) ○ OFF OFF – N R/W OFF
Executing an interrupt I505 when pulse output ends for axis
SM571 ○ OFF OFF – N R/W OFF
6 (Y0.10/Y0.11)
SM572 Y0.11 is outputting. ○ OFF OFF – N R OFF
SM573 The outputting of Y0.11 is complete. ○ OFF OFF – N R/W OFF
*SM574 Stopping outputting of the Y0.11. ○ OFF OFF – N R/W OFF
SM575 Output completion auto-reset for Y0.11 ○ OFF OFF – N R/W OFF
The output immediately stops when the instruction is
*SM576 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.10/axis 6 (Y0.10/Y0.11)
The output immediately stops when the instruction is
*SM577 ○ OFF OFF – N R/W OFF
disabled or stops for Y0.11
2-19
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-20
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-21
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-22
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-23
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
COM1
_2 *SM750 Data exchange via COM1 has been enabled by ISPSoft. ○ OFF – – H R/W OFF
*SM752 Connection 1 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM753 Connection 2 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM754 Connection 3 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM755 Connection 4 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM756 Connection 5 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM757 Connection 6 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM758 Connection 7 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM759 Connection 8 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
*SM760 Connection 9 via COM1 for data exchange has been started. ○ OFF – – H R/W OFF
Connection 10 via COM1 for data exchange has been
*SM761 ○ OFF – – H R/W OFF
started.
Connection 11 via COM1 for data exchange has been
*SM762 ○ OFF – – H R/W OFF
started.
Connection 12 via COM1 for data exchange has been
*SM763 ○ OFF – – H R/W OFF
started.
Connection 13 via COM1 for data exchange has been
*SM764 ○ OFF – – H R/W OFF
started.
Connection 14 via COM1 for data exchange has been
*SM765 ○ OFF – – H R/W OFF
started.
Connection 15 via COM1 for data exchange has been
*SM766 ○ OFF – – H R/W OFF
started.
Connection 16 via COM1 for data exchange has been
*SM767 ○ OFF – – H R/W OFF
started.
Connection 17 via COM1 for data exchange has been
*SM768 ○ OFF – – H R/W OFF
started.
Connection 18 via COM1 for data exchange has been
*SM769 ○ OFF – – H R/W OFF
started.
Connection 19 via COM1 for data exchange has been
*SM770 ○ OFF – – H R/W OFF
started.
Connection 20 via COM1 for data exchange has been
*SM771 ○ OFF – – H R/W OFF
started.
Connection 21 via COM1 for data exchange has been
*SM772 ○ OFF – – H R/W OFF
started.
Connection 22 via COM1 for data exchange has been
*SM773 ○ OFF – – H R/W OFF
started.
Connection 23 via COM1 for data exchange has been
*SM774 ○ OFF – – H R/W OFF
started.
Connection 24 via COM1 for data exchange has been
*SM775 ○ OFF – – H R/W OFF
started.
Connection 25 via COM1 for data exchange has been
*SM776 ○ OFF – – H R/W OFF
started.
Connection 26 via COM1 for data exchange has been
*SM777 ○ OFF – – H R/W OFF
started.
2-24
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-25
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
data exchange.
_2 *SM802
The data has been received via COM 1 connection 19 for
○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 20 for
*SM803 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 21 for
*SM804 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 22 for
*SM805 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 23 for
*SM806 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 24 for
*SM807 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 25 for
*SM808 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 26 for
*SM809 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 27 for
*SM810 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 28 for
*SM811 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 29 for
*SM812 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 30 for
*SM813 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 31 for
*SM814 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 1 connection 32 for
*SM815 ○ OFF – – N R OFF
data exchange.
*SM816 An error occurs in the COM1 connection 1 for data exchange ○ OFF – – N R OFF
*SM817 An error occurs in the COM1 connection 2 for data exchange ○ OFF – – N R OFF
*SM818 An error occurs in the COM1 connection 3 for data exchange ○ OFF – – N R OFF
*SM819 An error occurs in the COM1 connection 4 for data exchange ○ OFF – – N R OFF
*SM820 An error occurs in the COM1 connection 5 for data exchange ○ OFF – – N R OFF
*SM821 An error occurs in the COM1 connection 6 for data exchange ○ OFF – – N R OFF
*SM822 An error occurs in the COM1 connection 7 for data exchange ○ OFF – – N R OFF
*SM823 An error occurs in the COM1 connection 8 for data exchange ○ OFF – – N R OFF
*SM824 An error occurs in the COM1 connection 9 for data exchange ○ OFF – – N R OFF
An error occurs in the COM1 connection 10 for data
*SM825 ○ OFF – – N R OFF
exchange
An error occurs in the COM1 connection 11 for data
*SM826 ○ OFF – – N R OFF
exchange
An error occurs in the COM1 connection 12 for data
*SM827 ○ OFF – – N R OFF
exchange
An error occurs in the COM1 connection 13 for data
*SM828 ○ OFF – – N R OFF
exchange
2-26
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-27
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
*SM869 Connection 6 via COM2 for data exchange has been started. ○ OFF – – H R/W OFF
_2 *SM870 Connection 7 via COM2 for data exchange has been started. ○ OFF – – H R/W OFF
*SM871 Connection 8 via COM2 for data exchange has been started. ○ OFF – – H R/W OFF
*SM872 Connection 9 via COM2 for data exchange has been started. ○ OFF – – H R/W OFF
Connection 10 via COM2 for data exchange has been
*SM873 ○ OFF – – H R/W OFF
started.
Connection 11 via COM2 for data exchange has been
*SM874 ○ OFF – – H R/W OFF
started.
Connection 12 via COM2 for data exchange has been
*SM875 ○ OFF – – H R/W OFF
started.
Connection 13 via COM2 for data exchange has been
*SM876 ○ OFF – – H R/W OFF
started.
Connection 14 via COM2 for data exchange has been
*SM877 ○ OFF – – H R/W OFF
started.
Connection 15 via COM2 for data exchange has been
*SM878 ○ OFF – – H R/W OFF
started.
Connection 16 via COM2 for data exchange has been
*SM879 ○ OFF – – H R/W OFF
started.
Connection 17 via COM2 for data exchange has been
*SM880 ○ OFF – – H R/W OFF
started.
Connection 18 via COM2 for data exchange has been
*SM881 ○ OFF – – H R/W OFF
started.
Connection 19 via COM2 for data exchange has been
*SM882 ○ OFF – – H R/W OFF
started.
Connection 20 via COM2 for data exchange has been
*SM883 ○ OFF – – H R/W OFF
started.
Connection 21 via COM2 for data exchange has been
*SM884 ○ OFF – – H R/W OFF
started.
Connection 22 via COM2 for data exchange has been
*SM885 ○ OFF – – H R/W OFF
started.
Connection 23 via COM2 for data exchange has been
*SM886 ○ OFF – – H R/W OFF
started.
Connection 24 via COM2 for data exchange has been
*SM887 ○ OFF – – H R/W OFF
started.
Connection 25 via COM2 for data exchange has been
*SM888 ○ OFF – – H R/W OFF
started.
Connection 26 via COM2 for data exchange has been
*SM889 ○ OFF – – H R/W OFF
started.
Connection 27 via COM2 for data exchange has been
*SM890 ○ OFF – – H R/W OFF
started.
Connection 28 via COM2 for data exchange has been
*SM891 ○ OFF – – H R/W OFF
started.
Connection 29 via COM2 for data exchange has been
*SM892 ○ OFF – – H R/W OFF
started.
Connection 30 via COM2 for data exchange has been
*SM893 ○ OFF – – H R/W OFF
started.
*SM894 Connection 31 via COM2 for data exchange has been ○ OFF – – H R/W OFF
2-28
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
started.
*SM895
Connection 32 via COM2 for data exchange has been
○ OFF – – H R/W OFF 2_
started.
The data has been received via COM 2 connection 1 for data
*SM896 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 2 for data
*SM897 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 3 for data
*SM898 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 4 for data
*SM899 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 5 for data
*SM900 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 6 for data
*SM901 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 7 for data
*SM902 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 8 for data
*SM903 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 9 for data
*SM904 ○ OFF – – N R OFF
exchange.
The data has been received via COM 2 connection 10 for
*SM905 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 11 for
*SM906 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 12 for
*SM907 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 13 for
*SM908 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 14 for
*SM909 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 15 for
*SM910 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 16 for
*SM911 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 17 for
*SM912 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 18 for
*SM913 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 19 for
*SM914 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 20 for
*SM915 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 21 for
*SM916 ○ OFF – – N R OFF
data exchange.
The data has been received via COM 2 connection 22 for
*SM917 ○ OFF – – N R OFF
data exchange.
2-29
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-30
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
exchange
*SM946
An error occurs in the COM2 connection 19 for data
○ OFF – – N R OFF 2_
exchange
An error occurs in the COM2 connection 20 for data
*SM947 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 21 for data
*SM948 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 22 for data
*SM949 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 23 for data
*SM950 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 24 for data
*SM951 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 25 for data
*SM952 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 26 for data
*SM953 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 27 for data
*SM954 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 28 for data
*SM955 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 29 for data
*SM956 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 30 for data
*SM957 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 31 for data
*SM958 ○ OFF – – N R OFF
exchange
An error occurs in the COM2 connection 32 for data
*SM959 ○ OFF – – N R OFF
exchange
It is the Ethernet setting flag. When SM1000 is ON, the data
SM1000 ○ OFF – – N R/W OFF
in SR1000~SR1006 is written into the flash memory.
SM1001 The state of the Ethernet connectivity ○ OFF – – N R OFF
*SM1090 The TCP connection is busy. ○ OFF – – N R OFF
*SM1091 The UDP connection is busy. ○ OFF – – N R OFF
SM1100 The network cable is not connected ○ OFF – – N R OFF
*SM1106 Basic management─Ethernet connection error ○ OFF – – N R OFF
*SM1107 Basic management of Ethernet─Basic setting error ○ OFF – – N R OFF
Basic management of the TCP/UDP socket─The local port is
*SM1109 ○ OFF – – N R OFF
already used.
SM1111 EtherNet/IP data exchange flag ○ OFF – – N R OFF
*SM1113 Email service error ○ OFF – – N R OFF
*SM1116 It is the switch of trigger 1 in the email. ○ OFF – – N R OFF
*SM1117 Trigger 1 in the email ○ OFF – – N R OFF
When trigger 1 is triggered and the email has been sent
*SM1119 ○ OFF – – N R OFF
successfully; SM1119 is ON.
2-31
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-32
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
*SM1153
When trigger 4 is triggered and there is an SMTP server
○ OFF – – N R OFF 2_
response error, SM1153 is ON.
When trigger 4 is triggered and the size of the attachment
*SM1154 ○ OFF – – N R OFF
exceeds the limit, SM1154 is ON.
When trigger 4 is triggered and the attachment is not found,
*SM1155 ○ OFF – – N R OFF
SM1155 is ON.
An error occurs in the initialization of the data exchange via
*SM1166 ○ – – – N R OFF
Ethernet port.
Data exchange via Ethernet port has been enabled by
*SM1167 ○ OFF – – H R/W OFF
ISPSoft.
Connection 1 via Ethernet port for data exchange has been
*SM1168 ○ OFF – – H R/W OFF
started.
Connection 2 via Ethernet port for data exchange has been
*SM1169 ○ OFF – – H R/W OFF
started.
Connection 3 via Ethernet port for data exchange has been
*SM1170 ○ OFF – – H R/W OFF
started.
Connection 4 via Ethernet port for data exchange has been
*SM1171 ○ OFF – – H R/W OFF
started.
Connection 5 via Ethernet port for data exchange has been
*SM1172 ○ OFF – – H R/W OFF
started.
Connection 6 via Ethernet port for data exchange has been
*SM1173 ○ OFF – – H R/W OFF
started.
Connection 7 via Ethernet port for data exchange has been
*SM1174 ○ OFF – – H R/W OFF
started.
Connection 8 via Ethernet port for data exchange has been
*SM1175 ○ OFF – – H R/W OFF
started.
Connection 9 via Ethernet port for data exchange has been
*SM1176 ○ OFF – – H R/W OFF
started.
Connection 10 via Ethernet port for data exchange has been
*SM1177 ○ OFF – – H R/W OFF
started.
Connection 11 via Ethernet port for data exchange has been
*SM1178 ○ OFF – – H R/W OFF
started.
Connection 12 via Ethernet port for data exchange has been
*SM1179 ○ OFF – – H R/W OFF
started.
Connection 13 via Ethernet port for data exchange has been
*SM1180 ○ OFF – – H R/W OFF
started.
Connection 14 via Ethernet port for data exchange has been
*SM1181 ○ OFF – – H R/W OFF
started.
Connection 15 via Ethernet port for data exchange has been
*SM1182 ○ OFF – – H R/W OFF
started.
Connection 16 via Ethernet port for data exchange has been
*SM1183 ○ OFF – – H R/W OFF
started.
Connection 17 via Ethernet port for data exchange has been
*SM1184 ○ OFF – – H R/W OFF
started.
Connection 18 via Ethernet port for data exchange has been
*SM1185 ○ OFF – – H R/W OFF
started.
2-33
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-34
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
*SM1210
The data has been received via Ethernet port connection 11
○ OFF – – N R OFF 2_
for data exchange.
The data has been received via Ethernet port connection 12
*SM1211 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 13
*SM1212 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 14
*SM1213 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 15
*SM1214 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 16
*SM1215 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 17
*SM1216 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 18
*SM1217 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 19
*SM1218 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 20
*SM1219 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 21
*SM1220 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 22
*SM1221 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 23
*SM1222 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 24
*SM1223 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 25
*SM1224 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 26
*SM1225 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 27
*SM1226 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 28
*SM1227 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 29
*SM1228 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 30
*SM1229 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 31
*SM1230 ○ OFF – – N R OFF
for data exchange.
The data has been received via Ethernet port connection 32
*SM1231 ○ OFF – – N R OFF
for data exchange.
An error occurs in the Ethernet port connection 1 for data
*SM1232 ○ OFF – – N R OFF
exchange
2-35
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-36
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
exchange
*SM1257
An error occurs in the Ethernet port connection 26 for data
○ OFF – – N R OFF 2_
exchange
An error occurs in the Ethernet port connection 27 for data
*SM1258 ○ OFF – – N R OFF
exchange
An error occurs in the Ethernet port connection 28 for data
*SM1259 ○ OFF – – N R OFF
exchange
An error occurs in the Ethernet port connection 29 for data
*SM1260 ○ OFF – – N R OFF
exchange
An error occurs in the Ethernet port connection 30 for data
*SM1261 ○ OFF – – N R OFF
exchange
An error occurs in the Ethernet port connection 31 for data
*SM1262 ○ OFF – – N R OFF
exchange
An error occurs in the Ethernet port connection 32 for data
*SM1263 ○ OFF – – N R OFF
exchange
SM1269 Socket configuration error ○ OFF – – N R/W OFF
SM1270 TCP socket 1─The connection is successful. ○ OFF – – N R OFF
SM1271 TCP socket 1─The data has been received. ○ OFF – – N R OFF
SM1272 TCP socket 1─The data has been sent. ○ OFF – – N R OFF
SM1273 TCP socket 1─The connection is being started. ○ OFF – – N R OFF
SM1274 TCP socket 1─The connection is being closed. ○ ON – – Y R ON
SM1275 TCP socket 1─The data is being sent. ○ OFF – – N R OFF
SM1277 TCP socket 1─Error flag ○ OFF – – N R OFF
SM1278 TCP socket 2─The connection is successful. ○ OFF – – N R OFF
SM1279 TCP socket 2─The data has been received. ○ OFF – – N R OFF
SM1280 TCP socket 2─The data has been sent. ○ OFF – – N R OFF
SM1281 TCP socket 2─The connection is being started. ○ OFF – – N R OFF
SM1282 TCP socket 2─The connection is being closed. ○ ON – – Y R ON
SM1283 TCP socket 2─The data is being sent. ○ OFF – – N R OFF
SM1285 TCP socket 2─Error flag ○ OFF – – N R OFF
SM1286 TCP socket 3The connection is successful. ○ OFF – – N R OFF
SM1287 TCP socket 3─The data has been received. ○ OFF – – N R OFF
SM1288 TCP socket 3─The data has been sent. ○ OFF – – N R OFF
SM1289 TCP socket 3─The connection is being started. ○ OFF – – N R OFF
SM1290 TCP socket 3─The connection is being closed. ○ ON – – Y R ON
SM1291 TCP socket 3─The data is being sent. ○ OFF – – N R OFF
SM1293 TCP socket 3─Error flag ○ OFF – – N R OFF
SM1294 TCP socket 4─The connection is successful. ○ OFF – – N R OFF
SM1295 TCP socket 4─The data has been received. ○ OFF – – N R OFF
SM1296 TCP socket 4─The data has been sent. ○ OFF – – N R OFF
SM1297 TCP socket 4─The connection is being started. ○ OFF – – N R OFF
SM1298 TCP socket 4─The connection is being closed. ○ ON – – Y R ON
SM1299 TCP socket 4─The data is being sent. ○ OFF – – N R OFF
2-37
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-38
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-39
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
exchange
_2 SM1411
An error occurs in the EtherNet/IP connection 4 for data
○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 5 for data
SM1412 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 6 for data
SM1413 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 7 for data
SM1414 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 8 for data
SM1415 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 9 for data
SM1416 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 10 for data
SM1417 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 11 for data
SM1418 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 12 for data
SM1419 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 13 for data
SM1420 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 14 for data
SM1421 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 15 for data
SM1422 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 16 for data
SM1423 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 17 for data
SM1424 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 18 for data
SM1425 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 19 for data
SM1426 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 20 for data
SM1427 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 21 for data
SM1428 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 22 for data
SM1429 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 23 for data
SM1430 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 24 for data
SM1431 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 25 for data
SM1432 ○ OFF – – N R OFF
exchange
An error occurs in the EtherNet/IP connection 26 for data
SM1433 ○ OFF – – N R OFF
exchange
2-40
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
2-41
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SM Function
ON RUN STOP
SM1655 Servo is ON for the axis 5 of ASD-A2 CAN ○ OFF OFF – N R OFF
_2 SM1656 Servo is ON for the axis 6 of ASD-A2 CAN ○ OFF OFF – N R OFF
SM1657 Servo is ON for the axis 7 of ASD-A2 CAN ○ OFF OFF – N R OFF
SM1658 Servo is ON for the axis 8 of ASD-A2 CAN ○ OFF OFF – N R OFF
The function of going back and forth is enabled for the axis 1
SM1661 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The function of going back and forth is enabled for the axis 2
SM1662 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The function of going back and forth is enabled for the axis 3
SM1663 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The function of going back and forth is enabled for the axis 4
SM1664 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The function of going back and forth is enabled for the axis 5
SM1665 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The function of going back and forth is enabled for the axis 6
SM1666 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The function of going back and forth is enabled for the axis 7
SM1667 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The function of going back and forth is enabled for the axis 8
SM1668 ○ OFF OFF – N R/W OFF
of ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 1 of
SM1671 ○ OFF OFF – N R OFF
ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 2 of
SM1672 ○ OFF OFF – N R OFF
ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 3 of
SM1673 ○ OFF OFF – N R OFF
ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 4 of
SM1674 ○ OFF OFF – N R OFF
ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 5 of
SM1675 ○ OFF OFF – N R OFF
ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 6 of
SM1676 ○ OFF OFF – N R OFF
ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 7 of
SM1677 ○ OFF OFF – N R OFF
ASD-A2 CAN.
The go-back/go-forth direction indication flag for the axis 8 of
SM1678 ○ OFF OFF – N R OFF
ASD-A2 CAN.
Initialization and communication are completed for ASD-A2
SM1681 ○ OFF OFF – N R OFF
CAN.
SM1682 The CANopen communication error flag for ASD-A2 CAN ○ OFF OFF – N R OFF
*1: For items with a * mark, please refer to the additional remark for Additional Remarks on Special Auxiliary Relays and
Special Data Registers for details.
*2: The system will execute according to the parameters set in HWCONFIG, when the power of SM is from
*3: The communication card here means AS-F232, AS-F422 and AS-F485.
2-42
C ha pt er 2 D e v ic es
2-43
A S S er i es Pr og r am m ing M an u a l
Special auxiliary
Refresh time
relay
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.
SM104~SM105
The flag is set to ON when there is a receive timeout.
Users set the flag to ON and reset it to OFF.
SM106~SM107 ON: The 8-bit mode
_2 OFF: The 16-bit mode
SM166~SM167 Users set the flag to ON and reset it to OFF.
SM168~SM171 The system automatically sets the flag to ON, and reset it to OFF.
Users set the flag to ON, and the system automatically resets it to OFF.
SM204~SM205
ON: Clearing the non-latched/latched areas
Users set SM206 to ON and reset it to OFF.
SM206
ON: Inhibiting all output
Users set SM209 to ON, and the system automatically resets it to OFF.
SM209
ON: The communication protocol of COM1 changes.
Users set SM210 to ON and reset it to OFF for COM1.
SM210 ON: The RTU mode
OFF: The ASCII mode
Users set SM211 to ON, and the system automatically resets it to OFF.
SM211
ON: The communication protocol of COM2 changes.
Users set SM210 to ON and reset it to OFF for COM2.
SM212 ON: The RTU mode
OFF: The ASCII mode
Users set SM215 to ON and reset it to OFF.
SM215 ON: The PLC runs.
OFF: The PLC stops.
The system checks the real-time clock when power-on.
SM218 ON: when the real-time clock is malfunction
Users reset it to OFF.
The system monitors the battery power of the real-time clock.
SM219 ON: when the power is low
The system resets it to OFF.
Users set SM220 to ON and reset it to OFF.
SM220
ON: Calibrating the real-time clock within ±30 seconds
The flag is refreshed according to the settings in HWCONFIG or when the instruction API1607
SM221 DST is executed.
ON: the instruction DST is executed.
The flag is ON when the instruction CSFO is executed.
SM270 ~ SM275 ON: enabling the function of reversing the input direction
OFF: disabling the function of reversing the input direction
Users set the flag to ON and reset it to OFF.
SM281~SM288 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM291~SM296 ON: enabling the function of clearing the input points
OFF: disabling the function of clearing the input points
Users set the flag to ON and reset it to OFF.
SM300 ON: counting down
OFF: counting up
2-44
C ha pt er 2 D e v ic es
Special auxiliary
Refresh time
relay
The system set the flag to ON and reset it to OFF.
SM301~SM303 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM304 ON: counting down
OFF: counting up 2_
Users set the flag to ON and reset it to OFF.
SM305~SM307 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM308 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM309~SM311 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM312 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM313~SM315 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM316 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM317~SM319 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM320 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM321~SM323 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM332 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM333~SM335 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM336 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM337~SM339 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM340 ON: counting down
OFF: counting up
2-45
A S S er i es Pr og r am m ing M an u a l
Special auxiliary
Refresh time
relay
Users set the flag to ON and reset it to OFF.
SM341 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM342 ON: counting down
_2 OFF: counting up
Users set the flag to ON and reset it to OFF.
SM343 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM344 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM345 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM346 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM347 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM348 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM349 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM350 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM351 ON: counting down
OFF: counting up
Users set the flag to ON and reset it to OFF.
SM352~SM353 ON: counting down
OFF: counting up
The system automatically sets the flag to ON and resets it to OFF.
SM400~SM403
The flag is refreshed every scan cycle.
The system automatically sets the flag to ON and resets it to OFF.
SM404
SM404 is refreshed every 5 milliseconds.
The system automatically sets SM405 to ON and resets it to OFF.
SM405
SM405 is refreshed every 50 milliseconds.
The system automatically sets SM406 to ON and resets it to OFF.
SM406
SM406 is refreshed every 100 milliseconds.
The system automatically sets SM407 to ON and resets it to OFF.
SM407
SM407 is refreshed every 0.5 seconds.
The system automatically sets SM450 to ON and resets it to OFF.
SM450
ON: The memory card is inserted into the PLC.
2-46
C ha pt er 2 D e v ic es
Special auxiliary
Refresh time
relay
OFF: The memory card is removed out of the PLC.
SM452~SM453 The system sets the flag to ON or OFF.
SM454 Users set the flag to ON or OFF.
SM455 The system sets the flag to ON or OFF.
SM456 Users set the flag to ON to save. After the saving is complete, the system resets it to OFF.
SM457 The system sets the flag to ON or OFF.
2_
SM460 The system sets the flag to ON or OFF.
SM461 The system sets the flag to ON and users reset it to OFF.
SM462~SM464 Users set the flag to ON or OFF.
SM465 The system sets the flag to ON and users reset it to OFF.
SM466 Users set the flag to ON or OFF.
SM467 The system sets the flag to ON and users reset it to OFF.
SM468~SM471 Users set the flag to ON or OFF.
SM472 The system sets the flag to ON or OFF.
SM473 The system sets the flag to ON and users reset it to OFF.
SM474~SM477 Users set the flag to ON or OFF.
SM480 The system sets the flag to ON or OFF.
SM481 The system sets the flag to ON and users reset it to OFF.
SM482~SM484 Users set the flag to ON or OFF.
SM485 The system sets the flag to ON and users reset it to OFF.
SM486 Users set the flag to ON or OFF.
SM487 The system sets the flag to ON and users reset it to OFF.
SM488~SM491 Users set the flag to ON or OFF.
SM492 The system sets the flag to ON or OFF.
SM493 The system sets the flag to ON and users reset it to OFF.
SM494~SM497 Users set the flag to ON or OFF.
SM500 The system sets the flag to ON or OFF.
SM501 The system sets the flag to ON and users reset it to OFF.
SM502~SM504 Users set the flag to ON or OFF.
SM505 The system sets the flag to ON and users reset it to OFF.
SM506 Users set the flag to ON or OFF.
SM507 The system sets the flag to ON and users reset it to OFF.
SM508~SM511 Users set the flag to ON or OFF.
SM512 The system sets the flag to ON or OFF.
SM513 The system sets the flag to ON and users reset it to OFF.
SM514~SM517 Users set the flag to ON or OFF.
SM520 The system sets the flag to ON or OFF.
SM521 The system sets the flag to ON and users reset it to OFF.
SM522~SM524 Users set the flag to ON or OFF.
SM525 The system sets the flag to ON and users reset it to OFF.
SM526 Users set the flag to ON or OFF.
SM527 The system sets the flag to ON and users reset it to OFF.
SM528~SM531 Users set the flag to ON or OFF.
SM532 The system sets the flag to ON or OFF.
SM533 The system sets the flag to ON and users reset it to OFF.
SM534~SM537 Users set the flag to ON or OFF.
2-47
A S S er i es Pr og r am m ing M an u a l
Special auxiliary
Refresh time
relay
SM540 The system sets the flag to ON or OFF.
SM541 The system sets the flag to ON and users reset it to OFF.
SM542~SM544 Users set the flag to ON or OFF.
SM545 The system sets the flag to ON and users reset it to OFF.
2-48
C ha pt er 2 D e v ic es
Special auxiliary
Refresh time
relay
SM693 The flag is refreshed when the instruction SEGL is executed.
SM694 The flag is refreshed when the instruction DSW is executed.
SM695 Users set the flag to ON or OFF.
Every time after the parameters of data exchange are downloaded, the system is refreshed when
SM749
power-on.
SM750~SM783 After the parameters of data exchange are downloaded, users set the flag to ON or OFF.
2_
SM784~SM847 The flag is ON when the system is refreshed.
Every time after the parameters of data exchange are downloaded, the system is refreshed when
SM861
power-on.
SM862~SM895 After the parameters of data exchange are downloaded, users set the flag to ON or OFF.
SM896~SM959 The flag is ON, when the system is refreshed automatically.
SM1000 Users set the flag to ON and after saving; the system sets the flag to OFF.
The flag is ON, when the Ethernet connection is active.
SM1001
The flag is OFF, when the Ethernet connection is not active.
SM1090 SM1090 is ON when the TCP connection is busy.
SM1091 SM1091 is ON when the UDP connection is busy.
SM1100 The flag is refreshed when API2200-API2210 is executed or the network cable is reconnected.
SM1106 SM1106 is ON when the PHY initialization fails.
SM1107 is ON when the IP address, the netmask address, and the gateway address are set
SM1107
incorrectly.
SM1109 SM1109 is ON when the function of the socket is enabled and the same port is used.
SM1111 Users set the flag to ON or OFF.
SM1113 The flag is ON, when there is a server error.
SM1116 SM1116 is ON when the trigger of the PLC parameter is enabled.
SM1117 SM1117 is ON when the trigger of the PLC parameter is triggered.
SM1119 SM1119 is ON when the trigger is enabled and the last mail has been sent successfully.
SM1120 SM1120 is ON when the trigger is enabled and the last mail has been sent in error.
SM1122~SM1123 The flag is ON when the trigger is enabled and there is an SMTP server response timeout.
SM1124 SM1124 is ON when the trigger is enabled and the size of the attachment exceeds the limit.
SM1125 SM1125 is ON when the trigger is enabled and the attachment is not found.
SM1126~SM1127 The flag is ON when the trigger of the PLC parameter is enabled.
SM1129 SM1129 is ON when the trigger is enabled and the last mail has been sent successfully.
SM1130 SM1130 is ON when the trigger is enabled and the last mail has been sent in error.
SM1132 SM1132 is ON when the trigger is enabled and there is an SMTP server response timeout.
SM1133 SM1133 is ON when the trigger is enabled and there is an SMTP server response error.
SM1134 SM1134 is ON when the trigger is enabled and the size of the attachment exceeds the limit.
SM1135 SM1135 is ON when the trigger is enabled and the attachment is not found.
SM1136 SM1136 is ON when the trigger of the PLC parameter is enabled.
SM1137 SM1137 is ON when the trigger of the PLC parameter is triggered.
SM1139 SM1139 is ON when the trigger is enabled and the last mail has been sent successfully.
SM1140 SM1140 is ON when the trigger is enabled and the last mail has been sent in error.
SM1142 SM1142 is ON when the trigger is enabled and there is an SMTP server response timeout.
SM1143 SM1143 is ON when the trigger is enabled and there is an SMTP server response error.
SM1144 SM1144 is ON when the trigger is enabled and the size of the attachment exceeds the limit.
SM1145 SM1145 is ON when the trigger is enabled and the attachment is not found.
2-49
A S S er i es Pr og r am m ing M an u a l
Special auxiliary
Refresh time
relay
SM1146 SM1146 is ON when the trigger of the PLC parameter is enabled.
SM1147 SM1147 is ON when the trigger of the PLC parameter is triggered.
SM1149 SM1149 is ON when the trigger is enabled and the last mail has been sent successfully.
SM1150 SM1150 is ON when the trigger is enabled and the last mail has been sent in error.
_2 SM1152 SM1152 is ON when the trigger is enabled and there is an SMTP server response timeout.
SM1153 SM1153 is ON when the trigger is enabled and there is an SMTP server response error.
SM1154 SM1154 is ON when the trigger is enabled and the size of the attachment exceeds the limit.
SM1155 SM1155 is ON when the trigger is enabled and the attachment is not found.
SM1166 After the parameters of data exchange are downloaded, the system is refreshed.
SM1167~SM1199 After the parameters of data exchange are downloaded, users set the flag to ON or OFF.
SM1200~SM1263 The flag is ON, when the system is refreshed.
SM1269 The flag is ON, when there is a socket configuration error.
SM1270~SM1353 The flag is refreshed when the socket function is executed.
After the parameters of data exchange via EtherNet/IP are downloaded, users set the flag to ON
SM1375~SM1407
or OFF.1.
SM1408~SM1439 The flag is ON when an error occurs in data exchange via EtherNet/IP.
SM1440~SM1447 The flag is ON when a timeout occurs in the slave of the I/O connection via EtherNet/IP
SM1631~SM1638 The system sets the flag to ON and users set it to OFF.
SM1641~SM1648 Users set the flag to ON or OFF.
SM1651~SM1658 The system sets the flag to ON or OFF.
SM1661~SM1668 Users set the flag to ON or OFF.
SM1671~SM1682 The system sets the flag to ON or OFF.
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 cannot 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. 1 millisecond timer: The timer specified by the instruction TMRH takes 1 millisecond as the timing unit.
3. The accumulative timers are ST0~ST511. If users want to use the device-monitoring function, they can monitor
T0~T511.
4. 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.
5. If the same timer is used repeatedly in the program, it is OFF when one of the conditional contacts is OFF.
6. 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.
2-50
C ha pt er 2 D e v ic es
7. When the timer is switched from ON to OFF and the conditional contact is ON, the timer is reset and counts again.
8. 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 (value of the timer ≧ setting value), the state of the contact is ON.
A. 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. 2_
1. When X0.0=ON and the timer takes 100ms as the timing unit, the output coil T0 will be ON, when the value of
the timer = setting value100.
2. When X0.0=OFF or the power is off, the value of the timer is 0 and the output coil T0 will be OFF.
10 sec
X0. 0
SV: K100
T0(PV)
Y0. 0
B. 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 will count from the current value.
3. When X0.0=ON and the timer T250 takes 100ms as the timing unit, the output coil T250 will be ON, when the
value of the timer = setting value100.
4. When X0.0=OFF or the power is off, the timer T250 stops counting, and the value of the timer stays the same.
When X0.0=ON, the value of the timer will be accumulated and when the accumulated value = setting value
100, the output coil T250 will be ON.
2-51
A S S er i es Pr og r am m ing M an u a l
_2
T1 T2 T1+T2=10 sec
X0. 0
SV: K100
T250(PV)
Y0. 0
T412~T511 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
cannot count correctly.
2.2.11 Counters
Characteristics of the 16-bit counter
Each time the input switches from OFF to ON, the value of the counter is the same as the output coil. Users can use
either the decimal constant or the value in the data register as the setting value.
2-52
C ha pt er 2 D e v ic es
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.
2_
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 data 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 0.
1. When X0.0=ON, the instruction RST will be executed and the current value of C0 will be reset to zero and the output
contact of the counter C0 will be FF.
2. When X0.1 is from OFF to ON, the value of the counter increases by one increment.
3. When the value of the counter C0 reached the setting value 5, the contact of the counter C0 will be ON (the current
value of C0 = the setting value = 5). After that the trigger from X0.1 will not be accepted by C0 and the current value
of C0 will stay at the value 5.
2-53
A S S er i es Pr og r am m ing M an u a l
X 0.0
X 0.1
5
4 (SV)
C0 ( PV )
_2 3
2
1
0 0
Y 0.0 ,C0
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.
2-54
C ha pt er 2 D e v ic es
Please refer to the instruction description of API1004 DCNT in AS Series Programming Manual for more details.
Example:
2_
2. When X11.0 goes from OFF to ON, RST instruction will be executed and the PV in HC0 will be cleared to 0 and its
contact is OFF.
3. When X12.0 goes from OFF to ON, PV of HC0 will count up (plus 1) or count down (minus 1).
4. When PV in HC0 changes from -6 to -5, the contact HC0 will go from OFF to ON. When PV in HC0 changes from -5
to -6, the contact HC0 will go from ON to OFF.
5. If MOV instruction is applied through ISPSoft to designate a value bigger than SV to the PV register of HC0, next
time when X12.0 goes from OFF to ON, the contact HC0 will be ON and PV of HC0 will equal SV.
Accu mul ati vel y Accu mul ati vel y
X10.0 i ncr ea sin g P rog re ssive ly i ncr ea sin g
d ecre asi ng
X11.0
X12.0
5
4 4
3 3
HC0 2 2
1 1
(PV )
0 0 0
-1
-2
-3 -3
-4 -4
-5 -5
-6 -6
Wh en t he o u tpu t c on tact w as O N -7 -7
-8
Y0.0,
HC0 Con tacts
2-55
A S S er i es Pr og r am m ing M an u a l
The registers can be classified into two types according to their properties.
1. General-purpose register: When 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 when 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.
Attribute
Latched
SR Function
ON RUN STOP
2-56
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-57
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-58
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-59
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-60
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-61
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-62
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-63
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
*SR344 PLC status change log 9: The year and the month ○ - - - Y R 0
_2 *SR345 PLC status change log 9: The day and the hour ○ - - - Y R 0
*SR346 PLC status change log 9: The minute and the second ○ - - - Y R 0
*SR347 PLC status change log 10: The action number ○ - - - Y R 0
*SR348 PLC status change log 10: The year and the month ○ - - - Y R 0
*SR349 PLC status change log 10: The day and the hour ○ - - - Y R 0
*SR350 PLC status change log 10: The minute and the second ○ - - - Y R 0
*SR351 PLC status change log 11: The action number ○ - - - Y R 0
*SR352 PLC status change log 11: The year and the month ○ - - - Y R 0
*SR353 PLC status change log 11: The day and the hour ○ - - - Y R 0
*SR354 PLC status change log 11: The minute and the second ○ - - - Y R 0
*SR355 PLC status change log 12: The action number ○ - - - Y R 0
*SR356 PLC status change log 12: The year and the month ○ - - - Y R 0
*SR357 PLC status change log 12: The day and the hour ○ - - - Y R 0
*SR358 PLC status change log 12: The minute and the second ○ - - - Y R 0
*SR359 PLC status change log 13: The action number ○ - - - Y R 0
*SR360 PLC status change log 13: The year and the month ○ - - - Y R 0
*SR361 PLC status change log 13: The day and the hour ○ - - - Y R 0
*SR362 PLC status change log 13: The minute and the second ○ - - - Y R 0
*SR363 PLC status change log 14: The action number ○ - - - Y R 0
*SR364 PLC status change log 14: The year and the month ○ - - - Y R 0
*SR365 PLC status change log 14: The day and the hour ○ - - - Y R 0
*SR366 PLC status change log 14: The minute and the second ○ - - - Y R 0
*SR367 PLC status change log 15: The action number ○ - - - Y R 0
*SR368 PLC status change log 15: The year and the month ○ - - - Y R 0
*SR369 PLC status change log 15: The day and the hour ○ - - - Y R 0
*SR370 PLC status change log 15: The minute and the second ○ - - - Y R 0
*SR371 PLC status change log 16: The action number ○ - - - Y R 0
*SR372 PLC status change log 16: The year and the month ○ - - - Y R 0
*SR373 PLC status change log 16: The day and the hour ○ - - - Y R 0
*SR374 PLC status change log 16: The minute and the second ○ - - - Y R 0
*SR375 PLC status change log 17: The action number ○ - - - Y R 0
*SR376 PLC status change log 17: The year and the month ○ - - - Y R 0
*SR377 PLC status change log 17: The day and the hour ○ - - - Y R 0
*SR378 PLC status change log 17: The minute and the second ○ - - - Y R 0
*SR379 PLC status change log 18: The action number ○ - - - Y R 0
*SR380 PLC status change log 18: The year and the month ○ - - - Y R 0
*SR381 PLC status change log 18: The day and the hour ○ - - - Y R 0
*SR382 PLC status change log 18: The minute and the second ○ - - - Y R 0
*SR383 PLC status change log 19: The action number ○ - - - Y R 0
*SR384 PLC status change log 19: The year and the month ○ - - - Y R 0
2-64
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
*SR385 PLC status change log 19: The day and the hour ○ - - - Y R 0
*SR386 PLC status change log 19: The minute and the second ○ - - - Y R 0 2_
*SR387 PLC status change log 20: The action number ○ - - - Y R 0
*SR388 PLC status change log 20: The year and the month ○ - - - Y R 0
*SR389 PLC status change log 20: The day and the hour ○ - - - Y R 0
*SR390 PLC status change log 20: The minute and the second ○ - - - Y R 0
Value of the year in the real-time clock (RTC): 00~99
*SR391 ○ - - - Y R 0
(A.D.)
*SR392 Value of the month in the real-time clock (RTC): 01~12 ○ - - - Y R 1
*SR393 Value of the day in the real-time clock (RTC): 1~31 ○ - - - Y R 1
*SR394 Value of the hour in the real-time clock (RTC): 00~23 ○ - - - Y R 0
*SR395 Value of the minute in the real-time clock (RTC): 00~59 ○ - - - Y R 0
*SR396 Value of the second in the real-time clock (RTC): 00~59 ○ - - - Y R 0
*SR397 Value of the week in the real-time clock (RTC): 1~7 ○ - - - Y R 1
When the PLC runs, the value in SR407 increases by
SR407 one every second. SR407 counts from 0 to 32767, and ○ 0 0 - N R/W 0
then from -32768 to 0.
When the PLC runs, the value in SR408 increases by
SR408 one every scan cycle. SR408 counts from 0 to 32767, ○ 0 0 - N R/W 0
and then from -32768 to 0.
SR411 The current scan time is stored in SR411 and SR412, and ○ 0 - - N R 0
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
SR412 ○ 0 - - N R 0
SR421. (The 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.
SR413 The maximum scan time is stored in SR413 and SR414,
and the unit of measurement is 100 microseconds. The ○ 0 - - N R 0
SR414
value of the millisecond is stored in SR413.
SR415 The maximum scan time is stored in SR415 and SR416,
and the unit of measurement is 100 microseconds. The ○ 0 - - N R 0
SR416
value of the millisecond is stored in SR415.
Duration of the timer interrupt I601 (unit: minutes); the
SR421 default is 0, meaning the system will follow the settings in ○ 0 0 - N R/W 0
HWCONFIG.
Duration of the timer interrupt I602 (unit: minutes); the
SR422 default is 0, meaning the system will follow the settings in ○ 0 0 - N R/W 0
HWCONFIG.
Duration of the timer interrupt I603 (unit: minutes); the
SR423 default is 0, meaning the system will follow the settings in ○ 0 0 - N R/W 0
HWCONFIG.
Duration of the timer interrupt I604 (unit: minutes); the
SR424 default is 0, meaning the system will follow the settings in ○ 0 0 - N R/W 0
HWCONFIG.
2-65
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
SR440 ○ - - - Y R -
_2 MAC address
SR441 (Ex: 12:34:56:78:9A:BC => SR440=16#1234, ○ - - - Y R -
SR441=16#5678, SR442=16#9ABC)
SR442 ○ - - - Y R -
2-66
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-67
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-68
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-69
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-70
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
I416~I431
SR658
The number of the Delta CANopen communication axis
○ 0 - - N R 0 2_
from Delta servo which has a communication error
SR659 Delta CANopen communication error ○ 0 - - N R 0
The PR command of Delta CANopen communication axis
SR661 ○ 0 - - N R 0
1 from Delta servo
The PR command of Delta CANopen communication axis
SR662 2 from Delta servo ○ 0 - - N R 0
The PR command of Delta CANopen communication axis
SR663 3 from Delta servo ○ 0 - - N R 0
The PR command of Delta CANopen communication axis
SR664 4 from Delta servo ○ 0 - - N R 0
The PR command of Delta CANopen communication axis
SR665 5 from Delta servo ○ 0 - - N R 0
The PR command of Delta CANopen communication axis
SR666 6 from Delta servo ○ 0 - - N R 0
The PR command of Delta CANopen communication axis
SR667 7 from Delta servo ○ 0 - - N R 0
The PR command of Delta CANopen communication axis
SR668 8 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 1
SR671 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 2
SR672 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 3
SR673 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 4
SR674 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 5
SR675 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 6
SR676 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 7
SR677 from Delta servo ○ 0 - - N R 0
The alarm code of Delta CANopen communication axis 8
SR678 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 1
SR681 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 2
SR682 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 3
SR683 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 4
SR684 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 5
SR685 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 6
SR686 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 7
SR687 from Delta servo ○ 0 - - N R 0
The DO state of Delta CANopen communication axis 8
SR688 ○ 0 - - N R 0
from Delta servo
SR691 The current position of Delta CANopen communication
○ 0 - - N R 0
SR692 axis 1 from Delta servo (32-bit)
2-71
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-72
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-73
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-74
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
SR886
The state of slave ID 57 in CANopen DS301
○ 0 - - N R 0
2_
communication
The state of slave ID 58 in CANopen DS301
SR887 communication ○ 0 - - N R 0
The state of slave ID 59 in CANopen DS301
SR888 communication ○ 0 - - N R 0
The state of slave ID 60 in CANopen DS301
SR889 communication ○ 0 - - N R 0
The state of slave ID 61 in CANopen DS301
SR890 communication ○ 0 - - N R 0
The state of slave ID 62 in CANopen DS301
SR891 communication ○ 0 - - N R 0
The state of slave ID 63 in CANopen DS301
SR892 communication ○ 0 - - N R 0
The state of slave ID 64 in CANopen DS301
SR893 communication ○ 0 - - N R 0
SR900
The number of the samplings in the data logger (32-bit) ○ 0 - - N R 0
SR901
The code for the executions of data logger and the
memory card (need to work with SM456), e.g. H5AA5:
SR902 ○ 0 - - N R/W 0
write the sampling data from the data logger into the
memory card.
SR1000
Ethernet IP address (32-bit) ○ - - - H R/W 0
SR1001
SR1002
Ethernet netmask address (32-bit) ○ - - - H R/W 0
SR1003
SR1004
Ethernet gateway address (32-bit) ○ - - - H R/W 0
SR1005
SR1006 Time for which the TCP connection has been persistent ○ - - - H R/W 30
SR1007 Ethernet transmission speed ○ 0 - - N R 0
SR1009 Number of TCP connections ○ 0 - - N R 0
SR1010 A specific time when to resend via the TCP connection ○ - - - N R/W 20
SR1011 The connection number of MODBUS/TCP Server ○ 0 - - N R 0
SR1012 The connection number of MODBUS/TCP Client ○ 0 - - N R 0
SR1013 The connection number of EtherNet/IP Adapter ○ 0 - - N R 0
SR1014 The connection number of EtherNet/IP Scanner ○ 0 - - N R 0
SR1020 The state of the EtherNet/IP connection 1 ○ 0 - - N R 0
SR1021 The state of the EtherNet/IP connection 2 ○ 0 - - N R 0
SR1022 The state of the EtherNet/IP connection 3 ○ 0 - - N R 0
SR1023 The state of the EtherNet/IP connection 4 ○ 0 - - N R 0
SR1024 The state of the EtherNet/IP connection 5 ○ 0 - - N R 0
SR1025 The state of the EtherNet/IP connection 6 ○ 0 - - N R 0
SR1026 The state of the EtherNet/IP connection 7 ○ 0 - - N R 0
SR1027 The state of the EtherNet/IP connection 8 ○ 0 - - N R 0
2-75
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-76
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-77
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-78
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
connection 1
*SR1153
The error code for data exchange via the Ethernet
connection 2
○ 0 - - N R 0 2_
The error code for data exchange via the Ethernet
*SR1154 ○ 0 - - N R 0
connection 3
The error code for data exchange via the Ethernet
*SR1155 ○ 0 - - N R 0
connection 4
The error code for data exchange via the Ethernet
*SR1156 ○ 0 - - N R 0
connection 5
The error code for data exchange via the Ethernet
*SR1157 ○ 0 - - N R 0
connection 6
The error code for data exchange via the Ethernet
*SR1158 ○ 0 - - N R 0
connection 7
The error code for data exchange via the Ethernet
*SR1159 ○ 0 - - N R 0
connection 8
The error code for data exchange via the Ethernet
*SR1160 ○ 0 - - N R 0
connection 9
The error code for data exchange via the Ethernet
*SR1161 ○ 0 - - N R 0
connection 10
The error code for data exchange via the Ethernet
*SR1162 ○ 0 - - N R 0
connection 11
The error code for data exchange via the Ethernet
*SR1163 ○ 0 - - N R 0
connection 12
The error code for data exchange via the Ethernet
*SR1164 ○ 0 - - N R 0
connection 13
The error code for data exchange via the Ethernet
*SR1165 ○ 0 - - N R 0
connection 14
The error code for data exchange via the Ethernet
*SR1166 ○ 0 - - N R 0
connection 15
The error code for data exchange via the Ethernet
*SR1167 ○ 0 - - N R 0
connection 16
The error code for data exchange via the Ethernet
*SR1168 ○ 0 - - N R 0
connection 17
The error code for data exchange via the Ethernet
*SR1169 ○ 0 - - N R 0
connection 18
The error code for data exchange via the Ethernet
*SR1170 ○ 0 - - N R 0
connection 19
The error code for data exchange via the Ethernet
*SR1171 ○ 0 - - N R 0
connection 20
The error code for data exchange via the Ethernet
*SR1172 ○ 0 - - N R 0
connection 21
The error code for data exchange via the Ethernet
*SR1173 ○ 0 - - N R 0
connection 22
The error code for data exchange via the Ethernet
*SR1174 ○ 0 - - N R 0
connection 23
The error code for data exchange via the Ethernet
*SR1175 ○ 0 - - N R 0
connection 24
2-79
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-80
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-81
A S S er i es Pr og r am m ing M an u a l
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-82
C ha pt er 2 D e v ic es
AS300 Series
Attribute
Latched
OFF STOP RUN
Default
SR Function
ON RUN STOP
2-83
A S S er i es Pr og r am m ing M an u a l
Special data
Refresh time
register
SR220~SR226 The register is refreshed every scan cycle.
SR227~SR308 The register is refreshed when the program is downloaded to the PLC.
SR309~SR390 The register is refreshed when the status of the PLC changes.
SR391~SR397 The register is refreshed every scan cycle.
2-84
C ha pt er 2 D e v ic es
Special data
Refresh time
register
When the PLC is supplied with power, the register is refreshed according to the position planning
SR528~SR529
table. Users can edit the settings afterwards
SR530 The register is refreshed by the system.
SR532 The register is refreshed by users.
The register is refreshed by the system whenever the high-speed output instruction is executed and
SR534
the program is scanned. If the instruction is not executed, users can edit the setting. 2_
SR536~SR537 The register is refreshed by users.
The register is refreshed by the system whenever the high-speed output instruction is executed and
SR540
the program is scanned. If the instruction is not executed, users can edit the settings.
SR542~SR546 The register is refreshed by users.
SR547 The register is refreshed by the system.
When the PLC is supplied with power, the register is refreshed according to the position planning
SR548~SR549
table. Users can edit the settings afterwards
SR550 The register is refreshed by the system.
SR552 The register is refreshed by users.
The register is refreshed by the system whenever the high-speed output instruction is executed and
SR554
the program is scanned. If the instruction is not executed, users can edit the settings.
SR556~SR557 The register is refreshed by users.
The register is refreshed by the system whenever the high-speed output instruction is executed and
SR560
the program is scanned. If the instruction is not executed, users can edit the settings.
SR562~SR566 The register is refreshed by users.
SR567 The register is refreshed by the system.
When the PLC is supplied with power, the register is refreshed according to the position planning
SR568~SR569
table. Users can edit the settings afterwards
SR570 The register is refreshed by the system.
SR572 The register is refreshed by users.
The register is refreshed by the system whenever the high-speed output instruction is executed and
SR574
the program is scanned. If the instruction is not executed, users can edit the settings.
SR576~SR577 The register is refreshed by users.
The register is refreshed according to the settings in HWCONFIG when the PLC is powered-on.
SR580~SR603
Users can edit the settings afterwards
SR604~SR609 The register is refreshed by users.
SR610~SR621 The register is refreshed whenever the output instruction is executed.
The register is refreshed whenever the instruction EIX or DIX is executed.
SR623~SR634 ON: the interrupt is enabled
OFF: the interrupt is disabled
SR658~SR901 The register is refreshed by the system.
SR820 The register is refreshed according to the settings in CANopen Builder.
SR821 The register is refreshed when the firmware is updated.
SR822 The register is refreshed according to the settings in HWCONFIG.
SR825~SR893 The register is refreshed by the system.
SR902 The register is refreshed by users.
SR1000~SR1006 The register is refreshed by users.
SR1007 The register is refreshed by the system.
SR1009 The register is refreshed by the system.
SR1010 The register is refreshed by users.
SR1011~SR1014 The register is refreshed by the system.
2-85
A S S er i es Pr og r am m ing M an u a l
Special data
Refresh time
register
1. The register is refreshed when a connection is established.
SR1020~SR1107
2. The register is refreshed every scan cycle.
SR1116~SR1117 The register is refreshed when the program is downloaded to the PLC.
SR1120~SR1183 The register is refreshed when the communication is complete.
_2 SR1318~SR1320
The register is refreshed when the parameter is downloaded to the PLC, or when the PLC is
supplied with power.
SR1335~SR1336 After the function of data exchange is enabled, the register is refreshed every scan cycle.
SR1340~SR1371 The register is refreshed when there is an error.
SR1375~SR1376 After the function of data exchange is enabled, the register is refreshed every scan cycle.
SR1380~SR1411 The register is refreshed when there is an error.
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.
2. Clearing the warning light
SM22
If SM22 is ON, the error log and the warning light will be cleared.
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
Binary-coded Decimal Function Value
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
2-86
C ha pt er 2 D e v ic es
Device
Binary-coded Decimal Function Value
decimal system system
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_
Please refer to chapter 6 for more information related to the instruction of real-time clock.
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.
Code 0 1 2 3 4 5 6
Function No card RS232 RS422 RS485 F2AD F2DA FCOPM
FCOPM function card only support Function Card 2.
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 chapter 6 for
more information related to the communication instructions.
0100 (H 4) : 38400
0101 (H 5) : 57600
0110 (H 6) : 115200
0111 (H 7) : 230400
1000 (H 8) : 500000
1001 (H 9) : 921000
2-87
A S S er i es Pr og r am m ing M an u a l
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.
2-88
C ha pt er 2 D e v ic es
11
SR102
SR103 SR104
SR105 High SR105 SR106 High SR106 Low SR107 High SR107 Low 2_
Low byte byte Low byte byte byte byte byte
SR108 SR111 High SR111 Low SR112 High SR112 Low SR113 High SR113 Low
12 SR109 SR110
Low byte byte byte byte byte byte byte
SR114 SR117 High SR117 SR118 High SR118 Low SR119 High SR119 Low
13 SR115 SR116
Low byte byte Low byte byte byte byte byte
SR120 SR123 High SR123 SR124 High SR124 Low SR125 High SR125 Low
14 SR121 SR122
Low byte byte Low byte byte byte byte byte
SR126 SR129 High SR129 SR130 High SR130 Low SR131 High SR131 Low
15 SR127 SR128
Low byte byte Low byte byte byte byte byte
SR132 SR135 High SR135 SR136 High SR136 Low SR137 High SR137 Low
16 SR133 SR134
Low byte byte Low byte byte byte byte byte
SR138 SR141 High SR141 SR142 High SR142 Low SR143 High SR143 Low
17 SR139 SR140
Low byte byte Low byte byte byte byte byte
SR144 SR147 High SR147 SR148 High SR148 Low SR149 High SR149 Low
18 SR145 SR146
Low byte byte Low byte byte byte byte byte
SR150 SR153 High SR153 SR154 High SR154 Low SR155 High SR155 Low
19 SR151 SR152
Low byte byte Low byte byte byte byte byte
SR156 SR159 High SR159 SR160 High SR160 Low SR161 High SR161 Low
20 SR157 SR158
Low byte byte Low byte byte byte byte byte
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.
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.
2-89
A S S er i es Pr og r am m ing M an u a l
Function Value
Year 00~99 (A.D.)
Month 01~12
Day 01~31
Hour 00~23
2-90
C ha pt er 2 D e v ic es
Function Value
Minute 00~59
Second 00~59
SR309~SR390
SR309: The maximum number of PLC status change logs which are stored in SR309 is 20. Every PLC status 2_
change log occupies 4 registers. The PLC status change actions which are recorded are numbered, as
shown in the following table.
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.
2-91
A S S er i es Pr og r am m ing M an u a l
*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
SM400~SM403
SM402: SM402 is ON during the first scan time, and then is switched OFF. The pulse width equals one scan time.
2-92
C ha pt er 2 D e v ic es
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
2_
SM401
SM402
SM403
Scan ti me
SM404,SM405,SM406,SM407
The PLC provides seven types of clock pulses. When the PLC is supplied with power, the seven types of clock
pulses act automatically.
Device Function
10 millisecond clock pulse during which the pulse is ON for 5 milliseconds and is OFF for 5
SM404
milliseconds
100 millisecond clock pulse during which the pulse is ON for 50 milliseconds and is OFF for 50
SM405
milliseconds
200 millisecond clock pulse during which the pulse is ON for 100 milliseconds and is OFF for 100
SM406
milliseconds
One second clock pulse during which the pulse is ON for 500 milliseconds and is OFF for 500
SM407
milliseconds
The clock pulses are illustrated as follows.
10 ms
5 ms
100 ms
50 ms
200 ms
100 ms
1 sec
SM407 (1 sec) 1 Hz
500 ms
2-93
A S S er i es Pr og r am m ing M an u a l
SM36、SM450~SM453、SM456、SR36、SR453、SR902
The memory card is used to backup the data in the PLC. Please refer to chapter 6 for instruction concerning the
memory card.
Device Function
_2 Enable saving data to the memory card. When it is ON, the PLC will run according to the value in the
SM36
SR36.
Whether the memory card exists
SM450 ON: The memory card exists.
OFF: The memory card does not exist.
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.
SM456 Execution of data logger and the memory card. (ON: execution by the values in SR902)
SR36 The system saves data to the memory card. This function need to work with SM36.
SR453 If an error occurs during the operation of the memory card, the error code will be recorded.
The code for the executions of data logger and the memory card (need to work with SM456), e.g.
SR902
H5AA5: write the sampling data from the data logger into the memory card.
A. The number 1234 means the error log (SR40~SR161) of the PLC is stored in the memory card.
B. The number 3456 means the error log (SR40~SR161) of the PLC and the PLC state changing log
(SR309~SR390) are stored in the memory card.
12. The high-speed output instruction is being executed. The output immediately stops when the instruction is
disabled or stops.
SM476, SM477, SM496, SM497, SM516, SM517, SM536, SM537, SM556, SM557, SM576, SM577:
SM463, SM474, SM483, SM494, SM503, SM514, SM523, SM534, SM543, SM554, SM563, SM574:the flags
are used to pause outputting.
When the flag is OFF to ON, it means the output will be stopped. This should work with the abovementioned flags;
refer to the section above for more actions on stop).
When the flag is ON to OFF, it means the rest of the outputs will be executed.
SR580~SR603
Positive output limit: set up the limit in ISPSoft; when the output position is greater than the positive limit,
the output stops immediately.
2-94
C ha pt er 2 D e v ic es
Negative output limit: set up the limit in ISPSoft; when the output position is smaller than the negative
limit, the output stops immediately.
When the limits of positive and negative output are both 0, it means the function is disabled. This
function should work with the output instruction. The system will only check the limit set in the ISPSoft,
when the instruction is executed. Thus it will not come to an immediate stop even when it is out of the
output limit. If an immediate stop is needed, it is suggested to use the external input as the way to check
the limit. 2_
14. S curve mode
There are 3 S curves, small, medium and large. The range is between 0 to 2. When the value exceeds the range,
the system will treat the value as the minimum 0 or the maximum 2.
The S curve mode should work with the flags such as SM468, SM488, SM568 and so on. If the flag is ON, the
parameters of the S curve will be executed by the output instruction.
SM1000、SR1000~SR1006
SM Function Action
SM1090 The TCP connection is busy. ON: TCP connection timeout
SM1091 The UDP connection is busy. ON: UDP connection timeout
OFF: when the PHY initialization succeeds.
SM1106 Ethernet connection error
ON: when the PHY initialization fails.
OFF: correct basic setting
SM1107 Ethernet basic setting error
ON: basic setting error
TCP/UDP socket─the local port is
SM1109 ON: the same port has been used
already used.
For the error codes, the corresponding LED indicators, and other troubleshooting, please refer to chapter 12 of the AS
Series operation manual.
2-95
A S S er i es Pr og r am m ing M an u a l
SM1113,SM1116~SM1155
If the sending of email fails, the flag of the email service error SM1113 will be ON.
The triggers of email sending and the corresponding flags (SM1116~SM1155) are listed below:
_2 Item
Trigger 1 Trigger 2 Trigger 3 Trigger 4
Function
SM Type Function
SM750 R/W Data exchange via COM1 has been enabled by ISPSoft.
SM752 ~ SM783 R/W Connection 1~32 via COM1 for data exchange has been started.
SM784 ~ SM815 R The data has been received via COM 1 connection 1~32 for data exchange.
SM816 ~ SM847 R An error occurs in the COM1 connection 1~32 for data exchange
SM Type Function
SM862 R/W Data exchange via COM2 has been enabled by ISPSoft.
SM864 ~ SM895 R/W Connection 1~32 via COM2 for data exchange has been started.
SM896 ~ SM927 R The data has been received via COM2 connection 1~32 for data exchange.
SM928 ~ SM959 R An error occurs in the COM2 connection 1~32 for data exchange
2-96
C ha pt er 2 D e v ic es
SR Function
SR1335 The actual cycle time of connection 1~32 for data exchange via COM1
The number of connection that is currently performing a cyclical data exchange
SR1336
via COM1
SR1340 ~ SR1371 The error code for data exchange via the COM1 connection 1~32
Data registers for COM2 connections 2_
SR1375 The actual cycle time of connection 1~32 for data exchange via COM2
The number of connection that is currently performing a cyclical data exchange
SR1376
via COM2
SR1380 ~ SR1411 The error code for data exchange via the COM2 connection 1~32
The error codes 1~7 are the standard response error codes of MODBUS protocol. The error code 9 means timeout.
SM Type Function
SM1167 R/W Data exchange via Ethernet port has been enabled by ISPSoft.
SM1168 ~ SM1199 R/W Connection 1~32 via Ethernet port for data exchange has been started.
The data has been received via Ethernet port connection 1~32 for data
SM1200 ~ SM1231 R
exchange.
SM1232 ~ SM1263 R An error occurs in the Ethernet port connection 1~32 for data exchange
Data registers for Ethernet connections
SR Function
SR1120 ~ SR1151 The actual connection time for data exchange via the Ethernet connection 1~32
SR1152 ~ SR1183 The error code for data exchange via the Ethernet connection 1~32
Error codes for Ethernet connections
Users can edit, upload, download the parameters in the file registers via ISPSoft.
The values in FR can be read while operating the PLC. Please refer to API2303 MEMW in AS Series programming
manual for more information about how to write in FR.
2-97
A S S er i es Pr og r am m ing M an u a l
MEMO
_2
2-98
3
Chapter 3 Instruction Tables
Table of Contents
3-1
A S S er i es Pr og r am m ing M an u a l
3.1 Instructions
Instructions used in the AS300 series PLC include basic instructions and applied instructions.
_3 Rising-edge/Falling-edge Triggering the instructions that load the contact, connect the contacts in series, and
detection contact instructions connect the contacts in parallel
Rising-edge/Falling-edge
Bit device differential output
differential output instructions
Other instructions Other instructions
3-2
C ha pt er 3 I ns tr uc t i o n Tab l es
The descriptions:
: The function
3-3
A S S er i es Pr og r am m ing M an u a l
_3
The descriptions:
: 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 cannot.
If users want to use the pulse instruction, they only need to add a P in back of the instruction.
: The function
3-4
C ha pt er 3 I ns tr uc t i o n Tab l es
3_
The descriptions:
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 cannot.
If users want to use the pulse instruction, they only need to add a P in back of the instruction.
: The function
3-5
A S S er i es Pr og r am m ing M an u a l
_3
The descriptions:
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.
: The operand
: The function
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 cannot be modified by an index register.
3-6
C ha pt er 3 I ns tr uc t i o n Tab l es
It indicates whether the instruction can be used as the pulse instruction, the 16-bit instruction, or the 32-bit
instruction
Instruction
Symbol Function Operand
code
LD
OR
LDI
ORI
Output instructions
Instruction Execution
Symbol Function Operand
code condition
Keeping the
SET DY, Y, M, SM, S, T, C, HC, D
device on
Instruction
Symbol Function Operand
code
3-7
A S S er i es Pr og r am m ing M an u a l
Instruction
Symbol Function Operand
code
LDP
_3
ANDP DX, X, Y, M, SM, S, T, C, HC, D
Starting the
rising-edge
ORP detection/Connecti
ng the rising-edge
detection in
PED series/Connecting
the rising-edge
detection in parallel
APED X, Y,M, SM, S, T, C, HC, D
OPED
LDF
ONED
3-8
C ha pt er 3 I ns tr uc t i o n Tab l es
Execution
Instruction code Symbol Function Operand
condition
Rising-edge
PLS Y, M, SM, S
differential output
Falling-edge
PLF Y, M, SM, S
differential output
Other instructions 3_
Instruction code Symbol Function Operand
3-9
A S S er i es Pr og r am m ing M an u a l
3-10
C ha pt er 3 I ns tr uc t i o n Tab l es
3 - 11
A S S er i es Pr og r am m ing M an u a l
3-12
C ha pt er 3 I ns tr uc t i o n Tab l es
3-13
A S S er i es Pr og r am m ing M an u a l
3-14
C ha pt er 3 I ns tr uc t i o n Tab l es
Arithmetic instructions
3-15
A S S er i es Pr og r am m ing M an u a l
3-16
C ha pt er 3 I ns tr uc t i o n Tab l es
3_
3-17
A S S er i es Pr og r am m ing M an u a l
_3
3-18
C ha pt er 3 I ns tr uc t i o n Tab l es
3_
0308 SWAP DSWAP Exchange the high byte with the low byte
Jump instructions
3-19
A S S er i es Pr og r am m ing M an u a l
Convenience instructions
3-20
C ha pt er 3 I ns tr uc t i o n Tab l es
Logic instructions
3-21
A S S er i es Pr og r am m ing M an u a l
_3
0814 AND^ DAND^ ─ S1^S2
Rotation instructions
0901 RCR DRCR Rotating to the right with the carry flag
3-22
C ha pt er 3 I ns tr uc t i o n Tab l es
0903 RCL DRCL Rotating to the left with the carry flag
3-23
A S S er i es Pr og r am m ing M an u a l
Shift instructions
_3
Shifting the data in the word devices to the
1102 WSFR ─
right
1106 SFPO ─ Reading the latest data from the data list
3-24
C ha pt er 3 I ns tr uc t i o n Tab l es
3-25
A S S er i es Pr og r am m ing M an u a l
_3
1210 ABS DABS Absolute value
3-26
C ha pt er 3 I ns tr uc t i o n Tab l es
3_
1223 ZONE DZONE Controlling the zone
Module instructions
3-27
A S S er i es Pr og r am m ing M an u a l
3-28
C ha pt er 3 I ns tr uc t i o n Tab l es
─
1516 FPOW Power of the floating-point number
3_
3-29
A S S er i es Pr og r am m ing M an u a l
Peripheral instructions
Communication instructions
3-30
C ha pt er 3 I ns tr uc t i o n Tab l es
Other instructions
3-31
A S S er i es Pr og r am m ing M an u a l
_3
Converting the signed decimal ASCII
2103 DABIN DDABIN code into the signed decimal binary
number
3-32
C ha pt er 3 I ns tr uc t i o n Tab l es
Ethernet instructions
3-33
A S S er i es Pr og r am m ing M an u a l
3-34
C ha pt er 3 I ns tr uc t i o n Tab l es
3-35
A S S er i es Pr og r am m ing M an u a l
2-Axis absolute-position
2715 – DCICCA – counterclockwise arc
interpolation
–
2723 DPPGB – Point to point go back and forth
3-36
C ha pt er 3 I ns tr uc t i o n Tab l es
3-37
A S S er i es Pr og r am m ing M an u a l
3-38
C ha pt er 3 I ns tr uc t i o n Tab l es
of a servo
3-39
A S S er i es Pr og r am m ing M an u a l
3-40
C ha pt er 3 I ns tr uc t i o n Tab l es
3-41
A S S er i es Pr og r am m ing M an u a l
0208 GRY DGRY Converting the binary number into the Gray code
Converting the hexadecimal ASCII code into the
2104 HABIN DHABIN
hexadecimal binary number
H 1701 HKY DHKY – Hexadecimal key input
3-42
C ha pt er 3 I ns tr uc t i o n Tab l es
3-43
A S S er i es Pr og r am m ing M an u a l
0206 MMOV – Converting the 16-bit value into the 32-bit value
_3 2301 MREAD –
Reading the data from the memory card into the
PLC
2204 MSEND – Sending the email
2300 MWRIT – Writing the data from the PLC into the memory card
3-44
C ha pt er 3 I ns tr uc t i o n Tab l es
0903 RCL DRCL Rotating to the left with the carry flag
0901 RCR DRCR Rotating to the right with the carry flag
0207 RMOV – Converting the 32-bit value into the 16-bit value 3_
0902 ROL DROL Rotating to the left
1104 SFWR – Shifting the data and writing it into the word device
3-45
A S S er i es Pr og r am m ing M an u a l
0308 SWAP DSWAP Exchange the high byte with the low byte
1103 WSFL – Shifting the data in the word devices to the left
1102 WSFR – Shifting the data in the word devices to the right
3-46
C ha pt er 3 I ns tr uc t i o n Tab l es
3_
3-47
A S S er i es Pr og r am m ing M an u a l
MEMO
_3
3-48
4
Chapter 4 Instruction Structure
Table of Contents
4.1 API Composition of Applied Instructions ........................................... 4-2
4-1
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
_4 S
D
S : Data source
D : Data destination
1. 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. F in the operand area represents the single precision floating point (32-bit)
4. The solid circle ● indicates that the device can be modified by an index register, and the hollow circle ○ indicates
that the device cannot be modified by an index register. For example, the data register designated by the operand S
can be modified by an index register.
5. 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.
6. If users want to use an instruction in the function block, and the output, input and data devices are supported among
the operands, users have to use the pointer registers. AS for the timer, the 16-bit counter, and the 32-bit counter
that are supported among the operands, users have to use the pointer register of the timer, the pointer register of
4-2
Ch a pt er 4 Ins tr uc t i on Str uc t ur e
the 16-bit counter, and the pointer register of the 32-bit counter. Please refer to sections 4.4~4.7 for more
information or section 7.2.4 in ISPSoft.
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.)
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 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”.
4_
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
S 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.
The length of the operand (the 16-bit instruction, the 32-bit instruction, or the floating-point number 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.
4-3
A S S er i es Pr og r am m ing M an u a l
The floating-point number instructions can support the 32-bit floating-point number instructions which correspond to the
single-precision floating-point number instructions. Users can refer to chapter 2 for more information about the
floating-point numbers.
_4
32-bit single-precision floating-point number instruction F+
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.
Continuous execution
Whenever M1 is ON during the
scan cycle, the instruction MOV
is executed once. Therefore, the
instruction is called the
continuous instruction.
4-4
Ch a pt er 4 Ins tr uc t i on Str uc t ur e
When the conditonal contact M1 is OFF, the instruction is not executed, and the value in the destination
operand D does not change.
5. Timer: T0 ~ T511
13. Constant: The decimal constants are notated by K, and the hexadecimal constants are notated by 16#.
16. 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.
17. 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.。
18. 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.
19. The index registers can only be used in the 16-bit instruction.
1. The system assigns the variables to declare such as Bool, WORD, INT and so on: U0 ~ U16387 and W0 ~ W29999.
3. Pointer type variable symbols, the supporting devices and usage are listed below.
4-5
A S S er i es Pr og r am m ing M an u a l
General pointer Maximum quantity Up to 16 pointers can be used in each function block
(Pointer) Variable symbols of WORD/DWORD/LWORD/INT/DINT/LINT
Can be assigned to types or data register, input relay or output relay devices
(e.g. X0, Y0, etc.)
API0065 CHKADR, FB_NP, FB_PN, NED, ANED, ONED, PED, APED, OPED
GOEND
LDP, ANDP, ORP, LDF, ANDF, ORF, PLS, PLF, NP, PN, MC/MCR, GOEND and all pulse instructions in applied
instructions.
If users want to use some of the instructions mentioned above, they can use the substitute instructions.
Instruction which cannot be used in the function block Substitute instruction in the function block
LDP/ANDP/ORP NED/ANED/ONED
LDF/ANDF/ORF PED/APED/OPED
PLS -
PLF -
NP FB_NP
PN FB_PN
MC -
4-6
Ch a pt er 4 Ins tr uc t i on Str uc t ure
Instruction which cannot be used in the function block Substitute instruction in the function block
MCR -
*1: Pulse instructions cannot 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:
2. When StartBit1 is switched from OFF to ON, method 1 (network 1) and method 2 (network 2) can only execute the
instruction MOV once; users can choose one to use.
4_
4-7
A S S er i es Pr og r am m ing M an u a l
NOTE 1: AS Series supports using the register name to modify the device for example D0.1@E0 but not supporting
2-layered modification for example, [email protected]@E0.
NOTE 2: When E0=17, D0.1@E0=D0.(1+17)=D1.2, and D1.2 will be ON. And the bit part 1@E0=(1+17)=18.
However, the maximum bit number is 15. Since m=18/16=1 and the remainder is 2, the last modification result is D
(0+1).2=D1.2. D1.2 will be ON.
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.
4-8
Ch a pt er 4 Ins tr uc t i on Str uc t ur e
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 4_
program from being executed wrongly.
Users can declare 16 pointer registers in every function block. The range is PR0~PR15, or PR0.0~PR15.15.
Example:
4-9
A S S er i es Pr og r am m ing M an u a l
Choose VAR_IN_OUT as the declaration type, Point1 as the identifier, POINTER as the data type. The variable is
the pointer register.
_4
6. Call the function block FB0 in the program organization unit (POU).
When VarBit1 in FB0 is ON, E0=1, Var1=D0, Point1@E0=D (0+1)=D1, and Var2=D1.
Network 2: When StartBit[1] is ON, the address of CVar1[0] is transmitted to Point1 in FB0.
4-10
Ch a pt er 4 Ins tr uc t i on Str uc t ur e
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.
Users can declare 8 pointer registers of the timers in every function block. The range is TR0~TR7.
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:
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 - 11
A S S er i es Pr og r am m ing M an u a l
6. Call the function block FB0 in the program organization unit (POU).
Network 1: When StartBit[0] is ON, the address of T511 is transmitted to TPoint1 in FB0.
_4
When VarBit1 in the FB0 is ON, the instruction TMR is executed, and TPoint1 (T511) 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.
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.
Users can declare 8 pointer registers of the 16-bit counters in every function block. The range is CR0~CR7.
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.
4-12
Ch a pt er 4 Ins tr uc t i on Str uc t ur e
Example:
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.
6. Call the function block FB0 in the program organization unit (POU).
4-13
A S S er i es Pr og r am m ing M an u a l
Network 2: When StartBit[1] is ON, the address of CVar1 is transmitted to CPoint1 in FB0.
When the variable declaration type is VAR_IN_OUT, and the data type is HC_POINTER, the variable is the pointer
_4 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.
Users can declare 8 pointer registers of the 32-bit counters in every function block. The range is HCR0~HCR7.
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:
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.
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.
4-14
Ch a pt er 4 Ins tr uc t i on Str uc t ur e
5. Call the function block FB0 in the program organization unit (POU).
Network 1: When StartBit[0] is ON, the address of HC0 is transmitted to HCPoint1 in FB0.
Users can edit, upload, download the parameters in the file registers via ISPSoft.
The values in FR can be read while operating the PLC. Please refer to API2303 MEMW in AS Series programming
manual for more information about how to write in FR.
4-15
A S S er i es Pr og r am m ing M an u a l
MEMO
_4
4-16
5
Chapter 5 Basic Instructions
Table of Contents
5-1
A S S er i es Pr o gr am m ing Ma n ua l
5-2
C ha pt er 5 Bas ic I ns t r uc t i ons
Device DX DY X Y M SM S T C HC D
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
LD S : Specified device
AND
OR
5_
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-3
A S S er i es Pr o gr am m ing Ma n ua l
Device DX DY X Y M SM S T C HC D
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
ANI
ORI
Explanation:
_5
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-4
C ha pt er 5 Bas ic I ns t r uc t i ons
Device DX DY X Y M SM S T C HC D
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
D
Symbol:
D : Specified device
Explanation:
1. The logical operation result prior to the application of the instruction OUT is output into the specified device.
OUT
Operation Contact
result Coil Contact A Contact B
5_
(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.
5-5
A S S er i es Pr o gr am m ing Ma n ua l
Device DX DY X Y M SM S T C HC D
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
D
Symbol:
D : Specified device
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:
_5 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-6
C ha pt er 5 Bas ic I ns t r uc t i ons
Symbol:
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 contact
General-purpose timer
are OFF.
The timer value is reset to zero. The coil and the contact
Timer used in the function block
are OFF.
Accumulative timer
The coil is OFF. The timer value and the state of the 5_
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 actions of the
Applied instruction
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-7
A S S er i es Pr o gr am m ing Ma n ua l
Example:
_5
5-8
C ha pt er 5 Bas ic I ns t r uc t i ons
Device DX DY X Y M SM S T C HC D
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
LDP
ORP
Explanation:
5_
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-9
A S S er i es Pr o gr am m ing Ma n ua l
Device DX DY X Y M SM S T C HC D
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
LDF
ORF
_5 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-10
C ha pt er 5 Bas ic I ns t r uc t i ons
Device DX DY X Y M SM S T C HC D
S1
S2
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
5_
Output the state of the
OPED Q :
operation result
Explanation:
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.
6. The state of the operation result will be outputted automatically after the instruction is executed. Users do not need
to input device for this.
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 - 11
A S S er i es Pr o gr am m ing Ma n ua l
_5
5-12
C ha pt er 5 Bas ic I ns t r uc t i ons
Device DX DY X Y M SM S T C HC D
S1
S2
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
5_
Output the state of
ONED Q :
the operation result
Explanation:
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.
6. The state of the operation result will be outputted automatically after the instruction is executed. Users do not need
to input device for this.
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
A S S er i es Pr o gr am m ing Ma n ua l
_5
5-14
C ha pt er 5 Bas ic I ns t r uc t i ons
Device DX DY X Y M SM S T C HC D
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
D
Symbol:
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.
5_
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.0
On e sc an c y c le
M0.0
Y0.0
5-15
A S S er i es Pr o gr am m ing Ma n ua l
Device DX DY X Y M SM S T C HC D
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
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.
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
One scan c ycle
M0
Y0 .0
5-16
C ha pt er 5 Bas ic I ns t r uc t i ons
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_
5-17
A S S er i es Pr o gr am m ing Ma n ua l
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: Operation:
_5
LD M0 Contact A of M0 is loaded.
Timing diagram:
M0
M1
One scan c ycle One scan c ycle
Y0 .0
5-18
C ha pt er 5 Bas ic I ns t r uc t i ons
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.
Example:
5_
Instruction: Operation::
LD M0 Contact A of M0 is loaded.
Timing diagram:
M0
M1
One scan cycle One scan cycle
Y0 .0
5-19
A S S er i es Pr o gr am m ing Ma n ua l
Device DX DY X Y M SM S T C HC D
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
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.
_5 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.
Example:
Instruction: Operation:
LD M0 Contact A of M0 is loaded.
Timing diagram:
M0
M1
One scan cycl e One scan cycl e
Y0 .0
5-20
C ha pt er 5 Bas ic I ns t r uc t i ons
Device DX DY X Y M SM S T C HC D
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
INT
Data type
S
Symbol:
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.
5_
Otherwise, the wrong execution result will appear.
Example:
Instruction: Operation:
LD M0 Contact A of M0 is loaded.
Timing diagram:
M0
M1
One scan cycle One scan cycle
Y0 .0
5-21
A S S er i es Pr o gr am m ing Ma n ua l
MEMO
_5
5-22
6
Chapter 6 Applied Instructions
Table of Contents
6.1 Comparison Instructions ....................................................................... 6-4
6.1.1 List of Comparison Instructions ............................................................ 6-4
6.1.2 Explanation of Comparison Instructions................................................. 6-7
6-1
AS Ser ies Pro gra mm in g M anu al
6-2
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
6_
6-3
AS Ser ies Pro gra mm in g M anu al
6-4
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
0062 CMPT>= –
Comparing the tables 6_
ON: ≧
Comparing the tables
0063 CMPT< –
ON: <
Comparing the tables
0064 CMPT<= –
ON: ≦
0065 CHKADR – – Checking the address of the contact type of pointer register
0066 LDZ= DLDZ= – |S1-S2|=|S3|
0067 LDZ<> DLDZ<> – |S1-S2|≠|S3|
0068 LDZ> DLDZ> – |S1-S2|>|S3|
6-5
AS Ser ies Pro gra mm in g M anu al
_6
6-6
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
0000~
D LD※ S1,S2 Comparing the values LD※
0005
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S2 : Data source 1
1. The instructions are used to compare the value in S1 with that in S2. Take the instruction LD= for example. When the 6_
comparison result is that the value in S1 is equal to that in S2, the continuity condition of the instruction is met. When
the comparison result is that the value in S1 is not equal to that in S2, the discontinuity condition of the instruction is
met.
2. Only the 32-bit instruction can use the 32-bit counter, but not the device E.
Example:
2. When the value in D200 is greater than -30, Y0.11 keeps ON.
3. When the value in (C201, C200) is less than 678,493, or when M3 is ON, M50 is ON.
6-7
AS Ser ies Pro gra mm in g M anu al
_6
6-8
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S2 : Data source 2
Explanation:
1. The instructions are used to compare the value in S1 with that in S2. Take the instruction AND= for example. When
6_
the comparison result is that the value in S1 is equal to that in S2, the continuity condition of the instruction is met.
When the comparison result is that the value in S1 is not equal to that in S2, the discontinuity condition of the
instruction is met.
2. Only the 32-bit instruction can use the 32-bit counter, but not the device E.
Example:
1. When X0.0 is ON and the current value in C10 is equal to 100, Y0.10 is ON.
2. 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-9
AS Ser ies Pro gra mm in g M anu al
_6
6-10
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S2 : Data source 2
Explanation:
1. The instructions are used to compare the value in S1 with that in S2. Take the instruction OR= for example. When the 6_
comparison result is that the value in S1 is equal to that in S2, the continuity condition of the instruction is met. When
the comparison result is that the value in S1 is not equal to that in S2, the discontinuity condition of the instruction is
met.
2. Only the 32-bit instruction can use the 32-bit counter, but not the device E.
Example:
1. When X0.1 is ON, or when the current value in C10 is equal to 100, Y0.10 is ON.
2. 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 - 11
AS Ser ies Pro gra mm in g M anu al
_6
6-12
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S2 : Data source 2
Explanation:
6-13
AS Ser ies Pro gra mm in g M anu al
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
6-14
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S1 : Data source 1
S2 : Data source 2
Explanation:
6-15
AS Ser ies Pro gra mm in g M anu al
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. 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
6-16
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S2 : Data source2
Explanation:
6-17
AS Ser ies Pro gra mm in g M anu al
Example:
When X1.0 is ON, or when the value in D1 is equal to that in D2, Y1.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
6-18
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S1 : Data source1
S2 : Data source2
Explanation:
1. The instructions are used to compare the data in S1 with that in S2, and the data compared is strings. 6_
2. Up to 256 characters can be inputted in the S1 and S2 (16#00 the end symbol is included.)
3. Take the instruction LD$= for example. When the comparison result is that the value in S1 is equal to that in S2, the
continuity condition of the instruction is met. When the comparison result is that the value in S1 is not equal
to that in S2, the discontinuity condition of the instruction is met.
b 15 b8 b7 b0
S 16#32( 2) 16#31( 1)
6-19
AS Ser ies Pro gra mm in g M anu al
5. When two strings are the same, the corresponding comparison operation results of the instructions are listed below.
For example:
b 15 b8 b7 b0 b 15 b8 b7 b0
Example:
When the string starting with the data in D0~16#00 is equal to the string staring with D2~16#00, Y0.0 is ON.
Additional remark:
_6 1. If the string contains more than 256 characters or the string does not end with 16#00, the instruction will not be
executed, SM is ON, and the error code in SR0 is 16#200E.
2. During the string comparison, whenever the end symbol 16#00 is shown, the length of the string ends there.
6-20
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S2 : Data source2
Explanation:
1. The instructions are used to compare the data in S1 with that in S2, and the data compared is strings.
2. Up to 256 characters can be inputted in the S1 and S2 (16#00 the end symbol is included.) 6_
3. Take the instruction AND$= for example. When the comparison result is that the value in S1 is equal to that in S2, the
continuity condition of the instruction is met. When the comparison result is that the value in S1 is not equal
to that in S2, the discontinuity condition of the instruction is met.
16-bit Continuity Discontinuity
API number
instruction condition condition
0042 AND$= S1=S2 S1≠S2
0043 AND$<> S1≠S2 S1=S2
th
4. Only when the data in S~S+n (n indicates the n device, up to 256 characters can be inputted) includes 16#00 can
the data be judged as a complete string. For example:
5. When two strings are the same, the corresponding comparison operation results of the instructions are listed below.
For example:
b 15 b8 b7 b0 b 15 b8 b7 b0
6-21
AS Ser ies Pro gra mm in g M anu al
Example:
When the string starting with the data in D0~16#00 is equal to the string staring with D2~16#00, Y0.0 is ON.
Additional remark:
1. If the string contains more than 256 characters or the string does not end with 16#00, the instruction will not be
executed, SM is ON, and the error code in SR0 is 16#200E.
2. During the string comparison, whenever the end symbol 16#00 is shown, the length of the string ends there.
_6
6-22
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S1 : Data source1
S2 : Data source2
Explanation:
1. The instructions are used to compare the data in S1 with that in S2, and the data compared is strings.
2. Up to 256 characters can be inputted in the S1 and S2 (16#00 the end symbol is included.) 6_
3. Take the instruction OR$= for example. When the comparison result is that the value in S1 is equal to that in S2, the
continuity condition of the instruction is met. When the comparison result is that the value in S1 is not equal
to that in S2, the discontinuity condition of the instruction is met.
16-bit Continuity Discontinuity
API number
instruction condition condition
0048 OR$= S1=S2 S1≠S2
0049 OR$<> S1≠S2 S1=S2
th
4. Only when the data in S~S+n (n indicates the n device, up to 256 characters can be inputted) includes 16#00 can
the data be judged as a complete string. For example:
5. When two strings are the same, the corresponding comparison operation results of the instructions are listed below.
For example:
b 15 b8 b7 b0 b 15 b8 b7 b0
6-23
AS Ser ies Pro gra mm in g M anu al
Example:
When the string starting with the data in D0~16#00 is equal to the string staring with D2~16#00, Y0.0 is ON.
Additional remark:
1. If the string contains more than 256 characters or the string does not end with 16#00, the instruction will not be
executed, SM is ON, and the error code in SR0 is 16#200E.
2. During the string comparison, whenever the end symbol 16#00 is shown, the length of the string ends there.
_6
6-24
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
S1 : Comparison value1
S2 : Comparison value2
D : Comparison result
6_
Explanation:
1. 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.
2. The operand D occupies 3 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.
3. Only the instructions DCMP and DCMPP can use the 32-bit counter, but not the device E.
Example:
1. If the operand D is M0, the comparison results will be stored in M0, M1 and M2, as shown below.
2. 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.
6-25
AS Ser ies Pro gra mm in g M anu al
3. If users need to clear the comparison result, they can use the instruction RST or ZRST.
Additional remark:
1. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
_6 2. 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-26
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S
D
Explanation:
1. 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.
2. 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.
3. 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.
4. Only the instructions DZCP and DZCPP can use the 32-bit counter, but not the device E.
6-27
AS Ser ies Pro gra mm in g M anu al
Example:
1. If the operand D is M0, the comparison results will be stored in M0, M1 and M2, as shown below.
2. 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 need to clear the comparison result, they can use the instruction RST or ZRST.
_6
Additional remark:
1. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
2. 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-28
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
D : Comparison result
Explanation:
6_
1. 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.
2. 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. If the operand D is M10, the comparison results will be stored in M10, M11 and M12, as shown below.
2. 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.
3. If users want to get the comparison result ≧, ≦, or ≠, they can connect M10~M12 is series or in parallel.
4. If users want to clear the comparison result, they can use the instruction RST or ZRST.
6-29
AS Ser ies Pro gra mm in g M anu al
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.
2. If users declare the operand D in ISPSoft, the data type will ARRAY [3] of BOOL.
3. 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
6-30
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S
D
Explanation:
1. 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.
2. 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.
3. 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 compared value in S2 is less than the
value in S, D+2 will be ON.
Example:
1. If the operand D is M0, the comparison results will be stored in M0, M1 and M2.
2. 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.
3. If users want to clear the comparison result, they can use the instruction RST or ZRST.
6-31
AS Ser ies Pro gra mm in g M anu al
Additional remark:
1. 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.
2. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
3. 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
6-32
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
n
D
D : Pointer 6_
Explanation:
1. 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.
3. 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.
4. 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.
Example:
1. When X0.0 is switched from OFF to ON, SM609 is OFF. The search for the bits whose states are different (SM607 is
6-33
AS Ser ies Pro gra mm in g M anu al
OFF) starts from the bits specified by the number gotten from the addition of one to the current value of the pointer.
2. 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.
2 Pointer
b0 D20
S1 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
_6 b47
Additional remark:
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.
SM608: The matrix comparison comes to an end. When the last bits are compared, SM608 is ON.
It is the matrix bit search flag. When the matching bits are compared, the comparison stops
SM610:
immediately, and SM610 is ON.
It is the matrix pointer error flag. When the value of the pointer exceeds the comparison range,
SM611:
SM611 is ON.
6-34
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
n
D
Symbol:
S1 : Source device 1
S2 : Source device 2
n : Data length
6_
D : Comparison result
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.
4. 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.
S 1 +( N- 2) 10(BIN) S 2 +( N- 2) 8888(BIN) D +( N- 2) 0
S 1 +( N- 1) 90(BIN) S 2 +( N- 1) 9999(BIN) D +( N- 1) 0
6-35
AS Ser ies Pro gra mm in g M anu al
6. 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 1111(B IN) D 0
S 2 +1 2222(BIN) D +1 0
Compar iosn sign S 2 +2 3333(BIN) D +2 1
S1 3333(BIN) = S 2 +3 4444(BIN) n D +3 0
~
S 2 +( N- 2) 8888(BIN) D +( N- 2) 0
S 2 +( N- 1) 9999(BIN) D +( N- 1) 0
7. The corresponding comparison operation results of the instructions are listed below.
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.
_6
Comparison result
Additional remark:
1. 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.
2. 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.
6-36
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
S : Pointer register
n : Number of devices
D : Check result
6_
Explanation:
1. 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.
4. The instruction CHKADR only can be used in the function block. It is used for the initial program development phase
or when not sure if the device range will be exceeded. After the program is written, this instruction can be deleted.
Example:
6-37
AS Ser ies Pro gra mm in g M anu al
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.
3. Call the function block FB0 in the program, and assign D29999, T0, C511, and HC50 to VarPR1, VarTR1, VarCR1,
and VarHCR1 in FB0 respectively.
_6
4. Use the instruction CHKADR to check whether VarPR1, VarTR1, VarCR1, and VarHCR1 exceed the range.
5. When chkPR is ON, the practical device represented by VarPR1 is D29999. Since the legal range of devices is from
D0 to D29999, and D29999+10-1=D30008, which exceeds the range, PR_ChkBit is OFF.
6. When chkTR is ON, the practical device represented by VarTR1 is T0. Since the legal range of devices is from T0 to
T511, and T0+10-1=T9, which does not exceed the range, TR_ChkBit is ON.
6-38
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
7. When chkCR is ON, the practical device represented by C511. Since the legal range of devices is from C0 to C511,
and C511+10-1=C520, which exceeds the range, CR_ChkBit is OFF.
8. When chkHCR is ON, the practical device represented by HC50 is VarHCR1. Since the legal range of deices is from
HC0 to HC255, and HC50+10-1=HC59, which does not exceed the range, HCR_ChkBit is ON.
Additional remark:
1. 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.
2. 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_
6-39
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S1 : Data source1
S2 : Data source2
S3 : Comparison result
1. The absolute value of the difference between S1 and S2 is compared with the absolute value of S3. Take LDZ= for
example. If the comparison result is that the absolute value of the differencebetween S1 and S2 is equal to the
absolute value of S3, the continuity condition of the instruction is met. If the comparison result is that the absolute
value of the difference between S1 and S2 is not equalto the absolute value of S3, the discontinuity condition of the
instruction is met.
2. Only the 32-bit instruction can use the 32-bit HC device, but not the device E.
6-40
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
Example:
1. When the absolute difference of D10 and D11 is greater than 200, Y0.0 is ON. While the absolute difference is less
than 200, Y0.0 is OFF.
6_
6-41
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S1 : Data source1
S2 : Data source2
S3 : Comparison result
Explanation:
1. The absolute value of the difference between S1 and S2 is compared with the absolute value of S3. Take ANDZ= for
example. If the comparison result is that the absolute value of the differencebetween S1 and S2 is equal to the
absolute value of S3, the continuity condition of the instruction is met. If the comparison result is that the absolute
value of the difference between S1 and S2 is not equalto the absolute value of S3, the discontinuity condition of the
instruction is met.
2. Only the 32-bit instruction can use the 32-bit HC device, but not the device E.
Continuity Discontinuity
API number 16-bit instruction 32-bit instruction
condition condition
0072 ANDZ= DANDZ= | S1- S2|=| S3| | S1- S2| ≠ | S3|
0073 ANDZ<> DANDZ<> | S1- S2|≠| S3| | S1- S2|=| S3|
0074 ANDZ> DANDZ> | S1- S2|>| S3| | S1- S2| ≦ | S3|
6-42
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
Example:
1. When M0 is ON and the absolute difference of D10 and D11 is greater than 200, Y0.0 is ON. While the absolute
difference is less than 200, Y0.0 is OFF.
6_
6-43
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S1 : Data source1
S2 : Data source2
S3 : Comparison result
1. The absolute value of the difference between S1 and S2 is compared with the absolute value of S3. Take ORZ= for
example. If the comparison result is that the absolute value of the differencebetween S1 and S2 is equal to the
absolute value of S3, the continuity condition of the instruction is met. If the comparison result is that the absolute
value of the difference between S1 and S2 is not equalto the absolute value of S3, the discontinuity condition of the
instruction is met.
2. Only the 32-bit instruction can use the 32-bit HC device, but not the device E.
Continuity Discontinuity
API number 16-bit instruction 32-bit instruction
condition condition
0078 ORZ= DORZ= | S1- S2|=| S3| | S1- S2| ≠ | S3|
0079 ORZ<> DORZ<> | S1- S2|≠| S3| | S1- S2|=| S3|
0080 ORZ> DORZ> | S1- S2|>| S3| | S1- S2| ≦ | S3|
6-44
C h a p t e r 6 Ap p l i e d I n s t r u c t i o n s
Example:
1. When M0 is ON and the absolute difference of D10 and D11 is greater than 200, Y0.0 is ON. While the absolute
difference is less than 200, Y0.0 is OFF.
6_
6-45
A S S er i es Pr og r am m ing M an u a l
6-46
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
Data
REAL
UINT
DINT
LINT
TMR
CNT
type INT
S1
S2
D
Symbol:
S1 : Augend
S2 : Addend
D : Sum 6_
Explanation:
1. The binary value in S2 is added to the binary value in S1, and the sum is stored in D.
2. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
3. The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the operation result exceeds the range of 16-bit binary values, SM602 is ON. Otherwise, it is OFF.
6-47
A S S er i es Pr og r am m ing M an u a l
When the operation result exceeds the range of 32-bit binary values, SM602 is ON. Otherwise, it is OFF.
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.
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.
Example 2:
_6
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,
When the values in (D31, D30) and (D41, D40) are 11111111 and 44444444 respectively, (D31, D30) plus (D41,
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
6-48
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
Flag:
4,294,967,295 、0、1
6_
4,294,967,295 、0、1 4,294,967,295 、0、1、2
6-49
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Minuend
S2 : Subtrahend
D : Difference
_6
Explanation:
1. The binary value in S2 is subtracted from the binary value in S1, and the difference is stored in D.
2. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
3. The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
5. 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,
6-50
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
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.
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
When the values in (D31, D30) and (D41, D40) are 55555555 and 11111111 respectively, (D31, D30) minus (D41,
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
6-51
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Multiplicand
S2 : Multiplier
D : Product
_6
Explanation:
1. The signed binary value in S1 is multiplied by the singed binary value in S2, and the product is stored in D.
S1 S2 D +1 D
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.
6-52
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
S 1 +1 S1 S 2 +1 S2 D +3 D +2 D +1 D
* =
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
6_
D0×D10=(D21, D20)
6-53
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Dividend
S2 : Divisor
D : Quotient; remainder
_6
Explanation:
1. The singed binary value in S1 is divided by the signed binary value in S2. The quotient and the remainder are stored
in D.
3. When the sign bit is 0, the value is a positive one. When the sign bit is 1, the value is a negative one.
Quotient Remainder
S1 S2 D D+1
6-54
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
Quotient Remainder
S 1 +1 S1 S 2 +1 S2 D+1 D 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_
Additional remark:
1. If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. If the divisor is 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2012.
3. 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.
4. 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-55
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Augend
S2 : Addend
D : Sum
Explanation:
_6
1. This instruction is an operation for the addition of 32-bit single-precision floating-point numbers.
2. The floating-point number in S2 is added to the floating-point number in S1, and the sum is stored in D.
3. The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the absolute value of the operation result is less than the value which can be represented by the
When the absolute value of the operation result is larger than the value which can be represented by the
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-56
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
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_
6-57
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Minuend
S2 : Subtrahend
D : Difference
_6
Explanation:
1. This instruction is an operation for the subtraction of 32-bit single-precision floating-point numbers.
2. The floating-point number in S2 is subtracted from the floating-point number in S1, and the difference is store in D.
3. The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the absolute value of the operation result is less than the value which can be represented by the
When the absolute value of the operation result is larger than the value which can be represented by the
S 1 +1 S1 S 2 +1 S2 D+1 D
6-58
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
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).
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_
6-59
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Multiplicand
S2 : Multiplier
D : Product
_6
Explanation:
1. This instruction is an operation for the multiplication of 32-bit single-precision floating-point numbers.
2. The floating-point number in S1 is multiplied by the floating-point number in S2, and the product is stored in D.
3. The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the absolute value of the operation result is less than the value which can be represented by the
When the absolute value of the operation result is larger than the value which can be represented by the
S 1 +1 S1 S 2 +1 S2 D+1 D
6-60
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
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).
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_
6-61
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Dividend
S2 : Divisor
D : Quotient
_6
Explanation:
1. This instruction is an operation for the division of 32-bit single-precision floating-point numbers.
2. 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.
3. The Flags: SM600 (zero flag), SM601 (borrow flag), and SM602 (carry flag)
When the absolute value of the operation result is less than the value which can be represented by the
When the absolute value of the operation result is larger than the value which can be represented by the
S 1 +1 S1 S 2 +1 S2 D +1 D
6-62
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
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
Additional remark:
1. If the divisor is 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2012.
2. 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_
6-63
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
n
D
Symbol:
S1 : Augend
S2 : Addend
n : Data length
_6 D : Sum
Explanation:
1. 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 values, and the sums are stored in D.
5. For the 16-bit instructions, when the operation result is less than –32,768, SM601 is ON.
6. For the 16-bit instructions, when the operation result is larger than 32,767, SM602 is ON.
7. For the 32-bit instructions, when the operation result is less than–21,474,836,488, SM601 is ON.
8. For the 32-bit instructions, when the operation result is larger than 2,147,483,647, SM602 is ON.
6-64
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
9. Take the 16-bit instruction as an example, when the operand S2 is a device (not a constant or a hexadecimal value):
} } }
S1 1 S2 1 D 1+1=2
S1 +1 2 + S2 +1 2 = D +1 2+2=4
.
.
.
.
n .
.
.
.
n .
.
.
. n
. . .
. . . . . .
. .
. .
. .
10. Take the 16-bit instruction as an example, when the operand S2 is a constant or a hexadecimal value:
} } }
S1 1 S2 10 D 1+10=11
S1 +1 2 + S2 10 = D +1 2+10=12
.
.
.
.
n .
.
.
.
n .
.
.
. 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_
D0 1 D10 10 D100 11
D1 2 D11 11 D101 13
D2 3 + 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.
6-65
A S S er i es Pr og r am m ing M an u a l
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. For the 16-bit instructions, 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.
2. For the 32-bit instructions, if the devices S1~S1+2*n-1, S2~S2+2*n-1, or D~D+2*n-1 exceed the device range, the
instruction is not executed, SM is ON, and the error code in SR0 is 16#2003.
_6
3. If n<1 or n>256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
4. For the 16-bit instructions, 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.
5. For the 32-bit instructions, if S1~S1+2*n-1 overlap D~D+2*n-1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200C.
6. For the 16-bit instructions, 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.
7. For the 32-bit instructions, if S2~S2+2*n-1 overlap D~D+2*n-1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200C.
6-66
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
n
D
Symbol:
S1 : Minuend
S2 : Subtrahend
n : Data length
D : Difference
6_
Explanation:
1. n pieces of data in devices starting from S2 are subtracted to those in devices starting from S1. The minuends and
the subtrahends are binary values, and the differences are stored in D.
5. For the 16-bit instructions, when the operation result is less than –32,768, SM601 is ON.
6. For the 16-bit instructions, when the operation result is larger than 32,767, SM602 is ON.
7. For the 32-bit instructions, when the operation result is less than–21,474,836,488, SM601 is ON.
6-67
A S S er i es Pr og r am m ing M an u a l
8. For the 32-bit instructions, when the operation result is larger than 2,147,483,647, SM602 is ON.
9. Take the 16-bit instruction as an example, when the operand S2 is a device (not a constant or a hexadecimal value):
} } }
S1 5 S2 1 D 5-1=4
S1 +1 4 - S2 1 = D +1 4-1=3
.
.
.
.
n .
.
.
.
n .
.
.
. n
. . .
. . . . . .
. .
. .
. .
10. Take the 16-bit instruction as an example, when the operand S2 is a constant or a hexadecimal value:
} } }
S1 5 S2 1 D 5-1=4
S1 +1 4 - S2 1 = D +1 4-1=3
.
.
.
.
n .
.
.
.
n .
.
.
. 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
_6
D0 5 D10 1 D100 4 1
D1 4 D11 2 D101 2 SM6 00
D2 3 - D12 3 D102 0
D3 2 D13 4 D103 -2
D4 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.
6-68
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
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. For the 16-bit instructions, 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.
2. For the 32-bit instructions, if the devices S1~S1+2*n-1, S2~S2+2*n-1, or D~D+2*n-1 exceed the device range, the
instruction is not executed, SM is ON, and the error code in SR0 is 16#2003.
3. If n<1 or n>256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B. 6_
4. For the 16-bit instructions, 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.
5. For the 32-bit instructions, if S1~S1+2*n-1 overlap D~D+2*n-1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200C.
6. For the 16-bit instructions, 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.
7. For the 32-bit instructions, if S2~S2+2*n-1 overlap D~D+2*n-1, the instruction is not executed, SM0 is ON, and the
error code in SR0 is 16#200C.
6-69
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : String 1
S2 : String 2
Explanation:
_6 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.
2. When the data source for S1, S2 or Operand D is not a string ($), the content of the data source is up to 256
3. The string in the operand S1 and the string in the operand S2 are linked and moved to the operand D, as illustrated
below.
S1 B (1 6# 62 ) A (1 6# 61 ) S2 B (1 6# 42 ) A (1 6# 41 ) D B (1 6# 62 ) A (1 6# 61 )
D( 16 #6 4) C( 16 #6 3) S2 +1 D( 16 #4 4) C( 16 #4 3) D( 16 #6 4) C( 16 #6 3)
S 1 +1 = D +1
S 1 +2 ( 16 #0 0) E (1 6# 65 ) 1 2 (1 6# 00 )
S2 + (1 6# 00 ) D +2 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)
6-70
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
S1 B (1 6# 62 ) A (1 6# 61 ) S2 B (1 6# 42 ) A (1 6# 41 ) D d (1 6# 62 ) a (1 6# 61 )
D( 16 #6 4) C( 16 #6 3) S2 +1 D( 16 #4 4) C( 16 #4 3) d (1 6# 64 ) c( 16 #6 3)
S 1 +1 = D +1
S 1 +2 E (1 6# 65 ) ( 16 #0 0) S2 +
12 (1 6# 00 ) (1 6# 00 ) D +2 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)
4. When the data source for S1, S2 or Operand D is not a string ($),the ending code 16#00 should be added to the end
5. 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
S1 b(16#62) a(16#61)
S 1 +1 d(16#64) c(16#63)
S 1 +2 (16#00) e(16#65)
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
Additional remark:
2. If D is not sufficient to contain the string composed of the strings in S1 and S2, the instruction is not executed, SM0 is
3. If the string of S1+S2 is with more than 256 character (the ending code 16#00 included), the instruction is not
4. If S1 or S2 overlaps D, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200C.
5. 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.
6-71
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
D : Destination device
Explanation:
3. When the 16-bit operation is performed, 32,767 plus 1 equals -32,768. When the 32-bit operation is performed,
Example:
When X0.0 is switched from OFF to ON, the value in D0 increases by one.
6-72
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
D : Destination device
Explanation:
3. When the 16-bit operation is performed, -32,768 minus 1 leaves 32,767. When the 32-bit operation is performed,
Example:
When X0.0 is switched from OFF to ON, the value in D0 decreases by one.
6-73
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Multiplicand
S2 : Multiplier
D : Product
_6
Explanation:
1. The signed binary value in S1 is multiplied by the singed binary value in S2, and the product is stored in D.
S1 S2 D
* =
Bit 15 is a sign bit. Bit 15 is a sign bit. Bit 15 is a sign bit.
The product gotten is a 16-bit value. It is stored in D which is a 16-bit register. If b15 in D is 0, the product stored
6-74
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
S 1 +1 S1 S 2 +1 S2 D +1 D
Bit 31 is a si gn bit.
* Bit 31 is a si gn bit.= Bit 31 is a si gn bit.
The product gotten is a 32-bit value. It is stored in (D, D+1) which is a 32-bit register. If b31 in D is 0, the product stored in
(D, D+1) is a positive value. If b31 in D is 1, the product stored in (D, D+1) is a negative value.
Example:
The 16-bit value in D0 is multiplied by the 16-bit value in D10, and the product is stored in D20. Whether the product is a
positive value or a negative value depends on the leftmost bit (bit 15) in D20. If bit 15 in D20 is 0, the product stored in D20
is a positive value. If bit 15 in D20 is 1, the product stored in D20 is a negative value.
D0×D10=D20
6_
16-bit value×16-bit value=16-bit value
Additional remark:
1. If the product of a 16-bit multiplication is not a 16-bit signed value available, and is greater than the maximum 16-bit
positive number K32767, or less than the minimum negative number K-32768, the carry flag SM602 will be ON, and
2. If users need the complete result of a 16-bit multiplication (a 32-bit value), they have to use API 0102 */*P. Please
3. If the product of a 32-bit multiplication is not a 32-bit signed value available, and is greater than the maximum 32-bit
positive number K2147483647, or less than the minimum negative number K-2147483648, the carry flag SM602
4. If users need the complete result of a 32-bit multiplication (a 64-bit value), they have to use API 0102 D*/D*P. Please
6-75
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Dividend
S2 : Divisor
D : Quotient; remainder
_6
Explanation:
1. The singed binary value in S1 is divided by the signed binary value in S2. The quotient is stored in D.
Quotient
S1 S2 D
6-76
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
Quotient
S 1 +1 S1 S 2 +1 S2 D+1 D
Example:
When X0.0 is ON, the dividend in D0 is divided by the divisor in D10, and the quotient is stored in D20.
Whether the quotient is a positive value or a negative value depends on the leftmost bit in D20.
Additional remark:
1. If the device used is not available, the instruction will not be executed, SM0 will be ON, and the error code stored in
2. If the divisor used is 0, the instruction will not be executed, SM0 will be ON, and the error code stored in SR0 will be 6_
16#2012.
3. If you want to store the remainder gotten, you have to use “/” instruction (Division of binary values). Please refer to
6-77
A S S er i es Pr og r am m ing M an u a l
0206 MMOV – Converting the 16-bit value into the 32-bit value
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
6-78
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
6_
Explanation:
1. The binary value in S is converted into the binary-coded decimal value, and the conversion result is stored in D.
2. Only the instruction DBCD can use the 32-bit counter, but not the device E.
3. 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
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.
6-79
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. 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.).
2. 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
6-80
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
Explanation:
1. The binary-coded decimal value in S is converted into the binary value, and the conversion result is stored in D.
6_
2. 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.
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
4. Constants and hexadecimal values are converted into binary values automatically. Therefore, users do not need to
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.
6-81
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. 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
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
When X1.0 is ON, the binary-coded decimal value in X0.0~X0.15 is converted into the binary value, and the
conversion result is stored in D100. Subsequently, the binary value in D100 is converted into the binary-coded
_6
3 2 1 0
10 10 10 10
F our -digit binary -coded
6 6 4 2 decimal ty pe of DIP s witch
8 1 8 1 8 1 8 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
6-82
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
Explanation:
1. The instruction is used to convert the binary integer into the single-precision floating-point number. 6_
2. The operand S used in the instruction FLT cannot be the 32-bit counter, but not the device E.
3. The source device S used in the instruction FLT occupies one register, and D used in FLT occupies two registers.
4. 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.
Example 1:
1. When X0.0 is ON, the binary integer in D0 is converted into the single-precision floating-point number, and the
6-83
A S S er i es Pr og r am m ing M an u a l
2. When X0.1 is ON, the binary integer in (D1, D0) is converted into the single-precision floating-point number, and the
3. Suppose the value in D0 is 10. When X0.0 is ON, 10 is converted into the single-precision floating-point number
4. 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).
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
stored in D200.
The binary integer in D200 is converted into the single-precision floating-point number, and the conversion
The constant 615 is divided by the constant 10, and the quotient which is the single-precision floating-point
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,
6-84
Ch a pt er 6 A pp l i e d I n str uc t io ns
The single-precision floating-point number in (D21, D20) is converted into the binary integer, and the
1 2 5 4 7
(D3 1 ,D3 0 )
D eci mal f lo ati ng -po in t nu mb er
(D1 0 1,D 1 00 ) (D2 0 0) BIN (D3 0 1,D 3 00 )
8
Single- pr ecisi on
(D4 1 ,D4 0 )
Single- pr ecisi on 3
floati ng- point number floati ng- point number 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_
6-85
A S S er i es Pr og r am m ing M an u a l
_6
6-86
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
6_
Explanation:
1. 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
2. The source device S used in the instruction INT occupies two registers, and D used in INT occupies one register.
3. The source device S used in the instruction DINT occupies two registers, and D used in DINT also occupies two
registers.
4. The operand D used in the instruction INT cannot be the 32-bit counter, but not the device E.
7. During the conversion, if the floating-point number is rounded down to the nearest whole digit, SM601 will be ON.
6-87
A S S er i es Pr og r am m ing M an u a l
9. For the instruction INT/IINTP, the range of conversion results is between -32,768 and 32,767.
10. For the instruction DINT/DINTP, the range of conversion results is between -2,147,483,648 and 2,147,483,647.
Example:
1. 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.
2. 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
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
6-88
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
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.
6_
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.
b 15 b0
0 Plus sign
1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D4
1 Minus sign
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-89
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
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.
_6 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
1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D4
b15 b0
6-90
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
Explanation:
6_
1. The binary value in the device specified by S is converted into the Gray code, and the conversion result is stored in
2. Only the instruction DGRY can use the 32-counter, but not the device E.
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.
6-91
A S S er i es Pr og r am m ing M an u a l
b15 b0
K6513=H1971 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1
Y1.15 Y1.0
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
6-92
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Conversion result
Explanation:
1. The Gray code in the device specified by S is converted into the binary value, and the conversion result is stored in
6_
the device specified by D.
2. 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.
3. Only the instruction DGBIN can use the 32-counter, but not the device E.
The value in the device D used in the 16-bit instruction should be within the range between 0 and 32,767.
The value in the device D 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.
6-93
A S S er i es Pr og r am m ing M an u a l
X0
X0.15 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
6-94
Ch a pt er 6 A pp l i e d I n str uc t io ns
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
Explanation:
1. The instruction is used to convert the negative binary value into the absolute value.
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
Example 2:
th
1. When the value of the 15 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
6-95
A S S er i es Pr og r am m ing M an u a l
Example 3:
_6
6-96
Ch a pt er 6 A pp l i e d I n str uc t io ns
Additional remark:
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_
6-97
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
Explanation:
Example:
Before the instruction is executed, the value in (D1, D0) is the negative value 16#AE0F9000. When X0.0 is switched from
_6 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-98
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Data source
D : Conversion result
Explanation:
1. The single-precision floating-point number in the register specified by S is converted into the decimal floating-point
FBCD is used to convert the single-precision floating-point number into the decimal floating-point number.
3. 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
When the absolute value of the conversion result is less than the value which can be represented by the minimum
Example:
When X0.0 is ON, the single-precision floating-point number in (D1, D0) is converted into the decimal floating-point
6-99
A S S er i es Pr og r am m ing M an u a l
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
_6
6-100
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Data source
D : Conversion result
Explanation:
1. The decimal floating-point number in the register specified by S is converted into the single-precision floating-point
3. The value in D should be a single-precision floating-point number, and the values in S and S+1 represent the
4. The instruction FBIN is used to convert the decimal floating-point number into the single-precision floating-point
number.
5. 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:
1. When X0.0 is ON, the decimal floating-point number in the register in (D1, D0) is converted into the single-precision
6-101
A S S er i es Pr og r am m ing M an u a l
Binary floating-point number D3 D2 Real number: 23 bits; Ex ponent: 8 bits ; sign: 1 bit
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 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
2. When X0.0 is ON, K314 and K-2 are moved to D0 and D1 respectively, and combine into the decimal floating-point
-2
number (3.14=314×10 ).
_6
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-102
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Data source
n : Data length
D : Conversion result
Explanation:
6_
1. n pieces of data (the binary values) in devices starting from S are converted into the binary-coded decimal values,
Example:
When M1 is ON, the binary values in D0 and D1 are converted into the binary-coded decimal values, and the conversion
Additional remark:
1. 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.
6-103
A S S er i es Pr og r am m ing M an u a l
2. 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
3. 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
4. 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
6-104
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Data source
n : Data length
D : Conversion result
Explanation: 6_
1. n pieces of data (the binary-coded decimal values) in devices starting from S are converted into the binary values,
2. The binary-coded decimal value in S should be within the range between 0 and 9,999.
Example:
When M1 is ON, the binary-code decimal values in D0 and D1 are converted into the binary values, and the conversion
6-105
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. 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.
2. 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
3. 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
4. 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
6-106
Ch a pt er 6 A pp l i e d I n str uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
S1 : Data source
S2 : Slope
S3 : Offset
D : Destination device 6_
Explanation:
2. 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.
6-107
A S S er i es Pr og r am m ing M an u a l
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
Destination value
D
Slope=168
Offset=-4
Sourc e value
0 S 1=500
Example 2:
1. Suppose the values in S1, S2, and S3 are 500, -168, and 534 respectively. When X0.0 is ON, the instruction SCAL is
6-108
Ch a pt er 6 A pp l i e d I n str uc t io ns
Additional remark:
1. Only when the slope and the offset are known can the instruction SCAL be used. If the slope and the offset are 6_
unknown, users are suggested to use the instruction SCLP to perform the operation.
2. When the 16-bit instruction is performed, 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. If the value in S2 exceeds the range,
3. When the 32-bit instruction is performed, the value entered into S2 should be within the range between
-2,147,483,648 and 2,147,483,647. (The practical value is within the range between -2,147,483,648 and
2,147,483,647. If the value in S2 exceeds the range, please use the instruction SCLP to do the operation.
4. 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.
5. When the 16-bit instruction is performed, 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. When the 32-bit instruction is performed, if the value in D is larger than 2,147,483,647, the value stored in D will be
2,147,483,6477. If the value in D is less than -2,147,483,648, the value stored in D will be -2,147,483,648.
6-109
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Data source
S2 : Parameter
D : Destination device
_6
Explanation:
1. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
32-bit instruction
16-bit
Constant
instruction
SM685 ON SM685 OFF
Constant X
hexadecima
X
l
Floating
X X
number
The flag SM685 (whether to use floating point operation or not) can only be used for 32-bit instructions.
6 - 11 0
Ch a pt er 6 A pp l i e d I n str uc t io ns
Setting range
Device number Parameter
Integer Floating-point number
floating-point numbers
S2+4、5 Maximum destination value 2,147,483,647
7. 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.
8. The operation equation in the instruction: D=[(S1–Minimum source value)×(Maximum destination value–Minimum
destination value)]÷(Maximum source value)+Minimum destination value
9. The operational relation between the source value and the destination value:
y=kx+b
value)
6 - 111
A S S er i es Pr og r am m ing M an u a l
The parameters above are being substituted for y, k, x, and b in the equation y=kx+b, and the operation equation in
10. 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
_6
Example 1:
1. 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
80.35 is rounded off to the nearest whole digit, and becomes 80. 80 is stored in D10.
6 - 11 2
Ch a pt er 6 A pp l i e d I n str uc t io ns
Destinati on value
Maximum destination
value =500
6_
D
Minimum des ti nation
value =30 S 1=500
Sourc e value
0 Minimum Maximum
sourc e value =200 sourc e value =3000
Example 2:
1. 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
449.64 is rounded off to the nearest whole digit, and becomes 450. 450 is stored in D10.
6 - 11 3
A S S er i es Pr og r am m ing M an u a l
_6
Example 3:
1. 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.
80.35 is rounded off to the nearest whole digit, and becomes 80.0. 80.0 is stored in D10.
6 - 11 4
Ch a pt er 6 A pp l i e d I n str uc t io ns
6_
Additional remark:
1. The value in S1 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
6 - 11 5
A S S er i es Pr og r am m ing M an u a l
2. 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
3. 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.
4. 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.
5. When the maximum source value is the same as the minimum source value, the instruction will not be executed and
it will be seen as an operation error; SM0 will be ON and the error code in SR0 is 16#2012.
6. If the operand S2 used during the execution of the 16-bit instruction is declared in ISPSoft, the data type will be
7. If the operand S2 used during the execution of the 32-bit instruction is declared in ISPSoft, the data type will be
_6
6 - 11 6
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Instruction code
API Pulse instruction Function
16-bit 32-bit
0308 SWAP DSWAP Exchange the high byte with the low byte
6_
6 - 11 7
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Data source
D : Data destination
_6
Explanation:
1. 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.
2. Only the data in S which is used in the 32-bit instruction can be the floating-point number.
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example:
1. 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
6 - 11 8
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
2. 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).
3. 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_
6 - 11 9
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Data source
D : Data destination
Explanation:
1. When the operand S is a string and the insturction is executed, the string is transferred to D, and the code 16#00 is
_6 added to the end of the data
2. When the operand S is not a string, the code 16#00 should be added to the end of the data transferred.
3. When the ending code16#00 cannot be found in S for 256 characters in a row or even beyond the device range, the
instruction is not executed; SM0 is ON and the error code in SR0 is 16#200E.
4. 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.
5. If D is not sufficient to contain the string composed of the strings in S, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
6. 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.
6-120
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
7. When 16#00 appears in the low byte, the execution of the instruction is as follows.
8. When 16#00 appears in the high byte, the execution of the instruction is as follows.
6-121
A S S er i es Pr og r am m ing M an u a l
9. 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.
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.
_6
The operand S:
Hexadecimal
16#31 16#32 16#33 16#34
value
D3 Unchanged Unchanged
6-122
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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:
Hexadecimal
16#31 16#32 16#33 16#34 16#35
value
D3 Unchanged Unchanged 6_
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:
6-123
A S S er i es Pr og r am m ing M an u a l
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.
The operand S:
D3 Unchanged Unchanged
6-124
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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
The operand S:
D5 Unchanged Unchanged
6-125
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Data source
D : Data destination
Explanation:
_6 1. 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.
2. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example 1:
When X0.0 is ON, all bit in D1 are inverted, and the conversion result is stored in Y0.0~Y0.15.
b 15 b3 b2 b1 b0
D1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Sign bi t (0: P os itive s ign; 1: Negativ e si gn)
Y0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Inversi on resul t
6-126
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example 2:
6_
6-127
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Data source
D : Data destination
n : Data length
_6
Explanation:
1. 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.
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
4. 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 (using the 16-bit instruction as an example).
When the device number of S is larger than the device number of D, the data is transferred in the order from to .
1
D 20 D 19
2
D 21 D 20
3
D 22 D 21
6-128
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
When the device number of S is less than the device number of D, the data is transferred in the order from to .
1
D 19 D 20
2
D 20 D 21
3
D 21 D 22
Example 1:
D0 D20
D1 D21
N=4
D2 D22
D3 D23
Example 2:
In order to prevent the error which results from the overlap between the source devices and the destination devices, the
1
D20 D19
2
D21 D20
3
D22 D21
6-129
A S S er i es Pr og r am m ing M an u a l
2. When the device number of S is less than the device number of D, the data is transferred in the order from to .
1
D10 D11
2
D11 D12
3
D12 D13
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.
3. 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
6-130
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Data source
D : Data destination
n : Data length
6_
Explanation:
1. When the instruciton is executed, the data in S is transferred to the n devices starting from the device specified by D.
3. The operand n used in the instruction NMOV should be within the range between 1 and 256.
S S D
S D+1
S D+2 N=5
S D+3
S D+4
6-131
A S S er i es Pr og r am m ing M an u a l
Example:
Additional remark:
1. If D~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 the operand n used in the 16-bit instruciton is larger than 256 or less than 1, the instruction is not executed, SM0
_6
6-132
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
Explanation: 6_
1. The data in the device specified by S1 is exchanged with the data in the device specified by S2.
2. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example 1:
When X0.0 is switched from OFF to ON, the data in D20 is exchanged with the data in D40.
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 After the instruction
is executed: 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
6-133
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
n
Symbol:
n : Data length
_6 Explanation:
1. 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.
2. The operand n used in the instruction should be within the range between 1 and 256.
6-134
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example:
When X0.0 is ON, the data in D10~D14 is exchanged with the data in D100~D104.
D10 D11 D12 D13 D14 D100 D101 D102 D103 D104
1 2 3 4 5 16 17 18 19 20
D10 D11 D12 D13 D14 D100 D101 D102 D103 D104
16 17 18 19 20 1 2 3 4 5
Additional remark:
1. 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.
2. If S2+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is
6_
16#2003.
3. 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-135
A S S er i es Pr og r am m ing M an u a l
0308 D SWAP P S Exchange the high byte with the low byte
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
S : Data source
Explanation:
1. 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.
_6 2. 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
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
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
6-136
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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 D10
High byte Low byte High byte Low byte
6_
6-137
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S
m1
m2
D
n
Symbol:
S : Data source
Start digit which will be transferred from the
m1 :
_6
source device
m2 : Number of digits which will be transferred
D : Data destination
Start digit where the source data is stored in
n :
the destination device
Explanation:
1. The instruction can be used to allocate and combine the data. When the instruction is executed, the m2 digits of the
th
number which start from the m1 digit of the number in S are transferred to the m2 digits of the number which starts
th
from the n digit of the number in D.
2. 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.)
3. When SM605 is OFF, the data involved in the instruction is binary-coded decimal numbers.
6-138
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Suppose the number in S is K1234, and the number in D is K5678. After the instruction is executed, the number in S
4. When SM605 is ON, the data involved in the instruction is binary numbers.
th rd nd st
4 digit 3 digit 2 digit 1 digit
D10 ( 16- bit binary number )
Suppose the number in S is 16#1234, and the number in D is 16#5678. After the instruction is executed, the number
Example 1: 6_
1. 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
3
is executed, the digits in the thousands place of the decimal number (10 ) and the ones place of the decimal number
0
(10 ) in D20 are unchanged.
2. 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.
6-139
A S S er i es Pr og r am m ing M an u a l
Suppose the number in D10 is 1234, and the number in D20 is 5678. After the instruction is executed, the number in
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 decimal numbers, and the digit which is
6-140
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
th rd nd st
4 digit 3 digit 2 digit 1 digit
D10 ( 16- bit binary number )
Suppose the number in D10 is 16#1234, and the number in D20 is 16#5678. After the instruction is executed, the
Example 3:
1. The instruction can be used to combine the values of the DIP switches which are connected to the input terminals
2. 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
3. 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 1 0
10 10 10
6_
6 4 2
8 1 8 1
8 1
X0.3~X0.0 X1.15~X1.0
PLC
6-141
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. 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
3. 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.
4. 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-142
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Data source
n : Data length
D : Data destination
Explanation:
1. When the instruciton is executed, n pieces of data in devices starting from the device specified by S are transferred
2. When S is T, C or HC, only the state of the device is transferred, and the current value of the device is not
transferred.
3. 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:
6-143
A S S er i es Pr og r am m ing M an u a l
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
6-144
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
6_
6-145
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
Symbol:
S : Jump destination
Explanation:
1. 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.
_6 2. If the program specified by the label is prior to the instruction CJ, the watchdog timer error will occur, and the PLC
4. 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 keeps counting and when the set time is reached, the output T-coil will be driven.
For more information on the instructions MC and MCR, please refer to the example 2 below.
Example 1:
1. When X0.0 is ON, the execution of the program jumps from NETWORK1 to LABEL1 (NETWORK3) and skips the
NETWORK2.
2. When X0.0 is OFF, the execution of the program starts from NETWORK1 to NETWORK3 in sequence, and the
6-146
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example 2:
1. 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
(b) The execution of the program jumps from the part of the program outside the MC/MCR loop to the part of the
(c) The execution of the program jumps from the part of the program inside the MC/MCR loop to the part of the
(e) The execution of the program jumps from the part of the program inside one the MC/MCR loop to the part of
2. 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 cannot 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-147
A S S er i es Pr og r am m ing M an u a l
_6
6-148
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example 3:
State of the contact State of the contact during the State of the output coil during the
M1, M2, and M3 are M1, M2, and M3 are switched from *1
Y0.1 , M20, and S1 are OFF.
OFF. OFF to ON.
Y, M, and S
M1, M2, and M3 M1, M2, and M3 are switched from *1
Y0.1 , M20, and S1 are ON.
are ON. ON to OFF.
driven.
6_
M7 and M10 are
M10 is ON/OFF. The counter is not enabled.
OFF.
Counter
M7 is OFF. M10 is C0 stops counting. When M0 is
M10 is ON/OFF.
ON/OFF. switched OFF, C0 keeps counting.
M11 is OFF. M11 is switched from OFF to ON The applied instruction is not executed.
Applied
The applied instruction which is
instruction M11 is ON. M11 is switched from ON to OFF
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.
6-149
A S S er i es Pr og r am m ing M an u a l
_6
6-150
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
Please refer to ISPSoft User Manual for more information about the use of the label (Pointer).
6_
6-151
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
Symbol:
S : Jump destination
Explanation:
1. The execution of the program jumps to the part of the program specified by the label (pointer) without any condition.
2. If the program specified by the label is prior to the instruction JMP, the watchdog timer error will occur, and the PLC
_6
will stop running. Please use the instruction carefully.
3. Please refer to the instruction CJ for more information on the states of the devices while executing the instruction.
4. Please refer to ISPSoft User Manual for more information about the use of the label (Pointer).
6-152
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Symbol:
Explanation:
1. When the condition is met, the execution of the program jumps to END in the program.
2. Function blocks and interrupt tasks do not support the instruction. Besides, the instruction cannot be etween the
instruction FOR and the instruction NEXT.
3. When the instruction GOEND is executed, the instructions skipped are not executed, the data in all devices is
6_
6-153
A S S er i es Pr og r am m ing M an u a l
_6
6-154
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
Symbol:
Explanation:
6_
6-155
A S S er i es Pr og r am m ing M an u a l
Symbol:
Explanation:
1. The use of the instruction EI indicates that the interrupt task is allowed to be used in the program. (Please refer to
2. 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.
3. During the execution of one interrupt task, a new interrupt 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. For example,
during the execution of I0 (#1), 2 new I0 (#2, #3) are generated, only #2 I0 will be memorized.
4. When several interrupts occur, the interrupt task which should be executed first has higher priority. When several
_6 interrupts occur simultaneously, the interrupt task whose pointer number is smaller is executed first.
5. When the interrupt task occurring between DI and EI, it cannot be executed, and the interrupt request will be
ignored. It is suggested not to use the instruction DI to disable interrupts while PLC operates.
6. When the immediate I/O signal is required in the execution of the interrupt task, users can use the instruction REF
or the device DX/DY in the program to refresh the state of the I/O.
7. Every interrupt number is with a temporary maskable function. Please refer to the following page for the list of
interrupt numbers.
Example:
When the PLC runs and once the program Cyclic_0 scans the instruction EI, the interrupt task I601 is enabled and
the interrupt task is executed. When the execution of the interrupt task is complete, the main program is executed.
6-156
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
When M2 is ON, the SR623 is 0 and the I601 timed interrupt task will be disabled.
When M3 is ON, the SR623 is 1 and the I601 timed interrupt task will be enabled.
6_
6-157
A S S er i es Pr og r am m ing M an u a l
M 0=ON
Execut e t he instructio n EIX
to en able inte rrup t
M 1=ON
SR6 23= 0
int erru pt disable d
M 2=ON
M 3=ON
0.5
Y0.0 0.5 s ec
s ec
Additional remark:
I000 represents the input X0.0 is falling edge triggered. I100 represents the input X0.1 is rising edge triggered. I101
represents the input X0.1 is falling edge triggered. And the rest can be done in the same manner.
_6 This type of interrupts can be further divided into 6 groups. Each group is corresponding to a hardware high-speed
counter. (refer to the instruction DCNT for more information). Each group is assigned with 4 interrupt numbers (refer to
the instruction DHSCS for more information). For example, the interrupt numbers for the first group is I200~I203, and
for the second group is I210~I213 and so on.
There are 8 interrupts for software high-speed comparators and these 8 interrupts are shared with 8 high-speed
counters.
4. Communication interrupts
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 API1812 COMRS for more information.
COM1: I300
COM2: I302
Card 1: I304
Card 2: I306
6-158
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
Each module is assigned with one interrupt. Users can set up 1 interrupt service for each extension module.
When the pulse outputting is complete, the interrupt request will be sent; the interrupts (I500~I505) for the complete
execution of the positioning instruction should work with special devices (SM) to activate the interrupt service. For
example, when the instruction DDRVI completes the execution of the first axis, the interrupt request I500 will be sent;
users can set the SM471 to ON to activate the interrupt service. The interrupts (I510~I519) for the complete execution
of the position planning table instruction should work with the instruction TPO. When the pulse outputting is complete,
The timer interrupts I601~I603: The default value is 10 milliseconds (unit: 1ms) (1~2000 milliseconds).
The timer interrupts I604: The default value is 1 milliseconds (unit: 0.1ms) (0.1~200 milliseconds).
The complete interrupt numbers, descriptions and the maskable interrupts (SR) are listed below.
6-159
A S S er i es Pr og r am m ing M an u a l
6-160
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
high-speed counter 2
6-161
A S S er i es Pr og r am m ing M an u a l
I301 Reserved 1
I303 Reserved 3
SR628
Receiving some specific word to trigger communication
4
I304 interruption in function card 1
I305 Reserved 5
I307 Reserved 7
6-162
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
6-163
A S S er i es Pr og r am m ing M an u a l
Note: When several interrupts occur simultaneously, the interrupt task whose pointer number is smaller will be executed
first. PLC will complete the execution of the on-going interrupt, and then execute other occurring interrupts according to
their pointer number. For example, during the execution of the interrupt I400, if I500 and I300 occur simultaneously,
after the execution of I400 is done, PLC will execute the I300 (smaller pointer number).
_6
6-164
Ch a pt er 6 A pp l i e d I n s tr uc t io ns
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
Symbol:
S : Data source
Explanation:
1. Only decimal numbers can be inputted in S and the number inputted should be an interrupt number. If the number
inputted is not an interrupt number, the instruction will not be executed and no warning will be shown. Users should
input EIX500 when they wish to enable the interrupt I500. Please refer to the interrupt number list in the explanation
3. Users can use the instruction to enalbe the interrupt tasks in SR623~SR634.
4. If the instruction is not executed, an interrupt task to be performed or not is up to the contents of SR623~SR634.
5. Please refer to the examples in API0501 the instruction EI for more information.
6-165
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
Symbol:
S : Data source
Explanation:
1. Only decimal numbers can be inputted in S and the number inputted should be an interrupt number. If the number
inputted is not an interrupt number, the instruction will not be executed and no warning will be shown. Users should
input DIX500 when they wish to disable the interrupt I500. Please refer to the interrupt number list in the explanation
_6
2. The default for interrupt tasks in the AS series is enabled. Users can use the instruction DIX to disable the interrupts.
3. Users can use the instruction to disable the interrupt tasks in SR623~SR634.
4. If the instruction is not executed, an interrupt task to be performed or not is up to the contents of SR623~SR634.
5. Please refer to the examples in API0501 the instruction EI for more information.
6-166
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
6_
6-167
AS Series Programming Manual
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
_6 Explanation:
1. 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, when users need the latest I/O data in the
operation process, they can use this instruction or use the device DX/DY to execute input/output.
Example 1:
1. When X0.0 is ON, the PLC reads the states of the inputs X0.0~X0.15 immediately. The input signals are refreshed
6-168
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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.
2. If n is larger than 16, 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_
6-169
A S S er i es Pr og r am m ing M an u a l
_6
6-170
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
D : Destination device
Explanation:
1. When the instruction ALT is executed, the state of the device specified by D alternate between ON and OFF. 6_
2. 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
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 first
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
6-171
A S S er i es Pr og r am m ing M an u a 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
_6
6-172
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
n : Multiplier
Explanation:
1. 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 cannot be
3. 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
4. When the on-line editing is used, please reset the conditional contact to initialize the instruction.
6-173
A S S er i es Pr og r am m ing M an u a l
Example 1:
1. The time for which the button switch X0.0 has been turned ON is multiplied by n, and the product is stored in D0.
X0.0
D0
D0
T T
The time for whic h The time for whic h
the button switc h is the button switc h is
turned on. turned on.
(Unit: Second) (Unit: Second)
Additional remark:
_6
1. If D+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. 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.
3. If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
6-174
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
m
D
Symbol:
D : Output device
Explanation:
1. The instruction STMR is used to generate the off-delay relay, the one-shot circuit, and the flashing circuit. 6_
2. The timer specified by the instruction TMR takes 100 milliseconds as the timing unit.
6. 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.
7. When the on-line editing is used, please reset the conditional contact to initialize the instruction.
6-175
A S S er i es Pr og r am m ing M an u a l
Example:
1. When X0.0 is ON, the instruction STMR specifies the timer T0, and the setting value of T0 is five seconds.
2. 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.
4. When X0.0 is switched from OFF to ON, Y0.2 is ON for five seconds.
5. 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.
X0.0
Y0.0
5 s econds 5 s econds
_6 Y0.1
5 s econds 5 s econds
Y0.2
5 s econds
Y0.3
5 s econds 5 s econds 5 s econds
6. When the conditional contact X0.0 is followed by the b contact of Y0.3, the flashing currents pass through Y0.1 and
Y0.2. When X10 is switched OFF, Y0.0, Y0.1, and Y0.3 are switched OFF, and T10 is reset to 0.
6-176
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
X 0.0
Y 0.1
Y 0.2
5 s econds
Additional remark:
1. If D+3 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. If m is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
3. If users declare the operand D in ISPSoft, the data type will be ARRAY [4] of BOOL.
6_
6-177
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
Symbol:
Explanation:
1. The instruction is used to get the slope. The slope is linear, and has an absolute relationship with the scan time.
Thus it is suggested to set a fixed scan time or write this instruction to the timer interrupt task.
2. The initial value of the ramp signal and the final value of the ramp signal are written into S1 and S2 respectively in
advance. When X0.0 is ON, D increases from the setting value in S1 to the setting value in S2. The number of scan
cycles is stored in D+1. When the value in D is equal to that in S2, or when the value in D+1 is equal to n, reached to
3. When the conditional contact is not enabled, the value in D, and D+1 are both 0, and SM687 is OFF.
4. When the on-line editing is used, please reset the conditional contact to initialize the instruction.
5. Please refer to ISPSoft User Manual for more information related to the fixing of the scan time.
6. The operand n should be within the range between 1 and 32767. When the operand n is out of the range, this
7. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
6-178
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
8. Use with the flag SM686, the setting value in D is reset to 0. Refer to the examples below for more details.
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. SM686 is OFF, and when D12 is reaching the setting value in D11, SM687 is ON as a scan cycle. And when D12 is
D11
D10
D12
D12
D11
D10
6_
The number of scan cycl e i s n. The number of scan cycl e i s n.
D10<D11 D10>D11
The number of scan cycl e i s stored i n D13.
3. When SM686 is ON, and D12 is reaching the setting value in D11, the value in D12 will not be reset to 0, and
SM687 is ON. Till the conditional contact is closed, the value in D12 will be reset to 0 and SM687 will be OFF. When
SM686=O N SM686=O FF
X0.0 X0.0
T he signal is enabled. T he signal is enabled.
D11
D11
D12 D12
D10 D10
SM687 SM687
6-179
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. If D+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. If n is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
3. When the 16-Bit instruction is executed, if users declare the operand D in ISPSoft, the data type will be ARRAY [2]
of WORD/INT.
4. When the 32-Bit instruction is executed, if users declare the operand D in ISPSoft, the data type will be ARRAY [2]
of DWORD/DINT.
_6
6-180
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D1
D2
n
Explanation:
1. S specifies the initial input device in the matrix scan. The eight devices starting from the device specified by S are
2. 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.
3. One row of inputs is refreshed every scan cycle. There are 16 inputs in a row, and the scan starts from the first row
th
to the n row.
4. 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.
5. When the instruction is used, users can connect at most 8 rows of input switches in parallel to get 64 inputs
(8×8=64).
6-181
A S S er i es Pr og r am m ing M an u a l
6. 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
7. Generally, the conditional contact used in the instruction is the normally-open contact SM400.
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
2. The diagram below is the external wiring diagram of the 2-by-8 matrix input circuit which is 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.
_6
M20 M21 M22 M23 M24 M25 M26 M27
Y0.1
Y0.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
6-182
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Y0.0 1 3
T he second r ow of input s ignal s ar e read.
Y0.1 2 4
Additional remark:
1. When this instruction is executed, a too long or a too short scan cycle time will cause the state of the switches not be
When the scan cycle is too short, the I/O may not be able to respond in time and the correct states of the
inputs cannot be read. Users can set a fixed scan time to solve this issue.
When the scan cycle is too long, the switch may become slow to react. Users can write this instruction to the
2. 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.
3. 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.
4. If users declare the operand S in ISPSoft, the data type will be ARRAY [8] of BOOL.
6_
6-183
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
Symbol:
S2 : Comparison value
D : Comparison result
Explanation:
1. The instruction ABSD is used to generate multiple pulses corresponding to the current values of the counter.
2. Only the instruction DABSD can use the 32-Bit counter, but not the device E.
3. When the instruction ABSD is used, n should be within the range between 1 and 256.
Example 1:
1. 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.
2. When X0.0 is ON, the current value of the counter C10 is compared with the maximum values and the minimum
6-184
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
4. When the current value of C10 is within the range between the minimum value and the maximum value, M10~M13
5. 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.
6-185
A S S er i es Pr og r am m ing M an u a l
40 100
M10
120 210
M11
60 140
M12
150 390
M13
0 200 400
Additional remark:
1. If S+2*n-1 used in the instruction ABSD exceeds the device range, the instruction is not executed, SM0 is ON, and
2. If S+4*n-1 used in the instruction DABSD exceeds the device range, the instruction is not executed, SM0 is ON, and
3. If D+n-1 used in the instruction ABSD exceeds the device range, the instruction is not executed, SM0 is ON, and the
4. If D+2*n-1 used in the instruction DABSD exceeds the device range, the instruction is not executed, SM0 is ON, and
_6 5. If n used in the instruction ABSD is less than 1 or larger than 256, the instruction is not executed, SM0 is ON, and
6-186
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
S2 : Counter number
D : Comparison result
Explanation:
1. The instruction INCD is used to generate multiple pulses for a pair of counters.
2. 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.
3. After the comparison between the current values of S2 and the n groups of values is complete, SM688 is ON for a
scan cycle.
4. 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.
5. When the on-line editing is used, please reset the conditional contact to initialize the instruction.
6-187
A S S er i es Pr og r am m ing M an u a l
Example:
1. 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.
2. 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.
4. When the value in C11 changes by one, M10~M14 act correspondingly. Please refer to the timing diagram below.
5. When the comparison between the current values of C10 and the values in D100~D104 is complete, SM688 is ON
for a scan cycle.
6. 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
6-188
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
X0.0
40
30 30
25
C10 15 15 15
10
Current v alue
4
C11 3
2
Current v alue 0 1 1 1
0 0
M10
M11
M12
M13
M14
SM688
Additional remark:
1. If S2+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. 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. 6_
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.
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.
5. If users declare the operand S2 in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
6-189
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
Data
REAL
UINT
DINT
LINT
TMR
CNT
INT
type
6-190
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Symbol:
Explanation:
1. 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
6-191
A S S er i es Pr og r am m ing M an u a l
Setting
Operand Data type Function Description
range
implemented.
PID_RUN BOOL Enabling the PID algorithm False: The output value (MV) is reset to
implemented.
Range of
single-
precision
SV REAL SV Target value
floating-
point
numbers
Range of
single-
precision
PV REAL PV Process value
floating-
point
numbers
_6 0: Automatic control
algorithm.
control.
PID_MODE DWORD/DINT PID control mode
When the tuning of the parameters is
vaule manually.
6-192
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Setting
Operand Data type Function Description
range
True: Manual
False: Automatic
True: Automatic
the MV.
algorithm is implmented
according to the
MV is refreshed. (The
as 1. If TS is larger than
as 40,000.
6-193
A S S er i es Pr og r am m ing M an u a l
Setting
Operand Data type Function Description
range
numbers controlled by P.
(unit: Ti =
sec; Ki =
1/sec)
numbers
(unit: sec)
6-194
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Setting
Operand Data type Function Description
range
numbers Smoothing)
(unit: sec)
the error).
6-195
A S S er i es Pr og r am m ing M an u a l
Setting
Operand Data type Function Description
range
of ERR_DBW,
implemented, otherwise
algorithm according to
minimum MV will be
reversed.
Range of
numbers
6-196
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Setting
Operand Data type Function Description
range
Range of
single-
Feedforward output
precision
BIAS REAL Feedforward output value value, used for the PID
floating-
feedforward.
point
numbers
Accumulated integral
unchanged.
6_
I_MV+1 The previous error value is temporarily stored in it.
I_MV+2 ~
For system use only
I_MV+5
I_MV+7 ~
For system use only
I_MV+14
6-197
A S S er i es Pr og r am m ing M an u a l
tID_aAN
PID
Calculation CALSE
MV
TRUE
CALSE
aOUT_AUTO
1. When switching the control mode (PID_MAN=0) from automatic to manual, users can set the flag
MOUT_AUTO to 1 and the output value of MOUT will go along with the output value of MV. After switching to
2. When PID_RUN is changing from TRUE to FALSE, the PLC will reset the value in MV to 0. When the value in
MV is to be retained, users can set the EN as FALSE to dismiss the instruction and to keep the output value in
MV.
Example:
1. Before the instruction DPID is executed, the setting of the parameters should be complete.
2. When X0.0 is ON, the instruction is executed. When M1 is ON, the DPID algorithm is implemented. When M1 is
_6
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
6-198
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
1. The instruction can be used several times, but the registers specified by I_MV~I_MV+14 cannot be the same.
2. I_MV occupies 30 registers. I_MV used in the instruction PID in the above example occupies D126~D155.
3. The instruction DPID only can be used in the cyclic task and the interval interrupt task. When the instruction DPID is
used in the interval interrupt task, the sampling time (Cycle) is the same as the interval between the timed interrupt
tasks.
4. When the instruction is scanned, the DPID algorithm is implmented according to the sampling time (Cycle), and the
MV is refreshed. When the instruction is used in the interrupt task, the sampling time (Cycle) is the same as the
interval between the timed interrupt tasks. The PID algorithm is implemented according to the interval between the
5. Before the DPID 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 DPID algorithm, they have to notice the time it
takes for the analog input to be converted into the digital input.
6. When the PV (process value) is in the range of ERR_DBW, at the beginning, the present error will be brought into
the PID algorithm according to the normal processing and then the CPU module will check whether the present
error meets the cross status condition: PV (process value) goes beyond the SV (target value). Once the condition is
met, the present error will be counted as 0 to implement the PID algorithm. And after the PV (process value) is out of
the ERR_DBW range, the present error will be brought into the PID algorithm again. If PID_DE is true, that means
6_
using the variations in the PV to calculate the control value of the derivative and after the cross status condition is
met, the PLC will treat Δ PV as 0 to implement the PID algorithm. (Δ PV= current PV – previous PV). As the example
shown below, the present error will be brought into the PID algorithm according to the normal processing in the
section A and the present error or Δ PV will be counted as 0 to implement the PID algorithm in the section B.
6-199
A S S er i es Pr og r am m ing M an u a l
1. When PID_MODE is set to 0, the PID control mode is the automatic control mode.
t
dE
MV = K P E + Ki ∫ Edt + K d * + BIAS E = SV – PV or E = PV – SV
0
dt
t
dPV
MV = K P E + Ki ∫ Edt − K d * + BIAS E = SV – PV
0
dt
Or
t
dPV
MV = K P E + Ki ∫ Edt + K d * + BIAS E =PV – SV
0
dt
1
t
dE
MV = K c E + ∫ Edt + Td * + BIAS E = SV – PV or E = PV – SV
Ti 0 dt
1
t
dE
MV = K c E + ∫ Edt − Td * + BIAS E = SV – PV
Ti 0 dt
Or
1
t
dE
MV = K c E + ∫ Edt + Td * + BIAS E = PV – SV
Ti 0 dt
2. 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.
6-200
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
ERR_DBW
Kc_Kp
PID-P
>0 PID_MAN
BIAS
+ 0
<=0 +
0 +
Kc_Kp MV_LIMIT
1
MV
Ti_Ki
PID-I
>0
MV_MAX, MV_MIN
+
<=0 +
0 +
Ti_Ki MOUT_AUTO
+ MOUT
0
Td_Kd MOUT
PID-D PID_MAN
>0 1
0
<=0
0 1
Td_Kd, Tf MOUT
Kc_Kp
ERR_DBW Kc_Kp
>0
<=0
0
PID_MAN
BIAS
+ 0
+
+
MV_LIMIT
1
Ti_Ki MV
PID-I
>0
MV_MAX, M V_MIN
<=0
0
Ti_Ki MOUT_AUTO
MOUT
0
Td_Kd MOUT PID_MAN
PID-D
>0 1
0
<=0
0 1
Td_Kd, Tf MOUT
6-201
A S S er i es Pr og r am m ing M an u a l
Suggestion:
1. Owing to the fact that the instruction DPID 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
2. When users tune the parameters Kc_Kp, Ti_Ki, and Td_Kd (PID_MODE is set to 0), they have to tune the KP first
(according to the experience), and then set the Ti_Ki and the Td_Kd to 0. When users can handle the control, they
can increase the Ti_Ki and the Td_Kd. When the Kc_Kp is 1, 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 the proportional gain is larger than 100%, the error value is increased.
3. 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 Ti_Ki and the
Td_Kd.
4. The instruction should be used with many parameters. To prevent the improper control from occurring, please do not
Example 1: The steps of tuning the parameters used with the instruction PID
_6
b
Suppose that the transfer function of the plant is the first-order function G(s) = , the SV is 1, the sampling time Ts is
s+a
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.
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)
6-202
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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
1 .5
PV= SV
0 .5
K P =10,KI = 8,K D=0.2
0 0 .1 0 .2 0 .3 0 .4 0 .5 0 .6 0 .7 0 .8 0 .9 1 T ime (s ec)
Note: The example is only for reference. Users have to tune the parameters properly according to the practical condition
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
6-203
A S S er i es Pr og r am m ing M an u a l
_6
6-204
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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 6_
100°C, the result is as below.
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-205
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data INT
type
S1
S2
S3
S4
D
Explanation:
1. This instruction is only applicable for AS series with firmware version 1.04 or higher.
2. The operand S1 is for the setting of the trigger input points; high-speed inputs are X0.0~X0.15 and for inputs other
than X0.0~X0.15, they are general type. Once the instruction is executed, the external interrupts for the inputs
(X0.0~X0.15) will be enabled. Therefore it is not suggested to use the inputs with interrupt tasks; otherwise, when
the instruction is executed, the interrupts will be disabled, and only after the instruction is done, the interrupt tasks
will be resumed. For the general type, they will be affected by the scan time though they are suitable for the
6-206
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
3. The operand S2 works with 32-bit counters (HC0~HC255). When the inputs are high-speed trigger input type, it is
suggested to implement the hardware high-speed counter and users can use the instruction DCNT to enable the
counter. When it is required to use high-speed outputting, users can use the instruction DMOV to copy the output
current position, for example copying the axis of SR460 to HC0, (DMOV SR460 HC0).
4. The operand S3 occupies a consecutive three 16-bit devices. S3+0 is n the setting of the work station number and
S3+1 is m the maximum object number. S3+2 is the result of the object being filtered. The range for n and m is 1~32.
When the value is out of range, the value will be seen as the maximum (32) or the minimum (1). The range for S3+2
(the number of filter) is 0~32767. Value less than 0 will be seen as 0 and when the value is 0, the filtering function is
5. It is suggested to set the maximum number for S3+1 (m). If m<n, users should take notice of the objects and make
sure they are sufficient on the production line.
6. The operand S4 occupies a consecutive of 3xn 32-bit devices (6xn 16-bit devices). If the space taken exceeds the
range of device D, the instruction will not be executed. The n is the work station number set in the operand S3. The
functions for each device and the corresponding number for S4 are listed below. It is suggested to declare an array
(32-bit) 6_
Observational error when leaving S4+4xn S4+4xn+2 ‧‧‧ S4+(4xn-1)x2
(32-bit)
When the reference value is set to 0 for a specific work station, the specific work station will stop working. Users can
7. The operand D is initial corresponding device for the comparison result in the stack area. The operand D occupies a
consecutive of 2xn 16-bit devices and 2xmxn 32-bit devices (or 4xmxn 16-bit devices). If the space taken exceeds
the range of device D, the instruction will not be executed. The functions for each device and the corresponding
6-207
A S S er i es Pr og r am m ing M an u a l
: : : : :
It tends to occupy more space in the stack area. If the space taken exceeds the range of device D, the PLC will only
execute what is valid in the storage and no warning will be shown. It is suggested to declare an array of 2xn+4xmxn
words.
8. There is no limit on the number of times the instruction can be executed but only one execution can be done at a
time.
9. This instruction is suggested to use with the instruction API0710 YOUT and use the same initial corresponding
device for the comparison result in the stack area (the operand D).
10. The timing diagram of executing the high-speed counter and filter (read from right to left).
*1 * 2 *1 *1 *1 *1 * 2 *1
*4 *4
_6
*3 *3
*2. Drop the counter value: the number of filters read is less than the number of filters set.
*3. Record the counter value: the signal is high (on time) and records the counter value to the comparing stack area
for entering.
*4. Record the counter value: the signal is low (off time) and records the counter value to the comparing stack area
for leaving.
11. When the signal is rising-/falling-edge triggered and complete processing filter, the PLC reads the high-speed
counter value and adds one in the value of the head index. The PLC will record the entering and leaving counter
results of each work station. The compared counter result is the current counter value + reference value +
observational error. Whether it is rising-triggered or falling-edge triggered, the value of the head index will be
accumulated. The maximum head index value is mx2 (the maximum number of object).
6-208
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
12. The value of the head index will be cyclically accumulated, when the signal is rising-/falling-edge triggered and
complete with processing the number of filters. (the default for trigger input is OFF) The maximum value of the head
index is mx2 (the maximum number of object). For example, the number of object is set to 10, the value of the head
index (default: 0) will be added to 1, 2, 3 to 20 and then 1, 2, 3 to 20 repeatedly. When the value of the head index is
set to 0, it means there is no object entered after the instruction is executed. After adding one to the value of the
head index, the PLC will check the value in the tail index. If the value (after adding one) in the value of the head
index equals to the value of the tail index, the addition will be cancelled and the counter result will be recorded.
13. When the instruction is executed and the state of the initial input is OFF, the rising-edge trigger will correspond to
the odd numbers of the head index value, and the falling-edge trigger will correspond to the even numbers of
14. When the instruction is executed and the state of the initial input is ON, the falling-edge trigger will correspond to
the odd numbers of the head index value, and the rising-edge trigger will correspond to the even numbers of the
15. When the instruction is executed, values in the accumulated area and the index areas will not be cleared. If the data
is in the latched area and needed to be enabled again, users need to use the instruction ZRST to clear the values in
Example:
Please refer to the example in the API0710 YOUT for more information. 6_
6-209
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
1. This instruction is only applicable for AS series with firmware version 1.04 or higher.
2. The operand S1 is for the setting of the high-speed counter. The high-speed counter should be set the same as the
high-speed counter set from the API0709 XCMP.
3. The operand S2 occupies a consecutive two 16-bit devices. S2+0 is n the setting of the work station number and
S2+1 is m the maximum object number. The range for n and m is 1~32. When the value is out of range, the value
will be seen as the maximum (32) or the minimum (1). The settings here should be the same as the API0709 XCMP.
4. The operand S3 is initial corresponding device for the comparison result in the stack area. The operand S3 occupies
a consecutive of 2xn 16-bit devices and 2xmxn 32-bit devices (or 4xmxn 16-bit devices). For the functions of each
device and the corresponding number for D, please refer to the API0709 XCMP. It is suggested to use the same
6-210
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
5. There is no limit on the number of times the instruction can be executed but only one execution can be done at a
time.
6. This instruction is suggested to use with the API0709 XCMP and use the same initial corresponding device for the
comparison result in the stack area (the operand S3).
7. The operand D is only for the outputs of Y as well as M devices and BOOL data type. It occupies a consecutive of
work stations xn. When it is used as the output point or the M device, the instruction will run to refresh the output
states.
8. The corresponding values for the odd numbered head index (for example 1, 3, 5,…) are called compared counter
result of the object when entering. The corresponding values for the even numbered head index (for example 2, 4,
6,…) are called compared counter result of the object when leaving.
9. When the compared counter result of entering and leaving in the stack area are 0, the actions in this area will not be
executed and the state of the corresponding output work station will be OFF. Adding 2 to the value in the tail index
but the value (after adding 2) will not exceed the value of the head index.
10. When the instruction YOUT is executed, each work station will check the compared value of entering and leaving in
the tail index. When the counter value is larger or the same as the compared value of entering, the corresponding
output point will be ON and will add 1 to the value of the tail index. When the counter value is larger or the same as
the compared value of leaving, the corresponding output will be OFF and will add 1 to the value of the tail index but
the value (after adding 1) will not exceed the value of the head index.
Example: the example of work station x3 and the number of objects can be up to 4. 6_
Wo rk Work Work
station station station
Object 1 2 3
detection
Obj ect
En co der
Step 1: using the input point X0.4 as the object detection interrupts, HC202 is the high-speed counter for the encoder and
the output point Y0.0 as the initial output point for the work station to output.
Step 2: using the register to edit, set up the reference value, the observational error when entering and leaving.
6 - 2 11
A S S er i es Pr og r am m ing M an u a l
_6
6-212
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Set up 3 work stations for D0, 4 objects for D1 and 50 filters for D2. After the contact M0 is activated, settings of the object
detection, compared value setup, the compared counter result of the object entering as well as leaving, and the output
controls for each work station can be done. For instance the system detects 2 objects entered and 4 triggers to read the
compared counter results, 3000, 3500, 4500, and 5000 in HC202 (HC202=K5060). The compared value and the head/tail
6-213
A S S er i es Pr og r am m ing M an u a l
_6
6-214
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
When the high-speed counter HC202 reaching 5200, the state of the output point Y is as below:
When the high-speed counter HC202 reaching 6200, the state of the output point Y is as below:
When the high-speed counter HC202 reaching 6800, the state of the output point Y is as below:
6-215
A S S er i es Pr og r am m ing M an u a l
When the high-speed counter HC202 reaching 7300, the state of the output point Y is as below:
D2002
Device D number D2000 D2001
When the high-speed counter HC202 reaching 7700, the state of the output point Y is as below:
When the high-speed counter HC202 reaching 8000, the state of the output point Y is as below:
6-216
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
When the high-speed counter HC202 reaching 8700, the state of the output point Y is as below:
6_
6-217
A S S er i es Pr og r am m ing M an u a l
_6
0814 AND^ DAND^ – S1^S2
6-218
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Data source 1
S2 : Data source 2
D : Operation result
6_
Explanation:
1. 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.
3. 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-219
A S S er i es Pr og r am m ing M an u a 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).
_6
S1
b31 b15 b0
Before the instruction Y11 Y1 0 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
is executed S2 DA ND
Y2 1 Y2 0 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
After the instruction D
is executed
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-220
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
Symbol:
S1 : Matrix source 1
S2 : Matrix source 2
D : Operation result
6_
n : Length of the array
Explanation:
1. 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.
2. 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:
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-221
A S S er i es Pr og r am m ing M an u a l
S1 b15 b0
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
Y2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
Before the instruction
is executed S2 b15 b0
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 b15 b0
Y20 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
After the instruction
Y21 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
is executed
Y22 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
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 ON, and the error
_6 code in SR0 is 16#2003.
2. 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.
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
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
6-222
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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.
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
Length: n
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
Mn-1 b16n- 1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
Example: The following matrix is composed of the three 16-bit devices Y0, Y1, and Y2. The data in Y0 is
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 6_
16#37, the data in X 1 is 16#68, and the data in X 2 is 16#45.
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-223
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Data source 1
S2 : Data source 2
D : Operation result
_6
Explanation:
1. 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.
2. Only the instruction DOR can use the 32-bit counter but not the device E.
3. 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.
6-224
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b0
S1 Y0 011 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before the instruction
is executed
S2 Y2 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
b15 b0
After the instruction
Y4 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
is executed D
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).
6_
S1 b31 b15 b0
Before the instruction Y11 Y1 0 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
is executed DO R
S2
Y2 1 Y2 0 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
6-225
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
Symbol:
S1 : Matrix source 1
S2 : Matrix source 2
D : Operation result
Explanation:
1. 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.
2. 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:
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.
6-226
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
S1 b15 b0
Y0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
After the
Y1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 instruc tion
Y2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 is executed D b15 b0
Before the Y20 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
instruc tion S2 b15 MOR b0
is executed Y10 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1 Y21 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
Y11 0 0 0 1 0 1 1 1 1 0 1 0 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
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 ON, and the error
code in SR0 is 16#2003.
2. 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_
6-227
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Data source 1
S2 : Data source 2
D : Operation result
_6
Explanation:
1. 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.
2. Only the instruction DXOR can use the 32-bit counter, but not the device E.
3. 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.
6-228
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b0
S1 Y0 011 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before the instruction
is executed
S2 Y2 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
b15 b0
After the i nstruction
Y4 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0
is executed D
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_
6-229
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
Symbol:
S1 : Matrix source 1
S2 : Matrix source 2
D : Operation result
Explanation:
1. 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.
2. The result in each position is 1 if the two bits are different, and 0 if they are the same.
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
6-230
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
S1 b15 b0
Y0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
After the
Y1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
instruc tion D
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 ON, and the error
code in SR0 is 16#2003.
2. 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_
6-231
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Data source
D : Operation result
_6 Explanation:
1. Use the data in S to execute the INV instruction. The operation result is stored in D.
2. Only the instruction DINV can use the 32-bit counter but not the device E.
3. W he n a n I N V i n s t r u c t i o n i s e xe c u t e d , r e v e r s e p r o c e s s i n g i s p e r f o r m e d . I f t h e s ta t e i s 0 b e f o r e
t h e I N V i n s t r u c t i o n i s e x e c u t e d , t h e s ta t e w i l l c h a n g e t o 1 a s a r e s u l t o f t h e I N V i n s t r u c t i o n .
Example 1:
When X0.0 is ON, the operator WINV takes data in the 16-bit device Y0 and performs the INV operation on the
corresponding bits. The operation result is stored in the 16-bit device Y4.
6-232
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example 2:
When X0.0 is ON, the operator DINV takes data in the 32-bit devices Y11~Y10 and performs the INV operation on each
pair of corresponding bits. The operation result is stored in the 32-bit device Y41~Y40.
6_
6-233
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Data source 1
S2 : Data source 2
Explanation:
_6 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 but not the device E.
5. |: Logical OR operation
6-234
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example:
1. 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.
2. 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.
3. 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_
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-235
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Data source 1
S2 : Data source 2
Explanation:
_6 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, but not the device E.
5. |: Logical OR operation
6-236
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example:
1. 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.
2. 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.
3. When X0.2 is ON, the logical operator XOR takes the data in the 32-bit register (D200, D201) and the data in the
32-bit register (D100, D101), 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_
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-237
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Data source 1
S2 : Data source 2
Explanation:
_6 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.
5. |: Logical OR operation
6-238
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example:
1. 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.
2. 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 (D10, D11) and the 32-bit register (D20, D21) 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 (D200, D201) and the operation result is
6_
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-239
A S S er i es Pr og r am m ing M an u a l
0901 RCR DRCR Rotating to the right with the carry flag
0903 RCL DRCL Rotating to the left with the carry flag
_6
6-240
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
6_
Explanation:
1. The values of the bits in the device specified by D are divided into groups (n bits as a group), and these groups are
2. Only the instruction DROR can use the 32-bit counter, but not the device E.
3. 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. When n is less than 0, the instruction will not be
executed; when n exceeds the range, it will be seen as the maximum value (32) of the range, and the instruction will
be executed.
6-241
A S S er i es Pr og r am m ing M an u a l
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.)
b 15 ※ b0
Carry flag
0 1 1 1 1 0 1 1 0 1 0 0 0 1 0 1
b 15 b0 Carry flag
0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0 0
Additional remark:
1. If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
_6
6-242
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
0901 D RCR P D,n Rotating to the right with the carry flag
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
6_
Explanation:
1. The values of the bits in the device specified by D are divided into groups (n bits as a group), and these groups are
2. Only the instruction DRCR can use the 32-bit counter, but not the device E.
3. 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. When n is less than 0, the instruction will not be
executed; when n exceeds the range, it will be seen as the maximum value (32) of the range, and the instruction will
be executed.
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.)
6-243
A S S er i es Pr og r am m ing M an u a l
Carry flag
b 15 ※ b0
0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 1
Carry flag b 15 b0
0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0
Additional remark:
1. If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
_6
6-244
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
6_
Explanation:
1. The values of the bits in the device specified by D are divided into groups (n bits as a group), and these groups are
2. Only the instruction DROL can use the 32-bit counter, but not the device E.
3. 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. When n is less than 0, the instruction will not be
executed; when n exceeds the range, it will be seen as the maximum value (32) of the range, and the instruction will
be executed.
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.)
6-245
A S S er i es Pr og r am m ing M an u a l
Carry flag b 15 ※ b0
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
Carry flag b 15 b0
1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
Additional remark:
1. If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
_6
6-246
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
0903 D RCL P D,n Rotating to the left with the carry flag
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
6_
Explanation:
1. The values of the bits in the device specified by D are divided into groups (n bits as a group), and these groups are
2. Only the instruction DRCL can use the 32-bit counter, but not the device E.
3. 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. When n is less than 0, the instruction will not be
executed; when n exceeds the range, it will be seen as the maximum value (32) of the range, and the instruction will
be executed.
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.)
6-247
A S S er i es Pr og r am m ing M an u a l
Carry flag ※
b 15 b0
0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
Carry flag
b 15 b0
1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1
Additional remark:
1. If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
_6
6-248
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Matrix source
D : Operation result
Explanation:
1. 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 6_
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.
2. 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. When n is less than 0, the instruction will not be
executed; when n exceeds the range, it will be seen as the maximum value (32) of the range, and the instruction will
be executed.
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-249
A S S er i es Pr og r am m ing M an u a l
D
SM616=0 b15 b0
After the rotation 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 D20
to the left is executedCarry flag 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 D21
S M614 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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
_6 SM614.
6-250
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
MBR
SM616=0 D
b15 b0 Carry flag
After the rotation D20 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
to the left is exec uted 0
D21 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D22 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
SM614
Additional remark:
1. 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.
2. The flags:
6_
6-251
A S S er i es Pr og r am m ing M an u a l
1000 RST DRST – Resetting the contact to OFF or clearing the value in the register.
6-252
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
Explanation: 6_
1. DRST only supports the clearing of the values in the 32-bit HC device and two consecutive 16-bit D devices. For
2. When RST instruction is driven, the specified devices will act as follows.
Device State
The current timer value and counter value are set to 0. And the coil and contact are set to
T,C
OFF.
DWord,HC,Real The 32-bit content value including the floating point number will be cleared to 0.
3. If RST instruction is not executed, the state of the device specified by the instruction will keep unchanged.
6-253
A S S er i es Pr og r am m ing M an u a l
Example:
_6
6-254
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Timer number
Explanation:
6-255
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Timer number
Explanation:
1. The T timer specified by TMR instruction takes 100ms as the timing unit. And the T timer specified by TMRH
2. The range of the setting values of the timers in TMR and TMRH instructions is 0~32767.
3. If the same T timer is used repeatedly in the program, including being used in the different instructions TMR and
TMRH, the setting value is the one that the value of the timer matches first.
4. The T timer will reset to zero automatically when the conditional contact changes from ON to OFF.
5. As long as users add the letter S in front of the device T, the timer used in the instruction TMR
becomes an accumulative timer. When the conditional contact is OFF, the value of the accumulative timer is not
cleared. When the conditional contact is ON, the timer counts from the current value. The ST accumulative timer
should be used with the instruction RST together to clear the value of the timer.
6. If the same T timer is used repeatedly in the program, it is OFF when one of the conditional contacts is OFF.
7. If the same T timer is used repeatedly as T and ST in the program, T is OFF when one of the conditional contacts is
OFF.
8. 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 contact is ON.
6-256
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
9. The timers T0~T411 are defined as general timers. T412~T511 are subroutine timers by default. If the ranges of the
two types of timers need be changed, use the hardware configuration software HWCONFIG for the modification.
10. The general timers will compare the timing values when TMR instructions are scanned. They are applied to the
For the subroutine timers, the system counts the time and compares the timing values after the END instruction is
executed. And so the subroutine timers are applied to the situation in which TMR instruction is executed not in every
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
X0.0 is switched from OFF to ON, T0 counts up from 25 to 50, and the contact of T0 is ON. 6_
Example 3:
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, T5 counts up from 500 to 1000, and the contact of T5 is ON.
6-257
A S S er i es Pr og r am m ing M an u a l
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, T5 counts up from 500 to 1000, and the contact of T5 is ON.
Additional remark:
When the operand S1 is declared via ISPSoft, the data type TIMER should be selected for the general T timer. If the
_6
6-258
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Counter number
Explanation:
1. When the instruction CNT is switched from OFF to ON, it indicates that the specified counter coil changes from OFF
to ON and then the value of the counter is increased by 1. When the value of the counter matches the setting value,
6_
the contact of the counter will be ON.
2. When the value of the counter matches the setting value, the state of the contact and value of the counter both
remain unchanged if any counting pulse is input. Use RST to reset the counter for one more counting.
Example:
When SM408 is ON for the first time, the setting value 10 is loaded to the counter C0 and the counter begins counting.
After SM408 is swiched from OFF to ON ten times, the value of C0 is 10 and the contact of C0 is ON. After C0 is ON,
SM408 continues to switch from OFF to ON. But the value of C0 will not be accumulated after it reaches the setting value
of C0.
Additional remark:
When the operand S1 is declared via ISPSoft, the data type COUNTER should be selected.
6-259
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Counter value
Explanation:
_6 1. DCNT is the instruction to enable the 32-bit counter within the range between HC0 and HC255.
2. When the operand S1 is declared via ISPSoft, the data type CNT can not be selected and users should specify an
HC device number.
3. For the count-up/count-down counters HC0~HC63, when the conditional contact of the instruction DCNT is
switched from OFF to ON, the counters will count up by increasing the values by 1 when SM621~SM684 are OFF or
4. For the count-up counters HC64~HC199, they will count up by increasing the values by 1 when the conditional
5. When the instruction DCNT is OFF, the counter will stop counting. But the original count value will not be cleared.
RST can be used to clear the count value and reset the contact to OFF.
6. Refer to the following pages for details on the high-speed counter HC200~HC255.
6-260
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example:
NETWORK1
When PLC runs, the value of the counter HC0 is cleared and the counter counts up as SM621 is OFF. At the moment,
SM408 is ON for the first time. So the setting value 10 will be loaded to the counter HC0 and the counter will begin
counting.
NETWORK2
After SM408 is swiched from OFF to ON ten times, the value of the counter HC0 matches the setting value 10 and the
contact of HC0 is ON. After HC0 is ON, the value of the counter will keep increasing because SM408 continues to change
from OFF to ON though the value of HC0 has reached the setting value.
NETWORK3
When HC0 continues to count up and the value reaches the setting value 20, the counter will count down as SM621 is ON
in the program. After SM408 is switched from OFF to ON ten times and the value of HC0 decreases from 10 to 9, the
After the contact of HC0 is OFF, the value of HC0 will still continue to decrease since SM408 continues to change from
OFF to ON.
6_
Additional remark:
1. For the setting mode of SM621~SM684, refer to the explanation of the 32-bit counter HC in Chapter 2.
6-261
A S S er i es Pr og r am m ing M an u a l
AS300 high-speed counters can be classified into hardware counter (Up to 200KHz input at most and for differential input
Hardware counter:
Input X0.
HC No. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#1 #1
HC200 P R
#1
HC201 P D R
#1 #1
HC202 A B R
#2
HC203 -- -- --
HC204 P R
HC205 P D R
HC206 A B R
HC207 -- -- --
HC208 P R
HC209 P D R
_6
HC210 A B R
HC211 -- -- --
HC212 P R
HC213 P D R
HC214 A B R
HC215 -- -- --
HC216 P
HC217 P D
HC218 A B
HC219 -- --
HC220 P
HC221 P D
HC222 A B
HC223 -- --
Note 1: P: single-phase pulse input, D: Direction signal input, A and B: two phase two input, R: Reset signal input.
6-262
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Note 2: ‘--‘ means that the counting mode is reserved and unable to use now. The empty box indicates no function.
Note3: Refer to the SM/SR table for count up/down state selection and the selection of how many times frequency input.
Note 4: The function of R (input resetting) is disabled by default. Refer to SM/SR comparison table on how to use R.
Take HC200 for example. SM291 is switched to ON to start the R function and then the rising edge of X0.12 triggers the
Software counter:
Input X0.
HC No. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
HC232 P
HC233 P D
HC234 A B
#5 #5
HC235 UP DN
HC236 P
HC237 P D
HC238 A B
HC239 UP DN
6_
HC240 P
HC241 UP DN
HC242 P
HC243 UP DN
HC244 P
HC245 UP DN
HC246 P
HC247 UP DN
HC248 P
HC249 UP DN
HC250 P
HC251 UP DN
HC252 P
HC253 P
6-263
A S S er i es Pr og r am m ing M an u a l
Note 5: UP: Single phase count-up input (Same as CW), DN: Single phase count-down input (Same as CCW)
The high-speed counters within the range of HC200~HC255, which has not been listed in the table are the reserved
devices inside PLC. They are not recommended to the program designer for use.
The high-speed counter, SM/SR and function are corresponded as shown in the following table.
6-264
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
HC237)
HC238 SM338 R Show
counting only
HC244 SM344 R/W Show/ set
counting only
Note 1: All SM special flags in the above table are OFF by default.
Note 2: When SM under “Count-up/count-down function” is OFF, it indicates that the corresponding counter
counts up or displays it is counting up. If SM is ON, it indicates that the corresponding counter counts
down or displays it is counting down.
Note 3: The “R” under Attribute means “Read only” and “W” means “Set”.
Note 4: The SR special registers under “Counting mode” are of 1 time frequency input by default. The input
value 2 indicates double frequency and 4 is the 4 times frequency. 4 times frequency is only applicable
for the counter of A/B 2-phase input. If the value is not 1, 2 and 4 in SR, PLC will run with the 1 time
frequency.
6-265
A S S er i es Pr og r am m ing M an u a l
Note 5: All single-phase counters above counts by using 1 time frequency and the rising-edge counting mode
changing the input point from OFF to ON.
Note 6: Reversing the direction is applicable for the counters of “P” (Pulse input) and “D” (Direction). When
SM is ON, the counting direction (up/down) will be reversed. For example, when the preset direction
input is OFF, the counter counts up. When SM is set to ON, the counter will change to count down.
_6
6-266
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Counter number
S2 : Comparative value
D : Comparison result
Explanation:
6_
1. The instruction should be used with the high-speed counter of number HC200 and above together. If the high-speed
counter specified by S1 changes by increasing or decreasing by 1 in the value, DHSCS instruction will make the
comparison immediately. When the current value of the high-speed counter is equal to the comparative value
specified by S2, the device specified by D will change to ON. After that, the device specified by D remains ON even if
the comparison result is that the current value and the comparative value become not equal..
2. If the device specified by D is Y0.0~Y0.15, the comparison result that the value of S2 is equal to the current value of
the high-speed counter will be output to the output terminals Y0.0~Y0.15. And other Y devices will be affected by the
scan cycle. But all devices are updated immediately and not affected by the scan cycle.
3. The D operand can also specify an interrupt device I within the range: I2, =00~67.
4. The high-speed counters can be classified into the software counter and hardware counter. The available high-speed
comparators and interrupt device numbers are listed in the following table.
6-267
A S S er i es Pr og r am m ing M an u a l
HCC00~HCC03
HCC04~HCC07
HCC08~HCC11
Hardware counter
HC212 ~ HC215 Comparator: I230~I233
HCC12~HCC15
HCC16~HCC19
HCC20~HC223
5. Explanation of the hardware comparators for DHSCS, DHSCR and DHSZ instructions:
Every one group of hardware counters share 4 high-speed comparators. One DHSCS or DHSCR instruction
occupies 1 high-speed comparator. One DHSZ instruction uses 2 high-speed comparators.
_6
During the program editing, every group of hardware counters can use 4 high-speed comparators at most for
DHSCS, DHSCR or DHSZ instructions. Otherwise, the syntax error will occur.
There are 8 software comparators for comparison of the Set or Reset function. Every one DHSCS or DHSCR
instruction uses one high-speed comparator.
The software comparators compare the interrupt by assigning a corresponding software comparator
according to the interrupt numbers. It is noted that the same interrupt number can not be used repeatedly.
For DHSCS or DHSCR instructions, the Set or Reset comparators for them can not exceed 8 pieces in the
program. Otherwise, the syntax error will occur.
There are 8 software comparators for the zone comparison. One DHSZ instruction uses one comparator.
DHSZ instruction can use maximum 8 software comparators. Otherwise, the syntax error will occur if the used
software comparators are more than 8 pieces.
6-268
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example 1:
When the current value of HC200 changes from 99 to 100 or from 101 to 100, Y0.10 is ON, which will output to the
external output terminal Y0.10 in real time and it will remain ON.
Example 2:
1. When M0 is ON, DHSCS instruction is executed. When the current value of HC200 changes from 99 to 100 or from
101 to 100, Y0.10 will output its state to the external output terminal immediately, which is irrelevant to the program
6_
scan time.
2. When the current value of HC200 changes from 99 to100, the contact of HC200 is ON immediately. But when the
execution of SET Y0.11 is reached, Y0.11 will still be affected by the scan time and will output its state after END is
passed .
6-269
A S S er i es Pr og r am m ing M an u a l
Example 3:
When the current value of HC200 changes from 99 to100 or 101 to100, the program jumps to the interrup pointer for
Main program:
_6
6-270
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Counter number
S2 : Comparative value
D : Comparison result
Explanation:
1. The instruction should be used with the high-speed counter of number HC200 and above together. If the high-speed 6_
counter specified by S1 changes by increasing or decreasing the value by 1, DHSCR instruction will make the
comparison immediately. When the current value of the high-speed counter is equal to the comparative value
specified by S2, the device specified by D will change to OFF. After that, the device specified by D remains OFF even
if the comparison result is that the current value and the comparative value become not equal.
2. If the device specified by D is Y0.0~Y0.15, the comparison result that the comparative value of S2 is equal to the
current value of the counter will be output to the external output terminals Y0.0~Y0.15. And other Y devices will be
affected by the scan cycle. But all devices are updated immediately and not affected by the scan cycle.
3. D operand can also specify the HC device to reset, which is only limited to the condition in which the high-speed
Example 1:
1. When M0 is ON and HC200 changes its current value from 99 to 100 or from 101 to 100, Y0.10 will be reset to OFF.
2. When HC200 changes its current value from 199 to 200, the contact of HC200 is ON and Y0.11 is ON. But the
6-271
A S S er i es Pr og r am m ing M an u a l
Example 2:
For HC200 specified as the hardware high-speed counter of the same number, the contact of HC200 will be reset to OFF
when HC200 changes its current value from 999 to 1000 or from 1001 to 1000.
_6
1 00 0
2 00
6-272
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
S1 : Counter number
Lower bound of the comparison
S2 :
zone
Upper bound of the comparison
S3 :
zone
D :
Comparison result (3 consecutive 6_
devices)
Explanation:
1. The instruction should be used with the high-speed counter of number HC200 and above together. The low bound of
S2 must be less than the upper bound of S3. If the zone limit values are not set properly, PLC will make the
2. If S1 specifies a software counter and the specified counter changes by increasing or decreasing by 1 in the value,
DHSZ instruction will make the comparison right away. The comparison condition and output state are shown below.
6-273
A S S er i es Pr og r am m ing M an u a l
Note: The lower bound specified by S2 must be less than the upper bound specified by S3. If the zone bound is set
3. If S1 specifies a hardware counter and the value of the specified counter reaches the lower bound specified by S2 or
the upper bound specified by S3, DHSZ instruction will make the comparison immediately according to the count
direction (up/down). And the comparison condition and output state are shown in the following table
Count direction Comparison condition D+0 state D+1 state D+2 state
4. If the device specified by D is Y0.0~Y0.15, the comparison result will be output to the external output terminals
Y0.0~Y0.15. And other Y devices will be affected by the scan cycle. But all devices are updated immediately and not
5. Refer to DHSCS instruction for other relevant information on the high-speed zone comparison.
_6
Example:
2. When DHSZ is executed, the instruction compares the current value in HC200 with the
upper/lower bound (1500/2000) of the comparison zone, and one of Y0.10~Y0.12 will be ON according to the
comparison result.
3. When the current value in HC200 <1500, Y0.10 is ON. When 1500<= the current value in HC200<2000, Y0.11 is ON.
6-274
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Counter value
Explanation:
1. When executing this speed detection instruciton, S1 has to be used with the instruction DCNT to enable the high 6_
speed counter with the counter number over HC200 (including HC200).
2. S2 is the setting value of the cycle time with the unit of millisecond (ms). Setting range is between 10~1000. When the
value is out of range, the system will execute it as the minimum value or the maximum value and the PLC will not
3. When the set value in S2 is reached, this instruction will store the number of pulses in the D apporinted device. That is
4. This instruction has no limitation on the editing times, but it only allows 8 sets of speed detection instructions to run
th
simultaneously. The 9 set of the speed detection instruction or later ones will be ignored and no error messages will
be sent. When executing this instruction, the set parameters of the operand will be recorded. Thus during the
Example:
Where there is an input pulse signal in X0.0, DSPD instruction can be used for the speed detection. When M0 is ON,
DSPD will have the number of pulses counted by HC200 shown in D0 every 500ms.
6-275
A S S er i es Pr og r am m ing M an u a l
In the following example, the value in D0 is 7500 and the actual pulse input frequency of X0.0 is 15kHz (7500/500ms).
_6
6-276
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D1
D2
Symbol:
S2 : Unit of measurement
Pulse width detection time (32-bit
D1 :
value)
D2 : Updated flag 6_
Explanation:
1. S1 supports the following 8 inputs, X0.0/X0.1/X0.2/X0.3/X0.4/X0.6/X0.8/X0.10. But S1 cannot share the same inputs
2. S2 is the unit of measurement. The instruction will not be executed if the setting value of S2 is not the one among the
6-277
A S S er i es Pr og r am m ing M an u a l
measurement range
3. D1 is used for storing the pulse width detection time (32-bit value) and the detection range is 0~100,000,000. If the
vaule is over the maximum value, it will be seen as the maximum value. If the vaule is 0, that means during the
4. D2 is the updated flag. Whenever the detection of the S1 input is completed and the instruciton is scanned, the
updated flag will be switched to ON for one scan cycle time. Users can check if the detection value has been updated
to the most recent value using the updated flag. When the instruciton is executed for the first time, the updated flag
_6 5. When the value in S2 is among 0, 1 and 2, refer to the timing diagram below for the procedures performed such as
storing detection values and updating flags during the execution of the instruction. Time to start the timer is when the
S1 input is switched from OFF to ON as it is shown in the position of the following diagram. Time to store the
detection time is when the S1 input is switched from ON to OFF as shown in the position of the following diagram.
enable
S1
D2
Figure 1 Detection mode when the value in S2 is 0, 1 or 2
6. When the value in S2 is 4, or 5, refer to the timing diagram below for the procedures performed such as storing
detection values and updating flags during the execution of the instruction. Time to start the timer is when the S1 input
6-278
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
is switched from OFF to ON as it is shown in the position of the following diagram. Time to store the detection time
is when the S1 input is switched from OFF to ON as shown in the position of the following diagram.
enable
S1
D1 0 100 101
D2
Figure 2 Detection mode when the value in S2 is 4 or 5
7. This instruction has no limitation on the editing times, but it only allows 8 sets of pulse width detection instructions to
th
run simultaneously. The 9 set of the pulse width detection instruction or later ones will be invalid and no error
messages will be sent. When executing this instruction, the set parameters of the operand will be recorded. Thus
during the execution of this instruciton, editing on the parameters is not allowed.
8. Before executing this instruction, please check the input hardware response time and the pulse time set in
HWCONFIG. For example, when the value in the S2 is set to 0 or 2, that means the unit of measurement is
microsecond (μs). And the S1 input value should be set to 0 to disable the Input Point Filter Time in HWCONFIG. 6_
Example:
There is a pulse signal of 10kHz in the input X0.0. When M0 is ON, the instruction PWD can detect the input signal of
the X0.0 and have the pulse width shown in D10/D11 (32-bit data), the time unit is set to 0 and the width detected
6-279
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
Number of an external interrupt
S1 :
input point
S2 : High-speed counter number
Register for storing the captured
D :
value
Explanation:
_6 1. Only the 16 input points X0.0~X0.15 of PLC can be used in S1. They are used with the external interrupt service
program to start the function. It is to be noted that S1 should not share the same input point with the high-speed
counter.
2. The high-speed counter HC device is selected in S2. The HC device has to be used with the DCNT instruction to start
3. The captured value of the high-speed counter is stored in (32-bit) D when the interrupt takes place. Time to store data
is when the interrupt occurs and not affected by the PLC program scan.
4. The procedure of the instruction operation is shown below: (Suppose that the input interrupt is triggered by the falling
edge.)
When the execution of the instruction starts, the value in D will not change and users can enter the default
value.
When the interrupt in S1 occurs, the value of the counter specified by S2 is captured immediately and stored in D.
6-280
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
enable
S2
S1
5. The instruction can start DCAP instructions for four different input points at most. If one input point is set as the
external interrupt triggered by the rising edge and falling edge, the time to capture the value is when the input is
triggered by the rising edge and by falling edge respectively and the count value is stored in the device specified by D.
When two instructions specify the same interrupt input point, the one which is started first will use the interrupt input
point first.
6. The HC device number is set in S2. The high-speed counters within the range of HC200~HC255 are recommended.
For details on the counters, refer to the explanation of API1004 DCNT instruction.
Example:
6_
6-281
A S S er i es Pr og r am m ing M an u a l
_6
Note:
1. When M0 is ON, the DCAP instruction is enabled. When an external interrupt occurs in X0.7, the value in HC200
is captured and stored to (32-bit) D0.
2. When the external input interrupt is triggered by the rising edge once, E0 is modified to 0 through setting D100,
the count value in D0 is stored to D10 through modifying E0 and the value in D100 is 0+2.
6-282
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
3. When the external input interrupt is triggered by the falling edge once, E0 is modified to 2 through setting D100,
the count value (10+E0=12) in D0 is stored to D12 through modifying E0 and the value in D100 is 0+2. When the
4. If the external interrupt is triggered by the rising edge and falling edge five times respectively, the value capturing
will be carried out 10 times and the captured values will be stored in D10, D12…D28.
st
The 1 captured value= D10
nd
The 2 captured value= D12
th
The 10 captured value=D28
th
The 11 captured value=D10
6_
6-283
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S1 : Timer number
Explanation:
6-284
C ha pt er 6 A p pl i e d In s tr uc t io ns
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
– Shifting the values of the bits in the 16-bit registers by n bits to the
1110 SFR
right
1111 SFL – Shifting the values of the bits in the 16-bit registers by n bits to the left
6_
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
6-285
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n1
n2
Symbol:
Initial device in which the value is
S :
shifted
Initial device in which the value is
D :
_6 shifted
n1 : Length of the data which is shifted
Explanation:
1. 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.
3. 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. When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0 to M15 are divided
into groups (four bits as a group), and these groups are shifted to the right.
2. The shift of the states of the bit devices to the right during a scan is illustrated as follows.
6-286
C ha pt er 6 A p pl i e d In s tr uc t io ns
M7~M4 → M3~M0
M11~M8 → M7~M4
M15~M12 → M11~M8
X0.3~X0.0 → M15~M12
5
M1 5 M1 4 M1 3 M1 2 M11 M1 0 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
4 3 2 1
6_
Example 2:
1. When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0 to M15 are divided
into groups (five bits as a group), and these groups are shifted to the right.
2. 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
6-287
A S S er i es Pr og r am m ing M an u a l
4 3 2 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 1024, 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
6-288
C ha pt er 6 A p pl i e d In s tr uc t io ns
1101 SFTL P S,D,n1,n2 Shifting the states of the devices to the left
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n1
n2
Symbol:
Explanation:
1. 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.
3. The operand n1 should be within the range between 1 and 1024. The operand n2 should be within the range
Example 1:
1. When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0 to M15 are divided
into groups (four bits as a group), and these groups are shifted to the left.
2. The shift of the states of the bit devices to the left during a scan is illustrated as follows.
6-289
A S S er i es Pr og r am m ing M an u a l
M11~M8 → M15~M12
M7~M4 → M11~M8
M3~M0 → M7~M4
X0.3~X0.0 → M3~M0
5
Being c arri ed M1 5 M1 4 M1 3 M1 2 M11 M1 0 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
1 2 3 4
_6
Example 2:
1. When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0 to M15 are divided
into groups (five bits as a group), and these groups are shifted to the left.
2. The shift of the states of the bit devices to the left during a scan is illustrated as follows.
M10 → M15
M9~M5 → M14~M10
M4~M0 → M9~M5
X0.4~X0.0 → M4~M0
6-290
C ha pt er 6 A p pl i e d In s tr uc t io ns
1 2 3 4
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 1024, 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_
6-291
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n1
n2
Symbol:
Initial device in which the value is
S :
shifted
Initial device in which the value is
D :
shifted
n1 : Length of the data which is shifted
Explanation:
1. 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.
3. 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. When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20 to D35 is divided
into groups (four 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.
6-292
C ha pt er 6 A p pl i e d In s tr uc t io ns
D27~D24 → D23~D20
D31~D28 → D27~D24
D35~D32 → D31~D28
D13~D10 → D35~D32
5
D3 5 D3 4 D3 3 D3 2 D3 1 D3 0 D2 9 D2 8 D2 7 D2 6 D2 5 D2 4 D2 3 D2 2 D2 1 D2 0 Being c arri ed
4 3 2 1
6_
Example 2:
1. When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20 to D35 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.
D25 → D20
D30~D26 → D25~D21
D35~D31 → D30~D26
D14~D10 → D35~D31
6-293
A S S er i es Pr og r am m ing M an u a l
5
D3 5 D3 4 D3 3 D3 2 D3 1 D3 0 D2 9 D2 8 D2 7 D2 6 D2 5 D2 4 D2 3 D2 2 D2 1 D2 0 Being c arri ed
4 3 2 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
6-294
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n1
n2
Symbol:
Initial device in which the value is
S :
shifted
Initial device in which the value is
D :
shifted
n1 : Length of the data which is shifted
1. 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.
3. 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. When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20 to D35 is divided
into groups (four words as a group), and these groups are shifted to the left.
2. The shift of the data in the word devices to the left during a scan is illustrated as follows.
6-295
A S S er i es Pr og r am m ing M an u a l
D31~D28 → D35~D32
D27~D24 → D31~D28
D23~D20 → D27~D24
D13~D10 → D23~D20
5
Being carri ed D3 5 D3 4 D3 3 D3 2 D3 1 D3 0 D2 9 D2 8 D2 7 D2 6 D2 5 D2 4 D2 3 D2 2 D2 1 D2 0
1 2 3 4
_6
Example 2:
1. When X0.0 is switched from OFF to ON, the data in the sixteen word devices starting from D20 to D35 is divided
into groups (five words as a group), and these groups are shifted to the left.
2. The shift of the data in the word devices to the left during a scan is illustrated as follows.
D30 → D35
D29~D25 → D34~D30
D24~D20 → D29~D25
D14~D10 → D24~D20
6-296
C ha pt er 6 A p pl i e d In s tr uc t io ns
5
Being c arri ed D3 5 D3 4 D3 3 D3 2 D3 1 D3 0 D2 9 D2 8 D2 7 D2 6 D2 5 D2 4 D2 3 D2 2 D2 1 D2 0
1 2 3 4
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_
6-297
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
D : Initial device
n : Data length
Explanation:
_6 1. 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.
Example:
1. 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
2. The data in the word device is shifted and written in the following way.
6-298
C ha pt er 6 A p pl i e d In s tr uc t io ns
n=10
Sourc e
D20 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Pointer
D0=3 2 1
Additional remark:
1. 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.
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.
3. 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. 6_
4. The instruction SFWR can be used with the instruction SFRD to write and read the data.
6-299
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Initial device
n : Data length
Explanation:
_6 1. 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,
Example:
1. 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.
2. The data in the word device is shifted and read in the following way.
6-300
C ha pt er 6 A p pl i e d In s tr uc t io ns
n=10
D0 D29 D28 D27 D26 D25 D24 D23 D22 D21 D20
Pointer
T he data is read.
Additional remark:
1. 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.
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.
3. 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.
4. The instruction SFWR can be used with the instruction SFRD to write and read the data.
6_
6-301
A S S er i es Pr og r am m ing M an u a l
1106 SFPO P S,D Reading the latest data from the data list
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Initial device
Explanation:
1. The device specified by S is taken as a pointer. When the instruction is executed, the data in the device specified by
_6 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.
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.
6-302
C ha pt er 6 A p pl i e d In s tr uc t io ns
D S
D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
1000 7
Pointer
T he data is read.
D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
1000 0 6
Pointer
Additional remark:
1. 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.
2. 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_
6-303
A S S er i es Pr og r am m ing M an u a l
1107 SFDEL P S,D,n Deleting the data from the data list
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Initial device
_6 Explanation:
1. 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,
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.
6-304
C ha pt er 6 A p pl i e d In s tr uc t io ns
S
D n=4
D20 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
4712 857 123 100 111 22 48 5 799 9
T he length of the data
T he data is deleted.
D20 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
22 0 4712 857 123 100 111 48 5 799 8
T he length of the data
Additional remark:
1. 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.
2. If S+n exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
3. 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_
4. 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.
5. If n is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
6-305
A S S er i es Pr og r am m ing M an u a l
1108 SFINS P S,D,n Inserting the data into the data list
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Initial device
Explanation:
_6 1. 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.
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
6-306
C ha pt er 6 A p pl i e d In s tr uc t io ns
D n=4 S
D200 D8 D7 D6 D5 D4 D3 D2 D1 D0
22 4712 857 123 100 111 48 5 799 8
T he length of the data
T he data is inserted.
D200 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
22 4712 857 123 100 111 22 48 5 799 9
T he length of the data
Additional remark:
1. 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.
2. If S+n exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003
3. 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.
4. 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.
5. If n is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
6_
6-307
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Matrix source
D : Operation result
Explanation:
_6 1. 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 (from shifted to
the left is b0 and from shift to the right is b16n-1) resulting from the shift is filled by the state of the borrow flag
SM615, the value of the bit shifted last (from shifted to the left is b16n-1 and from the shift to the right is b0) is
transmitted to the carry flag SM614, and the operation result is stored in D.
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,
6-308
C ha pt er 6 A p pl i e d In s tr uc t io ns
b 15 b0 Borr ow flag
D0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0
Carry flag 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
D1
D2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
b 15 b0
Borr ow flag
D20 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0
Carry flag D21 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 D22 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
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,
b 15 b0 Carry flag
D0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Borr ow flag D1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
D2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
b 15 b0 Carry flag
D20 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
Borr ow flag D21 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 D22 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
6-309
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. 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.
2. 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.
3. The flags:
_6
6-310
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
n : Number of bits
Explanation:
1. 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
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 shift of the values of the bits to the right during a scan is illustrated as follows.
b15~b6 → b9~b0
0 → b15~b10
6 - 3 11
A S S er i es Pr og r am m ing M an u a l
b 15 ※ b0 Carry flag
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
b 15 b0 Carry flag
0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 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
6-312
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
n : Number of bits
Explanation:
1. 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
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
The shift of the values of the bits to the left during a scan is illustrated as follows.
b9~b0 → b15~b6
0 → b5~b0
6-313
A S S er i es Pr og r am m ing M an u a l
b 15 ※ b0
Carry flag
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
Carry flag
b 15 b0
1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 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
6-314
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
n : Data length
Explanation:
1. 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,
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
6-315
A S S er i es Pr og r am m ing M an u a l
M5 M4 M3 M2 M1 M0 Carry flag
0 0 0 1 0 1
After the shift
M5 M4 M3 M2 M1 M0 Carry flag
0 0 0 0 1 0 1
Being c leared to 0
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 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
6-316
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
n : Data length
Explanation:
1. 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
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
6-317
A S S er i es Pr og r am m ing M an u a l
M5 M4 M3 M2 M1 M0 Carry flag
0 0 0 1 0 1
M5 M4 M3 M2 M1 M0 Carry flag
0 0 1 0 1 0 0
Being c leared to 0
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 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
6-318
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
n : Data length
Explanation:
1. 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.
6_
3. 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 D2 D1 D0
30 2235 9578 754 28 423 11
After the shift
D6 D5 D4 D3 D2 D1 D0
0 30 2235 9578 754 28 423
Being cleared to 0
6-319
A S S er i es Pr og r am m ing M an u a l
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 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
6-320
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
n
Symbol:
n : Data length
Explanation:
1. The data in the n registers starting from D is shifted to the left, and the data in D is cleared to 0.
6_
3. 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 D2 D1 D0
30 2235 9578 754 28 423 11
After the shift
D6 D5 D4 D3 D2 D1 D0
2235 9578 754 28 423 11 0
Being c leared to 0
6-321
A S S er i es Pr og r am m ing M an u a l
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 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
6-322
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
1212 MBRD – Reading the matrix bit
6_
1213 MBWR – Writing the matrix bit
6-323
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
Symbol:
S2 : Compared data
_6
Initial device in which the comparison
D :
result is stored
n : Data length
Explanation:
1. 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.
6-324
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Device Description
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example:
1. 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.
2. The data number of the minimum value is stored in D53, and the data number of the maximum value is stored in
D54. If there is more than one minimum value or maximum value, the data number which is bigger is stored. 6_
6-325
A S S er i es Pr og r am m ing M an u a l
Compared Data
S1 Value Result D Value Description
data number
D15 300 5
D17 5 7 Minimum
_6
Additional remark:
1. 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.
2. If the operand n used in the 16-bit instruction is less than 1 or larger than 256, the instruction is not executed, SM0
3. If the operand n used in the 32-bit instruction is less than 1 or larger than 128, the instruction is not executed, SM0
4. If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the data type will be
5. If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the data type will be
6-326
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
D : Destination device
Explanation:
2. When the values of the bits in the source device specified by S are 0, the zero flag SM600 is ON.
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example:
When X0.0 is ON, the number of bits whose values are 1 in D0 is stored in D2.
b15 b0
0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 3
D0 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-327
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Source device
Device in which the decoded values
D :
are stored
Number of bits whose values are
n :
decoded
Explanation:
_6 n
1. The values of the lower n bits in the source device specified by S are decoded as the values of the lower 2 bits in D.
n
2. The values of the consecutive n bits in the source device specified by S are decoded as the values of the lower 2
bits in D.
3. When the source device specified by S is a timer or counter, the device will be seen as a word device.
4. 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.)
5. 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
Example 1:
1. 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.
6-328
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
2. 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.
3. 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
0 1 1
4 2 1
3
7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0
M107 M106 M105 M104 M103 M102 M101 M100
Example 2:
1. 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.
6_
2. 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.
3. After the instruction DECO is executed and X0.0 is switched OFF, the data in D20 is unchanged.
b15 D10 b0
0 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.
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
b15 D20 b0
6-329
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. 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
2. 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,
3. Suppose S is a bit device. If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the
4. Suppose D is a bit device. If D+(2^n)-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
_6
6-330
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Source device
Device in which the encoded values
D :
are stored
Number of bits whose values are
n :
encoded
Explanation:
1.
n
When S is a word device, the values of the lower 2 bits in the source device specified by S are encoded as the 6_
values of the lower n bits in D.
n
2. When S is a bit device, the higher bit with the value S+(n-1) from the lower 2 bits is processed and the result is
stored in D.
3. When the source device specified by S is a timer or counter, the device will be seen as a word device.
4. 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
5. 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
Example 1:
1. 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.
6-331
A S S er i es Pr og r am m ing M an u a l
2. 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 D0 4 2 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
b0
T he values of b15~b3 in D0 become 0.
Example 2:
1. 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.)
2. After the instruction ENCO is executed and X0.0 is switched OFF, the data in D is unchanged.
_6
b15 D10 b0
0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 0
7 6 5 4 3 2 1 0
T he values of b8~b18 in D10 are invalid data.
b15 D20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
b0
T he values of b15~b3 in D20 become 0.
Additional remark:
1. If there is no bit whose value is 1 in the source device specified by S, the instruction is not executed, SM0 is ON,
6-332
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
2. 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
3. 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,
4. Suppose S is a bit device. If S+(2^n)-1 exceeds the device range, the instruction is not executed, SM0 is ON, and
5. Suppose D is a bit device. If D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the
6_
6-333
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
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
_6 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.
6-334
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
The relation between the seven-segment data and the bit pattern of source data is presented in the following table.
Segment s tate
Bi t Assi gnment
Hex Dis play
pattern of s egments B0(a) B1(b) B2(c) B3(d) B4(e) B5(f) B6(g)
0 0000 ON ON ON ON ON ON OFF
6 0110 a ON OFF ON ON ON ON ON
8 1000 e c ON ON ON ON ON ON ON
d
9 1001 ON ON ON ON OFF ON ON
A 1010 ON ON ON OFF ON ON ON
6_
6-335
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S
m1
m2
D
n
Symbol:
Explanation:
1. 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.
2. 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.
3. When SM604 is OFF, the data is sorted in ascending order. When SM604 is ON, the data is sorted in descending
order.
5. Only the 32-bit instruction can use the 32-bit counter, but not the device E.
6-336
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example:
1. Suppose SM604 is OFF. When X0.0 is switched from OFF to ON, the data is sorted in ascending order.
m2 columns of data
Column
Column 1 2 3 4 5
Student
Chinese English Math Physics
Row number
6-337
A S S er i es Pr og r am m ing M an u a l
m2 columns of data
Column
Column 1 2 3 4 5
Student
Chinese English Math Physics
Row number
m2 columns of data
_6
Column
Column 1 2 3 4 5
Student
Chinese English Math Physics
Row number
6-338
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
1. If the device exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. 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_
6-339
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D1
D2
Symbol:
Explanation:
1. When the instruction is executed, the values in D1~D2 are cleared. The device type should be the same to perform
this instruction.
_6
2. When the device number of D1 is larger than the device number of D2, only D2 is reset.
Example:
1. When X0.0 is ON, the auxiliary relays M300~M399 are reset to OFF.
2. 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
3. When X2.0 is ON, the stepping relays S0~S127 are reset to OFF.
4. When X3.0 is ON, the output relays Y0.0~Y1.15 are reset to OFF.
5. When X4.0 is ON, the 32-bit counters HC0~HC63 are reset. (The values of HC0~HC63 are cleared to 0, and the
6. 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
6-340
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
6_
Additional remark:
1. 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.
2. 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-341
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Source device
_6
Explanation:
th
1. The state of the n bit in S is checked, and the result is stored in D.
2. 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.
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example:
th
1. When X0.0 is ON, Y0.1 is ON if the value of the 15 bit in D0 is 1. When X0.0 is ON, Y0.1 is OFF if the value of the
th
15 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.
6-342
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b0
0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 Y0.1=OFF
D0
b15 b0
1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 Y0.1=ON
D0
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_
6-343
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Initial device
Device in which the mean is
D :
stored
n : Number of devices
_6
Explanation:
1. 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.
3. The operand n used in the 16-bit instruction should be within the range between 1 and 256
4. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
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.
6-344
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
(D0+D1+D2)/3 D10
D0 100
Additional remark:
1. 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.
2. 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.
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.
6_
6-345
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Initial device
Device in which the sum is
D :
stored
n : Number of pieces of data
_6 Explanation:
1. 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.
2. 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.
3. 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
6-346
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Example 1:
1. When SM606 is OFF, the working mode of the instruction is the 16-bit conversion mode.
2. 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,
S Data
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 867 Sum
D101 00 01 000 1
T he parity bit is set to 1 if the number of ones i s odd.
6_
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
Example 2:
1. When SM606 is ON, the working mode of the instruction is the 8-bit conversion mode.
2. 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,
6-347
A S S er i es Pr og r am m ing M an u a l
S Data
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 211 = 1 1 0 1 0 0 1 1
D100 867 Sum
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
_6
Additional remark:
1. Suppose SM606 is ON. If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the
2. Suppose SM606 is OFF. If S+n/2-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the
3. 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.
4. If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
6-348
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
Device involved in the getting
D :
of the absolute value
Explanation:
1. When the instruction ABS is executed, the absolute value of the value in the device specified by D is gotten.
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-349
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
S : Matrix source
D : Operation result
Explanation:
_6 1. The bits in the n devices starting from the device specified by S are inverted, and the inversion result is stored in D.
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.
6-350
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b0
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
Additional remark:
1. 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.
2. 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_
6-351
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Matrix source
D : Pointer
_6 Explanation:
1. 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.
2. When the value of the last bit is read, SM608 is ON, and the bit number is recorded in the pointer D.
4. 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. Suppose SM613 is OFF and SM612 is ON when X0.0 is switched from OFF to ON.
2. Suppose the current value in D20 is 45. When X0.0 is switched from OFF to ON three times, users can get the
6-352
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b0
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 Ptr
D20
Additional remark:
1. 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_
2. 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.
3. 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
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.
6-353
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Matrix source
D : Pointer
Explanation:
_6 1. 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.
2. 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
4. 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. Suppose SM613 is OFF and SM612 is ON when X0.0 is switched from OFF to ON.
2. 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-354
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b0
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 Ptr
b15 b0
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. If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is
6_
16#2003.
2. 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.
3. 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.
6-355
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Matrix source
D : Operation result
Explanation:
_6 1. 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.
2. 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.
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.
6-356
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b0
D0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 12
D1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 SM 617 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. 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.
2. 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.
3. The flags:
6_
6-357
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Data source
n : Number of devices
D : Operation result
_6 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 b12 b11 b8 b7 b4 b3 b0 b15 b4 b3 b0
S D
D +1 n
D +2
D +3
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
6-358
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
1. 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.
2. 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 6_
16#200B.
6-359
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Data source
n : Data length
D : Operation result
_6
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
b15 b4 b3 b0
S
S +1
S +2
S +3 D
b15 b12 b11 b8 b7 b4 b3 b0
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
6-360
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
b15 b4 b3 b0
D0 1 2 3 4
D1 5 6 7 8
D2 8 7 6 5
D3 4 3 2 1 1 5 8 4 D1 0
b15 b12 b11 b8 b7 b4 b3 b0
Additional remark:
1. 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.
6_
2. 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-361
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Data source
n : Data length
D : Operation result
_6
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
D +1 D
S +2
B in ar y val ue s n
S +3
S +4 B in ar y val ue
S +5
S S +1
S +3 S +2
D +1 D
S +5 S +4
B in ar y val ue s n D +3 D +2
S +7 S +6
B in ar y val ue
S +9 S +8
6-362
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
2. The operand n used in the 16-bit instruction should be within the range between 1 and 256.
3. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example:
When the instruction WSUM is executed, the values in D0~D2 are added up, and the sum is stored in D10.
(D0+D1+D2) D10
D0 100
D2 125
Additional remark:
6_
1. 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
2. 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
3. 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.
4. If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the data type will be
5. If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the data type will be
6-363
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
S3 : Input value
_6 D : Output value
Explanation:
1. The input value in S3 is compared with the minimum output value in S1 and the maximum output value in S2, and the
If the minimum output value in S1 is larger than the input value in S3, the output value stored in D is equal
If the maximum output value in S2 is less than the input value in S3, the output value stored in D is equal
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.
6-364
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
If the minimum output value in S1 is larger than the maximum output value in S2, the instruction is not
executed.
2. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
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.
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
6-365
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
Minimum value of the
S1 :
deadband
Maximum value of the
S2 :
deadband
S3 : Input value
_6 D : Output value
Explanation:
1. The minimum value of the deadband in S1 or the maximum value of the deadband in S2 is subtracted from the input
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
6-366
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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
2. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
3. The figures:
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.
6_
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
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.
=-2147483648-1000=16#80000000-16#000003E8=16#7FFFFC18
=2147482648
6-367
A S S er i es Pr og r am m ing M an u a l
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.
500 -1000≦D0≦1000=>D0=0 0
_6
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
6-368
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
(D1,D0)<-10000
=(D1,D0)-(-10000)
(D1,D0)>10000
-10000 10000
12000 =>(D11,D10) 2000
=(D1,D0)-10000
-10000≦(D1,D0)≦10000
5000 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
6_
6-369
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
S1 : Negative deviation
S2 : Positive deviation
S3 : Input value
_6 D : Output value
Explanation:
1. 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
If the input value in S3 is larger than 0, the positive deviation in S2 is added to the input
6-370
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
2. The figures:
Positiv e deviation
Negativ e deviation
3. Only the 32-bit instructions can use the 32-bit counter but not the device E.
4. The negative deviation in S1, the positive deviation in S2, the input value in S3, and the output value in D should be
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.
If the instruction DZONE is executed, the negative deviation in S1, the positive deviation in S2, the input value
6_
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
=-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.
6-371
A S S er i es Pr og r am m ing M an u a l
50 D0>0=>D10=50+100 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
6-372
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Initial device
Device in which the mean is
D :
stored
n : Number of devices
Explanation:
6_
1. After the single precision floating points in the n devices starting from the device specified by S are added up, the
2. The operand n used in the 16-bit instruction should be within the range between 1 and 256,
3. The flags: SM600 (zero flag), SM601 (borrow flag), SM602 (carry flag):
If the value while adding or the absolute result of the operation is less than the floating point number can be
If the value while adding or the absolute result of the operation is larger than the floating point number can be
Example:
When X0.0 is ON, add the values of the 3 single precision floating points in (D1, D0), (D3, D2), (D5, D4) and then divide
the addition result by 3, after that store the result in (D11, D10).
6-373
A S S er i es Pr og r am m ing M an u a l
( D11, D1 0) 11 2.2
(D3, D 2) 113.2
(D5, D 4) 123.3
Additional remark:
1. If the operand n used 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.
2. If S+2*n-1exceeds 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 S exceeds the range of the floating point number can be shown, the instruction is not executed, SM0
is ON, and the error code in SR0 is 16#2013.
_6
6-374
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : Data source
n : Data length
D : Operation result
Explanation: 6_
1. After the single precision floating points in the n devices starting from the device specified by S are added up, the
sum is stored in D.
2. The operand n used in the 16-bit instruction should be within the range between 1 and 256,
3. The flags: SM600 (zero flag), SM601 (borrow flag), SM602 (carry flag):
If the value while adding or the absolute result of the operation is less than the floating point number can be
If the value while adding or the absolute result of the operation is larger than the floating point number can be
6-375
A S S er i es Pr og r am m ing M an u a l
S +1 S
S +3 S +2
S +5 S +4 D +1 D
F lo at ing p oi nt nu mb ers n=5
S +7 S +6
F l oatin g po int n umbers
S +9 S +8
Example:
When the instruction FSUM is executed, the values of the 3 single precision floating points in (D1, D0), (D3, D2), (D5, D4)
Additional remark:
1. If the operand n used 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.
2. If S+2*n-1exceeds 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 S exceeds the range of the floating point number can be shown, the instruction is not executed, SM0
is ON, and the error code in SR0 is 16#2013.
6-376
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
6_
6-377
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
Explanation:
_6
6-378
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Symbol:
Explanation:
1. 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
2. N should be within the range between 1 and 32,767. If N is less than 1, it is count as 1.
3. If the program between FOR and NEXT is not executed, it can be skipped by the use of the instruction CJ.
The instruction FOR exists, but the instruction NEXT does not exist.
6_
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.
5. 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.
6-379
A S S er i es Pr og r am m ing M an u a l
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.
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.
_6 The execution of the program jumps to LABEL 1:, i.e. network 6, and network 4~network 5 are not executed.
6-380
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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
6_
6-381
A S S er i es Pr og r am m ing M an u a l
_6
6-382
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
Please refer to ISPSoft User Manual for more information related to the usage of the label.
6_
6-383
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
Device in which the remaining
D : number of times the loop can be
executed is stored
Explanation:
1. 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 instruction NEXT and execute
3. When the instruction BREAK is executed for the first time to terminate the FOR/NEXT loop, the execution of the
program cannot jump to the instruction NEXT to execute the next instruction. But if the instruction BREAK is
executed for more than one time to terminate the FOR/NEXT loop, the execution of the program can jump to the
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-384
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
6_
Additional remark:
1. 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.
2. Please refer to ISPSoft User Manual for more information related to the usage of the label.
6-385
A S S er i es Pr og r am m ing M an u a l
1400 FROM DFROM Reading the data from the control register in the extension module
1401 TO DTO Writing the data into the control register in the extension module
_6
6-386
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
m1
m2
m3
D1
D2
n
Symbol: 6_
Numbers of the CPU module or the
m1 :
remote extension module
The order numbers of the extension
m2 :
number
n : Data length
Explanation:
1. Users can use this instruction to read the data from the control register in the extension module.
2. The operand m1 should be within the range between 0 and 16. 0 represents the CPU module, and 1~16 represent
the extension modules.
6-387
A S S er i es Pr og r am m ing M an u a l
3. The operand m2 represents the number of the right-side extension modules that is connected to the CPU module or
the remote modules. The first device is number 1, the second device is number 2 and so on. Any type of the
5. 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. When the instruction is not executed, D2 will not
7. Only the 32-bit instructions can use the 32-bit counter, but not he device E.
Example:
When X0.0 is switched from OFF to ON, the instruction FROM is executed. Read the data stored in CR#2 from the right
side of the first module and store the data in D100. Owing to the fact that no error occurs, the code stored in D110 is
16#0000.
_6
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,
2. 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.
3. If the value in n exceeds the range, the operation error occurs, the instruction is not executed, SM0 is ON, and the
4. 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 are suggested to use pulse type instruction to perform a single trigger as the example
shown above.
6-388
C ha pt er 6 A p pl i e d In s tr uc t io ns
5. When the instruction is executed, if there is any error responded from modules, the error code will be stored in D2.
16#1400 Reading the data from the control register (CR) in the module but no such CR number.
6_
6-389
A S S er i es Pr og r am m ing M an u a l
m1
m2
m3
S
D
n
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
m1
m2
m3
S
D
n
_6 Symbol:
n : Data length
Explanation:
1. Users can use this instruction to write the data to the control register in the extension module.
2. The operand m1 should be within the range between 0 and 16. 0 represents the CPU module, and 1~16 represent
6-390
C ha pt er 6 A p pl i e d In s tr uc t io ns
3. The operand m2 represents the number of the right-side extension modules that is connected to the CPU module or
the remote modules. The first device is number 1, the second device is number 2 and so on. Any type of the
5. 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. When the instruction is not executed, D2 will not
7. Only the 32-bit instructions can use the 32-bit counter, but not he device E.
8. When S is a hexadecimal value, 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.
Example:
When X0.0 is switched from OFF to ON, the instruction TO is executed. Write the data stored in D100 to CR#2 in the right
side of the first module. Owing to the fact that no error occurs, the code stored in D110 is 16#0000.
6_
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 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.
3. If the value in n exceeds the range, the operation error occurs, the instruction is not executed, SM0 is ON, and the
6-391
A S S er i es Pr og r am m ing M an u a l
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 are suggested to use pulse type instruction to perform a single trigger as the example shown
above.
5. When the instruction is executed, if there is any error responded from modules, the error code will be stored in D2.
16#1400 Reading the data from the control register (CR) in the module but no such CR number.
_6
6-392
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
1512 – FSQR Square root of the floating-point number
6_
1513 – FEXP Exponent of the floating-point number
6-393
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
D : Sine value
Explanation:
1. Whether the source value specified by S is a radian or a degree depends on the state of SM695.
_6
2. If SM695 is OFF, the source value specified by S is a radian. Radian=Degree×π/180.
Degree=Radian×180/π. (0 ≦Degree≦360 )
o 0
5. The sine of the source value specified by S is stored in the register specified by D.
6. The relation between radians and sine values are shown below.
6-394
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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.
Additional remark:
1. 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.
2. 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-395
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
D : Cosine value
Explanation:
1. Whether the source value specified by S is a radian or a degree depends on the state of SM695.
_6
2. If SM695 is OFF, the source value specified by S is a radian. Radian=Degree×π/180.
Degree=Radian×180/π. (0 ≦Degree≦360 )
o 0
5. The cosine of the source value specified by S is stored in the register specified by D.
6. The relation between radians and cosine values are shown below.
6-396
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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.
Additional remark:
1. 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.
2. 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
6-397
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
D : Tangent value
Explanation:
1. Whether the source value specified by S is a radian or a degree depends on the state of SM695.
Degree=Radian×180/π. (0 ≦Degree≦360 )
o 0
5. The tangent of the source value specified by S is stored in the register specified by D.
6. The relation between radians and tangent values are shown below.
6-398
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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_
6-399
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. 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.
2. 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
_6
6-400
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
D : Arcsine value
Explanation:
-1
1. Arcsine value=sin
The relation between sine values and arcsine values are shown below. 6_
6-401
A S S er i es Pr og r am m ing M an u a l
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.
Additional remark:
1. 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.
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.
6-402
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
D : Arccosine value
Explanation:
-1
1. Arccosine value=cos
The relation between cosine values and arccosine values are shown below.
6_
2. If the absolute value of the conversion result is larger than the value which can be represented by the maximum
3. If the absolute value of the conversion result is less than the value which can be represented by the minimum
6-403
A S S er i es Pr og r am m ing M an u a l
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.
Additional remark:
1. 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.
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.
6-404
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
D : Arctangent value
Explanation:
-1
1. Arctangent value=tan
2. The relation between tangent values and arctangent values are shown below. 6_
6-405
A S S er i es Pr og r am m ing M an u a l
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.
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
6-406
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S :
D :
Explanation:
2. If the absolute value of the conversion result is larger than the value which can be represented by the maximum
Example:
1. 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 Single-pr ecision
D1 D0
floati ng- poi nt number
6-407
A S S er i es Pr og r am m ing M an u a l
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.
3. 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.
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
_6
6-408
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Explanation:
2. If the absolute value of the conversion result is larger than the value which can be represented by the maximum
6_
floating-point number, the value in D is 16#7F800000, and SM602 is ON.
3. 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.
Example:
1. When X0.0 is ON, the hyperbolic cosine of the floating-point number in (D1, D0) is stored in (D11, D10). The
6-409
A S S er i es Pr og r am m ing M an u a l
S D1 D0 Single-pr ecision
floati ng- point number
2. If the absolute value of the conversion result is larger than the value which can be represented by the maximum
3. If the absolute value of the conversion result is less than the value which can be represented by the minimum
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
_6
6-410
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Explanation:
6_
Example:
1. 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.
Single- pr ecision
S D1 D0
floati ng- point number
6 - 4 11
A S S er i es Pr og r am m ing M an u a l
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
_6
6-412
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
Explanation:
6_
2. Radian=Degree×(π/180).
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).
Degree
S D1 D0
F loating- point number
6-413
A S S er i es Pr og r am m ing M an u a l
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
_6
6-414
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
Explanation:
2. Degree=Radian×(180/π).
6_
3. If the absolute value of the conversion result is larger than the value which can be represented by the maximum
4. If the absolute value of the conversion result is less than the value which can be represented by the minimum
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).
6-415
A S S er i es Pr og r am m ing M an u a l
Radian
S D1 D0 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
_6
6-416
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
S : Source device
Explanation:
1. The square root of the value in the device specified by S is calculated, and the result is stored in the device specified 6_
by D.
2. 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.
4. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example:
When X0.0 is ON, the square root of the value in D0 is calculated, and the result is stored in D10.
6-417
A S S er i es Pr og r am m ing M an u a l
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
6-418
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
Explanation:
1. The square root of the floating-point number in the register specified by S is calculated, and the result is stored in
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-419
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
Explanation:
1. Exponentiation involves two numbers, the base e which represents 2.71828, and the exponent in the device
specified by S.
3. 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 e . (e is 2.71828, and S represents the source data.)
S
4.
5. 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.
Example:
1. When X0.0 is ON, the value in (D1, D0) is converted into the floating-point number, and the conversion result is
2. When X0.1 is ON, the exponentiation with the value in (D11, D10) as the exponent is performed. The result is a
6-420
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
6_
6-421
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S2 : Source device
Device in which the operation result is
D :
stored
Explanation:
_6 1. The logarithm of the value in S2 with respect to the value in S1 is calculated, and the single-precision floating-point
S1 =S2.→D=LogS1S2.
D
3.
4. Example: Suppose the values in S1 and S2 are 5 and 125 respectively. Find log5125.
S1 =S2.→5D=125.→D=log5125=3.
D
5.
Example:
1. 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.
2. 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-422
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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_
6-423
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source device
Explanation:
1. The natural logarithm of the operand S is calculated by the single-precision floating-point operation.
_6
e =S.→The value in D=lnS.
D
3.
Example:
1. When X0.0 is ON, the value in (D1, D0) is converted into the floating-point number, and the conversion result is
2. When X0.1 is ON, the natural logarithm of the floating-point number in (D11, D10) is calculated, and the operation
6-424
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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_
6-425
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
Explanation:
_6 1. The single-precision floating-point number in S1 is raised to the power of the value in S2, and the he single-precision
2. D=POW[S1+1,S1]^[S2+1,S2]
3. The value in S1 only can be a positive value, whereas the value in S2 can be a positive value or a negative value.
3
4. Suppose the values in S1 and S2 are 5 and 3 respectively. D=5 =125.
5. If the absolute value of the operation result is large than the value which can be represented by the maximum
6. If the absolute value of the operation result is less than the value which can be represented by the minimum
Example:
1. 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.
6-426
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
2. When X0.1 is ON, the floating-point number in (D11, D10) is raised to the power of the floating-point number in (D13,
3. When X0.2 is ON, the binary floating-point number in (D21, D20) is converted into the binary-coded decimal
6_
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-427
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Minimum value
S2 : Maximum value
Explanation:
_6 1. 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.
2. 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
Example:
When X0.0 is ON, the random number within the range between the minimum value in D0 and the maximum value in D10
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-428
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
6_
6-429
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
Explanation:
3. 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
4. The last two digits of the year number for A.D. 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.
6-430
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
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 and 59, the value of the minute increases by one, and the value of
6_
6-431
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
S : Data source
Explanation:
3. When users want to adjust the built-in real-time clock in the CPU module, they can use the instruction to write the
4. 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.
6-432
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
1. If the value in S exceeds the range, the operation error occurs, the instruction is not executed, SM is ON, and the
2. 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.
3. If users declare the operand S in ISPSoft, the data type will be ARRAY [7] of WORD/INT.
6_
6-433
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Source device 1
S2 : Source device 2
_6
Explanation:
1. 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
2. The operands S1, S2, and D each occupy three consecutive devices.
3. If the sum is larger than or equal to 24 hours, SM602 is ON, and the result gotten from the subtraction of 24 hours
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
6-434
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
1. If the value in S1 or S2 exceeds the range, the operation error occurs, the instruction is not executed, SM0 is ON,
2. 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.
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/IN.
5. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT. 6_
6-435
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Source device 1
S2 : Source device 2
Explanation:
_6 1. 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
2. The operands S1, S2, and D all occupy three consecutive devices.
3. 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.
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
6-436
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Additional remark:
1. If the value in S1 or S2 exceeds the range, the operation error occurs, the instruction is not executed, SM0 is ON,
2. If S1+2, S2+2, or D+2 exceeds the device range, the operation error occurs, the instruction is not executed, SM0 is
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. 6_
5. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT.
6-437
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D1
D2
Symbol:
Time after which the output
S :
device is ON
D1 : Current time
D2 : Output device
Explanation:
The operand S used in the 16-bit instruction should be within the range between 1 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 cannot be altered when the instruction is executed. Otherwise, an error
will occur.
6-438
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
When the current time is 32,767 hour 3,599 second, the timer stops counting. After the values in D1 and D1+1 are
4. 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.
6. When the on-line editing is used, please reset the conditional contact to initialize the instruction.
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.
6_
Additional remark:
1. When S is less than or equal to 0, the instruction is not executed, and the state of the output device is unchanged.
2. If the value in D1 used in the instruction HOUR is less than 0, the state of the output device is unchanged.
3. 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.
4. 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.
5. 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-439
A S S er i es Pr og r am m ing M an u a l
Device
X Y M S T C HC D FR SM SR E K 16# “$” F
S1
S2
S3
S
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S
D
Symbol:
S : Current time
D : Comparison result
Explanation:
1. 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
2. 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.
3. The operand D occupies three consecutive devices. The comparison result is stored in D, D+1, and D+2.
4. Users generally use the instruction TRD to read the current time from the real-time clock first, and then they use the
6-440
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
5. 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.
6. 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.
7. 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
2. If users want to get the comparison result ≧, ≦, or ≠, they can connect M10~M12 is series or in parallel.
6_
Additional remark:
1. If S+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
2. 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-441
A S S er i es Pr og r am m ing M an u a l
3. If the value in S exceeds the range, the operation error occurs, the instruction is not executed, SM0 is ON, and the
4. If the values in S1~S3 exceed the range, the operation error occurs, the instruction is not executed, SM0 is ON, and
5. If users declare the operand S in ISPSoft, the data type will be ARRAY [3] of WORD.
6. If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL.
_6
6-442
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Device
X Y M S T C HC D FR SM SR E K 16# “$” F
S1
S2
S
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S
D
Symbol:
S : Current time
6_
D : Comparison result
Explanation:
1. 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.
2. 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.
3. 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.
4. 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.
5. 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.
6-443
A S S er i es Pr og r am m ing M an u a l
6. Users generally use the instruction TRD to read the current time from the real-time clock first, and then they use the
7. 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
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
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 BOOL.
6-444
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Device
X Y M S T C HC D FR SM SR E K 16# “$” F
S
S1
S2
S3
S4
S5
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data INT
type
S
S1
S2
S3
S4
S5
D
Explanation:
1. When the operand S is 0, the function of daylight saving time is disabled. When the operand S is 1, the function of
daylight saving time is enabled. When the operand S is 2, the function of daylight saving time is being read. When
the value shown in the S is not in the range of 0~2, it means the function of daylight saving time is being read.
2. After the instruction is executed, the state of the daylight saving time will be stored in D. When the value in D is OFF,
the daylight saving time is disabled. When the value in D is ON, the daylight saving time is enabled.
6-445
A S S er i es Pr og r am m ing M an u a l
3. S1、S2: Settings for the month and the date to start the daylight saving time
4. S3、S4: Settings for the month and the date to end the daylight saving time
5. S5: Settings for the duration of the daylight saving time; unit: minute
6. When the instruction is executed to disable or enable the function of daylight saving time, the system time of the PLC
7. When the function of daylight saving time is enabled and the system runs for the first time during the start time (S1,
S2), the system time will add the value set in S5 for one time. When the function of daylight saving time is disabled
and the system runs for the first time during the end time (S1, S2), the system time will subtract the value set in S5 for
one time.
8. When the S is set to enable the daylight saving time, the start/end month should be set between 1~12 and the
start/end date should be set between 1~31. The start date should be set before the end date, for example, do not set
st st
the start date as Oct. 1 and the end date as April 1 . And the value should be set according to the actual calendar,
st
for example if users set a date as April 31 but there is no such date, this function will not be enabled and the SM0
9. When the S is set to enable the daylight saving time, the settings range should be within 1~1439 minutes, if not this
function will not be enabled and the SM0 will be ON, the error code in SR0 is 16#200B.
10. When the S is set to disable the daylight saving time, the values in S1~S5 are irrelevant.
_6
11. When the S is set to read the state of the daylight saving function and the output state of D is ON, the PLC will save
the setting values in operand S1~S5. The device is be set to D while the S is set to read. If the device is set to K or
16#, the values will not be saved. And the SM0 will be ON, the error code in SR0 is 16#2003.
Example 1:
st rd
To enable the daylight saving function and set the daylight starting on April 1 and ending on September 3 and the
duration is 60 minutes.
6-446
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
When the X0.0 is ON, the M0 will be ON too, meaning the daylight saving function is enabled.
That is the PLC system time will add 60 minutes when the date April 1st comes, and when the date September 3rd comes,
the PLC system will subtract the 60 minutes to stop the daylight saving.
Example 2:
Use the instruction DST or the HWCONFIG in ISPSoft to read the daylight saving state.
When the X0.0 is ON, the settings concerning the daylight saving will be stored in the assigned registers; see the
examples below:
D5 60 Duration: 60 minutes
6-447
A S S er i es Pr og r am m ing M an u a l
Device
X Y M S T C HC D FR SM SR E K 16# “$” F
S1
S2
S3
S4
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S1
S2
S3
S4
D
Symbol:
Explanation:
1. S1~ S1+6 allows users to set the hour to start working on Sunday / Monday / Tuesday / Wednesday / Thursday /
Friday / Saturday respectively. This operand occupies 7 consecutive devices, users can use the variables in ARRAY
2. S2~ S2+6 S1~ S1+6 allows users to set the minutes to start working on Sunday / Monday / Tuesday / Wednesday /
Thursday / Friday / Saturday respectively. This operand occupies 7 consecutive devices, users can use the variables
3. S3~ S3+6 allows users to set the hour to stop working on Sunday / Monday / Tuesday / Wednesday / Thursday /
Friday / Saturday respectively. This operand occupies 7 consecutive devices, users can use the variables in ARRAY
4. S4~ S4+6 allows users to set the minutes to stop working on Sunday / Monday / Tuesday / Wednesday / Thursday /
6-448
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
Friday / Saturday respectively. This operand occupies 7 consecutive devices, users can use the variables in ARRAY
5. When the hour value in S1 is larger than the value set in S3, it means the time to stop working is the next day. For
example when users set the time to start working at 18:00 on Monday and the time to stop working at 6:00 , it means
Sunday S1 24 S2 00 S3 24 S4 00
6. The setting rage for the hour is 0~23. When the setting value is out of range, this function will not be enabled. The
setting rage for the minute is 0~59. When the setting value is out of range, this function will be enabled but will use 0
7. When it is required to set the work time to be more than 1 day, users can set the hour as 24 and that means the
system will not check the start working time and the stop working time. For example, to set the start working time to 8
am Monday and the stop working time to 8pm Tuesday, settings will be like this S1+1=8, S3+1=24, S1+2 =24 and
S3+2=20. See the formula below:
8. This instruction should work with the real-time clock. Before operating, please make sure the battery is securely
9. There is no limit on the number of times the instruction can be executed but the output control device D cannot be
used repeatedly. If users use the device D repeatedly, only the last output result from the instruction WWON will be
executed.
8. If there are more than 1 work hours are needed, please use the instruction WWON for several times as required.
6-449
A S S er i es Pr og r am m ing M an u a l
Example 1:
Set a working time from 8:00 to 18:00 from Monday to Friday and no work on Saturday and Sunday.
Example 2:
Set a working time from 18:00 Monday to 08:00 Tuesday and from 18:00 Tuesday to 08: 00 Wednesday. Follow this
6-450
Ch a pt er 6 Ap p l i ed I ns t r uc t i ons
When M0 is ON, the Y0.0 is ON from 18:00 to 8:00 the next day from Monday to Friday and for other times the Y0.0 is
OFF.
Example 3:
Set a working time from 08:00 to 12:00 and from 14:00 to 17:30 from Monday to Friday. No work on Saturday and Sunday.
6_
6-451
A S S er i es Pr og r am m ing M an u a l
When M0 is ON, the Y0.0 is ON from 08:00 to 12:00 and 14:00 to 17:30 from Monday to Friday and for other times the
Y0.0 is OFF.
6-452
C ha pt er 6 A p pl i e d In s tr uc t io ns
6_
6-453
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S
D1
D2
Symbol:
S : Initial device
Device in which the value is
D1 :
stored
D2 : Output signal
_6 Explanation:
1. 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 0~9,999 (16-bit instruction) or an eight-digit
decimal value 0~99,999,999 (32-bit instruction) by pressing the keys in order. The decimal value is stored in D1, and
the output signals are stored in D2.
3. The operand D2 occupies eleven bits. Please do not change the states of the bits during the execution of the
instruction.
4. When the conditional contact is not enabled, the eleven bits starting from the bit specified by D2 is OFF.
5. When the on-line editing is used, please reset the conditional contact to initialize the instruction.
6. Only when D1 uses 32-bit instructions, the 32-bit counter can be used.
6-454
C ha pt er 6 A p pl i e d In s tr uc t io ns
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
0 1 2 3 4 5 6 7 8 9
24VDC
X0.0 X0.1 X0.2 X0.3 X0.4 X0.5 X0.6 X0.7 X0.8 X0.9 S/S
0 1 2 3 4 5 6 7 8 9 Numeric keys
6_
Ov erflowi ng 10
3 2
10 10
1
10
0
Binary -coded
decimal value
Binary
value D0
2. 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
3. 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.
6-455
A S S er i es Pr og r am m ing M an u a l
4. 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.
6. When the conditional contact M0 is switched OFF, the value which was stored in D0 is unchanged. However,
M10~M20 are switched OFF.
X0.0 3
X0.1 4
X0.3 2
X0.5 1
M10
M11
M13
M15
Output si gnal
_6 M20 1 2 3 4
Additional remark:
1. If users declare the operand S in ISPSoft, the data type will be ARRAY [10] of BOOL.
2. If users declare the operand D2 in ISPSoft, the data type will be ARRAY [11] of BOOL.
6-456
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D1
D2
D3
Symbol:
D3 : Output signal
Explanation:
1. 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.
2. 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.
3. After the execution of the instruction is complete, SM692 is ON. That is to say, SM692 is ON for a scan cycle after
6-457
A S S er i es Pr og r am m ing M an u a l
4. Only when D2 uses 32-bit instructions, the 32-bit counter can be used.
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
If SM691 is ON, 0~F are taken as hexadecimal values in the execution of the instruction HKY.
Numeric keys:
0 1 2 3 4 5 6 7 8 9 A B C D E F Kyes
Ov erflowi ng 16
3
16
2 1
16 16
0
_6
D0
If SM691 is OFF, A~F are taken as function keys in the execution of the instruction HKY.
Numeric keys:
0 1 2 3 4 5 6 7 8 9 Numeric keys
Ov erflowi ng 10
3
10
2
10
1
10
0
Bina ry -c oded
dec imal v alue
Binary
D0
value
6-458
C ha pt er 6 A p pl i e d In s tr uc t io ns
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
2. Output signals:
3. When the conditional contact X1.0 is switched OFF, the value which was stored in D0 is unchanged. However,
M0~M7 are switched OFF.
C D E F
8 9 A B
4 5 6 7
6_
0 1 2 3
24VDC
+
X0.0 X0.1 X0.2 X0.3 S/S Y0.0 Y0.1 Y0.2 Y0.3 UP ZP
Additional remark:
1. When this instruction is executed, a too long or a too short scan cycle time will cause the state of the switches not be
When the scan cycle is too short, the I/O may not be able to respond in time and the correct states of the
inputs cannot be read. Users can set a fixed scan time to solve this issue.
When the scan cycle is too long, the switch may become slow to react. Users can write this instruction to the
2. If users declare the operand S in ISPSoft, the data type will be ARRAY [4] of BOOL.
3. If users declare the operand D1 in ISPSoft, the data type will be ARRAY [4] of BOOL.
4. If users declare the operand D3 in ISPSoft, the data type will be ARRAY [8] of BOOL.
6-459
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S1
S2
D1
D2
n
Symbol:
Explanation:
1. 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.
2. If n is 1, the operand D2 occupies one register. If n is 2, the operand D2 occupies two registers.
3. S2 and S2+1, which are for system use only, occupy two devices. Please do not alter the values in these devices.
4. After the execution of the instruction is complete, SM694 is ON for a scan cycle.
5. When the conditional contact is not enabled, the four external outputs starting from the output specified by D1 keep
OFF.
6-460
C ha pt er 6 A p pl i e d In s tr uc t io ns
6. 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 complete, SM694 is ON for a
scan cycle.
X1.0
Cycli c ac tion
6_
Y0.1 0.1s
Inter ruption
Y0.2 0.1s
Y0.3 0.1s
T he execution of the
SM694 insturc iton is complete.
0 1 2 3
10 10 10 10
A dio de (1 N4 14 8) m u st
b e con ne cted i n series .
+
3 2 1 0
1 2 4 8 1 2 4 8 10 10 10 10
X 0 .0 X 0.1 X 0 .2 X 0 .3 X 0. 4 X 0.5 X 0.6 X0 .7 S /S Y 0.3 Y 0.2 Y 0.1 Y0 .0 UP ZP
6-461
A S S er i es Pr og r am m ing M an u a l
Additional remark:
1. If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
2. If users declare the operand D1 in ISPSoft, the data type will be ARRAY [4] of BOOL.
_6
6-462
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D1
D2
n
Symbol:
n : Positive/Negative logic
Explanation:
1. 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
3. S2 is for system use only. Please do not alter the value in it.
5. When the conditional contact is disabled, the eight bit devices starting from the bit device specified by D2 keep OFF.
6. The operand n should be within the range between 0 and 3. Please refer to the additional remark on the instruction
6-463
A S S er i es Pr og r am m ing M an u a l
7. When the on-line editing is used, please reset the conditional contact to initialize the instruction.
Example:
1. 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
3
2. When X1.0 is ON, the digit in the place 10 is selected. If the left arrow is pressed, the places are selected in
If the right arrow is pressed, the places are selected in sequence (10 →10 →10 →10 →10 →10 ). The LED
3 2 1 0 3 2
3.
indicators with the corresponding places are connected to Y0.4~Y0.7. When the digits in the places are selected in
4. 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
Up arr ow
Y 0.4
Y0 .5
X 0.1
Y 0.6
Y 0.7 LED indic ators
Left arrow X 0.3 X 0.2 Right arr ow
3 2 1 0
10 10 10 10
1 X 0.0
Y 0.0
2
Y 0.1
4
Y 0.2
Y 0.3
8 Down arrow
Additional remark:
1. If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
2. If users declare the operand S1 in ISPSoft, the data type will be ARRAY [4] of BOOL.
3. If users declare the operand D2 in ISPSoft, the data type will be ARRAY [8] of BOOLL.
6-464
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
n
Symbol:
S1 : Source device
n : Positive/Negative logic 6_
Explanation:
1. 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.
2. 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
3. S2 is for system use only. Please do not alter the value in it.
4. The operand n should be within the range between 0 and 7. Please refer to the additional remark for more
information.
5. Whether there is one four-digit seven-segment display or two four-digit seven-segment displays, and whether an
6. If there is one four-digit seven-segment display, eight outputs are occupied. If there are two four-digit
6-465
A S S er i es Pr og r am m ing M an u a l
7. 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.
8. 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.
2. 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
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
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.
4. 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
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
6-466
C ha pt er 6 A p pl i e d In s tr uc t io ns
5. The wiring:
Y0.0 Y0.1 Y0.2 Y0.3 Y0.4 Y0.5 Y0.6 Y0.7 Y0.8 Y0.9 Y0.10 Y0.11 UP ZP
0 1 2 3
1 2 4 8 +
10 10 10 10
24VDC
3 2 1 0 3 2 1 0
10 10 10 10 10 10 10 10
1
2 V+ 1
2 V+
4 4
8 8
Additional remark:
Whether an output is a positive output or a negative output, and whether there is one four-digit
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
Output
6_
Binary-coded
(Binary-coded Signal
decimal value
decimal code)
b3 b2 b1 b0 8 4 2 1 A B C D
0 0 0 0 0 0 0 0 1 1 1 1
0 0 0 1 0 0 0 1 1 1 1 0
0 0 1 0 0 0 1 0 1 1 0 1
0 0 1 1 0 0 1 1 1 1 0 0
0 1 0 0 0 1 0 0 1 0 1 1
0 1 0 1 0 1 0 1 1 0 1 0
0 1 1 0 0 1 1 0 1 0 0 1
0 1 1 1 0 1 1 1 1 0 0 0
1 0 0 0 1 0 0 0 0 1 1 1
1 0 0 1 1 0 0 1 0 1 1 0
6-467
A S S er i es Pr og r am m ing M an u a l
Output
Binary-coded
(Binary-coded Signal
decimal value
decimal code)
b3 b2 b1 b0 8 4 2 1 A B C D
0 0 0 0 1 1 1 1 0 0 0 0
0 0 0 1 1 1 1 0 0 0 0 1
0 0 1 0 1 1 0 1 0 0 1 0
0 0 1 1 1 1 0 0 0 0 1 1
0 1 0 0 1 0 1 1 0 1 0 0
0 1 0 1 1 0 1 0 0 1 0 1
0 1 1 0 1 0 0 1 0 1 1 0
0 1 1 1 1 0 0 0 0 1 1 1
1 0 0 0 0 1 1 1 1 0 0 0
1 0 0 1 0 1 1 0 1 0 0 1
The latch:
Number of
displays
Output
(Binary-coded + - + -
decimal code)
Latch + - + - + - + -
n 0 1 2 3 4 5 6 7
Users can edit the parameters in n to modify the logics for the output transistor and the input of the
seven-segment display.
6-468
C ha pt er 6 A p pl i e d In s tr uc t io ns
The connection of the common-anode four-digit seven-segment display with IC 7447 is as follows.
3 2 1 0
8 4 2 1 10 10 10 10
1K 120
B Vcc
C f
LT g 3 a f 2 1 b
+
5VDC RBO a
RBI b e d c h g 0
D c
A d
GND e
IC7447
C0
6_
6-469
A S S er i es Pr og r am m ing M an u a l
1817 MODRWE – – Reading and writing Modbus data without any flag used
_6
6-470
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
n : Number of bytes
Initial device in which the operation result is
D :
stored
Explanation: 6_
1. Please refer to the additional remark on the instruction LRC for more information about the LRC check code.
2. 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.
3. 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.
4. 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.)
6-471
A S S er i es Pr og r am m ing M an u a l
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
PLCVFD-S
SM606 is ON.)
6-472
C ha pt er 6 A p pl i e d In s tr uc t io ns
The two’s complement of 16#2C is 16#D4. ‘D’ (16#44) is stored in the low 8-bit in D113, and ‘4’
Additional remark:
Function Lo ‘3’ The 8-bit function code is composed of two ASCII codes.
‘1’
‘0’ 6_
DATA(n-1)
‘2’
…….
‘0’
DATA 0
‘0’
‘0’
‘2’
LRC CHK Lo ‘7’ The 8-bit check code is composed of two ASCII codes.
2. LRC check code: The values starting from the communication address to the data are added up. The two’s
Example: 16#01+16#03+16#21+16#02+16#00+16#02=16#29
6-473
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
n : Number of bytes
Initial device in which the operation result is
D:
stored
Explanation:
_6
1. Please refer to the additional remark on the instruction CRC for more information about the CRC check code.
2. 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.
3. 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.
4. 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
6-474
C ha pt er 6 A p pl i e d In s tr uc t io ns
PLCVFD-S
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 6_
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.
6-475
A S S er i es Pr og r am m ing M an u a l
Additional remark:
…….
DATA 0
2. 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
_6
register, and performs the logical exclusive OR operation on each pair of corresponding bits.
Step 3: The values of the bits in the 16-bit registers are shifted by one bit to the right. The value of the
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
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-476
C ha pt er 6 A p pl i e d In s tr uc t io ns
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S
n
Symbol:
S1 : Unit address
S2 : Function code 6_
S3 : Device address
Register involved in the
S :
reading/writing of the data
n : Data length
Explanation:
1. The operand S1 should be within the range between 0 and 254; 0 is the broadcasting mode.
For example:
Function Data
Description Devices that support devices for slaves
code length
01 PLC reads the data from several bit devices. 1~1600 X, Y, M, SM, S, T, C, HC
02 PLC reads the data from several bit devices. 1~1600 X, Y, M, SM, S, T, C, HC
6-477
A S S er i es Pr og r am m ing M an u a l
Function Data
Description Devices that support devices for slaves
code length
0F PLC writes the states into several bit devices. 1~1600 Y, M, SM, S, T, C, HC
Only the function codes mentioned above are supported, and other function codes can not be executed. Please
3. S3: The device address. If the address is illegal for the designated communication device, the communication
device will respond with an error message. For example, the device address 16#8000 is illegal in DVP-ES2.
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.
_6 For the word type communication function code, the data length cannot exceed 100 words.
For the bit type (Bool) communictication function code, the data lengthe ranges from 1 to 1600bits.
5. The functions of S3, S, and n vary with the function code used.
Function
S3 S n
code
6-478
C ha pt er 6 A p pl i e d In s tr uc t io ns
Function
S3 S n
code
data is written.
6. There is no limitation on the times of using this instruction, however only one instruction can be executed on the
7. If the communication timeout occurs, timeout flags are ON. After the problem is solved, users have to reset timeout
flags to OFF. When using the instruction MODRW, the timeout value cannot be 0, and the value should be set
between 100 ~ 32767ms; when the value is set to 0, it will be seen as 200ms.
8. In the MODBUS ASCII mode, users only need to set up the data (non-ASCII mode) for transmission, the instruction
will convert the non-ASCII mode to the ASCII mode, consisting of the head code (:), the converted ASCII code,
checksum (LRC) and tail code (CRLF). The data which is received is stored as the ASCII character in the internal
register. The PLC automatically converts the data into the hexadecimal value, and if the communication data is
correct, the conversion result will be stored in S. and the completion flag SM will be ON. 6_
9. In the MODBUS RTU mode, users only need to set up the data for transmission, the instruction will add the
checksum (CRC) and the data which is received is stored as the ASCII character in the internal register. The PLC
automatically converts the data into the hexadecimal value, and if the communication data is correct, the
conversion result will be stored in S.
1. The following exapmles use PLC communication port 1 and special registers to demonstrate how to setup a
communication protocol.
2. Users can set up the PLC communication port via the HWCONFIG of ISPSoft, or via the relative spcial registers, or
API1813 COMDF to set up the communication. Please refer to ISPSoft manual for setups in HWCONFIG. As for
communication register setups (SM, SR), please refer to section 6.19.3 for more details.
3. The communication setup for this example is RS485 ASCII, 9600, 8, E, 1 (SR209=16#0025).
6-479
A S S er i es Pr og r am m ing M an u a l
For users who set up the communication port via the instruction API1813 COMDF, this step can be ignored.
_6
For users who set up the communication port in ISPSoft->HWCONFIG->COM Port, this step can be ignored.
6-480
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 1:
1. Function code 01 (16#01): The PLC reads the data from several bit devices which are not discrete input devices.
(16 peiece of data is read in this example.) For the function code 02, the operation is the same as the function code
01.
When SM96 and X0.0 are on, AS CPU module series sends and receives the Y0~Y17 commands from DVP-ES2.
6_
When the address of Y0 is 16#0500, the states of Y0~Y17 in DVP-ES2 are listed below:
Device Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
Value D 2
Value 0 4
6-481
A S S er i es Pr og r am m ing M an u a l
ASCII mode:
The ASCII codes do not need to be converted intentionally and they are all expressed in the 16# values.
RTU mode:
2. The responding messages of DVP-ES2 will be stored in registers D10.0 to 10.15. (The data read is
D10.15~D10.0=16#04D2. )
Value D 2
Value 0 4
3. After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
be confirmed and determined whether it is correct. If no error occurs in the format, corresponding special flags
6-482
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 2:
1. Function code 03 (16#03): The PLC reads the data from several bit devices which are not discrete input devices. (8
peiece of data is read in this example.) For the function code 04, the operation is the same as the function code 03.
When SM96 and X0.0 are on, AS CPU module series sends and receives the D32~D39 from DVP-ES2.
3. When the address of D32 is 16#1020, the values of D32~D39 in DVP-ES2 are listed below:
6_
Device D32 D33 D34 D35 D36 D37 D38 D39
Value (16#) 1234 5678 1122 3344 5566 7788 99AA BBCC
6-483
A S S er i es Pr og r am m ing M an u a l
ASCII mode:
The ASCII codes do not need to be converted intentionally and they are all expressed in the 16# values.
CR LF”.
RTU mode:
Values in D10~D17 :
Value
1234 5678 1122 3344 5566 7788 99AA BBCC
(16#)
4. After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
_6 be confirmed and determined whether it is correct. If no error occurs in the format, corresponding special flags
6-484
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 3:
1. Function code 05 (16#05): PLC writes the state into a bit device. The device is set to ON in this example.
2. AS CPU module series is connected to the DVP-ES2 series PLC. D10.0 is ON and the Y0 of the DVP-ES2 series
6_
PLC is also ON. When SM96 and X0.0 are ON, the PLC can set the state of Y0.
S1 Unit address 1
ASCII mode:
The ASCII codes do not need to be converted intentionally and they are all expressed in the 16# values.
6-485
A S S er i es Pr og r am m ing M an u a l
RTU mode:
3. After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
be confirmed and determined whether it is correct. If no error occurs in the format, corresponding special flags
SM100 will be on, if not SM102 will be ON.
5. The parameter n will not be used in here, since this function code here is for to write.
_6
6-486
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 4:
1. Function code 06 (16#06): PLC writes the state into a word device.
When SM96 and X0.0 are ON, the PLC can write data to the T0 of the DVP-ES2 series PLC. The address of T0 is
16#0600.
S1 Unit address 1
6-487
A S S er i es Pr og r am m ing M an u a l
ASCII mode:
The ASCII codes do not need to be converted intentionally and they are all expressed in the 16# values.
RTU mode:
4. After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
be confirmed and determined whether it is correct. If no error occurs in the format, corresponding special flags
5. When the DVP-ES2 receives this instruction, it will write data stored in the device D10 to the device T0 of the
DVP-ES2.
6. The parameter n will not be used in here, since this function code here is for to write.
_6
6-488
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 5:
1. Function code 0F (16#0F): PLC writes the states into several bit devices.
Value D 2
Value 0 4
When SM96 and X0.0 are ON, the PLC can set the state of Y0~Y17 of the DVP-ES2. The address of Y0 is
16#0500.
6-489
A S S er i es Pr og r am m ing M an u a l
S1 Unit address 1
n Data length 16
ASCII mode:
The ASCII codes do not need to be converted intentionally and they are all expressed in the 16# values.
RTU mode:
3. After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
be confirmed and determined whether it is correct. If no error occurs in the format, corresponding special flags
Device Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
Value D 2
Value 0 4
4. The parameter n will not be used in here, since this function code here is for to write.
6-490
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 6:
1. Function code 10 (16#10): PLC writes the states into several word devices.
3. Suppose the values for D20~27 are listed below. (waiting to write data to the devices T0~7 of the DVP-ES2).
Value (16#) 1234 5678 1122 3344 5566 7788 99AA BBCC 6_
When SM96 and X0.0 are ON, the PLC can write data to the T0~7 of the DVP-ES2 series PLC. The address of T0
is 16#0600.
S1 Unit address 1
6-491
A S S er i es Pr og r am m ing M an u a l
ASCII mode:
The ASCII codes do not need to be converted intentionally and they are all expressed in the 16# values.
AS sends the communication command: “:01 10 0600 00 08 10 1234 5678 1122 3344 5566 7788 99AA BBCC
8F CR LF”
RTU mode:
AS sends the communication command: “01 10 06 00 00 08 10 1234 5678 1122 3344 5566 7788 99AA BBCC
0B 0C”
5. After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
be confirmed and determined whether it is correct. If no error occurs in the format, corresponding special flags
SM100 will be on, if not SM102 will be ON. When the DVP-ES2 receives this instruction, it will write data stored in
Device T0 T1 T2 T3 T4 T5 T6 T7
Value (16#) 1234 5678 1122 3344 5566 7788 99AA BBCC
_6
6. The parameter n will not be used in here, since this function code here is for to write.
Additional remark:
1. If the value in S1 or S2 exceeds the range, the operation error occurs, the instruction is not executed, SM0 is ON,
2. If the device specified by S is not sufficient to contain the n pieces of data, the instruction is not executed, SM0 is
3. 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.
4. 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.
5. 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.
6-492
C ha pt er 6 A p pl i e d In s tr uc t io ns
6. If the communication command is 0x05 or 0x06, n does not work. The state or the data is written into one bit device
7. If sending flags SM96 and SM97 are not ON, the instruction MODRW is not executed.
8. If the communication timeout occurs, the timeout flags SM104 and SM105 are ON, and the receving flags SM98
9. If the error occurs during the reception of the data, the error flags SM102 and SM103 are ON, and the receving
10. If the function code specified by S2 is related to the word device, the device in the external equipment with which the
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 PLC communicates has to be the bit device.
11. As for communication register setups (SM, SR), please refer to section 6.19.3 for more details.
6_
6-493
A S S er i es Pr og r am m ing M an u a l
S1
S2
S3
D1
D2
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data INT
type
S1
S2
S3
D1
D2
Symbol:
1. S1 is a communication port number, COM1 is number 1, COM 2 is number 2, Card 1 is number 11 and Card 2 is
number 12. If the data is out of the communication port range, the instruction will not execute any sending or
receiving.
2. If a specific character or specific characters are used as the condition of ending the receiving of data, it is
suggested that the instruction should be applied to ASCII data. If the instruction is not applied to ASCII data, it is
suggested that a timeout period should be used as the condition of ending the receiving of data.
6-494
C ha pt er 6 A p pl i e d In s tr uc t io ns
If S2 is D100 and S3 is 10, the values in the low bytes in D100~D109 will be sent through the communication port
specified by S1.
4. If the setting value in S3 is 0, no string will be sent. The maximum number of characters which can be sent is 256
words.
If D1 is D200, the value in D2 is 3, and the value in D2+1 is 16#0D0A, the data received will be stored in the low
bytes in the devices starting from D201 (the high bytes will be unchanged), the receiving of data will not stop until
the consecutive stop characters 16#0D and 16#0A are received, the length of the data received will be written to
D200 after 16#0D and 16#0A are received, and a completion flag will be set to ON after the receiving of data stops.
Not receiving communication data Unused After the sending of data is complete, a
0
completion flage will be set to ON.
When the time which passes The setting value in If the time that users set is greater than 6_
before the next piece of data is D2+1 is time. The unit 3000 milliseconds, the value in D2+1 will
received exceeds the time set in of measurement for be 3000. If the time that users set is less
1 D2+1, the receiving of data is time is 1 millisecond. than 5 milliseconds, the value in D2+1
5 to 3000.
2 The data received ends with a The setting value in If a specific character is 16#0A, the
character.
3 The data received ends with two The setting value in If two specific characters are 16#0D and
consecutive specific characters. D2+1 is two specific 16#0A, the value in D2+1 will be
characters. 16#0D0A.
4 The data received starts with a A specific character is If a start character is 16#3A, and time is
specific character. When the time stored in the high byte 15 milliseconds, the value in D2+1 will
6-495
A S S er i es Pr og r am m ing M an u a l
the time set in D2+1, the receiving D2+1. (The time set in
in the range of 5
milliseconds to 255
millseconds.)
5 The data received starts with a The setting value in If a start character is 16#3A, and a stop
specific character, and ends with a D2+1 is a specific start character is 16#0A, the value in D2+1
6 A specific quantity of data is The setting value in If users want to receive 10 characters,
is 1~256.
7 The data received ends with a The setting value in If an end character is 16#0A, the value
specific character and generate D2+1 is a specific end in D2+1 will be 16#000A.
8 Set the quantity of data received The setting value in If users want to receive 10 characters,
and then generate communication D2+1 is the length of the value in D2+1 is 10.
_6
interruptions. the data which is
is 1~256.
9 The data received ends with a A specific end If an end character is 16#0A, and time is
quantity of data received; when the high byte in D2+1, words, the value in D2+1 will be
of 1 milliseconds to 255
millseconds.)
6-496
Cha p ter 6 App l ied Ins truc tio n s
7. Except mode 6 and 8, when data received in D2 exceeds the maximum range of the received data length 256 words
and no ending character is received, the instruction will stop executing and will regard this opearation as a receiving
error. D1+0 is 0 and D1+1~ will not be inputted in the received data.
8. The relation among communication port, related spcial auxiliary relays, and a related special data register are
9. Timing diagrams
When data is sent, users can not cancel the sending of the data. If the conditional contact preceding the
instruction is not enable, the data will still be sent, but a completion flag will not be set to ON after the sending
Reception fl ag
Completion fl ag
6_
2 3 2 5
1 4 4 1
Description:
③ After the first character is received, the time which passes before the next character is received will be
measured. Whenever a character is received, the time measured is cleared. The completion flag will not
be set to ON until the time measured is greater than the setting value in D2+1.
④ If the instruction is still enabled after users reset the completion flag or the communication flag, the next
communication data is sent automatically when the instruction is scanned in the next cycle.
6-497
AS Ser ies Pro gra mm in g M anu al
⑤ When the PLC begins to receive data, it begins to measure the time which passes. The communication
timeout will not be set to ON until the time measured exceeds the timeout period set. It is suggested that
the timeout period set should be longer than the time set in D2+1.
Reception fl ag
Completion fl ag
2 3 2 2
1 4 4 1
Description:
③ After the first character is received, the time which passes before the next character is
received will be measured. Whenever a character is received, the time measured is cleared.
A communication timeout flag will not be set to ON until the time measured exceeds the
④ If the instruction is still enabled after users reset a completion flag or a communication flag,
the next communication data is sent automatically when the instruction is scanned in the
next cycle.
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.)
6-498
C ha pt er 6 A p pl i e d In s tr uc t io ns
16-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. When SM106/SM107 is OFF, the 16-bit data is divided into the
6_
The data which the PLC receives from the external equipment includes the head and the tail code. Therefore, users
11. When the mode is 7 or 8, the corresponding communication port and the interruption number are listed below.
Communicaiton port
COM1 COM2 Card1 Card2
number
6-499
A S S er i es Pr og r am m ing M an u a l
Example 1:
The mode in D2 is 0 (not receiving communication data) and set the mode of sending data/Mode of receiving data to 8-bit
mode (SM106=ON).
2. The contents for the data to be sent: D100=16#0031, D101=16#0032, D102=16#0033, D103=16#0034.
7. Since receiving data is not required, after the PLC sends out all the data, the operation ends. SM100=0.
_6
8. For another data sending, users can set the flag SM100 to OFF to start the operation again.
6-500
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 2:
The mode in D2 is 1 (setting the time value to 5~3000ms) and set the mode of sending data/Mode of receiving data to
3. Set D10=16#0001 (mode: 1), D11=300 (set the time value to 300ms).
7. After the external equipment received the data from the PLC, 5 consecutive data will be sent to the PLC and each
8. D200=5 (number of the data received), the content of the received data: D201=16#3635, D202=16#3837, 6_
D203=16#0039.
10. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC will start receiving data.
The interval time of every data reception is set in D11. When the interval time exceeds the set time and no data is
6-501
A S S er i es Pr og r am m ing M an u a l
Example 3:
The mode in D2 is 2 (The data received ends with a specific character.) and set the mode of sending data/Mode of
1. The length for the data to be sent: D20=0, meaning the PLC will not send data but only receives data.
4. PLC is waiting to receive data from the external equipment. (D20=0, meaning the PLC will not send data to the
external equipment.).
6. D200=6 (number of the data received), the content of the received data: D201=16#0031, D202=16#0032,
8. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC will start receiving data
till the ending character (16#0A) is received. When the reception of data is complete, SM100 is ON. If the
communication timeout occurs but the ending character (16#0A) is still not received, the communication timeout
6-502
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 4:
The mode in D2 is 3 (The data received ends with two specific character.) and set the mode of sending data/Mode of
The example uses DVP-ES2 as the external equipment and is going to write H1234 to the D100 of the DVP-ES2.
2. The contents for the data to be sent: D100=16#303A, D101=16#3031, D102=16#3136, D103=16#3630,
3. Set D10=16#0003 (mode: 3), D11=16#0D0A (the ending character is 16#0D and 16#0A).
6. The external equipment receives data from the PLC and the last 2 data are 16#0D and 16#0A.
7. D200=17 (number of the data received), the content of the received data: D201=16#303A, D202=16#3031,
D209=16#000A.
9. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC will start receiving data
till the ending character (16#0D0A) is received. When the reception of data is complete, SM100 is ON. If the
communication timeout occurs but the ending character (16#0D0A) is still not received, the communication
6-503
A S S er i es Pr og r am m ing M an u a l
Example 5:
The mode in D2 is 4 (The data received starts with a specific character and set the time value to 5~255ms.) and set the
2. The contents for the data to be sent: D100=16#0031, D101=16#0032, D102=16#0033, D103=16#0034.
3. Set D10=16#0004 (mode: 4), D11=16#3A0F (the starting character is 16#3A and set the time value to 16#0F,
meaning 15ms).
6. The external equipment receives data from the PLC and then sends 7 consecutive words to the PLC with an
7. D200=6 (number of the data received), the content of the received data: D201=16#003A, D202=16#0035,
D203=16#0036, D204=16#0037, D205=16#0038, D206=16#0039.
9. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC is ready to receive data.
When receiving the starting character 16#3A, the PLC will start receiving data. The interval time of every data
reception is set in D11. When the interval time exceeds the set time 16#0F (15ms) and no data is coming in, the
6-504
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 6:
The mode in D2 is 5 (The data received starts and ends with a specific character) and set the mode of sending data/Mode
The example uses DVP-ES2 as the external equipment and is going to read data in the D100 of the DVP-ES2.
2. The contents for the data to be sent: D100=16#303A, D101=16#3031, D102=16#3133, D103=16#3630,
D104=16#3034, D105=16#3030, D106=16#3831, D107=16#0D37, D108=16#000A
3. Set D10=16#0005 (mode: 5), D11=16#3A0A (the starting character is 16#3A and the ending character is 16#0A).
7. D200=15 (number of the data received), the content of the received data: D201=16#303A, D202=16#3031,
9. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC is ready to receive data.
When receiving the starting character 16#3A, the PLC will start receiving data till the ending character 16#0A is
received. And the the SM100 will be ON. If the communication timeout occurs but the starting character 16#3A or
the ending character 16#0A is still not received, the communication timeout flag SM104 will be ON.
6-505
A S S er i es Pr og r am m ing M an u a l
Example 7:
The mode in D2 is 6 (the received data length) and set the mode of sending data/Mode of receiving data to 8-bit mode
(SM106=ON).
2. The contents for the data to be sent: D100=16#0031, D101=16#0032, D102=16#0033, D103=16#0034.
6. The external equipment receives data from the PLC and then sends 8 consecutive data to the PLC.
9. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC is ready to receive data.
When receiving the set quantity of data, the SM100 will be ON. If the communication timeout occurs but the set
quantity of data is still not received, the communication timeout flag SM104 will be ON.
6-506
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 8:
The mode in D2 is 7 (The data received ends with a specific character and generates communication interruptions.) and
set the mode of sending data/Mode of receiving data to 8-bit mode (SM106=ON).
3. The contents for the data to be sent: D100=16#0031, D101=16#0032, D102=16#0033, D103=16#0034.
9. D200=6 (number of the data received), the content of the received data: D201=16#0031, D202=16#0032,
11. D30=1 (the interruption is trigger and then the INC D30 is executed.)
12. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC is ready to receive data.
When receiving the set ending character (16#06), the SM100 will be ON. If the communication timeout occurs but
the set ending character is still not received, the communication timeout flag SM104 will be ON.
6-507
A S S er i es Pr og r am m ing M an u a l
Example 9:
The mode in D2 is 8 (The set quantity of data is received and generates communication interruptions.) and set the mode
3. The contents for the data to be sent: D100=16#0031, D101=16#0032, D102=16#0033, D103=16#0034.
8. The external equipment receives data from the PLC and then sends 8 consecutive data to the PLC.
10. D200=8 (number of the data received), the content of the received data: D201=16#0032, D202=16#0033,
12. D30=1 (the interruption is trigger and then the INC D30 is executed.)
13. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC is ready to receive data.
When receiving the set quantyity of data, the SM100 will be ON. If the communication timeout occurs but the set
quantity of data is still not received, the communication timeout flag SM104 will be ON.
6-508
C ha pt er 6 A p pl i e d In s tr uc t io ns
Example 10:
The mode in D2 is 9 (The set ending character or the set quantity of data is received) and set the mode of sending
2. The contents for the data to be sent: D100=16#0031, D101=16#0032, D102=16#0033, D103=16#0034.
3. Set D10=16#0009 (mode: 9), D11=16#0A0F (the ending character is 16#0A and the set data length is 16#0F).
6. The external equipment receives data from the PLC and then sends 15 pieces of data to the PLC.
7. D200=6 (number of the data received), the content of the received data: D201=16#0031, D202=16#0032, 6_
D203=16#0033, D204=16#0034, D205=16#0035, D206=16#000A.
th
The PLC stops receiving data after the 6 of data is received.
9. For another data sending, users can set the flag SM100 to OFF to start the operation again.
NOTE: When the data sending is complete, the receiving flag SM98 will be ON and then the PLC is ready to receive data.
When receiving the set ending character or the set quantity of data, the SM100 will be ON. If the communication
timeout occurs but the set ending character or the set quantity of data is still not received, the communication
Additional remark:
1. There is no limit on the number of times the communication instruction COMRS can be executed. However, every
communication port can only be enabled by one communication instruction, and the communication instructions
2. When COMRS is executed, no checksum is used. If users need a checksum, they can use COMRS and another
instruction available.
6-509
A S S er i es Pr og r am m ing M an u a l
3. If the value in D2 is 2, 3, 5, 6 or 9, it is suggested that users should set a timeout period. After a timeout period is set,
the sending of data will be retried if a stop character is not received.
4. The instruction does not automatically clear the value in D1~D1+n whenever the instruction is just executed or the
PLC begins to receive new communication data. Only after a completion flag is switched from OFF to ON can users
know whether data is received and how much data the PLC receives. If the users want to clear the values in
6. If the number of devices starting from S2 is not equal to the value in S3, the instruction will not be executed, SM0 will
be ON, and the error code in SR0 will be 16#2003.
7. If the value in D2 is not in the range of 0 to 9, the instruction will not be executed, SM0 will be ON, and the error
code in SR0 will be 16#200B.
8. If the value in D2 is 6, 8 or 9, and the number of devices starting from D1 is not equal to the value in D2+1, the
instruction will not be executed, SM0 will be ON, and the error code in SR0 will be 16#2003.
9. The quantity of data received is greater than the number of devices starting from D1, the data which can not be
stored will be ignored.
10. If a completion flag is ON, the PLC will stop receiving data. If a communication port receives data when a
completion flag is ON, the data will not be received.
11. If the setting value in S3 is less than 0 or greater than 256, the instruction will not be executed, SM0 will be ON, and
the error code in SR0 will be 16#200B.
12. When the mode of D2 is 6 or 8, the length of D2+1 is less than 1 or greater than 256, the instruction will not be
_6
executed. SM0 will be ON, and the error code in SR0 will be 16#200B.
6-510
C ha pt er 6 A p pl i e d In s tr uc t io ns
S1
S2
S3
S4
S5
D
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S4
S5
D
S3 : Parity bit
Explanation:
1. The instruction only provides the way of directly setting the parameter values, instead of variable declaration.
2. S1 sets the baud rate with the unit 100bps. For example, the input value 96 indicates 9600bps.
3. S2 sets the number of data bits. The input value 7 indicates 7 data bits. 8 means 8 data bits. If the value is not 7 or 8
6 - 5 11
A S S er i es Pr og r am m ing M an u a l
4. S3 sets the parity bit. The value 0 indicates None (no parity bit). 1 corresponds to Odd bit checking. The setting
value 2 corresponds to Even bit checking. If the value is not 0, 1 or 2 in S3, the default value is filled automatically.
5. S4 sets the number of end bits. The value 1 (preset) indicates 1 bit. 2 means 2 bits. If the value is not 1 or 2 in S4,
6. S5 sets the communication mode of the Modbus communication protocol. The value 0 indicates ASCII (default
value) and 1 means RTU. If the value is not 0 or 1 in S5, the instruction is executed with the default value.
7. D sets communication port number. The serial number of COM1 is 1, COM2 is 2, Card1 is 11 and Card2 is 12. If the
setting value is out of the valid range, the instruction will not perform any communication port format setting.
8. Users can also directly set the communication port through ISPSoft->HWCONFIG->COM Port or the special
registers. (For the setting in HWCONFIG, refer to ISPSoft user manual. Refer to section 6.19.3 for the setting in the
9. The communication at the actual communication port will change immediately after the setting of the instruction is
used. If some communication is being carried out at the moment, it will be forced to cancel. Additionally, the
corresponding setting value in SM/SR will change accordingly. For details on SM/SR, refer to section 6.19.3.
10. The instruction will not make any setting for the actual communication port when the communication format setting
Example:
_6
1. Take PLC COM1 for example here. Other PLC communication ports are similar to it in the communication setting.
S3 Parity bit E 2
6-512
C ha pt er 6 A p pl i e d In s tr uc t io ns
6_
6-513
A S S er i es Pr og r am m ing M an u a l
S1
S2
S3
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data INT
type
S1
S2
S3
S
Symbol:
Explanation:
1. S1 sets a communication port number. The serial number of COM1 is 1, COM2 is 2, Card1 is 11 and Card2 is 12. If
the value exceeds the valid range, the instruction will not execute the receiving of any communication data.
2. S2 sets the station address of VFD AC motor drive. If the station address is 0, it indicates that the broadcast mode is
adopted. The range is 0~254. The instruction will not be executed if the value is out of the range.
3. S3 the communication function code and S the source or received data are explained in the following table.
S3
S source and received
function S3 function name Remark
data
code
6-514
C ha pt er 6 A p pl i e d In s tr uc t io ns
S3
S source and received
function S3 function name Remark
data
code
1 Clockwise running Velocity value Refer to AC motor drive user manual for the
command setting value and the unit.
command
4 Jog clockwise running Unused For the setting of the jog velocity, refer to AC
command motor drive user manual.
running command
Rec eption fl ag
Compl etion fl ag
l m
n
Description:
Transmitting data begins after the instruction is started. During the time, the communication timeout time is not
measured.
The reception flag is set. From the moment when the first character is received to the moment when the next
6-515
A S S er i es Pr og r am m ing M an u a l
character is received, the period of time will be measured. Whenever a character is received, the time
measured is cleared. The communication timeout flag will be generated if the time measured is greater than
When the receiving of data is completed, the completion flag is set. Users must clear the flag themselves.
Before the communication instruction is sent out once again, the instruction need be stopped for one cycle
after the completion flag is watched. And then the instruction is started in the next cycle.
5. There is no limit to the number of times to use the instruction. One communication port can only be used for the
output and execution of one communication instruction every time. If the receiving and sending of data is completed,
1. Set PLC COM1 (RS485) port with the station address 2 and the communication format: ASCII, 115200, 7, N, 2
through HWCONFIG.
2. Make a basic setting using the panel of Delta C2000 AC motor drive according to the following steps.
B. Setting 09-01 to 115.2, RS485 baud rate of the AC motor drive is 115200.
Example:
By using VFDRW instruction to control the velocity, make VFD run forward at the frequency of 120Hz, run reversely at the
6-516
C ha pt er 6 A p pl i e d In s tr uc t io ns
6_
1. Connect AS COU to VFD.
Set D202=12000 at first. When M1 is ON, VFD starts to accelerate after receiving the command of clockwise
2. Set D204=18000 at first. When M2 is ON, VFD starts to decelerate till it stops after receiving the command of
3. When M3 is ON (at the moment, the value in D206 is ineffective), VFD decelerates to stop after receiving the stop
command.
Device
D220 D221 D222 D223 D224
Frequency
Content Error code VFD state Output frequency Output current
command
6-517
A S S er i es Pr og r am m ing M an u a l
As Bit2 =1, VFD executes the jog command. As Bit4~3= 11B, VFD runs counterclockwise. As the frequency
command is 18000, it indicates that VFD starts to run at the frequency of 180Hz.
(For the definitions of parameter addresses in the communication protocol, refer to Delta AC motor drive user
manual.)
5. The reception completion flag SM100 is ON, the values of M1~M5 are cleared so as to avoid influencing the
After the receiving of the data that VFD sends back is completed, the format of the data sent back from VFD will be
checked. If the data format is correct, SM100 is ON. Otherwise, SM102 is ON.
_6
6-518
C ha pt er 6 A p pl i e d In s tr uc t io ns
S1
S2
S3
S
DWORD
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S
Symbol:
Explanation:
1. S1 sets a communication port number. The serial number of COM1 is 1, COM2 is 2, Card1 is 11 and Card2 is 12. If
the value exceeds the valid range, the instruction will not execute the receiving of any communication data.
2. S2 sets the station address of the servo. If the station address is 0, it indicates that the broadcast mode is adopted.
The range of the value is 0~254. The instruction will not be executed if the value is out of the valid range.
4. S3 the communication function code and S the source or received data are explained in the following table.
6-519
A S S er i es Pr og r am m ing M an u a l
S3 function
S3 function name S source or received data Remark
code
S3 function
S3 function name S source or received data Remark
code
Reading the servo state value Occupies 10 consecutive Reading the state value from
(32-bit value)
Writing data into the servo Occupies 8 consecutive devices Writing the data into the registers
(32-bit value)
Writing the mapping parameter Occupies 8 consecutive devices Writing the data into the registers
(32-bit value)
Jog velocity input, clockwise The range of velocity: 1~5000; Writing data into the register of
19
running, counterclockwise 4999 (Clockwise running); P4-05
6-520
C ha pt er 6 A p pl i e d In s tr uc t io ns
stop running) ;
0 (Stop)
Servo ON/OFF 1: Servo On; Writing the data into the register
20
Other value: Servo OFF of P2-30
Velocity command Occupies 6 consecutive devices Writing data into the registers of
Torque command Occupies 6 consecutive devices Writing the data into the registers
Setting the mapping targets of Occupies 8 consecutive devices Writing the data into the registers
(32-bit value)
Sending data
6_
Rec eption fl ag
Compl etion fl ag
l m
n
Description:
Transmitting data begins after the instruction is started. During the period, the communication timeout time is
not measured.
The reception flag is set. From the moment when the first character is received to the moment when the next
character is received, the period of time will be measured. Whenever a character is received, the time
measured is cleared. The communication timeout flag will be generated if the time measured is greater than
6-521
A S S er i es Pr og r am m ing M an u a l
When the receiving of data is completed, the completion flag is set. Users must clear the flag themselves.
Before one communication instruction is sent out once again, the instruction need be disabled for one cycle
after the completion flag is watched. And then it is started in the next cycle.
6. There is no limit to the number of times to use the instruction. One communication port can only be used for the
output and execution of one communication instruction every time. If the receiving and sending of data is completed,
1. Set PLC COM1 (RS485) port to ASCII, 115200, 8, E, 1 as the communication format through HWCONFIG.
2. Make a basic setting using the panel of Delta ASDA-A2 servo according to the following steps.
E. By Setting P3-01 to 0205, the RS485 baud rate of the servo is set to 115200.
_6
F. By setting P3-02 to 0004, the RS485 communication format of the servo is 8, E, 1.
Example:
By using ASDRW instruction to control the velocity, make the servo run to the relative position 5000000PUU by
accelerating for 400ms from the speed of 3000.0r/min and then decelerating for 200ms.
6-522
C ha pt er 6 A p pl i e d In s tr uc t io ns
6_
7. Set the values in D200~D207 as the following table shows, which will be written to P0-35~P0-38 of ASDA-A2. 8
6-523
A S S er i es Pr og r am m ing M an u a l
The setting values of P0-35~P0-38 are used for setting the mapping target of P0-25~P0-28. Users can set the
Setting value(16#) 0514 0515 0602 0602 0603 0603 053C 0507
When the value of P0-38 is set to 053C 0507, it indicates that the mapping parameter target of P0-28 is P5-60 (16
Mapping parameter
P5-20, P5-21 P6-02 P6-03 P5-60, P5-07
target
Acceleration/deceleration
Target velocity and
time1
Parameter name Path type1 Path1 data PR command trigger
Acceleration/deceleration
time2
When M3 is ON, the values in D220~D227 are written into P0-25~28 of ASDA-A2.
_6
ASDA-A2 P0-25 P0-26 P0-27 P0-28
The servo starts running after acceleration time=0190 (400ms), deceleration time=00C8 (200ms), path type=1083,
position command=4C4B40 (5000000PUU), target velocity=7530 (3000.0rpm) and PR command trigger =1 are set.
9. Set the values in D240~D247 as the following table shows, which will be written into P0-17~ P0-20 of ASDA-A2. 8
Setting value(10#) 41 0 0 0
When M4 is ON, the values in D240~D247 are written into P0-17~20 of ASDA-A2.
The setting values of P0-17~20 are used for setting the contents of P0-09~12.
(Users can set the contents to be displayed by referring to Delta servo operation manual.)
6-524
C ha pt er 6 A p pl i e d In s tr uc t io ns
Setting value(10#) 41 0 0 0
When P0-17 is set to 41, it indicates that the content of P0-09 is the drive state.
10. When M5 is set to ON, the values of P0-17~ P0-20 of ASDA-A2 are read to D260~D267.
When the drive state bit, Bit 4 is1, it indicates that the target position is reached.
11. When the reception completion flag SM100 is set to ON, the values of M1~M5 are cleared to avoid influencing the
After the receiving of the data that ASDA-A2 sends back is completed, the format of the data sent back from
ASDA-A2 will be checked. If the data format is correct, SM100 is ON. Whereas, SM102 is ON if the data format is
incorrect. 6_
6-525
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
6-526
C ha pt er 6 A p pl i e d In s tr uc t io ns
Explanation:
1. The names and descriptions of S1~S11 are listed in the following table.
1=COM1, 2=COM2.
Communication port
S1 If other value is filled, the instruction will not WORD
number
execute the modification of the operand.
Item number in the data If the value is out the range, the instruction
S2 WORD
exchange table will not execute the modification of the
operand.
The station address of the instruction will take 240 as the value number
S3 WORD
remote equipment automatically. If the value is 0 or less than 0, will be
changed. 0.
S6 Reading data length The value 0 indicates not to read data. WORD
selectable.
6-527
A S S er i es Pr og r am m ing M an u a l
of the operand.
S10 Writing data length The value 0 indicates not to write data. WORD
The local register into which Bit function code: only M is selectable. BOOL
S11
the remote data are written Word function code: only D is selectable. WORD
2. It is suggested that the instruction be set as the pulse instruction when the instruction is used.
3. See the details about the Modbus function codes in S4 and S8 as below.
The command that AS reads the data from several bit devices (which are not discrete input devices) is 1 (16#01).
The command that AS reads the data from several bit devices (which are only discrete input devices) is 2 (16#02).
The command that AS reads the data from several word devices (which are not input registers) is 3 (16#03).
_6
The command that AS reads the data from several word devices (which are only input registers) is 4 (16#04).
The command that AS writes the state into a bit device is 5 (16#05).
The command that AS writes the state into a word device is 6 (16#06).
The command that AS writes the state into several bit devices is 15 (16#0F).
The command that AS writes the data into several word devices is 16 (16#10).
The command that AS synchronously reads from and writes the data into several word devices is 23 (16#17).
Only the function codes mentioned above are supported. For other function code setting value, such as 0, it will be
seen as invalid (including communication address, length and the start register) and the instruction will execute the
4. When users select16#17 (for reading and writing synchronously) in S4 (the function code for reading), the operand
S8 (the function code for writing) is seen as invalid and 16#17 is automatically seen for writing data.
6-528
C ha pt er 6 A p pl i e d In s tr uc t io ns
5. When users select16#05 or 16#06 in S8 (the function code for writing), the operand S10 (for writing the data length)
is seen as invalid and 16#05 or 16#06 is automatically seen for writing a piece of data.
6. The parameter values specified by the instruction are valid only while PLC is running. After PLC is repowered, the
data in the data exchange table set through HWCONFIG are taken as default values. If there are the values of
parameters to be modified in the execution, the instruction will be needed for modifying them.
7. The instruction is used to immediately set the parameters for communication connection when the data exchange
function is not started. The new communication parameter will not be able to execute till the next cycle if the data
exchange function is being executed and meanwhile the communication parameters of the connection number are
just changed.
For example, while the data exchange function is executing the parameters of connection 3, the instruction
specifies the parameters of connection 3 to change. So the newly changed communication parameters will not be
8. The instruction only provides the function of revising the communication parameters. Refer to the following flags for
starting and closing of the communication connection function if PLC program is used for starting or closing of the
connection number.
When users set the automatic scan function through the editing software, the start/stop flag of the connection
number will automatically update the start/stop state once after the data exchange function finishes executing the
scan.
6_
See the following table for the details on SM and the explanation.
SM752 ~ SM783 R/W The flags for enabling the data exchange connection 1~32
SM784 ~ SM815 R The reading success flags of the data exchange connection 1~32
SM816 ~ SM847 R The error flags of the data exchange connection 1~32
SM864 ~ SM895 R/W The flags for enabling the data exchange connection 1~32
SM896 ~ SM927 R The reading success flags of the data exchange connection 1~32
SM928 ~ SM959 R The error flags of the data exchange connection 1~32
PLC will set it to ON when the reading success flag mentioned above indicates the data receiving is completed and
the data checked are correct. If an error occurs in receiving of the data or communication timeout happens, the
6-529
A S S er i es Pr og r am m ing M an u a l
error flag will be set to ON. (Users can refer to error codes.) Since the reading success flag and error flag of every
connection number are not ON simultaneously, PLC will not reset any of them to OFF in the data exchange.
9. See the following table for (only-read registers) SR in the data exchange function and the explanation.
SR No. Description
SR1335 The cycle of actual connection 1~32 in the COM1 data exchange
SR1336 The cyclic connection number in the COM1 data exchange currently
SR1340 ~ SR1371 The error codes of connection 1~32 in the COM1 data exchange
SR1375 The cycle of actual connection 1~32 in the COM2 data exchange
SR1376 The cyclic connection number in the COM2 data exchange currently
SR1380 ~ SR1411 The error codes of connection 1~32 in the COM2 data exchange
10. The data exchange function does not provide the writing success flag. It is suggested that the connection number in
execution can be referred to for judging whether the writing of data succeeds or not if the writing success flag need
be used.
For example, when the executed connection number is 3 in SR1336, the communication actions which are taken
successively are to read communication data first and then to write communication data after reading is finished.
_6 11. If the length value in S6 and the initial device of S7 are out of the range of D or M device, the length value in S6 will be
automatically revised to the value within the valid range. For example, if the length value in S6 is100 and the initial
12. In the following cases, the instruction will not be executed and the parameter settings in HWCONFIG will not be
changed. And SM0 will be set to ON and the error code will be 16#200B in SR0.
When the setting values in S1, S2, S4 and S8 are out of the specified range, it is seen as an input error.
When S4 or S8 function code selects the bit type for reading or writing data, the local device for storing data S7
or S11 must select M device. If the selection is not M, it is seen as an input error.
When S4 or S8 function code selects the word type for reading or writing data, the local device for storing data
S7 or S11 must select D device. If the selection is not D, it is seen as an input error.
6-530
C ha pt er 6 A p pl i e d In s tr uc t io ns
1. For the data exchange between AS CPU and DVP-ES2 CPU, the COM1 data exchange table in ISPSoft HWConfig
is shown as follows.
Remote
Detection Remote Function
Item No. station Local device Length How to start
method device code
address
2. Before the data exchange is started, suppose that the corresponding data between AS CPU and DVP-ES2 CPU
are listed in the following table.
6_
D200~D249 200~249 D200~D249 0
3. The function of the data exchange between AS CPU and DVP-ES2 CPU is started as X0.1 is ON.
6-531
A S S er i es Pr og r am m ing M an u a l
_6
4. After the data exchange is started, the corresponding data between AS CPU and DVP-ES2 CPU are changed as
shown in the following table.
5. As X0.0 is ON, the COM1 data exchange table parameters of AS CPU are modified as below.
6-532
C ha pt er 6 A p pl i e d In s tr uc t io ns
6. Due to the change of COM1 data exchange table parameters, the corresponding data between AS CPU and
DVP-ES2 CPU are modified as below.
M100~M109 ON M0~M9 ON
6_
6-533
A S S er i es Pr og r am m ing M an u a l
STRING
LWORD
LREAL
WORD
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S4
S
n
D
S2 : Unit address
S3 : Function code
S4 : Device address
Register involved in the reading and writing of the
S :
data
n : Data length
The flag for setting the completion of the reading
D :
and writing the data
Explanation:
1. S1 sets the serial number of a communication port. The serial number of COM1 is 1, COM2 is 2, Card1 is 11 and
Card2 is 12. If the value exceeds the valid range, the instruction will not execute the receiving of any
communication data.
2. Refer to the explanation of API1808 MODRW instruction for the meaning of S2, S3, S4, S and n.
6-534
C ha pt er 6 A p pl i e d In s tr uc t io ns
3. D sets the communication state flags when the communication instruction completes the communication. 3
consecutive devices are occupied by the flags. Users must reset them to OFF by themselves. The explanations of
Operand Description
NOTE: Only one flag will be set to ON among the three state flags and meanwhile the corresponding special flags
(SM) will be also set to ON every time the communication is completed. Refer to section 6.19.3 for the use
4. The timing for sending the instruction is when the instruction is started. Users must disable the instruction for a scan
cycle after the communication is completed. And then the next communication instruction can be sent just after the
instruction is restarted.
5. The communication action and control sequence of the instruction are similar to API1808 MODRW instruction. The
only difference between them is that the sending of the communication command can be done without users’
Example:
The MODRW program and MODRWE program are compared by taking PLC COM1 and function code 03 to read 8 6_
pieces of data from D20 of DVP-ES2 for example. The same is for other PLC communication ports. For the use of other
function codes, refer to API1808 MODRW instruction and the following example.
1. The device address of D20 in DVP-ES2 CPU, 16#1020 and the content values in D20~D27 are shown in the table
below.
Value (16#) 1234 5678 1122 3344 5566 7788 99AA BBCC
2. AS reads the content values from D20~D27 in DVP-ES2 CPU through the communication.
6-535
A S S er i es Pr og r am m ing M an u a l
The data in D20~D27 of DVP-ES2 are read when SM96 is ON and X0.0 is ON.
ASCII mode: (The ASCII codes do not need to be converted intentionally and they are all expressed in the 16#
values.)
6-536
C ha pt er 6 A p pl i e d In s tr uc t io ns
RTU mode:
After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
be confirmed and judged whether it is correct. If no error occurs in the format, SM100 is ON. Whereas, SM102 is
6_
6-537
A S S er i es Pr og r am m ing M an u a l
ASCII mode: (The ASCII codes do not need to be converted intentionally and they are all expressed in the 16#
values.)
RTU mode:
After the receiving of the data sent back from DVP-ES2 is completed, the data format sent back from DVP-ES2 will
be confirmed and judged whether it is correct. If no error occurs in the format, M0 is ON. Whereas, M1 is ON if the
data format sent back is incorrect. M2 is ON if there is no response. And meanwhile the corresponding special flags
Value (16#) 1234 5678 1122 3344 5566 7788 99AA BBCC
Additional remarks:
1. The data type is ARRAY [3] of BOOL if D operand is declared via ISPSoft.
2. If D+2 exeeds the device range, the instruction will not be executed, SM0 will be ON and the error code will be
16#2003 in SR0.
6-538
C ha pt er 6 A p pl i e d In s tr uc t io ns
6-539
A S S er i es Pr og r am m ing M an u a l
Communication protocol
SR209 SR212 SR177 SR179 For details, please refer to the following table to set up the communication
Suppose the setting value is larger than 0. When the communication instruction
is executed and the PLC is in the receiving state, but no data is received after the
SR210 SR213 SR182 SR183 timeout period or the intervening time of the two characters exceeds the setting
value, the timeout flag will be ON. The register can be set to 0 and the
00 : None
_6 10 : Even
*1: Users can set up the baud rate via the HWCONFIG of ISPSoft.
6-540
C ha pt er 6 A p pl i e d In s tr uc t io ns
Baud rate (bps) RTU timeout timer (ms) Baud rate (bps) RTU timeout timer (ms)
4800 9 115200 1
9600 5 230400 1
19200 3 - -
38400 2 - -
57600 1 - -
6_
6-541
AS Ser ies Pro gra mm in g M anu al
_6
6-542
Ch ap te r 6 Ap pl ie d Instruc ti ons
Symbol:
Explanation:
1. In the AS series PLC, there is a watchdog timer which is used to monitor the operation of the system.
2. 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 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.
STEP0 END
WDT
t1 t2
(b) Please refer to ISPSoft User Manual for more information about changing the setting value of the
watchdog timer.
6-543
AS Ser ies Pro gra mm in g M anu al
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
_6
6-544
Ch ap te r 6 Ap pl ie d Instruc ti ons
DWORD
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
S : Delay
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.
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.
6-545
AS Ser ies Pro gra mm in g M anu al
Input X0.0
T =2ms
Additional remark:
2. If S is larger than 1000, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
_6
6-546
Ch ap te r 6 Ap pl ie d Instruc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Pulse width
S2 : Pulse cycle
D : Output device
Explanation:
1. When the instruction GPWM is executed, every pulse with a width specified by S1 and with a cycle specified by S2 is
2. The pulse width specified by S1 is t. t should be within the range between 0 and 3276 milliseconds.
3. The pulse cycle specified by S2 is T. T should be within the range between 1 and 32767 milliseconds, and S1 should
4. S2+1 and S2+2 are parameters for system use. Please do not occupy them.
5. If S1 is less than 0, there is no pulse output. If S1 is larger than S2, the output device keeps ON.
8. 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-547
AS Ser ies Pro gra mm in g M anu al
t =1000ms
Y0.0
T= 2000ms
Additional remark:
1. 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.
_6
2. If the instruction is used in the function block or the interrupt task, the inaccurate pulse output will occur.
3. If users declare the operand S2 in ISPSoft, the data type will be ARRAY [3] of WORD/INT.
6-548
Ch ap te r 6 Ap pl ie d Instruc ti ons
DWORD
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
Explanation:
1. The values in E0~E9 are stored in the devices specified by the value in D. The allowed value for D is in the range of
0~99. Values exceed the range will not be executed.
2. The execution of the instruction involves sixteen devices, and the last six 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~E9 is
4. This instruction uses pulse instruction to interact with the stack, pushing a value onto the stack. Therefore, users
5. When 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, following the LIFO (last in first out) principle.
D+1 E0
D+2 E1
......
......
D + 10 E9
For system u se
D +16
D +17 E0
D + 18 E1
D + 19 E2
......
......
6-549
AS Ser ies Pro gra mm in g M anu al
Example:
When X0.0 is ON for the first time, the data in E0~E9 is transmitted to D1~D10 and the value in D0 becomes 1.
When X0.0 is switched from OFF to ON for the second time, the data in E0~E9 is transmitted to D17~D26, and the value
in D0 becomes 2.
When X0.0 is switched from OFF to ON for the nth time, the data in E0~E9 is transmitted to (n*16)+1~(n*16)+10.
Additional remark:
1. If the value in D is less than 0 or greater than 99, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
2. If the range of device is not sufficient for the D+((the value in D)+1)*16-1), the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
_6
6-550
Ch ap te r 6 Ap pl ie d Instruc ti ons
DWORD
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
D
Symbol:
Explanation:
1. The values in the devices specified by the value in D are read into E0~E9, and the value in D decreases by one. The
allowed value for D is in the range of 1~100. Values exceed the range will not be executed.
2. The execution of the instruction involves sixteen devices, and the last six 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~E9 is
3. This instruction uses pulse instruction to interact with the stack, taking the TOP VALUE from the stack and assigns it
to the specified variable. Therefore, users need to reset the contact upon the next operation.
4. The value which is stored last in the device specified by the value in D is read first, following the LIFO (last in first out)
principle.
D+1 E0
D+2 E1
......
......
D + 10 E9
F or syst em u se
D +16
D +17 E0
D + 18 E1
D + 19 E2
......
......
6-551
AS Ser ies Pro gra mm in g M anu al
Example:
When X0.0 is ON, the value in D0 is set to 0, and the values in E0~E9 are transmitted to D1~D10. After the execution of
FB0 is complete, the values in D1~D9 are read into E0~E9 via the instruction EPOP.
_6 Additional remark:
1. If the value in D is less than 0 or greater than 100, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
2. If the range of device is not sufficient for the D+((the value in D) *16-1), the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
6-552
Cha p ter 6 App l ied Ins truc tio ns
2100 BINDA DBINDA Converting the singed decimal number into the ASCII code
6-553
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
_6
Explanation:
1. The signed decimal binary number in S is converted into the ASCII code, and the conversion result is stored in D.
3. The value in S used in the 16-bit instruction should be a binary number and should be within the range between
-32768 and 32767. The operand D occupies four word devices. The data is converted as follows.
b15 b0 b15 b7
b8 b0
If SM690 is OFF, the ending character 16#0000 is stored in D+2. If SM690 is ON, the value in D+2 is unchanged
without the ending character.
6-554
Cha p ter 6 App l ied Ins truc tio ns
Besides, if the value in S is a positive value, only value will be inputted but not the sign character in D. If the value in
S is a negative value, the sign character in D “-” will be stored in 16#2D. For example, if the value in S is -12345 and
b15 b0 b15 b7
b8 b0
4. The value in S used in the 32-bit instruction should be a binary number and should be within the range between
-2147483648 and 2147483647. The operand D occupies six word devices. The data is converted as follows.
b31 b0 b15 b7
b8 b0
If SM690 is OFF, the ending character 16#0000 is stored in D+4. If SM690 is ON, the value in D+4 is unchanged
previous example shown. If the value in S is a negative value, the sign character in D “-” will be stored in 16#2D. For
example, if the value in S is -12345678, and SM690 is OFF, the conversion result is as follows.
b31 b0 b15 b7
b8 b0
6-555
AS Ser ies Pro gra mm in g M anu al
Example 1:
Suppose the value in L0 is 5126 and SM690 is OFF. When the PLC runs, the values are D0=16#3135, D1=16#3632,
D2=16#0000.
D10 b15 b7
b8 b0
16#36 16#32 D1
16#00 16#00 D2
Example 2:
Suppose the value in D10 is -3842563 and SM690 is OFF. When the PLC runs, the values are D0=16#332D,
_6
D10 b15 b7
b8 b0
16#34 16#38 D1
16#35 16#32 D2
16#33 16#36 D3
16#00 16#00 D4
6-556
Cha p ter 6 App l ied Ins truc tio ns
Additional remark:
1. If value in the device D is not sufficient for conversion, SM0 is ON, and the error code in SR0 is 16#2003.
2. 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.
3. 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_
6-557
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Device in which the conversion
D :
result is stored
Explanation:
_6 1. The hexadecimal binary number in S is converted into the ASCII code, and the conversion result is stored in D.
3. 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.
b15 b0 b15 b7
b8 b0
02A6 16#32 16#30 D+0
16#36 16#41 D+1
16#00 16#00 D+2
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
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.
b31 b0 b15 b7
b8 b0
03AC 6251 16#33 16#30 D+0
16#43 16#41 D+1
6-558
Cha p ter 6 App l ied Ins truc tio ns
Example 1:
Suppose the value in D10 is 16#9C06 and SM690 is OFF. When PLC runs, the values are D0=16#4339, D1=16#3630,
D2=16#0000.
D10 b15 b7
b8 b0
16#36 16#30 D1
16#00 16#00 D2 6_
Example 2:
Suppose the value in D10 is 16#7B3C581F and SM690 is OFF. When PLC runs, the values are D0=16#4237,
6-559
AS Ser ies Pro gra mm in g M anu al
D10 b15 b7
b8 b0
16#43 16#33 D1
16#38 16#35 D2
16#46 16#31 D3
16#00 16#00 D4
Additional remark:
1. 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.
2. 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.
3. 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.
4. 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
6-560
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Explanation:
1. The binary-coded decimal number in S is converted into the ASCII code, and the conversion result is stored in D. 6_
3. 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.
4. 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.
6-561
AS Ser ies Pro gra mm in g M anu al
b31 b0 b15 b7
b8 b0
0876 5432 16#38 16#30 D+0
16#36 16#37 D+1
16#34 16#35 D+2
16#32 16#33 D+3
16#00 16#00 D+4
5. If SM690 is OFF, the ending character 16#0000 is stored in D+5. If SM690 is ON, the value in D+5 is unchanged
6. Even if the first digit of binary-coded decimal value in S is 0, it will be converted into the ASCII code 0 (16#30).
Example 1:
Suppose the binary-coded decimal value in D10 is 1295 and SM690 is OFF. When PLC runs, the values are D0=16#3231,
D1=16#3539, D2=16#0000.
D10 b15 b7
b8 b0
1295 16#32 16#31 D0
16#35 16#39 D1
_6 16#00 16#00 D2
Example 2:
Suppose the binary-coded decimal value in D10 is 00578352 and SM690 is OFF. When PLC runs, the values are
D10 b15 b7
b8 b0
0057 8352 16#30 16#30 D0
16#37 16#35 D1
16#33 16#38 D2
16#32 16#35 D3
16#00 16#00 D4
6-562
Cha p ter 6 App l ied Ins truc tio ns
Additional remark:
1. 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.)
2. 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.)
3. 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.
4. 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.
5. If the operand D used during the execution of the 16-bit instruction is declared in ISPSoft, the data type will be
6. If the operand D used during the execution of the 32-bit instruction is declared in ISPSoft, the data type will be
6_
6-563
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Explanation:
_6 1. The signed decimal ASCII code in S is converted into the signed decimal binary number, and the conversion result
is stored in D.
2. 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 the value in S is a string and without the ending character 16#00,
the conversion can be up to 5 digits (sign excluded).
b15 b7 b15
b8 b0 b0
S+0 “2“ “1“ 1234 D
S+1 “4“ “3“
S+2 16#00 16#00
3. 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 “2345” for example.
b15 b7 b15
b8 b0 b0
S+0 “2“ “-“ -2345 D
S+1 “4“ “3“
S+2 16#00 “5“
6-564
Cha p ter 6 App l ied Ins truc tio ns
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 the value in S is a string and without the ending
character 16#00, the conversion can be up to 10 digits (sign excluded).
b15 b7 b31
b8 b0 b0
S+0 “2“ “1“ 1234567890 D
S+1 “4“ “3“
S+2 “6“ “5“
S+3 “8“ “7“
S+4 “0“ “9“
S+5 16#00 16#00
5. 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 “-234567890” for example.
b15 b7 b31
b8 b0 b0
6. If the first digit of the string in the device S is blank (16#20) + sign (16#2B), it will be seen as 0. For the second digit,
6_
if the number is not 0~9, it will be seen as the ending of a string and no error message will be shown. For example if
7. The string range in the device S for 16-bit instruction is 1~6 (positive/negative signs included) and for 32-bit
instruction is 1~11 (positive/negative signs included).
8. Only the 32-bit instructions can use the 32-bit counter, but not the device E.
Example 1:
Suppose the values are D20=16#302D, D21=16#3433, D22=16#0035. When PLC runs, the value is D0=-345.
b15 b7 b15
b8 b0 b0
D20 16#30 16#2D -345 D0
D21 16#34 16#33
D22 16#00 16#35
6-565
AS Ser ies Pro gra mm in g M anu al
Example 2:
Suppose the values are D20=16#322D, D21=16#3433, D22=16#3635, D23=16#2037, D24=16#0000, D25=16#0000.
b15 b7 b31
b8 b0 b0
_6 Example 3:
Suppose the string value in S is 12. When PLC runs, the value is D0=12.
Additional remark:
1. If the value of the first word in S is an ending character (16#00), the instruction will see the value in S as 0 (16#30).
2. If the value of the first digit in S is 16#20 (blank) or 16#2B (+) or 16#2D (-) and the second digit is 16#00, the
3. Even if the first digit of binary-coded decimal value in S is 0, it will be converted into the ASCII code 0 (16#30).
4. The value of the first digit in S only supports ASCII codes, 16#30~16#39 (0~9), 16#200 (blank), 16#2D (negative
6-566
Cha p ter 6 App l ied Ins truc tio ns
sign), 16#2B (positive sign), 16#00 (ending character). If the value of the first digit in S is not ASCII code, the
instruction will not be executed, SM0 is ON, and the error code in SR0 is 16#2003.
5. Except the first digit, if the value of other digits in S is not ASCII codes, 16#30~16#39 or 16#00, it will be seen as
16#00.
6. If the value in S exceeds the device range, SM0 is ON, and the error code in SR0 is 16#2003. The instruction will
not be executed.
7. 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.
8. 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_
6-567
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Explanation:
_6 1. The hexadecimal ASCII code in S is converted into the hexadecimal binary number, and the conversion result is
stored in D.
2. The operand S used in the 16-bit instruction occupies two word devices. If the value in S is a string and without the
ending character 16#00, the conversion can be up to 4 digits (sign excluded). 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 b7 b15
b8 b0 b0
3. The operand S used in the 32-bit instruction occupies four word devices. If the value in S is a string and without the
ending character 16#00, the conversion can be up to 8 digits (sign excluded). 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”.
6-568
Cha p ter 6 App l ied Ins truc tio ns
b15 b7 b31
b8 b0 b0
4. The string range in the device S for 16-bit instruction is 1~4 and for 32-bit instruction is 1~8.
Example 1:
Suppose the values are D20=16#3641, D21=16#4633 (ASCII 16#A63F). When PLC runs, the value is D0=-22977.
b15 b7 b15
b8 b0 b0
6_
D20 16#36 16#41 16#A63F D0
Example 2:
Suppose the values are D20=16#4634, D21=16#3244, D22=16#3738, D23=16#3035 (ASCII 16#4FD28750). When PLC
6-569
AS Ser ies Pro gra mm in g M anu al
b15 b7 b31
b8 b0 b0
Example 3:
Suppose the string value in S is A. When PLC runs, the value is D20=16#A=10.
Example 4:
_6 Suppose the values are D20=16#3641, D21=16#4600 (ASCII 16#00A6). When PLC runs, the value is D0=166.
b15 b7 b15
b8 b0 b0
Additional remark:
1. If the ASCII code in S is not within the range between 16#30~16#39 (“0”~”9”), or within the range between
16#41~16#46 (“A”~”F”), the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
6-570
Cha p ter 6 App l ied Ins truc tio ns
2. 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.
3. 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_
6-571
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Explanation:
_6 1. The ASCII code in S is converted into the binary-coded decimal number, and the conversion result is stored in D.
2. 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”.
b8 b0 b3~b0
3. 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-572
Cha p ter 6 App l ied Ins truc tio ns
b8 b0 b3~b0
4. If the value in S is 16#20 the value is processed as 16#30. If the value in S is 16#00, the value is processed as an
ending character..
5. 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 are D20=16#3820, D21=16#3637 (ASCII 876). When PLC runs, the value will be converted into
Y0=16#876.
6_
b8 b0 b3~b0
6-573
AS Ser ies Pro gra mm in g M anu al
Example 2:
Suppose the values are D20=16#3738, D21=16#3536, D22=16#3334, D23=16#3132 (ASCII 87654321). When PLC runs,
b15 b7 b31
b8 b0 b0
Example 3:
_6
Suppose the string value in S is 1. When PLC runs, the value is D20=16#0001.
Example 4:
Suppose the string value in S is 1234. When PLC runs, the value is (D21, D20)= 16#00001234.
6-574
Cha p ter 6 App l ied Ins truc tio ns
Additional remark:
1. If the ASCII code in S is not ASCII codes 16#30~16#39, 16#20, 16#00, the instruction is not executed, SM0 is ON,
and the error code in SR0 is 16#2003.
2. 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.
3. 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.
4. 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_
6-575
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : String
Explanation:
1. 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.
_6 2. The value stored in D should be within the range between 0~32767. If exceeding the range, the value in D will be
seen as 32767.
b15 b8 b 7 b0
S Sec ond char acter Fi rs t c haracter
S+1 F ourth c harac ter Thir d char acter b15 b0
S+2 Six th c harac ter Fifth charac ter n D
b15 b8 b7 b0
S 16#42( B) 16#41( A)
S+1 16#44( D) 16#43( C) ABCDEF GHI b15 b0
S+2 16#46( F) 16#45( E) 9 D
S+3 16#48( H) 16#47( G)
S+4 16#00 16#49( I)
( En di ng cha ra cter )
6-576
Cha p ter 6 App l ied Ins truc tio ns
Example 1:
Suppose S is the string “DELTA”. When the PLC runs, the value in D0 is 5.
Example 2:
Suppose the data in D0~D2 is as follows. When the PLC runs, the value in L0 is 5.
6_
Additional remark:
1. If the string does not end with 16#00, the instruction will execute to the maximum value 32767.
2. If the length of the value exceeds the device range, the last character will be seen as the ending character.
6-577
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : Source value
Explanation:
_6 1. 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.
2. The floating-point number in S1 is converted into the string and added with the ending character 16#00 and then
store the conversion result in D.
Floating-point number …… ……
Floating-point string
4. The value in S2+1 should be within the range of 2≦S2+1≦20; the signs (+,-), digits in the integer and decimal
6-578
Cha p ter 6 App l ied Ins truc tio ns
number can be included but the point in the decimal number and the exponent number are not included. .
Operand Description
0: Decimal format
S2
1: Exponential
5. If the value in S1 is a positive number, the first ASCII code can be inputted in D; if the value in S1 is a negative
number, the sign 16#2D (-) will be inputted first and then the second ASCII can be inputted.
The value in S2+1 should be within the range of 2≦S2+1≦20; the signs (+,-), digits in the integer and decimal
number can be included but the point in the decimal number and the exponent number are not included..
Example 1:
Suppose the number of characters is 8. When the floating-point numbers are -1.2345678 and 123456. The
calculation is as follows.
16#00
D+3 16#36 (6) 16#35 (5)
ending character
16#00
D+4 16#38 (8)
ending character
After the conversion, if the floating-point number can be shown in S2+1 but the length exceed the value in
S2+1, the digits in decimal will be rounded off. If the floating-point string cannot fulfill all the number of
characters, it is not required to fulfill.
6-579
AS Ser ies Pro gra mm in g M anu al
Example 2:
After the conversion, if the floating-point number can be shown in S2+1, the instruction will use the exponential
format to convert. For example the number of characters is 5 digits and the floating-point number is 1234567,
Floating-point number
D number
1234567
16#0000
D+5
ending character
Example 3:
After the conversion, if the floating-point number can be shown in S2+1, the instruction will use the exponential
format to convert. For example the number of characters is 2 digits and the floating-point number is
_6 0.00012345, the conversion result is1.2E-04.
Floating-point number
D number
0.00012345
16#00
D+3 16#34 (4)
ending character
Example 4:
After the conversion, if the absolute value of the floating-point number is <=10-5, the instruction will use the
exponential format to convert. For example the number of characters is 4 digits and the floating-point number
6-580
Cha p ter 6 App l ied Ins truc tio ns
Floating-point number
D number
0.00001234
16#00
D+4 16#35 (5)
ending character
in th e device D.
The value in S2+1 should be within the range of 2≦S2+1≦20; the signs (+,-), digits in the integer and decimal
number can be included but the point in the decimal number and the exponent number are not included. After
calculation, the length will add the exponents (4 digits) and the point of the decimal number in.
negative number, 16#2D (-) will be added in the area for exponent in D. The number of character in the area
for the exponent is 2 digits. If there is only 1 digit in the conversion result, the first digit of the area for the
Example:
Suppose the number of characters is 8. When the floating-point numbers are -123.456789 and 123456. The
calculation is as follows.
6-581
AS Ser ies Pro gra mm in g M anu al
16#00
D+5 16#30 (0) 16#2B (+)
ending character
16#00
D+6 16#32 (2)
ending character
After the conversion, if the floating-point number can be shown in S2+1, the exceeding digits will be rounded
off.
The conversion result of the string length for the floating number -123.456789 in a number of 8 characters is
The conversion result of the string length for the floating number 12345 in a number of 8 characters is 10 (the
If the floating-point string cannot fulfill all the number of characters, it is not required to fulfill.
Example 1:
The floating-point number in (D1, D0= 12.3456) is converted into the decimal format of the string (D4=0, D5=8).
_6
16#00
D13 16#36(6)
ending character
6-582
Cha p ter 6 App l ied Ins truc tio ns
Example 2:
The floating-point number in (D1, D0 = 0.0012345678) is converted into the exponential format of the string (D4=1, D5=8).
16#00
D16 16#33 (3)
ending character
Additional remark:
1. If the value in S1 exceeds the range of values which can be represented by the floating-point numbers, the 6_
instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013.
2. 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.
3. If the value in S2+1 exceeds the range 2≦S2+1≦20, the instruction is not executed, SM0 is ON, and the error code
in SR0 is 16#2003.
4. If users declare the operand S2 in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
6-583
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
Symbol:
S : Source value
Explanation:
1. The string in S is converted into the floating-point number, and the conversion result is stored in D.
…… …… Floating-point number
16#00
S +n
ending character
Floating-point string
For the decimal or exponential formats, the maximum length for the floating-point string (m) is 24 words
(16#00 the ending character excluded) and as for n, the maximum length is 13 words.
2. The format of the value in S can be decimal or exponential. The PLC will determine the format according to the value
in S automatically.
Decimal format: the length for the floating-point string is 9; the ending character 16#00 is not included.
6-584
Cha p ter 6 App l ied Ins truc tio ns
16#00
S+4 16#37 (7)
ending character
OR
16#00
S+4 16#38 (8)
ending character
Exponential format: the length for the floating-point string is 9; the ending character 16#00 is not included.
16#00
S+4 16#32 (3)
ending character
3. If the sign code in S is 16#20, 16#30, or 16#2B the conversion result is a positive value. If the sign code in S1 is
16#2D, the conversion result is a negative value.
Example 1:
6-585
AS Ser ies Pro gra mm in g M anu al
16#00
D4 16#37 (7)
ending character
Example 2:
16#00
D4 16#32 (3)
ending character
Additional remark:
1. If the length of the string in S exceeds 25 bytes and does not end with 16#00, SM0 is ON, and the error code in SR0
is 16#2003.
2. There are some rules for the value in S. if the value in S is not followed by the rules, the instruction will not be
The first ASCII code: signs16#2B(+), 16#2D(-), blank16#20, and numbers 16#30(0)~16#39(9) are allowed.
If the first ASCII code is a sign or a blank, the second ASCII code should be a number.
6-586
Cha p ter 6 App l ied Ins truc tio ns
Decimal format:
Integ er OR In tege r
r D ecimal
The point“,”(16#2E), can only be inputted once and there should be numbers before and after the
point.
Exponential format:
point.
Fi rst Second 6_
E OR e +OR- n umber
nu mb er
There should be an “E” (16#45) or ”e” (16#65) and can only be used once.
There should be a sign “+”(16#2B) or “-” (16#2D) and can only be used once.
3. If the string in S is out of range, the instruction is not executed, SM is ON, and the error code in SR0 is
If the first character in the string is a number ”0”~”9” (16#30~16#39), the range for a floating-point string is
If the first character in the string is a blank (16#20) or a sign (“+”(16#2B) or “-” (16#2D)), the range for a
floating-point string is 2~24. The minimum length for the string is “+1”.
4. 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-587
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : String
Number of characters which
n :
are retrieved
Device in which the characters
D:
retrieved are stored
Explanation:
_6 1. 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. When S is a string device, the maximum length for the value in S is 31 words; when the S
is not a string device, the maximum length for the value in S is 255 words.
b15 b8 b7 b0
S Second A SCII code F irst ASCII code
S +1 F our th ASCII code T hi rd AS CII c ode
.. ... ... ... ... ... ... .
Second ASC II code from the last T hi rd AS CII c ode from the l as t
16#00 F irst ASC II code from the last
n-1 A SCII c ode from the last n ASCII code fr om the las t
th th
D
n-3 A SCII c ode from the last
th
n-2 A SCII c ode from the last
th
D +1
.....................
Second ASC II code from the last T hi rd AS CII c ode from the l as t
16#00 F irst ASC II code from the last
6-588
Cha p ter 6 App l ied Ins truc tio ns
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 b8 b7 b0 b15 b8 b7 b0
S 16#42(B) 16#41(A) 16# 32(2) 16#31(1) D
S +1 16# 44(D) 16# 43(C) 16# 34(4) 16# 33(3) D +1
ABCDE F12345 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) T he fifth charac ter from the last
S +5 16# 00 16# 35(5)
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) 16# 00 D12
D3 16#48( H) 16#47( G) T he fourth char ac ter from the last
D4 16# 00
Additional remark: 6_
1. If the operand S is not a string ($) but a device with a string, the string in S can read up to 256 words (16#00 ending
character included). If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
2. If n is less than 0, it will be seen as 0. If n is greater than the length of the string in S, it will be seen as the length of
the string is S.
3. 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-589
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
n
D
Symbol:
S : String
Number of characters which
n :
are retrieved
Device in which the characters
D:
retrieved are stored
Explanation:
_6 1. 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. When S is a string device, the maximum length for the value in S is 31 words; when the S is not a
string device, the maximum length for the value in S is 255 words.
2. If n is 0, the value in D is 0.
b15 b8 b7 b0 b15 b8 b7 b0
S Second ASCII code F irst ASCII code Second ASCII code F irst ASCII code D
S +1 F our th ASCII code T hi rd A SCII c ode F our th ASCII code T hi rd A SCII c ode D +1
.....................
...........
~
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.
6-590
Cha p ter 6 App l ied Ins truc tio ns
b15 b8 b7 b0 b15 b8 b7 b0
S 16#42(B) 16#41( A) 16# 42(B) 16#41( A) D
S +1 16# 44(D) 16# 43(C) 16# 44(D) 16# 43(C) D +1
ABCDEF 12345 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) Seventh c haracter
S +5 16# 00 16# 35(5)
Example:
When M0 is ON, the instruction $LEFT is executed. The six characters starting from the character in D100 are retrieved,
b15 b8 b7 b0 b15 b8 b7 b0
D0 6 D100 16#42(B) 16#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
Six th charac ter D103 16# 48(H) 16#47( G) 16# 00 D13
D104 16# 00
Additional remark: 6_
1. If the operand S is not a string ($) but a device with a string, the string in S can read up to 256 words (16#00 ending
character included). If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
2. If n is less than 0, it will be seen as 0. If n is greater than the length of the string in S, it will be seen as the length of
the string is S.
3. 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-591
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
S1 : String
Part of the string which is
S2 :
retrieved
Device in which the characters
D :
retrieved are stored
Explanation:
_6 1.
th
Suppose the values in S2 and S2+1 are n and m respectively. The m characters starting from the n character in the
string in S1 are retrieved, and stored in D.
b15 b8 b7 b0 b15 b8 b7 b0
.. .. .. .. ...
~
n+ 1
th
AS CII co de f rom th e las t n t h A SCII c ode from t he las t n+ m-2 t h AS CII co de f rom th e las t n+ m-3 t h AS CII co de f rom t he las t
n+ 2 AS CII co de f rom th e las t n+ m-1 AS CII co de f rom th e las t
th th
n+ 3 t h AS CII co de f rom th e las t 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.
6-592
Cha p ter 6 App l ied Ins truc tio ns
b15 b8 b7 b0 b15 b8 b7 b0
S1 16#42(B) 16#41(A) 16# 44(D) 16# 43(C) D
S1 +1 16# 44(D) 16# 43(C) 16# 46(F ) 16#45(E) D+1
S2
S1 +2 16# 46(F ) 16# 45(E) 16# 48(H) 16# 47(G) D+2
Thi rd cha ra cter D+3
S1+3 16# 48(H) 16# 47(G) 16# 00 16# 49(I)
S1 +4 16# 4A(J ) 16# 49(I)
16# 00 16# 4B(K) Se ven th ch ar acte r
S1+5
4. 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
5. 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.
b15 b8 b7 b0 b15 b8 b7 b0
S1 16#42(B) 16#41( A) 16# 46(F ) 16#45( E) D
S1 +1 16# 44(D) 16# 43(C) 16# 48(H) 16# 47(G) D +1
S1 +2 16# 46(F ) 16# 45(E) 16# 4A(J ) 16# 49(I) D +2
S1+3 16# 48(H) 16# 47(G) Fifth c harac ter 16# 00 16# 4B(K)
S1 +4 16# 4A(J ) 16# 49(I)
S1+5 16# 00 16# 4B(K)
Example:
6_
b15 b8 b7 b0 b15 b8 b7 b0
D10 16#32(2) 16#31( 1) 16# 34(4) 16#33( 3) D0
D11 16# 34(4) 16# 33(3) 16# 36(6) 16# 35(5) D1
D12 16#36( 6) 16# 35(5) 16# 00 D2
D13 16# 00 16# 37(7)
D20 3
D21 4
Additional remark:
1. If the operand S1 is not a string ($) but a device with a string, the string in S1 can read up to 256 words (16#00
ending character included). If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is
16#200E.
2. If the value of S2 is S2<=0 or S2+1<-1, SM0 is ON, and the error code in SR0 is 16#2003.
6-593
AS Ser ies Pro gra mm in g M anu al
3. If the value in S2 or S2 + S2+1 is larger than the length of the string in S1, SM0 is ON, and the error code in SR0 is
16#2003.
4. 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.
5. If D is not sufficient to contain S2+1 characters, the instruction is not executed, SM0 is ON, and the error code in
SR0 is 16#2003.
6. 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
6-594
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
n
D
Symbol:
1. The instruction is used to search the string from the nth character in S2 for the string which is the same as the string
3. Suppose the string in S2 is “ABCDEFGHIJK”, the string in S1 is “EFGH”, and n is 3. The search begins from the third
Ig n o r e d
6-595
AS Ser ies Pro gra mm in g M anu al
Example:
b15 b8 b7 b0
16#32(2) 16#31( 1) D0
AB 16# 44(D) 16# 43(C) D1
Searc hing the str ing from the thi rd c har acter
16# 42(B) 16#41( A) D2
Matching c har acter
16# 48(H) 16# 47(G) D3
Ignored 16# 00
5 D100
Additional remark:
1. If the operand S1 is not a string ($) but a device with a string, the string in S1 can read up to 256 words (16#00
_6 ending character included). If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is
16#200E.
2. If the operand S1 is not a string ($) but a device with a string, the string in S2 can read up to 256 words (16#00
ending character included). If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is
16#200E.
3. If n is less than or equal to 0, SM0 is ON, and the error code in SR0 is 16#2003.
6-596
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
S4
D
Symbol:
S2 : New string
S3 :
Number of characters in S1 which are 6_
replaced
The characters in S1 starting from the
S4 : character indicated by the value in S4 are
replaced.
Device in which the execution result is
D :
stored
Explanation:
1. 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.
2. The four characters starting from the sixth character in the string “1234567890” are replaced by “MN”, and the result
is “12345MN0”.
6-597
AS Ser ies Pro gra mm in g M anu al
b15 b8 b7 b0 b15 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# 4D(M) 16# 35(5) D+2
S1+3 16# 38(8) 16# 37(7) After the instruction 16# 30(0) 16# 4E(N) D+3
S1+4 16# 30(0) 16# 39(9) is executed 16# 0000 D+4
S1+5 Ignored 16# 00
3. If the string in S2 is 16#00, the instruction has the function of deleting the characters.
4. 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.
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
_6 stored in D20~D27.
6-598
Cha p ter 6 App l ied Ins truc tio ns
If the values in D50 and D51 are 3 and 4 respectively, the execution result is as follows.
A f te r t he in s t ruc t io n
is ex ec u t ed.
Ig n o r e d
I g n or ed
N u m b e r o f c h ar ac t er s w h ic h a r e r e p la c e d
C h a r a c t e r w h ic h i s r e p la c e d
If the values in D50 and D51 are 4 and 4 respectively, the execution result is as follows.
b15 b8 b7 b0 b15 b8 b7 b0
D0 16#32(2) 16#31( 1) 16# 32(2) 16#31( 1) D20
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
After the instruction
D4 16# 32(2) 16# 31(1) 16#32 (2) 16#31 (1) D24
is executed
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
Ignored 16#00 16# 0000
6_
D7 D27
6-599
AS Ser ies Pro gra mm in g M anu al
If the values in D50 and D51 are 20 and 4 respectively, the execution result is as follows.
b15 b8 b7 b0 b15 b8 b7 b0
D0 16#32(2) 16#31(1) 16# 32(2) 16#31(1) D20
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) After the instruction 16# 00 16# 46(F ) D23
D4 16# 32(2) 16# 31(1) is executed
D5 16# 34(4) 16# 33(3)
D6 16# 42(B) 16# 41(A)
D7 Ignored 16# 00
If the values in D50, D51, and D10 are 3, 4, and 16#00 respectively, the execution result is as follows. The three
b15 b8 b7 b0 b15 b8 b7 b0
D0 16#32(2) 16#31(1) 16# 32(2) 16#31(1) D20
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) D22
D3 16# 42(B) 16# 41(A) After the instruction 16# 33(3) 16# 32(2) D23
D4 16# 32(2) 16# 31(1) is executed 16# 41(A) 16# 34(4) D24
D5 16# 34(4) 16# 33(3) 16# 00 16#42(B) D25
D6 16# 42(B) 16# 41(A)
D7 16# 00
_6 D10 16# 00
Additional remark:
1. If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
2. If the string in S2 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
3. If the value in S3 <0 or S4<=0 or the value in S4 is larger than the length of the string in S1, SM0 is ON, and the error
code in SR0 is 16#2003.
4. If the replaced value in the string (16#00 the ending character included) in S1 is larger than 256, the instruction will
not be executed, SM0 is ON, and the error code in SR0 is 16#2003.
6-600
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
S1 : String
Number of characters which are
S2 :
deleted
The characters in S1 starting from the
S3 : character indicated by the value in S3
are deleted.
D :
Device in which the execution result is 6_
stored
Explanation:
1. 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.
2. 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 b8 b7 b0 b15 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# 38(8) 16# 37(7) D +1
S1 +2 16# 36(6) 16# 35(5) 16# 30(0) 16# 39(9) D +2
S1+3 16# 38(8) 16# 37(7) After the instruction 16# 0000 D +2
S1 +4 16# 30(0) 16# 39(9) is executed
S1 +5 Ignored 16# 00
S2 4
S3 3
6-601
AS Ser ies Pro gra mm in g M anu al
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.
b15 b8 b7 b0
S1 16#32(2) 16#31(1)
S1 +1 16# 34(4) 16# 33(3) b15 b8 b7 b0
16# 32(2) 16#31(1) D
S1 +2 16# 36(6) 16# 35(5)
D +1
S1+3 16# 38(8) 16# 37(7) After the instruction 16# 0000
S1 +4
is executed
16# 30(0) 16# 39(9)
S1 +5 Ignored 16# 00
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
_6
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) b15 b8 b7 b0
D1 16# 34(4) 16# 33(3) 16# 32(2) 16#31( 1) D20
D2 16# 36(6) 16# 35(5) 16# 37(7) 16# 33(3) D21
D3 16# 00 16# 37(7) 16# 00 D22
After the instruction
is executed
D10 3
D11 4
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
6-602
Cha p ter 6 App l ied Ins truc tio ns
b15 b8 b7 b0
D0 16#32(2) 16#31( 1)
b15 b8 b7 b0
D1 16# 34(4) 16# 33(3)
16# 32(2) 16#31( 1) D20
D2 16# 36(6) 16# 35(5) D21
After the instruction 16# 00 16# 33(3)
D3 16# 00 16# 37(7)
is executed
D11 4
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)
b15 b8 b7 b0
D1 16# 34(4) 16# 33(3)
16# 37(7) 16#36(6) D20
D2 16# 36(6) 16# 35(5) D21
16# 00
D3 16# 00 16# 37(7) After the instruction
is executed
D10 5
D11 1
Additional remark:
1. If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
2. 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_
6-603
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
Explanation:
1. The string in S is cleared. If the string in S does not end with 16#00, up to 255 characters will be cleared.
b15 b8 b7 b0
S 16#31(1) 16# 2D(-) 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
Example:
b15 b8 b7 b0
D0 16#32(2) 16#31(1) 16# 0000 D0
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) After the instruction 16# 0000 D3
is executed
6-604
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
D
Symbol:
S1 : String
1. 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.
2. 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.
b15 b8 b7 b0 b15 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
After the instruction
S1 +4 16# 30(0) 16# 39(9) 16# 38(8) 16# 37(7) D +4
is executed
S1 +5 16# 00 16# 30(0) 16# 39(9) D +5
16# 00 D +6
S2 16# 4E(N) 16# 4D( M)
S2 +1 16# 00
S3 6
6-605
AS Ser ies Pro gra mm in g M anu al
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.
b15 b8 b7 b0 b15 b8 b7 b0
D0 16#32(2) 16#31( 1) 16# 41(A) 16#31( 1) D20
D1 16# 34(4) 16# 33(3) 16# 32(2) 16# 42(B) D21
D2 16# 36(6) 16# 35(5) 16# 34(4) 16# 33(3) D22
_6 D3 16# 00 16# 37(7) After the instruction 16# 36(6) 16# 35(5) D23
is executed 16# 00 16# 37(7) D24
D10 16# 42(B) 16# 41(A)
D11 Ignored 16# 00
D30 1
b15 b8 b7 b0 b15 b8 b7 b0
D0 16#32(2) 16#31(1) 16#42(B) 16 #41(A) D20
D1 16#34(4) 16#33(3) 16#32(2 ) 16 #31(1) D21
D2 16#36(6) 16#35(5) Af ter 16#34(4) 16 #33(3) D22
execution 16# 36(6)
D3 16#00 16#37(7) 16 #35(5) D23
16#00 16 #37(7) D24
D10 16#42(B) 16#41(A)
D11 I gnored 16#00
D30 0
6-606
Cha p ter 6 App l ied Ins truc tio ns
Additional remark:
1. If the string in S1 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
2. If the string in S2 does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
3. 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.
4. If the inserted value in the string (16#00 the ending character included) in S1 is larger than 256, the instruction will
not be executed, SM0 is ON, and the error code in SR0 is 16#2003.
6_
6-607
AS Seri es Progr amm i ng Manual
Converting the IP address of the string type into the IP address of the
2207 IATON –
integer type
_6
6-608
Chapt er 6 Ap pl i ed I nst ruct i on s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
Data
LINT
TMR
CNT
INT
type
S1
S2
S3
S2 : Socket number
S3 : Start mode
6_6
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. The AS series PLC as the client sends the TCP connection request to the server if S3 is 1, and the AS
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.
2. The operand S1 should be either 0 or 1; the operand S2 should be within the range between 1 and 4; the operand S3
should be either 0 or 1.
3. Before using the instruction, users have to accomplish the following setting in HWCONFIG of ISPSoft.
4. Refer to API2209 SCONF instruction for the modification of the TCP and UDP Socket parameters
6-609
AS Seri es Progr amm i ng Manual
5. When the TCP Socket is opened, the settings of the Socket IP and communication ports are shown as below.
Local Remote
Start
Remote IP communication communication Description
Mode
port port
Specific IP Illegal
1 0 0
address
Master mode,
Specific IP
1 0 Not equal to 0 Specifies the IP address; but not specify the
address
local communication port.
Specific IP
1 Not equal to 0 0 Illegal
address
Master mode,
Slave mode,
Specific IP
0 Not equal to 0 0 Specifies the IP address; but not specify the
address
remote communication port.
Slave mode,
Specific IP
0 Not equal to 0 Not equal to 0 Specifies the IP address and remote
address
communication port.
No limit to the
0 0.0.0.0 0 Illegal
value
Slave mode,
Slave mode,
0 0.0.0.0 Not equal to 0 Not equal to 0 Not specify the IP address, but specifies the
remote communication port.
6-610
Chapt er 6 Ap pl i ed I nst ruct i on s
6. If the data are transmitted through the TCP socket, and no error occurs after the instruction is executed, the socket
starts to establish the connection with the remote device and the flag of being starting the connection is ON. If the
connection is made successfully, the flag of successful connection is ON, and the flag of being starting the
connection is OFF. If an error occurs, the error flag is ON.
Being Being
Successfu
Having Having starting closing Being
TCP Socket l
received sent the the the sending Error flag
Number connectio
the data data connectio connectio the data
n
n n
7. If the data are transmitted through the UDP socket, and no error occurs after the instruction is executed, the flag of
having started the connection is ON. If an error occurs, the error flag is ON.
UDP Socket Having started Having received Having sent the Being closing
Error flag
Number the connection the data data the connection
Example 1:
1. The system framework below illustrates how to establish the TCP connection between a computer as Server and an
AS series PLC as Client.
6 - 6 11
AS Seri es Progr amm i ng Manual
Ethernet configuration
IP Addressing Mode Static
IP Address 192.168.1.111
Netmask address 255.255.255.0
Gateway address 192.168.1.1
3. a)ISPSoft -> HWCONFIG(Ethernet – Advance > Socket > TCP Socket Connection)
b)SCONF instruction
4. The parameters related to TCP Socket1 are set first in HWCONFIG of the ISPSoft configuration software or in the
SCONF instruction.
5. 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 to OFF.
6-612
Chapt er 6 Ap pl i ed I nst ruct i on s
6. When M1 is ON, whether the socket has been connected and no data are being sent is checked. If the socket has
been connected, and no data are being sent, the data will be sent. If the socket has not been connected, the
instruction will not be executed. After the sending of the data is completed, M1 will be switched to OFF.
7. When M2 is ON, whether the socket has been connected and the flag of having received the data is ON is checked.
If the socket has been connected and the flag of having received the data is ON, it means that the data have already
been received.
8. 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 will not be executed. After the
connection is closed, M2 and M3 will be switched to OFF.
6_6
6-613
AS Seri es Progr amm i ng Manual
_6
6-614
Chapt er 6 Ap pl i ed I nst ruct i on s
6_6
Example 2:
1. The example illustrates how to establish the UDP connection between a computer and an AS series PLC.
2. 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 to OFF.
3. When M1 is ON, the data are sent. After the sending of the data is completed, M1 will be switched to OFF.
6-615
AS Seri es Progr amm i ng Manual
4. When M2 is ON, whether the socket has been connected and the flag of having received the data is ON is checked.
If the socket has been connected and the flag of having received the data is ON, it means that the data have been
received.
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 will not be executed. After the
connection is closed, M2 and M3 will be switched to OFF.
_6
6-616
Chapt er 6 Ap pl i ed I nst ruct i on s
Additional remark:
16#6201 Error flag of TCP Socket Illegal TCP Socket communication mode setting
16#6202 Error flag of TCP Socket Illegal TCP Socket mode setting
16#6203 Error flag of TCP Socket Illegal address for sending data
16#6204 Error flag of TCP Socket The length of sent data exceeds the range
16#6205 Error flag of TCP Socket The device where data are sent exceeds the range
16#6206 Error flag of TCP Socket Illegal address for receiving data
16#6207 Error flag of TCP Socket The length of received data exceeds the range
16#6208 Error flag of TCP Socket The device for receiving data exceeds the range
16#6213 Error flag of TCP Socket The size of data actually received is larger than the set data. 6_6
16#6214 Error flag of TCP Socket TCP Socket connection is rejected by the remote equipment
16#6215 Error flag of TCP Socket TCP Socket has not been connected
16#6217 Error flag of TCP Socket TCP Socket connection has been triggered.
16#6218 Error flag of TCP Socket The sending of data through TCP Socket has been triggered.
16#621A Error flag of TCP Socket Disabling the TCP Socket connection has been triggered.
16#620C Error flag of UDP Socket Illegal address for sending data
6-617
AS Seri es Progr amm i ng Manual
16#620D Error flag of UDP Socket The length of sent data exceeds the range
16#620E Error flag of UDP Socket The device where data are sent exceeds the range
16#620F Error flag of UDP Socket Illegal address for receiving data
16#6210 Error flag of UDP Socket The length of data actually received exceeds the range.
16#6211 Error flag of UDP Socket The device where data are received exceeds the range.
16#6213 Error flag of UDP Socket The size of data actually received is larger than the set data.
16#6217 Error flag of UDP Socket UDP Socket connection has been triggered.
16#6218 Error flag of UDP Socket The sending of UDP Socket data has been triggered.
16#621A Error flag of UDP Socket Disabling the UDP Socket connection has been triggered.
3. When the client and server are both AS series PLC and the timeout time settings are same, the server will cut the
connection automatically if the timeout occurs in the server first. Thus the error flag in the client will not be ON.
Whereas, if the timeout occurs in the client first, the error flag in the client will be ON and the connection will be cut.
_6
6-618
Chapt er 6 Ap pl i ed I nst ruct i on s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
Data
LINT
TMR
CNT
INT
type
S1
S2
S1 : Socket mode
S2 : Socket number
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.
6_6
2. The operand S1 should be either 0 or 1, and the operand S2 should be within the range between 1 and 4.
3. Before using this instruction, users need to use the instruction SOPEN to open the socket. If the flag of successful
connection (of TCP socket) is ON, or the flag of having started the connection (of UDP socket) is ON, this instruction
can be used.
4. If the data are sent through the TCP socket, and no error occurs after the instruction is executed, the data are sent,
and the flag of being sending the data is ON. If the data are sent successfully, the flag of having sent the data is ON,
and the flag of being sending the data is OFF. If an error occurs, the error flag is ON.
TCP Socket number Being sending the data Having sent the data Error flag
6-619
AS Seri es Progr amm i ng Manual
5. If the data are sent through the UDP socket, and no error occurs after the instruction is executed, the flag of having
sent the data is ON. If an error occurs, the error flag is ON.
1 SM1336 SM1338
2 SM1341 SM1343
3 SM1346 SM1348
4 SM1351 SM1353
Example:
Additional remark:
16#6202 Error flag of TCP Socket Illegal TCP Socket mode setting
_6
16#6203 Error flag of TCP Socket Illegal address for sending data
16#6204 Error flag of TCP Socket The length of sent data exceeds the range.
16#6205 Error flag of TCP Socket The device where data are sent exceeds the range.
Error flag of TCP Socket TCP Socket TCP Socket connection is rejected by the remote
16#6214
equipment.
16#6215 Error flag of TCP Socket TCP Socket has not been connected.
16#6218 Error flag of TCP Socket The sending of data has been triggered.
16#620A Error flag of UDP Socket Illegal UDP Socket communication mode setting
6-620
Chapt er 6 Ap pl i ed I nst ruct i on s
16#620C Error flag of UDP Socket Illegal address for sending data
16#620D Error flag of UDP Socket The length of sent data exceeds the range
16#620E Error flag of UDP Socket The device for sending data exceeds the range
16#6218 Error flag of UDP Socket The sending of data has been triggered.
6_6
6-621
AS Seri es Progr amm i ng Manual
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
Data
LINT
TMR
CNT
INT
type
S1
S2
S1 : Socket mode
S2 : Socket number
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.
_6 2. The operand S1 should be either 0 or 1, and the operand S2 should be within the range between 1 and 4.
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 client, the server continues to be connected to the local communication port (the
flag of successful connection is ON). If the TCP socket is closed is by the server, the server will not be connected to
the local communication port after the execution of the instruction is completed. After the TCP socket is closed, the
corresponding flags will be 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 connection with the remote
device starts being closed and the flag of being closing the connection is ON. If the connection is closed successfully,
the flag of being closing the connection is OFF. If an error occurs, the error flag is ON.
1 SM1274 SM1277
2 SM1282 SM1285
3 SM1290 SM1293
4 SM1298 SM1301
6-622
Chapt er 6 Ap pl i ed I nst ruct i on s
7. If the UDP socket is closed, and no error occurs after the instruction is executed, the flag of having started the
connection is OFF. If an error occurs, the error flag is ON.
1 SM1338
2 SM1343
3 SM1348
4 SM1353
Example:
Additional remark:
16#6214 Error flag of TCP Socket TCP Socket connection is rejected by the remote device
6_6
16#621A Error flag of TCP Socket Disabling TCP Socket connection has been triggered.
16#621A Error flag of UDP Socket Disabling UDP Socket connection has been triggered.
6-623
AS Seri es Progr amm i ng Manual
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
D
S3 : Email body
Completion of the
D :
_6 instruction
Explanation:
2. Before using the instruction, users have to accomplish the following setting in ISPSoft.
PLC Parameter Setting→Ethernet-Advance→Email→Setting the SMTP server, the port, the local email
address, and the SMTP subject
6-624
Chapt er 6 Ap pl i ed I nst ruct i on s
Bit0~bit3 set in ISPSoft indicate the remote email addresses. (Users can
Remote email set 4 email addresses in ISPSoft.) Bit0 corresponds to remote email 1;
S1
number bit1 corresponds to remote email 2 and so on.
If users want to send an email, they have to set the corresponding bit in
ISPSoft.
Completion of the After the execution of the instruction is completed, the bit is ON. If the
D
instruction execution of the instruction is abnormal, the next bit is ON.
Example:
Suppose the value in D0 is 00010100. When X0.0 is ON, the email is sent to remote email number 3 and remote email
number 5. After the communication with the SMTP sever is completed, M20 is ON. If no error occurs during the
communication, M21 is OFF and Y0.0 is ON.
6_6
6-625
AS Seri es Progr amm i ng Manual
Additional remark:
1. For the length of the string in S2 or S3, the system will capture the data with the end of 16#00. If the length of the
string is larger than the maximum value (with16#00 as the end), the length of the string in S2 or S3 will be counted
equal to the maximum value.
2. If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
3. Please reserve one word between S2 and S3 for the interrupt character.
16#6108 D+1 An error in the password authentication of the SMTP server account
_6
6-626
Chapt er 6 Ap pl i ed I nst ruct i on s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
Data
LINT
TMR
CNT
INT
type
S
D
D : Conversion result
Explanation:
1. The IP address in S and S+1 is converted into the IP address of the string type, and the conversion result is stored
in D.
Afte r th e in struction
D 12 "6 " " 1"
D0 16 #C0( 192) 16#A8(16 8) D1 3
is exe cu ted "." "8 "
D1 16#00 ( 0) " 192.168.0.1"
16 #01 (1) D 14 " 0" " 0"
D 15 "." " 0"
D 16 "0 " "0 "
D1 7 16 # 00 "1 "
Additional remark:
1. If users declare the operand S in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
2. If users declare the operand D in ISPSoft, the data type will be ARRAY [8] of WORD/INT.
6-627
AS Seri es Progr amm i ng Manual
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
Data
LINT
TMR
CNT
INT
type
S
D
D : Conversion result
Explanation:
1. 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 and D+1.
3. There are 1~3 characters in every section of the IP address of the string type in S. These sections are separated by
“.” (16#2E). For example, users can enter “192.168.0.1” instead of “192.168.000.001”
4. The value converted from the characters in every section of the IP address of the string type in S should be within
the range of 0~255.
6-628
Chapt er 6 Ap pl i ed I nst ruct i on s
Example 1:
" 19 2. 16 8 .0 .1 "
Example 2:
6_6
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.
2. 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.
3. If the number of decimal points “.” 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.
4. If the value converted from the characters in any section of the IP address of the string type in S is out of the range
of 0~255, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
5. The number of characters in any section of the IP address of the string type in S is within the range of 1~3. If the
6-629
AS Seri es Progr amm i ng Manual
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.
6. If users declare the operand S in ISPSoft, the data type will be ARRAY [8] of WORD/INT.
7. If users declare the operand D in ISPSoft, the data type will be ARRAY [2] of WORD/INT.
_6
6-630
Chapt er 6 Ap pl i ed I nst ruct i on s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
Data
LINT
TMR
CNT
INT
type
See Explanation
D1~D2 :
below.
6-631
AS Seri es Progr amm i ng Manual
Explanation:
1. The name and explanation of S1~S7, n, S and D1~D2 are listed in the following table.
_6 n
The length of read and The size of the data which are written or
WORD
written data read. Unit: byte; maximum: 200 bytes.
error occurs.
Occupies
The major error code and extended error two
D2 Error code WORD[2]
code consecutive
words
6-632
Chapt er 6 Ap pl i ed I nst ruct i on s
2. When the instruction is enabled for the first time, it indicates that the communication command is sent. If the number
of slaves connected reaches the upper limit, the communication status value in D1 is 0, which means the
communication is not triggered to execute.
3. When the set parameter value exceeds the range, the instruction is not executed and the communication status
value in D1 is 4
Example 1:
The vendor code of the device (at 192.168.1.5) are read and the read data are stored in D100. The EtherNet/IP Object
parameters are set as below.
(1) Class ID = 1
(2) Instance ID = 1
(3) Attribute ID = 1
6_6
6-633
AS Seri es Progr amm i ng Manual
_6
6-634
Chapt er 6 Ap pl i ed I nst ruct i on s
Example 2:
The maximum frequency (01-00) of the AC motor drive (at 192.168.1.6) is set to 60.00Hz. The EtherNet/IP Object
parameters are set as below.
6_6
Additional remark:
1. If users declare the operand S1 in ISPSoft, the data type will be ARRAY [2] of WORD.
2. If users declare the operand S in ISPSoft, the data type will be ARRAY [n] of WORD of which n is the size of the
read/written data.
6-635
AS Seri es Progr amm i ng Manual
3. If users declare the operand D2 in ISPSoft, the data type will be ARRAY [2] of WORD.
_6 16#01 Connection error Check if the EDS file of the slave is correct.
The path to the Check if the settings of Class ID (S4), Instance ID (S5) and Attribute
16#05
destination does not exist. ID (S7) are proper.
6-636
Chapt er 6 Ap pl i ed I nst ruct i on s
Check if the slave device object attribute allows PLC to perform the
16#0A An error in the attribute list
Get_Attribute_List and Set_Attribute_List function.
16#0C Object status conflicts Check if the Owner IO connection has been established.
Check if the slave has supported the set object. The service does
16#0D Object has existed.
not need to execute if the set object has been supported.
16#0E Attribute is not writable. Check if the object attribute supports the write function.
No privilege to perform
16#0F Check if the slave device is allowed to perform the service code.
the service code
The size of response data Check if the length of data in object attribute exceeds the limit (100
16#11
is too large. words). 6_6
The data access
16#12 sequence error occurs Check if the data length and data type are right.
when Tag is accessed.
Attribute value is Check if the set Attribute ID switch (S6) and Attribute ID (S7) are
16#14
unsupported. correct.
16#16 The object is inexistent. Check if the set Class ID (S4) is right.
6-637
AS Seri es Progr amm i ng Manual
User-defined object
16#1F Refer to the definition of the slave device error.
access error
_6
6-638
Chapt er 6 Ap pl i ed I nst ruct i on s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
Data
LINT
TMR
CNT
INT
type
Symbol:
S1~S10 :
See Explanation 6_6
below
Explanation:
1. The name and explanation of S1~S10 are listed in the following table.
6-639
AS Seri es Progr amm i ng Manual
Applicable
2. The pulse instruction is recommended for the setting when the instruction is used.
3. The Socket parameters take the setting values in HWCONFIG by default. When the parameter values need be
changed randomly during the communication, the instruction will be needed for the modification.
4. If the parameters are set when the socket number is in communication, the setting values will not be effective until
the communication is completed. It is suggested that the setting should be made after making sure that the socket is
not used.
5. If any one of the setting value of parameters is out of the range, the instruction will not be executed, SM0 is ON and
the error code in SR0 is 16#2003.
6-640
Chapt er 6 Ap pl i ed I nst ruct i on s
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
Explanation:
1. The names and explanations of S1~S11 are listed in the following table.
6-641
AS Seri es Progr amm i ng Manual
The local register where the Bit device supports M device only BOOL
S7
received data are stored The function code for reading data in WORD
Word device supports D device only.
6-642
Chapt er 6 Ap pl i ed I nst ruct i on s
The local register where the device supports M device only BOOL
S11
remote data are written The function code for writing data in WORD
Word device supports D device only.
When AS series PLC reads the data in multiple bit devices (not discrete input devices), the function code sent is 1
(16#01).
When AS series PLC reads the data in multiple bit devices (not discrete input devices), the function code sent is 2
(16#02).
When AS series PLC reads the data in multiple word devices (not input registers), the function code sent is 3
(16#03).
When AS series PLC reads the data in multiple word devices (not input registers), the function code sent is 4
(16#04).
6_6
When AS series PLC writes the status in one bit device, the function code sent is 5 (16#05).
When AS series PLC writes the data in one word device, the function code sent is 6 (16#06).
When AS series PLC writes the status in multiple bit devices, the function code sent is 15 (16#0F).
When AS series PLC writes the data in multiple word devices, the function code sent is 16 (16#10).
When AS series PLC writes the data in multiple word devices, the function code sent is 23 (16#17).
4. The parameter values set in the instruction are valid only while PLC is running. When PLC is repowered after power
off, it will take the setting values in the data exchange table by default. If some parameter values need be revised
during the data exchange, the instruction will be used for the modification of the parameter values.
5. If the specified number is in communication, the newly set parameter values will be effective when the next
communication is performed after the current communication is completed.
6. When any one of the parameter values is not within the valid range, the instruction will not be executed; SM0 is ON
and the error code in SR0 is 16#200B.
6-643
AS Seri es Progr amm i ng Manual
7. AS series PLC does not support Modbus TCP communication instructions. If the PLC program is used for the
control, please enable the “Program control” mode in the data exchange table first and use the SM number in the
following table.
SM1168 ~ SM1199 R/W The flag for enabling the data exchange connection 1~32
SM1200 ~ SM1231 R The success flag of the data exchange connection 1~32
SM1232 ~ SM1263 R The error flag of the data exchange connection 1~32
When the receiving of data are OK, the success flag will be ON. When an error occurs in receiving data, the error
flag will be ON. The success flag and error flag of one connection number are not switched to ON simultaneously.
SR number Explanation
SR1120 ~ SR1151 Respectively indicate the actual communication time of connection 1~32.
SR1152 ~ SR1183 Respectively indicate the communication error codes of connection 1~32.
6-644
Cha p ter 6 App l ied Ins truc tio ns
Binary value
Default value
0
The file name extension is .dmd.
6-645
AS Ser ies Pro gra mm in g M anu al
Appending
The data which is written into the memory card is added after the last value
0 in the file.
Default value
Overwriting
The data which is written into the memory card replaces the values in the
1
file starting from the value indicated by the value in S4.
S1: The length of the data which is written into the file
Item Description
If the file format is 0, 1, 3, or 5, the unit of the value is the word. If the file format is
Value unit
2, 4, or 6, the unit of the value is the double word.
The devices in which the data is stored can not exceed the device range, and the
Length of the data size of the data which is written into the file can not be more than four gigabytes.
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
6-646
Cha p ter 6 App l ied Ins truc tio ns
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
AS332T-A
AS324MT-A
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 file format is 2, 4, or
Value unit
6, the unit of the value is the double word.
6_
Parameter unit The parameter unit is the double word.
If the function option is 1, the data which is written into the memory card replaces the
Usage values in the file starting from the value indicated by the value in S4.
Flag Description
SM450 If the memory card is in the CPU module, the flag is ON.
The data is being written from the PLC to the memory card, or the data is being read
SM452
from the memory card into the PLC.
6-647
AS Ser ies Pro gra mm in g M anu al
Flag Description
If an error occurs during the operation of the memory card, the flag is ON. If the flag is
SM453
ON, users have to reset it to OFF. The error code is stored in SR453.
Otherwise, the data cannot 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 MWRIT is executed; SM452 is
OFF when the execution of MWRIT is complete. MWRITP the pulse instruction cannot be used continuously. If executing
this pulse instruction to write data into the memory card continuously, it may exceed its written limitation and may lead to
6-648
Cha p ter 6 App l ied Ins truc tio ns
D10, D11 16#00000030 The size of the data which is written into the file is 48 words.
D20=16#6554
D22=16#0031
The data which is written into the memory card replaces the values in the file
D30、D31 16#00000000
starting from the first value.
Additional remark:
1. 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.
2. 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.
3. 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.
4. 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_
6-649
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data INT
type
C
S
S1
S2
S3
D
Symbol:
_6 C : Control parameter
S : File name
S2 : Reserved
S3 : Data length
D : Data destination
Explanation:
6-650
Cha p ter 6 App l ied Ins truc tio ns
Binary value
6-651
AS Ser ies Pro gra mm in g M anu al
The values in the file starting from the value indicated by the value in S1. are read.
0
The default value is 0.
1 If the file format is 0, 1, 3, or 5, the unit of the value is the word. If the file format is 2,
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
_6
AS332T-A
AS324MT-A
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 file format is
Value unit
2, 4, or 6, the unit of the value is the double word.
6-652
Cha p ter 6 App l ied Ins truc tio ns
S3: The length of the data which is read from the file
The devices in which the data is stored cannot 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.
Flag Description
SM450 If the memory card is in the CPU module, the flag is ON.
The data is being written from the PLC to the memory card, or the data is being read from the
SM452
memory card into the PLC.
If an error occurs during the operation of the memory card, the flag is ON. If the flag is ON,
SM453
users have to reset it to OFF. The error code is stored in SR453.
16#0063 An error occurs when the data is written into the file.
4. 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 cannot 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
6-653
AS Ser ies Pro gra mm in g M anu al
D300=16#6554
D302=16#0031
D10, D11 16#00000000 The values in the file starting from the first value are read.
D30、D31 16#00000020 The size of the data which is read from the file is 32 words.
_6
D20 - The data which is read is stored in D20.
Additional remark:
1. 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.
2. 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.
3. 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.
4. 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-654
Cha p ter 6 App l ied Ins truc tio ns
2302 MTWRIT P C,S,S1,S2,S3 Writing the string into the memory card
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
C
S
S1
S2
S3
Symbol:
C : Control parameter
S : Data source 6_
S1 : Data length
S2 : Separation mark
S3 : File name
Explanation:
Parameter
Description
value
If the file exists, the data which is written into the memory card is added after the last byte in
0
the file.
6-655
AS Ser ies Pro gra mm in g M anu al
If the file exists, the new data which is written into the memory card replaces the old data in
1
the file. The size of the file is the size of the new data.
(Overwriting)
If the file does not exist, it is created automatically.
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 cannot exceed the device range,
and the length of the data which is written into the memory card cannot be more than 255 bytes.
If the value in S1 is N, the value in S2 is written into the memory card as follows.
_6
S2Operand
Description
High byte Low byte
16#00 or not
16#00 The N-byte data is written into the file.
16#00
The N+1-byte data is written into the file. The value in the high byte in S2 is the
Not 16#00 16#00
value in the N+1st byte.
The N+2-byte data is written into the file. The value in the high byte in S2 is the
Not 16#00 Not 16#00 value in the seventh byte, and the value in low byte in S2 is the value in the N+2th
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
6-656
Cha p ter 6 App l ied Ins truc tio ns
AS332T-A
AS324MT-A
Flag Description
SM450 If the memory card is in the CPU module, the flag is ON.
The data is being written from the PLC to the memory card, or the data is being read
SM452
from the memory card into the PLC.
SM453
If an error occurs during the operation of the memory card, the flag is ON. If the flag is 6_
ON, users have to reset it to OFF. The error code is stored in SR453.
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.
6-657
AS Ser ies Pro gra mm in g M anu al
Example:
SM450 is ON when the memory card is inserted into the CPU module; SM452 is ON when MTWRIT is executed; SM452
After the data is written into the file, the separation mark is added after the last
D1 16#0A00
byte in the file.
D30=16#6554
D32=16#0031
Additional remark:
1. 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.
2. 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.
3. 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-658
Cha p ter 6 App l ied Ins truc tio ns
2303 MEMW P S,D,n Writing the data into the file register
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
D
n
Symbol:
n : Data length
6_
Explanation:
1. S: The initial address of the data source; it is suggested to declare an array type of variables.
2. D: The initial address in which the data is stored; it is suggested to assign an address for the file register and declare an
array type of variables.
3. n: The length of the data which is written into the file register, ranging from 1 to 2048. When exceeding, the
instruction will not be executed, SM0 is ON, and the error code in SR0 is 16#200B.
4. If the device S or D exceeds the allowed range, SM0 is ON, and the error code in SR0 is 16#2003.
5. Since it takes 60~120ms for the instruction to write, it is suggested to use this instruction when the PLC is idle. For
example there is no external interrupt task, no high-speed outputting, or any immediate events for the PLC to
process.
6. The instruction will only write when the contact is from OFF to ON and will only write once.
NOTE: This file register can only be written into for 100,000 times.
6-659
AS Ser ies Pro gra mm in g M anu al
_6
6-660
Ch ap te r 6 Ap pl ie d Instruc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
S : Task number
Explanation:
2. When the PLC runs, the execution of the cyclic tasks depends on the setting of the cyclic tasks in ISPSoft.
6_
3. The description of the operands:
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
The two cyclic tasks are created in ISPSoft. Cyclic task (0) is enabled when the PLC runs, and cyclic task (1) is not
6-661
AS Ser ies Pro gra mm in g M anu al
Cyclic task (1) is enabled by the execution of the instruction TKON in cyclic task (0).
Additional remark:
Please refer to ISPSoft User Manual for more information related to tasks.
_6
6-662
Ch ap te r 6 Ap pl ie d Instruc ti ons
Device
X Y M S T C HC D FR SM SR E K 16# “$” F
S
DWORD
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
S : Task number
Explanation:
2. When the PLC runs, the execution of the cyclic tasks depends on the setting of the cyclic tasks in ISPSoft.
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
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).
6-663
AS Ser ies Pro gra mm in g M anu al
Additional remark:
Please refer to ISPSoft User Manual for more information related to tasks.
_6
6-664
Chapter 6 Applied Instructions
6_
6-665
AS Series Programming Manual
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S1
S2
S3
Symbol:
S2 : Function code
S3 : Device address
_6
Explanation:
1. The designated SFC program of S1 will be activated according to the setups of S2.
2. When the instruction is executed, the SFC POU designated by S1 will be activated only when the SFC POU is being
scanned.
3. Operand:
When the designated SFC POU of S1 is executed, the parameters such as SFC/STEP/ACTION/TRANSITION
of the SFC program will be cleared when S2=0 or 1, and the execution will start according to the value
specified in S2.
S2=0, the system will execute the SFC POU from the initial Step.
S2=1, the system will execute the SFC POU from the designated Step of S3.
6-666
Chapter 6 Applied Instructions
S2=2, the status and the parameters such as SFC/STEP/ACTION/TRANSITION of the SFC will NOT be
cleared and the system will start executing from where it pauses.
5. When the state of the SFC POU is RUN, executing this instruction is invalid.
Example:
Set up one LD(ladder) POU and specify its POU name as Main, and 2 SFC POUs with the names of TestSFC1 and
TestSFC2.
1. When the program is executed (RUN), TestSFC1 and TestSFC2 will execute the SFCSTP, and 2 SFC POUs will stop
executing.
2. When M0 is set from OFF to ON, TestSFC1/ TestSFC2 POU will execute the SFCRUN* instructions. Refer to the
contents of TestSFC1 and TestSFC2 for execution details of the 2 POUs. When S2 is set to 0, the status and the
parameters of the SFC will be cleared and will begin to execute from STEP 1. When S2 is set to 1, the status and the
parameters will be cleared and will begin to execute from the designated STEP of S3.
3. When M1 is set from OFF to ON, TestSFC1 POU will pause. When S2 is set to 1, all the executing actions and the
outputs of the SFC will be cleared, and the system will run the final scan.
4. When M2 is set from OFF to ON, TestSFC1 POU will execute its actions. When S2 is set to 1, the status and the 6_
parameters will be cleared, and the system will begin to execute from STEP 2.
5. When M3 is set from OFF to ON, TestSFC2 POU will pause. When S2 is set to 0, all the executing actions of the SFC
and the outputs will be kept, and the system will not run the final scan.
6. When M4 is set from OFF to ON, TestSFC1 POU will execute its actions. When S2 is set to 2, the status and the
parameters will be kept and will begin to execute from where it pauses.
6-667
AS Series Programming Manual
Main POU
_6
6-668
Chapter 6 Applied Instructions
TestSFC1 POU
TestSFC2 POU 6_
Additional Remark:
Please refer to ISPSoft User Manual for more information related to SFC.
6-669
AS Series Programming Manual
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S2 : Function code
Explanation:
1. The designated SFC POU of S1 will pause according to the setups of S2.
_6
2. When the instruction is executed, the SFC POU designated by S1 will be paused only when the SFC POU is being
scanned.
3. When pausing, the status and the parameters such as SFC/STEP/ACTION/TRANSITION of the SFC will be kept.
4. Operand:
When S2=0, all the executing actions of the SFC and the outputs will be kept, and the system will not run the
final scan.
When S2=1, all the executing actions and the outputs of the SFC POU will be cleared, and the system will run
the final scan..
6. When the state of the SFC POU is PAUSE/STOP, executing this instruction is invalid.
6-670
Chapter 6 Applied Instructions
Example:
Additional Remark:
Please refer to ISPSoft User Manual for more information related to SFC.
6_
6-671
AS Series Programming Manual
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
Symbol:
Explanation:
_6 2. When the instruction is executed, the SFC POU designated by S1 will stop only when the SFC POU is being
scanned.
3. When stopping, the status and the parameters of the SFC will be cleared, and the system will run the final scan.
4. When the state of the SFC POU is STOP, executing this instruction is invalid.
Example:
Additional Remark:
Please refer to ISPSoft User Manual for more information related to SFC.
6-672
Cha p ter 6 App l ied Ins truc tio ns
6-673
AS Ser ies Pro gra mm in g M anu al
_6
6-674
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
D
Symbol:
Explanation:
1. S1 specifies the pulse output frequency as 4MHz for the line driver output models and the value within the range of
0Hz~200kHz for the open collector output models. The unit of the output frequency is 1Hz.The tolerable error rate
for 200kHz is about 0.02% and for 100kHz is about 0.01%. The error rate is decreasing with the decreasing
frequency. For example, if the output frequency is set to 199990Hz, the actual output is 199960Hz. If the output
frequency is set to 99999Hz, the actual output is 99990Hz. If the output frequency is out of the valid range, PLC will
2. The output frequency specified by S1 can change during the execution of the instruction without the execution of
ramp up/down process. The time to change the frequency is when the being executed instruction is scanned and
3. S2 specified the number of output pulses. The range: 0~2,147,483,647. When the number of output pulses is set to
0, it means the number of pulses is not restricted and pulses can be output constantly till the instruction is disabled.
4. After the output is started, the number of output pulses specified by S2 will not be allowed to change again.
6-675
AS Ser ies Pro gra mm in g M anu al
5. D only specifies Y0.0~Y0.11 as the output point. After the instruction is enabled, its output function becomes the
high-speed output. The basic instruction output point control will be invalid. It is suggested that the general output
function should not be used after the high-speed output function is used in the program.
6. The ratio of Duty-OFF Time and Duty-ON Time for the pulse output is 1:1.
7. There is no limit to how many times the instruction is used and repeated use of the same output points. But every
one output point can only be started and output by one high-speed output instruction in one scan cycle and the
instruction which is started first will occupy the output point first.
8. After every high-speed output instruction for every output point is enabled, other instruction occupying the same
output point can not be started till the high-speed output instruction which is being executed is disabled.
9. When the high-speed output instruction is enabled in the interrupt program or is not edited in the main process, it is
suggested that the instruction should be used with the auto-reset function together when output is completed and
10. After the stop flag is set, PLC will stop the output and clear the Busy flag only after the start instruction is executed a
second time and outputs a full pulse. PLC will continue to outpout pulses when the stop flag is reset and the
previously remaining pulse output is not finished. The stop flag is set and reset by designers.
11. The high-speed output points and corresponding SM/SR are listed in the following table.
Output point number Attribute#2 Y0.0 Y0.1 Y0.2 Y0.3 Y0.4 Y0.5
_6
Busy flag R SM460 SM472 SM480 SM492 SM500 SM512
Output completion
R/W SM470 SM475 SM490 SM495 SM510 SM515
auto-reset#4
Present output
SR460 SR474 SR480 SR494 SR500 SR514
position#1 R/W
SR461 SR475 SR481 SR495 SR501 SR515
(32-bit)
Output point number Attribute #2 Y0.6 Y0.7 Y0.8 Y0.9 Y0.10 Y0.11
Output completion
R/W SM530 SM535 SM550 SM555 SM570 SM575
auto-reset #4
6-676
Cha p ter 6 App l ied Ins truc tio ns
Output point number Attribute#2 Y0.0 Y0.1 Y0.2 Y0.3 Y0.4 Y0.5
Note:
#1: All present output positions are latched when power is off.
#2: R means “Ready-only” registers and the data in the registers can not be modified. R/W means the data can be
#3: It is suggested that the completion flag should be cleared by designers. If the completion flag is not cleared, it
will be cleared automatically when the high-speed output instruction is enabled next time.
#4: The output completion auto-reset flag is set by designers. PLC will clear the flag automatically after the output
is completed.
Example 1:
1. When X0.0 is ON, Y0.0 outputs 200 pulses with the frequency of 1kHz. SM461 is ON when the pulse output is
2. When X0.0 is OFF, Y0.0 stops the output. The pulse output is restarted when X0.0 is ON again. 6_
0.5ms
Output point
輸出Y0.0
Y0 2 3 200
1ms
6-677
AS Ser ies Pro gra mm in g M anu al
Example 2:
_6
Explanation:
1. Y0.0 outputs 1000 pulses whenever X0.0 receives the external interrupt signal once. Y0.2 outputs 1000 pulses
whenever X0.1 receives the external interrupt signal once.
2. When the external interrupt input X triggers the pulse output from Y, the interval time between the Y pulse
output completion and the next external interrupt input X trigger must be one PLC scan cycle or above.
6-678
Cha p ter 6 App l ied Ins truc tio ns
Explanation:
1. When M0 is ON, Y0.0 outputs 1000 pulses with the frequency of 1kHz.
2. When the pulse output is completed, SM461 is ON and then SM470 is ON.
3. When M0 changes from OFF to ON, the pulse output will be restarted.
6_
6-679
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S1
S2
S3
D
Symbol:
Explanation:
1. S1 specifies the pulse output frequency as 4MHz for the line driver output models and the value within the range of
0Hz~200kHz for the open collector output models. The unit of the output frequency is 1Hz.The tolerable error rate
for 200kHz is about 0.02% and for 100kHz is about 0.01%. The error rate is decreasing with the decreasing
frequency. For example, if the output frequency is set to 199990Hz, the actual output is 199960Hz. If the output
frequency is set to 99999Hz, the actual output is 99990Hz. If the output frequency is out of the valid range, PLC will
take the maximum or minimum frequency for the pulse output automatically.
2. After the instruction is enabled, the target output frequency specified by S1 can be changed and the ramp up/down
process is performed according to the set ramp up/down time. The time to change the frequency is when the being
executed instruction is scanned and the output of a full pulse which is being output is completed.
3. S2 is the number of output pulses. The range: 0~2,147,483,647. When the number of pulses is set to 0, it means
the number of pulses is not restricted and pulses can be output continuously till the instruction is disabled.
4. After the output is started, the number of output pulses which S2 specifies will not be allowed to change again.
6-680
Cha p ter 6 App l ied Ins truc tio ns
5. S3 sets the ramp-up/down time with the unit of 1ms. The value is effective when the instruction is enabled for the
first time. If the target frequency specified by S1 is modified in the ramp-up process, the ramp up/down time will be
reloaded for execution. But if the target frequency is modified when the output enters the ramp-down process, the
6. D only specifies the output device among Y0.0~Y0.11. After the instruction is enabled, its output function becomes
the high-speed output. The general instruction output point control will be invalid. It is suggested that the general
output function should not be used after the high-speed output function is used in the program.
7. The target output frequency S1, number of output pulses S2 and Ramp up/down time S3 are illustrated in the
following figure.
8. The ratio of Duty-OFF Time and Duty-ON Time for the pulse output is 1:1.
9. There is no limit to how many times the instruction is used and the repeated use of the same output points. But 6_
every output point can be started for output only by one high-speed output instruction in one scan cycle and the
instruction which starts the output point first will occupy the output point first.
10. After the high-speed output instruction for one output point is enabled, other instruction which is specified to occupy
the same output point can not be started till the high-speed output instruction in execution is disabled.
11. When the high-speed output instruction is enabled in the interrupt program or is not edited in the main program, it is
suggested that the instruction should be used with the auto-reset function together when the output is completed
and PLC will update the output state in the END instruction.
12. After the stop flag is set, PLC will perform the ramp-down stop or immediately stop the output only after the start
13. Refer to PLSY instruction for explanation of the high-speed output points and corresponding SM/SR.
6-681
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
D
Symbol:
_6 Explanation:
1. The 16-bit instruction PWM takes 100us as the output unit and the 32-bit instruction DPWM takes 1us as the output
unit.
2. S1 the pulse output width (Duty ON) is defined as t, S2 the pulse output cycle time (Cycle time) is T as below. S1≦
S2 is recommended.
6-682
Cha p ter 6 App l ied Ins truc tio ns
4. There is no limit to how many times the instruction is used in the program. But only one of the output instructions
which use the same output point can be executed in the same scan cycle. When several high-speed pulse output
instructions start the same point in the program, PLC will first perform the output based on the instruction which is
executed first.
5. If S1≦0 or S2≦0, it will be seen as 0 output (the pulse output is OFF). If S1>S2, it will be seen as S1=S2. When S1
6. The pulse output width S1 and pulse output cycle S2 can be modified when PWM is executed.
Output point number Attribute Y0.0 Y0.1 Y0.2 Y0.3 Y0.4 Y0.5
Present output
SR460 SR474 SR480 SR494 SR500 SR514
position#1 R/W
SR461 SR475 SR481 SR495 SR501 SR515
(32-bit)
Output point number Attribute Y0.6 Y0.7 Y0.8 Y0.9 Y0.10 Y0.11
Example: 6_
When X0.0 is ON, Y0.1 outputs the following pulses. When X0.0 is OFF, Y0.1 output changes to OFF.
t=1000ms
Output Y0.1
Output Y1
T=2000ms
6-683
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
D1
D2
Symbol:
S1 : Ramp-up time
_6
S2 : Target output frequency
S3 : Ramp-down time
Explanation:
1. S1 is the ramp-up time with the unit of 10ms. For example: the setting value 10 means the ramp-up time is 100ms.
After the instruction is enabled, the output frequency can be divided into ten times and it speeds up once every
10ms. And it will speed up to JOG target frequency specified by S2 when S1 the ramp-up time is reached.
2. When the instruction is disabled, its output frequency will ramp down once every 10ms based on the set ramp-down
time. The output will not stop till the ramp-down time is reached. If the ramp-down time is set to 0, the output will
stop immediately.
3. The range of ramp-up time S1 and ramp-down time S3 is 0~3000 (that is 0~30 seconds). If the setting value is out of
the range, PLC will take the minimum or maximum value for the output. The ramp-up time and ramp-down time will
6-684
Cha p ter 6 App l ied Ins truc tio ns
be affected by the scan time. If the accurate time is required to switch the ramp-up and ramp-down process, the
output instruction with the ramp up/down designed such as DDRVI instruction is recommended to use.
4. The range of the target output frequency S2 is -200K~200kHz. If the setting value is out of the range, PLC will take
the minimum or maximum value for the output. If the output frequency is a positive number, it indicates the forward
ouput. If the output frequency is a negative number, it indicates the reverse output.
5. The output point for D1 must be selected from Y0.0~Y0.11 as the following table shows. For the auxiliary output
point for D2, the output points in the following table can be referred to. If users choose other output point or M device,
the value in SR indicating the output mode will be invalid and the “Pulse+direction” mode will be valid by default. D2
is a direction output point here.
6. If SR=0, it indicates the “Pulse+direction” output mode. When SR=1, it means the A/B phase output. (Note: The
output mode can be selected only when D1 uses the even output point and D2 uses the recommended direction
output point.)
7. When the output begins, the Busy flag SM is set to ON. When the output is completed, the Busy flag will be reset to
8. The output timing diagram: (For the Busy flag in the following figure, refer to the Busy flags of axes.)
6-685
AS Ser ies Pro gra mm in g M anu al
Jog_in
Busy flag
S2 > 0
S1 S3
D1
0 Time
S1 S3
S2 < 0
9. The target output frequency can be modified during the execution of the instruction. When the new frequency is
greater than the previous one, the ramp-up slope is used. Whereas, the ramp-down slope is used if the new
10. The ramp-up/down slope is set through conversion of the set time and target frequency when the instruction is
enabled. Thus the slope will not change with the changing target frequency in the process of the the instruction
output. For example, the original target frequency for the output is 1kHz and then it is modified as 2kHz. Thus the
actual ramp-down time will be different from the time set originally. The following dotted line is the ramp-up/down
_6
Jog_in
Change S2
S2
D1
Time
S1 S3
6-686
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
D
Symbol:
Explanation:
1. The range of the target frequency for zero return S1 is 1Hz~200kHz. The JOG frequency S2 should be less than the
target frequency S1. The JOG frequency S2 is the start frequency. If S1 is less than S2, S1 will be revised
2. The input point for S4 and output point for D must match for use. Do not change them during the execution of the
instruction. The input point for S4 can only be one of the 16 high-speed input points X0.0 ~ X0.15. For the selection
of D output point and direction output point, refer to the following table. If D is not the preset “Pulse+direction” output
(default: 0), change the mode into A/B phase output by setting SR to 1.
6-687
AS Ser ies Pro gra mm in g M anu al
It can be any one of the input points X0.0 ~ X0.15. But the same input point can not be
selected for different axis output. If DOG point shakes or the switch bounces, please
Input point for S4
set the input point filter time in HWCONFIG.
3. S3 is for selection of a zero return mode and the function code is set by two high and low16-bit parameters. See the
details as below.
Code
Functions High Explanation
Low 16-bit
16-bit
6-688
Cha p ter 6 App l ied Ins truc tio ns
after returning to the zero of Z same as that for the low 16-bit code. After the
point phases zero point is returned to, the motion will continue
(Z phase input point is set in according to the number of Z phases. When the
HWCONFIG ) high 16-bit code is a positive number, the search
is toward the positive direction. Whereas, the
negtive value indicates that the search is toward
the negative direction. Suppose that the
rising-edge trigger of X0.1 is specified as the
condition for Z phase input by HWCONFIG, the
counting will be performed once whenever the
rising-edge trigger of X0.1 occurs.
Choosing the value 4~7 means selecting the
Number
functions of code 0~3 respectively and the
of pulses 4+0=4
Mode 0 Outputs the clear specified output point will send an ON signal
for 4+1=5
signal after returning to the which is about 20ms wide when the function
moition
zero point. 4+2=6 execution is completed. The range of the output
or
(Output clear point is set in 4+3=7 point is Y0.12~Y0.15 and Y1.0 ~ Y1.15. For
number
HWCONFIG ) (bit2=ON) example, if Y1.12 is specified as the output point
of Z
in HWCONFIG, it indicates Y1.12 is for the output
phases
of clear signals.
Leaves the zero point in the
8+0=8
positive direction and then The operation for zero point return is the same as
0 8+1=9
stops that for code 1 (Mode 1)
(bit3=ON)
(Mode 1)
The operation for zero point return is the same as
that for low 16-bit code 1.
After the zero point is returned to, the motion will
Number
Mode 1 Outputs the continue in accordance with the number of pulses
of pulses 8+2=10
number of pulses after the specified. When the value of the high 16-bit code is
for (bit3=ON)
zero point is returned to
moition
a positive number, the motion will go toward the
positive direction. Whereas, the motion will be in
6_
the negative direction if the value is a negative
number.
The operation for zero point return is the same as
that for low 16-bit code 1.
After the zero point is returned to, the motion will
continue in accordance with the number of Z
Mode 1 Searches for Z
Number phases to seek. When the value of the high 16-bit
phase after returning to the
of Z 8+3=11 code is a positive number, the motion will go
zero point
phases (bit3=ON) toward the positive direction. Whereas, the motion
(Z phase input point is set in
will be in the negative direction if the value is a
HWCONFIG )
negative number.
If the rising edge trigger of X0.1 is the condition for
Z phase input, the counting will be performed once
whenever the rising-edge trigger of X0.1 occurs.
0 or
Mode 1 Outputs the clear number
signal after returning to the of pulses 12 ~ 15
After the zero point in mode 1 is returned to, the
zero point or (bit3=bit2
20ms-width clear signal is output.
(Output clear point is set in number =ON)
HWCONFIG ) of Z
phases
+16 When in the low 16-bit code, bit 4 is ON, it means
DOG point is B point
(bit4=ON) the zero point is ON as DOG point changes from
6-689
AS Ser ies Pro gra mm in g M anu al
The DOG signal is determined by the value of bit4 Mode 0 or mode 1 for the zero point return is selected
according to the value of bit3. The operation of the zero point return is performed according to the values of bit 1
5. Please set the input point and the rising edge trigger condition in HWCONFIG, when the position control system
needs the positive and negative limit input points. Note that the limit input points must not be the same as the zero
6. The Completion flag will be set to ON after the instruction finishes performing the specified function. For example,
selecting the function of code 6, PLC will set the Completion flag to ON only when the Z phase seeking is
completed.
7. After DZRN instruction is enabled, the interrupt service program will not be executed till DZRN instruction is
disabled if the specified input point for zero point is the same as that for the external input interrupt in the program.
8. When the limit switch is started by HWCONFIG and the external input interrupt service program exists, the interrupt
Function code 0:
_6
The DZRN function is enabled and the search for the zero point is toward the negative direction with the target
frequency.
After the DOG signal is received, the output frequency will decrease into JOG frequency. The output will
continue toward the negative direction and will not stop till the zero point signal changes from ON to OFF.
The output will stop when the signal changes from ON to OFF after DOG signal is left.
Negative direction
Completion flag ON
DOG signal ON
Frequen cy
Target frequency
JOG frequency
Time
1 2 3
6-690
Cha p ter 6 App l ied Ins truc tio ns
Function code 1:
The DZRN function is enabled and the search for the zero point is toward the negative direction with the target
frequency.
After the DOG signal is received, the output is toward the positive direction with the JOG frequency after the
output frequency is decreased and the motion direction is reversed. The output will not stop till the zero point
DOG signal is left and PLC will stop when the signal changes from ON to OFF.
P ositive
Negative direction direction
Completion flag ON
DOG signal ON
F requency
Target frequency
JOG frequency
Time
1 2 3 4
6_
Function code 2:
The DZRN function is enabled and the search for the zero point is toward the negative direction with the target
frequency.
After DOG signal is received, the output will decrease the frequency to JOG frequency and will continue toward
When DOG signal is left and the signal changes from ON to OFF, the number of pulses specified will be output.
When the 100th pulse output is completed, PLC will stop and the Completion flag will be ON.
6-691
AS Ser ies Pro gra mm in g M anu al
Completion flag ON
DOG signal ON
Output Y
Frequency
Target frequency
JOG frequency
Time
1 2 3 4 5
Function code 3:
DZRN function is enabled and the search for the zero point is toward the negative direction with the target
frequency.
After the DOG signal is received, the output frequency will decrease to JOG frequency and the motion will
The motion will go on according to the number of Z phases when the signal changes from ON to OFF after DOG
signal is left.
Completion flag ON
DOG signal ON
Z phase pulse
Frequency
Target frequency
JOG frequency
Time
1 2 3 4 5
Function code 4:
DZRN function is enabled and the search for the zero point is toward the negative direction with the target
frequency.
After the DOG signal is received, the output frequency will decrease to JOG frequency and will continue toward
the negative direction. The output will not stop till the zero point signal changes from ON to OFF.
6-692
Cha p ter 6 App l ied Ins truc tio ns
After DOG signal is left, the output will stop when the signal changes from ON to OFF and the clear signal will be
Negative direction
Completion flag ON
Clear signal ON
DOG signal ON
Frequency
Target frequency
JOG frequency
Time
1 2 3
The negative limit input point is set in HWCONFIG and then the setting is downloaded to PLC. (PLC will
automatically judge the negative limit function when the instruction is enabled.)
DZRN function is enabled and the search for the zero point is toward the negative direction with the target
frequency.
After the negative limit switch is ON, the motion will stop and then will go toward the positive direction after the
direction is reversed.
6_
The motion will continue to go toward the positive direction after leaving the negative limit switch.
The output frequency will ramp down after DOG signal is received. The reverse output will be performed with the
JOG frequency after the direction is reversed.
The output will stop when the signal changes from ON to OFF after the DOG signal is left.
Positive Negative
Negative direction direction direction
Completion flag ON
DOG signal
Frequency
Target frequency
JOG frequency
Time
1 2 3 4 5
6-693
AS Ser ies Pro gra mm in g M anu al
Example 1:
When M0 is ON, the zero return is started by outputting the pulse from Y0.0 with the frequency of 20kHz.
When DOG signal is received and X0.4 is ON, Y0.0 outputs the pulse with the JOG frequency of 1kHz. And the output will
Example 2:
When M0 is ON, the zero return is performed by outputting the pulse from Y0.0 with the frequency of 20kHz.
When DOG signal is received and X0.4 is ON, PLC decreases the frequency to the JOG frequency of 1kHz and the
output is conducted with the JOG frequency of 1kHz. When X0.4 is OFF, PLC starts to seek the Z phase pulse. When
X0.5 receives two pulses, PLC stops and Y1.4 outputs a 20ms-width pulse.
_6
Explanation:
1. If the rising-edge trigger at X0.5 is specified as the condition for Z phase input in HWCONFIG, the counting will be
2. Y1.4 is specified as the output point for outputting the clear signal in HWCONFIG.
3. S3 is set as 16#00020007. The value of the high 16-bit code, 02 means to search Z phase twice. The value of the
low 16-bit code, 07 means to output the clear signal (20ms wide) after the Z phase is found.
6-694
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S
D1
D2
Symbol:
6_
Explanation:
1. S1 specifies the pulse output frequency. The range is -4MHz ~ +4MkHz for the line driver output models and
-200kHz ~ +200kHz for the open collector output models. The minus sign and plus sign indicate the positive
direction and negative direction. The pulse output frequency can be changed during the pulse output. But if the new
frequency is different from the previous frequency in direction, the instruction will stop the output and one cycle later
2. Refer to the following table for selection of pulse output devices for D1 and D2. When the output mode for D1 and
D2 is not the default “Pulse+direction” output (0 is the default value), please modify the mode by setting SR to 1.
And the mode is changed into A/B phase output.
6-695
AS Ser ies Pro gra mm in g M anu al
3. The output point for the pulse direction output device D2 will be affected by the scan cycle if it is not the output point
which is recommended to use.
4. The pulse direction output device D2 will change its own state according to the minus sign and plus sign of S. D2 is
5. There is no ramp-up/down setting in the instruction. Thus the ramp-up operation at the beginning and ramp-down
stop operation can not be performed. If the function of ramp-up/down must be achieved, please use API 0703
DRAMP instrunction for increasing and decreasing of the pulse output frequency.
6. While the instruction is executing the pulse output, the output will immediately stop if the drive condition changes
to OFF.
Example:
When M10 is ON, Y0.0 outputs the pulse with the frequency of 20kHz. Y0.1 = OFF means the positive direction for the
pulse output.
_6
6-696
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
D1
D2
Symbol:
Number of output pulses
S1 :
(Relative positioning)
S2 : Pulse output frequency
Explanation:
1. S1 is the number of output pulses (Relative positioning). The available range is -2,147,483,648 ~ +2,147,483,647 of
which the “+/-”signs indicate the positive and negative directions.
2. S2 is the pulse output frequency. Available range: 1Hz ~ +200k Hz for open collector output models and1Hz ~ +4Mk
Hz for line driver output models.
3. Refer to the following table for selection of pulse output devices for D1 and D2. When the output mode for D1 and D2
is not the default “Pulse+direction” output (0 is the default value), please modify the mode by setting SR to 1. And
Direction output point for D2 Y0.1 Y0.3 Y0.5 Y0.7 Y0.9 Y0.11
6-697
AS Ser ies Pro gra mm in g M anu al
DDRVI and DDRVA support the output devices for D1 which can be the odd points as shown in the following table.
Only the “Pulse+direction” output mode is supported. The input points Y0.0, Y0.2…Y0.10 are not recommended to
4. If the pulse direction output device for D2 is not the output point recommended in the table above, the output will be
affected by the scan time.
5. When D2 uses the output mode “pulse+direction” and S1 has the minus sign, D2 is ON. When S1 has the plus sign,
D2 is OFF. D2 will not be OFF immediately after the pulse output in the negative direction is completed. D2 is
switched to OFF when the contact for the execution of the instruction is OFF.
6. For the instruction execution, the parameters such as the start/end frequency and ramp-up/down time need be
used. For SM/SR which axes correspond to, refer to the following table.
_6
Busy flag SM460 SM480 SM500 SM520 SM540 SM560
Enabling S curve
SM468 SM488 SM508 SM528 SM548 SM568
ramp-up/down
Output completion
SM470 SM490 SM510 SM530 SM550 SM570
auto-reset
Executing an interrupt
output ends
Corresponding
I500 I501 I502 I503 I504 I505
interrupt I number
6-698
Cha p ter 6 App l ied Ins truc tio ns
The output
immediately stops
SM476 SM496 SM516 SM536 SM556 SM576
when the instruction is
disabled or stops
Start/end
SR463 SR483 SR503 SR523 SR543 SR563
frequency(Hz)
Output completion
SM475 SM495 SM515 SM535 SM555 SM575
auto-reset
The output
immediately stops
SM477 SM497 SM517 SM537 SM557 SM577
when the instruction is
disabled or stops
Start/end
SR476 SR496 SR516 SR536 SR556 SR576
frequency(Hz)
Ramp-up/down time
SR477 SR497 SR517 SR537 SR557 SR577
(ms)
6-699
AS Ser ies Pro gra mm in g M anu al
The flags such as S curve ramp-up/down, fixed slope ramp-up/down and executing an interrupt program when
pulse output ends are not supported by the odd output points.
If the output is ongoing, the preset output is the ramp-down stop when the instruction is disabled or stops
temporarily. If the output has to be stopped immediately, users should set the immediately stop flag to ON.
7. Refer to the following table for Attribute, Factory default and Latched of SM/SR that axes correspond to.
Factory
Item Attribute StopRun RunStop Power ON Latched
default
Output completion N
R/W OFF OFF OFF OFF
auto-reset
Enabling S curve N
R/W OFF OFF OFF OFF
ramp-up/down
Executing an interrupt N
output ends
The output N
immediately stops
R/W OFF OFF OFF OFF
when the instruction is
disabled or stops
Present output
R / Wd No change No change No change 0 Y
position
Start/end Y
R / Wd No change No change No change 200
frequency(Hz)
Target frequency of R / Wd Y
No change No change No change 0
the fixed slope
6-700
Cha p ter 6 App l ied Ins truc tio ns
Present output
R 0 0 0 0 N
frequency
Note: R mean the device is readable. W means the device is writable. Wd means the device is writable any time
8. After the function of output completion auto-reset is enabled, the flag will be reset to OFF automatically when the
output is completed. Thus the flag need be set to ON again if the auto-reset function is needed for the next output
operation. It is suggested that the rising-edge or falling-edge should be used to trigger the flag every time. The
function is usually used in the case that the output instruction DDRVI can not be scanned and executed by PLC
program after DDRVI is enabled. For example, the instruction is enabled in the interrupt program.
9. If the Completion flag is used for setting the I interrupt function, the flag will automatically be reset to OFF when the
output is completed and the interrupt program is entered. Thus the flag need be set to ON again for the next output
in which the interrupt occurs. It is suggested that the rising-edge or falling-edge should be used the trigger the flag
every time.
Example 1:
When M10 is ON, Y0.0 outputs 20,000 pulses with the frequency of 2kHz (Relative positioning). Y0.1 = OFF means the
positive direction.
6_
Additional remark:
1. Explanation of relative positioning: specify the travel distance from current position with the “+/-” signs.
F requency
+ 3, 000 pulse
Target frequency
S tart/end frequency
Current position
6-701
AS Ser ies Pro gra mm in g M anu al
F requency
Number of
S1:: output pulses
Slope ramp-up
S2
S tart/end frequency
SR463
Time
used to start Y0.0 for output, then other instructions which also use Y0.0 for output will not be executed. The
instruction which starts the output point first will use the point first.
c) After the instruction is enabled, the modification of other all parameters will not be accepted till the
instruction is disabled.
_6 F requency
Fixed slope
Target frequency
Target frequency
Original slope
S tart/end frequency
Time
c) The new slope will take the place of the orginal slope and the positioning will be performed by DDRVI as the
figure above shows.
d) The general slope is determined by the start/end frequency, target frequency and ramp up/down time.
The fixed slope is determined by the start/end frequency, target frequency of the fixed slope and ramp
up/down time.
6-702
Cha p ter 6 App l ied Ins truc tio ns
e) When the target frequency of the fixed slope is less than the target frequency, the fixed slope function will not
be started.
b) Ramp-down stop
When M10 is ON, DDRVI instruction is enabled and starts to output pulses. And SM460, the Busy flag is
ON.
When the instruction is disabled (M10 is OFF) or the stop flag SM463 is ON, the state of the immediately 6_
stop flag SM476 will be confirmed.
If the immediately stop flag SM476 is OFF, the output will ramp down till stop and then SM460 the Busy
flag is OFF.
If M10 is not OFF and the stop flag SM463 is not ON after the instruction is enabled, Y0.0 will stop the
c) Immediately stop
If the instruction is disabled (M10 is OFF) or the stop flag SM463 is ON, the state of the immediately stop
If the immediately stop flag SM476 is ON, the output will stop immediately and SM460 the Busy flag will
be OFF.
6-703
AS Ser ies Pro gra mm in g M anu al
SM464 is set to ON, it means that the positive limit function is started.
DDRVI outputs 20,000 pulses in the positive direction. (Note: the instruction will not output in the positive
direction if the positive limit point is ON when the function is started)
When the limit input point X0.6 is triggered by the external mechanism and is ON, it indicates that the
If the condition for the hardware limit function is not met, Y0.0 will stop the output after outputting 20,000
pulses.
SM466 is set to ON, it means that the negative limit function is started.
DDRVI outputs 20,000 pulses in the negative direction. (Note: the instruction will not output in the
negative direction if the negative limit point is ON when the function is started)
When the limit input point X0.7 is triggered by the external mechanism and is ON, it indicates that the
DDRVI instruction will stop the output immediately and the negative limit alarm SM467 is ON.
If the condition for the hardware limit function is not met, Y0.0 will stop the output after outputting -20,000
pulses.
6-704
Cha p ter 6 App l ied Ins truc tio ns
positive limit
flag
negative limit
flag
Note: The limit point alarm flag is an only-read flag and is set or reset automatically by PLC according to the state
6_
DDRVI starts to output 20,000 pulses in the positive direction. (Note: the instruction will not output in the
positive direction if the positive limit is exceeded when the function is started)
When the current position SR460 > the limit position SR580, it means that the condition for the software limit
function is met.
6-705
AS Ser ies Pro gra mm in g M anu al
DDRVI instruction will stop the output immediately and the positive limit alarm SM465 is ON.
DDRVI starts to output 20,000 pulses in the negative direction. (Note: the instruction will not output in the
negative direction if the negative limit is exceeded when the function is started)
When the current position SR460 < the limit position SR582, it means that the condition for the software
_6 DDRVI instruction will stop the output immediately and the negative limit alarm SM467 is ON.
If the condition for the software limit function is not met, Y0.0 will stop the output after outputting -20,000
pulses.
Positive output limit: The output will stop immediately if the current position is greater than the positive limit
position.
Negative output limit: The output will stop immediately if the current position is less than the negative limit
position.
When the positive and negative limits are both 0, the software limit function can not be started. Since the
6-706
Cha p ter 6 App l ied Ins truc tio ns
software limit function will check the output position when the output instruction is scanned, the stop of the
output will be affected by the PLC scan. To quickly stop the output in real time, please use the external input
7. ST Example:
Explanation
1. When M0 is ON, Y0.0 outputs 1000 pulses with the frequency of 1kHz.
2. When the pulse output is completed, SM461 is ON and meanwhile SM470=ON is triggered.
3. The pulse output will restart when M0 changes from OFF to ON again.
6_
6-707
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
D1
D2
Symbol:
Number of output pulses
S1 :
(Absolute positioning)
S2 : Pulse output frequency
Explanation:
1. S1 is the number of output pulses (Relative positioning). The available range is -2,147,483,648 ~ +2,147,483,647
among which the “+/-”signs indicate the positive and negative directions.
2. S2 is the pulse output frequency. Available range: 1Hz ~ +200k Hz for open collector output models and1Hz ~ +4Mk
Hz for line driver output models.
3. The absolute positioning is that the pulse output is conducted from current position till the specified target position is
reached. For example, the number of output pulses at current position is 100 and the number of pulses at the target
position S1 is set to 1000. So the number of the actual output pulses is 1000-100=900.
6-708
Cha p ter 6 App l ied Ins truc tio ns
Example:
If the value of the present output position SR460 (32-bit) is 100 and M10 is ON, by means of DDRVA instruction, Y0.0 will
output pulses with the frequency of 2kHz till the value in SR460 becomes 20,000 (Absolute positioning). Y0.1 = OFF
Additional remark:
1. Absolute positioning: the way of specifying the distance from the center (zero point).
F requency
+ 3, 000 pulse
Target frequency
S tart/end frequency
6_
Zero point
0 pulse
6-709
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
S5
D1
D2
Symbol:
Explanation:
1. S1 can only specify X0.0, X0.2, X0.4, X0.6, X0.8 and X0.10 as the input points and occupies two consecutive points
for input. The instruction can not be executed if the input points are not among the points specified above. After the
6-710
Cha p ter 6 App l ied Ins truc tio ns
input points are selected, the high-speed counter will be specified automatically. If there is a DCNT instruction with
the same high-speed counter in the program, PLC will first execute the instruction which starts the counter first. The
input points and corresponding high-speed counters are shown in the following table.
Group number 1 2 3 4 5 6
High-speed counter
HC202 HC206 HC210 HC214 HC218 HC222
number
Flag of reversing
SM270 SM271 SM272 SM273 SM274 SM275
input direction
2. If the high-speed counters for the instruction can only use the phase A/B input mode, please set the flag of
reversing the input direction to ON when MPG is connected but has not rotated yet and the input point of PLC is
ON.
3. S2 is the number of input pulses. Please use the 32-bit variable to declare the parameter.
4. S3 is the frequency of input pulses. Please use the 32-bit variable to declare the parameter with the unit of 1Hz.
5. S4 is the denominator (output frequency) of the proportion of the input frequency and output frequency. S5 is the
6_
numerator (input frequency) of the proportion of the input frequency and output frequency. The range of S4 and S5 is
1~255. If the setting value exceeds the range, the instruction will take the maximum or minimum value for
calculation automatically. For example, if input frequency: output frequency= 5:3, the denominator output frequency
is K3 and the numerator input frequency is K5. If the input frequency: output frequency=1:2, the denominator output
6. D1 can only specify Y0.0, Y0.2, Y0.4, Y0.6, Y0.8 and Y0.10 as the output points and occupies two consecutive
points for output.
The output points and corresponding output mode SR are shown in the following table.
6 - 7 11
AS Ser ies Pro gra mm in g M anu al
7. D2 is the frequency of output pulses. Please use the 32-bit variable to declare the parameter with the unit of 1Hz.
8. There is no limit to how many times the instruction is used. But its high-speed input and output points can not be
used by other instructions whenever the instruction is enabled. Otherwise, the instruction can not be executed.
Note:
1. The input pulse frequency is calculated on the base of the input pulse width (ON) in the positive half cycle. If pulse
width for ON: pulse width for OFF is not 1:1, PLC takes the ON width as the standard for conversion by default.
2. The input pulse=ON means the input point LED is on. Please notice whether the input point LED is OFF and whether
the flag of reversing the input direction need be activated if the MPG is used but it has not rotated yet.
Example 1:
X0.0/X0.1 input pulses for detection of the MPG. When M0 is ON, the setting values of S4 and S5 are both 1 (D4=1 and
D5=1). When the input frquency is 10Hz (D0, D1=10) and the number of pulses is 10 (D2, D3=10), the output axis
(Y0.0/Y0.1) will output 10 pulses (SR460, SR461=10) with the frequency of 10Hz (D10, D11=10).
_6
Example 2:
When M0 is ON, the setting values of S4 and S5 are 3 and 5 (D4=3, D5=5) respectively. When the input frequency of
MPG is 100Hz (D0, D1=100) and the number of pulses is 100 (D2, D3=100), the output axis (Y0.0/Y0.1) will output 60
6-712
Cha p ter 6 App l ied Ins truc tio ns
6_
6-713
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
S5
S6
D1
D2
Symbol:
Explanation:
1. When the value of S1 is 0, it indicates the output is a maximum 32-bit value (with a sign) and the output will not
perform the ramp-down stop till the mark signal is received.
6-714
Cha p ter 6 App l ied Ins truc tio ns
If the value of S1 is not 0 and the external interrupt does not occur, the output pulses of the target number are output.
The range of S1 is -2,147,483,648 ~ +2,147,483,647 of which the “+/-” sign means the positive/negative direction.
2. When the value of S2 is less than or equal to 0, the output is not enabled. If the output frequency is greater than the
maximum frequency, PLC will take the maximum frequency for output.
3. S3 can specifiy M or X device as the input point. The input source signal will be affected by the scan cycle if the
selected input point is not the one among X0.0~X0.15 in PLC .
4. The instruction must be used by combination of the input point number and external interrupt program so as to
achieve the real-time ramp-down output. For the operation of rising-edge or falling-edge trigger for the external
interrupt, please make the selection of them during the editing of the external interrupt program.
A. Using the external interrupt (I0xx, I1xx): when the external interrupt occurs, the ramp-down stop is performed
after the mark signal is received. No operation is performed if the external interrupt is not enabled.
B. Without using the external interrupt (I0xx, I1xx): When the instruction is executed, the ramp-down stop will be
performed after the mark signal is received if the rising edge occurs at X point and it will be affected by the scan
time.
5. The number of output pulses in the forepart mask section is between 1 and S4. When the setting value for S4 is 0, it
means not to enable the forepart-section mask function. When the number of pulses to be masked exceeds the
value of S1, the instruction will take the target number of output pulses S1 as the condition for the number to be
masked. If the external input trigger occurs within the number of output pulses to be masked, the external input
6_
interrupt will be invalid automatically.
6. The number of output pulses in the rear mask section is between S5 and S1. When S5 =0 or S5 >=S1, it means that
the rear mask section function is not enabled. When the external input trigger occurs in the mask sections, the
external input interrupt will be invalid automatically. When S4 >S5, it indicates the external input interrupt is invalid in
the output process.
7. If the forepart and rear mask sections are both set and S4 < S5, it means the valid input interrupt occurs in the section
8. If S6 is set to 0 after the mark signal is received, it means that the ramp-down stop should be performed based on
the ramp-down time. If S6 =-1 or < 0 after the mark signal is received, it means that the output will immediately stop.
If the setting value of S6 is not enough to achieve the ramp-down stop within the ramp-down time, the instruction will
limit the target frquency and perform the ramp-down stop in accordance with the set ramp-down time. If S6 is greater
than the number of pulses output within the ramp-down time, the instruction will output the number of the redundant
pulses with the output frequency of when the interrupt is triggered and then perform the ramp-down process.
9. If the output has entered the ramp-down process when the external input interrupt trigger occurs, the instruction will
6-715
AS Ser ies Pro gra mm in g M anu al
10. See the following timing diagram about the output, interrupt trigger, mask and relavant flags.(For the completion flag,
EN
S4 S5
S3
finish flag
S2
D1
Time
0
Pulse No.
S6
S1
11. The target frequency S2 of the instuction can be modified in the process of the pulse output.Since the number of
output pulses in the ramp-down section has been set when the instruction is enabled, the timing diagram for
_6 S3
Change S2
S2
D1
Time
Pulse No.
S6
12. Refer to DDRVI instruction for the selection of pulse output devices for D1 and D2. If the output points are not the
recommended ones, the direction output D2 will be affected by the scan cycle.
6-716
Cha p ter 6 App l ied Ins truc tio ns
Example 1:
Note:
1. When M0 changes from OFF to ON, Y0.0 starts to output the pulses. After more than 30,000 pulses are output, the
external interrupt is detected on X0.4. The value in D0 will increase by 1 and the pulse output stops after 20,000
pulses are output (S6:20,000). If the interrupt does not occur, the output will not stop till 100,000 pulses are output. 6_
2. If the number of output pulses is between 1~30,000, it belongs to the forepart mask section. The external interrupt
occurs at X0.4 at the moment and the instruction will not perform the operation of the ramp-down stop.
3. If the number of output pulses is between 70,000~100,000, it belongs to the rear mask section. The external
interrupt occurs at X0.4 at the moment and the instruction will still not perform the operation of the ramp-down stop.
Additional remark:
When the interrupt occurs for the mark alignment, the ramp-down process is performed and the output stops
When the interrupt for the mark alignment does not occur or takes no effect, DDRVM stops outputting the pulses
6-717
AS Ser ies Pro gra mm in g M anu al
S4: The number of output pulses in the forepart mask section. If the interrupt occurs in the section, the interrupt will
be ineffective for the mark alignment.
S5: The number of output pulses in the rear mask section. If the interrupt occurs in the section, the interrupt will be
ineffective for the mark alignment.
2. The mark alignment function is enabled in the ramp-up and target frequency and ramp-down sections.
_6
When the mark alignment function is not enabled:
The output will stop after 100,000 pulses are output when the mark alignment function is not enabled.
The operation of the mark alignment is performed when the number of pulses is 3000. The target frequency of 10kHZ can
6-718
Cha p ter 6 App l ied Ins truc tio ns
The operation of the mark alignment is performed when the number of pulses is 6000. The target frequency of 10kHZ can
be reached if S6 is 15,000.
The operation of the mark alignment is performed when the number of pulses is 50,000.
6_
6-719
AS Ser ies Pro gra mm in g M anu al
The operation of the mark alignment is performed when the number of pulses is 95,000.
The operation of the mark alignment is performed when the number of pulses is 95,000. After the mark alignment, the
number of output pulses for S6 is -1. (The output stops immediately.)
_6
6-720
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
D1
D2
Symbol:
Number of output pulses of X
S1 :
axis 6_
Number of output pulses of Y
S2 :
axis
Maximum point-to-point output
S3 :
frequency
D1 : Pulse output device for X axis
Explanation:
1. S1 and S2 specify the number of output pulses (relative positioning) of X axis and Y axis. Range: -2,147,483,648 ~
+2,147,483,647 (The “+/-” sign indicates the positive/negative direction).
2. S3 specifies the maximum point to point output frequency. Range: 1Hz ~ +200k Hz.
3. D1 and D2 are the output devices for X axis and Y axis respectively. Users can designate the following 6 axes for
output but the fixed direction output points can not be changed. The direction signal: OFF means the positive
direction and ON is the negative direction. If the preset “Pulse+direction” output mode is not used (default: 0),
6-721
AS Ser ies Pro gra mm in g M anu al
4. PLC will assign the value of S3 to X axis or Y axis which output the largest number of pulses. But if the numbers of
pulses which the two axes output are excessively different so that no proper output frequency can be calculated
through the numbers of their output pulses, PLC will automatically decrease the maximum point to point frequency
5. The parameters such as the start/end frequency and ramp-up/down time of axes are used in the execution of the
instruction. Instead of the originally configured parameters of axes, the X axis parameters are taken as the reference
source. For example, When X axis selects axis1 and Y axis selects axis 3 for the output, axis 1 parameters will be
taken as the parameter sources for the start frequency and ramp up/down time.
6. See the flags of axes and corresponding SM/SR in the following table.
7. The instruction has no limit to how many times it is used. But when the instruction is enabled, the instruction can not
execute the output till Y axis completes the output and is released if Y axis output is being used.
8. When the 2-axis synchronized pulse output is completed, the corresponding Completion flags of the two axes will be
set. Since the same timing for the completion of the 2-axis synchronized pulse output can not be ensured every time,
the execution of the next user program should go on after the corresponding Completion flags of the two axes are
judged simultaneously.
6-722
Cha p ter 6 App l ied Ins truc tio ns
Example:
Y軸
(0,0)
X軸
(-27000,-27000) (27000,-27000)
(0,-55000)
2. Steps:
Set the coordinates of four points (0, 0), (-27000, -27000), (0, -55000), (27000, -27000) (as the figure
above). Calculate the relative coordinates of the four points and obtain (-27000, -27000),
(27000, -28000), (27000, 28000), and (-27000, 27000). Place them in the 32-bit registers (D200, D202), (D204,
6_
6-723
AS Ser ies Pro gra mm in g M anu al
_6
3. Operation:
When PLC runs and M0 is ON, PLC will start the first point-to-point motion with the frequency of 100KHz. D0 will increase
by 1 whenever a point-to-point motion is completed and the second point-to-point motion will
start to execute automatically. The operation pattern repeats until the fourth point-to-point
motion is completed.
6-724
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
D1
D2
Symbol:
Number of output pulses of X
S1 :
axis
S2 :
Number of output pulses of Y 6_
axis
Maximum point-to-point output
S3 :
frequency
D1 : Pulse output device for X axis
Explanation:
1. S1 and S2 specify the number of output pulses (absolute positioning) of X axis and Y axis.
Example:
6-725
AS Ser ies Pro gra mm in g M anu al
A xis Y
(0,0)
Axis X
(0, -55,000)
2. Steps:
Set the four coordinates (-27000, -27000), (0, -55000), (27000, -27000) and (0, 0) (as the
figure above). Place them in the 32-bit registers (D200, D202), (D204, D206), (D208, D210),
(D212, D214).
_6
6-726
Cha p ter 6 App l ied Ins truc tio ns
3. Operation:
When PLC runs and M0 is ON, PLC will start the first point-to-point motion with the frequency of 100KHz. D0 will increase 6_
by 1 whenever a point-to-point motion is completed and the second point-to-point motion will
start to execute automatically. The operation pattern repeats until the fourth point-to-point
motion is completed.
6-727
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
S5
D1
D2
_6 - - AS
Symbol:
X axis target coordinate (Relative
S1 :
positioning)
Y axis target coordinate (Relative
S2 :
positioning)
S3 : The shift of the center
S5 : Function selection
Explanation:
1. S1, S2 and S3 respectively designate the X axis target coordinate, Y axis target coordinate (relative position) and the
shift of the center of a circle. Refer to the following clockwise arc operation for details.
2. D1 and D2 are the pulse output devices for X axis and Y axis respectively. Refer to DPPMR instruction for the
selection of output points and output mode of axes.
6-728
Cha p ter 6 App l ied Ins truc tio ns
3. S4 sets the target frequency for reference. The target reference frequency will be used for the prior calculation when
PLC plans the travel path for the arc after the instruction is enabled. But if the estimated calculation process can not
achieve the arc travel path, the output frequency will be decreased automatically so as to fulfill the synchronized arc
drawing function.
4. S5 is the setting value for function selection. When the setting value is 0, the arc resolution takes the 10° arc as the
basic angle for motion. When the setting value is 1, the arc resolution takes the 5° arc as the basic angle for motion.
When the setting value is not 1, 0 will be taken as the setting value for the execution of the instruction.
1. See the four quadrants (QI, QII, QIII and QIV) of a coordinate system as below. Point A indicates the current
II I
X
A
III IV
2. Point B is the target coordinates specified by S1 and S2. Point O is the center of a circle where point A and point B
are in. 6_
3. S3 is the distance that the center point O shifts by.
4. When the target point B is in QI and QIV of point A, the arc travel paths are performed as the solid lines in the figures
S3 >= 0
O
S3 < 0 B
A
r O
r
A
S3>= 0 S3< 0
5. When the target point B is in QII and QIII of point A, the arc travel paths are shown as the solid lines in the figures
6-729
AS Ser ies Pro gra mm in g M anu al
S3 < 0
O
S3 >= 0 A B O
r
r
B
S3>= 0 S3< 0
6. When of target point B, X axis coordinate = 0 and Y axis target coordinate >= 0, point B is defined as the point
staying in QI of point A. Whereas, if Y axis target coordinate < 0, point B is defined as the point staying in QIII of
point A.
Example:
_6
An ellipse= use DCICR instruction for the relative-position clockwise arc interpolation.
(123119,73206).
Taking (39930,-9982) as the start point, the obtained relative coordinates: (-49912,49912), (83188,83189),
6-730
Cha p ter 6 App l ied Ins truc tio ns
6_
When PLC runs and M1 is ON, PLC will start the drawing of the first segment of the arc. D1 will
increase by 1 whenever a segment of arc is completed and the second segment of the arc will start to
6-731
AS Ser ies Pro gra mm in g M anu al
execute automatically. The operation pattern repeats until the fourth segment of arc is completed.
When D1=1, using DCICR, PLC will perform the drawing of the first-segment arc from P1 to P2 with the shift of the
When D1=2, using DCICR, PLC will perform the drawing of the second-segment arc from P2 to P3 with the shift of
When D1=3, using DCICR, PLC will perform the drawing of the third-segment arc from P3 to P4 with the shift of the
When D1=4, using DCICR, PLC will perform the drawing of the fourth-segment arc from P4 to P1 with the shift of the
The absolute coordinates of the circle: P5(86213,15435) and P6(103048,37425). Taking (86213,15435)
as the start point, the relative coordinates of the center of the circle is (16835,21990).
_6 When PLC runs and M2 is ON, PLC will start to perform the relative-position circle drawing with the target reference
frequency of 20kHz.
6-732
Cha p ter 6 App l ied Ins truc tio ns
When PLC runs and M0 is ON, PLC will start to perform the first segment of 2-axis synchronized motion with the
6_
frequency of 50kHz. D1 will increase by 1 whenever a segment of 2-axis synchronized motion is completed and the
second segment of 2-axis synchronized motion will start to execute automatically. The operation pattern repeats until
When D1=1, PLC will start to draw the line from P7 to P8 with DPPMA.
When D1=2, PLC will start to draw the line from P8 to P9 with DPPMA.
When D1=3, PLC will start to draw the line from P9 to P7 with DPPMA.
6-733
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
S5
D1
D2
Symbol:
X axis target coordinate (Absolute
S1 :
positioning)
Y axis target coordinate (Absolute
S2 :
positioning)
S3 : The shift of the center
S5 : Function
Explanation:
1. S1 and S2 respectively designate the X axis target coordinate, Y axis target coordinate. For relevant
explanation, refer to DCICR instruction.
6-734
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
S5
D1
D2
S5 : Function
Explanation:
1. S1, S2 and S3 respectively designate the target coordinate on X axis, target coordinate on Y axis and the shift of the
center of a circle. Refer to the following operation of drawing the counterclockwise arc for details.
2. D1 and D2 are the output devices for X axis and Y axis respectively. Refer to DPPMR instruction for the selection of
output points and output mode of axes.
6-735
AS Ser ies Pro gra mm in g M anu al
3. S4 sets the target frequency for reference. The target reference frequency will be used for the prior calculation when
PLC plans the travel path for the arc after the instruction is enabled. But if the estimated calculation process can not
achieve the planned arc travel path, the output frequency will be decreased automatically so as to fulfill the
4. S5 is the setting value for function selection. When the setting value is 0, the arc resolution takes the 10° arc as the
basic angle for motion. When the setting value is 1, the arc resolution takes the 5° arc as the basic angle for motion.
When the setting value is not 1, 0 will be taken as the setting value for the execution of the instruction.
1. See the four quadrants (QI, QII, QIII and QIV) of a coordinate system as below. Point A indicates the current
II I
X
A
III IV
2. Point B is the target coordinates specified by S1 and S2. Point O is the center of a circle where point A and point B
_6 are in.
4. When the target point B is in QI and QIV of point A, the arc travel paths are performed as the solid lines in the two
S3 < 0
O
S3 >= 0 B
A
r O
r
A
S3>= 0 S3< 0
5. When the target point B is in QII and QIII of point A, the arc travel paths are shown as the solid lines in the figures
6-736
Cha p ter 6 App l ied Ins truc tio ns
S3 >= 0
O
S3 < 0 A
B
r O
r
B
S3>= 0 S3< 0
6. When X axis coordinate of target point B = 0 and Y axis coordinate >= 0, point B is defined as the point staying in QI
of point A. Whereas, if Y axis coordinate < 0, point B is defined as the point staying in QIII of point A.
Example:
6_
An ellipse= use DCICR instruction for the relative-position counterclockwise arc interpolation.
(-9982,39930)
Taking (39930,-9982) as the start point, the obtained relative coordinates: (83189,83188), (-49913,49913),
(-83188,-83189) and(49912,-49912).
6-737
AS Ser ies Pro gra mm in g M anu al
_6
6-738
Cha p ter 6 App l ied Ins truc tio ns
When PLC runs and M1 is ON, PLC will start the drawing of the first segment of clockwise arc with the frequency of
50kHz. D1 will increase by 1 whenever a segment of arc is completed and the second segment of arc will start to
execute automatically. The operation pattern repeats until the fourth segment of arc is completed.
When D1=1, using DCICCR, PLC will perform the drawing of the first-segment arc from P1 to P4 with the shift of the
When D1=2, using DCICCR, PLC will perform the drawing of the second-segment arc from P4 to P3 with the shift of
When D1=3, using DCICCR, PLC will perform the drawing of the third-segment arc from P3 to P2 with the shift of the
When D1=4, using DCICCR, PLC will perform the drawing of the fourth-segment arc from P2 to P1 with the shift of
A circle = use DCCMR instruction for the relative-position circle drawing. Refer to the example in API 2712 DCICR
for detailed operation.
A delta = use DPPMA for the absolute-position 2-axis synchronized motion. Refer to the example in API 2712
DCICR for detailed operation.
6_
6-739
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
S5
D1
D2
Symbol:
X axis target coordinate (Absolute
S1 :
positioning)
Y axis target coordinate (Absolute
S2 :
positioning)
S3 : The shift of the center
S5 : Function
Explanation:
1. S1 and S2 respectively designate the target coordinate on X axis, target coordinate on Y axis. For relevant
explanation, refer to DCICCR instruction.
6-740
Cha p ter 6 App l ied Ins truc tio ns
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
type INT
S1
S2
S3
S4
D1
D2
Symbol:
X axis coordinate of the center 6_
S1 :
(Relative positioning)
Y axis coordinate of the center
S2 :
(Relative positioning)
S3 : Function selection
Explanation:
1. S1 and S2 are respectively the X axis coordinate and Y axis coordinate of the center of a circle. (Relative position)
2. S3 is the setting value for function selection. When the setting value is 0, the arc resolution takes a 10° arc as the
basic angle for clockwise motion. When the setting value is 1, the arc resolution takes a 5° arc as the basic angle for
clockwise motion. When the setting value is 2, the arc resolution takes a 10° arc as the basic angle for
counterclockwise motion. When the setting value is 3, the arc resolution takes a 5° arc as the basic angle for
counterclockwise motion.
6-741
AS Ser ies Pro gra mm in g M anu al
3. D1 and D2 are the pulse output devices of X axis and Y axis respectively. Refer to DPPMR instruction for the
selection of output points and output mode of axes.
4. S4 sets the target frequency for reference. The target reference frequency will be used for the prior calculation when
PLC plans the travel path for the arc after the instruction is enabled. But if the calculation process which is estimated
can not achieve the planned arc travel path, the output frequency will be decreased automatically so as to fulfill the
When the X axis coordinate of the center point O=0, point O is defined as the point staying in QI of point A if Y axis
target coordinate >= 0. Whereas, if Y axis target coordinate < 0, point B is defined as the one staying in QIII of point
A.
Point A is the present position and point O is the target center, r is the radius of the circle as the figures below.
O O
r
A
_6 Center O in QI and QIV Center O in QII and QIII
O O
r
6-742
Cha p ter 6 App l ied Ins truc tio ns
Example:
1. Taking (40000, 50000) as the center O and (10000, 10000) as point A, draw a circle as below.
O (4 0000, 50000)
O
A (10000, 10000)
A
2. Steps:
S3=1 and the clockwise circle drawing is performed with a 5° as the basic motion angle.
When PLC runs and M0 is set to ON, the relative-position circle drawing starts.
6_
3. Operation:
When PLC runs and M0 is ON, PLC starts to perform the clockwise circle drawing with the frequency of 100kHz.
When the circle drawing is completed, SM461 and SM481 are ON.
6-743
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
D1
D2
Symbol:
_6 X axis coordinate of the center
S1 :
(Absolute positioning)
Y axis coordinate of the center
S2 :
(Absolute positioning)
S3 : Function selection
S4 : Target frequency
Explanation:
1. S1 and S2 are respectively the X axis coordinate and Y axis coordinate of the center of a circle. (Absolute
positioning). For other explanation, refer to DCCMR instruction.
6-744
Cha p ter 6 App l ied Ins truc tio ns
Example:
1. Taking (40000, 50000) as the center O and (10000, 10000) as point A, draw a circle as below.
O (4 0000, 50000)
O
A (10000, 10000)
A
2. Steps:
Fill the absolute X coordinate and Y coordinate (40000, 50000) in the instruction
S3 is 1 and the clockwise circle drawing is performed with a 5° as the basic motion angle.
When PLC runs and M0 is ON, the absolute-position circle drawing starts.
6_
3. Operation:
When PLC runs and M0 is ON, PLC starts to perform the clockwise circle drawing with the frequency of 100kHz.
When the circle drawing is completed, SM461 and SM481 are ON.
6-745
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S
D1
D2
Symbol:
The first output number in the position
S :
planning table
D1 : The output number which is being output
Switch flag at the end of the
D2 :
consecutive-number output
_6
Explanation:
1. S is the number listed in the position planning table. If the number does not exist in the table, the instruction will not
be executed, SM0 will be ON and the error code SR0=16#2027 will be kept.
2. S is the first output number when PLC is enabled. Refer to the value in D1 if there are consecutive-number outputs
during the output.
3. When one single number or the first one of consecutive numbers is output, the switch flag D2 will be set to OFF.
When the consecutive-number output reaches the output number to be switched to, D2 will be ON for a scan cycle
and will be ON again till the last number output is completed.
The example and timing diagram for the flag state switching are shown as below.
6-746
Cha p ter 6 App l ied Ins truc tio ns
M0
TPO
M0 EN D1 D100 D100 1 2 3
1 S D2 M100
M100
4. The switch flag D2 will be affected by PLC scan time. If the time for switching to the next number of output is shorter
than the scan time, the flag for switching to the number of output may not reset to OFF.
6_
6-747
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
Symbol:
A number listed in the position
S1 :
planning table
S2 : Target position
S3 : Target speed
_6 Explanation:
1. S1 is the number listed in the position planning table. If the number does not exist in the table or the number is not
under Single-axis point-to-point motion or Single-axis multi-segment motion, the instruction will not be executed,
2. S2 is the target position which is a 32-bit integer. If the mechanical unit conversion is used during the editing of the
position planning table in the software, please use the conversion instruction for modification first.
3. S3 is the target speed. The range: 1Hz~200,000Hz. (Note: The maximum speed of the output axis Y0 and Y2 can be
set to 4MHz for AS324MT.)
4. When the instruction is enabled to modify the parameters of the single axis which is outputting pulses, the modified
parameters will be kept in the table and will not be effective till the next output is started.
6-748
Cha p ter 6 App l ied Ins truc tio ns
5. The parameters modified by the instruction can only be modified while PLC is running. The last written parameter will
not be kept when the power turns OFF. The table which is edited in the software and downloaded to PLC is seen as
6_
6-749
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
type INT
S1
S2
S3
S4
Symbol:
A number listed in the position
S1 :
planning table
S2 : Target position of X axis
_6
S3 : Target position of Y axis
S4 : Target speed
Explanation:
1. S1 is the number listed in the position planning table. If the number does not exist in the table or the output of the
number does not belong to 2-axis linear interpolation, the instruction will not be executed, SM0 will be ON and the
2. S2 and S3 are respectively the target positions of X axis and Y axis which can only be 32-bit integers. If the
mechanical unit conversion is used during the editing of the position planning table in the software, please use the
6-750
Cha p ter 6 App l ied Ins truc tio ns
4. When the linear interpolation is executed, the target frequency S4 will automatically correspond to the output of an
axis which is farthest from its target position. If X axis and Y axis can not achieve the simultaneous reaching of the
target positions, PLC will automatically decelerate the frequency so as to make the two axes reach the target
positions simultaneously.
6. When the instruction is enabled to modify parameters of two axes any one of which is outputting, the modified
parameters of the two axes will be kept in the table and will not be effective till the next 2-axis output is started.
5. The parameters modified by the instruction can be modified only while PLC is running. The last written parameter will
not be kept when the power turns OFF. The table which is edited in the software and downloaded to PLC is seen as
6_
6-751
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
S5
Symbol:
A number listed in the position
S1 :
planning table
_6
S2 : X axis coordinate of the center
S5 : Target speed
Explanation:
1. S1 is the number listed in the position planning table. If the number does not exist in the table or the output of the
number does not belong to 2-axis arc interpolation, the instruction will not be executed, SM0 will be ON and the error
6-752
Cha p ter 6 App l ied Ins truc tio ns
2. S2 and S3 are respectively the coordinates of the center on X axis and Y axis. S4 is the shift of the center. The three
parameters can only be 32-bit integers. If the mechanical unit conversion is used during the editing of the position
planning table in the software, please use the conversion instruction for modification first.
3. S5 is the target speed. The range: 1Hz~200,000Hz. It is the referece speed for the actual output. PLC will
automatically decelerate the speed if the 2-axis synchronized output can not be achieved.
4. When the instruction is enabled to modify parameters of two axes any of which is outputting, the modified parameters
of the two axes will be kept in the table and will not be effective till the next 2-axis output is started.
5. The parameters modified by the instruction can be modified only while PLC is running. The last written parameter will
not be kept when the power turns OFF. The table which is edited in the software and downloaded to PLC is seen as
The instruction does not support the change of the clockwise and counterclockwise motion direction. For the direction
change, please add or modify the output parameters for arc interpolation in the position planning table in the software.
6_
6-753
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
Data
CNT
INT
type
S1
S2
S3
S4
D1
D2
Symbol:
_6
S1 : Relative target position A
S3 : Target speed
Target speed ratio adjusted value
S4 :
(floating point value)
D1 : Pulse output device
Explanation:
1. This high speed output instruction is used for a movement going back and forth between 2 target positions which
are converted from the two relative target positions specified by S1 and S2, applicable for warping machines in the
textile industry and winding & binding machines in the cable industry, and many more.
2. When the instruction starts the output, the relative positions S1 and S2 need be specified first so that the instruction
can make the prior calculation for switching to the next output. After the instruction is enabled, users can modify the
target positions which are to exectue but the outputting target positions can not be changed.
6-754
Cha p ter 6 App l ied Ins truc tio ns
DPPGB instruction is enabled. When S1 is 30,000 and S2 is -30,000, the motion will go toward the target position
A1=30,000.
If the pulse position >15,000, the relative positions are modified into S1:20,000 and S2:-20,000 and the target
position is A1=30,000 at the moment. The target positions obtained through calculation are B1=10,000(A1+ S2) and
A2=30,000(B1+ S1) since the outputting target positions can not be modified.
3. S3 is the target speed (32-bit integer), and S4 is the target speed ratio adjusted value (floating point). The actual
speed is the result of multiplying the values of S3 and S4 and then making the calculation result rounded down to the
32-bit integer. The acceptable input speed range is 1~200kHz. When values are out of range, PLC will
automatically take the minimum or the maximum of the range for operation. The ratio formula for the actual target
6_
speed is S3 x S4. For instance, target speed is 1kHz, the adjusted floating point is 1.2345 and the actual will be
1234Hz.
4. When the outputting is ongoing, the target speed and the adjusted ratio can be modified, and the result will be
updated to the actual output speed once the instruction is scanned. But it is suggested that the target speed should
not change too greatly in case the calculated deceleration will be affected.
5. The output points for D1 can only be Y0.0, Y0.2, Y0.4, Y0.6, Y0.8 and Y0.10 and it occupies 2 consecutive points
for output. The output sets and the output special register modes are listed below.
6. D2 is the flag indicating the changeable target speed and the adjusted ratio. When this flag is ON, that means the
executing target speed can be modified. When the flag is switching from ON to OFF, that means it is now
decelerating and the current target speed will be seen as the target speed of the next output.
6-755
AS Ser ies Pro gra mm in g M anu al
7. This instruction has no limitation on the execution times. But during execution, the appointed high speed axis
Speed
D2 = OFF
D2 = ON
S3 x S4
D1 +1 = OFF
S1
S2 Position
D1 +1 = ON
S3 x S4
D2 = ON
D2 = OFF
Example:
_6 When M0 is ON, DPPGB instruction starts to perform the motion going back and forth between the target positions which
are calculated from two relatives target positions specified by S1 and S2 at the actual target speed of 8500Hz(5000*1.7).
Y0.0 is the output point. Y0.1=OFF means the positive direction.
6-756
Cha p ter 6 App l ied Ins truc tio ns
6_
6-757
AS Ser ies Pro gra mm in g M anu al
Explanation:
1. After the instruction starts the output, modify the relative target positions A for S1 and B for S2.
b) Explanation:
When S1:30,000, S2:-30,000 and M0 has DPPGB instruction enabled, the motion goes toward the
position A1=30,000.
When D0=1 and the position: number of pulses in SR460 >15,000, the relative positions are changed into
At the moment, the target position is A1=30,000 since the outputting target position can not be modified. The
_6 target positions obtained through calculation are B1=2,000(A1-28,000), A2=28,000(B1+26,000).
When D0=2 and the position: number of pulses in SR460 >15,000, the relative positions are changed into
At the moment, the target position is A2=28,000 since the outputting target position can not be modified.
When D0=3 and the position: number of pulses in SR460 >15,000, the relative positions are changed into
When D0=4 and the position: number of pulses in SR460 >15,000, the relative positions are changed into
The target positions obtained through calculation are B4=0(A4-24,000) and A1=30,000(B4+30,000).
6-758
Cha p ter 6 App l ied Ins truc tio ns
Step S1: Relative position S2: Relative position Target position B Target position A
6_
6-759
AS Ser ies Pro gra mm in g M anu al
2802 CASD – – Setting the acceleration time and deceleration time of a servo
_6
6-760
Ch ap te r 6 App l ied Ins tr uc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S
Symbol:
Explanation:
1. Before the instruction is executed, please make sure that “Delta ASD-A2 control” is selected as the working mode of 6_
the function card 2 in the hardware configuration software HWCONFIG.
2. The range of S: 1~8. When the input value is greater than 8, PLC will automatically take 8 as the value of S for the
initialization. The set station addresses can only start from 1 and the middle numbers can not be skipped or
reserved.
3. SM1681 will be cleared to OFF when the instruction is enabled. SM1681 will be set to ON when all slaves complete
the initialization.
4. SM1682 will be set to ON when an error occurs during the execution of the communication. Besides, SR658 will
keep the number of the axis in which an error occurs and SR659 will keep the error code.
1. Before using Delta CANopen instructions, please mount AS-FCOPM card in AS series PLC (Slot 2 only) and make
sure that “Delta ASD-A2 control” is selected as the working mode of AS-FCOPM card 2 in the configuration software
HWCONFIG. The baud rate is set to 1000kbps or one of 125k, 250k, 500k and 1000kbps.
6-761
AS Ser ies Pro gra mm in g M anu al
_6
2. Connect AS series PLC to ASDA series with a CANopen communication cable as shown in the figure below. (The
terminal resistor of120Ω in AS-FCOPM card need be switched to ON so as to enable the terminal resistor.)
6-762
Ch ap te r 6 App l ied Ins tr uc ti ons
3. Follow the steps below for the basic setting on the panel of ASD-A2.
d. Set P3-01 to 0400 and the baud rate of the servo for CAN communication to 1.0Mbit/s. (The set baud rate should
e. Set a station address for every servo based on the quantity of servos. P3-00 of each servo is set to 1, 2 and 3 in
4. Download the example program and set M0 to ON. Then the instruction will make the servos of station addresses
1~3 initialized. When SM1681 is ON, it means the initialization is completed. (When the servo enters the CANopen
6_
5. The settings of the servo drive in the AS series initialization process are shown below.
a. Set P2-30 (auxiliary function) to 5. It means that the servo does not need to store the setting values in EEPROM
b. Reset P6-02 (PATH#1) to 0 and P6-06(PATH#3) to 0. (It indicates that PATH#1 & #3 in PR mode are cleared)
c. Set P3-06 (SDI source) to 16#0100. (It means that DI1~DI8 are controlled by the hardware, EDI9 is controlled by
e. Set P2-36 (EDI9) to 16#0101. (It means that the function of EDI9 is selected as Servo ON.)
f. Set P0-17 (CM1A) to 1. (It indicates that the mapping parameter is the pulse command output register CMD_O.)
g. Set P0-18 (CM2A) to 64. (It indicates that the mapping parameter is the pulse command register CMD_E.)
6-763
AS Ser ies Pro gra mm in g M anu al
h. Set P5-20~P5-35 (acceleration time) to 1. (It indicates that the acceleration time is 1ms.)
i. Set P5-60~P5-75 (target speed) to 1. (It indicates that the target speed is 0.1rpm)
j. Make PDO1 correspond to P5-07 (PR command), P0-01(Fault code) and P0-46 (state of DO point).
k. Make PDO2 correspond to P0-09 (CM1 state: CMD_O) and P0-10(CM2 state: CMD_E).
6. For the servo parameters set in the above six items a, b, f, g, j and k, do not use COPRW instruction to modify them.
7. When the absolute-type servo is used, users should use the COPRW communication instruction for writing 16#0100
to P3-12 so that relevant absolute-type servo parameters will be written to EEPROM at the moment when power is
off.
8. To modify the hardware DI signal setting of ASD-A2, Uses can set relevant DI signal configuration parameters by
manual or by using the COPRW instruction. COPRW can be used for the modification of the configuration after the
9. For more details about the servo parameters, refer to Delta servo operation manual.
_6
6-764
Ch ap te r 6 App l ied Ins tr uc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
Explanation:
3. If S2 is a non-zero value, the servo is enabled (Servo ON). If S2 is 0, the servo is disabled (Servo OFF).
4. Every servo has a flag (SM1651~M1658) for displaying own state. The actual servo state can be known from the flag.
When the flag is ON, the servo is Servo-ON. When the flag is OFF, the servo is Servo-OFF.
5. SM1682 will be set to ON if an error occurs during the communication. Besides, SR658 will keep the number of the
axis in which an error occurs and SR659 will keep the error code.
Example:
1. When M0 changes from OFF to ON, the INITC instruction starts to make the servos of station addresses 1~3
2. When M1 changes from OFF to ON, the ASDON instruction starts to make the servo of station address 2 enabled.
6-765
AS Ser ies Pro gra mm in g M anu al
_6
6-766
Ch ap te r 6 App l ied Ins tr uc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
Symbol:
S2 : Acceleration time(ms)
S3 : Deceleration time(ms)
6_
Explanation:
3. The range of S2 and S3: 0~32767. If the values of S2 and S3 are out of the range, 0 will be seen as the input value.
(Unit: ms)
4. The acceleration time is the period of time during which the servo speeds up from 0 to 3000.0 rpm. The deceleration
time is the period of time during which the servo speeds down from 3000.0 rpm to 0.
5. When the instruction is enabled, SM1681 will be cleared to OFF. When the servo has responded to the received
6. SM1682 will be set to ON when an error occurs during the communication. Besides, SR658 will keep the number of
the axis in which an error occurs and SR659 will keep the error code.
6-767
AS Ser ies Pro gra mm in g M anu al
Example:
1. When M0 changes from OFF to ON, the INITC instruction makes the servos of station addresses 1~3 initialized till
SM1681 is ON.
2. When M1 changes from OFF to ON and the target speed of the servo of station addresses 2 is 3000rpm, the CASD
instruction sets the acceleration time of servo 2 to 3000ms and the deceleration time to 9000ms.
3. If the target speed of servo 2 is 1000 rpm, the acceleration time and deceleration time will be as follows.
_6
6-768
Ch ap te r 6 App l ied Ins tr uc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
Symbol:
S3 : Target speed
6_
Explanation:
The execution of INITC and ASDON (servo ON) instructions must be finished before the instruction is executed.
2. The range of S2: -2147483648 ~ 2147483647. The +/- sign means the forward / reverse direction. The target position
is a relative position.
3. The unit of the value of S3: 0.1rpm.The range: 1~60000. It indicates 0.1~6000.0 rpm.
4. When the target position is reached, the corresponding finish flags of axes (SM1631~SM1638) will be ON.
6. SM1682 will be set to ON when an error occurs during the communication. Besides, SR658 will keep the number of
the axis in which an error occurs and SR659 will keep the error code.
6-769
AS Ser ies Pro gra mm in g M anu al
Example:
1. When M0 changes from OFF to ON, the INITC instruction starts to make the servos of station addresses 1~3
2. When M1 changes from OFF to ON, the ASDON instruction starts to make the servo of station address 2 enabled.
3. When M2 changes from OFF to ON, servo 2 moves to the relative position 100000 PUU at 100.0r/min.
_6
6-770
Ch ap te r 6 App l ied Ins tr uc ti ons
Explanation of special flags (SM) and registers (SR) related to ASD-A2 CAN communication instructions
Special flags (SM) and registers (SR) related to ASD-A2 CAN communication
Flag R/W ID. 1 ID. 2 ID. 3 ID. 4 ID. 5 ID. 6 ID. 7 ID. 8
The function of going back and forth is SM166 SM166 SM166 SM166 SM166 SM166 SM166 SM166
enabled. R/W
1 2 3 4 5 6 7 8
Only DDRVAC is supported.
The go-back/go-forth direction indication SM167 SM167 SM167 SM167 SM167 SM167 SM167 SM167
flag. R
1 2 3 4 5 6 7 8
Only DDRVAC is supported.
The number of the axis which has a 6_
R SR658
communication error
Servo parameters of axes correspond to special registers in the CAN communication as below.
Servo parameter name (Number) ID. 1 ID. 2 ID. 3 ID. 4 ID. 5 ID. 6 ID. 7 ID. 8
Alarm code(P0_01)
(hexadecimal) SR671 SR672 SR673 SR674 SR675 SR676 SR677 SR678
6-771
AS Ser ies Pro gra mm in g M anu al
0x0006 One of the servos is being used when the INITC instruction is executed.
_6
6-772
Ch ap te r 6 App l ied Ins tr uc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
Symbol:
S3 : Target speed
6_
Explanation:
1. Before the instruction is executed, the execution of INITC and ASDON (Servo ON) instructions must be finished
3. The range of S2: -2147483648 ~ 2147483647. The +/ - sign means the forward / reverse direction. The target position
is an absolute position.
4. Refer to DRVIC instruction for the explanation of other content and example.
Example 1:
1. When M0 changes OFF to ON, the INITC instruction makes the servos of station addresses 1~3 initialized till
SM1681 is ON.
2. When M1 changes from OFF to ON, the ASDON instruction starts to make the servo of station address 2 enabled.
6-773
AS Ser ies Pro gra mm in g M anu al
3. When M2 changes from OFF to ON, servo 2 moves from current position to the absolute position 100,000 PUU at
100.0r/min.
_6
Example 2:
1. Add one row of program to the program in example 1. When PLC runs and SM1662 is ON, the function of going back
2. As the figure shows below, the servo moves from current position 20,000 to the absolute target position 100,000 after
M2 is ON and then it goes back and forth between the absolute position 100,000 and 0.
The direction indication flag SM1672 is ON when the servo goes toward the target position for the first time after
Servo-ON. After that, the flag will repeat the state changing from ON to OFF.
3. The target position can be modified any time in the motion. But the timing for making the new target position valid is
the next cycle of when the servo goes back and forth.
6-774
Ch ap te r 6 App l ied Ins tr uc ti ons
6_
6-775
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
Symbol:
S2 Target speed
Explanation:
_6
1. The execution of INITC and ASDON (Servo ON) instructions must be finished before the instruction is executed.
3. The range of S2: -60000 ~ 60000. The +/- sign means the forward / reverse direction. Unit: 0.1rpm.
5. SM1682 will be set to ON when an error occurs during the communication. Besides, SR658 will keep the number of
the axis in which an error occurs and SR659 will keep the error code.
Example:
1. When M0 changes from OFF to ON, the INITC instruction starts to make the servos of station addresses 1~3
2. When M1 changes from OFF to ON, the ASDON instruction starts to make the servo of station address 2 enabled.
6-776
Ch ap te r 6 App l ied Ins tr uc ti ons
3. When M2 changes from OFF to ON, servo 2 moves at 100.0r/min until M2 is OFF.
6_
6-777
AS Ser ies Pro gra mm in g M anu al
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
INT
type
S1
S2
S3
Symbol:
st
S2 : The 1 – segment speed
nd
S3 : The 2 – segment speed
_6 Explanation:
1. The execution of INITC and ASDON (Servo ON) instructions must be finished before the instruction is executed.
5. When the servo returns to the home point, the corresponding finish flag of axes will be ON. Refer to DRVIC
instruction for the explanation of special flags (SM) and registers (SR).
6. SM1682 will be set to ON when an error occurs during the execution of the communication. Besides, SR658 will keep
the number of the axis in which an error occurs and SR659 will keep the error code.
Example:
1. When M0 changes from OFF to ON, the INITC instruction starts to make servo 1 initialized till SM1681 is ON.
2. When M1 changes from OFF to ON, the acceleration time (10000) and deceleration time (20000) of servo 1 are set
6-778
Ch ap te r 6 App l ied Ins tr uc ti ons
The 2-byte data are written to P5-04 of servo 1. When D100=5 and the writing of data is finished, M100 is ON.
The 4-byte data are written to P6-00 of servo 1. When D102=0 and the writing of data is finished, M101 is ON.
The 4-byte data are written to P6-01 of servo 1. When D104=0 and the writing of data is finished, M102 is
ON.
4. When M3 changes from OFF to ON, the homing function is enabled for servo 1.
6_
6-779
AS Ser ies Pro gra mm in g M anu al
_6
6-780
Ch ap te r 6 App l ied Ins tr uc ti ons
STRING
LWORD
WORD
LREAL
BOOL
REAL
UINT
DINT
LINT
TMR
CNT
Data
type INT
S1
S2
S3
S4
S5
D
Symbol: 6_
S1 : Station address of a servo
S2 : Request code
S3 : Index
S4 : Sub-index
S5 : Read/write device
Communication completion
D :
flag
Explanation:
1. The range of S1: 1~127. If the value is out of the range (<1 or >127), the minimum or maximum value will be
automatically seen as the value of S1 by the instruction.
2. S2 can only specify four types of request codes as shown in the following table.
6-781
AS Ser ies Pro gra mm in g M anu al
Reading the data. The data length is contained in the SDO response
H40 message.
3. For S3 and S4, refer to the object dictionary in Delta servo operation manual.
4. It is suggested that COPRW instruction should be executed after the execution of INITC instruction is finished in case
that the written parameter values may be overwritten by the INITC instruction. COPRW instruction is used for the
CANopen SDO communication. If the station address of a slave exceeds the range of 1~8, COPRW instruction can
5. SM1682 will be set to ON when an error occurs during the communication. Besides, SR658 will keep the number of
the axis in which an error occurs and SR659 will keep the error code.
Note: When COPRW instruction is used, users must edit the process of dealing with the communication errors in
order to avoid resulting in incorrect communication process incurred by unexpected communication errors.
When COPRW instruction is enabled for the first time, the instruction will send the command code immediately if
6-782
Ch ap te r 6 App l ied Ins tr uc ti ons
7. COPRW instruction only supports the following “Delta ASD-A2 control” mode for the hardware configuration setting.
Most of the parameters in Delta ASDA-A2 are displayed in the decimal format. Users can convert the parameters into
index addresses by using the formula: the index address of PX-YY=0x2000 +(X << 8)+ YY
1. When M0 changes from OFF to ON, the INITC instruction starts to make the servo of station addresses 1~3 initialized
2. When M1 changes from OFF to ON, PLC writes the 2-byte data in D100 to P5-04 of servo 3 by using the COPRW
3. When M2 changes from OFF to ON, PLC reads the value of P4-07 of servo 3 and the read value is stored in D106.
6-783
AS Ser ies Pro gra mm in g M anu al
_6
6-784
12
7
Chapter 7 Troubleshooting
Table of Contents
7.1 Troubleshooting ................................................................................ 7-2
7.1.1 Basic troubleshooting steps ............................................................. 7-2
7.1.2 Clear the States of Errors................................................................ 7-2
7.1.3 Troubleshooting SOP ...................................................................... 7-3
7.1.4 System Log ................................................................................... 7-4
7.4 Error Codes and LED Indicators for CPU Modules ............................ 7-18
7.4.1 Error Codes and LED Indicators for CPU Modules ..............................7-18
7.4.2 Error Codes and LED Indicators for Analog/Temperature Modules .......7-23
7.4.3 Error Codes and LED Indicators for Load Cell Module AS02LC .............7-24
7.4.4 Error Codes and LED Indicators for Module AS00SCM as a Communication
Module ........................................................................................7-25
7.4.5 Error Codes and LED Indicators for Module AS00SCM as a Remote
Module ........................................................................................7-25
7-1
AS Ser i es Pr o g r a m m i n g Ma n u a l
7.1 Troubleshooting
7.1.1 Basic troubleshooting steps
This chapter includes kinds of possible errors occurred during operation and the causes of them and what actions should
be taken to correct the errors.
PLC should be operated in a safe environment (the environmental, electronical, vibrational safeties should be
considered.)
Power supply should be correctly connected and supply power to the PLC.
Use the System Log function of the ISPSoft to check the system operation and the logs.
_7 Use the following methods to clear the status of errors when errors occurred. But if the source of error is not fixed, the
system will still show errors.
(1) Switch the state of the CPU model to STOP and then to RUN.
(4) Reset the CPU and set the settings to defaults and download the project again to operate.
7-2
Ch a p t er 7 Tr o u b l es h o o t i n g
Basic
troub leshoot in g No Refer to s ec tion 7 .1 .1 for
Basic troubleshooti ng steps
steps
done
Yes
Mo dule 1. Refer to s ec ti on 7 .1.4 f or the s ys tem l og
error 2. Refer to s ec ti on 7 .4 for error codes and
CP U mo d u le e r ro r L ED indic ators for CPU modules
o r mo d u le s er r or 3. Refer to s ec ti on 7 .3 for tr oubles hooting f or
I/O modules
CP U module
error
1. Refer to s ection 7 . 1. 4 for the s ys tem log
Yes 2. Refer to s ec ti on 7 .4 for error codes and
ERRO R L E D O N L ED indic ators for CPU modules
3. Refer to s ec ti on 7 .2 for tr oubles hooting f or
C PU modul es
No
No
No
No
No
Afte r g oi ng t hr ou gh
tro ub le sho oti ng s tep s,
Yes If the p roblem per sis ts , pleas e c ontact
the i ssu es a re s til l n ot s upport.
r eso lve d.
No
7-3
AS Series Programming Manual
(1) Click System Log on the PLC menu. PLC> System Log.
(2) After users click System Log on the PLC menu, the System Log window will appear. After users click Clear Log, the
error log in the window and the error log in the CPU module will be cleared, and the CPU module will be reset.
_7
Group No.: The number 1 indicates the error occurred in the CPU module or the right-side module 1. The number
2~16 indicates the error occurred in the remote module 1~15.
Module No.: The number 0 indicates the error occurred in the CPU module or the remote module. The number
1~32 indicates the error occurred in the right-side module of the CPU module / remote module. (The
number 1 represents the closest module to the CPU module or the remote module; this number
increases from the closest to the furthest to the CPU module or the remote module.) Note: Up to 8
extension modules can be connected to the right-side of the remote module.
PLC/Module name: Model names of the CPU modules, remote modules and the extension modules.
7-4
Ch a p t er 7 Tr o u b l es h o o t i n g
Date & Time: The error occurred date and time. The most recent occurred error will be listed on the
top.
The last column shows the relative descriptions for the error.
7-5
AS Ser i es Pr o g r a m m i n g Ma n u a l
Error
Code Description Solution Flag Log
(16#)
1300
Errors occurred in the remote Refer to section 12.3.4 for more information on the error
~ SM30 V
modules codes of the remote modules.
130F
The actual arrangement of the I/O
Check whether the settings in HWCONFIG are consistent
1402 modules is not consistent with the SM10 V
with the actual arrangement of the I/O modules.
settings.
The communication modules exceed
140B Check the total number of the communication modules. SM10 V
the limit of 4.
The extension modules exceed the
140D Check the total number of the extension modules. SM10 V
limit of 32.
The remote modules exceed the
Check the total number of the remote modules on the
140E limit of 8 on the right side of the CPU SM30 V
right side of the CPU module.
module.
1. Make sure the module is well-connected to the CPU
The ID of the extension module
1600 module and turn-on the modules again. SM10 V
exceeds the range.
2. If the error still occurs, please contact the factory.
1. Make sure the module is well-connected to the CPU
The ID of the extension module
1601 module and turn-on the modules again. SM10 V
cannot be set.
2. If the error still occurs, please contact the factory.
1. Make sure the module is well-connected to the CPU
The ID of the extension module is
1602 module and turn-on the modules again. SM10 V
duplicated.
2. If the error still occurs, please contact the factory.
1. Make sure the module is well-connected to the CPU
The extension module cannot be
1603 module and turn-on the modules again. SM10 V
operated.
2. If the error still occurs, please contact the factory.
1. Make sure the module is well-connected to the CPU
Extension module communication
1604 module and turn-on the modules again. SM10 V
timeout
2. If the error still occurs, please contact the factory.
1605 Hardware failure Please contact the factory. SM10 V
_7 1606
Errors on the function card of the Make sure the function card is well-connected to the CPU
SM10 V
communication module module and turn-on the modules again.
Check whether the external 24 V power supply to the
1607 The external voltage is abnormal. SM10 V
module is normal.
The Internal factory calibration or the
1608 Please contact the factory. SM10 V
CJC is abnormal.
1609
~ Reserved (Error codes for the extension modules)
160F
Check the program, compile the program again, and
200A Invalid instruction SM5 V
download the program again.
The number of the MODBUS TCP Check if the number of the superior devices exceeds the SM
6010 V
connections exceeds the range. limit of 32. 1092
The number of the EtherNet/IP Check if the number of the connections exceeds the SM
6011 V
connections exceeds the range. range of 16. 1093
7-6
Ch a p t er 7 Tr o u b l es h o o t i n g
Error
Code Description Solution Flag Log
(16#)
Check whether the external 24 V power supply to the
002A The external voltage is abnormal. SM7 V
module is normal.
Error
Code Description Solution Flag Log
(16#)
RTC cannot keep track of the
0026 Please contact the factory. SM218 V
current time
7.2.7 The LED Indicators of RUN and ERROR are Blinking Every 0.5
Seconds Simultaneously
This happens when the firmware of the CPU module is being upgraded. If this happens once the power is supplied to the
7-7
AS Ser i es Pr o g r a m m i n g Ma n u a l
CPU module, it means errors occurred during the previous firmware upgrade. Users need to upgrade the firmware again
or contact your point of purchase.
7.2.8 The LED Indicators of RUN and ERROR are Blinking One After
Another Every 0.5 Seconds.
This happens when the memory card of the CPU module is backing up / restoring / or saving.
7-8
Ch a p t er 7 Tr o u b l es h o o t i n g
A file in the memory card cannot be Check whether the file path is correct, or whether
0064 SM453 V
read. the file is damaged.
The initialization of Delta ASD-A2
1. Check the CANopen connection cable.
control has not yet been completed, the
1950 2. Check if the specific salve is working properly. - V
CANopen instructions cannot be
3. If nothing is wrong, initialize Delta ASD-A2 again.
executed.
Without using the FCOMP card or not in
the right mode for the ASDA-A2 while Make sure to use the FCOMP card in the function
2001 SM0 V
using the CANopen communication card 2 and check if the operation mode is correct.
instruction.
The device used in the program Check the program, compile the program again,
2003 SM0 V
exceeds the device range. and download the program again.
The operand n or the other constant Check the program, compile the program again,
200B SM0 V
operands K/H exceed the range. and download the program again.
Check the program, compile the program again,
200C The operands overlap. SM0 V
and download the program again.
The binary to the binary-coded decimal Check the program, compile the program again,
200D SM0 V
conversion is incorrect. and download the program again.
Check the program, compile the program again,
200E The string does not end with 00. SM0 V
and download the program again.
Check the program, compile the program again,
2012 Incorrect division operation SM0 V
and download the program again.
The value exceeds the range of values
Check the program, compile the program again,
2013 which can be represented by the SM0 V
and download the program again.
floating-point numbers.
Check the program, compile the program again,
The task designated by TKON/YKOFF
2014 and download the program again. SM0 V
is incorrect, or exceeds the range.
The instruction BREAK is written outside Check the program, compile the program again,
2017 SM0 V
of the FOR-NEXT. and download the program again.
1. Check the program, compile the program again,
No such position planning table number
2027 and download the program again. SM0 V
or the format is incorrect.
2. Check the settings of the position planning table.
The high speed output instruction is
Refer to SR28 for the record of the axis number and 7_
2028 being executed. Only one instruction - V
rearrange the output control procedures.
can be executed at a time.
Set the Ethernet parameter for the CPU module in
6004 The IP address filter is set incorrectly. SM1108 X
HWCONFIG again.
600D RJ45 port is not connected. Check the connection. SM1100 X
1. Check if there are devices using the same IP
There are devices using the same IP address.
6012 SM1101 V
address. 2. Check if there is more than 1 DHCP or BOOTP
server on the network.
Retry the email connection later. (This error does
not cause the PLC to stop running. Users can
6100 The email connection is busy. SM1113 X
perform the corresponding solution by means of the
related flag in the program.)
Set up the trigger attachment mode in HWCONFIG
The trigger attachment mode in the > CPU Module > Device Setting > Options >
6103 SM1113 X
email is set incorrectly. Ethernet Port Advanced > Email > Trigger Setting >
Trigger Attachment Mode.
7-9
AS Ser i es Pr o g r a m m i n g Ma n u a l
The attachment in the email does not Check whether the attachment exists in the
6104 SM1113 X
exist. memory card.
The attachment in the email is Check the size of the attachment. If the size is over
6105 SM1113 X
oversized. 2 MB, the file cannot be sent as an attachment.
Check for the correct address and set up the SMTP
There is an SMTP server response server in HWCONFIG > CPU Module > Device
6106 SM1113 X
timeout. Setting > Options > Ethernet Port Advanced >
Email again.
1. Check whether the status of the SMTP server is
normal.
There is an SMTP server response 2. Retry the sending of the email later. (This error
6107 SM1113 X
timeout. does not cause the PLC to stop running. Users
can perform the corresponding solution by
means of the related flag in the program.)
Check for the correct ID/Password and set up in
6108 SMTP verification failed HWCONFIG > CPU Module > Device Setting > SM1113 X
Options > Ethernet Port Advanced > Email again.
1. Check the program and the related special data
registers.
The remote communication IP address 2. Set the Ethernet parameter for the CPU module
6200 - X
set in the TCP socket function is illegal. in HWCONFIG CPU Module > Device Setting >
Options > Ethernet Port Advanced > TCP
Socket.
1. Check the program and the related special data
registers.
The local communication port set in the 2. Set the Ethernet parameter for the CPU module
6201 - X
TCP socket function is illegal. in HWCONFIG CPU Module > Device Setting >
Options > Ethernet Port Advanced > TCP
Socket.
1. Check the program and the related special data
registers.
The remote communication port set in 2. Set the Ethernet parameter for the CPU module
6202 - X
the TCP socket function is illegal. in HWCONFIG CPU Module > Device Setting >
Options > Ethernet Port Advanced > TCP
_7 Socket.
1. Check the program and the related special data
registers.
The device from which the data is sent 2. Set the Ethernet parameter for the CPU module
6203 - X
in the TCP socket function is illegal. in HWCONFIG CPU Module > Device Setting >
Options > Ethernet Port Advanced > TCP
Socket.
1. Check the program and the related special data
registers.
The device which receives the data in 2. Set the Ethernet parameter for the CPU module
6206 - X
the TCP socket function is illegal. in HWCONFIG CPU Module > Device Setting >
Options > Ethernet Port Advanced > TCP
Socket.
1. Check the program and the related special data
registers.
The data which is received through the 2. Set the Ethernet parameter for the CPU module
6208 - X
TCP socket exceeds the device range. in HWCONFIG CPU Module > Device Setting >
Options > Ethernet Port Advanced > TCP
Socket.
7-10
Ch a p t er 7 Tr o u b l es h o o t i n g
7 - 11
AS Ser i es Pr o g r a m m i n g Ma n u a l
7-12
Ch a p t er 7 Tr o u b l es h o o t i n g
7-13
AS Ser i es Pr o g r a m m i n g Ma n u a l
Digital I/O modules, analog I/O modules, temperature measurement modules, load cell modules, and network
modules can be installed in an AS series system. There are 2 types of error codes, for errors and for warning. The
CPU module and its modules will stop operating when errors occurred. The CPU modules and its modules will not
stop operating when warnings triggered.
Error
Description Solution
Code
16#1605 Hardware failure Please contact the factory.
16#1607 The external voltage is abnormal. Check the power supply.
The factory calibration or the CJC is
16#1608 Please contact the factory.
abnormal.
Error
Description Solution
Code
16#1801 The external voltage is abnormal. Check the power supply.
16#1802 Hardware failure Please contact the factory.
16#1804 The factory calibration is abnormal. Please contact the factory.
_7 16#1807 The CJC is abnormal. Please contact the factory.
The signal received by channel 1 exceeds
16#1808 Check the signal received by channel 1
the range of analog inputs (temperature).
The signal received by channel 2 exceeds
16#1809 Check the signal received by channel 2
the range of analog inputs (temperature).
The signal received by channel 3 exceeds
16#180A Check the signal received by channel 3
the range of analog inputs (temperature).
The signal received by channel 4 exceeds
16#180B Check the signal received by channel 4
the range of analog inputs (temperature).
7-14
Ch a p t er 7 Tr o u b l es h o o t i n g
Error
Description Solution
Code
16#1605 Hardware failure (e.g. the diver board) Please contact the factory.
16#1607 The external voltage is abnormal. Check the power supply.
Error
Description Solution
Code
16#1801 The external voltage is abnormal. Check the power supply.
16#1802 Hardware failure Please contact the factory.
16#1807 Diver board failure Please contact the factory.
The signal received by channel 1 exceeds
Check the signal received by channel 1 and the cable
16#1808 the range of analog inputs or the SEN
connections.
voltage is abnormal.
The signal received by channel 1 exceeds Check the value inputted in channel 1 and the setting of
16#1809
the weight limit. the maximum weight.
The factory calibration in channel 1 is
16#180A Check the weight calibration in channel 1.
incorrect.
The signal received by channel 2 exceeds
Check the signal received by channel 2 and the cable
16#180B the range of analog inputs or the SEN
connections.
voltage is abnormal.
The signal received by channel 2 exceeds Check the value inputted in channel 2 and the setting of
16#180C
the weight limit. the maximum weight.
The factory calibration in channel 2 is
16#180D Check the weight calibration in channel 1.
incorrect. 7_
Error
Description Solution
Code
1. Check if the module is securely installed.
16#1605 Hardware failure 2. Change and install a new AS00SCM or contact the
factory.
7-15
AS Ser i es Pr o g r a m m i n g Ma n u a l
Error
Description Solution
Code
1. Check if the function card is securely installed.
2. Change and install a new function card or contact the
factory.
16#1606 The setting of the function card is incorrect. 3. Check if the setting in HWCONFIG is consistent with
the actual setting in the function card.
4. Change and install a new AS00SCM or contact the
factory.
Error
Description Solution
Code
Check the parameter in HWCONFIG, and the parameter.
16#1802 Incorrect parameters
Download the parameter again.
1. Check whether the communication cable is
connected well.
2. Check if the station number and the communication
16#1803 Communication timeout
format are correctly set.
3. Check if the connection with the function card is
working fine.
1. Check the settings of the UD Link.
16#1804 The setting of the UD Link is incorrect.
2. Check the settings to trigger warnings in the PLC.
The following error codes can only be viewed via SCMSoft; when the following errors occurred, they will not be shown on
the LED indicators and the system will not send the error messages to the CPU module.
Error
Description Solution
Code
The settings in HWCONFIG and actual Check the settings in HWCONFIG and actual manual
16#0107 manual settings are not consistent for the settings for the function card 1.
_7 function card 1.
The settings in HWCONFIG and actual Check the settings in HWCONFIG and actual manual
16#0108 manual settings are not consistent for the settings for the function card 2.
function card 2.
Check the parameter in HWCONFIG, and the parameter.
16#0201 Incorrect parameters
Download the parameter again.
1. Check if the station number and the communication
format are correctly set.
16#0301 Function card 1 communication timeout
2. Check if the connection with the function card is
working fine.
1. Check if the station number and the communication
format are correctly set.
16#0302 Function card 2 communication timeout
2. Check if the connection with the function card is
working fine.
Invalid UD Link Group ID for the function 1. Check the settings of the UD Link.
16#0400
card 1 2. Check the settings to trigger warnings in the PLC.
Invalid UD Link Group ID for the function 1. Check the settings of the UD Link.
16#0401
card 2 2. Check the settings to trigger warnings in the PLC.
7-16
Ch a p t er 7 Tr o u b l es h o o t i n g
Error
Description Solution
Code
Invalid UD Link Command for the function 1. Check the settings of the UD Link.
16#0402
card 1 2. Check the settings to trigger warnings in the PLC.
Invalid UD Link Command for the function 1. Check the settings of the UD Link.
16#0403
card 1 2. Check the settings to trigger warnings in the PLC.
Error
Description Solution
Code
1. Check if the module is securely installed.
16#1301 Hardware failure 2. Change and install a new AS00SCM or contact the
factory.
1. Check if the function card is securely installed with
the AS-FCOPM card.
2. Change and install a new function card or contact the
factory.
16#1302 The setting of the function card is incorrect.
3. Check if the setting in HWCONFIG is consistent with
the actual setting in the function card.
4. Change and install a new AS00SCM or contact the
factory.
Error
Description Solution
7_
Code
Check the parameter in HWCONFIG, and the parameter.
16#1502 Incorrect parameters
Download the parameter again.
Make sure the module is well-connected to the CPU
16#1503 Extension module communication timeout
module and turn-on the modules again.
Error
Description Solution
Code
24VDC power supply is not sufficient and Check whether the 24 V power supply to the module is
16#1303 then is recovered from a low-voltage less normal.
than 10ms situation.
7-17
AS Ser i es Pr o g r a m m i n g Ma n u a l
d. LED indicator status: If the error occurs, the LED indicator is ON, OFF, or blinks.
Descriptions
Error type:
ON: A serious error occurs in the module.
CPU Error LED Blinking fast (every 0.2 seconds): unstable power supply or hardware
failure
Blinking normally (every 0.5 second): system program errors or system
cannot run.
Warning type:
Blinking slowly (every 1 second and stop for 3 seconds): a warning is
_7 triggered, but the system can still run.
OFF: a warning is triggered, but the system can still run. Users can
modify the rules of how a warning is triggered or use the SM/SR to show
the warnings.
7-18
Ch a p t er 7 Tr o u b l es h o o t i n g
7-19
AS Ser i es Pr o g r a m m i n g Ma n u a l
1502
~ Errors occurred in the remote modules Continue V
150F
1600 The ID of the extension module exceeds the range. Stop V
1601 The ID of the extension module cannot be set. Stop V
1602 The ID of the extension module is duplicated. Stop V
1603 The extension module cannot be operated. Stop V
1604 Extension module communication timeout Stop V
1605 Hardware failure Stop V
Errors on the function card of the communication
1606 Stop V
module
1607 The external voltage is abnormal. Stop V
The Internal factory calibration or the CJC is
1608 Stop V
abnormal.
1609
~ Reserved (Error codes for the extension modules) Stop V
160F
1800
~ Errors occurred in the extension modules Continue V
180F
1900
Heartbeat errors occurred in the slave of Delta
~ Continue V
ASD-A2 control.
191C
The initialization of Delta ASD-A2 control has not
_7 1950 yet been completed, the CANopen instructions Continue V
cannot be executed.
Without using the FCOMP card or not in the right
2001 mode for the ASDA-A2 while using the CANopen Continue V
communication instruction.
The device used in the program exceeds the device
2003 Continue V
range.
200A Invalid instruction Stop V
The operand n or the other constant operands K/H
200B Continue V
exceed the range.
200C The operands overlap. Continue V
The binary to the binary-coded decimal conversion
200D Continue V
is incorrect.
200E The string does not end with 00. Continue V
2012 Incorrect division operation Continue V
The value exceeds the range of values which can
2013 Continue V
be represented by the floating-point numbers.
7-20
Ch a p t er 7 Tr o u b l es h o o t i n g
7-21
AS Ser i es Pr o g r a m m i n g Ma n u a l
7-22
Ch a p t er 7 Tr o u b l es h o o t i n g
7-23
AS Ser i es Pr o g r a m m i n g Ma n u a l
7.4.3 Error Codes and LED Indicators for Load Cell Module AS02LC
7-24
Ch a p t er 7 Tr o u b l es h o o t i n g
7.4.5 Error Codes and LED Indicators for Module AS00SCM as a Remote
Module
7_
7-25
AS Ser i es Pr o g r a m m i n g Ma n u a l
MEMO
_7
7-26