Hide thumbs Also See for AH500:
Table of Contents

Advertisement

Quick Links

A�ELT"
IABU Headquarters
Delta Electronics, Inc.
Taoyuan Technology Center
No.18, Xinglong Rd., Taoyuan City,
Taoyuan County 33068, Taiwan
I
TEL: 886-3-362-6301
FAX: 886-3-371-6301
Asia
Delta Electronics (Jiangsu) Ltd.
Wujiang Plant 3
1688 Jiangxing East Road,
Wujiang Economic Development Zone
Wujiang City, Jiang Su Province,
People's Republic of China (Post code: 215200)
I
TEL: 86-512-6340-3008
FAX: 86-769-6340-7290
Delta Greentech (China) Co., Ltd.
238 Min-Xia Road, Pudong District,
ShangHai, P.R.C.
Post code : 201209
I
TEL: 86-21-58635678
FAX: 86-21-58630003
Delta Electronics (Japan), Inc.
Tokyo Office
2-1-14 Minato-ku Shibadaimon,
Tokyo 105-0012, Japan
I
TEL: 81-3-5733-1111
FAX: 81-3-5733-1211
Delta Electronics (Korea), Inc.
1511, Byucksan Digital Valley 6-cha, Gasan-dong,
Geumcheon-gu, Seoul, Korea, 153-704
I
TEL: 82-2-515-5303
FAX: 82-2-515-5302
Delta Electronics lnt'I (5) Pte Ltd
4 Kaki Bu kit Ave 1, #05-05, Singapore 417939
I
TEL: 65-6747-5155
FAX: 65-6744-9228
Delta Electronics (India) Pvt. Ltd.
Plot No 43 Sector 35, HSIIDC
Gurgaon, PIN 122001, Haryana, India
I
TEL : 91-124-4874900
FAX : 91-124-4874945
Americas
Delta Products Corporation (USA)
Raleigh Office
P.O. Box 12173,5101 Davis Drive,
Research Triangle Park, NC 27709, U.S.A.
I
TEL: 1-919-767-3800
FAX: 1-919-767-8080
Delta Greentech (Brasil) 5.A
Sao Paulo Office
Rua ltapeva, 26 - 3
°
andar Edificio ltapeva One-Bela Vista
01332-000-Sao Paulo-SP-Brazil
I
TEL: +55 11 3568-3855
FAX: +55 11 3568-3865
Europe
Deltronics (The Netherlands) B.V.
Eindhoven Office
De Witbogt 15, 5652 AG Eindhoven, T he Netherlands
I
TEL: 31-40-2592850
FAX: 31-40-2592851
AH-0109720-03
*We reserve the right to change the information in this catalogue without prior notice.
:t
UI
0
,,
0
..,
0
IC
..,
m
3
3
AHSOO
Programming Manual
-
2018-06-05
www.delta.corn.tw/ia

Advertisement

Table of Contents
loading

Summary of Contents for Delta AH500

  • Page 1 1511, Byucksan Digital Valley 6-cha, Gasan-dong, Geumcheon-gu, Seoul, Korea, 153-704 AHSOO TEL: 82-2-515-5303 FAX: 82-2-515-5302 Delta Electronics lnt'I (5) Pte Ltd 4 Kaki Bu kit Ave 1, #05-05, Singapore 417939 Programming Manual TEL: 65-6747-5155 FAX: 65-6744-9228 Delta Electronics (India) Pvt. Ltd.
  • Page 2 AH500 Programming Manual Revision History Version Revision Date The first version is published. 2012/11/09 1. Chapter 1: updated the model description in section 1.1.2 2. Chapter 2: updated device list in section 2.1.1, latched areas in the device range in section 2.1.4, strings in section 2.2.3, special auxiliary relays in section 2.2.7, refresh time of special...
  • Page 3 Program Organization Units and Tasks ..........1-11 Chapter 2 Devices Introduction of Devices ................2-2 2.1.1 Devise List ..................2-2 2.1.1.1 AH500 Basic CPU Modules (AHCPU500/510/520/530) ....2-2 2.1.1.2 AH500 Advanced CPU Modules (AHCPU501/511/521/531) .... 2-3 2.1.2 Basic Structure of I/O Storages ............2-4 2.1.3 Relation between the PLC Action and the Device Type ....
  • Page 4 2.2.15 Refresh Time of Special Data Registers ........2-80 2.2.16 Additional Remarks on Special Auxiliary Relays and Special Data Registers ..................2-82 2.2.17 Link Registers ................2-98 2.2.18 Index Registers ................2-98 Chapter 3 Instruction Tables Instructions .................... 3-2 3.1.1 Basic Instructions ................
  • Page 5 6.2.1 List of Arithmetic Instructions............6-36 6.2.2 Explanation of Arithmetic Instructions ..........6-37 Data Conversion Instructions ..............6-73 6.3.1 List of Data Conversion Instructions ..........6-73 6.3.2 Explanation of Data Conversion Instructions ........6-74 Data Transfer Instructions ..............6-111 6.4.1 List of Data Transfer Instructions ........... 6-111 6.4.2 Explanation of Data Transfer Instructions........
  • Page 6 6.15 Module Instructions ................6-315 6.15.1 List of Module Instructions ............6-315 6.15.2 Explanation of Module Instructions ..........6-316 6.16 Floating-point Number Instructions ............6-321 6.16.1 List of Floating-point Number Instructions........6-321 6.16.2 Explanation of Floating-point Number Instructions ....... 6-322 6.17 Real-time Clock Instructions ..............
  • Page 7 Chapter 7 Error Codes Error Codes and LED Indicators ............... 7-2 7.1.1 CPU Modules ..................7-2 7.1.2 Analog I/O Modules and Temperature Measurement Modules ..7-22 7.1.3 AH02HC-5A/AH04HC-5A ..............7-24 7.1.4 AH05PM-5A / AH10PM-5A / AH15PM-5A ........7-24 7.1.5 AH20MC-5A ..................7-25 7.1.6 AH10EN-5A / AH-15EN-5A ..............7-26 7.1.7 AH10SCM-5A / AH15SCM-5A ............7-27 7.1.8...
  • Page 8: Table Of Contents

    Chapter 1 Introduction Table of Contents Overview ....................1-2 1.1.1 Related Manuals ................1-2 1.1.2 Model Description ................1-2 Software ....................1-10 1.2.1 Program Editor .................1-10 1.2.2 Program Organization Units and Tasks ..........1-12 1 - 1...
  • Page 9: Overview

    This manual introduces the programming of the AH500 series programmable logic controllers, the basic instructions, and the applied instructions. 1.1.1 Related Manuals The related manuals of the AH500 series programmable logic controllers are composed of the following.  AH500 Quick Start It guides users to use the system before they read the related manuals.
  • Page 10 Ch a pt er 1 In tr od uc t i o n Classification Model Name Description It is an advanced CPU module with one built-in Ethernet port, one built-in RS-485 port, one built-in USB port, and AHCPU501-EN one built-in SD interface. It supports 768 inputs/outputs. The program capacity is 48K steps.
  • Page 11 AH 5 00 Pr ogr am m ing Ma n ua l Classification Model Name Description port, one built-in RS-485/RS-232 port, one built-in USB port, and one built-in SD interface. It supports 65536 inputs/outputs. The program capacity is 1M steps. AHBP04M1-5A Four-slot main backplane for a CPU/RTU rack Main...
  • Page 12 Ch a pt er 1 In tr od uc t i o n Classification Model Name Description Terminal block 12~24 V DC 0.5 A AH16AN01P-5A 16 outputs Sourcing output Terminal block 12~24 V DC 0.1 A AH32AN02T-5A 32 outputs Sinking output Terminal block 12~24 V DC 0.1 A...
  • Page 13 AH 5 00 Pr ogr am m ing Ma n ua l Classification Model Name Description 8 outputs Relay Terminal block 24 V DC 5 mA 8 inputs 12~24 V DC AH16AP11T-5A 0.5 A 8 outputs Sinking output Terminal block 24 V DC 5 mA 8 inputs...
  • Page 14 (Four axes: 1 MHz; Two axes: 200 kHz) module AH15PM-5A Four-axis pulse train motion control module (1 MHz ) Twelve-axis DMCNET (Delta Motion Control Network) AH20MC-5A motion control module (10 Mbps) It is an Ethernet communication module. It can function as a mater or a slave.
  • Page 15 AH 5 00 Pr ogr am m ing Ma n ua l Classification Model Name Description One part of communication is isolated from the other part of the communication, and one part of power is isolated from the other part of the power. It is a DeviceNet communication module.
  • Page 16 Ch a pt er 1 In tr od uc t i o n Classification Model Name Description I/O external terminal module for AH04HC-5A and UB-10-IO16C AH20MC-5A UB-10-IO24C I/O external terminal module for AH10PM-5A UB-10-IO34C I/O external terminal module for AH15PM-5A Space module AHASP01-5A Space module used for an empty I/O slot...
  • Page 17: Software

    AH 5 00 Pr ogr am m ing Ma n ua l 1.2 Software 1.2.1 Program Editor The outline of program editor ISPSoft:  There are five types of programming languages, including the instruction list, the structure text, the ladder diagram, the sequential function chart, and the function block diagram. ...
  • Page 18 Ch a pt er 1 In tr od uc t i o n  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.
  • Page 19: Program Organization Units And Tasks

    AH 5 00 Pr ogr am m ing Ma n ua l 1.2.2 Program Organization Units and Tasks The POUs (Program Organization Units) are the basic elements which constitute the PLC program. Differing from the traditional PLC program, the character of the program framework introduced by IEC 61131-3 lies in the fact that the large program is divided into several small units.
  • Page 20 Devices Table of Contents Introduction of Devices ................2-2 2.1.1 Devise List ..................2-2 2.1.1.1 AH500 Basic CPU Modules (AHCPU500/510/520/530) ....2-2 2.1.1.2 AH500 Advanced CPU Modules (AHCPU501/511/521/531) ... 2-3 2.1.2 Basic Structure of I/O Storages ............2-4 2.1.3 Relation between the PLC Action and the Device Type ....2-4 2.1.4...
  • Page 21: Introduction Of Devices

    This section gives an account of values/strings processed by the PLC. It also describes the functions of devices which include input/output/auxiliary relays, timers, counters, and data registers. 2.1.1 Devise List 2.1.1.1 AH500 Basic CPU Modules (AHCPU500/510/520/530) Type Device name Number of devices...
  • Page 22: Ah500 Advanced Cpu Modules (Ahcpu501/511/521/531)

    ISPSoft, for example, for F500, simply input 500.0. *3: The strings are notated by “$” in chapters 5 and 6, whereas they are represented by “ ” in ISPSoft, for example, for “1234”, simply input 1234. 2.1.1.2 AH500 Advanced CPU Modules (AHCPU501/511/521/531) Type Device name...
  • Page 23: Basic Structure Of I/O Storages

    AH 5 00 Pr ogr am m ing Ma n ua l Type Device name Number of devices Range Index register E0~E31 16 bits: -32768~32767 Decimal system 32 bits: -2147483648~2147483647 16 bits: 16#0~16#FFFF Hexadecimal system 32 bits: 16#0~16#FFFFFFFF Constant* Single-precision + 38 32 bits: ±1.17549435 ~±3.40282347...
  • Page 24: Latched Areas In The Device Range

    Counter The default range is C0~C2047. 32-bit counter The default range is HC0~HC63. AH500-EN/RS2: The default range is D0~D16383. AH501-EN/RS2: The default range is D0~D24575. Data register The default range is D0~D32767. At most 32768 devices can be latched areas.
  • Page 25: Functions Of Devices

    AH 5 00 Pr ogr am m ing Ma n ua l 2.2 Functions of Devices The procedure for processing the program in the PLC:  Regenerating the input signal: 1. Before the program is executed, the state of the external input signal is read into the memory of Input ter minal X the input signal.
  • Page 26: Floating-Point Numbers

    Ch a pt er 2 De v ic es The decimal number in the PLC is used as  the setting value of the timer (T) or the setting value of the counter (C/HC). For example, TMR C0 50 (constant K). ...
  • Page 27: Double-Precision Floating-Point Numbers

    ±2 , and correspond to the range from ±1.1755×10 to ±3.4028×10 The AH500 series PLC uses two consecutive registers to form a 32-bit floating-point number. Take (D1, D0) for example. D1 (b 15 ~b 0) D0 (b 15 ~b 0)
  • Page 28: Decimal Floating-Point Numbers

    Ch a pt er 2 De v ic es Step 4: Combine the sign bit, the exponent, and the mantissa to form the floating-point number. 0 10000011 01110000000000000000000 =41B80000 23 is represented by the double-precision floating-point number. Step 1: Convert 23 into the binary number, i.e. 23.0=10111. Step 2: Normalize the binary number, i.e.
  • Page 29: Input Relays

    AH 5 00 Pr ogr am m ing Ma n ua l The string is an even number. 16#62 (b) 16#61 (a) 16#64 (d) 16#63 (c) 0 (NULL) The string is an odd number. 16#62 (b) 16#61 (a) 16#64 (d) 16#63 (c) 0 (NULL) 16#65 (e)
  • Page 30: Output Relays

    Ch a pt er 2 De v ic es  The input number (the decimal number): For the PLC, the input numbers start from X0.0. The number of inputs varies with the number of inputs on the digital input/output modules, and the inputs are numbered according to the order in which the digital input/output modules are connected to the CPU module.
  • Page 31: Special Auxiliary Relays

    AH 5 00 Pr ogr am m ing Ma n ua l 2.2.7 Special Auxiliary Relays Every special auxiliary relay has its specific function. Please do not use the special auxiliary relays which are not defined. The special auxiliary relays and their functions are listed as follows. As to the SM numbers marked “*”, users can refer to the additional remarks on special auxiliary relays/special data registers.
  • Page 32 Ch a pt er 2 De v ic es STOP    Function STOP The receiving of data through COM1 is ○ ○ ○ × SM108 × – – – R/W OFF complete. The receiving of data through COM2 is ○...
  • Page 33 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP Port 4 connection status of backplane 2 (1 ○ ○ ○ OFF *SM421 – – R OFF × × redundant extension backplane) Port 2 connection status of backplane 3 (2 ○...
  • Page 34 Ch a pt er 2 De v ic es STOP    Function STOP from bit 0. It is the matrix bit search flag. When the ○ ○ ○ ○ ○ OFF SM610 matching bits are compared, the comparison –...
  • Page 35 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP It sets the counting mode of HC13. (HC13 ○ ○ ○ ○ ○ OFF SM634 – – R/W OFF counts down when SM634 is ON.) It sets the counting mode of HC14.
  • Page 36 Ch a pt er 2 De v ic es STOP    Function STOP It sets the counting mode of HC40. (HC40 ○ ○ ○ ○ ○ OFF SM661 – – R/W OFF counts down when SM661 is ON.) It sets the counting mode of HC41.
  • Page 37 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP The execution of the instruction INCD is ○ ○ ○ ○ ○ OFF SM688 – – R/W OFF complete. ○ ○ ○ ○...
  • Page 38 Ch a pt er 2 De v ic es STOP    Function STOP × ○ ○ OFF SM719 Enabling Modbus TCP connection 20 × – – R/W OFF 1.01 × ○ ○ OFF SM720 Enabling Modbus TCP connection 21 ×...
  • Page 39 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP × ○ × ○ ○ OFF SM748 Enabling Modbus TCP connection 49 – – R/W OFF × ○ × ○ ○ OFF SM749 Enabling Modbus TCP connection 50 –...
  • Page 40 Ch a pt er 2 De v ic es STOP    Function STOP × ○ × ○ ○ OFF SM777 Enabling Modbus TCP connection 78 – – R/W OFF × ○ × ○ ○ OFF SM778 Enabling Modbus TCP connection 79 –...
  • Page 41 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP × ○ × ○ ○ OFF SM806 Enabling Modbus TCP connection 107 – – R/W OFF × ○ × ○ ○ OFF SM807 Enabling Modbus TCP connection 108 –...
  • Page 42 Ch a pt er 2 De v ic es STOP    Function STOP ○ ○ OFF SM836 An error occurs in Modbus TCP connection 9. × × – – 1.01 ○ ○ OFF SM837 An error occurs in Modbus TCP connection 10. ×...
  • Page 43 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP × ○ × ○ ○ OFF SM865 An error occurs in Modbus TCP connection 38. – – R OFF × ○ × ○ ○...
  • Page 44 Ch a pt er 2 De v ic es STOP    Function STOP × ○ × ○ ○ OFF SM894 An error occurs in Modbus TCP connection 67. – – × ○ × ○ ○ OFF SM895 An error occurs in Modbus TCP connection 68. –...
  • Page 45 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP × ○ × ○ ○ OFF SM924 An error occurs in Modbus TCP connection 97. – – R OFF × ○ × ○ ○...
  • Page 46 Ch a pt er 2 De v ic es STOP    Function STOP SM953 An error occurs in Modbus TCP connection 126. × ○ × ○ ○ OFF – – SM954 An error occurs in Modbus TCP connection 127. × ○ ×...
  • Page 47 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP When trigger 2 is triggered and the email has ○ ○ ○ OFF *SM1129 – – R OFF × × been sent successfully; SM1129 is ON. When trigger 2 is triggered but the email cannot ○...
  • Page 48 Ch a pt er 2 De v ic es STOP    Function STOP When trigger 4 is triggered and the attachment ○ ○ ○ OFF *SM1155 – – × × is not found, SM1155 is ON. ○ ○ ○ OFF *SM1156 It is the switch of trigger 5 in the email.
  • Page 49 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP When trigger 7 is triggered and the email is ○ ○ ○ OFF *SM1181 – – R OFF × × being sent; SM1181 is ON. When trigger 7 is triggered and there is an ○...
  • Page 50 Ch a pt er 2 De v ic es STOP    Function STOP *SM1289 TCP socket 3─The connection is being started. × ○ ○ ○ OFF – – × *SM1290 TCP socket 3─The connection is being closed. × ○...
  • Page 51 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP UDP socket 1─The connection has been ○ ○ ○ OFF *SM1334 – – R OFF × × started. *SM1335 UDP socket 1─The data has been received. ○...
  • Page 52 Ch a pt er 2 De v ic es STOP    Function STOP TCP socket 2─Start to send an odd number of ○ ○ OFF SM1376 × × R/W OFF bytes 1.05 TCP socket 3─Start to send an odd number of ○...
  • Page 53 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP × ○ ○ ○ OFF Enabling the Modbus connection of COM1 – – R/W OFF × Assignment of the slaves by users in the PLC ○...
  • Page 54 Ch a pt er 2 De v ic es STOP    Function STOP ↓ SM1630 SM1720 Changing the function code used for a PLC link ↓ ○ ○ × × × OFF OFF – R/W OFF to 0x04 (slave 1~32) SM1751 SM1752↓...
  • Page 55 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP ○ ○ SM1848 Block 25~56 for an Ether link is active. × × × OFF – – R OFF ↓ COM2 finishes reading data from slave 1~32 by ○...
  • Page 56 Ch a pt er 2 De v ic es STOP    Function STOP The data is sent by using the instruction ○ ○ ○ OFF OFF *SM2018 × × OFF R/W OFF EMDRW 4. The PLC waits for the data after the instruction ○...
  • Page 57: Refresh Time Of Special Auxiliary Relays

    AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP An error occurs when the instruction EMDRW 8 ○ ○ ○ OFF OFF *SM2045 × × R OFF is used. There is a timeout after the instruction EMDRW ○...
  • Page 58 Ch a pt er 2 De v ic es Limited Special auxiliary Refresh time relay Users set the flag to ON, and the system automatically resets it to OFF. SM22, SM23, SM24 The log is cleared when the flag is ON. The system automatically sets the flag to ON and resets it to OFF.
  • Page 59 AH 5 00 Pr ogr am m ing Ma n ua l Limited Special auxiliary Refresh time relay 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.
  • Page 60 Ch a pt er 2 De v ic es Limited Special auxiliary Refresh time relay 1. The flag is refreshed after the Modbus TCP data exchange table AH5×1 is downloaded. 2. The flag is refreshed after the system restoration is executed. 1.
  • Page 61 AH 5 00 Pr ogr am m ing Ma n ua l Limited Special auxiliary Refresh time relay SM1132 is ON when the trigger is enabled and there is an SMTP SM1132 server response timeout. SM1133 is ON when the trigger is enabled and there is an SMTP SM1133 server response error.
  • Page 62 Ch a pt er 2 De v ic es Limited Special auxiliary Refresh time relay SM1161 is ON when the trigger is enabled and the mail has been SM1161 sent. SM1162 is ON when the trigger is enabled and there is an SMTP SM1162 server response timeout.
  • Page 63 AH 5 00 Pr ogr am m ing Ma n ua l Limited Special auxiliary Refresh time relay SM1190 is ON when the trigger is enabled and the last mail has SM1190 been sent in error. SM1191 is ON when the trigger is enabled and the mail has been SM1191 sent.
  • Page 64 Ch a pt er 2 De v ic es Limited Special auxiliary Refresh time relay SM1596 is ON when the COM1-Modbus connection is enabled AH5×1 and an error occurs. SM1597~SM11630 Users set the flag to ON and reset it to OFF. SM1720~SM1751 Users set the flag to ON and reset it to OFF.
  • Page 65: Stepping Relays

    AH 5 00 Pr ogr am m ing Ma n ua l Limited Special auxiliary Refresh time relay SM2018 User define. The flag is refreshed, after the transmission is done. SM2019 The flag is refreshed when the instruction EMDRW is executed. SM2020 The flag is refreshed when the instruction EMDRW is executed.
  • Page 66: Timers

    Ch a pt er 2 De v ic es There are 2048 stepping relays, i.e. S0~S2047. Every stepping relay is like an output relay in that it has an output coil, contact A, and contact B. It can be used several times in the program, but it can not directly drive the external load.
  • Page 67: Counters

    AH 5 00 Pr ogr am m ing Ma n ua l The accumulative timer When the instruction TMR is executed, the accumulative timer begins to count. As the value of the timer matches the setting value, the output coil is ON. As long as users add the letter S in front of the letter T, the timer becomes the accumulative timer.
  • Page 68 Ch a pt er 2 De v ic es Item 16-bit counter setting value. When the instruction RST is executed, the current value is Reset cleared to zero, and the contact is reset of OFF. Action of the contact After the scan is complete, the contact acts. The function of the counter: Each time the input switches from OFF to ON, the value of the counter increases by one increment.
  • Page 69: 32-Bit Counters

    AH 5 00 Pr ogr am m ing Ma n ua l X0 .0 X0 .1 Setting v alue Current v alue o f C0 Y0 .0 a nd C0 2.2.12 32-bit Counters The characteristics of the 32-bit counter: Item 32-bit counter Type General type...
  • Page 70: Data Registers

    Ch a pt er 2 De v ic es ×10.0 drives S621 to determine whether the counter HC0 is the addition counter or the subtraction counter. When ×11.0 is switched from OFF to ON, the instruction RST is executed, the current value of the counter HC0 is cleared to zero, and the contact is switched OFF.
  • Page 71: Special Data Registers

    AH 5 00 Pr ogr am m ing Ma n ua l register, i.e. (D+3, D+2, D+1, D) in which the register whose number is smaller represents the lower 16 bits. The highest bit represents either a positive sign or a negative sign, and the values which can be stored in the data registers range from -9,223,372,036,854,776 to +9,223,372,036,854,775,807.
  • Page 72 Ch a pt er 2 De v ic es STOP    Function STOP ○ ○ ○ ○ ○ *SR40 Number of error logs – – – ○ ○ ○ ○ ○ *SR41 Error log pointer – – – Error log 1: The rack number and the slot ○...
  • Page 73 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP ○ ○ ○ ○ ○ *SR82 Error log 7: The day and the hour – – – ○ ○ ○ ○ ○ *SR83 Error log 7: The minute and the second –...
  • Page 74 Ch a pt er 2 De v ic es STOP    Function STOP ○ ○ ○ ○ ○ *SR124 Error log 14: The year and the month – – – ○ ○ ○ ○ ○ *SR125 Error log 14: The day and the hour –...
  • Page 75 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP Number of times the command is resent ○ ○ ○ ○ ○ *SR211 – – – through COM1 16#0 ○ ○ ○ *SR212 Communication protocol of COM2 ×...
  • Page 76 Ch a pt er 2 De v ic es STOP    Function STOP second ○ ○ ○ ○ ○ *SR249 Download log 6: The action number – – – ○ ○ ○ ○ ○ *SR250 Download log 6: The year and the month –...
  • Page 77 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP second ○ ○ ○ ○ ○ *SR289 Download log 16: The action number – – – ○ ○ ○ ○ ○ *SR290 Download log 16: The year and the month –...
  • Page 78 Ch a pt er 2 De v ic es STOP    Function STOP the second PLC status change log 4: The action ○ ○ ○ ○ ○ *SR323 – – – number PLC status change log 4: The year and the ○...
  • Page 79 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP PLC status change log 10: The day and the ○ ○ ○ ○ ○ *SR349 – – – hour PLC status change log 10: The minute and ○...
  • Page 80 Ch a pt er 2 De v ic es STOP    Function STOP number PLC status change log 17: The year and ○ ○ ○ ○ ○ *SR376 – – – the month PLC status change log 17: The day and the ○...
  • Page 81 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP When the PLC runs, the value in SR408 increases by one every scan cycle. SR408 ○ ○ ○ ○ ○ SR408 – counts from 0 to 32767, and then from -32768 to 0.
  • Page 82 Ch a pt er 2 De v ic es STOP    Function STOP Bit 0~bit 15: The conditions of the interrupt ○ ○ ○ ○ ○ FFFF SR626 programs I48~I63 are set by the instruction – – IMASK. Bit 0~bit 15: The conditions of the interrupt ○...
  • Page 83 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP SR682 whose slot number is 0 ↓ Recording the mapping error code occurring in the module table for rack 2 whose slot number is 7 Recording the mapping error code occurring in the module table for rack 3 *SR683...
  • Page 84 Ch a pt er 2 De v ic es STOP    Function STOP ○ ○ ○ *SR1003 Low word in the Ethernet netmask address × – – – × ○ ○ ○ *SR1004 High word in the Ethernet gateway address × ×...
  • Page 85 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP TCP Socket 2─The local communication ○ ○ ○ *SR1131 × × – – – port TCP Socket 2─The high word in the remote ○...
  • Page 86 Ch a pt er 2 De v ic es STOP    Function STOP TCP Socket 4─The high word in the remote ○ ○ ○ *SR1158 × × – – – IP address TCP Socket 4─The low word in the remote ○...
  • Page 87 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP TCP Socket 6─The low word in the remote ○ ○ ○ *SR1185 × × – – – IP address TCP Socket 6─The remote communication ○...
  • Page 88 Ch a pt er 2 De v ic es STOP    Function STOP TCP Socket 8─The remote communication ○ ○ ○ *SR1212 × × – – – port TCP Socket 8─The length of the data ○ ○ ○ *SR1213 ×...
  • Page 89 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP UDP Socket 2─The high word in the ○ ○ ○ *SR1239 × × – – – address of the data transmitted UDP Socket 2─The low word in the ○...
  • Page 90 Ch a pt er 2 De v ic es STOP    Function STOP UDP Socket 4─The high word in the ○ ○ ○ *SR1266 × × – – – address of the data received UDP Socket 4─The low word in the ○...
  • Page 91 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP counter UDP Socket 7─The local communication ○ ○ ○ *SR1294 × – – – × port UDP Socket 7─The high word in the remote ○...
  • Page 92 Ch a pt er 2 De v ic es STOP    Function STOP ○ ○ ○ ○ ○ *SR1330 Main slot ID – – – ○ ○ ○ ○ ○ *SR1331 RTU number – – – ○ ○ ○...
  • Page 93 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP SR1595 Starting communication address in slave 1 ○ ○ (SR1532, SR1533) ~ 32 (SR1594, SR1595) – – – × × × from which COM1 reads data by Modbus Device address in slave 1 (SR1596, ○...
  • Page 94 Ch a pt er 2 De v ic es STOP    Function STOP Error code of EtherNet/IP I/O connection 65 SR2112 ↓ ○ ○ ○ ↓ × × – – – Error code of EtherNet/IP I/O connection SR2175 Error code of EtherNet/IP I/O connection SR2176 ○...
  • Page 95 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP Low byte of RTU IP or ID from the 3 error ○ ○ ○ SR2571 × × – – – RTU backplane ID and slot ID from the 3 ○...
  • Page 96 Ch a pt er 2 De v ic es STOP    Function STOP High byte of RTU IP or ID from the 8 error ○ ○ ○ SR2595 × × – – – Low byte of RTU IP or ID from the 8 error ○...
  • Page 97 AH 5 00 Pr ogr am m ing Ma n ua l STOP    Function STOP SR2618 Position of the 12 execution error in the ○ ○ ○ ↓ program × × – – – SR2619 High byte of RTU IP or ID from the 13 ○...
  • Page 98 Ch a pt er 2 De v ic es STOP    Function STOP RTU backplane ID and slot ID from the 17 ○ ○ ○ SR2642 × × – – – error log SR2643 Position of the 17 execution error in the ○...
  • Page 99: Refresh Time Of Special Data Registers

    AH 5 00 Pr ogr am m ing Ma n ua l 2.2.15 Refresh Time of Special Data Registers Limited Special data register Refresh time SR0~SR2 The register is refreshed when the program is executed in error. The register is refreshed when there is a grammar check error The register is refreshed when the program is downloaded to the SR5~SR6 PLC, or when the PLC is suppied with power and starts to run for...
  • Page 100 Ch a pt er 2 De v ic es Limited Special data register Refresh time PLC. The register is refreshed when the parameter is downloaded to the SR1142~SR1143 PLC, or when the PLC is supplied with power. The register is refreshed when the parameter is downloaded to the SR1144~SR1154 PLC.
  • Page 101: Additional Remarks On Special Auxiliary Relays And Special Data Registers

    AH 5 00 Pr ogr am m ing Ma n ua l Limited Special data register Refresh time PLC. The register is refreshed when the parameter is downloaded to the SR1304~SR1305 PLC, or when the PLC is supplied with power. The register is refreshed when the parameter is downloaded to the SR1306~SR1315 PLC.
  • Page 102 Ch a pt er 2 De v ic es 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. Please refer to section 6.17 for more information related to the real-time clock. The functions related to communication ...
  • Page 103 AH 5 00 Pr ogr am m ing Ma n ua l  SR40~SR161 SR40: The maximum number of error logs which are stored in SR40 is 20. Every error log occupies 6 registers. SR41: The error log pointer points to the latest error log. When an error occurs, the value of the error log pointer increases by one.
  • Page 104 Ch a pt er 2 De v ic es SR228: The download log pointer points to the latest download log. When a download action is executed, the value of the download log pointer increases by one. The range of pointer values is 0~19. For example, the download log pointer points to the fourth download log when the value in SR228 is 3.
  • Page 105 AH 5 00 Pr ogr am m ing Ma n ua l Function Value Second 00~59 The PLC status change log  SR309~SR390 SR309: The maximum number of PLC status change logs which are stored in SR309 is 20. Every PLC status change log occupies 4 registers. The PLC status change actions which are recorded are numbered, as shown in the following table.
  • Page 106 Ch a pt er 2 De v ic es Action *Time when the PLC status change action occurs Number number Year Month Hour Minute Second High byte Low byte High byte Low byte High byte Low byte SR372 SR372 SR373 SR373 SR374 SR374...
  • Page 107 AH 5 00 Pr ogr am m ing Ma n ua l 10. The initial clock pulse  SM404~SM410, and SR409~SR410 The PLC provides seven types of clock pulses. When the PLC is supplied with power, the seven types of clock pulses act automatically. Users can set the interval of the clock pulse in SM409 and SM410.
  • Page 108 Ch a pt er 2 De v ic es 2 sec 0.5 Hz SM408 (2 sec) 1 sec 2n sec 1/2n Hz SM409 (2n sec) n sec 2n ms SM410 (2n ms) n ms 11. The flags related to the memory card ...
  • Page 109 AH 5 00 Pr ogr am m ing Ma n ua l Main Extension backplane backplane Description Backplane Backplane Backplane Backplane Backplane Backplane Backplane Backplane Device SR655 SR656 SR657 SR658 SR659 SR660 SR661 SR662 Slot 0 Bit0 Bit0 Bit0 Bit0 Bit0 Bit0 Bit0...
  • Page 110 The flag is ON when the same port is used. is already used. Please refer to section 12.2 in AH500 Operation Manual for more information about the LED indicators and the error codes. 14. The setting of the email sending ...
  • Page 111 When the trigger is enabled and the attachment is not found, the flag is ON. Please refer to section 12.2 in AH500 Operation Manual for more information about the LED indicators and the error codes. 15. Setting the TCP/UDP socket ...
  • Page 112 The PLC Link supports COM1 on the PLC. At most 32 slaves can be connected. When the master connects to the AH500 series programmable logic controllers, at most 450 words or 7200 bits can be read from the AH500 series programmable logic controllers and written into them.
  • Page 113 Link is complete. (ON->OFF) (SM1552) (SM1553) (SM1583) Please refer to section 11.1 in AH500 Operation Manual for more information related to the PLC Link. 17. The functions related to the Ether Link Starting the Ether Link Ether Link error flag...
  • Page 114 SM1786 SM1804 SM1822 Port 15 SM1787 SM1805 SM1823 Please refer to section 11.2 in AH500 Operation Manual for more information related to the Ether Link. 18. Setting the IP address  SR1792~SR2047 Device Function Description High eight bits in the IP address of block 1...
  • Page 115 AH 5 00 Pr ogr am m ing Ma n ua l External 24V low-voltage Power module status detection Description Master Standby Master Standby power Power power Power module module module module Device SR32 SR33 SR731 SR732 Main Backplane 1 Bit0 Bit0 Bit0...
  • Page 116 Ch a pt er 2 De v ic es Master CP U (backplane 1) S tandby C PU S M418 S M420 S M421 Redundant extension backplane backplane 2) S M422 S M423 Redundant extension backplane backplane 3) S M430 S M431 Redundant extension backplane backplane 7) Redundant extension backplane backplane 8)
  • Page 117: Link Registers

    The link register is mainly used in the PLC Link or the Ether Link. When the data exchange occurs between the AH500 series programmable logic controllers, the link register can be used as the buffer. Please refer to chapter 12 in AH500 Operation Manual for more information.
  • Page 118 Chapter 3 Instruction Tables Table of Contents Instructions .................... 3-2 3.1.1 Basic Instructions ................3-2 3.1.2 Applied Instructions ................3-2 Instruction Tables .................. 3-3 3.2.1 Basic Instructions ................3-3 3.2.2 Applied Instructions ................3-4 3.2.3 Applied Instructions (Sorted Alphabetically) ........3-5 3.2.4 Device Tables ...................
  • Page 119: Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 3.1 Instructions Instructions used in the AH500 series PLC include basic instructions and applied instructions. 3.1.1 Basic Instructions Classification Description Loading the contact, connecting the contact in series, connecting Contact instructions the contact in parallel, and etc.
  • Page 120: Instruction Tables

    Ch a pt er 3 Ins tr uc t i on T ab les Classification Description mentioned above Conversion between binary/binary-coded decimal numbers and ASCII codes; conversion between String processing binary numbers and strings; conversion between 2100~2121 instructions floating-point numbers and strings; string processing 2200~2207 Ethernet instructions...
  • Page 121: Applied Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 3.2.2 Applied Instructions The descriptions:  : The applied instruction number  : The instruction name  : If the 16-bit instruction can be used as the 32-bit instruction, a D is added in front of the 16-bit instruction to form the 32-bit instruction.
  • Page 122: Applied Instructions (Sorted Alphabetically)

    Ch a pt er 3 Ins tr uc t i on T ab les 3.2.3 Applied Instructions (Sorted Alphabetically) The descriptions:  : The initial of the instruction name  : The applied instruction number   ~ : The instruction names If the 16-bit instruction can be used as the 32-bit instruction, a D is added in front of the 16-bit instruction to form the 32-bit instruction.
  • Page 123: Device Tables

    AH 5 00 Pr ogr am m ing Ma n ua l 3.2.4 Device Tables The descriptions:  : The applied instruction number  : The instruction name If the 16-bit instruction can be used as the 32-bit instruction, a D is added in front of the 16-bit instruction to form the 32-bit instruction.
  • Page 124: Lists Of Basic Instructions

    Ch a pt er 3 Ins tr uc t i on T ab les  : The unit of the operand  : The format of the instruction It indicates whether the instruction can be used as the pulse instruction, the 16-bit instruction, the 32-bit instruction, or the 64-bit instruction, and the number of steps.
  • Page 125 AH 5 00 Pr ogr am m ing Ma n ua l  Output instructions Instruction Execution Symbol Function Operand code condition DY, X, Y, M, S, T, C, HC, Driving the coil D, L, SM, and PR DY, X, Y, M, S, T, C, HC, Keeping the device on D, L, SM, and PR ...
  • Page 126: Lists Of Applied Instructions

    Ch a pt er 3 Ins tr uc t i on T ab les Instruction Execution Symbol Function Operand code condition DY, X, Y, M, S, T, C, HC, Falling-edge output D, L, SM, and PR  Other instructions Instruction Symbol Function Operand...
  • Page 127 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function Instruction 16-bit 32-bit Comparing the values =S 0006 AND= DAND= – ON: S ≠S OFF: S Comparing the values ≠S ON: S 0007 AND<> DAND<>...
  • Page 128 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 32-bit 64-bit Instruction Comparing the floating-point numbers 0018 FLD= DFLD= – =S ON: S ≠S OFF: S Comparing the floating-point numbers 1≠S 0019 FLD<>...
  • Page 129 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function Instruction 32-bit 64-bit Comparing the floating-point numbers 0029 FAND<= DFAND<= – ≦S ON: S >S OFF: S Comparing the floating-point numbers 0030 FOR= DFOR= –...
  • Page 130 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 32-bit 64-bit Instruction Comparing the strings =S 0042 AND$= – – ON: S ≠S OFF S Comparing the strings ≠S ON: S 0043 AND$<>...
  • Page 131 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function Instruction 32-bit 64-bit  0055 DZCP Zone comparison Comparing the floating-point  0056 – FCMP numbers  0057 – FZCP Floating-point zone comparison ...
  • Page 132 Ch a pt er 3 Ins tr uc t i on T ab les  Arithmetic instructions Instruction code Pulse Symbol Function 16-bit 32-bit instruction Addition of binary numbers  0100 Subtraction of binary numbers  0101 Multiplication of binary numbers ...
  • Page 133 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 32-bit 64-bit Division of floating-point numbers  0107 Addition of binary-coded decimal  0108 numbers Subtraction of binary-coded  0109 decimal numbers Multiplication of binary-coded ...
  • Page 134 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 16-bit 32-bit instruction Multiplication of binary numbers for 16-bit  0117 MUL16 MUL32 Multiplication of binary numbers for 32-bit Division of binary numbers for 16-bit ...
  • Page 135 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 16-bit 32-bit Converting the 16-bit value into  0206 MMOV – the 32-bit value Converting the 32-bit value into  0207 RMOV –...
  • Page 136 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function instruction 16-bit 32-bit Converting a line of data into a  0219 COLM DCOLM column of data  Data transfer instructions Instruction code Pulse Symbol...
  • Page 137 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 16-bit 32-bit Exchange the high byte with the  0308 SWAP DSWAP low byte  0309 SMOV – Transferring the digits  0310 MOVB –...
  • Page 138 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 16-bit 32-bit instruction ─ ─ 0702 STMR Special timer ─ ─ 0703 RAMP Ramp signal ─ ─ 0704 Matrix input ─ 0705 ABSD DABSD Absolute drum sequencer...
  • Page 139 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 16-bit 32-bit ─  0801 MAND Matrix AND operation  0802 Logical OR operation ─  0803 Matrix OR operation  0804 WXOR DXOR Logical exclusive OR operation...
  • Page 140 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 16-bit 32-bit instruction ≠ ON: S 0814 AND^ DAND^ – OFF: S ≠ ON: S &S 0815 OR& DOR& – OFF: S &S ≠...
  • Page 141 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 16-bit 32-bit ─ ─ 1001 16-bit timer ─ ─ 1002 TMRH 16-bit timer ─ ─ 1003 16-bit counter ─ ─ 1004 DCNT 32-bit counter ...
  • Page 142 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 16-bit 32-bit instruction Shifting the values of the bits in the ─  1110 16-bit registers by n bits to the right Shifting the values of the bits in the ─...
  • Page 143 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 16-bit 32-bit  1207 DBON Checking the state of the bit  1208 MEAN DMEAN Mean ─  1209 Sum check  1210 DABS Absolute value...
  • Page 144 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 16-bit 32-bit instruction ─  1219 BRST Resetting the bit in the word device ─  1220 BKRST Resetting the specified zone Confining the value within the ...
  • Page 145 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 16-bit 32-bit Writing the data into the control  1401 register in the special module  Floating-point number instructions Instruction code Pulse Symbol Function 16-bit...
  • Page 146 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 16-bit 32-bit instruction Logarithm of the floating-point ─  1514 FLOG number Natural logarithm of the binary ─  1515 floating-point number A power of the floating-point ─...
  • Page 147 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Symbol Function instruction 16-bit 32-bit ─  1605 TCMP Comparing the time ─  1606 TZCP Time zone comparison  Peripheral instructions Instruction code Pulse Symbol Function instruction...
  • Page 148 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function 16-bit 32-bit instruction Resetting the abnormal AC ─ ─ 1805 RSTEF motor drives ─  1806 Longitudinal parity check ─  1807 Cyclic Redundancy Check Reading/Writing the MODBUS...
  • Page 149 AH 5 00 Pr ogr am m ing Ma n ua l  String processing instructions Instruction code Pulse Symbol Function instruction 16-bit 32-bit Converting the singed  2100 BINDA DBINDA decimal number into the ASCII code Converting the binary hexadecimal number into ...
  • Page 150 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function instruction 16-bit 32-bit Converting the ─  2109 $FSTR floating-point number into the string Converting the string into ─  2110 $FVAL the floating-point number The retrieve of the...
  • Page 151 AH 5 00 Pr ogr am m ing Ma n ua l  Ethernet instructions Instruction code Pulse Symbol Function instruction 16-bit 32-bit ─  2200 SOPEN Opening the socket Sending the data through ─  2201 SSEND the socket Receiving the data ─...
  • Page 152 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Symbol Function instruction 16-bit 32-bit Writing the string into the ─  2302 MTWRIT memory card  Task control instructions Instruction code Pulse Symbol Function instruction...
  • Page 153: Applied Instructions (Sorted Alphabetically)

    AH 5 00 Pr ogr am m ing Ma n ua l 3.4.2 Applied Instructions (Sorted Alphabetically) Instruction code Pulse Function Classification instruction 16-bit 32-bit 64-bit Subtraction of binary ─  0101 numbers ─ ─  0114 Linking the strings ─...
  • Page 154 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Function Classification 16-bit 32-bit 64-bit instruction >S OFF: S Comparing the strings ≠S ─ ─ ─ ON: S 0043 AND$<> =S OFF: S Comparing the strings ─...
  • Page 155 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Classification Function instruction 16-bit 32-bit 64-bit binary-coded decimal numbers Division of binary-coded ─  decimal numbers 0111 Addition of binary-coded ─  decimal numbers 0108 Arccosine of the ─...
  • Page 156 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Function Classification 16-bit 32-bit 64-bit instruction Resetting the specified ─ ─  1220 BKRST zone ─ ─  0304 BMOV Transferring all data Checking the state of the ─...
  • Page 157 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Classification Function instruction 16-bit 32-bit 64-bit Cyclic Redundancy ─ ─ ─ 1807 Check Converting the ASCII code into the ─  2105 DABCD DDABCD binary-coded decimal number Converting the signed decimal ASCII code into...
  • Page 158 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Function Classification 16-bit 32-bit 64-bit instruction Arccosine of the ─ ─  1504 FACOS floating-point number Comparing the floating-point numbers ─ ─ 0028 FAND<...
  • Page 159 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Classification Function instruction 16-bit 32-bit 64-bit Converting the 64-bit ─  0205 FINT DFINT floating-point number into the binary integer Comparing the floating-point numbers ─ ─...
  • Page 160 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Function Classification 16-bit 32-bit 64-bit instruction <S ON: S ≧S OFF: S Comparing the floating-point numbers ─ ─ 0035 FOR<= DFOR<= ≦S ON: S >S OFF: S Comparing the...
  • Page 161 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Classification Function instruction 16-bit 32-bit 64-bit number ─ ─ ─ 0402 GOEND Jumping to END General pulse width ─ ─ ─ 1902 GPWM modulation Converting the binary ─...
  • Page 162 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Function Classification 16-bit 32-bit 64-bit instruction <S ON: S ≧S OFF: S Comparing the values ≦S ─ ─ ON: S 0005 LD<= DLD<= >S OFF: S Comparing the values...
  • Page 163 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Classification Function instruction 16-bit 32-bit 64-bit ─ ─ ─ 0704 Matrix input Writing the string into the ─ ─ ─ 2302 MTWRIT memory card Multiplication of binary ─...
  • Page 164 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Function Classification 16-bit 32-bit 64-bit instruction Comparing the values ≦S ─ ─ ON: S 0017 OR<= DOR<= >S OFF: S Comparing the values ≠S ─...
  • Page 165 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Classification Function instruction 16-bit 32-bit 64-bit Parameter type of scale ─  0217 SCLP DSCLP value operation Seven-segment ─ ─  1204 SEGD decoding Seven-segment display ─...
  • Page 166 Ch a pt er 3 Ins tr uc t i on T ab les Instruction code Pulse Function Classification 16-bit 32-bit 64-bit instruction ─ ─  1602 Adding the time ─ ─  1605 TCMP Comparing the time ─ ─ ─...
  • Page 167 AH 5 00 Pr ogr am m ing Ma n ua l MEMO 3 - 5 0...
  • Page 168 Chapter 4 Instruction Structure Table of Contents Composition of Applied Instructions ............4-2 Restrictions on the Use of the Instructions ..........4-5 Index Registers ..................4-6 Pointer Registers ..................4-7 Pointer Registers of Timers ..............4-9 Pointer Registers of 16-bit Counters .............4-10 Pointer Registers of 32-bit Counters .............
  • Page 169: Composition Of Applied Instructions

    ● ● ● ● ● ○ ● Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: : Data source Word/Double word : Data destination Word/Double word The devices used by the instruction are listed in the operand column. S, D, n, and m are used as the operands according to their functions.
  • Page 170 Ch a pt er 4 Ins tr uc t i on Str uc t ur e 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.
  • Page 171 AH 5 00 Pr ogr am m ing Ma n ua l The values of the operands used in the instructions can be divided into the 32-bit values and the 64-bit values. Accordingly, in order to process data of difference lengths, the instructions are divided into the 32-bit instructions and the 64-bit instructions.
  • Page 172: Restrictions On The Use Of The Instructions

    Ch a pt er 4 Ins tr uc t i on Str uc t ur e 13. Pointer register: PR0~PR15 14. Pointer register of the timer: TR0~TR7 15. Pointer register of the 16-bit counter: CR0~CR7 16. Pointer register of the 32-bit counter: HCR0~HCR7 17.
  • Page 173: Index Registers

    AH 5 00 Pr ogr am m ing Ma n ua l 4.3 Index Registers The index register is the 16-bit data register. It is like the general register in that the data can be read from it and written into it. However, it is mainly used as the index register. The range of index registers is E0~E13.
  • Page 174: Pointer Registers

    Ch a pt er 4 Ins tr uc t i on Str uc t ur e When M0 is ON, E0=10, and M1@E0=M (1+10)=M11. M11 is ON. Declaring the variables first, and then modifying the device  Declare the three variables StartBit, Var1, and Var2 in ISPSoft. The type of StartBit is the Boolean array, and its size is 2 bits.
  • Page 175 AH 5 00 Pr ogr am m ing Ma n ua l  Users can declare 16 pointer registers in every function block. The range is PR0~PR15, or PR0.0~PR15.15. Example: Establish a program organization unit (POU) in ISPSoft first. Establish a function block which is called FB0. The program in the function block FB0 Declare the varaible in the function block FB0.
  • Page 176: Pointer Registers Of Timers

    Ch a pt er 4 Ins tr uc t i on Str uc t ur e Network 2: When StartBit[1] is ON, the address of CVar1[0] is transmitted to Point1 in FB0. When VarBit1 in FB0 is ON, E0=1, Var1=CVar1[0], Point1@E0=CVar1 (0+1)=Cvar1[1], and Var2=CVar1[1].
  • Page 177: Pointer Registers Of 16-Bit Counters

    AH 5 00 Pr ogr am m ing Ma n ua l Call the function block FB0 in the program organization unit (POU). The program in the program organization unit (POU) Network 1: When StartBit[0] is ON, the address of T1920 is transmitted to TPoint1 in FB0. When VarBit1 in the FB0 is ON, the instruction TMR is executed, and TPoint1 (T1920) starts counting.
  • Page 178: Pointer Registers Of 32-Bit Counters

    Ch a pt er 4 Ins tr uc t i on Str uc t ur e The program in the function block FB0 Declare the variable in the program organization unit (POU). The data type of CVar1 should be COUNTER. Call the function block FB0 in the program organization unit (POU).
  • Page 179 AH 5 00 Pr ogr am m ing Ma n ua l Establish a function block which is called FB0. Declare the varaible in the function block FB0. Choose VAR_IN_OUT as the declaration type, HCPoint1 as the identifier, HC_POINTER as the data type.
  • Page 180: List Of Basic Instructions

    Chapter 5 Basic Instructions Table of Contents List of Basic Instructions ................5-2 Basic Instructions ..................5-3 5 - 1...
  • Page 181: Basic Instructions

    AH5 00 Prog ram m ing M an ua l 5.1 List of Basic Instructions Instruction code Function Operand Step Loading contact A/Connecting DX, X, Y, M, SM, S, T, C, HC, LD/AND/OR contact A in series/Connecting D, L, and PR contact A in parallel Loading contact B/Connecting DX, X, Y, M, SM, S, T, C, HC,...
  • Page 182 Ch ap te r 5 Bas ic Instruc ti ons 5.2 Basic Instructions Instruction code Operand Function Loading contact A/Connecting LD/AND/OR contact A in series/Connecting contact A in parallel Device ● ● ● ● ● ● ● ● ● ● ●...
  • Page 183 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function Loading contact B/Connecting LDI/ANI/ORI contact B in series/Connecting contact B in parallel Device ● ● ● ● ● ● ● ● ● ● ● ● Symbol: S :...
  • Page 184 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Connecting the circuit blocks in ANB/ORB series/parallel Symbol: Explanation: The instruction ANB is used to perform the AND operation between the reserved logical operation result and the contents of the accumulative register. The instruction ANB is used to perform the OR operation between the reserved logical operation result and the contents of the accumulative register.
  • Page 185 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function Storing the data in the stack/Reading MPS/MRD/MPP the data from the stack/Popping the data from the stack Explanation: The instruction MPS is used to store the data in the accumulative register in the stack (the value of the stack pointer increases by one).
  • Page 186 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Driving the coil Device ● ● ● ● ● ● ● ● ● ● ● ● Symbol: S : Specified device Explanation: The logical operation result prior to the application of the instruction OUT is output into the specified device.
  • Page 187 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function Keeping the device on Device ● ● ● ● ● ● ● ● ● ● ● ● Symbol: S : 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.
  • Page 188 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Setting/Resetting the master MC/MCR control Symbol: Level of the nested N : N0~N31 program structure Explanation: 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.
  • Page 189 AH5 00 Prog ram m ing M an ua l Example: 5 - 1 0...
  • Page 190 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Starting the rising-edge detection/Connecting the rising-edge LDP/ANDP/ORP detection in series/Connecting the rising-edge detection in parallel Device ● ● ● ● ● ● ● ● ● ● ●...
  • Page 191 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function Starting the falling-edge detection/Connecting the LDF/ANDF/ORF falling-edge detection in series/Connecting the falling-edge detection in parallel Device ● ● ● ● ● ● ● ● ● ● ●...
  • Page 192 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Starting the rising-edge detection/Connecting the rising PED/APED/OPED edge-detection in series/Connecting the rising-edge detection in parallel Device ● ● ● ● ● ● ● ● ● ● ●...
  • Page 193 AH5 00 Prog ram m ing M an ua l 5 - 1 4...
  • Page 194 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Starting the falling-edge detection/Connecting the falling-edge NED/ANED/ONED detection in series/Connecting the falling-edge detection in parallel Device ● ● ● ● ● ● ● ● ● ● ●...
  • Page 195 AH5 00 Prog ram m ing M an ua l 5 - 1 6...
  • Page 196 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Rising-edge output Device ● ● ● ● ● ● ● ● ● ● ● ● Symbol: D : Specified device Explanation: 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.
  • Page 197 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function Falling-edge output Device ● ● ● ● ● ● ● ● ● ● ● ● Symbol: D : Specified device Explanation: 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.
  • Page 198 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Inverting the logical operation result Symbol: Explanation: The logical operation result preceding the instruction INV is inverted, and the inversion result stored in the accumulative register. Example: When X0.0 is ON, Y0.0 is OFF.
  • Page 199 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function No operation Symbol: None Explanation: The instruction NOP does not perform any operation in the program. Therefore, the original logical operation result is retained after NOP is executed. If users want to delete a certain instruction without changing the length of the program, they can use NOP instead.
  • Page 200 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function The circuit is rising edge-triggered. Symbol: Explanation: 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.
  • Page 201 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function The circuit is falling edge-triggered. Symbol: Explanation: 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.
  • Page 202 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function FB_NP The circuit is rising edge-triggered. Device ● ● ● ● ● ● ● ● ● ● ● Symbol: S : For internal use Explanation: 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.
  • Page 203 AH5 00 Prog ram m ing M an ua l Instruction code Operand Function FB_PN The circuit is falling edge-triggered. Device ● ● ● ● ● ● ● ● ● ● ● Symbol: S : For internal use Explanation: 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.
  • Page 204 Ch ap te r 5 Bas ic Instruc ti ons Instruction code Operand Function Stopping executing the program in PSTOP the PLC Symbol: Explanation: When the conditional contact is enabled, the instruction PSTOP stops the execution of the program, and the PLC stops running. Example: When X0.0 is ON, Y0.0 is set to ON, Y0.1 remains OFF, and the PLC stops running.
  • Page 205 AH5 00 Prog ram m ing M an ua l MEMO 5 - 2 6...
  • Page 206 Chapter 6 Applied Instructions Table of Contents Comparison Instructions ................6-3 6.1.1 List of Comparison Instructions ............6-3 6.1.2 Explanation of Comparison Instructions ........... 6-6 Arithmetic Instructions ................6-36 6.2.1 List of Arithmetic Instructions............6-36 6.2.2 Explanation of Arithmetic Instructions ..........6-37 Data Conversion Instructions ..............6-73 6.3.1 List of Data Conversion Instructions ..........6-73 6.3.2...
  • Page 207 6.15.2 Explanation of Module Instructions ..........6-316 6.16 Floating-point Number Instructions ............6-321 6.16.1 List of Floating-point Number Instructions........6-321 6.16.2 Explanation of Floating-point Number Instructions ....... 6-322 6.17 Real-time Clock Instructions ..............6-362 6.17.1 List of Real-time Clock Instructions ..........6-362 6.17.2 Explanation of Real-time Clock Instructions ........
  • Page 208: Comparison Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.1 Comparison Instructions 6.1.1 List of Comparison Instructions Instruction code Pulse Function Step 16-bit 32-bit 64-bit instruction =S 0000 LD= DLD= – – ≠S 0001 LD<> DLD<> – –...
  • Page 209 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Instruction code Pulse Function Step instruction 16-bit 32-bit 64-bit <S 0034 – FOR< DFOR< – ≦S 0035 – FOR<= DFOR<= – =S 0036 LD$= –...
  • Page 210 AH 5 00 Pr ogr am m ing Ma n ua l Instruction code Pulse Function Step instruction 16-bit 32-bit 64-bit Comparing the  tables 0063 CMPT< – – ON: < Comparing the  tables 0064 CMPT<= – – ON: ≦ Checking the address of the 0065 CHKADR...
  • Page 211: Explanation Of Comparison Instructions

           Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) - AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word Taking LD= and DLD= for example Explanation:...
  • Page 212 AH 5 00 Pr ogr am m ing Ma n ua l 6 - 7...
  • Page 213        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) - AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word Taking AND= and DAND= for example Explanation:...
  • Page 214 AH 5 00 Pr ogr am m ing Ma n ua l 6 - 9...
  • Page 215        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) - AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word Taking OR= and DOR= for example Explanation:...
  • Page 216 AH 5 00 Pr ogr am m ing Ma n ua l 6 - 11...
  • Page 217       Pulse instruction 32-bit instruction (5-7 steps) 64-bit instruction (5-7 steps) - AH500 AH500 Symbol: : Data source 1 Double word/Long word : Data source 2 Double word/Long word Taking FLD= and DFLD= for example...
  • Page 218        Pulse instruction 32-bit instruction (5-7 steps) 64-bit instruction (5-7 steps) AH500 AH500 Symbol: : Data source 1 Double word/Long word : Data source 2 Double word/Long word Taking FAND= and DFAND= for example...
  • Page 219        Pulse instruction 32-bit instruction (5-7 steps) 64-bit instruction (5-7 steps) AH500 AH500 Symbol: : Data source 1 Double word/Long word : Data source 2 Double word/Long word Taking FOR= and DFOR= for example...
  • Page 220 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If the value in S 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. 6 - 1 5...
  • Page 221       Pulse instruction 16-bit instruction (5-17 steps) 32-bit instruction AH500 Symbol: : Data source 1 String : Data source 2 String Taking LD$= for example Explanation: The instructions are used to compare the data in S...
  • Page 222 AH 5 00 Pr ogr am m ing Ma n ua l Comparison symbol Comparison operation result $= $<> $> $>= $< $<= When the lengths of the strings are the same, but their contents are different, the first different values (ASCII codes) met in the strings are compared. For example, the string in S is “ABCDF”, and the string in S is “ABCDE”.
  • Page 223 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Comparison symbol Comparison operation result $< $<= Example: When the string starting with the data in D0 is equal to the string staring with D2, Y0.0 is ON. Additional remark: If the string does not end with 16#00, the instruction is not executed, SM is ON, and the error code in SR0 is 16#200E.
  • Page 224        Pulse instruction 16-bit instruction (5-17 steps) 32-bit instruction AH500 Symbol: : Data source 1 String : Data source 2 String Taking AND$= for example Explanation: The instructions are used to compare the data in S...
  • Page 225 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons b 15 b 8 b 7 b 15 b 8 b 7 16#42( B) 16#41( A) 16#42( B) 16#41( A) Compar ison sign 16#44( D) 16#43( C) 16#44( D)
  • Page 226        Pulse instruction 16-bit instruction (5-17 steps) 32-bit instruction AH500 Symbol: : Data source 1 String : Data source 2 String Taking OR$= for example Explanation: The instructions are used to compare the data in S...
  • Page 227 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons b 15 b 8 b 7 b 15 b 8 b 7 16#42( B) 16#41( A) 16#42( B) 16#41( A) Compar ison sign 16#44( D) 16#43( C) 16#44( D)
  • Page 228          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: : Comparison value 1 Word/Double word : Comparison value 2 Word/Double word D : Comparison result Explanation:...
  • Page 229 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL. If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 230          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 AH500 Symbol: Minimum value of the zone : Word/Double word comparison Maximum value of the zone : Word/Double word comparison S :...
  • Page 231 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of BOOL. If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 232        Pulse instruction 32-bit instruction (7-9 steps) 64-bit instruction - AH500 AH500 Symbol: : Floating-point number 1 Double word : Floating-point number 2 Double word D : Comparison result Explanation: The instruction FCMP is used to compare the floating-point number in S...
  • Page 233         Pulse instruction 32-bit instruction (9-12 steps) 64-bit instruction - AH500 AH500 Symbol: Minimum value of the zone : Double word comparison Maximum value of the zone : Double word comparison S : Comparison value Double word D :...
  • Page 234        Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: : Matrix source device 1 Word : Matrix source device 2 Word n : Length of the array Word D : Pointer...
  • Page 235 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Pointer MCMP Additional remark: The description of the operation error code: If the devices S +n-1 and S +n-1 exceed the range, the instruction MCMP is not executed, SM is ON, and the error code in SR0 is 16#2003.
  • Page 236          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: : Source device 1 Word : Source device 2 Word n : Data length Word D : Comparison result...
  • Page 237 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Comparison operation result 16-bit number instruction ≠S =S 0059 CMPT= ≠S =S 0060 CMPT<> >S ≦S 0061 CMPT> ≧S <S 0062 CMPT>= <S ≧S 0063...
  • Page 238       Pulse instruction 16-bit instruction (7 steps) 32-bit instruction - - AH500 Symbol: POINTER/T_POINTER/ S : Pointer register C_POINTER/HC_POINTER n : Number of devices Word D : Check result Explanation: The instruction CHKADR is used to check whether the value in S and (the value in S)+n-1 exceed the device range.
  • Page 239 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Call the function block FB0 in the program, and assign D65535, T0, C2047, and HC50 to VarPR1, VarTR1, VarCR1, and VarHCR1 in FB0 respectively. Use the instruction CHKADR to check whether VarPR1, VarTR1, VarCR1, and VarHCR1 exceed the range.
  • Page 240 AH 5 00 Pr ogr am m ing Ma n ua l When chkHCR is ON, the practical device represented by HC50 is VarHCR1. Since the legal range of deices is from HC0 to HC63, and HC50+10-1=HC59, which does not exceed the range, HCR_ChkBit is ON.
  • Page 241: Data Conversion Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.3 Data Conversion Instructions 6.3.1 List of Data Conversion Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit 64-bit Converting the binary number into the ...
  • Page 242: Explanation Of Data Conversion Instructions

            Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Conversion result Word/Double word Explanation: The binary value in S is converted into the binary-coded decimal value, and the conversion result is stored in D.
  • Page 243         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Conversion result Word/Double word Explanation: The binary-coded decimal value in S is converted into the binary value, and the conversion result is stored in D.
  • Page 244 AH 5 00 Pr ogr am m ing Ma n ua l binary value, and the conversion result is stored in D100. Subsequently, the binary value in D100 is converted into the binary-coded decimal value, and the conversion result is stored in Y0.0~Y0.15.
  • Page 245         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Conversion result Double word Explanation: The instruction is used to convert the binary integer into the single-precision floating-point number.
  • Page 246 AH 5 00 Pr ogr am m ing Ma n ua l Example 2: Users can use the applied instructions to perform the following calculation.  The binary integer in D10 is converted into the single-precision floating-point number, and the conversion result is stored in (D101, D100). ...
  • Page 247 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6 - 7 9...
  • Page 248         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Conversion result Long word Explanation: When the instruction is executed, the binary integer is converted into the double-precision floating-point number.
  • Page 249 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6 - 8 1...
  • Page 250         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Double word D : Conversion result Word/Double word Explanation: The single-precision floating-point number in the register specified by S is converted into the binary integer.
  • Page 251 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If the value in S exceeds the range of values which can be represented by the floating-point numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013. 6 - 8 3...
  • Page 252         Pulse instruction 32-bit instruction (5 steps) 64-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Long word D : Conversion result Word/Double word Explanation: The double-precision floating-point number in the register specified by S is converted into the binary integer.
  • Page 253 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6 - 8 5...
  • Page 254      Pulse instruction 16-bit instruction (5 steps) 32-bit instruction - AH500 AH500 Symbol: S : Source device Word D : Conversion result Double word Explanation: The data in the 16-bit device S is transmitted to the 32-bit device D. The sing bit which is specified is copied repeatedly to the destination.
  • Page 255      Pulse instruction 16-bit instruction (5 steps) 32-bit instruction - AH500 AH500 Symbol: S : Source device Double word D : Conversion result Word Explanation: The data in the 32-bit device S is transmitted to the 16-bit device D. The sing bit which is specified is retained.
  • Page 256         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Conversion result Word/Double word Explanation: The binary value in the device specified by S is converted into the Gray code, and the conversion result is stored in the device specified by D.
  • Page 257         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Conversion result Word/Double word Explanation: The Gray code in the device specified by S is converted into the binary value, and the conversion result is stored in the device specified by D.
  • Page 258         Pulse instruction 16-bit instruction (3 steps) 32-bit instruction (3 steps) AH500 AH500 AH500 Symbol: Device in which the two’s D : Word/Double word complement is stored Explanation: The instruction is used to convert the negative binary value into the absolute value.
  • Page 259 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Example 3: The absolute value of the difference between two values: Suppose X0.0 is ON. When the value in D0 is greater than that in D2, M0 is ON. When the value in D0 is equal to that in D2, M1 is ON.
  • Page 260        Pulse instruction 32-bit instruction (3 steps) 64-bit instruction AH500 AH500 Symbol: Device in which the sign of the D : Double word value is reversed Explanation: The sign of the single-precision floating-point number in the device D is reversed.
  • Page 261        Pulse instruction 32-bit instruction (5 steps) 64-bit instruction AH500 AH500 Symbol: S : Data source Double word D : Conversion result Double word Explanation: The single-precision floating-point number in the register specified by S is converted into the...
  • Page 262        Pulse instruction 32-bit instruction (5 steps) 64-bit instruction AH500 AH500 Symbol: S : Data source Double word D : Conversion result Double word Explanation: The decimal floating-point number in the register specified by S is converted into the single-precision floating-point number, and the conversion result is stored in the register specified by D.
  • Page 263 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons conversion is that the value converted in the binary integer. However, the instruction FBIN can be used to convert the floating-point number into the single-precision floating-point number. When X0.0 is ON, K314 and K-2 are moved to D0 and D1 respectively, and combine into the decimal floating-point number (3.14=314×10 Additional remark:...
  • Page 264         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction - AH500 AH500 Symbol: S : Data source Word n : Data length Word D : Conversion result Word Explanation: n pieces of data (the binary values) in devices starting from S are converted into the binary-coded decimal values, and the conversion results are stored in D.
  • Page 265         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction - AH500 AH500 Symbol: S : Data source Word n : Data length Word D : Conversion result Word Explanation: n pieces of data (the binary-coded decimal values) in devices starting from S are converted into the binary values, and the conversion results are stored in D.
  • Page 266           Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: : Data source Word : Slope Word : Offset Word D : Destination device Word Explanation: The operation equation in the instruction: D=(S ×S...
  • Page 267 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons The operation equation: D0=(500×168)÷1,000+(-4)=80 Destination value Slope=168 Offset=-4 Sourc e value =500 Example 2: Suppose the values in S , and S are 500, -168, and 534 respectively.
  • Page 268 AH 5 00 Pr ogr am m ing Ma n ua l operation. The value entered into S should be within the range between –32,768 and 32,767. (The practical value is within the range between –32,768 and 32,767. When users use the slope equation, they have to notice that the maximum source value should be larger than the minimum source value.
  • Page 269           Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 AH500 Symbol: : Data source Word/Double word : Parameter Word/Double word D : Destination device Word/Double word Explanation: Only the 32-bit instructions can use the 32-bit counter.
  • Page 270 AH 5 00 Pr ogr am m ing Ma n ua l x=Source value (S b=Offset =Minimum destination value–Minimum source value×Slope The parameters above are being substituted for y, k, x, and b in the equation y=kx+b, and the operation equation in the instruction is obtained. +Offset=Slope×S +Minimum destination value–Minimum y=kx+b=D=kS...
  • Page 271 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Destinati on value Maximum destination value =500 Minimum des ti nation value =500 Sourc e value Minimum Maximum sourc e value sourc e value =200 =3000 Example 2:...
  • Page 272 AH 5 00 Pr ogr am m ing Ma n ua l Example 3: Suppose the value in S 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.
  • Page 273 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: The value in S which is used in the 16-bit instruction should be within the range between the minimum source value and the maximum source value, i.e. between -32,768 and 32,767. If the value exceeds the boundary value, the boundary value is used in the operation.
  • Page 274 AH 5 00 Pr ogr am m ing Ma n ua l 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.
  • Page 275         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: S : Data source Word/Double word n : Number of bits Word/Double word D : Data destination Word/Double word Explanation: The operand S used in the 16-bit instruction occupies sixteen 16-bit registers, i.e.
  • Page 276 AH 5 00 Pr ogr am m ing Ma n ua l Take the 32-bit instruction for example. S+29 S+30 S+31 ..0 1 0 Example: When M0 is ON, the values of the 15 bits in D0~D14 are stored in b0~b15 in D100. Additional remark: If the device S+15 used in the 16-bit instruction exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 277         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: S : Data source Word/Double word n : Number of bits Word/Double word D : Data destination Word/Double word Explanation: The operand D used in the 16-bit instruction occupies sixteen 16-bit registers, i.e.
  • Page 278 AH 5 00 Pr ogr am m ing Ma n ua l Take the 32-bit instruction for example. b 31 ..... . b 31 D+2 9 D+3 0 D+3 1...
  • Page 279: Data Transfer Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.4 Data Transfer Instructions 6.4.1 List of Data Transfer Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit 64-bit  0300 DMOV –...
  • Page 280: Explanation Of Data Transfer Instructions

            Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Data source Word/Double word D : Data destination Word/Double word Explanation: 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.
  • Page 281 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6 - 11 3...
  • Page 282       Pulse instruction 32-bit instruction 64-bit instruction (5-6 steps) - AH500 AH500 Symbol: S : Data source Long word D : Data destination Double word/Long word Explanation: 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.
  • Page 283       Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction - AH500 AH500 Symbol: S : Data source String D : Data destination String Explanation: If the operand S is a string, at most 31 characters can be moved. For a string, the number of steps=1+(the number of characters +1)/4 (The value will be rounded up to the nearest whole digit if (the number of characters +1) is not divisible by 4.).
  • Page 284 AH 5 00 Pr ogr am m ing Ma n ua l When 16#00 appears in the high byte, the execution of the instruction is as follows. Before the instr uction is executed: b15~b8 b7~b0 b15~b8 b7~b0 16#30 16#31 16#38 16#39 16#32 S+ 1...
  • Page 285 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons After the instruction is executed, the data in the operand D is as follows. Device High byte Low byte Note 16#32 16#31 ‘1’=16#31;...
  • Page 286 AH 5 00 Pr ogr am m ing Ma n ua l The operand S: Device High byte Low byte Note D100 16#31 16#30 ‘1’=16#31; ‘0’=16#30 D101 16#33 16#32 ‘3’=16#33; ‘2’=16#32 D102 16#00 16#34 16#00 is the ending code. ‘4’=16#34 D103 16#37 16#36...
  • Page 287         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Data source Word/Double word D : Data destination Word/Double word Explanation: 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.
  • Page 288 AH 5 00 Pr ogr am m ing Ma n ua l Example 2: The circuits below can be represented by means of the instruction CML. 6 - 1 2 0...
  • Page 289         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction - AH500 AH500 Symbol: S : Data source Word D : Data destination Word n : Data length Word Explanation: 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.
  • Page 290 AH 5 00 Pr ogr am m ing Ma n ua l Example 2: In order to prevent the error which results from the overlap between the source devices and the destination devices, the data is transferred in the following way. When the device number of S is larger than the device number of D, the data is transferred in ...
  • Page 291         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: S : Data source Word/Double word D : Data destination Word/Double word n : Data length Word/Double word...
  • Page 292 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If D~D+n-1 exceed the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If the operand n used in the 16-bit instruciton is larger than 256 or less than 1, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 293           Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: Data which will be : Word/Double word exchanged Data which will be : Word/Double word exchanged...
  • Page 294          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction - AH500 AH500 Symbol: Data which will be : Word/Double word exchanged Data which will be : Word/Double word exchanged n : Data length...
  • Page 295 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If S +n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If S +n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 296       Pulse instruction 16-bit instruction (3 steps) 32-bit instruction (3 steps) AH500 AH500 AH500 Symbol: S : Data source Word/Double word Explanation: 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.
  • Page 297        Pulse instruction 16-bit instruction (11 steps) 32-bit instruction - AH500 AH500 Symbol: S : Data source Word Start digit which will be transferred : Word from the source device Number of digits which will be :...
  • Page 298 AH 5 00 Pr ogr am m ing Ma n ua l 4 digit 3 digit 2 digit 1 digit D10 ( 16- bit binary number T ransferring the digits D20 ( 16- bit binary number 4 digit 3 digit 2 digit 1 digit Unchanged...
  • Page 299 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons decimal numbers, and the digit which is transferred is composed of four bits. 4 digit 3 digit 2 digit 1 digit D10 ( 16- bit binary number T ransferring the digits D20 (...
  • Page 300 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: Suppose the data involved in the instruction is binary-coded decimal numbers. If the number in S is not within the range between 0 and 9999, or if the number in D is not within the range between 0 and 9999, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200D.
  • Page 301       Pulse instruction 16-bit instruction (7 steps) 32-bit instruction - AH500 AH500 Symbol: S : Data source n : Data length Word D : Data destination Explanation: When the instruciton is executed, n pieces of data in devices starting from the device specified by S are transferred to the devices starting from the device specified by D.
  • Page 302: Jump Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.5 Jump Instructions 6.5.1 List of Jump Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  0400 – Conditional jump 0401 – – Unconditional jump 0402 GOEND –...
  • Page 303: Explanation Of Jump Instructions

    Device SM SR 16# “$” Pulse instruction 16-bit instruction (3 steps) 32-bit instruction - AH500 AH500 Symbol: S : Jump destination Explanation: 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.
  • Page 304 AH 5 00 Pr ogr am m ing Ma n ua l Example 2: The instruction CJ between the instruction MC and the instruction MCR can be used in the five conditions below. The execution of the program jumps from the part of the program outside one MC/MCR loop to the part of the program outside another MC/MCR loop.
  • Page 305 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6 - 1 3 7...
  • Page 306 AH 5 00 Pr ogr am m ing Ma n ua l Example 3: The states of the devices are listed below. State of the State of the contact during State of the output coil during Device contact before the the execution of CJ the execution of CJ execution of CJ...
  • Page 307 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6 - 1 3 9...
  • Page 308 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: Please refer to ISPSoft User Manual for more information about the use of the label. 6 - 1 4 0...
  • Page 309 SM SR 16# “$” Pulse instruction 16-bit instruction (3 steps) 32-bit instruction - - AH500 Symbol: S : Jump destination Explanation: The execution of the program jumps to the part of the program specified by the pointer without any condition.
  • Page 310 Jumping to END Pulse instruction 16-bit instruction (1 step) 32-bit instruction - - AH500 Symbol: Explanation: When the condition is met, the execution of the program jumps to END in the program. Function blocks and interrupt tasks do not support the instruction. Besides, the instruction can not be between the instruction FOR and the instruction NEXT.
  • Page 311: Program Execution Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.6 Program Execution Instructions 6.6.1 List of Program Execution Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit 0500 – – Disabling the interrupt 0501 –...
  • Page 312: Explanation Of Program Execution Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.6.2 Explanation of Program Execution Instructions Instruction code Operand Function - 0500 Disabling the interrupt Pulse instruction 16-bit instruction (1 step) 32-bit instruction - - AH500 Symbol: 6 - 1 4 4...
  • Page 313 Explanation: The use of the instruction EI indicates that the interrupt task is allowed to be used in the program. (Please refer to section 6.6 in AH500 Operation Manual for more information about task I0~task I255.) The interrupt task is allowed to be used between the instruction EI and the instruction DI in the program.
  • Page 314 AH 5 00 Pr ogr am m ing Ma n ua l The program Cyclic_0: The interrupt task: Additional remark: There are 256 interrupt tasks, i.e. task I0~task I255. 1. The I/O interrupts (I0~I31) The I/O interrupts are used by the special high-speed module. The interrupt conditions and the interrupt numbers are set in HWCONFIG in ISPSoft, and the interrupt programs are downloaded to the PLC.
  • Page 315 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons set to ON. (b) If the external 24 V voltage of the first local extension backplane is abnormal, bit 1 in SR731 will be set to ON.
  • Page 316 AH 5 00 Pr ogr am m ing Ma n ua l Interrupt number Description Priority order Communication interrupt (COM2) 24 V low voltage interrupt Whether the external 24 V voltage is normal can be checked by the terminals VS+ and VS- on AH500PS05-5A.
  • Page 317    Pulse instruction 16-bit instruction (3 steps) 32-bit instruction - - AH500 Symbol: S : Data source Word Explanation: The values of the bits in S~S+15 determine whether the interrupts are enabled or disabled. When the value of the bit is 1 and the instruction EI is executed, the corresponding interrupt is executed.
  • Page 318 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If S~S+15 exceed the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. 6 - 1 5 0...
  • Page 319: I/O Refreshing Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.7 I/O Refreshing Instructions 6.7.1 List of I/O Refreshing Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  0600 – Refreshing the I/O 6 - 1 5 1...
  • Page 320: Explanation Of I/O Refreshing Instructions

           Pulse instruction 16-bit instruction (5 steps) 32-bit instruction - AH500 AH500 Symbol: D : I/O point whose state is refreshed Number of I/O points whose states n : 1~256 are refreshed Explanation: The I/O states are not refreshed until the instruction END is executed. When the scanning of the program starts, the states of the external inputs are read and stored in the memory.
  • Page 321 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 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.
  • Page 322 AH 5 00 Pr ogr am m ing Ma n ua l 6.8 Miscellaneous Instructions 6.8.1 The List of Miscellaneous Instructions Instruction code Pulse Function Step instruction 16-Bit 32-Bit  0700 – Alternating between ON and OFF 0701 TTMR – –...
  • Page 323     Pulse instruction 16-Bit instruction (3 steps) 32-Bit instruction - AH500 AH500 Symbol: D : Destination device Explanation: When the instruction ALT is executed, the state of the device specified by D alternate between ON and OFF.
  • Page 324 AH 5 00 Pr ogr am m ing Ma n ua l Example 3: When X0.0 is ON, T0 generates a pulse every two seconds. The output Y0.0 alternates between ON and OFF according to the pulses generated by T0. 6 - 1 5 6...
  • Page 325   Pulse instruction 16-Bit instruction (5 steps) 32-Bit instruction - - AH500 Symbol: D : Device in which the time is stored Word n : Multiplier Word Explanation: 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.
  • Page 326 AH 5 00 Pr ogr am m ing Ma n ua l X0.0 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: If D+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 327    Pulse instruction 16-Bit instruction (7 steps) 32-Bit instruction - - AH500 Symbol: S : Timer number T0~T2047 m : Setting value of the timer Word D : Output device Explanation: The instruction STMR is used to generate the off-delay relay, the one-shot circuit, and the flashing circuit.
  • Page 328 AH 5 00 Pr ogr am m ing Ma n ua l X0.0 Y0.0 5 s econds 5 s econds Y0.1 5 s econds 5 s econds Y0.2 5 s econds Y0.3 5 s econds 5 s econds 5 s econds When the conditional contact X0.0 is followed by the normally-closed contact Y0.0, the flashing currents pass through Y0.1 and Y0.2.
  • Page 329    Pulse instruction 16-Bit instruction (9 steps) 32-Bit instruction - - AH500 Symbol: : Initial value of the ramp signal Word : Final value of the ramp signal Word D : Duration of the ramp signal Word n : Number of scan cycles...
  • Page 330 AH 5 00 Pr ogr am m ing Ma n ua l 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. Additional remark: If D+1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 331    Pulse instruction 16-Bit instruction (9 steps) 32-Bit instruction - - AH500 Symbol: S : Initial input device in the matrix scan : Initial output device in the matrix scan Initial corresponding device in the matrix : scan n :...
  • Page 332 AH 5 00 Pr ogr am m ing Ma n ua l composed of X0.0~X0.7 and Y0.0~Y0.7. The corresponding internal relays of the 16 switches are M10~M17 and M20~M27. Y0.1 Y0.0 X0.1 X0.2 X0.3 X0.4 X0.5 X0.6 X0.7 X0.0 X0.1 X0.2 X0.3 X0.4 X0.5 X0.6 X0.7 The eight input devices starting from X0.0 are connected to the two output devices starting...
  • Page 333         Pulse instruction 16-Bit instruction (9 steps) 32-Bit instruction (9 steps) - AH500 AH500 Symbol: Initial device in the : Word/Double word comparison : Comparison value Word/Double word D : Comparison result Number of comparison n :...
  • Page 334 AH 5 00 Pr ogr am m ing Ma n ua l When the current value of C10 is within the range between the minimum value and the maximum value, M10~M13 are ON. Otherwise, M10~M13 are OFF. Minimum value Maximum value Current value of C10 Output D100=40...
  • Page 335 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If S+2*n-1 used in the instruction ABSD exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If S+4*n-1 used in the instruction DABSD exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 336          Pulse instruction 16-Bit instruction (9 steps) 32-Bit instruction - - AH500 Symbol: Initial device in the : Word comparison : Counter number Word : Comparison result Number of comparison : Word...
  • Page 337 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons X0.0 Current v alue Current v alue SM688 Additional remark: If S +1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 338   I_MV    Pulse instruction 16-Bit instruction 32-Bit instruction (35 steps) - - AH500 Symbol: : Enabling the PID algorithm PID_RUN : Target value (SV) Double word : Process value (PV) Double word : PID control mode...
  • Page 339 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Maximum output value : MV_MAX Double word (MV_MAX) Minimum output value : MV_MIN Double word (MV_MIN) : Manual output value (MOUT) MOUT Double word Accumulated integral value :...
  • Page 340 AH 5 00 Pr ogr am m ing Ma n ua l Data Setting Device number Function Description range type switched from ON to OFF, the MV involved in the internal algorithm is involved in the automatic algorithm. If the setting value exceeds the range, it will be counts as 0.
  • Page 341 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Data Setting Device number Function Description range type interval between the timed interrupt tasks. It is the magnified proportional value of the Range of error between positive...
  • Page 342 AH 5 00 Pr ogr am m ing Ma n ua l Data Setting Device number Function Description range type Suppose MV_MAX is set to 1,000. When the MV is larger than 1,000, 1,000 is Range of output. The single- value in MV_MAX precision...
  • Page 343 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Data Setting Device number Function Description range type The MV is withing the range between the MV_MIN and REAL the MV_MAX. Example: Before the instruction PID is executed, the setting of the parameters should be complete.
  • Page 344 AH 5 00 Pr ogr am m ing Ma n ua l The PID algorithm includes the forward action and the reverse action. Whether the action is the forward one or the reverse one depends on the setting of PID_DIR. The PID algorithm is as follows.
  • Page 345 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 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.
  • Page 346 AH 5 00 Pr ogr am m ing Ma n ua l K =40 SV= 1 K =20 K =10 K =5 1 T ime (s ec) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Step 2: When the K is 40, there is overreaction.
  • Page 347 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons The experimental result of the automatic tuning function is shown below. 6 - 1 7 9...
  • Page 348 AH 5 00 Pr ogr am m ing Ma n ua l The experimental result of using the parameters which have been tuned to control the temperature is shown below. As the diagam above shows, after the parameters are tuned automatically, users can get a good temperature control result.
  • Page 349  I_MV    Pulse instruction 16-Bit instruction 32-Bit instruction (43 steps) - - AH500 Symbol: : Enabling the PID algorithm PID_RUN : Target value (SV) Double word : Process value (PV) Double word : PID control mode PID_MODE Double word :...
  • Page 350 AH 5 00 Pr ogr am m ing Ma n ua l Integral gain (second or : Ti_Ki Double word 1/seccond) : Derivative gain (second) Td_Kd Double word Derivative action time constant : Double word (second) : Selection of a PID formula PID_EQ Selection of the calculation of :...
  • Page 351 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Device Function Setting range Description Device number number is complete, the device is automatically set to 0, and is filled in with appropriate parameters Kc_Kp, Ti_K , Td_K and Tf.
  • Page 352 AH 5 00 Pr ogr am m ing Ma n ua l Device Function Setting range Description Device number number If Kc_Kp is equal to 0 when the independent formula is used, the proportional control is not used. It is an integral Range of gain.
  • Page 353 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Device Function Setting range Description Device number number less than the absolute value of ERR_DBW, and check whether the present error meets the cross status condition.
  • Page 354 AH 5 00 Pr ogr am m ing Ma n ua l Device Function Setting range Description Device number number true, the MV will be output according to the MOUT, but it will be still in the range of the MV_MIN to the MV_MAX.
  • Page 355 PV will be used to calculate the control value of the derivative, and the CPU module will count the Delta PV as 0 after the cross status condition is met. (Delta PV=Current PV-Previous PV) In the PV trend chart shown below, the CPU module implements the PID algorithm normally in the A sections A.
  • Page 356 AH 5 00 Pr ogr am m ing Ma n ua l PID algorithms: 1. When PID_MODE is set to 0, the PID control mode is the automatic control mode.  Independent Formula & Derivative of E(PID_EQ=False & PID_DE=False)  Independent Formula &...
  • Page 357 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons  Dependent Formula & Derivative of PV(PID_EQ=True & PID_DE=True) ※The CV values in the formulas above are the MV used in DPIDE. 2.
  • Page 358 AH 5 00 Pr ogr am m ing Ma n ua l PID Block Diagram (Dependent) PID_D IR DEAD BAND PID-P REVERSE X(-1) Kc_Kp Kc_Kp ERR_DBW >0 <=0 PID_MAN BIAS MV_LIMIT Ti_Ki PID-I >0 MV_MAX, M V_MIN <=0 Ti_Ki MOUT_AUTO MOUT MOUT Td_Kd...
  • Page 359: Logic Instructions

    C ha pt er 6 A p pl i e d In s tr uc t io ns 6.9 Logic Instructions 6.9.1 List of Logic Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  0800 WAND DAND Logical AND operation ...
  • Page 360: Explanation Of Logic Instructions

            Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word D : Operation result Word/Double word...
  • Page 361 C ha pt er 6 A p pl i e d In s tr uc t io ns 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).
  • Page 362        Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: : Matrix source 1 Word : Matrix source 2 Word D : Operation result Word n : Length of the array...
  • Page 363 C ha pt er 6 A p pl i e d In s tr uc t io ns 1 1 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 1 1 1 1 1 1 1 1 0 0 0 0 1 1 Before the instruction is executed...
  • Page 364 AH 5 00 Pr ogr am m ing Ma n ua l Example: The following matrix is composed of the three 16-bit devices X 0, X 1, and X 2. The data in X 0 is 16#37, the data in X 1 is 16#68, and the data in X 2 is 16#45. 6 - 1 9 6...
  • Page 365         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word D : Operation result Word/Double word...
  • Page 366 AH 5 00 Pr ogr am m ing Ma n ua l 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.
  • Page 367        Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: : Matrix source 1 Word : Matrix source 2 Word D : Operation result Word n : Length of the array...
  • Page 368 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If S +n-1, S +n-1, or D+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 369         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word D : Operation result Word/Double word...
  • Page 370 AH 5 00 Pr ogr am m ing Ma n ua l 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.
  • Page 371        Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: : Matrix source 1 Word : Matrix source 2 Word D : Operation result Word n : Length of the array...
  • Page 372 AH 5 00 Pr ogr am m ing Ma n ua l ON, and the error code in SR0 is 16#2003. If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 373         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word D : Operation result Word/Double word...
  • Page 374 AH 5 00 Pr ogr am m ing Ma n ua l 6 - 2 0 6...
  • Page 375        Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: : Matrix source 1 Word : Matrix source 2 Word D : Operation result Word n : Length of the array...
  • Page 376 AH 5 00 Pr ogr am m ing Ma n ua l ON, and the error code in SR0 is 16#2003. If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 377        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) - AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word Taking LD& and DLD& for example Explanation:...
  • Page 378 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If S or S is illegal, the condition of the instruction is not met, SM0 is ON, and the error in SR0 is 16#2003. 6 - 2 1 0...
  • Page 379        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) - AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word Taking AND& and DAND& for example Explanation:...
  • Page 380 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If S or S is illegal, the condition of the instruction is not met, SM0 is ON, and the error in SR0 is 16#2003. 6 - 2 1 2...
  • Page 381        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) - AH500 AH500 Symbol: : Data source 1 Word/Double word : Data source 2 Word/Double word Taking OR& and DOR& for example Explanation:...
  • Page 382 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If S or S is illegal, the condition of the instruction is not met, SM0 is ON, and the error in SR0 is 16#2003. 6 - 2 1 4...
  • Page 383: Rotation Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.10 Rotation Instructions 6.10.1 List of Rotation Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  0900 DROR Rotating to the right ...
  • Page 384: Explanation Of Rotation Instructions

            Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: D : Device which is rotated Word/Double word Number of bits forming a n : Word/Double word group...
  • Page 385 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Carry flag ※ b 15 0 1 1 1 1 0 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0 After the rotation is ex ecuted Carry flag b 15...
  • Page 386         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: D : Device which is rotated Word/Double word Number of bits forming a n : Word/Double word group...
  • Page 387 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 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. If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 388         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: D : Device which is rotated Word/Double word Number of bits forming a n : Word/Double word group...
  • Page 389 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 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. If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 390         Pulse instruction 32-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: D : Device which is rotated Word/Double word Number of bits forming a n : Word/Double word group...
  • Page 391 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 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. If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 392         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction - AH500 AH500 Symbol: S : Matrix source Word D : Operation result Word n : Length of the array Word Explanation: The values of the n rows of bits in S are rotated to the right or to the left. When SM616 is OFF, the values of the bits are rotated to the left.
  • Page 393 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Before the rotation is executed 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Carry flag 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 S M614 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0...
  • Page 394 AH 5 00 Pr ogr am m ing Ma n ua l 6.11 Timer and Counter Instructions 6.11.1 List of Timer and Counter Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit Resetting the contact or clearing the 1000 – –...
  • Page 395     Pulse instruction 16-bit instruction (3 steps) 32-bit instruction - - AH500 Symbol: D : Device which is reset Bit/Word Explanation: When the instruction RST is driven, the action of the device specified is as follows. Device status The coil and the contact are set to OFF.
  • Page 396     Pulse instruction 16-bit instruction (5 steps) 32-bit instruction - - AH500 Symbol: : Timer number Word : Setting value of the timer Word Explanation: Please refer to the explanation of the instruction TMRH for more information.
  • Page 397     Pulse instruction 16-bit instruction (5 steps) 32-bit instruction - - AH500 Symbol: : Timer number Word : Setting value of the timer Word Explanation: The timer used in the instruction TMR takes 100 milliseconds as the timing unit, and the timer used in the instruction TMRH takes 1 millisecond as the timing unit.
  • Page 398 AH 5 00 Pr ogr am m ing Ma n ua l 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. Example 3: When X0.0 is ON, the setting value 1000 is loaded to the timer T5.
  • Page 399     Pulse instruction 16-bit instruction (5 steps) 32-bit instruction - - AH500 Symbol: : Counter number Word : Setting value of the counter Word Explanation: When the instruction CNT is executed, the coil of the counter is ON, and the value of the counter increases by one.
  • Page 400      Pulse instruction 16-bit instruction 32-bit instruction (5 steps) - AH500 Symbol: : Counter value Double word : Setting value of the counter Double word Explanation: The instruction DCNT can be used to enable the 32-bit counter within the range between HC0 and HC63.
  • Page 401 C ha pt er 6 A p pl i e d In s tr uc t io ns Additional remark: 1. Please refer to the usage of 32-bit counters in chapter 2 for more information related to SM621~SM684. 2. When declare the operand S1 via ISPSoft, the data type is COUNTER. 6 - 2 3 3...
  • Page 402: Shift Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.12 Shift Instructions 6.12.1 The List of Shift Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  1100 SFTR – Shifting the states of the devices to the right ...
  • Page 403: Explanation Of Shift Instructions

       Pulse instruction 16-bit instruction (9 steps) 32-bit instruction - AH500 AH500 Symbol: S : Initial device in which the value is shifted D : Initial device in which the value is shifted : Length of the data which is shifted Word :...
  • Page 404 AH 5 00 Pr ogr am m ing Ma n ua l F our bits as a group ar e shifted to the r ight. X 0.3 X 0.2 X 0.1 X 0.0 M1 5 M1 4 M1 3 M1 2 M11 M1 0 M9 Example 2: When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0 are divided into groups (five bits as a group), and these groups are shifted to the right.
  • Page 405     Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device in which the value is shifted D : Initial device in which the value is shifted : Length of the data which is shifted Word :...
  • Page 406 AH 5 00 Pr ogr am m ing Ma n ua l F our bits as a group ar e shifted to the left X 0.3 X 0.2 X 0.1 X 0.0 Being c arri ed M11 M1 0 M9 M1 5 M1 4 M1 3 M1 2 Example 2: When X0.0 is switched from OFF to ON, the states of the sixteen bit devices starting from M0...
  • Page 407       Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device in which the value is shifted Word D : Initial device in which the value is shifted Word : Length of the data which is shifted Word :...
  • Page 408 AH 5 00 Pr ogr am m ing Ma n ua l F our r egi ster s as a group are shifted to the r ight. D1 3 D1 2 D11 D1 0 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...
  • Page 409       Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device in which the value is shifted Word D : Initial device in which the value is shifted Word : Length of the data which is shifted Word :...
  • Page 410 AH 5 00 Pr ogr am m ing Ma n ua l F our r egi ster s as a group ar e shifted to the l eft. D1 3 D1 2 D11 D1 0 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...
  • Page 411         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Device in which the data is shifted Word D : Initial device Word n : Data length Word Explanation: 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.
  • Page 412 AH 5 00 Pr ogr am m ing Ma n ua l n=10 Sourc e Pointer D0=3 Additional remark: 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.
  • Page 413         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device Word D : Device in which the data is shifted Word n : Data length Word Explanation: 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.
  • Page 414 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If the value in S is less than 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 415        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device Word D : Device in which the data is stored Word Explanation: The device specified by S is taken as a pointer. When the instruction is executed, the data in the device specified by the value of the pointer is written into the device specified by D and cleared to 0, and the value in the device specified by S decreases by one.
  • Page 416       Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device Word D : Device in which the data is stored Word n : Device in which the data is deleted...
  • Page 417 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: 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.
  • Page 418        Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device Word D : Data which is inserted Word n : Device into which the data is inserted Word...
  • Page 419 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: 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.
  • Page 420          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Matrix source Word D : Operation result Word n : Length of the array Word Explanation: 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.
  • Page 421 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Borr ow flag b 15 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Carry flag 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 After the s hift...
  • Page 422        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Device involved in the shift Word n : Number of bits Word Explanation: The values of the bits in D are shifted by n bits to the right. The vacancies (b15~b15-n+1) resulting from the shift is filled by 0, and the value of bn-1 is transmitted to SM602.
  • Page 423        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Device involved in the shift Word n : Number of bits Word Explanation: The values of the bits in D are shifted by n bits to the left. The vacancies (b0~bn-1) resulting from the shift is filled by 0, and the value of b16-n is transmitted to SM602.
  • Page 424       Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Initial device involve in the shift n : Data length Word Explanation: The states of the n bit devices starting from D are shifted by one bit to the right. The state of D+n-1 is cleared to 0, and the state of D is transmitted to the carry flag SM602.
  • Page 425       Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Initial device involve in the shift n : Data length Word Explanation: The states of the n bit devices starting from D are shifted by one bit to the left. The state of D is cleared to 0, and the state of D+n-1 is transmitted to the carry flag SM602.
  • Page 426        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Initial device involve in the shift Word n : Data length Word Explanation: 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.
  • Page 427        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Initial device involve in the shift Word n : Data length Word Explanation: The data in the n registers starting from D is shifted to the left, and the data in D is cleared to 0.
  • Page 428: Data Processing Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.13 Data Processing Instructions 6.13.1 List of Data Processing Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  1200 DSER Searching the data  1201 DSUM Number of bits whose states are ON ...
  • Page 429: Explanation Of Data Processing Instructions

             Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 AH500 Symbol: Initial device involved in the : Word/Double word comparison : Compared data Word/Double word Initial device in which the D :...
  • Page 430 AH 5 00 Pr ogr am m ing Ma n ua l Example: 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.
  • Page 431         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Destination device Word/Double word Explanation: The number of bits whose values are 1 in S is stored in D.
  • Page 432         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Source device Bit/Word Device in which the decoded values are D : Bit/Word stored n : Number of bits whose values are decoded...
  • Page 433 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Example 2: When X0.0 is switched from OFF to ON, the instruction DECO decodes the values of b2~b0 in D10 as the values of b7~b0 in D20, and the values of b15~b8 in D10 become 0. The values of the lower 3 bits in D10 is decoded as the values of the lower 8 bits in D20.
  • Page 434         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Source device Bit/Word Device in which the encoded values D : Word are stored Number of bits whose values are n :...
  • Page 435 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Example 2: When X0.0 is switched from OFF to ON, the instruction ENCO encodes the values of b0~b7 in D10 as the values of b2~b0 in D20, and the values of b15~b3 in D20 become 0. (The values of b8~b18 in D10 are invalid data.) After the instruction ENCO is executed and X0.0 is switched OFF, the data in D is unchanged.
  • Page 436          Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Source device Word Device in which the seven-segment data is D : Word stored Explanation: The values of the lower 4 bits (b0~b3) in the source device specified by S are decoded as the seven-segment data stored in D.
  • Page 437 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Segment s tate Bi t Assi gnment Dis play pattern of s egments B0(a) B1(b) B2(c) B3(d) B4(e) B5(f) B6(g) 0000 0001 0010 0011 0100...
  • Page 438        Pulse instruction 16-bit instruction (11 steps) 32-bit instruction (11 steps) AH500 AH500 Symbol: Initial device in which the original S : Word/Double word data is stored : Number of rows of data Word/Double word :...
  • Page 439 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons The data which will be sorted is shown below. columns of data Column Column Student Chinese English Math Physics number (D0) 1 (D5) 90 (D10) 75 (D15) 66...
  • Page 440 AH 5 00 Pr ogr am m ing Ma n ua l When the value in D100 is 5, the data is sorted as follows. columns of data Column Column Student Chinese English Math Physics number (D50) 4 (D55) 70 (D60) 60 (D65) 99 (D70) 50...
  • Page 441        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: : Initial device which is reset Bit/Word : Final device which is reset Bit/Word Explanation: When the instruction is executed, the values in D are cleared.
  • Page 442 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If D and D are different types of devices, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2007. If D and D contain different formats of data, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2007.
  • Page 443         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word Device in which the check result is D : stored n : Bit whose state is judged...
  • Page 444 AH 5 00 Pr ogr am m ing Ma n ua l 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 - 2 7 6...
  • Page 445          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction(7 steps) AH500 AH500 AH500 Symbol: S : Initial device Word/Double word Device in which the mean is D : Word/Double word stored n : Number of devices...
  • Page 446 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If the operand n used in the 16-bit instruction is less than 1 or larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B. If the operand n used in the 32-bit instruction is less than 1 or larger than 128, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 447         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Initial device Word Device in which the sum is D : Word stored n : Number of pieces of data...
  • Page 448 AH 5 00 Pr ogr am m ing Ma n ua l 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...
  • Page 449 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 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.
  • Page 450         Pulse instruction 16-bit instruction (3 steps) 32-bit instruction (3 steps) AH500 AH500 AH500 Symbol: Device involved in the getting of the D : Word/Double word absolute value Explanation: When the instruction ABS is executed, the absolute value of the value in the device specified by D is gotten.
  • Page 451          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Matrix source Word D : Operation result Word n : Length of the array Word Explanation: The bits in the n devices starting from the device specified by S are inverted, and the inversion result is stored in D.
  • Page 452          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Matrix source Word n : Length of the array Word D : Pointer Word Explanation: 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.
  • Page 453 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If S+n-1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 454          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Matrix source Word n : Length of the array Word D : Pointer Word Explanation: 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.
  • Page 455 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons SM 615 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 After the instruction i s exec uted 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1...
  • Page 456          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Matrix source Word n : Length of the array Word D : Operation result Word Explanation: 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.
  • Page 457          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Data source Word n : Number of devices Word D : Operation result Word Explanation: 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).).
  • Page 458 AH 5 00 Pr ogr am m ing Ma n ua l D1 0 D1 2 D1 3 T he positions in whcih All becomes 0. the data is stored. Additional remark: 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.
  • Page 459          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: S : Data source Word n : Data length Word D : Operation result Word Explanation: The 16-bit values in the registers specified by S~S+(n-1) are divided into groups (four bits as a group), and every group which is composed of b0~b3 is stored in the register specified by D.
  • Page 460 AH 5 00 Pr ogr am m ing Ma n ua l D1 0 Additional remark: If S~S+(n-1) exceed the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If n is less than 1, or if n is larger than 4, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 461         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: S : Data source Word/Double word n : Data length Word/Double word D : Operation result Double word/Long word...
  • Page 462 AH 5 00 Pr ogr am m ing Ma n ua l (D0+D1+D2) After the instruction is executed Additional remark: If n used in the 16-bit instruction is less than 1 or larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B. If n used in the 32-bit instruction is less than 1 or larger than 128, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 463         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Device number Word n : Bit number Word Explanation: The instruction is used to set the n bit in the register specified by D to 1.
  • Page 464         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Device number Word n : Bit number Word Explanation: The instruction is used to set the n bit in the register specified by D to 0.
  • Page 465         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: D : Device number Bit/Word n : Length Word Explanation: The instruction is used to clear the values in D~D+(n-1). The operand n should be within the range between 1 and 1024.
  • Page 466 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If D~D+(n-1) exceed the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If n is less than 0, or if n is larger than 1024, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B.
  • Page 467          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 AH500 Symbol: : Minimum output value Word/Double word : Maximum output value Word/Double word : Input value Word/Double word D :...
  • Page 468 AH 5 00 Pr ogr am m ing Ma n ua l Minimum output Maximum output Output value in Output value in Function value value D0<500 5001 D0>5000 5000 5000 500≦D0≦5000 Additional remark: If the minimum output value in S is larger than the maximum output value in S , the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 469           Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 AH500 Symbol: Minimum value of the : Word/Double word deadband Maximum value of the : Word/Double word deadband :...
  • Page 470 AH 5 00 Pr ogr am m ing Ma n ua l The figures: BAND is not exec uted. BAND is exec uted. Output value Output value T he lower l imit value of the deadband Input value Input value T he upper li mit value of the deadband The minimum value of the deadband in S...
  • Page 471 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, -10000 or 10000 is subtracted from the binary-coded decimal value in (X2, X1), and the difference is stored in (D11, D10). The execution results: Minimum Maximum...
  • Page 472          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 AH500 Symbol: : Negative deviation Word/Double word : Positive deviation Word/Double word : Input value Word/Double word D : Output value...
  • Page 473 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons value in D should be within the range described below.  If the instruction ZONE is executed, the negative deviation in S , the positive deviation in , the input value in S , and the output value in D is within the range between -32768...
  • Page 474 AH 5 00 Pr ogr am m ing Ma n ua l Negative Positive Input value in Output value in Function deviation deviation (D1, D0) (D11, D10) (D1, D0)<0 -10010 =>(D11, D10) =(-10)+(-10000) (D1, D0)=0 -10000 10000 =>(D11, D10)=0 (D1, D0)>0 10050 =>(D11, D10)=50+10000 6 - 3 0 6...
  • Page 475: Structure Creation Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.14 Structure Creation Instructions 6.14.1 List of Structure Creation Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit 1300 – – Start of the nested loop 1301 NEXT –...
  • Page 476: Explanation Of Structure Creation Instructions

    16# “$”            Pulse instruction 16-bit instruction (3 steps) 32-bit instruction - - AH500 Symbol: Number of times the loop is executed : Word repeatedly 6 - 3 0 8...
  • Page 477 End of the nested loop Pulse instruction 16-bit instruction (1 step) 32-bit instruction - - AH500 Symbol: Explanation: The program between FOR and NEXT is executed N times. After the program between FOR and NEXT is executed N times, the program follows NEXT is executed. The instruction FOR specifies the number of times the program between FOR and NEXT is executed.
  • Page 478 AH 5 00 Pr ogr am m ing Ma n ua l Example 2: When X0.0 is OFF, the program between FOR and NEXT is executed. When X0.0 is ON, the instruction CJ is executed. The execution of the program jumps to LABEL 1:, i.e. network 6, and network 4~network 5 are not executed.
  • Page 479 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6 - 3 11...
  • Page 480 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: Please refer to ISPSoft User Manual for more information related to the usage of the label. 6 - 3 1 2...
  • Page 481        Pulse instruction 16-bit instruction (3 steps) 32-bit instruction - AH500 AH500 Symbol: Device in which the remaining D : number of times the loop can be Word executed is stored P : Pointer...
  • Page 482 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If the part of the program specified by the pointer in the instruction BREAK does not exist, the operation error occurs, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2004.
  • Page 483: Module Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.15 Module Instructions 6.15.1 List of Module Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit Reading the data from the  1400 FROM DFROM...
  • Page 484: Explanation Of Module Instructions

    Explanation: Users can use this instruction to read the data from the control register in the special module into the AH500 series PLC. The operand m should be within the range between 1 and 8. 1 represents a main rack, and 2~8 represent extension racks.
  • Page 485 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons X0.0 is switched from OFF to ON, the instruction FROM is executed. The mode of the data exchange through COM1 on AH50010SCM-5A stored in CR#7 is read into D100. Owing to the fact that no error occurs, the code stored in D110 is 16#0000.
  • Page 486 : Data length Word/Double word Explanation: Users can use this instruction to write the data in the AH500 series PLC into the control register in the special module. The operand m should be within the range between 1 and 8. 1 represents a main rack, and 2~8 represent extension racks.
  • Page 487 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Example: Suppose the first special module at the right side of the CPU module is AH50010SCM-A5. When X1.1 is switched from OFF to ON, the instruction TO is executed. The mode of the data exchange through COM1 on AH50010SCM-5A stored in CR#7 changes from being disabled to being enabled.
  • Page 488 AH 5 00 Pr ogr am m ing Ma n ua l  The n which is 2 in the 16-bit instruction has the same meaning as the n which is 1 in the 32-bit instruction. Specified Specified Specified control register Specified control register device...
  • Page 489: Floating-Point Number Instructions

    Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 6.16 Floating-point Number Instructions 6.16.1 List of Floating-point Number Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  1500 – FSIN Sine of the floating-point number ...
  • Page 490: Explanation Of Floating-Point Number Instructions

           Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Sine value Double word Explanation: Whether the source value specified by S is a radian or a degree depends on the state of SM695.
  • Page 491 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons X1.15~X1.0 F LT D11~D10 F loating- point Binary -coded Binary val ue number decimal value F SIN F RAD D21~D20 D31~D30 R1.570796 F loating- point F loating- point number...
  • Page 492        Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Cosine value Double word Explanation: Whether the source value specified by S is a radian or a degree depends on the state of SM695.
  • Page 493 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons F LT X1.15~X1.0 D11~D10 R360 Binary -coded F loating-point Binary value decimal value number F RAD F CO S D21~D20 D31~D30 R6.283185 F loating-point F loating-point number...
  • Page 494        Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Tangent value Double word Explanation: Whether the source value specified by S is a radian or a degree depends on the state of SM695.
  • Page 495 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons F LT X1.15~X1.0 D11~D10 Binary -coded F loating- point Binary val ue decimal value number F RAD F TAN D21~D20 D31~D30 R0.785398 F loating- point F loating- point number...
  • Page 496         Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Arcsine value Double word Explanation: Arcsine value=sin The relation between sine values and arcsine values are shown below.
  • Page 497 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons F DEG F ASIN D11~D10 D21~D20 R1.570796 F loating- point F loating- point F loating- point number number number DINT D31~D30 Y1.15~Y1.0 Binary v al ue Binary -coded decimal value...
  • Page 498         Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Arccosine value Double word Explanation: Arccosine value=cos The relation between cosine values and arccosine values are shown below.
  • Page 499 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons F ACO S F DEG D11~D10 D21~D20 R180 R3.141592 F loating- point F loating- point F loating- point number number number DINT D31~D30 Y1.15~Y1.0 Binary v al ue...
  • Page 500         Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Arctangent value Double word Explanation: Arctangent value=tan The relation between tangent values and arctangent values are shown below.
  • Page 501 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons F ATAN F DEG D11~D10 D21~D20 R0.785398 F loating- point F loating- point F loating- point number number number DINT D31~D30 Y1.15~Y1.0 Binary v al ue Binary -coded decimal value...
  • Page 502          Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : hyperbolic sine value Double word Explanation: Hyperbolic sine value=(e )/2. If the absolute value of the conversion result is larger than the value which can be represented by the maximum floating-point number, the value in D is 16#7F800000, and SM602 is ON.
  • Page 503          Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Hyperbolic cosine value Double word Explanation: Hyperbolic cosine value=(e )/2. If the absolute value of the conversion result is larger than the value which can be represented by the maximum floating-point number, the value in D is 16#7F800000, and SM602 is ON.
  • Page 504          Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Double word D : Hyperbolic tangent value Double word Explanation: Hyperbolic tangent value=(e )/(e If the conversion result is 0, SM600 is ON.
  • Page 505        Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Data source (degree) Double word D : Conversion result (radian) Double word Explanation: The equation below is used to convert degrees into radians.
  • Page 506        Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Data source (radian) Double word D : Conversion result (Degree) Double word Explanation: The equation below is used to convert radians into degrees.
  • Page 507         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Device in which the result is stored Word/Double word Explanation: The square root of the value in the device specified by S is calculated, and the result is stored in the device specified by D.
  • Page 508        Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source device Double word D : Device in which the result is stored Double word Explanation: The square root of the floating-point number in the register specified by S is calculated, and the result is stored in the register specified by D.
  • Page 509          Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source device Double word Device in which the operation result is D : Double word stored Explanation: Exponentiation involves two numbers, the base e which represents 2.71828, and the exponent in the device specified by S.
  • Page 510        Pulse instruction 16-bit instruction (7-9 steps) 32-bit instruction AH500 AH500 Symbol: : Device in which the base is stored Double word : Source device Double word Device in which the operation result is D :...
  • Page 511 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If the value in S is less than or equal to 1, or if the value in S is less or equal to 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 512        Pulse instruction 16-bit instruction (5-6 steps) 32-bit instruction AH500 AH500 Symbol: S : Source device Double word D : Device in which the operation result is stored Double word Explanation: The natural logarithm of the operand S is calculated.
  • Page 513       Pulse instruction 16-bit instruction (7-9 steps) 32-bit instruction AH500 AH500 Symbol: : Device in which the base is stored Double word : Device in which the power is stored Double word Device in which the operation result is D :...
  • Page 514 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: 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. 6 - 3 4 6...
  • Page 515          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: : Minimum value Word : Maximum value Word D : Device in which the result is stored Word Explanation: The instruction is used to generate the random number within the range between the minimum...
  • Page 516         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source device Word/Double word D : Device in which the result is stored Word/Double word Explanation:...
  • Page 517 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If the value in S is not a binary-coded decimal value (The binary-coded decimal value is represented by the hexadecimal number, but one of digits is not within the range between 0 and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
  • Page 518        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Word D : Result Word Explanation: The source value specified by S is a degree, and the instruction is used to get the sine of the source value specified by S.
  • Page 519 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D. If the value in S is not within the range between 0° and 360°, the operation error occurs, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 520        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Word D : Result Word Explanation: The source value specified by S is a degree, and the instruction is used to get the cosine of the source value specified by S.
  • Page 521 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D. If the value in S is not within the range between 0° and 360°, the operation error occurs, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 522        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Word D : Result Word Explanation: The source value specified by S is a degree, and the instruction is used to get the tangent of the source value specified by S.
  • Page 523 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D. If the value in S is not within the range between 0° and 360°, the operation error occurs, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 524        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Word D : Arcsine value Word Explanation: The source value specified by S is a binary-coded decimal value, and the instruction is used to get the arcsine of the source value specified by S.
  • Page 525 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Take 0.5 for example. When it is entered, users need to enter 0, 0, and 16#5000 into S, S+1, S+2 respectively. If the value in S is not a binary-coded decimal value (The binary-coded decimal value is represented by the hexadecimal number, but one of digits is not within the range between 0 and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
  • Page 526        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Word D : Arccosine value Word Explanation: The source value specified by S is a binary-coded decimal value, and the instruction is used to get the arccosine of the source value specified by S.
  • Page 527 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Take 0.5 for example. When it is entered, users need to enter 0, 0, and 16#5000 into S, S+1, S+2 respectively. If the value in S is not a binary-coded decimal value (The binary-coded decimal value is represented by the hexadecimal number, but one of digits is not within the range between 0 and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
  • Page 528        Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Word D : Arctangent value Word Explanation: The source value specified by S is a binary-coded decimal value, and the instruction is used to get the arctangent of the source value specified by S.
  • Page 529 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Take 0.5 for example. When it is entered, users need to enter 0, 0, and 16#5000 into S, S+1, S+2 respectively. If the value in S is not a binary-coded decimal value (The binary-coded decimal value is represented by the hexadecimal number, but one of digits is not within the range between 0 and 9.), the operation error occurs, SM0 is ON, and the error code in SR0 is 16#200D.
  • Page 530: Real-Time Clock Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.17 Real-time Clock Instructions 6.17.1 List of Real-time Clock Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  1600 TRD – Reading the time  1601 TWR –...
  • Page 531: Explanation Of Real-Time Clock Instructions

            Pulse instruction 16-bit instruction (3 steps) 32-bit instruction AH500 AH500 Symbol: Device in which the result is D : Word stored Explanation: D: The device in which the current time is stored The operand D occupies seven consecutive devices.
  • Page 532 AH 5 00 Pr ogr am m ing Ma n ua l and 59, the value of the minute increases by one, and the value of the second is cleared to zero. If users declare the operand D in ISPSoft, the data type will be ARRAY [7] of WORD/INT. 6 - 3 6 4...
  • Page 533       Pulse instruction 16-bit instruction (3 steps) 32-bit instruction AH500 AH500 Symbol: S : Data source Word Explanation: S: The device into which the setting value is written The operand S occupies seven consecutive devices.
  • Page 534          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: : Source device Word : Source device Word D : Device in which the result is stored Word Explanation: The value of the hour, the value of the minute, and the value of the second in the real-time...
  • Page 535 C ha pt er 6 A p pl i e d In s tr uc t io ns If users declare the operand D in ISPSoft, the data type will be ARRAY [3] of WORD/INT. 6 - 3 6 7...
  • Page 536          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: : Source device Word : Source device Word D : Device in which the result is stored Word Explanation: The value of the hour, the value of the minute, and the value of the second in the real-time...
  • Page 537 C ha pt er 6 A p pl i e d In s tr uc t io ns executed, SM0 is ON, and the error code in SR0 is 16#2003. If S +2, S +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.
  • Page 538         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 Symbol: Time after which the output S : Word/Double word device is ON : Current time Word/Double word : Output device...
  • Page 539 C ha pt er 6 A p pl i e d In s tr uc t io ns 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.
  • Page 540         Pulse instruction 16-bit instruction (11 steps) 32-bit instruction AH500 AH500 Symbol: : Hour of the setting time Word : Minute of the setting time Word : Second of the setting time Word S :...
  • Page 541 C ha pt er 6 A p pl i e d In s tr uc t io ns Additional remark: If S+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If D+2 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 542          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 AH500 Symbol: : Lower limit time Word : Upper limit time Word S : Current time Word D : Comparison result Explanation:...
  • Page 543 C ha pt er 6 A p pl i e d In s tr uc t io ns Additional remark: 1. If S +2, S +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.
  • Page 544: Peripheral Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.18 Peripheral Instructions 6.18.1 List of Peripheral Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit 1700 DTKY – Ten-key keypad 1701 DHKY – Sixteen-key keypad 1702 – –...
  • Page 545: Explanation Of Peripheral Instructions

             Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 Symbol: S : Initial device Device in which the value is : Word/Double word stored : Output signal Explanation: The ten external inputs starting from the input specified by S represents 0~9 in the decimal system.
  • Page 546 AH 5 00 Pr ogr am m ing Ma n ua l 24VDC X0.1 X0.3 X0.0 X0.2 X0.4 X0.5 X0.6 X0.7 X0.8 X0.9 Note: The digital input module AH16AM10N-5A is used in this example. Numeric keys One- di gi t binary- coded Binary -coded decimal code decimal value...
  • Page 547 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons X0.0 X0.1 X0.3 X0.5 Output si gnal Additional remark: If users declare the operand S in ISPSoft, the data type will be ARRAY [10] of BOOL. If users declare the operand D in ISPSoft, the data type will be ARRAY [11] of BOOL.
  • Page 548        Pulse instruction 16-bit instruction (9 steps) 32-bit instruction (9 steps) AH500 AH500 Symbol: : Initial input device : For system use only Word : Initial output device Device in which the value is :...
  • Page 549 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons  Numeric keys: Kyes A B C Ov erflowi ng  If SM691 is OFF, A~F are taken as function keys in the execution of the instruction HKY. ...
  • Page 550 AH 5 00 Pr ogr am m ing Ma n ua l The external wiring: 24VDC X0.0 X0.3 Y0.0 Y0.1 Y0.2 Y0.3 X0.1 X0.2 Note: The transistor output module AH16AP11T-5A is used in this example. Additional remark: If users declare the operand S in ISPSoft, the data type will be ARRAY [4] of BOOL. If users declare the operand D in ISPSoft, the data type will be ARRAY [4] of BOOL.
  • Page 551        Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 Symbol: : Initial input device : For system use only Word : Initial output device : Device in which the value is stored Word :...
  • Page 552 AH 5 00 Pr ogr am m ing Ma n ua l 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. The outputs Y0.0~Y0.3 must be transistors. X1.0 Cycli c ac tion Y0.0...
  • Page 553       Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 Symbol: : Initial input device : For system use only Word : Device in which the setting value is stored Word : Initial output device n :...
  • Page 554 AH 5 00 Pr ogr am m ing Ma n ua l Up arr ow Y 0.4 Y0 .5 X 0.1 Y 0.6 LED indic ators Y 0.7 Right arr ow Left arrow X 0.3 X 0.2 X 0.0 Y 0.0 Y 0.1 Y 0.2 Down arrow...
  • Page 555          Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 Symbol: : Source device Word : For system use only Word D : Initial output device n : Positive/Negative logic Word Explanation:...
  • Page 556 AH 5 00 Pr ogr am m ing Ma n ua l When X1.0 is ON, Y0.4~Y0.7 are ON cyclically. It takes twelve scan cycles for Y0.4~Y0.7 to be ON. After the execution of the instruction is complete, SM693 is ON for a scan cycle. If there is on four-digit seven-segment display, n is within the range between 0 and 3.
  • Page 557 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Output Binary-coded (Binary-coded Signal decimal value decimal code)  The positive logic: Output Binary-coded (Binary-coded Signal decimal value decimal code)  The latch: Positive logic Negative logic Latch...
  • Page 558 AH 5 00 Pr ogr am m ing Ma n ua l  The connection of the common-anode four-digit seven-segment display with IC 7447 is as follows. 5VDC IC7447 6 - 3 9 0...
  • Page 559: Communication Instructions

    C ha pt er 6 A p pl i e d In s tr uc t io n 6.19 Communication Instructions 6.19.1 List of Communication Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit Transmitting the user-defined communication 1800 – –...
  • Page 560: Explanation Of Communication Instructions

           Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 Symbol: S : Initial transmission device Word m : Number of data which is sent Word D : Initial reception device Word : Number of data which is received...
  • Page 561 C ha pt er 6 A p pl i e d In s tr uc t io n 8-bit mode, data transmission 0x01234567 D10 (high) D10 (low) D11 (high) D11 (low) D12 (high) D12 (low) D13 (high) D13 (low) 16#01 16#23 16#45 16#67...
  • Page 562 AH 5 00 Pr ogr am m ing Ma n ua l OFF after the data which has been received is processed. Please do not execute the instruction RST continuously. If the command which the PLC receives includes a special character (SR621), I32 will be triggered.
  • Page 563 C ha pt er 6 A p pl i e d In s tr uc t io n Additional remark: If the value in m or 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. The flags related to the instruction RS/MODRW: Flag Description...
  • Page 564 AH 5 00 Pr ogr am m ing Ma n ua l Flag Description Action COM1 COM2 The communication protocol changes in accordance with the setting Users set the values in SR201, SR202, SR209, SR210, SR211, SR212, SR213, flag to ON, .
  • Page 565 C ha pt er 6 A p pl i e d In s tr uc t io n : (16#6) 0110 115200 RS-232 does not support : (16#7) 0111 230400 the baud rate. RS-232 does not support : (16#8) 1000 460800 the baud rate.
  • Page 566         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 Symbol: : Unit address Word : Operation frequency of the AC motor drives Word n : Mode Word 6 - 3 9 8...
  • Page 567         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 Symbol: : Unit address Word : Operation frequency of the AC motor drives Word n : Mode Word 6 - 3 9 9...
  • Page 568 : Unit address Word Explanation: The instruction FWD/REV/STOP is for the Delta VFD series AC motor drives. FWD/REV/STOP has to be used with SR210 or SR213. The operand S should be within the range between 0 and 255. If the station address is 0, it indicates that the PLC broadcasts to all AC motor drives.
  • Page 569 C ha pt er 6 A p pl i e d In s tr uc t io n PLCVFD The PLC sends “:01 10 2000 0002 04 0012 01F4 C2 CR LF”. VFDPLC The PLC receives “:01 10 2000 0002 CD CR LF”. 6 - 4 0 1...
  • Page 570 AH 5 00 Pr ogr am m ing Ma n ua l The PLC sends the data. Data Description ‘0’ 16#30 ADR 1 ADR (10) is the station address of the AC motor drive. ‘1’ 16#31 ADR 0 ‘1’ 16#31 CMD 1 CMD (10) is the command code.
  • Page 571 C ha pt er 6 A p pl i e d In s tr uc t io n If n exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B. The instructions FWD, REV, STOP, RDST, and RSTEF are consistent with the MODBUS communication format.
  • Page 572       Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 Symbol: S : Unit address Word D : Initial device in which the data is stored Word Explanation: The operand S should be within the range between 1 and 255. It can not be 0.
  • Page 573 C ha pt er 6 A p pl i e d In s tr uc t io n PLCVFD The PLC sends “:01 03 2100 0005 D6 CR LF” (ASCII). VFDPLC The PLC receives “:01 03 0A 0000 0500 01F4 0000 0000 F8 CR LF” (ASCII). The PLC sends the data.
  • Page 574 AH 5 00 Pr ogr am m ing Ma n ua l The PLC receives the data. Data Description ‘0’ 16#30 ADR 1 ‘1’ 16#31 ADR 0 ‘0’ 16#30 CMD 1 ‘3’ 16#33 CMD 0 ‘0’ 16#30 Number of data (counted by the byte) ‘A’...
  • Page 575      Pulse instruction 16-bit instruction (3 steps) 32-bit instruction AH500 Symbol: S : Unit address Word Explanation: The operand S should be within the range between 0 and 255. If the station address is 0, it indicates that the PLC broadcasts to all AC motor drives.
  • Page 576 AH 5 00 Pr ogr am m ing Ma n ua l PLCVFD The PLC sends “:01 06 2002 0002 D5 CR LF” (ASCII). VFDPLC The PLC receives “:01 06 2002 0002 D5 CR LF” (ASCII). The PLC sends the data. Data Description ‘0’...
  • Page 577 C ha pt er 6 A p pl i e d In s tr uc t io n The PLC receives the data. Data Description ‘0’ 16#30 ADR 1 ‘1’ 16#31 ADR 0 ‘0’ 16#30 CMD 1 ‘6’ 16#36 CMD 0 ‘2’...
  • Page 578      Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 Symbol: S : Initial device to which the LRC is applied Word n : Number of bytes Word D : Initial device in which the operation result is stored...
  • Page 579 C ha pt er 6 A p pl i e d In s tr uc t io n The PLC sends the data. Register Data Description D100 16#3A ‘:’ Low 8 bits D101 ‘0’ 16#30 ADR 1 Low 8 bits AD (1, 0) is the station address of the AC motor drive.
  • Page 580 AH 5 00 Pr ogr am m ing Ma n ua l ‘:’ The start-of-text character is ‘:’ (16#3A). Address Hi ‘ 0 ’ Communication address: The 8-bit address is composed of two ASCII codes. Address Lo ‘ 1 ’ Function Hi ‘...
  • Page 581      Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 Symbol: S : Initial device to which the CRC is applied Word n : Number of bytes Word D : Initial device in which the operation result is stored...
  • Page 582 AH 5 00 Pr ogr am m ing Ma n ua l The PLC sends the data. Register Data Description D100 16#01 Address Low 8 bits D101 16#06 Function Low 8 bits D102 16#20 Low 8 bits Data address D103 16#00 Low 8 bits D104...
  • Page 583 C ha pt er 6 A p pl i e d In s tr uc t io n Step 4: If the value of the right-most bit which is shifted to the right is 0, the data gotten from step 3 is stored in the 16-bit register. Otherwise, the logical operator XOR takes 16#A001 and the data in the 16-bit register, and performs the logical exclusive OR operation on each pair of corresponding bits.
  • Page 584 : The function code For example: 1 (16#01): The AH500 series PLC reads the data from several bit devices which are not discrete input devices. 2 (16#02): The AH500 series PLC reads the data from several bit devices which are discrete input devices.
  • Page 585 (:), error checking code (LRC) and tail code (CRLF). The data which is received is stored as the ASCII character in the internal register. The AH500 series PLC automatically converts the data into the hexadecimal value, and the conversion result is stored in S.
  • Page 586 AH500 series is connected to the DVP-ES2 series PLC. ASCII Mode: The AH500 series PLC is connected to the DVP-ES2series PLC. When SM96 and X0.0 are on, the AH500 series PLC sends and receives the Y0~Y15 (Y0 address is 16#0500) commands from DVP-ES2.
  • Page 587 AH500 series is connected to the DVP-ES2 series PLC. ASCII Mode: The AH500 series PLC is connected to the DVP-ES2series PLC. When SM96 and X0.0 are on, the AH500 series PLC sends and receives the Y0 (Y0 address is 16#0500) commands from DVP-ES2.
  • Page 588 AH500 series is connected to the DVP-ES2 series PLC. ASCII Mode: The AH500 series PLC is connected to the DVP-ES2series PLC. When SM96 and X0.0 are on, the AH500 series PLC sends and receives the T0 (T0 address is 16#0600) commands from DVP-ES2.
  • Page 589 10. If the function code specified by S is related to the word device, the device in the external equipment with which the AH500 series PLC communicates has to be the word device. If the function code specified by S is related to the bit device, the device in the external equipment with which the AH500 series PLC communicates has to be the bit device.
  • Page 590 ASCII data, it is suggested that a timeout period should be used as the condition of ending the receiving of data. The instruction COMRS only supports the built-in communication ports of an AH500 series CPU module. (COM1 in AHCPU5xx-EN, and COM1 and COM2 in AHCPU5xx-RS2 are supported.)
  • Page 591 C ha pt er 6 A p pl i e d In s tr uc t io n +1: Condition of ending the receiving of data and D +1 are described below. Mode of receiving data Setting value in D Remark Not receiving Unused...
  • Page 592 AH 5 00 Pr ogr am m ing Ma n ua l communication data. When a timeout occurs, the PLC sets a communication timeout flag to ON. Users have Communication to reset the communication timeout flag to OFF SM104 SM105 timeout flag by means of a program.
  • Page 593 C ha pt er 6 A p pl i e d In s tr uc t io n the timeout period set. It is suggested that the timeout period set should be longer than the time set in D  Mode of receiving data: 2, 3, 5, or 6 Description: ①...
  • Page 594 AH 5 00 Pr ogr am m ing Ma n ua l 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. The 16-bit data is divided into the high 8-bit data and the low 8-bit data.
  • Page 595 C ha pt er 6 A p pl i e d In s tr uc t io n If the number of devices starting from S is not equal to the value in S , the instruction will not be executed, SM0 will be ON, and the error code in SR0 will be 16#2003. If the value in D is not in the range of 0 to 6, the instruction will not be executed, SM0 will be ON, and the error code in SR0 will be 16#2003.
  • Page 596: Other Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.20 Other Instructions 6.20.1 List of Other Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  1900 – Watchdog timer  1901 DELAY – Delaying the execution of the program 1902 GPWM –...
  • Page 597: Explanation Of Other Instructions

    AH500 Symbol: Explanation: In the AH500 series PLC, there is a watchdog timer which is used to monitor the operation of the system. The instruction WDT is used to reset the watchdog timer in the PLC. If the program scanning time exceeds 200 milliseconds, the error LED indicator is ON, and the PLC stops running.
  • Page 598      Pulse instruction 16-bit instruction (3 steps) 32-bit instruction ─ AH500 AH500 Symbol: S : Delay Word Explanation: After the instruction DELAY is executed, the execution of the program following the DELAY is delayed for a period of time specified by users.
  • Page 599      Pulse instruction 16-bit instruction (7 steps) 32-bit instruction ─ ─ AH500 Symbol: : Pulse width Word : Pulse cycle Word D : Output device Explanation: When the instruction GPWM is executed, every pulse with a width specified by S...
  • Page 600 AH 5 00 Pr ogr am m ing Ma n ua l t =1000ms Y0.0 T= 2000ms Additional remark: The instruction counts by the scan cycle. Therefore, the maximum error is one scan cycle. Besides, S , and (S ) should be larger than the scan cycle. Otherwise, an error occurs when the instruction GPWM is executed.
  • Page 601       Pulse instruction 16-bit instruction (7 steps) 32-bit instruction ─ ─ AH500 Symbol: : Time which passes Word : Setting value Word D : Output device Explanation: When the conditional contact is ON, S starts to count. D is not ON until the value in S...
  • Page 602       Pulse instruction 16-bit instruction (3 steps) 32-bit instruction ─ AH500 AH500 Symbol: Device in which the value in the D : Word index register is stored Explanation: The values in E0~E31 are stored in the devices specified by the value in D.
  • Page 603 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: 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.
  • Page 604       Pulse instruction 16-bit instruction (3 steps) 32-bit instruction ─ AH500 AH500 Symbol: Device from which the value is D : Word read Explanation: The values in the devices specified by the value in D are read into E0~E31, and the value in D decreases by one.
  • Page 605 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If the value in D is less than or equal to 0, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 606: String Processing Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.21 String Processing Instructions 6.21.1 List of String Processing Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit 64-bit Converting the singed decimal  2100 BINDA DBINDA – number into the ASCII code Converting the binary hexadecimal ...
  • Page 607: Explanation Of String Processing Instructions

            Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source value Word/Double word Device in which the conversion D : Word result is stored Explanation: The signed decimal binary number in S is converted into the ASCII code, and the conversion result is stored in D.
  • Page 608 AH 5 00 Pr ogr am m ing Ma n ua l ASCII code in Sign (±) the billi ons place ASCII code in the ASCII code in hundred mil lions plac e the ten mill ions plac e ASCII code in the hundred ASCII code in High 16 bi ts Low 16 bits...
  • Page 609 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 16#20( ) 16#20( ) 16#31(1) 5126 16#35(5) 16#36(6) 16#32(2) 16#00 Example 2: Suppose the value in L10 is -3842563 and SM690 is OFF. When the PLC runs, the values in D0, D1, D2, D3, D4, and D5 are 16#202D, 16#2020, 16#3833, 16#3234, 16#3635, and 16#0033 respectively.
  • Page 610          Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source value Word/Double word Device in which the conversion D : Word result is stored...
  • Page 611 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons If SM690 is OFF, 16#0000 is stored in D+4. If SM690 is ON, the value in D+4 is unchanged. For example, if the value in S is 16#03AC625E and SM690 is OFF, the conversion result is as follows.
  • Page 612 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If D+2 used in the 16-bit instruction exceeds the device range, SM0 is ON, and the error code in SR0 is 16#2003. If D+4 used in the 32-bit instruction exceeds the device range, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 613         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction (5 steps) AH500 AH500 AH500 Symbol: S : Source value Word/Double word Device in which the conversion D : Word result is stored Explanation: The binary-coded decimal number in S is converted into the ASCII code, and the conversion result is stored in D.
  • Page 614 AH 5 00 Pr ogr am m ing Ma n ua l ten millions place of the number are 0. When the instruction is executed, 16#20 is stored in the low 8 bits in D+1, the high 8 bits in D, and the low 8 bits in D. 16#20( ) 16#20( ) 16#31( 1)
  • Page 615 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: 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.
  • Page 616          Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction (5-11 steps) AH500 AH500 AH500 Symbol: S : Source value Word Device in which the conversion D : Word/Double word result is stored...
  • Page 617 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons ASCII code in Sign the billi ons place ASCII code in ASCII code in the (D+1, D) the ten mill ions plac e hundred mil lions pl ac e ASCII code in ASCII code in the hundred...
  • Page 618 AH 5 00 Pr ogr am m ing Ma n ua l 16#20( ) 16#20( ) 16#20( ) 16#20( ) (D1, D0) 3968370 16#33( 3) 39(9) (Regarded as +0003968370) 16#38( 8) 16#36( 6) 16#37( 7) 16#33( 3) 16#30( 0) Example 3: Suppose S is the string “1”.
  • Page 619          Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction (5-11 steps) AH500 AH500 AH500 Symbol: S : Source value Word Device in which the conversion D : Word/Double word result is stored...
  • Page 620 AH 5 00 Pr ogr am m ing Ma n ua l 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.
  • Page 621 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If the ASCII code in S is not within the range between 16#30 and 16#39, or within the range between 16#41 and 16#46, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 622         Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction (5-11 steps) AH500 AH500 AH500 Symbol: S : Source value Word/Double word Device in which the D : Word/Double word conversion result is stored...
  • Page 623 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons ASCII code in ASCII code in b15 b12 b11 b8 b7 b4 b3 b15 b12 b11 b8 b7 b4 b3 the milli ons place the ten mill ions place ASCII code in the ASCII code in the hundred...
  • Page 624 AH 5 00 Pr ogr am m ing Ma n ua l Example 3: Suppose S is the string “1”. Since the number of characters contained in the string is less than 4, the string is regarded as “1000”. When the PLC runs, the value in D20 is 16#1000. Example 4: Suppose S is the string “0001”.
  • Page 625 16#46( F) 16#45( E) 16#48( H) 16#47( G) 16#00 16#49( I) En di ng cha ra cter Example 1: Suppose S is the string “DELTA”. When the PLC runs, the value in D0 is 5. 6 - 4 5 7...
  • Page 626 AH 5 00 Pr ogr am m ing Ma n ua l Example 2: Suppose the data in D0~D2 is as follows. When the PLC runs, the value in L0 is 5. 16#45 (E) 16#44 (D) 16#54 (T) 16#4C (L) 16#00 (Ending character) 16#41 (A) Additional remark:...
  • Page 627         Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH500 AH500 AH500 Symbol: Initial device in which the : Word/Double word number of characters is stored : Value which is converted...
  • Page 628 AH 5 00 Pr ogr am m ing Ma n ua l S1+1 16#31(1) 16#2D( -) 16#2E(.) 32(2) Sign 33(3) 16#00 Ending character - 123 D$STR: The value in S should be within the range between 2 and 13. The value in S +1 should be within the range between 0 and 10, and should be less than or equal to the value in S minus 3.
  • Page 629 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Number of characters Number of dec imal plac es 000000543.21 Binary number 54321 T he sign code is 16#20, and the mis sing digits are r eplaced by 16#30 ("...
  • Page 630 AH 5 00 Pr ogr am m ing Ma n ua l 16#30( 0) 16#20( ) 16#2E(.) 16#30( 0) ( D11, D10) 16#32( 2) 16#31( 1) 12345678 16#34( 4) 16#33( 3) ( D1, D0) “ 0.012345678” 16#35( 5) 16#36( 6) 16#38( 8) 16#37( 7) ( D2, D3)
  • Page 631         Pulse 16-bit instruction (7-13 steps) 32-bit instruction (7-13 steps) AH500 AH500 AH500 Symbol: S : Source value Word Device in which the number : Word/Double word of characters is stored Device in which the binary :...
  • Page 632 AH 5 00 Pr ogr am m ing Ma n ua l If the data in S~S+3 is -123.45, the calculation is as follows. D1 +1 16#31(1) 2D( -) 33(3) 32(2) - 12345 2E(.) 34(4) 35(5) If there is 16#20 or 16#30 between the sign character and the first value which is not 0 in the string, 16#20 or 16#30 is ignored when the string is converted into the binary number.
  • Page 633 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons If the data in S~S+5 is -12345.678, the calculation is as follows. (D1+ 1,D1) (D1+ 3,D1+ 2) 16#31(1) 2D(-) (D2+ 1,D2) 33(3) 32(2) - 12345678 35(5)
  • Page 634 AH 5 00 Pr ogr am m ing Ma n ua l Example 2: ( D11,D10) Number of characters 16#31(1) 16#20( ) (D13,D12) 16#33(3) 16#32(2) Number of dec imal plac es 16#35(5) 16#34(4) (D1,D0) 16#36(6) 16#2E(.) 12345678 16#38(8) 16#37(7) 16#00 Additional remark: If the number of characters contained in the string in S exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 635          Pulse instruction 16-bit instruction (7-8 steps) 32-bit instruction AH500 AH500 Symbol: : Source value Double word Initial device in which the : Word format is stored Initial device in which the D :...
  • Page 636 AH 5 00 Pr ogr am m ing Ma n ua l Suppose the number of characters is 8, the number of decimal places is 2, and the value is -1.23456. The calculation is as follows. 16#20( ) 2D( -) 31(1) 20( ) 32(2)
  • Page 637 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Exponential format Ex pon ential format Numbe r of cha ract ers Numbe r of dec im al plac es F irst ASCII code Sign (Integer) Decimal poi nt (.) Second A SCII code...
  • Page 638 AH 5 00 Pr ogr am m ing Ma n ua l ( S1+1,S1) - 12.34567 Example 1: Suppose the value in D4 is 0. The floating-point number in (D1, D0) is converted into the decimal format of the string. Dec imal fo rm at 16#20( ) 20( )
  • Page 639 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons the error code in SR0 is 16#2003.  The decimal format: If the value in S +2 is 0, the value in S +1 should be within the range between 2 and 24, and the number of characters which the integer part contains should be less than or equal to 23.
  • Page 640          Pulse instruction 16-bit instruction (5-11 steps) 32-bit instruction AH500 AH500 Symbol: S : Source value Word Device in which the conversion D : Double word result is stored Explanation: The string in S is converted into the floating-point number, and the conversion result is stored in D.
  • Page 641 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 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 S is 16#2D, the conversion result is a negative value.
  • Page 642 AH 5 00 Pr ogr am m ing Ma n ua l 20( ) 16#20( ) 2E(.) 31(1) ( D101, D100) 33(3) 32(2) 16#3C4A42AD 34(4) 35(5) F loating-point number 1.2345E-2 45(E) 2D(-) 16#30(0) 16#32(2) 16#00 Ignor ed Ignor ed Additional remark: If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
  • Page 643          Pulse instruction 16-bit instruction (7-13 steps) 32-bit instruction AH500 AH500 Symbol: S : String Word Number of characters which are n : Word retrieved Device in which the characters D :...
  • Page 644 AH 5 00 Pr ogr am m ing Ma n ua l Example: 16#41( A) 16#42(B) 46(F ) 16#45( E) 44(D) 16#43( C) 48(H) 47(G) 46(F ) 45(E) T he fourth char ac ter from the last 16#48( H) 16#47( G) Additional remark: If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
  • Page 645         Pulse instruction 16-bit instruction (7-13 steps) 32-bit instruction AH500 AH500 Symbol: S : String Word Number of characters which are n : Word retrieved Device in which the characters D : Word...
  • Page 646 AH 5 00 Pr ogr am m ing Ma n ua l D100 16#42(B) 16#41( A) 42(B) 16#41( A) D101 44(D) 43(C) 44(D) 43(C) D102 46(F ) 45(E) 46(F ) 45(E) Six th charac ter 48(H) D103 16#47( G) D104 Additional remark: If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E.
  • Page 647          Pulse instruction 16-bit instruction (7-13 steps) 32-bit instruction AH500 AH500 Symbol: : String Word Part of the string which is : Word retrieved Device in which the characters D : Word...
  • Page 648 AH 5 00 Pr ogr am m ing Ma n ua l 16#42(B) 16#41( A) 46(F ) 16#45( E) 44(D) 43(C) 48(H) 47(G) 46(F ) 45(E) 4A(J ) 49(I) Fifth c harac ter 48(H) 47(G) 4B(K) 4A(J ) 49(I) 4B(K) Example: 16#32(2) 16#31( 1)
  • Page 649           Pulse instruction 16-bit instruction (7-13 steps) 32-bit instruction AH500 AH500 Symbol: : String Word Part of the string which is : Word replaced D : String which is replaced Word...
  • Page 650 AH 5 00 Pr ogr am m ing Ma n ua l 16#32(2) 16#H31( 1) 46(F ) 16#45(E) 34(4) 33(3) 48(H) 47(G) 36(6) 35(5) 4A(J ) 49(I) 38(8) 37(7) 4B(K) 4C(L) 4D(M) 39(9) Af ter the in st ruct ion is ex ec ute d In iti al cha ra cter in D whi ch is r ep la ced Nu mbe r o f cha ra cter s whi ch a re re tri eve d fr om S 1...
  • Page 651 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 16#42(B) 32(2) 16#31( 1) D100 16#41( A) 44(D) 43(C) 34(4) 33(3) D101 46(F) 45(E) 36(6) 35(5) D102 37(7) 38(8) D103 D104 Af ter t he in st ruct ion is ex ec uted In iti al cha ra cter in D whi ch i s re pl ac ed Nu mbe r o f cha ra cter s whi ch a re re tri eve d fr om S 1...
  • Page 652         Pulse instruction 16-bit instruction (9-21 steps) 32-bit instruction AH500 AH500 Symbol: : String which is searched Word : String which is searched for Word character in S from which the n :...
  • Page 653 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 16#32(2) 16#31( 1) 44(D) 43(C) Searc hing the str ing from the thi rd c har acter 42(B) 16#41( A) Matching c har acter 48(H) 47(G) Ignored...
  • Page 654           Pulse instruction 16-bit instruction (11-17 steps) 32-bit instruction AH500 AH500 Symbol: : String which is replaced Word : New string Word Number of characters in S which are : Word...
  • Page 655 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons If the value in S is equal to 0, the instruction is not executed. Example: When M0 is ON, the data in D0~D7 is “1234ABAB1234AB”, and the data in D10~D11 is “CDEF”. When the instruction $RPLC is executed, the characters in D0~D7 starting from the character indicated by the value in D51 are replaced by the characters in D10~D11.
  • Page 656 AH 5 00 Pr ogr am m ing Ma n ua l If the values in D50 and D51 are 4 and 4 respectively, the execution result is as follows. 32(2) 16#31( 1) 16#32(2) 16#31( 1) 43(C) 33(3) 34(4) 33(3) 42(B) 45(E) 44(D)
  • Page 657          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 AH500 Symbol: : String Word : Number of characters which are deleted Word The characters in S starting from the : character indicated by the value in S Word deleted.
  • Page 658 AH 5 00 Pr ogr am m ing Ma n ua l 16#32(2) 16#31(1) 34(4) 33(3) 32(2) 16#31(1) 36(6) 35(5) After the instruction 0000 38(8) 37(7) is executed 30(0) 39(9) Ignored Larger than the number of charac ter s which can be deleted i n the str ing in S1 If the value in S is equal to 0, the instruction is not executed.
  • Page 659 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons If the values in D10 and D11 are 5 and 1 respectively, the execution result is as follows. 16#32(2) 16#31(1) 34(4) 33(3) 37(7) 16#36(6) 36(6)
  • Page 660 SM SR 16# “$”        Pulse instruction 16-bit instruction (3 steps) 32-bit instruction AH500 AH500 Symbol: S : String which is cleared Word Explanation: The string in S is cleared. 0000 16#31(1) 2D(-) 0000...
  • Page 661           Pulse instruction 16-bit instruction (9-15 steps) 32-bit instruction AH500 AH500 Symbol: : String Word : String which is inserted Word The string is inserted into S after the : Word...
  • Page 662 AH 5 00 Pr ogr am m ing Ma n ua l If the value in D30 is 1, the execution result is as follows. 16#32(2) 16#31( 1) 41(A) 16#31( 1) 32(2) 42(B) 34(4) 33(3) 36(6) 34(4) 33(3) 35(5) After the instruction 36(6) 35(5) 37(7)
  • Page 663          Pulse instruction 32-bit instruction (7-8 steps) 64-bit instruction AH500 AH500 Symbol: : Floating-point number Double word : Number of places Word D : Conversion result Word Explanation: The decimal point in the floating-point number in S...
  • Page 664 AH 5 00 Pr ogr am m ing Ma n ua l as follows. The value in D is 1 because the floating-point number in S is a negative number. The value stored in (D+2, D+1) is 16#3225550. (The floating-point number is converted into the seven-digit binary-coded decimal number, and the seven-digit binary-coded decimal number is rounded off).
  • Page 665 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If the value in S exceeds the range of values which can be represented by the floating-point numbers, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2013. If the value in S exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 666           Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 Symbol: Binary-coded decimal : Word floating-point number : Number of places Word D : Conversion result Double word Explanation: The binary-coded decimal floating-point number in S...
  • Page 667 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 1 6# 12 34 57 0 1 .23 45 7 The value in D0 is 0 because the binary-coded decimal floating-point number is a positive number. 16#1234570 is stored in (D2, D1).
  • Page 668: Ethernet Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.22 Ethernet Instructions 6.22.1 List of Ethernet Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  2200 SOPEN – Opening the socket  2201 SSEND – Sending the data through the socket ...
  • Page 669: Explanation Of Ethernet Instructions

    1 if users want to open the TCP socket, and S is 0 if users want to open the UDP socket. is the socket number. The AH500 series PLC as the client sends the TCP connection request to the server if S...
  • Page 670 AH 5 00 Pr ogr am m ing Ma n ua l Socket Number Item Local communication SR1118 SR1131 SR1144 SR1157 SR1170 SR1183 SR1196 SR1209 port Remote IP address SR1119 SR1132 SR1145 SR1158 SR1171 SR1184 SR1197 SR1210 (high word) Remote IP address SR1120 SR1133...
  • Page 671 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Socket Number Item Transmitted SR1226 SR1238 SR1250 SR1262 SR1274 SR1286 SR1298 SR1310 data length Transmitted data address SR1227 SR1239 SR1251 SR1263 SR1275 SR1287 SR1299 SR1311...
  • Page 672 AH 5 00 Pr ogr am m ing Ma n ua l Local Remote Remote IP communication communication Description address port port 1. The connection requests from the local communication port, the remote communication port, and the specific IP address are received. Specific 2.
  • Page 673 Example 1: The system framework below illustrates how to establish the TCP connection between a computer as the client and an AH500 series PLC as the server. Ethernet Configuration Setups: ISPSoft > HWCONFIG > CPU > PLC Parameter Setting >...
  • Page 674 AH 5 00 Pr ogr am m ing Ma n ua l connection procedure is performed. After the socket has been connected, M0 will is switched OFF and M1 will be ON. When M1 is ON, whether the socket has been connected and no data is being sent is checked. If the socket has been connected, and no data is being sent, the data will be sent.
  • Page 675 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons The example illustrates how to establish the UDP connection between a computer and an AH500 series PLC. 10. When M0 is ON, whether the socket has been connected is checked. If the socket has not been connected, the connection procedure is performed.
  • Page 676 SM0 is ON, and the error code in SR0 is 16#2003. When the AH500 series PLC as the server starts the TCP connection, if the number of servers which can be connected reaches the upper limit, the error occurs, the corresponding error flag is ON, the error code is 16#600A, and the instruction is not executed.
  • Page 677 ON, the error code is 16#600B, and the instruction is not executed. When the AH500 series PLC is the client and the TCP connection is started, if the local communication port has been used, the error occurs, the corresponding error flag is ON, the error code is 16#600C, and the instruction is not executed.
  • Page 678         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: : Socket mode Word : Socket number Word Explanation: 1. S is 1 if users want to open the TCP socket, and S is 0 if users want to open the UDP socket.
  • Page 679 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons 7. While using this instruction, if the transmission length is an odd number, use the following flag to set up. Flags for Flags for Socket number sending an odd number of...
  • Page 680 AH 5 00 Pr ogr am m ing Ma n ua l Additional remark: If S or S exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. If the data is sent through the TCP socket, and the device from which the data is read is not the device permitted by the socket, the error occurs, the corresponding error flag is ON, the error code is 16#6203, and the instruction is not executed.
  • Page 681         Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 Symbol: : Socket mode Word : Socket number Word Explanation: 1. S is 1 if users want to open the TCP socket, and S is 0 if users want to open the UDP socket.
  • Page 682 AH 5 00 Pr ogr am m ing Ma n ua l Being receiving the Having received the UDP socket number Error flag data data SM1372 SM1370 SM1373 6. Generally, the pulse instruction SRCVDP is used. Example: Please refer to the example of the execution of SOPEN. Additional remark: If S , or S...
  • Page 683         Pulse instruction 16-bit instruction (5 Steps) 32-bit instruction AH500 AH500 Symbol: : Socket mode Word : Socket number Word Explanation: 1. S is 1 if users want to close the TCP socket, and S is 0 if users want to close the UDP socket.
  • Page 684 AH 5 00 Pr ogr am m ing Ma n ua l Socket number Error flag SM1363 SM1368 SM1373 8. Generally, the pulse instruction SCLOSEP is used. Example: Please refer to the example of the execution of SOPEN. Additional remark: If S , or S exceeds the range, the instruction is not executed, SM0 is ON, and the error code...
  • Page 685          Pulse instruction 16-bit instruction (9 steps) 32-bit instruction AH500 AH500 Symbol: : Remote email address Word : Email subject Word : Email body Word D : Completion of the instruction Explanation:...
  • Page 686 AH 5 00 Pr ogr am m ing Ma n ua l Example: Suppose the value in D0 is 00010100. When X0.0 is ON, the email is sent to remote email address 3, and remote email address 5. After the communication with the SMTP sever is complete, M20 is ON.
  • Page 687 : Function code For example: 1 (16#01): The AH500 series PLC reads the data from several bit devices which are not discrete input devices. 2 (16#02): The AH500 series PLC reads the data from several bit devices which are discrete input devices.
  • Page 688 AH 5 00 Pr ogr am m ing Ma n ua l 5 (16#05): The AH500 series PLC writes the state into a bit device. 6 (16#06): The AH500 series PLC writes the data into a word device. 15 (16#0F): The AH500 series PLC writes the states into several bit devices.
  • Page 689 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If the value in S , or S exceeds the range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003.
  • Page 690        Pulse instruction 16-bit instruction 32-bit instruction (5 steps) AH500 AH500 Symbol: S : Source value Double word D : Conversion result Word Explanation: The IP address of the integer type in S is converted into the IP address of the string type, and the conversion result is stored in D.
  • Page 691 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Additional remark: If users declare the operand D in ISPSoft, the data type will be ARRAY [8] of WORD/INT. 6 - 5 2 3...
  • Page 692        Pulse instruction 16-bit instruction 32-bit instruction (5-11 steps) AH500 AH500 Symbol: S : Source value String D : Conversion result Double word Explanation: 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.
  • Page 693 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Example 2: Additional remark: If the string in S does not end with 16#00, SM0 is ON, and the error code in SR0 is 16#200E. In the string in S, except for the code representing the decimal point, the other binary codes have to be within the range between 16#30 and 16#39.
  • Page 694: Memory Card Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.23 Memory Card Instructions 6.23.1 List of Memory Card Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit Writing the data from the PLC into the  2300 MWRIT –...
  • Page 695: Explanation Of Memory Card Instructions

              Pulse instruction 16-bit instruction (13 steps) 32-bit instruction AH500 AH500 Symbol: : Control parameter Word : Data source Word : Data length Double word : Line advance Word : File name Word :...
  • Page 696 AH 5 00 Pr ogr am m ing Ma n ua l Item Code Description The file name extension is .cvs. The ASCII codes are adopted. The value which is stored is a hexadecimal value. The values are separated by a tab. The unit of the value is the word.
  • Page 697 “Test1”, the characters are written into the devices as follows.  The default folder path: Model name Folder path AHCPU530-RS2 AHCPU530-EN PLC CARD\AH500\UserProg AHCPU530-EN/RM AHCPU533-EN  : The value in the file which is overwritten is indicated by the value in S Item Description If the file format is 0, 1, 3, or 5, the unit of the value is the word.
  • Page 698 AH 5 00 Pr ogr am m ing Ma n ua l 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.
  • Page 699          Pulse instruction 16-bit instruction (13 steps) 32-bit instruction AH500 AH500 Symbol: C : Control parameter Word : File name Word : Data address in the file Double word : Reserved Word :...
  • Page 700 The file which is created is in the default folder. If the file name is “Test1”, the characters are written into the devices as follows.  The default folder path: Model name Folder path AHCPU530-RS2 AHCPU530-EN PLC CARD\AH500\UserProg AHCPU530-EN/RM AHCPU533-EN 6 - 5 3 2...
  • Page 701 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons  : The value in the file which is read is indicated by the value in S Item Description If the file format is 0, 1, 3, or 5, the unit of the value is the word. If the Value unit file format is 2, 4, or 6, the unit of the value is the double word.
  • Page 702 AH 5 00 Pr ogr am m ing Ma n ua l Operand Setting value Description The file from which the data is read The file format: The values are separated by a comma. 16#0011 The unit of the value is the word. The file name extension is .csv.
  • Page 703           Pulse instruction 16-bit instruction (11 steps) 32-bit instruction AH500 AH500 Symbol: C : Control parameter Word S : Data source Word : Data length Word : Separation mark Word : File name...
  • Page 704 “Test1”, the characters are written into the devices as follows.  The default folder path Model name Folder path AHCPU530-RS2 AHCPU530-EN PLC CARD\AH500\UserProg AHCPU530-EN/RM AHCPU533-EN The related flags: Flag Description SM450 If the memory card is in the CPU module, the flag is ON.
  • Page 705 Ch a pt er 6 Ap p l i ed I ns t r uc t i ons Example: SM450 is ON when the memory card is inserted into the CPU module; SM452 is ON when MTWRIT is executed; SM452 is OFF when the execution of MTWRIT is complete. Operand Setting value Description...
  • Page 706: Task Control Instructions

    AH 5 00 Pr ogr am m ing Ma n ua l 6.24 Task Control Instructions 6.24.1 List of Task Control Instructions Instruction code Pulse Function Step instruction 16-bit 32-bit  2400 TKON – Enabling the cyclic task  2401 TKOFF –...
  • Page 707: Explanation Of Task Control Instructions

         Pulse instruction 16-bit instruction (3 steps) 32-bit instruction AH500 AH500 Symbol: S : Task number Word Explanation: The cyclic task specified by S is enabled. When the PLC runs, the execution of the cyclic tasks depends on the setting of the cyclic tasks in ISPSoft.
  • Page 708       Pulse instruction 16-bit instruction (3 steps) 32-bit instruction AH500 AH500 Symbol: S : Task number Word Explanation: The cyclic task specified by S is disabled. When the PLC runs, the execution of the cyclic tasks depends on the setting of the cyclic tasks in ISPSoft.
  • Page 709: Sfc Instructions

    C h a p t e r 6 A p p l i e d I n s t r u c t i o n s 6.25 SFC Instructions 6.25.1 List of SFC Instructions Instruction code Pulse Function Step 16-bit 32-bit instruction...
  • Page 710 Device “$”        32-bit Pulse instruction 16-bit instruction (7 steps) AH500 Symbol: : Name of the SFC POU : Function code Word : Device address Explanation: The designated SFC program of S will be activated according to the setups of S...
  • Page 711 C h a p t e r 6 A p p l i e d I n s t r u c t i o n s begin to execute from STEP 1. When S is set to 1, the status and the parameters will be cleared and will begin to execute from the designated STEP of S 3.
  • Page 712 A H 5 0 0 P r o g r a m m i n g M a n u a l TestSFC1 POU 6 - 5 4 4...
  • Page 713 C h a p t e r 6 A p p l i e d I n s t r u c t i o n s TestSFC2 POU Additional Remark: Please refer to ISPSoft User Manual for more information related to SFC. 6 - 5 4 5...
  • Page 714       32-bit Pulse instruction 16-bit instruction (5 steps) AH500 Symbol: : Name of the SFC POU : Function code Word Explanation: The designated SFC POU of S will pause according to the setups of S...
  • Page 715 SFC Stop Device “$” 32-bit Pulse instruction 16-bit instruction (3 steps) AH500 Symbol: S : Name of the SFC POU Explanation: The designated SFC POU of S will stop. When the instruction is executed, the SFC POU designated by S will stop only when the SFC POU is being scanned.
  • Page 716: Redundant Instructions

    A H 5 0 0 P r o g r a m m i n g M a n u a l 6.26 Redundant Instructions 6.26.1 List of SFC Instructions Instruction code Pulse Function Step 16-bit 32-bit instruction Switching from Master CPU to Standby ...
  • Page 717: Explanation Of Redundant Instructions

          32-bit Pulse instruction 16-bit instruction (7 steps) AH500 AH500 Symbol: D : Error code Word Explanation: This instruction is for Redundant CPU Module AHCPU560-EN2. When the instruction is executed, the system switches from Master CPU to Standby CPU.
  • Page 718           32-bit Pulse instruction 16-bit instruction (5 steps) AH500 Symbol: Redundant system S : Word data type Redundant system D : data and operation Word result Explanation: This instruction is for Redundant CPU Module AHCPU560-EN2.
  • Page 719 C h a p t e r 6 A p p l i e d I n s t r u c t i o n s Description Description Description D: Standby CPU does not exist Bit0 D+2: Master CPU does not exist Bit1 RUN LED ON Bit2...
  • Page 720 Chapter 7 Error Codes Table of Contents Error Codes and LED Indicators ............... 7-2 7.1.1 CPU Modules ..................7-2 7.1.2 Analog I/O Modules and Temperature Measurement Modules ..7-22 7.1.3 AH02HC-5A/AH04HC-5A ..............7-24 7.1.4 AH05PM-5A / AH10PM-5A / AH15PM-5A ........7-24 7.1.5 AH20MC-5A ..................7-25 7.1.6 AH10EN-5A / AH-15EN-5A ..............7-26 7.1.7...
  • Page 721: Error Codes And Led Indicators

    AH 5 00 Pr ogr am m ing Ma n ua l 7.1 Error Codes and LED Indicators  Columns a. Error code: If the error occurs in the system, the error code is generated. b. Description: The description of the error c.
  • Page 722 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT 16#0016 The module setting is incorrect. (SM10) Stop Keep The device which is associated with the data 16#0017 Stop Keep register is incorrect.
  • Page 723 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT 16#0055 The latched 32-bit counters are abnormal. Continue Keep The memories in the latched timers are 16#0056 Continue Keep abnormal.
  • Page 724 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT The checksum of the high-speed data 16#140C Stop Keep exchange is incorrect. (SM9) The ID of the actual power supply module is 16#140D not the same as the ID of the power supply Stop...
  • Page 725 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT 1. The instruction does not support the device. 2. Encoding error 16#2010 Stop Blinking Keep 3. The instruction is a 16-bit instruction, but the constant operand is a 32-bit code.
  • Page 726 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT The execution of FWD is abnormal. Self-defined 16#2028 Blinking Keep (SM102/103) The execution of REV is abnormal. Self-defined 16#2029 Blinking Keep (SM102/103) The execution of STOP is abnormal.
  • Page 727 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT 16#6002 Illegal netmask address (SM1107) Continue Blinking Keep 16#6003 Illegal gateway mask (SM1107) Continue Blinking Keep The IP address filter is set incorrectly. 16#6004 Continue Blinking...
  • Page 728 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT The transmitted data length set in the TCP 16#6204 Continue Keep Keep socket function is illegal. The data which is sent through the TCP 16#6205 Continue Keep...
  • Page 729 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT The module ID or the setting of the module is 16#630A Continue Blinking Keep different from the setting in the Ether Link. The setting of the netmask address for the 16#630B CPU or the module is different from the setting...
  • Page 730 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT The function code in a reply command is 16#7410 Continue Keep Keep incorrect. Owing to the fact that SW1 is ON, data can 16#7412 Continue Keep...
  • Page 731 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT 16#860F System restoration error Continue Blinking Blinking No memory card exists, or the memory card 16#8611 Continue Keep Keep format is incorrect.
  • Page 732 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT The setting of the data exchange for slave 16 16#9A10 in the PLC Link / COM1 MODBUS is incorrect. Continue Keep Keep (SM1590)
  • Page 733 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT An error occurs when the master 16#9A21 communicates with slave 1 in the PLC Link / Continue Keep Keep COM1 MODBUS.
  • Page 734 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT An error occurs when the master 16#9A32 communicates with slave 18 in the PLC Link / Continue Keep Keep COM1 MODBUS. (SM1591) An error occurs when the master 16#9A33 communicates with slave 19 in the PLC Link /...
  • Page 735 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT There is no response from slave 4 in the PLC 16#9A44 Continue Keep Keep Link / COM1 MODBUS. (SM1592) There is no response from slave 5 in the PLC 16#9A45 Continue...
  • Page 736 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT There is no response from slave 29 in the PLC 16#9A5D Continue Keep Keep Link / COM1 MODBUS. (SM1592) There is no response from slave 30 in the PLC 16#9A5E Continue Keep...
  • Page 737 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT A communication error occurs, when COM2 is 16#9B33 Continue Keep Keep connected to slave 19 by means of MODBUS. A communication error occurs, when COM2 is 16#9B34 Continue...
  • Page 738 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT There is no response when COM2 is 16#9B4E Continue Keep Keep connected to slave 14 by means of MODBUS. There is no response when COM2 is 16#9B4F Continue Keep...
  • Page 739 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT 16#B315 Invalid segment in connection path Continue Keep Keep The model number for the control mode CPU 16#E206 Continue Keep Keep and the standby mode CPU are not the same.
  • Page 740 Ch a pt er 7 Er r or C o des LED indicator status Error code Description Status ERROR FAULT Module on the main backplane slot 6 does not 16#E266 Continue Keep Keep support a redundancy system. Module on the main backplane slot 7 does not 16#E267 Continue Keep...
  • Page 741: Analog I/O Modules And Temperature Measurement Modules

    AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error code Description Status ERROR FAULT The network module IP of the control mode 16#E286 CPU on the main backplane slot 6 cannot be Continue Keep Keep detected.
  • Page 742 Ch a pt er 7 Er r or C o des LED indicator status Module Error code Description ERROR FAULT The signal received by channel 7 exceeds the range of 16#A007 Blinking inputs which can be received by the hardware. The signal received by channel 0 exceeds the range of 16#A400 inputs which can be received by the hardware.
  • Page 743: Ah02Hc-5A/Ah04Hc-5A

    AH 5 00 Pr ogr am m ing Ma n ua l 7.1.3 AH02HC-5A/AH04HC-5A LED indicator status Module Error code Description ERROR FAULT The linear accumulation in channel 0 exceeds the 16#A001 Blinking range. 16#A002 The prescale value for channel 0 exceeds the range. Blinking 16#A003 The moving average for channel 0 exceeds the range.
  • Page 744: Ah20Mc-5A

    Ch a pt er 7 Er r or C o des LED indicator status Module Error code Description Error FAULT The pointer used in JMP is the same as the pointer 16#A009 Blinking used in CALL. 16#A00B Target position (I) of the single speed is incorrect. Blinking Target position (II) of the single-axis motion is 16#A00C...
  • Page 745: Ah10En-5A / Ah-15En-5A

    AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Module Error code Description ERROR FAULT The pointer used in JMP is the same as the pointer 16#A009 Blinking used in CALL. 16#A00B Target position (I) of the single speed is incorrect. Blinking Target position (II) of the single-axis motion is 16#A00C...
  • Page 746: Ah10Scm-5A / Ah15Scm-5A

    Ch a pt er 7 Er r or C o des 7.1.7 AH10SCM-5A / AH15SCM-5A LED indicator status Module Error code Description ERROR FAULT The setting of the UD Link is incorrect, or the 16#A002 Blinking communication fails. 16#A401 Hardware error The communication through the communication port is 16#A804 incorrect.
  • Page 747: Ah10Pfbm-5A

    AH 5 00 Pr ogr am m ing Ma n ua l 7.1.9 AH10PFBM-5A LED indicator status Error MODULE Description code FAULT The red The green The green The green 16#A001 The master is not set. light light is light is light blinks.
  • Page 748: Ah10Copm-5A

    Ch a pt er 7 Er r or C o des LED indicator status Error Description MODULE code BUS FAULT The red light is The green light The green light 16#A4F3 Configuration error is ON. is ON. The red light is The green light The green light 16#A4F4 GPIO detection error...
  • Page 749 AH 5 00 Pr ogr am m ing Ma n ua l LED indicator status Error Description MODULE code BUS FAULT ERROR The node address of AH10COPM-5A is set 16#A0F5 Blinking incorrectly. Internal error: An error occurs in the manufacturing 16#A0F6 Blinking process in the factory.

Table of Contents